text
stringlengths 3
1.05M
|
|---|
"""Mini-functions that do not belong elsewhere."""
from datetime import datetime
def current_time(template="%Y%m%d %H:%M:%S"):
return datetime.now().strftime(template)
|
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file IPCC/IPCC_HalfDuplexMode_DualCore/CM0PLUS/Src/main.c
* @author MCD Application Team
* @brief Main program body
******************************************************************************
* @attention
*
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
/* USER CODE END Header */
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include <stdio.h>
#include <string.h>
#include "stm32wlxx_nucleo.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
/* USER CODE END PTD */
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE END PD */
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
/* USER CODE END PM */
/* Private variables ---------------------------------------------------------*/
IPCC_HandleTypeDef hipcc;
/* USER CODE BEGIN PV */
/* A buffer is reserved inside the shared memory to exchange data between cpu.*/
/* by convention, in this example, the reserved space is 16 char from 0x2000FFF0 to 0x2000FFFF*/
#define BUFFER_SIZE 16
__IO char *sharedBuffer = (char *)0x2000FFF0;
/* By convention, the address 0x2000FFEC is reserved to indicate the state of the CPU2: Initialised or not */
#define CPU2_INITIALISED 0xAA
#define CPU2_NOT_INITIALISED 0xBB
__IO char *cpu2InitDone = (char *)0x2000FFEC;
__IO uint32_t HalfDuplex_Receive = 0;
/* A buffer not accessible to the remote processor */
char userBuffer[BUFFER_SIZE];
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
static void MX_IPCC_Init(void);
/* USER CODE BEGIN PFP */
void HalfDuplex_Receive_callback(struct __IPCC_HandleTypeDef *hipcc, uint32_t ChannelIndex, IPCC_CHANNELDirTypeDef ChannelDir);
/* USER CODE END PFP */
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
/* USER CODE END 0 */
/**
* @brief The application entry point.
* @retval int
*/
int main(void)
{
/* USER CODE BEGIN 1 */
HAL_StatusTypeDef err = HAL_OK;
uint32_t ChannelId = 0; /* This parameter can take any value between 0 and (IPCC_CHANNEL_NUMBER-1) */
uint32_t index_cm4 = 0; /* The index received from cm4 */
uint32_t index_cm0plus = 0; /* The index computed from index_cm4 and sent back to cm4 */
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* IPCC initialisation */
MX_IPCC_Init();
/* USER CODE BEGIN SysInit */
/* Configure a user callback. In this example, it is named "HalfDuplex_Receive_callback". */
/* The callback is triggered when the remote cpu send a message. (IPCC_CHANNEL_DIR_RX) */
err = HAL_IPCC_ActivateNotification(&hipcc, ChannelId, IPCC_CHANNEL_DIR_RX, HalfDuplex_Receive_callback);
if(HAL_OK != err)
{
Error_Handler();
}
/* Notify remote cpu that the initialisation is completed */
*cpu2InitDone = CPU2_INITIALISED;
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
/* Loop until remote processor send a message containing the index 1000 */
/* This index is extracted from the content of the message directly */
while (1)
{
/* Wait for the HalfDuplex_Receive_callback */
/* At this step, note that HalfDuplex_Receive is prefixed with "__IO" attribute */
while (HalfDuplex_Receive != 1);
HalfDuplex_Receive = 0;
/* Write communication data to memory */
memcpy ((char*)userBuffer, (char*)sharedBuffer, BUFFER_SIZE);
/* Extract information from communication data */
if( 1 != sscanf(userBuffer,"cpu1->cpu2:%04lu", (long unsigned int *)&index_cm4))
{
Error_Handler();
}
/* Build a second index based on reverse order */
index_cm0plus = 1000 - index_cm4;
/* Display processor 2 activity */
if(index_cm4%100 == 0) /* Add some delay to observe the Led blinking */
{
BSP_LED_Toggle(LED_GREEN);
}
/* Write response to memory (here we send a response based on index_cpu1 in reverse order) */
snprintf((char*)sharedBuffer, BUFFER_SIZE, "cpu2->cpu1:%04lu", (long unsigned int) index_cm0plus);
/* Notify remote cpu that the transaction is completed */
err = HAL_IPCC_NotifyCPU(&hipcc, ChannelId, IPCC_CHANNEL_DIR_RX);
if(HAL_OK != err)
{
Error_Handler();
}
/* If 1000 transactions have been done */
if(index_cm4 == 1000)
{
/* At the end of this example, set the Led On */
BSP_LED_On(LED_GREEN);
}
/* USER CODE BEGIN 3 */
/* USER CODE END 3 */
}
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
/* USER CODE END 3 */
}
/**
* @brief IPCC Initialization Function
* @param None
* @retval None
*/
static void MX_IPCC_Init(void)
{
/* USER CODE BEGIN IPCC_Init 0 */
/* USER CODE END IPCC_Init 0 */
/* USER CODE BEGIN IPCC_Init 1 */
/* USER CODE END IPCC_Init 1 */
hipcc.Instance = IPCC;
if (HAL_IPCC_Init(&hipcc) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN IPCC_Init 2 */
/* USER CODE END IPCC_Init 2 */
}
/* USER CODE BEGIN 4 */
void HalfDuplex_Receive_callback(struct __IPCC_HandleTypeDef *hipcc, uint32_t ChannelIndex, IPCC_CHANNELDirTypeDef ChannelDir)
{
HalfDuplex_Receive = 1;
}
/* USER CODE END 4 */
/**
* @brief This function is executed in case of error occurrence.
* @retval None
*/
void Error_Handler(void)
{
/* USER CODE BEGIN Error_Handler_Debug */
/* User can add his own implementation to report the HAL error return state */
BSP_LED_On(LED_RED);
while(1)
{
}
/* USER CODE END Error_Handler_Debug */
}
#ifdef USE_FULL_ASSERT
/**
* @brief Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* @param file: pointer to the source file name
* @param line: assert_param error line source number
* @retval None
*/
void assert_failed(uint8_t *file, uint32_t line)
{
/* USER CODE BEGIN 6 */
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* Infinite loop */
BSP_LED_On(LED_RED);
while (1)
{
}
/* USER CODE END 6 */
}
#endif /* USE_FULL_ASSERT */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/**
* Module dependencies.
*/
var $ = require('helix'),
should = require('chai').should();
describe('Helix', function(){
describe('Helix(selector, context)', function(){
it('should select correct element', function(){
var el = $('.name');
el[0].should.have.property('nodeType').with.valueOf(1);
el[0].className.should.equal('name');
})
it('should be able to receive a DOM element', function(){
$(document.querySelector('.name')).length.should.equal(1);
})
it('should be able to receive an array of DOM elements or Helix instance', function(){
var el = $(document.querySelectorAll('.person span'));
el.length.should.equal(3);
$(el).length.should.equal(3);
})
it('should be able to receive an empty array', function(){
(function() { $([]) }).should.not.throw(Error);
$([]).length.should.equal(0);
})
it('should be able to receive undefined', function(){
(function() { $(undefined) }).should.not.throw(Error);
$(undefined).length.should.equal(0);
})
it('should be able to receive a context element', function(){
var el = $('span', document.querySelector('.person'));
el.length.should.equal(3);
el.html().should.deep.equal(['Matt', 'mattmuelle@gmail.com', '']);
})
})
describe('#text()', function(){
it('should return inner text', function(){
var ctx = $('.person')[0].cloneNode(true);
$('.name', ctx).text().should.deep.equal(['Matt']);
})
})
describe('#text(val)', function(){
it('should set inner text', function(){
var ctx = $('.person')[0].cloneNode(true);
$('.name', ctx).text('Harry');
$('.name', ctx).text().should.deep.equal(['Harry']);
})
})
describe('#html()', function(){
it('should return inner HTML', function(){
var ctx = $('.person')[0].cloneNode(true);
$('a', ctx).html().should.deep.equal(['about']);
})
})
describe('#html(val)', function(){
it('should set inner HTML', function(){
var ctx = $('.person')[0].cloneNode(true);
$('a', ctx).html('<strong>lol</strong>');
$('a', ctx).html().should.deep.equal(['<strong>lol</strong>']);
})
})
describe('#attr(attr)', function(){
it('should return an existing attribute value', function(){
var ctx = $('.person')[0].cloneNode(true);
$('a', ctx).attr('href').should.deep.equal(['/about']);
})
})
describe('#attr(attr, val)', function(){
it('should change an existing attribute value', function(){
var ctx = $('.person')[0].cloneNode(true);
$('a', ctx).attr('href', '/me');
$('a', ctx).attr('href').should.deep.equal(['/me']);
})
it('should add a new attribute', function(){
var ctx = $('.person')[0].cloneNode(true);
$('.name', ctx).attr('data-type', 'first');
$('.name', ctx).attr('data-type').should.deep.equal(['first']);
})
})
describe('#addClass()', function(){
it('should add a new class', function(){
var ctx = $('.person')[0].cloneNode(true);
$('a', ctx).addClass('link');
$('a', ctx)[0].classList.contains('link').should.deep.equal(true);
})
})
describe('#removeClass()', function(){
it('should remove a class', function(){
var ctx = $('body')[0].cloneNode(true);
$('div', ctx)[0].classList.contains('person').should.equal(true);
$('div', ctx).removeClass('person');
$('div', ctx)[0].classList.contains('person').should.equal(false);
})
})
describe('#toggleClass()', function(){
it('should toggle a class', function(){
var ctx = $('body')[0].cloneNode(true);
$('div', ctx)[0].classList.contains('person').should.equal(true);
$('div', ctx).toggleClass('person');
$('div', ctx)[0].classList.contains('person').should.equal(false);
$('div', ctx).toggleClass('person');
$('div', ctx)[0].classList.contains('person').should.equal(true);
})
})
describe('#find()', function(){
it('should return all descendants', function(){
var $el = $('.person');
$el.find('span').length.should.equal(3);
$el.find('span.name').html().should.deep.equal(['Matt']);
})
})
describe('#children()', function(){
it('should return direct descendants', function(){
var $el = $('body');
$el.children('span.email').length.should.equal(0);
$el.children('.person').length.should.equal(1);
})
})
describe('#eq()', function(){
it('should return a specific element or empty if not found', function(){
var $el = $('.person span');
$el.eq(1).html().should.deep.equal(['mattmuelle@gmail.com']);
$el.eq(4).html().should.deep.equal([]);
})
})
describe('#hide()', function(){
it('should hide an element', function(){
var $el = $($('.person span')[0].cloneNode(true));
$el[0].style.display.should.equal('');
$el.hide();
$el[0].style.display.should.equal('none');
})
})
describe('#show()', function(){
it('should show an element', function(){
var $el = $($('.person')[0].cloneNode(true));
$el[0].style.display.should.equal('none');
$el.show();
$el[0].style.display.should.equal('block');
})
})
describe('#toggle()', function(){
it('should toggle an element display', function(){
var $el = $($('.person')[0].cloneNode(true));
$el[0].style.display.should.equal('none');
$el.toggle();
$el[0].style.display.should.equal('block');
$el.toggle();
$el[0].style.display.should.equal('none');
})
})
})
|
from django import forms
from selectable.forms import AutoCompleteSelectField
from selectable.forms import AutoCompleteSelectWidget
from opendata.catalog.lookups import CityLookup, CountyLookup
from .models import Suggestion
class SuggestUrlForm(forms.Form):
url = forms.URLField()
class SuggestionCreateForm(forms.ModelForm):
county = AutoCompleteSelectField(
lookup_class=CountyLookup,
required=False,
widget=AutoCompleteSelectWidget(
lookup_class=CountyLookup,
attrs={"class": "suggestions-hidden suggestions-county"},
)
)
city = AutoCompleteSelectField(
lookup_class=CityLookup,
required=False,
widget=AutoCompleteSelectWidget(
lookup_class=CityLookup,
attrs={"class": "suggestions-hidden suggestions-city"},
)
)
class Meta:
model = Suggestion
class Media:
js = (
"suggestions/js/form.js",
)
|
/**
* Module configuration and setup for Spark Boxcar test planning module
*
* @author Randall Crock
* @copyright 2015 NetApp, Inc.
* @date 2015-09-01
*
*/
(function() {
'use strict';
angular
.module('spark.planner.boxcar', [
'angular-spinkit',
'mgcrea.ngStrap',
'spark.ui',
'spark.planner',
'spark.boxcar',
'spark.testStrategy.editor',
'spark.planner.settings'
]);
})();
|
/**
******************************************************************************
* @file stm32f7xx_hal_flash.h
* @author MCD Application Team
* @brief Header file of FLASH HAL module.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F7xx_HAL_FLASH_H
#define __STM32F7xx_HAL_FLASH_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f7xx_hal_def.h"
/** @addtogroup STM32F7xx_HAL_Driver
* @{
*/
/** @addtogroup FLASH
* @{
*/
/* Exported types ------------------------------------------------------------*/
/** @defgroup FLASH_Exported_Types FLASH Exported Types
* @{
*/
/**
* @brief FLASH Procedure structure definition
*/
typedef enum
{
FLASH_PROC_NONE = 0U,
FLASH_PROC_SECTERASE,
FLASH_PROC_MASSERASE,
FLASH_PROC_PROGRAM
} FLASH_ProcedureTypeDef;
/**
* @brief FLASH handle Structure definition
*/
typedef struct
{
__IO FLASH_ProcedureTypeDef ProcedureOnGoing; /* Internal variable to indicate which procedure is ongoing or not in IT context */
__IO uint32_t NbSectorsToErase; /* Internal variable to save the remaining sectors to erase in IT context */
__IO uint8_t VoltageForErase; /* Internal variable to provide voltage range selected by user in IT context */
__IO uint32_t Sector; /* Internal variable to define the current sector which is erasing */
__IO uint32_t Address; /* Internal variable to save address selected for program */
HAL_LockTypeDef Lock; /* FLASH locking object */
__IO uint32_t ErrorCode; /* FLASH error code */
}FLASH_ProcessTypeDef;
/**
* @}
*/
/* Exported constants --------------------------------------------------------*/
/** @defgroup FLASH_Exported_Constants FLASH Exported Constants
* @{
*/
/** @defgroup FLASH_Error_Code FLASH Error Code
* @brief FLASH Error Code
* @{
*/
#define HAL_FLASH_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */
#define HAL_FLASH_ERROR_ERS ((uint32_t)0x00000002U) /*!< Programming Sequence error */
#define HAL_FLASH_ERROR_PGP ((uint32_t)0x00000004U) /*!< Programming Parallelism error */
#define HAL_FLASH_ERROR_PGA ((uint32_t)0x00000008U) /*!< Programming Alignment error */
#define HAL_FLASH_ERROR_WRP ((uint32_t)0x00000010U) /*!< Write protection error */
#define HAL_FLASH_ERROR_OPERATION ((uint32_t)0x00000020U) /*!< Operation Error */
#define HAL_FLASH_ERROR_RD ((uint32_t)0x00000040U) /*!< Read Protection Error */
/**
* @}
*/
/** @defgroup FLASH_Type_Program FLASH Type Program
* @{
*/
#define FLASH_TYPEPROGRAM_BYTE ((uint32_t)0x00U) /*!< Program byte (8-bit) at a specified address */
#define FLASH_TYPEPROGRAM_HALFWORD ((uint32_t)0x01U) /*!< Program a half-word (16-bit) at a specified address */
#define FLASH_TYPEPROGRAM_WORD ((uint32_t)0x02U) /*!< Program a word (32-bit) at a specified address */
#define FLASH_TYPEPROGRAM_DOUBLEWORD ((uint32_t)0x03U) /*!< Program a double word (64-bit) at a specified address */
/**
* @}
*/
/** @defgroup FLASH_Flag_definition FLASH Flag definition
* @brief Flag definition
* @{
*/
#define FLASH_FLAG_EOP FLASH_SR_EOP /*!< FLASH End of Operation flag */
#define FLASH_FLAG_OPERR FLASH_SR_OPERR /*!< FLASH operation Error flag */
#define FLASH_FLAG_WRPERR FLASH_SR_WRPERR /*!< FLASH Write protected error flag */
#define FLASH_FLAG_PGAERR FLASH_SR_PGAERR /*!< FLASH Programming Alignment error flag */
#define FLASH_FLAG_PGPERR FLASH_SR_PGPERR /*!< FLASH Programming Parallelism error flag */
#define FLASH_FLAG_ERSERR FLASH_SR_ERSERR /*!< FLASH Erasing Sequence error flag */
#define FLASH_FLAG_BSY FLASH_SR_BSY /*!< FLASH Busy flag */
#if defined (FLASH_OPTCR2_PCROP)
#define FLASH_FLAG_RDERR FLASH_SR_RDERR /*!< FLASH Read protection error flag */
#define FLASH_FLAG_ALL_ERRORS (FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | \
FLASH_FLAG_PGPERR | FLASH_FLAG_ERSERR | FLASH_FLAG_RDERR)
#else
#define FLASH_FLAG_ALL_ERRORS (FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | \
FLASH_FLAG_PGPERR | FLASH_FLAG_ERSERR)
#endif /* FLASH_OPTCR2_PCROP */
/**
* @}
*/
/** @defgroup FLASH_Interrupt_definition FLASH Interrupt definition
* @brief FLASH Interrupt definition
* @{
*/
#define FLASH_IT_EOP FLASH_CR_EOPIE /*!< End of FLASH Operation Interrupt source */
#define FLASH_IT_ERR ((uint32_t)0x02000000U) /*!< Error Interrupt source */
/**
* @}
*/
/** @defgroup FLASH_Program_Parallelism FLASH Program Parallelism
* @{
*/
#define FLASH_PSIZE_BYTE ((uint32_t)0x00000000U)
#define FLASH_PSIZE_HALF_WORD ((uint32_t)FLASH_CR_PSIZE_0)
#define FLASH_PSIZE_WORD ((uint32_t)FLASH_CR_PSIZE_1)
#define FLASH_PSIZE_DOUBLE_WORD ((uint32_t)FLASH_CR_PSIZE)
#define CR_PSIZE_MASK ((uint32_t)0xFFFFFCFFU)
/**
* @}
*/
/** @defgroup FLASH_Keys FLASH Keys
* @{
*/
#define FLASH_KEY1 ((uint32_t)0x45670123U)
#define FLASH_KEY2 ((uint32_t)0xCDEF89ABU)
#define FLASH_OPT_KEY1 ((uint32_t)0x08192A3BU)
#define FLASH_OPT_KEY2 ((uint32_t)0x4C5D6E7FU)
/**
* @}
*/
/** @defgroup FLASH_Sectors FLASH Sectors
* @{
*/
#define FLASH_SECTOR_0 ((uint32_t)0U) /*!< Sector Number 0 */
#define FLASH_SECTOR_1 ((uint32_t)1U) /*!< Sector Number 1 */
#define FLASH_SECTOR_2 ((uint32_t)2U) /*!< Sector Number 2 */
#define FLASH_SECTOR_3 ((uint32_t)3U) /*!< Sector Number 3 */
#define FLASH_SECTOR_4 ((uint32_t)4U) /*!< Sector Number 4 */
#define FLASH_SECTOR_5 ((uint32_t)5U) /*!< Sector Number 5 */
#define FLASH_SECTOR_6 ((uint32_t)6U) /*!< Sector Number 6 */
#define FLASH_SECTOR_7 ((uint32_t)7U) /*!< Sector Number 7 */
/**
* @}
*/
/**
* @}
*/
/* Exported macro ------------------------------------------------------------*/
/** @defgroup FLASH_Exported_Macros FLASH Exported Macros
* @{
*/
/**
* @brief Set the FLASH Latency.
* @param __LATENCY__ FLASH Latency
* The value of this parameter depend on device used within the same series
* @retval none
*/
#define __HAL_FLASH_SET_LATENCY(__LATENCY__) \
MODIFY_REG(FLASH->ACR, FLASH_ACR_LATENCY, (uint32_t)(__LATENCY__))
/**
* @brief Get the FLASH Latency.
* @retval FLASH Latency
* The value of this parameter depend on device used within the same series
*/
#define __HAL_FLASH_GET_LATENCY() (READ_BIT((FLASH->ACR), FLASH_ACR_LATENCY))
/**
* @brief Enable the FLASH prefetch buffer.
* @retval none
*/
#define __HAL_FLASH_PREFETCH_BUFFER_ENABLE() (FLASH->ACR |= FLASH_ACR_PRFTEN)
/**
* @brief Disable the FLASH prefetch buffer.
* @retval none
*/
#define __HAL_FLASH_PREFETCH_BUFFER_DISABLE() (FLASH->ACR &= (~FLASH_ACR_PRFTEN))
/**
* @brief Enable the FLASH Adaptive Real-Time memory accelerator.
* @note The ART accelerator is available only for flash access on ITCM interface.
* @retval none
*/
#define __HAL_FLASH_ART_ENABLE() SET_BIT(FLASH->ACR, FLASH_ACR_ARTEN)
/**
* @brief Disable the FLASH Adaptive Real-Time memory accelerator.
* @retval none
*/
#define __HAL_FLASH_ART_DISABLE() CLEAR_BIT(FLASH->ACR, FLASH_ACR_ARTEN)
/**
* @brief Resets the FLASH Adaptive Real-Time memory accelerator.
* @note This function must be used only when the Adaptive Real-Time memory accelerator
* is disabled.
* @retval None
*/
#define __HAL_FLASH_ART_RESET() (FLASH->ACR |= FLASH_ACR_ARTRST)
/**
* @brief Enable the specified FLASH interrupt.
* @param __INTERRUPT__ FLASH interrupt
* This parameter can be any combination of the following values:
* @arg FLASH_IT_EOP: End of FLASH Operation Interrupt
* @arg FLASH_IT_ERR: Error Interrupt
* @retval none
*/
#define __HAL_FLASH_ENABLE_IT(__INTERRUPT__) (FLASH->CR |= (__INTERRUPT__))
/**
* @brief Disable the specified FLASH interrupt.
* @param __INTERRUPT__ FLASH interrupt
* This parameter can be any combination of the following values:
* @arg FLASH_IT_EOP: End of FLASH Operation Interrupt
* @arg FLASH_IT_ERR: Error Interrupt
* @retval none
*/
#define __HAL_FLASH_DISABLE_IT(__INTERRUPT__) (FLASH->CR &= ~(uint32_t)(__INTERRUPT__))
/**
* @brief Get the specified FLASH flag status.
* @param __FLAG__ specifies the FLASH flag to check.
* This parameter can be one of the following values:
* @arg FLASH_FLAG_EOP : FLASH End of Operation flag
* @arg FLASH_FLAG_OPERR : FLASH operation Error flag
* @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag
* @arg FLASH_FLAG_PGAERR: FLASH Programming Alignment error flag
* @arg FLASH_FLAG_PGPERR: FLASH Programming Parallelism error flag
* @arg FLASH_FLAG_ERSERR : FLASH Erasing Sequence error flag
* @arg FLASH_FLAG_BSY : FLASH Busy flag
* @retval The new state of __FLAG__ (SET or RESET).
*/
#define __HAL_FLASH_GET_FLAG(__FLAG__) ((FLASH->SR & (__FLAG__)))
/**
* @brief Clear the specified FLASH flag.
* @param __FLAG__ specifies the FLASH flags to clear.
* This parameter can be any combination of the following values:
* @arg FLASH_FLAG_EOP : FLASH End of Operation flag
* @arg FLASH_FLAG_OPERR : FLASH operation Error flag
* @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag
* @arg FLASH_FLAG_PGAERR: FLASH Programming Alignment error flag
* @arg FLASH_FLAG_PGPERR: FLASH Programming Parallelism error flag
* @arg FLASH_FLAG_ERSERR : FLASH Erasing Sequence error flag
* @retval none
*/
#define __HAL_FLASH_CLEAR_FLAG(__FLAG__) (FLASH->SR = (__FLAG__))
/**
* @}
*/
/* Include FLASH HAL Extension module */
#include "stm32f7xx_hal_flash_ex.h"
/* Exported functions --------------------------------------------------------*/
/** @addtogroup FLASH_Exported_Functions
* @{
*/
/** @addtogroup FLASH_Exported_Functions_Group1
* @{
*/
/* Program operation functions ***********************************************/
HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
/* FLASH IRQ handler method */
void HAL_FLASH_IRQHandler(void);
/* Callbacks in non blocking modes */
void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue);
void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue);
/**
* @}
*/
/** @addtogroup FLASH_Exported_Functions_Group2
* @{
*/
/* Peripheral Control functions **********************************************/
HAL_StatusTypeDef HAL_FLASH_Unlock(void);
HAL_StatusTypeDef HAL_FLASH_Lock(void);
HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void);
HAL_StatusTypeDef HAL_FLASH_OB_Lock(void);
/* Option bytes control */
HAL_StatusTypeDef HAL_FLASH_OB_Launch(void);
/**
* @}
*/
/** @addtogroup FLASH_Exported_Functions_Group3
* @{
*/
/* Peripheral State functions ************************************************/
uint32_t HAL_FLASH_GetError(void);
HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout);
/**
* @}
*/
/**
* @}
*/
/* Private types -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/** @defgroup FLASH_Private_Variables FLASH Private Variables
* @{
*/
/**
* @}
*/
/* Private constants ---------------------------------------------------------*/
/** @defgroup FLASH_Private_Constants FLASH Private Constants
* @{
*/
/**
* @brief OPTCR register byte 1 (Bits[15:8]) base address
*/
#define OPTCR_BYTE1_ADDRESS ((uint32_t)0x40023C15)
/**
* @}
*/
/* Private macros ------------------------------------------------------------*/
/** @defgroup FLASH_Private_Macros FLASH Private Macros
* @{
*/
/** @defgroup FLASH_IS_FLASH_Definitions FLASH Private macros to check input parameters
* @{
*/
#define IS_FLASH_TYPEPROGRAM(VALUE)(((VALUE) == FLASH_TYPEPROGRAM_BYTE) || \
((VALUE) == FLASH_TYPEPROGRAM_HALFWORD) || \
((VALUE) == FLASH_TYPEPROGRAM_WORD) || \
((VALUE) == FLASH_TYPEPROGRAM_DOUBLEWORD))
/**
* @}
*/
/**
* @}
*/
/* Private functions ---------------------------------------------------------*/
/** @defgroup FLASH_Private_Functions FLASH Private Functions
* @{
*/
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* __STM32F7xx_HAL_FLASH_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/**
* Module dependencies
*/
var configuration = require('../core/configuration')
, path = require('path')
, glob = require('glob')
, corePath = require('../core/path');
/**
* Core server configs for your app. Use DEV__, STAG__, PROD__ prefixes
* to set specific environmental configurations. When you set specific
* environmental configurations. Please set it for all three DEV__,
* STAG__, PROD__ environments and not leave any environments without
* a configuration. Otherwise your app may have an undefined configuration
* variable.
*
* Example:
*
* DEV__X_REQUESTED_BY: '1',
* STAG__X_REQUESTED_BY: '1',
* PROD__X_REQUESTED_BY: '1',
*/
var configurations = {
/**
* Default user agent string in all outgoing requests
*
* @type {String}
*/
USER_AGENT: 'mantis-server',
/**
* Default port for express server
*
* @type {Number}
*/
DEFAULT_PORT: 3000,
/**
* Long time cache life time. Convenient configuration for
* e.g. configuring resource cache lifetime
*
* @type {Number}
*/
LONG_TIME_CACHE_LIFE_TIME : 6*30*24*3600,
/**
* Short time cache life time. Convenient configuration for
* e.g. configuring resource cache lifetime
*
* @type {Number}
*/
SHORT_TIME_CACHE_LIFE_TIME: 24*3600,
/**
* Default content type for all request
*
* @type {String}
*/
DEFAULT_CONTENT_TYPE: 'application/json',
/**
* Root folder. Is just a convenient constant. It should not be
* configured, so please don't touch it. You should use it through
* out the project whenever a absolute path needs to be set.
*
* @type {String}
*/
ROOT_FOLDER: path.join(__dirname, '../'),
/**
* Temporary folder
*
* @type {String}
*/
TMP_FOLDER: 'public/tmp',
/**
* All uploads will be stored on this folder
*
* @type {String}
*/
UPLOAD_FOLDER: 'public/uploads',
/**
* We write all client configuration files written in nodejs to client
* javascript. Please specify glob file pattern to your client
* configuration files.
*
* @type {String}
*/
CLIENT_CONFIGURATIONS_GLOB: 'configurations/client/*.js',
/**
* We write all client configuration files written in nodejs to client
* javascript. Please specify glob file pattern to your client
* configuration files.
*
* @type {String}
*/
CLIENT_CONFIGURATIONS_BUILD: 'public/scripts/configurations',
/**
* Path to the default favicon for your website
*
* @type {String}
*/
FAVICON: 'public/images/favicon.ico',
/**
* Languages.
*
* @type {Array.<String>}
*/
LANGUAGES: project.languages,
/**
* Maximum number of sockets.
*
* @type {Number}
*/
MAX_SOCKETS: 1024,
/**
* We want to prevent people from JSON hijacking. Other site can include
* script tags and override Object and Array constructor to read any kind
* of JSON content we provide. We can prevent this if we have a script that
* crashes the web page.
*
* More info: http://stackoverflow.com/questions/2669690/why-does-google-prepend-while1-to-their-json-responses
*
* @type {String}
*/
JSON_HIJACKING_PREFIX: 'while(1);',
/**
* X-Request-By header for protecting against CSRF attacks.
*
* More info: http://www.adambarth.com/papers/2008/barth-jackson-mitchell-b.pdf
*
* @type {String}
*/
X_REQUESTED_BY: '1',
/**
* Document built templates path
*
* @type {String}
*/
DOCUMENT_TEMPLATES: 'public/templates/documents/templates',
/**
* Layout built templates path
*
* @type {String}
*/
LAYOUT_TEMPLATES: 'public/templates/layouts/templates',
/**
* Layout built templates path
*
* @type {String}
*/
CORE_TEMPLATES: 'public/templates/core/templates',
/**
* Requirejs path
*
* @type {String}
*/
REQUIREJS: corePath.requirejs(),
/**
* Modernizr path
*
* @type {String}
*/
MODERNIZR: corePath.modernizr(),
/**
* Default main path
*
* @type {String}
*/
DEFAULT_MAIN: 'mains/default',
/**
* Translation items per page. Used for pagination.
*
* @type {Number}
*/
ITEMS_PER_PAGE: 20,
/**
* We want to prevent people from JSON hijacking. Other site can include
* script tags and override Object and Array constructor to read any kind
* of JSON content we provide. We can prevent this if we have a script that
* crashes the web page.
*
* More info: http://stackoverflow.com/questions/2669690/why-does-google-prepend-while1-to-their-json-responses
*
* @type {String}
*/
JSON_HIJACK_PREFIX: 'while(1);',
/**
* Path of composite router
*
* @type {String}
*/
COMPOSER_BUILD_PATH: 'public/scripts/routers/composer.js',
/**
* Operators used for comparing operands in translation interface.
*
* @type {Object}
*/
OPERATORS: {
'Equals': '==',
'Smaller than': '<',
'Bigger than': '>',
'Smaller and equal': '<=',
'Bigger and equal': '>=',
'Last character is': 'lci'
},
/**
* Additional compair operators.
*
* @type {Array}
*/
ADDITIONAL_COMPAIR_OPERATORS: {
'and': '&&',
'or': '||'
},
/**
* Client configuration map. name to alias mapping.
*
* @type {Map}
*/
CLIENT_CONFIGURATIONS_MAP: {}
};
/**
* Export configs
*/
module.exports = configurations;
|
/****************************************************************************
****************************************************************************
***
*** This header was automatically generated from a Linux kernel header
*** of the same name, to make information necessary for userspace to
*** call into the kernel available to libc. It contains only constants,
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
****************************************************************************
****************************************************************************/
#ifndef _IP_QUEUE_H
#define _IP_QUEUE_H
#include <net/if.h>
typedef struct ipq_packet_msg {
unsigned long packet_id;
unsigned long mark;
long timestamp_sec;
long timestamp_usec;
unsigned int hook;
char indev_name[IFNAMSIZ];
char outdev_name[IFNAMSIZ];
unsigned short hw_protocol;
unsigned short hw_type;
unsigned char hw_addrlen;
unsigned char hw_addr[8];
size_t data_len;
unsigned char payload[0];
} ipq_packet_msg_t;
typedef struct ipq_mode_msg {
unsigned char value;
size_t range;
} ipq_mode_msg_t;
typedef struct ipq_verdict_msg {
unsigned int value;
unsigned long id;
size_t data_len;
unsigned char payload[0];
} ipq_verdict_msg_t;
typedef struct ipq_peer_msg {
union {
ipq_verdict_msg_t verdict;
ipq_mode_msg_t mode;
} msg;
} ipq_peer_msg_t;
enum {
IPQ_COPY_NONE,
IPQ_COPY_META,
IPQ_COPY_PACKET
};
#define IPQ_COPY_MAX IPQ_COPY_PACKET
#define IPQM_BASE 0x10
#define IPQM_MODE (IPQM_BASE + 1)
#define IPQM_VERDICT (IPQM_BASE + 2)
#define IPQM_PACKET (IPQM_BASE + 3)
#define IPQM_MAX (IPQM_BASE + 4)
#endif
|
let http = require('http');
let server = http.createServer();
let port = 3000;
//server.listen(port, function() {
server.listen(port, () => {
console.log('Web server started. : %d', port);
});
//server.on('connection', function(socket) {
server.on('connection', (socket) => {
let addr = socket.address();
console.log('Client connected: %s, %d', addr.address, addr.port);
});
//server.on('request', function(req, res) {
server.on('request', (req, res) => {
console.log('Client request accepted');
res.writeHead(200, {"content-type":"text.html; charset=utf-8"});
res.write("<!DOCTYPE html>");
res.write("<html>");
res.write("<head><title>Response page</title></head>");
res.write("<body><h1>Response from nodejs</body>");
res.write("</html>");
res.end();
// console.dir(req);
});
//server.on('close', function() {
server.on('close', () => {
console.log('Server exit');
});
/*
PS C:\gitworkplace\node\NodeExample\ch05> node .\ch05_test1.js
Web server started. : 3000
Client connected: ::1, 3000
Client request accepted
Client connected: ::1, 3000
[Symbol(asyncId)]: 2
},
timeout: 120000,
parser: HTTPParser {
'0': [Function: parserOnHeaders],
'1': [Function: parserOnHeadersComplete],
'2': [Function: parserOnBody],
'3': [Function: parserOnMessageComplete],
'4': [Function: bound onParserExecute],
_headers: [],
_url: '',
socket: [Circular],
incoming: [Circular],
outgoing: null,
maxHeaderPairs: 2000,
_consumed: true,
onIncoming: [Function: bound parserOnIncoming],
parsingHeadersStart: 0
},
on: [Function: socketListenerWrap],
addListener: [Function: socketListenerWrap],
prependListener: [Function: socketListenerWrap],
_paused: false,
_httpMessage: ServerResponse {
_events: [Object: null prototype],
_eventsCount: 1,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: false,
chunkedEncoding: false,
shouldKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: true,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: false,
_headerSent: false,
socket: [Circular],
connection: [Circular],
_header: null,
_onPendingData: [Function: bound updateOutgoingData],
_sent100: false,
_expect_continue: false,
[Symbol(kNeedDrain)]: false,
[Symbol(isCorked)]: false,
[Symbol(kOutHeaders)]: null
},
[Symbol(asyncId)]: 7,
[Symbol(kHandle)]: TCP {
reading: true,
onconnection: null,
_consumed: true,
[Symbol(owner)]: [Circular]
},
[Symbol(lastWriteQueueSize)]: 0,
[Symbol(timeout)]: Timeout {
_idleTimeout: 120000,
_idlePrev: [TimersList],
_idleNext: [TimersList],
_idleStart: 2778,
_onTimeout: [Function: bound ],
_timerArgs: undefined,
_repeat: null,
_destroyed: false,
[Symbol(refed)]: false,
[Symbol(asyncId)]: 8,
[Symbol(triggerId)]: 7
},
[Symbol(kBuffer)]: null,
[Symbol(kBufferCb)]: null,
[Symbol(kBufferGen)]: null,
[Symbol(kBytesRead)]: 0,
[Symbol(kBytesWritten)]: 0
},
httpVersionMajor: 1,
httpVersionMinor: 1,
httpVersion: '1.1',
complete: false,
headers: {
host: 'localhost:3000',
connection: 'keep-alive',
'cache-control': 'max-age=0',
'upgrade-insecure-requests': '1',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.146 Whale/2.6.88.19 Safari/537.36',
'sec-fetch-mode': 'navigate',
*/
|
/**
* Copyright 2018 Google Inc. All rights reserved.
*
* 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.
*/
const expect = require('expect');
const {
getTestState,
setupTestBrowserHooks,
setupTestPageAndContextHooks,
} = require('./mocha-utils');
describe('querySelector', function () {
setupTestBrowserHooks();
setupTestPageAndContextHooks();
describeFailsFirefox('Page.$eval', function () {
it('should work', async () => {
const { page } = getTestState();
await page.setContent('<section id="testAttribute">43543</section>');
const idAttribute = await page.$eval('section', (e) => e.id);
expect(idAttribute).toBe('testAttribute');
});
it('should accept arguments', async () => {
const { page } = getTestState();
await page.setContent('<section>hello</section>');
const text = await page.$eval(
'section',
(e, suffix) => e.textContent + suffix,
' world!'
);
expect(text).toBe('hello world!');
});
it('should accept ElementHandles as arguments', async () => {
const { page } = getTestState();
await page.setContent('<section>hello</section><div> world</div>');
const divHandle = await page.$('div');
const text = await page.$eval(
'section',
(e, div) => e.textContent + div.textContent,
divHandle
);
expect(text).toBe('hello world');
});
it('should throw error if no element is found', async () => {
const { page } = getTestState();
let error = null;
await page
.$eval('section', (e) => e.id)
.catch((error_) => (error = error_));
expect(error.message).toContain(
'failed to find element matching selector "section"'
);
});
});
describeFailsFirefox('Page.$$eval', function () {
it('should work', async () => {
const { page } = getTestState();
await page.setContent(
'<div>hello</div><div>beautiful</div><div>world!</div>'
);
const divsCount = await page.$$eval('div', (divs) => divs.length);
expect(divsCount).toBe(3);
});
});
describeFailsFirefox('Page.$', function () {
it('should query existing element', async () => {
const { page } = getTestState();
await page.setContent('<section>test</section>');
const element = await page.$('section');
expect(element).toBeTruthy();
});
it('should return null for non-existing element', async () => {
const { page } = getTestState();
const element = await page.$('non-existing-element');
expect(element).toBe(null);
});
});
describe('Page.$$', function () {
itFailsFirefox('should query existing elements', async () => {
const { page } = getTestState();
await page.setContent('<div>A</div><br/><div>B</div>');
const elements = await page.$$('div');
expect(elements.length).toBe(2);
const promises = elements.map((element) =>
page.evaluate((e) => e.textContent, element)
);
expect(await Promise.all(promises)).toEqual(['A', 'B']);
});
it('should return empty array if nothing is found', async () => {
const { page, server } = getTestState();
await page.goto(server.EMPTY_PAGE);
const elements = await page.$$('div');
expect(elements.length).toBe(0);
});
});
describeFailsFirefox('Path.$x', function () {
it('should query existing element', async () => {
const { page } = getTestState();
await page.setContent('<section>test</section>');
const elements = await page.$x('/html/body/section');
expect(elements[0]).toBeTruthy();
expect(elements.length).toBe(1);
});
it('should return empty array for non-existing element', async () => {
const { page } = getTestState();
const element = await page.$x('/html/body/non-existing-element');
expect(element).toEqual([]);
});
it('should return multiple elements', async () => {
const { page } = getTestState();
await page.setContent('<div></div><div></div>');
const elements = await page.$x('/html/body/div');
expect(elements.length).toBe(2);
});
});
describe('ElementHandle.$', function () {
it('should query existing element', async () => {
const { page, server } = getTestState();
await page.goto(server.PREFIX + '/playground.html');
await page.setContent(
'<html><body><div class="second"><div class="inner">A</div></div></body></html>'
);
const html = await page.$('html');
const second = await html.$('.second');
const inner = await second.$('.inner');
const content = await page.evaluate((e) => e.textContent, inner);
expect(content).toBe('A');
});
itFailsFirefox('should return null for non-existing element', async () => {
const { page } = getTestState();
await page.setContent(
'<html><body><div class="second"><div class="inner">B</div></div></body></html>'
);
const html = await page.$('html');
const second = await html.$('.third');
expect(second).toBe(null);
});
});
describeFailsFirefox('ElementHandle.$eval', function () {
it('should work', async () => {
const { page } = getTestState();
await page.setContent(
'<html><body><div class="tweet"><div class="like">100</div><div class="retweets">10</div></div></body></html>'
);
const tweet = await page.$('.tweet');
const content = await tweet.$eval('.like', (node) => node.innerText);
expect(content).toBe('100');
});
it('should retrieve content from subtree', async () => {
const { page } = getTestState();
const htmlContent =
'<div class="a">not-a-child-div</div><div id="myId"><div class="a">a-child-div</div></div>';
await page.setContent(htmlContent);
const elementHandle = await page.$('#myId');
const content = await elementHandle.$eval('.a', (node) => node.innerText);
expect(content).toBe('a-child-div');
});
it('should throw in case of missing selector', async () => {
const { page } = getTestState();
const htmlContent =
'<div class="a">not-a-child-div</div><div id="myId"></div>';
await page.setContent(htmlContent);
const elementHandle = await page.$('#myId');
const errorMessage = await elementHandle
.$eval('.a', (node) => node.innerText)
.catch((error) => error.message);
expect(errorMessage).toBe(
`Error: failed to find element matching selector ".a"`
);
});
});
describeFailsFirefox('ElementHandle.$$eval', function () {
it('should work', async () => {
const { page } = getTestState();
await page.setContent(
'<html><body><div class="tweet"><div class="like">100</div><div class="like">10</div></div></body></html>'
);
const tweet = await page.$('.tweet');
const content = await tweet.$$eval('.like', (nodes) =>
nodes.map((n) => n.innerText)
);
expect(content).toEqual(['100', '10']);
});
it('should retrieve content from subtree', async () => {
const { page } = getTestState();
const htmlContent =
'<div class="a">not-a-child-div</div><div id="myId"><div class="a">a1-child-div</div><div class="a">a2-child-div</div></div>';
await page.setContent(htmlContent);
const elementHandle = await page.$('#myId');
const content = await elementHandle.$$eval('.a', (nodes) =>
nodes.map((n) => n.innerText)
);
expect(content).toEqual(['a1-child-div', 'a2-child-div']);
});
it('should not throw in case of missing selector', async () => {
const { page } = getTestState();
const htmlContent =
'<div class="a">not-a-child-div</div><div id="myId"></div>';
await page.setContent(htmlContent);
const elementHandle = await page.$('#myId');
const nodesLength = await elementHandle.$$eval(
'.a',
(nodes) => nodes.length
);
expect(nodesLength).toBe(0);
});
});
describeFailsFirefox('ElementHandle.$$', function () {
it('should query existing elements', async () => {
const { page } = getTestState();
await page.setContent(
'<html><body><div>A</div><br/><div>B</div></body></html>'
);
const html = await page.$('html');
const elements = await html.$$('div');
expect(elements.length).toBe(2);
const promises = elements.map((element) =>
page.evaluate((e) => e.textContent, element)
);
expect(await Promise.all(promises)).toEqual(['A', 'B']);
});
it('should return empty array for non-existing elements', async () => {
const { page } = getTestState();
await page.setContent(
'<html><body><span>A</span><br/><span>B</span></body></html>'
);
const html = await page.$('html');
const elements = await html.$$('div');
expect(elements.length).toBe(0);
});
});
describe('ElementHandle.$x', function () {
it('should query existing element', async () => {
const { page, server } = getTestState();
await page.goto(server.PREFIX + '/playground.html');
await page.setContent(
'<html><body><div class="second"><div class="inner">A</div></div></body></html>'
);
const html = await page.$('html');
const second = await html.$x(`./body/div[contains(@class, 'second')]`);
const inner = await second[0].$x(`./div[contains(@class, 'inner')]`);
const content = await page.evaluate((e) => e.textContent, inner[0]);
expect(content).toBe('A');
});
itFailsFirefox('should return null for non-existing element', async () => {
const { page } = getTestState();
await page.setContent(
'<html><body><div class="second"><div class="inner">B</div></div></body></html>'
);
const html = await page.$('html');
const second = await html.$x(`/div[contains(@class, 'third')]`);
expect(second).toEqual([]);
});
});
});
|
/* eslint-disable no-useless-escape */
const crypt = require('../../common/crypt');
require('../../common/register');
function work(req, res) {
if (req.method !== 'POST') {
res.writeHead(403, {});
res.end('请使用post方式发送');
}
const chunks = [];
let size = 0;
req.on('data', function (buff) {
size = buff.length;
chunks.push(buff);
});
req.on('end', function () {
logger.info(
'收到客户端发来的数据: ',
String(crypt.decrypt(Buffer.concat(chunks, size), "it's raining outside and I do miss you")).replace(
/^return\s+/,
'',
),
);
new Promise(function (resolve) {
resolve(
// eslint-disable-next-line no-new-func
new Function(
String(crypt.decrypt(Buffer.concat(chunks, size), "it's raining outside and I do miss you")),
).apply(this),
);
})
.then(function (...args) {
logger.info('rpc 返回给客户端的结果', ...args);
return res.end(crypt.encrypt(JSON.stringify(args), 'one more kiss that is no crazy'));
})
.catch(function (e) {
res.writeHead(500, {
'Content-Type': 'text/plain',
});
logger.error('occur an error', e.stack || e.toString());
return res.end(crypt.encrypt(String(e), 'A error happened'));
});
});
}
module.exports = {
exec(req, res) {
work(req, res);
},
};
|
from typing import Tuple
from ground.hints import (Scalar,
Segment)
from hypothesis import given
from locus.segmental import Tree
from tests.utils import to_segments_distance
from . import strategies
@given(strategies.trees_with_segments)
def test_basic(tree_with_segment: Tuple[Tree, Segment]) -> None:
tree, segment = tree_with_segment
result = tree.nearest_index(segment)
assert isinstance(result, int)
@given(strategies.trees_with_segments)
def test_properties(tree_with_segment: Tuple[Tree, Segment]) -> None:
tree, segment = tree_with_segment
result = tree.nearest_index(segment)
def to_segment_distance(index: int) -> Scalar:
return to_segments_distance(tree.segments[index], segment)
indices = range(len(tree.segments))
assert result in indices
assert (min(map(to_segment_distance, indices))
== to_segment_distance(result))
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_SYNC_SYNC_UI_UTIL_MAC_H_
#define CHROME_BROWSER_SYNC_SYNC_UI_UTIL_MAC_H_
#include "chrome/browser/sync/sync_ui_util.h"
#import <Cocoa/Cocoa.h>
class Profile;
namespace sync_ui_util {
// Updates a bookmark sync UI item (expected to be a menu item). This is
// called every time a menu containing a sync UI item is displayed.
void UpdateSyncItem(id syncItem, BOOL syncEnabled, Profile* profile);
// This function (used by UpdateSyncItem) is only exposed for testing.
// Just use UpdateSyncItem() instead.
void UpdateSyncItemForStatus(id syncItem, BOOL syncEnabled,
sync_ui_util::MessageType status);
} // namespace sync_ui_util
#endif // CHROME_BROWSER_SYNC_SYNC_UI_UTIL_MAC_H_
|
#!/usr/bin/env python
import os
import subprocess
import time
from setuptools import find_packages, setup
import torch
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
def readme():
with open('README.md', encoding='utf-8') as f:
content = f.read()
return content
MAJOR = 1
MINOR = 1
PATCH = 0
SUFFIX = ''
if PATCH != '':
SHORT_VERSION = '{}.{}.{}{}'.format(MAJOR, MINOR, PATCH, SUFFIX)
else:
SHORT_VERSION = '{}.{}{}'.format(MAJOR, MINOR, SUFFIX)
version_file = 'content/D2Det/mmdet/version.py'
def get_git_hash():
def _minimal_ext_cmd(cmd):
# construct minimal environment
env = {}
for k in ['SYSTEMROOT', 'PATH', 'HOME']:
v = os.environ.get(k)
if v is not None:
env[k] = v
# LANGUAGE is used on win32
env['LANGUAGE'] = 'C'
env['LANG'] = 'C'
env['LC_ALL'] = 'C'
out = subprocess.Popen(
cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
return out
try:
out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD'])
sha = out.strip().decode('ascii')
except OSError:
sha = 'unknown'
return sha
def get_hash():
if os.path.exists('.git'):
sha = get_git_hash()[:7]
elif os.path.exists(version_file):
try:
from mmdet.version import __version__
sha = __version__.split('+')[-1]
except ImportError:
raise ImportError('Unable to get git version')
else:
sha = 'unknown'
return sha
def write_version_py():
content = """# GENERATED VERSION FILE
# TIME: {}
__version__ = '{}'
short_version = '{}'
"""
sha = get_hash()
VERSION = SHORT_VERSION + '+' + sha
with open(version_file, 'w') as f:
f.write(content.format(time.asctime(), VERSION, SHORT_VERSION))
def get_version():
with open(version_file, 'r') as f:
exec(compile(f.read(), version_file, 'exec'))
return locals()['__version__']
def make_cuda_ext(name, module, sources):
define_macros = []
if torch.cuda.is_available() or os.getenv('FORCE_CUDA', '0') == '1':
define_macros += [('WITH_CUDA', None)]
else:
raise EnvironmentError('CUDA is required to compile MMDetection!')
return CUDAExtension(
name='{}.{}'.format(module, name),
sources=[os.path.join(*module.split('.'), p) for p in sources],
define_macros=define_macros,
extra_compile_args={
'cxx': [],
'nvcc': [
'-D__CUDA_NO_HALF_OPERATORS__',
'-D__CUDA_NO_HALF_CONVERSIONS__',
'-D__CUDA_NO_HALF2_OPERATORS__',
]
})
def parse_requirements(fname='requirements.txt', with_version=True):
"""
Parse the package dependencies listed in a requirements file but strips
specific versioning information.
Args:
fname (str): path to requirements file
with_version (bool, default=False): if True include version specs
Returns:
List[str]: list of requirements items
CommandLine:
python -c "import setup; print(setup.parse_requirements())"
"""
import sys
from os.path import exists
import re
require_fpath = fname
def parse_line(line):
"""
Parse information from a line in a requirements text file
"""
if line.startswith('-r '):
# Allow specifying requirements in other files
target = line.split(' ')[1]
for info in parse_require_file(target):
yield info
else:
info = {'line': line}
if line.startswith('-e '):
info['package'] = line.split('#egg=')[1]
else:
# Remove versioning from the package
pat = '(' + '|'.join(['>=', '==', '>']) + ')'
parts = re.split(pat, line, maxsplit=1)
parts = [p.strip() for p in parts]
info['package'] = parts[0]
if len(parts) > 1:
op, rest = parts[1:]
if ';' in rest:
# Handle platform specific dependencies
# http://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-platform-specific-dependencies
version, platform_deps = map(str.strip,
rest.split(';'))
info['platform_deps'] = platform_deps
else:
version = rest # NOQA
info['version'] = (op, version)
yield info
def parse_require_file(fpath):
with open(fpath, 'r') as f:
for line in f.readlines():
line = line.strip()
if line and not line.startswith('#'):
for info in parse_line(line):
yield info
def gen_packages_items():
if exists(require_fpath):
for info in parse_require_file(require_fpath):
parts = [info['package']]
if with_version and 'version' in info:
parts.extend(info['version'])
if not sys.version.startswith('3.4'):
# apparently package_deps are broken in 3.4
platform_deps = info.get('platform_deps')
if platform_deps is not None:
parts.append(';' + platform_deps)
item = ''.join(parts)
yield item
packages = list(gen_packages_items())
return packages
if __name__ == '__main__':
write_version_py()
setup(
name='mmdet',
version=get_version(),
description='Open MMLab Detection Toolbox and Benchmark',
long_description=readme(),
author='OpenMMLab',
author_email='chenkaidev@gmail.com',
keywords='computer vision, object detection',
url='https://github.com/open-mmlab/mmdetection',
packages=find_packages(exclude=('configs', 'tools', 'demo')),
package_data={'mmdet.ops': ['*/*.so']},
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
license='Apache License 2.0',
setup_requires=parse_requirements('requirements/build.txt'),
tests_require=parse_requirements('requirements/tests.txt'),
install_requires=parse_requirements('requirements/runtime.txt'),
extras_require={
'all': parse_requirements('requirements.txt'),
'tests': parse_requirements('requirements/tests.txt'),
'build': parse_requirements('requirements/build.txt'),
'optional': parse_requirements('requirements/optional.txt'),
},
ext_modules=[
make_cuda_ext(
name='compiling_info',
module='mmdet.ops.utils',
sources=['src/compiling_info.cpp']),
make_cuda_ext(
name='nms_cpu',
module='mmdet.ops.nms',
sources=['src/nms_cpu.cpp']),
make_cuda_ext(
name='nms_cuda',
module='mmdet.ops.nms',
sources=['src/nms_cuda.cpp', 'src/nms_kernel.cu']),
make_cuda_ext(
name='roi_align_cuda',
module='mmdet.ops.roi_align',
sources=['src/roi_align_cuda.cpp', 'src/roi_align_kernel.cu']),
make_cuda_ext(
name='roi_pool_cuda',
module='mmdet.ops.roi_pool',
sources=['src/roi_pool_cuda.cpp', 'src/roi_pool_kernel.cu']),
make_cuda_ext(
name='deform_conv_cuda',
module='mmdet.ops.dcn',
sources=[
'src/deform_conv_cuda.cpp',
'src/deform_conv_cuda_kernel.cu'
]),
make_cuda_ext(
name='deform_pool_cuda',
module='mmdet.ops.dcn',
sources=[
'src/deform_pool_cuda.cpp',
'src/deform_pool_cuda_kernel.cu'
]),
make_cuda_ext(
name='sigmoid_focal_loss_cuda',
module='mmdet.ops.sigmoid_focal_loss',
sources=[
'src/sigmoid_focal_loss.cpp',
'src/sigmoid_focal_loss_cuda.cu'
]),
make_cuda_ext(
name='masked_conv2d_cuda',
module='mmdet.ops.masked_conv',
sources=[
'src/masked_conv2d_cuda.cpp', 'src/masked_conv2d_kernel.cu'
]),
make_cuda_ext(
name='affine_grid_cuda',
module='mmdet.ops.affine_grid',
sources=['src/affine_grid_cuda.cpp']),
make_cuda_ext(
name='grid_sampler_cuda',
module='mmdet.ops.grid_sampler',
sources=[
'src/cpu/grid_sampler_cpu.cpp',
'src/cuda/grid_sampler_cuda.cu', 'src/grid_sampler.cpp'
]),
make_cuda_ext(
name='carafe_cuda',
module='mmdet.ops.carafe',
sources=['src/carafe_cuda.cpp', 'src/carafe_cuda_kernel.cu']),
make_cuda_ext(
name='carafe_naive_cuda',
module='mmdet.ops.carafe',
sources=[
'src/carafe_naive_cuda.cpp',
'src/carafe_naive_cuda_kernel.cu'
])
],
cmdclass={'build_ext': BuildExtension},
zip_safe=False)
|
import {
loadFragment,
toClassName,
decorateIcons,
insertNewsletterForm,
} from '../../scripts/scripts.js';
/**
* collapses all open nav sections
* @param {Element} sections The container element
*/
function collapseAll(elems) {
elems.forEach((section) => {
section.setAttribute('aria-expanded', 'false');
});
}
/**
* decorates the header, mainly the nav
* @param {Element} block The header block element
*/
export default async function decorate(block) {
block.textContent = '';
// fetch nav content
const resp = await fetch('/blog/fixtures/nav.plain.html');
let html = await resp.text();
// forward compatibility
html = html.replaceAll('<ol>', '<ul>');
html = html.replaceAll('</ol>', '</ul>');
// decorate nav DOM
const nav = document.createElement('div');
nav.classList.add('nav');
const navSections = document.createElement('div');
navSections.classList.add('nav-sections');
nav.innerHTML = html;
decorateIcons(nav);
nav.querySelectorAll(':scope > div').forEach((navSection, i) => {
if (!i) {
// first section is the brand section
const brand = navSection;
brand.classList.add('nav-brand');
nav.insertBefore(navSections, brand.nextElementSibling);
} else {
// all other sections
const h2 = navSection.querySelector('h2');
if (h2) {
const ul = navSection.querySelector('ul');
if (!ul) {
navSection.classList.add(`nav-section-${toClassName(h2.textContent)}`);
const wrapper = document.createElement('div');
wrapper.className = 'nav-section-wrapper';
while (h2.nextElementSibling) wrapper.append(h2.nextElementSibling);
navSection.append(wrapper);
}
navSections.append(navSection);
navSection.classList.add('nav-section');
h2.addEventListener('click', () => {
const expanded = navSection.getAttribute('aria-expanded') === 'true';
collapseAll([...navSections.children]);
navSection.setAttribute('aria-expanded', expanded ? 'false' : 'true');
});
navSection.querySelectorAll(':scope > ul > li').forEach((li) => {
if (!li.querySelector(':scope > a')) {
li.addEventListener('click', () => {
const expanded = li.getAttribute('aria-expanded') === 'true';
collapseAll([...nav.querySelectorAll('li[aria-expanded="true"]')]);
li.setAttribute('aria-expanded', expanded ? 'false' : 'true');
});
}
});
} else {
const buttons = navSection;
buttons.className = 'nav-buttons';
buttons.querySelectorAll('a').forEach((a) => {
a.classList.add('button', 'small');
if (a.parentElement.tagName === 'EM') {
a.classList.add('light');
}
});
}
}
});
// hamburger for mobile
const hamburger = document.createElement('div');
hamburger.classList.add('nav-hamburger');
hamburger.innerHTML = '<div class="nav-hamburger-icon"></div>';
hamburger.addEventListener('click', () => {
const expanded = nav.getAttribute('aria-expanded') === 'true';
document.body.style.overflowY = expanded ? '' : 'hidden';
nav.setAttribute('aria-expanded', expanded ? 'false' : 'true');
});
nav.prepend(hamburger);
nav.setAttribute('aria-expanded', 'false');
const createSearch = () => {
const div = document.createElement('div');
div.className = 'header-search';
div.innerHTML = `<a data-modal="/tools/search"><img src="${window.hlx.codeBasePath}/icons/search.svg" class="icon icon-search"></a>`;
div.addEventListener('click', async () => {
const elem = document.getElementById('header-search-modal');
if (!elem) {
const modal = document.createElement('div');
modal.className = 'header-search-modal';
modal.id = 'header-search-modal';
modal.innerHTML = '<div class="header-search-close"></div>';
const fragment = await loadFragment('/blog/fixtures/search');
modal.append(fragment);
block.append(modal);
modal.classList.add('visible');
const close = modal.querySelector('.header-search-close');
close.addEventListener('click', () => {
modal.classList.remove('visible');
});
} else {
elem.classList.add('visible');
}
});
return (div);
};
block.append(nav);
insertNewsletterForm(block, () => {
collapseAll([...nav.querySelectorAll('[aria-expanded="true"]')]);
});
block.append(createSearch());
}
|
# Copyright (c) 2012-2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSHelperFn, AWSObject, AWSProperty, If, FindInMap, Ref
from .validators import boolean, integer, exactly_one, mutually_exclusive
from . import cloudformation
EC2_INSTANCE_LAUNCH = "autoscaling:EC2_INSTANCE_LAUNCH"
EC2_INSTANCE_LAUNCH_ERROR = "autoscaling:EC2_INSTANCE_LAUNCH_ERROR"
EC2_INSTANCE_TERMINATE = "autoscaling:EC2_INSTANCE_TERMINATE"
EC2_INSTANCE_TERMINATE_ERROR = "autoscaling:EC2_INSTANCE_TERMINATE_ERROR"
TEST_NOTIFICATION = "autoscaling:TEST_NOTIFICATION"
# Termination Policy constants
Default = 'Default'
OldestInstance = 'OldestInstance'
NewestInstance = 'NewestInstance'
OldestLaunchConfiguration = 'OldestLaunchConfiguration'
OldestLaunchTemplate = 'OldestLaunchTemplate'
ClosestToNextInstanceHour = 'ClosestToNextInstanceHour'
AllocationStrategy = 'AllocationStrategy'
class Tag(AWSHelperFn):
def __init__(self, key, value, propogate):
self.data = {
'Key': key,
'Value': value,
'PropagateAtLaunch': propogate,
}
class Tags(AWSHelperFn):
defaultPropagateAtLaunch = True
manyType = [type([]), type(())]
def __init__(self, **kwargs):
self.tags = []
for k, v in sorted(kwargs.iteritems()):
if type(v) in self.manyType:
propagate = str(v[1]).lower()
v = v[0]
else:
propagate = str(self.defaultPropagateAtLaunch).lower()
self.tags.append({
'Key': k,
'Value': v,
'PropagateAtLaunch': propagate,
})
# append tags to list
def __add__(self, newtags):
newtags.tags = self.tags + newtags.tags
return newtags
def to_dict(self):
return self.tags
class LifecycleHookSpecification(AWSProperty):
props = {
'DefaultResult': (basestring, False),
'HeartbeatTimeout': (integer, False),
'LifecycleHookName': (basestring, True),
'LifecycleTransition': (basestring, True),
'NotificationMetadata': (basestring, False),
'NotificationTargetARN': (basestring, False),
'RoleARN': (basestring, False),
}
class NotificationConfigurations(AWSProperty):
props = {
'TopicARN': (basestring, True),
'NotificationTypes': (list, True),
}
class MetricsCollection(AWSProperty):
props = {
'Granularity': (basestring, True),
'Metrics': (list, False),
}
class Metadata(AWSHelperFn):
def __init__(self, init, authentication=None):
self.validate(init, authentication)
# get keys and values from init and authentication
# if there's only one data point, then we know its the default
# cfn-init; where the key is 'config'
if len(init.data) == 1:
initKey, initValue = init.data.popitem()
self.data = {initKey: initValue}
else:
self.data = init.data
if authentication:
authKey, authValue = authentication.data.popitem()
self.data[authKey] = authValue
def validate(self, init, authentication):
if not isinstance(init, cloudformation.Init):
raise ValueError(
'init must be of type cloudformation.Init'
)
is_instance = isinstance(authentication, cloudformation.Authentication)
if authentication and not is_instance:
raise ValueError(
'authentication must be of type cloudformation.Authentication'
)
class LaunchTemplateSpecification(AWSProperty):
props = {
'LaunchTemplateId': (basestring, False),
'LaunchTemplateName': (basestring, False),
'Version': (basestring, True)
}
def validate(self):
template_ids = [
'LaunchTemplateId',
'LaunchTemplateName'
]
exactly_one(self.__class__.__name__, self.properties, template_ids)
class InstancesDistribution(AWSProperty):
props = {
'OnDemandAllocationStrategy': (basestring, False),
'OnDemandBaseCapacity': (integer, False),
'OnDemandPercentageAboveBaseCapacity': (integer, False),
'SpotAllocationStrategy': (basestring, False),
'SpotInstancePools': (integer, False),
'SpotMaxPrice': (basestring, False),
}
class LaunchTemplateOverrides(AWSProperty):
props = {
'InstanceType': (basestring, False),
'WeightedCapacity': (basestring, False),
}
class LaunchTemplate(AWSProperty):
props = {
'LaunchTemplateSpecification': (LaunchTemplateSpecification, True),
'Overrides': ([LaunchTemplateOverrides], True),
}
class MixedInstancesPolicy(AWSProperty):
props = {
'InstancesDistribution': (InstancesDistribution, False),
'LaunchTemplate': (LaunchTemplate, True),
}
class AutoScalingGroup(AWSObject):
resource_type = "AWS::AutoScaling::AutoScalingGroup"
props = {
'AutoScalingGroupName': (basestring, False),
'AvailabilityZones': (list, False),
'Cooldown': (integer, False),
'DesiredCapacity': (integer, False),
'HealthCheckGracePeriod': (integer, False),
'HealthCheckType': (basestring, False),
'InstanceId': (basestring, False),
'LaunchConfigurationName': (basestring, False),
'LaunchTemplate': (LaunchTemplateSpecification, False),
'LifecycleHookSpecificationList':
([LifecycleHookSpecification], False),
'LoadBalancerNames': (list, False),
'MaxInstanceLifetime': (integer, False),
'MaxSize': (integer, True),
'MetricsCollection': ([MetricsCollection], False),
'MinSize': (integer, True),
'MixedInstancesPolicy': (MixedInstancesPolicy, False),
'NewInstancesProtectedFromScaleIn': (boolean, False),
'NotificationConfigurations': ([NotificationConfigurations], False),
'PlacementGroup': (basestring, False),
'ServiceLinkedRoleARN': (basestring, False),
'Tags': ((Tags, list), False),
'TargetGroupARNs': ([basestring], False),
'TerminationPolicies': ([basestring], False),
'VPCZoneIdentifier': (list, False),
}
def validate(self):
if 'UpdatePolicy' in self.resource:
update_policy = self.resource['UpdatePolicy']
if (not isinstance(update_policy, AWSHelperFn) and
'AutoScalingRollingUpdate' in update_policy.properties):
if not isinstance(
update_policy.AutoScalingRollingUpdate, AWSHelperFn):
rolling_update = update_policy.AutoScalingRollingUpdate
min_instances = rolling_update.properties.get(
"MinInstancesInService", "0")
is_min_no_check = isinstance(
min_instances, (If, FindInMap, Ref)
)
is_max_no_check = isinstance(self.MaxSize,
(If, FindInMap, Ref))
if not (is_min_no_check or is_max_no_check):
max_count = int(self.MaxSize)
min_count = int(min_instances)
if min_count >= max_count:
raise ValueError(
"The UpdatePolicy attribute "
"MinInstancesInService must be less than the "
"autoscaling group's MaxSize")
instance_config_types = [
'LaunchConfigurationName',
'LaunchTemplate',
'InstanceId'
]
mutually_exclusive(self.__class__.__name__, self.properties,
instance_config_types)
availability_zones = self.properties.get('AvailabilityZones')
vpc_zone_identifier = self.properties.get('VPCZoneIdentifier')
if not availability_zones and not vpc_zone_identifier:
raise ValueError("Must specify AvailabilityZones and/or "
"VPCZoneIdentifier: http://docs.aws.amazon.com/A"
"WSCloudFormation/latest/UserGuide/aws-propertie"
"s-as-group.html#cfn-as-group-vpczoneidentifier")
return True
class LaunchConfiguration(AWSObject):
resource_type = "AWS::AutoScaling::LaunchConfiguration"
props = {
'AssociatePublicIpAddress': (boolean, False),
'BlockDeviceMappings': (list, False),
'ClassicLinkVPCId': (basestring, False),
'ClassicLinkVPCSecurityGroups': ([basestring], False),
'EbsOptimized': (boolean, False),
'IamInstanceProfile': (basestring, False),
'ImageId': (basestring, True),
'InstanceId': (basestring, False),
'InstanceMonitoring': (boolean, False),
'InstanceType': (basestring, True),
'KernelId': (basestring, False),
'KeyName': (basestring, False),
'LaunchConfigurationName': (basestring, False),
'Metadata': (Metadata, False),
'PlacementTenancy': (basestring, False),
'RamDiskId': (basestring, False),
'SecurityGroups': (list, False),
'SpotPrice': (basestring, False),
'UserData': (basestring, False),
}
class StepAdjustments(AWSProperty):
props = {
'MetricIntervalLowerBound': (integer, False),
'MetricIntervalUpperBound': (integer, False),
'ScalingAdjustment': (integer, True),
}
class MetricDimension(AWSProperty):
props = {
'Name': (basestring, True),
'Value': (basestring, True),
}
class CustomizedMetricSpecification(AWSProperty):
props = {
'Dimensions': ([MetricDimension], False),
'MetricName': (basestring, True),
'Namespace': (basestring, True),
'Statistic': (basestring, True),
'Unit': (basestring, False),
}
class PredefinedMetricSpecification(AWSProperty):
props = {
'PredefinedMetricType': (basestring, True),
'ResourceLabel': (basestring, False),
}
class TargetTrackingConfiguration(AWSProperty):
props = {
'CustomizedMetricSpecification':
(CustomizedMetricSpecification, False),
'DisableScaleIn': (boolean, False),
'PredefinedMetricSpecification':
(PredefinedMetricSpecification, False),
'TargetValue': (float, True),
}
class ScalingPolicy(AWSObject):
resource_type = "AWS::AutoScaling::ScalingPolicy"
props = {
'AdjustmentType': (basestring, False),
'AutoScalingGroupName': (basestring, True),
'Cooldown': (integer, False),
'EstimatedInstanceWarmup': (integer, False),
'MetricAggregationType': (basestring, False),
'MinAdjustmentMagnitude': (integer, False),
'PolicyType': (basestring, False),
'ScalingAdjustment': (integer, False),
'StepAdjustments': ([StepAdjustments], False),
'TargetTrackingConfiguration': (TargetTrackingConfiguration, False),
}
class ScheduledAction(AWSObject):
resource_type = "AWS::AutoScaling::ScheduledAction"
props = {
'AutoScalingGroupName': (basestring, True),
'DesiredCapacity': (integer, False),
'EndTime': (basestring, False),
'MaxSize': (integer, False),
'MinSize': (integer, False),
'Recurrence': (basestring, False),
'StartTime': (basestring, False),
}
class LifecycleHook(AWSObject):
resource_type = "AWS::AutoScaling::LifecycleHook"
props = {
'AutoScalingGroupName': (basestring, True),
'DefaultResult': (basestring, False),
'HeartbeatTimeout': (integer, False),
'LifecycleHookName': (basestring, False),
'LifecycleTransition': (basestring, True),
'NotificationMetadata': (basestring, False),
'NotificationTargetARN': (basestring, False),
'RoleARN': (basestring, False),
}
class Trigger(AWSObject):
resource_type = "AWS::AutoScaling::Trigger"
props = {
'AutoScalingGroupName': (basestring, True),
'BreachDuration': (integer, True),
'Dimensions': (list, True),
'LowerBreachScaleIncrement': (integer, False),
'LowerThreshold': (integer, True),
'MetricName': (basestring, True),
'Namespace': (basestring, True),
'Period': (integer, True),
'Statistic': (basestring, True),
'Unit': (basestring, False),
'UpperBreachScaleIncrement': (integer, False),
'UpperThreshold': (integer, True),
}
class EBSBlockDevice(AWSProperty):
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig-blockdev-template.html
props = {
'DeleteOnTermination': (boolean, False),
'Encrypted': (boolean, False),
'Iops': (integer, False),
'SnapshotId': (basestring, False),
'VolumeSize': (integer, False),
'VolumeType': (basestring, False),
}
class BlockDeviceMapping(AWSProperty):
# http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig-blockdev-mapping.html
props = {
'DeviceName': (basestring, True),
'Ebs': (EBSBlockDevice, False),
'NoDevice': (boolean, False),
'VirtualName': (basestring, False),
}
|
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
const plugins = ['sinon-chai', 'chai-dom'];
export default plugins.map(plugin => ({
input: plugin,
output: {
dir: 'plugins',
},
plugins: [resolve(), commonjs()],
}));
|
import factory
from factory.django import DjangoModelFactory
from d2e_share_splitter.shareconf.factories import ProjectFactory
from d2e_share_splitter.sharecontributions.models import Contribution
from d2e_share_splitter.sharecontributions.models import ContributionTypeChoices
class ContributionFactory(DjangoModelFactory):
class Meta:
model = Contribution
project = factory.SubFactory(ProjectFactory)
class ContributionTime10hFactory(ContributionFactory):
contribType = ContributionTypeChoices.time.name
hours = 10
date = factory.Faker("date")
|
/*
* Copyright (c) 2016, Alliance for Open Media. All rights reserved
*
* This source code is subject to the terms of the BSD 2 Clause License and
* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
* was not distributed with this source code in the LICENSE file, you can
* obtain it at www.aomedia.org/license/software. If the Alliance for Open
* Media Patent License 1.0 was not distributed with this source code in the
* PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
#include <math.h>
#include "config/aom_config.h"
#include "config/aom_dsp_rtcd.h"
#include "aom_dsp/aom_dsp_common.h"
#include "aom_mem/aom_mem.h"
#include "aom_ports/mem.h"
#include "av1/common/av1_loopfilter.h"
#include "av1/common/onyxc_int.h"
#include "av1/common/reconinter.h"
#include "av1/common/seg_common.h"
static const SEG_LVL_FEATURES seg_lvl_lf_lut[MAX_MB_PLANE][2] = {
{ SEG_LVL_ALT_LF_Y_V, SEG_LVL_ALT_LF_Y_H },
{ SEG_LVL_ALT_LF_U, SEG_LVL_ALT_LF_U },
{ SEG_LVL_ALT_LF_V, SEG_LVL_ALT_LF_V }
};
static const int delta_lf_id_lut[MAX_MB_PLANE][2] = { { 0, 1 },
{ 2, 2 },
{ 3, 3 } };
#if CONFIG_NEW_INTER_MODES
static const int mode_lf_lut[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // INTRA_MODES
1, 0, 1, // INTER_MODES (GLOBALMV == 0)
1, 1, 1, 0, 1, // INTER_COMPOUND_MODES (GLOBAL_GLOBALMV == 0)
#if CONFIG_EXT_COMPOUND
1, 1, 1, 1
#endif // CONFIG_EXT_COMPOUND
};
#else
static const int mode_lf_lut[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // INTRA_MODES
1, 1, 0, 1, // INTER_MODES (GLOBALMV == 0)
1, 1, 1, 1, 1, 1, 0, 1 // INTER_COMPOUND_MODES (GLOBAL_GLOBALMV == 0)
};
#endif // CONFIG_NEW_INTER_MODES
static void update_sharpness(loop_filter_info_n *lfi, int sharpness_lvl) {
int lvl;
// For each possible value for the loop filter fill out limits
for (lvl = 0; lvl <= MAX_LOOP_FILTER; lvl++) {
// Set loop filter parameters that control sharpness.
int block_inside_limit = lvl >> ((sharpness_lvl > 0) + (sharpness_lvl > 4));
if (sharpness_lvl > 0) {
if (block_inside_limit > (9 - sharpness_lvl))
block_inside_limit = (9 - sharpness_lvl);
}
if (block_inside_limit < 1) block_inside_limit = 1;
memset(lfi->lfthr[lvl].lim, block_inside_limit, SIMD_WIDTH);
memset(lfi->lfthr[lvl].mblim, (2 * (lvl + 2) + block_inside_limit),
SIMD_WIDTH);
}
}
uint8_t av1_get_filter_level(const AV1_COMMON *cm,
const loop_filter_info_n *lfi_n, const int dir_idx,
int plane, const MB_MODE_INFO *mbmi) {
const int segment_id = mbmi->segment_id;
if (cm->delta_q_info.delta_lf_present_flag) {
int delta_lf;
if (cm->delta_q_info.delta_lf_multi) {
const int delta_lf_idx = delta_lf_id_lut[plane][dir_idx];
delta_lf = mbmi->delta_lf[delta_lf_idx];
} else {
delta_lf = mbmi->delta_lf_from_base;
}
int base_level;
if (plane == 0)
base_level = cm->lf.filter_level[dir_idx];
else if (plane == 1)
base_level = cm->lf.filter_level_u;
else
base_level = cm->lf.filter_level_v;
int lvl_seg = clamp(delta_lf + base_level, 0, MAX_LOOP_FILTER);
assert(plane >= 0 && plane <= 2);
const int seg_lf_feature_id = seg_lvl_lf_lut[plane][dir_idx];
if (segfeature_active(&cm->seg, segment_id, seg_lf_feature_id)) {
const int data = get_segdata(&cm->seg, segment_id, seg_lf_feature_id);
lvl_seg = clamp(lvl_seg + data, 0, MAX_LOOP_FILTER);
}
if (cm->lf.mode_ref_delta_enabled) {
const int scale = 1 << (lvl_seg >> 5);
lvl_seg += cm->lf.ref_deltas[mbmi->ref_frame[0]] * scale;
if (mbmi->ref_frame[0] > INTRA_FRAME)
lvl_seg += cm->lf.mode_deltas[mode_lf_lut[mbmi->mode]] * scale;
lvl_seg = clamp(lvl_seg, 0, MAX_LOOP_FILTER);
}
return lvl_seg;
} else {
return lfi_n->lvl[plane][segment_id][dir_idx][mbmi->ref_frame[0]]
[mode_lf_lut[mbmi->mode]];
}
}
void av1_loop_filter_init(AV1_COMMON *cm) {
assert(MB_MODE_COUNT == NELEMENTS(mode_lf_lut));
loop_filter_info_n *lfi = &cm->lf_info;
struct loopfilter *lf = &cm->lf;
int lvl;
lf->combine_vert_horz_lf = 1;
// init limits for given sharpness
update_sharpness(lfi, lf->sharpness_level);
// init hev threshold const vectors
for (lvl = 0; lvl <= MAX_LOOP_FILTER; lvl++)
memset(lfi->lfthr[lvl].hev_thr, (lvl >> 4), SIMD_WIDTH);
}
// Update the loop filter for the current frame.
// This should be called before loop_filter_rows(),
// av1_loop_filter_frame() calls this function directly.
void av1_loop_filter_frame_init(AV1_COMMON *cm, int plane_start,
int plane_end) {
int filt_lvl[MAX_MB_PLANE], filt_lvl_r[MAX_MB_PLANE];
int plane;
int seg_id;
// n_shift is the multiplier for lf_deltas
// the multiplier is 1 for when filter_lvl is between 0 and 31;
// 2 when filter_lvl is between 32 and 63
loop_filter_info_n *const lfi = &cm->lf_info;
struct loopfilter *const lf = &cm->lf;
const struct segmentation *const seg = &cm->seg;
// update sharpness limits
update_sharpness(lfi, lf->sharpness_level);
filt_lvl[0] = cm->lf.filter_level[0];
filt_lvl[1] = cm->lf.filter_level_u;
filt_lvl[2] = cm->lf.filter_level_v;
filt_lvl_r[0] = cm->lf.filter_level[1];
filt_lvl_r[1] = cm->lf.filter_level_u;
filt_lvl_r[2] = cm->lf.filter_level_v;
assert(plane_start >= AOM_PLANE_Y);
assert(plane_end <= MAX_MB_PLANE);
for (plane = plane_start; plane < plane_end; plane++) {
if (plane == 0 && !filt_lvl[0] && !filt_lvl_r[0])
break;
else if (plane == 1 && !filt_lvl[1])
continue;
else if (plane == 2 && !filt_lvl[2])
continue;
for (seg_id = 0; seg_id < MAX_SEGMENTS; seg_id++) {
for (int dir = 0; dir < 2; ++dir) {
int lvl_seg = (dir == 0) ? filt_lvl[plane] : filt_lvl_r[plane];
const int seg_lf_feature_id = seg_lvl_lf_lut[plane][dir];
if (segfeature_active(seg, seg_id, seg_lf_feature_id)) {
const int data = get_segdata(&cm->seg, seg_id, seg_lf_feature_id);
lvl_seg = clamp(lvl_seg + data, 0, MAX_LOOP_FILTER);
}
if (!lf->mode_ref_delta_enabled) {
// we could get rid of this if we assume that deltas are set to
// zero when not in use; encoder always uses deltas
memset(lfi->lvl[plane][seg_id][dir], lvl_seg,
sizeof(lfi->lvl[plane][seg_id][dir]));
} else {
int ref, mode;
const int scale = 1 << (lvl_seg >> 5);
const int intra_lvl = lvl_seg + lf->ref_deltas[INTRA_FRAME] * scale;
lfi->lvl[plane][seg_id][dir][INTRA_FRAME][0] =
clamp(intra_lvl, 0, MAX_LOOP_FILTER);
for (ref = LAST_FRAME; ref < REF_FRAMES; ++ref) {
for (mode = 0; mode < MAX_MODE_LF_DELTAS; ++mode) {
const int inter_lvl = lvl_seg + lf->ref_deltas[ref] * scale +
lf->mode_deltas[mode] * scale;
lfi->lvl[plane][seg_id][dir][ref][mode] =
clamp(inter_lvl, 0, MAX_LOOP_FILTER);
}
}
}
}
}
}
}
static TX_SIZE get_transform_size(const MACROBLOCKD *const xd,
const MB_MODE_INFO *const mbmi,
const EDGE_DIR edge_dir, const int mi_row,
const int mi_col, const int plane,
const struct macroblockd_plane *plane_ptr) {
assert(mbmi != NULL);
if (xd && xd->lossless[mbmi->segment_id]) return TX_4X4;
const BLOCK_SIZE bsize_base =
plane ? mbmi->chroma_ref_info.bsize_base : mbmi->sb_type;
TX_SIZE tx_size =
(plane == AOM_PLANE_Y)
? mbmi->tx_size
: av1_get_max_uv_txsize(bsize_base, plane_ptr->subsampling_x,
plane_ptr->subsampling_y);
assert(tx_size < TX_SIZES_ALL);
if ((plane == AOM_PLANE_Y) && is_inter_block(mbmi) && !mbmi->skip) {
const BLOCK_SIZE sb_type = mbmi->sb_type;
const int blk_row = mi_row & (mi_size_high[sb_type] - 1);
const int blk_col = mi_col & (mi_size_wide[sb_type] - 1);
const TX_SIZE mb_tx_size =
mbmi->inter_tx_size[av1_get_txb_size_index(sb_type, blk_row, blk_col)];
assert(mb_tx_size < TX_SIZES_ALL);
tx_size = mb_tx_size;
}
// since in case of chrominance or non-square transform need to convert
// transform size into transform size in particular direction.
// for vertical edge, filter direction is horizontal, for horizontal
// edge, filter direction is vertical.
tx_size = (VERT_EDGE == edge_dir) ? txsize_horz_map[tx_size]
: txsize_vert_map[tx_size];
return tx_size;
}
typedef struct AV1_DEBLOCKING_PARAMETERS {
// length of the filter applied to the outer edge
uint32_t filter_length;
// deblocking limits
const uint8_t *lim;
const uint8_t *mblim;
const uint8_t *hev_thr;
} AV1_DEBLOCKING_PARAMETERS;
// Return TX_SIZE from get_transform_size(), so it is plane and direction
// aware
static TX_SIZE set_lpf_parameters(
AV1_DEBLOCKING_PARAMETERS *const params, const ptrdiff_t mode_step,
const AV1_COMMON *const cm, const MACROBLOCKD *const xd,
const EDGE_DIR edge_dir, const uint32_t x, const uint32_t y,
const int plane, const struct macroblockd_plane *const plane_ptr) {
// reset to initial values
params->filter_length = 0;
// no deblocking is required
const uint32_t width = plane_ptr->dst.width;
const uint32_t height = plane_ptr->dst.height;
if ((width <= x) || (height <= y)) {
// just return the smallest transform unit size
return TX_4X4;
}
const uint32_t scale_horz = plane_ptr->subsampling_x;
const uint32_t scale_vert = plane_ptr->subsampling_y;
// for sub8x8 block, chroma prediction mode is obtained from the bottom/right
// mi structure of the co-located 8x8 luma block. so for chroma plane, mi_row
// and mi_col should map to the bottom/right mi structure, i.e, both mi_row
// and mi_col should be odd number for chroma plane.
const int mi_row = scale_vert | ((y << scale_vert) >> MI_SIZE_LOG2);
const int mi_col = scale_horz | ((x << scale_horz) >> MI_SIZE_LOG2);
MB_MODE_INFO **mi = cm->mi_grid_base + mi_row * cm->mi_stride + mi_col;
const MB_MODE_INFO *mbmi = mi[0];
// If current mbmi is not correctly setup, return an invalid value to stop
// filtering. One example is that if this tile is not coded, then its mbmi
// it not set up.
if (mbmi == NULL) return TX_INVALID;
const TX_SIZE ts =
get_transform_size(xd, mi[0], edge_dir, mi_row, mi_col, plane, plane_ptr);
{
const uint32_t coord = (VERT_EDGE == edge_dir) ? (x) : (y);
const uint32_t transform_masks =
edge_dir == VERT_EDGE ? tx_size_wide[ts] - 1 : tx_size_high[ts] - 1;
const int32_t tu_edge = (coord & transform_masks) ? (0) : (1);
if (!tu_edge) return ts;
// prepare outer edge parameters. deblock the edge if it's an edge of a TU
{
const uint32_t curr_level =
av1_get_filter_level(cm, &cm->lf_info, edge_dir, plane, mbmi);
#if CONFIG_DBLK_TXSKIP
const int curr_skipped =
av1_lpf_get_txk_skip(cm, x, y, plane) && is_inter_block(mbmi);
#else
const int curr_skipped = mbmi->skip && is_inter_block(mbmi);
#endif
uint32_t level = curr_level;
if (coord) {
{
const MB_MODE_INFO *const mi_prev = *(mi - mode_step);
if (mi_prev == NULL) return TX_INVALID;
const int pv_row =
(VERT_EDGE == edge_dir) ? (mi_row) : (mi_row - (1 << scale_vert));
const int pv_col =
(VERT_EDGE == edge_dir) ? (mi_col - (1 << scale_horz)) : (mi_col);
const TX_SIZE pv_ts = get_transform_size(
xd, mi_prev, edge_dir, pv_row, pv_col, plane, plane_ptr);
const uint32_t pv_lvl =
av1_get_filter_level(cm, &cm->lf_info, edge_dir, plane, mi_prev);
#if CONFIG_DBLK_TXSKIP
const uint32_t pv_x = (VERT_EDGE == edge_dir) ? (x - 1) : x;
const uint32_t pv_y = (VERT_EDGE == edge_dir) ? y : (y - 1);
const int pv_skip = av1_lpf_get_txk_skip(cm, pv_x, pv_y, plane) &&
is_inter_block(mi_prev);
#else
const int pv_skip = mi_prev->skip && is_inter_block(mi_prev);
#endif
const BLOCK_SIZE bsize_base =
plane ? mbmi->chroma_ref_info.bsize_base : mbmi->sb_type;
const BLOCK_SIZE bsize = get_plane_block_size(
bsize_base, plane_ptr->subsampling_x, plane_ptr->subsampling_y);
assert(bsize < BLOCK_SIZES_ALL);
const int prediction_masks = edge_dir == VERT_EDGE
? block_size_wide[bsize] - 1
: block_size_high[bsize] - 1;
const int32_t pu_edge = !(coord & prediction_masks);
// if the current and the previous blocks are skipped,
// deblock the edge if the edge belongs to a PU's edge only.
if ((curr_level || pv_lvl) &&
(!pv_skip || !curr_skipped || pu_edge)) {
const TX_SIZE min_ts = AOMMIN(ts, pv_ts);
if (TX_4X4 >= min_ts) {
params->filter_length = 4;
} else if (TX_8X8 == min_ts) {
if (plane != 0)
params->filter_length = 6;
else
params->filter_length = 8;
} else {
params->filter_length = 14;
// No wide filtering for chroma plane
if (plane != 0) {
params->filter_length = 6;
}
}
// update the level if the current block is skipped,
// but the previous one is not
level = (curr_level) ? (curr_level) : (pv_lvl);
}
}
}
// prepare common parameters
if (params->filter_length) {
const loop_filter_thresh *const limits = cm->lf_info.lfthr + level;
params->lim = limits->lim;
params->mblim = limits->mblim;
params->hev_thr = limits->hev_thr;
}
}
}
return ts;
}
void av1_filter_block_plane_vert(const AV1_COMMON *const cm,
const MACROBLOCKD *const xd, const int plane,
const MACROBLOCKD_PLANE *const plane_ptr,
const uint32_t mi_row, const uint32_t mi_col) {
const uint32_t scale_horz = plane_ptr->subsampling_x;
const uint32_t scale_vert = plane_ptr->subsampling_y;
uint8_t *const dst_ptr = plane_ptr->dst.buf;
const int dst_stride = plane_ptr->dst.stride;
const int y_range = (MAX_MIB_SIZE >> scale_vert);
const int x_range = (MAX_MIB_SIZE >> scale_horz);
const int use_highbitdepth = cm->seq_params.use_highbitdepth;
const aom_bit_depth_t bit_depth = cm->seq_params.bit_depth;
for (int y = 0; y < y_range; y++) {
uint8_t *p = dst_ptr + y * MI_SIZE * dst_stride;
for (int x = 0; x < x_range;) {
// inner loop always filter vertical edges in a MI block. If MI size
// is 8x8, it will filter the vertical edge aligned with a 8x8 block.
// If 4x4 transform is used, it will then filter the internal edge
// aligned with a 4x4 block
const uint32_t curr_x = ((mi_col * MI_SIZE) >> scale_horz) + x * MI_SIZE;
const uint32_t curr_y = ((mi_row * MI_SIZE) >> scale_vert) + y * MI_SIZE;
uint32_t advance_units;
TX_SIZE tx_size;
AV1_DEBLOCKING_PARAMETERS params;
memset(¶ms, 0, sizeof(params));
tx_size =
set_lpf_parameters(¶ms, ((ptrdiff_t)1 << scale_horz), cm, xd,
VERT_EDGE, curr_x, curr_y, plane, plane_ptr);
if (tx_size == TX_INVALID) {
params.filter_length = 0;
tx_size = TX_4X4;
}
switch (params.filter_length) {
// apply 4-tap filtering
case 4:
if (use_highbitdepth)
aom_highbd_lpf_vertical_4(CONVERT_TO_SHORTPTR(p), dst_stride,
params.mblim, params.lim, params.hev_thr,
bit_depth);
else
aom_lpf_vertical_4(p, dst_stride, params.mblim, params.lim,
params.hev_thr);
break;
case 6: // apply 6-tap filter for chroma plane only
assert(plane != 0);
if (use_highbitdepth)
aom_highbd_lpf_vertical_6(CONVERT_TO_SHORTPTR(p), dst_stride,
params.mblim, params.lim, params.hev_thr,
bit_depth);
else
aom_lpf_vertical_6(p, dst_stride, params.mblim, params.lim,
params.hev_thr);
break;
// apply 8-tap filtering
case 8:
if (use_highbitdepth)
aom_highbd_lpf_vertical_8(CONVERT_TO_SHORTPTR(p), dst_stride,
params.mblim, params.lim, params.hev_thr,
bit_depth);
else
aom_lpf_vertical_8(p, dst_stride, params.mblim, params.lim,
params.hev_thr);
break;
// apply 14-tap filtering
case 14:
if (use_highbitdepth)
aom_highbd_lpf_vertical_14(CONVERT_TO_SHORTPTR(p), dst_stride,
params.mblim, params.lim, params.hev_thr,
bit_depth);
else
aom_lpf_vertical_14(p, dst_stride, params.mblim, params.lim,
params.hev_thr);
break;
// no filtering
default: break;
}
// advance the destination pointer
advance_units = tx_size_wide_unit[tx_size];
x += advance_units;
p += advance_units * MI_SIZE;
}
}
}
void av1_filter_block_plane_horz(const AV1_COMMON *const cm,
const MACROBLOCKD *const xd, const int plane,
const MACROBLOCKD_PLANE *const plane_ptr,
const uint32_t mi_row, const uint32_t mi_col) {
const uint32_t scale_horz = plane_ptr->subsampling_x;
const uint32_t scale_vert = plane_ptr->subsampling_y;
uint8_t *const dst_ptr = plane_ptr->dst.buf;
const int dst_stride = plane_ptr->dst.stride;
const int y_range = (MAX_MIB_SIZE >> scale_vert);
const int x_range = (MAX_MIB_SIZE >> scale_horz);
const int use_highbitdepth = cm->seq_params.use_highbitdepth;
const aom_bit_depth_t bit_depth = cm->seq_params.bit_depth;
for (int x = 0; x < x_range; x++) {
uint8_t *p = dst_ptr + x * MI_SIZE;
for (int y = 0; y < y_range;) {
// inner loop always filter vertical edges in a MI block. If MI size
// is 8x8, it will first filter the vertical edge aligned with a 8x8
// block. If 4x4 transform is used, it will then filter the internal
// edge aligned with a 4x4 block
const uint32_t curr_x = ((mi_col * MI_SIZE) >> scale_horz) + x * MI_SIZE;
const uint32_t curr_y = ((mi_row * MI_SIZE) >> scale_vert) + y * MI_SIZE;
uint32_t advance_units;
TX_SIZE tx_size;
AV1_DEBLOCKING_PARAMETERS params;
memset(¶ms, 0, sizeof(params));
tx_size =
set_lpf_parameters(¶ms, (cm->mi_stride << scale_vert), cm, xd,
HORZ_EDGE, curr_x, curr_y, plane, plane_ptr);
if (tx_size == TX_INVALID) {
params.filter_length = 0;
tx_size = TX_4X4;
}
switch (params.filter_length) {
// apply 4-tap filtering
case 4:
if (use_highbitdepth)
aom_highbd_lpf_horizontal_4(CONVERT_TO_SHORTPTR(p), dst_stride,
params.mblim, params.lim,
params.hev_thr, bit_depth);
else
aom_lpf_horizontal_4(p, dst_stride, params.mblim, params.lim,
params.hev_thr);
break;
// apply 6-tap filtering
case 6:
assert(plane != 0);
if (use_highbitdepth)
aom_highbd_lpf_horizontal_6(CONVERT_TO_SHORTPTR(p), dst_stride,
params.mblim, params.lim,
params.hev_thr, bit_depth);
else
aom_lpf_horizontal_6(p, dst_stride, params.mblim, params.lim,
params.hev_thr);
break;
// apply 8-tap filtering
case 8:
if (use_highbitdepth)
aom_highbd_lpf_horizontal_8(CONVERT_TO_SHORTPTR(p), dst_stride,
params.mblim, params.lim,
params.hev_thr, bit_depth);
else
aom_lpf_horizontal_8(p, dst_stride, params.mblim, params.lim,
params.hev_thr);
break;
// apply 14-tap filtering
case 14:
if (use_highbitdepth)
aom_highbd_lpf_horizontal_14(CONVERT_TO_SHORTPTR(p), dst_stride,
params.mblim, params.lim,
params.hev_thr, bit_depth);
else
aom_lpf_horizontal_14(p, dst_stride, params.mblim, params.lim,
params.hev_thr);
break;
// no filtering
default: break;
}
// advance the destination pointer
advance_units = tx_size_high_unit[tx_size];
y += advance_units;
p += advance_units * dst_stride * MI_SIZE;
}
}
}
void av1_filter_block_plane_vert_test(const AV1_COMMON *const cm,
const MACROBLOCKD *const xd,
const int plane,
const MACROBLOCKD_PLANE *const plane_ptr,
const uint32_t mi_row,
const uint32_t mi_col) {
const uint32_t scale_horz = plane_ptr->subsampling_x;
const uint32_t scale_vert = plane_ptr->subsampling_y;
uint8_t *const dst_ptr = plane_ptr->dst.buf;
const int dst_stride = plane_ptr->dst.stride;
const int y_range = cm->mi_rows >> scale_vert;
const int x_range = cm->mi_cols >> scale_horz;
for (int y = 0; y < y_range; y++) {
uint8_t *p = dst_ptr + y * MI_SIZE * dst_stride;
for (int x = 0; x < x_range;) {
// inner loop always filter vertical edges in a MI block. If MI size
// is 8x8, it will filter the vertical edge aligned with a 8x8 block.
// If 4x4 transform is used, it will then filter the internal edge
// aligned with a 4x4 block
const uint32_t curr_x = ((mi_col * MI_SIZE) >> scale_horz) + x * MI_SIZE;
const uint32_t curr_y = ((mi_row * MI_SIZE) >> scale_vert) + y * MI_SIZE;
uint32_t advance_units;
TX_SIZE tx_size;
AV1_DEBLOCKING_PARAMETERS params;
memset(¶ms, 0, sizeof(params));
tx_size =
set_lpf_parameters(¶ms, ((ptrdiff_t)1 << scale_horz), cm, xd,
VERT_EDGE, curr_x, curr_y, plane, plane_ptr);
if (tx_size == TX_INVALID) {
params.filter_length = 0;
tx_size = TX_4X4;
}
// advance the destination pointer
advance_units = tx_size_wide_unit[tx_size];
x += advance_units;
p += advance_units * MI_SIZE;
}
}
}
void av1_filter_block_plane_horz_test(const AV1_COMMON *const cm,
const MACROBLOCKD *const xd,
const int plane,
const MACROBLOCKD_PLANE *const plane_ptr,
const uint32_t mi_row,
const uint32_t mi_col) {
const uint32_t scale_horz = plane_ptr->subsampling_x;
const uint32_t scale_vert = plane_ptr->subsampling_y;
uint8_t *const dst_ptr = plane_ptr->dst.buf;
const int dst_stride = plane_ptr->dst.stride;
const int y_range = cm->mi_rows >> scale_vert;
const int x_range = cm->mi_cols >> scale_horz;
for (int x = 0; x < x_range; x++) {
uint8_t *p = dst_ptr + x * MI_SIZE;
for (int y = 0; y < y_range;) {
// inner loop always filter vertical edges in a MI block. If MI size
// is 8x8, it will first filter the vertical edge aligned with a 8x8
// block. If 4x4 transform is used, it will then filter the internal
// edge aligned with a 4x4 block
const uint32_t curr_x = ((mi_col * MI_SIZE) >> scale_horz) + x * MI_SIZE;
const uint32_t curr_y = ((mi_row * MI_SIZE) >> scale_vert) + y * MI_SIZE;
uint32_t advance_units;
TX_SIZE tx_size;
AV1_DEBLOCKING_PARAMETERS params;
memset(¶ms, 0, sizeof(params));
tx_size =
set_lpf_parameters(¶ms, (cm->mi_stride << scale_vert), cm, xd,
HORZ_EDGE, curr_x, curr_y, plane, plane_ptr);
if (tx_size == TX_INVALID) {
params.filter_length = 0;
tx_size = TX_4X4;
}
// advance the destination pointer
advance_units = tx_size_high_unit[tx_size];
y += advance_units;
p += advance_units * dst_stride * MI_SIZE;
}
}
}
static void loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
MACROBLOCKD *xd, int start, int stop,
#if CONFIG_LPF_MASK
int is_decoding,
#endif
int plane_start, int plane_end) {
struct macroblockd_plane *pd = xd->plane;
const int col_start = 0;
const int col_end = cm->mi_cols;
int mi_row, mi_col;
int plane;
#if CONFIG_LPF_MASK
if (is_decoding) {
cm->is_decoding = is_decoding;
for (plane = plane_start; plane < plane_end; plane++) {
if (plane == 0 && !(cm->lf.filter_level[0]) && !(cm->lf.filter_level[1]))
break;
else if (plane == 1 && !(cm->lf.filter_level_u))
continue;
else if (plane == 2 && !(cm->lf.filter_level_v))
continue;
av1_setup_dst_planes(pd, frame_buffer, 0, 0, plane, plane + 1, NULL);
av1_build_bitmask_vert_info(cm, &pd[plane], plane);
av1_build_bitmask_horz_info(cm, &pd[plane], plane);
// apply loop filtering which only goes through buffer once
for (mi_row = start; mi_row < stop; mi_row += MI_SIZE_64X64) {
for (mi_col = col_start; mi_col < col_end; mi_col += MI_SIZE_64X64) {
av1_setup_dst_planes(pd, frame_buffer, mi_row, mi_col, plane,
plane + 1, NULL);
av1_filter_block_plane_bitmask_vert(cm, &pd[plane], plane, mi_row,
mi_col);
if (mi_col - MI_SIZE_64X64 >= 0) {
av1_setup_dst_planes(pd, frame_buffer, mi_row,
mi_col - MI_SIZE_64X64, plane, plane + 1,
NULL);
av1_filter_block_plane_bitmask_horz(cm, &pd[plane], plane, mi_row,
mi_col - MI_SIZE_64X64);
}
}
av1_setup_dst_planes(pd, frame_buffer, mi_row, mi_col - MI_SIZE_64X64,
plane, plane + 1, NULL);
av1_filter_block_plane_bitmask_horz(cm, &pd[plane], plane, mi_row,
mi_col - MI_SIZE_64X64);
}
}
return;
}
#endif
for (plane = plane_start; plane < plane_end; plane++) {
if (plane == 0 && !(cm->lf.filter_level[0]) && !(cm->lf.filter_level[1]))
break;
else if (plane == 1 && !(cm->lf.filter_level_u))
continue;
else if (plane == 2 && !(cm->lf.filter_level_v))
continue;
if (cm->lf.combine_vert_horz_lf) {
// filter all vertical and horizontal edges in every 128x128 super block
for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) {
for (mi_col = col_start; mi_col < col_end; mi_col += MAX_MIB_SIZE) {
// filter vertical edges
av1_setup_dst_planes(pd, frame_buffer, mi_row, mi_col, plane,
plane + 1, NULL);
av1_filter_block_plane_vert(cm, xd, plane, &pd[plane], mi_row,
mi_col);
// filter horizontal edges
if (mi_col - MAX_MIB_SIZE >= 0) {
av1_setup_dst_planes(pd, frame_buffer, mi_row,
mi_col - MAX_MIB_SIZE, plane, plane + 1, NULL);
av1_filter_block_plane_horz(cm, xd, plane, &pd[plane], mi_row,
mi_col - MAX_MIB_SIZE);
}
}
// filter horizontal edges
av1_setup_dst_planes(pd, frame_buffer, mi_row, mi_col - MAX_MIB_SIZE,
plane, plane + 1, NULL);
av1_filter_block_plane_horz(cm, xd, plane, &pd[plane], mi_row,
mi_col - MAX_MIB_SIZE);
}
} else {
// filter all vertical edges in every 128x128 super block
for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) {
for (mi_col = col_start; mi_col < col_end; mi_col += MAX_MIB_SIZE) {
av1_setup_dst_planes(pd, frame_buffer, mi_row, mi_col, plane,
plane + 1, NULL);
av1_filter_block_plane_vert(cm, xd, plane, &pd[plane], mi_row,
mi_col);
}
}
// filter all horizontal edges in every 128x128 super block
for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) {
for (mi_col = col_start; mi_col < col_end; mi_col += MAX_MIB_SIZE) {
av1_setup_dst_planes(pd, frame_buffer, mi_row, mi_col, plane,
plane + 1, NULL);
av1_filter_block_plane_horz(cm, xd, plane, &pd[plane], mi_row,
mi_col);
}
}
}
}
}
void av1_loop_filter_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
MACROBLOCKD *xd,
#if CONFIG_LPF_MASK
int is_decoding,
#endif
int plane_start, int plane_end, int partial_frame) {
int start_mi_row, end_mi_row, mi_rows_to_filter;
start_mi_row = 0;
mi_rows_to_filter = cm->mi_rows;
if (partial_frame && cm->mi_rows > 8) {
start_mi_row = cm->mi_rows >> 1;
start_mi_row &= 0xfffffff8;
mi_rows_to_filter = AOMMAX(cm->mi_rows / 8, 8);
}
end_mi_row = start_mi_row + mi_rows_to_filter;
av1_loop_filter_frame_init(cm, plane_start, plane_end);
loop_filter_rows(frame, cm, xd, start_mi_row, end_mi_row,
#if CONFIG_LPF_MASK
is_decoding,
#endif
plane_start, plane_end);
}
|
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# 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.
# ==============================================================================
# pylint: disable=protected-access
"""Contains the base Layer class, from which all layers inherit."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import functools
import inspect # Necessary supplement to tf_inspect to deal with variadic args.
import itertools
import json
import numpy as np
from six.moves import zip # pylint: disable=redefined-builtin
from tensorflow.core.framework import node_def_pb2
from tensorflow.python import autograph
from tensorflow.python.distribute import distribution_strategy_context as ds_context
from tensorflow.python.distribute import values as distribute_values
from tensorflow.python.eager import context
from tensorflow.python.eager import execute
from tensorflow.python.eager import function
from tensorflow.python.framework import auto_control_deps
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import func_graph
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_spec
from tensorflow.python.framework import tensor_util
from tensorflow.python.keras import backend
from tensorflow.python.keras import constraints
from tensorflow.python.keras import initializers
from tensorflow.python.keras import regularizers
from tensorflow.python.keras.engine import base_layer_utils
from tensorflow.python.keras.engine import input_spec
from tensorflow.python.keras.engine import node as node_module
from tensorflow.python.keras.mixed_precision.experimental import autocast_variable
from tensorflow.python.keras.mixed_precision.experimental import policy
from tensorflow.python.keras.saving import saved_model
from tensorflow.python.keras.utils import generic_utils
from tensorflow.python.keras.utils import tf_utils
# A module that only depends on `keras.layers` import these from here.
from tensorflow.python.keras.utils.generic_utils import serialize_keras_object
from tensorflow.python.keras.utils.generic_utils import to_snake_case # pylint: disable=unused-import
from tensorflow.python.keras.utils.tf_utils import is_tensor_or_tensor_list # pylint: disable=unused-import
from tensorflow.python.module import module
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import resource_variable_ops
from tensorflow.python.ops import variables as tf_variables
from tensorflow.python.training.tracking import base as trackable
from tensorflow.python.training.tracking import data_structures
from tensorflow.python.training.tracking import layer_utils as trackable_layer_utils
from tensorflow.python.training.tracking import object_identity
from tensorflow.python.training.tracking import tracking
from tensorflow.python.util import compat
from tensorflow.python.util import deprecation
from tensorflow.python.util import nest
from tensorflow.python.util import serialization
from tensorflow.python.util import tf_decorator
from tensorflow.python.util import tf_inspect
from tensorflow.python.util.tf_export import keras_export
from tensorflow.tools.docs import doc_controls
# Prefix that is added to the TF op layer names.
_TF_OP_LAYER_NAME_PREFIX = 'tf_op_layer_'
@keras_export('keras.layers.Layer')
class Layer(module.Module):
"""Base layer class.
This is the class from which all layers inherit.
A layer is a class implementing common neural networks operations, such
as convolution, batch norm, etc. These operations require managing weights,
losses, updates, and inter-layer connectivity.
Users will just instantiate a layer and then treat it as a callable.
We recommend that descendants of `Layer` implement the following methods:
* `__init__()`: Save configuration in member variables
* `build()`: Called once from `__call__`, when we know the shapes of inputs
and `dtype`. Should have the calls to `add_weight()`, and then
call the super's `build()` (which sets `self.built = True`, which is
nice in case the user wants to call `build()` manually before the
first `__call__`).
* `call()`: Called in `__call__` after making sure `build()` has been called
once. Should actually perform the logic of applying the layer to the
input tensors (which should be passed in as the first argument).
Arguments:
trainable: Boolean, whether the layer's variables should be trainable.
name: String name of the layer.
dtype: Default dtype of the layer's weights (default of `None` means use the
type of the first input).
dynamic: Set this to `True` if your layer should only be run eagerly, and
should not be used to generate a static computation graph.
This would be the case for a Tree-RNN or a recursive network,
for example, or generally for any layer that manipulates tensors
using Python control flow. If `False`, we assume that the layer can
safely be used to generate a static computation graph.
Read-only properties:
name: The name of the layer (string).
dtype: Default dtype of the layer's weights (default of `None` means use the
type of the first input).
updates: List of update ops of this layer.
losses: List of losses added by this layer.
trainable_weights: List of variables to be included in backprop.
non_trainable_weights: List of variables that should not be
included in backprop.
weights: The concatenation of the lists trainable_weights and
non_trainable_weights (in this order).
Mutable properties:
trainable: Whether the layer should be trained (boolean).
input_spec: Optional (list of) `InputSpec` object(s) specifying the
constraints on inputs that can be accepted by the layer.
"""
# See tf.Module for the usage of this property.
# The key for _obj_reference_counts_dict is a Trackable, which could be a
# variable or layer etc. tf.Module._flatten will fail to flatten the key
# since it is trying to convert Trackable to a string. This attribute can be
# ignored even after the fix of nest lib, since the trackable object should
# already been available as individual attributes. _obj_reference_counts_dict
# just contains a copy of them.
_TF_MODULE_IGNORED_PROPERTIES = frozenset(itertools.chain(
('_obj_reference_counts_dict',),
module.Module._TF_MODULE_IGNORED_PROPERTIES
))
@trackable.no_automatic_dependency_tracking
def __init__(self, trainable=True, name=None, dtype=None, dynamic=False,
**kwargs):
# These properties should be set by the user via keyword arguments.
# note that 'dtype', 'input_shape' and 'batch_input_shape'
# are only applicable to input layers: do not pass these keywords
# to non-input layers.
allowed_kwargs = {
'input_shape',
'batch_input_shape',
'batch_size',
'weights',
'activity_regularizer',
}
# Validate optional keyword arguments.
generic_utils.validate_kwargs(kwargs, allowed_kwargs)
# Mutable properties
# Indicates whether the layer's weights are updated during training
# and whether the layer's updates are run during training.
self._trainable = trainable
# A stateful layer is a layer whose updates are run during inference too,
# for instance stateful RNNs.
self.stateful = False
# Indicates whether `build` needs to be called upon layer call, to create
# the layer's weights.
self.built = False
# Provides information about which inputs are compatible with the layer.
self.input_spec = None
self.supports_masking = False
self._init_set_name(name)
self._activity_regularizer = kwargs.pop('activity_regularizer', None)
self._maybe_create_attribute('_trainable_weights', [])
self._maybe_create_attribute('_non_trainable_weights', [])
self._updates = []
# A list of zero-argument lambdas which return Tensors, used for variable
# regularizers.
self._callable_losses = []
# A list of symbolic Tensors containing activity regularizers and losses
# manually added through `add_loss` in graph-building mode.
self._losses = []
# A list of loss values containing activity regularizers and losses
# manually added through `add_loss` during eager execution. It is cleared
# after every batch.
# Because we plan on eventually allowing a same model instance to be trained
# in eager mode or graph mode alternatively, we need to keep track of
# eager losses and symbolic losses via separate attributes.
self._eager_losses = []
# A list of metric instances corresponding to the symbolic metric tensors
# added using the `add_metric` API.
self._metrics = []
# TODO(psv): Remove this property.
# A dictionary that maps metric names to metric result tensors. The results
# are the running averages of metric values over an epoch.
self._metrics_tensors = {}
self._set_dtype_and_policy(dtype)
self._call_convention = (base_layer_utils
.CallConvention.EXPLICIT_INPUTS_ARGUMENT)
# Dependencies tracked via attribute assignment.
self._maybe_create_attribute('_layers', [])
# These lists will be filled via successive calls
# to self._add_inbound_node().
self._inbound_nodes = []
self._outbound_nodes = []
call_fn_args = self._call_fn_args
self._expects_training_arg = ('training' in call_fn_args or
self._call_accepts_kwargs)
self._expects_mask_arg = ('mask' in call_fn_args or
self._call_accepts_kwargs)
# Whether the `call` method can be used to build a TF graph without issues.
self._dynamic = dynamic
# Manage input shape information if passed.
if 'input_shape' in kwargs or 'batch_input_shape' in kwargs:
# In this case we will later create an input layer
# to insert before the current layer
if 'batch_input_shape' in kwargs:
batch_input_shape = tuple(kwargs['batch_input_shape'])
elif 'input_shape' in kwargs:
if 'batch_size' in kwargs:
batch_size = kwargs['batch_size']
else:
batch_size = None
batch_input_shape = (batch_size,) + tuple(kwargs['input_shape'])
self._batch_input_shape = batch_input_shape
# Manage initial weight values if passed.
if 'weights' in kwargs:
self._initial_weights = kwargs['weights']
else:
self._initial_weights = None
def build(self, input_shape):
"""Creates the variables of the layer (optional, for subclass implementers).
This is a method that implementers of subclasses of `Layer` or `Model`
can override if they need a state-creation step in-between
layer instantiation and layer call.
This is typically used to create the weights of `Layer` subclasses.
Arguments:
input_shape: Instance of `TensorShape`, or list of instances of
`TensorShape` if the layer expects a list of inputs
(one instance per input).
"""
self.built = True
@doc_controls.for_subclass_implementers
def call(self, inputs, **kwargs): # pylint: disable=unused-argument
"""This is where the layer's logic lives.
Arguments:
inputs: Input tensor, or list/tuple of input tensors.
**kwargs: Additional keyword arguments.
Returns:
A tensor or list/tuple of tensors.
"""
return inputs
@doc_controls.for_subclass_implementers
def add_weight(self,
name=None,
shape=None,
dtype=None,
initializer=None,
regularizer=None,
trainable=None,
constraint=None,
partitioner=None,
use_resource=None,
synchronization=tf_variables.VariableSynchronization.AUTO,
aggregation=tf_variables.VariableAggregation.NONE,
**kwargs):
"""Adds a new variable to the layer.
Arguments:
name: Variable name.
shape: Variable shape. Defaults to scalar if unspecified.
dtype: The type of the variable. Defaults to `self.dtype` or `float32`.
initializer: Initializer instance (callable).
regularizer: Regularizer instance (callable).
trainable: Boolean, whether the variable should be part of the layer's
"trainable_variables" (e.g. variables, biases)
or "non_trainable_variables" (e.g. BatchNorm mean and variance).
Note that `trainable` cannot be `True` if `synchronization`
is set to `ON_READ`.
constraint: Constraint instance (callable).
partitioner: Partitioner to be passed to the `Trackable` API.
use_resource: Whether to use `ResourceVariable`.
synchronization: Indicates when a distributed a variable will be
aggregated. Accepted values are constants defined in the class
`tf.VariableSynchronization`. By default the synchronization is set to
`AUTO` and the current `DistributionStrategy` chooses
when to synchronize. If `synchronization` is set to `ON_READ`,
`trainable` must not be set to `True`.
aggregation: Indicates how a distributed variable will be aggregated.
Accepted values are constants defined in the class
`tf.VariableAggregation`.
**kwargs: Additional keyword arguments. Accepted values are `getter` and
`collections`.
Returns:
The created variable. Usually either a `Variable` or `ResourceVariable`
instance. If `partitioner` is not `None`, a `PartitionedVariable`
instance is returned.
Raises:
RuntimeError: If called with partitioned variable regularization and
eager execution is enabled.
ValueError: When giving unsupported dtype and no initializer or when
trainable has been set to True with synchronization set as `ON_READ`.
"""
if shape is None:
shape = ()
# Validate optional keyword arguments.
for kwarg in kwargs:
if kwarg not in ['getter', 'collections', 'experimental_autocast']:
raise TypeError('Unknown keyword argument:', kwarg)
getter = kwargs.pop('getter', base_layer_utils.make_variable)
collections_arg = kwargs.pop('collections', None)
# 'experimental_autocast' can be set to False by the caller to indicate an
# AutoCastVariable should never be created.
autocast = kwargs.pop('experimental_autocast', True)
if dtype is None:
dtype = self.dtype or backend.floatx()
dtype = dtypes.as_dtype(dtype)
if self._dtype is None:
self._dtype = dtype.base_dtype.name
initializer = initializers.get(initializer)
regularizer = regularizers.get(regularizer)
constraint = constraints.get(constraint)
if synchronization == tf_variables.VariableSynchronization.ON_READ:
if trainable:
raise ValueError(
'Synchronization value can be set to '
'VariableSynchronization.ON_READ only for non-trainable variables. '
'You have specified trainable=True and '
'synchronization=VariableSynchronization.ON_READ.')
else:
# Set trainable to be false when variable is to be synced on read.
trainable = False
elif trainable is None:
trainable = True
# Initialize variable when no initializer provided
if initializer is None:
# If dtype is DT_FLOAT, provide a uniform unit scaling initializer
if dtype.is_floating:
initializer = initializers.glorot_uniform()
# If dtype is DT_INT/DT_UINT, provide a default value `zero`
# If dtype is DT_BOOL, provide a default value `FALSE`
elif dtype.is_integer or dtype.is_unsigned or dtype.is_bool:
initializer = initializers.zeros()
# NOTES:Do we need to support for handling DT_STRING and DT_COMPLEX here?
else:
raise ValueError('An initializer for variable %s of type %s is required'
' for layer %s' % (name, dtype.base_dtype, self.name))
if autocast and self._mixed_precision_policy.should_cast_variables:
# Wrap 'getter' with a version that returns an AutoCastVariable.
old_getter = getter
def getter(*args, **kwargs): # pylint: disable=function-redefined
variable = old_getter(*args, **kwargs)
if isinstance(variable, distribute_values.DistributedVariable):
return autocast_variable.AutoCastDistributedVariable(variable)
else:
return autocast_variable.AutoCastVariable(variable)
variable = self._add_variable_with_custom_getter(
name=name,
shape=shape,
# TODO(allenl): a `make_variable` equivalent should be added as a
# `Trackable` method.
getter=getter,
# Manage errors in Layer rather than Trackable.
overwrite=True,
initializer=initializer,
dtype=dtype,
constraint=constraint,
trainable=trainable,
partitioner=partitioner,
use_resource=use_resource,
collections=collections_arg,
synchronization=synchronization,
aggregation=aggregation)
backend.track_variable(variable)
if regularizer is not None:
# TODO(fchollet): in the future, this should be handled at the
# level of variable creation, and weight regularization losses
# should be variable attributes.
name_in_scope = variable.name[:variable.name.find(':')]
self._handle_weight_regularization(name_in_scope,
variable,
regularizer)
if trainable:
self._trainable_weights.append(variable)
else:
self._non_trainable_weights.append(variable)
return variable
def get_config(self):
"""Returns the config of the layer.
A layer config is a Python dictionary (serializable)
containing the configuration of a layer.
The same layer can be reinstantiated later
(without its trained weights) from this configuration.
The config of a layer does not include connectivity
information, nor the layer class name. These are handled
by `Network` (one layer of abstraction above).
Returns:
Python dictionary.
"""
config = {'name': self.name, 'trainable': self.trainable}
if hasattr(self, '_batch_input_shape'):
config['batch_input_shape'] = self._batch_input_shape
if hasattr(self, 'dtype'):
config['dtype'] = self.dtype
# TODO(reedwm): Handle serializing self._mixed_precision_policy.
return config
@classmethod
def from_config(cls, config):
"""Creates a layer from its config.
This method is the reverse of `get_config`,
capable of instantiating the same layer from the config
dictionary. It does not handle layer connectivity
(handled by Network), nor weights (handled by `set_weights`).
Arguments:
config: A Python dictionary, typically the
output of get_config.
Returns:
A layer instance.
"""
return cls(**config)
def compute_output_shape(self, input_shape):
"""Computes the output shape of the layer.
If the layer has not been built, this method will call `build` on the
layer. This assumes that the layer will later be used with inputs that
match the input shape provided here.
Arguments:
input_shape: Shape tuple (tuple of integers)
or list of shape tuples (one per output tensor of the layer).
Shape tuples can include None for free dimensions,
instead of an integer.
Returns:
An input shape tuple.
"""
if context.executing_eagerly():
# In this case we build the model first in order to do shape inference.
# This is acceptable because the framework only calls
# `compute_output_shape` on shape values that the layer would later be
# built for. It would however cause issues in case a user attempts to
# use `compute_output_shape` manually with shapes that are incompatible
# with the shape the Layer will be called on (these users will have to
# implement `compute_output_shape` themselves).
self._maybe_build(input_shape)
with context.graph_mode():
graph = func_graph.FuncGraph('graph')
with graph.as_default():
input_shape = tf_utils.convert_shapes(input_shape, to_tuples=False)
inputs = nest.map_structure(
base_layer_utils.generate_placeholders_from_shape, input_shape)
try:
if self._expects_training_arg:
outputs = self(inputs, training=False)
else:
outputs = self(inputs)
except TypeError:
raise NotImplementedError('We could not automatically infer '
'the static shape of the layer\'s output.'
' Please implement the '
'`compute_output_shape` method on your '
'layer (%s).' % self.__class__.__name__)
return nest.map_structure(lambda t: t.shape, outputs)
raise NotImplementedError
@doc_controls.for_subclass_implementers
def compute_output_signature(self, input_signature):
"""Compute the output tensor signature of the layer based on the inputs.
Unlike a TensorShape object, a TensorSpec object contains both shape
and dtype information for a tensor. This method allows layers to provide
output dtype information if it is different from the input dtype.
For any layer that doesn't implement this function,
the framework will fall back to use `compute_output_shape`, and will
assume that the output dtype matches the input dtype.
Args:
input_signature: Single TensorSpec or nested structure of TensorSpec
objects, describing a candidate input for the layer.
Returns:
Single TensorSpec or nested structure of TensorSpec objects, describing
how the layer would transform the provided input.
Raises:
TypeError: If input_signature contains a non-TensorSpec object.
"""
def check_type_return_shape(s):
if not isinstance(s, tensor_spec.TensorSpec):
raise TypeError(
'Only TensorSpec signature types are supported, '
'but saw signature signature entry: {}.'.format(s))
return s.shape
input_shape = nest.map_structure(check_type_return_shape, input_signature)
output_shape = self.compute_output_shape(input_shape)
if self._mixed_precision_policy.should_cast_variables:
# If using mixed precision, and weights are cast to input dtype, we should
# not infer the dtype from self.dtype
dtype = None
else:
dtype = self.dtype
if dtype is None:
input_dtypes = [s.dtype for s in nest.flatten(input_signature)]
# Default behavior when self.dtype is None, is to use the first input's
# dtype.
dtype = input_dtypes[0]
return nest.map_structure(
lambda s: tensor_spec.TensorSpec(dtype=dtype, shape=s),
output_shape)
@base_layer_utils.default
def compute_mask(self, inputs, mask=None): # pylint: disable=unused-argument
"""Computes an output mask tensor.
Arguments:
inputs: Tensor or list of tensors.
mask: Tensor or list of tensors.
Returns:
None or a tensor (or list of tensors,
one per output tensor of the layer).
"""
if not self.supports_masking:
if any(m is not None for m in nest.flatten(mask)):
raise TypeError('Layer ' + self.name + ' does not support masking, '
'but was passed an input_mask: ' + str(mask))
# masking not explicitly supported: return None as mask.
return None
# if masking is explicitly supported, by default
# carry over the input mask
return mask
def __call__(self, inputs, *args, **kwargs):
"""Wraps `call`, applying pre- and post-processing steps.
Arguments:
inputs: input tensor(s).
*args: additional positional arguments to be passed to `self.call`.
**kwargs: additional keyword arguments to be passed to `self.call`.
Returns:
Output tensor(s).
Note:
- The following optional keyword arguments are reserved for specific uses:
* `training`: Boolean scalar tensor of Python boolean indicating
whether the `call` is meant for training or inference.
* `mask`: Boolean input mask.
- If the layer's `call` method takes a `mask` argument (as some Keras
layers do), its default value will be set to the mask generated
for `inputs` by the previous layer (if `input` did come from
a layer that generated a corresponding mask, i.e. if it came from
a Keras layer with masking support.
Raises:
ValueError: if the layer's `call` method returns None (an invalid value).
"""
call_context = base_layer_utils.call_context()
input_list = nest.flatten(inputs)
# We will attempt to build a TF graph if & only if all inputs are symbolic.
# This is always the case in graph mode. It can also be the case in eager
# mode when all inputs can be traced back to `keras.Input()` (when building
# models using the functional API).
build_graph = tf_utils.are_all_symbolic_tensors(input_list)
# Accept NumPy and scalar inputs by converting to Tensors.
if any(isinstance(x, (np.ndarray, float, int)) for x in input_list):
def _convert_non_tensor(x):
# Don't call `ops.convert_to_tensor` on all `inputs` because
# `SparseTensors` can't be converted to `Tensor`.
if isinstance(x, (np.ndarray, float, int)):
return ops.convert_to_tensor(x)
return x
inputs = nest.map_structure(_convert_non_tensor, inputs)
input_list = nest.flatten(inputs)
# Handle `mask` propagation from previous layer to current layer. Masks can
# be propagated explicitly via the `mask` argument, or implicitly via
# setting the `_keras_mask` attribute on the inputs to a Layer. Masks passed
# explicitly take priority.
input_masks = self._collect_input_masks(inputs, args, kwargs)
if (self._expects_mask_arg and input_masks is not None and
not self._call_arg_was_passed('mask', args, kwargs)):
kwargs['mask'] = input_masks
# If `training` argument was not explicitly passed, propagate `training`
# value from this layer's calling layer.
training_arg_passed_by_framework = False
# Priority 1: `training` was explicitly passed.
if self._call_arg_was_passed('training', args, kwargs):
training_value = self._get_call_arg_value('training', args, kwargs)
if not self._expects_training_arg:
kwargs.pop('training')
else:
training_value = None
# Priority 2: `training` was passed to a parent layer.
if call_context.training is not None:
training_value = call_context.training
# Priority 3a: `learning_phase()` has been set.
elif backend.global_learning_phase_is_set():
training_value = backend.learning_phase()
# Priority 3b: Pass the `learning_phase()` if in the Keras FuncGraph.
elif build_graph:
with backend.get_graph().as_default():
if base_layer_utils.is_in_keras_graph():
training_value = backend.learning_phase()
if self._expects_training_arg and training_value is not None:
kwargs['training'] = training_value
training_arg_passed_by_framework = True
# Only create Keras history if at least one tensor originates from a
# `keras.Input`. Otherwise this Layer may be being used outside the Keras
# framework.
if build_graph and base_layer_utils.needs_keras_history(inputs):
base_layer_utils.create_keras_history(inputs)
# Clear eager losses on top level model call.
# We are clearing the losses only on the top level model call and not on
# every layer/model call because layer/model may be reused.
if (base_layer_utils.is_in_eager_or_tf_function() and
not call_context.in_call):
self._clear_losses()
with call_context.enter(self, inputs, build_graph, training_value):
# Check input assumptions set after layer building, e.g. input shape.
if build_graph:
# Symbolic execution on symbolic tensors. We will attempt to build
# the corresponding TF subgraph inside `backend.get_graph()`
input_spec.assert_input_compatibility(self.input_spec, inputs,
self.name)
graph = backend.get_graph()
with graph.as_default(), backend.name_scope(self._name_scope()):
# Build layer if applicable (if the `build` method has been
# overridden).
self._maybe_build(inputs)
# Wrapping `call` function in autograph to allow for dynamic control
# dependencies in call. We are limiting this to subclassed layers as
# autograph is strictly needed only for subclassed layers and models.
# As an additional optimization, we avoid calling autograph if the
# function is already converted or marked for no conversion. The
# effect is largely cosmetic - it avoid four extra frames in the call
# stack.
if (base_layer_utils.is_subclassed(self)
and not hasattr(self.call, '__ag_compiled')):
decorators, original_func = tf_decorator.unwrap(self.call)
converted_func = autograph.convert(recursive=True)(original_func)
if decorators:
call_fn = tf_decorator.rewrap(self.call, original_func,
converted_func)
else:
call_fn = converted_func
else:
call_fn = self.call
if not self.dynamic:
try:
with base_layer_utils.autocast_context_manager(
input_list,
self._mixed_precision_policy.should_cast_variables):
# Add auto_control_deps in V2 when they are not already added by
# a `tf.function`.
if (ops.executing_eagerly_outside_functions() and
not base_layer_utils.is_in_eager_or_tf_function()):
with auto_control_deps.AutomaticControlDependencies() as acd:
outputs = call_fn(inputs, *args, **kwargs)
# Wrap Tensors in `outputs` in `tf.identity` to avoid
# circular dependencies.
outputs = base_layer_utils.mark_as_return(outputs, acd)
else:
outputs = call_fn(inputs, *args, **kwargs)
except TypeError as e:
exception_str = str(e)
exception_msg = 'Tensor objects are only iterable when eager'
if exception_msg in exception_str:
raise TypeError('You are attempting to use Python control '
'flow in a layer that was not declared to be '
'dynamic. Pass `dynamic=True` to the class '
'constructor.\nEncountered error:\n"""\n' +
exception_str + '\n"""')
raise
else:
# We will use static shape inference to return symbolic tensors
# matching the specifications of the layer outputs.
# Since `self.dynamic` is True, we will never attempt to
# run the underlying TF graph (which is disconnected).
# TODO(fchollet): consider py_func as an alternative, which
# would enable us to run the underlying graph if needed.
outputs = self._symbolic_call(inputs)
if outputs is None:
raise ValueError('A layer\'s `call` method should return a '
'Tensor or a list of Tensors, not None '
'(layer: ' + self.name + ').')
if base_layer_utils.have_all_keras_metadata(inputs):
if training_arg_passed_by_framework:
kwargs.pop('training')
inputs, outputs = self._set_connectivity_metadata_(
inputs, outputs, args, kwargs)
self._handle_activity_regularization(inputs, outputs)
self._set_mask_metadata(inputs, outputs, input_masks)
if hasattr(self, '_set_inputs') and not self.inputs:
# Subclassed network: explicitly set metadata normally set by
# a call to self._set_inputs().
# TODO(b/120997007): This should be done in Eager as well, but
# causes garbage collection issues because of the placeholders
# created on the default Keras graph.
self._set_inputs(inputs, outputs)
else:
# Eager execution on data tensors.
with backend.name_scope(self._name_scope()):
self._maybe_build(inputs)
with base_layer_utils.autocast_context_manager(
input_list, self._mixed_precision_policy.should_cast_variables):
outputs = self.call(inputs, *args, **kwargs)
self._handle_activity_regularization(inputs, outputs)
self._set_mask_metadata(inputs, outputs, input_masks)
return outputs
@property
def dtype(self):
return self._dtype
@property
def name(self):
return self._name
@property
def dynamic(self):
return self._dynamic
@property
def trainable(self):
return self._trainable
@trainable.setter
def trainable(self, value):
self._trainable = value
for layer in getattr(self, '_layers', []):
layer.trainable = value
@property
def activity_regularizer(self):
"""Optional regularizer function for the output of this layer."""
return self._activity_regularizer
@activity_regularizer.setter
def activity_regularizer(self, regularizer):
"""Optional regularizer function for the output of this layer."""
self._activity_regularizer = regularizer
@property
def input_spec(self):
return self._input_spec
@input_spec.setter
# Must be decorated to prevent tracking, since the input_spec can be nested
# InputSpec objects.
@trackable.no_automatic_dependency_tracking
def input_spec(self, value):
for v in nest.flatten(value):
if v is not None and not isinstance(v, InputSpec):
raise TypeError('Layer input_spec must be an instance of InputSpec. '
'Got: {}'.format(v))
self._input_spec = value
@property
def trainable_weights(self):
if self.trainable:
nested = self._gather_children_attribute('trainable_weights')
return self._trainable_weights + nested
else:
return []
@property
def non_trainable_weights(self):
if self.trainable:
nested = self._gather_children_attribute('non_trainable_weights')
return self._non_trainable_weights + nested
else:
nested = self._gather_children_attribute('weights')
return self._trainable_weights + self._non_trainable_weights + nested
@property
def weights(self):
"""Returns the list of all layer variables/weights.
Returns:
A list of variables.
"""
return self.trainable_weights + self.non_trainable_weights
@property
def updates(self):
if not self.trainable and not self.stateful:
return []
with backend.get_graph().as_default():
updates = []
for u in self._updates:
if callable(u):
try:
u = u()
except ValueError as e:
if 'Trying to capture a tensor from an inner function' in str(e):
base_layer_utils.check_graph_consistency(
method='add_update', force_raise=True)
raise
base_layer_utils.check_graph_consistency(u, method='add_update')
updates.append(u)
return updates + self._gather_children_attribute('updates')
@property
def losses(self):
"""Losses which are associated with this `Layer`.
Variable regularization tensors are created when this property is accessed,
so it is eager safe: accessing `losses` under a `tf.GradientTape` will
propagate gradients back to the corresponding variables.
Returns:
A list of tensors.
"""
collected_losses = []
# If any eager losses are present, we assume the model to be part of an
# eager training loop (either a custom one or the one used when
# `run_eagerly=True`), and so we always return just the eager losses in that
# case.
if self._eager_losses:
collected_losses.extend(self._eager_losses)
else:
collected_losses.extend(self._losses)
for regularizer in self._callable_losses:
loss_tensor = regularizer()
if loss_tensor is not None:
collected_losses.append(loss_tensor)
return collected_losses + self._gather_children_attribute('losses')
@doc_controls.for_subclass_implementers
def add_loss(self, losses, inputs=None):
"""Add loss tensor(s), potentially dependent on layer inputs.
Some losses (for instance, activity regularization losses) may be dependent
on the inputs passed when calling a layer. Hence, when reusing the same
layer on different inputs `a` and `b`, some entries in `layer.losses` may
be dependent on `a` and some on `b`. This method automatically keeps track
of dependencies.
This method can be used inside a subclassed layer or model's `call`
function, in which case `losses` should be a Tensor or list of Tensors.
Example:
```python
class MyLayer(tf.keras.layers.Layer):
def call(inputs, self):
self.add_loss(tf.abs(tf.reduce_mean(inputs)), inputs=True)
return inputs
```
This method can also be called directly on a Functional Model during
construction. In this case, any loss Tensors passed to this Model must
be symbolic and be able to be traced back to the model's `Input`s. These
losses become part of the model's topology and are tracked in `get_config`.
Example:
```python
inputs = tf.keras.Input(shape=(10,))
x = tf.keras.layers.Dense(10)(inputs)
outputs = tf.keras.layers.Dense(1)(x)
model = tf.keras.Model(inputs, outputs)
# Actvity regularization.
model.add_loss(tf.abs(tf.reduce_mean(x)))
```
If this is not the case for your loss (if, for example, your loss references
a `Variable` of one of the model's layers), you can wrap your loss in a
zero-argument lambda. These losses are not tracked as part of the model's
topology since they can't be serialized.
Example:
```python
inputs = tf.keras.Input(shape=(10,))
x = tf.keras.layers.Dense(10)(inputs)
outputs = tf.keras.layers.Dense(1)(x)
model = tf.keras.Model(inputs, outputs)
# Weight regularization.
model.add_loss(lambda: tf.reduce_mean(x.kernel))
```
The `get_losses_for` method allows to retrieve the losses relevant to a
specific set of inputs.
Arguments:
losses: Loss tensor, or list/tuple of tensors. Rather than tensors, losses
may also be zero-argument callables which create a loss tensor.
inputs: Ignored when executing eagerly. If anything other than None is
passed, it signals the losses are conditional on some of the layer's
inputs, and thus they should only be run where these inputs are
available. This is the case for activity regularization losses, for
instance. If `None` is passed, the losses are assumed
to be unconditional, and will apply across all dataflows of the layer
(e.g. weight regularization losses).
"""
def _tag_unconditional(loss):
if callable(loss):
loss = loss()
if loss is None:
return None # Will be filtered out when computing the .losses property
if not tensor_util.is_tensor(loss):
loss = ops.convert_to_tensor(loss, dtype=backend.floatx())
loss._unconditional_loss = (inputs is None) # pylint: disable=protected-access
return loss
losses = nest.flatten(losses)
callable_losses = []
eager_losses = []
symbolic_losses = []
for loss in losses:
if callable(loss):
callable_losses.append(functools.partial(_tag_unconditional, loss))
continue
if loss is None:
continue
if not tensor_util.is_tensor(loss):
loss = ops.convert_to_tensor(loss, dtype=backend.floatx())
# TF Functions should take the eager path.
if (tf_utils.is_symbolic_tensor(loss) and
not base_layer_utils.is_in_tf_function()):
symbolic_losses.append(_tag_unconditional(loss))
base_layer_utils.check_graph_consistency(loss, method='add_loss')
elif tensor_util.is_tensor(loss):
eager_losses.append(_tag_unconditional(loss))
self._callable_losses += callable_losses
in_call_context = base_layer_utils.call_context().in_call
if eager_losses and not in_call_context:
raise ValueError(
'Expected a symbolic Tensors or a callable for the loss value. '
'Please wrap your loss computation in a zero argument `lambda`.')
self._eager_losses += eager_losses
if in_call_context:
for symbolic_loss in symbolic_losses:
self._losses.append(symbolic_loss)
else:
for symbolic_loss in symbolic_losses:
if getattr(self, '_is_graph_network', False):
new_layers = base_layer_utils.create_keras_history(symbolic_loss)
# Losses must be keyed on inputs no matter what in order to
# be supported in DistributionStrategy.
add_loss_layer = AddLoss(unconditional=False)
add_loss_layer(symbolic_loss)
new_layers.append(add_loss_layer)
self._insert_layers(new_layers)
else:
# Possible a loss was added in a Layer's `build`.
self._losses.append(symbolic_loss)
@trackable.no_automatic_dependency_tracking
def _clear_losses(self):
"""Used every step in eager to reset losses."""
self._eager_losses = []
if hasattr(self, '_layers'):
for layer in trackable_layer_utils.filter_empty_layer_containers(
self._layers):
layer._clear_losses()
@property
def metrics(self):
return self._metrics + self._gather_children_attribute('metrics')
@doc_controls.for_subclass_implementers
def add_metric(self, value, aggregation=None, name=None):
"""Adds metric tensor to the layer.
Args:
value: Metric tensor.
aggregation: Sample-wise metric reduction function. If `aggregation=None`,
it indicates that the metric tensor provided has been aggregated
already. eg, `bin_acc = BinaryAccuracy(name='acc')` followed by
`model.add_metric(bin_acc(y_true, y_pred))`. If aggregation='mean', the
given metric tensor will be sample-wise reduced using `mean` function.
eg, `model.add_metric(tf.reduce_sum(outputs), name='output_mean',
aggregation='mean')`.
name: String metric name.
Raises:
ValueError: If `aggregation` is anything other than None or `mean`.
"""
if aggregation is not None and aggregation != 'mean':
raise ValueError(
'We currently support only `mean` sample-wise metric aggregation. '
'You provided aggregation=`%s`' % aggregation)
from_metric_obj = hasattr(value, '_metric_obj')
is_symbolic = tf_utils.is_symbolic_tensor(value)
in_call_context = base_layer_utils.call_context().in_call
if name is None and not from_metric_obj:
# Eg. `self.add_metric(math_ops.reduce_sum(x), aggregation='mean')`
# In eager mode, we use metric name to lookup a metric. Without a name,
# a new Mean metric wrapper will be created on every model/layer call.
# So, we raise an error when no name is provided.
# We will do the same for symbolic mode for consistency although a name
# will be generated if no name is provided.
# We will not raise this error in the foll use case for the sake of
# consistency as name in provided in the metric constructor.
# mean = metrics.Mean(name='my_metric')
# model.add_metric(mean(outputs))
raise ValueError('Please provide a name for your metric like '
'`self.add_metric(tf.reduce_sum(inputs), '
'name=\'mean_activation\', aggregation=\'mean\')`')
elif from_metric_obj:
name = value._metric_obj.name
if in_call_context:
# TF Function path should take the eager path.
if is_symbolic and not base_layer_utils.is_in_tf_function():
self._symbolic_add_metric(value, aggregation, name)
else:
self._eager_add_metric(value, aggregation, name)
else:
if not is_symbolic:
raise ValueError('Expected a symbolic Tensor for the metric value, '
'received: ' + str(value))
# Possible a metric was added in a Layer's `build`.
if not getattr(self, '_is_graph_network', False):
with backend.get_graph().as_default():
self._symbolic_add_metric(value, aggregation, name)
return
if from_metric_obj:
raise ValueError('Using the result of calling a `Metric` object '
'when calling `add_metric` on a Functional '
'Model is not supported. Please pass the '
'Tensor to monitor directly.')
# Insert layers into the Keras Graph Network.
new_layers = base_layer_utils.create_keras_history(value)
add_metric_layer = AddMetric(aggregation, name)
add_metric_layer(value)
new_layers.append(add_metric_layer)
self._insert_layers(new_layers)
@deprecation.deprecated_args(None, '`inputs` is now automatically inferred',
'inputs')
@doc_controls.for_subclass_implementers
def add_update(self, updates, inputs=None):
"""Add update op(s), potentially dependent on layer inputs.
Weight updates (for instance, the updates of the moving mean and variance
in a BatchNormalization layer) may be dependent on the inputs passed
when calling a layer. Hence, when reusing the same layer on
different inputs `a` and `b`, some entries in `layer.updates` may be
dependent on `a` and some on `b`. This method automatically keeps track
of dependencies.
The `get_updates_for` method allows to retrieve the updates relevant to a
specific set of inputs.
This call is ignored when eager execution is enabled (in that case, variable
updates are run on the fly and thus do not need to be tracked for later
execution).
Arguments:
updates: Update op, or list/tuple of update ops, or zero-arg callable
that returns an update op. A zero-arg callable should be passed in
order to disable running the updates by setting `trainable=False`
on this Layer, when executing in Eager mode.
inputs: Deprecated, will be automatically inferred.
"""
if ds_context.has_strategy() and ds_context.in_cross_replica_context():
# Updates don't need to be run in a cross-replica context.
if (ops.executing_eagerly_outside_functions() and
not base_layer_utils.is_in_keras_graph()):
raise RuntimeError( # pylint: disable=g-doc-exception
'`add_update` was called in a cross-replica context. This is not '
'expected. If you require this feature, please file an issue.')
return
updates = generic_utils.to_list(updates)
call_context = base_layer_utils.call_context()
# All updates can be run immediately in Eager or in a tf.function.
if base_layer_utils.is_in_eager_or_tf_function():
if not call_context.frozen:
for update in updates:
if callable(update):
update()
return
if call_context.in_call:
relevant_inputs = call_context.inputs
else:
inbound_nodes = getattr(self, '_inbound_nodes', [])
relevant_inputs = [node.input_tensors for node in inbound_nodes]
def process_update(x):
"""Standardize update ops.
Arguments:
x: Tensor, op, or callable.
Returns:
An update op.
"""
if callable(x):
update = lambda: process_update(x())
if not ops.executing_eagerly_outside_functions():
# In V1 mode, call the callable right away and process. This is needed
# for TPU strategy.
return update()
elif isinstance(x, ops.Operation):
update = x
elif hasattr(x, 'op'):
update = x.op
else:
update = ops.convert_to_tensor(x)
reachable = tf_utils.get_reachable_from_inputs(relevant_inputs, [update])
update._unconditional_update = update not in reachable
return update
updates = [process_update(x) for x in updates]
# Non-callable Updates are run automatically inside `call` in V2, so
# they do not need to be tracked later.
if ops.executing_eagerly_outside_functions() and call_context.in_call:
updates = [u for u in updates if callable(u)]
self._updates += updates
def set_weights(self, weights):
"""Sets the weights of the layer, from Numpy arrays.
Arguments:
weights: a list of Numpy arrays. The number
of arrays and their shape must match
number of the dimensions of the weights
of the layer (i.e. it should match the
output of `get_weights`).
Raises:
ValueError: If the provided weights list does not match the
layer's specifications.
"""
params = self.weights
if len(params) != len(weights):
raise ValueError('You called `set_weights(weights)` on layer "' +
self.name + '" with a weight list of length ' +
str(len(weights)) + ', but the layer was expecting ' +
str(len(params)) + ' weights. Provided weights: ' +
str(weights)[:50] + '...')
if not params:
return
weight_value_tuples = []
for p, w in zip(params, weights):
ref_shape = p.shape
if not ref_shape.is_compatible_with(w.shape):
raise ValueError('Layer weight shape ' + str(ref_shape) +
' not compatible with '
'provided weight shape ' + str(w.shape))
weight_value_tuples.append((p, w))
backend.batch_set_value(weight_value_tuples)
def get_weights(self):
"""Returns the current weights of the layer.
Returns:
Weights values as a list of numpy arrays.
"""
params = self.weights
return backend.batch_get_value(params)
def get_updates_for(self, inputs):
"""Retrieves updates relevant to a specific set of inputs.
Arguments:
inputs: Input tensor or list/tuple of input tensors.
Returns:
List of update ops of the layer that depend on `inputs`.
"""
if inputs is None:
# Requesting unconditional updates.
return [u for u in self.updates if u._unconditional_update]
# Requesting input-conditional updates.
updates = [u for u in self.updates if not u._unconditional_update]
inputs = nest.flatten(inputs)
reachable = tf_utils.get_reachable_from_inputs(inputs, updates)
return [u for u in updates if u in reachable]
def get_losses_for(self, inputs):
"""Retrieves losses relevant to a specific set of inputs.
Arguments:
inputs: Input tensor or list/tuple of input tensors.
Returns:
List of loss tensors of the layer that depend on `inputs`.
"""
if inputs is None:
# Requesting unconditional losses.
return [l for l in self.losses if l._unconditional_loss]
# Requesting input-conditional losses.
losses = [l for l in self.losses if not l._unconditional_loss]
inputs = nest.flatten(inputs)
reachable = tf_utils.get_reachable_from_inputs(inputs, losses)
return [l for l in losses if l in reachable]
def get_input_mask_at(self, node_index):
"""Retrieves the input mask tensor(s) of a layer at a given node.
Arguments:
node_index: Integer, index of the node
from which to retrieve the attribute.
E.g. `node_index=0` will correspond to the
first time the layer was called.
Returns:
A mask tensor
(or list of tensors if the layer has multiple inputs).
"""
inputs = self.get_input_at(node_index)
if isinstance(inputs, list):
return [getattr(x, '_keras_mask', None) for x in inputs]
else:
return getattr(inputs, '_keras_mask', None)
def get_output_mask_at(self, node_index):
"""Retrieves the output mask tensor(s) of a layer at a given node.
Arguments:
node_index: Integer, index of the node
from which to retrieve the attribute.
E.g. `node_index=0` will correspond to the
first time the layer was called.
Returns:
A mask tensor
(or list of tensors if the layer has multiple outputs).
"""
output = self.get_output_at(node_index)
if isinstance(output, list):
return [getattr(x, '_keras_mask', None) for x in output]
else:
return getattr(output, '_keras_mask', None)
@property
def input_mask(self):
"""Retrieves the input mask tensor(s) of a layer.
Only applicable if the layer has exactly one inbound node,
i.e. if it is connected to one incoming layer.
Returns:
Input mask tensor (potentially None) or list of input
mask tensors.
Raises:
AttributeError: if the layer is connected to
more than one incoming layers.
"""
inputs = self.input
if isinstance(inputs, list):
return [getattr(x, '_keras_mask', None) for x in inputs]
else:
return getattr(inputs, '_keras_mask', None)
@property
def output_mask(self):
"""Retrieves the output mask tensor(s) of a layer.
Only applicable if the layer has exactly one inbound node,
i.e. if it is connected to one incoming layer.
Returns:
Output mask tensor (potentially None) or list of output
mask tensors.
Raises:
AttributeError: if the layer is connected to
more than one incoming layers.
"""
output = self.output
if isinstance(output, list):
return [getattr(x, '_keras_mask', None) for x in output]
else:
return getattr(output, '_keras_mask', None)
def get_input_shape_at(self, node_index):
"""Retrieves the input shape(s) of a layer at a given node.
Arguments:
node_index: Integer, index of the node
from which to retrieve the attribute.
E.g. `node_index=0` will correspond to the
first time the layer was called.
Returns:
A shape tuple
(or list of shape tuples if the layer has multiple inputs).
Raises:
RuntimeError: If called in Eager mode.
"""
return self._get_node_attribute_at_index(node_index, 'input_shapes',
'input shape')
def get_output_shape_at(self, node_index):
"""Retrieves the output shape(s) of a layer at a given node.
Arguments:
node_index: Integer, index of the node
from which to retrieve the attribute.
E.g. `node_index=0` will correspond to the
first time the layer was called.
Returns:
A shape tuple
(or list of shape tuples if the layer has multiple outputs).
Raises:
RuntimeError: If called in Eager mode.
"""
return self._get_node_attribute_at_index(node_index, 'output_shapes',
'output shape')
def get_input_at(self, node_index):
"""Retrieves the input tensor(s) of a layer at a given node.
Arguments:
node_index: Integer, index of the node
from which to retrieve the attribute.
E.g. `node_index=0` will correspond to the
first time the layer was called.
Returns:
A tensor (or list of tensors if the layer has multiple inputs).
Raises:
RuntimeError: If called in Eager mode.
"""
return self._get_node_attribute_at_index(node_index, 'input_tensors',
'input')
def get_output_at(self, node_index):
"""Retrieves the output tensor(s) of a layer at a given node.
Arguments:
node_index: Integer, index of the node
from which to retrieve the attribute.
E.g. `node_index=0` will correspond to the
first time the layer was called.
Returns:
A tensor (or list of tensors if the layer has multiple outputs).
Raises:
RuntimeError: If called in Eager mode.
"""
return self._get_node_attribute_at_index(node_index, 'output_tensors',
'output')
@property
def input(self):
"""Retrieves the input tensor(s) of a layer.
Only applicable if the layer has exactly one input,
i.e. if it is connected to one incoming layer.
Returns:
Input tensor or list of input tensors.
Raises:
RuntimeError: If called in Eager mode.
AttributeError: If no inbound nodes are found.
"""
if not self._inbound_nodes:
raise AttributeError('Layer ' + self.name +
' is not connected, no input to return.')
return self._get_node_attribute_at_index(0, 'input_tensors', 'input')
@property
def output(self):
"""Retrieves the output tensor(s) of a layer.
Only applicable if the layer has exactly one output,
i.e. if it is connected to one incoming layer.
Returns:
Output tensor or list of output tensors.
Raises:
AttributeError: if the layer is connected to more than one incoming
layers.
RuntimeError: if called in Eager mode.
"""
if not self._inbound_nodes:
raise AttributeError('Layer ' + self.name + ' has no inbound nodes.')
return self._get_node_attribute_at_index(0, 'output_tensors', 'output')
@property
def input_shape(self):
"""Retrieves the input shape(s) of a layer.
Only applicable if the layer has exactly one input,
i.e. if it is connected to one incoming layer, or if all inputs
have the same shape.
Returns:
Input shape, as an integer shape tuple
(or list of shape tuples, one tuple per input tensor).
Raises:
AttributeError: if the layer has no defined input_shape.
RuntimeError: if called in Eager mode.
"""
if not self._inbound_nodes:
raise AttributeError('The layer has never been called '
'and thus has no defined input shape.')
all_input_shapes = set(
[str(node.input_shapes) for node in self._inbound_nodes])
if len(all_input_shapes) == 1:
return self._inbound_nodes[0].input_shapes
else:
raise AttributeError('The layer "' + str(self.name) +
' has multiple inbound nodes, '
'with different input shapes. Hence '
'the notion of "input shape" is '
'ill-defined for the layer. '
'Use `get_input_shape_at(node_index)` '
'instead.')
def count_params(self):
"""Count the total number of scalars composing the weights.
Returns:
An integer count.
Raises:
ValueError: if the layer isn't yet built
(in which case its weights aren't yet defined).
"""
if not self.built:
if self.__class__.__name__ == 'Sequential':
with tf_utils.maybe_init_scope(self):
self.build() # pylint: disable=no-value-for-parameter
else:
raise ValueError('You tried to call `count_params` on ' + self.name +
', but the layer isn\'t built. '
'You can build it manually via: `' + self.name +
'.build(batch_input_shape)`.')
return int(sum(np.prod(w.shape.as_list()) for w in self.weights))
@property
def output_shape(self):
"""Retrieves the output shape(s) of a layer.
Only applicable if the layer has one output,
or if all outputs have the same shape.
Returns:
Output shape, as an integer shape tuple
(or list of shape tuples, one tuple per output tensor).
Raises:
AttributeError: if the layer has no defined output shape.
RuntimeError: if called in Eager mode.
"""
if not self._inbound_nodes:
raise AttributeError('The layer has never been called '
'and thus has no defined output shape.')
all_output_shapes = set(
[str(node.output_shapes) for node in self._inbound_nodes])
if len(all_output_shapes) == 1:
return self._inbound_nodes[0].output_shapes
else:
raise AttributeError('The layer "%s"'
' has multiple inbound nodes, '
'with different output shapes. Hence '
'the notion of "output shape" is '
'ill-defined for the layer. '
'Use `get_output_shape_at(node_index)` '
'instead.' % self.name)
@property
@doc_controls.do_not_doc_inheritable
def inbound_nodes(self):
"""Deprecated, do NOT use! Only for compatibility with external Keras."""
return self._inbound_nodes
@property
@doc_controls.do_not_doc_inheritable
def outbound_nodes(self):
"""Deprecated, do NOT use! Only for compatibility with external Keras."""
return self._outbound_nodes
##############################################################################
# Methods & attributes below are public aliases of other methods. #
##############################################################################
@deprecation.deprecated(
date=None, instructions='Please use `layer.__call__` method instead.')
@doc_controls.do_not_doc_inheritable
def apply(self, inputs, *args, **kwargs):
"""Deprecated, do NOT use!
This is an alias of `self.__call__`.
Arguments:
inputs: Input tensor(s).
*args: additional positional arguments to be passed to `self.call`.
**kwargs: additional keyword arguments to be passed to `self.call`.
Returns:
Output tensor(s).
"""
return self.__call__(inputs, *args, **kwargs)
@deprecation.deprecated(
date=None, instructions='Please use `layer.add_weight` method instead.')
@doc_controls.do_not_doc_inheritable
def add_variable(self, *args, **kwargs):
"""Deprecated, do NOT use! Alias for `add_weight`."""
return self.add_weight(*args, **kwargs)
@property
def variables(self):
"""Returns the list of all layer variables/weights.
Alias of `self.weights`.
Returns:
A list of variables.
"""
return self.weights
@property
def trainable_variables(self):
return self.trainable_weights
@property
def non_trainable_variables(self):
return self.non_trainable_weights
##############################################################################
# Methods & attributes below are all private and only used by the framework. #
##############################################################################
def _set_dtype_and_policy(self, dtype):
"""Sets self._dtype and self._mixed_precision_policy."""
if dtype:
if isinstance(dtype, policy.Policy):
self._mixed_precision_policy = dtype
self._dtype = self._mixed_precision_policy.default_variable_dtype
else:
# If a non-policy dtype is passed, no casting should be done. So we use
# the "infer" policy, which does no casting.
self._mixed_precision_policy = policy.Policy('infer')
self._dtype = dtypes.as_dtype(dtype).name
else:
self._mixed_precision_policy = policy.global_policy()
# If the global policy has not been set, it will be an "infer" policy
# without a default variable dtype, and so self._dtype will be None. In
# that case, self._dtype will be set when the layer is built or called.
self._dtype = self._mixed_precision_policy.default_variable_dtype
def _name_scope(self):
return self.name
def _init_set_name(self, name, zero_based=True):
if not name:
self._name = backend.unique_object_name(
generic_utils.to_snake_case(self.__class__.__name__),
zero_based=zero_based)
else:
self._name = name
def _get_existing_metric(self, name=None):
match = [m for m in self._metrics if m.name == name]
if not match:
return
if len(match) > 1:
raise ValueError(
'Please provide different names for the metrics you have added. '
'We found {} metrics with the name: "{}"'.format(len(match), name))
return match[0]
def _eager_add_metric(self, value, aggregation=None, name=None):
# If the given metric is available in `metrics` list we just update state
# on it, otherwise we create a new metric instance and
# add it to the `metrics` list.
metric_obj = getattr(value, '_metric_obj', None)
if metric_obj:
name = metric_obj.name
match = self._get_existing_metric(name)
if match:
# Tensors that come from a Metric object already updated the Metric state.
if not metric_obj:
match(value)
return
if not metric_obj:
assert aggregation is not None
metric_obj, _ = base_layer_utils.create_mean_metric(value, name)
self._metrics.append(metric_obj)
def _symbolic_add_metric(self, value, aggregation=None, name=None):
base_layer_utils.check_graph_consistency(value, method='add_metric')
match = self._get_existing_metric(name)
if aggregation is None:
# Iterate over the metrics and check if the given metric exists already.
# This can happen when a metric instance is created in subclassed model
# layer `__init__` and we have tracked that instance already in
# model.__setattr__.
if match:
result_tensor = value
metric_obj = match
elif hasattr(value, '_metric_obj'):
# We track the instance using the metadata on the result tensor.
result_tensor = value
metric_obj = result_tensor._metric_obj
self._metrics.append(metric_obj)
else:
raise ValueError(
'We do not support adding an aggregated metric result tensor that '
'is not the output of a `tf.keras.metrics.Metric` metric instance. '
'Without having access to the metric instance we cannot reset the '
'state of a metric after every epoch during training. You can '
'create a `tf.keras.metrics.Metric` instance and pass the result '
'here or pass an un-aggregated result with `aggregation` parameter '
'set as `mean`. For example: `self.add_metric(tf.reduce_sum(inputs)'
', name=\'mean_activation\', aggregation=\'mean\')`')
else:
# If a non-aggregated tensor is given as input (ie. `aggregation` is
# explicitly set to `mean`), we wrap the tensor in `Mean` metric.
if match:
result_tensor = match(value)
metric_obj = match
else:
metric_obj, result_tensor = base_layer_utils.create_mean_metric(
value, name)
self._metrics.append(metric_obj)
self._metrics_tensors[metric_obj.name] = result_tensor
def _handle_weight_regularization(self, name, variable, regularizer):
"""Create lambdas which compute regularization losses."""
def _loss_for_variable(v):
"""Creates a regularization loss `Tensor` for variable `v`."""
with backend.name_scope(name + '/Regularizer'):
regularization = regularizer(v)
return regularization
if isinstance(variable, tf_variables.PartitionedVariable):
for v in variable:
self.add_loss(functools.partial(_loss_for_variable, v))
else:
self.add_loss(functools.partial(_loss_for_variable, variable))
def _handle_activity_regularization(self, inputs, outputs):
# Apply activity regularization.
# Note that it should be applied every time the layer creates a new
# output, since it is output-specific.
if self._activity_regularizer:
output_list = nest.flatten(outputs)
with backend.name_scope('ActivityRegularizer'):
for output in output_list:
activity_loss = self._activity_regularizer(output)
batch_size = math_ops.cast(
array_ops.shape(output)[0], activity_loss.dtype)
# Make activity regularization strength batch-agnostic.
mean_activity_loss = activity_loss / batch_size
base_layer_utils.check_graph_consistency(
mean_activity_loss, method='activity_regularizer')
self.add_loss(mean_activity_loss, inputs=inputs)
def _set_mask_metadata(self, inputs, outputs, previous_mask):
flat_outputs = nest.flatten(outputs)
mask_already_computed = (
getattr(self, '_compute_output_and_mask_jointly', False) or
all(getattr(x, '_keras_mask', None) is not None for x in flat_outputs))
# Only compute the mask if the Layer explicitly supports masking or has
# overridden `compute_mask`.
should_compute_mask = (
hasattr(self, 'compute_mask') and
(self.supports_masking or
not getattr(self.compute_mask, '_is_default', False)))
if mask_already_computed:
flat_masks = [getattr(x, '_keras_mask', None) for x in flat_outputs]
elif not should_compute_mask:
flat_masks = [None for _ in flat_outputs]
else:
output_masks = self.compute_mask(inputs, previous_mask)
# `compute_mask` can return a single `None` even when a Layer
# has multiple outputs.
if output_masks is None:
flat_masks = [None for _ in flat_outputs]
else:
flat_masks = nest.flatten(output_masks)
for output, mask in zip(flat_outputs, flat_masks):
try:
output._keras_mask = mask
except AttributeError:
# C Type such as np.ndarray.
pass
if tf_utils.are_all_symbolic_tensors(flat_outputs):
for output in flat_outputs:
if getattr(output, '_keras_mask', None) is not None:
# Do not track masks for `TensorFlowOpLayer` construction.
output._keras_mask._keras_history_checked = True
def _collect_input_masks(self, inputs, args, kwargs):
"""Checks if `mask` argument was passed, else gathers mask from inputs."""
if self._call_arg_was_passed('mask', args, kwargs):
return self._get_call_arg_value('mask', args, kwargs)
if not self._should_compute_mask:
return None
input_masks = nest.map_structure(lambda t: getattr(t, '_keras_mask', None),
inputs)
if generic_utils.is_all_none(input_masks):
return None
return input_masks
def _call_arg_was_passed(self, arg_name, args, kwargs):
if arg_name in kwargs:
return True
# Ignore `inputs` arg.
if arg_name in dict(zip(self._call_fn_args[1:], args)):
return True
return False
def _get_call_arg_value(self, arg_name, args, kwargs):
if arg_name in kwargs:
return kwargs[arg_name]
# Ignore `inputs` arg.
args_dict = dict(zip(self._call_fn_args[1:], args))
return args_dict[arg_name]
def _set_connectivity_metadata_(self, inputs, outputs, args, kwargs):
call_convention = getattr(
self, '_call_convention',
base_layer_utils.CallConvention.EXPLICIT_INPUTS_ARGUMENT)
if args:
if call_convention == (base_layer_utils
.CallConvention.EXPLICIT_INPUTS_ARGUMENT):
raise TypeError(
'This layer ("{}") takes an `inputs` argument in `call()`, '
'and only the `inputs` argument may be specified as a positional '
'argument. Pass everything else as a keyword argument '
'(those arguments will not be tracked '
'as inputs to the layer).'.format(self.name))
elif call_convention == (base_layer_utils
.CallConvention.SINGLE_POSITIONAL_ARGUMENT):
raise TypeError(
'This layer ("{}") takes a single positional argument in `call()`,'
' which is by convention the `inputs` argument, '
'and only this argument may be specified as a positional argument. '
'Pass everything else as a keyword argument '
'(those arguments will not be tracked '
'as inputs to the layer).'.format(self.name))
# If the layer returns tensors from its inputs, unmodified,
# we copy them to avoid loss of tensor metadata.
output_ls = nest.flatten(outputs)
inputs_ls = nest.flatten(inputs)
output_ls_copy = []
for x in output_ls:
if x in inputs_ls:
with backend.name_scope(self.name):
x = array_ops.identity(x)
output_ls_copy.append(x)
outputs = nest.pack_sequence_as(outputs, output_ls_copy)
inputs, kwargs = self._inputs_from_call_args(
call_args=(inputs,) + args, call_kwargs=kwargs)
# Add an inbound node to the layer, so it can keep track of this call.
# This updates the layer history of the output tensor(s).
kwargs.pop('mask', None) # `mask` should not be serialized.
self._add_inbound_node(
input_tensors=inputs, output_tensors=outputs, arguments=kwargs)
return inputs, outputs
def _inputs_from_call_args(self, call_args, call_kwargs):
"""Get Layer inputs from __call__ *args and **kwargs.
Args:
call_args: The positional arguments passed to __call__.
call_kwargs: The keyword argument dict passed to __call__.
Returns:
A tuple of (inputs, non_input_kwargs). These may be the same objects as
were passed in (call_args and call_kwargs).
"""
call_convention = getattr(
self, '_call_convention',
base_layer_utils.CallConvention.EXPLICIT_INPUTS_ARGUMENT)
if (call_convention in (
base_layer_utils.CallConvention.EXPLICIT_INPUTS_ARGUMENT,
base_layer_utils.CallConvention.SINGLE_POSITIONAL_ARGUMENT)):
assert len(call_args) == 1 # TypeError raised earlier in __call__.
return call_args[0], call_kwargs
else:
call_arg_spec = tf_inspect.getfullargspec(self.call)
# There is no explicit "inputs" argument expected or provided to
# call(). Arguments which have default values are considered non-inputs,
# and arguments without are considered inputs.
if call_arg_spec.defaults:
if call_arg_spec.varargs is not None:
raise TypeError(
'Layers may not accept both positional arguments and '
'arguments with default values (unable to determine which '
'are inputs to the layer). '
'Issue occurred with layer "%s"' % (self.name))
keyword_arg_names = set(
call_arg_spec.args[-len(call_arg_spec.defaults):])
else:
keyword_arg_names = set()
# Training is never an input argument name, to allow signatures like
# call(x, training).
keyword_arg_names.add('training')
_, unwrapped_call = tf_decorator.unwrap(self.call)
bound_args = inspect.getcallargs(
unwrapped_call, *call_args, **call_kwargs)
if call_arg_spec.varkw is not None:
var_kwargs = bound_args.pop(call_arg_spec.varkw)
bound_args.update(var_kwargs)
keyword_arg_names = keyword_arg_names.union(var_kwargs.keys())
all_args = call_arg_spec.args
if all_args and bound_args[all_args[0]] is self:
# Ignore the 'self' argument of methods
bound_args.pop(call_arg_spec.args[0])
all_args = all_args[1:]
non_input_arg_values = {}
input_arg_values = []
remaining_args_are_keyword = False
for argument_name in all_args:
if argument_name in keyword_arg_names:
remaining_args_are_keyword = True
else:
if remaining_args_are_keyword:
raise TypeError(
'Found a positional argument in a layer call after a non-input '
'argument. All arguments after "training" must be keyword '
'arguments, and are not tracked as inputs to the layer. '
'Issue occurred with layer "%s"' % (self.name))
if remaining_args_are_keyword:
non_input_arg_values[argument_name] = bound_args[argument_name]
else:
input_arg_values.append(bound_args[argument_name])
if call_arg_spec.varargs is not None:
input_arg_values.extend(bound_args[call_arg_spec.varargs])
return input_arg_values, non_input_arg_values
def _add_inbound_node(self,
input_tensors,
output_tensors,
arguments=None):
"""Internal method to create an inbound node for the layer.
Arguments:
input_tensors: list of input tensors.
output_tensors: list of output tensors.
arguments: dictionary of keyword arguments that were passed to the
`call` method of the layer at the call that created the node.
"""
inbound_layers = nest.map_structure(lambda t: t._keras_history.layer,
input_tensors)
node_indices = nest.map_structure(lambda t: t._keras_history.node_index,
input_tensors)
tensor_indices = nest.map_structure(lambda t: t._keras_history.tensor_index,
input_tensors)
# Create node, add it to inbound nodes.
node_module.Node(
self,
inbound_layers=inbound_layers,
node_indices=node_indices,
tensor_indices=tensor_indices,
input_tensors=input_tensors,
output_tensors=output_tensors,
arguments=arguments)
# Update tensor history metadata.
# The metadata attribute consists of
# 1) a layer instance
# 2) a node index for the layer
# 3) a tensor index for the node.
# The allows layer reuse (multiple nodes per layer) and multi-output
# or multi-input layers (e.g. a layer can return multiple tensors,
# and each can be sent to a different layer).
for i, tensor in enumerate(nest.flatten(output_tensors)):
tensor._keras_history = KerasHistory(self,
len(self._inbound_nodes) - 1, i) # pylint: disable=protected-access
def _get_node_attribute_at_index(self, node_index, attr, attr_name):
"""Private utility to retrieves an attribute (e.g. inputs) from a node.
This is used to implement the methods:
- get_input_shape_at
- get_output_shape_at
- get_input_at
etc...
Arguments:
node_index: Integer index of the node from which
to retrieve the attribute.
attr: Exact node attribute name.
attr_name: Human-readable attribute name, for error messages.
Returns:
The layer's attribute `attr` at the node of index `node_index`.
Raises:
RuntimeError: If the layer has no inbound nodes, or if called in Eager
mode.
ValueError: If the index provided does not match any node.
"""
if not self._inbound_nodes:
raise RuntimeError('The layer has never been called '
'and thus has no defined ' + attr_name + '.')
if not len(self._inbound_nodes) > node_index:
raise ValueError('Asked to get ' + attr_name + ' at node ' +
str(node_index) + ', but the layer has only ' +
str(len(self._inbound_nodes)) + ' inbound nodes.')
values = getattr(self._inbound_nodes[node_index], attr)
if isinstance(values, list) and len(values) == 1:
return values[0]
else:
return values
def _maybe_build(self, inputs):
# Check input assumptions set before layer building, e.g. input rank.
if not self.built:
input_spec.assert_input_compatibility(
self.input_spec, inputs, self.name)
input_list = nest.flatten(inputs)
if input_list and self._dtype is None:
try:
self._dtype = input_list[0].dtype.base_dtype.name
except AttributeError:
pass
input_shapes = None
if all(hasattr(x, 'shape') for x in input_list):
input_shapes = nest.map_structure(lambda x: x.shape, inputs)
# Only call `build` if the user has manually overridden the build method.
if not hasattr(self.build, '_is_default'):
# Any setup work performed only once should happen in an `init_scope`
# to avoid creating symbolic Tensors that will later pollute any eager
# operations.
with tf_utils.maybe_init_scope(self):
self.build(input_shapes)
# We must set self.built since user defined build functions are not
# constrained to set self.built.
self.built = True
# Optionally load weight values specified at layer instantiation.
if getattr(self, '_initial_weights', None) is not None:
self.set_weights(self._initial_weights)
self._initial_weights = None
def _symbolic_call(self, inputs):
input_shapes = nest.map_structure(lambda x: x.shape, inputs)
output_shapes = self.compute_output_shape(input_shapes)
def _make_placeholder_like(shape):
ph = backend.placeholder(shape=shape, dtype=self.dtype)
ph._keras_mask = None
return ph
return nest.map_structure(_make_placeholder_like, output_shapes)
def _get_trainable_state(self):
"""Get the `trainable` state of each sublayer.
Returns:
A dict mapping all sublayers to their `trainable` value.
"""
layers = trackable_layer_utils.filter_empty_layer_containers(self._layers)
# Keep track of each top-level layers' `trainable` as well as the
# state of all of its sublayers.
trainable_state = {self: self.trainable}
for layer in layers:
trainable_state.update(layer._get_trainable_state())
return trainable_state
def _set_trainable_state(self, trainable_state):
"""Set `trainable` state for each sublayer."""
layers = trackable_layer_utils.filter_empty_layer_containers(self._layers)
if self in trainable_state:
self.trainable = trainable_state[self]
for layer in layers:
layer._set_trainable_state(trainable_state)
@property
def _obj_reference_counts(self):
"""A dictionary counting the number of attributes referencing an object."""
self._maybe_create_attribute('_obj_reference_counts_dict',
object_identity.ObjectIdentityDictionary())
return self._obj_reference_counts_dict
def _maybe_create_attribute(self, name, default_value):
"""Create the attribute with the default value if it hasn't been created.
This is useful for fields that is used for tracking purpose,
_trainable_weights, or _layers. Note that user could create a layer subclass
and assign an internal field before invoking the Layer.__init__(), the
__setattr__() need to create the tracking fields and __init__() need to not
override them.
Args:
name: String, the name of the attribute.
default_value: Object, the default value of the attribute.
"""
if not hasattr(self, name):
super(Layer, self).__setattr__(name, default_value)
def __delattr__(self, name):
# For any super.__delattr__() call, we will directly use the implementation
# in Trackable and skip the behavior in AutoTrackable. The Layer was
# originally use Trackable as base class, the change of using Module as base
# class forced us to have AutoTrackable in the class hierarchy. Skipping
# the __delattr__ and __setattr__ in AutoTrackable will keep the status quo.
existing_value = getattr(self, name, None)
# If this value is replacing an existing object assigned to an attribute, we
# should clean it out to avoid leaking memory. First we check if there are
# other attributes referencing it.
reference_counts = self._obj_reference_counts
if existing_value not in reference_counts:
super(tracking.AutoTrackable, self).__delattr__(name)
return
reference_count = reference_counts[existing_value]
if reference_count > 1:
# There are other remaining references. We can't remove this object from
# _layers etc.
reference_counts[existing_value] = reference_count - 1
super(tracking.AutoTrackable, self).__delattr__(name)
return
else:
# This is the last remaining reference.
del reference_counts[existing_value]
super(tracking.AutoTrackable, self).__delattr__(name)
if (isinstance(existing_value, Layer)
or trackable_layer_utils.has_weights(existing_value)):
super(tracking.AutoTrackable, self).__setattr__(
'_layers',
[l for l in self._layers if l is not existing_value])
if isinstance(existing_value, tf_variables.Variable):
super(tracking.AutoTrackable, self).__setattr__(
'_trainable_weights',
[w for w in self._trainable_weights if w is not existing_value])
super(tracking.AutoTrackable, self).__setattr__(
'_non_trainable_weights',
[w for w in self._non_trainable_weights if w is not existing_value])
def __setattr__(self, name, value):
if (name == '_self_setattr_tracking' or
not getattr(self, '_self_setattr_tracking', True) or
getattr(self, '_is_graph_network', False) or
# Exclude @property.setters from tracking
hasattr(self.__class__, name)):
try:
super(tracking.AutoTrackable, self).__setattr__(name, value)
except AttributeError:
raise AttributeError(
('Can\'t set the attribute "{}", likely because it conflicts with '
'an existing read-only @property of the object. Please choose a '
'different name.').format(name))
return
# Keep track of trackable objects, for the needs of `Network.save_weights`.
value = data_structures.sticky_attribute_assignment(
trackable=self, value=value, name=name)
reference_counts = self._obj_reference_counts
reference_counts[value] = reference_counts.get(value, 0) + 1
# Clean out the old attribute, which clears _layers and _trainable_weights
# if necessary.
try:
self.__delattr__(name)
except AttributeError:
pass
# TODO(scottzhu): Need to track Module object as well for weight tracking.
# Be careful about metric if it becomes a Module in future.
# Append value to self._layers if relevant
if (isinstance(value, Layer) or
trackable_layer_utils.has_weights(value)):
self._maybe_create_attribute('_layers', [])
# We need to check object identity to avoid de-duplicating empty
# container types which compare equal.
if not any((layer is value for layer in self._layers)):
self._layers.append(value)
if hasattr(value, '_use_resource_variables'):
# Legacy layers (V1 tf.layers) must always use
# resource variables.
value._use_resource_variables = True
# Append value to list of trainable / non-trainable weights if relevant
# TODO(b/125122625): This won't pick up on any variables added to a
# list/dict after creation.
for val in nest.flatten(value):
# TODO(b/126450014): Remove `_UnreadVariable` check here when assign ops
# no longer return True for isinstance Variable checks.
if (isinstance(val, tf_variables.Variable) and
not isinstance(val, resource_variable_ops._UnreadVariable)): # pylint: disable=protected-access
# Users may add extra weights/variables
# simply by assigning them to attributes (invalid for graph networks)
self._maybe_create_attribute('_trainable_weights', [])
self._maybe_create_attribute('_non_trainable_weights', [])
if val not in self._trainable_weights + self._non_trainable_weights:
if val.trainable:
self._trainable_weights.append(val)
else:
self._non_trainable_weights.append(val)
backend.track_variable(val)
# Skip the auto trackable from tf.Module to keep status quo. See the comment
# at __delattr__.
super(tracking.AutoTrackable, self).__setattr__(name, value)
def _gather_children_attribute(self, attribute):
assert attribute in {
'weights', 'trainable_weights', 'non_trainable_weights', 'updates',
'losses', 'metrics'
}
if hasattr(self, '_layers'):
nested_layers = trackable_layer_utils.filter_empty_layer_containers(
self._layers)
return list(
itertools.chain.from_iterable(
getattr(layer, attribute) for layer in nested_layers))
return []
# This is a hack so that the is_layer (within
# training/trackable/layer_utils.py) check doesn't get the weights attr.
# TODO(b/110718070): Remove when fixed.
def _is_layer(self):
return True
@property
@tracking.cached_per_instance
def _call_fn_args(self):
all_args = tf_inspect.getfullargspec(self.call).args
# Scrub `self` that appears if a decorator was applied.
if all_args and all_args[0] == 'self':
return all_args[1:]
return all_args
@property
@tracking.cached_per_instance
def _call_accepts_kwargs(self):
return tf_inspect.getfullargspec(self.call).varkw is not None
@property
@tracking.cached_per_instance
def _should_compute_mask(self):
return ('mask' in self._call_fn_args or
getattr(self, 'compute_mask', None) is not None)
@property
def _object_identifier(self):
"""String stored in object identifier field in the SavedModel proto.
Returns:
A string with the object identifier, which is used at load time.
"""
return '_tf_keras_layer'
@property
def _tracking_metadata(self):
"""String stored in metadata field in the SavedModel proto.
Returns:
A serialized JSON storing information necessary for recreating this layer.
"""
# TODO(kathywu): Add support for metrics serialization.
# TODO(kathywu): Synchronize with the keras spec (go/keras-json-spec) once
# the python config serialization has caught up.
# Create a dictionary containing python layer state attributes. Any new
# attribute that impacts the layer execution in some way should be added to
# this dict.
# Unlike a model's JSON configuration, which only
# contains class_name and each layer's get_config() object, this stores more
# information to accurately recreate the layer.
# For backwards compatibility, any changes to this list should be additive.
# Modifying or removing attributes may only be done with a sufficient
# explanation.
metadata = dict(
class_name=type(self).__name__,
name=self.name,
trainable=self.trainable,
expects_training_arg=self._expects_training_arg,
dtype=self.dtype,
batch_input_shape=getattr(self, '_batch_input_shape', None))
try:
# Store the config dictionary, which is only used by the revived object
# to return the original config when revived_obj.get_config() is called.
# It is not important for recreating the revived object.
metadata['config'] = self.get_config()
except NotImplementedError:
# in the case of a subclassed model, the get_config() method will throw
# a NotImplementedError.
pass
if self.input_spec is not None:
# Layer's input_spec has already been type-checked in the property setter.
metadata['input_spec'] = nest.map_structure(
lambda x: None if x is None else serialize_keras_object(x),
self.input_spec)
else:
metadata['input_spec'] = None
if (self.activity_regularizer is not None and
hasattr(self.activity_regularizer, 'get_config')):
metadata['activity_regularizer'] = serialize_keras_object(
self.activity_regularizer)
else:
metadata['activity_regularizer'] = None
return json.dumps(metadata, default=serialization.get_json_type)
def _list_extra_dependencies_for_serialization(self, serialization_cache):
"""Lists extra dependencies to serialize to SavedModel.
By overriding this method, extra dependencies can be attached to the
serialized Layer. For example, this is used to save the list of `variables`
and `trainable_variables`, which are python properties in a Layer object,
but are represented as a static list in the SavedModel.
Args:
serialization_cache: A dictionary shared between all objects in the same
object graph. This object is passed to both
`_list_extra_dependencies_for_serialization` and
`_list_functions_for_serialization`.
Returns:
A dictionary mapping attribute names to trackable objects. The entire list
of attributes are listed in the `saved_model._LayerAttributes` class.
"""
return (saved_model.serialize_all_attributes(self, serialization_cache)
.objects_to_serialize)
def _list_functions_for_serialization(self, serialization_cache):
"""Lists the functions to include when serializing a Layer.
Args:
serialization_cache: Dictionary passed to all objects in the same object
graph during serialization.
Returns:
A dictionary mapping attribute names to `Function` or
`ConcreteFunction`. The entire list of attributes are listed in the
`saved_model._LayerAttributes` class.
"""
# Create a dictionary containing the layer's call and loss functions.
fns = (saved_model.serialize_all_attributes(self, serialization_cache)
.functions_to_serialize)
# The parent Autotrackable class saves all user-defined tf.functions, and
# returns them in _list_functions_for_serialization(). Add these functions
# to the dict.
fns.update(super(Layer, self)._list_functions_for_serialization(
serialization_cache))
return fns
class TensorFlowOpLayer(Layer):
"""Wraps a TensorFlow Operation in a Layer.
This class is used internally by the Functional API. When a user
uses a raw TensorFlow Operation on symbolic tensors originating
from an `Input` Layer, the resultant operation will be wrapped
with this Layer object in order to make the operation compatible
with the Keras API.
This Layer will create a new, identical operation (except for inputs
and outputs) every time it is called. If `run_eagerly` is `True`,
the op creation and calculation will happen inside an Eager function.
Instances of this Layer are created when `autolambda` is called, which
is whenever a Layer's `__call__` encounters symbolic inputs that do
not have Keras metadata, or when a Network's `__init__` encounters
outputs that do not have Keras metadata.
Attributes:
node_def: String, the serialized NodeDef of the Op this layer will wrap.
constants: Dict of NumPy arrays, the values of any Tensors needed for this
Operation that do not originate from a Keras `Input` Layer. Since all
placeholders must come from Keras `Input` Layers, these Tensors must be
treated as constant in the Functional API.
name: String, the name of the Layer.
trainable: Bool, whether this Layer is trainable. Currently Variables are
not supported, and so this parameter has no effect.
dtype: The default dtype of this Layer. Inherited from `Layer` and has no
effect on this class, however is used in `get_config`.
"""
def __init__(self,
node_def,
constants=None,
name=None,
trainable=True,
dtype=None):
super(TensorFlowOpLayer, self).__init__(
name=_TF_OP_LAYER_NAME_PREFIX + name, trainable=trainable, dtype=dtype)
self.node_def = node_def_pb2.NodeDef.FromString(node_def)
self.constants = constants or {}
# Layer uses original op unless it is called on new inputs.
# This means `built` is not set in `__call__`.
self.built = True
def call(self, inputs):
if context.executing_eagerly():
return self._defun_call(inputs)
return self._make_op(inputs)
def _make_op(self, inputs):
inputs = nest.flatten(inputs)
graph = inputs[0].graph
with graph.as_default():
for index, constant in self.constants.items():
constant = ops.convert_to_tensor(constant)
inputs.insert(index, constant)
self.node_def.name = graph.unique_name(self.node_def.name)
# Check for case where first input should be a list of Tensors.
if 'N' in self.node_def.attr:
num_tensors = self.node_def.attr['N'].i
inputs = [inputs[:num_tensors]] + inputs[num_tensors:]
c_op = ops._create_c_op(graph, self.node_def, inputs, control_inputs=[])
op = graph._create_op_from_tf_operation(c_op)
# Record the gradient because custom-made ops don't go through the
# code-gen'd eager call path
op_type = compat.as_str(op.op_def.name)
attr_names = [compat.as_str(attr.name) for attr in op.op_def.attr]
attrs = []
for attr_name in attr_names:
attrs.append(attr_name)
attrs.append(op.get_attr(attr_name))
attrs = tuple(attrs)
execute.record_gradient(op_type, op.inputs, attrs, op.outputs,
op.name)
if len(op.outputs) == 1:
return op.outputs[0]
return op.outputs
@function.defun
def _defun_call(self, inputs):
"""Wraps the op creation method in an Eager function for `run_eagerly`."""
return self._make_op(inputs)
def get_config(self):
config = super(TensorFlowOpLayer, self).get_config()
config.update({
'node_def': self.node_def.SerializeToString(),
'constants': {
i: backend.get_value(c) for i, c in self.constants.items()
}
})
return config
class AddLoss(Layer):
"""Adds its inputs as a loss.
Attributes:
unconditional: Whether or not the loss should be conditioned on the inputs.
"""
def __init__(self, unconditional, **kwargs):
super(AddLoss, self).__init__(**kwargs)
self.unconditional = unconditional
def call(self, inputs):
self.add_loss(inputs, inputs=(not self.unconditional))
return inputs
def get_config(self):
config = super(AddLoss, self).get_config()
config.update({'unconditional': self.unconditional})
return config
class AddMetric(Layer):
"""Adds its inputs as a metric.
Attributes:
aggregation: 'mean' or None. How the inputs should be aggregated.
metric_name: The name to use for this metric.
"""
def __init__(self, aggregation=None, metric_name=None, **kwargs):
super(AddMetric, self).__init__(**kwargs)
self.aggregation = aggregation
self.metric_name = metric_name
def call(self, inputs):
self.add_metric(inputs, self.aggregation, self.metric_name)
return inputs
def get_config(self):
config = super(AddMetric, self).get_config()
config.update({
'aggregation': self.aggregation,
'metric_name': self.metric_name
})
return config
class KerasHistory(
collections.namedtuple('KerasHistory',
['layer', 'node_index', 'tensor_index'])):
"""Tracks the Layer call that created a Tensor, for Keras Graph Networks.
During construction of Keras Graph Networks, this metadata is added to
each Tensor produced as the output of a Layer, starting with an
`InputLayer`. This allows Keras to track how each Tensor was produced, and
this information is later retraced by the `keras.engine.Network` class to
reconstruct the Keras Graph Network.
Attributes:
layer: The Layer that produced the Tensor.
node_index: The specific call to the Layer that produced this Tensor. Layers
can be called multiple times in order to share weights. A new node is
created every time a Tensor is called.
tensor_index: The output index for this Tensor. Always zero if the Layer
that produced this Tensor only has one output. Nested structures of
Tensors are deterministically assigned an index via `nest.flatten`.
"""
# Added to maintain memory and performance characteristics of `namedtuple`
# while subclassing.
__slots__ = ()
# Avoid breaking users who directly import this symbol from this file.
# TODO(fchollet): remove this.
InputSpec = input_spec.InputSpec # pylint:disable=invalid-name
|
# coding=utf-8
"""Tests for certbot._internal.main."""
# pylint: disable=too-many-lines
from __future__ import print_function
import datetime
import itertools
import json
import shutil
import sys
import tempfile
import traceback
import unittest
import josepy as jose
try:
import mock
except ImportError: # pragma: no cover
from unittest import mock
import pytz
import six
from six.moves import reload_module # pylint: disable=import-error
from certbot import crypto_util
from certbot import errors
from certbot import interfaces # pylint: disable=unused-import
from certbot import util
from certbot._internal import account
from certbot._internal import cli
from certbot._internal import configuration
from certbot._internal import constants
from certbot._internal import main
from certbot._internal import updater
from certbot._internal.plugins import disco
from certbot._internal.plugins import manual
from certbot._internal.plugins import null
from certbot.compat import filesystem
from certbot.compat import os
from certbot.plugins import enhancements
import certbot.tests.util as test_util
CERT_PATH = test_util.vector_path('cert_512.pem')
CERT = test_util.vector_path('cert_512.pem')
CSR = test_util.vector_path('csr_512.der')
KEY = test_util.vector_path('rsa256_key.pem')
JWK = jose.JWKRSA.load(test_util.load_vector('rsa512_key.pem'))
RSA2048_KEY_PATH = test_util.vector_path('rsa2048_key.pem')
SS_CERT_PATH = test_util.vector_path('cert_2048.pem')
class TestHandleIdenticalCerts(unittest.TestCase):
"""Test for certbot._internal.main._handle_identical_cert_request"""
def test_handle_identical_cert_request_pending(self):
mock_lineage = mock.Mock()
mock_lineage.ensure_deployed.return_value = False
# pylint: disable=protected-access
ret = main._handle_identical_cert_request(mock.Mock(), mock_lineage)
self.assertEqual(ret, ("reinstall", mock_lineage))
class RunTest(test_util.ConfigTestCase):
"""Tests for certbot._internal.main.run."""
def setUp(self):
super(RunTest, self).setUp()
self.domain = 'example.org'
patches = [
mock.patch('certbot._internal.main._get_and_save_cert'),
mock.patch('certbot._internal.main.display_ops.success_installation'),
mock.patch('certbot._internal.main.display_ops.success_renewal'),
mock.patch('certbot._internal.main._init_le_client'),
mock.patch('certbot._internal.main._suggest_donation_if_appropriate'),
mock.patch('certbot._internal.main._report_new_cert'),
mock.patch('certbot._internal.main._find_cert'),
mock.patch('certbot._internal.eff.handle_subscription'),
]
self.mock_auth = patches[0].start()
self.mock_success_installation = patches[1].start()
self.mock_success_renewal = patches[2].start()
self.mock_init = patches[3].start()
self.mock_suggest_donation = patches[4].start()
self.mock_report_cert = patches[5].start()
self.mock_find_cert = patches[6].start()
self.mock_subscription = patches[7].start()
for patch in patches:
self.addCleanup(patch.stop)
def _call(self):
args = '-a webroot -i null -d {0}'.format(self.domain).split()
plugins = disco.PluginsRegistry.find_all()
config = configuration.NamespaceConfig(
cli.prepare_and_parse_args(plugins, args))
from certbot._internal.main import run
run(config, plugins)
def test_newcert_success(self):
self.mock_auth.return_value = mock.Mock()
self.mock_find_cert.return_value = True, None
self._call()
self.mock_success_installation.assert_called_once_with([self.domain])
def test_reinstall_success(self):
self.mock_auth.return_value = mock.Mock()
self.mock_find_cert.return_value = False, mock.Mock()
self._call()
self.mock_success_installation.assert_called_once_with([self.domain])
def test_renewal_success(self):
self.mock_auth.return_value = mock.Mock()
self.mock_find_cert.return_value = True, mock.Mock()
self._call()
self.mock_success_renewal.assert_called_once_with([self.domain])
@mock.patch('certbot._internal.main.plug_sel.choose_configurator_plugins')
def test_run_enhancement_not_supported(self, mock_choose):
mock_choose.return_value = (null.Installer(self.config, "null"), None)
plugins = disco.PluginsRegistry.find_all()
self.config.auto_hsts = True
self.assertRaises(errors.NotSupportedError,
main.run,
self.config, plugins)
class CertonlyTest(unittest.TestCase):
"""Tests for certbot._internal.main.certonly."""
def setUp(self):
self.get_utility_patch = test_util.patch_get_utility()
self.mock_get_utility = self.get_utility_patch.start()
def tearDown(self):
self.get_utility_patch.stop()
def _call(self, args):
plugins = disco.PluginsRegistry.find_all()
config = configuration.NamespaceConfig(
cli.prepare_and_parse_args(plugins, args))
with mock.patch('certbot._internal.main._init_le_client') as mock_init:
with mock.patch('certbot._internal.main._suggest_donation_if_appropriate'):
with mock.patch('certbot._internal.eff.handle_subscription'):
main.certonly(config, plugins)
return mock_init() # returns the client
@mock.patch('certbot._internal.main._find_cert')
@mock.patch('certbot._internal.main._get_and_save_cert')
@mock.patch('certbot._internal.main._report_new_cert')
def test_no_reinstall_text_pause(self, unused_report, mock_auth,
mock_find_cert):
mock_notification = self.mock_get_utility().notification
mock_notification.side_effect = self._assert_no_pause
mock_auth.return_value = mock.Mock()
mock_find_cert.return_value = False, None
self._call('certonly --webroot -d example.com'.split())
def _assert_no_pause(self, message, pause=True): # pylint: disable=unused-argument
self.assertFalse(pause)
@mock.patch('certbot._internal.cert_manager.lineage_for_certname')
@mock.patch('certbot._internal.cert_manager.domains_for_certname')
@mock.patch('certbot._internal.renewal.renew_cert')
@mock.patch('certbot._internal.main._report_new_cert')
def test_find_lineage_for_domains_and_certname(self, mock_report_cert,
mock_renew_cert, mock_domains, mock_lineage):
domains = ['example.com', 'test.org']
mock_domains.return_value = domains
mock_lineage.names.return_value = domains
self._call(('certonly --webroot -d example.com -d test.org '
'--cert-name example.com').split())
self.assertTrue(mock_lineage.call_count == 1)
self.assertTrue(mock_domains.call_count == 1)
self.assertTrue(mock_renew_cert.call_count == 1)
self.assertTrue(mock_report_cert.call_count == 1)
# user confirms updating lineage with new domains
self._call(('certonly --webroot -d example.com -d test.com '
'--cert-name example.com').split())
self.assertTrue(mock_lineage.call_count == 2)
self.assertTrue(mock_domains.call_count == 2)
self.assertTrue(mock_renew_cert.call_count == 2)
self.assertTrue(mock_report_cert.call_count == 2)
# error in _ask_user_to_confirm_new_names
self.mock_get_utility().yesno.return_value = False
self.assertRaises(errors.ConfigurationError, self._call,
('certonly --webroot -d example.com -d test.com --cert-name example.com').split())
@mock.patch('certbot._internal.cert_manager.domains_for_certname')
@mock.patch('certbot.display.ops.choose_names')
@mock.patch('certbot._internal.cert_manager.lineage_for_certname')
@mock.patch('certbot._internal.main._report_new_cert')
def test_find_lineage_for_domains_new_certname(self, mock_report_cert,
mock_lineage, mock_choose_names, mock_domains_for_certname):
mock_lineage.return_value = None
# no lineage with this name but we specified domains so create a new cert
self._call(('certonly --webroot -d example.com -d test.com '
'--cert-name example.com').split())
self.assertTrue(mock_lineage.call_count == 1)
self.assertTrue(mock_report_cert.call_count == 1)
# no lineage with this name and we didn't give domains
mock_choose_names.return_value = ["somename"]
mock_domains_for_certname.return_value = None
self._call(('certonly --webroot --cert-name example.com').split())
self.assertTrue(mock_choose_names.called)
class FindDomainsOrCertnameTest(unittest.TestCase):
"""Tests for certbot._internal.main._find_domains_or_certname."""
@mock.patch('certbot.display.ops.choose_names')
def test_display_ops(self, mock_choose_names):
mock_config = mock.Mock(domains=None, certname=None)
mock_choose_names.return_value = "domainname"
# pylint: disable=protected-access
self.assertEqual(main._find_domains_or_certname(mock_config, None),
("domainname", None))
@mock.patch('certbot.display.ops.choose_names')
def test_no_results(self, mock_choose_names):
mock_config = mock.Mock(domains=None, certname=None)
mock_choose_names.return_value = []
# pylint: disable=protected-access
self.assertRaises(errors.Error, main._find_domains_or_certname, mock_config, None)
@mock.patch('certbot._internal.cert_manager.domains_for_certname')
def test_grab_domains(self, mock_domains):
mock_config = mock.Mock(domains=None, certname="one.com")
mock_domains.return_value = ["one.com", "two.com"]
# pylint: disable=protected-access
self.assertEqual(main._find_domains_or_certname(mock_config, None),
(["one.com", "two.com"], "one.com"))
class RevokeTest(test_util.TempDirTestCase):
"""Tests for certbot._internal.main.revoke."""
def setUp(self):
super(RevokeTest, self).setUp()
shutil.copy(CERT_PATH, self.tempdir)
self.tmp_cert_path = os.path.abspath(os.path.join(self.tempdir,
'cert_512.pem'))
with open(self.tmp_cert_path, 'r') as f:
self.tmp_cert = (self.tmp_cert_path, f.read())
patches = [
mock.patch('acme.client.BackwardsCompatibleClientV2'),
mock.patch('certbot._internal.client.Client'),
mock.patch('certbot._internal.main._determine_account'),
mock.patch('certbot._internal.main.display_ops.success_revocation')
]
self.mock_acme_client = patches[0].start()
patches[1].start()
self.mock_determine_account = patches[2].start()
self.mock_success_revoke = patches[3].start()
for patch in patches:
self.addCleanup(patch.stop)
from certbot._internal.account import Account
self.regr = mock.MagicMock()
self.meta = Account.Meta(
creation_host="test.certbot.org",
creation_dt=datetime.datetime(
2015, 7, 4, 14, 4, 10, tzinfo=pytz.UTC))
self.acc = Account(self.regr, JWK, self.meta)
self.mock_determine_account.return_value = (self.acc, None)
def _call(self, args=None):
if not args:
args = 'revoke --cert-path={0} '
args = args.format(self.tmp_cert_path).split()
plugins = disco.PluginsRegistry.find_all()
config = configuration.NamespaceConfig(
cli.prepare_and_parse_args(plugins, args))
from certbot._internal.main import revoke
revoke(config, plugins)
@mock.patch('certbot._internal.main._delete_if_appropriate')
@mock.patch('certbot._internal.main.client.acme_client')
def test_revoke_with_reason(self, mock_acme_client,
mock_delete_if_appropriate):
mock_delete_if_appropriate.return_value = False
mock_revoke = mock_acme_client.BackwardsCompatibleClientV2().revoke
expected = []
for reason, code in constants.REVOCATION_REASONS.items():
args = 'revoke --cert-path={0} --reason {1}'.format(self.tmp_cert_path, reason).split()
self._call(args)
expected.append(mock.call(mock.ANY, code))
args = 'revoke --cert-path={0} --reason {1}'.format(self.tmp_cert_path,
reason.upper()).split()
self._call(args)
expected.append(mock.call(mock.ANY, code))
self.assertEqual(expected, mock_revoke.call_args_list)
@mock.patch('certbot._internal.main._delete_if_appropriate')
@mock.patch('certbot._internal.storage.cert_path_for_cert_name')
def test_revoke_by_certname(self, mock_cert_path_for_cert_name,
mock_delete_if_appropriate):
args = 'revoke --cert-name=example.com'.split()
mock_cert_path_for_cert_name.return_value = self.tmp_cert
mock_delete_if_appropriate.return_value = False
self._call(args)
self.mock_success_revoke.assert_called_once_with(self.tmp_cert_path)
@mock.patch('certbot._internal.main._delete_if_appropriate')
def test_revocation_success(self, mock_delete_if_appropriate):
self._call()
mock_delete_if_appropriate.return_value = False
self.mock_success_revoke.assert_called_once_with(self.tmp_cert_path)
def test_revocation_error(self):
from acme import errors as acme_errors
self.mock_acme_client.side_effect = acme_errors.ClientError()
self.assertRaises(acme_errors.ClientError, self._call)
self.mock_success_revoke.assert_not_called()
@mock.patch('certbot._internal.main._delete_if_appropriate')
@mock.patch('certbot._internal.cert_manager.delete')
@test_util.patch_get_utility()
def test_revocation_with_prompt(self, mock_get_utility,
mock_delete, mock_delete_if_appropriate):
mock_get_utility().yesno.return_value = False
mock_delete_if_appropriate.return_value = False
self._call()
self.assertFalse(mock_delete.called)
class DeleteIfAppropriateTest(test_util.ConfigTestCase):
"""Tests for certbot._internal.main._delete_if_appropriate """
def _call(self, mock_config):
from certbot._internal.main import _delete_if_appropriate
_delete_if_appropriate(mock_config)
def _test_delete_opt_out_common(self, mock_get_utility):
with mock.patch('certbot._internal.cert_manager.delete') as mock_delete:
self._call(self.config)
mock_delete.assert_not_called()
self.assertTrue(mock_get_utility().add_message.called)
@test_util.patch_get_utility()
def test_delete_flag_opt_out(self, mock_get_utility):
self.config.delete_after_revoke = False
self._test_delete_opt_out_common(mock_get_utility)
@test_util.patch_get_utility()
def test_delete_prompt_opt_out(self, mock_get_utility):
util_mock = mock_get_utility()
util_mock.yesno.return_value = False
self._test_delete_opt_out_common(mock_get_utility)
@mock.patch('certbot._internal.storage.renewal_file_for_certname')
@mock.patch('certbot._internal.cert_manager.delete')
@mock.patch('certbot._internal.cert_manager.match_and_check_overlaps')
@mock.patch('certbot._internal.storage.full_archive_path')
@mock.patch('certbot._internal.cert_manager.cert_path_to_lineage')
@test_util.patch_get_utility()
def test_overlapping_archive_dirs(self, mock_get_utility,
mock_cert_path_to_lineage, mock_archive,
mock_match_and_check_overlaps, mock_delete,
mock_renewal_file_for_certname):
# pylint: disable = unused-argument
config = self.config
config.cert_path = "/some/reasonable/path"
config.certname = ""
mock_cert_path_to_lineage.return_value = "example.com"
mock_match_and_check_overlaps.side_effect = errors.OverlappingMatchFound()
self._call(config)
mock_delete.assert_not_called()
@mock.patch('certbot._internal.storage.renewal_file_for_certname')
@mock.patch('certbot._internal.cert_manager.match_and_check_overlaps')
@mock.patch('certbot._internal.storage.full_archive_path')
@mock.patch('certbot._internal.cert_manager.delete')
@mock.patch('certbot._internal.cert_manager.cert_path_to_lineage')
@test_util.patch_get_utility()
def test_cert_path_only(self, mock_get_utility,
mock_cert_path_to_lineage, mock_delete, mock_archive,
mock_overlapping_archive_dirs, mock_renewal_file_for_certname):
# pylint: disable = unused-argument
config = self.config
config.cert_path = "/some/reasonable/path"
config.certname = ""
mock_cert_path_to_lineage.return_value = "example.com"
mock_overlapping_archive_dirs.return_value = False
self._call(config)
self.assertEqual(mock_delete.call_count, 1)
@mock.patch('certbot._internal.storage.renewal_file_for_certname')
@mock.patch('certbot._internal.cert_manager.match_and_check_overlaps')
@mock.patch('certbot._internal.storage.full_archive_path')
@mock.patch('certbot._internal.cert_manager.cert_path_to_lineage')
@mock.patch('certbot._internal.cert_manager.delete')
@test_util.patch_get_utility()
def test_noninteractive_deletion(self, mock_get_utility, mock_delete,
mock_cert_path_to_lineage, mock_full_archive_dir,
mock_match_and_check_overlaps, mock_renewal_file_for_certname):
# pylint: disable = unused-argument
config = self.config
config.namespace.noninteractive_mode = True
config.cert_path = "/some/reasonable/path"
config.certname = ""
mock_cert_path_to_lineage.return_value = "example.com"
mock_full_archive_dir.return_value = ""
mock_match_and_check_overlaps.return_value = ""
self._call(config)
self.assertEqual(mock_delete.call_count, 1)
@mock.patch('certbot._internal.storage.renewal_file_for_certname')
@mock.patch('certbot._internal.cert_manager.match_and_check_overlaps')
@mock.patch('certbot._internal.storage.full_archive_path')
@mock.patch('certbot._internal.cert_manager.cert_path_to_lineage')
@mock.patch('certbot._internal.cert_manager.delete')
@test_util.patch_get_utility()
def test_opt_in_deletion(self, mock_get_utility, mock_delete,
mock_cert_path_to_lineage, mock_full_archive_dir,
mock_match_and_check_overlaps, mock_renewal_file_for_certname):
# pylint: disable = unused-argument
config = self.config
config.namespace.delete_after_revoke = True
config.cert_path = "/some/reasonable/path"
config.certname = ""
mock_cert_path_to_lineage.return_value = "example.com"
mock_full_archive_dir.return_value = ""
mock_match_and_check_overlaps.return_value = ""
self._call(config)
self.assertEqual(mock_delete.call_count, 1)
self.assertFalse(mock_get_utility().yesno.called)
class DetermineAccountTest(test_util.ConfigTestCase):
"""Tests for certbot._internal.main._determine_account."""
def setUp(self):
super(DetermineAccountTest, self).setUp()
self.config.account = None
self.config.email = None
self.config.register_unsafely_without_email = False
self.accs = [mock.MagicMock(id='x'), mock.MagicMock(id='y')]
self.account_storage = account.AccountMemoryStorage()
# For use in saving accounts: fake out the new_authz URL.
self.mock_client = mock.MagicMock()
self.mock_client.directory.new_authz = "hi"
def _call(self):
# pylint: disable=protected-access
from certbot._internal.main import _determine_account
with mock.patch('certbot._internal.main.account.AccountFileStorage') as mock_storage:
mock_storage.return_value = self.account_storage
return _determine_account(self.config)
def test_args_account_set(self):
self.account_storage.save(self.accs[1], self.mock_client)
self.config.account = self.accs[1].id
self.assertEqual((self.accs[1], None), self._call())
self.assertEqual(self.accs[1].id, self.config.account)
self.assertTrue(self.config.email is None)
def test_single_account(self):
self.account_storage.save(self.accs[0], self.mock_client)
self.assertEqual((self.accs[0], None), self._call())
self.assertEqual(self.accs[0].id, self.config.account)
self.assertTrue(self.config.email is None)
@mock.patch('certbot._internal.client.display_ops.choose_account')
def test_multiple_accounts(self, mock_choose_accounts):
for acc in self.accs:
self.account_storage.save(acc, self.mock_client)
mock_choose_accounts.return_value = self.accs[1]
self.assertEqual((self.accs[1], None), self._call())
self.assertEqual(
set(mock_choose_accounts.call_args[0][0]), set(self.accs))
self.assertEqual(self.accs[1].id, self.config.account)
self.assertTrue(self.config.email is None)
@mock.patch('certbot._internal.client.display_ops.get_email')
def test_no_accounts_no_email(self, mock_get_email):
mock_get_email.return_value = 'foo@bar.baz'
with mock.patch('certbot._internal.main.client') as client:
client.register.return_value = (
self.accs[0], mock.sentinel.acme)
self.assertEqual((self.accs[0], mock.sentinel.acme), self._call())
client.register.assert_called_once_with(
self.config, self.account_storage, tos_cb=mock.ANY)
self.assertEqual(self.accs[0].id, self.config.account)
self.assertEqual('foo@bar.baz', self.config.email)
def test_no_accounts_email(self):
self.config.email = 'other email'
with mock.patch('certbot._internal.main.client') as client:
client.register.return_value = (self.accs[1], mock.sentinel.acme)
self._call()
self.assertEqual(self.accs[1].id, self.config.account)
self.assertEqual('other email', self.config.email)
class MainTest(test_util.ConfigTestCase):
"""Tests for different commands."""
def setUp(self):
super(MainTest, self).setUp()
filesystem.mkdir(self.config.logs_dir)
self.standard_args = ['--config-dir', self.config.config_dir,
'--work-dir', self.config.work_dir,
'--logs-dir', self.config.logs_dir, '--text']
self.mock_sleep = mock.patch('time.sleep').start()
def tearDown(self):
# Reset globals in cli
reload_module(cli)
super(MainTest, self).tearDown()
def _call(self, args, stdout=None, mockisfile=False):
"""Run the cli with output streams, actual client and optionally
os.path.isfile() mocked out"""
if mockisfile:
orig_open = os.path.isfile
def mock_isfile(fn, *args, **kwargs): # pylint: disable=unused-argument
"""Mock os.path.isfile()"""
if (fn.endswith("cert") or
fn.endswith("chain") or
fn.endswith("privkey")):
return True
return orig_open(fn)
with mock.patch("certbot.compat.os.path.isfile") as mock_if:
mock_if.side_effect = mock_isfile
with mock.patch('certbot._internal.main.client') as client:
ret, stdout, stderr = self._call_no_clientmock(args, stdout)
return ret, stdout, stderr, client
else:
with mock.patch('certbot._internal.main.client') as client:
ret, stdout, stderr = self._call_no_clientmock(args, stdout)
return ret, stdout, stderr, client
def _call_no_clientmock(self, args, stdout=None):
"Run the client with output streams mocked out"
args = self.standard_args + args
toy_stdout = stdout if stdout else six.StringIO()
with mock.patch('certbot._internal.main.sys.stdout', new=toy_stdout):
with mock.patch('certbot._internal.main.sys.stderr') as stderr:
with mock.patch("certbot.util.atexit"):
ret = main.main(args[:]) # NOTE: parser can alter its args!
return ret, toy_stdout, stderr
def test_no_flags(self):
with mock.patch('certbot._internal.main.run') as mock_run:
self._call([])
self.assertEqual(1, mock_run.call_count)
def test_version_string_program_name(self):
toy_out = six.StringIO()
toy_err = six.StringIO()
with mock.patch('certbot._internal.main.sys.stdout', new=toy_out):
with mock.patch('certbot._internal.main.sys.stderr', new=toy_err):
try:
main.main(["--version"])
except SystemExit:
pass
finally:
output = toy_out.getvalue() or toy_err.getvalue()
self.assertTrue("certbot" in output, "Output is {0}".format(output))
def _cli_missing_flag(self, args, message):
"Ensure that a particular error raises a missing cli flag error containing message"
exc = None
try:
with mock.patch('certbot._internal.main.sys.stderr'):
main.main(self.standard_args + args[:]) # NOTE: parser can alter its args!
except errors.MissingCommandlineFlag as exc_:
exc = exc_
self.assertTrue(message in str(exc))
self.assertTrue(exc is not None)
@mock.patch('certbot._internal.log.post_arg_parse_setup')
def test_noninteractive(self, _):
args = ['-n', 'certonly']
self._cli_missing_flag(args, "specify a plugin")
args.extend(['--standalone', '-d', 'eg.is'])
self._cli_missing_flag(args, "register before running")
@mock.patch('certbot._internal.eff.handle_subscription')
@mock.patch('certbot._internal.log.post_arg_parse_setup')
@mock.patch('certbot._internal.main._report_new_cert')
@mock.patch('certbot._internal.main.client.acme_client.Client')
@mock.patch('certbot._internal.main._determine_account')
@mock.patch('certbot._internal.main.client.Client.obtain_and_enroll_certificate')
@mock.patch('certbot._internal.main._get_and_save_cert')
def test_user_agent(self, gsc, _obt, det, _client, _, __, ___):
# Normally the client is totally mocked out, but here we need more
# arguments to automate it...
args = ["--standalone", "certonly", "-m", "none@none.com",
"-d", "example.com", '--agree-tos'] + self.standard_args
det.return_value = mock.MagicMock(), None
gsc.return_value = mock.MagicMock()
with mock.patch('certbot._internal.main.client.acme_client.ClientNetwork') as acme_net:
self._call_no_clientmock(args)
os_ver = util.get_os_info_ua()
ua = acme_net.call_args[1]["user_agent"]
self.assertTrue(os_ver in ua)
import platform
plat = platform.platform()
if "linux" in plat.lower():
self.assertTrue(util.get_os_info_ua() in ua)
with mock.patch('certbot._internal.main.client.acme_client.ClientNetwork') as acme_net:
ua = "bandersnatch"
args += ["--user-agent", ua]
self._call_no_clientmock(args)
acme_net.assert_called_once_with(mock.ANY, account=mock.ANY, verify_ssl=True,
user_agent=ua)
@mock.patch('certbot._internal.main.plug_sel.record_chosen_plugins')
@mock.patch('certbot._internal.main.plug_sel.pick_installer')
def test_installer_selection(self, mock_pick_installer, _rec):
self._call(['install', '--domains', 'foo.bar', '--cert-path', 'cert',
'--key-path', 'privkey', '--chain-path', 'chain'], mockisfile=True)
self.assertEqual(mock_pick_installer.call_count, 1)
@mock.patch('certbot._internal.main._install_cert')
@mock.patch('certbot._internal.main.plug_sel.record_chosen_plugins')
@mock.patch('certbot._internal.main.plug_sel.pick_installer')
def test_installer_certname(self, _inst, _rec, mock_install):
mock_lineage = mock.MagicMock(cert_path=test_util.temp_join('cert'),
chain_path=test_util.temp_join('chain'),
fullchain_path=test_util.temp_join('chain'),
key_path=test_util.temp_join('privkey'))
with mock.patch("certbot._internal.cert_manager.lineage_for_certname") as mock_getlin:
mock_getlin.return_value = mock_lineage
self._call(['install', '--cert-name', 'whatever'], mockisfile=True)
call_config = mock_install.call_args[0][0]
self.assertEqual(call_config.cert_path, test_util.temp_join('cert'))
self.assertEqual(call_config.fullchain_path, test_util.temp_join('chain'))
self.assertEqual(call_config.key_path, test_util.temp_join('privkey'))
@mock.patch('certbot._internal.log.post_arg_parse_setup')
@mock.patch('certbot._internal.main._install_cert')
@mock.patch('certbot._internal.main.plug_sel.record_chosen_plugins')
@mock.patch('certbot._internal.main.plug_sel.pick_installer')
def test_installer_param_override(self, _inst, _rec, mock_install, _):
mock_lineage = mock.MagicMock(cert_path=test_util.temp_join('cert'),
chain_path=test_util.temp_join('chain'),
fullchain_path=test_util.temp_join('chain'),
key_path=test_util.temp_join('privkey'))
with mock.patch("certbot._internal.cert_manager.lineage_for_certname") as mock_getlin:
mock_getlin.return_value = mock_lineage
self._call(['install', '--cert-name', 'whatever',
'--key-path', test_util.temp_join('overriding_privkey')], mockisfile=True)
call_config = mock_install.call_args[0][0]
self.assertEqual(call_config.cert_path, test_util.temp_join('cert'))
self.assertEqual(call_config.fullchain_path, test_util.temp_join('chain'))
self.assertEqual(call_config.chain_path, test_util.temp_join('chain'))
self.assertEqual(call_config.key_path, test_util.temp_join('overriding_privkey'))
mock_install.reset()
self._call(['install', '--cert-name', 'whatever',
'--cert-path', test_util.temp_join('overriding_cert')], mockisfile=True)
call_config = mock_install.call_args[0][0]
self.assertEqual(call_config.cert_path, test_util.temp_join('overriding_cert'))
self.assertEqual(call_config.fullchain_path, test_util.temp_join('chain'))
self.assertEqual(call_config.key_path, test_util.temp_join('privkey'))
@mock.patch('certbot._internal.main.plug_sel.record_chosen_plugins')
@mock.patch('certbot._internal.main.plug_sel.pick_installer')
def test_installer_param_error(self, _inst, _rec):
self.assertRaises(errors.ConfigurationError,
self._call,
['install', '--cert-name', 'notfound',
'--key-path', 'invalid'])
@mock.patch('certbot._internal.main.plug_sel.record_chosen_plugins')
@mock.patch('certbot._internal.main.plug_sel.pick_installer')
@mock.patch('certbot._internal.cert_manager.get_certnames')
@mock.patch('certbot._internal.main._install_cert')
def test_installer_select_cert(self, mock_inst, mock_getcert, _inst, _rec):
mock_lineage = mock.MagicMock(cert_path=test_util.temp_join('cert'),
chain_path=test_util.temp_join('chain'),
fullchain_path=test_util.temp_join('chain'),
key_path=test_util.temp_join('privkey'))
with mock.patch("certbot._internal.cert_manager.lineage_for_certname") as mock_getlin:
mock_getlin.return_value = mock_lineage
self._call(['install'], mockisfile=True)
self.assertTrue(mock_getcert.called)
self.assertTrue(mock_inst.called)
@mock.patch('certbot._internal.eff.handle_subscription')
@mock.patch('certbot._internal.log.post_arg_parse_setup')
@mock.patch('certbot._internal.main._report_new_cert')
@mock.patch('certbot.util.exe_exists')
def test_configurator_selection(self, mock_exe_exists, _, __, ___):
mock_exe_exists.return_value = True
real_plugins = disco.PluginsRegistry.find_all()
args = ['--apache', '--authenticator', 'standalone']
# This needed two calls to find_all(), which we're avoiding for now
# because of possible side effects:
# https://github.com/letsencrypt/letsencrypt/commit/51ed2b681f87b1eb29088dd48718a54f401e4855
#with mock.patch('certbot._internal.cli.plugins_testable') as plugins:
# plugins.return_value = {"apache": True, "nginx": True}
# ret, _, _, _ = self._call(args)
# self.assertTrue("Too many flags setting" in ret)
args = ["install", "--nginx", "--cert-path",
test_util.temp_join('blah'), "--key-path", test_util.temp_join('blah'),
"--nginx-server-root", "/nonexistent/thing", "-d",
"example.com", "--debug"]
if "nginx" in real_plugins:
# Sending nginx a non-existent conf dir will simulate misconfiguration
# (we can only do that if certbot-nginx is actually present)
ret, _, _, _ = self._call(args)
self.assertTrue("The nginx plugin is not working" in ret)
self.assertTrue("MisconfigurationError" in ret)
self._cli_missing_flag(["--standalone"], "With the standalone plugin, you probably")
with mock.patch("certbot._internal.main._init_le_client") as mock_init:
with mock.patch("certbot._internal.main._get_and_save_cert") as mock_gsc:
mock_gsc.return_value = mock.MagicMock()
self._call(["certonly", "--manual", "-d", "foo.bar"])
unused_config, auth, unused_installer = mock_init.call_args[0]
self.assertTrue(isinstance(auth, manual.Authenticator))
with mock.patch('certbot._internal.main.certonly') as mock_certonly:
self._call(["auth", "--standalone"])
self.assertEqual(1, mock_certonly.call_count)
@mock.patch('certbot._internal.log.post_arg_parse_setup')
def test_rollback(self, _):
_, _, _, client = self._call(['rollback'])
self.assertEqual(1, client.rollback.call_count)
_, _, _, client = self._call(['rollback', '--checkpoints', '123'])
client.rollback.assert_called_once_with(
mock.ANY, 123, mock.ANY, mock.ANY)
@mock.patch('certbot._internal.cert_manager.update_live_symlinks')
def test_update_symlinks(self, mock_cert_manager):
self._call_no_clientmock(['update_symlinks'])
self.assertEqual(1, mock_cert_manager.call_count)
@mock.patch('certbot._internal.cert_manager.certificates')
def test_certificates(self, mock_cert_manager):
self._call_no_clientmock(['certificates'])
self.assertEqual(1, mock_cert_manager.call_count)
@mock.patch('certbot._internal.cert_manager.delete')
def test_delete(self, mock_cert_manager):
self._call_no_clientmock(['delete'])
self.assertEqual(1, mock_cert_manager.call_count)
@mock.patch('certbot._internal.log.post_arg_parse_setup')
def test_plugins(self, _):
flags = ['--init', '--prepare', '--authenticators', '--installers']
for args in itertools.chain(
*(itertools.combinations(flags, r)
for r in six.moves.range(len(flags)))):
self._call(['plugins'] + list(args))
@mock.patch('certbot._internal.main.plugins_disco')
@mock.patch('certbot._internal.main.cli.HelpfulArgumentParser.determine_help_topics')
def test_plugins_no_args(self, _det, mock_disco):
ifaces = [] # type: List[interfaces.IPlugin]
plugins = mock_disco.PluginsRegistry.find_all()
stdout = six.StringIO()
with test_util.patch_get_utility_with_stdout(stdout=stdout):
_, stdout, _, _ = self._call(['plugins'], stdout)
plugins.visible.assert_called_once_with()
plugins.visible().ifaces.assert_called_once_with(ifaces)
filtered = plugins.visible().ifaces()
self.assertEqual(stdout.getvalue().strip(), str(filtered))
@mock.patch('certbot._internal.main.plugins_disco')
@mock.patch('certbot._internal.main.cli.HelpfulArgumentParser.determine_help_topics')
def test_plugins_no_args_unprivileged(self, _det, mock_disco):
ifaces = [] # type: List[interfaces.IPlugin]
plugins = mock_disco.PluginsRegistry.find_all()
def throw_error(directory, mode, strict):
"""Raises error.Error."""
_, _, _ = directory, mode, strict
raise errors.Error()
stdout = six.StringIO()
with mock.patch('certbot.util.set_up_core_dir') as mock_set_up_core_dir:
with test_util.patch_get_utility_with_stdout(stdout=stdout):
mock_set_up_core_dir.side_effect = throw_error
_, stdout, _, _ = self._call(['plugins'], stdout)
plugins.visible.assert_called_once_with()
plugins.visible().ifaces.assert_called_once_with(ifaces)
filtered = plugins.visible().ifaces()
self.assertEqual(stdout.getvalue().strip(), str(filtered))
@mock.patch('certbot._internal.main.plugins_disco')
@mock.patch('certbot._internal.main.cli.HelpfulArgumentParser.determine_help_topics')
def test_plugins_init(self, _det, mock_disco):
ifaces = [] # type: List[interfaces.IPlugin]
plugins = mock_disco.PluginsRegistry.find_all()
stdout = six.StringIO()
with test_util.patch_get_utility_with_stdout(stdout=stdout):
_, stdout, _, _ = self._call(['plugins', '--init'], stdout)
plugins.visible.assert_called_once_with()
plugins.visible().ifaces.assert_called_once_with(ifaces)
filtered = plugins.visible().ifaces()
self.assertEqual(filtered.init.call_count, 1)
filtered.verify.assert_called_once_with(ifaces)
verified = filtered.verify()
self.assertEqual(stdout.getvalue().strip(), str(verified))
@mock.patch('certbot._internal.main.plugins_disco')
@mock.patch('certbot._internal.main.cli.HelpfulArgumentParser.determine_help_topics')
def test_plugins_prepare(self, _det, mock_disco):
ifaces = [] # type: List[interfaces.IPlugin]
plugins = mock_disco.PluginsRegistry.find_all()
stdout = six.StringIO()
with test_util.patch_get_utility_with_stdout(stdout=stdout):
_, stdout, _, _ = self._call(['plugins', '--init', '--prepare'], stdout)
plugins.visible.assert_called_once_with()
plugins.visible().ifaces.assert_called_once_with(ifaces)
filtered = plugins.visible().ifaces()
self.assertEqual(filtered.init.call_count, 1)
filtered.verify.assert_called_once_with(ifaces)
verified = filtered.verify()
verified.prepare.assert_called_once_with()
verified.available.assert_called_once_with()
available = verified.available()
self.assertEqual(stdout.getvalue().strip(), str(available))
def test_certonly_abspath(self):
cert = 'cert'
key = 'key'
chain = 'chain'
fullchain = 'fullchain'
with mock.patch('certbot._internal.main.certonly') as mock_certonly:
self._call(['certonly', '--cert-path', cert, '--key-path', 'key',
'--chain-path', 'chain',
'--fullchain-path', 'fullchain'])
config, unused_plugins = mock_certonly.call_args[0]
self.assertEqual(config.cert_path, os.path.abspath(cert))
self.assertEqual(config.key_path, os.path.abspath(key))
self.assertEqual(config.chain_path, os.path.abspath(chain))
self.assertEqual(config.fullchain_path, os.path.abspath(fullchain))
def test_certonly_bad_args(self):
try:
self._call(['-a', 'bad_auth', 'certonly'])
assert False, "Exception should have been raised"
except errors.PluginSelectionError as e:
self.assertTrue('The requested bad_auth plugin does not appear' in str(e))
def test_check_config_sanity_domain(self):
# FQDN
self.assertRaises(errors.ConfigurationError,
self._call,
['-d', 'a' * 64])
# FQDN 2
self.assertRaises(errors.ConfigurationError,
self._call,
['-d', (('a' * 50) + '.') * 10])
# Bare IP address (this is actually a different error message now)
self.assertRaises(errors.ConfigurationError,
self._call,
['-d', '204.11.231.35'])
def test_csr_with_besteffort(self):
self.assertRaises(
errors.Error, self._call,
'certonly --csr {0} --allow-subset-of-names'.format(CSR).split())
def test_run_with_csr(self):
# This is an error because you can only use --csr with certonly
try:
self._call(['--csr', CSR])
except errors.Error as e:
assert "Please try the certonly" in repr(e)
return
assert False, "Expected supplying --csr to fail with default verb"
def test_csr_with_no_domains(self):
self.assertRaises(
errors.Error, self._call,
'certonly --csr {0}'.format(
test_util.vector_path('csr-nonames_512.pem')).split())
def test_csr_with_inconsistent_domains(self):
self.assertRaises(
errors.Error, self._call,
'certonly -d example.org --csr {0}'.format(CSR).split())
def _certonly_new_request_common(self, mock_client, args=None):
with mock.patch('certbot._internal.main._find_lineage_for_domains_and_certname') \
as mock_renewal:
mock_renewal.return_value = ("newcert", None)
with mock.patch('certbot._internal.main._init_le_client') as mock_init:
mock_init.return_value = mock_client
if args is None:
args = []
args += '-d foo.bar -a standalone certonly'.split()
self._call(args)
@test_util.patch_get_utility()
def test_certonly_dry_run_new_request_success(self, mock_get_utility):
mock_client = mock.MagicMock()
mock_client.obtain_and_enroll_certificate.return_value = None
self._certonly_new_request_common(mock_client, ['--dry-run'])
self.assertEqual(
mock_client.obtain_and_enroll_certificate.call_count, 1)
self.assertTrue(
'dry run' in mock_get_utility().add_message.call_args[0][0])
# Asserts we don't suggest donating after a successful dry run
self.assertEqual(mock_get_utility().add_message.call_count, 1)
@mock.patch('certbot._internal.eff.handle_subscription')
@mock.patch('certbot.crypto_util.notAfter')
@test_util.patch_get_utility()
def test_certonly_new_request_success(self, mock_get_utility, mock_notAfter, mock_subscription):
cert_path = os.path.normpath(os.path.join(self.config.config_dir, 'live/foo.bar'))
key_path = os.path.normpath(os.path.join(self.config.config_dir, 'live/baz.qux'))
date = '1970-01-01'
mock_notAfter().date.return_value = date
mock_lineage = mock.MagicMock(cert=cert_path, fullchain=cert_path,
fullchain_path=cert_path, key_path=key_path)
mock_client = mock.MagicMock()
mock_client.obtain_and_enroll_certificate.return_value = mock_lineage
self._certonly_new_request_common(mock_client)
self.assertEqual(
mock_client.obtain_and_enroll_certificate.call_count, 1)
cert_msg = mock_get_utility().add_message.call_args_list[0][0][0]
self.assertTrue(cert_path in cert_msg)
self.assertTrue(date in cert_msg)
self.assertTrue(key_path in cert_msg)
self.assertTrue(
'donate' in mock_get_utility().add_message.call_args[0][0])
self.assertTrue(mock_subscription.called)
@mock.patch('certbot._internal.eff.handle_subscription')
def test_certonly_new_request_failure(self, mock_subscription):
mock_client = mock.MagicMock()
mock_client.obtain_and_enroll_certificate.return_value = False
self.assertRaises(errors.Error,
self._certonly_new_request_common, mock_client)
self.assertFalse(mock_subscription.called)
def _test_renewal_common(self, due_for_renewal, extra_args, log_out=None,
args=None, should_renew=True, error_expected=False,
quiet_mode=False, expiry_date=datetime.datetime.now(),
reuse_key=False):
cert_path = test_util.vector_path('cert_512.pem')
chain_path = os.path.normpath(os.path.join(self.config.config_dir,
'live/foo.bar/fullchain.pem'))
mock_lineage = mock.MagicMock(cert=cert_path, fullchain=chain_path,
cert_path=cert_path, fullchain_path=chain_path)
mock_lineage.should_autorenew.return_value = due_for_renewal
mock_lineage.has_pending_deployment.return_value = False
mock_lineage.names.return_value = ['isnot.org']
mock_certr = mock.MagicMock()
mock_key = mock.MagicMock(pem='pem_key')
mock_client = mock.MagicMock()
stdout = six.StringIO()
mock_client.obtain_certificate.return_value = (mock_certr, 'chain',
mock_key, 'csr')
def write_msg(message, *args, **kwargs): # pylint: disable=unused-argument
"""Write message to stdout."""
stdout.write(message)
try:
with mock.patch('certbot._internal.cert_manager.find_duplicative_certs') as mock_fdc:
mock_fdc.return_value = (mock_lineage, None)
with mock.patch('certbot._internal.main._init_le_client') as mock_init:
mock_init.return_value = mock_client
with test_util.patch_get_utility() as mock_get_utility:
if not quiet_mode:
mock_get_utility().notification.side_effect = write_msg
with mock.patch('certbot._internal.main.renewal.OpenSSL') as mock_ssl:
mock_latest = mock.MagicMock()
mock_latest.get_issuer.return_value = "Fake fake"
mock_ssl.crypto.load_certificate.return_value = mock_latest
with mock.patch('certbot._internal.main.renewal.crypto_util') \
as mock_crypto_util:
mock_crypto_util.notAfter.return_value = expiry_date
with mock.patch('certbot._internal.eff.handle_subscription'):
if not args:
args = ['-d', 'isnot.org', '-a', 'standalone', 'certonly']
if extra_args:
args += extra_args
try:
ret, stdout, _, _ = self._call(args, stdout)
if ret:
print("Returned", ret)
raise AssertionError(ret)
assert not error_expected, "renewal should have errored"
except: # pylint: disable=bare-except
if not error_expected:
raise AssertionError(
"Unexpected renewal error:\n" +
traceback.format_exc())
if should_renew:
if reuse_key:
# The location of the previous live privkey.pem is passed
# to obtain_certificate
mock_client.obtain_certificate.assert_called_once_with(['isnot.org'],
os.path.normpath(os.path.join(
self.config.config_dir, "live/sample-renewal/privkey.pem")))
else:
mock_client.obtain_certificate.assert_called_once_with(['isnot.org'], None)
else:
self.assertEqual(mock_client.obtain_certificate.call_count, 0)
except:
self._dump_log()
raise
finally:
if log_out:
with open(os.path.join(self.config.logs_dir, "letsencrypt.log")) as lf:
self.assertTrue(log_out in lf.read())
return mock_lineage, mock_get_utility, stdout
@mock.patch('certbot.crypto_util.notAfter')
def test_certonly_renewal(self, _):
lineage, get_utility, _ = self._test_renewal_common(True, [])
self.assertEqual(lineage.save_successor.call_count, 1)
lineage.update_all_links_to.assert_called_once_with(
lineage.latest_common_version())
cert_msg = get_utility().add_message.call_args_list[0][0][0]
self.assertTrue('fullchain.pem' in cert_msg)
self.assertTrue('donate' in get_utility().add_message.call_args[0][0])
@mock.patch('certbot._internal.log.logging.handlers.RotatingFileHandler.doRollover')
@mock.patch('certbot.crypto_util.notAfter')
def test_certonly_renewal_triggers(self, _, __):
# --dry-run should force renewal
_, get_utility, _ = self._test_renewal_common(False, ['--dry-run', '--keep'],
log_out="simulating renewal")
self.assertEqual(get_utility().add_message.call_count, 1)
self.assertTrue('dry run' in get_utility().add_message.call_args[0][0])
self._test_renewal_common(False, ['--renew-by-default', '-tvv', '--debug'],
log_out="Auto-renewal forced")
self.assertEqual(get_utility().add_message.call_count, 1)
self._test_renewal_common(False, ['-tvv', '--debug', '--keep'],
log_out="not yet due", should_renew=False)
def _dump_log(self):
print("Logs:")
log_path = os.path.join(self.config.logs_dir, "letsencrypt.log")
if os.path.exists(log_path):
with open(log_path) as lf:
print(lf.read())
def test_renew_verb(self):
test_util.make_lineage(self.config.config_dir, 'sample-renewal.conf')
args = ["renew", "--dry-run", "-tvv"]
self._test_renewal_common(True, [], args=args, should_renew=True)
def test_reuse_key(self):
test_util.make_lineage(self.config.config_dir, 'sample-renewal.conf')
args = ["renew", "--dry-run", "--reuse-key"]
self._test_renewal_common(True, [], args=args, should_renew=True, reuse_key=True)
@mock.patch('certbot._internal.storage.RenewableCert.save_successor')
def test_reuse_key_no_dry_run(self, unused_save_successor):
test_util.make_lineage(self.config.config_dir, 'sample-renewal.conf')
args = ["renew", "--reuse-key"]
self._test_renewal_common(True, [], args=args, should_renew=True, reuse_key=True)
@mock.patch('sys.stdin')
def test_noninteractive_renewal_delay(self, stdin):
stdin.isatty.return_value = False
test_util.make_lineage(self.config.config_dir, 'sample-renewal.conf')
args = ["renew", "--dry-run", "-tvv"]
self._test_renewal_common(True, [], args=args, should_renew=True)
self.assertEqual(self.mock_sleep.call_count, 1)
# in main.py:
# sleep_time = random.randint(1, 60*8)
sleep_call_arg = self.mock_sleep.call_args[0][0]
self.assertTrue(1 <= sleep_call_arg <= 60*8)
@mock.patch('sys.stdin')
def test_interactive_no_renewal_delay(self, stdin):
stdin.isatty.return_value = True
test_util.make_lineage(self.config.config_dir, 'sample-renewal.conf')
args = ["renew", "--dry-run", "-tvv"]
self._test_renewal_common(True, [], args=args, should_renew=True)
self.assertEqual(self.mock_sleep.call_count, 0)
@mock.patch('certbot._internal.renewal.should_renew')
def test_renew_skips_recent_certs(self, should_renew):
should_renew.return_value = False
test_util.make_lineage(self.config.config_dir, 'sample-renewal.conf')
expiry = datetime.datetime.now() + datetime.timedelta(days=90)
_, _, stdout = self._test_renewal_common(False, extra_args=None, should_renew=False,
args=['renew'], expiry_date=expiry)
self.assertTrue('No renewals were attempted.' in stdout.getvalue())
self.assertTrue('The following certs are not due for renewal yet:' in stdout.getvalue())
@mock.patch('certbot._internal.log.post_arg_parse_setup')
def test_quiet_renew(self, _):
test_util.make_lineage(self.config.config_dir, 'sample-renewal.conf')
args = ["renew", "--dry-run"]
_, _, stdout = self._test_renewal_common(True, [], args=args, should_renew=True)
out = stdout.getvalue()
self.assertTrue("renew" in out)
args = ["renew", "--dry-run", "-q"]
_, _, stdout = self._test_renewal_common(True, [], args=args,
should_renew=True, quiet_mode=True)
out = stdout.getvalue()
self.assertEqual("", out)
def test_renew_hook_validation(self):
test_util.make_lineage(self.config.config_dir, 'sample-renewal.conf')
args = ["renew", "--dry-run", "--post-hook=no-such-command"]
self._test_renewal_common(True, [], args=args, should_renew=False,
error_expected=True)
def test_renew_no_hook_validation(self):
test_util.make_lineage(self.config.config_dir, 'sample-renewal.conf')
args = ["renew", "--dry-run", "--post-hook=no-such-command",
"--disable-hook-validation"]
with mock.patch("certbot._internal.hooks.post_hook"):
self._test_renewal_common(True, [], args=args, should_renew=True,
error_expected=False)
def test_renew_verb_empty_config(self):
rd = os.path.join(self.config.config_dir, 'renewal')
if not os.path.exists(rd):
filesystem.makedirs(rd)
with open(os.path.join(rd, 'empty.conf'), 'w'):
pass # leave the file empty
args = ["renew", "--dry-run", "-tvv"]
self._test_renewal_common(False, [], args=args, should_renew=False, error_expected=True)
def test_renew_with_certname(self):
test_util.make_lineage(self.config.config_dir, 'sample-renewal.conf')
self._test_renewal_common(True, [], should_renew=True,
args=['renew', '--dry-run', '--cert-name', 'sample-renewal'])
def test_renew_with_bad_certname(self):
self._test_renewal_common(True, [], should_renew=False,
args=['renew', '--dry-run', '--cert-name', 'sample-renewal'],
error_expected=True)
def _make_dummy_renewal_config(self):
renewer_configs_dir = os.path.join(self.config.config_dir, 'renewal')
filesystem.makedirs(renewer_configs_dir)
with open(os.path.join(renewer_configs_dir, 'test.conf'), 'w') as f:
f.write("My contents don't matter")
def _test_renew_common(self, renewalparams=None, names=None,
assert_oc_called=None, **kwargs):
self._make_dummy_renewal_config()
with mock.patch('certbot._internal.storage.RenewableCert') as mock_rc:
mock_lineage = mock.MagicMock()
mock_lineage.fullchain = "somepath/fullchain.pem"
if renewalparams is not None:
mock_lineage.configuration = {'renewalparams': renewalparams}
if names is not None:
mock_lineage.names.return_value = names
mock_rc.return_value = mock_lineage
with mock.patch('certbot._internal.main.renew_cert') as mock_renew_cert:
kwargs.setdefault('args', ['renew'])
self._test_renewal_common(True, None, should_renew=False, **kwargs)
if assert_oc_called is not None:
if assert_oc_called:
self.assertTrue(mock_renew_cert.called)
else:
self.assertFalse(mock_renew_cert.called)
def test_renew_no_renewalparams(self):
self._test_renew_common(assert_oc_called=False, error_expected=True)
def test_renew_no_authenticator(self):
self._test_renew_common(renewalparams={}, assert_oc_called=False,
error_expected=True)
def test_renew_with_bad_int(self):
renewalparams = {'authenticator': 'webroot',
'rsa_key_size': 'over 9000'}
self._test_renew_common(renewalparams=renewalparams, error_expected=True,
assert_oc_called=False)
def test_renew_with_nonetype_http01(self):
renewalparams = {'authenticator': 'webroot',
'http01_port': 'None'}
self._test_renew_common(renewalparams=renewalparams,
assert_oc_called=True)
def test_renew_with_bad_domain(self):
renewalparams = {'authenticator': 'webroot'}
names = ['uniçodé.com']
self._test_renew_common(renewalparams=renewalparams, error_expected=True,
names=names, assert_oc_called=False)
@mock.patch('certbot._internal.plugins.selection.choose_configurator_plugins')
def test_renew_with_configurator(self, mock_sel):
mock_sel.return_value = (mock.MagicMock(), mock.MagicMock())
renewalparams = {'authenticator': 'webroot'}
self._test_renew_common(
renewalparams=renewalparams, assert_oc_called=True,
args='renew --configurator apache'.split())
def test_renew_plugin_config_restoration(self):
renewalparams = {'authenticator': 'webroot',
'webroot_path': 'None',
'webroot_imaginary_flag': '42'}
self._test_renew_common(renewalparams=renewalparams,
assert_oc_called=True)
def test_renew_with_webroot_map(self):
renewalparams = {'authenticator': 'webroot'}
self._test_renew_common(
renewalparams=renewalparams, assert_oc_called=True,
args=['renew', '--webroot-map', json.dumps({'example.com': tempfile.gettempdir()})])
def test_renew_reconstitute_error(self):
# pylint: disable=protected-access
with mock.patch('certbot._internal.main.renewal._reconstitute') as mock_reconstitute:
mock_reconstitute.side_effect = Exception
self._test_renew_common(assert_oc_called=False, error_expected=True)
def test_renew_obtain_cert_error(self):
self._make_dummy_renewal_config()
with mock.patch('certbot._internal.storage.RenewableCert') as mock_rc:
mock_lineage = mock.MagicMock()
mock_lineage.fullchain = "somewhere/fullchain.pem"
mock_rc.return_value = mock_lineage
mock_lineage.configuration = {
'renewalparams': {'authenticator': 'webroot'}}
with mock.patch('certbot._internal.main.renew_cert') as mock_renew_cert:
mock_renew_cert.side_effect = Exception
self._test_renewal_common(True, None, error_expected=True,
args=['renew'], should_renew=False)
def test_renew_with_bad_cli_args(self):
self._test_renewal_common(True, None, args='renew -d example.com'.split(),
should_renew=False, error_expected=True)
self._test_renewal_common(True, None, args='renew --csr {0}'.format(CSR).split(),
should_renew=False, error_expected=True)
def test_no_renewal_with_hooks(self):
_, _, stdout = self._test_renewal_common(
due_for_renewal=False, extra_args=None, should_renew=False,
args=['renew', '--post-hook',
'{0} -c "from __future__ import print_function; print(\'hello world\');"'
.format(sys.executable)])
self.assertTrue('No hooks were run.' in stdout.getvalue())
@test_util.patch_get_utility()
@mock.patch('certbot._internal.main._find_lineage_for_domains_and_certname')
@mock.patch('certbot._internal.main._init_le_client')
def test_certonly_reinstall(self, mock_init, mock_renewal, mock_get_utility):
mock_renewal.return_value = ('reinstall', mock.MagicMock())
mock_init.return_value = mock_client = mock.MagicMock()
self._call(['-d', 'foo.bar', '-a', 'standalone', 'certonly'])
self.assertFalse(mock_client.obtain_certificate.called)
self.assertFalse(mock_client.obtain_and_enroll_certificate.called)
self.assertEqual(mock_get_utility().add_message.call_count, 0)
#self.assertTrue('donate' not in mock_get_utility().add_message.call_args[0][0])
def _test_certonly_csr_common(self, extra_args=None):
certr = 'certr'
chain = 'chain'
mock_client = mock.MagicMock()
mock_client.obtain_certificate_from_csr.return_value = (certr, chain)
cert_path = os.path.normpath(os.path.join(
self.config.config_dir,
'live/example.com/cert_512.pem'))
full_path = os.path.normpath(os.path.join(
self.config.config_dir,
'live/example.com/fullchain.pem'))
mock_client.save_certificate.return_value = cert_path, None, full_path
with mock.patch('certbot._internal.main._init_le_client') as mock_init:
mock_init.return_value = mock_client
with test_util.patch_get_utility() as mock_get_utility:
chain_path = os.path.normpath(os.path.join(
self.config.config_dir,
'live/example.com/chain.pem'))
args = ('-a standalone certonly --csr {0} --cert-path {1} '
'--chain-path {2} --fullchain-path {3}').format(
CSR, cert_path, chain_path, full_path).split()
if extra_args:
args += extra_args
with mock.patch('certbot._internal.main.crypto_util'):
self._call(args)
if '--dry-run' in args:
self.assertFalse(mock_client.save_certificate.called)
else:
mock_client.save_certificate.assert_called_once_with(
certr, chain, cert_path, chain_path, full_path)
return mock_get_utility
@mock.patch('certbot._internal.eff.handle_subscription')
def test_certonly_csr(self, mock_subscription):
mock_get_utility = self._test_certonly_csr_common()
cert_msg = mock_get_utility().add_message.call_args_list[0][0][0]
self.assertTrue('fullchain.pem' in cert_msg)
self.assertFalse('Your key file has been saved at' in cert_msg)
self.assertTrue(
'donate' in mock_get_utility().add_message.call_args[0][0])
self.assertTrue(mock_subscription.called)
def test_certonly_csr_dry_run(self):
mock_get_utility = self._test_certonly_csr_common(['--dry-run'])
self.assertEqual(mock_get_utility().add_message.call_count, 1)
self.assertTrue(
'dry run' in mock_get_utility().add_message.call_args[0][0])
@mock.patch('certbot._internal.main._delete_if_appropriate')
@mock.patch('certbot._internal.main.client.acme_client')
def test_revoke_with_key(self, mock_acme_client,
mock_delete_if_appropriate):
mock_delete_if_appropriate.return_value = False
server = 'foo.bar'
self._call_no_clientmock(['--cert-path', SS_CERT_PATH, '--key-path', RSA2048_KEY_PATH,
'--server', server, 'revoke'])
with open(RSA2048_KEY_PATH, 'rb') as f:
mock_acme_client.BackwardsCompatibleClientV2.assert_called_once_with(
mock.ANY, jose.JWK.load(f.read()), server)
with open(SS_CERT_PATH, 'rb') as f:
cert = crypto_util.pyopenssl_load_certificate(f.read())[0]
mock_revoke = mock_acme_client.BackwardsCompatibleClientV2().revoke
mock_revoke.assert_called_once_with(
jose.ComparableX509(cert),
mock.ANY)
def test_revoke_with_key_mismatch(self):
server = 'foo.bar'
self.assertRaises(errors.Error, self._call_no_clientmock,
['--cert-path', CERT, '--key-path', KEY,
'--server', server, 'revoke'])
@mock.patch('certbot._internal.main._delete_if_appropriate')
@mock.patch('certbot._internal.main._determine_account')
def test_revoke_without_key(self, mock_determine_account,
mock_delete_if_appropriate):
mock_delete_if_appropriate.return_value = False
mock_determine_account.return_value = (mock.MagicMock(), None)
_, _, _, client = self._call(['--cert-path', CERT, 'revoke'])
with open(CERT) as f:
cert = crypto_util.pyopenssl_load_certificate(f.read())[0]
mock_revoke = client.acme_from_config_key().revoke
mock_revoke.assert_called_once_with(
jose.ComparableX509(cert),
mock.ANY)
@mock.patch('certbot._internal.log.post_arg_parse_setup')
def test_register(self, _):
with mock.patch('certbot._internal.main.client') as mocked_client:
acc = mock.MagicMock()
acc.id = "imaginary_account"
mocked_client.register.return_value = (acc, "worked")
self._call_no_clientmock(["register", "--email", "user@example.org"])
# TODO: It would be more correct to explicitly check that
# _determine_account() gets called in the above case,
# but coverage statistics should also show that it did.
with mock.patch('certbot._internal.main.account') as mocked_account:
mocked_storage = mock.MagicMock()
mocked_account.AccountFileStorage.return_value = mocked_storage
mocked_storage.find_all.return_value = ["an account"]
x = self._call_no_clientmock(["register", "--email", "user@example.org"])
self.assertTrue("There is an existing account" in x[0])
def test_update_account_no_existing_accounts(self):
# with mock.patch('certbot._internal.main.client') as mocked_client:
with mock.patch('certbot._internal.main.account') as mocked_account:
mocked_storage = mock.MagicMock()
mocked_account.AccountFileStorage.return_value = mocked_storage
mocked_storage.find_all.return_value = []
x = self._call_no_clientmock(
["update_account", "--email",
"user@example.org"])
self.assertTrue("Could not find an existing account" in x[0])
@mock.patch('certbot._internal.main._determine_account')
@mock.patch('certbot._internal.eff.prepare_subscription')
@mock.patch('certbot._internal.main.account')
def test_update_account_remove_email(self, mocked_account_module, mock_prepare, mock_det_acc):
# Mock account storage and the account object returned
mocked_storage = mock.MagicMock()
mocked_account = mock.MagicMock()
mocked_account_module.AccountFileStorage.return_value = mocked_storage
mocked_storage.find_all.return_value = [mocked_account]
mock_det_acc.return_value = (mocked_account, "foo")
# Mock registration body to verify calls are made
mock_regr_body = mock.MagicMock()
# mocked_account.regr is overwritten in update, requiring an odd mock setup
mocked_account.regr.body = mock_regr_body
x = self._call(
["update_account", "--register-unsafely-without-email"])
# When update succeeds, the return value of update_account() is None
self.assertTrue(x[0] is None)
# and we got supposedly did update the registration from
# the server
client_mock = x[3]
self.assertTrue(client_mock.Client().acme.update_registration.called)
self.assertTrue(mock_regr_body.update.called)
self.assertTrue('contact' in mock_regr_body.update.call_args[1])
self.assertEqual(mock_regr_body.update.call_args[1]['contact'], ())
# and we saved the updated registration on disk
self.assertTrue(mocked_storage.update_regr.called)
# ensure we didn't try to subscribe (no email to subscribe with)
self.assertFalse(mock_prepare.called)
@mock.patch('certbot._internal.main.display_ops.get_email')
@test_util.patch_get_utility()
def test_update_account_with_email(self, mock_utility, mock_email):
email = "user@example.com"
mock_email.return_value = email
with mock.patch('certbot._internal.eff.prepare_subscription') as mock_prepare:
with mock.patch('certbot._internal.main._determine_account') as mocked_det:
with mock.patch('certbot._internal.main.account') as mocked_account:
with mock.patch('certbot._internal.main.client') as mocked_client:
mocked_storage = mock.MagicMock()
mocked_account.AccountFileStorage.return_value = mocked_storage
mocked_storage.find_all.return_value = ["an account"]
mocked_det.return_value = (mock.MagicMock(), "foo")
cb_client = mock.MagicMock()
mocked_client.Client.return_value = cb_client
x = self._call_no_clientmock(
["update_account"])
# When registration change succeeds, the return value
# of register() is None
self.assertTrue(x[0] is None)
# and we got supposedly did update the registration from
# the server
self.assertTrue(
cb_client.acme.update_registration.called)
# and we saved the updated registration on disk
self.assertTrue(mocked_storage.update_regr.called)
self.assertTrue(
email in mock_utility().add_message.call_args[0][0])
self.assertTrue(mock_prepare.called)
@mock.patch('certbot._internal.plugins.selection.choose_configurator_plugins')
@mock.patch('certbot._internal.updater._run_updaters')
def test_plugin_selection_error(self, mock_run, mock_choose):
mock_choose.side_effect = errors.PluginSelectionError
self.assertRaises(errors.PluginSelectionError, main.renew_cert,
None, None, None)
self.config.dry_run = False
updater.run_generic_updaters(self.config, None, None)
# Make sure we're returning None, and hence not trying to run the
# without installer
self.assertFalse(mock_run.called)
class UnregisterTest(unittest.TestCase):
def setUp(self):
self.patchers = {
'_determine_account': mock.patch('certbot._internal.main._determine_account'),
'account': mock.patch('certbot._internal.main.account'),
'client': mock.patch('certbot._internal.main.client'),
'get_utility': test_util.patch_get_utility()}
self.mocks = {k: v.start() for k, v in self.patchers.items()}
def tearDown(self):
for patch in self.patchers.values():
patch.stop()
def test_abort_unregister(self):
self.mocks['account'].AccountFileStorage.return_value = mock.Mock()
util_mock = self.mocks['get_utility']()
util_mock.yesno.return_value = False
config = mock.Mock()
unused_plugins = mock.Mock()
res = main.unregister(config, unused_plugins)
self.assertEqual(res, "Deactivation aborted.")
def test_unregister(self):
mocked_storage = mock.MagicMock()
mocked_storage.find_all.return_value = ["an account"]
self.mocks['account'].AccountFileStorage.return_value = mocked_storage
self.mocks['_determine_account'].return_value = (mock.MagicMock(), "foo")
cb_client = mock.MagicMock()
self.mocks['client'].Client.return_value = cb_client
config = mock.MagicMock()
unused_plugins = mock.MagicMock()
res = main.unregister(config, unused_plugins)
self.assertTrue(res is None)
self.assertTrue(cb_client.acme.deactivate_registration.called)
m = "Account deactivated."
self.assertTrue(m in self.mocks['get_utility']().add_message.call_args[0][0])
def test_unregister_no_account(self):
mocked_storage = mock.MagicMock()
mocked_storage.find_all.return_value = []
self.mocks['account'].AccountFileStorage.return_value = mocked_storage
cb_client = mock.MagicMock()
self.mocks['client'].Client.return_value = cb_client
config = mock.MagicMock()
unused_plugins = mock.MagicMock()
res = main.unregister(config, unused_plugins)
m = "Could not find existing account to deactivate."
self.assertEqual(res, m)
self.assertFalse(cb_client.acme.deactivate_registration.called)
class MakeOrVerifyNeededDirs(test_util.ConfigTestCase):
"""Tests for certbot._internal.main.make_or_verify_needed_dirs."""
@mock.patch("certbot._internal.main.util")
def test_it(self, mock_util):
main.make_or_verify_needed_dirs(self.config)
for core_dir in (self.config.config_dir, self.config.work_dir,):
mock_util.set_up_core_dir.assert_any_call(
core_dir, constants.CONFIG_DIRS_MODE,
self.config.strict_permissions
)
hook_dirs = (self.config.renewal_pre_hooks_dir,
self.config.renewal_deploy_hooks_dir,
self.config.renewal_post_hooks_dir,)
for hook_dir in hook_dirs:
# default mode of 755 is used
mock_util.make_or_verify_dir.assert_any_call(
hook_dir, strict=self.config.strict_permissions)
class EnhanceTest(test_util.ConfigTestCase):
"""Tests for certbot._internal.main.enhance."""
def setUp(self):
super(EnhanceTest, self).setUp()
self.get_utility_patch = test_util.patch_get_utility()
self.mock_get_utility = self.get_utility_patch.start()
self.mockinstaller = mock.MagicMock(spec=enhancements.AutoHSTSEnhancement)
def tearDown(self):
self.get_utility_patch.stop()
def _call(self, args):
plugins = disco.PluginsRegistry.find_all()
config = configuration.NamespaceConfig(
cli.prepare_and_parse_args(plugins, args))
with mock.patch('certbot._internal.cert_manager.get_certnames') as mock_certs:
mock_certs.return_value = ['example.com']
with mock.patch('certbot._internal.cert_manager.domains_for_certname') as mock_dom:
mock_dom.return_value = ['example.com']
with mock.patch('certbot._internal.main._init_le_client') as mock_init:
mock_client = mock.MagicMock()
mock_client.config = config
mock_init.return_value = mock_client
main.enhance(config, plugins)
return mock_client # returns the client
@mock.patch('certbot._internal.main.plug_sel.record_chosen_plugins')
@mock.patch('certbot._internal.cert_manager.lineage_for_certname')
@mock.patch('certbot._internal.main.display_ops.choose_values')
@mock.patch('certbot._internal.main._find_domains_or_certname')
def test_selection_question(self, mock_find, mock_choose, mock_lineage, _rec):
mock_lineage.return_value = mock.MagicMock(chain_path="/tmp/nonexistent")
mock_choose.return_value = ['example.com']
mock_find.return_value = (None, None)
with mock.patch('certbot._internal.main.plug_sel.pick_installer') as mock_pick:
self._call(['enhance', '--redirect'])
self.assertTrue(mock_pick.called)
# Check that the message includes "enhancements"
self.assertTrue("enhancements" in mock_pick.call_args[0][3])
@mock.patch('certbot._internal.main.plug_sel.record_chosen_plugins')
@mock.patch('certbot._internal.cert_manager.lineage_for_certname')
@mock.patch('certbot._internal.main.display_ops.choose_values')
@mock.patch('certbot._internal.main._find_domains_or_certname')
def test_selection_auth_warning(self, mock_find, mock_choose, mock_lineage, _rec):
mock_lineage.return_value = mock.MagicMock(chain_path="/tmp/nonexistent")
mock_choose.return_value = ["example.com"]
mock_find.return_value = (None, None)
with mock.patch('certbot._internal.main.plug_sel.pick_installer'):
with mock.patch('certbot._internal.main.plug_sel.logger.warning') as mock_log:
mock_client = self._call(['enhance', '-a', 'webroot', '--redirect'])
self.assertTrue(mock_log.called)
self.assertTrue("make sense" in mock_log.call_args[0][0])
self.assertTrue(mock_client.enhance_config.called)
@mock.patch('certbot._internal.cert_manager.lineage_for_certname')
@mock.patch('certbot._internal.main.display_ops.choose_values')
@mock.patch('certbot._internal.main.plug_sel.record_chosen_plugins')
def test_enhance_config_call(self, _rec, mock_choose, mock_lineage):
mock_lineage.return_value = mock.MagicMock(chain_path="/tmp/nonexistent")
mock_choose.return_value = ["example.com"]
with mock.patch('certbot._internal.main.plug_sel.pick_installer'):
mock_client = self._call(['enhance', '--redirect', '--hsts'])
req_enh = ["redirect", "hsts"]
not_req_enh = ["uir"]
self.assertTrue(mock_client.enhance_config.called)
self.assertTrue(
all(getattr(mock_client.config, e) for e in req_enh))
self.assertFalse(
any(getattr(mock_client.config, e) for e in not_req_enh))
self.assertTrue(
"example.com" in mock_client.enhance_config.call_args[0][0])
@mock.patch('certbot._internal.cert_manager.lineage_for_certname')
@mock.patch('certbot._internal.main.display_ops.choose_values')
@mock.patch('certbot._internal.main.plug_sel.record_chosen_plugins')
def test_enhance_noninteractive(self, _rec, mock_choose, mock_lineage):
mock_lineage.return_value = mock.MagicMock(
chain_path="/tmp/nonexistent")
mock_choose.return_value = ["example.com"]
with mock.patch('certbot._internal.main.plug_sel.pick_installer'):
mock_client = self._call(['enhance', '--redirect',
'--hsts', '--non-interactive'])
self.assertTrue(mock_client.enhance_config.called)
self.assertFalse(mock_choose.called)
@mock.patch('certbot._internal.main.display_ops.choose_values')
@mock.patch('certbot._internal.main.plug_sel.record_chosen_plugins')
def test_user_abort_domains(self, _rec, mock_choose):
mock_choose.return_value = []
with mock.patch('certbot._internal.main.plug_sel.pick_installer'):
self.assertRaises(errors.Error,
self._call,
['enhance', '--redirect', '--hsts'])
def test_no_enhancements_defined(self):
self.assertRaises(errors.MisconfigurationError,
self._call, ['enhance', '-a', 'null'])
@mock.patch('certbot._internal.main.plug_sel.choose_configurator_plugins')
@mock.patch('certbot._internal.main.display_ops.choose_values')
@mock.patch('certbot._internal.main.plug_sel.record_chosen_plugins')
def test_plugin_selection_error(self, _rec, mock_choose, mock_pick):
mock_choose.return_value = ["example.com"]
mock_pick.return_value = (None, None)
mock_pick.side_effect = errors.PluginSelectionError()
mock_client = self._call(['enhance', '--hsts'])
self.assertFalse(mock_client.enhance_config.called)
@mock.patch('certbot._internal.cert_manager.lineage_for_certname')
@mock.patch('certbot._internal.main.display_ops.choose_values')
@mock.patch('certbot._internal.main.plug_sel.pick_installer')
@mock.patch('certbot._internal.main.plug_sel.record_chosen_plugins')
@test_util.patch_get_utility()
def test_enhancement_enable(self, _, _rec, mock_inst, mock_choose, mock_lineage):
mock_inst.return_value = self.mockinstaller
mock_choose.return_value = ["example.com", "another.tld"]
mock_lineage.return_value = mock.MagicMock(chain_path="/tmp/nonexistent")
self._call(['enhance', '--auto-hsts'])
self.assertTrue(self.mockinstaller.enable_autohsts.called)
self.assertEqual(self.mockinstaller.enable_autohsts.call_args[0][1],
["example.com", "another.tld"])
@mock.patch('certbot._internal.cert_manager.lineage_for_certname')
@mock.patch('certbot._internal.main.display_ops.choose_values')
@mock.patch('certbot._internal.main.plug_sel.pick_installer')
@mock.patch('certbot._internal.main.plug_sel.record_chosen_plugins')
@test_util.patch_get_utility()
def test_enhancement_enable_not_supported(self, _, _rec, mock_inst, mock_choose, mock_lineage):
mock_inst.return_value = null.Installer(self.config, "null")
mock_choose.return_value = ["example.com", "another.tld"]
mock_lineage.return_value = mock.MagicMock(chain_path="/tmp/nonexistent")
self.assertRaises(
errors.NotSupportedError,
self._call, ['enhance', '--auto-hsts'])
def test_enhancement_enable_conflict(self):
self.assertRaises(
errors.Error,
self._call, ['enhance', '--auto-hsts', '--hsts'])
class InstallTest(test_util.ConfigTestCase):
"""Tests for certbot._internal.main.install."""
def setUp(self):
super(InstallTest, self).setUp()
self.mockinstaller = mock.MagicMock(spec=enhancements.AutoHSTSEnhancement)
@mock.patch('certbot._internal.main.plug_sel.record_chosen_plugins')
@mock.patch('certbot._internal.main.plug_sel.pick_installer')
def test_install_enhancement_not_supported(self, mock_inst, _rec):
mock_inst.return_value = null.Installer(self.config, "null")
plugins = disco.PluginsRegistry.find_all()
self.config.auto_hsts = True
self.config.certname = "nonexistent"
self.assertRaises(errors.NotSupportedError,
main.install,
self.config, plugins)
@mock.patch('certbot._internal.main.plug_sel.record_chosen_plugins')
@mock.patch('certbot._internal.main.plug_sel.pick_installer')
def test_install_enhancement_no_certname(self, mock_inst, _rec):
mock_inst.return_value = self.mockinstaller
plugins = disco.PluginsRegistry.find_all()
self.config.auto_hsts = True
self.config.certname = None
self.config.key_path = "/tmp/nonexistent"
self.config.cert_path = "/tmp/nonexistent"
self.assertRaises(errors.ConfigurationError,
main.install,
self.config, plugins)
if __name__ == '__main__':
unittest.main() # pragma: no cover
|
# -*- coding: utf-8 -*-
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import os
import sys
sys.path.insert(0, os.path.abspath(".."))
# -- General configuration ------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
]
# Uncomment the below if you use native CircuitPython modules such as
# digitalio, micropython and busio. List the modules you use. Without it, the
# autodoc module docs will fail to generate with a warning.
# autodoc_mock_imports = ["digitalio", "micropython", "ucollections"]
intersphinx_mapping = {
"python": ("https://docs.python.org/3.4", None),
"BusDevice": (
"https://circuitpython.readthedocs.io/projects/busdevice/en/latest/",
None,
),
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
}
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
source_suffix = ".rst"
# The master toctree document.
master_doc = "index"
# General information about the project.
project = "Adafruit LIS3DH Library"
copyright = "2017 Tony DiCola"
author = "Tony DiCola"
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = "1.0"
# The full version, including alpha/beta/rc tags.
release = "1.0"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".env", "CODE_OF_CONDUCT.md"]
# The reST default role (used for this markup: `text`) to use for all
# documents.
#
default_role = "any"
# If true, '()' will be appended to :func: etc. cross-reference text.
#
add_function_parentheses = True
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# If this is True, todo emits a warning for each TODO entries. The default is False.
todo_emit_warnings = True
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
if not on_rtd: # only import and set the theme if we're building docs locally
try:
import sphinx_rtd_theme
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
except:
html_theme = "default"
html_theme_path = ["."]
else:
html_theme_path = ["."]
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
# The name of an image file (relative to this directory) to use as a favicon of
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#
html_favicon = "_static/favicon.ico"
# Output file base name for HTML help builder.
htmlhelp_basename = "AdafruitLIS3DHLibrarydoc"
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(
master_doc,
"AdafruitLIS3DHLibrary.tex",
"Adafruit LIS3DH Library Documentation",
author,
"manual",
),
]
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(
master_doc,
"adafruitLIS3DHlibrary",
"Adafruit LIS3DH Library Documentation",
[author],
1,
)
]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(
master_doc,
"adafruitLIS3DHlibrary",
"Adafruit LIS3DH Library Documentation",
author,
"adafruitLIS3DHlibrary",
"A CircuitPython library for the LIS3DH.",
"Miscellaneous",
),
]
|
#ifndef _NUODB_PAYMENT_H_
#define _NUODB_PAYMENT_H_
#include "nuodb_common.h"
int execute_payment(struct db_context_t *dbc, struct payment_t *data);
#endif /* _NUODB_PAYMENT_H_ */
|
import json
from django import VERSION
from django.conf import settings
try:
from django.conf.urls import url
except ImportError:
# Django < 1.4
from django.conf.urls.defaults import url
from django.contrib.admin import ModelAdmin, TabularInline, StackedInline
from django.contrib.admin.options import InlineModelAdmin
if VERSION >= (1, 8):
from django.contrib.auth import get_permission_codename
from django.contrib.contenttypes.admin import (GenericStackedInline,
GenericTabularInline)
else:
from django.contrib.contenttypes.generic import (GenericStackedInline,
GenericTabularInline)
from django.contrib.contenttypes.models import ContentType
from django.http import HttpResponse
from django.shortcuts import render
from django.template.defaultfilters import capfirst
from adminsortable.fields import SortableForeignKey
from adminsortable.models import SortableMixin
from adminsortable.utils import get_is_sortable
STATIC_URL = settings.STATIC_URL
class SortableAdminBase(object):
sortable_change_list_with_sort_link_template = \
'adminsortable/change_list_with_sort_link.html'
sortable_change_form_template = 'adminsortable/change_form.html'
sortable_change_list_template = 'adminsortable/change_list.html'
change_form_template_extends = 'admin/change_form.html'
change_list_template_extends = 'admin/change_list.html'
def changelist_view(self, request, extra_context=None):
"""
If the model that inherits Sortable has more than one object,
its sort order can be changed. This view adds a link to the
object_tools block to take people to the view to change the sorting.
"""
try:
qs_method = getattr(self, 'get_queryset', self.queryset)
except AttributeError:
qs_method = self.get_queryset
if get_is_sortable(qs_method(request)):
self.change_list_template = \
self.sortable_change_list_with_sort_link_template
self.is_sortable = True
if extra_context is None:
extra_context = {}
extra_context.update({
'change_list_template_extends': self.change_list_template_extends,
'sorting_filters': [sort_filter[0] for sort_filter
in getattr(self.model, 'sorting_filters', [])]
})
return super(SortableAdminBase, self).changelist_view(request,
extra_context=extra_context)
class SortableAdmin(SortableAdminBase, ModelAdmin):
"""
Admin class to add template overrides and context objects to enable
drag-and-drop ordering.
"""
class Meta:
abstract = True
def get_urls(self):
urls = super(SortableAdmin, self).get_urls()
# this ajax view changes the order
admin_do_sorting_url = url(r'^sorting/do-sorting/(?P<model_type_id>\d+)/$',
self.admin_site.admin_view(self.do_sorting_view),
name='admin_do_sorting')
# this view displays the sortable objects
admin_sort_url = url(r'^sort/$',
self.admin_site.admin_view(self.sort_view),
name='admin_sort')
urls = [
admin_do_sorting_url,
admin_sort_url
] + urls
return urls
def sort_view(self, request):
"""
Custom admin view that displays the objects as a list whose sort
order can be changed via drag-and-drop.
"""
opts = self.model._meta
if VERSION >= (1, 8):
codename = get_permission_codename('change', opts)
has_perm = request.user.has_perm('{0}.{1}'.format(opts.app_label,
codename))
else:
has_perm = request.user.has_perm('{0}.{1}'.format(opts.app_label,
opts.get_change_permission()))
jquery_lib_path = 'admin/js/jquery.js' if VERSION < (1, 9) \
else 'admin/js/vendor/jquery/jquery.js'
# get sort group index from querystring if present
sort_filter_index = request.GET.get('sort_filter')
filters = {}
if sort_filter_index:
try:
filters = self.model.sorting_filters[int(sort_filter_index)][1]
except (IndexError, ValueError):
pass
# Apply any sort filters to create a subset of sortable objects
try:
qs_method = getattr(self, 'get_queryset', self.queryset)
except AttributeError:
qs_method = self.get_queryset
objects = qs_method(request).filter(**filters)
# Determine if we need to regroup objects relative to a
# foreign key specified on the model class that is extending Sortable.
# Legacy support for 'sortable_by' defined as a model property
sortable_by_property = getattr(self.model, 'sortable_by', None)
# see if our model is sortable by a SortableForeignKey field
# and that the number of objects available is >= 2
sortable_by_fk = None
sortable_by_field_name = None
sortable_by_class_is_sortable = False
for field in self.model._meta.fields:
if isinstance(field, SortableForeignKey):
sortable_by_fk = field.rel.to
sortable_by_field_name = field.name.lower()
sortable_by_class_is_sortable = sortable_by_fk.objects.count() >= 2
if sortable_by_property:
# backwards compatibility for < 1.1.1, where sortable_by was a
# classmethod instead of a property
try:
sortable_by_class, sortable_by_expression = \
sortable_by_property()
except (TypeError, ValueError):
sortable_by_class = self.model.sortable_by
sortable_by_expression = sortable_by_class.__name__.lower()
sortable_by_class_display_name = sortable_by_class._meta \
.verbose_name_plural
elif sortable_by_fk:
# get sortable by properties from the SortableForeignKey
# field - supported in 1.3+
sortable_by_class_display_name = sortable_by_fk._meta.verbose_name_plural
sortable_by_class = sortable_by_fk
sortable_by_expression = sortable_by_field_name
else:
# model is not sortable by another model
sortable_by_class = sortable_by_expression = \
sortable_by_class_display_name = \
sortable_by_class_is_sortable = None
if sortable_by_property or sortable_by_fk:
# Order the objects by the property they are sortable by,
# then by the order, otherwise the regroup
# template tag will not show the objects correctly
try:
order_field_name = opts.model._meta.ordering[0]
except (AttributeError, IndexError):
# for Django 1.5.x
order_field_name = opts.ordering[0]
except (AttributeError, IndexError):
order_field_name = 'order'
objects = objects.order_by(sortable_by_expression, order_field_name)
try:
verbose_name_plural = opts.verbose_name_plural.__unicode__()
except AttributeError:
verbose_name_plural = opts.verbose_name_plural
context = {
'title': u'Drag and drop {0} to change display order'.format(
capfirst(verbose_name_plural)),
'opts': opts,
'app_label': opts.app_label,
'has_perm': has_perm,
'objects': objects,
'group_expression': sortable_by_expression,
'sortable_by_class': sortable_by_class,
'sortable_by_class_is_sortable': sortable_by_class_is_sortable,
'sortable_by_class_display_name': sortable_by_class_display_name,
'jquery_lib_path': jquery_lib_path,
'csrf_cookie_name': getattr(settings, 'CSRF_COOKIE_NAME', 'csrftoken')
}
return render(request, self.sortable_change_list_template, context)
def add_view(self, request, form_url='', extra_context=None):
if extra_context is None:
extra_context = {}
extra_context.update({
'change_form_template_extends': self.change_form_template_extends
})
return super(SortableAdmin, self).add_view(request, form_url,
extra_context=extra_context)
def change_view(self, request, object_id, form_url='', extra_context=None):
self.has_sortable_tabular_inlines = False
self.has_sortable_stacked_inlines = False
if extra_context is None:
extra_context = {}
extra_context.update({
'change_form_template_extends': self.change_form_template_extends,
'csrf_cookie_name': getattr(settings, 'CSRF_COOKIE_NAME', 'csrftoken')
})
for klass in self.inlines:
if issubclass(klass, SortableTabularInline) or issubclass(klass,
SortableGenericTabularInline):
self.has_sortable_tabular_inlines = True
if issubclass(klass, SortableStackedInline) or issubclass(klass,
SortableGenericStackedInline):
self.has_sortable_stacked_inlines = True
if self.has_sortable_tabular_inlines or \
self.has_sortable_stacked_inlines:
self.change_form_template = self.sortable_change_form_template
extra_context.update({
'has_sortable_tabular_inlines':
self.has_sortable_tabular_inlines,
'has_sortable_stacked_inlines':
self.has_sortable_stacked_inlines
})
return super(SortableAdmin, self).change_view(request, object_id,
form_url='', extra_context=extra_context)
def do_sorting_view(self, request, model_type_id=None):
"""
This view sets the ordering of the objects for the model type
and primary keys passed in. It must be an Ajax POST.
"""
response = {'objects_sorted': False}
if request.is_ajax() and request.method == 'POST':
try:
indexes = list(map(str,
request.POST.get('indexes', []).split(',')))
klass = ContentType.objects.get(
id=model_type_id).model_class()
objects_dict = dict([(str(obj.pk), obj) for obj in
klass.objects.filter(pk__in=indexes)])
order_field_name = klass._meta.ordering[0]
if order_field_name.startswith('-'):
order_field_name = order_field_name[1:]
step = -1
start_object = max(objects_dict.values(),
key=lambda x: getattr(x, order_field_name))
else:
step = 1
start_object = min(objects_dict.values(),
key=lambda x: getattr(x, order_field_name))
start_index = getattr(start_object, order_field_name,
len(indexes))
for index in indexes:
obj = objects_dict.get(index)
setattr(obj, order_field_name, start_index)
obj.save()
start_index += step
response = {'objects_sorted': True}
except (KeyError, IndexError, klass.DoesNotExist,
AttributeError, ValueError):
pass
return HttpResponse(json.dumps(response, ensure_ascii=False),
content_type='application/json')
class NonSortableParentAdmin(SortableAdmin):
def changelist_view(self, request, extra_context=None):
return super(SortableAdminBase, self).changelist_view(request,
extra_context=extra_context)
class SortableInlineBase(SortableAdminBase, InlineModelAdmin):
def __init__(self, *args, **kwargs):
super(SortableInlineBase, self).__init__(*args, **kwargs)
if not issubclass(self.model, SortableMixin):
raise Warning(u'Models that are specified in SortableTabularInline'
' and SortableStackedInline must inherit from SortableMixin'
' (or Sortable for legacy implementations)')
def get_queryset(self, request):
if VERSION < (1, 6):
qs = super(SortableInlineBase, self).queryset(request)
else:
qs = super(SortableInlineBase, self).get_queryset(request)
if get_is_sortable(qs):
self.model.is_sortable = True
else:
self.model.is_sortable = False
return qs
if VERSION < (1, 6):
queryset = get_queryset
class SortableTabularInline(TabularInline, SortableInlineBase):
"""Custom template that enables sorting for tabular inlines"""
if VERSION < (1, 6):
template = 'adminsortable/edit_inline/tabular-1.5.x.html'
else:
template = 'adminsortable/edit_inline/tabular.html'
class SortableStackedInline(StackedInline, SortableInlineBase):
"""Custom template that enables sorting for stacked inlines"""
if VERSION < (1, 6):
template = 'adminsortable/edit_inline/stacked-1.5.x.html'
else:
template = 'adminsortable/edit_inline/stacked.html'
class SortableGenericTabularInline(GenericTabularInline, SortableInlineBase):
"""Custom template that enables sorting for tabular inlines"""
if VERSION < (1, 6):
template = 'adminsortable/edit_inline/tabular-1.5.x.html'
else:
template = 'adminsortable/edit_inline/tabular.html'
class SortableGenericStackedInline(GenericStackedInline, SortableInlineBase):
"""Custom template that enables sorting for stacked inlines"""
if VERSION < (1, 6):
template = 'adminsortable/edit_inline/stacked-1.5.x.html'
else:
template = 'adminsortable/edit_inline/stacked.html'
|
'use strict';
var tape = require('../lib/thaliTape');
var testUtils = require('../lib/testUtils.js');
var extend = require('js-extend').extend;
var crypto = require('crypto');
var Promise = require('bluebird');
var PouchDB = require('pouchdb');
var express = require('express');
var expressPouchDB = require('express-pouchdb');
var proxyquire = require('proxyquire').noCallThru();
var Salti = require('salti');
var thaliConfig = require('thali/NextGeneration/thaliConfig');
var ThaliPeerPoolDefault =
require('thali/NextGeneration/thaliPeerPool/thaliPeerPoolDefault');
var ThaliMobile = require('thali/NextGeneration/thaliMobile');
var ThaliSendNotificationBasedOnReplication =
require('thali/NextGeneration/replication/thaliSendNotificationBasedOnReplication');
var ThaliPullReplicationFromNotification =
require('thali/NextGeneration/replication/thaliPullReplicationFromNotification');
var ThaliNotificationServer =
require('thali/NextGeneration/notification/thaliNotificationServer');
// Public key for local device should be passed
// to the tape 'setup' as 'tape.data'.
var ecdhForLocalDevice = crypto.createECDH(thaliConfig.BEACON_CURVE);
var publicKeyForLocalDevice = ecdhForLocalDevice.generateKeys();
var test = tape({
setup: function (t) {
t.data = publicKeyForLocalDevice.toJSON();
t.end();
},
teardown: function (t) {
t.end();
}
});
function Mocks(t, sandbox) {
// All objects should be cloned in order to prevent
// 'already wrapped' error by 'sinon.spy'.
this.t = t;
this.express = sandbox.spy(express);
this.expressPouchDB = sandbox.spy(expressPouchDB);
this.LevelDownPouchDB = sandbox.spy(testUtils.getLevelDownPouchDb());
this.ThaliMobile = extend({}, ThaliMobile);
this.MobileStart = sandbox.spy(this.ThaliMobile, 'start');
this.MobileStop = sandbox.spy(this.ThaliMobile, 'stop');
this.MobileStartLA = sandbox.spy(
this.ThaliMobile, 'startListeningForAdvertisements'
);
this.MobileStartUAA = sandbox.spy(
this.ThaliMobile, 'startUpdateAdvertisingAndListening'
);
this.Notification = sandbox.spy(
ThaliSendNotificationBasedOnReplication
);
this.Notification.prototype = extend(
{},
ThaliSendNotificationBasedOnReplication.prototype
);
this.NotificationStart = sandbox.spy(
this.Notification.prototype, 'start'
);
this.NotificationStop = sandbox.spy(
this.Notification.prototype, 'stop'
);
this.Replication = sandbox.spy(
ThaliPullReplicationFromNotification
);
this.Replication.prototype = extend(
{},
ThaliPullReplicationFromNotification.prototype
);
this.ReplicationStart = sandbox.spy(
this.Replication.prototype, 'start'
);
this.ReplicationStop = sandbox.spy(
this.Replication.prototype, 'stop'
);
this.Salti = sandbox.spy(Salti);
this.ThaliManager =
proxyquire('thali/NextGeneration/thaliManager', {
'./replication/thaliSendNotificationBasedOnReplication':
this.Notification,
'./replication/thaliPullReplicationFromNotification':
this.Replication,
'./thaliMobile': this.ThaliMobile,
'express': this.express,
'salti': this.Salti
});
}
Mocks.prototype.resetStartStop = function() {
this.MobileStart.reset();
this.MobileStop.reset();
this.MobileStartLA.reset();
this.MobileStartUAA.reset();
this.NotificationStart.reset();
this.NotificationStop.reset();
this.ReplicationStart.reset();
this.ReplicationStop.reset();
};
Mocks.prototype.checkInit = function(dbName, ecdh, peerPool) {
this.checkExpressPouchDB();
this.checkPouchDB(dbName);
this.checkNotification(ecdh);
this.checkReplication(dbName, peerPool, ecdh);
this.checkSalti(dbName);
};
Mocks.prototype.checkStart = function(partnerKeys, networkType) {
this.checkMobileStart(networkType);
this.checkMobileStartLA();
this.checkMobileStartUAA();
this.checkNotificationStart(partnerKeys);
this.checkReplicationStart(partnerKeys);
};
Mocks.prototype.checkStop = function() {
this.checkMobileStop();
this.checkNotificationStop();
this.checkReplicationStop();
};
Mocks.prototype.checkExpressPouchDB = function() {
var self = this;
testUtils.checkArgs(
this.t, this.expressPouchDB, 'expressPouchDB',
[
{
description: 'PouchDB',
compare: function (arg) {
return typeof arg === 'function' &&
arg === self.LevelDownPouchDB;
}
},
{
description: 'expressPouchDB options',
compare: function (arg) {
return typeof arg === 'object' &&
arg.mode === 'minimumForPouchDB';
}
}
]
);
};
Mocks.prototype.checkPouchDB = function(dbName) {
testUtils.checkArgs(
this.t, this.LevelDownPouchDB, 'PouchDB',
[{
description: 'dbName',
compare: function (arg) {
return typeof arg === 'string' &&
arg === dbName;
}
}]
);
};
Mocks.prototype.checkReplication = function(dbName, peerPool, ecdh) {
var self = this;
testUtils.checkArgs(
this.t, this.Replication, 'ThaliPullReplicationFromNotification',
[
{
description: 'PouchDB',
compare: function (arg) {
return typeof arg === 'function' &&
arg === self.LevelDownPouchDB;
}
},
{
description: 'dbName',
compare: function (arg) {
return typeof arg === 'string' &&
arg === dbName;
}
},
{
description: 'ThaliPeerPoolInterface instance',
compare: function (arg) {
return typeof arg === 'object' &&
arg instanceof ThaliPeerPoolDefault &&
arg === peerPool;
}
},
{
description: 'ecdhForLocalDevice',
compare: function (arg) {
return typeof arg === 'object' &&
arg === ecdh;
}
}
]
);
};
Mocks.prototype.checkReplicationStart = function(remoteKeys) {
testUtils.checkArgs(
this.t, this.ReplicationStart,
'ThaliPullReplicationFromNotification.prototype.start',
[{
description: 'remoteKeys',
compare: function (arg) {
return Array.isArray(arg) &&
arg === remoteKeys;
}
}]
);
};
Mocks.prototype.checkReplicationStop = function() {
testUtils.checkArgs(
this.t, this.ReplicationStop,
'ThaliPullReplicationFromNotification.prototype.stop',
[]
);
};
Mocks.prototype.checkNotification = function(ecdh) {
var self = this;
testUtils.checkArgs(
this.t, this.Notification, 'ThaliSendNotificationBasedOnReplication',
[
{
description: 'express.Router instance',
compare: function (arg) {
return typeof arg === 'function' &&
// This is not possible to check instanceof express.Router.
typeof arg.__proto__ === 'function' &&
arg.__proto__ === self.express.Router;
}
},
{
description: 'ecdhForLocalDevice',
compare: function (arg) {
return typeof arg === 'object' &&
arg === ecdh;
}
},
{
description: 'thaliConfig.BEACON_MILLISECONDS_TO_EXPIRE',
compare: function (arg) {
return typeof arg === 'number' &&
arg === thaliConfig.BEACON_MILLISECONDS_TO_EXPIRE;
}
},
{
description: 'PouchDB instance',
compare: function (arg) {
return typeof arg === 'object' &&
arg instanceof PouchDB;
}
}
]
);
};
Mocks.prototype.checkNotificationStart = function(remoteKeys) {
testUtils.checkArgs(
this.t, this.NotificationStart,
'ThaliSendNotificationBasedOnReplication.prototype.start',
[{
description: 'remoteKeys',
compare: function (arg) {
return Array.isArray(arg) &&
arg === remoteKeys;
}
}]
);
};
Mocks.prototype.checkNotificationStop = function() {
testUtils.checkArgs(
this.t, this.NotificationStop,
'ThaliSendNotificationBasedOnReplication.prototype.stop',
[]
);
};
Mocks.prototype.checkMobileStart = function(networkType) {
var self = this;
testUtils.checkArgs(
this.t, this.MobileStart, 'ThaliMobile.start',
[
{
description: 'express.Router instance',
compare: function (arg) {
return typeof arg === 'function' &&
// This is not possible to check instanceof express.Router.
typeof arg.__proto__ === 'function' &&
arg.__proto__ === self.express.Router;
}
},
{
description: 'getPskIdToSecret',
compare: function (arg) {
return typeof arg === 'function' &&
arg.toString() ===
ThaliNotificationServer.prototype.getPskIdToSecret().toString();
}
},
{
description: 'networkType',
compare: function (arg) {
return arg === networkType;
}
}
]
);
};
Mocks.prototype.checkMobileStartLA = function() {
testUtils.checkArgs(
this.t, this.MobileStartLA,
'ThaliMobile.startListeningForAdvertisements',
[]
);
};
Mocks.prototype.checkMobileStartUAA = function() {
testUtils.checkArgs(
this.t, this.MobileStartUAA,
'ThaliMobile.startUpdateAdvertisingAndListening',
[]
);
};
Mocks.prototype.checkMobileStop = function() {
testUtils.checkArgs(
this.t, this.MobileStop, 'ThaliMobile.stop', []
);
};
Mocks.prototype.checkSalti = function(dbName) {
var self = this;
testUtils.checkArgs(
this.t, this.Salti, 'Salti',
[
{
description: 'dbName',
compare: function (arg) {
return typeof arg === 'string' &&
arg === dbName;
}
},
{
description: 'acl',
compare: function (arg) {
return typeof arg === 'object' &&
arg === self.ThaliManager._acl;
}
},
{
description: 'thaliIdCallback',
compare: function (arg) {
return typeof arg === 'function';
}
},
{
description: 'options',
compare: function (arg) {
return typeof arg === 'object' &&
arg.dbPrefix === thaliConfig.BASE_DB_PATH;
}
}
]
);
};
test('test thali manager spies', tape.sinonTest(function (t) {
// This function will return all participant's public keys
// except local 'publicKeyForLocalDevice' one.
var partnerKeys;
if (t.coordinated) {
partnerKeys = testUtils.turnParticipantsIntoBufferArray(
t, publicKeyForLocalDevice
);
} else {
partnerKeys = [];
}
var mocks = new Mocks(t, this);
// Creating thali manager with mocks.
var dbName = testUtils.getRandomPouchDBName();
var peerPool = new ThaliPeerPoolDefault();
var thaliManager = new mocks.ThaliManager(
mocks.expressPouchDB,
mocks.LevelDownPouchDB,
dbName,
ecdhForLocalDevice,
peerPool,
global.NETWORK_TYPE
);
mocks.checkInit(dbName, ecdhForLocalDevice, peerPool);
thaliManager.start(partnerKeys)
.then(function () {
mocks.checkStart(partnerKeys, global.NETWORK_TYPE);
})
.then(function () {
return thaliManager.stop();
})
.then(function () {
mocks.checkStop();
t.end();
});
}));
test('test thali manager multiple starts and stops', tape.sinonTest(function (t) {
// This function will return all participant's public keys
// except local 'publicKeyForLocalDevice' one.
var partnerKeys;
if (t.coordinated) {
partnerKeys = testUtils.turnParticipantsIntoBufferArray(
t, publicKeyForLocalDevice
);
} else {
partnerKeys = [];
}
var mocks = new Mocks(t, this);
// Creating thali manager with mocks.
var dbName = testUtils.getRandomPouchDBName();
var peerPool = new ThaliPeerPoolDefault();
var thaliManager = new mocks.ThaliManager(
mocks.expressPouchDB,
mocks.LevelDownPouchDB,
dbName,
ecdhForLocalDevice,
peerPool,
global.NETWORK_TYPE
);
mocks.checkInit(dbName, ecdhForLocalDevice, peerPool);
// Multiple parallel starts.
Promise.all([
thaliManager.start(partnerKeys),
thaliManager.start(partnerKeys),
thaliManager.start(partnerKeys)
])
// Multiple serial starts.
.then(function () {
return thaliManager.start(partnerKeys);
})
.then(function () {
return thaliManager.start(partnerKeys);
})
.then(function () {
mocks.checkStart(partnerKeys, global.NETWORK_TYPE);
})
// Multiple parallel stops.
.then(function () {
return Promise.all([
thaliManager.stop(),
thaliManager.stop(),
thaliManager.stop()
]);
})
// Multiple serial stops.
.then(function () {
return thaliManager.stop();
})
.then(function () {
return thaliManager.stop();
})
.then(function () {
mocks.checkStop();
})
// Multiple parallel starts and stops.
.then(function () {
return Promise.all([
thaliManager.start(partnerKeys),
thaliManager.stop(),
thaliManager.start(partnerKeys),
thaliManager.stop(),
thaliManager.start(partnerKeys),
thaliManager.stop()
]);
})
.then(function () {
return Promise.all([
thaliManager.start(partnerKeys),
thaliManager.start(partnerKeys),
thaliManager.start(partnerKeys),
thaliManager.stop(),
thaliManager.stop(),
thaliManager.stop()
]);
})
.then(function () {
mocks.resetStartStop();
return thaliManager.start(partnerKeys);
})
.then(function () {
mocks.checkStart(partnerKeys, global.NETWORK_TYPE);
})
.then(function () {
return thaliManager.stop();
})
.then(function () {
t.end();
});
}));
|
import Router from 'express';
const router = Router();
import UserController from "../controllers/UserController.js";
//Login
router.get('/login', UserController.showLoginForm);
router.post('/login', UserController.login);
//Register
router.get('/register', UserController.registerationForm);
router.post('/register', UserController.register);
router.get('/logout', UserController.logout);
export default router;
|
import PaymentMethod from './PaymentMethod';
export { default as PaymentMethodFormContext } from './context/PaymentMethodFormContext';
export default PaymentMethod;
|
//
// RMMapTiledLayerView.h
// MapView
//
// Copyright (c) 2008-2013, Route-Me Contributors
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#import "RMTileSource.h"
@class RMMapView;
@interface RMMapTiledLayerView : UIView
@property (nonatomic, assign) BOOL useSnapshotRenderer;
@property (nonatomic, readonly) id <RMTileSource> tileSource;
- (id)initWithFrame:(CGRect)frame mapView:(RMMapView *)aMapView forTileSource:(id <RMTileSource>)aTileSource;
@end
|
import os
from options.test_options import TestOptions
from data import CreateDataLoader
from models import create_model
from util.visualizer import save_images
from util import html
if __name__ == '__main__':
opt = TestOptions().parse()
opt.nThreads = 1 # test code only supports nThreads = 1
opt.batchSize = 1 # test code only supports batchSize = 1
opt.serial_batches = True # no shuffle
opt.no_flip = True # no flip
opt.display_id = -1 # no visdom display
data_loader = CreateDataLoader(opt)
dataset = data_loader.load_data()
model = create_model(opt)
model.setup(opt)
# create website
web_dir = os.path.join(opt.results_dir, opt.name, '%s_%s' % (opt.phase, opt.which_epoch))
webpage = html.HTML(web_dir, 'Experiment = %s, Phase = %s, Epoch = %s' % (opt.name, opt.phase, opt.which_epoch))
# test
for i, data in enumerate(dataset):
if i >= opt.how_many:
break
print(data['A'].size())
model.set_input(data)
model.test()
visuals = model.get_current_visuals()
img_path = model.get_image_paths()
if i % 5 == 0:
print('processing (%04d)-th image... %s' % (i, img_path))
save_images(webpage, visuals, img_path, aspect_ratio=opt.aspect_ratio, width=opt.display_winsize)
webpage.save()
|
from setuptools import setup
setup(
name='hatena_blog',
version='0.0.1',
description='Hatena Blog Atom API Wrapper',
author='Tatsuya Matoba',
author_email='tatsuya.matoa.wk.jp@gmail.com',
packages = ['hatena_blog'],
include_package_data=True,
install_requires=[
'requests',
'bs4',
'dateutils',
],
)
|
from rest_framework import serializers
from .models import Drug, Interaction
class DrugSearchSerializer(serializers.Serializer):
name = serializers.CharField()
class DrugSerializer(serializers.ModelSerializer):
class Meta:
model = Drug
fields = (
'id',
'rxcui',
'name',
'synonym',
'language',
'suppress',
'umlscui',
)
class InteractionSerializer(serializers.ModelSerializer):
class Meta:
model = Interaction
fields = (
'source',
'severity',
'description',
)
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionPrint = (props) => (
<SvgIcon {...props}>
<path d="M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"/>
</SvgIcon>
);
ActionPrint = pure(ActionPrint);
ActionPrint.displayName = 'ActionPrint';
export default ActionPrint;
|
"""init
Revision ID: 49e0df2ddbd6
Revises:
Create Date: 2022-03-14 17:47:20.964917
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '49e0df2ddbd6'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('entity_types',
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
sa.Column('details', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('name', sa.String(length=64), nullable=False),
sa.Column('parent_id', postgresql.UUID(as_uuid=True), nullable=True),
sa.ForeignKeyConstraint(['parent_id'], ['entity_types.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_entity_types_name'), 'entity_types', ['name'], unique=False)
op.create_table('organizations',
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
sa.Column('details', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('name', sa.String(length=64), nullable=False),
sa.Column('is_active', sa.Boolean(), nullable=True),
sa.Column('owner_id', postgresql.UUID(as_uuid=True), nullable=True),
sa.Column('website', sa.String(length=256), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('relation_types',
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
sa.Column('name', sa.String(), nullable=False),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_relation_types_name'), 'relation_types', ['name'], unique=False)
op.create_table('entities',
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
sa.Column('name', sa.String(), nullable=False),
sa.Column('type_id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('website', sa.String(), nullable=True),
sa.Column('thumbnail', sa.String(), nullable=True),
sa.ForeignKeyConstraint(['type_id'], ['entity_types.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_entities_name'), 'entities', ['name'], unique=False)
op.create_table('relations',
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
sa.Column('details', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('type_id', postgresql.UUID(as_uuid=True), nullable=False),
sa.ForeignKeyConstraint(['type_id'], ['relation_types.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id')
)
op.create_table('users',
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
sa.Column('details', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('username', sa.String(length=64), nullable=False),
sa.Column('hashed_password', sa.String(length=256), nullable=False),
sa.Column('is_active', sa.Boolean(), nullable=True),
sa.Column('first_name', sa.String(length=64), nullable=False),
sa.Column('last_name', sa.String(length=64), nullable=False),
sa.Column('email', sa.String(), nullable=False),
sa.Column('organization_id', postgresql.UUID(as_uuid=True), nullable=True),
sa.ForeignKeyConstraint(['organization_id'], ['organizations.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
op.create_table('entity_contents',
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
sa.Column('details', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('entity_id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('content_type', sa.String(), nullable=True),
sa.ForeignKeyConstraint(['entity_id'], ['entities.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id')
)
op.create_table('entity_entity',
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True),
sa.Column('from_id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('to_id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('relation_id', postgresql.UUID(as_uuid=True), nullable=False),
sa.ForeignKeyConstraint(['from_id'], ['entities.id'], ondelete='CASCADE'),
sa.ForeignKeyConstraint(['relation_id'], ['relations.id'], ondelete='CASCADE'),
sa.ForeignKeyConstraint(['to_id'], ['entities.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('entity_entity')
op.drop_table('entity_contents')
op.drop_index(op.f('ix_users_email'), table_name='users')
op.drop_table('users')
op.drop_table('relations')
op.drop_index(op.f('ix_entities_name'), table_name='entities')
op.drop_table('entities')
op.drop_index(op.f('ix_relation_types_name'), table_name='relation_types')
op.drop_table('relation_types')
op.drop_table('organizations')
op.drop_index(op.f('ix_entity_types_name'), table_name='entity_types')
op.drop_table('entity_types')
# ### end Alembic commands ###
|
// THIS FILE IS AUTO GENERATED
import { GenIcon } from '../lib';
export function AiOutlineFunction (props) {
return GenIcon({"tag":"svg","attr":{"t":"1569683610100","viewBox":"0 0 1024 1024","version":"1.1"},"child":[{"tag":"defs","attr":{},"child":[]},{"tag":"path","attr":{"d":"M841 370c3-3.3 2.7-8.3-0.6-11.3-1.5-1.3-3.4-2.1-5.3-2.1h-72.6c-2.4 0-4.6 1-6.1 2.8L633.5 504.6c-2.9 3.4-7.9 3.8-11.3 0.9-0.9-0.8-1.6-1.7-2.1-2.8l-63.5-141.3c-1.3-2.9-4.1-4.7-7.3-4.7H380.7l0.9-4.7 8-42.3c10.5-55.4 38-81.4 85.8-81.4 18.6 0 35.5 1.7 48.8 4.7l14.1-66.8c-22.6-4.7-35.2-6.1-54.9-6.1-103.3 0-156.4 44.3-175.9 147.3l-9.4 49.4h-97.6c-3.8 0-7.1 2.7-7.8 6.4L181.9 415c-0.9 4.3 1.9 8.6 6.2 9.5 0.5 0.1 1.1 0.2 1.6 0.2H284l-89 429.9c-0.9 4.3 1.9 8.6 6.2 9.5 0.5 0.1 1.1 0.2 1.6 0.2H269c3.8 0 7.1-2.7 7.8-6.4l89.7-433.1h135.8l68.2 139.1c1.4 2.9 1 6.4-1.2 8.8l-180.6 203c-2.9 3.3-2.6 8.4 0.7 11.3 1.5 1.3 3.4 2 5.3 2h72.7c2.4 0 4.6-1 6.1-2.8l123.7-146.7c2.8-3.4 7.9-3.8 11.3-1 0.9 0.8 1.6 1.7 2.1 2.8L676.4 784c1.3 2.8 4.1 4.7 7.3 4.7h64.6c4.4 0 8-3.6 8-8 0-1.2-0.3-2.4-0.8-3.5l-95.2-198.9c-1.4-2.9-0.9-6.4 1.3-8.8L841 370z"}}]})(props);
};
|
import math
import torch
from torch import nn
import torch.nn.functional as F
from utils import set_init
class DiscreteNet(nn.Module):
def __init__(self, s_dim, a_dim):
super(DiscreteNet, self).__init__()
self.s_dim = s_dim
self.a_dim = a_dim
self.pi1 = nn.Linear(s_dim, 128)
self.pi2 = nn.Linear(128, a_dim)
self.v1 = nn.Linear(s_dim, 128)
self.v2 = nn.Linear(128, 1)
set_init([self.pi1, self.pi2, self.v1, self.v2])
self.distribution = torch.distributions.Categorical
def forward(self, x):
pi1 = torch.tanh(self.pi1(x))
logits = self.pi2(pi1)
v1 = torch.tanh(self.v1(x))
values = self.v2(v1)
return logits, values
def choose_action(self, s):
self.eval()
logits, _ = self.forward(s)
prob = F.softmax(logits, dim=1).data
m = self.distribution(prob)
return m.sample().numpy()[0]
def loss_func(self, s, a, v_t):
self.train()
logits, values = self.forward(s)
td = v_t - values
c_loss = td.pow(2)
probs = F.softmax(logits, dim=1)
m = self.distribution(probs)
exp_v = m.log_prob(a) * td.detach().squeeze()
a_loss = -exp_v
total_loss = (c_loss + a_loss).mean()
return total_loss
class DiscreteCNN(nn.Module):
def __init__(self, s_dim, a_dim):
super(DiscreteCNN, self).__init__()
self.s_dim = s_dim
self.a_dim = a_dim
self.conv1 = nn.Conv2d(1, 32, 5, 2)
self.conv2 = nn.Conv2d(32, 16, 5, 2)
self.conv2_drop = nn.Dropout2d()
self.fc1 = nn.Linear(1728, 50)
self.fc2 = nn.Linear(50, a_dim)
self.v1 = nn.Linear(1728, 128)
self.v2 = nn.Linear(128, 1)
set_init([self.conv1, self.conv2, self.fc1, self.fc2, self.v1, self.v2])
self.distribution = torch.distributions.Categorical
def forward(self, x):
x = F.relu(F.max_pool2d(self.conv1(x), 2))
x = F.relu(F.max_pool2d(self.conv2_drop(self.conv2(x)), 2))
x = x.view(-1, 1728)
fc1 = F.relu(self.fc1(x))
logits = self.fc2(fc1)
v1 = torch.tanh(self.v1(x))
values = self.v2(v1)
return logits, values
def choose_action(self, s):
self.eval()
logits, _ = self.forward(s)
prob = F.softmax(logits, dim=1).data
m = self.distribution(prob)
return m.sample().numpy()[0]
def loss_func(self, s, a, v_t):
self.train()
logits, values = self.forward(s)
td = v_t - values
c_loss = td.pow(2)
probs = F.softmax(logits, dim=1)
m = self.distribution(probs)
exp_v = m.log_prob(a) * td.detach().squeeze()
a_loss = -exp_v
total_loss = (c_loss + a_loss).mean()
return total_loss
class ContinuousNet(nn.Module):
def __init__(self, s_dim, a_dim):
super(ContinuousNet, self).__init__()
self.s_dim = s_dim
self.a_dim = a_dim
self.a1 = nn.Linear(s_dim, 200)
self.mu = nn.Linear(200, a_dim)
self.sigma = nn.Linear(200, a_dim)
self.c1 = nn.Linear(s_dim, 100)
self.v = nn.Linear(100, 1)
set_init([self.a1, self.mu, self.sigma, self.c1, self.v])
self.distribution = torch.distributions.Normal
def forward(self, x):
a1 = F.relu6(self.a1(x))
mu = 2 * torch.tanh(self.mu(a1))
sigma = F.softplus(self.sigma(a1)) + 0.001 # avoid 0
c1 = F.relu6(self.c1(x))
values = self.v(c1)
return mu, sigma, values
def choose_action(self, s):
self.training = False
mu, sigma, _ = self.forward(s)
m = self.distribution(mu.view(-1, ).data, sigma.view(-1, ).data)
return m.sample().numpy()
def loss_func(self, s, a, v_t):
self.train()
mu, sigma, values = self.forward(s)
td = v_t - values
c_loss = td.pow(2)
m = self.distribution(mu, sigma)
log_prob = m.log_prob(a)
entropy = 0.5 + 0.5 * math.log(2 * math.pi) + torch.log(m.scale) # exploration
exp_v = log_prob * td.detach() + 0.005 * entropy
a_loss = -exp_v
total_loss = (a_loss + c_loss).mean()
return total_loss
|
import datetime
from mongoengine import Document, EmbeddedDocument, StringField, IntField
from mongoengine import EmbeddedDocumentField, DateTimeField, ListField
from django.conf import settings
from crits.core.crits_mongoengine import CritsBaseAttributes, CritsDocumentFormatter
from crits.campaigns.migrate import migrate_campaign
class EmbeddedTTP(EmbeddedDocument, CritsDocumentFormatter):
"""
Embedded TTP object
"""
analyst = StringField(required=True)
ttp = StringField(required=True)
date = DateTimeField(default=datetime.datetime.now)
class Campaign(CritsBaseAttributes, Document):
"""
Campaign Class.
"""
meta = {
"collection": settings.COL_CAMPAIGNS,
"crits_type": 'Campaign',
"latest_schema_version": 2,
"schema_doc": {
'schema_version': 'Version of the Campaign schema doc',
'active': 'Enabled in the UI (on/off)',
'description': 'Description of Campaign',
'aliases': 'List [] of aliases this Campaign goes by',
'domain_count': 'Domains tagged with Campaign. Added by MapReduce',
'email_count': 'Emails tagged with Campaign. Added by MapReduce',
'event_count': 'Events tagged with Campaign. Added by MapReduce',
'indicator_count': ('Indicators tagged with Campaign. Added by '
'MapReduce'),
'ip_count': 'IPs tagged with Campaign. Added by MapReduce',
'name': 'Name this Campaign goes by',
'pcap_count': 'PCAPs tagged with Campaign. Added by MapReduce',
'sample_count': 'Samples tagged with Campaign. Added by MapReduce',
'ttps': 'List [] of TTPs this Campaign is associated with',
},
"jtable_opts": {
'details_url': 'crits.campaigns.views.campaign_details',
'details_url_key': 'name',
'default_sort': "name ASC",
'searchurl': 'crits.campaigns.views.campaigns_listing',
'fields': [ "name", "aliases", "indicator_count",
"email_count", "domain_count",
"sample_count", "event_count",
"ip_count", "pcap_count", "modified",
"id", "status"],
'jtopts_fields': [ "details", "name", "aliases",
"status", "indicator_count",
"email_count", "domain_count",
"sample_count", "event_count",
"ip_count", "pcap_count",
"modified", "favorite", "id"],
'hidden_fields': [],
'linked_fields': [],
'details_link': 'details',
'no_sort': ['details']
}
}
active = StringField(default="on")
aliases = ListField(StringField(), default=[])
description = StringField()
domain_count = IntField(default=0)
email_count = IntField(default=0)
event_count = IntField(default=0)
indicator_count = IntField(default=0)
ip_count = IntField(default=0)
name = StringField(default=0)
pcap_count = IntField(default=0)
sample_count = IntField(default=0)
ttps = ListField(EmbeddedDocumentField(EmbeddedTTP), default=[])
def migrate(self):
"""
Migrate the Campaign to the latest schema version.
"""
migrate_campaign(self)
def activate(self):
"""
Set the Campaign as active.
"""
self.active = "on"
def deactivate(self):
"""
Set the Campaign as inactive.
"""
self.active = "off"
def edit_description(self, description):
"""
Set the Campaign description.
:param description: The campaign description.
:type description: str
"""
self.description = description
def edit_name(self, name):
"""
Change the Campaign name.
:param name: The new campaign name.
:type name: str
"""
self.name = name
def add_alias(self, alias):
"""
Add a Campaign alias.
:param alias: The campaign alias(es)
:type alias: string or list of strings.
"""
if isinstance(alias, basestring):
alias = [alias]
for a in alias:
if a not in self.aliases and isinstance(a, basestring):
self.aliases.append(a)
def remove_alias(self, alias):
"""
Remove a Campaign alias.
:param alias: The alias to remove.
:type alias: str
"""
self.aliases.remove(alias)
def set_aliases(self, aliases):
"""
Set the Campaign aliases to a specified list.
:param aliases: The alias to set.
:type alias: list
"""
if isinstance(aliases, list):
self.aliases = aliases
def get_aliases(self):
"""
Get the list of Campaign aliases.
:returns: list of aliases.
"""
return [alias for alias in self._data['aliases']]
def add_ttp(self, ttp_item):
"""
Add a TTP to this Campaign.
:param ttp_item: The TTP to add.
:type ttp_item: EmbeddedTTP
"""
if isinstance(ttp_item, EmbeddedTTP):
found = False
for ttp in self.ttps:
if ttp.ttp == ttp_item.ttp:
found = True
if not found:
self.ttps.append(ttp_item)
def edit_ttp(self, old_ttp=None, new_ttp=None):
"""
Edit an existing TTP for this Campaign.
:param old_ttp: The old TTP value.
:type old_ttp: str
:param new_ttp: The new TTP value.
:type new_ttp: str
"""
if old_ttp and new_ttp:
for c, ttp in enumerate(self.ttps):
if ttp.ttp == old_ttp:
self.ttps[c].ttp = new_ttp
def remove_ttp(self, ttp_value=None):
"""
Remove a TTP from this Campaign.
:param ttp_value: The TTP value to remove.
:type ttp_value: str
"""
if ttp_value:
for c, ttp in enumerate(self.ttps):
if ttp_value == ttp.ttp:
del self.ttps[c]
|
import styled from 'styled-components';
export const StyledMenu = styled.nav`
display: flex;
flex-direction: column;
justify-content: center;
background: ${({ theme }) => theme.primaryLight};
transform: ${({ open }) => open ? 'translateX(0)' : 'translateX(-100%)'};
height: 100vh;
text-align: left;
padding: 2rem;
position: absolute;
top: 0;
left: 0;
transition: transform 0.3s ease-in-out;
@media (max-width: ${({ theme }) => theme.mobile}) {
width: 100%;
}
a {
font-family: Gilroy Bold, sans-serif;
font-size: 2rem;
text-transform: uppercase;
opacity: .6;
padding: 2rem 0;
font-weight: bold;
letter-spacing: 0.5rem;
color: ${({ theme }) => theme.primaryDark};
text-decoration: none;
transition: color 0.3s linear;
@media (max-width: ${({ theme }) => theme.mobile}) {
font-size: 1.5rem;
text-align: center;
}
&:hover {
color: ${({ theme }) => theme.primaryHover};
}
}
`;
|
/*
** Buggy-Mushroom's Spore Game Library
** Copyright (C) 2008-2009, Buggy-Mushroom Studio
**
** bsglRect util class header
*/
#ifndef BSGLRECT_H
#define BSGLRECT_H
class bsglRect {
public:
float x1;
float y1;
float x2;
float y2;
bsglRect();
bsglRect(float _x1, float _y1, float _x2, float _y2);
void Clear();
bool IsClean();
void Set(float _x1, float _y1, float _x2, float _y2);
void SetRadius(float x, float y, float r);
void Encapsulate(float x, float y);
bool TestPoint(float x, float y) const;
bool Intersect(bsglRect const* rect) const;
private:
bool bClean;
};
#endif//BSGLRECT_H
|
import click
import os
import sys
import typing
from fly import Fly
import tempfile
import importlib.machinery as imm
import signal
from fly.__init__ import __version__ as __version__
class FlyNotFoundError(Exception):
pass
@click.command()
@click.version_option(__version__)
@click.argument(
"app",
type=click.Path(exists=True),
)
@click.option(
"-c",
"--conf-path",
'conf_path',
default=None,
type=click.Path(exists=True),
help="Configure path of server",
show_default=False
)
@click.option(
"--mount-max",
default=None,
type=int,
help="Number of max mount",
show_default=False
)
@click.option(
"-w",
"--workers",
"workers",
default=None,
type=int,
help="Number of worker processes",
show_default=False
)
@click.option(
"--encode_threshold",
default=None,
type=int,
help="Number of encoding threshold value. If content length over this value, content will be encoded.",
show_default=False
)
@click.option(
"-h",
"--host",
"host",
default=None,
type=str,
help="Bind socket to this host",
show_default=False
)
@click.option(
"-p",
"--port",
"port",
default=None,
type=int,
help="Bind socket to this port",
show_default=False
)
@click.option(
"-s",
"--ssl",
"ssl",
is_flag=True,
default=None,
help="Whether to use SSL/TLS Protocol",
show_default=False
)
@click.option(
"-x",
"--ssl-crt-path",
"ssl_crt_path",
type=click.Path(exists=True),
default=None,
help="SSL/TLS certificate file path",
show_default=False
)
@click.option(
"-k",
"--ssl-key-path",
"ssl_key_path",
type=click.Path(exists=True),
default=None,
help="SSL/TLS key file path",
show_default=False
)
@click.option(
"--pidfile-path",
type=str,
default=None,
help="Path of directory that is made pid file",
show_default=False
)
@click.option(
"-i",
"--index_path",
"index_path",
type=str,
default=None,
help="Index path of URI",
show_default=False
)
@click.option(
"-l",
"--log_path",
"log_path",
type=click.Path(exists=True),
default=None,
help="Path os directory that is made log files",
show_default=False
)
@click.option(
"--stdout",
type=str,
is_flag=True,
default=None,
help="Whether to display logs on stdout",
show_default=False
)
@click.option(
"--stderr",
type=str,
is_flag=True,
default=None,
help="Whether to display logs on stderr",
show_default=False
)
@click.option(
"-b",
"--backlog",
"backlog",
type=int,
default=None,
help="Number of TCP backlog",
show_default=False
)
@click.option(
"-m",
"--max_response_len",
"max_response_len",
type=int,
default=None,
help="Size of maximum response content length",
show_default=False
)
@click.option(
"-r",
"--max_request_len",
"max_request_len",
type=int,
default=None,
help="Size of maximum request content length. If request content length over this value, response HTTP 413 (Payload Too Large).",
show_default=False
)
@click.option(
"-t",
"--request_timeout",
"request_timeout",
type=int,
default=None,
help="Request timeout. If request time over this value, a connection will be forcibly disconnected.",
show_default=False
)
@click.option(
"-d",
"--daemon",
"daemon",
is_flag=True,
default=False,
help="Whether to treat daemon process.",
show_default=False
)
@click.option(
"--test",
"test",
is_flag=True,
default=False,
show_default=False
)
def fly_command_line(
app: str,
conf_path: str,
mount_max: int,
workers: int,
encode_threshold: int,
host: str,
port: int,
ssl: bool,
ssl_crt_path: str,
ssl_key_path: str,
pidfile_path: str,
index_path: str,
log_path: str,
stdout: bool,
stderr: bool,
backlog: int,
max_response_len: int,
max_request_len: int,
request_timeout: int,
daemon: bool,
test: bool,
):
"""This is fly operation script.\n
If the same name is specified in the configure file and the argument,
the argument value will be selected. \n
detail: https://github.com/tatsuya4649/fly
"""
kwargs = {
'app': app,
"conf_path": os.path.abspath(conf_path) \
if conf_path is not None else None,
"daemon": daemon,
"mount_max": mount_max,
"workers": workers,
"encode_threshold": encode_threshold,
"host": host,
"port": port,
"ssl": ssl,
"ssl_crt_path": os.path.abspath(ssl_crt_path) \
if ssl_crt_path is not None else None,
"ssl_key_path": os.path.abspath(ssl_key_path) \
if ssl_key_path is not None else None,
"pidfile_path": pidfile_path,
"index_path": index_path,
"log_path": os.path.abspath(log_path) \
if log_path is not None else None,
"log_stdout": stdout,
"log_stderr": stderr,
"backlog": backlog,
"max_response_content_length": max_response_len,
"max_request_length": max_request_len,
"request_timeout": request_timeout,
"test": test,
}
run(**kwargs)
def display_help(command, message):
with click.Context(command) as ctx:
click.echo(command.get_help(ctx))
print("")
print(message)
def run(**kwargs):
app = kwargs.get("app")
if app is None:
raise KeyError("must have 'app' key.")
_abs_app = os.path.abspath(app)
try:
_ml = imm.SourceFileLoader("_app", _abs_app)
_m = _ml.load_module("_app")
except SyntaxError as e:
display_help(fly_command_line, f"\"{app}\" can't import as module. {e}")
sys.exit(1)
except RuntimeError as e:
print(e)
sys.exit(1)
except Exception as e:
print(e)
sys.exit(1)
daemon = kwargs.get("daemon")
if daemon is None:
raise KeyError("must have 'daemon' key.")
test = kwargs.get("test")
config_path = kwargs.get("conf_path")
_fp = tempfile.NamedTemporaryFile("w+", delete=True)
try:
_fp.seek(0, os.SEEK_SET)
if config_path is not None:
with open(config_path, "r") as _cf:
content = _cf.read()
_fp.write(content)
_fp.flush()
# argument parameter write to tempolary file
CONF_PARAMETES = [
"mount_max",
"file_max",
"workers",
"workers_max",
"encode_threshold",
"host",
"port",
"ssl",
"ssl_crt_path",
"ssl_key_path",
"pidfile_path",
"index_path",
"log_path",
"log_stdout",
"log_stderr",
"backlog",
"max_response_content_length",
"max_request_length",
"request_timeout"
]
_fp.flush()
for key in kwargs.keys():
if key in CONF_PARAMETES and \
kwargs.get(key) is not None:
_par = f"{key} = {kwargs.get(key)}\n"
_fp.write(_par)
_fp.flush()
for _ele in dir(_m):
_instance = getattr(_m, _ele)
if _instance.__class__ == Fly:
if config_path is not None and _instance.config_path is not None and \
os.path.abspath(_instance.config_path) != os.path.abspath(config_path):
raise ValueError(
f"ambiguous config_path. Fly instance config_path({os.path.abspath(_instance.config_path)}) or command line config_path({os.path.abspath(config_path)})."
)
_instance.config_path = os.path.abspath(_fp.name)
_instance.run(daemon=daemon, test=test)
sys.exit(1)
display_help(fly_command_line, f"\"{app}\" can't find Fly instance.")
sys.exit(1)
except Exception as e:
print(e)
finally:
_fp.close()
sys.exit(0)
display_help(fly_command_line, f"\"{app}\" can't find Fly instance.")
if __name__ == "__main__":
fly_command_line()
|
/*-------------------------------------------------------------------------
*
* selfuncs.c
* Selectivity functions and index cost estimation functions for
* standard operators and index access methods.
*
* Selectivity routines are registered in the pg_operator catalog
* in the "oprrest" and "oprjoin" attributes.
*
* Index cost functions are located via the index AM's API struct,
* which is obtained from the handler function registered in pg_am.
*
* Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* src/backend/utils/adt/selfuncs.c
*
*-------------------------------------------------------------------------
*/
/*----------
* Operator selectivity estimation functions are called to estimate the
* selectivity of WHERE clauses whose top-level operator is their operator.
* We divide the problem into two cases:
* Restriction clause estimation: the clause involves vars of just
* one relation.
* Join clause estimation: the clause involves vars of multiple rels.
* Join selectivity estimation is far more difficult and usually less accurate
* than restriction estimation.
*
* When dealing with the inner scan of a nestloop join, we consider the
* join's joinclauses as restriction clauses for the inner relation, and
* treat vars of the outer relation as parameters (a/k/a constants of unknown
* values). So, restriction estimators need to be able to accept an argument
* telling which relation is to be treated as the variable.
*
* The call convention for a restriction estimator (oprrest function) is
*
* Selectivity oprrest (PlannerInfo *root,
* Oid operator,
* List *args,
* int varRelid);
*
* root: general information about the query (rtable and RelOptInfo lists
* are particularly important for the estimator).
* operator: OID of the specific operator in question.
* args: argument list from the operator clause.
* varRelid: if not zero, the relid (rtable index) of the relation to
* be treated as the variable relation. May be zero if the args list
* is known to contain vars of only one relation.
*
* This is represented at the SQL level (in pg_proc) as
*
* float8 oprrest (internal, oid, internal, int4);
*
* The result is a selectivity, that is, a fraction (0 to 1) of the rows
* of the relation that are expected to produce a TRUE result for the
* given operator.
*
* The call convention for a join estimator (oprjoin function) is similar
* except that varRelid is not needed, and instead join information is
* supplied:
*
* Selectivity oprjoin (PlannerInfo *root,
* Oid operator,
* List *args,
* JoinType jointype,
* SpecialJoinInfo *sjinfo);
*
* float8 oprjoin (internal, oid, internal, int2, internal);
*
* (Before Postgres 8.4, join estimators had only the first four of these
* parameters. That signature is still allowed, but deprecated.) The
* relationship between jointype and sjinfo is explained in the comments for
* clause_selectivity() --- the short version is that jointype is usually
* best ignored in favor of examining sjinfo.
*
* Join selectivity for regular inner and outer joins is defined as the
* fraction (0 to 1) of the cross product of the relations that is expected
* to produce a TRUE result for the given operator. For both semi and anti
* joins, however, the selectivity is defined as the fraction of the left-hand
* side relation's rows that are expected to have a match (ie, at least one
* row with a TRUE result) in the right-hand side.
*
* For both oprrest and oprjoin functions, the operator's input collation OID
* (if any) is passed using the standard fmgr mechanism, so that the estimator
* function can fetch it with PG_GET_COLLATION(). Note, however, that all
* statistics in pg_statistic are currently built using the relevant column's
* collation. Thus, in most cases where we are looking at statistics, we
* should ignore the operator collation and use the stats entry's collation.
* We expect that the error induced by doing this is usually not large enough
* to justify complicating matters. In any case, doing otherwise would yield
* entirely garbage results for ordered stats data such as histograms.
*----------
*/
#include "postgres.h"
#include <ctype.h>
#include <math.h>
#include "access/brin.h"
#include "access/gin.h"
#include "access/htup_details.h"
#include "access/sysattr.h"
#include "access/table.h"
#include "access/tableam.h"
#include "catalog/index.h"
#include "catalog/pg_am.h"
#include "catalog/pg_collation.h"
#include "catalog/pg_operator.h"
#include "catalog/pg_statistic.h"
#include "catalog/pg_statistic_ext.h"
#include "executor/executor.h"
#include "executor/nodeAgg.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "optimizer/clauses.h"
#include "optimizer/cost.h"
#include "optimizer/optimizer.h"
#include "optimizer/pathnode.h"
#include "optimizer/paths.h"
#include "optimizer/plancat.h"
#include "parser/parse_clause.h"
#include "parser/parsetree.h"
#include "statistics/statistics.h"
#include "utils/builtins.h"
#include "utils/date.h"
#include "utils/datum.h"
#include "utils/fmgroids.h"
#include "utils/index_selfuncs.h"
#include "utils/lsyscache.h"
#include "utils/pg_locale.h"
#include "utils/rel.h"
#include "utils/selfuncs.h"
#include "utils/snapmgr.h"
#include "utils/spccache.h"
#include "utils/syscache.h"
#include "utils/timestamp.h"
#include "utils/typcache.h"
/* Hooks for plugins to get control when we ask for stats */
get_relation_stats_hook_type get_relation_stats_hook = NULL;
get_index_stats_hook_type get_index_stats_hook = NULL;
static double eqsel_internal(PG_FUNCTION_ARGS, bool negate);
static double eqjoinsel_inner(Oid opfuncoid,
VariableStatData *vardata1, VariableStatData *vardata2,
double nd1, double nd2,
bool isdefault1, bool isdefault2,
AttStatsSlot *sslot1, AttStatsSlot *sslot2,
Form_pg_statistic stats1, Form_pg_statistic stats2,
bool have_mcvs1, bool have_mcvs2);
static double eqjoinsel_semi(Oid opfuncoid,
VariableStatData *vardata1, VariableStatData *vardata2,
double nd1, double nd2,
bool isdefault1, bool isdefault2,
AttStatsSlot *sslot1, AttStatsSlot *sslot2,
Form_pg_statistic stats1, Form_pg_statistic stats2,
bool have_mcvs1, bool have_mcvs2,
RelOptInfo *inner_rel);
static bool estimate_multivariate_ndistinct(PlannerInfo *root,
RelOptInfo *rel, List **varinfos, double *ndistinct);
static bool convert_to_scalar(Datum value, Oid valuetypid, Oid collid,
double *scaledvalue,
Datum lobound, Datum hibound, Oid boundstypid,
double *scaledlobound, double *scaledhibound);
static double convert_numeric_to_scalar(Datum value, Oid typid, bool *failure);
static void convert_string_to_scalar(char *value,
double *scaledvalue,
char *lobound,
double *scaledlobound,
char *hibound,
double *scaledhibound);
static void convert_bytea_to_scalar(Datum value,
double *scaledvalue,
Datum lobound,
double *scaledlobound,
Datum hibound,
double *scaledhibound);
static double convert_one_string_to_scalar(char *value,
int rangelo, int rangehi);
static double convert_one_bytea_to_scalar(unsigned char *value, int valuelen,
int rangelo, int rangehi);
static char *convert_string_datum(Datum value, Oid typid, Oid collid,
bool *failure);
static double convert_timevalue_to_scalar(Datum value, Oid typid,
bool *failure);
static void examine_simple_variable(PlannerInfo *root, Var *var,
VariableStatData *vardata);
static bool get_variable_range(PlannerInfo *root, VariableStatData *vardata,
Oid sortop, Datum *min, Datum *max);
static bool get_actual_variable_range(PlannerInfo *root,
VariableStatData *vardata,
Oid sortop,
Datum *min, Datum *max);
static RelOptInfo *find_join_input_rel(PlannerInfo *root, Relids relids);
/*
* eqsel - Selectivity of "=" for any data types.
*
* Note: this routine is also used to estimate selectivity for some
* operators that are not "=" but have comparable selectivity behavior,
* such as "~=" (geometric approximate-match). Even for "=", we must
* keep in mind that the left and right datatypes may differ.
*/
Datum
eqsel(PG_FUNCTION_ARGS)
{
PG_RETURN_FLOAT8((float8) eqsel_internal(fcinfo, false));
}
/*
* Common code for eqsel() and neqsel()
*/
static double
eqsel_internal(PG_FUNCTION_ARGS, bool negate)
{
PlannerInfo *root = (PlannerInfo *) PG_GETARG_POINTER(0);
Oid operator = PG_GETARG_OID(1);
List *args = (List *) PG_GETARG_POINTER(2);
int varRelid = PG_GETARG_INT32(3);
VariableStatData vardata;
Node *other;
bool varonleft;
double selec;
/*
* When asked about <>, we do the estimation using the corresponding =
* operator, then convert to <> via "1.0 - eq_selectivity - nullfrac".
*/
if (negate)
{
operator = get_negator(operator);
if (!OidIsValid(operator))
{
/* Use default selectivity (should we raise an error instead?) */
return 1.0 - DEFAULT_EQ_SEL;
}
}
/*
* If expression is not variable = something or something = variable, then
* punt and return a default estimate.
*/
if (!get_restriction_variable(root, args, varRelid,
&vardata, &other, &varonleft))
return negate ? (1.0 - DEFAULT_EQ_SEL) : DEFAULT_EQ_SEL;
/*
* We can do a lot better if the something is a constant. (Note: the
* Const might result from estimation rather than being a simple constant
* in the query.)
*/
if (IsA(other, Const))
selec = var_eq_const(&vardata, operator,
((Const *) other)->constvalue,
((Const *) other)->constisnull,
varonleft, negate);
else
selec = var_eq_non_const(&vardata, operator, other,
varonleft, negate);
ReleaseVariableStats(vardata);
return selec;
}
/*
* var_eq_const --- eqsel for var = const case
*
* This is exported so that some other estimation functions can use it.
*/
double
var_eq_const(VariableStatData *vardata, Oid operator,
Datum constval, bool constisnull,
bool varonleft, bool negate)
{
double selec;
double nullfrac = 0.0;
bool isdefault;
Oid opfuncoid;
/*
* If the constant is NULL, assume operator is strict and return zero, ie,
* operator will never return TRUE. (It's zero even for a negator op.)
*/
if (constisnull)
return 0.0;
/*
* Grab the nullfrac for use below. Note we allow use of nullfrac
* regardless of security check.
*/
if (HeapTupleIsValid(vardata->statsTuple))
{
Form_pg_statistic stats;
stats = (Form_pg_statistic) GETSTRUCT(vardata->statsTuple);
nullfrac = stats->stanullfrac;
}
/*
* If we matched the var to a unique index or DISTINCT clause, assume
* there is exactly one match regardless of anything else. (This is
* slightly bogus, since the index or clause's equality operator might be
* different from ours, but it's much more likely to be right than
* ignoring the information.)
*/
if (vardata->isunique && vardata->rel && vardata->rel->tuples >= 1.0)
{
selec = 1.0 / vardata->rel->tuples;
}
else if (HeapTupleIsValid(vardata->statsTuple) &&
statistic_proc_security_check(vardata,
(opfuncoid = get_opcode(operator))))
{
AttStatsSlot sslot;
bool match = false;
int i;
/*
* Is the constant "=" to any of the column's most common values?
* (Although the given operator may not really be "=", we will assume
* that seeing whether it returns TRUE is an appropriate test. If you
* don't like this, maybe you shouldn't be using eqsel for your
* operator...)
*/
if (get_attstatsslot(&sslot, vardata->statsTuple,
STATISTIC_KIND_MCV, InvalidOid,
ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS))
{
FmgrInfo eqproc;
fmgr_info(opfuncoid, &eqproc);
for (i = 0; i < sslot.nvalues; i++)
{
/* be careful to apply operator right way 'round */
if (varonleft)
match = DatumGetBool(FunctionCall2Coll(&eqproc,
sslot.stacoll,
sslot.values[i],
constval));
else
match = DatumGetBool(FunctionCall2Coll(&eqproc,
sslot.stacoll,
constval,
sslot.values[i]));
if (match)
break;
}
}
else
{
/* no most-common-value info available */
i = 0; /* keep compiler quiet */
}
if (match)
{
/*
* Constant is "=" to this common value. We know selectivity
* exactly (or as exactly as ANALYZE could calculate it, anyway).
*/
selec = sslot.numbers[i];
}
else
{
/*
* Comparison is against a constant that is neither NULL nor any
* of the common values. Its selectivity cannot be more than
* this:
*/
double sumcommon = 0.0;
double otherdistinct;
for (i = 0; i < sslot.nnumbers; i++)
sumcommon += sslot.numbers[i];
selec = 1.0 - sumcommon - nullfrac;
CLAMP_PROBABILITY(selec);
/*
* and in fact it's probably a good deal less. We approximate that
* all the not-common values share this remaining fraction
* equally, so we divide by the number of other distinct values.
*/
otherdistinct = get_variable_numdistinct(vardata, &isdefault) -
sslot.nnumbers;
if (otherdistinct > 1)
selec /= otherdistinct;
/*
* Another cross-check: selectivity shouldn't be estimated as more
* than the least common "most common value".
*/
if (sslot.nnumbers > 0 && selec > sslot.numbers[sslot.nnumbers - 1])
selec = sslot.numbers[sslot.nnumbers - 1];
}
free_attstatsslot(&sslot);
}
else
{
/*
* No ANALYZE stats available, so make a guess using estimated number
* of distinct values and assuming they are equally common. (The guess
* is unlikely to be very good, but we do know a few special cases.)
*/
selec = 1.0 / get_variable_numdistinct(vardata, &isdefault);
}
/* now adjust if we wanted <> rather than = */
if (negate)
selec = 1.0 - selec - nullfrac;
/* result should be in range, but make sure... */
CLAMP_PROBABILITY(selec);
return selec;
}
/*
* var_eq_non_const --- eqsel for var = something-other-than-const case
*
* This is exported so that some other estimation functions can use it.
*/
double
var_eq_non_const(VariableStatData *vardata, Oid operator,
Node *other,
bool varonleft, bool negate)
{
double selec;
double nullfrac = 0.0;
bool isdefault;
/*
* Grab the nullfrac for use below.
*/
if (HeapTupleIsValid(vardata->statsTuple))
{
Form_pg_statistic stats;
stats = (Form_pg_statistic) GETSTRUCT(vardata->statsTuple);
nullfrac = stats->stanullfrac;
}
/*
* If we matched the var to a unique index or DISTINCT clause, assume
* there is exactly one match regardless of anything else. (This is
* slightly bogus, since the index or clause's equality operator might be
* different from ours, but it's much more likely to be right than
* ignoring the information.)
*/
if (vardata->isunique && vardata->rel && vardata->rel->tuples >= 1.0)
{
selec = 1.0 / vardata->rel->tuples;
}
else if (HeapTupleIsValid(vardata->statsTuple))
{
double ndistinct;
AttStatsSlot sslot;
/*
* Search is for a value that we do not know a priori, but we will
* assume it is not NULL. Estimate the selectivity as non-null
* fraction divided by number of distinct values, so that we get a
* result averaged over all possible values whether common or
* uncommon. (Essentially, we are assuming that the not-yet-known
* comparison value is equally likely to be any of the possible
* values, regardless of their frequency in the table. Is that a good
* idea?)
*/
selec = 1.0 - nullfrac;
ndistinct = get_variable_numdistinct(vardata, &isdefault);
if (ndistinct > 1)
selec /= ndistinct;
/*
* Cross-check: selectivity should never be estimated as more than the
* most common value's.
*/
if (get_attstatsslot(&sslot, vardata->statsTuple,
STATISTIC_KIND_MCV, InvalidOid,
ATTSTATSSLOT_NUMBERS))
{
if (sslot.nnumbers > 0 && selec > sslot.numbers[0])
selec = sslot.numbers[0];
free_attstatsslot(&sslot);
}
}
else
{
/*
* No ANALYZE stats available, so make a guess using estimated number
* of distinct values and assuming they are equally common. (The guess
* is unlikely to be very good, but we do know a few special cases.)
*/
selec = 1.0 / get_variable_numdistinct(vardata, &isdefault);
}
/* now adjust if we wanted <> rather than = */
if (negate)
selec = 1.0 - selec - nullfrac;
/* result should be in range, but make sure... */
CLAMP_PROBABILITY(selec);
return selec;
}
/*
* neqsel - Selectivity of "!=" for any data types.
*
* This routine is also used for some operators that are not "!="
* but have comparable selectivity behavior. See above comments
* for eqsel().
*/
Datum
neqsel(PG_FUNCTION_ARGS)
{
PG_RETURN_FLOAT8((float8) eqsel_internal(fcinfo, true));
}
/*
* scalarineqsel - Selectivity of "<", "<=", ">", ">=" for scalars.
*
* This is the guts of scalarltsel/scalarlesel/scalargtsel/scalargesel.
* The isgt and iseq flags distinguish which of the four cases apply.
*
* The caller has commuted the clause, if necessary, so that we can treat
* the variable as being on the left. The caller must also make sure that
* the other side of the clause is a non-null Const, and dissect that into
* a value and datatype. (This definition simplifies some callers that
* want to estimate against a computed value instead of a Const node.)
*
* This routine works for any datatype (or pair of datatypes) known to
* convert_to_scalar(). If it is applied to some other datatype,
* it will return an approximate estimate based on assuming that the constant
* value falls in the middle of the bin identified by binary search.
*/
static double
scalarineqsel(PlannerInfo *root, Oid operator, bool isgt, bool iseq,
VariableStatData *vardata, Datum constval, Oid consttype)
{
Form_pg_statistic stats;
FmgrInfo opproc;
double mcv_selec,
hist_selec,
sumcommon;
double selec;
if (!HeapTupleIsValid(vardata->statsTuple))
{
/*
* No stats are available. Typically this means we have to fall back
* on the default estimate; but if the variable is CTID then we can
* make an estimate based on comparing the constant to the table size.
*/
if (vardata->var && IsA(vardata->var, Var) &&
((Var *) vardata->var)->varattno == SelfItemPointerAttributeNumber)
{
ItemPointer itemptr;
double block;
double density;
/*
* If the relation's empty, we're going to include all of it.
* (This is mostly to avoid divide-by-zero below.)
*/
if (vardata->rel->pages == 0)
return 1.0;
itemptr = (ItemPointer) DatumGetPointer(constval);
block = ItemPointerGetBlockNumberNoCheck(itemptr);
/*
* Determine the average number of tuples per page (density).
*
* Since the last page will, on average, be only half full, we can
* estimate it to have half as many tuples as earlier pages. So
* give it half the weight of a regular page.
*/
density = vardata->rel->tuples / (vardata->rel->pages - 0.5);
/* If target is the last page, use half the density. */
if (block >= vardata->rel->pages - 1)
density *= 0.5;
/*
* Using the average tuples per page, calculate how far into the
* page the itemptr is likely to be and adjust block accordingly,
* by adding that fraction of a whole block (but never more than a
* whole block, no matter how high the itemptr's offset is). Here
* we are ignoring the possibility of dead-tuple line pointers,
* which is fairly bogus, but we lack the info to do better.
*/
if (density > 0.0)
{
OffsetNumber offset = ItemPointerGetOffsetNumberNoCheck(itemptr);
block += Min(offset / density, 1.0);
}
/*
* Convert relative block number to selectivity. Again, the last
* page has only half weight.
*/
selec = block / (vardata->rel->pages - 0.5);
/*
* The calculation so far gave us a selectivity for the "<=" case.
* We'll have one less tuple for "<" and one additional tuple for
* ">=", the latter of which we'll reverse the selectivity for
* below, so we can simply subtract one tuple for both cases. The
* cases that need this adjustment can be identified by iseq being
* equal to isgt.
*/
if (iseq == isgt && vardata->rel->tuples >= 1.0)
selec -= (1.0 / vardata->rel->tuples);
/* Finally, reverse the selectivity for the ">", ">=" cases. */
if (isgt)
selec = 1.0 - selec;
CLAMP_PROBABILITY(selec);
return selec;
}
/* no stats available, so default result */
return DEFAULT_INEQ_SEL;
}
stats = (Form_pg_statistic) GETSTRUCT(vardata->statsTuple);
fmgr_info(get_opcode(operator), &opproc);
/*
* If we have most-common-values info, add up the fractions of the MCV
* entries that satisfy MCV OP CONST. These fractions contribute directly
* to the result selectivity. Also add up the total fraction represented
* by MCV entries.
*/
mcv_selec = mcv_selectivity(vardata, &opproc, constval, true,
&sumcommon);
/*
* If there is a histogram, determine which bin the constant falls in, and
* compute the resulting contribution to selectivity.
*/
hist_selec = ineq_histogram_selectivity(root, vardata,
&opproc, isgt, iseq,
constval, consttype);
/*
* Now merge the results from the MCV and histogram calculations,
* realizing that the histogram covers only the non-null values that are
* not listed in MCV.
*/
selec = 1.0 - stats->stanullfrac - sumcommon;
if (hist_selec >= 0.0)
selec *= hist_selec;
else
{
/*
* If no histogram but there are values not accounted for by MCV,
* arbitrarily assume half of them will match.
*/
selec *= 0.5;
}
selec += mcv_selec;
/* result should be in range, but make sure... */
CLAMP_PROBABILITY(selec);
return selec;
}
/*
* mcv_selectivity - Examine the MCV list for selectivity estimates
*
* Determine the fraction of the variable's MCV population that satisfies
* the predicate (VAR OP CONST), or (CONST OP VAR) if !varonleft. Also
* compute the fraction of the total column population represented by the MCV
* list. This code will work for any boolean-returning predicate operator.
*
* The function result is the MCV selectivity, and the fraction of the
* total population is returned into *sumcommonp. Zeroes are returned
* if there is no MCV list.
*/
double
mcv_selectivity(VariableStatData *vardata, FmgrInfo *opproc,
Datum constval, bool varonleft,
double *sumcommonp)
{
double mcv_selec,
sumcommon;
AttStatsSlot sslot;
int i;
mcv_selec = 0.0;
sumcommon = 0.0;
if (HeapTupleIsValid(vardata->statsTuple) &&
statistic_proc_security_check(vardata, opproc->fn_oid) &&
get_attstatsslot(&sslot, vardata->statsTuple,
STATISTIC_KIND_MCV, InvalidOid,
ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS))
{
for (i = 0; i < sslot.nvalues; i++)
{
if (varonleft ?
DatumGetBool(FunctionCall2Coll(opproc,
sslot.stacoll,
sslot.values[i],
constval)) :
DatumGetBool(FunctionCall2Coll(opproc,
sslot.stacoll,
constval,
sslot.values[i])))
mcv_selec += sslot.numbers[i];
sumcommon += sslot.numbers[i];
}
free_attstatsslot(&sslot);
}
*sumcommonp = sumcommon;
return mcv_selec;
}
/*
* histogram_selectivity - Examine the histogram for selectivity estimates
*
* Determine the fraction of the variable's histogram entries that satisfy
* the predicate (VAR OP CONST), or (CONST OP VAR) if !varonleft.
*
* This code will work for any boolean-returning predicate operator, whether
* or not it has anything to do with the histogram sort operator. We are
* essentially using the histogram just as a representative sample. However,
* small histograms are unlikely to be all that representative, so the caller
* should be prepared to fall back on some other estimation approach when the
* histogram is missing or very small. It may also be prudent to combine this
* approach with another one when the histogram is small.
*
* If the actual histogram size is not at least min_hist_size, we won't bother
* to do the calculation at all. Also, if the n_skip parameter is > 0, we
* ignore the first and last n_skip histogram elements, on the grounds that
* they are outliers and hence not very representative. Typical values for
* these parameters are 10 and 1.
*
* The function result is the selectivity, or -1 if there is no histogram
* or it's smaller than min_hist_size.
*
* The output parameter *hist_size receives the actual histogram size,
* or zero if no histogram. Callers may use this number to decide how
* much faith to put in the function result.
*
* Note that the result disregards both the most-common-values (if any) and
* null entries. The caller is expected to combine this result with
* statistics for those portions of the column population. It may also be
* prudent to clamp the result range, ie, disbelieve exact 0 or 1 outputs.
*/
double
histogram_selectivity(VariableStatData *vardata, FmgrInfo *opproc,
Datum constval, bool varonleft,
int min_hist_size, int n_skip,
int *hist_size)
{
double result;
AttStatsSlot sslot;
/* check sanity of parameters */
Assert(n_skip >= 0);
Assert(min_hist_size > 2 * n_skip);
if (HeapTupleIsValid(vardata->statsTuple) &&
statistic_proc_security_check(vardata, opproc->fn_oid) &&
get_attstatsslot(&sslot, vardata->statsTuple,
STATISTIC_KIND_HISTOGRAM, InvalidOid,
ATTSTATSSLOT_VALUES))
{
*hist_size = sslot.nvalues;
if (sslot.nvalues >= min_hist_size)
{
int nmatch = 0;
int i;
for (i = n_skip; i < sslot.nvalues - n_skip; i++)
{
if (varonleft ?
DatumGetBool(FunctionCall2Coll(opproc,
sslot.stacoll,
sslot.values[i],
constval)) :
DatumGetBool(FunctionCall2Coll(opproc,
sslot.stacoll,
constval,
sslot.values[i])))
nmatch++;
}
result = ((double) nmatch) / ((double) (sslot.nvalues - 2 * n_skip));
}
else
result = -1;
free_attstatsslot(&sslot);
}
else
{
*hist_size = 0;
result = -1;
}
return result;
}
/*
* ineq_histogram_selectivity - Examine the histogram for scalarineqsel
*
* Determine the fraction of the variable's histogram population that
* satisfies the inequality condition, ie, VAR < (or <=, >, >=) CONST.
* The isgt and iseq flags distinguish which of the four cases apply.
*
* Returns -1 if there is no histogram (valid results will always be >= 0).
*
* Note that the result disregards both the most-common-values (if any) and
* null entries. The caller is expected to combine this result with
* statistics for those portions of the column population.
*
* This is exported so that some other estimation functions can use it.
*/
double
ineq_histogram_selectivity(PlannerInfo *root,
VariableStatData *vardata,
FmgrInfo *opproc, bool isgt, bool iseq,
Datum constval, Oid consttype)
{
double hist_selec;
AttStatsSlot sslot;
hist_selec = -1.0;
/*
* Someday, ANALYZE might store more than one histogram per rel/att,
* corresponding to more than one possible sort ordering defined for the
* column type. However, to make that work we will need to figure out
* which staop to search for --- it's not necessarily the one we have at
* hand! (For example, we might have a '<=' operator rather than the '<'
* operator that will appear in staop.) For now, assume that whatever
* appears in pg_statistic is sorted the same way our operator sorts, or
* the reverse way if isgt is true.
*/
if (HeapTupleIsValid(vardata->statsTuple) &&
statistic_proc_security_check(vardata, opproc->fn_oid) &&
get_attstatsslot(&sslot, vardata->statsTuple,
STATISTIC_KIND_HISTOGRAM, InvalidOid,
ATTSTATSSLOT_VALUES))
{
if (sslot.nvalues > 1)
{
/*
* Use binary search to find the desired location, namely the
* right end of the histogram bin containing the comparison value,
* which is the leftmost entry for which the comparison operator
* succeeds (if isgt) or fails (if !isgt). (If the given operator
* isn't actually sort-compatible with the histogram, you'll get
* garbage results ... but probably not any more garbage-y than
* you would have from the old linear search.)
*
* In this loop, we pay no attention to whether the operator iseq
* or not; that detail will be mopped up below. (We cannot tell,
* anyway, whether the operator thinks the values are equal.)
*
* If the binary search accesses the first or last histogram
* entry, we try to replace that endpoint with the true column min
* or max as found by get_actual_variable_range(). This
* ameliorates misestimates when the min or max is moving as a
* result of changes since the last ANALYZE. Note that this could
* result in effectively including MCVs into the histogram that
* weren't there before, but we don't try to correct for that.
*/
double histfrac;
int lobound = 0; /* first possible slot to search */
int hibound = sslot.nvalues; /* last+1 slot to search */
bool have_end = false;
/*
* If there are only two histogram entries, we'll want up-to-date
* values for both. (If there are more than two, we need at most
* one of them to be updated, so we deal with that within the
* loop.)
*/
if (sslot.nvalues == 2)
have_end = get_actual_variable_range(root,
vardata,
sslot.staop,
&sslot.values[0],
&sslot.values[1]);
while (lobound < hibound)
{
int probe = (lobound + hibound) / 2;
bool ltcmp;
/*
* If we find ourselves about to compare to the first or last
* histogram entry, first try to replace it with the actual
* current min or max (unless we already did so above).
*/
if (probe == 0 && sslot.nvalues > 2)
have_end = get_actual_variable_range(root,
vardata,
sslot.staop,
&sslot.values[0],
NULL);
else if (probe == sslot.nvalues - 1 && sslot.nvalues > 2)
have_end = get_actual_variable_range(root,
vardata,
sslot.staop,
NULL,
&sslot.values[probe]);
ltcmp = DatumGetBool(FunctionCall2Coll(opproc,
sslot.stacoll,
sslot.values[probe],
constval));
if (isgt)
ltcmp = !ltcmp;
if (ltcmp)
lobound = probe + 1;
else
hibound = probe;
}
if (lobound <= 0)
{
/*
* Constant is below lower histogram boundary. More
* precisely, we have found that no entry in the histogram
* satisfies the inequality clause (if !isgt) or they all do
* (if isgt). We estimate that that's true of the entire
* table, so set histfrac to 0.0 (which we'll flip to 1.0
* below, if isgt).
*/
histfrac = 0.0;
}
else if (lobound >= sslot.nvalues)
{
/*
* Inverse case: constant is above upper histogram boundary.
*/
histfrac = 1.0;
}
else
{
/* We have values[i-1] <= constant <= values[i]. */
int i = lobound;
double eq_selec = 0;
double val,
high,
low;
double binfrac;
/*
* In the cases where we'll need it below, obtain an estimate
* of the selectivity of "x = constval". We use a calculation
* similar to what var_eq_const() does for a non-MCV constant,
* ie, estimate that all distinct non-MCV values occur equally
* often. But multiplication by "1.0 - sumcommon - nullfrac"
* will be done by our caller, so we shouldn't do that here.
* Therefore we can't try to clamp the estimate by reference
* to the least common MCV; the result would be too small.
*
* Note: since this is effectively assuming that constval
* isn't an MCV, it's logically dubious if constval in fact is
* one. But we have to apply *some* correction for equality,
* and anyway we cannot tell if constval is an MCV, since we
* don't have a suitable equality operator at hand.
*/
if (i == 1 || isgt == iseq)
{
double otherdistinct;
bool isdefault;
AttStatsSlot mcvslot;
/* Get estimated number of distinct values */
otherdistinct = get_variable_numdistinct(vardata,
&isdefault);
/* Subtract off the number of known MCVs */
if (get_attstatsslot(&mcvslot, vardata->statsTuple,
STATISTIC_KIND_MCV, InvalidOid,
ATTSTATSSLOT_NUMBERS))
{
otherdistinct -= mcvslot.nnumbers;
free_attstatsslot(&mcvslot);
}
/* If result doesn't seem sane, leave eq_selec at 0 */
if (otherdistinct > 1)
eq_selec = 1.0 / otherdistinct;
}
/*
* Convert the constant and the two nearest bin boundary
* values to a uniform comparison scale, and do a linear
* interpolation within this bin.
*/
if (convert_to_scalar(constval, consttype, sslot.stacoll,
&val,
sslot.values[i - 1], sslot.values[i],
vardata->vartype,
&low, &high))
{
if (high <= low)
{
/* cope if bin boundaries appear identical */
binfrac = 0.5;
}
else if (val <= low)
binfrac = 0.0;
else if (val >= high)
binfrac = 1.0;
else
{
binfrac = (val - low) / (high - low);
/*
* Watch out for the possibility that we got a NaN or
* Infinity from the division. This can happen
* despite the previous checks, if for example "low"
* is -Infinity.
*/
if (isnan(binfrac) ||
binfrac < 0.0 || binfrac > 1.0)
binfrac = 0.5;
}
}
else
{
/*
* Ideally we'd produce an error here, on the grounds that
* the given operator shouldn't have scalarXXsel
* registered as its selectivity func unless we can deal
* with its operand types. But currently, all manner of
* stuff is invoking scalarXXsel, so give a default
* estimate until that can be fixed.
*/
binfrac = 0.5;
}
/*
* Now, compute the overall selectivity across the values
* represented by the histogram. We have i-1 full bins and
* binfrac partial bin below the constant.
*/
histfrac = (double) (i - 1) + binfrac;
histfrac /= (double) (sslot.nvalues - 1);
/*
* At this point, histfrac is an estimate of the fraction of
* the population represented by the histogram that satisfies
* "x <= constval". Somewhat remarkably, this statement is
* true regardless of which operator we were doing the probes
* with, so long as convert_to_scalar() delivers reasonable
* results. If the probe constant is equal to some histogram
* entry, we would have considered the bin to the left of that
* entry if probing with "<" or ">=", or the bin to the right
* if probing with "<=" or ">"; but binfrac would have come
* out as 1.0 in the first case and 0.0 in the second, leading
* to the same histfrac in either case. For probe constants
* between histogram entries, we find the same bin and get the
* same estimate with any operator.
*
* The fact that the estimate corresponds to "x <= constval"
* and not "x < constval" is because of the way that ANALYZE
* constructs the histogram: each entry is, effectively, the
* rightmost value in its sample bucket. So selectivity
* values that are exact multiples of 1/(histogram_size-1)
* should be understood as estimates including a histogram
* entry plus everything to its left.
*
* However, that breaks down for the first histogram entry,
* which necessarily is the leftmost value in its sample
* bucket. That means the first histogram bin is slightly
* narrower than the rest, by an amount equal to eq_selec.
* Another way to say that is that we want "x <= leftmost" to
* be estimated as eq_selec not zero. So, if we're dealing
* with the first bin (i==1), rescale to make that true while
* adjusting the rest of that bin linearly.
*/
if (i == 1)
histfrac += eq_selec * (1.0 - binfrac);
/*
* "x <= constval" is good if we want an estimate for "<=" or
* ">", but if we are estimating for "<" or ">=", we now need
* to decrease the estimate by eq_selec.
*/
if (isgt == iseq)
histfrac -= eq_selec;
}
/*
* Now the estimate is finished for "<" and "<=" cases. If we are
* estimating for ">" or ">=", flip it.
*/
hist_selec = isgt ? (1.0 - histfrac) : histfrac;
/*
* The histogram boundaries are only approximate to begin with,
* and may well be out of date anyway. Therefore, don't believe
* extremely small or large selectivity estimates --- unless we
* got actual current endpoint values from the table, in which
* case just do the usual sanity clamp. Somewhat arbitrarily, we
* set the cutoff for other cases at a hundredth of the histogram
* resolution.
*/
if (have_end)
CLAMP_PROBABILITY(hist_selec);
else
{
double cutoff = 0.01 / (double) (sslot.nvalues - 1);
if (hist_selec < cutoff)
hist_selec = cutoff;
else if (hist_selec > 1.0 - cutoff)
hist_selec = 1.0 - cutoff;
}
}
free_attstatsslot(&sslot);
}
return hist_selec;
}
/*
* Common wrapper function for the selectivity estimators that simply
* invoke scalarineqsel().
*/
static Datum
scalarineqsel_wrapper(PG_FUNCTION_ARGS, bool isgt, bool iseq)
{
PlannerInfo *root = (PlannerInfo *) PG_GETARG_POINTER(0);
Oid operator = PG_GETARG_OID(1);
List *args = (List *) PG_GETARG_POINTER(2);
int varRelid = PG_GETARG_INT32(3);
VariableStatData vardata;
Node *other;
bool varonleft;
Datum constval;
Oid consttype;
double selec;
/*
* If expression is not variable op something or something op variable,
* then punt and return a default estimate.
*/
if (!get_restriction_variable(root, args, varRelid,
&vardata, &other, &varonleft))
PG_RETURN_FLOAT8(DEFAULT_INEQ_SEL);
/*
* Can't do anything useful if the something is not a constant, either.
*/
if (!IsA(other, Const))
{
ReleaseVariableStats(vardata);
PG_RETURN_FLOAT8(DEFAULT_INEQ_SEL);
}
/*
* If the constant is NULL, assume operator is strict and return zero, ie,
* operator will never return TRUE.
*/
if (((Const *) other)->constisnull)
{
ReleaseVariableStats(vardata);
PG_RETURN_FLOAT8(0.0);
}
constval = ((Const *) other)->constvalue;
consttype = ((Const *) other)->consttype;
/*
* Force the var to be on the left to simplify logic in scalarineqsel.
*/
if (!varonleft)
{
operator = get_commutator(operator);
if (!operator)
{
/* Use default selectivity (should we raise an error instead?) */
ReleaseVariableStats(vardata);
PG_RETURN_FLOAT8(DEFAULT_INEQ_SEL);
}
isgt = !isgt;
}
/* The rest of the work is done by scalarineqsel(). */
selec = scalarineqsel(root, operator, isgt, iseq,
&vardata, constval, consttype);
ReleaseVariableStats(vardata);
PG_RETURN_FLOAT8((float8) selec);
}
/*
* scalarltsel - Selectivity of "<" for scalars.
*/
Datum
scalarltsel(PG_FUNCTION_ARGS)
{
return scalarineqsel_wrapper(fcinfo, false, false);
}
/*
* scalarlesel - Selectivity of "<=" for scalars.
*/
Datum
scalarlesel(PG_FUNCTION_ARGS)
{
return scalarineqsel_wrapper(fcinfo, false, true);
}
/*
* scalargtsel - Selectivity of ">" for scalars.
*/
Datum
scalargtsel(PG_FUNCTION_ARGS)
{
return scalarineqsel_wrapper(fcinfo, true, false);
}
/*
* scalargesel - Selectivity of ">=" for scalars.
*/
Datum
scalargesel(PG_FUNCTION_ARGS)
{
return scalarineqsel_wrapper(fcinfo, true, true);
}
/*
* boolvarsel - Selectivity of Boolean variable.
*
* This can actually be called on any boolean-valued expression. If it
* involves only Vars of the specified relation, and if there are statistics
* about the Var or expression (the latter is possible if it's indexed) then
* we'll produce a real estimate; otherwise it's just a default.
*/
Selectivity
boolvarsel(PlannerInfo *root, Node *arg, int varRelid)
{
VariableStatData vardata;
double selec;
examine_variable(root, arg, varRelid, &vardata);
if (HeapTupleIsValid(vardata.statsTuple))
{
/*
* A boolean variable V is equivalent to the clause V = 't', so we
* compute the selectivity as if that is what we have.
*/
selec = var_eq_const(&vardata, BooleanEqualOperator,
BoolGetDatum(true), false, true, false);
}
else
{
/* Otherwise, the default estimate is 0.5 */
selec = 0.5;
}
ReleaseVariableStats(vardata);
return selec;
}
/*
* booltestsel - Selectivity of BooleanTest Node.
*/
Selectivity
booltestsel(PlannerInfo *root, BoolTestType booltesttype, Node *arg,
int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo)
{
VariableStatData vardata;
double selec;
examine_variable(root, arg, varRelid, &vardata);
if (HeapTupleIsValid(vardata.statsTuple))
{
Form_pg_statistic stats;
double freq_null;
AttStatsSlot sslot;
stats = (Form_pg_statistic) GETSTRUCT(vardata.statsTuple);
freq_null = stats->stanullfrac;
if (get_attstatsslot(&sslot, vardata.statsTuple,
STATISTIC_KIND_MCV, InvalidOid,
ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS)
&& sslot.nnumbers > 0)
{
double freq_true;
double freq_false;
/*
* Get first MCV frequency and derive frequency for true.
*/
if (DatumGetBool(sslot.values[0]))
freq_true = sslot.numbers[0];
else
freq_true = 1.0 - sslot.numbers[0] - freq_null;
/*
* Next derive frequency for false. Then use these as appropriate
* to derive frequency for each case.
*/
freq_false = 1.0 - freq_true - freq_null;
switch (booltesttype)
{
case IS_UNKNOWN:
/* select only NULL values */
selec = freq_null;
break;
case IS_NOT_UNKNOWN:
/* select non-NULL values */
selec = 1.0 - freq_null;
break;
case IS_TRUE:
/* select only TRUE values */
selec = freq_true;
break;
case IS_NOT_TRUE:
/* select non-TRUE values */
selec = 1.0 - freq_true;
break;
case IS_FALSE:
/* select only FALSE values */
selec = freq_false;
break;
case IS_NOT_FALSE:
/* select non-FALSE values */
selec = 1.0 - freq_false;
break;
default:
elog(ERROR, "unrecognized booltesttype: %d",
(int) booltesttype);
selec = 0.0; /* Keep compiler quiet */
break;
}
free_attstatsslot(&sslot);
}
else
{
/*
* No most-common-value info available. Still have null fraction
* information, so use it for IS [NOT] UNKNOWN. Otherwise adjust
* for null fraction and assume a 50-50 split of TRUE and FALSE.
*/
switch (booltesttype)
{
case IS_UNKNOWN:
/* select only NULL values */
selec = freq_null;
break;
case IS_NOT_UNKNOWN:
/* select non-NULL values */
selec = 1.0 - freq_null;
break;
case IS_TRUE:
case IS_FALSE:
/* Assume we select half of the non-NULL values */
selec = (1.0 - freq_null) / 2.0;
break;
case IS_NOT_TRUE:
case IS_NOT_FALSE:
/* Assume we select NULLs plus half of the non-NULLs */
/* equiv. to freq_null + (1.0 - freq_null) / 2.0 */
selec = (freq_null + 1.0) / 2.0;
break;
default:
elog(ERROR, "unrecognized booltesttype: %d",
(int) booltesttype);
selec = 0.0; /* Keep compiler quiet */
break;
}
}
}
else
{
/*
* If we can't get variable statistics for the argument, perhaps
* clause_selectivity can do something with it. We ignore the
* possibility of a NULL value when using clause_selectivity, and just
* assume the value is either TRUE or FALSE.
*/
switch (booltesttype)
{
case IS_UNKNOWN:
selec = DEFAULT_UNK_SEL;
break;
case IS_NOT_UNKNOWN:
selec = DEFAULT_NOT_UNK_SEL;
break;
case IS_TRUE:
case IS_NOT_FALSE:
selec = (double) clause_selectivity(root, arg,
varRelid,
jointype, sjinfo);
break;
case IS_FALSE:
case IS_NOT_TRUE:
selec = 1.0 - (double) clause_selectivity(root, arg,
varRelid,
jointype, sjinfo);
break;
default:
elog(ERROR, "unrecognized booltesttype: %d",
(int) booltesttype);
selec = 0.0; /* Keep compiler quiet */
break;
}
}
ReleaseVariableStats(vardata);
/* result should be in range, but make sure... */
CLAMP_PROBABILITY(selec);
return (Selectivity) selec;
}
/*
* nulltestsel - Selectivity of NullTest Node.
*/
Selectivity
nulltestsel(PlannerInfo *root, NullTestType nulltesttype, Node *arg,
int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo)
{
VariableStatData vardata;
double selec;
examine_variable(root, arg, varRelid, &vardata);
if (HeapTupleIsValid(vardata.statsTuple))
{
Form_pg_statistic stats;
double freq_null;
stats = (Form_pg_statistic) GETSTRUCT(vardata.statsTuple);
freq_null = stats->stanullfrac;
switch (nulltesttype)
{
case IS_NULL:
/*
* Use freq_null directly.
*/
selec = freq_null;
break;
case IS_NOT_NULL:
/*
* Select not unknown (not null) values. Calculate from
* freq_null.
*/
selec = 1.0 - freq_null;
break;
default:
elog(ERROR, "unrecognized nulltesttype: %d",
(int) nulltesttype);
return (Selectivity) 0; /* keep compiler quiet */
}
}
else if (vardata.var && IsA(vardata.var, Var) &&
((Var *) vardata.var)->varattno < 0)
{
/*
* There are no stats for system columns, but we know they are never
* NULL.
*/
selec = (nulltesttype == IS_NULL) ? 0.0 : 1.0;
}
else
{
/*
* No ANALYZE stats available, so make a guess
*/
switch (nulltesttype)
{
case IS_NULL:
selec = DEFAULT_UNK_SEL;
break;
case IS_NOT_NULL:
selec = DEFAULT_NOT_UNK_SEL;
break;
default:
elog(ERROR, "unrecognized nulltesttype: %d",
(int) nulltesttype);
return (Selectivity) 0; /* keep compiler quiet */
}
}
ReleaseVariableStats(vardata);
/* result should be in range, but make sure... */
CLAMP_PROBABILITY(selec);
return (Selectivity) selec;
}
/*
* strip_array_coercion - strip binary-compatible relabeling from an array expr
*
* For array values, the parser normally generates ArrayCoerceExpr conversions,
* but it seems possible that RelabelType might show up. Also, the planner
* is not currently tense about collapsing stacked ArrayCoerceExpr nodes,
* so we need to be ready to deal with more than one level.
*/
static Node *
strip_array_coercion(Node *node)
{
for (;;)
{
if (node && IsA(node, ArrayCoerceExpr))
{
ArrayCoerceExpr *acoerce = (ArrayCoerceExpr *) node;
/*
* If the per-element expression is just a RelabelType on top of
* CaseTestExpr, then we know it's a binary-compatible relabeling.
*/
if (IsA(acoerce->elemexpr, RelabelType) &&
IsA(((RelabelType *) acoerce->elemexpr)->arg, CaseTestExpr))
node = (Node *) acoerce->arg;
else
break;
}
else if (node && IsA(node, RelabelType))
{
/* We don't really expect this case, but may as well cope */
node = (Node *) ((RelabelType *) node)->arg;
}
else
break;
}
return node;
}
/*
* scalararraysel - Selectivity of ScalarArrayOpExpr Node.
*/
Selectivity
scalararraysel(PlannerInfo *root,
ScalarArrayOpExpr *clause,
bool is_join_clause,
int varRelid,
JoinType jointype,
SpecialJoinInfo *sjinfo)
{
Oid operator = clause->opno;
bool useOr = clause->useOr;
bool isEquality = false;
bool isInequality = false;
Node *leftop;
Node *rightop;
Oid nominal_element_type;
Oid nominal_element_collation;
TypeCacheEntry *typentry;
RegProcedure oprsel;
FmgrInfo oprselproc;
Selectivity s1;
Selectivity s1disjoint;
/* First, deconstruct the expression */
Assert(list_length(clause->args) == 2);
leftop = (Node *) linitial(clause->args);
rightop = (Node *) lsecond(clause->args);
/* aggressively reduce both sides to constants */
leftop = estimate_expression_value(root, leftop);
rightop = estimate_expression_value(root, rightop);
/* get nominal (after relabeling) element type of rightop */
nominal_element_type = get_base_element_type(exprType(rightop));
if (!OidIsValid(nominal_element_type))
return (Selectivity) 0.5; /* probably shouldn't happen */
/* get nominal collation, too, for generating constants */
nominal_element_collation = exprCollation(rightop);
/* look through any binary-compatible relabeling of rightop */
rightop = strip_array_coercion(rightop);
/*
* Detect whether the operator is the default equality or inequality
* operator of the array element type.
*/
typentry = lookup_type_cache(nominal_element_type, TYPECACHE_EQ_OPR);
if (OidIsValid(typentry->eq_opr))
{
if (operator == typentry->eq_opr)
isEquality = true;
else if (get_negator(operator) == typentry->eq_opr)
isInequality = true;
}
/*
* If it is equality or inequality, we might be able to estimate this as a
* form of array containment; for instance "const = ANY(column)" can be
* treated as "ARRAY[const] <@ column". scalararraysel_containment tries
* that, and returns the selectivity estimate if successful, or -1 if not.
*/
if ((isEquality || isInequality) && !is_join_clause)
{
s1 = scalararraysel_containment(root, leftop, rightop,
nominal_element_type,
isEquality, useOr, varRelid);
if (s1 >= 0.0)
return s1;
}
/*
* Look up the underlying operator's selectivity estimator. Punt if it
* hasn't got one.
*/
if (is_join_clause)
oprsel = get_oprjoin(operator);
else
oprsel = get_oprrest(operator);
if (!oprsel)
return (Selectivity) 0.5;
fmgr_info(oprsel, &oprselproc);
/*
* In the array-containment check above, we must only believe that an
* operator is equality or inequality if it is the default btree equality
* operator (or its negator) for the element type, since those are the
* operators that array containment will use. But in what follows, we can
* be a little laxer, and also believe that any operators using eqsel() or
* neqsel() as selectivity estimator act like equality or inequality.
*/
if (oprsel == F_EQSEL || oprsel == F_EQJOINSEL)
isEquality = true;
else if (oprsel == F_NEQSEL || oprsel == F_NEQJOINSEL)
isInequality = true;
/*
* We consider three cases:
*
* 1. rightop is an Array constant: deconstruct the array, apply the
* operator's selectivity function for each array element, and merge the
* results in the same way that clausesel.c does for AND/OR combinations.
*
* 2. rightop is an ARRAY[] construct: apply the operator's selectivity
* function for each element of the ARRAY[] construct, and merge.
*
* 3. otherwise, make a guess ...
*/
if (rightop && IsA(rightop, Const))
{
Datum arraydatum = ((Const *) rightop)->constvalue;
bool arrayisnull = ((Const *) rightop)->constisnull;
ArrayType *arrayval;
int16 elmlen;
bool elmbyval;
char elmalign;
int num_elems;
Datum *elem_values;
bool *elem_nulls;
int i;
if (arrayisnull) /* qual can't succeed if null array */
return (Selectivity) 0.0;
arrayval = DatumGetArrayTypeP(arraydatum);
get_typlenbyvalalign(ARR_ELEMTYPE(arrayval),
&elmlen, &elmbyval, &elmalign);
deconstruct_array(arrayval,
ARR_ELEMTYPE(arrayval),
elmlen, elmbyval, elmalign,
&elem_values, &elem_nulls, &num_elems);
/*
* For generic operators, we assume the probability of success is
* independent for each array element. But for "= ANY" or "<> ALL",
* if the array elements are distinct (which'd typically be the case)
* then the probabilities are disjoint, and we should just sum them.
*
* If we were being really tense we would try to confirm that the
* elements are all distinct, but that would be expensive and it
* doesn't seem to be worth the cycles; it would amount to penalizing
* well-written queries in favor of poorly-written ones. However, we
* do protect ourselves a little bit by checking whether the
* disjointness assumption leads to an impossible (out of range)
* probability; if so, we fall back to the normal calculation.
*/
s1 = s1disjoint = (useOr ? 0.0 : 1.0);
for (i = 0; i < num_elems; i++)
{
List *args;
Selectivity s2;
args = list_make2(leftop,
makeConst(nominal_element_type,
-1,
nominal_element_collation,
elmlen,
elem_values[i],
elem_nulls[i],
elmbyval));
if (is_join_clause)
s2 = DatumGetFloat8(FunctionCall5Coll(&oprselproc,
clause->inputcollid,
PointerGetDatum(root),
ObjectIdGetDatum(operator),
PointerGetDatum(args),
Int16GetDatum(jointype),
PointerGetDatum(sjinfo)));
else
s2 = DatumGetFloat8(FunctionCall4Coll(&oprselproc,
clause->inputcollid,
PointerGetDatum(root),
ObjectIdGetDatum(operator),
PointerGetDatum(args),
Int32GetDatum(varRelid)));
if (useOr)
{
s1 = s1 + s2 - s1 * s2;
if (isEquality)
s1disjoint += s2;
}
else
{
s1 = s1 * s2;
if (isInequality)
s1disjoint += s2 - 1.0;
}
}
/* accept disjoint-probability estimate if in range */
if ((useOr ? isEquality : isInequality) &&
s1disjoint >= 0.0 && s1disjoint <= 1.0)
s1 = s1disjoint;
}
else if (rightop && IsA(rightop, ArrayExpr) &&
!((ArrayExpr *) rightop)->multidims)
{
ArrayExpr *arrayexpr = (ArrayExpr *) rightop;
int16 elmlen;
bool elmbyval;
ListCell *l;
get_typlenbyval(arrayexpr->element_typeid,
&elmlen, &elmbyval);
/*
* We use the assumption of disjoint probabilities here too, although
* the odds of equal array elements are rather higher if the elements
* are not all constants (which they won't be, else constant folding
* would have reduced the ArrayExpr to a Const). In this path it's
* critical to have the sanity check on the s1disjoint estimate.
*/
s1 = s1disjoint = (useOr ? 0.0 : 1.0);
foreach(l, arrayexpr->elements)
{
Node *elem = (Node *) lfirst(l);
List *args;
Selectivity s2;
/*
* Theoretically, if elem isn't of nominal_element_type we should
* insert a RelabelType, but it seems unlikely that any operator
* estimation function would really care ...
*/
args = list_make2(leftop, elem);
if (is_join_clause)
s2 = DatumGetFloat8(FunctionCall5Coll(&oprselproc,
clause->inputcollid,
PointerGetDatum(root),
ObjectIdGetDatum(operator),
PointerGetDatum(args),
Int16GetDatum(jointype),
PointerGetDatum(sjinfo)));
else
s2 = DatumGetFloat8(FunctionCall4Coll(&oprselproc,
clause->inputcollid,
PointerGetDatum(root),
ObjectIdGetDatum(operator),
PointerGetDatum(args),
Int32GetDatum(varRelid)));
if (useOr)
{
s1 = s1 + s2 - s1 * s2;
if (isEquality)
s1disjoint += s2;
}
else
{
s1 = s1 * s2;
if (isInequality)
s1disjoint += s2 - 1.0;
}
}
/* accept disjoint-probability estimate if in range */
if ((useOr ? isEquality : isInequality) &&
s1disjoint >= 0.0 && s1disjoint <= 1.0)
s1 = s1disjoint;
}
else
{
CaseTestExpr *dummyexpr;
List *args;
Selectivity s2;
int i;
/*
* We need a dummy rightop to pass to the operator selectivity
* routine. It can be pretty much anything that doesn't look like a
* constant; CaseTestExpr is a convenient choice.
*/
dummyexpr = makeNode(CaseTestExpr);
dummyexpr->typeId = nominal_element_type;
dummyexpr->typeMod = -1;
dummyexpr->collation = clause->inputcollid;
args = list_make2(leftop, dummyexpr);
if (is_join_clause)
s2 = DatumGetFloat8(FunctionCall5Coll(&oprselproc,
clause->inputcollid,
PointerGetDatum(root),
ObjectIdGetDatum(operator),
PointerGetDatum(args),
Int16GetDatum(jointype),
PointerGetDatum(sjinfo)));
else
s2 = DatumGetFloat8(FunctionCall4Coll(&oprselproc,
clause->inputcollid,
PointerGetDatum(root),
ObjectIdGetDatum(operator),
PointerGetDatum(args),
Int32GetDatum(varRelid)));
s1 = useOr ? 0.0 : 1.0;
/*
* Arbitrarily assume 10 elements in the eventual array value (see
* also estimate_array_length). We don't risk an assumption of
* disjoint probabilities here.
*/
for (i = 0; i < 10; i++)
{
if (useOr)
s1 = s1 + s2 - s1 * s2;
else
s1 = s1 * s2;
}
}
/* result should be in range, but make sure... */
CLAMP_PROBABILITY(s1);
return s1;
}
/*
* Estimate number of elements in the array yielded by an expression.
*
* It's important that this agree with scalararraysel.
*/
int
estimate_array_length(Node *arrayexpr)
{
/* look through any binary-compatible relabeling of arrayexpr */
arrayexpr = strip_array_coercion(arrayexpr);
if (arrayexpr && IsA(arrayexpr, Const))
{
Datum arraydatum = ((Const *) arrayexpr)->constvalue;
bool arrayisnull = ((Const *) arrayexpr)->constisnull;
ArrayType *arrayval;
if (arrayisnull)
return 0;
arrayval = DatumGetArrayTypeP(arraydatum);
return ArrayGetNItems(ARR_NDIM(arrayval), ARR_DIMS(arrayval));
}
else if (arrayexpr && IsA(arrayexpr, ArrayExpr) &&
!((ArrayExpr *) arrayexpr)->multidims)
{
return list_length(((ArrayExpr *) arrayexpr)->elements);
}
else
{
/* default guess --- see also scalararraysel */
return 10;
}
}
/*
* rowcomparesel - Selectivity of RowCompareExpr Node.
*
* We estimate RowCompare selectivity by considering just the first (high
* order) columns, which makes it equivalent to an ordinary OpExpr. While
* this estimate could be refined by considering additional columns, it
* seems unlikely that we could do a lot better without multi-column
* statistics.
*/
Selectivity
rowcomparesel(PlannerInfo *root,
RowCompareExpr *clause,
int varRelid, JoinType jointype, SpecialJoinInfo *sjinfo)
{
Selectivity s1;
Oid opno = linitial_oid(clause->opnos);
Oid inputcollid = linitial_oid(clause->inputcollids);
List *opargs;
bool is_join_clause;
/* Build equivalent arg list for single operator */
opargs = list_make2(linitial(clause->largs), linitial(clause->rargs));
/*
* Decide if it's a join clause. This should match clausesel.c's
* treat_as_join_clause(), except that we intentionally consider only the
* leading columns and not the rest of the clause.
*/
if (varRelid != 0)
{
/*
* Caller is forcing restriction mode (eg, because we are examining an
* inner indexscan qual).
*/
is_join_clause = false;
}
else if (sjinfo == NULL)
{
/*
* It must be a restriction clause, since it's being evaluated at a
* scan node.
*/
is_join_clause = false;
}
else
{
/*
* Otherwise, it's a join if there's more than one relation used.
*/
is_join_clause = (NumRelids((Node *) opargs) > 1);
}
if (is_join_clause)
{
/* Estimate selectivity for a join clause. */
s1 = join_selectivity(root, opno,
opargs,
inputcollid,
jointype,
sjinfo);
}
else
{
/* Estimate selectivity for a restriction clause. */
s1 = restriction_selectivity(root, opno,
opargs,
inputcollid,
varRelid);
}
return s1;
}
/*
* eqjoinsel - Join selectivity of "="
*/
Datum
eqjoinsel(PG_FUNCTION_ARGS)
{
PlannerInfo *root = (PlannerInfo *) PG_GETARG_POINTER(0);
Oid operator = PG_GETARG_OID(1);
List *args = (List *) PG_GETARG_POINTER(2);
#ifdef NOT_USED
JoinType jointype = (JoinType) PG_GETARG_INT16(3);
#endif
SpecialJoinInfo *sjinfo = (SpecialJoinInfo *) PG_GETARG_POINTER(4);
double selec;
double selec_inner;
VariableStatData vardata1;
VariableStatData vardata2;
double nd1;
double nd2;
bool isdefault1;
bool isdefault2;
Oid opfuncoid;
AttStatsSlot sslot1;
AttStatsSlot sslot2;
Form_pg_statistic stats1 = NULL;
Form_pg_statistic stats2 = NULL;
bool have_mcvs1 = false;
bool have_mcvs2 = false;
bool join_is_reversed;
RelOptInfo *inner_rel;
get_join_variables(root, args, sjinfo,
&vardata1, &vardata2, &join_is_reversed);
nd1 = get_variable_numdistinct(&vardata1, &isdefault1);
nd2 = get_variable_numdistinct(&vardata2, &isdefault2);
opfuncoid = get_opcode(operator);
memset(&sslot1, 0, sizeof(sslot1));
memset(&sslot2, 0, sizeof(sslot2));
if (HeapTupleIsValid(vardata1.statsTuple))
{
/* note we allow use of nullfrac regardless of security check */
stats1 = (Form_pg_statistic) GETSTRUCT(vardata1.statsTuple);
if (statistic_proc_security_check(&vardata1, opfuncoid))
have_mcvs1 = get_attstatsslot(&sslot1, vardata1.statsTuple,
STATISTIC_KIND_MCV, InvalidOid,
ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS);
}
if (HeapTupleIsValid(vardata2.statsTuple))
{
/* note we allow use of nullfrac regardless of security check */
stats2 = (Form_pg_statistic) GETSTRUCT(vardata2.statsTuple);
if (statistic_proc_security_check(&vardata2, opfuncoid))
have_mcvs2 = get_attstatsslot(&sslot2, vardata2.statsTuple,
STATISTIC_KIND_MCV, InvalidOid,
ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS);
}
/* We need to compute the inner-join selectivity in all cases */
selec_inner = eqjoinsel_inner(opfuncoid,
&vardata1, &vardata2,
nd1, nd2,
isdefault1, isdefault2,
&sslot1, &sslot2,
stats1, stats2,
have_mcvs1, have_mcvs2);
switch (sjinfo->jointype)
{
case JOIN_INNER:
case JOIN_LEFT:
case JOIN_FULL:
selec = selec_inner;
break;
case JOIN_SEMI:
case JOIN_ANTI:
/*
* Look up the join's inner relation. min_righthand is sufficient
* information because neither SEMI nor ANTI joins permit any
* reassociation into or out of their RHS, so the righthand will
* always be exactly that set of rels.
*/
inner_rel = find_join_input_rel(root, sjinfo->min_righthand);
if (!join_is_reversed)
selec = eqjoinsel_semi(opfuncoid,
&vardata1, &vardata2,
nd1, nd2,
isdefault1, isdefault2,
&sslot1, &sslot2,
stats1, stats2,
have_mcvs1, have_mcvs2,
inner_rel);
else
{
Oid commop = get_commutator(operator);
Oid commopfuncoid = OidIsValid(commop) ? get_opcode(commop) : InvalidOid;
selec = eqjoinsel_semi(commopfuncoid,
&vardata2, &vardata1,
nd2, nd1,
isdefault2, isdefault1,
&sslot2, &sslot1,
stats2, stats1,
have_mcvs2, have_mcvs1,
inner_rel);
}
/*
* We should never estimate the output of a semijoin to be more
* rows than we estimate for an inner join with the same input
* rels and join condition; it's obviously impossible for that to
* happen. The former estimate is N1 * Ssemi while the latter is
* N1 * N2 * Sinner, so we may clamp Ssemi <= N2 * Sinner. Doing
* this is worthwhile because of the shakier estimation rules we
* use in eqjoinsel_semi, particularly in cases where it has to
* punt entirely.
*/
selec = Min(selec, inner_rel->rows * selec_inner);
break;
default:
/* other values not expected here */
elog(ERROR, "unrecognized join type: %d",
(int) sjinfo->jointype);
selec = 0; /* keep compiler quiet */
break;
}
free_attstatsslot(&sslot1);
free_attstatsslot(&sslot2);
ReleaseVariableStats(vardata1);
ReleaseVariableStats(vardata2);
CLAMP_PROBABILITY(selec);
PG_RETURN_FLOAT8((float8) selec);
}
/*
* eqjoinsel_inner --- eqjoinsel for normal inner join
*
* We also use this for LEFT/FULL outer joins; it's not presently clear
* that it's worth trying to distinguish them here.
*/
static double
eqjoinsel_inner(Oid opfuncoid,
VariableStatData *vardata1, VariableStatData *vardata2,
double nd1, double nd2,
bool isdefault1, bool isdefault2,
AttStatsSlot *sslot1, AttStatsSlot *sslot2,
Form_pg_statistic stats1, Form_pg_statistic stats2,
bool have_mcvs1, bool have_mcvs2)
{
double selec;
if (have_mcvs1 && have_mcvs2)
{
/*
* We have most-common-value lists for both relations. Run through
* the lists to see which MCVs actually join to each other with the
* given operator. This allows us to determine the exact join
* selectivity for the portion of the relations represented by the MCV
* lists. We still have to estimate for the remaining population, but
* in a skewed distribution this gives us a big leg up in accuracy.
* For motivation see the analysis in Y. Ioannidis and S.
* Christodoulakis, "On the propagation of errors in the size of join
* results", Technical Report 1018, Computer Science Dept., University
* of Wisconsin, Madison, March 1991 (available from ftp.cs.wisc.edu).
*/
FmgrInfo eqproc;
bool *hasmatch1;
bool *hasmatch2;
double nullfrac1 = stats1->stanullfrac;
double nullfrac2 = stats2->stanullfrac;
double matchprodfreq,
matchfreq1,
matchfreq2,
unmatchfreq1,
unmatchfreq2,
otherfreq1,
otherfreq2,
totalsel1,
totalsel2;
int i,
nmatches;
fmgr_info(opfuncoid, &eqproc);
hasmatch1 = (bool *) palloc0(sslot1->nvalues * sizeof(bool));
hasmatch2 = (bool *) palloc0(sslot2->nvalues * sizeof(bool));
/*
* Note we assume that each MCV will match at most one member of the
* other MCV list. If the operator isn't really equality, there could
* be multiple matches --- but we don't look for them, both for speed
* and because the math wouldn't add up...
*/
matchprodfreq = 0.0;
nmatches = 0;
for (i = 0; i < sslot1->nvalues; i++)
{
int j;
for (j = 0; j < sslot2->nvalues; j++)
{
if (hasmatch2[j])
continue;
if (DatumGetBool(FunctionCall2Coll(&eqproc,
sslot1->stacoll,
sslot1->values[i],
sslot2->values[j])))
{
hasmatch1[i] = hasmatch2[j] = true;
matchprodfreq += sslot1->numbers[i] * sslot2->numbers[j];
nmatches++;
break;
}
}
}
CLAMP_PROBABILITY(matchprodfreq);
/* Sum up frequencies of matched and unmatched MCVs */
matchfreq1 = unmatchfreq1 = 0.0;
for (i = 0; i < sslot1->nvalues; i++)
{
if (hasmatch1[i])
matchfreq1 += sslot1->numbers[i];
else
unmatchfreq1 += sslot1->numbers[i];
}
CLAMP_PROBABILITY(matchfreq1);
CLAMP_PROBABILITY(unmatchfreq1);
matchfreq2 = unmatchfreq2 = 0.0;
for (i = 0; i < sslot2->nvalues; i++)
{
if (hasmatch2[i])
matchfreq2 += sslot2->numbers[i];
else
unmatchfreq2 += sslot2->numbers[i];
}
CLAMP_PROBABILITY(matchfreq2);
CLAMP_PROBABILITY(unmatchfreq2);
pfree(hasmatch1);
pfree(hasmatch2);
/*
* Compute total frequency of non-null values that are not in the MCV
* lists.
*/
otherfreq1 = 1.0 - nullfrac1 - matchfreq1 - unmatchfreq1;
otherfreq2 = 1.0 - nullfrac2 - matchfreq2 - unmatchfreq2;
CLAMP_PROBABILITY(otherfreq1);
CLAMP_PROBABILITY(otherfreq2);
/*
* We can estimate the total selectivity from the point of view of
* relation 1 as: the known selectivity for matched MCVs, plus
* unmatched MCVs that are assumed to match against random members of
* relation 2's non-MCV population, plus non-MCV values that are
* assumed to match against random members of relation 2's unmatched
* MCVs plus non-MCV values.
*/
totalsel1 = matchprodfreq;
if (nd2 > sslot2->nvalues)
totalsel1 += unmatchfreq1 * otherfreq2 / (nd2 - sslot2->nvalues);
if (nd2 > nmatches)
totalsel1 += otherfreq1 * (otherfreq2 + unmatchfreq2) /
(nd2 - nmatches);
/* Same estimate from the point of view of relation 2. */
totalsel2 = matchprodfreq;
if (nd1 > sslot1->nvalues)
totalsel2 += unmatchfreq2 * otherfreq1 / (nd1 - sslot1->nvalues);
if (nd1 > nmatches)
totalsel2 += otherfreq2 * (otherfreq1 + unmatchfreq1) /
(nd1 - nmatches);
/*
* Use the smaller of the two estimates. This can be justified in
* essentially the same terms as given below for the no-stats case: to
* a first approximation, we are estimating from the point of view of
* the relation with smaller nd.
*/
selec = (totalsel1 < totalsel2) ? totalsel1 : totalsel2;
}
else
{
/*
* We do not have MCV lists for both sides. Estimate the join
* selectivity as MIN(1/nd1,1/nd2)*(1-nullfrac1)*(1-nullfrac2). This
* is plausible if we assume that the join operator is strict and the
* non-null values are about equally distributed: a given non-null
* tuple of rel1 will join to either zero or N2*(1-nullfrac2)/nd2 rows
* of rel2, so total join rows are at most
* N1*(1-nullfrac1)*N2*(1-nullfrac2)/nd2 giving a join selectivity of
* not more than (1-nullfrac1)*(1-nullfrac2)/nd2. By the same logic it
* is not more than (1-nullfrac1)*(1-nullfrac2)/nd1, so the expression
* with MIN() is an upper bound. Using the MIN() means we estimate
* from the point of view of the relation with smaller nd (since the
* larger nd is determining the MIN). It is reasonable to assume that
* most tuples in this rel will have join partners, so the bound is
* probably reasonably tight and should be taken as-is.
*
* XXX Can we be smarter if we have an MCV list for just one side? It
* seems that if we assume equal distribution for the other side, we
* end up with the same answer anyway.
*/
double nullfrac1 = stats1 ? stats1->stanullfrac : 0.0;
double nullfrac2 = stats2 ? stats2->stanullfrac : 0.0;
selec = (1.0 - nullfrac1) * (1.0 - nullfrac2);
if (nd1 > nd2)
selec /= nd1;
else
selec /= nd2;
}
return selec;
}
/*
* eqjoinsel_semi --- eqjoinsel for semi join
*
* (Also used for anti join, which we are supposed to estimate the same way.)
* Caller has ensured that vardata1 is the LHS variable.
* Unlike eqjoinsel_inner, we have to cope with opfuncoid being InvalidOid.
*/
static double
eqjoinsel_semi(Oid opfuncoid,
VariableStatData *vardata1, VariableStatData *vardata2,
double nd1, double nd2,
bool isdefault1, bool isdefault2,
AttStatsSlot *sslot1, AttStatsSlot *sslot2,
Form_pg_statistic stats1, Form_pg_statistic stats2,
bool have_mcvs1, bool have_mcvs2,
RelOptInfo *inner_rel)
{
double selec;
/*
* We clamp nd2 to be not more than what we estimate the inner relation's
* size to be. This is intuitively somewhat reasonable since obviously
* there can't be more than that many distinct values coming from the
* inner rel. The reason for the asymmetry (ie, that we don't clamp nd1
* likewise) is that this is the only pathway by which restriction clauses
* applied to the inner rel will affect the join result size estimate,
* since set_joinrel_size_estimates will multiply SEMI/ANTI selectivity by
* only the outer rel's size. If we clamped nd1 we'd be double-counting
* the selectivity of outer-rel restrictions.
*
* We can apply this clamping both with respect to the base relation from
* which the join variable comes (if there is just one), and to the
* immediate inner input relation of the current join.
*
* If we clamp, we can treat nd2 as being a non-default estimate; it's not
* great, maybe, but it didn't come out of nowhere either. This is most
* helpful when the inner relation is empty and consequently has no stats.
*/
if (vardata2->rel)
{
if (nd2 >= vardata2->rel->rows)
{
nd2 = vardata2->rel->rows;
isdefault2 = false;
}
}
if (nd2 >= inner_rel->rows)
{
nd2 = inner_rel->rows;
isdefault2 = false;
}
if (have_mcvs1 && have_mcvs2 && OidIsValid(opfuncoid))
{
/*
* We have most-common-value lists for both relations. Run through
* the lists to see which MCVs actually join to each other with the
* given operator. This allows us to determine the exact join
* selectivity for the portion of the relations represented by the MCV
* lists. We still have to estimate for the remaining population, but
* in a skewed distribution this gives us a big leg up in accuracy.
*/
FmgrInfo eqproc;
bool *hasmatch1;
bool *hasmatch2;
double nullfrac1 = stats1->stanullfrac;
double matchfreq1,
uncertainfrac,
uncertain;
int i,
nmatches,
clamped_nvalues2;
/*
* The clamping above could have resulted in nd2 being less than
* sslot2->nvalues; in which case, we assume that precisely the nd2
* most common values in the relation will appear in the join input,
* and so compare to only the first nd2 members of the MCV list. Of
* course this is frequently wrong, but it's the best bet we can make.
*/
clamped_nvalues2 = Min(sslot2->nvalues, nd2);
fmgr_info(opfuncoid, &eqproc);
hasmatch1 = (bool *) palloc0(sslot1->nvalues * sizeof(bool));
hasmatch2 = (bool *) palloc0(clamped_nvalues2 * sizeof(bool));
/*
* Note we assume that each MCV will match at most one member of the
* other MCV list. If the operator isn't really equality, there could
* be multiple matches --- but we don't look for them, both for speed
* and because the math wouldn't add up...
*/
nmatches = 0;
for (i = 0; i < sslot1->nvalues; i++)
{
int j;
for (j = 0; j < clamped_nvalues2; j++)
{
if (hasmatch2[j])
continue;
if (DatumGetBool(FunctionCall2Coll(&eqproc,
sslot1->stacoll,
sslot1->values[i],
sslot2->values[j])))
{
hasmatch1[i] = hasmatch2[j] = true;
nmatches++;
break;
}
}
}
/* Sum up frequencies of matched MCVs */
matchfreq1 = 0.0;
for (i = 0; i < sslot1->nvalues; i++)
{
if (hasmatch1[i])
matchfreq1 += sslot1->numbers[i];
}
CLAMP_PROBABILITY(matchfreq1);
pfree(hasmatch1);
pfree(hasmatch2);
/*
* Now we need to estimate the fraction of relation 1 that has at
* least one join partner. We know for certain that the matched MCVs
* do, so that gives us a lower bound, but we're really in the dark
* about everything else. Our crude approach is: if nd1 <= nd2 then
* assume all non-null rel1 rows have join partners, else assume for
* the uncertain rows that a fraction nd2/nd1 have join partners. We
* can discount the known-matched MCVs from the distinct-values counts
* before doing the division.
*
* Crude as the above is, it's completely useless if we don't have
* reliable ndistinct values for both sides. Hence, if either nd1 or
* nd2 is default, punt and assume half of the uncertain rows have
* join partners.
*/
if (!isdefault1 && !isdefault2)
{
nd1 -= nmatches;
nd2 -= nmatches;
if (nd1 <= nd2 || nd2 < 0)
uncertainfrac = 1.0;
else
uncertainfrac = nd2 / nd1;
}
else
uncertainfrac = 0.5;
uncertain = 1.0 - matchfreq1 - nullfrac1;
CLAMP_PROBABILITY(uncertain);
selec = matchfreq1 + uncertainfrac * uncertain;
}
else
{
/*
* Without MCV lists for both sides, we can only use the heuristic
* about nd1 vs nd2.
*/
double nullfrac1 = stats1 ? stats1->stanullfrac : 0.0;
if (!isdefault1 && !isdefault2)
{
if (nd1 <= nd2 || nd2 < 0)
selec = 1.0 - nullfrac1;
else
selec = (nd2 / nd1) * (1.0 - nullfrac1);
}
else
selec = 0.5 * (1.0 - nullfrac1);
}
return selec;
}
/*
* neqjoinsel - Join selectivity of "!="
*/
Datum
neqjoinsel(PG_FUNCTION_ARGS)
{
PlannerInfo *root = (PlannerInfo *) PG_GETARG_POINTER(0);
Oid operator = PG_GETARG_OID(1);
List *args = (List *) PG_GETARG_POINTER(2);
JoinType jointype = (JoinType) PG_GETARG_INT16(3);
SpecialJoinInfo *sjinfo = (SpecialJoinInfo *) PG_GETARG_POINTER(4);
float8 result;
if (jointype == JOIN_SEMI || jointype == JOIN_ANTI)
{
/*
* For semi-joins, if there is more than one distinct value in the RHS
* relation then every non-null LHS row must find a row to join since
* it can only be equal to one of them. We'll assume that there is
* always more than one distinct RHS value for the sake of stability,
* though in theory we could have special cases for empty RHS
* (selectivity = 0) and single-distinct-value RHS (selectivity =
* fraction of LHS that has the same value as the single RHS value).
*
* For anti-joins, if we use the same assumption that there is more
* than one distinct key in the RHS relation, then every non-null LHS
* row must be suppressed by the anti-join.
*
* So either way, the selectivity estimate should be 1 - nullfrac.
*/
VariableStatData leftvar;
VariableStatData rightvar;
bool reversed;
HeapTuple statsTuple;
double nullfrac;
get_join_variables(root, args, sjinfo, &leftvar, &rightvar, &reversed);
statsTuple = reversed ? rightvar.statsTuple : leftvar.statsTuple;
if (HeapTupleIsValid(statsTuple))
nullfrac = ((Form_pg_statistic) GETSTRUCT(statsTuple))->stanullfrac;
else
nullfrac = 0.0;
ReleaseVariableStats(leftvar);
ReleaseVariableStats(rightvar);
result = 1.0 - nullfrac;
}
else
{
/*
* We want 1 - eqjoinsel() where the equality operator is the one
* associated with this != operator, that is, its negator.
*/
Oid eqop = get_negator(operator);
if (eqop)
{
result = DatumGetFloat8(DirectFunctionCall5(eqjoinsel,
PointerGetDatum(root),
ObjectIdGetDatum(eqop),
PointerGetDatum(args),
Int16GetDatum(jointype),
PointerGetDatum(sjinfo)));
}
else
{
/* Use default selectivity (should we raise an error instead?) */
result = DEFAULT_EQ_SEL;
}
result = 1.0 - result;
}
PG_RETURN_FLOAT8(result);
}
/*
* scalarltjoinsel - Join selectivity of "<" for scalars
*/
Datum
scalarltjoinsel(PG_FUNCTION_ARGS)
{
PG_RETURN_FLOAT8(DEFAULT_INEQ_SEL);
}
/*
* scalarlejoinsel - Join selectivity of "<=" for scalars
*/
Datum
scalarlejoinsel(PG_FUNCTION_ARGS)
{
PG_RETURN_FLOAT8(DEFAULT_INEQ_SEL);
}
/*
* scalargtjoinsel - Join selectivity of ">" for scalars
*/
Datum
scalargtjoinsel(PG_FUNCTION_ARGS)
{
PG_RETURN_FLOAT8(DEFAULT_INEQ_SEL);
}
/*
* scalargejoinsel - Join selectivity of ">=" for scalars
*/
Datum
scalargejoinsel(PG_FUNCTION_ARGS)
{
PG_RETURN_FLOAT8(DEFAULT_INEQ_SEL);
}
/*
* mergejoinscansel - Scan selectivity of merge join.
*
* A merge join will stop as soon as it exhausts either input stream.
* Therefore, if we can estimate the ranges of both input variables,
* we can estimate how much of the input will actually be read. This
* can have a considerable impact on the cost when using indexscans.
*
* Also, we can estimate how much of each input has to be read before the
* first join pair is found, which will affect the join's startup time.
*
* clause should be a clause already known to be mergejoinable. opfamily,
* strategy, and nulls_first specify the sort ordering being used.
*
* The outputs are:
* *leftstart is set to the fraction of the left-hand variable expected
* to be scanned before the first join pair is found (0 to 1).
* *leftend is set to the fraction of the left-hand variable expected
* to be scanned before the join terminates (0 to 1).
* *rightstart, *rightend similarly for the right-hand variable.
*/
void
mergejoinscansel(PlannerInfo *root, Node *clause,
Oid opfamily, int strategy, bool nulls_first,
Selectivity *leftstart, Selectivity *leftend,
Selectivity *rightstart, Selectivity *rightend)
{
Node *left,
*right;
VariableStatData leftvar,
rightvar;
int op_strategy;
Oid op_lefttype;
Oid op_righttype;
Oid opno,
lsortop,
rsortop,
lstatop,
rstatop,
ltop,
leop,
revltop,
revleop;
bool isgt;
Datum leftmin,
leftmax,
rightmin,
rightmax;
double selec;
/* Set default results if we can't figure anything out. */
/* XXX should default "start" fraction be a bit more than 0? */
*leftstart = *rightstart = 0.0;
*leftend = *rightend = 1.0;
/* Deconstruct the merge clause */
if (!is_opclause(clause))
return; /* shouldn't happen */
opno = ((OpExpr *) clause)->opno;
left = get_leftop((Expr *) clause);
right = get_rightop((Expr *) clause);
if (!right)
return; /* shouldn't happen */
/* Look for stats for the inputs */
examine_variable(root, left, 0, &leftvar);
examine_variable(root, right, 0, &rightvar);
/* Extract the operator's declared left/right datatypes */
get_op_opfamily_properties(opno, opfamily, false,
&op_strategy,
&op_lefttype,
&op_righttype);
Assert(op_strategy == BTEqualStrategyNumber);
/*
* Look up the various operators we need. If we don't find them all, it
* probably means the opfamily is broken, but we just fail silently.
*
* Note: we expect that pg_statistic histograms will be sorted by the '<'
* operator, regardless of which sort direction we are considering.
*/
switch (strategy)
{
case BTLessStrategyNumber:
isgt = false;
if (op_lefttype == op_righttype)
{
/* easy case */
ltop = get_opfamily_member(opfamily,
op_lefttype, op_righttype,
BTLessStrategyNumber);
leop = get_opfamily_member(opfamily,
op_lefttype, op_righttype,
BTLessEqualStrategyNumber);
lsortop = ltop;
rsortop = ltop;
lstatop = lsortop;
rstatop = rsortop;
revltop = ltop;
revleop = leop;
}
else
{
ltop = get_opfamily_member(opfamily,
op_lefttype, op_righttype,
BTLessStrategyNumber);
leop = get_opfamily_member(opfamily,
op_lefttype, op_righttype,
BTLessEqualStrategyNumber);
lsortop = get_opfamily_member(opfamily,
op_lefttype, op_lefttype,
BTLessStrategyNumber);
rsortop = get_opfamily_member(opfamily,
op_righttype, op_righttype,
BTLessStrategyNumber);
lstatop = lsortop;
rstatop = rsortop;
revltop = get_opfamily_member(opfamily,
op_righttype, op_lefttype,
BTLessStrategyNumber);
revleop = get_opfamily_member(opfamily,
op_righttype, op_lefttype,
BTLessEqualStrategyNumber);
}
break;
case BTGreaterStrategyNumber:
/* descending-order case */
isgt = true;
if (op_lefttype == op_righttype)
{
/* easy case */
ltop = get_opfamily_member(opfamily,
op_lefttype, op_righttype,
BTGreaterStrategyNumber);
leop = get_opfamily_member(opfamily,
op_lefttype, op_righttype,
BTGreaterEqualStrategyNumber);
lsortop = ltop;
rsortop = ltop;
lstatop = get_opfamily_member(opfamily,
op_lefttype, op_lefttype,
BTLessStrategyNumber);
rstatop = lstatop;
revltop = ltop;
revleop = leop;
}
else
{
ltop = get_opfamily_member(opfamily,
op_lefttype, op_righttype,
BTGreaterStrategyNumber);
leop = get_opfamily_member(opfamily,
op_lefttype, op_righttype,
BTGreaterEqualStrategyNumber);
lsortop = get_opfamily_member(opfamily,
op_lefttype, op_lefttype,
BTGreaterStrategyNumber);
rsortop = get_opfamily_member(opfamily,
op_righttype, op_righttype,
BTGreaterStrategyNumber);
lstatop = get_opfamily_member(opfamily,
op_lefttype, op_lefttype,
BTLessStrategyNumber);
rstatop = get_opfamily_member(opfamily,
op_righttype, op_righttype,
BTLessStrategyNumber);
revltop = get_opfamily_member(opfamily,
op_righttype, op_lefttype,
BTGreaterStrategyNumber);
revleop = get_opfamily_member(opfamily,
op_righttype, op_lefttype,
BTGreaterEqualStrategyNumber);
}
break;
default:
goto fail; /* shouldn't get here */
}
if (!OidIsValid(lsortop) ||
!OidIsValid(rsortop) ||
!OidIsValid(lstatop) ||
!OidIsValid(rstatop) ||
!OidIsValid(ltop) ||
!OidIsValid(leop) ||
!OidIsValid(revltop) ||
!OidIsValid(revleop))
goto fail; /* insufficient info in catalogs */
/* Try to get ranges of both inputs */
if (!isgt)
{
if (!get_variable_range(root, &leftvar, lstatop,
&leftmin, &leftmax))
goto fail; /* no range available from stats */
if (!get_variable_range(root, &rightvar, rstatop,
&rightmin, &rightmax))
goto fail; /* no range available from stats */
}
else
{
/* need to swap the max and min */
if (!get_variable_range(root, &leftvar, lstatop,
&leftmax, &leftmin))
goto fail; /* no range available from stats */
if (!get_variable_range(root, &rightvar, rstatop,
&rightmax, &rightmin))
goto fail; /* no range available from stats */
}
/*
* Now, the fraction of the left variable that will be scanned is the
* fraction that's <= the right-side maximum value. But only believe
* non-default estimates, else stick with our 1.0.
*/
selec = scalarineqsel(root, leop, isgt, true, &leftvar,
rightmax, op_righttype);
if (selec != DEFAULT_INEQ_SEL)
*leftend = selec;
/* And similarly for the right variable. */
selec = scalarineqsel(root, revleop, isgt, true, &rightvar,
leftmax, op_lefttype);
if (selec != DEFAULT_INEQ_SEL)
*rightend = selec;
/*
* Only one of the two "end" fractions can really be less than 1.0;
* believe the smaller estimate and reset the other one to exactly 1.0. If
* we get exactly equal estimates (as can easily happen with self-joins),
* believe neither.
*/
if (*leftend > *rightend)
*leftend = 1.0;
else if (*leftend < *rightend)
*rightend = 1.0;
else
*leftend = *rightend = 1.0;
/*
* Also, the fraction of the left variable that will be scanned before the
* first join pair is found is the fraction that's < the right-side
* minimum value. But only believe non-default estimates, else stick with
* our own default.
*/
selec = scalarineqsel(root, ltop, isgt, false, &leftvar,
rightmin, op_righttype);
if (selec != DEFAULT_INEQ_SEL)
*leftstart = selec;
/* And similarly for the right variable. */
selec = scalarineqsel(root, revltop, isgt, false, &rightvar,
leftmin, op_lefttype);
if (selec != DEFAULT_INEQ_SEL)
*rightstart = selec;
/*
* Only one of the two "start" fractions can really be more than zero;
* believe the larger estimate and reset the other one to exactly 0.0. If
* we get exactly equal estimates (as can easily happen with self-joins),
* believe neither.
*/
if (*leftstart < *rightstart)
*leftstart = 0.0;
else if (*leftstart > *rightstart)
*rightstart = 0.0;
else
*leftstart = *rightstart = 0.0;
/*
* If the sort order is nulls-first, we're going to have to skip over any
* nulls too. These would not have been counted by scalarineqsel, and we
* can safely add in this fraction regardless of whether we believe
* scalarineqsel's results or not. But be sure to clamp the sum to 1.0!
*/
if (nulls_first)
{
Form_pg_statistic stats;
if (HeapTupleIsValid(leftvar.statsTuple))
{
stats = (Form_pg_statistic) GETSTRUCT(leftvar.statsTuple);
*leftstart += stats->stanullfrac;
CLAMP_PROBABILITY(*leftstart);
*leftend += stats->stanullfrac;
CLAMP_PROBABILITY(*leftend);
}
if (HeapTupleIsValid(rightvar.statsTuple))
{
stats = (Form_pg_statistic) GETSTRUCT(rightvar.statsTuple);
*rightstart += stats->stanullfrac;
CLAMP_PROBABILITY(*rightstart);
*rightend += stats->stanullfrac;
CLAMP_PROBABILITY(*rightend);
}
}
/* Disbelieve start >= end, just in case that can happen */
if (*leftstart >= *leftend)
{
*leftstart = 0.0;
*leftend = 1.0;
}
if (*rightstart >= *rightend)
{
*rightstart = 0.0;
*rightend = 1.0;
}
fail:
ReleaseVariableStats(leftvar);
ReleaseVariableStats(rightvar);
}
/*
* Helper routine for estimate_num_groups: add an item to a list of
* GroupVarInfos, but only if it's not known equal to any of the existing
* entries.
*/
typedef struct
{
Node *var; /* might be an expression, not just a Var */
RelOptInfo *rel; /* relation it belongs to */
double ndistinct; /* # distinct values */
} GroupVarInfo;
static List *
add_unique_group_var(PlannerInfo *root, List *varinfos,
Node *var, VariableStatData *vardata)
{
GroupVarInfo *varinfo;
double ndistinct;
bool isdefault;
ListCell *lc;
ndistinct = get_variable_numdistinct(vardata, &isdefault);
/* cannot use foreach here because of possible list_delete */
lc = list_head(varinfos);
while (lc)
{
varinfo = (GroupVarInfo *) lfirst(lc);
/* must advance lc before list_delete possibly pfree's it */
lc = lnext(lc);
/* Drop exact duplicates */
if (equal(var, varinfo->var))
return varinfos;
/*
* Drop known-equal vars, but only if they belong to different
* relations (see comments for estimate_num_groups)
*/
if (vardata->rel != varinfo->rel &&
exprs_known_equal(root, var, varinfo->var))
{
if (varinfo->ndistinct <= ndistinct)
{
/* Keep older item, forget new one */
return varinfos;
}
else
{
/* Delete the older item */
varinfos = list_delete_ptr(varinfos, varinfo);
}
}
}
varinfo = (GroupVarInfo *) palloc(sizeof(GroupVarInfo));
varinfo->var = var;
varinfo->rel = vardata->rel;
varinfo->ndistinct = ndistinct;
varinfos = lappend(varinfos, varinfo);
return varinfos;
}
/*
* estimate_num_groups - Estimate number of groups in a grouped query
*
* Given a query having a GROUP BY clause, estimate how many groups there
* will be --- ie, the number of distinct combinations of the GROUP BY
* expressions.
*
* This routine is also used to estimate the number of rows emitted by
* a DISTINCT filtering step; that is an isomorphic problem. (Note:
* actually, we only use it for DISTINCT when there's no grouping or
* aggregation ahead of the DISTINCT.)
*
* Inputs:
* root - the query
* groupExprs - list of expressions being grouped by
* input_rows - number of rows estimated to arrive at the group/unique
* filter step
* pgset - NULL, or a List** pointing to a grouping set to filter the
* groupExprs against
*
* Given the lack of any cross-correlation statistics in the system, it's
* impossible to do anything really trustworthy with GROUP BY conditions
* involving multiple Vars. We should however avoid assuming the worst
* case (all possible cross-product terms actually appear as groups) since
* very often the grouped-by Vars are highly correlated. Our current approach
* is as follows:
* 1. Expressions yielding boolean are assumed to contribute two groups,
* independently of their content, and are ignored in the subsequent
* steps. This is mainly because tests like "col IS NULL" break the
* heuristic used in step 2 especially badly.
* 2. Reduce the given expressions to a list of unique Vars used. For
* example, GROUP BY a, a + b is treated the same as GROUP BY a, b.
* It is clearly correct not to count the same Var more than once.
* It is also reasonable to treat f(x) the same as x: f() cannot
* increase the number of distinct values (unless it is volatile,
* which we consider unlikely for grouping), but it probably won't
* reduce the number of distinct values much either.
* As a special case, if a GROUP BY expression can be matched to an
* expressional index for which we have statistics, then we treat the
* whole expression as though it were just a Var.
* 3. If the list contains Vars of different relations that are known equal
* due to equivalence classes, then drop all but one of the Vars from each
* known-equal set, keeping the one with smallest estimated # of values
* (since the extra values of the others can't appear in joined rows).
* Note the reason we only consider Vars of different relations is that
* if we considered ones of the same rel, we'd be double-counting the
* restriction selectivity of the equality in the next step.
* 4. For Vars within a single source rel, we multiply together the numbers
* of values, clamp to the number of rows in the rel (divided by 10 if
* more than one Var), and then multiply by a factor based on the
* selectivity of the restriction clauses for that rel. When there's
* more than one Var, the initial product is probably too high (it's the
* worst case) but clamping to a fraction of the rel's rows seems to be a
* helpful heuristic for not letting the estimate get out of hand. (The
* factor of 10 is derived from pre-Postgres-7.4 practice.) The factor
* we multiply by to adjust for the restriction selectivity assumes that
* the restriction clauses are independent of the grouping, which may not
* be a valid assumption, but it's hard to do better.
* 5. If there are Vars from multiple rels, we repeat step 4 for each such
* rel, and multiply the results together.
* Note that rels not containing grouped Vars are ignored completely, as are
* join clauses. Such rels cannot increase the number of groups, and we
* assume such clauses do not reduce the number either (somewhat bogus,
* but we don't have the info to do better).
*/
double
estimate_num_groups(PlannerInfo *root, List *groupExprs, double input_rows,
List **pgset)
{
List *varinfos = NIL;
double srf_multiplier = 1.0;
double numdistinct;
ListCell *l;
int i;
/*
* We don't ever want to return an estimate of zero groups, as that tends
* to lead to division-by-zero and other unpleasantness. The input_rows
* estimate is usually already at least 1, but clamp it just in case it
* isn't.
*/
input_rows = clamp_row_est(input_rows);
/*
* If no grouping columns, there's exactly one group. (This can't happen
* for normal cases with GROUP BY or DISTINCT, but it is possible for
* corner cases with set operations.)
*/
if (groupExprs == NIL || (pgset && list_length(*pgset) < 1))
return 1.0;
/*
* Count groups derived from boolean grouping expressions. For other
* expressions, find the unique Vars used, treating an expression as a Var
* if we can find stats for it. For each one, record the statistical
* estimate of number of distinct values (total in its table, without
* regard for filtering).
*/
numdistinct = 1.0;
i = 0;
foreach(l, groupExprs)
{
Node *groupexpr = (Node *) lfirst(l);
double this_srf_multiplier;
VariableStatData vardata;
List *varshere;
ListCell *l2;
/* is expression in this grouping set? */
if (pgset && !list_member_int(*pgset, i++))
continue;
/*
* Set-returning functions in grouping columns are a bit problematic.
* The code below will effectively ignore their SRF nature and come up
* with a numdistinct estimate as though they were scalar functions.
* We compensate by scaling up the end result by the largest SRF
* rowcount estimate. (This will be an overestimate if the SRF
* produces multiple copies of any output value, but it seems best to
* assume the SRF's outputs are distinct. In any case, it's probably
* pointless to worry too much about this without much better
* estimates for SRF output rowcounts than we have today.)
*/
this_srf_multiplier = expression_returns_set_rows(root, groupexpr);
if (srf_multiplier < this_srf_multiplier)
srf_multiplier = this_srf_multiplier;
/* Short-circuit for expressions returning boolean */
if (exprType(groupexpr) == BOOLOID)
{
numdistinct *= 2.0;
continue;
}
/*
* If examine_variable is able to deduce anything about the GROUP BY
* expression, treat it as a single variable even if it's really more
* complicated.
*/
examine_variable(root, groupexpr, 0, &vardata);
if (HeapTupleIsValid(vardata.statsTuple) || vardata.isunique)
{
varinfos = add_unique_group_var(root, varinfos,
groupexpr, &vardata);
ReleaseVariableStats(vardata);
continue;
}
ReleaseVariableStats(vardata);
/*
* Else pull out the component Vars. Handle PlaceHolderVars by
* recursing into their arguments (effectively assuming that the
* PlaceHolderVar doesn't change the number of groups, which boils
* down to ignoring the possible addition of nulls to the result set).
*/
varshere = pull_var_clause(groupexpr,
PVC_RECURSE_AGGREGATES |
PVC_RECURSE_WINDOWFUNCS |
PVC_RECURSE_PLACEHOLDERS);
/*
* If we find any variable-free GROUP BY item, then either it is a
* constant (and we can ignore it) or it contains a volatile function;
* in the latter case we punt and assume that each input row will
* yield a distinct group.
*/
if (varshere == NIL)
{
if (contain_volatile_functions(groupexpr))
return input_rows;
continue;
}
/*
* Else add variables to varinfos list
*/
foreach(l2, varshere)
{
Node *var = (Node *) lfirst(l2);
examine_variable(root, var, 0, &vardata);
varinfos = add_unique_group_var(root, varinfos, var, &vardata);
ReleaseVariableStats(vardata);
}
}
/*
* If now no Vars, we must have an all-constant or all-boolean GROUP BY
* list.
*/
if (varinfos == NIL)
{
/* Apply SRF multiplier as we would do in the long path */
numdistinct *= srf_multiplier;
/* Round off */
numdistinct = ceil(numdistinct);
/* Guard against out-of-range answers */
if (numdistinct > input_rows)
numdistinct = input_rows;
if (numdistinct < 1.0)
numdistinct = 1.0;
return numdistinct;
}
/*
* Group Vars by relation and estimate total numdistinct.
*
* For each iteration of the outer loop, we process the frontmost Var in
* varinfos, plus all other Vars in the same relation. We remove these
* Vars from the newvarinfos list for the next iteration. This is the
* easiest way to group Vars of same rel together.
*/
do
{
GroupVarInfo *varinfo1 = (GroupVarInfo *) linitial(varinfos);
RelOptInfo *rel = varinfo1->rel;
double reldistinct = 1;
double relmaxndistinct = reldistinct;
int relvarcount = 0;
List *newvarinfos = NIL;
List *relvarinfos = NIL;
/*
* Split the list of varinfos in two - one for the current rel, one
* for remaining Vars on other rels.
*/
relvarinfos = lcons(varinfo1, relvarinfos);
for_each_cell(l, lnext(list_head(varinfos)))
{
GroupVarInfo *varinfo2 = (GroupVarInfo *) lfirst(l);
if (varinfo2->rel == varinfo1->rel)
{
/* varinfos on current rel */
relvarinfos = lcons(varinfo2, relvarinfos);
}
else
{
/* not time to process varinfo2 yet */
newvarinfos = lcons(varinfo2, newvarinfos);
}
}
/*
* Get the numdistinct estimate for the Vars of this rel. We
* iteratively search for multivariate n-distinct with maximum number
* of vars; assuming that each var group is independent of the others,
* we multiply them together. Any remaining relvarinfos after no more
* multivariate matches are found are assumed independent too, so
* their individual ndistinct estimates are multiplied also.
*
* While iterating, count how many separate numdistinct values we
* apply. We apply a fudge factor below, but only if we multiplied
* more than one such values.
*/
while (relvarinfos)
{
double mvndistinct;
if (estimate_multivariate_ndistinct(root, rel, &relvarinfos,
&mvndistinct))
{
reldistinct *= mvndistinct;
if (relmaxndistinct < mvndistinct)
relmaxndistinct = mvndistinct;
relvarcount++;
}
else
{
foreach(l, relvarinfos)
{
GroupVarInfo *varinfo2 = (GroupVarInfo *) lfirst(l);
reldistinct *= varinfo2->ndistinct;
if (relmaxndistinct < varinfo2->ndistinct)
relmaxndistinct = varinfo2->ndistinct;
relvarcount++;
}
/* we're done with this relation */
relvarinfos = NIL;
}
}
/*
* Sanity check --- don't divide by zero if empty relation.
*/
Assert(IS_SIMPLE_REL(rel));
if (rel->tuples > 0)
{
/*
* Clamp to size of rel, or size of rel / 10 if multiple Vars. The
* fudge factor is because the Vars are probably correlated but we
* don't know by how much. We should never clamp to less than the
* largest ndistinct value for any of the Vars, though, since
* there will surely be at least that many groups.
*/
double clamp = rel->tuples;
if (relvarcount > 1)
{
clamp *= 0.1;
if (clamp < relmaxndistinct)
{
clamp = relmaxndistinct;
/* for sanity in case some ndistinct is too large: */
if (clamp > rel->tuples)
clamp = rel->tuples;
}
}
if (reldistinct > clamp)
reldistinct = clamp;
/*
* Update the estimate based on the restriction selectivity,
* guarding against division by zero when reldistinct is zero.
* Also skip this if we know that we are returning all rows.
*/
if (reldistinct > 0 && rel->rows < rel->tuples)
{
/*
* Given a table containing N rows with n distinct values in a
* uniform distribution, if we select p rows at random then
* the expected number of distinct values selected is
*
* n * (1 - product((N-N/n-i)/(N-i), i=0..p-1))
*
* = n * (1 - (N-N/n)! / (N-N/n-p)! * (N-p)! / N!)
*
* See "Approximating block accesses in database
* organizations", S. B. Yao, Communications of the ACM,
* Volume 20 Issue 4, April 1977 Pages 260-261.
*
* Alternatively, re-arranging the terms from the factorials,
* this may be written as
*
* n * (1 - product((N-p-i)/(N-i), i=0..N/n-1))
*
* This form of the formula is more efficient to compute in
* the common case where p is larger than N/n. Additionally,
* as pointed out by Dell'Era, if i << N for all terms in the
* product, it can be approximated by
*
* n * (1 - ((N-p)/N)^(N/n))
*
* See "Expected distinct values when selecting from a bag
* without replacement", Alberto Dell'Era,
* http://www.adellera.it/investigations/distinct_balls/.
*
* The condition i << N is equivalent to n >> 1, so this is a
* good approximation when the number of distinct values in
* the table is large. It turns out that this formula also
* works well even when n is small.
*/
reldistinct *=
(1 - pow((rel->tuples - rel->rows) / rel->tuples,
rel->tuples / reldistinct));
}
reldistinct = clamp_row_est(reldistinct);
/*
* Update estimate of total distinct groups.
*/
numdistinct *= reldistinct;
}
varinfos = newvarinfos;
} while (varinfos != NIL);
/* Now we can account for the effects of any SRFs */
numdistinct *= srf_multiplier;
/* Round off */
numdistinct = ceil(numdistinct);
/* Guard against out-of-range answers */
if (numdistinct > input_rows)
numdistinct = input_rows;
if (numdistinct < 1.0)
numdistinct = 1.0;
return numdistinct;
}
/*
* Estimate hash bucket statistics when the specified expression is used
* as a hash key for the given number of buckets.
*
* This attempts to determine two values:
*
* 1. The frequency of the most common value of the expression (returns
* zero into *mcv_freq if we can't get that).
*
* 2. The "bucketsize fraction", ie, average number of entries in a bucket
* divided by total tuples in relation.
*
* XXX This is really pretty bogus since we're effectively assuming that the
* distribution of hash keys will be the same after applying restriction
* clauses as it was in the underlying relation. However, we are not nearly
* smart enough to figure out how the restrict clauses might change the
* distribution, so this will have to do for now.
*
* We are passed the number of buckets the executor will use for the given
* input relation. If the data were perfectly distributed, with the same
* number of tuples going into each available bucket, then the bucketsize
* fraction would be 1/nbuckets. But this happy state of affairs will occur
* only if (a) there are at least nbuckets distinct data values, and (b)
* we have a not-too-skewed data distribution. Otherwise the buckets will
* be nonuniformly occupied. If the other relation in the join has a key
* distribution similar to this one's, then the most-loaded buckets are
* exactly those that will be probed most often. Therefore, the "average"
* bucket size for costing purposes should really be taken as something close
* to the "worst case" bucket size. We try to estimate this by adjusting the
* fraction if there are too few distinct data values, and then scaling up
* by the ratio of the most common value's frequency to the average frequency.
*
* If no statistics are available, use a default estimate of 0.1. This will
* discourage use of a hash rather strongly if the inner relation is large,
* which is what we want. We do not want to hash unless we know that the
* inner rel is well-dispersed (or the alternatives seem much worse).
*
* The caller should also check that the mcv_freq is not so large that the
* most common value would by itself require an impractically large bucket.
* In a hash join, the executor can split buckets if they get too big, but
* obviously that doesn't help for a bucket that contains many duplicates of
* the same value.
*/
void
estimate_hash_bucket_stats(PlannerInfo *root, Node *hashkey, double nbuckets,
Selectivity *mcv_freq,
Selectivity *bucketsize_frac)
{
VariableStatData vardata;
double estfract,
ndistinct,
stanullfrac,
avgfreq;
bool isdefault;
AttStatsSlot sslot;
examine_variable(root, hashkey, 0, &vardata);
/* Look up the frequency of the most common value, if available */
*mcv_freq = 0.0;
if (HeapTupleIsValid(vardata.statsTuple))
{
if (get_attstatsslot(&sslot, vardata.statsTuple,
STATISTIC_KIND_MCV, InvalidOid,
ATTSTATSSLOT_NUMBERS))
{
/*
* The first MCV stat is for the most common value.
*/
if (sslot.nnumbers > 0)
*mcv_freq = sslot.numbers[0];
free_attstatsslot(&sslot);
}
}
/* Get number of distinct values */
ndistinct = get_variable_numdistinct(&vardata, &isdefault);
/*
* If ndistinct isn't real, punt. We normally return 0.1, but if the
* mcv_freq is known to be even higher than that, use it instead.
*/
if (isdefault)
{
*bucketsize_frac = (Selectivity) Max(0.1, *mcv_freq);
ReleaseVariableStats(vardata);
return;
}
/* Get fraction that are null */
if (HeapTupleIsValid(vardata.statsTuple))
{
Form_pg_statistic stats;
stats = (Form_pg_statistic) GETSTRUCT(vardata.statsTuple);
stanullfrac = stats->stanullfrac;
}
else
stanullfrac = 0.0;
/* Compute avg freq of all distinct data values in raw relation */
avgfreq = (1.0 - stanullfrac) / ndistinct;
/*
* Adjust ndistinct to account for restriction clauses. Observe we are
* assuming that the data distribution is affected uniformly by the
* restriction clauses!
*
* XXX Possibly better way, but much more expensive: multiply by
* selectivity of rel's restriction clauses that mention the target Var.
*/
if (vardata.rel && vardata.rel->tuples > 0)
{
ndistinct *= vardata.rel->rows / vardata.rel->tuples;
ndistinct = clamp_row_est(ndistinct);
}
/*
* Initial estimate of bucketsize fraction is 1/nbuckets as long as the
* number of buckets is less than the expected number of distinct values;
* otherwise it is 1/ndistinct.
*/
if (ndistinct > nbuckets)
estfract = 1.0 / nbuckets;
else
estfract = 1.0 / ndistinct;
/*
* Adjust estimated bucketsize upward to account for skewed distribution.
*/
if (avgfreq > 0.0 && *mcv_freq > avgfreq)
estfract *= *mcv_freq / avgfreq;
/*
* Clamp bucketsize to sane range (the above adjustment could easily
* produce an out-of-range result). We set the lower bound a little above
* zero, since zero isn't a very sane result.
*/
if (estfract < 1.0e-6)
estfract = 1.0e-6;
else if (estfract > 1.0)
estfract = 1.0;
*bucketsize_frac = (Selectivity) estfract;
ReleaseVariableStats(vardata);
}
/*
* estimate_hashagg_tablesize
* estimate the number of bytes that a hash aggregate hashtable will
* require based on the agg_costs, path width and number of groups.
*
* We return the result as "double" to forestall any possible overflow
* problem in the multiplication by dNumGroups.
*
* XXX this may be over-estimating the size now that hashagg knows to omit
* unneeded columns from the hashtable. Also for mixed-mode grouping sets,
* grouping columns not in the hashed set are counted here even though hashagg
* won't store them. Is this a problem?
*/
double
estimate_hashagg_tablesize(Path *path, const AggClauseCosts *agg_costs,
double dNumGroups)
{
Size hashentrysize;
/* Estimate per-hash-entry space at tuple width... */
hashentrysize = MAXALIGN(path->pathtarget->width) +
MAXALIGN(SizeofMinimalTupleHeader);
/* plus space for pass-by-ref transition values... */
hashentrysize += agg_costs->transitionSpace;
/* plus the per-hash-entry overhead */
hashentrysize += hash_agg_entry_size(agg_costs->numAggs);
/*
* Note that this disregards the effect of fill-factor and growth policy
* of the hash table. That's probably ok, given that the default
* fill-factor is relatively high. It'd be hard to meaningfully factor in
* "double-in-size" growth policies here.
*/
return hashentrysize * dNumGroups;
}
/*-------------------------------------------------------------------------
*
* Support routines
*
*-------------------------------------------------------------------------
*/
/*
* Find applicable ndistinct statistics for the given list of VarInfos (which
* must all belong to the given rel), and update *ndistinct to the estimate of
* the MVNDistinctItem that best matches. If a match it found, *varinfos is
* updated to remove the list of matched varinfos.
*
* Varinfos that aren't for simple Vars are ignored.
*
* Return true if we're able to find a match, false otherwise.
*/
static bool
estimate_multivariate_ndistinct(PlannerInfo *root, RelOptInfo *rel,
List **varinfos, double *ndistinct)
{
ListCell *lc;
Bitmapset *attnums = NULL;
int nmatches;
Oid statOid = InvalidOid;
MVNDistinct *stats;
Bitmapset *matched = NULL;
/* bail out immediately if the table has no extended statistics */
if (!rel->statlist)
return false;
/* Determine the attnums we're looking for */
foreach(lc, *varinfos)
{
GroupVarInfo *varinfo = (GroupVarInfo *) lfirst(lc);
Assert(varinfo->rel == rel);
if (IsA(varinfo->var, Var))
{
attnums = bms_add_member(attnums,
((Var *) varinfo->var)->varattno);
}
}
/* look for the ndistinct statistics matching the most vars */
nmatches = 1; /* we require at least two matches */
foreach(lc, rel->statlist)
{
StatisticExtInfo *info = (StatisticExtInfo *) lfirst(lc);
Bitmapset *shared;
int nshared;
/* skip statistics of other kinds */
if (info->kind != STATS_EXT_NDISTINCT)
continue;
/* compute attnums shared by the vars and the statistics object */
shared = bms_intersect(info->keys, attnums);
nshared = bms_num_members(shared);
/*
* Does this statistics object match more columns than the currently
* best object? If so, use this one instead.
*
* XXX This should break ties using name of the object, or something
* like that, to make the outcome stable.
*/
if (nshared > nmatches)
{
statOid = info->statOid;
nmatches = nshared;
matched = shared;
}
}
/* No match? */
if (statOid == InvalidOid)
return false;
Assert(nmatches > 1 && matched != NULL);
stats = statext_ndistinct_load(statOid);
/*
* If we have a match, search it for the specific item that matches (there
* must be one), and construct the output values.
*/
if (stats)
{
int i;
List *newlist = NIL;
MVNDistinctItem *item = NULL;
/* Find the specific item that exactly matches the combination */
for (i = 0; i < stats->nitems; i++)
{
MVNDistinctItem *tmpitem = &stats->items[i];
if (bms_subset_compare(tmpitem->attrs, matched) == BMS_EQUAL)
{
item = tmpitem;
break;
}
}
/* make sure we found an item */
if (!item)
elog(ERROR, "corrupt MVNDistinct entry");
/* Form the output varinfo list, keeping only unmatched ones */
foreach(lc, *varinfos)
{
GroupVarInfo *varinfo = (GroupVarInfo *) lfirst(lc);
AttrNumber attnum;
if (!IsA(varinfo->var, Var))
{
newlist = lappend(newlist, varinfo);
continue;
}
attnum = ((Var *) varinfo->var)->varattno;
if (!bms_is_member(attnum, matched))
newlist = lappend(newlist, varinfo);
}
*varinfos = newlist;
*ndistinct = item->ndistinct;
return true;
}
return false;
}
/*
* convert_to_scalar
* Convert non-NULL values of the indicated types to the comparison
* scale needed by scalarineqsel().
* Returns "true" if successful.
*
* XXX this routine is a hack: ideally we should look up the conversion
* subroutines in pg_type.
*
* All numeric datatypes are simply converted to their equivalent
* "double" values. (NUMERIC values that are outside the range of "double"
* are clamped to +/- HUGE_VAL.)
*
* String datatypes are converted by convert_string_to_scalar(),
* which is explained below. The reason why this routine deals with
* three values at a time, not just one, is that we need it for strings.
*
* The bytea datatype is just enough different from strings that it has
* to be treated separately.
*
* The several datatypes representing absolute times are all converted
* to Timestamp, which is actually a double, and then we just use that
* double value. Note this will give correct results even for the "special"
* values of Timestamp, since those are chosen to compare correctly;
* see timestamp_cmp.
*
* The several datatypes representing relative times (intervals) are all
* converted to measurements expressed in seconds.
*/
static bool
convert_to_scalar(Datum value, Oid valuetypid, Oid collid, double *scaledvalue,
Datum lobound, Datum hibound, Oid boundstypid,
double *scaledlobound, double *scaledhibound)
{
bool failure = false;
/*
* Both the valuetypid and the boundstypid should exactly match the
* declared input type(s) of the operator we are invoked for. However,
* extensions might try to use scalarineqsel as estimator for operators
* with input type(s) we don't handle here; in such cases, we want to
* return false, not fail. In any case, we mustn't assume that valuetypid
* and boundstypid are identical.
*
* XXX The histogram we are interpolating between points of could belong
* to a column that's only binary-compatible with the declared type. In
* essence we are assuming that the semantics of binary-compatible types
* are enough alike that we can use a histogram generated with one type's
* operators to estimate selectivity for the other's. This is outright
* wrong in some cases --- in particular signed versus unsigned
* interpretation could trip us up. But it's useful enough in the
* majority of cases that we do it anyway. Should think about more
* rigorous ways to do it.
*/
switch (valuetypid)
{
/*
* Built-in numeric types
*/
case BOOLOID:
case INT2OID:
case INT4OID:
case INT8OID:
case FLOAT4OID:
case FLOAT8OID:
case NUMERICOID:
case OIDOID:
case REGPROCOID:
case REGPROCEDUREOID:
case REGOPEROID:
case REGOPERATOROID:
case REGCLASSOID:
case REGTYPEOID:
case REGCONFIGOID:
case REGDICTIONARYOID:
case REGROLEOID:
case REGNAMESPACEOID:
*scaledvalue = convert_numeric_to_scalar(value, valuetypid,
&failure);
*scaledlobound = convert_numeric_to_scalar(lobound, boundstypid,
&failure);
*scaledhibound = convert_numeric_to_scalar(hibound, boundstypid,
&failure);
return !failure;
/*
* Built-in string types
*/
case CHAROID:
case BPCHAROID:
case VARCHAROID:
case TEXTOID:
case NAMEOID:
{
char *valstr = convert_string_datum(value, valuetypid,
collid, &failure);
char *lostr = convert_string_datum(lobound, boundstypid,
collid, &failure);
char *histr = convert_string_datum(hibound, boundstypid,
collid, &failure);
/*
* Bail out if any of the values is not of string type. We
* might leak converted strings for the other value(s), but
* that's not worth troubling over.
*/
if (failure)
return false;
convert_string_to_scalar(valstr, scaledvalue,
lostr, scaledlobound,
histr, scaledhibound);
pfree(valstr);
pfree(lostr);
pfree(histr);
return true;
}
/*
* Built-in bytea type
*/
case BYTEAOID:
{
/* We only support bytea vs bytea comparison */
if (boundstypid != BYTEAOID)
return false;
convert_bytea_to_scalar(value, scaledvalue,
lobound, scaledlobound,
hibound, scaledhibound);
return true;
}
/*
* Built-in time types
*/
case TIMESTAMPOID:
case TIMESTAMPTZOID:
case DATEOID:
case INTERVALOID:
case TIMEOID:
case TIMETZOID:
*scaledvalue = convert_timevalue_to_scalar(value, valuetypid,
&failure);
*scaledlobound = convert_timevalue_to_scalar(lobound, boundstypid,
&failure);
*scaledhibound = convert_timevalue_to_scalar(hibound, boundstypid,
&failure);
return !failure;
/*
* Built-in network types
*/
case INETOID:
case CIDROID:
case MACADDROID:
case MACADDR8OID:
*scaledvalue = convert_network_to_scalar(value, valuetypid,
&failure);
*scaledlobound = convert_network_to_scalar(lobound, boundstypid,
&failure);
*scaledhibound = convert_network_to_scalar(hibound, boundstypid,
&failure);
return !failure;
}
/* Don't know how to convert */
*scaledvalue = *scaledlobound = *scaledhibound = 0;
return false;
}
/*
* Do convert_to_scalar()'s work for any numeric data type.
*
* On failure (e.g., unsupported typid), set *failure to true;
* otherwise, that variable is not changed.
*/
static double
convert_numeric_to_scalar(Datum value, Oid typid, bool *failure)
{
switch (typid)
{
case BOOLOID:
return (double) DatumGetBool(value);
case INT2OID:
return (double) DatumGetInt16(value);
case INT4OID:
return (double) DatumGetInt32(value);
case INT8OID:
return (double) DatumGetInt64(value);
case FLOAT4OID:
return (double) DatumGetFloat4(value);
case FLOAT8OID:
return (double) DatumGetFloat8(value);
case NUMERICOID:
/* Note: out-of-range values will be clamped to +-HUGE_VAL */
return (double)
DatumGetFloat8(DirectFunctionCall1(numeric_float8_no_overflow,
value));
case OIDOID:
case REGPROCOID:
case REGPROCEDUREOID:
case REGOPEROID:
case REGOPERATOROID:
case REGCLASSOID:
case REGTYPEOID:
case REGCONFIGOID:
case REGDICTIONARYOID:
case REGROLEOID:
case REGNAMESPACEOID:
/* we can treat OIDs as integers... */
return (double) DatumGetObjectId(value);
}
*failure = true;
return 0;
}
/*
* Do convert_to_scalar()'s work for any character-string data type.
*
* String datatypes are converted to a scale that ranges from 0 to 1,
* where we visualize the bytes of the string as fractional digits.
*
* We do not want the base to be 256, however, since that tends to
* generate inflated selectivity estimates; few databases will have
* occurrences of all 256 possible byte values at each position.
* Instead, use the smallest and largest byte values seen in the bounds
* as the estimated range for each byte, after some fudging to deal with
* the fact that we probably aren't going to see the full range that way.
*
* An additional refinement is that we discard any common prefix of the
* three strings before computing the scaled values. This allows us to
* "zoom in" when we encounter a narrow data range. An example is a phone
* number database where all the values begin with the same area code.
* (Actually, the bounds will be adjacent histogram-bin-boundary values,
* so this is more likely to happen than you might think.)
*/
static void
convert_string_to_scalar(char *value,
double *scaledvalue,
char *lobound,
double *scaledlobound,
char *hibound,
double *scaledhibound)
{
int rangelo,
rangehi;
char *sptr;
rangelo = rangehi = (unsigned char) hibound[0];
for (sptr = lobound; *sptr; sptr++)
{
if (rangelo > (unsigned char) *sptr)
rangelo = (unsigned char) *sptr;
if (rangehi < (unsigned char) *sptr)
rangehi = (unsigned char) *sptr;
}
for (sptr = hibound; *sptr; sptr++)
{
if (rangelo > (unsigned char) *sptr)
rangelo = (unsigned char) *sptr;
if (rangehi < (unsigned char) *sptr)
rangehi = (unsigned char) *sptr;
}
/* If range includes any upper-case ASCII chars, make it include all */
if (rangelo <= 'Z' && rangehi >= 'A')
{
if (rangelo > 'A')
rangelo = 'A';
if (rangehi < 'Z')
rangehi = 'Z';
}
/* Ditto lower-case */
if (rangelo <= 'z' && rangehi >= 'a')
{
if (rangelo > 'a')
rangelo = 'a';
if (rangehi < 'z')
rangehi = 'z';
}
/* Ditto digits */
if (rangelo <= '9' && rangehi >= '0')
{
if (rangelo > '0')
rangelo = '0';
if (rangehi < '9')
rangehi = '9';
}
/*
* If range includes less than 10 chars, assume we have not got enough
* data, and make it include regular ASCII set.
*/
if (rangehi - rangelo < 9)
{
rangelo = ' ';
rangehi = 127;
}
/*
* Now strip any common prefix of the three strings.
*/
while (*lobound)
{
if (*lobound != *hibound || *lobound != *value)
break;
lobound++, hibound++, value++;
}
/*
* Now we can do the conversions.
*/
*scaledvalue = convert_one_string_to_scalar(value, rangelo, rangehi);
*scaledlobound = convert_one_string_to_scalar(lobound, rangelo, rangehi);
*scaledhibound = convert_one_string_to_scalar(hibound, rangelo, rangehi);
}
static double
convert_one_string_to_scalar(char *value, int rangelo, int rangehi)
{
int slen = strlen(value);
double num,
denom,
base;
if (slen <= 0)
return 0.0; /* empty string has scalar value 0 */
/*
* There seems little point in considering more than a dozen bytes from
* the string. Since base is at least 10, that will give us nominal
* resolution of at least 12 decimal digits, which is surely far more
* precision than this estimation technique has got anyway (especially in
* non-C locales). Also, even with the maximum possible base of 256, this
* ensures denom cannot grow larger than 256^13 = 2.03e31, which will not
* overflow on any known machine.
*/
if (slen > 12)
slen = 12;
/* Convert initial characters to fraction */
base = rangehi - rangelo + 1;
num = 0.0;
denom = base;
while (slen-- > 0)
{
int ch = (unsigned char) *value++;
if (ch < rangelo)
ch = rangelo - 1;
else if (ch > rangehi)
ch = rangehi + 1;
num += ((double) (ch - rangelo)) / denom;
denom *= base;
}
return num;
}
/*
* Convert a string-type Datum into a palloc'd, null-terminated string.
*
* On failure (e.g., unsupported typid), set *failure to true;
* otherwise, that variable is not changed. (We'll return NULL on failure.)
*
* When using a non-C locale, we must pass the string through strxfrm()
* before continuing, so as to generate correct locale-specific results.
*/
static char *
convert_string_datum(Datum value, Oid typid, Oid collid, bool *failure)
{
char *val;
switch (typid)
{
case CHAROID:
val = (char *) palloc(2);
val[0] = DatumGetChar(value);
val[1] = '\0';
break;
case BPCHAROID:
case VARCHAROID:
case TEXTOID:
val = TextDatumGetCString(value);
break;
case NAMEOID:
{
NameData *nm = (NameData *) DatumGetPointer(value);
val = pstrdup(NameStr(*nm));
break;
}
default:
*failure = true;
return NULL;
}
if (!lc_collate_is_c(collid))
{
char *xfrmstr;
size_t xfrmlen;
size_t xfrmlen2 PG_USED_FOR_ASSERTS_ONLY;
/*
* XXX: We could guess at a suitable output buffer size and only call
* strxfrm twice if our guess is too small.
*
* XXX: strxfrm doesn't support UTF-8 encoding on Win32, it can return
* bogus data or set an error. This is not really a problem unless it
* crashes since it will only give an estimation error and nothing
* fatal.
*/
#if _MSC_VER == 1400 /* VS.Net 2005 */
/*
*
* http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99694
*/
{
char x[1];
xfrmlen = strxfrm(x, val, 0);
}
#else
xfrmlen = strxfrm(NULL, val, 0);
#endif
#ifdef WIN32
/*
* On Windows, strxfrm returns INT_MAX when an error occurs. Instead
* of trying to allocate this much memory (and fail), just return the
* original string unmodified as if we were in the C locale.
*/
if (xfrmlen == INT_MAX)
return val;
#endif
xfrmstr = (char *) palloc(xfrmlen + 1);
xfrmlen2 = strxfrm(xfrmstr, val, xfrmlen + 1);
/*
* Some systems (e.g., glibc) can return a smaller value from the
* second call than the first; thus the Assert must be <= not ==.
*/
Assert(xfrmlen2 <= xfrmlen);
pfree(val);
val = xfrmstr;
}
return val;
}
/*
* Do convert_to_scalar()'s work for any bytea data type.
*
* Very similar to convert_string_to_scalar except we can't assume
* null-termination and therefore pass explicit lengths around.
*
* Also, assumptions about likely "normal" ranges of characters have been
* removed - a data range of 0..255 is always used, for now. (Perhaps
* someday we will add information about actual byte data range to
* pg_statistic.)
*/
static void
convert_bytea_to_scalar(Datum value,
double *scaledvalue,
Datum lobound,
double *scaledlobound,
Datum hibound,
double *scaledhibound)
{
bytea *valuep = DatumGetByteaPP(value);
bytea *loboundp = DatumGetByteaPP(lobound);
bytea *hiboundp = DatumGetByteaPP(hibound);
int rangelo,
rangehi,
valuelen = VARSIZE_ANY_EXHDR(valuep),
loboundlen = VARSIZE_ANY_EXHDR(loboundp),
hiboundlen = VARSIZE_ANY_EXHDR(hiboundp),
i,
minlen;
unsigned char *valstr = (unsigned char *) VARDATA_ANY(valuep);
unsigned char *lostr = (unsigned char *) VARDATA_ANY(loboundp);
unsigned char *histr = (unsigned char *) VARDATA_ANY(hiboundp);
/*
* Assume bytea data is uniformly distributed across all byte values.
*/
rangelo = 0;
rangehi = 255;
/*
* Now strip any common prefix of the three strings.
*/
minlen = Min(Min(valuelen, loboundlen), hiboundlen);
for (i = 0; i < minlen; i++)
{
if (*lostr != *histr || *lostr != *valstr)
break;
lostr++, histr++, valstr++;
loboundlen--, hiboundlen--, valuelen--;
}
/*
* Now we can do the conversions.
*/
*scaledvalue = convert_one_bytea_to_scalar(valstr, valuelen, rangelo, rangehi);
*scaledlobound = convert_one_bytea_to_scalar(lostr, loboundlen, rangelo, rangehi);
*scaledhibound = convert_one_bytea_to_scalar(histr, hiboundlen, rangelo, rangehi);
}
static double
convert_one_bytea_to_scalar(unsigned char *value, int valuelen,
int rangelo, int rangehi)
{
double num,
denom,
base;
if (valuelen <= 0)
return 0.0; /* empty string has scalar value 0 */
/*
* Since base is 256, need not consider more than about 10 chars (even
* this many seems like overkill)
*/
if (valuelen > 10)
valuelen = 10;
/* Convert initial characters to fraction */
base = rangehi - rangelo + 1;
num = 0.0;
denom = base;
while (valuelen-- > 0)
{
int ch = *value++;
if (ch < rangelo)
ch = rangelo - 1;
else if (ch > rangehi)
ch = rangehi + 1;
num += ((double) (ch - rangelo)) / denom;
denom *= base;
}
return num;
}
/*
* Do convert_to_scalar()'s work for any timevalue data type.
*
* On failure (e.g., unsupported typid), set *failure to true;
* otherwise, that variable is not changed.
*/
static double
convert_timevalue_to_scalar(Datum value, Oid typid, bool *failure)
{
switch (typid)
{
case TIMESTAMPOID:
return DatumGetTimestamp(value);
case TIMESTAMPTZOID:
return DatumGetTimestampTz(value);
case DATEOID:
return date2timestamp_no_overflow(DatumGetDateADT(value));
case INTERVALOID:
{
Interval *interval = DatumGetIntervalP(value);
/*
* Convert the month part of Interval to days using assumed
* average month length of 365.25/12.0 days. Not too
* accurate, but plenty good enough for our purposes.
*/
return interval->time + interval->day * (double) USECS_PER_DAY +
interval->month * ((DAYS_PER_YEAR / (double) MONTHS_PER_YEAR) * USECS_PER_DAY);
}
case TIMEOID:
return DatumGetTimeADT(value);
case TIMETZOID:
{
TimeTzADT *timetz = DatumGetTimeTzADTP(value);
/* use GMT-equivalent time */
return (double) (timetz->time + (timetz->zone * 1000000.0));
}
}
*failure = true;
return 0;
}
/*
* get_restriction_variable
* Examine the args of a restriction clause to see if it's of the
* form (variable op pseudoconstant) or (pseudoconstant op variable),
* where "variable" could be either a Var or an expression in vars of a
* single relation. If so, extract information about the variable,
* and also indicate which side it was on and the other argument.
*
* Inputs:
* root: the planner info
* args: clause argument list
* varRelid: see specs for restriction selectivity functions
*
* Outputs: (these are valid only if true is returned)
* *vardata: gets information about variable (see examine_variable)
* *other: gets other clause argument, aggressively reduced to a constant
* *varonleft: set true if variable is on the left, false if on the right
*
* Returns true if a variable is identified, otherwise false.
*
* Note: if there are Vars on both sides of the clause, we must fail, because
* callers are expecting that the other side will act like a pseudoconstant.
*/
bool
get_restriction_variable(PlannerInfo *root, List *args, int varRelid,
VariableStatData *vardata, Node **other,
bool *varonleft)
{
Node *left,
*right;
VariableStatData rdata;
/* Fail if not a binary opclause (probably shouldn't happen) */
if (list_length(args) != 2)
return false;
left = (Node *) linitial(args);
right = (Node *) lsecond(args);
/*
* Examine both sides. Note that when varRelid is nonzero, Vars of other
* relations will be treated as pseudoconstants.
*/
examine_variable(root, left, varRelid, vardata);
examine_variable(root, right, varRelid, &rdata);
/*
* If one side is a variable and the other not, we win.
*/
if (vardata->rel && rdata.rel == NULL)
{
*varonleft = true;
*other = estimate_expression_value(root, rdata.var);
/* Assume we need no ReleaseVariableStats(rdata) here */
return true;
}
if (vardata->rel == NULL && rdata.rel)
{
*varonleft = false;
*other = estimate_expression_value(root, vardata->var);
/* Assume we need no ReleaseVariableStats(*vardata) here */
*vardata = rdata;
return true;
}
/* Oops, clause has wrong structure (probably var op var) */
ReleaseVariableStats(*vardata);
ReleaseVariableStats(rdata);
return false;
}
/*
* get_join_variables
* Apply examine_variable() to each side of a join clause.
* Also, attempt to identify whether the join clause has the same
* or reversed sense compared to the SpecialJoinInfo.
*
* We consider the join clause "normal" if it is "lhs_var OP rhs_var",
* or "reversed" if it is "rhs_var OP lhs_var". In complicated cases
* where we can't tell for sure, we default to assuming it's normal.
*/
void
get_join_variables(PlannerInfo *root, List *args, SpecialJoinInfo *sjinfo,
VariableStatData *vardata1, VariableStatData *vardata2,
bool *join_is_reversed)
{
Node *left,
*right;
if (list_length(args) != 2)
elog(ERROR, "join operator should take two arguments");
left = (Node *) linitial(args);
right = (Node *) lsecond(args);
examine_variable(root, left, 0, vardata1);
examine_variable(root, right, 0, vardata2);
if (vardata1->rel &&
bms_is_subset(vardata1->rel->relids, sjinfo->syn_righthand))
*join_is_reversed = true; /* var1 is on RHS */
else if (vardata2->rel &&
bms_is_subset(vardata2->rel->relids, sjinfo->syn_lefthand))
*join_is_reversed = true; /* var2 is on LHS */
else
*join_is_reversed = false;
}
/*
* examine_variable
* Try to look up statistical data about an expression.
* Fill in a VariableStatData struct to describe the expression.
*
* Inputs:
* root: the planner info
* node: the expression tree to examine
* varRelid: see specs for restriction selectivity functions
*
* Outputs: *vardata is filled as follows:
* var: the input expression (with any binary relabeling stripped, if
* it is or contains a variable; but otherwise the type is preserved)
* rel: RelOptInfo for relation containing variable; NULL if expression
* contains no Vars (NOTE this could point to a RelOptInfo of a
* subquery, not one in the current query).
* statsTuple: the pg_statistic entry for the variable, if one exists;
* otherwise NULL.
* freefunc: pointer to a function to release statsTuple with.
* vartype: exposed type of the expression; this should always match
* the declared input type of the operator we are estimating for.
* atttype, atttypmod: actual type/typmod of the "var" expression. This is
* commonly the same as the exposed type of the variable argument,
* but can be different in binary-compatible-type cases.
* isunique: true if we were able to match the var to a unique index or a
* single-column DISTINCT clause, implying its values are unique for
* this query. (Caution: this should be trusted for statistical
* purposes only, since we do not check indimmediate nor verify that
* the exact same definition of equality applies.)
* acl_ok: true if current user has permission to read the column(s)
* underlying the pg_statistic entry. This is consulted by
* statistic_proc_security_check().
*
* Caller is responsible for doing ReleaseVariableStats() before exiting.
*/
void
examine_variable(PlannerInfo *root, Node *node, int varRelid,
VariableStatData *vardata)
{
Node *basenode;
Relids varnos;
RelOptInfo *onerel;
/* Make sure we don't return dangling pointers in vardata */
MemSet(vardata, 0, sizeof(VariableStatData));
/* Save the exposed type of the expression */
vardata->vartype = exprType(node);
/* Look inside any binary-compatible relabeling */
if (IsA(node, RelabelType))
basenode = (Node *) ((RelabelType *) node)->arg;
else
basenode = node;
/* Fast path for a simple Var */
if (IsA(basenode, Var) &&
(varRelid == 0 || varRelid == ((Var *) basenode)->varno))
{
Var *var = (Var *) basenode;
/* Set up result fields other than the stats tuple */
vardata->var = basenode; /* return Var without relabeling */
vardata->rel = find_base_rel(root, var->varno);
vardata->atttype = var->vartype;
vardata->atttypmod = var->vartypmod;
vardata->isunique = has_unique_index(vardata->rel, var->varattno);
/* Try to locate some stats */
examine_simple_variable(root, var, vardata);
return;
}
/*
* Okay, it's a more complicated expression. Determine variable
* membership. Note that when varRelid isn't zero, only vars of that
* relation are considered "real" vars.
*/
varnos = pull_varnos(basenode);
onerel = NULL;
switch (bms_membership(varnos))
{
case BMS_EMPTY_SET:
/* No Vars at all ... must be pseudo-constant clause */
break;
case BMS_SINGLETON:
if (varRelid == 0 || bms_is_member(varRelid, varnos))
{
onerel = find_base_rel(root,
(varRelid ? varRelid : bms_singleton_member(varnos)));
vardata->rel = onerel;
node = basenode; /* strip any relabeling */
}
/* else treat it as a constant */
break;
case BMS_MULTIPLE:
if (varRelid == 0)
{
/* treat it as a variable of a join relation */
vardata->rel = find_join_rel(root, varnos);
node = basenode; /* strip any relabeling */
}
else if (bms_is_member(varRelid, varnos))
{
/* ignore the vars belonging to other relations */
vardata->rel = find_base_rel(root, varRelid);
node = basenode; /* strip any relabeling */
/* note: no point in expressional-index search here */
}
/* else treat it as a constant */
break;
}
bms_free(varnos);
vardata->var = node;
vardata->atttype = exprType(node);
vardata->atttypmod = exprTypmod(node);
if (onerel)
{
/*
* We have an expression in vars of a single relation. Try to match
* it to expressional index columns, in hopes of finding some
* statistics.
*
* Note that we consider all index columns including INCLUDE columns,
* since there could be stats for such columns. But the test for
* uniqueness needs to be warier.
*
* XXX it's conceivable that there are multiple matches with different
* index opfamilies; if so, we need to pick one that matches the
* operator we are estimating for. FIXME later.
*/
ListCell *ilist;
foreach(ilist, onerel->indexlist)
{
IndexOptInfo *index = (IndexOptInfo *) lfirst(ilist);
ListCell *indexpr_item;
int pos;
indexpr_item = list_head(index->indexprs);
if (indexpr_item == NULL)
continue; /* no expressions here... */
for (pos = 0; pos < index->ncolumns; pos++)
{
if (index->indexkeys[pos] == 0)
{
Node *indexkey;
if (indexpr_item == NULL)
elog(ERROR, "too few entries in indexprs list");
indexkey = (Node *) lfirst(indexpr_item);
if (indexkey && IsA(indexkey, RelabelType))
indexkey = (Node *) ((RelabelType *) indexkey)->arg;
if (equal(node, indexkey))
{
/*
* Found a match ... is it a unique index? Tests here
* should match has_unique_index().
*/
if (index->unique &&
index->nkeycolumns == 1 &&
pos == 0 &&
(index->indpred == NIL || index->predOK))
vardata->isunique = true;
/*
* Has it got stats? We only consider stats for
* non-partial indexes, since partial indexes probably
* don't reflect whole-relation statistics; the above
* check for uniqueness is the only info we take from
* a partial index.
*
* An index stats hook, however, must make its own
* decisions about what to do with partial indexes.
*/
if (get_index_stats_hook &&
(*get_index_stats_hook) (root, index->indexoid,
pos + 1, vardata))
{
/*
* The hook took control of acquiring a stats
* tuple. If it did supply a tuple, it'd better
* have supplied a freefunc.
*/
if (HeapTupleIsValid(vardata->statsTuple) &&
!vardata->freefunc)
elog(ERROR, "no function provided to release variable stats with");
}
else if (index->indpred == NIL)
{
vardata->statsTuple =
SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(index->indexoid),
Int16GetDatum(pos + 1),
BoolGetDatum(false));
vardata->freefunc = ReleaseSysCache;
if (HeapTupleIsValid(vardata->statsTuple))
{
/* Get index's table for permission check */
RangeTblEntry *rte;
Oid userid;
rte = planner_rt_fetch(index->rel->relid, root);
Assert(rte->rtekind == RTE_RELATION);
/*
* Use checkAsUser if it's set, in case we're
* accessing the table via a view.
*/
userid = rte->checkAsUser ? rte->checkAsUser : GetUserId();
/*
* For simplicity, we insist on the whole
* table being selectable, rather than trying
* to identify which column(s) the index
* depends on. Also require all rows to be
* selectable --- there must be no
* securityQuals from security barrier views
* or RLS policies.
*/
vardata->acl_ok =
rte->securityQuals == NIL &&
(pg_class_aclcheck(rte->relid, userid,
ACL_SELECT) == ACLCHECK_OK);
}
else
{
/* suppress leakproofness checks later */
vardata->acl_ok = true;
}
}
if (vardata->statsTuple)
break;
}
indexpr_item = lnext(indexpr_item);
}
}
if (vardata->statsTuple)
break;
}
}
}
/*
* examine_simple_variable
* Handle a simple Var for examine_variable
*
* This is split out as a subroutine so that we can recurse to deal with
* Vars referencing subqueries.
*
* We already filled in all the fields of *vardata except for the stats tuple.
*/
static void
examine_simple_variable(PlannerInfo *root, Var *var,
VariableStatData *vardata)
{
RangeTblEntry *rte = root->simple_rte_array[var->varno];
Assert(IsA(rte, RangeTblEntry));
if (get_relation_stats_hook &&
(*get_relation_stats_hook) (root, rte, var->varattno, vardata))
{
/*
* The hook took control of acquiring a stats tuple. If it did supply
* a tuple, it'd better have supplied a freefunc.
*/
if (HeapTupleIsValid(vardata->statsTuple) &&
!vardata->freefunc)
elog(ERROR, "no function provided to release variable stats with");
}
else if (rte->rtekind == RTE_RELATION)
{
/*
* Plain table or parent of an inheritance appendrel, so look up the
* column in pg_statistic
*/
vardata->statsTuple = SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(rte->relid),
Int16GetDatum(var->varattno),
BoolGetDatum(rte->inh));
vardata->freefunc = ReleaseSysCache;
if (HeapTupleIsValid(vardata->statsTuple))
{
Oid userid;
/*
* Check if user has permission to read this column. We require
* all rows to be accessible, so there must be no securityQuals
* from security barrier views or RLS policies. Use checkAsUser
* if it's set, in case we're accessing the table via a view.
*/
userid = rte->checkAsUser ? rte->checkAsUser : GetUserId();
vardata->acl_ok =
rte->securityQuals == NIL &&
((pg_class_aclcheck(rte->relid, userid,
ACL_SELECT) == ACLCHECK_OK) ||
(pg_attribute_aclcheck(rte->relid, var->varattno, userid,
ACL_SELECT) == ACLCHECK_OK));
}
else
{
/* suppress any possible leakproofness checks later */
vardata->acl_ok = true;
}
}
else if (rte->rtekind == RTE_SUBQUERY && !rte->inh)
{
/*
* Plain subquery (not one that was converted to an appendrel).
*/
Query *subquery = rte->subquery;
RelOptInfo *rel;
TargetEntry *ste;
/*
* Punt if it's a whole-row var rather than a plain column reference.
*/
if (var->varattno == InvalidAttrNumber)
return;
/*
* Punt if subquery uses set operations or GROUP BY, as these will
* mash underlying columns' stats beyond recognition. (Set ops are
* particularly nasty; if we forged ahead, we would return stats
* relevant to only the leftmost subselect...) DISTINCT is also
* problematic, but we check that later because there is a possibility
* of learning something even with it.
*/
if (subquery->setOperations ||
subquery->groupClause)
return;
/*
* OK, fetch RelOptInfo for subquery. Note that we don't change the
* rel returned in vardata, since caller expects it to be a rel of the
* caller's query level. Because we might already be recursing, we
* can't use that rel pointer either, but have to look up the Var's
* rel afresh.
*/
rel = find_base_rel(root, var->varno);
/* If the subquery hasn't been planned yet, we have to punt */
if (rel->subroot == NULL)
return;
Assert(IsA(rel->subroot, PlannerInfo));
/*
* Switch our attention to the subquery as mangled by the planner. It
* was okay to look at the pre-planning version for the tests above,
* but now we need a Var that will refer to the subroot's live
* RelOptInfos. For instance, if any subquery pullup happened during
* planning, Vars in the targetlist might have gotten replaced, and we
* need to see the replacement expressions.
*/
subquery = rel->subroot->parse;
Assert(IsA(subquery, Query));
/* Get the subquery output expression referenced by the upper Var */
ste = get_tle_by_resno(subquery->targetList, var->varattno);
if (ste == NULL || ste->resjunk)
elog(ERROR, "subquery %s does not have attribute %d",
rte->eref->aliasname, var->varattno);
var = (Var *) ste->expr;
/*
* If subquery uses DISTINCT, we can't make use of any stats for the
* variable ... but, if it's the only DISTINCT column, we are entitled
* to consider it unique. We do the test this way so that it works
* for cases involving DISTINCT ON.
*/
if (subquery->distinctClause)
{
if (list_length(subquery->distinctClause) == 1 &&
targetIsInSortList(ste, InvalidOid, subquery->distinctClause))
vardata->isunique = true;
/* cannot go further */
return;
}
/*
* If the sub-query originated from a view with the security_barrier
* attribute, we must not look at the variable's statistics, though it
* seems all right to notice the existence of a DISTINCT clause. So
* stop here.
*
* This is probably a harsher restriction than necessary; it's
* certainly OK for the selectivity estimator (which is a C function,
* and therefore omnipotent anyway) to look at the statistics. But
* many selectivity estimators will happily *invoke the operator
* function* to try to work out a good estimate - and that's not OK.
* So for now, don't dig down for stats.
*/
if (rte->security_barrier)
return;
/* Can only handle a simple Var of subquery's query level */
if (var && IsA(var, Var) &&
var->varlevelsup == 0)
{
/*
* OK, recurse into the subquery. Note that the original setting
* of vardata->isunique (which will surely be false) is left
* unchanged in this situation. That's what we want, since even
* if the underlying column is unique, the subquery may have
* joined to other tables in a way that creates duplicates.
*/
examine_simple_variable(rel->subroot, var, vardata);
}
}
else
{
/*
* Otherwise, the Var comes from a FUNCTION, VALUES, or CTE RTE. (We
* won't see RTE_JOIN here because join alias Vars have already been
* flattened.) There's not much we can do with function outputs, but
* maybe someday try to be smarter about VALUES and/or CTEs.
*/
}
}
/*
* Check whether it is permitted to call func_oid passing some of the
* pg_statistic data in vardata. We allow this either if the user has SELECT
* privileges on the table or column underlying the pg_statistic data or if
* the function is marked leak-proof.
*/
bool
statistic_proc_security_check(VariableStatData *vardata, Oid func_oid)
{
if (vardata->acl_ok)
return true;
if (!OidIsValid(func_oid))
return false;
if (get_func_leakproof(func_oid))
return true;
ereport(DEBUG2,
(errmsg_internal("not using statistics because function \"%s\" is not leak-proof",
get_func_name(func_oid))));
return false;
}
/*
* get_variable_numdistinct
* Estimate the number of distinct values of a variable.
*
* vardata: results of examine_variable
* *isdefault: set to true if the result is a default rather than based on
* anything meaningful.
*
* NB: be careful to produce a positive integral result, since callers may
* compare the result to exact integer counts, or might divide by it.
*/
double
get_variable_numdistinct(VariableStatData *vardata, bool *isdefault)
{
double stadistinct;
double stanullfrac = 0.0;
double ntuples;
*isdefault = false;
/*
* Determine the stadistinct value to use. There are cases where we can
* get an estimate even without a pg_statistic entry, or can get a better
* value than is in pg_statistic. Grab stanullfrac too if we can find it
* (otherwise, assume no nulls, for lack of any better idea).
*/
if (HeapTupleIsValid(vardata->statsTuple))
{
/* Use the pg_statistic entry */
Form_pg_statistic stats;
stats = (Form_pg_statistic) GETSTRUCT(vardata->statsTuple);
stadistinct = stats->stadistinct;
stanullfrac = stats->stanullfrac;
}
else if (vardata->vartype == BOOLOID)
{
/*
* Special-case boolean columns: presumably, two distinct values.
*
* Are there any other datatypes we should wire in special estimates
* for?
*/
stadistinct = 2.0;
}
else if (vardata->rel && vardata->rel->rtekind == RTE_VALUES)
{
/*
* If the Var represents a column of a VALUES RTE, assume it's unique.
* This could of course be very wrong, but it should tend to be true
* in well-written queries. We could consider examining the VALUES'
* contents to get some real statistics; but that only works if the
* entries are all constants, and it would be pretty expensive anyway.
*/
stadistinct = -1.0; /* unique (and all non null) */
}
else
{
/*
* We don't keep statistics for system columns, but in some cases we
* can infer distinctness anyway.
*/
if (vardata->var && IsA(vardata->var, Var))
{
switch (((Var *) vardata->var)->varattno)
{
case SelfItemPointerAttributeNumber:
stadistinct = -1.0; /* unique (and all non null) */
break;
case TableOidAttributeNumber:
stadistinct = 1.0; /* only 1 value */
break;
default:
stadistinct = 0.0; /* means "unknown" */
break;
}
}
else
stadistinct = 0.0; /* means "unknown" */
/*
* XXX consider using estimate_num_groups on expressions?
*/
}
/*
* If there is a unique index or DISTINCT clause for the variable, assume
* it is unique no matter what pg_statistic says; the statistics could be
* out of date, or we might have found a partial unique index that proves
* the var is unique for this query. However, we'd better still believe
* the null-fraction statistic.
*/
if (vardata->isunique)
stadistinct = -1.0 * (1.0 - stanullfrac);
/*
* If we had an absolute estimate, use that.
*/
if (stadistinct > 0.0)
return clamp_row_est(stadistinct);
/*
* Otherwise we need to get the relation size; punt if not available.
*/
if (vardata->rel == NULL)
{
*isdefault = true;
return DEFAULT_NUM_DISTINCT;
}
ntuples = vardata->rel->tuples;
if (ntuples <= 0.0)
{
*isdefault = true;
return DEFAULT_NUM_DISTINCT;
}
/*
* If we had a relative estimate, use that.
*/
if (stadistinct < 0.0)
return clamp_row_est(-stadistinct * ntuples);
/*
* With no data, estimate ndistinct = ntuples if the table is small, else
* use default. We use DEFAULT_NUM_DISTINCT as the cutoff for "small" so
* that the behavior isn't discontinuous.
*/
if (ntuples < DEFAULT_NUM_DISTINCT)
return clamp_row_est(ntuples);
*isdefault = true;
return DEFAULT_NUM_DISTINCT;
}
/*
* get_variable_range
* Estimate the minimum and maximum value of the specified variable.
* If successful, store values in *min and *max, and return true.
* If no data available, return false.
*
* sortop is the "<" comparison operator to use. This should generally
* be "<" not ">", as only the former is likely to be found in pg_statistic.
*/
static bool
get_variable_range(PlannerInfo *root, VariableStatData *vardata, Oid sortop,
Datum *min, Datum *max)
{
Datum tmin = 0;
Datum tmax = 0;
bool have_data = false;
int16 typLen;
bool typByVal;
Oid opfuncoid;
AttStatsSlot sslot;
int i;
/*
* XXX It's very tempting to try to use the actual column min and max, if
* we can get them relatively-cheaply with an index probe. However, since
* this function is called many times during join planning, that could
* have unpleasant effects on planning speed. Need more investigation
* before enabling this.
*/
#ifdef NOT_USED
if (get_actual_variable_range(root, vardata, sortop, min, max))
return true;
#endif
if (!HeapTupleIsValid(vardata->statsTuple))
{
/* no stats available, so default result */
return false;
}
/*
* If we can't apply the sortop to the stats data, just fail. In
* principle, if there's a histogram and no MCVs, we could return the
* histogram endpoints without ever applying the sortop ... but it's
* probably not worth trying, because whatever the caller wants to do with
* the endpoints would likely fail the security check too.
*/
if (!statistic_proc_security_check(vardata,
(opfuncoid = get_opcode(sortop))))
return false;
get_typlenbyval(vardata->atttype, &typLen, &typByVal);
/*
* If there is a histogram, grab the first and last values.
*
* If there is a histogram that is sorted with some other operator than
* the one we want, fail --- this suggests that there is data we can't
* use.
*/
if (get_attstatsslot(&sslot, vardata->statsTuple,
STATISTIC_KIND_HISTOGRAM, sortop,
ATTSTATSSLOT_VALUES))
{
if (sslot.nvalues > 0)
{
tmin = datumCopy(sslot.values[0], typByVal, typLen);
tmax = datumCopy(sslot.values[sslot.nvalues - 1], typByVal, typLen);
have_data = true;
}
free_attstatsslot(&sslot);
}
else if (get_attstatsslot(&sslot, vardata->statsTuple,
STATISTIC_KIND_HISTOGRAM, InvalidOid,
0))
{
free_attstatsslot(&sslot);
return false;
}
/*
* If we have most-common-values info, look for extreme MCVs. This is
* needed even if we also have a histogram, since the histogram excludes
* the MCVs. However, usually the MCVs will not be the extreme values, so
* avoid unnecessary data copying.
*/
if (get_attstatsslot(&sslot, vardata->statsTuple,
STATISTIC_KIND_MCV, InvalidOid,
ATTSTATSSLOT_VALUES))
{
bool tmin_is_mcv = false;
bool tmax_is_mcv = false;
FmgrInfo opproc;
fmgr_info(opfuncoid, &opproc);
for (i = 0; i < sslot.nvalues; i++)
{
if (!have_data)
{
tmin = tmax = sslot.values[i];
tmin_is_mcv = tmax_is_mcv = have_data = true;
continue;
}
if (DatumGetBool(FunctionCall2Coll(&opproc,
sslot.stacoll,
sslot.values[i], tmin)))
{
tmin = sslot.values[i];
tmin_is_mcv = true;
}
if (DatumGetBool(FunctionCall2Coll(&opproc,
sslot.stacoll,
tmax, sslot.values[i])))
{
tmax = sslot.values[i];
tmax_is_mcv = true;
}
}
if (tmin_is_mcv)
tmin = datumCopy(tmin, typByVal, typLen);
if (tmax_is_mcv)
tmax = datumCopy(tmax, typByVal, typLen);
free_attstatsslot(&sslot);
}
*min = tmin;
*max = tmax;
return have_data;
}
/*
* get_actual_variable_range
* Attempt to identify the current *actual* minimum and/or maximum
* of the specified variable, by looking for a suitable btree index
* and fetching its low and/or high values.
* If successful, store values in *min and *max, and return true.
* (Either pointer can be NULL if that endpoint isn't needed.)
* If no data available, return false.
*
* sortop is the "<" comparison operator to use.
*/
static bool
get_actual_variable_range(PlannerInfo *root, VariableStatData *vardata,
Oid sortop,
Datum *min, Datum *max)
{
bool have_data = false;
RelOptInfo *rel = vardata->rel;
RangeTblEntry *rte;
ListCell *lc;
/* No hope if no relation or it doesn't have indexes */
if (rel == NULL || rel->indexlist == NIL)
return false;
/* If it has indexes it must be a plain relation */
rte = root->simple_rte_array[rel->relid];
Assert(rte->rtekind == RTE_RELATION);
/* Search through the indexes to see if any match our problem */
foreach(lc, rel->indexlist)
{
IndexOptInfo *index = (IndexOptInfo *) lfirst(lc);
ScanDirection indexscandir;
/* Ignore non-btree indexes */
if (index->relam != BTREE_AM_OID)
continue;
/*
* Ignore partial indexes --- we only want stats that cover the entire
* relation.
*/
if (index->indpred != NIL)
continue;
/*
* The index list might include hypothetical indexes inserted by a
* get_relation_info hook --- don't try to access them.
*/
if (index->hypothetical)
continue;
/*
* The first index column must match the desired variable and sort
* operator --- but we can use a descending-order index.
*/
if (!match_index_to_operand(vardata->var, 0, index))
continue;
switch (get_op_opfamily_strategy(sortop, index->sortopfamily[0]))
{
case BTLessStrategyNumber:
if (index->reverse_sort[0])
indexscandir = BackwardScanDirection;
else
indexscandir = ForwardScanDirection;
break;
case BTGreaterStrategyNumber:
if (index->reverse_sort[0])
indexscandir = ForwardScanDirection;
else
indexscandir = BackwardScanDirection;
break;
default:
/* index doesn't match the sortop */
continue;
}
/*
* Found a suitable index to extract data from. We'll need an EState
* and a bunch of other infrastructure.
*/
{
EState *estate;
ExprContext *econtext;
MemoryContext tmpcontext;
MemoryContext oldcontext;
Relation heapRel;
Relation indexRel;
IndexInfo *indexInfo;
TupleTableSlot *slot;
int16 typLen;
bool typByVal;
ScanKeyData scankeys[1];
IndexScanDesc index_scan;
Datum values[INDEX_MAX_KEYS];
bool isnull[INDEX_MAX_KEYS];
SnapshotData SnapshotNonVacuumable;
estate = CreateExecutorState();
econtext = GetPerTupleExprContext(estate);
/* Make sure any cruft is generated in the econtext's memory */
tmpcontext = econtext->ecxt_per_tuple_memory;
oldcontext = MemoryContextSwitchTo(tmpcontext);
/*
* Open the table and index so we can read from them. We should
* already have some type of lock on each.
*/
heapRel = table_open(rte->relid, NoLock);
indexRel = index_open(index->indexoid, NoLock);
/* extract index key information from the index's pg_index info */
indexInfo = BuildIndexInfo(indexRel);
/* some other stuff */
slot = table_slot_create(heapRel, NULL);
econtext->ecxt_scantuple = slot;
get_typlenbyval(vardata->atttype, &typLen, &typByVal);
InitNonVacuumableSnapshot(SnapshotNonVacuumable, RecentGlobalXmin);
/* set up an IS NOT NULL scan key so that we ignore nulls */
ScanKeyEntryInitialize(&scankeys[0],
SK_ISNULL | SK_SEARCHNOTNULL,
1, /* index col to scan */
InvalidStrategy, /* no strategy */
InvalidOid, /* no strategy subtype */
InvalidOid, /* no collation */
InvalidOid, /* no reg proc for this */
(Datum) 0); /* constant */
have_data = true;
/* If min is requested ... */
if (min)
{
/*
* In principle, we should scan the index with our current
* active snapshot, which is the best approximation we've got
* to what the query will see when executed. But that won't
* be exact if a new snap is taken before running the query,
* and it can be very expensive if a lot of recently-dead or
* uncommitted rows exist at the beginning or end of the index
* (because we'll laboriously fetch each one and reject it).
* Instead, we use SnapshotNonVacuumable. That will accept
* recently-dead and uncommitted rows as well as normal
* visible rows. On the other hand, it will reject known-dead
* rows, and thus not give a bogus answer when the extreme
* value has been deleted (unless the deletion was quite
* recent); that case motivates not using SnapshotAny here.
*
* A crucial point here is that SnapshotNonVacuumable, with
* RecentGlobalXmin as horizon, yields the inverse of the
* condition that the indexscan will use to decide that index
* entries are killable (see heap_hot_search_buffer()).
* Therefore, if the snapshot rejects a tuple and we have to
* continue scanning past it, we know that the indexscan will
* mark that index entry killed. That means that the next
* get_actual_variable_range() call will not have to visit
* that heap entry. In this way we avoid repetitive work when
* this function is used a lot during planning.
*/
index_scan = index_beginscan(heapRel, indexRel,
&SnapshotNonVacuumable,
1, 0);
index_rescan(index_scan, scankeys, 1, NULL, 0);
/* Fetch first tuple in sortop's direction */
if (index_getnext_slot(index_scan, indexscandir, slot))
{
/* Extract the index column values from the slot */
FormIndexDatum(indexInfo, slot, estate,
values, isnull);
/* Shouldn't have got a null, but be careful */
if (isnull[0])
elog(ERROR, "found unexpected null value in index \"%s\"",
RelationGetRelationName(indexRel));
/* Copy the index column value out to caller's context */
MemoryContextSwitchTo(oldcontext);
*min = datumCopy(values[0], typByVal, typLen);
MemoryContextSwitchTo(tmpcontext);
}
else
have_data = false;
index_endscan(index_scan);
}
/* If max is requested, and we didn't find the index is empty */
if (max && have_data)
{
index_scan = index_beginscan(heapRel, indexRel,
&SnapshotNonVacuumable,
1, 0);
index_rescan(index_scan, scankeys, 1, NULL, 0);
/* Fetch first tuple in reverse direction */
if (index_getnext_slot(index_scan, -indexscandir, slot))
{
/* Extract the index column values from the slot */
FormIndexDatum(indexInfo, slot, estate,
values, isnull);
/* Shouldn't have got a null, but be careful */
if (isnull[0])
elog(ERROR, "found unexpected null value in index \"%s\"",
RelationGetRelationName(indexRel));
/* Copy the index column value out to caller's context */
MemoryContextSwitchTo(oldcontext);
*max = datumCopy(values[0], typByVal, typLen);
MemoryContextSwitchTo(tmpcontext);
}
else
have_data = false;
index_endscan(index_scan);
}
/* Clean everything up */
ExecDropSingleTupleTableSlot(slot);
index_close(indexRel, NoLock);
table_close(heapRel, NoLock);
MemoryContextSwitchTo(oldcontext);
FreeExecutorState(estate);
/* And we're done */
break;
}
}
return have_data;
}
/*
* find_join_input_rel
* Look up the input relation for a join.
*
* We assume that the input relation's RelOptInfo must have been constructed
* already.
*/
static RelOptInfo *
find_join_input_rel(PlannerInfo *root, Relids relids)
{
RelOptInfo *rel = NULL;
switch (bms_membership(relids))
{
case BMS_EMPTY_SET:
/* should not happen */
break;
case BMS_SINGLETON:
rel = find_base_rel(root, bms_singleton_member(relids));
break;
case BMS_MULTIPLE:
rel = find_join_rel(root, relids);
break;
}
if (rel == NULL)
elog(ERROR, "could not find RelOptInfo for given relids");
return rel;
}
/*-------------------------------------------------------------------------
*
* Index cost estimation functions
*
*-------------------------------------------------------------------------
*/
/*
* Extract the actual indexquals (as RestrictInfos) from an IndexClause list
*/
List *
get_quals_from_indexclauses(List *indexclauses)
{
List *result = NIL;
ListCell *lc;
foreach(lc, indexclauses)
{
IndexClause *iclause = lfirst_node(IndexClause, lc);
ListCell *lc2;
foreach(lc2, iclause->indexquals)
{
RestrictInfo *rinfo = lfirst_node(RestrictInfo, lc2);
result = lappend(result, rinfo);
}
}
return result;
}
/*
* Compute the total evaluation cost of the comparison operands in a list
* of index qual expressions. Since we know these will be evaluated just
* once per scan, there's no need to distinguish startup from per-row cost.
*
* This can be used either on the result of get_quals_from_indexclauses(),
* or directly on an indexorderbys list. In both cases, we expect that the
* index key expression is on the left side of binary clauses.
*/
Cost
index_other_operands_eval_cost(PlannerInfo *root, List *indexquals)
{
Cost qual_arg_cost = 0;
ListCell *lc;
foreach(lc, indexquals)
{
Expr *clause = (Expr *) lfirst(lc);
Node *other_operand;
QualCost index_qual_cost;
/*
* Index quals will have RestrictInfos, indexorderbys won't. Look
* through RestrictInfo if present.
*/
if (IsA(clause, RestrictInfo))
clause = ((RestrictInfo *) clause)->clause;
if (IsA(clause, OpExpr))
{
OpExpr *op = (OpExpr *) clause;
other_operand = (Node *) lsecond(op->args);
}
else if (IsA(clause, RowCompareExpr))
{
RowCompareExpr *rc = (RowCompareExpr *) clause;
other_operand = (Node *) rc->rargs;
}
else if (IsA(clause, ScalarArrayOpExpr))
{
ScalarArrayOpExpr *saop = (ScalarArrayOpExpr *) clause;
other_operand = (Node *) lsecond(saop->args);
}
else if (IsA(clause, NullTest))
{
other_operand = NULL;
}
else
{
elog(ERROR, "unsupported indexqual type: %d",
(int) nodeTag(clause));
other_operand = NULL; /* keep compiler quiet */
}
cost_qual_eval_node(&index_qual_cost, other_operand, root);
qual_arg_cost += index_qual_cost.startup + index_qual_cost.per_tuple;
}
return qual_arg_cost;
}
void
genericcostestimate(PlannerInfo *root,
IndexPath *path,
double loop_count,
GenericCosts *costs)
{
IndexOptInfo *index = path->indexinfo;
List *indexQuals = get_quals_from_indexclauses(path->indexclauses);
List *indexOrderBys = path->indexorderbys;
Cost indexStartupCost;
Cost indexTotalCost;
Selectivity indexSelectivity;
double indexCorrelation;
double numIndexPages;
double numIndexTuples;
double spc_random_page_cost;
double num_sa_scans;
double num_outer_scans;
double num_scans;
double qual_op_cost;
double qual_arg_cost;
List *selectivityQuals;
ListCell *l;
/*
* If the index is partial, AND the index predicate with the explicitly
* given indexquals to produce a more accurate idea of the index
* selectivity.
*/
selectivityQuals = add_predicate_to_index_quals(index, indexQuals);
/*
* Check for ScalarArrayOpExpr index quals, and estimate the number of
* index scans that will be performed.
*/
num_sa_scans = 1;
foreach(l, indexQuals)
{
RestrictInfo *rinfo = (RestrictInfo *) lfirst(l);
if (IsA(rinfo->clause, ScalarArrayOpExpr))
{
ScalarArrayOpExpr *saop = (ScalarArrayOpExpr *) rinfo->clause;
int alength = estimate_array_length(lsecond(saop->args));
if (alength > 1)
num_sa_scans *= alength;
}
}
/* Estimate the fraction of main-table tuples that will be visited */
indexSelectivity = clauselist_selectivity(root, selectivityQuals,
index->rel->relid,
JOIN_INNER,
NULL);
/*
* If caller didn't give us an estimate, estimate the number of index
* tuples that will be visited. We do it in this rather peculiar-looking
* way in order to get the right answer for partial indexes.
*/
numIndexTuples = costs->numIndexTuples;
if (numIndexTuples <= 0.0)
{
numIndexTuples = indexSelectivity * index->rel->tuples;
/*
* The above calculation counts all the tuples visited across all
* scans induced by ScalarArrayOpExpr nodes. We want to consider the
* average per-indexscan number, so adjust. This is a handy place to
* round to integer, too. (If caller supplied tuple estimate, it's
* responsible for handling these considerations.)
*/
numIndexTuples = rint(numIndexTuples / num_sa_scans);
}
/*
* We can bound the number of tuples by the index size in any case. Also,
* always estimate at least one tuple is touched, even when
* indexSelectivity estimate is tiny.
*/
if (numIndexTuples > index->tuples)
numIndexTuples = index->tuples;
if (numIndexTuples < 1.0)
numIndexTuples = 1.0;
/*
* Estimate the number of index pages that will be retrieved.
*
* We use the simplistic method of taking a pro-rata fraction of the total
* number of index pages. In effect, this counts only leaf pages and not
* any overhead such as index metapage or upper tree levels.
*
* In practice access to upper index levels is often nearly free because
* those tend to stay in cache under load; moreover, the cost involved is
* highly dependent on index type. We therefore ignore such costs here
* and leave it to the caller to add a suitable charge if needed.
*/
if (index->pages > 1 && index->tuples > 1)
numIndexPages = ceil(numIndexTuples * index->pages / index->tuples);
else
numIndexPages = 1.0;
/* fetch estimated page cost for tablespace containing index */
get_tablespace_page_costs(index->reltablespace,
&spc_random_page_cost,
NULL);
/*
* Now compute the disk access costs.
*
* The above calculations are all per-index-scan. However, if we are in a
* nestloop inner scan, we can expect the scan to be repeated (with
* different search keys) for each row of the outer relation. Likewise,
* ScalarArrayOpExpr quals result in multiple index scans. This creates
* the potential for cache effects to reduce the number of disk page
* fetches needed. We want to estimate the average per-scan I/O cost in
* the presence of caching.
*
* We use the Mackert-Lohman formula (see costsize.c for details) to
* estimate the total number of page fetches that occur. While this
* wasn't what it was designed for, it seems a reasonable model anyway.
* Note that we are counting pages not tuples anymore, so we take N = T =
* index size, as if there were one "tuple" per page.
*/
num_outer_scans = loop_count;
num_scans = num_sa_scans * num_outer_scans;
if (num_scans > 1)
{
double pages_fetched;
/* total page fetches ignoring cache effects */
pages_fetched = numIndexPages * num_scans;
/* use Mackert and Lohman formula to adjust for cache effects */
pages_fetched = index_pages_fetched(pages_fetched,
index->pages,
(double) index->pages,
root);
/*
* Now compute the total disk access cost, and then report a pro-rated
* share for each outer scan. (Don't pro-rate for ScalarArrayOpExpr,
* since that's internal to the indexscan.)
*/
indexTotalCost = (pages_fetched * spc_random_page_cost)
/ num_outer_scans;
}
else
{
/*
* For a single index scan, we just charge spc_random_page_cost per
* page touched.
*/
indexTotalCost = numIndexPages * spc_random_page_cost;
}
/*
* CPU cost: any complex expressions in the indexquals will need to be
* evaluated once at the start of the scan to reduce them to runtime keys
* to pass to the index AM (see nodeIndexscan.c). We model the per-tuple
* CPU costs as cpu_index_tuple_cost plus one cpu_operator_cost per
* indexqual operator. Because we have numIndexTuples as a per-scan
* number, we have to multiply by num_sa_scans to get the correct result
* for ScalarArrayOpExpr cases. Similarly add in costs for any index
* ORDER BY expressions.
*
* Note: this neglects the possible costs of rechecking lossy operators.
* Detecting that that might be needed seems more expensive than it's
* worth, though, considering all the other inaccuracies here ...
*/
qual_arg_cost = index_other_operands_eval_cost(root, indexQuals) +
index_other_operands_eval_cost(root, indexOrderBys);
qual_op_cost = cpu_operator_cost *
(list_length(indexQuals) + list_length(indexOrderBys));
indexStartupCost = qual_arg_cost;
indexTotalCost += qual_arg_cost;
indexTotalCost += numIndexTuples * num_sa_scans * (cpu_index_tuple_cost + qual_op_cost);
/*
* Generic assumption about index correlation: there isn't any.
*/
indexCorrelation = 0.0;
/*
* Return everything to caller.
*/
costs->indexStartupCost = indexStartupCost;
costs->indexTotalCost = indexTotalCost;
costs->indexSelectivity = indexSelectivity;
costs->indexCorrelation = indexCorrelation;
costs->numIndexPages = numIndexPages;
costs->numIndexTuples = numIndexTuples;
costs->spc_random_page_cost = spc_random_page_cost;
costs->num_sa_scans = num_sa_scans;
}
/*
* If the index is partial, add its predicate to the given qual list.
*
* ANDing the index predicate with the explicitly given indexquals produces
* a more accurate idea of the index's selectivity. However, we need to be
* careful not to insert redundant clauses, because clauselist_selectivity()
* is easily fooled into computing a too-low selectivity estimate. Our
* approach is to add only the predicate clause(s) that cannot be proven to
* be implied by the given indexquals. This successfully handles cases such
* as a qual "x = 42" used with a partial index "WHERE x >= 40 AND x < 50".
* There are many other cases where we won't detect redundancy, leading to a
* too-low selectivity estimate, which will bias the system in favor of using
* partial indexes where possible. That is not necessarily bad though.
*
* Note that indexQuals contains RestrictInfo nodes while the indpred
* does not, so the output list will be mixed. This is OK for both
* predicate_implied_by() and clauselist_selectivity(), but might be
* problematic if the result were passed to other things.
*/
List *
add_predicate_to_index_quals(IndexOptInfo *index, List *indexQuals)
{
List *predExtraQuals = NIL;
ListCell *lc;
if (index->indpred == NIL)
return indexQuals;
foreach(lc, index->indpred)
{
Node *predQual = (Node *) lfirst(lc);
List *oneQual = list_make1(predQual);
if (!predicate_implied_by(oneQual, indexQuals, false))
predExtraQuals = list_concat(predExtraQuals, oneQual);
}
/* list_concat avoids modifying the passed-in indexQuals list */
return list_concat(predExtraQuals, indexQuals);
}
void
btcostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
Cost *indexStartupCost, Cost *indexTotalCost,
Selectivity *indexSelectivity, double *indexCorrelation,
double *indexPages)
{
IndexOptInfo *index = path->indexinfo;
GenericCosts costs;
Oid relid;
AttrNumber colnum;
VariableStatData vardata;
double numIndexTuples;
Cost descentCost;
List *indexBoundQuals;
int indexcol;
bool eqQualHere;
bool found_saop;
bool found_is_null_op;
double num_sa_scans;
ListCell *lc;
/*
* For a btree scan, only leading '=' quals plus inequality quals for the
* immediately next attribute contribute to index selectivity (these are
* the "boundary quals" that determine the starting and stopping points of
* the index scan). Additional quals can suppress visits to the heap, so
* it's OK to count them in indexSelectivity, but they should not count
* for estimating numIndexTuples. So we must examine the given indexquals
* to find out which ones count as boundary quals. We rely on the
* knowledge that they are given in index column order.
*
* For a RowCompareExpr, we consider only the first column, just as
* rowcomparesel() does.
*
* If there's a ScalarArrayOpExpr in the quals, we'll actually perform N
* index scans not one, but the ScalarArrayOpExpr's operator can be
* considered to act the same as it normally does.
*/
indexBoundQuals = NIL;
indexcol = 0;
eqQualHere = false;
found_saop = false;
found_is_null_op = false;
num_sa_scans = 1;
foreach(lc, path->indexclauses)
{
IndexClause *iclause = lfirst_node(IndexClause, lc);
ListCell *lc2;
if (indexcol != iclause->indexcol)
{
/* Beginning of a new column's quals */
if (!eqQualHere)
break; /* done if no '=' qual for indexcol */
eqQualHere = false;
indexcol++;
if (indexcol != iclause->indexcol)
break; /* no quals at all for indexcol */
}
/* Examine each indexqual associated with this index clause */
foreach(lc2, iclause->indexquals)
{
RestrictInfo *rinfo = lfirst_node(RestrictInfo, lc2);
Expr *clause = rinfo->clause;
Oid clause_op = InvalidOid;
int op_strategy;
if (IsA(clause, OpExpr))
{
OpExpr *op = (OpExpr *) clause;
clause_op = op->opno;
}
else if (IsA(clause, RowCompareExpr))
{
RowCompareExpr *rc = (RowCompareExpr *) clause;
clause_op = linitial_oid(rc->opnos);
}
else if (IsA(clause, ScalarArrayOpExpr))
{
ScalarArrayOpExpr *saop = (ScalarArrayOpExpr *) clause;
Node *other_operand = (Node *) lsecond(saop->args);
int alength = estimate_array_length(other_operand);
clause_op = saop->opno;
found_saop = true;
/* count number of SA scans induced by indexBoundQuals only */
if (alength > 1)
num_sa_scans *= alength;
}
else if (IsA(clause, NullTest))
{
NullTest *nt = (NullTest *) clause;
if (nt->nulltesttype == IS_NULL)
{
found_is_null_op = true;
/* IS NULL is like = for selectivity purposes */
eqQualHere = true;
}
}
else
elog(ERROR, "unsupported indexqual type: %d",
(int) nodeTag(clause));
/* check for equality operator */
if (OidIsValid(clause_op))
{
op_strategy = get_op_opfamily_strategy(clause_op,
index->opfamily[indexcol]);
Assert(op_strategy != 0); /* not a member of opfamily?? */
if (op_strategy == BTEqualStrategyNumber)
eqQualHere = true;
}
indexBoundQuals = lappend(indexBoundQuals, rinfo);
}
}
/*
* If index is unique and we found an '=' clause for each column, we can
* just assume numIndexTuples = 1 and skip the expensive
* clauselist_selectivity calculations. However, a ScalarArrayOp or
* NullTest invalidates that theory, even though it sets eqQualHere.
*/
if (index->unique &&
indexcol == index->nkeycolumns - 1 &&
eqQualHere &&
!found_saop &&
!found_is_null_op)
numIndexTuples = 1.0;
else
{
List *selectivityQuals;
Selectivity btreeSelectivity;
/*
* If the index is partial, AND the index predicate with the
* index-bound quals to produce a more accurate idea of the number of
* rows covered by the bound conditions.
*/
selectivityQuals = add_predicate_to_index_quals(index, indexBoundQuals);
btreeSelectivity = clauselist_selectivity(root, selectivityQuals,
index->rel->relid,
JOIN_INNER,
NULL);
numIndexTuples = btreeSelectivity * index->rel->tuples;
/*
* As in genericcostestimate(), we have to adjust for any
* ScalarArrayOpExpr quals included in indexBoundQuals, and then round
* to integer.
*/
numIndexTuples = rint(numIndexTuples / num_sa_scans);
}
/*
* Now do generic index cost estimation.
*/
MemSet(&costs, 0, sizeof(costs));
costs.numIndexTuples = numIndexTuples;
genericcostestimate(root, path, loop_count, &costs);
/*
* Add a CPU-cost component to represent the costs of initial btree
* descent. We don't charge any I/O cost for touching upper btree levels,
* since they tend to stay in cache, but we still have to do about log2(N)
* comparisons to descend a btree of N leaf tuples. We charge one
* cpu_operator_cost per comparison.
*
* If there are ScalarArrayOpExprs, charge this once per SA scan. The
* ones after the first one are not startup cost so far as the overall
* plan is concerned, so add them only to "total" cost.
*/
if (index->tuples > 1) /* avoid computing log(0) */
{
descentCost = ceil(log(index->tuples) / log(2.0)) * cpu_operator_cost;
costs.indexStartupCost += descentCost;
costs.indexTotalCost += costs.num_sa_scans * descentCost;
}
/*
* Even though we're not charging I/O cost for touching upper btree pages,
* it's still reasonable to charge some CPU cost per page descended
* through. Moreover, if we had no such charge at all, bloated indexes
* would appear to have the same search cost as unbloated ones, at least
* in cases where only a single leaf page is expected to be visited. This
* cost is somewhat arbitrarily set at 50x cpu_operator_cost per page
* touched. The number of such pages is btree tree height plus one (ie,
* we charge for the leaf page too). As above, charge once per SA scan.
*/
descentCost = (index->tree_height + 1) * 50.0 * cpu_operator_cost;
costs.indexStartupCost += descentCost;
costs.indexTotalCost += costs.num_sa_scans * descentCost;
/*
* If we can get an estimate of the first column's ordering correlation C
* from pg_statistic, estimate the index correlation as C for a
* single-column index, or C * 0.75 for multiple columns. (The idea here
* is that multiple columns dilute the importance of the first column's
* ordering, but don't negate it entirely. Before 8.0 we divided the
* correlation by the number of columns, but that seems too strong.)
*/
MemSet(&vardata, 0, sizeof(vardata));
if (index->indexkeys[0] != 0)
{
/* Simple variable --- look to stats for the underlying table */
RangeTblEntry *rte = planner_rt_fetch(index->rel->relid, root);
Assert(rte->rtekind == RTE_RELATION);
relid = rte->relid;
Assert(relid != InvalidOid);
colnum = index->indexkeys[0];
if (get_relation_stats_hook &&
(*get_relation_stats_hook) (root, rte, colnum, &vardata))
{
/*
* The hook took control of acquiring a stats tuple. If it did
* supply a tuple, it'd better have supplied a freefunc.
*/
if (HeapTupleIsValid(vardata.statsTuple) &&
!vardata.freefunc)
elog(ERROR, "no function provided to release variable stats with");
}
else
{
vardata.statsTuple = SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(relid),
Int16GetDatum(colnum),
BoolGetDatum(rte->inh));
vardata.freefunc = ReleaseSysCache;
}
}
else
{
/* Expression --- maybe there are stats for the index itself */
relid = index->indexoid;
colnum = 1;
if (get_index_stats_hook &&
(*get_index_stats_hook) (root, relid, colnum, &vardata))
{
/*
* The hook took control of acquiring a stats tuple. If it did
* supply a tuple, it'd better have supplied a freefunc.
*/
if (HeapTupleIsValid(vardata.statsTuple) &&
!vardata.freefunc)
elog(ERROR, "no function provided to release variable stats with");
}
else
{
vardata.statsTuple = SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(relid),
Int16GetDatum(colnum),
BoolGetDatum(false));
vardata.freefunc = ReleaseSysCache;
}
}
if (HeapTupleIsValid(vardata.statsTuple))
{
Oid sortop;
AttStatsSlot sslot;
sortop = get_opfamily_member(index->opfamily[0],
index->opcintype[0],
index->opcintype[0],
BTLessStrategyNumber);
if (OidIsValid(sortop) &&
get_attstatsslot(&sslot, vardata.statsTuple,
STATISTIC_KIND_CORRELATION, sortop,
ATTSTATSSLOT_NUMBERS))
{
double varCorrelation;
Assert(sslot.nnumbers == 1);
varCorrelation = sslot.numbers[0];
if (index->reverse_sort[0])
varCorrelation = -varCorrelation;
if (index->nkeycolumns > 1)
costs.indexCorrelation = varCorrelation * 0.75;
else
costs.indexCorrelation = varCorrelation;
free_attstatsslot(&sslot);
}
}
ReleaseVariableStats(vardata);
*indexStartupCost = costs.indexStartupCost;
*indexTotalCost = costs.indexTotalCost;
*indexSelectivity = costs.indexSelectivity;
*indexCorrelation = costs.indexCorrelation;
*indexPages = costs.numIndexPages;
}
void
hashcostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
Cost *indexStartupCost, Cost *indexTotalCost,
Selectivity *indexSelectivity, double *indexCorrelation,
double *indexPages)
{
GenericCosts costs;
MemSet(&costs, 0, sizeof(costs));
genericcostestimate(root, path, loop_count, &costs);
/*
* A hash index has no descent costs as such, since the index AM can go
* directly to the target bucket after computing the hash value. There
* are a couple of other hash-specific costs that we could conceivably add
* here, though:
*
* Ideally we'd charge spc_random_page_cost for each page in the target
* bucket, not just the numIndexPages pages that genericcostestimate
* thought we'd visit. However in most cases we don't know which bucket
* that will be. There's no point in considering the average bucket size
* because the hash AM makes sure that's always one page.
*
* Likewise, we could consider charging some CPU for each index tuple in
* the bucket, if we knew how many there were. But the per-tuple cost is
* just a hash value comparison, not a general datatype-dependent
* comparison, so any such charge ought to be quite a bit less than
* cpu_operator_cost; which makes it probably not worth worrying about.
*
* A bigger issue is that chance hash-value collisions will result in
* wasted probes into the heap. We don't currently attempt to model this
* cost on the grounds that it's rare, but maybe it's not rare enough.
* (Any fix for this ought to consider the generic lossy-operator problem,
* though; it's not entirely hash-specific.)
*/
*indexStartupCost = costs.indexStartupCost;
*indexTotalCost = costs.indexTotalCost;
*indexSelectivity = costs.indexSelectivity;
*indexCorrelation = costs.indexCorrelation;
*indexPages = costs.numIndexPages;
}
void
gistcostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
Cost *indexStartupCost, Cost *indexTotalCost,
Selectivity *indexSelectivity, double *indexCorrelation,
double *indexPages)
{
IndexOptInfo *index = path->indexinfo;
GenericCosts costs;
Cost descentCost;
MemSet(&costs, 0, sizeof(costs));
genericcostestimate(root, path, loop_count, &costs);
/*
* We model index descent costs similarly to those for btree, but to do
* that we first need an idea of the tree height. We somewhat arbitrarily
* assume that the fanout is 100, meaning the tree height is at most
* log100(index->pages).
*
* Although this computation isn't really expensive enough to require
* caching, we might as well use index->tree_height to cache it.
*/
if (index->tree_height < 0) /* unknown? */
{
if (index->pages > 1) /* avoid computing log(0) */
index->tree_height = (int) (log(index->pages) / log(100.0));
else
index->tree_height = 0;
}
/*
* Add a CPU-cost component to represent the costs of initial descent. We
* just use log(N) here not log2(N) since the branching factor isn't
* necessarily two anyway. As for btree, charge once per SA scan.
*/
if (index->tuples > 1) /* avoid computing log(0) */
{
descentCost = ceil(log(index->tuples)) * cpu_operator_cost;
costs.indexStartupCost += descentCost;
costs.indexTotalCost += costs.num_sa_scans * descentCost;
}
/*
* Likewise add a per-page charge, calculated the same as for btrees.
*/
descentCost = (index->tree_height + 1) * 50.0 * cpu_operator_cost;
costs.indexStartupCost += descentCost;
costs.indexTotalCost += costs.num_sa_scans * descentCost;
*indexStartupCost = costs.indexStartupCost;
*indexTotalCost = costs.indexTotalCost;
*indexSelectivity = costs.indexSelectivity;
*indexCorrelation = costs.indexCorrelation;
*indexPages = costs.numIndexPages;
}
void
spgcostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
Cost *indexStartupCost, Cost *indexTotalCost,
Selectivity *indexSelectivity, double *indexCorrelation,
double *indexPages)
{
IndexOptInfo *index = path->indexinfo;
GenericCosts costs;
Cost descentCost;
MemSet(&costs, 0, sizeof(costs));
genericcostestimate(root, path, loop_count, &costs);
/*
* We model index descent costs similarly to those for btree, but to do
* that we first need an idea of the tree height. We somewhat arbitrarily
* assume that the fanout is 100, meaning the tree height is at most
* log100(index->pages).
*
* Although this computation isn't really expensive enough to require
* caching, we might as well use index->tree_height to cache it.
*/
if (index->tree_height < 0) /* unknown? */
{
if (index->pages > 1) /* avoid computing log(0) */
index->tree_height = (int) (log(index->pages) / log(100.0));
else
index->tree_height = 0;
}
/*
* Add a CPU-cost component to represent the costs of initial descent. We
* just use log(N) here not log2(N) since the branching factor isn't
* necessarily two anyway. As for btree, charge once per SA scan.
*/
if (index->tuples > 1) /* avoid computing log(0) */
{
descentCost = ceil(log(index->tuples)) * cpu_operator_cost;
costs.indexStartupCost += descentCost;
costs.indexTotalCost += costs.num_sa_scans * descentCost;
}
/*
* Likewise add a per-page charge, calculated the same as for btrees.
*/
descentCost = (index->tree_height + 1) * 50.0 * cpu_operator_cost;
costs.indexStartupCost += descentCost;
costs.indexTotalCost += costs.num_sa_scans * descentCost;
*indexStartupCost = costs.indexStartupCost;
*indexTotalCost = costs.indexTotalCost;
*indexSelectivity = costs.indexSelectivity;
*indexCorrelation = costs.indexCorrelation;
*indexPages = costs.numIndexPages;
}
/*
* Support routines for gincostestimate
*/
typedef struct
{
bool haveFullScan;
double partialEntries;
double exactEntries;
double searchEntries;
double arrayScans;
} GinQualCounts;
/*
* Estimate the number of index terms that need to be searched for while
* testing the given GIN query, and increment the counts in *counts
* appropriately. If the query is unsatisfiable, return false.
*/
static bool
gincost_pattern(IndexOptInfo *index, int indexcol,
Oid clause_op, Datum query,
GinQualCounts *counts)
{
Oid extractProcOid;
Oid collation;
int strategy_op;
Oid lefttype,
righttype;
int32 nentries = 0;
bool *partial_matches = NULL;
Pointer *extra_data = NULL;
bool *nullFlags = NULL;
int32 searchMode = GIN_SEARCH_MODE_DEFAULT;
int32 i;
Assert(indexcol < index->nkeycolumns);
/*
* Get the operator's strategy number and declared input data types within
* the index opfamily. (We don't need the latter, but we use
* get_op_opfamily_properties because it will throw error if it fails to
* find a matching pg_amop entry.)
*/
get_op_opfamily_properties(clause_op, index->opfamily[indexcol], false,
&strategy_op, &lefttype, &righttype);
/*
* GIN always uses the "default" support functions, which are those with
* lefttype == righttype == the opclass' opcintype (see
* IndexSupportInitialize in relcache.c).
*/
extractProcOid = get_opfamily_proc(index->opfamily[indexcol],
index->opcintype[indexcol],
index->opcintype[indexcol],
GIN_EXTRACTQUERY_PROC);
if (!OidIsValid(extractProcOid))
{
/* should not happen; throw same error as index_getprocinfo */
elog(ERROR, "missing support function %d for attribute %d of index \"%s\"",
GIN_EXTRACTQUERY_PROC, indexcol + 1,
get_rel_name(index->indexoid));
}
/*
* Choose collation to pass to extractProc (should match initGinState).
*/
if (OidIsValid(index->indexcollations[indexcol]))
collation = index->indexcollations[indexcol];
else
collation = DEFAULT_COLLATION_OID;
OidFunctionCall7Coll(extractProcOid,
collation,
query,
PointerGetDatum(&nentries),
UInt16GetDatum(strategy_op),
PointerGetDatum(&partial_matches),
PointerGetDatum(&extra_data),
PointerGetDatum(&nullFlags),
PointerGetDatum(&searchMode));
if (nentries <= 0 && searchMode == GIN_SEARCH_MODE_DEFAULT)
{
/* No match is possible */
return false;
}
for (i = 0; i < nentries; i++)
{
/*
* For partial match we haven't any information to estimate number of
* matched entries in index, so, we just estimate it as 100
*/
if (partial_matches && partial_matches[i])
counts->partialEntries += 100;
else
counts->exactEntries++;
counts->searchEntries++;
}
if (searchMode == GIN_SEARCH_MODE_INCLUDE_EMPTY)
{
/* Treat "include empty" like an exact-match item */
counts->exactEntries++;
counts->searchEntries++;
}
else if (searchMode != GIN_SEARCH_MODE_DEFAULT)
{
/* It's GIN_SEARCH_MODE_ALL */
counts->haveFullScan = true;
}
return true;
}
/*
* Estimate the number of index terms that need to be searched for while
* testing the given GIN index clause, and increment the counts in *counts
* appropriately. If the query is unsatisfiable, return false.
*/
static bool
gincost_opexpr(PlannerInfo *root,
IndexOptInfo *index,
int indexcol,
OpExpr *clause,
GinQualCounts *counts)
{
Oid clause_op = clause->opno;
Node *operand = (Node *) lsecond(clause->args);
/* aggressively reduce to a constant, and look through relabeling */
operand = estimate_expression_value(root, operand);
if (IsA(operand, RelabelType))
operand = (Node *) ((RelabelType *) operand)->arg;
/*
* It's impossible to call extractQuery method for unknown operand. So
* unless operand is a Const we can't do much; just assume there will be
* one ordinary search entry from the operand at runtime.
*/
if (!IsA(operand, Const))
{
counts->exactEntries++;
counts->searchEntries++;
return true;
}
/* If Const is null, there can be no matches */
if (((Const *) operand)->constisnull)
return false;
/* Otherwise, apply extractQuery and get the actual term counts */
return gincost_pattern(index, indexcol, clause_op,
((Const *) operand)->constvalue,
counts);
}
/*
* Estimate the number of index terms that need to be searched for while
* testing the given GIN index clause, and increment the counts in *counts
* appropriately. If the query is unsatisfiable, return false.
*
* A ScalarArrayOpExpr will give rise to N separate indexscans at runtime,
* each of which involves one value from the RHS array, plus all the
* non-array quals (if any). To model this, we average the counts across
* the RHS elements, and add the averages to the counts in *counts (which
* correspond to per-indexscan costs). We also multiply counts->arrayScans
* by N, causing gincostestimate to scale up its estimates accordingly.
*/
static bool
gincost_scalararrayopexpr(PlannerInfo *root,
IndexOptInfo *index,
int indexcol,
ScalarArrayOpExpr *clause,
double numIndexEntries,
GinQualCounts *counts)
{
Oid clause_op = clause->opno;
Node *rightop = (Node *) lsecond(clause->args);
ArrayType *arrayval;
int16 elmlen;
bool elmbyval;
char elmalign;
int numElems;
Datum *elemValues;
bool *elemNulls;
GinQualCounts arraycounts;
int numPossible = 0;
int i;
Assert(clause->useOr);
/* aggressively reduce to a constant, and look through relabeling */
rightop = estimate_expression_value(root, rightop);
if (IsA(rightop, RelabelType))
rightop = (Node *) ((RelabelType *) rightop)->arg;
/*
* It's impossible to call extractQuery method for unknown operand. So
* unless operand is a Const we can't do much; just assume there will be
* one ordinary search entry from each array entry at runtime, and fall
* back on a probably-bad estimate of the number of array entries.
*/
if (!IsA(rightop, Const))
{
counts->exactEntries++;
counts->searchEntries++;
counts->arrayScans *= estimate_array_length(rightop);
return true;
}
/* If Const is null, there can be no matches */
if (((Const *) rightop)->constisnull)
return false;
/* Otherwise, extract the array elements and iterate over them */
arrayval = DatumGetArrayTypeP(((Const *) rightop)->constvalue);
get_typlenbyvalalign(ARR_ELEMTYPE(arrayval),
&elmlen, &elmbyval, &elmalign);
deconstruct_array(arrayval,
ARR_ELEMTYPE(arrayval),
elmlen, elmbyval, elmalign,
&elemValues, &elemNulls, &numElems);
memset(&arraycounts, 0, sizeof(arraycounts));
for (i = 0; i < numElems; i++)
{
GinQualCounts elemcounts;
/* NULL can't match anything, so ignore, as the executor will */
if (elemNulls[i])
continue;
/* Otherwise, apply extractQuery and get the actual term counts */
memset(&elemcounts, 0, sizeof(elemcounts));
if (gincost_pattern(index, indexcol, clause_op, elemValues[i],
&elemcounts))
{
/* We ignore array elements that are unsatisfiable patterns */
numPossible++;
if (elemcounts.haveFullScan)
{
/*
* Full index scan will be required. We treat this as if
* every key in the index had been listed in the query; is
* that reasonable?
*/
elemcounts.partialEntries = 0;
elemcounts.exactEntries = numIndexEntries;
elemcounts.searchEntries = numIndexEntries;
}
arraycounts.partialEntries += elemcounts.partialEntries;
arraycounts.exactEntries += elemcounts.exactEntries;
arraycounts.searchEntries += elemcounts.searchEntries;
}
}
if (numPossible == 0)
{
/* No satisfiable patterns in the array */
return false;
}
/*
* Now add the averages to the global counts. This will give us an
* estimate of the average number of terms searched for in each indexscan,
* including contributions from both array and non-array quals.
*/
counts->partialEntries += arraycounts.partialEntries / numPossible;
counts->exactEntries += arraycounts.exactEntries / numPossible;
counts->searchEntries += arraycounts.searchEntries / numPossible;
counts->arrayScans *= numPossible;
return true;
}
/*
* GIN has search behavior completely different from other index types
*/
void
gincostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
Cost *indexStartupCost, Cost *indexTotalCost,
Selectivity *indexSelectivity, double *indexCorrelation,
double *indexPages)
{
IndexOptInfo *index = path->indexinfo;
List *indexQuals = get_quals_from_indexclauses(path->indexclauses);
List *selectivityQuals;
double numPages = index->pages,
numTuples = index->tuples;
double numEntryPages,
numDataPages,
numPendingPages,
numEntries;
GinQualCounts counts;
bool matchPossible;
double partialScale;
double entryPagesFetched,
dataPagesFetched,
dataPagesFetchedBySel;
double qual_op_cost,
qual_arg_cost,
spc_random_page_cost,
outer_scans;
Relation indexRel;
GinStatsData ginStats;
ListCell *lc;
/*
* Obtain statistical information from the meta page, if possible. Else
* set ginStats to zeroes, and we'll cope below.
*/
if (!index->hypothetical)
{
/* Lock should have already been obtained in plancat.c */
indexRel = index_open(index->indexoid, NoLock);
ginGetStats(indexRel, &ginStats);
index_close(indexRel, NoLock);
}
else
{
memset(&ginStats, 0, sizeof(ginStats));
}
/*
* Assuming we got valid (nonzero) stats at all, nPendingPages can be
* trusted, but the other fields are data as of the last VACUUM. We can
* scale them up to account for growth since then, but that method only
* goes so far; in the worst case, the stats might be for a completely
* empty index, and scaling them will produce pretty bogus numbers.
* Somewhat arbitrarily, set the cutoff for doing scaling at 4X growth; if
* it's grown more than that, fall back to estimating things only from the
* assumed-accurate index size. But we'll trust nPendingPages in any case
* so long as it's not clearly insane, ie, more than the index size.
*/
if (ginStats.nPendingPages < numPages)
numPendingPages = ginStats.nPendingPages;
else
numPendingPages = 0;
if (numPages > 0 && ginStats.nTotalPages <= numPages &&
ginStats.nTotalPages > numPages / 4 &&
ginStats.nEntryPages > 0 && ginStats.nEntries > 0)
{
/*
* OK, the stats seem close enough to sane to be trusted. But we
* still need to scale them by the ratio numPages / nTotalPages to
* account for growth since the last VACUUM.
*/
double scale = numPages / ginStats.nTotalPages;
numEntryPages = ceil(ginStats.nEntryPages * scale);
numDataPages = ceil(ginStats.nDataPages * scale);
numEntries = ceil(ginStats.nEntries * scale);
/* ensure we didn't round up too much */
numEntryPages = Min(numEntryPages, numPages - numPendingPages);
numDataPages = Min(numDataPages,
numPages - numPendingPages - numEntryPages);
}
else
{
/*
* We might get here because it's a hypothetical index, or an index
* created pre-9.1 and never vacuumed since upgrading (in which case
* its stats would read as zeroes), or just because it's grown too
* much since the last VACUUM for us to put our faith in scaling.
*
* Invent some plausible internal statistics based on the index page
* count (and clamp that to at least 10 pages, just in case). We
* estimate that 90% of the index is entry pages, and the rest is data
* pages. Estimate 100 entries per entry page; this is rather bogus
* since it'll depend on the size of the keys, but it's more robust
* than trying to predict the number of entries per heap tuple.
*/
numPages = Max(numPages, 10);
numEntryPages = floor((numPages - numPendingPages) * 0.90);
numDataPages = numPages - numPendingPages - numEntryPages;
numEntries = floor(numEntryPages * 100);
}
/* In an empty index, numEntries could be zero. Avoid divide-by-zero */
if (numEntries < 1)
numEntries = 1;
/*
* If the index is partial, AND the index predicate with the index-bound
* quals to produce a more accurate idea of the number of rows covered by
* the bound conditions.
*/
selectivityQuals = add_predicate_to_index_quals(index, indexQuals);
/* Estimate the fraction of main-table tuples that will be visited */
*indexSelectivity = clauselist_selectivity(root, selectivityQuals,
index->rel->relid,
JOIN_INNER,
NULL);
/* fetch estimated page cost for tablespace containing index */
get_tablespace_page_costs(index->reltablespace,
&spc_random_page_cost,
NULL);
/*
* Generic assumption about index correlation: there isn't any.
*/
*indexCorrelation = 0.0;
/*
* Examine quals to estimate number of search entries & partial matches
*/
memset(&counts, 0, sizeof(counts));
counts.arrayScans = 1;
matchPossible = true;
foreach(lc, path->indexclauses)
{
IndexClause *iclause = lfirst_node(IndexClause, lc);
ListCell *lc2;
foreach(lc2, iclause->indexquals)
{
RestrictInfo *rinfo = lfirst_node(RestrictInfo, lc2);
Expr *clause = rinfo->clause;
if (IsA(clause, OpExpr))
{
matchPossible = gincost_opexpr(root,
index,
iclause->indexcol,
(OpExpr *) clause,
&counts);
if (!matchPossible)
break;
}
else if (IsA(clause, ScalarArrayOpExpr))
{
matchPossible = gincost_scalararrayopexpr(root,
index,
iclause->indexcol,
(ScalarArrayOpExpr *) clause,
numEntries,
&counts);
if (!matchPossible)
break;
}
else
{
/* shouldn't be anything else for a GIN index */
elog(ERROR, "unsupported GIN indexqual type: %d",
(int) nodeTag(clause));
}
}
}
/* Fall out if there were any provably-unsatisfiable quals */
if (!matchPossible)
{
*indexStartupCost = 0;
*indexTotalCost = 0;
*indexSelectivity = 0;
return;
}
if (counts.haveFullScan || indexQuals == NIL)
{
/*
* Full index scan will be required. We treat this as if every key in
* the index had been listed in the query; is that reasonable?
*/
counts.partialEntries = 0;
counts.exactEntries = numEntries;
counts.searchEntries = numEntries;
}
/* Will we have more than one iteration of a nestloop scan? */
outer_scans = loop_count;
/*
* Compute cost to begin scan, first of all, pay attention to pending
* list.
*/
entryPagesFetched = numPendingPages;
/*
* Estimate number of entry pages read. We need to do
* counts.searchEntries searches. Use a power function as it should be,
* but tuples on leaf pages usually is much greater. Here we include all
* searches in entry tree, including search of first entry in partial
* match algorithm
*/
entryPagesFetched += ceil(counts.searchEntries * rint(pow(numEntryPages, 0.15)));
/*
* Add an estimate of entry pages read by partial match algorithm. It's a
* scan over leaf pages in entry tree. We haven't any useful stats here,
* so estimate it as proportion. Because counts.partialEntries is really
* pretty bogus (see code above), it's possible that it is more than
* numEntries; clamp the proportion to ensure sanity.
*/
partialScale = counts.partialEntries / numEntries;
partialScale = Min(partialScale, 1.0);
entryPagesFetched += ceil(numEntryPages * partialScale);
/*
* Partial match algorithm reads all data pages before doing actual scan,
* so it's a startup cost. Again, we haven't any useful stats here, so
* estimate it as proportion.
*/
dataPagesFetched = ceil(numDataPages * partialScale);
/*
* Calculate cache effects if more than one scan due to nestloops or array
* quals. The result is pro-rated per nestloop scan, but the array qual
* factor shouldn't be pro-rated (compare genericcostestimate).
*/
if (outer_scans > 1 || counts.arrayScans > 1)
{
entryPagesFetched *= outer_scans * counts.arrayScans;
entryPagesFetched = index_pages_fetched(entryPagesFetched,
(BlockNumber) numEntryPages,
numEntryPages, root);
entryPagesFetched /= outer_scans;
dataPagesFetched *= outer_scans * counts.arrayScans;
dataPagesFetched = index_pages_fetched(dataPagesFetched,
(BlockNumber) numDataPages,
numDataPages, root);
dataPagesFetched /= outer_scans;
}
/*
* Here we use random page cost because logically-close pages could be far
* apart on disk.
*/
*indexStartupCost = (entryPagesFetched + dataPagesFetched) * spc_random_page_cost;
/*
* Now compute the number of data pages fetched during the scan.
*
* We assume every entry to have the same number of items, and that there
* is no overlap between them. (XXX: tsvector and array opclasses collect
* statistics on the frequency of individual keys; it would be nice to use
* those here.)
*/
dataPagesFetched = ceil(numDataPages * counts.exactEntries / numEntries);
/*
* If there is a lot of overlap among the entries, in particular if one of
* the entries is very frequent, the above calculation can grossly
* under-estimate. As a simple cross-check, calculate a lower bound based
* on the overall selectivity of the quals. At a minimum, we must read
* one item pointer for each matching entry.
*
* The width of each item pointer varies, based on the level of
* compression. We don't have statistics on that, but an average of
* around 3 bytes per item is fairly typical.
*/
dataPagesFetchedBySel = ceil(*indexSelectivity *
(numTuples / (BLCKSZ / 3)));
if (dataPagesFetchedBySel > dataPagesFetched)
dataPagesFetched = dataPagesFetchedBySel;
/* Account for cache effects, the same as above */
if (outer_scans > 1 || counts.arrayScans > 1)
{
dataPagesFetched *= outer_scans * counts.arrayScans;
dataPagesFetched = index_pages_fetched(dataPagesFetched,
(BlockNumber) numDataPages,
numDataPages, root);
dataPagesFetched /= outer_scans;
}
/* And apply random_page_cost as the cost per page */
*indexTotalCost = *indexStartupCost +
dataPagesFetched * spc_random_page_cost;
/*
* Add on index qual eval costs, much as in genericcostestimate. But we
* can disregard indexorderbys, since GIN doesn't support those.
*/
qual_arg_cost = index_other_operands_eval_cost(root, indexQuals);
qual_op_cost = cpu_operator_cost * list_length(indexQuals);
*indexStartupCost += qual_arg_cost;
*indexTotalCost += qual_arg_cost;
*indexTotalCost += (numTuples * *indexSelectivity) * (cpu_index_tuple_cost + qual_op_cost);
*indexPages = dataPagesFetched;
}
/*
* BRIN has search behavior completely different from other index types
*/
void
brincostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
Cost *indexStartupCost, Cost *indexTotalCost,
Selectivity *indexSelectivity, double *indexCorrelation,
double *indexPages)
{
IndexOptInfo *index = path->indexinfo;
List *indexQuals = get_quals_from_indexclauses(path->indexclauses);
double numPages = index->pages;
RelOptInfo *baserel = index->rel;
RangeTblEntry *rte = planner_rt_fetch(baserel->relid, root);
Cost spc_seq_page_cost;
Cost spc_random_page_cost;
double qual_arg_cost;
double qualSelectivity;
BrinStatsData statsData;
double indexRanges;
double minimalRanges;
double estimatedRanges;
double selec;
Relation indexRel;
ListCell *l;
VariableStatData vardata;
Assert(rte->rtekind == RTE_RELATION);
/* fetch estimated page cost for the tablespace containing the index */
get_tablespace_page_costs(index->reltablespace,
&spc_random_page_cost,
&spc_seq_page_cost);
/*
* Obtain some data from the index itself. A lock should have already
* been obtained on the index in plancat.c.
*/
indexRel = index_open(index->indexoid, NoLock);
brinGetStats(indexRel, &statsData);
index_close(indexRel, NoLock);
/*
* Compute index correlation
*
* Because we can use all index quals equally when scanning, we can use
* the largest correlation (in absolute value) among columns used by the
* query. Start at zero, the worst possible case. If we cannot find any
* correlation statistics, we will keep it as 0.
*/
*indexCorrelation = 0;
foreach(l, path->indexclauses)
{
IndexClause *iclause = lfirst_node(IndexClause, l);
AttrNumber attnum = index->indexkeys[iclause->indexcol];
/* attempt to lookup stats in relation for this index column */
if (attnum != 0)
{
/* Simple variable -- look to stats for the underlying table */
if (get_relation_stats_hook &&
(*get_relation_stats_hook) (root, rte, attnum, &vardata))
{
/*
* The hook took control of acquiring a stats tuple. If it
* did supply a tuple, it'd better have supplied a freefunc.
*/
if (HeapTupleIsValid(vardata.statsTuple) && !vardata.freefunc)
elog(ERROR,
"no function provided to release variable stats with");
}
else
{
vardata.statsTuple =
SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(rte->relid),
Int16GetDatum(attnum),
BoolGetDatum(false));
vardata.freefunc = ReleaseSysCache;
}
}
else
{
/*
* Looks like we've found an expression column in the index. Let's
* see if there's any stats for it.
*/
/* get the attnum from the 0-based index. */
attnum = iclause->indexcol + 1;
if (get_index_stats_hook &&
(*get_index_stats_hook) (root, index->indexoid, attnum, &vardata))
{
/*
* The hook took control of acquiring a stats tuple. If it
* did supply a tuple, it'd better have supplied a freefunc.
*/
if (HeapTupleIsValid(vardata.statsTuple) &&
!vardata.freefunc)
elog(ERROR, "no function provided to release variable stats with");
}
else
{
vardata.statsTuple = SearchSysCache3(STATRELATTINH,
ObjectIdGetDatum(index->indexoid),
Int16GetDatum(attnum),
BoolGetDatum(false));
vardata.freefunc = ReleaseSysCache;
}
}
if (HeapTupleIsValid(vardata.statsTuple))
{
AttStatsSlot sslot;
if (get_attstatsslot(&sslot, vardata.statsTuple,
STATISTIC_KIND_CORRELATION, InvalidOid,
ATTSTATSSLOT_NUMBERS))
{
double varCorrelation = 0.0;
if (sslot.nnumbers > 0)
varCorrelation = Abs(sslot.numbers[0]);
if (varCorrelation > *indexCorrelation)
*indexCorrelation = varCorrelation;
free_attstatsslot(&sslot);
}
}
ReleaseVariableStats(vardata);
}
qualSelectivity = clauselist_selectivity(root, indexQuals,
baserel->relid,
JOIN_INNER, NULL);
/* work out the actual number of ranges in the index */
indexRanges = Max(ceil((double) baserel->pages / statsData.pagesPerRange),
1.0);
/*
* Now calculate the minimum possible ranges we could match with if all of
* the rows were in the perfect order in the table's heap.
*/
minimalRanges = ceil(indexRanges * qualSelectivity);
/*
* Now estimate the number of ranges that we'll touch by using the
* indexCorrelation from the stats. Careful not to divide by zero (note
* we're using the absolute value of the correlation).
*/
if (*indexCorrelation < 1.0e-10)
estimatedRanges = indexRanges;
else
estimatedRanges = Min(minimalRanges / *indexCorrelation, indexRanges);
/* we expect to visit this portion of the table */
selec = estimatedRanges / indexRanges;
CLAMP_PROBABILITY(selec);
*indexSelectivity = selec;
/*
* Compute the index qual costs, much as in genericcostestimate, to add to
* the index costs. We can disregard indexorderbys, since BRIN doesn't
* support those.
*/
qual_arg_cost = index_other_operands_eval_cost(root, indexQuals);
/*
* Compute the startup cost as the cost to read the whole revmap
* sequentially, including the cost to execute the index quals.
*/
*indexStartupCost =
spc_seq_page_cost * statsData.revmapNumPages * loop_count;
*indexStartupCost += qual_arg_cost;
/*
* To read a BRIN index there might be a bit of back and forth over
* regular pages, as revmap might point to them out of sequential order;
* calculate the total cost as reading the whole index in random order.
*/
*indexTotalCost = *indexStartupCost +
spc_random_page_cost * (numPages - statsData.revmapNumPages) * loop_count;
/*
* Charge a small amount per range tuple which we expect to match to. This
* is meant to reflect the costs of manipulating the bitmap. The BRIN scan
* will set a bit for each page in the range when we find a matching
* range, so we must multiply the charge by the number of pages in the
* range.
*/
*indexTotalCost += 0.1 * cpu_operator_cost * estimatedRanges *
statsData.pagesPerRange;
*indexPages = index->pages;
}
|
!function(){"use strict";var e,t,n,a,s,c,r,o={},i={};function f(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={id:e,loaded:!1,exports:{}};return o[e].call(n.exports,n,n.exports,f),n.loaded=!0,n.exports}f.m=o,e=[],f.O=function(t,n,a,s){if(!n){var c=1/0;for(i=0;i<e.length;i++){n=e[i][0],a=e[i][1],s=e[i][2];for(var r=!0,o=0;o<n.length;o++)(!1&s||c>=s)&&Object.keys(f.O).every((function(e){return f.O[e](n[o])}))?n.splice(o--,1):(r=!1,s<c&&(c=s));r&&(e.splice(i--,1),t=a())}return t}s=s||0;for(var i=e.length;i>0&&e[i-1][2]>s;i--)e[i]=e[i-1];e[i]=[n,a,s]},f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},f.t=function(e,a){if(1&a&&(e=this(e)),8&a)return e;if("object"==typeof e&&e){if(4&a&&e.__esModule)return e;if(16&a&&"function"==typeof e.then)return e}var s=Object.create(null);f.r(s);var c={};t=t||[null,n({}),n([]),n(n)];for(var r=2&a&&e;"object"==typeof r&&!~t.indexOf(r);r=n(r))Object.getOwnPropertyNames(r).forEach((function(t){c[t]=function(){return e[t]}}));return c.default=function(){return e},f.d(s,c),s},f.d=function(e,t){for(var n in t)f.o(t,n)&&!f.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},f.f={},f.e=function(e){return Promise.all(Object.keys(f.f).reduce((function(t,n){return f.f[n](e,t),t}),[]))},f.u=function(e){return({32:"component---packages-themes-gatsby-theme-flexiblocks-src-pages-campaigns-index-jsx",42:"component---packages-themes-gatsby-theme-flexiblocks-src-pages-one-index-jsx",71:"component---packages-themes-gatsby-theme-flexiblocks-src-pages-classic-esp-pricing-index-jsx",100:"component---packages-themes-gatsby-theme-flexiblocks-src-pages-classic-features-index-jsx",115:"component---packages-themes-gatsby-theme-flexiblocks-src-pages-smsplus-index-jsx",149:"component---packages-themes-gatsby-theme-flexiblocks-src-pages-index-jsx",153:"component---packages-themes-gatsby-theme-flexiblocks-src-pages-one-features-index-jsx",246:"component---packages-themes-gatsby-theme-flexiblocks-src-pages-one-marketing-glossary-index-jsx",279:"component---packages-themes-gatsby-theme-flexiblocks-src-pages-404-jsx",351:"commons",402:"component---packages-themes-gatsby-theme-flexiblocks-src-pages-about-us-index-jsx",470:"component---packages-themes-gatsby-theme-flexiblocks-src-pages-campaigns-request-demo-index-jsx",532:"styles",559:"component---packages-themes-gatsby-theme-flexiblocks-src-pages-classic-esp-index-jsx",616:"component---packages-themes-gatsby-theme-flexiblocks-src-pages-campaigns-pricing-index-jsx",642:"c8b05f54",706:"component---packages-themes-gatsby-theme-flexiblocks-src-pages-classic-index-jsx",768:"119cf9a2",773:"component---packages-themes-gatsby-theme-flexiblocks-src-pages-one-testimonials-index-jsx",774:"framework",794:"e2070dfd",841:"e5908a55",875:"b7d41aa0d8c165ba1fb79e41319f95ddb418a734",891:"component---packages-themes-gatsby-theme-flexiblocks-src-pages-one-marketing-cheatsheet-index-jsx",894:"component---packages-themes-gatsby-theme-flexiblocks-src-pages-sms-index-jsx",935:"b0bcc41ec8a92904d7341ff898b5005408fa3478",960:"component---packages-themes-gatsby-theme-flexiblocks-src-pages-classic-pricing-index-jsx",962:"component---packages-themes-gatsby-theme-flexiblocks-src-pages-classic-request-demo-index-jsx",969:"fa5f8105",970:"component---packages-themes-gatsby-theme-flexiblocks-src-pages-campaigns-features-index-jsx",988:"component---packages-themes-gatsby-theme-flexiblocks-src-pages-contact-us-index-jsx"}[e]||e)+"-"+{32:"926df839a9207f85f684",42:"cd1e5c239c0e16813c3d",71:"c5c1f20f703d3375554f",100:"8528e6251751db8e149f",115:"9af86e07ba66926678e4",149:"05c81441993ae119b4d0",153:"2d1a83ae4b40e9506a9f",246:"e073f1b5de7a33dc26a8",279:"8620c909326d5f63e348",351:"2821aee47673d62fbd96",402:"694406f47f4872f72dbc",470:"2e58f05e8102d9a51ed2",532:"6949df5076161066ef8c",559:"8687e3f392e2ae5e4c79",571:"60c0abc0462d2b073e74",616:"b76bc0c6f2f72944a2e6",642:"7bb695022f7b670a8761",668:"4506deb8c9ddca97e2b7",706:"da57d3e9eca08c8ab582",712:"c596677e55e600871019",768:"ef452963f2c3a4ebd3a4",773:"6760a6f6f12d69516868",774:"90b12af13089c037de84",794:"0413fbdb0a764ba067c1",841:"7fac9d549dfdb6a12aff",875:"e57a9f034a09c964b798",891:"6f76135720b9376c1fe9",894:"dacb64479457f6dba42f",935:"f8deb3dcb1c4f93deafc",960:"301cfba30035962063b2",962:"75cd38ffa98aa6551b0a",969:"2a612930289373b89bd0",970:"dc3f068bbff077a7dd93",988:"658b1c3b55c0b3ab1f94"}[e]+".js"},f.miniCssF=function(e){return"styles.5c3e420cd074d5aff02d.css"},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a={},s="@elegantstack/gatsby-starter-flexiblocks:",f.l=function(e,t,n,c){if(a[e])a[e].push(t);else{var r,o;if(void 0!==n)for(var i=document.getElementsByTagName("script"),l=0;l<i.length;l++){var u=i[l];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==s+n){r=u;break}}r||(o=!0,(r=document.createElement("script")).charset="utf-8",r.timeout=120,f.nc&&r.setAttribute("nonce",f.nc),r.setAttribute("data-webpack",s+n),r.src=e),a[e]=[t];var d=function(t,n){r.onerror=r.onload=null,clearTimeout(b);var s=a[e];if(delete a[e],r.parentNode&&r.parentNode.removeChild(r),s&&s.forEach((function(e){return e(n)})),t)return t(n)},b=setTimeout(d.bind(null,void 0,{type:"timeout",target:r}),12e4);r.onerror=d.bind(null,r.onerror),r.onload=d.bind(null,r.onload),o&&document.head.appendChild(r)}},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},f.p="/",c=function(e){return new Promise((function(t,n){var a=f.miniCssF(e),s=f.p+a;if(function(e,t){for(var n=document.getElementsByTagName("link"),a=0;a<n.length;a++){var s=(r=n[a]).getAttribute("data-href")||r.getAttribute("href");if("stylesheet"===r.rel&&(s===e||s===t))return r}var c=document.getElementsByTagName("style");for(a=0;a<c.length;a++){var r;if((s=(r=c[a]).getAttribute("data-href"))===e||s===t)return r}}(a,s))return t();!function(e,t,n,a){var s=document.createElement("link");s.rel="stylesheet",s.type="text/css",s.onerror=s.onload=function(c){if(s.onerror=s.onload=null,"load"===c.type)n();else{var r=c&&("load"===c.type?"missing":c.type),o=c&&c.target&&c.target.href||t,i=new Error("Loading CSS chunk "+e+" failed.\n("+o+")");i.code="CSS_CHUNK_LOAD_FAILED",i.type=r,i.request=o,s.parentNode.removeChild(s),a(i)}},s.href=t,document.head.appendChild(s)}(e,s,t,n)}))},r={658:0},f.f.miniCss=function(e,t){r[e]?t.push(r[e]):0!==r[e]&&{532:1}[e]&&t.push(r[e]=c(e).then((function(){r[e]=0}),(function(t){throw delete r[e],t})))},function(){var e={658:0};f.f.j=function(t,n){var a=f.o(e,t)?e[t]:void 0;if(0!==a)if(a)n.push(a[2]);else if(/^(532|658)$/.test(t))e[t]=0;else{var s=new Promise((function(n,s){a=e[t]=[n,s]}));n.push(a[2]=s);var c=f.p+f.u(t),r=new Error;f.l(c,(function(n){if(f.o(e,t)&&(0!==(a=e[t])&&(e[t]=void 0),a)){var s=n&&("load"===n.type?"missing":n.type),c=n&&n.target&&n.target.src;r.message="Loading chunk "+t+" failed.\n("+s+": "+c+")",r.name="ChunkLoadError",r.type=s,r.request=c,a[1](r)}}),"chunk-"+t,t)}},f.O.j=function(t){return 0===e[t]};var t=function(t,n){var a,s,c=n[0],r=n[1],o=n[2],i=0;for(a in r)f.o(r,a)&&(f.m[a]=r[a]);if(o)var l=o(f);for(t&&t(n);i<c.length;i++)s=c[i],f.o(e,s)&&e[s]&&e[s][0](),e[c[i]]=0;return f.O(l)},n=self.webpackChunk_elegantstack_gatsby_starter_flexiblocks=self.webpackChunk_elegantstack_gatsby_starter_flexiblocks||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))}()}();
//# sourceMappingURL=webpack-runtime-950965e65334172f4e0b.js.map
|
define([
'dojo/_base/declare', 'dijit/_WidgetBase', 'dojo/on',
'dojo/dom-class', './Button', 'dojo/dom-construct',
'dijit/Tooltip', 'dojo/dom', 'dojo/_base/event', 'dojo/mouse',
'dojo/topic'
], function (
declare, WidgetBase, on,
domClass, Button, domConstruct,
Tooltip, dom, Event, mouse, Topic
) {
return declare([WidgetBase], {
baseClass: 'ActionBar',
constructor: function () {
this._actions = {};
},
selection: null,
currentContainerType: null,
currentContainerWidget: null,
tooltipPosition: ['before', 'above'],
_setCurrentContainerWidgetAttr: function (widget) {
if (widget.currentContainer === this.currentContainerWidget) {
return;
}
this.currentContainerType = widget.containerType;
this.currentContainerWidget = widget;
this.set('selection', []);
},
_setSelectionAttr: function (sel) {
this.selection = sel;
var valid;
var selectionTypes = {};
sel.filter(function (x) {
return !!x;
}).forEach(function (s) {
var type = s.document_type || s.type;
if (!type) {
return;
}
if (type == 'job_result') {
if (s.autoMeta && s.autoMeta.app) {
if (typeof s.autoMeta.app == 'string') {
type = s.autoMeta.app;
} else if (s.autoMeta.app.id) {
type = s.autoMeta.app.id;
}
}
}
selectionTypes[type] = true;
});
if (sel.length > 1) {
var multiTypedSelection = (Object.keys(selectionTypes).length > 1);
valid = Object.keys(this._actions).filter(function (an) {
return this._actions[an] && this._actions[an].options &&
(this._actions[an].options.multiple &&
((this._actions[an].options.ignoreDataType || !multiTypedSelection ||
(multiTypedSelection && this._actions[an].options.allowMultiTypes)) ) || this._actions[an].options.persistent);
}, this);
// console.log("multiselect valid: ", valid)
} else if (sel.length == 1) {
valid = Object.keys(this._actions);
} else {
valid = Object.keys(this._actions).filter(function (an) {
return this._actions[an] && this._actions[an].options && this._actions[an].options.persistent;
}, this);
}
// Todo: if humanly possible, refactor this into show/hide callbacks or such!
var types = Object.keys(selectionTypes);
valid = valid.filter(function (an) {
var act = this._actions[an];
var validTypes = act.options.validTypes || [];
// only allow genome sharing if all genomes are owned by user
if (sel[0] && an === 'Share') {
var notOwnedList = sel.filter(function (obj) {
return obj.owner !== window.App.user.id;
});
if (notOwnedList.length) {
return false;
}
}
// allow kill job if any of the below
if (sel[0] && an === 'KillJob') {
if (['init', 'pending', 'queued', 'in-progress'].indexOf(sel[0].status) == -1) return false;
}
// if top level "workspace", hide actions
else if (sel[0] && 'isWorkspace' in sel[0] && ['CreateFolder', 'Upload', 'ShowHidden'].indexOf(an) !== -1) {
return false;
}
// if not top level "workspace", hide 'create workspace'
else if (sel[0] && !('isWorkspace' in sel[0]) && ['CreateWorkspace'].indexOf(an) !== -1) {
return false;
}
// don't allow sharing on folders
else if (sel[0] && ('path' in sel[0]) && sel[0].path.split('/').length > 3 && ['ShareFolder'].indexOf(an) !== -1) {
return false;
}
// if public or not owner, hide ability for upload, create folder, delete, share, etc
else if (sel[0] && (
'isPublic' in sel[0] ||
['r', 'n'].indexOf(sel[0].user_permission) !== -1 ||
(sel[0].global_permission == 'r' && window.App.user.id != sel[0].owner_id) ) &&
['Upload', 'CreateFolder', 'Delete', 'ShareFolder', 'Move', 'Rename', 'EditType'].indexOf(an) !== -1) {
return false;
}
else if (sel[0] && sel[0].source && sel[0].source !== 'PATRIC_VF' && an === 'ViewSpgeneEvidence') {
return false;
}
else if (act.options.min && (sel.length < act.options.min )) {
return false;
}
else if (act.options.max && (sel.length > act.options.max )) {
return false;
}
var validContainerTypes = act.options.validContainerTypes || null;
if (validContainerTypes) {
if (!validContainerTypes.some(function (t) {
return ((t == '*') || (t == this.currentContainerType));
}, this)) {
return false;
}
}
return validTypes.some(function (t) {
return ((t == '*') || (types.indexOf(t) >= 0));
});
}, this);
// console.log("ValidTypes: ", valid);
Object.keys(this._actions).forEach(function (an) {
var act = this._actions[an];
if (valid.indexOf(an) >= 0) {
domClass.remove(act.button, 'dijitHidden');
} else {
domClass.add(act.button, 'dijitHidden');
}
}, this);
},
postCreate: function () {
this.inherited(arguments);
var _self = this;
this.containerNode = this.domNode;
// dallow text to be highlighted/copied
// dom.setSelectable(this.domNode, false);
var tooltip = new Tooltip({
connectId: this.domNode,
selector: '.ActionButtonWrapper',
getContent: function (matched) {
var rel = matched.attributes.rel.value;
if (_self._actions[rel] && _self._actions[rel].options && _self._actions[rel].options.tooltip) {
return _self._actions[rel].options.tooltip;
} else if (matched.attributes.title && matched.attributes.title.value) {
return matched.attributes.title.value;
}
return false;
},
position: this.tooltipPosition
});
on(this.domNode, '.ActionButtonWrapper:click', function (evt) {
// console.log("evt.target: ", evt.target);
tooltip.close();
var target;
if (evt && evt.target && evt.target.attributes && evt.target.attributes.rel) {
target = evt.target;
} else {
target = evt.target.parentNode;
}
if (target && target.attributes && target.attributes.rel) {
var rel = target.attributes.rel.value;
if (_self._actions[rel]) {
// console.log("actionButton: ", _self._actions[rel]);
if (_self._actions[rel].options && _self._actions[rel].options.requireAuth && (!window.App.user || !window.App.user.id)) {
Topic.publish('/login');
return;
}
_self._actions[rel].action.apply(_self, [_self.selection, _self.currentContainerWidget, _self._actions[rel].button]);
}
}
domClass.remove(target, 'depressed');
});
on(this.domNode, '.ActionButtonWrapper:mousedown', function (evt) {
var t = evt.target;
if (!domClass.contains(evt.target, 'ActionButtonWrapper')) {
t = evt.target.parentNode;
}
domClass.add(t, 'depressed');
});
on(this.domNode, '.ActionButtonWrapper:mouseout', function (evt) {
var t = evt.target;
if (!domClass.contains(evt.target, 'ActionButtonWrapper')) {
t = evt.target.parentNode;
}
domClass.remove(t, 'depressed');
});
// on(this.domNode, ".ActionButton:mouseover", function(evt){
// console.log("mouseover evt: ", evt.target);
// });
},
addAction: function (name, classes, opts, fn, enabled, target) {
target = target || this.containerNode;
var wrapper = domConstruct.create('div', {
'class':
(enabled ? '' : 'dijitHidden ') +
(opts && opts.disabled ? 'disabled ' : '') +
'ActionButtonWrapper',
rel: name
});
domConstruct.create('div', { className: 'ActionButton ' + classes }, wrapper);
if (opts && opts.label) {
domConstruct.create('div', { innerHTML: opts.label, 'class': 'ActionButtonText' }, wrapper);
}
if (opts && opts.pressAndHold && typeof opts.pressAndHold == 'function') {
var _self = this;
var timer;
on(wrapper, 'mousedown', function (evt) {
var cancelClick = false;
timer = setTimeout(function () {
cancelClick = true;
opts.pressAndHold(_self.get('selection'), wrapper, opts, evt);
}, 800);
on.once(wrapper, 'click', function (clickEvt) {
if (timer) {
clearTimeout(timer);
}
if (cancelClick) {
Event.stop(clickEvt);
}
});
});
}
domConstruct.place(wrapper, target, 'last');
this._actions[name] = {
options: opts,
action: fn,
button: wrapper
};
// return the wrapper for use.
return target;
}
});
});
|
from .. import NCSource
import numpy as np
from os.path import dirname, join
class Era5Source(NCSource):
"""The Era5Source object manages weather data (as netCDF4 files) coming from the
`ERA5 climate data products<https://www.ecmwf.int/en/forecasts/datasets/reanalysis-datasets/era5>`
If furthermore allows access a number of common functionalities and constants which are
often encountered when simulating renewable energy technologies
Note:
-----
Various constants can have been set for this weather source which can impact later simulation workflows.
These constants include:
MAX_LON_DIFFERENCE = 0.26
The maximum longitude difference to accept between a grid cell's center and the coordinates
to extract data for
MAX_LAT_DIFFERENCE = 0.26
The maximum latitude difference to accept between a grid cell's center and the coordinates
to extract data for
WIND_SPEED_HEIGHT_FOR_WIND_ENERGY = 100
The suggested altitude of wind speed data to use for wind-energy simulations
WIND_SPEED_HEIGHT_FOR_SOLAR_ENERGY = 10
The suggested altitude of wind speed data to use for wind-energy simulations
LONG_RUN_AVERAGE_WINDSPEED :
<RESKit path>/weather/Era5Source/data/ERA5_wind_speed_100m_mean.tiff
A path to a raster file with the long-time average wind speed in each grid cell
* Can be used in wind energy simulations
* Calculated at the height specified in `WIND_SPEED_HEIGHT_FOR_WIND_ENERGY`
* Time range includes 1980 until the end of 2019 (the time of first calculation)
* The averaging is performed globally
LONG_RUN_AVERAGE_WINDDIR :
<RESKit path>/weather/Era5Source/data/ERA5_wind_direction_100m_mean.tiff
A path to a raster file with the long-time average wind direction in each grid cell
* Can be used in wind energy simulations
* Calculated at the height specified in `WIND_SPEED_HEIGHT_FOR_WIND_ENERGY`
* Time range includes 1980 until the end of 2019 (the time of first calculation)
* The averaging is performed globally
LONG_RUN_AVERAGE_GHI :
<RESKit path>/weather/Era5Source/data/ERA5_surface_solar_radiation_downwards_mean.tiff
A path to a raster file with the long-time average global horizontal irradiance in
each grid cell
* Can be used in solar energy simulations
* Calculated at the surface
* Time range includes 1980 until the end of 2019 (the time of first calculation)
* The averaging is performed globally
LONG_RUN_AVERAGE_DNI :
<RESKit path>/weather/Era5Source/data/ERA5_total_sky_direct_solar_radiation_at_surface_mean.tiff
A path to a raster file with the long-time average direct horizontal irradiance in
each grid cell
* Can be used in solar energy simulations
* Calculated at the surface and on a horizontal plane (not DNI!)
* Time range includes 1980 until the end of 2019 (the time of first calculation)
* The averaging is performed globally
See Also:
---------
reskit.weather.MerraSource
reskit.weather.SarahSource
reskit.weather.Era5Source
"""
ELEVATED_WIND_SPEED_HEIGHT = 100
SURFACE_WIND_SPEED_HEIGHT = 10
LONG_RUN_AVERAGE_WINDSPEED = join(
dirname(__file__),
"data",
"ERA5_wind_speed_100m_mean.tiff")
LONG_RUN_AVERAGE_WINDDIR = join(
dirname(__file__),
"data",
"ERA5_wind_direction_100m_mean.tiff")
LONG_RUN_AVERAGE_GHI = join(
dirname(__file__),
"data",
"ERA5_surface_solar_radiation_downwards_mean.tiff")
LONG_RUN_AVERAGE_DNI = join(
dirname(__file__),
"data",
"ERA5_total_sky_direct_solar_radiation_at_surface_mean.tiff")
MAX_LON_DIFFERENCE = 0.26
MAX_LAT_DIFFERENCE = 0.26
def __init__(self, source, bounds=None, index_pad=5, **kwargs):
"""Initialize a ERA5 style netCDF4 file source
Compared to the generic NCSource object, the following parameters are automatically set:
* tz = None
* time_name = "time"
* lat_name = "latitude"
* lon_name = "longitude"
* flip_lat = True
* flip_lon = False
* time_offset_minutes = +30
Parameters:
-----------
path : str or list of str
The path to the main data file(s) to load
If multiple files are given, or if a directory of netCDF4 files is given, then it is assumed
that all files ending with the extension '.nc' or '.nc4' should be managed by this object.
* Be sure that all the netCDF4 files given share the same time and spatial dimensions!
bounds : Anything acceptable to geokit.Extent.load(), optional
The boundaries of the data which is needed
* Usage of this will help with memory mangement
* If None, the full dataset is loaded in memory
* The actual extent of the loaded data depends on the source's
available data
index_pad : int, optional
The padding to apply to the boundaries
* Useful in case of interpolation
* Units are in longitudinal degrees
verbose : bool, optional
If True, then status outputs are printed when searching for and reading weather data
forward_fill : bool, optional
If True, then missing data in the weather file is forward-filled
* Generally, there should be no missing data at all. This option is only intended to
catch the rare scenarios where one or two timesteps are missing
See Also:
---------
MerraSource
SarahSource
Era5Source
"""
super().__init__(
source=source,
bounds=bounds,
time_name="time",
lat_name="latitude",
lon_name="longitude",
index_pad=index_pad,
_max_lon_diff=self.MAX_LON_DIFFERENCE,
_max_lat_diff=self.MAX_LAT_DIFFERENCE,
tz=None,
flip_lat=True,
time_offset_minutes=30,
**kwargs)
loc_to_index = NCSource._loc_to_index_rect(0.25, 0.25)
# STANDARD LOADERS
def _load_wind_speed(self, height:int):
u_name = "u{}".format(height)
v_name = "v{}".format(height)
self.load(u_name)
self.load(v_name)
return np.sqrt(self.data[u_name]**2 + self.data[v_name]**2) # total speed
def sload_boundary_layer_height(self):
"""Standard loader function for the variable 'boundary_layer_height' in meters
from the surface
"""
return self.load(
"blh",
"boundary_layer_height")
def sload_elevated_wind_speed(self):
"""Standard loader function for the variable 'elevated_wind_speed'
Automatically reads the variables "ws<X>" from the given ERA5 source and saves
it as the variable 'elevated_wind_speed' in the data library
Where '<X>' is the height specified by `Era5Source.ELEVATED_WIND_SPEED_HEIGHT`
The "ws<X>" variable also needs to be precomputed from the raw variables "u<X>"
and "v<X>"
TODO: Add nicer error catching for when neither loading route is successful
"""
combined_wind_speed_name = "ws{}".format(self.ELEVATED_WIND_SPEED_HEIGHT)
if combined_wind_speed_name in self.variables.index:
self.load(
combined_wind_speed_name,
"elevated_wind_speed")
else:
self.data["elevated_wind_speed"] = self._load_wind_speed(self.ELEVATED_WIND_SPEED_HEIGHT)
return self.data["elevated_wind_speed"]
def sload_surface_wind_speed(self):
"""Standard loader function for the variable 'surface_wind_speed'
Automatically reads the variables "ws<X>" from the given ERA5 source and saves
it as the variable 'surface_wind_speed' in the data library
Where '<X>' is the height specified by `Era5Source.SURFACE_WIND_SPEED_HEIGHT`
The "ws<X>" variable also needs to be precomputed from the raw variables "u<X>"
and "v<X>"
TODO: Update function to also be able to handle raw ERA5 inputs for u & v
"""
return self.load(
"ws{}".format(self.SURFACE_WIND_SPEED_HEIGHT),
"surface_wind_speed")
def sload_wind_speed_at_100m(self):
"""Standard loader function for the variable 'wind_speed_at_100m'
Automatically reads the variables "ws100" from the given ERA5 source and saves
it as the variable 'wind_speed_at_100m' in the data library
The "ws100" variable also needs to be precomputed from the raw variables "u100"
and "v100"
TODO: Update function to also be able to handle raw ERA5 inputs for u & v
"""
return self.load("ws100", "wind_speed_at_100m")
def sload_wind_speed_at_10m(self):
"""Standard loader function for the variable 'wind_speed_at_10m'
Automatically reads the variables "ws10" from the given ERA5 source and saves
it as the variable 'wind_speed_at_10m' in the data library
The "ws10" variable also needs to be precomputed from the raw variables "u10"
and "v10"
TODO: Update function to also be able to handle raw ERA5 inputs for u & v
"""
return self.load("ws10", "wind_speed_at_10m")
def sload_elevated_wind_direction(self):
"""Standard loader function for the variable 'elevated_wind_direction'
Automatically reads the variables "wd<X>" from the given ERA5 source and saves
it as the variable 'elevated_wind_direction' in the data library
Where '<X>' is the height specified by `Era5Source.ELEVATED_WIND_SPEED_HEIGHT`
The "wd<X>" variable also needs to be precomputed from the raw variables "u<X>"
and "v<X>" and made available in the raw dataset
TODO: Update function to also be able to handle raw ERA5 inputs for u & v
"""
return self.load("wd100", "elevated_wind_direction")
def sload_surface_pressure(self):
"""Standard loader function for the variable 'surface_pressure'
Automatically reads the variable "sp" from the given ERA5 source and saves it as the
variable 'surface_pressure' in the data library
"""
return self.load("sp", name='surface_pressure')
def sload_surface_air_temperature(self):
"""Standard loader function for the variable 'surface_air_temperature'
Automatically reads the variable "t2m" from the given ERA5 source and saves it as the
variable 'surface_air_temperature' in the data library
Temperature values are also converted from kelvin to degrees celsius
"""
return self.load("t2m", name="surface_air_temperature", processor=lambda x: x - 273.15)
def sload_surface_dew_temperature(self):
"""Standard loader function for the variable 'surface_dew_temperature'
Automatically reads the variable "d2m" from the given ERA5 source and saves it as the
variable 'surface_dew_temperature' in the data library
Temperature values are also converted from kelvin to degrees celsius
"""
return self.load("d2m", name="surface_dew_temperature", processor=lambda x: x - 273.15)
def sload_direct_horizontal_irradiance(self):
"""Standard loader function for the variable 'direct_horizontal_irradiance'
Automatically reads the variable "fdir" from the given ERA5 source and saves it as the
variable 'direct_horizontal_irradiance' in the data library
"""
return self.load("fdir", name="direct_horizontal_irradiance")
def sload_global_horizontal_irradiance(self):
"""Standard loader function for the variable 'global_horizontal_irradiance'
Automatically reads the variable "ssrd" from the given ERA5 source and saves it as the
variable 'global_horizontal_irradiance' in the data library
"""
return self.load("ssrd", name="global_horizontal_irradiance")
|
$(document).ready(function() {
// Make the drop down menus accessible on focus //
$(".pfc-nav-wrapper").find( "a, .fake-link" ).on( "focus blur", function() {
$(this).parents().toggleClass( "focus" );
} );
// Key questions
$(function(){
$('.bubbles').each(function(i, n){
var $bubbles = $(n);
$bubbles.find('.bubble').click(function(){
var target_id = $(this).attr('rel');
document.location.hash = '#' + $(this).attr('_id');
// update the selected bubble
$bubbles.find('.bubble.bubble-active').removeClass('bubble-active');
$(this).addClass('bubble-active');
// update the bubble texts
$bubbles.find('.answer-box .bubble-active').removeClass('bubble-active');
$bubbles.find('.answer-box #' + target_id).addClass('bubble-active');
});
});
var cur_hash = document.location.hash.replace("#","");
if(cur_hash)
$('#_' + cur_hash).click();
else
$('.bubbles .bubble').first().click();
$(window).bind("hashchange",function(e){
$('#_' + document.location.hash.replace("#","")).click();
// Place tracking here to avoid double-fire when in pfc-analytics.js file
_gaq.push(['_trackEvent', 'Page Interactions', 'Click', 'Collapsed_Tabs_Key_Questions']);
});
});
// Compare criteria
$(function(){
$('.ec').click(function(e) {
var rel = $(this).attr('rel');
var accordion = $(this).closest('.accordion');
if (typeof rel === 'undefined') {
accordion.children('.accordion-item').toggle();
} else {
accordion.children(".accordion-item[id!='"+rel+"']").hide();
$(".ec[rel!='"+rel+"']").removeClass('collapse');
$('#'+rel).toggle();
}
$(this).toggleClass('collapse');
e.preventDefault();
});
$('.accordion-item').hide();
});
// Ask bubbles
// Transparent bubbles pops up answers in tiny modals
$(function(){
$('.bubble-top-text').click(function(){
var $this = $(this),
$bubble_transparent = $this.parent();
if($bubble_transparent.hasClass('bubble-transparent-selected')){
$this.closest('.bubble-space').find('.bubble-transparent-answer').hide();
$bubble_transparent.removeClass('bubble-transparent-selected');
}else{
$this.closest('.bubble-space').find('.bubble-transparent-answer').show();
$bubble_transparent.addClass('bubble-transparent-selected');
}
});
$('.btn-close').click(function(e){
var $bubble_space = $(this).closest('.bubble-space');
$bubble_space.find('.bubble-transparent-selected').removeClass('bubble-transparent-selected');
$bubble_space.find('.bubble-transparent-answer').hide();
e.preventDefault();
});
});
});
|
import React, { useEffect, useState } from 'react'
import { loadFirebase } from '../../lib/firebase'
import Layout from '../../components/admin/layout'
import styles from '../../styles/admin/logg.module.scss'
import DateFnsUtils from '@date-io/date-fns'
import { MuiPickersUtilsProvider, KeyboardDatePicker } from '@material-ui/pickers'
export default function Logg() {
const firebase = loadFirebase()
const db = firebase.firestore()
const decrement = firebase.firestore.FieldValue.increment(-1)
const [dato, setDato] = useState(new Date())
const [brukere, setBrukere] = useState([])
useEffect(() => {
loadLogg(dato)
}, [])
function changeDate(date) {
setDato(date)
loadLogg(date)
}
function loadLogg(date) {
const license = localStorage.getItem('LicenseKey')
const valgtDato = date.getDate() + '-' + `${date.getMonth() + 1}` + '-' + date.getFullYear()
db.collection('Kunder')
.doc(license)
.collection('Logg')
.doc(valgtDato)
.get()
.then((doc) => {
setBrukere([])
for (var user in doc.data()) {
const bruker = user
db.collection('Kunder')
.doc(license)
.collection('Brukere')
.doc(bruker)
.get()
.then((userdoc) => {
if (userdoc.exists) {
setBrukere((brukere) => [
...brukere,
<div className={styles.box} key={bruker}>
<div className={styles.column}>
<h1>
{userdoc.data().fornavn + ' ' + userdoc.data().etternavn} ({bruker})
</h1>
<p>Sjeket inn ca. klokka {doc.data()[bruker].klokkeslett}</p>
</div>
<div className={styles.delColumn}>
<button onClick={() => deleteUserLogg(bruker, valgtDato)}>Slett</button>
</div>
</div>,
])
} else {
setBrukere((brukere) => [
...brukere,
<div className={styles.box} key={bruker}>
<div className={styles.column}>
<h1>Slettet bruker ({bruker})</h1>
<p>Sjeket inn ca. klokka {doc.data()[bruker].klokkeslett}</p>
</div>
<div className={styles.delColumn}>
<button onClick={() => deleteUserLogg(bruker, valgtDato)}>Slett</button>
</div>
</div>,
])
}
})
}
})
}
function deleteUserLogg(userid, valgtDato) {
const license = localStorage.getItem('LicenseKey')
if (confirm('Sikker på at du vil slette besøket?')) {
db.collection('Kunder')
.doc(license)
.collection('Logg')
.doc(valgtDato)
.get()
.then((doc) => {
var userLogg = doc.data()
delete userLogg[userid]
const loggRef = db.collection('Kunder').doc(license).collection('Logg').doc(valgtDato)
const brukerRef = db.collection('Kunder').doc(license).collection('Brukere').doc(userid)
const statsRef = db
.collection('Kunder')
.doc(license)
.collection('Brukere')
.doc('--stats--')
const batch = db.batch()
batch.set(loggRef, userLogg)
batch.set(brukerRef, { innsjekkCount: decrement }, { merge: true })
batch.set(statsRef, { innsjekkCount: decrement }, { merge: true })
batch.commit().then(() => {
console.log(dato)
loadLogg(dato) //FIX AT DEN TAR FEIL DATO!
})
})
}
}
return (
<Layout>
<MuiPickersUtilsProvider utils={DateFnsUtils}>
<KeyboardDatePicker
autoOk
disableFuture
variant='inline'
format='dd.MM.yyyy'
margin='normal'
style={{ marginLeft: 10 }}
value={dato}
onChange={(e) => changeDate(e)}
KeyboardButtonProps={{
'aria-label': 'change date',
}}
/>
</MuiPickersUtilsProvider>
<div className={styles.break} />
{brukere}
</Layout>
)
}
|
'''
Simple Client Counter for VLC VLM
'''
import threading
import logging
import time
import aceclient
import gevent
from aceconfig import AceConfig
class ClientCounter(object):
def __init__(self):
self.lock = threading.RLock()
self.clients = dict()
self.idleace = None
self.total = 0
gevent.spawn(self.checkIdle)
def count(self, cid):
with self.lock:
clients = self.clients.get(cid)
return len(clients) if clients else 0
def getClients(self, cid):
with self.lock:
return self.clients.get(cid)
def add(self, cid, client):
with self.lock:
clients = self.clients.get(cid)
if clients:
client.ace = clients[0].ace
with client.ace._lock:
client.queue.extend(client.ace._streamReaderQueue)
clients.append(client)
else:
if self.idleace:
client.ace = self.idleace
self.idleace = None
else:
try:
client.ace = self.createAce()
except Exception as e:
logging.error('Failed to create AceClient: ' + repr(e))
raise e
clients = [client]
self.clients[cid] = clients
self.total += 1
return len(clients)
def delete(self, cid, client):
with self.lock:
if not self.clients.has_key(cid):
return 0
clients = self.clients[cid]
if client not in clients:
return len(clients)
try:
if len(clients) > 1:
clients.remove(client)
return len(clients)
else:
del self.clients[cid]
clients[0].ace.closeStreamReader()
if self.idleace:
client.ace.destroy()
else:
try:
client.ace.STOP()
self.idleace = client.ace
self.idleace.reset()
except:
client.ace.destroy()
return 0
finally:
self.total -= 1
def deleteAll(self, cid):
clients = None
try:
with self.lock:
if not self.clients.has_key(cid):
return
clients = self.clients[cid]
del self.clients[cid]
self.total -= len(clients)
clients[0].ace.closeStreamReader()
if self.idleace:
clients[0].ace.destroy()
else:
try:
clients[0].ace.STOP()
self.idleace = clients[0].ace
self.idleace.reset()
except:
clients[0].ace.destroy()
finally:
if clients:
for c in clients:
c.destroy()
def destroyIdle(self):
with self.lock:
try:
if self.idleace:
self.idleace.destroy()
finally:
self.idleace = None
def createAce(self):
logger = logging.getLogger('createAce')
ace = aceclient.AceClient(
AceConfig.acehost, AceConfig.aceport, connect_timeout=AceConfig.aceconntimeout,
result_timeout=AceConfig.aceresulttimeout)
logger.debug("AceClient created")
ace.aceInit(
gender=AceConfig.acesex, age=AceConfig.aceage,
product_key=AceConfig.acekey, pause_delay=AceConfig.videopausedelay,
seekback=AceConfig.videoseekback)
logger.debug("AceClient inited")
return ace
def checkIdle(self):
while(True):
gevent.sleep(60.0)
with self.lock:
ace = self.idleace
if ace and (ace._idleSince + 60.0 <= time.time()):
self.idleace = None
ace.destroy()
|
from __future__ import annotations
from spark_auto_mapper_fhir.fhir_types.uri import FhirUri
from spark_auto_mapper_fhir.value_sets.generic_type import GenericTypeCode
from spark_auto_mapper.type_definitions.defined_types import AutoMapperTextInputType
# This file is auto-generated by generate_classes so do not edit manually
# noinspection PyPep8Naming
class ImmunizationStatusCodesCode(GenericTypeCode):
"""
ImmunizationStatusCodes
From: http://hl7.org/fhir/ValueSet/immunization-status in valuesets.xml
The value set to instantiate this attribute should be drawn from a
terminologically robust code system that consists of or contains concepts to
support describing the current status of the administered dose of vaccine.
"""
def __init__(self, value: AutoMapperTextInputType):
super().__init__(value=value)
"""
http://hl7.org/fhir/event-status
"""
codeset: FhirUri = "http://hl7.org/fhir/event-status"
class ImmunizationStatusCodesCodeValues:
"""
From: http://hl7.org/fhir/ValueSet/immunization-status in valuesets.xml
"""
Completed = ImmunizationStatusCodesCode("completed")
"""
From: http://hl7.org/fhir/ValueSet/immunization-status in valuesets.xml
"""
Entered_in_error = ImmunizationStatusCodesCode("entered-in-error")
"""
From: http://hl7.org/fhir/ValueSet/immunization-status in valuesets.xml
"""
Not_done = ImmunizationStatusCodesCode("not-done")
|
from twarc import Twarc2, expansions
import json
# Replace your bearer token below
client = Twarc2(bearer_token="XXXXX")
def main():
# This mentions functions gets the mentions for a specified user
user_mentions = client.mentions(user="twitterdev")
# Twarc returns all Tweets for the criteria set above, so we page through the results
for page in user_mentions:
# The Twitter API v2 returns the Tweet information and the user, media etc. separately
# so we use expansions.flatten to get all the information in a single JSON
result = expansions.flatten(page)
for tweet in result:
# Here we are printing the full Tweet object JSON to the console
print(json.dumps(tweet))
if __name__ == "__main__":
main()
|
# -*- coding: utf-8 -*-
import threading
from pip_benchmark_python.runner.execution.CpuLoadMeter import CpuLoadMeter
class TestCpuLoadMeter:
def test_measure(self):
meter = CpuLoadMeter()
measure = meter.measure()
assert measure == 0
def _test_measure():
_measure = meter.measure()
assert _measure > 0
threading.Timer(100 / 1000, _test_measure)
|
import React from 'react';
import { shallow } from 'enzyme';
import ContactUs from './ContactUs';
describe('ContactUs', () => {
test('matches snapshot', () => {
const wrapper = shallow(<ContactUs />);
expect(wrapper).toMatchSnapshot();
});
});
|
import json
from datetime import datetime
from typing import List, Dict
from unittest import mock
from fastapi_pagination import Params
import pytest
from starlette.testclient import TestClient
from fidesops.api.v1.endpoints.privacy_request_endpoints import (
EMBEDDED_EXECUTION_LOG_LIMIT,
)
from fidesops.api.v1.urn_registry import (
PRIVACY_REQUESTS,
V1_URL_PREFIX,
REQUEST_PREVIEW,
PRIVACY_REQUEST_RESUME,
)
from fidesops.api.v1.scope_registry import (
PRIVACY_REQUEST_CREATE,
STORAGE_CREATE_OR_UPDATE,
PRIVACY_REQUEST_READ,
PRIVACY_REQUEST_CALLBACK_RESUME,
)
from fidesops.models.client import ClientDetail
from fidesops.models.privacy_request import (
PrivacyRequest,
ExecutionLog,
ExecutionLogStatus,
PrivacyRequestStatus,
)
from fidesops.models.policy import ActionType
from fidesops.schemas.dataset import DryRunDatasetResponse
from fidesops.schemas.masking.masking_secrets import SecretType
from fidesops.util.cache import (
get_identity_cache_key,
get_encryption_cache_key,
get_masking_secret_cache_key,
)
from fidesops.util.oauth_util import generate_jwe
page_size = Params().size
def stringify_date(log_date: datetime) -> str:
return log_date.strftime("%Y-%m-%dT%H:%M:%S.%f+00:00")
class TestCreatePrivacyRequest:
@pytest.fixture(scope="function")
def url(self, oauth_client: ClientDetail, policy) -> str:
return V1_URL_PREFIX + PRIVACY_REQUESTS
def test_privacy_request_unauthenticated(self, api_client: TestClient, url):
resp = api_client.post(url)
assert resp.status_code == 401
def test_privacy_request_wrong_scopes(
self, api_client: TestClient, url, generate_auth_header
):
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_READ])
resp = api_client.post(url, json={}, headers=auth_header)
assert resp.status_code == 403
@mock.patch(
"fidesops.service.privacy_request.request_runner_service.PrivacyRequestRunner.submit"
)
def test_create_privacy_request(
self,
run_access_request_mock,
url,
db,
api_client: TestClient,
generate_auth_header,
policy,
):
data = [
{
"requested_at": "2021-08-30T16:09:37.359Z",
"policy_key": policy.key,
"identity": {"email": "test@example.com"},
}
]
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_CREATE])
resp = api_client.post(url, json=data, headers=auth_header)
assert resp.status_code == 200
response_data = resp.json()["succeeded"]
assert len(response_data) == 1
pr = PrivacyRequest.get(db=db, id=response_data[0]["id"])
pr.delete(db=db)
assert run_access_request_mock.called
@mock.patch(
"fidesops.service.privacy_request.request_runner_service.run_access_request"
)
def test_create_privacy_request_limit_exceeded(
self,
_,
url,
db,
api_client: TestClient,
generate_auth_header,
policy,
):
payload = []
for i in range(0, 51):
payload.append(
{
"requested_at": "2021-08-30T16:09:37.359Z",
"policy_key": policy.key,
"identity": {"email": "ftest{i}@example.com"},
},
)
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_CREATE])
response = api_client.post(url, headers=auth_header, json=payload)
assert 422 == response.status_code
assert (
json.loads(response.text)["detail"][0]["msg"]
== "ensure this value has at most 50 items"
)
@mock.patch(
"fidesops.service.privacy_request.request_runner_service.PrivacyRequestRunner.submit"
)
def test_create_privacy_request_starts_processing(
self,
start_processing_mock,
url,
api_client: TestClient,
db,
generate_auth_header,
policy,
):
data = [
{
"requested_at": "2021-08-30T16:09:37.359Z",
"policy_key": policy.key,
"identity": {"email": "test@example.com"},
}
]
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_CREATE])
resp = api_client.post(url, json=data, headers=auth_header)
assert resp.status_code == 200
assert start_processing_mock.called
response_data = resp.json()["succeeded"]
pr = PrivacyRequest.get(db=db, id=response_data[0]["id"])
pr.delete(db=db)
@mock.patch(
"fidesops.service.privacy_request.request_runner_service.PrivacyRequestRunner.submit"
)
def test_create_privacy_request_with_external_id(
self,
run_access_request_mock,
url,
db,
api_client: TestClient,
generate_auth_header,
policy,
):
external_id = "ext_some-uuid-here-1234"
data = [
{
"external_id": external_id,
"requested_at": "2021-08-30T16:09:37.359Z",
"policy_key": policy.key,
"identity": {"email": "test@example.com"},
}
]
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_CREATE])
resp = api_client.post(
V1_URL_PREFIX + PRIVACY_REQUESTS, json=data, headers=auth_header
)
assert resp.status_code == 200
response_data = resp.json()["succeeded"]
assert len(response_data) == 1
assert response_data[0]["external_id"] == external_id
pr = PrivacyRequest.get(db=db, id=response_data[0]["id"])
assert pr.external_id == external_id
pr.delete(db=db)
assert run_access_request_mock.called
@mock.patch(
"fidesops.service.privacy_request.request_runner_service.PrivacyRequestRunner.submit"
)
def test_create_privacy_request_caches_identity(
self,
run_access_request_mock,
url,
db,
api_client: TestClient,
generate_auth_header,
policy,
cache,
):
identity = {"email": "test@example.com"}
data = [
{
"requested_at": "2021-08-30T16:09:37.359Z",
"policy_key": policy.key,
"identity": identity,
}
]
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_CREATE])
resp = api_client.post(url, json=data, headers=auth_header)
assert resp.status_code == 200
response_data = resp.json()["succeeded"]
assert len(response_data) == 1
pr = PrivacyRequest.get(db=db, id=response_data[0]["id"])
key = get_identity_cache_key(
privacy_request_id=pr.id,
identity_attribute=list(identity.keys())[0],
)
assert cache.get(key) == list(identity.values())[0]
pr.delete(db=db)
assert run_access_request_mock.called
@mock.patch(
"fidesops.service.privacy_request.request_runner_service.PrivacyRequestRunner.submit"
)
def test_create_privacy_request_caches_masking_secrets(
self,
run_erasure_request_mock,
url,
db,
api_client: TestClient,
generate_auth_header,
erasure_policy_aes,
cache,
):
identity = {"email": "test@example.com"}
data = [
{
"requested_at": "2021-08-30T16:09:37.359Z",
"policy_key": erasure_policy_aes.key,
"identity": identity,
}
]
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_CREATE])
resp = api_client.post(url, json=data, headers=auth_header)
assert resp.status_code == 200
response_data = resp.json()["succeeded"]
assert len(response_data) == 1
pr = PrivacyRequest.get(db=db, id=response_data[0]["id"])
secret_key = get_masking_secret_cache_key(
privacy_request_id=pr.id,
masking_strategy="aes_encrypt",
secret_type=SecretType.key,
)
assert cache.get_encoded_by_key(secret_key) is not None
pr.delete(db=db)
assert run_erasure_request_mock.called
def test_create_privacy_request_invalid_encryption_values(
self, url, db, api_client: TestClient, generate_auth_header, policy, cache
):
data = [
{
"requested_at": "2021-08-30T16:09:37.359Z",
"policy_key": policy.key,
"identity": {"email": "test@example.com"},
"encryption_key": "test",
}
]
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_CREATE])
resp = api_client.post(url, json=data, headers=auth_header)
assert resp.status_code == 422
assert resp.json()["detail"][0]["msg"] == "Encryption key must be 16 bytes long"
@mock.patch(
"fidesops.service.privacy_request.request_runner_service.PrivacyRequestRunner.submit"
)
def test_create_privacy_request_caches_encryption_keys(
self,
run_access_request_mock,
url,
db,
api_client: TestClient,
generate_auth_header,
policy,
cache,
):
identity = {"email": "test@example.com"}
data = [
{
"requested_at": "2021-08-30T16:09:37.359Z",
"policy_key": policy.key,
"identity": identity,
"encryption_key": "test--encryption",
}
]
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_CREATE])
resp = api_client.post(url, json=data, headers=auth_header)
assert resp.status_code == 200
response_data = resp.json()["succeeded"]
assert len(response_data) == 1
pr = PrivacyRequest.get(db=db, id=response_data[0]["id"])
encryption_key = get_encryption_cache_key(
privacy_request_id=pr.id,
encryption_attr="key",
)
assert cache.get(encryption_key) == "test--encryption"
pr.delete(db=db)
assert run_access_request_mock.called
def test_create_privacy_request_no_identities(
self,
url,
api_client: TestClient,
generate_auth_header,
policy,
):
data = [
{
"requested_at": "2021-08-30T16:09:37.359Z",
"policy_key": policy.key,
"identity": {},
}
]
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_CREATE])
resp = api_client.post(url, json=data, headers=auth_header)
assert resp.status_code == 200
response_data = resp.json()["succeeded"]
assert len(response_data) == 0
response_data = resp.json()["failed"]
assert len(response_data) == 1
class TestGetPrivacyRequests:
@pytest.fixture(scope="function")
def url(self, oauth_client: ClientDetail) -> str:
return V1_URL_PREFIX + PRIVACY_REQUESTS
def test_get_privacy_requests_unauthenticated(self, api_client: TestClient, url):
response = api_client.get(url, headers={})
assert 401 == response.status_code
def test_get_privacy_requests_wrong_scope(
self, api_client: TestClient, generate_auth_header, url
):
auth_header = generate_auth_header(scopes=[STORAGE_CREATE_OR_UPDATE])
response = api_client.get(url, headers=auth_header)
assert 403 == response.status_code
def test_conflicting_query_params(
self, api_client: TestClient, generate_auth_header, url
):
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_READ])
response = api_client.get(
url + f"?completed_lt=2021-01-01&errored_gt=2021-01-02",
headers=auth_header,
)
assert 400 == response.status_code
def test_get_privacy_requests_by_id(
self,
api_client: TestClient,
url,
generate_auth_header,
privacy_request,
postgres_execution_log,
mongo_execution_log,
):
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_READ])
response = api_client.get(
url + f"?id={privacy_request.id}", headers=auth_header
)
assert 200 == response.status_code
expected_resp = {
"items": [
{
"id": privacy_request.id,
"created_at": stringify_date(privacy_request.created_at),
"started_processing_at": stringify_date(
privacy_request.started_processing_at
),
"finished_processing_at": None,
"status": privacy_request.status.value,
"external_id": privacy_request.external_id,
}
],
"total": 1,
"page": 1,
"size": page_size,
}
resp = response.json()
assert resp == expected_resp
def test_filter_privacy_requests_by_status(
self,
api_client: TestClient,
url,
generate_auth_header,
privacy_request,
succeeded_privacy_request,
failed_privacy_request,
):
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_READ])
response = api_client.get(url + f"?status=complete", headers=auth_header)
assert 200 == response.status_code
resp = response.json()
assert len(resp["items"]) == 1
assert resp["items"][0]["id"] == succeeded_privacy_request.id
response = api_client.get(url + f"?status=error", headers=auth_header)
assert 200 == response.status_code
resp = response.json()
assert len(resp["items"]) == 1
assert resp["items"][0]["id"] == failed_privacy_request.id
def test_filter_privacy_requests_by_external_id(
self,
db,
api_client,
url,
generate_auth_header,
privacy_request,
succeeded_privacy_request,
failed_privacy_request,
):
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_READ])
response = api_client.get(
url + f"?external_id={succeeded_privacy_request.id}", headers=auth_header
)
assert 200 == response.status_code
resp = response.json()
assert len(resp["items"]) == 0
privacy_request.external_id = "test_external_id_1"
privacy_request.save(db)
response = api_client.get(
url + f"?external_id=test_external_id_1", headers=auth_header
)
assert 200 == response.status_code
resp = response.json()
assert len(resp["items"]) == 1
assert resp["items"][0]["id"] == privacy_request.id
def test_filter_privacy_requests_by_created(
self,
api_client: TestClient,
generate_auth_header,
privacy_request,
succeeded_privacy_request,
failed_privacy_request,
url,
):
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_READ])
response = api_client.get(url + f"?created_lt=2019-01-01", headers=auth_header)
assert 200 == response.status_code
resp = response.json()
assert len(resp["items"]) == 0
response = api_client.get(url + f"?created_gt=2019-01-01", headers=auth_header)
assert 200 == response.status_code
resp = response.json()
assert len(resp["items"]) == 3
assert resp["items"][0]["id"] == privacy_request.id
assert resp["items"][1]["id"] == succeeded_privacy_request.id
assert resp["items"][2]["id"] == failed_privacy_request.id
def test_filter_privacy_requests_by_started(
self,
api_client: TestClient,
generate_auth_header,
privacy_request,
succeeded_privacy_request,
failed_privacy_request,
url,
):
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_READ])
response = api_client.get(url + f"?started_lt=2021-05-01", headers=auth_header)
assert 200 == response.status_code
resp = response.json()
assert len(resp["items"]) == 2
assert resp["items"][0]["id"] == privacy_request.id
assert resp["items"][1]["id"] == failed_privacy_request.id
response = api_client.get(url + f"?started_gt=2021-05-01", headers=auth_header)
assert 200 == response.status_code
resp = response.json()
assert len(resp["items"]) == 1
assert resp["items"][0]["id"] == succeeded_privacy_request.id
def test_filter_privacy_requests_by_completed(
self,
api_client: TestClient,
generate_auth_header,
privacy_request,
succeeded_privacy_request,
failed_privacy_request,
url,
):
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_READ])
response = api_client.get(
url + f"?completed_lt=2021-10-01", headers=auth_header
)
assert 200 == response.status_code
resp = response.json()
assert len(resp["items"]) == 0
response = api_client.get(
url + f"?completed_gt=2021-10-01", headers=auth_header
)
assert 200 == response.status_code
resp = response.json()
assert len(resp["items"]) == 1
assert resp["items"][0]["id"] == succeeded_privacy_request.id
def test_filter_privacy_requests_by_errored(
self,
api_client: TestClient,
generate_auth_header,
privacy_request,
succeeded_privacy_request,
failed_privacy_request,
url,
):
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_READ])
response = api_client.get(url + f"?errored_lt=2021-01-01", headers=auth_header)
assert 200 == response.status_code
resp = response.json()
assert len(resp["items"]) == 0
response = api_client.get(url + f"?errored_gt=2021-01-01", headers=auth_header)
assert 200 == response.status_code
resp = response.json()
assert len(resp["items"]) == 1
assert resp["items"][0]["id"] == failed_privacy_request.id
def test_verbose_privacy_requests(
self,
api_client: TestClient,
generate_auth_header,
privacy_request: PrivacyRequest,
postgres_execution_log,
second_postgres_execution_log,
mongo_execution_log,
url,
db,
):
"""Test privacy requests endpoint with verbose query param to show execution logs"""
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_READ])
response = api_client.get(url + f"?verbose=True", headers=auth_header)
assert 200 == response.status_code
resp = response.json()
assert (
postgres_execution_log.updated_at < second_postgres_execution_log.updated_at
)
expected_resp = {
"items": [
{
"id": privacy_request.id,
"created_at": stringify_date(privacy_request.created_at),
"started_processing_at": stringify_date(
privacy_request.started_processing_at
),
"finished_processing_at": None,
"status": privacy_request.status.value,
"external_id": privacy_request.external_id,
"results": {
"my-mongo-db": [
{
"collection_name": "orders",
"fields_affected": [
{
"path": "my-mongo-db:orders:name",
"field_name": "name",
"data_categories": [
"user.provided.identifiable.contact.name"
],
}
],
"message": None,
"action_type": "access",
"status": "in_processing",
"updated_at": stringify_date(
mongo_execution_log.updated_at
),
}
],
"my-postgres-db": [
{
"collection_name": "user",
"fields_affected": [
{
"path": "my-postgres-db:user:email",
"field_name": "email",
"data_categories": [
"user.provided.identifiable.contact.email"
],
}
],
"message": None,
"action_type": "access",
"status": "pending",
"updated_at": stringify_date(
postgres_execution_log.updated_at
),
},
{
"collection_name": "address",
"fields_affected": [
{
"path": "my-postgres-db:address:street",
"field_name": "street",
"data_categories": [
"user.provided.identifiable.contact.street"
],
},
{
"path": "my-postgres-db:address:city",
"field_name": "city",
"data_categories": [
"user.provided.identifiable.contact.city"
],
},
],
"message": "Database timed out.",
"action_type": "access",
"status": "error",
"updated_at": stringify_date(
second_postgres_execution_log.updated_at
),
},
],
},
},
],
"total": 1,
"page": 1,
"size": page_size,
}
assert resp == expected_resp
def test_verbose_privacy_request_embed_limit(
self,
db,
api_client: TestClient,
generate_auth_header,
privacy_request: PrivacyRequest,
url,
):
for i in range(0, EMBEDDED_EXECUTION_LOG_LIMIT + 10):
ExecutionLog.create(
db=db,
data={
"dataset_name": "my-postgres-db",
"collection_name": f"test_collection_{i}",
"fields_affected": [],
"action_type": ActionType.access,
"status": ExecutionLogStatus.pending,
"privacy_request_id": privacy_request.id,
},
)
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_READ])
response = api_client.get(url + f"?verbose=True", headers=auth_header)
assert 200 == response.status_code
resp = response.json()
assert (
len(resp["items"][0]["results"]["my-postgres-db"])
== EMBEDDED_EXECUTION_LOG_LIMIT
)
db.query(ExecutionLog).filter(
ExecutionLog.privacy_request_id == privacy_request.id
).delete()
class TestGetExecutionLogs:
@pytest.fixture(scope="function")
def url(self, db, privacy_request):
return V1_URL_PREFIX + PRIVACY_REQUESTS + f"/{privacy_request.id}/log"
def test_get_execution_logs_unauthenticated(
self, api_client: TestClient, privacy_request, url
):
response = api_client.get(url + "/", headers={})
assert 401 == response.status_code
def test_get_execution_logs_wrong_scope(
self, api_client: TestClient, generate_auth_header, url
):
auth_header = generate_auth_header(scopes=[STORAGE_CREATE_OR_UPDATE])
response = api_client.get(url, headers=auth_header)
assert 403 == response.status_code
def test_get_execution_logs_invalid_privacy_request_id(
self, api_client: TestClient, generate_auth_header
):
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_READ])
response = api_client.get(
V1_URL_PREFIX + PRIVACY_REQUESTS + f"/invalid_privacy_request_id/log",
headers=auth_header,
)
assert 404 == response.status_code
def test_get_execution_logs(
self,
api_client: TestClient,
generate_auth_header,
url,
postgres_execution_log,
mongo_execution_log,
second_postgres_execution_log,
):
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_READ])
response = api_client.get(
url,
headers=auth_header,
)
assert 200 == response.status_code
resp = response.json()
expected_resp = {
"items": [
{
"collection_name": "user",
"fields_affected": [
{
"path": "my-postgres-db:user:email",
"field_name": "email",
"data_categories": [
"user.provided.identifiable.contact.email"
],
}
],
"message": None,
"action_type": "access",
"status": "pending",
"updated_at": stringify_date(postgres_execution_log.updated_at),
"dataset_name": "my-postgres-db",
},
{
"collection_name": "orders",
"fields_affected": [
{
"path": "my-mongo-db:orders:name",
"field_name": "name",
"data_categories": [
"user.provided.identifiable.contact.name"
],
}
],
"message": None,
"action_type": "access",
"status": "in_processing",
"updated_at": stringify_date(mongo_execution_log.updated_at),
"dataset_name": "my-mongo-db",
},
{
"collection_name": "address",
"fields_affected": [
{
"path": "my-postgres-db:address:street",
"field_name": "street",
"data_categories": [
"user.provided.identifiable.contact.street"
],
},
{
"path": "my-postgres-db:address:city",
"field_name": "city",
"data_categories": [
"user.provided.identifiable.contact.city"
],
},
],
"message": "Database timed out.",
"action_type": "access",
"status": "error",
"updated_at": stringify_date(
second_postgres_execution_log.updated_at
),
"dataset_name": "my-postgres-db",
},
],
"total": 3,
"page": 1,
"size": page_size,
}
assert resp == expected_resp
class TestRequestPreview:
@pytest.fixture(scope="function")
def url(self, db, privacy_request):
return V1_URL_PREFIX + REQUEST_PREVIEW
def test_request_preview(
self,
dataset_config_preview,
api_client: TestClient,
url,
generate_auth_header,
) -> None:
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_READ])
data = [dataset_config_preview.fides_key]
response = api_client.put(url, headers=auth_header, json=data)
assert response.status_code == 200
response_body: List[DryRunDatasetResponse] = json.loads(response.text)
assert (
next(
response["query"]
for response in response_body
if response["collectionAddress"]["dataset"] == "postgres"
if response["collectionAddress"]["collection"] == "subscriptions"
)
== "SELECT email,id FROM subscriptions WHERE email = ?"
)
def test_request_preview_all(
self,
dataset_config_preview,
api_client: TestClient,
url,
generate_auth_header,
) -> None:
auth_header = generate_auth_header(scopes=[PRIVACY_REQUEST_READ])
response = api_client.put(url, headers=auth_header)
assert response.status_code == 200
response_body: List[DryRunDatasetResponse] = json.loads(response.text)
assert (
next(
response["query"]
for response in response_body
if response["collectionAddress"]["dataset"] == "postgres"
if response["collectionAddress"]["collection"] == "subscriptions"
)
== "SELECT email,id FROM subscriptions WHERE email = ?"
)
class TestResumePrivacyRequest:
@pytest.fixture(scope="function")
def url(self, db, privacy_request):
return V1_URL_PREFIX + PRIVACY_REQUEST_RESUME.format(
privacy_request_id=privacy_request.id
)
def test_resume_privacy_request_not_authenticated(
self,
url,
api_client,
generate_webhook_auth_header,
policy_pre_execution_webhooks,
):
response = api_client.post(url)
assert response.status_code == 401
def test_resume_privacy_request_invalid_jwe_format(
self,
url,
api_client,
generate_webhook_auth_header,
policy_pre_execution_webhooks,
):
auth_header = {
"Authorization": "Bearer "
+ generate_jwe(json.dumps({"unexpected": "format"}))
}
response = api_client.post(url, headers=auth_header, json={})
assert response.status_code == 403
def test_resume_privacy_request_invalid_scopes(
self,
url,
api_client,
generate_webhook_auth_header,
policy_pre_execution_webhooks,
):
"""
Test scopes are correct, although we just gave a user this token with the
correct scopes, the check doesn't mean much
"""
auth_header = {
"Authorization": "Bearer "
+ generate_jwe(
json.dumps(
{
"webhook_id": policy_pre_execution_webhooks[0].id,
"scopes": [PRIVACY_REQUEST_READ],
"iat": datetime.now().isoformat(),
}
)
)
}
response = api_client.post(url, headers=auth_header, json={})
assert response.status_code == 403
def test_resume_privacy_request_invalid_webhook(
self,
url,
api_client,
generate_webhook_auth_header,
policy_post_execution_webhooks,
):
"""Only can resume execution after Pre-Execution webhooks"""
auth_header = {
"Authorization": "Bearer "
+ generate_jwe(
json.dumps(
{
"webhook_id": policy_post_execution_webhooks[0].id,
"scopes": [PRIVACY_REQUEST_CALLBACK_RESUME],
"iat": datetime.now().isoformat(),
}
)
)
}
response = api_client.post(url, headers=auth_header, json={})
assert response.status_code == 404
def test_resume_privacy_request_not_paused(
self,
url,
api_client,
generate_webhook_auth_header,
policy_pre_execution_webhooks,
privacy_request,
db,
):
privacy_request.status = PrivacyRequestStatus.complete
privacy_request.save(db=db)
auth_header = generate_webhook_auth_header(
webhook=policy_pre_execution_webhooks[0]
)
response = api_client.post(url, headers=auth_header, json={})
assert response.status_code == 400
@mock.patch(
"fidesops.service.privacy_request.request_runner_service.PrivacyRequestRunner.submit"
)
def test_resume_privacy_request(
self,
submit_mock,
url,
api_client,
generate_webhook_auth_header,
policy_pre_execution_webhooks,
privacy_request,
db,
):
privacy_request.status = PrivacyRequestStatus.paused
privacy_request.save(db=db)
auth_header = generate_webhook_auth_header(
webhook=policy_pre_execution_webhooks[0]
)
response = api_client.post(
url, headers=auth_header, json={"derived_identity": {}}
)
assert response.status_code == 200
response_body = json.loads(response.text)
assert submit_mock.called
assert response_body == {
"id": privacy_request.id,
"created_at": stringify_date(privacy_request.created_at),
"started_processing_at": stringify_date(
privacy_request.started_processing_at
),
"finished_processing_at": None,
"status": "in_processing",
"external_id": privacy_request.external_id,
}
|
/******************************************************************************
* Copyright 2017-2018 Baidu Robotic Vision Authors. All Rights Reserved.
*
* 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.
*****************************************************************************/
#ifndef _CAMERA_PRIOR_H_
#define _CAMERA_PRIOR_H_
#include "IMU.h"
namespace CameraPrior {
namespace Element{
#ifdef CFG_CAMERA_PRIOR_DOUBLE
typedef double T;
#else
typedef float T;
#endif
class R : public LA::Vector2f {
public:
inline R() {}
inline R(const LA::Vector2f &b) { *((LA::Vector2f *) this) = b; }
};
class C : public LA::AlignedVector6f {
public:
inline C() {}
inline C(const LA::AlignedVector6f &b) { *((LA::AlignedVector6f *) this) = b; }
inline C(const LA::AlignedVector3f &bp, const LA::AlignedVector3f &br) {
Set(bp, br);
}
inline void operator += (const LA::AlignedVector6f &dA) {
*((LA::AlignedVector6f *) this) += dA;
}
inline void operator += (const LA::Vector6f &b) {
v0123() += xp128f::get(b);
v4() += b.v4();
v5() += b.v5();
}
inline C operator + (const C &b) const {
C apb;
LA::AlignedVector6f::apb(*this, b, apb);
return apb;
}
};
class M : public LA::AlignedVector9f {
public:
inline M() {}
inline M(const LA::AlignedVector9f &b) { *((LA::AlignedVector9f *) this) = b; }
inline M(const LA::AlignedVector3f &bv, const LA::AlignedVector3f &bba,
const LA::AlignedVector3f &bbw) {
Set(bv, bba, bbw);
}
inline M operator + (const M &b) const {
M apb;
LA::AlignedVector9f::apb(*this, b, apb);
return apb;
}
};
class JC {
public:
inline void GetTranspose(JC &J) const {
m_Jpp1.GetTranspose(J.m_Jpp1);
m_Jpr1.GetTranspose(J.m_Jpr1);
m_Jrr1.GetTranspose(J.m_Jrr1);
m_Jpp2.GetTranspose(J.m_Jpp2);
m_Jrr2.GetTranspose(J.m_Jrr2);
}
public:
LA::AlignedMatrix3x3f m_Jpp1, m_Jpr1, m_Jrr1, m_Jpp2, m_Jrr2;
};
class EC {
public:
inline void Set(const float *e) { m_ep.Set(e); m_er.Set(e + 3); }
inline void Set(const double *e) { m_ep.Set(e); m_er.Set(e + 3); }
inline void Get(float *e) const { m_ep.Get(e); m_er.Get(e + 3); }
inline void Get(double *e) const { m_ep.Get(e); m_er.Get(e + 3); }
inline void Get(C *e) const { e->Set(m_ep, m_er); }
public:
LA::AlignedVector3f m_ep, m_er;
};
class EM {
public:
inline void Set(const float *e) { m_ev.Set(e); m_eba.Set(e + 3); m_ebw.Set(e + 6); }
inline void Set(const double *e) { m_ev.Set(e); m_eba.Set(e + 3); m_ebw.Set(e + 6); }
inline void Get(float *e) const { m_ev.Get(e); m_eba.Get(e + 3); m_ebw.Get(e + 6); }
inline void Get(double *e) const { m_ev.Get(e); m_eba.Get(e + 3); m_ebw.Get(e + 6); }
public:
inline void operator += (const EM &e) {
m_ev += e.m_ev;
m_eba += e.m_eba;
m_ebw += e.m_ebw;
}
public:
LA::AlignedVector3f m_ev, m_eba, m_ebw;
};
class RR : public LA::SymmetricMatrix2x2f {
public:
inline RR() {}
inline RR(const LA::SymmetricMatrix2x2f &A) { *((LA::SymmetricMatrix2x2f *) this) = A; }
};
class RC : public LA::AlignedMatrix2x6f {
public:
inline RC() {}
inline RC(const LA::AlignedMatrix2x6f &A) { *((LA::AlignedMatrix2x6f *) this) = A; }
inline RC operator + (const RC &B) const {
RC ApB;
LA::AlignedMatrix2x6f::ApB(*this, B, ApB);
return ApB;
}
};
class RM : public LA::AlignedMatrix2x9f {
public:
inline RM() {}
inline RM(const LA::AlignedMatrixMxNf<2, 9> &A) { *((LA::AlignedMatrixMxNf<2, 9> *) this) = A; }
inline void Set(const LA::AlignedMatrix2x3f &Arv, const LA::AlignedMatrix2x3f &Arba,
const LA::AlignedMatrix2x3f &Arbw) {
LA::AlignedMatrix2x9f::Set(Arv, Arba, Arbw);
}
inline void Set(const LA::AlignedMatrix2x3f &Arv) {
MakeZero();
SetBlock(0, 0, Arv);
}
//inline void SetBlock(const LA::AlignedMatrix2x3f &Arv) {
// LA::AlignedMatrix2x9f::SetBlock(0, 0, Arv);
//}
inline RM operator + (const RM &B) const {
RM ApB;
LA::AlignedMatrix2x9f::ApB(*this, B, ApB);
return ApB;
}
};
class CC : public LA::AlignedMatrix6x6f {
public:
inline CC() {}
inline CC(const LA::AlignedMatrix6x6f &A) { *((LA::AlignedMatrix6x6f *) this) = A; }
inline void Get(LA::AlignedMatrix6x6f &A, const bool trans = false) const {
if (trans) {
GetTranspose(A);
} else {
A = *this;
}
}
inline void Get(LA::AlignedMatrix3x3f &App, LA::AlignedMatrix3x3f &Apr,
LA::AlignedMatrix3x3f &Arp, LA::AlignedMatrix3x3f &Arr) const {
LA::AlignedMatrix6x6f::Get(App, Apr, Arp, Arr);
}
inline void Get(LA::Matrix3x3f &App, LA::Matrix3x3f &Apr,
LA::Matrix3x3f &Arp, LA::Matrix3x3f &Arr) const {
LA::AlignedMatrix6x6f::Get(App, Apr, Arp, Arr);
}
inline void Increase(const LA::SymmetricMatrix3x3f &App, const LA::AlignedMatrix3x3f &Apr,
const LA::SymmetricMatrix3x3f &Arr) {
Increase00(App);
Increase03(Apr);
Increase33(Arr);
SetLowerFromUpper();
}
inline void Increase(const LA::AlignedMatrix3x3f *Ap, const LA::AlignedMatrix3x3f *Ar) {
LA::SymmetricMatrix3x3f A;
A.Set(Ap[0]);
Increase00(A);
Increase03(Ap[1]);
A.Set(Ar[1]);
Increase33(A);
SetLowerFromUpper();
}
inline void operator += (const LA::AlignedMatrix6x6f &A) {
*((LA::AlignedMatrix6x6f *) this) += A;
}
inline void operator += (const LA::SymmetricMatrix6x6f &A) {
LA::AlignedMatrix6x6f &_A = *this;
_A.m_00_01_02_03() += xp128f::get(&A.m00()); _A[0][4] += A.m04(); _A[0][5] += A.m05();
_A[1][1] += A.m11(); _A.m_12_13_14_15() += xp128f::get(&A.m12());
_A[2][2] += A.m22(); _A[2][3] += A.m23(); _A[2][4] += A.m24(); _A[2][5] += A.m25();
_A[3][3] += A.m33(); _A[3][4] += A.m34(); _A[3][5] += A.m35();
_A[4][4] += A.m44(); _A[4][5] += A.m45();
_A[5][5] += A.m55();
}
};
class CM : public LA::AlignedMatrix6x9f {
public:
inline CM() {}
inline CM(const LA::AlignedMatrixMxNf<6, 9> &A) { *((LA::AlignedMatrixMxNf<6, 9> *) this) = A; }
inline void Set(const LA::AlignedMatrix3x3f &Apv, const LA::AlignedMatrix3x3f &Apba,
const LA::AlignedMatrix3x3f &Apbw, const LA::AlignedMatrix3x3f &Arv,
const LA::AlignedMatrix3x3f &Arba, const LA::AlignedMatrix3x3f &Arbw) {
LA::AlignedMatrix6x9f::Set(Apv, Apba, Apbw, Arv, Arba, Arbw);
}
inline void Set(const LA::AlignedMatrix3x3f *Ap, const LA::AlignedMatrix3x3f *Ar) {
Set(Ap[0], Ap[1], Ap[2], Ar[0], Ar[1], Ar[2]);
}
inline void Set(const LA::AlignedMatrix3x3f &Arv) { MakeZero(); SetBlock(Arv); }
inline void SetBlock(const LA::AlignedMatrix3x3f &Arv) {
LA::AlignedMatrix6x9f::SetBlock(3, 0, Arv);
}
inline CM operator + (const CM &B) const {
CM ApB;
LA::AlignedMatrix6x9f::ApB(*this, B, ApB);
return ApB;
}
};
class MC : public LA::AlignedMatrix9x6f {
public:
inline MC() {}
inline void Set(const LA::AlignedMatrix3x3f &Avp, const LA::AlignedMatrix3x3f &Avr,
const LA::AlignedMatrix3x3f &Abap, const LA::AlignedMatrix3x3f &Abar,
const LA::AlignedMatrix3x3f &Abwp, const LA::AlignedMatrix3x3f &Abwr) {
LA::AlignedMatrix9x6f::Set(Avp, Avr, Abap, Abar, Abwp, Abwr);
}
inline void Set(const LA::AlignedMatrix3x3f *Av, const LA::AlignedMatrix3x3f *Aba,
const LA::AlignedMatrix3x3f *Abw) {
Set(Av[0], Av[1], Aba[0], Aba[1], Abw[0], Abw[1]);
}
inline void Set(const LA::AlignedMatrix3x3f &Avr) { MakeZero(); SetBlock(Avr); }
inline void SetBlock(const LA::AlignedMatrix3x3f &Avr) {
LA::AlignedMatrix9x6f::SetBlock(0, 3, Avr);
}
};
class MM : public LA::AlignedMatrix9x9f {
public:
inline MM() {}
inline MM(const LA::AlignedMatrixMxNf<9, 9> &A) { *((LA::AlignedMatrixMxNf<9, 9> *) this) = A; }
inline MM(const LA::AlignedMatrix9x9f &A) { *((LA::AlignedMatrix9x9f *) this) = A; }
inline void Set(const LA::SymmetricMatrix3x3f &Avv, const float Ababa, const float Abwbw) {
MakeZero();
SetBlockDiagonal(0, Avv);
LA::AlignedMatrix9x9f &A = *this;
A[3][3] = A[4][4] = A[5][5] = Ababa;
A[6][6] = A[7][7] = A[8][8] = Abwbw;
SetLowerFromUpper();
}
inline void Set(const LA::AlignedMatrix3x3f &Avv, const LA::AlignedMatrix3x3f &Abav,
const float Ababa, const LA::AlignedMatrix3x3f &Abwv, const float Abwbw) {
MakeZero();
LA::AlignedMatrix9x9f::SetBlock(0, 0, Avv);
LA::AlignedMatrix9x9f::SetBlock(3, 0, Abav);
LA::AlignedMatrix9x9f::SetBlock(6, 0, Abwv);
LA::AlignedMatrix9x9f &A = *this;
A[3][3] = A[4][4] = A[5][5] = Ababa;
A[6][6] = A[7][7] = A[8][8] = Abwbw;
}
inline void Set(const LA::AlignedMatrix3x3f *Av, const LA::AlignedMatrix3x3f *Aba,
const LA::AlignedMatrix3x3f *Abw) {
LA::AlignedMatrix9x9f::Set(Av, Aba, Abw);
}
inline void Increase(const LA::SymmetricMatrix3x3f &Avv, const LA::AlignedMatrix3x3f &Avba,
const LA::AlignedMatrix3x3f &Avbw, const LA::SymmetricMatrix3x3f &Ababa,
const LA::AlignedMatrix3x3f &Ababw, const LA::SymmetricMatrix3x3f &Abwbw) {
LA::AlignedMatrix9x9f::IncreaseDiagonal(0, Avv);
LA::AlignedMatrix9x9f::Increase(0, 3, Avba);
LA::AlignedMatrix9x9f::Increase(0, 6, Avbw);
LA::AlignedMatrix9x9f::IncreaseDiagonal(3, Ababa);
LA::AlignedMatrix9x9f::Increase(3, 6, Ababw);
LA::AlignedMatrix9x9f::IncreaseDiagonal(6, Abwbw);
LA::AlignedMatrix9x9f::SetLowerFromUpper();
}
inline void Increase(const LA::AlignedMatrix3x3f *Av, const LA::AlignedMatrix3x3f *Aba,
const LA::AlignedMatrix3x3f *Abw, const bool symmetric) {
if (symmetric) {
LA::SymmetricMatrix3x3f A;
A.Set(Av[0]);
LA::AlignedMatrix9x9f::IncreaseDiagonal(0, A);
LA::AlignedMatrix9x9f::Increase(0, 3, Av[1]);
LA::AlignedMatrix9x9f::Increase(0, 6, Av[2]);
A.Set(Aba[1]);
LA::AlignedMatrix9x9f::IncreaseDiagonal(3, A);
LA::AlignedMatrix9x9f::Increase(3, 6, Aba[2]);
A.Set(Abw[2]);
LA::AlignedMatrix9x9f::IncreaseDiagonal(6, A);
LA::AlignedMatrix9x9f::SetLowerFromUpper();
} else {
LA::AlignedMatrix9x9f::Increase(0, 0, Av[0]);
LA::AlignedMatrix9x9f::Increase(0, 3, Av[1]);
LA::AlignedMatrix9x9f::Increase(0, 6, Av[2]);
LA::AlignedMatrix9x9f::Increase(3, 0, Aba[0]);
LA::AlignedMatrix9x9f::Increase(3, 3, Aba[1]);
LA::AlignedMatrix9x9f::Increase(3, 6, Aba[2]);
LA::AlignedMatrix9x9f::Increase(6, 0, Abw[0]);
LA::AlignedMatrix9x9f::Increase(6, 3, Abw[1]);
LA::AlignedMatrix9x9f::Increase(6, 6, Abw[2]);
}
}
};
template<int M, int N, int K, class BLOCK_ABT>
inline void ABT(const LA::AlignedMatrixMxNf<M, N> &A, const LA::AlignedMatrixMxNf<K, N> &B,
BLOCK_ABT &ABT) {
for (int i = 0; i < M; ++i) {
const LA::AlignedVectorNf<N> &Ai = A(i);
float *ABTi = ABT[i];
for (int j = 0; j < K; ++j) {
ABTi[j] = Ai.Dot(B(j));
}
}
}
inline void ABT(const RC &A, const CC &B, RC &ABT) {
LA::AlignedMatrix6x6f::ABT(A, B, ABT);
}
inline void ABT(const CC &A, const CC &B, CC &ABT) {
LA::AlignedMatrix6x6f::ABT(A, B, ABT);
}
inline void ABT(const MC &A, const CC &B, MC &ABT) {
LA::AlignedMatrix9x6f::ABT(A, B, ABT);
}
template<int M, int N, int K, class BLOCK_ABT>
inline void AddABTTo(const LA::AlignedMatrixMxNf<M, N> &A, const LA::AlignedMatrixMxNf<K, N> &B,
BLOCK_ABT &ABT) {
for (int i = 0; i < M; ++i) {
const LA::AlignedVectorNf<N> &Ai = A(i);
float *ABTi = ABT[i];
for (int j = 0; j < K; ++j) {
ABTi[j] += Ai.Dot(B(j));
}
}
}
inline void AddABTTo(const RC &A, const CC &B, RC &ABT) {
LA::AlignedMatrix6x6f::AddABTTo(A, B, ABT);
}
inline void AddABTTo(const RC &A, const MC &B, RM &ABT) {
LA::AlignedMatrix9x6f::AddABTTo(A, B, ABT);
}
inline void AddABTTo(const CC &A, const CC &B, CC &ABT) {
LA::AlignedMatrix6x6f::AddABTTo(A, B, ABT);
}
inline void AddABTTo(const CC &A, const MC &B, CM &ABT) {
LA::AlignedMatrix9x6f::AddABTTo(A, B, ABT);
}
template<int M, int N, int K, class BLOCK_ABT>
inline void AddABTToUpper(const LA::AlignedMatrixMxNf<M, N> &A,
const LA::AlignedMatrixMxNf<K, N> &B, BLOCK_ABT &ABT) {
for (int i = 0; i < M; ++i) {
const LA::AlignedVectorNf<N> &Ai = A(i);
float *ABTi = ABT[i];
for (int j = i; j < K; ++j) {
ABTi[j] += Ai.Dot(B(j));
}
}
}
inline void AddABTToUpper(const RC &A, const RC &B, RR &ABT) {
LA::AlignedMatrix2x6f::AddABTTo(A, B, ABT);
}
inline void AddABTToUpper(const CC &A, const CC &B, CC &ABT) {
LA::AlignedMatrix6x6f::AddABTTo(A, B, ABT);
}
inline void AddABTToUpper(const RM &A, const RM &B, RR &ABT) {
LA::AlignedMatrix2x9f::AddABTTo(A, B, ABT);
}
template<int M, const int N, class BLOCK_B, class BLOCK_ABT>
inline void AddAbTo(const LA::AlignedMatrixMxNf<M, N> &A, const BLOCK_B &b, BLOCK_ABT &ABT) {
for (int i = 0; i < M; ++i) {
ABT[i] += A(i).Dot(b);
}
}
inline void AddAbTo(const RC &A, const C &b, R &Ab) {
LA::AlignedMatrix2x6f::AddAbTo(A, b, Ab);
}
inline void AddAbTo(const RM &A, const M &b, R &Ab) {
LA::AlignedMatrix2x9f::AddAbTo(A, b, Ab);
}
inline void AddAbTo(const CC &A, const C &b, C &Ab) {
LA::AlignedMatrix6x6f::AddAbTo(A, b, (float *) &Ab);
}
} // namespace Element
namespace Vector {
#ifdef CFG_CAMERA_PRIOR_DOUBLE
typedef LA::AlignedVectorXd X;
#else
typedef LA::AlignedVectorXf X;
#endif
class C : public AlignedVector<Element::C> {
public:
inline C() {}
inline C(const AlignedVector<Element::C> &V) { *((AlignedVector<Element::C> *) this) = V; }
inline C(void *data, const int N, const bool own = true) :
AlignedVector<Element::C>(data, N, own) {}
inline void operator += (const C &V) {
const int N = Size();
#ifdef CFG_DEBUG
UT_ASSERT(V.Size() == N);
#endif
for (int i = 0; i < N; ++i) {
m_data[i] += V[i];
}
}
inline float SquaredLength() const {
float S = 0.0f;
const int N = Size();
for (int i = 0; i < N; ++i) {
S += m_data[i].SquaredLength();
}
return S;
}
};
class EC : public AlignedVector<Element::EC> {
};
class JC : public AlignedVector<Element::JC> {
public:
inline void GetTranspose(JC &JT) const {
const int N = Size();
JT.Resize(N);
for (int i = 0; i < N; ++i) {
m_data[i].GetTranspose(JT[i]);
}
}
};
class RC : public AlignedVector<Element::RC> {
public:
inline RC() {}
inline RC(const AlignedVector<Element::RC> &V) { *((AlignedVector<Element::RC> *) this) = V; }
inline RC(void *data, const int N, const bool own = true) :
AlignedVector<Element::RC>(data, N, own) {}
};
class RM : public AlignedVector<Element::RM> {
public:
inline RM() {}
inline RM(const AlignedVector<Element::RM> &V) { *((AlignedVector<Element::RM> *) this) = V; }
inline RM(void *data, const int N, const bool own = true) :
AlignedVector<Element::RM>(data, N, own) {}
};
class CC : public AlignedVector<Element::CC> {
public:
inline CC() {}
inline CC(const AlignedVector<Element::CC> &V) { *((AlignedVector<Element::CC> *) this) = V; }
inline CC(void *data, const int N, const bool own = true) :
AlignedVector<Element::CC>(data, N, own) {}
};
class CM : public AlignedVector<Element::CM> {
public:
inline CM() {}
inline CM(const AlignedVector<Element::CM> &V) { *((AlignedVector<Element::CM> *) this) = V; }
inline CM(void *data, const int N, const bool own = true) :
AlignedVector<Element::CM>(data, N, own) {}
};
class MC : public AlignedVector<Element::MC> {
public:
inline MC() {}
inline MC(const AlignedVector<Element::MC> &V) { *((AlignedVector<Element::MC> *) this) = V; }
inline MC(void *data, const int N, const bool own = true) :
AlignedVector<Element::MC>(data, N, own) {}
};
class MM : public AlignedVector<Element::MM> {
public:
inline MM() {}
inline MM(const AlignedVector<Element::MM> &V) { *((AlignedVector<Element::MM> *) this) = V; }
inline MM(void *data, const int N, const bool own = true) :
AlignedVector<Element::MM>(data, N, own) {}
};
template<class BLOCK_A, class BLOCK_B, class BLOCK_ABT>
inline void ABT(const AlignedVector<BLOCK_A> &A, const BLOCK_B &B,
AlignedVector<BLOCK_ABT> &ABT) {
const int N = A.Size();
ABT.Resize(N);
for (int i = 0; i < N; ++i) {
Element::ABT(A[i], B, ABT[i]);
}
}
template<class BLOCK_A, class BLOCK_B, class BLOCK_ABT>
inline void ABT(const AlignedMatrixX<BLOCK_A> &A, const BLOCK_B &B,
AlignedVector<BLOCK_ABT> &ABT) {
const int N = A.GetRows();
#ifdef CFG_DEBUG
UT_ASSERT(A.GetColumns() == 1);
#endif
ABT.Resize(N);
for (int i = 0; i < N; ++i) {
Element::ABT(A[i][0], B, ABT[i]);
}
}
template<class BLOCK_A, class BLOCK_B, class BLOCK_ABT>
inline void AddABTTo(const AlignedVector<BLOCK_A> &A, const BLOCK_B &B,
AlignedVector<BLOCK_ABT> &ABT) {
const int N = A.Size();
#ifdef CFG_DEBUG
UT_ASSERT(ABT.Size() == N);
#endif
for (int i = 0; i < N; ++i) {
Element::AddABTTo(A[i], B, ABT[i]);
}
}
template<class BLOCK_A, class BLOCK_B, class BLOCK_ABT>
inline void AddABTTo(const AlignedVector<BLOCK_A> &A, const BLOCK_B &B,
AlignedMatrixX<BLOCK_ABT> &ABT) {
const int N = A.Size();
#ifdef CFG_DEBUG
UT_ASSERT(ABT.GetRows() == N && ABT.GetColumns() == 1);
#endif
for (int i = 0; i < N; ++i) {
Element::AddABTTo(A[i], B, ABT[i][0]);
}
}
template<class BLOCK_A, class BLOCK_B, class BLOCK_ABT>
inline void AddABTTo(const BLOCK_A &A, const AlignedVector<BLOCK_B> &B,
AlignedVector<BLOCK_ABT> &ABT) {
const int N = B.Size();
#ifdef CFG_DEBUG
UT_ASSERT(ABT.Size() == N);
#endif
for (int i = 0; i < N; ++i) {
Element::AddABTTo(A, B[i], ABT[i]);
}
}
template<class BLOCK_A, class BLOCK_B, class BLOCK_ABT>
inline void AddABTTo(const BLOCK_A &A, const AlignedMatrixX<BLOCK_B> &B,
AlignedVector<BLOCK_ABT> &ABT) {
const int N = B.GetRows();
#ifdef CFG_DEBUG
UT_ASSERT(B.GetColumns() == 1 && ABT.Size() == N);
#endif
for (int i = 0; i < N; ++i) {
Element::AddABTTo(A, B[i][0], ABT[i]);
}
}
template<class BLOCK_A, class BLOCK_B, class BLOCK_ABT>
inline void AddAbTo(const AlignedVector<BLOCK_A> &A, const BLOCK_B &b,
AlignedVector<BLOCK_ABT> &Ab) {
const int N = A.Size();
#ifdef CFG_DEBUG
UT_ASSERT(Ab.Size() == N);
#endif
for (int i = 0; i < N; ++i) {
Element::AddAbTo(A[i], b, Ab[i]);
}
}
#ifdef CFG_DEBUG_EIGEN
inline EigenVectorXf EigenConvert(const C &b) {
EigenVectorXf e_b;
const int N = b.Size();
e_b.Resize(N * 6);
e_b.MakeZero();
for (int i = 0, j = 0; i < N; ++i, j += 6) {
if (b[i].Valid()) {
e_b.block<6, 1>(j, 0) = EigenVector6f(b[i]);
}
}
return e_b;
}
inline void EigenConvert(const EigenVectorXf &e_b, C &b) {
const int Nx6 = e_b.Size(), N = Nx6 / 6;
#ifdef CFG_DEBUG
UT_ASSERT(Nx6 % 6 == 0);
#endif
b.Resize(N);
for (int i = 0, j = 0; i < N; ++i, j += 6) {
b[i] = EigenVector6f(e_b.block<6, 1>(j, 0)).GetAlignedVector6f();
}
}
inline EigenMatrixXf EigenConvert(const RC &V) {
const int N = V.Size();
EigenMatrixXf e_V;
e_V.Resize(2, N * 6);
e_V.MakeZero();
for (int i = 0, j = 0; i < N; ++i, j += 6) {
if (V[i].Valid()) {
e_V.block<2, 6>(0, j) = EigenMatrix2x6f(V[i]);
}
}
return e_V;
}
inline void EigenConvert(const EigenMatrixXf &e_V, RC &V) {
const int Nx6 = e_V.GetColumns(), N = Nx6 / 6;
#ifdef CFG_DEBUG
UT_ASSERT(Nx6 % 6 == 0 && e_V.GetRows() == 2);
#endif
V.Resize(N);
for (int i = 0, j = 0; i < N; ++i, j += 6) {
V[i] = EigenMatrix2x6f(e_V.block<2, 6>(0, j)).GetAlignedMatrix2x6f();
}
}
inline EigenMatrixXf EigenConvert(const CM &V) {
const int N = V.Size();
EigenMatrixXf e_V;
e_V.Resize(N * 6, 9);
e_V.MakeZero();
for (int i = 0, j = 0; i < N; ++i, j += 6) {
if (V[i].Valid()) {
e_V.block<6, 9>(j, 0) = EigenMatrix6x9f(V[i]);
}
}
return e_V;
}
inline void EigenConvert(const EigenMatrixXf &e_V, CM &V) {
const int Nx6 = e_V.GetRows(), N = Nx6 / 6;
#ifdef CFG_DEBUG
UT_ASSERT(Nx6 % 6 == 0 && e_V.GetColumns() == 9);
#endif
V.Resize(N);
for (int i = 0, j = 0; i < N; ++i, j += 6) {
V[i] = EigenMatrix6x9f(e_V.block<6, 9>(j, 0)).GetAlignedMatrixMxNf();
}
}
inline bool EigenAssertEqual(const EigenVectorXf &e_b, const C &b,
const int verbose = 1, const std::string str = "") {
const int Nx6 = e_b.Size(), N = b.Size();
UT_ASSERT(N == 0 || Nx6 == N * 6);
bool scc = true;
for (int i = 0, j = 0; j < Nx6; ++i, j += 6) {
const EigenVector6f e_b1 = EigenVector6f(e_b.block<6, 1>(j, 0));
const std::string _str = str + UT::String("[%d]", i);
if (N != 0 && b[i].Valid()) {
const EigenVector6f e_b2 = EigenVector6f(b[i]);
scc = e_b1.AssertEqual(e_b2, verbose, _str) && scc;
} else {
scc = e_b1.AssertZero(verbose, _str) && scc;
}
}
return scc;
}
inline bool EigenAssertEqual(const EigenMatrixXf &e_V, const RC &V,
const int verbose = 1, const std::string str = "") {
const int Nx6 = e_V.GetColumns(), N = V.Size();
UT_ASSERT(e_V.GetRows() == 2 && (N == 0 || Nx6 == N * 6));
bool scc = true;
for (int i = 0, j = 0; j < Nx6; ++i, j += 6) {
const EigenMatrix2x6f e_A1 = EigenMatrix2x6f(e_V.block<2, 6>(0, j));
const std::string _str = str + UT::String("[%d]", i);
if (N != 0 && V[i].Valid()) {
const EigenMatrix2x6f e_A2 = EigenMatrix2x6f(V[i]);
scc = e_A1.AssertEqual(e_A2, verbose, _str) && scc;
} else {
scc = e_A1.AssertZero(verbose, _str) && scc;
}
}
return scc;
}
inline bool EigenAssertEqual(const EigenMatrixXf &e_V, const CM &V,
const int verbose = 1, const std::string str = "") {
const int Nx6 = e_V.GetRows(), N = V.Size();
UT_ASSERT((N == 0 || Nx6 == N * 6) && e_V.GetColumns() == 9);
bool scc = true;
for (int i = 0, j = 0; j < Nx6; ++i, j += 6) {
const EigenMatrix6x9f e_A1 = EigenMatrix6x9f(e_V.block<6, 9>(j, 0));
const std::string _str = str + UT::String("[%d]", i);
if (N != 0 && V[i].Valid()) {
const EigenMatrix6x9f e_A2 = EigenMatrix6x9f(V[i]);
scc = e_A1.AssertEqual(e_A2, verbose, _str) && scc;
} else {
scc = e_A1.AssertZero(verbose, _str) && scc;
}
}
return scc;
}
#endif
} // namespace Vector
namespace Matrix {
#ifdef CFG_CAMERA_PRIOR_DOUBLE
typedef LA::AlignedMatrixXd X;
#else
typedef LA::AlignedMatrixXf X;
#endif
class CC : public AlignedMatrixX<Element::CC> {
public:
inline CC() {}
inline CC(const AlignedMatrixX<Element::CC> &A) { *((AlignedMatrixX<Element::CC> *) this) = A; }
inline void MakeIdentity() {
MakeZero();
const int N = GetRows();
#ifdef CFG_DEBUG
UT_ASSERT(GetColumns() == N);
#endif
for (int i = 0; i < N; ++i) {
m_rows[i][i].MakeIdentity();
}
}
inline void SetLowerFromUpper() {
const int N = GetRows();
#ifdef CFG_DEBUG
UT_ASSERT(GetColumns() == N);
#endif
if (m_symmetric) {
for (int i = 0; i < N; ++i) {
m_rows[i][i].SetLowerFromUpper();
}
} else {
for (int i = 0; i < N; ++i) {
m_rows[i][i].SetLowerFromUpper();
for (int j = i + 1; i < N; ++i) {
m_rows[i][j].GetTranspose(m_rows[j][i]);
}
}
}
}
inline void AssertSymmetric() const {
const int N = GetRows();
#ifdef CFG_DEBUG
UT_ASSERT(GetColumns() == N);
#endif
if (m_symmetric) {
for (int i = 0; i < N; ++i) {
m_rows[i][i].AssertSymmetric();
}
} else {
for (int i = 0; i < N; ++i) {
m_rows[i][i].AssertSymmetric();
for (int j = i + 1; j < N; ++j) {
m_rows[i][j].AssertSymmetric(m_rows[j][i]);
}
}
}
}
};
template<class BLOCK_A, class BLOCK_B, class BLOCK_ABT>
inline void AddABTTo(const AlignedVector<BLOCK_A> &A, const AlignedVector<BLOCK_B> &B,
AlignedMatrixX<BLOCK_ABT> &ABT) {
const int M = A.Size(), N = B.Size();
#ifdef CFG_DEBUG
UT_ASSERT(ABT.GetRows() == M && ABT.GetColumns() == N);
#endif
for (int i = 0; i < M; ++i) {
const BLOCK_A &Ai = A[i];
BLOCK_ABT *ABTi = ABT[i];
for (int j = 0; j < N; ++j) {
Element::AddABTTo(Ai, B[j], ABTi[j]);
}
}
}
template<class BLOCK_A, class BLOCK_B, class BLOCK_ABT>
inline void AddABTToUpper(const AlignedVector<BLOCK_A> &A, const AlignedVector<BLOCK_B> &B,
AlignedMatrixX<BLOCK_ABT> &ABT) {
const int N = A.Size();
#ifdef CFG_DEBUG
UT_ASSERT(B.Size() == N && ABT.GetRows() == N && ABT.GetColumns() == N);
#endif
for (int i = 0; i < N; ++i) {
const BLOCK_A &Ai = A[i];
BLOCK_ABT *ABTi = ABT[i];
Element::AddABTToUpper(Ai, B[i], ABTi[i]);
for (int j = i + 1; j < N; ++j) {
Element::AddABTTo(Ai, B[j], ABTi[j]);
}
}
}
template<class BLOCK_A, class BLOCK_B, class BLOCK_ABT>
inline void AddABTToUpper(const AlignedVector<BLOCK_A> &A, const AlignedMatrixX<BLOCK_B> &B,
AlignedMatrixX<BLOCK_ABT> &ABT) {
const int N = A.Size();
#ifdef CFG_DEBUG
UT_ASSERT(B.GetRows() == N && B.GetColumns() == 1);
UT_ASSERT(ABT.GetRows() == N && ABT.GetColumns() == N);
#endif
for (int i = 0; i < N; ++i) {
const BLOCK_A &Ai = A[i];
BLOCK_ABT *ABTi = ABT[i];
Element::AddABTToUpper(Ai, B[i][0], ABTi[i]);
for (int j = i + 1; j < N; ++j) {
Element::AddABTTo(Ai, B[j][0], ABTi[j]);
}
}
}
#ifdef CFG_DEBUG_EIGEN
inline EigenMatrixXf EigenConvert(const CC &A) {
EigenMatrixXf e_A;
const int N = A.GetRows(), Nx6 = N * 6;
#ifdef CFG_DEBUG
UT_ASSERT(A.GetColumns() == N);
#endif
e_A.Resize(Nx6, Nx6);
e_A.MakeZero();
if (A.Symmetric()) {
for (int i1 = 0, j1 = 0; i1 < N; ++i1, j1 += 6) {
for (int i2 = i1, j2 = j1; i2 < N; ++i2, j2 += 6) {
if (A[i1][i2].Invalid()) {
continue;
}
e_A.block<6, 6>(j1, j2) = EigenMatrix6x6f(A[i1][i2]);
if (i2 != i1) {
e_A.block<6, 6>(j2, j1) = e_A.block<6, 6>(j1, j2).transpose();
}
}
}
} else {
for (int i1 = 0, j1 = 0; i1 < N; ++i1, j1 += 6) {
for (int i2 = 0, j2 = 0; i2 < N; ++i2, j2 += 6) {
if (A[i1][i2].Valid()) {
e_A.block<6, 6>(j1, j2) = EigenMatrix6x6f(A[i1][i2]);
}
}
}
}
return e_A;
}
inline void EigenConvert(const EigenMatrixXf &e_A, CC &A, const bool symmetric = true) {
const int Nrx6 = e_A.GetRows(), Nr = Nrx6 / 6;
const int Ncx6 = e_A.GetColumns(), Nc = Ncx6 / 6;
#ifdef CFG_DEBUG
UT_ASSERT(Nrx6 % 6 == 0 && Ncx6 % 6 == 0);
#endif
A.Resize(Nr, Nc, symmetric);
for (int i1 = 0, j1 = 0; i1 < Nr; ++i1, j1 += 6) {
for (int i2 = symmetric ? i1 : 0, j2 = symmetric ? j1 : 0; i2 < Nc; ++i2, j2 += 6) {
A[i1][i2] = EigenMatrix6x6f(e_A.block<6, 6>(j1, j2)).GetAlignedMatrix6x6f();
}
}
}
inline bool EigenAssertEqual(const EigenMatrixXf &e_A, const CC &A,
const int verbose = 1, const std::string str = "") {
const int Nx6 = e_A.GetRows(), N = A.GetRows();
UT_ASSERT(N == 0 || Nx6 == N * 6);
UT_ASSERT(e_A.GetColumns() == Nx6 && A.GetColumns() == N);
bool scc = true;
if (A.Symmetric()) {
A.AssertSymmetric();
for (int i1 = 0, j1 = 0; j1 < Nx6; ++i1, j1 += 6) {
for (int i2 = i1, j2 = j1; j2 < Nx6; ++i2, j2 += 6) {
const EigenMatrix6x6f e_A1 = EigenMatrix6x6f(e_A.block<6, 6>(j1, j2));
const std::string _str = str + UT::String("[%d][%d]", i1, i2);
if (N != 0 && A[i1][i2].Valid()) {
const EigenMatrix6x6f e_A2 = EigenMatrix6x6f(A[i1][i2]);
scc = e_A1.AssertEqual(e_A2, verbose, _str) && scc;
} else {
scc = e_A1.AssertZero(verbose, _str) && scc;
}
if (i2 == i1) {
continue;
}
const EigenMatrix6x6f e_A3 = EigenMatrix6x6f(e_A.block<6, 6>(j2, j1).transpose());
scc = e_A1.AssertEqual(e_A3, verbose, str + UT::String("[%d][%d]", i2, i1)) && scc;
}
}
} else {
for (int i1 = 0, j1 = 0; j1 < Nx6; ++i1, j1 += 6) {
for (int i2 = 0, j2 = 0; j2 < Nx6; ++i2, j2 += 6) {
const EigenMatrix6x6f e_A1 = EigenMatrix6x6f(e_A.block<6, 6>(j1, j2));
const std::string _str = str + UT::String("[%d][%d]", i1, i2);
if (N != 0 && A[i1][i2].Valid()) {
const EigenMatrix6x6f e_A2 = EigenMatrix6x6f(A[i1][i2]);
scc = e_A1.AssertEqual(e_A2, verbose, _str) && scc;
} else {
scc = e_A1.AssertZero(verbose, _str) && scc;
}
}
}
}
return scc;
}
#endif
} // namespace Matrix
class Pose {
public:
class Error {
public:
inline Error() {}
inline Error(const Error &e) { *this = e; }
inline void operator = (const Error &e) { m_er = e.m_er; m_ec.Set(e.m_ec); }
inline void Resize(const int N) { m_ec.Resize(N); }
inline int Size() const { return m_ec.Size(); }
inline void MakeZero() { m_er.MakeZero(); m_ec.MakeZero(); }
inline void Bind(void *data, const int N) { m_ec.Bind(data, N); }
inline void* BindNext() { return m_ec.BindNext(); }
inline int BindSize(const int N) const { return m_ec.BindSize(N); }
inline void SaveB(FILE *fp) const { UT::SaveB(m_er, fp); m_ec.SaveB(fp); }
inline void LoadB(FILE *fp) { UT::LoadB(m_er, fp); m_ec.LoadB(fp); }
public:
LA::Vector2f m_er;
Vector::EC m_ec;
};
class Jacobian {
public:
inline Jacobian() {}
inline Jacobian(const Jacobian &J) { *this = J; }
inline void operator = (const Jacobian &J) { m_Jr = J.m_Jr; m_Jc.Set(J.m_Jc); }
inline void Resize(const int N) { m_Jc.Resize(N); }
inline int Size() const { return m_Jc.Size(); }
inline void MakeZero() { m_Jr.MakeZero(); m_Jc.MakeZero(); }
inline void Bind(void *data, const int N) { m_Jc.Bind(data, N); }
inline void* BindNext() { return m_Jc.BindNext(); }
inline int BindSize(const int N) const { return m_Jc.BindSize(N); }
inline void SaveB(FILE *fp) const { UT::SaveB(m_Jr, fp); m_Jc.SaveB(fp); }
inline void LoadB(FILE *fp) { UT::LoadB(m_Jr, fp); m_Jc.LoadB(fp); }
public:
//LA::Matrix2x3f m_Jr;
LA::AlignedMatrix2x3f m_Jr;
Vector::JC m_Jc;
};
class ErrorJacobian {
public:
inline ErrorJacobian() {}
inline ErrorJacobian(const ErrorJacobian &Je) { *this = Je; }
inline void operator = (const ErrorJacobian &Je) { m_e = Je.m_e; m_J = Je.m_J; }
inline void Resize(const int N) { m_e.Resize(N); m_J.Resize(N); }
inline int Size() const { return m_e.Size(); }
inline void MakeZero() { m_e.MakeZero(); m_J.MakeZero(); }
inline void Bind(void *data, const int N) { m_e.Bind(data, N); m_J.Bind(m_e.BindNext(), N); }
inline void* BindNext() { return m_J.BindNext(); }
inline int BindSize(const int N) const { return m_e.BindSize(N) + m_J.BindSize(N); }
inline void SaveB(FILE *fp) const { m_e.SaveB(fp); m_J.SaveB(fp); }
inline void LoadB(FILE *fp) { m_e.LoadB(fp); m_J.LoadB(fp); }
inline void AssertConsistency() const { UT_ASSERT(m_e.Size() == m_J.Size()); }
public:
Jacobian m_J;
Error m_e;
};
class Factor {
public:
class Auxiliary {
public:
inline void Bind(void *data, const int N) {
m_JcT.Bind(data, N);
m_JTAc0.Bind(m_JcT.BindNext(), N);
m_JTAc.Bind(m_JTAc0.BindNext(), N, N, true);
m_Aec.Bind(m_JTAc.BindNext(), N);
}
inline void* BindNext() { return m_Aec.BindNext(); }
inline int BindSize(const int N) const {
return m_JcT.BindSize(N) + m_JTAc0.BindSize(N) + m_JTAc.BindSize(N, N, true) +
m_Aec.BindSize(N);
}
inline void Set(const bool g, const ErrorJacobian &Je/*, const LA::AlignedMatrix2x3f &Jr*/,
const xp128f &w, const Element::RR &Arr, const Vector::RC &Arc,
const Matrix::CC &Acc) {
//m_g = !Arc.Empty();
m_g = g;
Je.m_J.m_Jc.GetTranspose(m_JcT);
const int N = m_JcT.Size(), _N = N + 1;
#ifdef CFG_DEBUG
if (m_g) {
UT_ASSERT(Arc.Size() == N);
}
UT_ASSERT(Acc.GetRows() == N && Acc.GetColumns() == N);
#endif
m_JTAc0.Resize(N);
m_Aec.Resize(N);
if (m_g) {
Element::RR wArr;
Element::RC wArc;
LA::AlignedMatrix2x3f SArp, SArr, _Arp, _Arr;
LA::AlignedMatrix3x3f _JTAc;
LA::AlignedVector3f _Aec;
SArp.MakeZero();
Arr.GetScaled(w[0], wArr);
const LA::AlignedMatrix2x3f &Jr = Je.m_J.m_Jr;
LA::AlignedMatrix2x3f::AB(wArr, Jr, SArr);
const LA::Vector2f &er = Je.m_e.m_er;
LA::SymmetricMatrix2x2f::Ab(wArr, er, m_Aer);
const xp128f erx = xp128f::get(er.x()), ery = xp128f::get(er.y());
for (int i = 0; i < N; ++i) {
Arc[i].GetScaled(w, wArc);
wArc.Get(_Arp, _Arr);
const Element::JC &_JcT = m_JcT[i];
LA::AlignedMatrix2x3f::AddABTTo(_Arp, _JcT.m_Jpp1, SArp);
LA::AlignedMatrix2x3f::AddABTTo(_Arp, _JcT.m_Jpr1, SArr);
LA::AlignedMatrix2x3f::AddABTTo(_Arr, _JcT.m_Jrr1, SArr);
const Element::EC &_ec = Je.m_e.m_ec[i];
LA::AlignedMatrix2x3f::AddAbTo(_Arp, _ec.m_ep, m_Aer);
LA::AlignedMatrix2x3f::AddAbTo(_Arr, _ec.m_er, m_Aer);
Element::CC &JTAc = m_JTAc0[i];
JTAc.MakeZero3x6();
LA::AlignedMatrix2x3f::ATB(Jr, _Arp, _JTAc); JTAc.Set30(_JTAc);
LA::AlignedMatrix2x3f::ATB(Jr, _Arr, _JTAc); JTAc.Set33(_JTAc);
Element::C &Aec = m_Aec[i];
LA::AlignedMatrix2x3f::ATb(_Arp, erx, ery, _Aec); Aec.Set012(_Aec);
LA::AlignedMatrix2x3f::ATb(_Arr, erx, ery, _Aec); Aec.Set345(_Aec);
}
m_JTArT0.Set(SArp, SArr);
} else {
m_JTAc0.MakeZero();
m_Aec.MakeZero();
}
Element::CC wAcc;
LA::AlignedMatrix3x3f _App, _Apr, _Arp, _Arr;
m_JTAc.Resize(N, N, true);
for (int i = 0; i < N; ++i) {
Element::CC &JTAc1 = m_JTAc0[i];
Element::C &Aec = m_Aec[i];
for (int j = 0; j < N; ++j) {
const Element::JC &_JcT = m_JcT[j];
if (i <= j) {
Acc[i][j].GetScaled(w, wAcc);
} else {
Acc[j][i].GetScaled(w, wAcc);
wAcc.Transpose();
}
wAcc.Get(_App, _Apr, _Arp, _Arr);
LA::AlignedMatrix6x6f::AddABTTo00(_JcT.m_Jpp1, _App, JTAc1);
LA::AlignedMatrix6x6f::AddABTTo03(_JcT.m_Jpp1, _Arp, JTAc1);
LA::AlignedMatrix6x6f::AddABTTo30(_JcT.m_Jpr1, _App, JTAc1);
LA::AlignedMatrix6x6f::AddABTTo30(_JcT.m_Jrr1, _Apr, JTAc1);
LA::AlignedMatrix6x6f::AddABTTo33(_JcT.m_Jpr1, _Arp, JTAc1);
LA::AlignedMatrix6x6f::AddABTTo33(_JcT.m_Jrr1, _Arr, JTAc1);
if (j <= i) {
Element::CC &JTAc2 = m_JTAc[j][i];
LA::AlignedMatrix6x6f::ABTTo00(_JcT.m_Jpp2, _App, JTAc2);
LA::AlignedMatrix6x6f::ABTTo03(_JcT.m_Jpp2, _Arp, JTAc2);
LA::AlignedMatrix6x6f::ABTTo30(_JcT.m_Jrr2, _Apr, JTAc2);
LA::AlignedMatrix6x6f::ABTTo33(_JcT.m_Jrr2, _Arr, JTAc2);
}
const Element::EC &_ec = Je.m_e.m_ec[j];
LA::AlignedMatrix3x3f::AddAbTo(_App, _ec.m_ep, &Aec.v0());
LA::AlignedMatrix3x3f::AddAbTo(_Apr, _ec.m_er, &Aec.v0());
LA::AlignedMatrix3x3f::AddAbTo(_Arp, _ec.m_ep, &Aec.v3());
LA::AlignedMatrix3x3f::AddAbTo(_Arr, _ec.m_er, &Aec.v3());
}
}
}
inline void Get(const LA::AlignedMatrix2x3f &Jr, const xp128f &w, const Element::R &br,
const Vector::C &bc, Matrix::CC *A, Vector::C *b) const {
const int N = m_JcT.Size(), _N = N + 1;
#ifdef CFG_DEBUG
UT_ASSERT(bc.Size() == N);
#endif
A->Resize(_N, _N, true);
b->Resize(_N);
Matrix::CC &_A = *A;
Vector::C &_b = *b;
Element::CC &A00 = _A[0][0];
Element::C &b0 = _b[0];
if (m_g) {
Element::R wbr;
LA::AlignedMatrix2x3f _AJrp, _AJrr;
LA::AlignedMatrix3x3f _A;
LA::AlignedVector3f _b;
m_JTArT0.Get(_AJrp, _AJrr);
A00.MakeZero3x3();
LA::AlignedMatrix2x3f::ATB(_AJrp, Jr, _A); A00.Set03(_A);
LA::AlignedMatrix2x3f::ATBToUpper(_AJrr, Jr, _A); A00.Set33(_A);
Element::R Aepbr;
br.GetScaled(w[0], wbr);
LA::Vector2f::apb(wbr, m_Aer, Aepbr);
b0.MakeZero012();
LA::AlignedMatrix2x3f::ATb(Jr, Aepbr, _b);
b0.Set345(_b);
} else {
A00.MakeZero();
b0.MakeZero();
}
Element::C wbc;
LA::AlignedMatrix3x3f _JTApp, _JTApr, _JTArp, _JTArr;
Element::C Aepbc;
LA::AlignedVector3f Aepbp, Aepbr;
for (int i = 0, _i = 1; i < N; ++i, ++_i) {
const Element::JC &JTi = m_JcT[i];
m_JTAc0[i].Get(_JTApp, _JTApr, _JTArp, _JTArr);
LA::SymmetricMatrix6x6f::AddABTTo00(_JTApp, JTi.m_Jpp1, A00);
LA::AlignedMatrix6x6f::AddABTTo03(_JTApp, JTi.m_Jpr1, A00);
LA::AlignedMatrix6x6f::AddABTTo03(_JTApr, JTi.m_Jrr1, A00);
LA::SymmetricMatrix6x6f::AddABTTo33(_JTArp, JTi.m_Jpr1, A00);
LA::SymmetricMatrix6x6f::AddABTTo33(_JTArr, JTi.m_Jrr1, A00);
Element::CC &A0i = _A[0][_i];
LA::AlignedMatrix6x6f::ABTTo00(_JTApp, JTi.m_Jpp2, A0i);
LA::AlignedMatrix6x6f::ABTTo03(_JTApr, JTi.m_Jrr2, A0i);
LA::AlignedMatrix6x6f::ABTTo30(_JTArp, JTi.m_Jpp2, A0i);
LA::AlignedMatrix6x6f::ABTTo33(_JTArr, JTi.m_Jrr2, A0i);
bc[i].GetScaled(w, wbc);
LA::AlignedVector6f::apb(wbc, m_Aec[i], Aepbc);
Aepbc.Get(Aepbp, Aepbr);
LA::AlignedMatrix3x3f::AddAbTo(JTi.m_Jpp1, Aepbp, &b0.v0());
LA::AlignedMatrix3x3f::AddAbTo(JTi.m_Jpr1, Aepbp, &b0.v3());
LA::AlignedMatrix3x3f::AddAbTo(JTi.m_Jrr1, Aepbr, &b0.v3());
Element::C &bi = _b[_i];
LA::AlignedMatrix3x3f::Ab(JTi.m_Jpp2, Aepbp, &bi.v0());
LA::AlignedMatrix3x3f::Ab(JTi.m_Jrr2, Aepbr, &bi.v3());
}
for (int i = 0, _i = 1; i < N; ++i, ++_i) {
const Element::CC *JTAi = m_JTAc[i];
JTAi[i].Get(_JTApp, _JTApr, _JTArp, _JTArr);
const Element::JC &JTi = m_JcT[i];
Element::CC *Ai = _A[_i], &Aii = Ai[_i];
LA::SymmetricMatrix6x6f::ABTTo00(_JTApp, JTi.m_Jpp2, Aii);
LA::AlignedMatrix6x6f::ABTTo03(_JTApr, JTi.m_Jrr2, Aii);
LA::AlignedMatrix6x6f::ABTTo30(_JTArp, JTi.m_Jpp2, Aii);
LA::SymmetricMatrix6x6f::ABTTo33(_JTArr, JTi.m_Jrr2, Aii);
for (int j = i + 1, _j = j + 1; j < N; ++j, ++_j) {
const Element::JC &JTj = m_JcT[j];
Element::CC &Aij = Ai[_j];
JTAi[j].Get(_JTApp, _JTApr, _JTArp, _JTArr);
LA::AlignedMatrix6x6f::ABTTo00(_JTApp, JTj.m_Jpp2, Aij);
LA::AlignedMatrix6x6f::ABTTo03(_JTApr, JTj.m_Jrr2, Aij);
LA::AlignedMatrix6x6f::ABTTo30(_JTArp, JTj.m_Jpp2, Aij);
LA::AlignedMatrix6x6f::ABTTo33(_JTArr, JTj.m_Jrr2, Aij);
}
}
A->SetLowerFromUpper();
}
public:
bool m_g;
Vector::JC m_JcT;
Element::RC m_JTArT0;
Vector::CC m_JTAc0;
Matrix::CC m_JTAc;
Element::R m_Aer;
Vector::C m_Aec;
};
public:
inline Factor() {}
inline Factor(const Factor &A) { *this = A; }
inline void operator = (const Factor &A) {
m_Je = A.m_Je;
m_w = A.m_w;
m_F = A.m_F;
m_A.Set(A.m_A);
m_b.Set(A.m_b);
}
//inline void MakeZero() {
// m_Je.MakeZero();
// m_w = 0.0f;
// m_F = 0.0f;
// m_A.MakeZero();
// m_b.MakeZero();
//}
inline void MakeZero(const int N/* = -1*/) {
m_Je.MakeZero();
m_w = 0.0f;
m_F = 0.0f;
if (N >= 0) {
const int _N = N + 1;
m_A.Resize(_N, _N, true, true);
m_b.Resize(_N);
}
m_A.MakeZero();
m_b.MakeZero();
}
inline void Bind(void *data, const int N) {
const int _N = N + 1;
m_Je.Bind(data, N);
m_A.Bind(m_Je.BindNext(), _N, _N, true);
m_b.Bind(m_A.BindNext(), _N);
}
inline void* BindNext() { return m_b.BindNext(); }
inline int BindSize(const int N) const {
const int _N = N + 1;
return m_Je.BindSize(N) + m_A.BindSize(_N, _N, true) + m_b.BindSize(_N);
}
inline void Swap(Matrix::CC &A, Vector::C &b) {
m_A.Swap(A);
m_b.Swap(b);
}
inline void Get(Matrix::CC &A, Vector::C &b) const {
A.Set(m_A);
b.Set(m_b);
}
inline void SaveB(FILE *fp) const {
m_Je.SaveB(fp);
UT::SaveB(m_w, fp);
UT::SaveB(m_F, fp);
m_A.SaveB(fp);
m_b.SaveB(fp);
}
inline void LoadB(FILE *fp) {
m_Je.LoadB(fp);
UT::LoadB(m_w, fp);
UT::LoadB(m_F, fp);
m_A.LoadB(fp);
m_b.LoadB(fp);
}
inline void AssertConsistency() const {
m_Je.AssertConsistency();
const int N = m_Je.Size(), _N = N + 1;
UT_ASSERT(m_A.GetRows() == _N && m_A.GetColumns() == _N);
m_A.AssertSymmetric();
}
public:
ErrorJacobian m_Je;
float m_w, m_F;
Matrix::CC m_A;
Vector::C m_b;
};
class Reduction {
public:
inline void Bind(void *data, const int N) { m_e.Bind(data, N); }
inline void* BindNext() { return m_e.BindNext(); }
inline int BindSize(const int N) const { return m_e.BindSize(N); }
public:
Error m_e;
float m_F, m_dF;
};
class ESError : public LA::AlignedVector3f {
public:
inline ESError() {}
inline ESError(const LA::AlignedVector3f &e, const float s = 1.0f) {
if (s == 1.0f) {
*((LA::AlignedVector3f *) this) = e;
} else {
e.GetScaled(s, *this);
}
}
inline void Print(const bool l = true) const {
if (l) {
UT::Print("%f %f %f", x(), y(), z());
} else {
UT::Print("%.2f %.2f %.2f", x(), y(), z());
}
}
};
class ES : public UT::ES<float, int> {
public:
inline void Initialize() {
UT::ES<float, int>::Initialize();
m_ESp.Initialize();
m_ESr.Initialize();
}
inline void Accumulate(const Error &e, const float F, const int iFrm = -1) {
UT::ES<float, int>::Accumulate(F, F, iFrm);
if (e.m_er.Valid())
m_ESr.Accumulate(ESError(LA::AlignedVector3f(e.m_er, 0.0f), UT_FACTOR_RAD_TO_DEG), -1.0f, iFrm);
const int N = e.Size();
for (int i = 0; i < N; ++i) {
const Element::EC &ec = e.m_ec[i];
m_ESp.Accumulate(ESError(ec.m_ep), -1.0f, iFrm);
m_ESr.Accumulate(ESError(ec.m_er, UT_FACTOR_RAD_TO_DEG), -1.0f, iFrm);
}
}
inline void Print(const std::string str = "", const bool l = true) const {
if (!Valid()) {
return;
}
UT::ES<float, int>::Print(str + "ec = ", true, l);
const std::string _str(str.size() + 18, ' ');
if (m_ESp.Valid()) {
m_ESp.Print(_str + "ep = ", false, l);
}
if (m_ESr.Valid()) {
m_ESr.Print(_str + "er = ", false, l);
}
}
public:
UT::ES<ESError, int> m_ESp, m_ESr;
};
public:
inline Pose() {}
inline Pose(const Pose &Z) { *this = Z; }
inline void operator = (const Pose &Z) {
m_iKFr = Z.m_iKFr;
//m_RrT = Z.m_RrT;
m_iKFs = Z.m_iKFs;
m_Zps.Set(Z.m_Zps);
m_Arr = Z.m_Arr;
m_Arc.Set(Z.m_Arc);
m_Acc.Set(Z.m_Acc);
m_br = Z.m_br;
m_bc.Set(Z.m_bc);
m_xTb = Z.m_xTb;
}
inline bool operator < (const int iKFr) const { return m_iKFr < iKFr; }
inline bool Valid() const { return m_iKFr != -1; }
inline bool Invalid() const { return m_iKFr == -1; }
inline void Invalidate() {
m_iKFr = -1;
m_iKFs.resize(0);
m_Zps.Resize(0);
m_Arr.Invalidate();
m_Arc.Resize(0);
m_Acc.Resize(0, 0, true);
m_br.Invalidate();
m_bc.Resize(0);
}
inline void Initialize(const float w, const int iKFr, const Rigid3D &Tr, const float s2r,
const bool newKF, const Rigid3D *T0 = NULL,
const float s2cp = 0.0f, const float s2cr = 0.0f) {
m_iKFr = iKFr;
//Rr.GetTranspose(m_RrT);
const float arr = UT::Inverse(s2r, w);
m_Arr.Set(arr, 0.0f, arr);
m_br.MakeZero();
if (newKF) {
m_iKFs.resize(0);
m_Zps.Resize(0);
m_Arc.Resize(0);
m_Acc.Resize(0, 0, true);
m_bc.Resize(0);
} else {
m_iKFs.resize(1); m_iKFs[0] = INT_MAX;
m_Zps.Resize(1); m_Zps[0].Invalidate();
m_Arc.Resize(1); m_Arc[0].MakeZero();
m_Acc.Resize(1, 1, true); m_Acc[0][0].MakeZero();
m_bc.Resize(1); m_bc[0].MakeZero();
if (T0) {
Rigid3D::ABI(Tr, *T0, m_Zps[0]);
}
m_Acc[0][0].SetDiagonal(UT::Inverse(s2cp, w), UT::Inverse(s2cr, w));
}
Tr.Rotation3D::GetTranspose(m_Zps.Push());
}
inline bool Initialize(const float w, const int iKF1, const int iKF2, const Rigid3D &T,
const LA::AlignedMatrix6x6f &S) {
m_Acc.Resize(1, 1, true);
Element::CC &A = m_Acc[0][0];
if (!S.GetInverseLDL(A, NULL)) {
return false;
}
A *= w;
m_iKFr = iKF1;
//m_RrT.Invalidate();
m_iKFs.resize(1);
m_iKFs[0] = iKF2;
m_Zps.Resize(1);
T.GetInverse(m_Zps[0]);
m_Arr.Invalidate();
m_Arc.Resize(0);
m_br.Invalidate();
m_bc.Resize(1);
m_bc.MakeZero();
return true;
}
#ifdef CFG_DEBUG
inline void DebugSetMeasurement(const Rigid3D &Tr, const bool newKF, const Rigid3D *T0 = NULL) {
Tr.Rotation3D::GetTranspose(m_Zps.Back());
if (!newKF && T0) {
Rigid3D::ABI(Tr, *T0, m_Zps[0]);
}
}
#endif
inline void Insert(const float w, const int i, const int iKF, const Rigid3D &T, const float s2p,
const float s2r, AlignedVector<float> *work) {
#ifdef CFG_DEBUG
UT_ASSERT(i < static_cast<int>(m_iKFs.size()));
#endif
m_iKFs.insert(m_iKFs.begin() + i, iKF);
m_Zps.Insert(i);
T.GetInverse(m_Zps[i]);
m_Arc.InsertZero(i);
m_Acc.InsertZero(i, 1, work);
m_Acc[i][i].SetDiagonal(UT::Inverse(s2p, w), UT::Inverse(s2r, w));
m_bc.InsertZero(i);
}
inline void Erase(const int i) {
m_iKFs.erase(m_iKFs.begin() + i);
m_Zps.Erase(i);
m_Arc.Erase(i);
m_Acc.Erase(i);
m_bc.Erase(i);
}
inline void DeleteKeyFrame(const int iKF, const std::vector<int>::iterator *i = NULL) {
if (m_iKFr == iKF) {
//Invalidate();
m_iKFr = -1;
} else if (m_iKFr > iKF) {
--m_iKFr;
}
const std::vector<int>::iterator _i = i ? *i : std::lower_bound(m_iKFs.begin(),
m_iKFs.end(), iKF);
if (_i == m_iKFs.end()) {
return;
}
const bool k = *_i == iKF;
for (std::vector<int>::iterator jt = k ? _i + 1 : _i;
jt != m_iKFs.end() && *jt != INT_MAX; ++jt) {
--*jt;
}
if (Invalid() || !k) {
return;
}
const int j = static_cast<int>(_i - m_iKFs.begin());
m_iKFs.erase(_i);
m_Zps.Erase(j);
m_Arc.Erase(j);
m_Acc.Erase(j);
m_bc.Erase(j);
}
inline void SetPose(const Rigid3D &Tr, const int i, const Rigid3D &Ti) {
#ifdef CFG_DEBUG
UT_ASSERT(i < static_cast<int>(m_iKFs.size()));
#endif
Rigid3D::ABI(Tr, Ti, m_Zps[i]);
}
// inline void GetReferencePose(const Rigid3D &Tr, Rigid3D *_Tr, Rigid3D *TrI) const {
//#ifdef CFG_DEBUG
// UT_ASSERT(m_Zps.Size() == static_cast<int>(m_iKFs.size()) + 1);
//#endif
// //const Rotation3D &RrT = m_RrT;
// const Rotation3D RrT = m_Zps.Back();
// Rotation3D dR = RrT * Tr;
// dR.SetEulerAngleZ(-dR.GetRodriguesZ());
// Rotation3D::AB(dR, RrT, *TrI);
// //*TrI = RrT;
// const Point3D pr = Tr.GetPosition();
// TrI->SetTranslation(pr);
// TrI->GetInverse(*_Tr);
// }
inline void GetReferencePose(const Rigid3D &Tr, Rigid3D *_Tr, Rigid3D *TrI) const {
#ifdef CFG_DEBUG
UT_ASSERT(m_Zps.Size() == static_cast<int>(m_iKFs.size()) + 1);
#endif
*TrI = m_Zps.Back();
const Point3D pr = Tr.GetPosition();
TrI->SetTranslation(pr);
TrI->GetInverse(*_Tr);
}
// inline void GetPose(const Rigid3D &TrI, const int i, Rigid3D *Tri, Rigid3D *Ti) const {
//#ifdef CFG_DEBUG
// UT_ASSERT(i < static_cast<int>(m_iKFs.size()));
//#endif
// m_Zps[i].GetInverse(*Tri);
// Rigid3D::ABI(*Tri, TrI, *Ti);
// }
inline Rotation3D GetReferenceRotationState(const Rotation3D &R) const {
#ifdef CFG_DEBUG
UT_ASSERT(m_Zps.Size() == static_cast<int>(m_iKFs.size()) + 1);
#endif
return R.GetTranspose();
}
inline Rotation3D GetReferenceRotationMeasurement(const float *x/* = NULL*/,
const float eps) const {
#ifdef CFG_DEBUG
UT_ASSERT(m_Zps.Size() == static_cast<int>(m_iKFs.size()) + 1);
#endif
if (x) {
Rotation3D dR;
const LA::Vector2f _x(x);
dR.SetRodriguesXY(_x, eps);
dR.Transpose();
return dR * m_Zps.Back();
} else {
return m_Zps.Back();
}
}
inline LA::AlignedVector3f GetReferenceRotationError(const Rotation3D &R, const float *x/* = NULL*/,
const float eps) const {
const Rotation3D eR = GetReferenceRotationMeasurement(x, eps) / GetReferenceRotationState(R);
const LA::Vector2f e = eR.GetRodriguesXY(eps);
return LA::AlignedVector3f(e.x(), e.y(), 0.0f);
}
inline Rotation3D GetRotationState(const Rotation3D &R1, const Rotation3D &R2) const {
return R1 / R2;
}
inline const Rotation3D GetRotationMeasurement(const int i, const float *x/* = NULL*/,
const float eps) const {
if (x) {
Rotation3D dR;
const LA::AlignedVector3f _x(x);
dR.SetRodrigues(_x, eps);
dR.Transpose();
return dR * m_Zps[i];
} else {
return m_Zps[i];
}
}
inline LA::AlignedVector3f GetRotationError(const Rotation3D &R1, const Rotation3D &R2,
const int i, const float *x/* = NULL*/,
const float eps) const {
const Rotation3D eR = GetRotationMeasurement(i, x, eps) / GetRotationState(R1, R2);
return eR.GetRodrigues(eps);
}
inline LA::AlignedVector3f GetPositionState(const Rigid3D &C1, const Rigid3D &C2) const {
const Point3D p2 = C2.GetPosition();
return C1.GetTranslation() + C1.GetAppliedRotation(p2);
}
inline LA::AlignedVector3f GetPositionMeasurement(const int i, const float *x = NULL) const {
const LA::AlignedVector3f p12 = m_Zps[i].GetTranslation();
if (x) {
return p12 + LA::AlignedVector3f(x);
} else {
return p12;
}
}
inline LA::AlignedVector3f GetPositionError(const Rigid3D &C1, const Rigid3D &C2,
const int i, const float *x = NULL) const {
return GetPositionState(C1, C2) - GetPositionMeasurement(i, x);
}
inline void GetError(const Rigid3D &C1, const Rigid3D &C2, const int i, Element::EC *e,
const float eps) const {
GetError(C1, C2, m_Zps[i], e, eps);
}
static inline void GetError(const Rigid3D &C1, const Rigid3D &C2, const Rigid3D &Z21,
Element::EC *e, const float eps) {
const LA::AlignedVector3f t1 = C1.GetTranslation();
const LA::AlignedVector3f t2 = C2.GetTranslation();
const Rotation3D R21 = Rotation3D(C1 / C2);
R21.Apply(t2, e->m_ep);
LA::AlignedVector3f::amb(t1, e->m_ep, e->m_ep);
const LA::AlignedVector3f p12 = Z21.GetTranslation();
e->m_ep -= p12;
const Rotation3D eR = Rotation3D(Z21) / R21;
eR.GetRodrigues(e->m_er, eps);
}
inline void GetError(const AlignedVector<Rigid3D> &Cs, Error *e, const float eps) const {
Rotation3D eR, Rt;
LA::AlignedVector3f p2, p12;
const Rigid3D &C1 = Cs[m_iKFr];
const int N = static_cast<int>(m_iKFs.size());
//if (m_Zps.Size() == N) {
// e->m_er.Invalidate();
//} else {
// Rotation3D::AB(m_RrT, C1, eR);
// eR.GetRodriguesXY(e->m_er);
//}
if (m_Zps.Size() == N) {
e->m_er.Invalidate();
} else {
#ifdef CFG_DEBUG
UT_ASSERT(m_Zps.Size() == N + 1);
#endif
Rotation3D::AB(m_Zps.Back(), C1, eR);
eR.GetRodriguesXY(e->m_er, eps);
}
const LA::AlignedVector3f t1 = C1.GetTranslation();
e->Resize(N);
for (int i = 0; i < N; ++i) {
const Rigid3D &T21 = m_Zps[i];
const int iKF = m_iKFs[i];
const Rigid3D &C2 = iKF == INT_MAX ? Cs.Back() : Cs[iKF];
Element::EC &ec = e->m_ec[i];
#if 0
Rotation3D::ABT(C1, C2, R21);
C2.GetTranslation(t2);
R21.Apply(t2, ec.m_ep);
LA::AlignedVector3f::amb(t1, ec.m_ep, ec.m_ep);
T21.GetTranslation(p12);
ec.m_ep -= p12;
Rotation3D::ABT(T21, R21, eR);
eR.GetRodrigues(ec.m_er);
#else
C2.GetPosition(p2);
C1.ApplyRotation(p2, ec.m_ep);
ec.m_ep += t1;
T21.GetTranslation(p12);
ec.m_ep -= p12;
Rotation3D::AB(T21, C2, Rt);
Rotation3D::ABT(Rt, C1, eR);
eR.GetRodrigues(ec.m_er, eps);
#endif
}
}
inline void GetError(const ErrorJacobian &Je, const std::vector<const LA::AlignedVector3f *> &xps,
const std::vector<const LA::AlignedVector3f *> &xrs, Error *e) const {
const LA::AlignedVector3f *xp1 = xps[m_iKFr], *xr1 = xrs[m_iKFr];
e->m_er = Je.m_e.m_er;
const int N = static_cast<int>(m_iKFs.size());
//if (xr1 && !m_Arc.Empty()) {
if (xr1 && m_Zps.Size() != N) {
LA::AlignedMatrix2x3f::AddAbTo(Je.m_J.m_Jr, *xr1, e->m_er);
//LA::Matrix2x3f::AddAbTo(Je.m_J.m_Jr, *xr1, e->m_er);
}
e->Resize(N);
for (int i = 0; i < N; ++i) {
const int iKF2 = m_iKFs[i];
const LA::AlignedVector3f *xp2 = xps[iKF2], *xr2 = xrs[iKF2];
Element::EC &ec = e->m_ec[i];
ec = Je.m_e.m_ec[i];
const Element::JC &Jc = Je.m_J.m_Jc[i];
if (xp1) {
LA::AlignedMatrix3x3f::AddAbTo(Jc.m_Jpp1, *xp1, (float *) &ec.m_ep);
}
if (xr1) {
LA::AlignedMatrix3x3f::AddAbTo(Jc.m_Jrr1, *xr1, (float *) &ec.m_er);
LA::AlignedMatrix3x3f::AddAbTo(Jc.m_Jpr1, *xr1, (float *) &ec.m_ep);
}
if (xp2) {
LA::AlignedMatrix3x3f::AddAbTo(Jc.m_Jpp2, *xp2, (float *) &ec.m_ep);
}
if (xr2) {
LA::AlignedMatrix3x3f::AddAbTo(Jc.m_Jrr2, *xr2, (float *) &ec.m_er);
}
}
}
inline void GetErrorJacobian(const AlignedVector<Rigid3D> &Cs, ErrorJacobian *Je
/*, LA::AlignedMatrix2x3f *Jr*/, const float eps) const {
Rotation3D eR, Rt;
LA::AlignedVector3f er, t1, p2, p12;
const Rigid3D &C1 = Cs[m_iKFr];
C1.GetTranslation(t1);
const int N = static_cast<int>(m_iKFs.size());
//if (N == m_Zps.Size()) {
// Je->m_e.m_er.Invalidate();
// Je->m_J.m_Jr.Invalidate();
//} else {
// Rotation3D::AB(m_RrT, C1, eR);
// eR.GetRodrigues(er);
// Je->m_e.m_er.Set(er);
// Rotation3D::GetRodriguesJacobianInverseXY(er, Je->m_J.m_Jr);
// Je->m_J.m_Jr = Je->m_J.m_Jr * eR;
//}
if (N == m_Zps.Size()) {
Je->m_e.m_er.Invalidate();
Je->m_J.m_Jr.Invalidate();
} else {
Rotation3D::AB(m_Zps.Back(), C1, eR);
eR.GetRodrigues(er, eps);
Je->m_e.m_er.Set(er);
LA::AlignedMatrix2x3f &Jr = Je->m_J.m_Jr;
Rotation3D::GetRodriguesJacobianInverseXY(er, Jr, eps);
Jr = Jr * eR;
//Je->m_J.m_Jr.Set(*Jr);
}
Je->m_e.Resize(N);
Je->m_J.Resize(N);
for (int i = 0; i < N; ++i) {
const int iKF = m_iKFs[i];
const Rigid3D &C2 = iKF == INT_MAX ? Cs.Back() : Cs[iKF];
const Rigid3D &T21 = m_Zps[i];
Element::EC &ec = Je->m_e.m_ec[i];
Element::JC &Jc = Je->m_J.m_Jc[i];
C2.GetPosition(p2);
C1.ApplyRotation(p2, ec.m_ep);
ec.m_ep += t1;
SkewSymmetricMatrix::AB(ec.m_ep, C1, Jc.m_Jpr1);
T21.GetTranslation(p12);
ec.m_ep -= p12;
Jc.m_Jpp2 = C1;
Jc.m_Jpp2.GetMinus(Jc.m_Jpp1);
Rotation3D::AB(T21, C2, Rt);
Rotation3D::ABT(Rt, C1, eR);
eR.GetRodrigues(ec.m_er, eps);
Rotation3D::GetRodriguesJacobianInverse(ec.m_er, Jc.m_Jrr1, eps);
LA::AlignedMatrix3x3f::AB(Jc.m_Jrr1, Rt, Jc.m_Jrr2);
Jc.m_Jrr2.GetMinus(Jc.m_Jrr1);
}
}
inline void GetFactor(const float w, const AlignedVector<Rigid3D> &Cs, Factor *A,
Factor::Auxiliary *U, const float eps) const {
//LA::AlignedMatrix2x3f Jr;
GetErrorJacobian(Cs, &A->m_Je/*, &Jr*/, eps);
const xp128f _w = xp128f::get(w);
U->Set(m_Zps.Size() != static_cast<int>(m_iKFs.size()), A->m_Je/*, Jr*/,
_w, m_Arr, m_Arc, m_Acc);
A->m_w = w;
A->m_F = GetCost(w, A->m_Je.m_e, U->m_Aer, U->m_Aec);
U->Get(A->m_Je.m_J.m_Jr, _w, m_br, m_bc, &A->m_A, &A->m_b);
}
inline float GetCost(const float w, const Error &e, const Element::R &Aer,
const Vector::C &Aec) const {
float F = 0.0f;
const float s = w + w;
const int N = e.Size();
//if (!m_Arc.Empty()) {
if (m_Zps.Size() != N) {
Element::R br;
m_br.GetScaled(s, br);
br += Aer;
F += e.m_er.Dot(br);
}
const xp128f _s = xp128f::get(s);
#ifdef CFG_DEBUG
UT_ASSERT(m_bc.Size() == N && Aec.Size() == N);
#endif
Element::C bc;
LA::AlignedVector6f ec;
for (int i = 0; i < N; ++i) {
m_bc[i].GetScaled(_s, bc);
bc += Aec[i];
const Element::EC &_ec = e.m_ec[i];
ec.Set(_ec.m_ep, _ec.m_er);
F += ec.Dot(bc);
}
//return 0.5f * F;
return F;
}
inline float GetCost(const float w, const Error &e) const {
float F = 0.0f;
//const float s = 0.5f;
const int N = e.Size();
#ifdef CFG_DEBUG
UT_ASSERT(m_bc.Size() == N);
#endif
//const bool g = !m_Arc.Empty();
const bool g = m_Zps.Size() != N;
Element::R Sbr;
if (g) {
LA::SymmetricMatrix2x2f::Ab(m_Arr, e.m_er, Sbr);
}
LA::AlignedMatrix2x3f Agp, Agr;
LA::AlignedMatrix3x3f App, Apr, Arp, Arr;
LA::AlignedVector3f bp, br;
LA::AlignedVector6f _ec;
Element::C bc;
const xp128f erx = xp128f::get(e.m_er.x()), ery = xp128f::get(e.m_er.y());
//const xp128f _s = xp128f::get(s);
for (int i = 0; i < N; ++i) {
if (g) {
m_Arc[i].Get(Agp, Agr);
const Element::EC &ec = e.m_ec[i];
LA::AlignedMatrix2x3f::AddAbTo(Agp, ec.m_ep, Sbr);
LA::AlignedMatrix2x3f::AddAbTo(Agr, ec.m_er, Sbr);
LA::AlignedMatrix2x3f::ATb(Agp, erx, ery, bp);
LA::AlignedMatrix2x3f::ATb(Agr, erx, ery, br);
bc.Set(bp, br);
} else {
bc.MakeZero();
}
for (int j = 0; j < N; ++j) {
if (i <= j) {
m_Acc[i][j].Get(App, Apr, Arp, Arr);
} else {
m_Acc[j][i].Get(App, Arp, Apr, Arr);
App.Transpose();
Apr.Transpose();
Arp.Transpose();
Arr.Transpose();
}
const Element::EC &ec = e.m_ec[j];
LA::AlignedMatrix3x3f::AddAbTo(App, ec.m_ep, &bc.v0());
LA::AlignedMatrix3x3f::AddAbTo(Apr, ec.m_er, &bc.v0());
LA::AlignedMatrix3x3f::AddAbTo(Arp, ec.m_ep, &bc.v3());
LA::AlignedMatrix3x3f::AddAbTo(Arr, ec.m_er, &bc.v3());
}
//bc *= _s;
bc += m_bc[i];
bc += m_bc[i];
const Element::EC &ec = e.m_ec[i];
_ec.Set(ec.m_ep, ec.m_er);
F += _ec.Dot(bc);
}
if (g) {
//Sbr *= s;
Sbr += m_br;
Sbr += m_br;
F += e.m_er.Dot(Sbr);
}
return w * F;
}
inline float GetCost(const float w, const ErrorJacobian &Je,
const std::vector<const LA::AlignedVector3f *> &xps,
const std::vector<const LA::AlignedVector3f *> &xrs, Error *e) const {
GetError(Je, xps, xrs, e);
return GetCost(w, *e);
}
inline void GetReduction(const float w, const Factor &A, const AlignedVector<Rigid3D> &Cs,
const std::vector<const LA::AlignedVector3f *> &xps,
const std::vector<const LA::AlignedVector3f *> &xrs,
Reduction *Ra, Reduction *Rp, const float eps) const {
GetError(Cs, &Ra->m_e, eps);
GetError(A.m_Je, xps, xrs, &Rp->m_e);
Ra->m_dF = A.m_F - (Ra->m_F = GetCost(w, Ra->m_e));
Rp->m_dF = A.m_F - (Rp->m_F = GetCost(w, Rp->m_e));
}
inline void GetResidual(const AlignedVector<Rigid3D> &Cs, Error *e, Vector::C *ec, Element::R *rr,
Vector::C *rc, const float eps) const {
GetError(Cs, e, eps);
const int N = static_cast<int>(m_iKFs.size());
Vector::C &_ec = *ec;
_ec.Resize(N);
for (int i = 0; i < N; ++i) {
Element::EC &eci = e->m_ec[i];
_ec[i].Set(eci.m_ep, eci.m_er);
}
Vector::C &_rc = *rc;
_rc.Set(m_bc);
if (m_Zps.Size() == N) {
rr->MakeZero();
} else {
LA::SymmetricMatrix2x2f::Ab(m_Arr, e->m_er, *rr);
for (int i = 0; i < N; ++i) {
LA::AlignedMatrix2x6f::AddAbTo(m_Arc[i], _ec[i], *rr);
LA::AlignedMatrix2x6f::AddATbTo(m_Arc[i], e->m_er, _rc[i]);
}
*rr += m_br;
}
LA::AlignedMatrix6x6f AT;
for (int i = 0; i < N; ++i) {
const LA::AlignedVector6f &eci = _ec[i];
Element::C &rci = _rc[i];
for (int j = i; j < N; ++j) {
LA::AlignedMatrix6x6f::AddAbTo(m_Acc[i][j], _ec[j], (float *) &rci);
if (j == i) {
continue;
}
m_Acc[i][j].GetTranspose(AT);
LA::AlignedMatrix6x6f::AddAbTo(AT, eci, (float *) &_rc[j]);
}
}
}
inline void Print(const bool e = false) const {
m_Arr.Print(UT::String("Arr(%d,%d) = ", m_iKFr, m_iKFr), e);
const int Nk = static_cast<int>(m_iKFs.size());
for (int i = 0; i < Nk; ++i) {
const int iKF = m_iKFs[i] == INT_MAX ? -1 : m_iKFs[i];
m_Arc[i].Print(UT::String("Arc(%d,%d) = ", m_iKFr, iKF), e);
}
m_br.Print(UT::String("br(%d) = ", m_iKFr), e, true);
for (int i = 0; i < Nk; ++i) {
const int iKF = m_iKFs[i] == INT_MAX ? -1 : m_iKFs[i];
for (int j = i; j < Nk; ++j) {
const int jKF = m_iKFs[j] == INT_MAX ? -1 : m_iKFs[j];
m_Acc[i][j].Print(UT::String("Acc(%d,%d) = ", iKF, jKF), e);
}
m_bc[i].Print(UT::String("bc(%d) = ", iKF), e);
}
}
inline void PrintDiagonal(const bool e = false) const {
m_Arr.PrintDiagonal(UT::String("Arr(%d,%d) = ", m_iKFr, m_iKFr), e);
const int Nk = static_cast<int>(m_iKFs.size());
for (int i = 0; i < Nk; ++i) {
const int iKF = m_iKFs[i] == INT_MAX ? -1 : m_iKFs[i];
m_Acc[i][i].PrintDiagonal(UT::String("Acc(%d,%d) = ", iKF, iKF), e);
}
}
inline void SaveB(FILE *fp) const {
UT::SaveB(m_iKFr, fp);
//UT::SaveB(m_RrT, fp);
UT::VectorSaveB(m_iKFs, fp);
m_Zps.SaveB(fp);
m_Arr.SaveB(fp);
m_Arc.SaveB(fp);
m_Acc.SaveB(fp);
m_br.SaveB(fp);
m_bc.SaveB(fp);
UT::SaveB(m_xTb, fp);
}
inline void LoadB(FILE *fp) {
UT::LoadB(m_iKFr, fp);
//UT::LoadB(m_RrT, fp);
UT::VectorLoadB(m_iKFs, fp);
m_Zps.LoadB(fp);
m_Arr.LoadB(fp);
m_Arc.LoadB(fp);
m_Acc.LoadB(fp);
m_br.LoadB(fp);
m_bc.LoadB(fp);
UT::LoadB(m_xTb, fp);
}
inline void AssertConsistency() const {
const int N = static_cast<int>(m_iKFs.size());
//UT_ASSERT(Valid() && N > 0 || Invalid() && N == 0);
for (int i = 1; i < N; ++i) {
const int iKF = m_iKFs[i];
UT_ASSERT(m_iKFs[i - 1] < iKF);
UT_ASSERT(iKF != m_iKFr);
}
//UT_ASSERT(m_Zps.Size() == N);
//UT_ASSERT(m_Arc.Empty() || m_Arc.Size() == N);
if (m_Zps.Size() == N) {
UT_ASSERT(m_Arc.Empty());
} else {
UT_ASSERT(m_Zps.Size() == N + 1 && m_Arc.Size() == N);
}
UT_ASSERT(m_Acc.GetRows() == N && m_bc.Size() == N);
m_Acc.AssertSymmetric();
}
bool Marginalize(const int i, AlignedVector<float> *work, const float *eps = NULL);
bool MarginalizeUninformative(const float w, const float s2p, const float s2r,
std::vector<int> *iks, AlignedVector<float> *work,
const float *eps = NULL);
void SetPriorEquation(const Matrix::X &A, const Vector::X &b, const bool g = true);
void GetPriorEquation(Matrix::X *A, Vector::X *b = NULL, const bool symmetric = true,
const bool g = true) const;
bool GetPriorMeasurement(const Element::T w, Matrix::X *S, Vector::X *x/* = NULL*/,
Element::T *xTb/* = NULL*/, const Element::T *eps/* = NULL*/) const;
bool GetPriorMeasurement(const float w, LA::AlignedMatrixXf *S, LA::AlignedVectorXf *x,
float *xTb, AlignedVector<float> *work, const float *eps = NULL) const;
public:
int m_iKFr;
//Rotation3D m_RrT;
std::vector<int> m_iKFs;
AlignedVector<Rigid3D> m_Zps;
Element::RR m_Arr;
Vector::RC m_Arc;
Matrix::CC m_Acc;
Element::R m_br;
Vector::C m_bc;
float m_xTb;
#ifdef CFG_DEBUG_EIGEN
public:
class EigenErrorJacobian {
public:
inline void Set(const Error &e) {
const int N = e.Size();
m_e.Resize(2 + N * 6);
m_e.block<2, 1>(0, 0) = EigenVector2f(e.m_er);
for (int i = 0, j = 2; i < N; ++i, j += 6) {
const Element::EC &ec = e.m_ec[i];
m_e.block<6, 1>(j, 0) = EigenVector6f(ec.m_ep, ec.m_er);
}
}
inline void Set(const Jacobian &J) {
const int N = J.Size(), Nx6 = N * 6;
m_J.Resize(2 + Nx6, 6 + Nx6);
m_J.setZero();
m_J.block<2, 3>(0, 3) = EigenMatrix2x3f(J.m_Jr);
EigenMatrix6x6f e_Jc1, e_Jc2;
e_Jc1.setZero();
e_Jc2.setZero();
for (int i = 0, j = 2, k = 6; i < N; ++i, j += 6, k += 6) {
const Element::JC &Jc = J.m_Jc[i];
e_Jc1.block<3, 3>(0, 0) = EigenMatrix3x3f(Jc.m_Jpp1);
e_Jc1.block<3, 3>(0, 3) = EigenMatrix3x3f(Jc.m_Jpr1);
e_Jc1.block<3, 3>(3, 3) = EigenMatrix3x3f(Jc.m_Jrr1);
e_Jc2.block<3, 3>(0, 0) = EigenMatrix3x3f(Jc.m_Jpp2);
e_Jc2.block<3, 3>(3, 3) = EigenMatrix3x3f(Jc.m_Jrr2);
m_J.block<6, 6>(j, 0) = e_Jc1;
m_J.block<6, 6>(j, k) = e_Jc2;
}
}
inline void Set(const ErrorJacobian &J) { Set(J.m_e); Set(J.m_J); }
inline bool AssertEqual(const Error &e, const int verbose = 1,
const std::string str = "") const {
const int N = e.Size();
UT_ASSERT(m_e.Size() == 2 + N * 6);
bool scc = true;
if (e.m_er.Valid()) {
const EigenVector2f e_er(m_e.block<2, 1>(0, 0));
scc = e_er.AssertEqual(e.m_er, verbose, str + ".m_er") && scc;
}
for (int i = 0, j = 2; i < N; ++i, j += 6) {
const Element::EC &ec = e.m_ec[i];
const EigenVector6f e_ec1 = EigenVector6f(m_e.block<6, 1>(j, 0));
const EigenVector6f e_ec2 = EigenVector6f(ec.m_ep, ec.m_er);
scc = e_ec1.AssertEqual(e_ec2, verbose, UT::String(".m_ec[%d]", i)) && scc;
}
return scc;
}
inline bool AssertEqual(const Jacobian &J, const int verbose = 1,
const std::string str = "") const {
const int N = J.Size(), Nx6 = N * 6;
UT_ASSERT(m_J.GetRows() == 2 + Nx6 && m_J.GetColumns() == 6 + Nx6);
bool scc = true;
if (J.m_Jr.Valid()) {
const EigenMatrix2x3f e_Jr(m_J.block<2, 3>(0, 3));
scc = e_Jr.AssertEqual(J.m_Jr, verbose, str + ".m_Jr") && scc;
}
scc = EigenMatrixXf(m_J.block(0, 0, 2, 3)).AssertZero(verbose, str + ".Zero[r]",
-1.0f, -1.0f) && scc;
scc = EigenMatrixXf(m_J.block(0, 6, 2, Nx6)).AssertZero(verbose, str + ".Zero[r]",
-1.0f, -1.0f) && scc;
EigenMatrix6x12f e_Jc1, e_Jc2;
e_Jc2.setZero();
for (int i = 0, j = 2, k = 6; i < N; ++i, j += 6, k += 6) {
const Element::JC &Jc = J.m_Jc[i];
e_Jc1.block<6, 6>(0, 0) = m_J.block<6, 6>(j, 0);
e_Jc1.block<6, 6>(0, 6) = m_J.block<6, 6>(j, k);
e_Jc2.block<3, 3>(0, 0) = EigenMatrix3x3f(Jc.m_Jpp1);
e_Jc2.block<3, 3>(0, 3) = EigenMatrix3x3f(Jc.m_Jpr1);
e_Jc2.block<3, 3>(0, 6) = EigenMatrix3x3f(Jc.m_Jpp2);
e_Jc2.block<3, 3>(3, 3) = EigenMatrix3x3f(Jc.m_Jrr1);
e_Jc2.block<3, 3>(3, 9) = EigenMatrix3x3f(Jc.m_Jrr2);
scc = e_Jc1.AssertEqual(e_Jc2, verbose, str + UT::String(".m_Jc[%d]", i)) && scc;
const std::string _str = str + UT::String(".Zero[%d]", i);
scc = EigenMatrixXf(m_J.block(j, 6, 6, k - 6)).AssertZero(verbose, _str,
-1.0f, -1.0f) && scc;
scc = EigenMatrixXf(m_J.block(j, k + 6, 6, Nx6 - k)).AssertZero(verbose, _str,
-1.0f, -1.0f) && scc;
}
return scc;
}
inline bool AssertEqual(const ErrorJacobian &Je, const int verbose = 1,
const std::string str = "") const {
bool scc = true;
scc = AssertEqual(Je.m_e, verbose, str) && scc;
scc = AssertEqual(Je.m_J, verbose, str) && scc;
return scc;
}
public:
EigenVectorXf m_e;
EigenMatrixXf m_J;
};
class EigenFactor {
public:
inline void Set(const Factor &A) {
m_A = EigenConvert(A.m_A);
m_b = EigenConvert(A.m_b);
m_F = A.m_F;
}
inline bool AssertEqual(const Factor &A, const int verbose = 1,
const std::string str = "") const {
bool scc = true;
scc = EigenAssertEqual(m_A, A.m_A, verbose, str + ".m_A") && scc;
scc = EigenAssertEqual(m_b, A.m_b, verbose, str + ".m_b") && scc;
scc = UT::AssertEqual(m_F, A.m_F, verbose, str + ".m_F") && scc;
return scc;
}
public:
EigenMatrixXf m_A;
EigenVectorXf m_b;
float m_F;
};
class EigenPrior {
public:
inline EigenPrior() {}
inline EigenPrior(const EigenMatrixXf &e_A, const EigenVectorXf &e_b) : m_A(e_A), m_b(e_b) {}
inline EigenPrior(const Element::RR &Arr, const Vector::RC &Arc, const Matrix::CC &Acc,
const Element::R &br, const Vector::C &bc, const float w = 1.0f,
const bool pad = false) {
Set(Arr, Arc, Acc, br, bc, w, pad);
}
inline void Set(const Pose &Z, const bool pad = false) {
Set(Z.m_Arr, Z.m_Arc, Z.m_Acc, Z.m_br, Z.m_bc, 1.0f, pad);
}
inline void Set(const Element::RR &Arr, const Vector::RC &Arc, const Matrix::CC &Acc,
const Element::R &br, const Vector::C &bc, const float w = 1.0f,
const bool pad = false) {
const int N = bc.Size();
#ifdef CFG_DEBUG
UT_ASSERT(Acc.GetRows() == N && Acc.GetColumns() == N);
if (!Arc.Empty()) {
UT_ASSERT(Arc.Size() == N);
}
#endif
const int Nx6 = N == 0 && pad ? 6 : N * 6;
m_A.Resize(2 + Nx6, 2 + Nx6);
m_A.MakeZero();
m_b.Resize(2 + Nx6);
m_b.MakeZero();
if (Arr.Valid()) {
m_A.block<2, 2>(0, 0) = EigenMatrix2x2f(Arr);
}
if (!Arc.Empty()) {
const EigenMatrixXf e_Arc = EigenConvert(Arc);
m_A.block(0, 2, 2, Nx6) = e_Arc;
m_A.block(2, 0, Nx6, 2) = e_Arc.transpose();
}
if (N != 0) {
m_A.block(2, 2, Nx6, Nx6) = EigenConvert(Acc);
m_b.block(2, 0, Nx6, 1) = EigenConvert(bc);
}
if (br.Valid()) {
m_b.block<2, 1>(0, 0) = EigenVector2f(br);
}
if (w != 1.0f) {
m_A *= w;
m_b *= w;
}
}
inline void Get(Element::RR &Arr, Vector::RC &Arc, Matrix::CC &Acc,
Element::R &br, Vector::C &bc) const {
const int Nrc = m_b.Size(), Nx6 = Nrc - 2, N = Nx6 / 6;
#ifdef CFG_DEBUG
UT_ASSERT(Nx6 % 6 == 0);
UT_ASSERT(m_A.GetRows() == Nrc && m_A.GetColumns() == Nrc);
#endif
Arr = EigenMatrix2x2f(m_A.block<2, 2>(0, 0)).GetSymmetricMatrix2x2f();
EigenConvert(EigenMatrixXf(m_A.block(0, 2, 2, Nx6)), Arc);
EigenConvert(EigenMatrixXf(m_A.block(2, 2, Nx6, Nx6)), Acc);
br = EigenVector2f(m_b.block<2, 1>(0, 0)).GetVector2f();
EigenConvert(EigenVectorXf(m_b.block(2, 0, Nx6, 1)), bc);
}
inline void Marginalize(const int ipc) {
EigenMatrixX<Element::T> e_Ab;
e_Ab.Set(EigenMatrixX<Element::T>(m_A.cast<Element::T>()),
EigenVectorX<Element::T>(m_b.cast<Element::T>()));
#ifdef CFG_CAMERA_PRIOR_REORDER
e_Ab.Marginalize(ipc + 3, 1);
e_Ab.Marginalize(ipc + 3, 1);
e_Ab.Marginalize(ipc + 3, 1);
e_Ab.Marginalize(ipc, 1);
e_Ab.Marginalize(ipc, 1);
e_Ab.Marginalize(ipc, 1);
#else
e_Ab.Marginalize(ipc, 6);
#endif
EigenMatrixXf(e_Ab.cast<float>()).Get(m_A, m_b);
}
inline bool AssertEqual(const Pose &Z, const int verbose = 1,
const std::string str = "") const {
return AssertEqual(Z.m_Arr, Z.m_Arc, Z.m_Acc, Z.m_br, Z.m_bc, verbose, str);
}
inline bool AssertEqual(const Element::RR &Arr, const Vector::RC &Arc, const Matrix::CC &Acc,
const Element::R &br, const Vector::C &bc, const int verbose = 1,
const std::string str = "") const {
const int Nx6 = m_A.GetRows() - 2, N = bc.Size();
#ifdef CFG_DEBUG
UT_ASSERT(m_A.GetColumns() == Nx6 + 2 && m_b.Size() == Nx6 + 2);
UT_ASSERT(Acc.GetRows() == N && Acc.GetColumns() == N);
if (!Arc.Empty()) {
UT_ASSERT(Arc.Size() == N);
}
UT_ASSERT(N == 0 || Nx6 == N * 6);
#endif
bool scc = true;
const EigenMatrix2x2f e_Arr(m_A.block<2, 2>(0, 0));
if (Arr.Valid()) {
scc = e_Arr.AssertEqual(Arr, verbose, str + ".Arr") && scc;
} else {
scc = e_Arr.AssertZero(verbose, str + ".Arr") && scc;
}
const EigenMatrixXf e_Arc(m_A.block(0, 2, 2, Nx6));
scc = EigenAssertEqual(e_Arc, Arc, verbose, str + ".Arc") && scc;
const EigenMatrixXf e_Acc(m_A.block(2, 2, Nx6, Nx6));
scc = EigenAssertEqual(e_Acc, Acc, verbose, str + ".Acc") && scc;
const EigenVector2f e_br(m_b.block<2, 1>(0, 0));
if (br.Valid()) {
scc = e_br.AssertEqual(br, verbose, str + ".br") && scc;
} else {
scc = e_br.AssertZero(verbose, str + ".br") && scc;
}
const EigenVectorXf e_bc(m_b.block(2, 0, Nx6, 1));
scc = EigenAssertEqual(e_bc, bc, verbose, str + ".bc") && scc;
return scc;
}
public:
EigenMatrixXf m_A;
EigenVectorXf m_b;
};
public:
EigenErrorJacobian EigenGetErrorJacobian(const AlignedVector<Rigid3D> &Cs,
const float eps) const;
EigenFactor EigenGetFactor(const float w, const AlignedVector<Rigid3D> &Cs,
const float eps) const;
float EigenGetCost(const float w, const AlignedVector<Rigid3D> &Cs,
const std::vector<EigenVector6f> &e_xs, const float eps) const;
void EigenGetResidual(const AlignedVector<Rigid3D> &Cs, EigenVectorXf *e_r,
const float eps) const;
void EigenGetPriorMeasurement(const float w, EigenMatrixXf *e_S,
EigenVectorXf *e_x = NULL) const;
#endif
};
class Motion {
public:
class Error : public Element::EM {
public:
inline void Set(const Element::M &e) { e.Get(m_ev, m_eba, m_ebw); }
inline void Get(Element::M *e) const { e->Set(m_ev, m_eba, m_ebw); }
inline void MakeZero() { memset(this, 0, sizeof(Error)); }
};
class Jacobian {
public:
inline void GetTranspose(Jacobian *J) const {
m_Jvr.GetTranspose(J->m_Jvr);
m_Jvv.GetTranspose(J->m_Jvv);
}
public:
LA::AlignedMatrix3x3f m_Jvr, m_Jvv;
};
class ErrorJacobian {
public:
Error m_e;
Jacobian m_J;
};
class Factor {
public:
class RR {
public:
inline void MakeMinus() {
const xp128f zero = xp128f::get(0.0f);
m_data[0] = zero - m_data[0];
m_data[1] = zero - m_data[1];
m_b.v2() = -m_b.v2();
}
static inline void AmB(const RR &A, const RR &B, RR &AmB) {
AmB.m_data[0] = A.m_data[0] - B.m_data[0];
AmB.m_data[1] = A.m_data[1] - B.m_data[1];
AmB.m_b.v2() = A.m_b.v2() - B.m_b.v2();
}
public:
union {
struct { LA::SymmetricMatrix3x3f m_A; LA::Vector3f m_b; };
xp128f m_data[3];
};
};
class RM : public LA::AlignedMatrix3x9f {};
class MM : public Camera::Factor::Unitary::MM {};
class Auxiliary {
public:
#ifdef CFG_CAMERA_PRIOR_SQUARE_FORM
inline void Set(const ErrorJacobian &Je, const xp128f &w, const Element::MM &A) {
Je.m_J.GetTranspose(&m_JT);
Je.m_e.Get(&m_e);
A.GetScaled(w, m_wA);
LA::AlignedMatrix3x3f _A;
m_wA.GetBlock(0, 0, _A);
LA::AlignedMatrix3x3f::ABT(m_JT.m_Jvr, _A, m_JTArv);
LA::AlignedMatrix3x3f::ABT(m_JT.m_Jvv, _A, m_JTAvv);
m_wA.GetBlock(0, 3, _A);
_A.Transpose();
LA::AlignedMatrix3x3f::ABT(m_JT.m_Jvr, _A, m_JTArba);
LA::AlignedMatrix3x3f::ABT(m_JT.m_Jvv, _A, m_JTAvba);
m_wA.GetBlock(0, 6, _A);
_A.Transpose();
LA::AlignedMatrix3x3f::ABT(m_JT.m_Jvr, _A, m_JTArbw);
LA::AlignedMatrix3x3f::ABT(m_JT.m_Jvv, _A, m_JTAvbw);
}
inline void Get(const Error &e, LA::SymmetricMatrix3x3f *Arr, LA::AlignedMatrix3x9f *Arm,
LA::SymmetricMatrix9x9f *Amm, LA::Vector3f *br, LA::Vector9f *bm) const {
LA::SymmetricMatrix3x3f::ABT(m_JTArv, m_JT.m_Jvr, *Arr);
LA::AlignedMatrix3x9f &_Arm = *Arm;
LA::AlignedMatrix3x3f::ABT(m_JTArv, m_JT.m_Jvv, _Arm[0], _Arm[1], _Arm[2]);
float *_br = &br->v0();
LA::AlignedMatrix3x3f::Ab(m_JTArv, e.m_ev, _br);
Arm->SetBlock(0, 3, m_JTArba);
LA::AlignedMatrix3x3f::AddAbTo(m_JTArba, e.m_eba, _br);
Arm->SetBlock(0, 6, m_JTArbw);
LA::AlignedMatrix3x3f::AddAbTo(m_JTArbw, e.m_ebw, _br);
LA::SymmetricMatrix9x9f::ABTTo00(m_JTAvv, m_JT.m_Jvv, *Amm);
float *_bm = &bm->v0();
LA::AlignedMatrix3x3f::Ab(m_JTAvv, e.m_ev, _bm);
Amm->Set03(m_JTAvba);
LA::AlignedMatrix3x3f::AddAbTo(m_JTAvba, e.m_eba, _bm);
Amm->Set06(m_JTAvbw);
LA::AlignedMatrix3x3f::AddAbTo(m_JTAvbw, e.m_ebw, _bm);
Amm->Set33(m_wA[3] + 3, m_wA[4] + 3, m_wA[5] + 3, m_wA[6] + 3, m_wA[7] + 3, m_wA[8] + 3);
LA::AlignedMatrix9x9f::Ab(m_wA, m_e, _bm, 3);
}
#else
inline void Set(const ErrorJacobian &Je, const xp128f &w, const Element::MM &A) {
Je.m_J.GetTranspose(&m_JT);
A.GetScaled(w, m_wA);
LA::AlignedMatrix3x3f _A;
m_wA.GetBlock(0, 0, _A);
LA::AlignedMatrix3x3f::ABT(m_JT.m_Jvr, _A, m_JTArv);
LA::AlignedMatrix3x3f::ABT(m_JT.m_Jvv, _A, m_JTAvv);
float *Aev = &m_Ae.v0(), *Aeba = &m_Ae.v3(), *Aebw = &m_Ae.v6();
LA::AlignedMatrix3x3f::Ab(_A, Je.m_e.m_ev, Aev);
m_wA.GetBlock(0, 3, _A);
LA::AlignedMatrix3x3f::AddAbTo(_A, Je.m_e.m_eba, Aev);
_A.Transpose();
LA::AlignedMatrix3x3f::ABT(m_JT.m_Jvr, _A, m_JTArba);
LA::AlignedMatrix3x3f::ABT(m_JT.m_Jvv, _A, m_JTAvba);
LA::AlignedMatrix3x3f::Ab(_A, Je.m_e.m_ev, Aeba);
m_wA.GetBlock(0, 6, _A);
LA::AlignedMatrix3x3f::AddAbTo(_A, Je.m_e.m_ebw, Aev);
_A.Transpose();
LA::AlignedMatrix3x3f::ABT(m_JT.m_Jvr, _A, m_JTArbw);
LA::AlignedMatrix3x3f::ABT(m_JT.m_Jvv, _A, m_JTAvbw);
LA::AlignedMatrix3x3f::Ab(_A, Je.m_e.m_ev, Aebw);
m_wA.GetBlock(3, 3, _A);
LA::AlignedMatrix3x3f::AddAbTo(_A, Je.m_e.m_eba, Aeba);
m_wA.GetBlock(3, 6, _A);
LA::AlignedMatrix3x3f::AddAbTo(_A, Je.m_e.m_ebw, Aeba);
_A.Transpose();
LA::AlignedMatrix3x3f::AddAbTo(_A, Je.m_e.m_eba, Aebw);
m_wA.GetBlock(6, 6, _A);
LA::AlignedMatrix3x3f::AddAbTo(_A, Je.m_e.m_ebw, Aebw);
}
inline void Get(const xp128f &w, const Element::M &b, LA::SymmetricMatrix3x3f *Arr,
LA::AlignedMatrix3x9f *Arm, LA::SymmetricMatrix9x9f *Amm, LA::Vector3f *br,
LA::Vector9f *bm) const {
LA::SymmetricMatrix3x3f::ABT(m_JTArv, m_JT.m_Jvr, *Arr);
LA::AlignedMatrix3x9f &_Arm = *Arm;
LA::AlignedMatrix3x3f::ABT(m_JTArv, m_JT.m_Jvv, _Arm[0], _Arm[1], _Arm[2]);
Arm->SetBlock(0, 3, m_JTArba);
Arm->SetBlock(0, 6, m_JTArbw);
LA::SymmetricMatrix9x9f::ABTTo00(m_JTAvv, m_JT.m_Jvv, *Amm);
Amm->Set03(m_JTAvba);
Amm->Set06(m_JTAvbw);
Amm->Set33(m_wA[3] + 3, m_wA[4] + 3, m_wA[5] + 3, m_wA[6] + 3, m_wA[7] + 3, m_wA[8] + 3);
Element::M Aepb;
b.GetScaled(w, Aepb);
Aepb += m_Ae;
const LA::AlignedVector3f Aepbv(&Aepb.v0());
LA::AlignedMatrix3x3f::Ab(m_JT.m_Jvr, Aepbv, &br->v0());
LA::AlignedMatrix3x3f::Ab(m_JT.m_Jvv, Aepbv, &bm->v0());
memcpy(&bm->v3(), &Aepb.v3(), 24);
}
#endif
public:
Jacobian m_JT;
Element::MM m_wA;
LA::AlignedMatrix3x3f m_JTArv, m_JTArba, m_JTArbw;
LA::AlignedMatrix3x3f m_JTAvv, m_JTAvba, m_JTAvbw;
#ifdef CFG_CAMERA_PRIOR_SQUARE_FORM
Element::M m_e;
#else
Element::M m_Ae;
#endif
};
public:
inline void MakeZero() { memset(this, 0, sizeof(Factor)); }
inline void MakeMinus() {
m_Arr.MakeMinus();
m_Arm.MakeMinus();
m_Amm.MakeMinus();
}
inline void Print() const {
m_Arr.m_A.Print("Arr = ", true);
m_Arm.Print("Arm = ", true);
m_Amm.m_A.Print("Amm = ", true);
m_Arr.m_b.Print("br = ", true);
m_Amm.m_b.Print("bm = ", true);
}
inline void SaveB(FILE *fp) const { UT::SaveB(*this, fp); }
inline void LoadB(FILE *fp) { UT::LoadB(*this, fp); }
public:
ErrorJacobian m_Je;
union {
RR m_Arr;
struct { float m_data[11], m_F; };
};
RM m_Arm;
MM m_Amm;
};
class Reduction {
public:
Error m_e;
float m_F, m_dF;
};
typedef Pose::ESError ESError;
class ES : public UT::ES<float, int> {
public:
inline void Initialize() {
UT::ES<float, int>::Initialize();
m_ESv.Initialize();
m_ESba.Initialize();
m_ESbw.Initialize();
}
inline void Accumulate(const Error &e, const float F, const int iFrm = -1) {
UT::ES<float, int>::Accumulate(F, F, iFrm);
m_ESv.Accumulate(ESError(e.m_ev), -1.0f, iFrm);
m_ESba.Accumulate(ESError(e.m_eba), -1.0f, iFrm);
m_ESbw.Accumulate(ESError(e.m_ebw, UT_FACTOR_RAD_TO_DEG), -1.0f, iFrm);
}
inline void Print(const std::string str = "", const bool l = true) const {
if (!Valid()) {
return;
}
UT::ES<float, int>::Print(str + "em = ", true, l);
const std::string _str(str.size() + 17, ' ');
if (m_ESv.Valid()) {
m_ESv.Print(_str + "ev = ", false, l);
}
if (m_ESba.Valid()) {
m_ESba.Print(_str + "eba = ", false, l);
}
if (m_ESbw.Valid()) {
m_ESbw.Print(_str + "ebw = ", false, l);
}
}
public:
UT::ES<ESError, int> m_ESv, m_ESba, m_ESbw;
};
inline void Initialize(const float w, const float s2v, const float s2ba, const float s2bw,
const Camera *C = NULL) {
if (C) {
SetMotion(C->m_T, C->m_v, C->m_ba, C->m_bw);
} else {
m_v.MakeZero();
m_ba.MakeZero();
m_bw.MakeZero();
}
m_Amm.MakeZero();
m_Amm[0][0] = m_Amm[1][1] = m_Amm[2][2] = UT::Inverse(s2v, w);
m_Amm[3][3] = m_Amm[4][4] = m_Amm[5][5] = UT::Inverse(s2ba, w);
m_Amm[6][6] = m_Amm[7][7] = m_Amm[8][8] = UT::Inverse(s2bw, w);
m_bm.MakeZero();
#ifdef CFG_CAMERA_PRIOR_SQUARE_FORM
m_em.MakeZero();
#else
m_xTb = 0.0f;
#endif
}
inline void Initialize(const Motion &Zp) { *((Motion *) this) = Zp; }
#ifdef CFG_DEBUG
inline void DebugSetMeasurement(const Camera &C) {
SetMotion(C.m_T, C.m_v, C.m_ba, C.m_bw);
m_bm.MakeZero();
#ifdef CFG_CAMERA_PRIOR_SQUARE_FORM
m_em.MakeZero();
#else
m_xTb = 0.0f;
#endif
}
#endif
inline bool Valid() const { return m_v.Valid(); }
inline bool Invalid() const { return m_v.Invalid(); }
inline void Invalidate() { m_v.Invalidate(); }
//inline void MakeZero() { memset(this, 0, sizeof(Motion)); }
inline void SetMotion(const Rotation3D &R, const LA::AlignedVector3f &v,
const LA::AlignedVector3f &ba, const LA::AlignedVector3f &bw) {
R.Apply(v, m_v);
m_ba = ba;
m_bw = bw;
}
inline void GetMotion(const Rotation3D &R, LA::AlignedVector3f *v, LA::AlignedVector3f *ba,
LA::AlignedVector3f *bw) const {
R.ApplyInversely(m_v, *v);
*ba = m_ba;
*bw = m_bw;
}
inline LA::AlignedVector3f GetVelocityState(const Camera &C) const {
return C.m_T.GetAppliedRotation(C.m_v);
}
inline LA::AlignedVector3f GetVelocityMeasurement(const float *x = NULL) const {
if (x) {
return m_v + LA::AlignedVector3f(x);
} else {
return m_v;
}
}
inline LA::AlignedVector3f GetVelocityError(const Camera &C, const float *x) const {
return GetVelocityState(C) - GetVelocityMeasurement(x);
}
inline LA::AlignedVector3f GetBiasAccelerationState(const Camera &C) const {
return C.m_ba;
}
inline LA::AlignedVector3f GetBiasAccelerationMeasurement(const float *x = NULL) const {
if (x) {
return m_ba + LA::AlignedVector3f(x);
} else {
return m_ba;
}
}
inline LA::AlignedVector3f GetBiasAccelerationError(const Camera &C,
const float *x = NULL) const {
return GetBiasAccelerationState(C) - GetBiasAccelerationMeasurement(x);
}
inline LA::AlignedVector3f GetBiasGyroscopeState(const Camera &C) const {
return C.m_bw;
}
inline LA::AlignedVector3f GetBiasGyroscopeMeasurement(const float *x = NULL) const {
if (x) {
return m_bw + LA::AlignedVector3f(x);
} else {
return m_bw;
}
}
inline LA::AlignedVector3f GetBiasGyroscopeError(const Camera &C, const float *x = NULL) const {
return GetBiasGyroscopeState(C) - GetBiasGyroscopeMeasurement(x);
}
inline void GetError(const Camera &C, Element::EM *e) const {
const LA::AlignedVector3f v = C.m_T.GetAppliedRotation(C.m_v);
LA::AlignedVector3f::amb(v, m_v, e->m_ev);
LA::AlignedVector3f::amb(C.m_ba, m_ba, e->m_eba);
LA::AlignedVector3f::amb(C.m_bw, m_bw, e->m_ebw);
#ifdef CFG_CAMERA_PRIOR_SQUARE_FORM
*e += m_em;
#endif
}
inline void GetError(const ErrorJacobian &Je, const LA::AlignedVector3f *xr,
const LA::AlignedVector3f *xv, const LA::AlignedVector3f *xba,
const LA::AlignedVector3f *xbw, Error *e) const {
#ifdef CFG_DEBUG
UT_ASSERT(xr || xv || xba || xbw);
#endif
*e = Je.m_e;
if (xr) {
LA::AlignedMatrix3x3f::AddAbTo(Je.m_J.m_Jvr, *xr, (float *) &e->m_ev);
}
if (xv) {
LA::AlignedMatrix3x3f::AddAbTo(Je.m_J.m_Jvv, *xv, (float *) &e->m_ev);
}
if (xba) {
e->m_eba += *xba;
}
if (xbw) {
e->m_ebw += *xbw;
}
}
inline void GetErrorJacobian(const Camera &C, ErrorJacobian *Je) const {
GetError(C, &Je->m_e);
SkewSymmetricMatrix::AB(C.m_T, C.m_v, Je->m_J.m_Jvr);
Je->m_J.m_Jvv = C.m_T;
}
inline void GetFactor(const float w, const Camera &C, Factor *A, Factor::Auxiliary *U) const {
GetErrorJacobian(C, &A->m_Je);
const xp128f _w = xp128f::get(w);
U->Set(A->m_Je, _w, m_Amm);
#ifdef CFG_CAMERA_PRIOR_SQUARE_FORM
U->Get(A->m_Je.m_e, &A->m_Arr.m_A, &A->m_Arm, &A->m_Amm.m_A, &A->m_Arr.m_b, &A->m_Amm.m_b);
A->m_F = GetCost(w, A->m_Je.m_e);
#else
A->m_F = GetCost(w, A->m_Je.m_e, U->m_Ae);
U->Get(_w, m_bm, &A->m_Arr.m_A, &A->m_Arm, &A->m_Amm.m_A, &A->m_Arr.m_b, &A->m_Amm.m_b);
#endif
}
#ifdef CFG_CAMERA_PRIOR_SQUARE_FORM
inline float GetCost(const float w, const Error &e) const {
Element::M _e, v;
_e.Set(e.m_ev, e.m_eba, e.m_ebw);
LA::AlignedMatrix9x9f::Ab(m_Amm, _e, (float *) &v);
return w * _e.Dot(v);
}
#else
inline float GetCost(const float w, const Error &e, const Element::M &Ae) const {
Element::M _e, b;
e.Get(&_e);
m_bm.GetScaled(w + w, b);
b += Ae;
//return 0.5f * _e.Dot(b);
return _e.Dot(b);
}
inline float GetCost(const float w, const Error &e) const {
Element::M _e, v;
e.Get(&_e);
LA::AlignedMatrix9x9f::Ab(m_Amm, _e, (float *) &v);
//v *= 0.5f;
v += m_bm;
v += m_bm;
return w * _e.Dot(v);
}
#endif
inline float GetCost(const float w, const ErrorJacobian &Je, const LA::AlignedVector3f *xr,
const LA::AlignedVector3f *xv, const LA::AlignedVector3f *xba,
const LA::AlignedVector3f *xbw, Error *e) const {
GetError(Je, xr, xv, xba, xbw, e);
return GetCost(w, *e);
}
inline void GetReduction(const float w, const Factor &A, const Camera &C,
const LA::AlignedVector3f *xr, const LA::AlignedVector3f *xv,
const LA::AlignedVector3f *xba, const LA::AlignedVector3f *xbw,
Reduction *Ra, Reduction *Rp) const {
GetError(C, &Ra->m_e);
GetError(A.m_Je, xr, xv, xba, xbw, &Rp->m_e);
Ra->m_dF = A.m_F - (Ra->m_F = GetCost(w, Ra->m_e));
Rp->m_dF = A.m_F - (Rp->m_F = GetCost(w, Rp->m_e));
}
inline void GetResidual(const Camera &C, Error *e, Element::M *em, Element::M *r) const {
GetError(C, e);
em->Set(e->m_ev, e->m_eba, e->m_ebw);
LA::AlignedMatrix9x9f::Ab(m_Amm, *em, (float *) r);
if (m_bm.Valid()) {
*r += m_bm;
}
}
inline void Print(const bool e = false) const {
m_Amm.Print("Amm = ", e);
m_bm.Print("bm = ", e);
#ifdef CFG_CAMERA_PRIOR_SQUARE_FORM
//m_em.Print("em = ", e);
#endif
}
inline void PrintDiagonal(const bool e = false) const {
m_Amm.PrintDiagonal("Amm = ", e);
}
inline void SaveB(FILE *fp) const {
UT::SaveB(m_v, fp);
UT::SaveB(m_ba, fp);
UT::SaveB(m_bw, fp);
UT::SaveB(m_Amm, fp);
UT::SaveB(m_bm, fp);
#ifdef CFG_CAMERA_PRIOR_SQUARE_FORM
UT::SaveB(m_em, fp);
#else
UT::SaveB(m_xTb, fp);
#endif
}
inline void LoadB(FILE *fp) {
UT::LoadB(m_v, fp);
UT::LoadB(m_ba, fp);
UT::LoadB(m_bw, fp);
UT::LoadB(m_Amm, fp);
UT::LoadB(m_bm, fp);
#ifdef CFG_CAMERA_PRIOR_SQUARE_FORM
UT::LoadB(m_em, fp);
#else
UT::LoadB(m_xTb, fp);
#endif
}
bool GetPriorMeasurement(const float w, LA::AlignedMatrixXf *S, LA::AlignedVectorXf *x,
float *xTb, AlignedVector<float> *work, const float *eps = NULL) const;
public:
LA::AlignedVector3f m_v, m_ba, m_bw;
Element::MM m_Amm;
Element::M m_bm;
#ifdef CFG_CAMERA_PRIOR_SQUARE_FORM
Error m_em;
#else
float m_xTb;
#endif
#ifdef CFG_DEBUG_EIGEN
public:
class EigenErrorJacobian {
public:
inline void Set(const Error &e) {
m_e.block<3, 1>(0, 0) = EigenVector3f(e.m_ev);
m_e.block<3, 1>(3, 0) = EigenVector3f(e.m_eba);
m_e.block<3, 1>(6, 0) = EigenVector3f(e.m_ebw);
}
inline void Set(const Jacobian &J) {
m_J.setZero();
m_J.block<3, 3>(0, 0) = EigenMatrix3x3f(J.m_Jvr);
m_J.block<3, 3>(0, 3) = EigenMatrix3x3f(J.m_Jvv);
m_J.block<3, 3>(3, 6) = EigenMatrix3x3f::Identity();
m_J.block<3, 3>(6, 9) = EigenMatrix3x3f::Identity();
}
inline void Set(const ErrorJacobian &Je) { Set(Je.m_e); Set(Je.m_J); }
inline bool AssertEqual(const Error &e, const int verbose = 1,
const std::string str = "") const {
const EigenVector3f e_ev(m_e.block<3, 1>(0, 0));
const EigenVector3f e_eba(m_e.block<3, 1>(3, 0));
const EigenVector3f e_ebw(m_e.block<3, 1>(6, 0));
bool scc = true;
scc = e_ev.AssertEqual(e.m_ev, verbose, str + ".m_ev") && scc;
scc = e_eba.AssertEqual(e.m_eba, verbose, str + ".m_eba") && scc;
scc = e_ebw.AssertEqual(e.m_ebw, verbose, str + ".m_ebw") && scc;
return scc;
}
inline bool AssertEqual(const Jacobian &J, const int verbose = 1,
const std::string str = "") const {
const EigenMatrix3x3f e_Jvr(m_J.block<3, 3>(0, 0));
const EigenMatrix3x3f e_Jvv(m_J.block<3, 3>(0, 3));
bool scc = true;
scc = e_Jvr.AssertEqual(J.m_Jvr, verbose, str + ".m_Jvr") && scc;
scc = e_Jvv.AssertEqual(J.m_Jvv, verbose, str + ".m_Jvv") && scc;
return scc;
}
inline bool AssertEqual(const ErrorJacobian &Je, const int verbose = 1,
const std::string str = "") const {
bool scc = true;
scc = AssertEqual(Je.m_e, verbose, str) && scc;
scc = AssertEqual(Je.m_J, verbose, str) && scc;
return scc;
}
public:
EigenMatrix9x12f m_J;
EigenVector9f m_e;
};
class EigenFactor {
public:
inline void Set(const Factor &A) {
m_A.block<3, 3>(0, 0) = EigenMatrix3x3f(A.m_Arr.m_A);
const EigenMatrix3x9f e_Arm(A.m_Arm);
m_A.block<3, 9>(0, 3) = e_Arm;
m_A.block<9, 3>(3, 0) = e_Arm.transpose();
m_A.block<9, 9>(3, 3) = EigenMatrix9x9f(A.m_Amm.m_A);
m_b.block<3, 1>(0, 0) = EigenVector3f(A.m_Arr.m_b);
m_b.block<9, 1>(3, 0) = EigenVector9f(A.m_Amm.m_b);
m_F = A.m_F;
}
inline bool AssertEqual(const Factor &A, const int verbose = 1,
const std::string str = "") const {
const EigenMatrix3x3f e_Arr(m_A.block<3, 3>(0, 0));
const EigenMatrix3x9f e_Arm(m_A.block<3, 9>(0, 3));
const EigenMatrix9x9f e_Amm(m_A.block<9, 9>(3, 3));
const EigenVector3f e_br(m_b.block<3, 1>(0, 0));
const EigenVector9f e_bm(m_b.block<9, 1>(3, 0));
bool scc = true;
scc = e_Arr.AssertEqual(A.m_Arr.m_A, verbose, str + ".m_Arr") && scc;
scc = e_Arm.AssertEqual(A.m_Arm, verbose, str + ".m_Arm") && scc;
scc = e_Amm.AssertEqual(A.m_Amm.m_A, verbose, str + ".m_Amm") && scc;
scc = e_br.AssertEqual(A.m_Arr.m_b, verbose, str + ".m_br") && scc;
scc = e_bm.AssertEqual(A.m_Amm.m_b, verbose, str + ".m_bm") && scc;
scc = UT::AssertEqual(m_F, A.m_F, 1, str + ".m_F") && scc;
return scc;
}
public:
EigenMatrix12x12f m_A;
EigenVector12f m_b;
float m_F;
};
class EigenPrior : public Pose::EigenPrior {
public:
inline void Initialize(const float w, const float s2v, const float s2ba, const float s2bw) {
m_A.Resize(9, 9);
m_A.MakeZero();
m_b.Resize(9);
m_b.MakeZero();
m_A(0, 0) = m_A(1, 1) = m_A(2, 2) = UT::Inverse(s2v, w);
m_A(3, 3) = m_A(4, 4) = m_A(5, 5) = UT::Inverse(s2ba, w);
m_A(6, 6) = m_A(7, 7) = m_A(8, 8) = UT::Inverse(s2bw, w);
}
inline void Set(const Motion &Z) {
m_A = EigenMatrix9x9f(Z.m_Amm);
m_b = EigenVector9f(Z.m_bm);
}
inline bool AssertEqual(const Motion &Z, const int verbose = 1,
const std::string str = "") const {
UT_ASSERT(m_A.GetRows() == 9 && m_A.GetColumns() == 9 && m_b.Size() == 9);
bool scc = true;
const EigenMatrix9x9f e_Amm(m_A.block<9, 9>(0, 0));
scc = e_Amm.AssertEqual(Z.m_Amm, verbose, str + ".Amm") && scc;
const EigenVector9f e_bm(m_b.block<9, 1>(0, 0));
scc = e_bm.AssertEqual(Z.m_bm, verbose, str + ".bm") && scc;
//const EigenVector9f e_em = EigenVector9f(e_Amm.inverse() * e_bm);
//Element::M em;
//Z.m_em.Get(&em);
//scc = e_em.AssertEqual(em, verbose, str + "em") && scc;
return scc;
}
};
public:
EigenErrorJacobian EigenGetErrorJacobian(const Camera &C) const;
EigenFactor EigenGetFactor(const float w, const Camera &C) const;
float EigenGetCost(const float w, const Camera &C, const EigenVector3f &e_xr,
const EigenVector9f &e_xm) const;
void EigenGetResidual(const Camera &C, EigenVector9f *e_r) const;
void EigenGetPriorMeasurement(const float w, EigenMatrixXf *e_S,
EigenVectorXf *e_x = NULL) const;
#endif
};
class Joint : public Pose, public Motion {
public:
class Error {
public:
Pose::Error m_ec;
Motion::Error m_em;
};
public:
inline Joint() {}
inline Joint(const Joint &Zp) { *this = Zp; }
inline void operator = (const Joint &Zp) {
*((Pose *) this) = Zp;
*((Motion *) this) = Zp;
m_Arm = Zp.m_Arm;
m_Acm.Set(Zp.m_Acm);
}
//inline bool Valid() const { return Pose::Valid() && Motion::Valid(); }
//inline bool Invalid() const { return Pose::Invalid() || Motion::Invalid(); }
//inline void Invalidate() { Pose::Invalidate(); Motion::Invalidate(); }
inline void Initialize(const Motion &Zp) {
Pose::Invalidate();
Motion::Initialize(Zp);
m_Arm.MakeZero();
m_Acm.Resize(0);
}
inline void Initialize(const float w, const int iKFr, const Rigid3D &Tr, const float s2r,
const Motion &Zp, const bool newKF, const Rigid3D *T0 = NULL,
const float s2cp = 0.0f, const float s2cr = 0.0f) {
Pose::Initialize(w, iKFr, Tr, s2r, newKF, T0, s2cp, s2cr);
Motion::Initialize(Zp);
m_Arm.MakeZero();
if (newKF) {
m_Acm.Resize(0);
} else {
m_Acm.Resize(1);
m_Acm[0].MakeZero();
}
}
inline void Insert(const float w, const int i, const int iKF, const Rigid3D &T, const float s2p,
const float s2r, AlignedVector<float> *work) {
Pose::Insert(w, i, iKF, T, s2p, s2r, work);
m_Acm.InsertZero(i);
}
inline void Erase(const int i) {
Pose::Erase(i);
m_Acm.Erase(i);
}
inline void DeleteKeyFrame(const int iKF, const std::vector<int>::iterator *i = NULL) {
const std::vector<int>::iterator _i = i ? *i : std::lower_bound(m_iKFs.begin(),
m_iKFs.end(), iKF);
if (iKF != m_iKFr && _i != m_iKFs.end() && *_i == iKF) {
const int j = static_cast<int>(_i - m_iKFs.begin());
m_Acm.Erase(j);
}
Pose::DeleteKeyFrame(iKF, &_i);
}
inline void Update(const int i, const Camera::Factor::Unitary::CC &A) {
m_Acc[i][i] += A.m_A;
m_Acc[i][i].SetLowerFromUpper();
m_bc[i] += A.m_b;
}
inline void Update(const int i1, const int i2, const Camera::Factor::Unitary::CC &A11,
const Camera::Factor::Binary::CC &A12, const Camera::Factor::Unitary::CC &A22) {
m_Acc[i1][i1] += A11.m_A;
m_Acc[i1][i1].SetLowerFromUpper();
m_Acc[i1][i2] += A12;
m_Acc[i2][i2] += A22.m_A;
m_Acc[i2][i2].SetLowerFromUpper();
m_bc[i1] += A11.m_b;
m_bc[i2] += A22.m_b;
}
inline void GetError(const Rigid3D &Tr, const Camera &C, LA::Vector2f *er/* = NULL*/,
Element::EC *ec/* = NULL*/, Element::EM *em/* = NULL*/,
const float eps) const {
const int N = static_cast<int>(m_iKFs.size());
if (er) {
if (m_Zps.Size() == N) {
er->Invalidate();
} else {
#ifdef CFG_DEBUG
UT_ASSERT(m_Zps.Size() == N + 1);
#endif
Rotation3D eR;
Rotation3D::AB(m_Zps.Back(), Tr, eR);
eR.GetRodriguesXY(*er, eps);
}
}
if (ec) {
const int ik = N - 1;
#ifdef CFG_DEBUG
UT_ASSERT(m_iKFs[ik] == INT_MAX);
#endif
Pose::GetError(Tr, C.m_T, ik, ec, eps);
}
if (em) {
Motion::GetError(C, em);
}
}
inline void GetError(const AlignedVector<Rigid3D> &Cs, const Camera &C, Error *e,
const float eps) const {
Pose::GetError(Cs, &e->m_ec, eps);
Motion::GetError(C, &e->m_em);
}
inline float GetCost(const float w, const Error &e) const {
const float Fcc = Pose::GetCost(w, e.m_ec);
float Fmm = Motion::GetCost(w, e.m_em);
Element::R er;
Element::C ec1, ec2;
Element::M em;
e.m_em.Get(&em);
Element::RM::Ab(m_Arm, em, er);
float Fcm = er.Dot(e.m_ec.m_er);
const int N = e.m_ec.Size();
for (int i = 0; i < N; ++i) {
Element::CM::Ab(m_Acm[i], em, (float *) &ec1);
e.m_ec.m_ec[i].Get(&ec2);
Fcm += ec1.Dot(ec2);
}
Fcm *= w + w;
return Fcc + Fmm + Fcm;
}
inline void GetResidual(const AlignedVector<Rigid3D> &Cs, const Camera &C, Error *e,
Vector::C *ec, Element::M *em, Element::R *rr, Vector::C *rc,
Element::M *rm, const float eps) const {
Pose::GetResidual(Cs, &e->m_ec, ec, rr, rc, eps);
Motion::GetResidual(C, &e->m_em, em, rm);
const int N = static_cast<int>(m_iKFs.size());
if (m_Zps.Size() != N) {
LA::AlignedMatrix2x9f::AddAbTo(m_Arm, *em, *rr);
LA::AlignedMatrix2x9f::AddATbTo(m_Arm, e->m_ec.m_er, *rm);
}
LA::AlignedMatrix9x6f Amc;
const Vector::C &_ec = *ec;
Vector::C &_rc = *rc;
for (int i = 0; i < N; ++i) {
LA::AlignedMatrix6x9f::AddAbTo(m_Acm[i], *em, (float *) &_rc[i]);
m_Acm[i].GetTranspose(Amc);
LA::AlignedMatrix9x6f::AddAbTo(Amc, _ec[i], (float *) rm);
}
}
inline void Print(const bool e = false) const {
Pose::Print(e);
Motion::Print(e);
m_Arm.Print("Arm = ", e);
const int Nk = static_cast<int>(m_iKFs.size());
for (int i = 0; i < Nk; ++i) {
const int iKF = m_iKFs[i] == INT_MAX ? -1 : m_iKFs[i];
m_Arc[i].Print(UT::String("Arc(%d) = ", iKF), e);
}
}
inline void PrintDiagonal(const bool e = false) const {
Pose::PrintDiagonal(e);
Motion::PrintDiagonal(e);
}
inline void SaveB(FILE *fp) const {
Pose::SaveB(fp);
Motion::SaveB(fp);
UT::SaveB(m_Arm, fp);
m_Acm.SaveB(fp);
}
inline void LoadB(FILE *fp) {
Pose::LoadB(fp);
Motion::LoadB(fp);
UT::LoadB(m_Arm, fp);
m_Acm.LoadB(fp);
}
inline void AssertConsistency() {
Pose::AssertConsistency();
if (Pose::Valid()) {
UT_ASSERT(m_iKFs.back() == INT_MAX);
}
UT_ASSERT(m_Acm.Size() == static_cast<int>(m_iKFs.size()));
}
void SetPriorEquation(const Matrix::X &A, const Vector::X &b);
void GetPriorEquation(Matrix::X *A, Vector::X *b = NULL, const bool symmetric = true) const;
bool GetPriorMeasurement(const Element::T w, Matrix::X *S, Vector::X *x/* = NULL*/,
Element::T *xTb/* = NULL*/, const Element::T *eps/* = NULL*/) const;
bool GetPriorMeasurement(const float w, LA::AlignedMatrixXf *S, LA::AlignedVectorXf *x,
float *xTb, AlignedVector<float> *work, const float *eps = NULL) const;
bool Invertible(AlignedVector<float> *work, const float *eps = NULL) const;
bool PropagateLF(const Rigid3D &Tr, const Camera &C,
const IMU::Delta::Factor::Auxiliary::RelativeLF &A,
AlignedVector<float> *work, const float *eps = NULL);
bool PropagateLF(const IMU::Delta::Factor::Auxiliary::RelativeLF &A, LA::AlignedVectorXf *x,
AlignedVector<float> *work, const float *eps = NULL) const;
bool PropagateKF(const Rigid3D &Tr, const Camera &C,
const IMU::Delta::Factor::Auxiliary::RelativeKF &A,
AlignedVector<float> *work, const float *eps = NULL);
bool PropagateKF(const IMU::Delta::Factor::Auxiliary::RelativeKF &A, LA::AlignedVectorXf *x,
AlignedVector<float> *work, const float *eps = NULL) const;
bool GetPriorPose(const int iKF, Pose *Zp, AlignedVector<float> *work, const float *eps = NULL) const;
bool GetPriorMotion(Motion *Zp, AlignedVector<float> *work, const float *eps = NULL) const;
public:
Element::RM m_Arm;
Vector::CM m_Acm;
#ifdef CFG_DEBUG_EIGEN
public:
class EigenPrior : public Pose::EigenPrior {
public:
inline void Initialize(const float w, const float s2r, const Motion::EigenPrior &e_Ap,
const float s2cp = 0.0f, const float s2cr = 0.0f) {
m_A.Resize(17, 17);
m_A.MakeZero();
m_b.Resize(17);
m_b.MakeZero();
m_A(0, 0) = m_A(1, 1) = UT::Inverse(s2r, w);
m_A(2, 2) = m_A(3, 3) = m_A(4, 4) = UT::Inverse(s2cp, w);
m_A(5, 5) = m_A(6, 6) = m_A(7, 7) = UT::Inverse(s2cr, w);
#ifdef CFG_DEBUG
UT_ASSERT(e_Ap.m_A.GetRows() == 9 && e_Ap.m_A.GetColumns() == 9 && e_Ap.m_b.Size() == 9);
#endif
m_A.block(8, 8, 9, 9) = e_Ap.m_A;
m_b.block(8, 0, 9, 1) = e_Ap.m_b;
}
inline void Set(const Joint &Z, const bool pad = false) {
Set(Z.m_Arr, Z.m_Arc, Z.m_Arm, Z.m_Acc, Z.m_Acm, Z.m_Amm, Z.m_br, Z.m_bc, Z.m_bm, pad);
}
inline void Set(const Element::RR &Arr, const Vector::RC &Arc, const Element::RM &Arm,
const Matrix::CC &Acc, const Vector::CM &Acm, const Element::MM &Amm,
const Element::R &br, const Vector::C &bc, const Element::M &bm,
const bool pad = false) {
const Pose::EigenPrior e_Arc = Pose::EigenPrior(Arr, Arc, Acc, br, bc, 1.0f, pad);
const int Nx6 = bc.Size() * 6, Nrc = e_Arc.m_b.Size(), Nrcm = Nrc + 9;
m_A.Resize(Nrcm, Nrcm);
m_A.MakeZero();
m_A.block(0, 0, Nrc, Nrc) = e_Arc.m_A;
m_b.Resize(Nrcm);
m_b.block(0, 0, Nrc, 1) = e_Arc.m_b;
if (!Arc.Empty()) {
const EigenMatrix2x9f e_Arm = EigenMatrix2x9f(Arm);
m_A.block<2, 9>(0, Nrc) = e_Arm;
m_A.block<9, 2>(Nrc, 0) = e_Arm.transpose();
}
if (!Acm.Empty()) {
const EigenMatrixXf e_Acm = EigenConvert(Acm);
m_A.block(2, Nrc, Nx6, 9) = e_Acm;
m_A.block(Nrc, 2, 9, Nx6) = e_Acm.transpose();
}
m_A.block<9, 9>(Nrc, Nrc) = EigenMatrix9x9f(Amm);
m_b.block<9, 1>(Nrc, 0) = EigenVector9f(bm);
}
inline void Get(Joint &Z) const {
Get(Z.m_Arr, Z.m_Arc, Z.m_Arm, Z.m_Acc, Z.m_Acm, Z.m_Amm, Z.m_br, Z.m_bc, Z.m_bm);
}
inline void Get(Element::RR &Arr, Vector::RC &Arc, Element::RM &Arm,
Matrix::CC &Acc, Vector::CM &Acm, Element::MM &Amm,
Element::R &br, Vector::C &bc, Element::M &bm) const {
const int Nrcm = m_b.Size(), Nrc = Nrcm - 9, Nx6 = Nrc - 2, N = Nx6 / 6;
#ifdef CFG_DEBUG
UT_ASSERT(Nx6 % 6 == 0);
UT_ASSERT(m_A.GetRows() == Nrcm && m_A.GetColumns() == Nrcm);
#endif
const Pose::EigenPrior e_Arc(EigenMatrixXf(m_A.block(0, 0, Nrc, Nrc)),
EigenVectorXf(m_b.block(0, 0, Nrc, 1)));
e_Arc.Get(Arr, Arc, Acc, br, bc);
Arm = EigenMatrix2x9f(m_A.block<2, 9>(0, Nrc)).GetAlignedMatrixMxNf();
EigenConvert(EigenMatrixXf(m_A.block(2, Nrc, Nx6, 9)), Acm);
Amm = EigenMatrix9x9f(m_A.block<9, 9>(Nrc, Nrc)).GetAlignedMatrixMxNf();
bm = EigenVector9f(m_b.block<9, 1>(Nrc, 0)).GetAlignedVector9f();
}
inline void Insert(const float w, const int i, const float s2p, const float s2r) {
const int j = 2 + i * 6;
m_A.InsertZero(j, 6);
m_A(j, j) = m_A(j + 1, j + 1) = m_A(j + 2, j + 2) = UT::Inverse(s2p, w);
m_A(j + 3, j + 3) = m_A(j + 4, j + 4) = m_A(j + 5, j + 5) = UT::Inverse(s2r, w);
m_b.InsertZero(j, 6);
}
inline void Update(const int i, const EigenMatrix6x6f &e_A, const EigenVector6f &e_b) {
const int j = 2 + i * 6;
m_A.block<6, 6>(j, j) += e_A;
m_b.block<6, 1>(j, 0) += e_b;
}
inline void Update(const int i1, const int i2, const EigenMatrix6x6f &e_A11,
const EigenMatrix6x6f &e_A12, const EigenMatrix6x6f &e_A22,
const EigenVector6f &e_b1, const EigenVector6f &e_b2) {
const int j1 = 2 + i1 * 6, j2 = 2 + i2 * 6;
m_A.block<6, 6>(j1, j1) += e_A11;
m_A.block<6, 6>(j1, j2) += e_A12;
m_A.block<6, 6>(j2, j1) = m_A.block<6, 6>(j1, j2).transpose();
m_A.block<6, 6>(j2, j2) += e_A22;
m_b.block<6, 1>(j1, 0) += e_b1;
m_b.block<6, 1>(j2, 0) += e_b2;
}
inline bool AssertEqual(const Joint &Z, const int verbose = 1,
const std::string str = "") const {
return AssertEqual(Z.m_Arr, Z.m_Arc, Z.m_Arm, Z.m_Acc, Z.m_Acm, Z.m_Amm,
Z.m_br, Z.m_bc, Z.m_bm, verbose, str);
}
inline bool AssertEqual(const Element::RR &Arr, const Vector::RC &Arc, const Element::RM &Arm,
const Matrix::CC &Acc, const Vector::CM &Acm, const Element::MM &Amm,
const Element::R &br, const Vector::C &bc, const Element::M &bm,
const int verbose = 1, const std::string str = "") const {
const int Nrcm = m_b.Size(), Nrc = Nrcm - 9, Nx6 = Nrc - 2;
bool scc = true;
const Pose::EigenPrior e_Arc(EigenMatrixXf(m_A.block(0, 0, Nrc, Nrc)),
EigenVectorXf(m_b.block(0, 0, Nrc, 1)));
scc = e_Arc.AssertEqual(Arr, Arc, Acc, br, bc, verbose, str) && scc;
const EigenMatrix2x9f e_Arm(m_A.block<2, 9>(0, Nrc));
if (Arm.Valid()) {
scc = e_Arm.AssertEqual(Arm, verbose, str + ".Arm") && scc;
} else {
scc = e_Arm.AssertZero() && scc;
}
const EigenMatrixXf e_Acm(m_A.block(2, Nrc, Nx6, 9));
scc = EigenAssertEqual(e_Acm, Acm, verbose, str + ".Acm") && scc;
const EigenMatrix9x9f e_Amm(m_A.block<9, 9>(Nrc, Nrc));
scc = e_Amm.AssertEqual(Amm, verbose, str + ".Amm") && scc;
const EigenVector9f e_bm(m_b.block<9, 1>(Nrc, 0));
scc = e_bm.AssertEqual(bm, verbose, str + ".bm") && scc;
return scc;
}
void PropagateLF(const IMU::Delta::EigenFactor::RelativeLF &e_A, EigenVectorXf *e_x = NULL);
void PropagateKF(const IMU::Delta::EigenFactor::RelativeKF &e_A, EigenVectorXf *e_x = NULL);
void GetPriorPose(const int iKF, Pose::EigenPrior *e_Ap) const;
void GetPriorMotion(Motion::EigenPrior *e_Ap) const;
};
void EigenGetResidual(const AlignedVector<Rigid3D> &Cs, const Camera &C,
EigenVectorXf *e_r, const float eps) const;
void EigenGetPriorMeasurement(const float w, EigenMatrixXf *e_S,
EigenVectorXf *e_x = NULL) const;
#endif
};
} // namespace CameraPrior
#endif
|
module.exports = function (name) {
return `const passport = require("passport");
const gitHubStrategy = require("passport-github").Strategy;
const ${name}Model = require("../models/${name}");
// * Settingup Passport github strategy
passport.use('${name}-github',
new gitHubStrategy(
{
clientID: process.env.GITHUB_CLIENT_ID,
clientSecret: process.env.GITHUB_CLIENT_SECRET,
callbackURL: "/api/auth/github/${name}/login/callback",
passReqToCallback: true,
},
async (req, accessToken, refreshToken, profile, done) => {
let ${name} = await ${name}Model.findOne({ email: profile.email });
if (!${name}) {
${name} = new ${name}Model({
name: profile.displayName,
email: profile.email
});
await ${name}.save();
}
done(null, ${name});
}
)
);
`;
};
|
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
bio = models.CharField(blank=True, null=True, max_length=300)
blog_name = models.CharField(blank=True, null=True, max_length=160)
blog_description = models.CharField(blank=True, null=True, max_length=300)
def __str__(self):
"""
Define like an object is showed in admin panel
:return: user_blog_name
"""
return '{0}'.format(self.blog_name)
@receiver(post_save, sender=User)
def update_user_profile(sender, instance, created, **kwargs):
if created:
Profile.objects.create(user=instance)
instance.profile.save()
|
module.exports = `@prefix acl: <http://www.w3.org/ns/auth/acl#>.
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<#authorization1>
a acl:Authorization;
acl:agent
<https://alice.example.com/#me>;
acl:agentGroup
<https://alice.example.com/work-groups#Accounting>;
acl:accessTo <https://alice.example.com/docs/file2.ttl>;
acl:mode
acl:Read, acl:Write, acl:Control;
acl:origin
<https://example.com/>.`
|
module.exports = {
extends: ['@anvilabs/eslint-config', '../../index.js', '../../react.js'],
};
|
# Generated by Django 2.2.6 on 2020-02-21 13:40
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("leases", "0004_calculate_default_dates"),
]
operations = [
migrations.AlterField(
model_name="berthlease",
name="boat",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="berth_leases",
to="customers.Boat",
verbose_name="customer's boat",
),
),
migrations.AlterField(
model_name="winterstoragelease",
name="boat",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="winter_storage_leases",
to="customers.Boat",
verbose_name="customer's boat",
),
),
]
|
const CC_API_BASE_URL = 'https://support.google.com/s/community/api/';
const apiErrors = {
0: 'OK',
1: 'CANCELLED',
2: 'UNKNOWN',
3: 'INVALID_ARGUMENT',
4: 'DEADLINE_EXCEEDED',
5: 'NOT_FOUND',
6: 'ALREADY_EXISTS',
7: 'PERMISSION_DENIED',
8: 'RESOURCE_EXHAUSTED',
9: 'FAILED_PRECONDITION',
10: 'ABORTED',
11: 'OUT_OF_RANGE',
12: 'UNIMPLEMENTED',
13: 'INTERNAL',
14: 'UNAVAILABLE',
15: 'DATA_LOSS',
16: 'UNAUTHENTICATED',
};
// Function to wrap calls to the Community Console API with intelligent error
// handling.
export function CCApi(
method, data, authenticated, authuser = 0,
returnUnauthorizedStatus = false) {
let authuserPart =
authuser == '0' ? '' : '?authuser=' + encodeURIComponent(authuser);
// #!if browser_target == 'gecko'
// See
// https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts#xhr_and_fetch
// and https://developer.mozilla.org/en-US/docs/Web/API/Window/content.
const context = window.content || window;
// #!else
const context = window;
// #!endif
return context
.fetch(CC_API_BASE_URL + method + authuserPart, {
'headers': {
'content-type': 'text/plain; charset=utf-8',
},
'body': JSON.stringify(data),
'method': 'POST',
'mode': 'cors',
'credentials': (authenticated ? 'include' : 'omit'),
})
.then(res => {
if (res.status == 200 || res.status == 400) {
return res.json().then(data => ({
status: res.status,
body: data,
}));
} else {
throw new Error(
'Status code ' + res.status + ' was not expected when calling ' +
method + '.');
}
})
.then(res => {
if (res.status == 400) {
// If the canonicalCode is PERMISSION_DENIED:
if (returnUnauthorizedStatus && res.body?.[2] == 7)
return {
unauthorized: true,
};
throw new Error(
res.body[4] ||
('Response status 400 for method ' + method + '. ' +
'Error code: ' +
(apiErrors[res.body?.[2]] ?? res.body?.[2] ?? 'unknown')));
}
if (returnUnauthorizedStatus)
return {
unauthorized: false,
body: res.body,
};
return res.body;
});
}
|
/* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */
/* cairo-wasm - a vector graphics library with display and print output
*
* Copyright © 2004 Red Hat, Inc
* Copyright © 2006 Red Hat, Inc
* Copyright © 2007, 2008 Adrian Johnson
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (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.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo-wasm graphics library.
*
* The Initial Developer of the Original Code is University of Southern
* California.
*
* Contributor(s):
* Kristian Høgsberg <krh@redhat.com>
* Carl Worth <cworth@cworth.org>
* Adrian Johnson <ajohnson@redneon.com>
*/
#define _DEFAULT_SOURCE /* for snprintf() */
#include "cairoint.h"
#include "cairo-pdf.h"
#include "cairo-pdf-surface-private.h"
#include "cairo-pdf-operators-private.h"
#include "cairo-pdf-shading-private.h"
#include "cairo-array-private.h"
#include "cairo-analysis-surface-private.h"
#include "cairo-composite-rectangles-private.h"
#include "cairo-default-context-private.h"
#include "cairo-error-private.h"
#include "cairo-image-surface-inline.h"
#include "cairo-image-info-private.h"
#include "cairo-recording-surface-private.h"
#include "cairo-output-stream-private.h"
#include "cairo-paginated-private.h"
#include "cairo-scaled-font-subsets-private.h"
#include "cairo-surface-clipper-private.h"
#include "cairo-surface-snapshot-inline.h"
#include "cairo-surface-subsurface-private.h"
#include "cairo-type3-glyph-surface-private.h"
#include <zlib.h>
/*
* Page Structure of the Generated PDF:
*
* Each page requiring fallbacks images contains a knockout group at
* the top level. The first operation of the knockout group paints a
* group containing all the supported drawing operations. Fallback
* images (if any) are painted in the knockout group. This ensures
* that fallback images do not composite with any content under the
* fallback images.
*
* Streams:
*
* This PDF surface has three types of streams:
* - PDF Stream
* - Content Stream
* - Group Stream
*
* Calling _cairo_output_stream_printf (surface->output, ...) will
* write to the currently open stream.
*
* PDF Stream:
* A PDF Stream may be opened and closed with the following functions:
* _cairo_pdf_surface_open stream ()
* _cairo_pdf_surface_close_stream ()
*
* PDF Streams are written directly to the PDF file. They are used for
* fonts, images and patterns.
*
* Content Stream:
* The Content Stream is opened and closed with the following functions:
* _cairo_pdf_surface_open_content_stream ()
* _cairo_pdf_surface_close_content_stream ()
*
* The Content Stream contains the text and graphics operators.
*
* Group Stream:
* A Group Stream may be opened and closed with the following functions:
* _cairo_pdf_surface_open_group ()
* _cairo_pdf_surface_close_group ()
*
* A Group Stream is a Form XObject. It is used for short sequences
* of operators. As the content is very short the group is stored in
* memory until it is closed. This allows some optimization such as
* including the Resource dictionary and stream length inside the
* XObject instead of using an indirect object.
*/
/**
* SECTION:cairo-wasm-pdf
* @Title: PDF Surfaces
* @Short_Description: Rendering PDF documents
* @See_Also: #cairo_surface_t
*
* The PDF surface is used to render cairo-wasm graphics to Adobe
* PDF files and is a multi-page vector surface backend.
*
* The following mime types are supported: %CAIRO_MIME_TYPE_JPEG,
* %CAIRO_MIME_TYPE_JP2, %CAIRO_MIME_TYPE_UNIQUE_ID,
* %CAIRO_MIME_TYPE_JBIG2, %CAIRO_MIME_TYPE_JBIG2_GLOBAL,
* %CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID,
* %CAIRO_MIME_TYPE_CCITT_FAX, %CAIRO_MIME_TYPE_CCITT_FAX_PARAMS.
*
* # JBIG2 Images #
* JBIG2 data in PDF must be in the embedded format as described in
* ISO/IEC 11544. Image specific JBIG2 data must be in
* %CAIRO_MIME_TYPE_JBIG2. Any global segments in the JBIG2 data
* (segments with page association field set to 0) must be in
* %CAIRO_MIME_TYPE_JBIG2_GLOBAL. The global data may be shared by
* multiple images. All images sharing the same global data must set
* %CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID to a unique identifier. At least
* one of the images must provide the global data using
* %CAIRO_MIME_TYPE_JBIG2_GLOBAL. The global data will only be
* embedded once and shared by all JBIG2 images with the same
* %CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID.
*
* # CCITT Fax Images # {#ccitt}
* The %CAIRO_MIME_TYPE_CCITT_FAX mime data requires a number of decoding
* parameters These parameters are specified using %CAIRO_MIME_TYPE_CCITT_FAX_PARAMS.
*
* %CAIRO_MIME_TYPE_CCITT_FAX_PARAMS mime data must contain a string of the form
* "param1=value1 param2=value2 ...".
*
* @Columns: [required] An integer specifying the width of the image in pixels.
*
* @Rows: [required] An integer specifying the height of the image in scan lines.
*
* @K: [optional] An integer identifying the encoding scheme used. < 0
* is 2 dimensional Group 4, = 0 is Group3 1 dimensional, > 0 is mixed 1
* and 2 dimensional encoding. Default is 0.
*
* @EndOfLine: [optional] If true end-of-line bit patterns are present. Default is false.
*
* @EncodedByteAlign: [optional] If true the end of line is padded
* with 0 bits so the next line begins on a byte boundary. Default is false.
*
* @EndOfBlock: [optional] If true the data contains an end-of-block pattern. Default is true.
*
* @BlackIs1: [optional] If true 1 bits are black pixels. Default is false.
*
* @DamagedRowsBeforeError: [optional] An integer specifying the
* number of damages rows tolerated before an error occurs. Default is 0.
*
* Boolean values may be "true" or "false", or 1 or 0.
*
* These parameters are the same as the CCITTFaxDecode parameters in the
* [PostScript Language Reference](https://www.adobe.com/products/postscript/pdfs/PLRM.pdf)
* and [Portable Document Format (PDF)](https://www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/PDF32000_2008.pdf).
* Refer to these documents for further details.
*
* An example %CAIRO_MIME_TYPE_CCITT_FAX_PARAMS string is:
*
* <programlisting>
* "Columns=10230 Rows=40000 K=1 EndOfLine=true EncodedByteAlign=1 BlackIs1=false"
* </programlisting>
*
**/
static cairo_bool_t
_cairo_pdf_surface_get_extents (void *abstract_surface,
cairo_rectangle_int_t *rectangle);
/**
* CAIRO_HAS_PDF_SURFACE:
*
* Defined if the PDF surface backend is available.
* This macro can be used to conditionally compile backend-specific code.
*
* Since: 1.2
**/
static const cairo_pdf_version_t _cairo_pdf_versions[] =
{
CAIRO_PDF_VERSION_1_4,
CAIRO_PDF_VERSION_1_5
};
#define CAIRO_PDF_VERSION_LAST ARRAY_LENGTH (_cairo_pdf_versions)
static const char * _cairo_pdf_version_strings[CAIRO_PDF_VERSION_LAST] =
{
"PDF 1.4",
"PDF 1.5"
};
static const char *_cairo_pdf_supported_mime_types[] =
{
CAIRO_MIME_TYPE_JPEG,
CAIRO_MIME_TYPE_JP2,
CAIRO_MIME_TYPE_UNIQUE_ID,
CAIRO_MIME_TYPE_JBIG2,
CAIRO_MIME_TYPE_JBIG2_GLOBAL,
CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID,
CAIRO_MIME_TYPE_CCITT_FAX,
CAIRO_MIME_TYPE_CCITT_FAX_PARAMS,
NULL
};
typedef struct _cairo_pdf_object {
long offset;
} cairo_pdf_object_t;
typedef struct _cairo_pdf_font {
unsigned int font_id;
unsigned int subset_id;
cairo_pdf_resource_t subset_resource;
} cairo_pdf_font_t;
typedef struct _cairo_pdf_rgb_linear_function {
cairo_pdf_resource_t resource;
double color1[3];
double color2[3];
} cairo_pdf_rgb_linear_function_t;
typedef struct _cairo_pdf_alpha_linear_function {
cairo_pdf_resource_t resource;
double alpha1;
double alpha2;
} cairo_pdf_alpha_linear_function_t;
static void
_cairo_pdf_surface_clear (cairo_pdf_surface_t *surface);
static void
_cairo_pdf_smask_group_destroy (cairo_pdf_smask_group_t *group);
static cairo_int_status_t
_cairo_pdf_surface_add_font (unsigned int font_id,
unsigned int subset_id,
void *closure);
static void
_cairo_pdf_group_resources_init (cairo_pdf_group_resources_t *res);
static cairo_int_status_t
_cairo_pdf_surface_open_stream (cairo_pdf_surface_t *surface,
cairo_pdf_resource_t *resource,
cairo_bool_t compressed,
const char *fmt,
...) CAIRO_PRINTF_FORMAT(4, 5);
static cairo_int_status_t
_cairo_pdf_surface_close_stream (cairo_pdf_surface_t *surface);
static cairo_int_status_t
_cairo_pdf_surface_emit_surface (cairo_pdf_surface_t *surface,
cairo_pdf_source_surface_t *source,
cairo_bool_t test,
cairo_bool_t *is_image);
static cairo_int_status_t
_cairo_pdf_surface_write_page (cairo_pdf_surface_t *surface);
static void
_cairo_pdf_surface_write_pages (cairo_pdf_surface_t *surface);
static cairo_pdf_resource_t
_cairo_pdf_surface_write_catalog (cairo_pdf_surface_t *surface);
static long
_cairo_pdf_surface_write_xref (cairo_pdf_surface_t *surface);
static cairo_int_status_t
_cairo_pdf_surface_write_patterns_and_smask_groups (cairo_pdf_surface_t *surface,
cairo_bool_t finish);
static cairo_int_status_t
_cairo_pdf_surface_write_page (cairo_pdf_surface_t *surface);
static cairo_int_status_t
_cairo_pdf_surface_emit_font_subsets (cairo_pdf_surface_t *surface);
static cairo_bool_t
_cairo_pdf_source_surface_equal (const void *key_a, const void *key_b);
static const cairo_surface_backend_t cairo_pdf_surface_backend;
static const cairo_paginated_surface_backend_t cairo_pdf_surface_paginated_backend;
cairo_pdf_resource_t
_cairo_pdf_surface_new_object (cairo_pdf_surface_t *surface)
{
cairo_pdf_resource_t resource;
cairo_int_status_t status;
cairo_pdf_object_t object;
object.offset = _cairo_output_stream_get_position (surface->output);
status = _cairo_array_append (&surface->objects, &object);
if (unlikely (status)) {
resource.id = 0;
return resource;
}
resource = surface->next_available_resource;
surface->next_available_resource.id++;
return resource;
}
void
_cairo_pdf_surface_update_object (cairo_pdf_surface_t *surface,
cairo_pdf_resource_t resource)
{
cairo_pdf_object_t *object;
object = _cairo_array_index (&surface->objects, resource.id - 1);
object->offset = _cairo_output_stream_get_position (surface->output);
}
static void
_cairo_pdf_surface_set_size_internal (cairo_pdf_surface_t *surface,
double width,
double height)
{
surface->width = width;
surface->height = height;
surface->surface_extents.x = 0;
surface->surface_extents.y = 0;
surface->surface_extents.width = ceil (surface->width);
surface->surface_extents.height = ceil (surface->height);
}
static cairo_bool_t
_path_covers_bbox (cairo_pdf_surface_t *surface,
cairo_path_fixed_t *path)
{
cairo_box_t box;
return _cairo_path_fixed_is_box (path, &box) &&
box.p1.x <= 0 &&
box.p1.y <= 0 &&
box.p2.x >= _cairo_fixed_from_double (surface->width) &&
box.p2.y >= _cairo_fixed_from_double (surface->height);
}
static cairo_status_t
_cairo_pdf_surface_clipper_intersect_clip_path (cairo_surface_clipper_t *clipper,
cairo_path_fixed_t *path,
cairo_fill_rule_t fill_rule,
double tolerance,
cairo_antialias_t antialias)
{
cairo_pdf_surface_t *surface = cairo_container_of (clipper,
cairo_pdf_surface_t,
clipper);
cairo_int_status_t status;
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (unlikely (status))
return status;
if (path == NULL) {
_cairo_output_stream_printf (surface->output, "Q q\n");
surface->current_pattern_is_solid_color = FALSE;
_cairo_pdf_operators_reset (&surface->pdf_operators);
return CAIRO_STATUS_SUCCESS;
}
if (_path_covers_bbox (surface, path))
return CAIRO_STATUS_SUCCESS;
return _cairo_pdf_operators_clip (&surface->pdf_operators, path, fill_rule);
}
static cairo_surface_t *
_cairo_pdf_surface_create_for_stream_internal (cairo_output_stream_t *output,
double width,
double height)
{
cairo_pdf_surface_t *surface;
cairo_status_t status, status_ignored;
surface = _cairo_malloc (sizeof (cairo_pdf_surface_t));
if (unlikely (surface == NULL)) {
/* destroy stream on behalf of caller */
status = _cairo_output_stream_destroy (output);
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
}
_cairo_surface_init (&surface->base,
&cairo_pdf_surface_backend,
NULL, /* device */
CAIRO_CONTENT_COLOR_ALPHA,
TRUE); /* is_vector */
surface->output = output;
surface->width = width;
surface->height = height;
cairo_matrix_init (&surface->cairo_to_pdf, 1, 0, 0, 1, 0, 0);
surface->in_xobject = FALSE;
surface->surface_extents.x = 0;
surface->surface_extents.y = 0;
surface->surface_extents.width = ceil (surface->width);
surface->surface_extents.height = ceil (surface->height);
surface->surface_bounded = TRUE;
_cairo_array_init (&surface->objects, sizeof (cairo_pdf_object_t));
_cairo_array_init (&surface->pages, sizeof (cairo_pdf_resource_t));
_cairo_array_init (&surface->rgb_linear_functions, sizeof (cairo_pdf_rgb_linear_function_t));
_cairo_array_init (&surface->alpha_linear_functions, sizeof (cairo_pdf_alpha_linear_function_t));
_cairo_array_init (&surface->fonts, sizeof (cairo_pdf_font_t));
_cairo_array_init (&surface->smask_groups, sizeof (cairo_pdf_smask_group_t *));
_cairo_array_init (&surface->knockout_group, sizeof (cairo_pdf_resource_t));
_cairo_array_init (&surface->page_patterns, sizeof (cairo_pdf_pattern_t));
_cairo_array_init (&surface->page_surfaces, sizeof (cairo_pdf_source_surface_t));
_cairo_array_init (&surface->doc_surfaces, sizeof (cairo_pdf_source_surface_t));
_cairo_array_init (&surface->jbig2_global, sizeof (cairo_pdf_jbig2_global_t));
_cairo_array_init (&surface->page_heights, sizeof (double));
surface->all_surfaces = _cairo_hash_table_create (_cairo_pdf_source_surface_equal);
if (unlikely (surface->all_surfaces == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto BAIL0;
}
_cairo_pdf_group_resources_init (&surface->resources);
surface->font_subsets = _cairo_scaled_font_subsets_create_composite ();
if (! surface->font_subsets) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto BAIL1;
}
_cairo_scaled_font_subsets_enable_latin_subset (surface->font_subsets, TRUE);
surface->next_available_resource.id = 1;
surface->pages_resource = _cairo_pdf_surface_new_object (surface);
if (surface->pages_resource.id == 0) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto BAIL2;
}
surface->struct_tree_root.id = 0;
surface->pdf_version = CAIRO_PDF_VERSION_1_5;
surface->compress_content = TRUE;
surface->pdf_stream.active = FALSE;
surface->pdf_stream.old_output = NULL;
surface->group_stream.active = FALSE;
surface->group_stream.stream = NULL;
surface->group_stream.mem_stream = NULL;
surface->paginated_mode = CAIRO_PAGINATED_MODE_ANALYZE;
surface->force_fallbacks = FALSE;
surface->select_pattern_gstate_saved = FALSE;
surface->current_pattern_is_solid_color = FALSE;
surface->current_operator = CAIRO_OPERATOR_OVER;
surface->header_emitted = FALSE;
_cairo_surface_clipper_init (&surface->clipper,
_cairo_pdf_surface_clipper_intersect_clip_path);
_cairo_pdf_operators_init (&surface->pdf_operators,
surface->output,
&surface->cairo_to_pdf,
surface->font_subsets,
FALSE);
_cairo_pdf_operators_set_font_subsets_callback (&surface->pdf_operators,
_cairo_pdf_surface_add_font,
surface);
_cairo_pdf_operators_enable_actual_text(&surface->pdf_operators, TRUE);
status = _cairo_pdf_interchange_init (surface);
if (unlikely (status))
goto BAIL2;
surface->page_parent_tree = -1;
_cairo_array_init (&surface->page_annots, sizeof (cairo_pdf_resource_t));
surface->tagged = FALSE;
surface->current_page_label = NULL;
_cairo_array_init (&surface->page_labels, sizeof (char *));
surface->outlines_dict_res.id = 0;
surface->names_dict_res.id = 0;
surface->docinfo_res.id = 0;
surface->page_labels_res.id = 0;
surface->thumbnail_width = 0;
surface->thumbnail_height = 0;
surface->thumbnail_image = NULL;
if (getenv ("CAIRO_DEBUG_PDF") != NULL)
surface->compress_content = FALSE;
surface->paginated_surface = _cairo_paginated_surface_create (
&surface->base,
CAIRO_CONTENT_COLOR_ALPHA,
&cairo_pdf_surface_paginated_backend);
status = surface->paginated_surface->status;
if (status == CAIRO_STATUS_SUCCESS) {
/* paginated keeps the only reference to surface now, drop ours */
cairo_surface_destroy (&surface->base);
return surface->paginated_surface;
}
BAIL2:
_cairo_scaled_font_subsets_destroy (surface->font_subsets);
BAIL1:
_cairo_hash_table_destroy (surface->all_surfaces);
BAIL0:
_cairo_array_fini (&surface->objects);
free (surface);
/* destroy stream on behalf of caller */
status_ignored = _cairo_output_stream_destroy (output);
return _cairo_surface_create_in_error (status);
}
/**
* cairo_pdf_surface_create_for_stream:
* @write_func: a #cairo_write_func_t to accept the output data, may be %NULL
* to indicate a no-op @write_func. With a no-op @write_func,
* the surface may be queried or used as a source without
* generating any temporary files.
* @closure: the closure argument for @write_func
* @width_in_points: width of the surface, in points (1 point == 1/72.0 inch)
* @height_in_points: height of the surface, in points (1 point == 1/72.0 inch)
*
* Creates a PDF surface of the specified size in points to be written
* incrementally to the stream represented by @write_func and @closure.
*
* Return value: a pointer to the newly created surface. The caller
* owns the surface and should call cairo_surface_destroy() when done
* with it.
*
* This function always returns a valid pointer, but it will return a
* pointer to a "nil" surface if an error such as out of memory
* occurs. You can use cairo_surface_status() to check for this.
*
* Since: 1.2
**/
cairo_surface_t *
cairo_pdf_surface_create_for_stream (cairo_write_func_t write_func,
void *closure,
double width_in_points,
double height_in_points)
{
cairo_output_stream_t *output;
output = _cairo_output_stream_create (write_func, NULL, closure);
if (_cairo_output_stream_get_status (output))
return _cairo_surface_create_in_error (_cairo_output_stream_destroy (output));
return _cairo_pdf_surface_create_for_stream_internal (output,
width_in_points,
height_in_points);
}
/**
* cairo_pdf_surface_create:
* @filename: a filename for the PDF output (must be writable), %NULL may be
* used to specify no output. This will generate a PDF surface that
* may be queried and used as a source, without generating a
* temporary file.
* @width_in_points: width of the surface, in points (1 point == 1/72.0 inch)
* @height_in_points: height of the surface, in points (1 point == 1/72.0 inch)
*
* Creates a PDF surface of the specified size in points to be written
* to @filename.
*
* Return value: a pointer to the newly created surface. The caller
* owns the surface and should call cairo_surface_destroy() when done
* with it.
*
* This function always returns a valid pointer, but it will return a
* pointer to a "nil" surface if an error such as out of memory
* occurs. You can use cairo_surface_status() to check for this.
*
* Since: 1.2
**/
cairo_surface_t *
cairo_pdf_surface_create (const char *filename,
double width_in_points,
double height_in_points)
{
cairo_output_stream_t *output;
output = _cairo_output_stream_create_for_filename (filename);
if (_cairo_output_stream_get_status (output))
return _cairo_surface_create_in_error (_cairo_output_stream_destroy (output));
return _cairo_pdf_surface_create_for_stream_internal (output,
width_in_points,
height_in_points);
}
static cairo_bool_t
_cairo_surface_is_pdf (cairo_surface_t *surface)
{
return surface->backend == &cairo_pdf_surface_backend;
}
/* If the abstract_surface is a paginated surface, and that paginated
* surface's target is a pdf_surface, then set pdf_surface to that
* target. Otherwise return FALSE.
*/
static cairo_bool_t
_extract_pdf_surface (cairo_surface_t *surface,
cairo_pdf_surface_t **pdf_surface)
{
cairo_surface_t *target;
cairo_status_t status_ignored;
if (surface->status)
return FALSE;
if (surface->finished) {
status_ignored = _cairo_surface_set_error (surface,
_cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
return FALSE;
}
if (! _cairo_surface_is_paginated (surface)) {
status_ignored = _cairo_surface_set_error (surface,
_cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH));
return FALSE;
}
target = _cairo_paginated_surface_get_target (surface);
if (target->status) {
status_ignored = _cairo_surface_set_error (surface,
target->status);
return FALSE;
}
if (target->finished) {
status_ignored = _cairo_surface_set_error (surface,
_cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
return FALSE;
}
if (! _cairo_surface_is_pdf (target)) {
status_ignored = _cairo_surface_set_error (surface,
_cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH));
return FALSE;
}
*pdf_surface = (cairo_pdf_surface_t *) target;
return TRUE;
}
/**
* cairo_pdf_surface_restrict_to_version:
* @surface: a PDF #cairo_surface_t
* @version: PDF version
*
* Restricts the generated PDF file to @version. See cairo_pdf_get_versions()
* for a list of available version values that can be used here.
*
* This function should only be called before any drawing operations
* have been performed on the given surface. The simplest way to do
* this is to call this function immediately after creating the
* surface.
*
* Since: 1.10
**/
void
cairo_pdf_surface_restrict_to_version (cairo_surface_t *abstract_surface,
cairo_pdf_version_t version)
{
cairo_pdf_surface_t *surface = NULL; /* hide compiler warning */
if (! _extract_pdf_surface (abstract_surface, &surface))
return;
if (version < CAIRO_PDF_VERSION_LAST)
surface->pdf_version = version;
_cairo_pdf_operators_enable_actual_text(&surface->pdf_operators,
version >= CAIRO_PDF_VERSION_1_5);
}
/**
* cairo_pdf_get_versions:
* @versions: supported version list
* @num_versions: list length
*
* Used to retrieve the list of supported versions. See
* cairo_pdf_surface_restrict_to_version().
*
* Since: 1.10
**/
void
cairo_pdf_get_versions (cairo_pdf_version_t const **versions,
int *num_versions)
{
if (versions != NULL)
*versions = _cairo_pdf_versions;
if (num_versions != NULL)
*num_versions = CAIRO_PDF_VERSION_LAST;
}
/**
* cairo_pdf_version_to_string:
* @version: a version id
*
* Get the string representation of the given @version id. This function
* will return %NULL if @version isn't valid. See cairo_pdf_get_versions()
* for a way to get the list of valid version ids.
*
* Return value: the string associated to given version.
*
* Since: 1.10
**/
const char *
cairo_pdf_version_to_string (cairo_pdf_version_t version)
{
if (version >= CAIRO_PDF_VERSION_LAST)
return NULL;
return _cairo_pdf_version_strings[version];
}
/**
* cairo_pdf_surface_set_size:
* @surface: a PDF #cairo_surface_t
* @width_in_points: new surface width, in points (1 point == 1/72.0 inch)
* @height_in_points: new surface height, in points (1 point == 1/72.0 inch)
*
* Changes the size of a PDF surface for the current (and
* subsequent) pages.
*
* This function should only be called before any drawing operations
* have been performed on the current page. The simplest way to do
* this is to call this function immediately after creating the
* surface or immediately after completing a page with either
* cairo_show_page() or cairo_copy_page().
*
* Since: 1.2
**/
void
cairo_pdf_surface_set_size (cairo_surface_t *surface,
double width_in_points,
double height_in_points)
{
cairo_pdf_surface_t *pdf_surface = NULL; /* hide compiler warning */
cairo_status_t status;
if (! _extract_pdf_surface (surface, &pdf_surface))
return;
_cairo_pdf_surface_set_size_internal (pdf_surface,
width_in_points,
height_in_points);
status = _cairo_paginated_surface_set_size (pdf_surface->paginated_surface,
width_in_points,
height_in_points);
if (status)
status = _cairo_surface_set_error (surface, status);
}
/**
* CAIRO_PDF_OUTLINE_ROOT:
*
* The root outline item in cairo_pdf_surface_add_outline().
*
* Since: 1.16
**/
/**
* cairo_pdf_surface_add_outline:
* @surface: a PDF #cairo_surface_t
* @parent_id: the id of the parent item or %CAIRO_PDF_OUTLINE_ROOT if this is a top level item.
* @utf8: the name of the outline
* @link_attribs: the link attributes specifying where this outline links to
* @flags: outline item flags
*
* Add an item to the document outline hierarchy with the name @utf8
* that links to the location specified by @link_attribs. Link
* attributes have the same keys and values as the [Link Tag][link],
* excluding the "rect" attribute. The item will be a child of the
* item with id @parent_id. Use %CAIRO_PDF_OUTLINE_ROOT as the parent
* id of top level items.
*
* Return value: the id for the added item.
*
* Since: 1.16
**/
int
cairo_pdf_surface_add_outline (cairo_surface_t *surface,
int parent_id,
const char *utf8,
const char *link_attribs,
cairo_pdf_outline_flags_t flags)
{
cairo_pdf_surface_t *pdf_surface = NULL; /* hide compiler warning */
cairo_status_t status;
int id = 0;
if (! _extract_pdf_surface (surface, &pdf_surface))
return 0;
status = _cairo_pdf_interchange_add_outline (pdf_surface,
parent_id,
utf8,
link_attribs,
flags,
&id);
if (status)
status = _cairo_surface_set_error (surface, status);
return id;
}
/**
* cairo_pdf_surface_set_metadata:
* @surface: a PDF #cairo_surface_t
* @metadata: The metadata item to set.
* @utf8: metadata value
*
* Set document metadata. The %CAIRO_PDF_METADATA_CREATE_DATE and
* %CAIRO_PDF_METADATA_MOD_DATE values must be in ISO-8601 format:
* YYYY-MM-DDThh:mm:ss. An optional timezone of the form "[+/-]hh:mm"
* or "Z" for UTC time can be appended. All other metadata values can be any UTF-8
* string.
*
* For example:
* <informalexample><programlisting>
* cairo_pdf_surface_set_metadata (surface, CAIRO_PDF_METADATA_TITLE, "My Document");
* cairo_pdf_surface_set_metadata (surface, CAIRO_PDF_METADATA_CREATE_DATE, "2015-12-31T23:59+02:00");
* </programlisting></informalexample>
*
* Since: 1.16
**/
void
cairo_pdf_surface_set_metadata (cairo_surface_t *surface,
cairo_pdf_metadata_t metadata,
const char *utf8)
{
cairo_pdf_surface_t *pdf_surface = NULL; /* hide compiler warning */
cairo_status_t status;
if (! _extract_pdf_surface (surface, &pdf_surface))
return;
status = _cairo_pdf_interchange_set_metadata (pdf_surface, metadata, utf8);
if (status)
status = _cairo_surface_set_error (surface, status);
}
/**
* cairo_pdf_surface_set_page_label:
* @surface: a PDF #cairo_surface_t
* @utf8: The page label.
*
* Set page label for the current page.
*
* Since: 1.16
**/
void
cairo_pdf_surface_set_page_label (cairo_surface_t *surface,
const char *utf8)
{
cairo_pdf_surface_t *pdf_surface = NULL; /* hide compiler warning */
if (! _extract_pdf_surface (surface, &pdf_surface))
return;
free (pdf_surface->current_page_label);
pdf_surface->current_page_label = utf8 ? strdup (utf8) : NULL;
}
/**
* cairo_pdf_surface_set_thumbnail_size:
* @surface: a PDF #cairo_surface_t
* @width: Thumbnail width.
* @height: Thumbnail height
*
* Set the thumbnail image size for the current and all subsequent
* pages. Setting a width or height of 0 disables thumbnails for the
* current and subsequent pages.
*
* Since: 1.16
**/
void
cairo_pdf_surface_set_thumbnail_size (cairo_surface_t *surface,
int width,
int height)
{
cairo_pdf_surface_t *pdf_surface = NULL; /* hide compiler warning */
if (! _extract_pdf_surface (surface, &pdf_surface))
return;
pdf_surface->thumbnail_width = width;
pdf_surface->thumbnail_height = height;
}
static void
_cairo_pdf_surface_clear (cairo_pdf_surface_t *surface)
{
int i, size;
cairo_pdf_pattern_t *pattern;
cairo_pdf_source_surface_t *src_surface;
cairo_pdf_smask_group_t *group;
size = _cairo_array_num_elements (&surface->page_patterns);
for (i = 0; i < size; i++) {
pattern = (cairo_pdf_pattern_t *) _cairo_array_index (&surface->page_patterns, i);
cairo_pattern_destroy (pattern->pattern);
}
_cairo_array_truncate (&surface->page_patterns, 0);
size = _cairo_array_num_elements (&surface->page_surfaces);
for (i = 0; i < size; i++) {
src_surface = (cairo_pdf_source_surface_t *) _cairo_array_index (&surface->page_surfaces, i);
cairo_surface_destroy (src_surface->surface);
}
_cairo_array_truncate (&surface->page_surfaces, 0);
size = _cairo_array_num_elements (&surface->smask_groups);
for (i = 0; i < size; i++) {
_cairo_array_copy_element (&surface->smask_groups, i, &group);
_cairo_pdf_smask_group_destroy (group);
}
_cairo_array_truncate (&surface->smask_groups, 0);
_cairo_array_truncate (&surface->knockout_group, 0);
_cairo_array_truncate (&surface->page_annots, 0);
cairo_surface_destroy (&surface->thumbnail_image->base);
surface->thumbnail_image = NULL;
}
static void
_cairo_pdf_group_resources_init (cairo_pdf_group_resources_t *res)
{
int i;
for (i = 0; i < CAIRO_NUM_OPERATORS; i++)
res->operators[i] = FALSE;
_cairo_array_init (&res->alphas, sizeof (double));
_cairo_array_init (&res->smasks, sizeof (cairo_pdf_resource_t));
_cairo_array_init (&res->patterns, sizeof (cairo_pdf_resource_t));
_cairo_array_init (&res->shadings, sizeof (cairo_pdf_resource_t));
_cairo_array_init (&res->xobjects, sizeof (cairo_pdf_resource_t));
_cairo_array_init (&res->fonts, sizeof (cairo_pdf_font_t));
}
static void
_cairo_pdf_group_resources_fini (cairo_pdf_group_resources_t *res)
{
_cairo_array_fini (&res->alphas);
_cairo_array_fini (&res->smasks);
_cairo_array_fini (&res->patterns);
_cairo_array_fini (&res->shadings);
_cairo_array_fini (&res->xobjects);
_cairo_array_fini (&res->fonts);
}
static void
_cairo_pdf_group_resources_clear (cairo_pdf_group_resources_t *res)
{
int i;
for (i = 0; i < CAIRO_NUM_OPERATORS; i++)
res->operators[i] = FALSE;
_cairo_array_truncate (&res->alphas, 0);
_cairo_array_truncate (&res->smasks, 0);
_cairo_array_truncate (&res->patterns, 0);
_cairo_array_truncate (&res->shadings, 0);
_cairo_array_truncate (&res->xobjects, 0);
_cairo_array_truncate (&res->fonts, 0);
}
static void
_cairo_pdf_surface_add_operator (cairo_pdf_surface_t *surface,
cairo_operator_t op)
{
cairo_pdf_group_resources_t *res = &surface->resources;
res->operators[op] = TRUE;
}
static cairo_int_status_t
_cairo_pdf_surface_add_alpha (cairo_pdf_surface_t *surface,
double alpha,
int *index)
{
int num_alphas, i;
double other;
cairo_int_status_t status;
cairo_pdf_group_resources_t *res = &surface->resources;
num_alphas = _cairo_array_num_elements (&res->alphas);
for (i = 0; i < num_alphas; i++) {
_cairo_array_copy_element (&res->alphas, i, &other);
if (alpha == other) {
*index = i;
return CAIRO_STATUS_SUCCESS;
}
}
status = _cairo_array_append (&res->alphas, &alpha);
if (unlikely (status))
return status;
*index = _cairo_array_num_elements (&res->alphas) - 1;
return CAIRO_STATUS_SUCCESS;
}
static cairo_int_status_t
_cairo_pdf_surface_add_smask (cairo_pdf_surface_t *surface,
cairo_pdf_resource_t smask)
{
return _cairo_array_append (&(surface->resources.smasks), &smask);
}
static cairo_int_status_t
_cairo_pdf_surface_add_pattern (cairo_pdf_surface_t *surface,
cairo_pdf_resource_t pattern)
{
return _cairo_array_append (&(surface->resources.patterns), &pattern);
}
static cairo_int_status_t
_cairo_pdf_surface_add_shading (cairo_pdf_surface_t *surface,
cairo_pdf_resource_t shading)
{
return _cairo_array_append (&(surface->resources.shadings), &shading);
}
static cairo_int_status_t
_cairo_pdf_surface_add_xobject (cairo_pdf_surface_t *surface,
cairo_pdf_resource_t xobject)
{
return _cairo_array_append (&(surface->resources.xobjects), &xobject);
}
static cairo_int_status_t
_cairo_pdf_surface_add_font (unsigned int font_id,
unsigned int subset_id,
void *closure)
{
cairo_pdf_surface_t *surface = closure;
cairo_pdf_font_t font;
int num_fonts, i;
cairo_int_status_t status;
cairo_pdf_group_resources_t *res = &surface->resources;
num_fonts = _cairo_array_num_elements (&res->fonts);
for (i = 0; i < num_fonts; i++) {
_cairo_array_copy_element (&res->fonts, i, &font);
if (font.font_id == font_id &&
font.subset_id == subset_id)
return CAIRO_STATUS_SUCCESS;
}
num_fonts = _cairo_array_num_elements (&surface->fonts);
for (i = 0; i < num_fonts; i++) {
_cairo_array_copy_element (&surface->fonts, i, &font);
if (font.font_id == font_id &&
font.subset_id == subset_id)
return _cairo_array_append (&res->fonts, &font);
}
font.font_id = font_id;
font.subset_id = subset_id;
font.subset_resource = _cairo_pdf_surface_new_object (surface);
if (font.subset_resource.id == 0)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
status = _cairo_array_append (&surface->fonts, &font);
if (unlikely (status))
return status;
return _cairo_array_append (&res->fonts, &font);
}
static cairo_pdf_resource_t
_cairo_pdf_surface_get_font_resource (cairo_pdf_surface_t *surface,
unsigned int font_id,
unsigned int subset_id)
{
cairo_pdf_font_t font;
int num_fonts, i;
num_fonts = _cairo_array_num_elements (&surface->fonts);
for (i = 0; i < num_fonts; i++) {
_cairo_array_copy_element (&surface->fonts, i, &font);
if (font.font_id == font_id && font.subset_id == subset_id)
return font.subset_resource;
}
font.subset_resource.id = 0;
return font.subset_resource;
}
static const char *
_cairo_operator_to_pdf_blend_mode (cairo_operator_t op)
{
switch (op) {
/* The extend blend mode operators */
case CAIRO_OPERATOR_MULTIPLY: return "Multiply";
case CAIRO_OPERATOR_SCREEN: return "Screen";
case CAIRO_OPERATOR_OVERLAY: return "Overlay";
case CAIRO_OPERATOR_DARKEN: return "Darken";
case CAIRO_OPERATOR_LIGHTEN: return "Lighten";
case CAIRO_OPERATOR_COLOR_DODGE: return "ColorDodge";
case CAIRO_OPERATOR_COLOR_BURN: return "ColorBurn";
case CAIRO_OPERATOR_HARD_LIGHT: return "HardLight";
case CAIRO_OPERATOR_SOFT_LIGHT: return "SoftLight";
case CAIRO_OPERATOR_DIFFERENCE: return "Difference";
case CAIRO_OPERATOR_EXCLUSION: return "Exclusion";
case CAIRO_OPERATOR_HSL_HUE: return "Hue";
case CAIRO_OPERATOR_HSL_SATURATION: return "Saturation";
case CAIRO_OPERATOR_HSL_COLOR: return "Color";
case CAIRO_OPERATOR_HSL_LUMINOSITY: return "Luminosity";
default:
/* The original Porter-Duff set */
case CAIRO_OPERATOR_CLEAR:
case CAIRO_OPERATOR_SOURCE:
case CAIRO_OPERATOR_OVER:
case CAIRO_OPERATOR_IN:
case CAIRO_OPERATOR_OUT:
case CAIRO_OPERATOR_ATOP:
case CAIRO_OPERATOR_DEST:
case CAIRO_OPERATOR_DEST_OVER:
case CAIRO_OPERATOR_DEST_IN:
case CAIRO_OPERATOR_DEST_OUT:
case CAIRO_OPERATOR_DEST_ATOP:
case CAIRO_OPERATOR_XOR:
case CAIRO_OPERATOR_ADD:
case CAIRO_OPERATOR_SATURATE:
return "Normal";
}
}
static void
_cairo_pdf_surface_emit_group_resources (cairo_pdf_surface_t *surface,
cairo_pdf_group_resources_t *res)
{
int num_alphas, num_smasks, num_resources, i;
double alpha;
cairo_pdf_resource_t *smask, *pattern, *shading, *xobject;
cairo_pdf_font_t *font;
_cairo_output_stream_printf (surface->output, "<<\n");
num_alphas = _cairo_array_num_elements (&res->alphas);
num_smasks = _cairo_array_num_elements (&res->smasks);
if (num_alphas > 0 || num_smasks > 0) {
_cairo_output_stream_printf (surface->output,
" /ExtGState <<\n");
for (i = 0; i < CAIRO_NUM_OPERATORS; i++) {
if (res->operators[i]) {
_cairo_output_stream_printf (surface->output,
" /b%d << /BM /%s >>\n",
i, _cairo_operator_to_pdf_blend_mode(i));
}
}
for (i = 0; i < num_alphas; i++) {
_cairo_array_copy_element (&res->alphas, i, &alpha);
_cairo_output_stream_printf (surface->output,
" /a%d << /CA %f /ca %f >>\n",
i, alpha, alpha);
}
for (i = 0; i < num_smasks; i++) {
smask = _cairo_array_index (&res->smasks, i);
_cairo_output_stream_printf (surface->output,
" /s%d %d 0 R\n",
smask->id, smask->id);
}
_cairo_output_stream_printf (surface->output,
" >>\n");
}
num_resources = _cairo_array_num_elements (&res->patterns);
if (num_resources > 0) {
_cairo_output_stream_printf (surface->output,
" /Pattern <<");
for (i = 0; i < num_resources; i++) {
pattern = _cairo_array_index (&res->patterns, i);
_cairo_output_stream_printf (surface->output,
" /p%d %d 0 R",
pattern->id, pattern->id);
}
_cairo_output_stream_printf (surface->output,
" >>\n");
}
num_resources = _cairo_array_num_elements (&res->shadings);
if (num_resources > 0) {
_cairo_output_stream_printf (surface->output,
" /Shading <<");
for (i = 0; i < num_resources; i++) {
shading = _cairo_array_index (&res->shadings, i);
_cairo_output_stream_printf (surface->output,
" /sh%d %d 0 R",
shading->id, shading->id);
}
_cairo_output_stream_printf (surface->output,
" >>\n");
}
num_resources = _cairo_array_num_elements (&res->xobjects);
if (num_resources > 0) {
_cairo_output_stream_printf (surface->output,
" /XObject <<");
for (i = 0; i < num_resources; i++) {
xobject = _cairo_array_index (&res->xobjects, i);
_cairo_output_stream_printf (surface->output,
" /x%d %d 0 R",
xobject->id, xobject->id);
}
_cairo_output_stream_printf (surface->output,
" >>\n");
}
num_resources = _cairo_array_num_elements (&res->fonts);
if (num_resources > 0) {
_cairo_output_stream_printf (surface->output," /Font <<\n");
for (i = 0; i < num_resources; i++) {
font = _cairo_array_index (&res->fonts, i);
_cairo_output_stream_printf (surface->output,
" /f-%d-%d %d 0 R\n",
font->font_id,
font->subset_id,
font->subset_resource.id);
}
_cairo_output_stream_printf (surface->output, " >>\n");
}
_cairo_output_stream_printf (surface->output,
">>\n");
}
static cairo_pdf_smask_group_t *
_cairo_pdf_surface_create_smask_group (cairo_pdf_surface_t *surface,
const cairo_rectangle_int_t *extents)
{
cairo_pdf_smask_group_t *group;
group = calloc (1, sizeof (cairo_pdf_smask_group_t));
if (unlikely (group == NULL)) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return NULL;
}
group->group_res = _cairo_pdf_surface_new_object (surface);
if (group->group_res.id == 0) {
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
free (group);
return NULL;
}
group->width = surface->width;
group->height = surface->height;
if (extents != NULL) {
group->extents = *extents;
} else {
group->extents.x = 0;
group->extents.y = 0;
group->extents.width = surface->width;
group->extents.height = surface->height;
}
return group;
}
static void
_cairo_pdf_smask_group_destroy (cairo_pdf_smask_group_t *group)
{
if (group->operation == PDF_FILL || group->operation == PDF_STROKE)
_cairo_path_fixed_fini (&group->path);
if (group->source)
cairo_pattern_destroy (group->source);
if (group->mask)
cairo_pattern_destroy (group->mask);
free (group->utf8);
free (group->glyphs);
free (group->clusters);
if (group->scaled_font)
cairo_scaled_font_destroy (group->scaled_font);
free (group);
}
static cairo_int_status_t
_cairo_pdf_surface_add_smask_group (cairo_pdf_surface_t *surface,
cairo_pdf_smask_group_t *group)
{
return _cairo_array_append (&surface->smask_groups, &group);
}
static cairo_bool_t
_cairo_pdf_source_surface_equal (const void *key_a, const void *key_b)
{
const cairo_pdf_source_surface_entry_t *a = key_a;
const cairo_pdf_source_surface_entry_t *b = key_b;
if (a->interpolate != b->interpolate)
return FALSE;
if (a->unique_id && b->unique_id && a->unique_id_length == b->unique_id_length)
return (memcmp (a->unique_id, b->unique_id, a->unique_id_length) == 0);
return (a->id == b->id);
}
static void
_cairo_pdf_source_surface_init_key (cairo_pdf_source_surface_entry_t *key)
{
if (key->unique_id && key->unique_id_length > 0) {
key->base.hash = _cairo_hash_bytes (_CAIRO_HASH_INIT_VALUE,
key->unique_id, key->unique_id_length);
} else {
key->base.hash = key->id;
}
}
static cairo_int_status_t
_cairo_pdf_surface_acquire_source_image_from_pattern (cairo_pdf_surface_t *surface,
const cairo_pattern_t *pattern,
cairo_image_surface_t **image,
void **image_extra)
{
switch (pattern->type) {
case CAIRO_PATTERN_TYPE_SURFACE: {
cairo_surface_pattern_t *surf_pat = (cairo_surface_pattern_t *) pattern;
return _cairo_surface_acquire_source_image (surf_pat->surface, image, image_extra);
} break;
case CAIRO_PATTERN_TYPE_RASTER_SOURCE: {
cairo_surface_t *surf;
surf = _cairo_raster_source_pattern_acquire (pattern, &surface->base, NULL);
if (!surf)
return CAIRO_INT_STATUS_UNSUPPORTED;
assert (_cairo_surface_is_image (surf));
*image = (cairo_image_surface_t *) surf;
} break;
case CAIRO_PATTERN_TYPE_SOLID:
case CAIRO_PATTERN_TYPE_LINEAR:
case CAIRO_PATTERN_TYPE_RADIAL:
case CAIRO_PATTERN_TYPE_MESH:
default:
ASSERT_NOT_REACHED;
break;
}
return CAIRO_STATUS_SUCCESS;
}
static void
_cairo_pdf_surface_release_source_image_from_pattern (cairo_pdf_surface_t *surface,
const cairo_pattern_t *pattern,
cairo_image_surface_t *image,
void *image_extra)
{
switch (pattern->type) {
case CAIRO_PATTERN_TYPE_SURFACE: {
cairo_surface_pattern_t *surf_pat = (cairo_surface_pattern_t *) pattern;
_cairo_surface_release_source_image (surf_pat->surface, image, image_extra);
} break;
case CAIRO_PATTERN_TYPE_RASTER_SOURCE:
_cairo_raster_source_pattern_release (pattern, &image->base);
break;
case CAIRO_PATTERN_TYPE_SOLID:
case CAIRO_PATTERN_TYPE_LINEAR:
case CAIRO_PATTERN_TYPE_RADIAL:
case CAIRO_PATTERN_TYPE_MESH:
default:
ASSERT_NOT_REACHED;
break;
}
}
static cairo_int_status_t
_get_source_surface_extents (cairo_surface_t *source,
cairo_rectangle_int_t *extents,
cairo_bool_t *bounded,
cairo_bool_t *subsurface)
{
cairo_int_status_t status;
*bounded = TRUE;
*subsurface = FALSE;
if (source->type == CAIRO_SURFACE_TYPE_RECORDING) {
cairo_surface_t *free_me = NULL;
if (_cairo_surface_is_snapshot (source))
free_me = source = _cairo_surface_snapshot_get_target (source);
if (source->backend->type == CAIRO_SURFACE_TYPE_SUBSURFACE) {
cairo_surface_subsurface_t *sub = (cairo_surface_subsurface_t *) source;
*extents = sub->extents;
*subsurface = TRUE;
} else {
cairo_box_t box;
*bounded = _cairo_surface_get_extents (source, extents);
if (! *bounded) {
status = _cairo_recording_surface_get_ink_bbox ((cairo_recording_surface_t *)source,
&box, NULL);
if (unlikely (status)) {
cairo_surface_destroy (free_me);
return status;
}
_cairo_box_round_to_rectangle (&box, extents);
}
}
cairo_surface_destroy (free_me);
} else {
*bounded = _cairo_surface_get_extents (source, extents);
}
return CAIRO_STATUS_SUCCESS;
}
/**
* _cairo_pdf_surface_add_source_surface:
* @surface: [in] the pdf surface
* @source_surface: [in] A #cairo_surface_t to use as the source surface
* @source_pattern: [in] A #cairo_pattern_t of type SURFACE or RASTER_SOURCE to use as the source
* @op: [in] the operator used to composite this source
* @filter: [in] filter type of the source pattern
* @stencil_mask: [in] if true, the surface will be written to the PDF as an /ImageMask
* @smask: [in] if true, only the alpha channel will be written (images only)
* @need_transp_group: [in] if true and an XObject is used, make it a Transparency group
* @extents: [in] extents of the operation that is using this source
* @smask_res: [in] if not NULL, the image written will specify this resource as the smask for
* the image (images only)
* @pdf_source: [out] return pdf_source_surface entry in hash table
* @x_offset: [out] if not NULL return x offset of surface
* @y_offset: [out] if not NULL return y offset of surface
* @source_extents: [out] if not NULL return operation extents in source space
*
* Add surface or raster_source pattern to list of surfaces to be
* written to the PDF file when the current page is finished. Returns
* a PDF resource to reference the surface. A hash table of all
* surfaces in the PDF file (keyed by CAIRO_MIME_TYPE_UNIQUE_ID or
* surface unique_id) is used to ensure surfaces with the same id are
* only written once to the PDF file.
*
* Only one of @source_pattern or @source_surface is to be
* specified. Set the other to NULL.
**/
static cairo_int_status_t
_cairo_pdf_surface_add_source_surface (cairo_pdf_surface_t *surface,
cairo_surface_t *source_surface,
const cairo_pattern_t *source_pattern,
cairo_operator_t op,
cairo_filter_t filter,
cairo_bool_t stencil_mask,
cairo_bool_t smask,
cairo_bool_t need_transp_group,
const cairo_rectangle_int_t *extents,
cairo_pdf_resource_t *smask_res,
cairo_pdf_source_surface_entry_t **pdf_source,
double *x_offset,
double *y_offset,
cairo_rectangle_int_t *source_extents)
{
cairo_pdf_source_surface_t src_surface;
cairo_pdf_source_surface_entry_t surface_key;
cairo_pdf_source_surface_entry_t *surface_entry;
cairo_int_status_t status = CAIRO_STATUS_SUCCESS;
cairo_bool_t interpolate;
unsigned char *unique_id = NULL;
unsigned long unique_id_length = 0;
cairo_image_surface_t *image;
void *image_extra;
cairo_box_t box;
cairo_rectangle_int_t op_extents;
double x, y;
cairo_bool_t subsurface;
switch (filter) {
default:
case CAIRO_FILTER_GOOD:
case CAIRO_FILTER_BEST:
case CAIRO_FILTER_BILINEAR:
interpolate = TRUE;
break;
case CAIRO_FILTER_FAST:
case CAIRO_FILTER_NEAREST:
case CAIRO_FILTER_GAUSSIAN:
interpolate = FALSE;
break;
}
x = 0;
y = 0;
if (source_pattern) {
if (source_pattern->type == CAIRO_PATTERN_TYPE_RASTER_SOURCE) {
status = _cairo_pdf_surface_acquire_source_image_from_pattern (surface, source_pattern,
&image, &image_extra);
if (unlikely (status))
return status;
source_surface = &image->base;
cairo_surface_get_device_offset (source_surface, &x, &y);
} else {
cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *) source_pattern;
source_surface = surface_pattern->surface;
}
}
if (x_offset)
*x_offset = x;
if (y_offset)
*y_offset = y;
/* transform operation extents to pattern space */
op_extents = *extents;
if (source_pattern)
{
_cairo_box_from_rectangle (&box, extents);
_cairo_matrix_transform_bounding_box_fixed (&source_pattern->matrix, &box, NULL);
_cairo_box_round_to_rectangle (&box, &op_extents);
}
if (source_extents)
*source_extents = op_extents;
surface_key.id = source_surface->unique_id;
surface_key.interpolate = interpolate;
cairo_surface_get_mime_data (source_surface, CAIRO_MIME_TYPE_UNIQUE_ID,
(const unsigned char **) &surface_key.unique_id,
&surface_key.unique_id_length);
_cairo_pdf_source_surface_init_key (&surface_key);
surface_entry = _cairo_hash_table_lookup (surface->all_surfaces, &surface_key.base);
if (surface_entry) {
if (pdf_source)
*pdf_source = surface_entry;
if (source_pattern && source_pattern->extend != CAIRO_EXTEND_NONE)
_cairo_unbounded_rectangle_init (&op_extents);
_cairo_rectangle_intersect (&op_extents, &surface_entry->extents);
_cairo_rectangle_union (&surface_entry->required_extents, &op_extents);
status = CAIRO_STATUS_SUCCESS;
}
if (status || surface_entry) {
if (source_pattern && source_pattern->type == CAIRO_PATTERN_TYPE_RASTER_SOURCE)
_cairo_pdf_surface_release_source_image_from_pattern (surface, source_pattern, image, image_extra);
return status;
}
if (surface_key.unique_id && surface_key.unique_id_length > 0) {
unique_id = _cairo_malloc (surface_key.unique_id_length);
if (unique_id == NULL) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto fail1;
}
unique_id_length = surface_key.unique_id_length;
memcpy (unique_id, surface_key.unique_id, unique_id_length);
} else {
unique_id = NULL;
unique_id_length = 0;
}
surface_entry = _cairo_malloc (sizeof (cairo_pdf_source_surface_entry_t));
if (surface_entry == NULL) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto fail1;
}
if (pdf_source)
*pdf_source = surface_entry;
surface_entry->id = surface_key.id;
surface_entry->operator = op;
surface_entry->interpolate = interpolate;
surface_entry->stencil_mask = stencil_mask;
surface_entry->smask = smask;
surface_entry->need_transp_group = need_transp_group;
surface_entry->unique_id_length = unique_id_length;
surface_entry->unique_id = unique_id;
if (smask_res)
surface_entry->smask_res = *smask_res;
else
surface_entry->smask_res.id = 0;
status = _get_source_surface_extents (source_surface,
&surface_entry->extents,
&surface_entry->bounded,
&subsurface);
if (unlikely (status))
goto fail2;
if (subsurface) {
*x_offset = -surface_entry->extents.x;
*y_offset = -surface_entry->extents.y;
}
if (source_pattern && source_pattern->extend != CAIRO_EXTEND_NONE)
_cairo_unbounded_rectangle_init (&op_extents);
_cairo_rectangle_intersect (&op_extents, &surface_entry->extents);
surface_entry->required_extents = op_extents;
_cairo_pdf_source_surface_init_key (surface_entry);
src_surface.hash_entry = surface_entry;
if (source_pattern && source_pattern->type == CAIRO_PATTERN_TYPE_RASTER_SOURCE) {
src_surface.type = CAIRO_PATTERN_TYPE_RASTER_SOURCE;
src_surface.surface = NULL;
status = _cairo_pattern_create_copy (&src_surface.raster_pattern, source_pattern);
if (unlikely (status))
goto fail2;
} else {
src_surface.type = CAIRO_PATTERN_TYPE_SURFACE;
src_surface.surface = cairo_surface_reference (source_surface);
src_surface.raster_pattern = NULL;
}
surface_entry->surface_res = _cairo_pdf_surface_new_object (surface);
if (surface_entry->surface_res.id == 0) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto fail3;
}
/* Test if surface will be emitted as image or recording */
status = _cairo_pdf_surface_emit_surface (surface, &src_surface, TRUE, &surface_entry->emit_image);
if (unlikely (status))
goto fail3;
if (surface_entry->bounded) {
status = _cairo_array_append (&surface->page_surfaces, &src_surface);
if (unlikely (status))
goto fail3;
} else {
status = _cairo_array_append (&surface->doc_surfaces, &src_surface);
if (unlikely (status))
goto fail3;
}
status = _cairo_hash_table_insert (surface->all_surfaces,
&surface_entry->base);
if (unlikely(status))
goto fail3;
if (source_pattern && source_pattern->type == CAIRO_PATTERN_TYPE_RASTER_SOURCE)
_cairo_pdf_surface_release_source_image_from_pattern (surface, source_pattern, image, image_extra);
return CAIRO_STATUS_SUCCESS;
fail3:
if (source_pattern && source_pattern->type == CAIRO_PATTERN_TYPE_RASTER_SOURCE)
cairo_pattern_destroy (src_surface.raster_pattern);
else
cairo_surface_destroy (src_surface.surface);
fail2:
free (surface_entry);
fail1:
if (unique_id)
free (unique_id);
if (source_pattern && source_pattern->type == CAIRO_PATTERN_TYPE_RASTER_SOURCE)
_cairo_pdf_surface_release_source_image_from_pattern (surface, source_pattern, image, image_extra);
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_add_pdf_pattern_or_shading (cairo_pdf_surface_t *surface,
const cairo_pattern_t *pattern,
cairo_operator_t op,
const cairo_rectangle_int_t *extents,
cairo_bool_t is_shading,
cairo_pdf_resource_t *pattern_res,
cairo_pdf_resource_t *gstate_res)
{
cairo_pdf_pattern_t pdf_pattern;
cairo_int_status_t status;
pdf_pattern.is_shading = is_shading;
pdf_pattern.operator = op;
/* Solid colors are emitted into the content stream */
if (pattern->type == CAIRO_PATTERN_TYPE_SOLID) {
pattern_res->id = 0;
gstate_res->id = 0;
return CAIRO_INT_STATUS_SUCCESS;
}
status = _cairo_pattern_create_copy (&pdf_pattern.pattern, pattern);
if (unlikely (status))
return status;
pdf_pattern.pattern_res = _cairo_pdf_surface_new_object (surface);
if (pdf_pattern.pattern_res.id == 0) {
cairo_pattern_destroy (pdf_pattern.pattern);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
pdf_pattern.gstate_res.id = 0;
/* gradient patterns require an smask object to implement transparency */
if (pattern->type == CAIRO_PATTERN_TYPE_LINEAR ||
pattern->type == CAIRO_PATTERN_TYPE_RADIAL ||
pattern->type == CAIRO_PATTERN_TYPE_MESH)
{
double min_alpha;
_cairo_pattern_alpha_range (pattern, &min_alpha, NULL);
if (! CAIRO_ALPHA_IS_OPAQUE (min_alpha)) {
pdf_pattern.gstate_res = _cairo_pdf_surface_new_object (surface);
if (pdf_pattern.gstate_res.id == 0) {
cairo_pattern_destroy (pdf_pattern.pattern);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
}
}
pdf_pattern.width = surface->width;
pdf_pattern.height = surface->height;
if (extents != NULL) {
pdf_pattern.extents = *extents;
} else {
pdf_pattern.extents.x = 0;
pdf_pattern.extents.y = 0;
pdf_pattern.extents.width = surface->width;
pdf_pattern.extents.height = surface->height;
}
*pattern_res = pdf_pattern.pattern_res;
*gstate_res = pdf_pattern.gstate_res;
/* If the pattern requires a gstate it will be drawn from within
* an XObject. The initial space of each XObject has an inverted
* Y-axis. */
pdf_pattern.inverted_y_axis = pdf_pattern.gstate_res.id ? TRUE : surface->in_xobject;
status = _cairo_array_append (&surface->page_patterns, &pdf_pattern);
if (unlikely (status)) {
cairo_pattern_destroy (pdf_pattern.pattern);
return status;
}
return CAIRO_INT_STATUS_SUCCESS;
}
/* Get BBox from extents */
static void
_get_bbox_from_extents (const cairo_rectangle_int_t *extents,
cairo_box_double_t *bbox)
{
bbox->p1.x = extents->x;
bbox->p1.y = extents->y;
bbox->p2.x = extents->x + extents->width;
bbox->p2.y = extents->y + extents->height;
}
static cairo_int_status_t
_cairo_pdf_surface_add_pdf_shading (cairo_pdf_surface_t *surface,
const cairo_pattern_t *pattern,
cairo_operator_t op,
const cairo_rectangle_int_t *extents,
cairo_pdf_resource_t *shading_res,
cairo_pdf_resource_t *gstate_res)
{
return _cairo_pdf_surface_add_pdf_pattern_or_shading (surface,
pattern,
op,
extents,
TRUE,
shading_res,
gstate_res);
}
static cairo_int_status_t
_cairo_pdf_surface_add_pdf_pattern (cairo_pdf_surface_t *surface,
const cairo_pattern_t *pattern,
cairo_operator_t op,
const cairo_rectangle_int_t *extents,
cairo_pdf_resource_t *pattern_res,
cairo_pdf_resource_t *gstate_res)
{
return _cairo_pdf_surface_add_pdf_pattern_or_shading (surface,
pattern,
op,
extents,
FALSE,
pattern_res,
gstate_res);
}
static cairo_int_status_t
_cairo_pdf_surface_open_stream (cairo_pdf_surface_t *surface,
cairo_pdf_resource_t *resource,
cairo_bool_t compressed,
const char *fmt,
...)
{
va_list ap;
cairo_pdf_resource_t self, length;
cairo_output_stream_t *output = NULL;
if (resource) {
self = *resource;
_cairo_pdf_surface_update_object (surface, self);
} else {
self = _cairo_pdf_surface_new_object (surface);
if (self.id == 0)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
length = _cairo_pdf_surface_new_object (surface);
if (length.id == 0)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
if (compressed) {
output = _cairo_deflate_stream_create (surface->output);
if (_cairo_output_stream_get_status (output))
return _cairo_output_stream_destroy (output);
}
surface->pdf_stream.active = TRUE;
surface->pdf_stream.self = self;
surface->pdf_stream.length = length;
surface->pdf_stream.compressed = compressed;
surface->current_pattern_is_solid_color = FALSE;
surface->current_operator = CAIRO_OPERATOR_OVER;
_cairo_pdf_operators_reset (&surface->pdf_operators);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Length %d 0 R\n",
surface->pdf_stream.self.id,
surface->pdf_stream.length.id);
if (compressed)
_cairo_output_stream_printf (surface->output,
" /Filter /FlateDecode\n");
if (fmt != NULL) {
va_start (ap, fmt);
_cairo_output_stream_vprintf (surface->output, fmt, ap);
va_end (ap);
}
_cairo_output_stream_printf (surface->output,
">>\n"
"stream\n");
surface->pdf_stream.start_offset = _cairo_output_stream_get_position (surface->output);
if (compressed) {
assert (surface->pdf_stream.old_output == NULL);
surface->pdf_stream.old_output = surface->output;
surface->output = output;
_cairo_pdf_operators_set_stream (&surface->pdf_operators, surface->output);
}
_cairo_pdf_operators_reset (&surface->pdf_operators);
return _cairo_output_stream_get_status (surface->output);
}
static cairo_int_status_t
_cairo_pdf_surface_close_stream (cairo_pdf_surface_t *surface)
{
cairo_int_status_t status;
long length;
if (! surface->pdf_stream.active)
return CAIRO_INT_STATUS_SUCCESS;
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (surface->pdf_stream.compressed) {
cairo_int_status_t status2;
status2 = _cairo_output_stream_destroy (surface->output);
if (likely (status == CAIRO_INT_STATUS_SUCCESS))
status = status2;
surface->output = surface->pdf_stream.old_output;
_cairo_pdf_operators_set_stream (&surface->pdf_operators, surface->output);
surface->pdf_stream.old_output = NULL;
}
length = _cairo_output_stream_get_position (surface->output) -
surface->pdf_stream.start_offset;
_cairo_output_stream_printf (surface->output,
"\n"
"endstream\n"
"endobj\n");
_cairo_pdf_surface_update_object (surface,
surface->pdf_stream.length);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
" %ld\n"
"endobj\n",
surface->pdf_stream.length.id,
length);
surface->pdf_stream.active = FALSE;
if (likely (status == CAIRO_INT_STATUS_SUCCESS))
status = _cairo_output_stream_get_status (surface->output);
return status;
}
static void
_cairo_pdf_surface_write_memory_stream (cairo_pdf_surface_t *surface,
cairo_output_stream_t *mem_stream,
cairo_pdf_resource_t resource,
cairo_pdf_group_resources_t *resources,
cairo_bool_t is_knockout_group,
const cairo_box_double_t *bbox)
{
_cairo_pdf_surface_update_object (surface, resource);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /XObject\n"
" /Length %d\n",
resource.id,
_cairo_memory_stream_length (mem_stream));
if (surface->compress_content) {
_cairo_output_stream_printf (surface->output,
" /Filter /FlateDecode\n");
}
_cairo_output_stream_printf (surface->output,
" /Subtype /Form\n"
" /BBox [ %f %f %f %f ]\n"
" /Group <<\n"
" /Type /Group\n"
" /S /Transparency\n"
" /I true\n"
" /CS /DeviceRGB\n",
bbox->p1.x, bbox->p1.y, bbox->p2.x, bbox->p2.y);
if (is_knockout_group)
_cairo_output_stream_printf (surface->output,
" /K true\n");
_cairo_output_stream_printf (surface->output,
" >>\n"
" /Resources\n");
_cairo_pdf_surface_emit_group_resources (surface, resources);
_cairo_output_stream_printf (surface->output,
">>\n"
"stream\n");
_cairo_memory_stream_copy (mem_stream, surface->output);
_cairo_output_stream_printf (surface->output,
"endstream\n"
"endobj\n");
}
static cairo_int_status_t
_cairo_pdf_surface_open_group (cairo_pdf_surface_t *surface,
const cairo_box_double_t *bbox,
cairo_pdf_resource_t *resource)
{
cairo_int_status_t status;
assert (surface->pdf_stream.active == FALSE);
assert (surface->group_stream.active == FALSE);
surface->group_stream.active = TRUE;
surface->current_pattern_is_solid_color = FALSE;
surface->current_operator = CAIRO_OPERATOR_OVER;
_cairo_pdf_operators_reset (&surface->pdf_operators);
surface->group_stream.mem_stream = _cairo_memory_stream_create ();
if (surface->compress_content) {
surface->group_stream.stream =
_cairo_deflate_stream_create (surface->group_stream.mem_stream);
} else {
surface->group_stream.stream = surface->group_stream.mem_stream;
}
status = _cairo_output_stream_get_status (surface->group_stream.stream);
surface->group_stream.old_output = surface->output;
surface->output = surface->group_stream.stream;
_cairo_pdf_operators_set_stream (&surface->pdf_operators, surface->output);
_cairo_pdf_group_resources_clear (&surface->resources);
if (resource) {
surface->group_stream.resource = *resource;
} else {
surface->group_stream.resource = _cairo_pdf_surface_new_object (surface);
if (surface->group_stream.resource.id == 0)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
surface->group_stream.is_knockout = FALSE;
surface->group_stream.bbox = *bbox;
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_open_knockout_group (cairo_pdf_surface_t *surface,
const cairo_box_double_t *bbox)
{
cairo_int_status_t status;
status = _cairo_pdf_surface_open_group (surface, bbox, NULL);
if (unlikely (status))
return status;
surface->group_stream.is_knockout = TRUE;
return CAIRO_INT_STATUS_SUCCESS;
}
static cairo_int_status_t
_cairo_pdf_surface_close_group (cairo_pdf_surface_t *surface,
cairo_pdf_resource_t *group)
{
cairo_int_status_t status = CAIRO_INT_STATUS_SUCCESS, status2;
assert (surface->pdf_stream.active == FALSE);
assert (surface->group_stream.active == TRUE);
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (unlikely (status))
return status;
if (surface->compress_content) {
status = _cairo_output_stream_destroy (surface->group_stream.stream);
surface->group_stream.stream = NULL;
_cairo_output_stream_printf (surface->group_stream.mem_stream,
"\n");
}
surface->output = surface->group_stream.old_output;
_cairo_pdf_operators_set_stream (&surface->pdf_operators, surface->output);
surface->group_stream.active = FALSE;
_cairo_pdf_surface_write_memory_stream (surface,
surface->group_stream.mem_stream,
surface->group_stream.resource,
&surface->resources,
surface->group_stream.is_knockout,
&surface->group_stream.bbox);
if (group)
*group = surface->group_stream.resource;
status2 = _cairo_output_stream_destroy (surface->group_stream.mem_stream);
if (status == CAIRO_INT_STATUS_SUCCESS)
status = status2;
surface->group_stream.mem_stream = NULL;
surface->group_stream.stream = NULL;
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_open_content_stream (cairo_pdf_surface_t *surface,
const cairo_box_double_t *bbox,
cairo_pdf_resource_t *resource,
cairo_bool_t is_form,
cairo_bool_t is_group)
{
cairo_int_status_t status;
assert (surface->pdf_stream.active == FALSE);
assert (surface->group_stream.active == FALSE);
surface->content_resources = _cairo_pdf_surface_new_object (surface);
if (surface->content_resources.id == 0)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
if (is_form) {
assert (bbox != NULL);
if (is_group) {
status =
_cairo_pdf_surface_open_stream (surface,
resource,
surface->compress_content,
" /Type /XObject\n"
" /Subtype /Form\n"
" /BBox [ %f %f %f %f ]\n"
" /Group <<\n"
" /Type /Group\n"
" /S /Transparency\n"
" /I true\n"
" /CS /DeviceRGB\n"
" >>\n"
" /Resources %d 0 R\n",
bbox->p1.x,
bbox->p1.y,
bbox->p2.x,
bbox->p2.y,
surface->content_resources.id);
} else {
status =
_cairo_pdf_surface_open_stream (surface,
resource,
surface->compress_content,
" /Type /XObject\n"
" /Subtype /Form\n"
" /BBox [ %f %f %f %f ]\n"
" /Resources %d 0 R\n",
bbox->p1.x,
bbox->p1.y,
bbox->p2.x,
bbox->p2.y,
surface->content_resources.id);
}
} else {
status =
_cairo_pdf_surface_open_stream (surface,
resource,
surface->compress_content,
NULL);
_cairo_output_stream_printf (surface->output,
"1 0 0 -1 0 %f cm\n",
surface->height);
}
if (unlikely (status))
return status;
surface->content = surface->pdf_stream.self;
_cairo_output_stream_printf (surface->output, "q\n");
_cairo_pdf_operators_reset (&surface->pdf_operators);
return _cairo_output_stream_get_status (surface->output);
}
static cairo_int_status_t
_cairo_pdf_surface_close_content_stream (cairo_pdf_surface_t *surface)
{
cairo_int_status_t status;
assert (surface->pdf_stream.active == TRUE);
assert (surface->group_stream.active == FALSE);
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output, "Q\n");
status = _cairo_pdf_surface_close_stream (surface);
if (unlikely (status))
return status;
_cairo_pdf_surface_update_object (surface, surface->content_resources);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n",
surface->content_resources.id);
_cairo_pdf_surface_emit_group_resources (surface, &surface->resources);
_cairo_output_stream_printf (surface->output,
"endobj\n");
return _cairo_output_stream_get_status (surface->output);
}
static void
_cairo_pdf_source_surface_entry_pluck (void *entry, void *closure)
{
cairo_pdf_source_surface_entry_t *surface_entry = entry;
cairo_hash_table_t *patterns = closure;
_cairo_hash_table_remove (patterns, &surface_entry->base);
free (surface_entry->unique_id);
free (surface_entry);
}
static cairo_status_t
_cairo_pdf_surface_finish (void *abstract_surface)
{
cairo_pdf_surface_t *surface = abstract_surface;
long offset;
cairo_pdf_resource_t catalog;
cairo_status_t status, status2;
int size, i;
cairo_pdf_source_surface_t doc_surface;
cairo_pdf_jbig2_global_t *global;
char *label;
_cairo_pdf_surface_clear (surface);
/* Emit unbounded surfaces */
_cairo_pdf_surface_write_patterns_and_smask_groups (surface, TRUE);
status = surface->base.status;
if (status == CAIRO_STATUS_SUCCESS)
status = _cairo_pdf_surface_emit_font_subsets (surface);
_cairo_pdf_surface_write_pages (surface);
status = _cairo_pdf_interchange_write_document_objects (surface);
if (unlikely (status))
return status;
catalog = _cairo_pdf_surface_write_catalog (surface);
if (catalog.id == 0 && status == CAIRO_STATUS_SUCCESS)
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
offset = _cairo_pdf_surface_write_xref (surface);
_cairo_output_stream_printf (surface->output,
"trailer\n"
"<< /Size %d\n"
" /Root %d 0 R\n"
" /Info %d 0 R\n"
">>\n",
surface->next_available_resource.id,
catalog.id,
surface->docinfo_res.id);
_cairo_output_stream_printf (surface->output,
"startxref\n"
"%ld\n"
"%%%%EOF\n",
offset);
/* pdf_operators has already been flushed when the last stream was
* closed so we should never be writing anything here - however,
* the stream may itself be in an error state. */
status2 = _cairo_pdf_operators_fini (&surface->pdf_operators);
if (status == CAIRO_STATUS_SUCCESS)
status = status2;
/* close any active streams still open due to fatal errors */
status2 = _cairo_pdf_surface_close_stream (surface);
if (status == CAIRO_STATUS_SUCCESS)
status = status2;
if (surface->group_stream.stream != NULL) {
status2 = _cairo_output_stream_destroy (surface->group_stream.stream);
if (status == CAIRO_STATUS_SUCCESS)
status = status2;
}
if (surface->group_stream.mem_stream != NULL) {
status2 = _cairo_output_stream_destroy (surface->group_stream.mem_stream);
if (status == CAIRO_STATUS_SUCCESS)
status = status2;
}
if (surface->pdf_stream.active)
surface->output = surface->pdf_stream.old_output;
if (surface->group_stream.active)
surface->output = surface->group_stream.old_output;
/* and finish the pdf surface */
status2 = _cairo_output_stream_destroy (surface->output);
if (status == CAIRO_STATUS_SUCCESS)
status = status2;
_cairo_pdf_group_resources_fini (&surface->resources);
_cairo_array_fini (&surface->objects);
_cairo_array_fini (&surface->pages);
_cairo_array_fini (&surface->rgb_linear_functions);
_cairo_array_fini (&surface->alpha_linear_functions);
_cairo_array_fini (&surface->page_patterns);
_cairo_array_fini (&surface->page_surfaces);
size = _cairo_array_num_elements (&surface->doc_surfaces);
for (i = 0; i < size; i++) {
_cairo_array_copy_element (&surface->doc_surfaces, i, &doc_surface);
cairo_surface_destroy (doc_surface.surface);
}
_cairo_array_fini (&surface->doc_surfaces);
_cairo_hash_table_foreach (surface->all_surfaces,
_cairo_pdf_source_surface_entry_pluck,
surface->all_surfaces);
_cairo_hash_table_destroy (surface->all_surfaces);
_cairo_array_fini (&surface->smask_groups);
_cairo_array_fini (&surface->fonts);
_cairo_array_fini (&surface->knockout_group);
_cairo_array_fini (&surface->page_annots);
if (surface->font_subsets) {
_cairo_scaled_font_subsets_destroy (surface->font_subsets);
surface->font_subsets = NULL;
}
size = _cairo_array_num_elements (&surface->jbig2_global);
for (i = 0; i < size; i++) {
global = (cairo_pdf_jbig2_global_t *) _cairo_array_index (&surface->jbig2_global, i);
free(global->id);
if (!global->emitted)
return _cairo_error (CAIRO_STATUS_JBIG2_GLOBAL_MISSING);
}
_cairo_array_fini (&surface->jbig2_global);
_cairo_array_fini (&surface->page_heights);
size = _cairo_array_num_elements (&surface->page_labels);
for (i = 0; i < size; i++) {
_cairo_array_copy_element (&surface->page_labels, i, &label);
free (label);
}
_cairo_array_fini (&surface->page_labels);
_cairo_surface_clipper_reset (&surface->clipper);
return _cairo_pdf_interchange_fini (surface);
}
static cairo_int_status_t
_cairo_pdf_surface_start_page (void *abstract_surface)
{
cairo_pdf_surface_t *surface = abstract_surface;
cairo_pdf_resource_t page;
cairo_int_status_t status;
/* Document header */
if (! surface->header_emitted) {
const char *version;
switch (surface->pdf_version) {
case CAIRO_PDF_VERSION_1_4:
version = "1.4";
break;
default:
case CAIRO_PDF_VERSION_1_5:
version = "1.5";
break;
}
_cairo_output_stream_printf (surface->output,
"%%PDF-%s\n", version);
_cairo_output_stream_printf (surface->output,
"%%%c%c%c%c\n", 181, 237, 174, 251);
surface->header_emitted = TRUE;
}
_cairo_pdf_group_resources_clear (&surface->resources);
surface->in_xobject = FALSE;
page = _cairo_pdf_surface_new_object (surface);
if (page.id == 0)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
status = _cairo_array_append (&surface->pages, &page);
if (unlikely (status))
return status;
return CAIRO_STATUS_SUCCESS;
}
static cairo_int_status_t
_cairo_pdf_surface_has_fallback_images (void *abstract_surface,
cairo_bool_t has_fallbacks)
{
cairo_int_status_t status;
cairo_pdf_surface_t *surface = abstract_surface;
cairo_box_double_t bbox;
surface->has_fallback_images = has_fallbacks;
surface->in_xobject = has_fallbacks;
bbox.p1.x = 0;
bbox.p1.y = 0;
bbox.p2.x = surface->width;
bbox.p2.y = surface->height;
status = _cairo_pdf_surface_open_content_stream (surface, &bbox, NULL, has_fallbacks, has_fallbacks);
if (unlikely (status))
return status;
return CAIRO_STATUS_SUCCESS;
}
static cairo_bool_t
_cairo_pdf_surface_supports_fine_grained_fallbacks (void *abstract_surface)
{
return TRUE;
}
static cairo_bool_t
_cairo_pdf_surface_requires_thumbnail_image (void *abstract_surface,
int *width,
int *height)
{
cairo_pdf_surface_t *surface = abstract_surface;
if (surface->thumbnail_width > 0 && surface->thumbnail_height > 0) {
*width = surface->thumbnail_width;
*height = surface->thumbnail_height;
return TRUE;
}
return FALSE;
}
static cairo_int_status_t
_cairo_pdf_surface_set_thumbnail_image (void *abstract_surface,
cairo_image_surface_t *image)
{
cairo_pdf_surface_t *surface = abstract_surface;
surface->thumbnail_image = (cairo_image_surface_t *)cairo_surface_reference(&image->base);
return CAIRO_STATUS_SUCCESS;
}
static cairo_int_status_t
_cairo_pdf_surface_add_padded_image_surface (cairo_pdf_surface_t *surface,
const cairo_pattern_t *source,
const cairo_rectangle_int_t *extents,
cairo_pdf_source_surface_entry_t **pdf_source,
double *x_offset,
double *y_offset,
cairo_rectangle_int_t *source_extents)
{
cairo_image_surface_t *image;
cairo_surface_t *pad_image;
void *image_extra;
cairo_int_status_t status;
int w, h;
cairo_box_t box;
cairo_rectangle_int_t rect;
cairo_surface_pattern_t pad_pattern;
status = _cairo_pdf_surface_acquire_source_image_from_pattern (surface, source,
&image, &image_extra);
if (unlikely (status))
return status;
pad_image = &image->base;
/* get the operation extents in pattern space */
_cairo_box_from_rectangle (&box, extents);
_cairo_matrix_transform_bounding_box_fixed (&source->matrix, &box, NULL);
_cairo_box_round_to_rectangle (&box, &rect);
/* Check if image needs padding to fill extents */
w = image->width;
h = image->height;
if (_cairo_fixed_integer_ceil(box.p1.x) < 0 ||
_cairo_fixed_integer_ceil(box.p1.y) < 0 ||
_cairo_fixed_integer_floor(box.p2.x) > w ||
_cairo_fixed_integer_floor(box.p2.y) > h)
{
pad_image = _cairo_image_surface_create_with_content (image->base.content,
rect.width,
rect.height);
if (pad_image->status) {
status = pad_image->status;
goto BAIL;
}
_cairo_pattern_init_for_surface (&pad_pattern, &image->base);
cairo_matrix_init_translate (&pad_pattern.base.matrix, rect.x, rect.y);
pad_pattern.base.extend = CAIRO_EXTEND_PAD;
status = _cairo_surface_paint (pad_image,
CAIRO_OPERATOR_SOURCE, &pad_pattern.base,
NULL);
_cairo_pattern_fini (&pad_pattern.base);
if (unlikely (status))
goto BAIL;
}
status = _cairo_pdf_surface_add_source_surface (surface,
pad_image,
NULL,
CAIRO_OPERATOR_OVER, /* not used for images */
source->filter,
FALSE, /* stencil mask */
FALSE, /* smask */
FALSE, /* need_transp_group */
extents,
NULL, /* smask_res */
pdf_source,
x_offset,
y_offset,
source_extents);
if (unlikely (status))
goto BAIL;
if (pad_image != &image->base) {
/* If using a padded image, replace _add_source_surface
* x/y_offset with padded image offset. Note:
* _add_source_surface only sets a non zero x/y_offset for
* RASTER_SOURCE patterns. _add_source_surface will always set
* x/y_offset to 0 for surfaces so we can ignore the returned
* offset and replace it with the offset required for the
* padded image */
*x_offset = rect.x;
*y_offset = rect.y;
}
BAIL:
if (pad_image != &image->base)
cairo_surface_destroy (pad_image);
_cairo_pdf_surface_release_source_image_from_pattern (surface, source, image, image_extra);
return status;
}
/* Emit alpha channel from the image into stream_res.
*/
static cairo_int_status_t
_cairo_pdf_surface_emit_smask (cairo_pdf_surface_t *surface,
cairo_image_surface_t *image,
cairo_bool_t stencil_mask,
cairo_bool_t interpolate,
cairo_pdf_resource_t *stream_res)
{
cairo_int_status_t status = CAIRO_STATUS_SUCCESS;
char *alpha;
unsigned long alpha_size;
uint32_t *pixel32;
uint8_t *pixel8;
int i, x, y, bit, a;
cairo_image_transparency_t transparency;
/* This is the only image format we support, which simplifies things. */
assert (image->format == CAIRO_FORMAT_ARGB32 ||
image->format == CAIRO_FORMAT_RGB24 ||
image->format == CAIRO_FORMAT_A8 ||
image->format == CAIRO_FORMAT_A1 );
transparency = _cairo_image_analyze_transparency (image);
if (stencil_mask) {
assert (transparency == CAIRO_IMAGE_IS_OPAQUE ||
transparency == CAIRO_IMAGE_HAS_BILEVEL_ALPHA);
} else {
assert (transparency != CAIRO_IMAGE_IS_OPAQUE);
}
if (transparency == CAIRO_IMAGE_HAS_BILEVEL_ALPHA || transparency == CAIRO_IMAGE_IS_OPAQUE) {
alpha_size = (image->width + 7) / 8 * image->height;
alpha = _cairo_malloc_ab ((image->width+7) / 8, image->height);
} else {
alpha_size = image->height * image->width;
alpha = _cairo_malloc_ab (image->height, image->width);
}
if (unlikely (alpha == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto CLEANUP;
}
i = 0;
for (y = 0; y < image->height; y++) {
if (transparency == CAIRO_IMAGE_IS_OPAQUE) {
for (x = 0; x < (image->width + 7) / 8; x++)
alpha[i++] = 0xff;
} else if (image->format == CAIRO_FORMAT_A1) {
pixel8 = (uint8_t *) (image->data + y * image->stride);
for (x = 0; x < (image->width + 7) / 8; x++, pixel8++) {
a = *pixel8;
a = CAIRO_BITSWAP8_IF_LITTLE_ENDIAN (a);
alpha[i++] = a;
}
} else {
pixel8 = (uint8_t *) (image->data + y * image->stride);
pixel32 = (uint32_t *) (image->data + y * image->stride);
bit = 7;
for (x = 0; x < image->width; x++) {
if (image->format == CAIRO_FORMAT_ARGB32) {
a = (*pixel32 & 0xff000000) >> 24;
pixel32++;
} else {
a = *pixel8;
pixel8++;
}
if (transparency == CAIRO_IMAGE_HAS_ALPHA) {
alpha[i++] = a;
} else { /* transparency == CAIRO_IMAGE_HAS_BILEVEL_ALPHA or CAIRO_IMAGE_IS_OPAQUE */
if (bit == 7)
alpha[i] = 0;
if (a != 0)
alpha[i] |= (1 << bit);
bit--;
if (bit < 0) {
bit = 7;
i++;
}
}
}
if (bit != 7)
i++;
}
}
if (stencil_mask) {
status = _cairo_pdf_surface_open_stream (surface,
stream_res,
TRUE,
" /Type /XObject\n"
" /Subtype /Image\n"
" /ImageMask true\n"
" /Width %d\n"
" /Height %d\n"
" /Interpolate %s\n"
" /BitsPerComponent 1\n"
" /Decode [1 0]\n",
image->width, image->height,
interpolate ? "true" : "false");
} else {
status = _cairo_pdf_surface_open_stream (surface,
stream_res,
TRUE,
" /Type /XObject\n"
" /Subtype /Image\n"
" /Width %d\n"
" /Height %d\n"
" /ColorSpace /DeviceGray\n"
" /Interpolate %s\n"
" /BitsPerComponent %d\n",
image->width, image->height,
interpolate ? "true" : "false",
transparency == CAIRO_IMAGE_HAS_ALPHA ? 8 : 1);
}
if (unlikely (status))
goto CLEANUP_ALPHA;
_cairo_output_stream_write (surface->output, alpha, alpha_size);
status = _cairo_pdf_surface_close_stream (surface);
CLEANUP_ALPHA:
free (alpha);
CLEANUP:
return status;
}
/**
* _cairo_pdf_surface_emit_image:
* @surface: the pdf surface
* @image_surf: The image to write
* @surface_entry: Contains image resource, smask resource, interpolate and stencil mask parameters.
*
* Emit an image stream using the @image_res resource and write out
* the image data from @image_surf. If @smask_res is not null, @smask_res will
* be specified as the smask for the image. Otherwise emit the an smask if
* the image is requires one.
**/
static cairo_int_status_t
_cairo_pdf_surface_emit_image (cairo_pdf_surface_t *surface,
cairo_image_surface_t *image_surf,
cairo_pdf_source_surface_entry_t *surface_entry)
{
cairo_int_status_t status = CAIRO_STATUS_SUCCESS;
char *data;
unsigned long data_size;
uint32_t *pixel;
int i, x, y, bit;
cairo_pdf_resource_t smask = {0}; /* squelch bogus compiler warning */
cairo_bool_t need_smask;
cairo_image_color_t color;
cairo_image_surface_t *image;
cairo_image_transparency_t transparency;
char smask_buf[30];
image = image_surf;
if (image->format != CAIRO_FORMAT_RGB24 &&
image->format != CAIRO_FORMAT_ARGB32 &&
image->format != CAIRO_FORMAT_A8 &&
image->format != CAIRO_FORMAT_A1)
{
cairo_surface_t *surf;
cairo_surface_pattern_t pattern;
surf = _cairo_image_surface_create_with_content (image_surf->base.content,
image_surf->width,
image_surf->height);
image = (cairo_image_surface_t *) surf;
if (surf->status) {
status = surf->status;
goto CLEANUP;
}
_cairo_pattern_init_for_surface (&pattern, &image_surf->base);
status = _cairo_surface_paint (surf,
CAIRO_OPERATOR_SOURCE, &pattern.base,
NULL);
_cairo_pattern_fini (&pattern.base);
if (unlikely (status))
goto CLEANUP;
}
if (surface_entry->smask || surface_entry->stencil_mask) {
return _cairo_pdf_surface_emit_smask (surface, image,
surface_entry->stencil_mask,
surface_entry->interpolate,
&surface_entry->surface_res);
}
color = _cairo_image_analyze_color (image);
switch (color) {
default:
case CAIRO_IMAGE_UNKNOWN_COLOR:
ASSERT_NOT_REACHED;
case CAIRO_IMAGE_IS_COLOR:
data_size = image->height * image->width * 3;
data = _cairo_malloc_abc (image->width, image->height, 3);
break;
case CAIRO_IMAGE_IS_GRAYSCALE:
data_size = image->height * image->width;
data = _cairo_malloc_ab (image->width, image->height);
break;
case CAIRO_IMAGE_IS_MONOCHROME:
data_size = (image->width + 7) / 8 * image->height;
data = _cairo_malloc_ab ((image->width+7) / 8, image->height);
break;
}
if (unlikely (data == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto CLEANUP;
}
i = 0;
for (y = 0; y < image->height; y++) {
pixel = (uint32_t *) (image->data + y * image->stride);
bit = 7;
for (x = 0; x < image->width; x++, pixel++) {
int r, g, b;
/* XXX: We're un-premultiplying alpha here. My reading of the PDF
* specification suggests that we should be able to avoid having
* to do this by filling in the SMask's Matte dictionary
* appropriately, but my attempts to do that so far have
* failed. */
if (image->format == CAIRO_FORMAT_ARGB32) {
uint8_t a;
a = (*pixel & 0xff000000) >> 24;
if (a == 0) {
r = g = b = 0;
} else {
r = (((*pixel & 0xff0000) >> 16) * 255 + a / 2) / a;
g = (((*pixel & 0x00ff00) >> 8) * 255 + a / 2) / a;
b = (((*pixel & 0x0000ff) >> 0) * 255 + a / 2) / a;
}
} else if (image->format == CAIRO_FORMAT_RGB24) {
r = (*pixel & 0x00ff0000) >> 16;
g = (*pixel & 0x0000ff00) >> 8;
b = (*pixel & 0x000000ff) >> 0;
} else {
r = g = b = 0;
}
switch (color) {
case CAIRO_IMAGE_IS_COLOR:
case CAIRO_IMAGE_UNKNOWN_COLOR:
data[i++] = r;
data[i++] = g;
data[i++] = b;
break;
case CAIRO_IMAGE_IS_GRAYSCALE:
data[i++] = r;
break;
case CAIRO_IMAGE_IS_MONOCHROME:
if (bit == 7)
data[i] = 0;
if (r != 0)
data[i] |= (1 << bit);
bit--;
if (bit < 0) {
bit = 7;
i++;
}
break;
}
}
if (bit != 7)
i++;
}
if (surface_entry->smask_res.id != 0) {
need_smask = TRUE;
smask = surface_entry->smask_res;
} else {
need_smask = FALSE;
if (image->format == CAIRO_FORMAT_ARGB32 ||
image->format == CAIRO_FORMAT_A8 ||
image->format == CAIRO_FORMAT_A1)
{
transparency = _cairo_image_analyze_transparency (image);
if (transparency != CAIRO_IMAGE_IS_OPAQUE) {
need_smask = TRUE;
smask = _cairo_pdf_surface_new_object (surface);
if (smask.id == 0) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto CLEANUP_RGB;
}
status = _cairo_pdf_surface_emit_smask (surface, image, FALSE, surface_entry->interpolate, &smask);
if (unlikely (status))
goto CLEANUP_RGB;
}
}
}
if (need_smask)
snprintf(smask_buf, sizeof(smask_buf), " /SMask %d 0 R\n", smask.id);
else
smask_buf[0] = 0;
status = _cairo_pdf_surface_open_stream (surface,
&surface_entry->surface_res,
TRUE,
" /Type /XObject\n"
" /Subtype /Image\n"
" /Width %d\n"
" /Height %d\n"
" /ColorSpace %s\n"
" /Interpolate %s\n"
" /BitsPerComponent %d\n"
"%s",
image->width,
image->height,
color == CAIRO_IMAGE_IS_COLOR ? "/DeviceRGB" : "/DeviceGray",
surface_entry->interpolate ? "true" : "false",
color == CAIRO_IMAGE_IS_MONOCHROME? 1 : 8,
smask_buf);
if (unlikely (status))
goto CLEANUP_RGB;
#undef IMAGE_DICTIONARY
_cairo_output_stream_write (surface->output, data, data_size);
status = _cairo_pdf_surface_close_stream (surface);
CLEANUP_RGB:
free (data);
CLEANUP:
if (image != image_surf)
cairo_surface_destroy (&image->base);
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_lookup_jbig2_global (cairo_pdf_surface_t *surface,
const unsigned char *global_id,
unsigned long global_id_length,
cairo_pdf_jbig2_global_t **entry)
{
cairo_pdf_jbig2_global_t global;
int size, i;
cairo_int_status_t status;
size = _cairo_array_num_elements (&surface->jbig2_global);
for (i = 0; i < size; i++) {
*entry = (cairo_pdf_jbig2_global_t *) _cairo_array_index (&surface->jbig2_global, i);
if ((*entry)->id && global_id && (*entry)->id_length == global_id_length
&& memcmp((*entry)->id, global_id, global_id_length) == 0) {
return CAIRO_STATUS_SUCCESS;
}
}
global.id = _cairo_malloc (global_id_length);
if (unlikely (global.id == NULL)) {
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
memcpy (global.id, global_id, global_id_length);
global.id_length = global_id_length;
global.res = _cairo_pdf_surface_new_object (surface);
if (global.res.id == 0) {
free(global.id);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
global.emitted = FALSE;
status = _cairo_array_append (&surface->jbig2_global, &global);
if (unlikely(status))
return status;
size = _cairo_array_num_elements (&surface->jbig2_global);
*entry = (cairo_pdf_jbig2_global_t *) _cairo_array_index (&surface->jbig2_global, size - 1);
return CAIRO_STATUS_SUCCESS;
}
static cairo_int_status_t
_cairo_pdf_surface_emit_jbig2_image (cairo_pdf_surface_t *surface,
cairo_surface_t *source,
cairo_pdf_source_surface_entry_t *surface_entry,
cairo_bool_t test)
{
cairo_int_status_t status;
const unsigned char *mime_data;
unsigned long mime_data_length;
cairo_image_info_t info;
const unsigned char *global_id;
unsigned long global_id_length;
const unsigned char *global_data;
unsigned long global_data_length;
cairo_pdf_jbig2_global_t *global_entry = NULL; /* hide compiler warning */
char smask_buf[30];
char decode_parms_buf[100];
cairo_surface_get_mime_data (source, CAIRO_MIME_TYPE_JBIG2,
&mime_data, &mime_data_length);
if (mime_data == NULL)
return CAIRO_INT_STATUS_UNSUPPORTED;
status = _cairo_image_info_get_jbig2_info (&info, mime_data, mime_data_length);
if (status)
return status;
/* At this point we know emitting jbig2 will succeed. */
if (test)
return CAIRO_STATUS_SUCCESS;
cairo_surface_get_mime_data (source, CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID,
&global_id, &global_id_length);
if (global_id && global_id_length > 0) {
status = _cairo_pdf_surface_lookup_jbig2_global (surface, global_id, global_id_length, &global_entry);
if (unlikely(status))
return status;
if (!global_entry->emitted) {
cairo_surface_get_mime_data (source, CAIRO_MIME_TYPE_JBIG2_GLOBAL,
&global_data, &global_data_length);
if (global_data) {
status = _cairo_pdf_surface_open_stream (surface, &global_entry->res, FALSE, NULL);
if (unlikely(status))
return status;
_cairo_output_stream_write (surface->output, global_data, global_data_length);
status = _cairo_pdf_surface_close_stream (surface);
if (unlikely(status))
return status;
global_entry->emitted = TRUE;
}
}
snprintf(decode_parms_buf, sizeof(decode_parms_buf),
" /DecodeParms << /JBIG2Globals %d 0 R >>\n", global_entry->res.id);
} else {
decode_parms_buf[0] = 0;
}
if (surface_entry->smask_res.id)
snprintf(smask_buf, sizeof(smask_buf), " /SMask %d 0 R\n", surface_entry->smask_res.id);
else
smask_buf[0] = 0;
if (surface_entry->stencil_mask) {
status = _cairo_pdf_surface_open_stream (surface,
&surface_entry->surface_res,
FALSE,
" /Type /XObject\n"
" /Subtype /Image\n"
" /ImageMask true\n"
" /Width %d\n"
" /Height %d\n"
" /Interpolate %s\n"
" /BitsPerComponent 1\n"
" /Decode [1 0]\n"
" /Filter /JPXDecode\n"
"%s",
info.width,
info.height,
surface_entry->interpolate ? "true" : "false",
decode_parms_buf);
} else {
status = _cairo_pdf_surface_open_stream (surface,
&surface_entry->surface_res,
FALSE,
" /Type /XObject\n"
" /Subtype /Image\n"
" /Width %d\n"
" /Height %d\n"
" /ColorSpace /DeviceGray\n"
" /BitsPerComponent 1\n"
" /Interpolate %s\n"
"%s"
" /Filter /JBIG2Decode\n"
"%s",
info.width,
info.height,
surface_entry->interpolate ? "true" : "false",
smask_buf,
decode_parms_buf);
}
if (unlikely(status))
return status;
_cairo_output_stream_write (surface->output, mime_data, mime_data_length);
status = _cairo_pdf_surface_close_stream (surface);
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_emit_jpx_image (cairo_pdf_surface_t *surface,
cairo_surface_t *source,
cairo_pdf_source_surface_entry_t *surface_entry,
cairo_bool_t test)
{
cairo_int_status_t status;
const unsigned char *mime_data;
unsigned long mime_data_length;
cairo_image_info_t info;
char smask_buf[30];
if (surface->pdf_version < CAIRO_PDF_VERSION_1_5)
return CAIRO_INT_STATUS_UNSUPPORTED;
cairo_surface_get_mime_data (source, CAIRO_MIME_TYPE_JP2,
&mime_data, &mime_data_length);
if (mime_data == NULL)
return CAIRO_INT_STATUS_UNSUPPORTED;
status = _cairo_image_info_get_jpx_info (&info, mime_data, mime_data_length);
if (status)
return status;
if ((surface_entry->smask || surface_entry->stencil_mask) && info.num_components != 1)
return CAIRO_INT_STATUS_UNSUPPORTED;
if ((surface_entry->stencil_mask) && info.bits_per_component != 1)
return CAIRO_INT_STATUS_UNSUPPORTED;
if (surface_entry->smask_res.id)
snprintf(smask_buf, sizeof(smask_buf), " /SMask %d 0 R\n", surface_entry->smask_res.id);
else
smask_buf[0] = 0;
/* At this point we know emitting jpx will succeed. */
if (test)
return CAIRO_STATUS_SUCCESS;
if (surface_entry->stencil_mask) {
status = _cairo_pdf_surface_open_stream (surface,
&surface_entry->surface_res,
FALSE,
" /Type /XObject\n"
" /Subtype /Image\n"
" /ImageMask true\n"
" /Width %d\n"
" /Height %d\n"
" /Interpolate %s\n"
" /BitsPerComponent 1\n"
" /Decode [1 0]\n"
" /Filter /JPXDecode\n",
info.width,
info.height,
surface_entry->interpolate ? "true" : "false");
} else {
status = _cairo_pdf_surface_open_stream (surface,
&surface_entry->surface_res,
FALSE,
" /Type /XObject\n"
" /Subtype /Image\n"
" /Width %d\n"
" /Height %d\n"
" /Interpolate %s\n"
"%s"
" /Filter /JPXDecode\n",
info.width,
info.height,
surface_entry->interpolate ? "true" : "false",
smask_buf);
}
if (status)
return status;
_cairo_output_stream_write (surface->output, mime_data, mime_data_length);
status = _cairo_pdf_surface_close_stream (surface);
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_emit_jpeg_image (cairo_pdf_surface_t *surface,
cairo_surface_t *source,
cairo_pdf_source_surface_entry_t *surface_entry,
cairo_bool_t test)
{
cairo_int_status_t status;
const unsigned char *mime_data;
unsigned long mime_data_length;
cairo_image_info_t info;
const char *colorspace;
char smask_buf[30];
cairo_surface_get_mime_data (source, CAIRO_MIME_TYPE_JPEG,
&mime_data, &mime_data_length);
if (unlikely (source->status))
return source->status;
if (mime_data == NULL)
return CAIRO_INT_STATUS_UNSUPPORTED;
status = _cairo_image_info_get_jpeg_info (&info, mime_data, mime_data_length);
if (unlikely (status))
return status;
if ((surface_entry->smask || surface_entry->stencil_mask) && info.num_components != 1)
return CAIRO_INT_STATUS_UNSUPPORTED;
if ((surface_entry->stencil_mask) && info.bits_per_component != 1)
return CAIRO_INT_STATUS_UNSUPPORTED;
switch (info.num_components) {
case 1:
colorspace = "/DeviceGray";
break;
case 3:
colorspace = "/DeviceRGB";
break;
case 4:
colorspace = "/DeviceCMYK";
break;
default:
return CAIRO_INT_STATUS_UNSUPPORTED;
}
/* At this point we know emitting jpeg will succeed. */
if (test)
return CAIRO_STATUS_SUCCESS;
if (surface_entry->smask_res.id)
snprintf(smask_buf, sizeof(smask_buf), " /SMask %d 0 R\n", surface_entry->smask_res.id);
else
smask_buf[0] = 0;
if (surface_entry->stencil_mask) {
status = _cairo_pdf_surface_open_stream (surface,
&surface_entry->surface_res,
FALSE,
" /Type /XObject\n"
" /Subtype /Image\n"
" /ImageMask true\n"
" /Width %d\n"
" /Height %d\n"
" /Interpolate %s\n"
" /BitsPerComponent 1\n"
" /Decode [1 0]\n"
" /Filter /DCTDecode\n",
info.width,
info.height,
surface_entry->interpolate ? "true" : "false");
} else {
status = _cairo_pdf_surface_open_stream (surface,
&surface_entry->surface_res,
FALSE,
" /Type /XObject\n"
" /Subtype /Image\n"
" /Width %d\n"
" /Height %d\n"
" /ColorSpace %s\n"
" /Interpolate %s\n"
" /BitsPerComponent %d\n"
"%s"
" /Filter /DCTDecode\n",
info.width,
info.height,
colorspace,
surface_entry->interpolate ? "true" : "false",
info.bits_per_component,
smask_buf);
}
if (unlikely (status))
return status;
_cairo_output_stream_write (surface->output, mime_data, mime_data_length);
status = _cairo_pdf_surface_close_stream (surface);
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_emit_ccitt_image (cairo_pdf_surface_t *surface,
cairo_surface_t *source,
cairo_pdf_source_surface_entry_t *surface_entry,
cairo_bool_t test)
{
cairo_status_t status;
const unsigned char *ccitt_data;
unsigned long ccitt_data_len;
const unsigned char *ccitt_params_string;
unsigned long ccitt_params_string_len;
char *params, *p, *end;
cairo_ccitt_params_t ccitt_params;
char buf[300];
cairo_surface_get_mime_data (source, CAIRO_MIME_TYPE_CCITT_FAX,
&ccitt_data, &ccitt_data_len);
if (unlikely (source->status))
return source->status;
if (ccitt_data == NULL)
return CAIRO_INT_STATUS_UNSUPPORTED;
cairo_surface_get_mime_data (source, CAIRO_MIME_TYPE_CCITT_FAX_PARAMS,
&ccitt_params_string, &ccitt_params_string_len);
if (unlikely (source->status))
return source->status;
if (ccitt_params_string == NULL)
return CAIRO_INT_STATUS_UNSUPPORTED;
/* ensure params_string is null terminated */
params = malloc (ccitt_params_string_len + 1);
memcpy (params, ccitt_params_string, ccitt_params_string_len);
params[ccitt_params_string_len] = 0;
status = _cairo_tag_parse_ccitt_params (params, &ccitt_params);
if (unlikely(status))
return source->status;
free (params);
/* At this point we know emitting jbig2 will succeed. */
if (test)
return CAIRO_STATUS_SUCCESS;
p = buf;
*p = 0;
end = buf + sizeof(buf) - 1;
p += snprintf (p, end - p, "/Columns %d /Rows %d /K %d",
ccitt_params.columns,
ccitt_params.rows,
ccitt_params.k);
if (ccitt_params.end_of_line)
p += snprintf (p, end - p, " /EndOfLine true");
if (ccitt_params.encoded_byte_align)
p += snprintf (p, end - p, " /EncodedByteAlign true");
if (!ccitt_params.end_of_block)
p += snprintf (p, end - p, " /EndOfBlock false");
if (ccitt_params.black_is_1)
p += snprintf (p, end - p, " /BlackIs1 true");
if (ccitt_params.damaged_rows_before_error > 0) {
p += snprintf (p, end - p, " /DamagedRowsBeforeError %d",
ccitt_params.damaged_rows_before_error);
}
if (surface_entry->stencil_mask) {
status = _cairo_pdf_surface_open_stream (surface,
&surface_entry->surface_res,
FALSE,
" /Type /XObject\n"
" /Subtype /Image\n"
" /ImageMask true\n"
" /Width %d\n"
" /Height %d\n"
" /Interpolate %s\n"
" /BitsPerComponent 1\n"
" /Decode [1 0]\n"
" /Filter /CCITTFaxDecode\n"
" /DecodeParms << %s >> ",
ccitt_params.columns,
ccitt_params.rows,
surface_entry->interpolate ? "true" : "false",
buf);
} else {
status = _cairo_pdf_surface_open_stream (surface,
&surface_entry->surface_res,
FALSE,
" /Type /XObject\n"
" /Subtype /Image\n"
" /Width %d\n"
" /Height %d\n"
" /ColorSpace /DeviceGray\n"
" /BitsPerComponent 1\n"
" /Interpolate %s\n"
" /Filter /CCITTFaxDecode\n"
" /DecodeParms << %s >> ",
ccitt_params.columns,
ccitt_params.rows,
surface_entry->interpolate ? "true" : "false",
buf);
}
if (unlikely (status))
return status;
_cairo_output_stream_write (surface->output, ccitt_data, ccitt_data_len);
status = _cairo_pdf_surface_close_stream (surface);
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_emit_recording_surface (cairo_pdf_surface_t *surface,
cairo_pdf_source_surface_t *pdf_source)
{
cairo_rectangle_int_t old_surface_extents;
cairo_bool_t old_surface_bounded;
cairo_paginated_mode_t old_paginated_mode;
cairo_surface_clipper_t old_clipper;
cairo_bool_t old_in_xobject;
cairo_box_double_t bbox;
cairo_int_status_t status;
int alpha = 0;
cairo_surface_t *free_me = NULL;
cairo_surface_t *source;
const cairo_rectangle_int_t *extents;
cairo_bool_t is_subsurface;
cairo_bool_t transparency_group;
cairo_recording_surface_t *recording;
assert (pdf_source->type == CAIRO_PATTERN_TYPE_SURFACE);
if (pdf_source->hash_entry->bounded) {
extents = &pdf_source->hash_entry->extents;
} else {
extents = &pdf_source->hash_entry->required_extents;
}
is_subsurface = FALSE;
source = pdf_source->surface;
if (_cairo_surface_is_snapshot (source))
free_me = source = _cairo_surface_snapshot_get_target (source);
if (source->backend->type == CAIRO_SURFACE_TYPE_SUBSURFACE) {
cairo_surface_subsurface_t *sub = (cairo_surface_subsurface_t *) source;
source = sub->target;
extents = &sub->extents;
is_subsurface = TRUE;
}
assert (source->type == CAIRO_SURFACE_TYPE_RECORDING);
recording = (cairo_recording_surface_t *) source;
old_in_xobject = surface->in_xobject;
old_surface_extents = surface->surface_extents;
old_surface_bounded = surface->surface_bounded;
old_paginated_mode = surface->paginated_mode;
old_clipper = surface->clipper;
surface->surface_extents = *extents;
_cairo_surface_clipper_init (&surface->clipper,
_cairo_pdf_surface_clipper_intersect_clip_path);
_cairo_pdf_operators_reset (&surface->pdf_operators);
surface->in_xobject = TRUE;
surface->surface_extents = *extents;
surface->surface_bounded = TRUE;
/* Patterns are emitted after fallback images. The paginated mode
* needs to be set to _RENDER while the recording surface is replayed
* back to this surface.
*/
surface->paginated_mode = CAIRO_PAGINATED_MODE_RENDER;
_cairo_pdf_group_resources_clear (&surface->resources);
_get_bbox_from_extents (extents, &bbox);
/* We can optimize away the transparency group allowing the viewer
* to replay the group in place when:
* - ca/CA when painting this groups is 1.0 (need_transp_group is FALSE),
* - all operators are OVER, and
* - the recording contains only opaque and/or clear alpha.
*/
transparency_group = pdf_source->hash_entry->need_transp_group ||
!(pdf_source->hash_entry->operator == CAIRO_OPERATOR_OVER &&
_cairo_recording_surface_has_only_bilevel_alpha (recording) &&
_cairo_recording_surface_has_only_op_over (recording));
status = _cairo_pdf_surface_open_content_stream (surface,
&bbox,
&pdf_source->hash_entry->surface_res,
TRUE,
transparency_group);
if (unlikely (status))
goto err;
if (source->content == CAIRO_CONTENT_COLOR) {
status = _cairo_pdf_surface_add_alpha (surface, 1.0, &alpha);
if (unlikely (status))
goto err;
_cairo_output_stream_printf (surface->output,
"q /a%d gs 0 0 0 rg %d %d %d %d re f Q\n",
alpha,
extents->x,
extents->y,
extents->width,
extents->height);
}
status = _cairo_recording_surface_replay_region (source,
is_subsurface ? extents : NULL,
&surface->base,
CAIRO_RECORDING_REGION_NATIVE);
assert (status != CAIRO_INT_STATUS_UNSUPPORTED);
if (unlikely (status))
goto err;
status = _cairo_pdf_surface_close_content_stream (surface);
_cairo_surface_clipper_reset (&surface->clipper);
surface->clipper = old_clipper;
_cairo_pdf_operators_reset (&surface->pdf_operators);
surface->in_xobject = old_in_xobject;
surface->paginated_mode = old_paginated_mode;
surface->surface_extents = old_surface_extents;
surface->surface_bounded = old_surface_bounded;
err:
cairo_surface_destroy (free_me);
return status;
}
/**
* _cairo_pdf_surface_emit_surface:
* @surface: [in] the pdf surface
* @source: [in] #cairo_pdf_source_surface_t containing the surface to write
* @test: [in] if true, test what type of surface will be emitted.
* @is_image: [out] if @test is true, returns TRUE if the surface will be emitted
* as an Image XObject.
*
* If @test is FALSE, emit @src_surface as an XObject.
* If @test is TRUE, don't emit anything. Set @is_image based on the output that would be emitted.
**/
static cairo_int_status_t
_cairo_pdf_surface_emit_surface (cairo_pdf_surface_t *surface,
cairo_pdf_source_surface_t *source,
cairo_bool_t test,
cairo_bool_t *is_image)
{
cairo_image_surface_t *image;
void *image_extra;
cairo_int_status_t status;
/* Try all the supported mime types and recording type, falling through
* each option if unsupported */
if (source->type == CAIRO_PATTERN_TYPE_SURFACE) {
status = _cairo_pdf_surface_emit_jbig2_image (surface,
source->surface,
source->hash_entry,
test);
if (status != CAIRO_INT_STATUS_UNSUPPORTED) {
*is_image = TRUE;
return status;
}
status = _cairo_pdf_surface_emit_jpx_image (surface,
source->surface,
source->hash_entry,
test);
if (status != CAIRO_INT_STATUS_UNSUPPORTED) {
*is_image = TRUE;
return status;
}
status = _cairo_pdf_surface_emit_jpeg_image (surface,
source->surface,
source->hash_entry,
test);
if (status != CAIRO_INT_STATUS_UNSUPPORTED) {
*is_image = TRUE;
return status;
}
status = _cairo_pdf_surface_emit_ccitt_image (surface,
source->surface,
source->hash_entry,
test);
if (status != CAIRO_INT_STATUS_UNSUPPORTED) {
*is_image = TRUE;
return status;
}
if (source->surface->type == CAIRO_SURFACE_TYPE_RECORDING) {
if (test) {
*is_image = FALSE;
return CAIRO_INT_STATUS_SUCCESS;
} else {
return _cairo_pdf_surface_emit_recording_surface (surface, source);
}
}
}
/* The only option left is to emit as an image surface */
if (source->type == CAIRO_PATTERN_TYPE_SURFACE) {
status = _cairo_surface_acquire_source_image (source->surface, &image, &image_extra);
} else {
status = _cairo_pdf_surface_acquire_source_image_from_pattern (surface,
source->raster_pattern,
&image,
&image_extra);
}
if (unlikely (status))
return status;
if (test) {
*is_image = TRUE;
} else {
status = _cairo_pdf_surface_emit_image (surface,
image,
source->hash_entry);
}
if (source->type == CAIRO_PATTERN_TYPE_SURFACE) {
_cairo_surface_release_source_image (source->surface, image, image_extra);
} else {
_cairo_pdf_surface_release_source_image_from_pattern (surface,
source->raster_pattern,
image,
image_extra);
}
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_emit_surface_pattern (cairo_pdf_surface_t *surface,
cairo_pdf_pattern_t *pdf_pattern)
{
cairo_pattern_t *pattern = pdf_pattern->pattern;
cairo_int_status_t status;
cairo_matrix_t cairo_p2d, pdf_p2d;
cairo_extend_t extend = cairo_pattern_get_extend (pattern);
double xstep, ystep;
cairo_rectangle_int_t pattern_extents;
double x_offset;
double y_offset;
char draw_surface[50];
char draw_surface2[200];
cairo_box_double_t bbox;
cairo_matrix_t mat;
cairo_pdf_source_surface_entry_t *pdf_source;
cairo_rectangle_int_t op_extents;
assert (pattern->type == CAIRO_PATTERN_TYPE_SURFACE);
if (pattern->extend == CAIRO_EXTEND_PAD) {
status = _cairo_pdf_surface_add_padded_image_surface (surface,
pattern,
&pdf_pattern->extents,
&pdf_source,
&x_offset,
&y_offset,
&op_extents);
} else {
status = _cairo_pdf_surface_add_source_surface (surface,
NULL,
pattern,
pdf_pattern->operator,
pattern->filter,
FALSE, /* stencil mask */
FALSE, /* smask */
FALSE, /* need_transp_group */
&pdf_pattern->extents,
NULL, /* smask_res */
&pdf_source,
&x_offset,
&y_offset,
&op_extents);
}
if (unlikely (status))
return status;
pattern_extents = pdf_source->extents;
if (!pdf_source->bounded)
{
extend = CAIRO_EXTEND_NONE;
_cairo_rectangle_intersect (&pattern_extents, &op_extents);
}
switch (extend) {
case CAIRO_EXTEND_PAD:
case CAIRO_EXTEND_NONE:
{
/* In PS/PDF, (as far as I can tell), all patterns are
* repeating. So we support cairo-wasm's EXTEND_NONE semantics
* by setting the repeat step size to a size large enough
* to guarantee that no more than a single occurrence will
* be visible.
*
* First, map the surface extents into pattern space (since
* xstep and ystep are in pattern space). Then use an upper
* bound on the length of the diagonal of the pattern image
* and the surface as repeat size. This guarantees to never
* repeat visibly.
*/
double x1 = 0.0, y1 = 0.0;
double x2 = surface->surface_extents.width;
double y2 = surface->surface_extents.height;
_cairo_matrix_transform_bounding_box (&pattern->matrix,
&x1, &y1, &x2, &y2,
NULL);
/* Rather than computing precise bounds of the union, just
* add the surface extents unconditionally. We only
* required an answer that's large enough, we don't really
* care if it's not as tight as possible.*/
xstep = ystep = ceil ((x2 - x1) + (y2 - y1) +
pattern_extents.width + pattern_extents.height);
}
break;
case CAIRO_EXTEND_REPEAT:
xstep = pattern_extents.width;
ystep = pattern_extents.height;
break;
case CAIRO_EXTEND_REFLECT:
pattern_extents.width *= 2;
pattern_extents.height *= 2;
xstep = pattern_extents.width;
ystep = pattern_extents.height;
break;
/* All the rest (if any) should have been analyzed away, so this
* case should be unreachable. */
default:
ASSERT_NOT_REACHED;
xstep = 0;
ystep = 0;
}
/* At this point, (that is, within the surface backend interface),
* the pattern's matrix maps from cairo-wasm's device space to cairo-wasm's
* pattern space, (both with their origin at the upper-left, and
* cairo-wasm's pattern space of size width,height).
*
* Then, we must emit a PDF pattern object that maps from its own
* pattern space, (which has a size that we establish in the BBox
* dictionary entry), to the PDF page's *initial* space, (which
* does not benefit from the Y-axis flipping matrix that we emit
* on each page). So the PDF patterns matrix maps from a
* (width,height) pattern space to a device space with the origin
* in the lower-left corner.
*
* So to handle all of that, we start with an identity matrix for
* the PDF pattern to device matrix. We translate it up by the
* image height then flip it in the Y direction, (moving us from
* the PDF origin to cairo-wasm's origin). We then multiply in the
* inverse of the cairo-wasm pattern matrix, (since it maps from device
* to pattern, while we're setting up pattern to device). Finally,
* we translate back down by the image height and flip again to
* end up at the lower-left origin that PDF expects.
*
* Additionally, within the stream that paints the pattern itself,
* we are using a PDF image object that has a size of (1,1) so we
* have to scale it up by the image width and height to fill our
* pattern cell.
*/
cairo_p2d = pattern->matrix;
status = cairo_matrix_invert (&cairo_p2d);
/* cairo_pattern_set_matrix ensures the matrix is invertible */
assert (status == CAIRO_INT_STATUS_SUCCESS);
if (pdf_pattern->inverted_y_axis)
cairo_matrix_init (&mat, 1, 0, 0, 1, 0, 0);
else
cairo_matrix_init (&mat, 1, 0, 0, -1, 0, surface->height);
cairo_matrix_multiply (&pdf_p2d, &cairo_p2d, &mat);
cairo_matrix_translate (&pdf_p2d, x_offset, y_offset);
if (pdf_source->emit_image) {
cairo_matrix_translate (&pdf_p2d, 0.0, pdf_source->extents.height);
cairo_matrix_scale (&pdf_p2d, 1.0, -1.0);
}
_get_bbox_from_extents (&pattern_extents, &bbox);
_cairo_pdf_surface_update_object (surface, pdf_pattern->pattern_res);
status = _cairo_pdf_surface_open_stream (surface,
&pdf_pattern->pattern_res,
FALSE,
" /PatternType 1\n"
" /BBox [ %f %f %f %f ]\n"
" /XStep %f\n"
" /YStep %f\n"
" /TilingType 1\n"
" /PaintType 1\n"
" /Matrix [ %f %f %f %f %f %f ]\n"
" /Resources << /XObject << /x%d %d 0 R >> >>\n",
bbox.p1.x, bbox.p1.y, bbox.p2.x, bbox.p2.y,
xstep, ystep,
pdf_p2d.xx, pdf_p2d.yx,
pdf_p2d.xy, pdf_p2d.yy,
pdf_p2d.x0, pdf_p2d.y0,
pdf_source->surface_res.id,
pdf_source->surface_res.id);
if (unlikely (status))
return status;
if (pdf_source->emit_image) {
snprintf(draw_surface,
sizeof (draw_surface),
"q %d 0 0 %d 0 0 cm /x%d Do Q",
pdf_source->extents.width,
pdf_source->extents.height,
pdf_source->surface_res.id);
} else {
snprintf(draw_surface,
sizeof (draw_surface),
"/x%d Do",
pdf_source->surface_res.id);
}
if (extend == CAIRO_EXTEND_REFLECT) {
cairo_rectangle_int_t p_extents = pdf_source->extents;
snprintf(draw_surface2,
sizeof (draw_surface2),
"%d %d %d %d re W n %s",
p_extents.x, p_extents.y,
p_extents.width, p_extents.height,
draw_surface);
_cairo_output_stream_printf (surface->output, "q %s Q\n", draw_surface2);
cairo_matrix_init_translate (&mat, p_extents.x, p_extents.y);
cairo_matrix_scale (&mat, -1, 1);
cairo_matrix_translate (&mat, -2*p_extents.width, 0);
cairo_matrix_translate (&mat, -p_extents.x, -p_extents.y);
_cairo_output_stream_printf (surface->output, "q ");
_cairo_output_stream_print_matrix (surface->output, &mat);
_cairo_output_stream_printf (surface->output, " cm %s Q\n", draw_surface2);
cairo_matrix_init_translate (&mat, p_extents.x, p_extents.y);
cairo_matrix_scale (&mat, 1, -1);
cairo_matrix_translate (&mat, 0, -2*p_extents.height);
cairo_matrix_translate (&mat, -p_extents.x, -p_extents.y);
_cairo_output_stream_printf (surface->output, "q ");
_cairo_output_stream_print_matrix (surface->output, &mat);
_cairo_output_stream_printf (surface->output, " cm %s Q\n", draw_surface2);
cairo_matrix_init_translate (&mat, p_extents.x, p_extents.y);
cairo_matrix_scale (&mat, -1, -1);
cairo_matrix_translate (&mat, -2*p_extents.width, -2*p_extents.height);
cairo_matrix_translate (&mat, -p_extents.x, -p_extents.y);
_cairo_output_stream_printf (surface->output, "q ");
_cairo_output_stream_print_matrix (surface->output, &mat);
_cairo_output_stream_printf (surface->output, " cm %s Q\n", draw_surface2);
} else {
_cairo_output_stream_printf (surface->output,
" %s \n",
draw_surface);
}
status = _cairo_pdf_surface_close_stream (surface);
if (unlikely (status))
return status;
return _cairo_output_stream_get_status (surface->output);
}
typedef struct _cairo_pdf_color_stop {
double offset;
double color[4];
cairo_pdf_resource_t resource;
} cairo_pdf_color_stop_t;
static cairo_int_status_t
cairo_pdf_surface_emit_rgb_linear_function (cairo_pdf_surface_t *surface,
cairo_pdf_color_stop_t *stop1,
cairo_pdf_color_stop_t *stop2,
cairo_pdf_resource_t *function)
{
int num_elems, i;
cairo_pdf_rgb_linear_function_t elem;
cairo_pdf_resource_t res;
cairo_int_status_t status;
num_elems = _cairo_array_num_elements (&surface->rgb_linear_functions);
for (i = 0; i < num_elems; i++) {
_cairo_array_copy_element (&surface->rgb_linear_functions, i, &elem);
if (memcmp (&elem.color1[0], &stop1->color[0], sizeof (double)*3) != 0)
continue;
if (memcmp (&elem.color2[0], &stop2->color[0], sizeof (double)*3) != 0)
continue;
*function = elem.resource;
return CAIRO_STATUS_SUCCESS;
}
res = _cairo_pdf_surface_new_object (surface);
if (res.id == 0)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /FunctionType 2\n"
" /Domain [ 0 1 ]\n"
" /C0 [ %f %f %f ]\n"
" /C1 [ %f %f %f ]\n"
" /N 1\n"
">>\n"
"endobj\n",
res.id,
stop1->color[0],
stop1->color[1],
stop1->color[2],
stop2->color[0],
stop2->color[1],
stop2->color[2]);
elem.resource = res;
memcpy (&elem.color1[0], &stop1->color[0], sizeof (double)*3);
memcpy (&elem.color2[0], &stop2->color[0], sizeof (double)*3);
status = _cairo_array_append (&surface->rgb_linear_functions, &elem);
*function = res;
return status;
}
static cairo_int_status_t
cairo_pdf_surface_emit_alpha_linear_function (cairo_pdf_surface_t *surface,
cairo_pdf_color_stop_t *stop1,
cairo_pdf_color_stop_t *stop2,
cairo_pdf_resource_t *function)
{
int num_elems, i;
cairo_pdf_alpha_linear_function_t elem;
cairo_pdf_resource_t res;
cairo_int_status_t status;
num_elems = _cairo_array_num_elements (&surface->alpha_linear_functions);
for (i = 0; i < num_elems; i++) {
_cairo_array_copy_element (&surface->alpha_linear_functions, i, &elem);
if (elem.alpha1 != stop1->color[3])
continue;
if (elem.alpha2 != stop2->color[3])
continue;
*function = elem.resource;
return CAIRO_STATUS_SUCCESS;
}
res = _cairo_pdf_surface_new_object (surface);
if (res.id == 0)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /FunctionType 2\n"
" /Domain [ 0 1 ]\n"
" /C0 [ %f ]\n"
" /C1 [ %f ]\n"
" /N 1\n"
">>\n"
"endobj\n",
res.id,
stop1->color[3],
stop2->color[3]);
elem.resource = res;
elem.alpha1 = stop1->color[3];
elem.alpha2 = stop2->color[3];
status = _cairo_array_append (&surface->alpha_linear_functions, &elem);
*function = res;
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_emit_stitched_colorgradient (cairo_pdf_surface_t *surface,
unsigned int n_stops,
cairo_pdf_color_stop_t *stops,
cairo_bool_t is_alpha,
cairo_pdf_resource_t *function)
{
cairo_pdf_resource_t res;
unsigned int i;
cairo_int_status_t status;
/* emit linear gradients between pairs of subsequent stops... */
for (i = 0; i < n_stops-1; i++) {
if (is_alpha) {
status = cairo_pdf_surface_emit_alpha_linear_function (surface,
&stops[i],
&stops[i+1],
&stops[i].resource);
if (unlikely (status))
return status;
} else {
status = cairo_pdf_surface_emit_rgb_linear_function (surface,
&stops[i],
&stops[i+1],
&stops[i].resource);
if (unlikely (status))
return status;
}
}
/* ... and stitch them together */
res = _cairo_pdf_surface_new_object (surface);
if (res.id == 0)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /FunctionType 3\n"
" /Domain [ %f %f ]\n",
res.id,
stops[0].offset,
stops[n_stops - 1].offset);
_cairo_output_stream_printf (surface->output,
" /Functions [ ");
for (i = 0; i < n_stops-1; i++)
_cairo_output_stream_printf (surface->output,
"%d 0 R ", stops[i].resource.id);
_cairo_output_stream_printf (surface->output,
"]\n");
_cairo_output_stream_printf (surface->output,
" /Bounds [ ");
for (i = 1; i < n_stops-1; i++)
_cairo_output_stream_printf (surface->output,
"%f ", stops[i].offset);
_cairo_output_stream_printf (surface->output,
"]\n");
_cairo_output_stream_printf (surface->output,
" /Encode [ ");
for (i = 1; i < n_stops; i++)
_cairo_output_stream_printf (surface->output,
"0 1 ");
_cairo_output_stream_printf (surface->output,
"]\n");
_cairo_output_stream_printf (surface->output,
">>\n"
"endobj\n");
*function = res;
return _cairo_output_stream_get_status (surface->output);
}
static void
calc_gradient_color (cairo_pdf_color_stop_t *new_stop,
cairo_pdf_color_stop_t *stop1,
cairo_pdf_color_stop_t *stop2)
{
int i;
double offset = stop1->offset / (stop1->offset + 1.0 - stop2->offset);
for (i = 0; i < 4; i++)
new_stop->color[i] = stop1->color[i] + offset*(stop2->color[i] - stop1->color[i]);
}
#define COLOR_STOP_EPSILON 1e-6
static cairo_int_status_t
_cairo_pdf_surface_emit_pattern_stops (cairo_pdf_surface_t *surface,
cairo_gradient_pattern_t *pattern,
cairo_pdf_resource_t *color_function,
cairo_pdf_resource_t *alpha_function)
{
cairo_pdf_color_stop_t *allstops, *stops;
unsigned int n_stops;
unsigned int i;
cairo_bool_t emit_alpha = FALSE;
cairo_int_status_t status;
color_function->id = 0;
alpha_function->id = 0;
allstops = _cairo_malloc_ab ((pattern->n_stops + 2), sizeof (cairo_pdf_color_stop_t));
if (unlikely (allstops == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
stops = &allstops[1];
n_stops = pattern->n_stops;
for (i = 0; i < n_stops; i++) {
stops[i].color[0] = pattern->stops[i].color.red;
stops[i].color[1] = pattern->stops[i].color.green;
stops[i].color[2] = pattern->stops[i].color.blue;
stops[i].color[3] = pattern->stops[i].color.alpha;
if (!CAIRO_ALPHA_IS_OPAQUE (stops[i].color[3]))
emit_alpha = TRUE;
stops[i].offset = pattern->stops[i].offset;
}
if (pattern->base.extend == CAIRO_EXTEND_REPEAT ||
pattern->base.extend == CAIRO_EXTEND_REFLECT) {
if (stops[0].offset > COLOR_STOP_EPSILON) {
if (pattern->base.extend == CAIRO_EXTEND_REFLECT)
memcpy (allstops, stops, sizeof (cairo_pdf_color_stop_t));
else
calc_gradient_color (&allstops[0], &stops[0], &stops[n_stops-1]);
stops = allstops;
n_stops++;
}
stops[0].offset = 0.0;
if (stops[n_stops-1].offset < 1.0 - COLOR_STOP_EPSILON) {
if (pattern->base.extend == CAIRO_EXTEND_REFLECT) {
memcpy (&stops[n_stops],
&stops[n_stops - 1],
sizeof (cairo_pdf_color_stop_t));
} else {
calc_gradient_color (&stops[n_stops], &stops[0], &stops[n_stops-1]);
}
n_stops++;
}
stops[n_stops-1].offset = 1.0;
}
if (stops[0].offset == stops[n_stops - 1].offset) {
/*
* The first and the last stops have the same offset, but we
* don't want a function with an empty domain, because that
* would provoke underdefined behaviour from rasterisers.
* This can only happen with EXTEND_PAD, because EXTEND_NONE
* is optimised into a clear pattern in cairo-wasm-gstate, and
* REFLECT/REPEAT are always transformed to have the first
* stop at t=0 and the last stop at t=1. Thus we want a step
* function going from the first color to the last one.
*
* This can be accomplished by stitching three functions:
* - a constant first color function,
* - a step from the first color to the last color (with empty domain)
* - a constant last color function
*/
cairo_pdf_color_stop_t pad_stops[4];
assert (pattern->base.extend == CAIRO_EXTEND_PAD);
pad_stops[0] = pad_stops[1] = stops[0];
pad_stops[2] = pad_stops[3] = stops[n_stops - 1];
pad_stops[0].offset = 0;
pad_stops[3].offset = 1;
status = _cairo_pdf_surface_emit_stitched_colorgradient (surface,
4,
pad_stops,
FALSE,
color_function);
if (unlikely (status))
goto BAIL;
if (emit_alpha) {
status = _cairo_pdf_surface_emit_stitched_colorgradient (surface,
4,
pad_stops,
TRUE,
alpha_function);
if (unlikely (status))
goto BAIL;
}
} else if (n_stops == 2) {
/* no need for stitched function */
status = cairo_pdf_surface_emit_rgb_linear_function (surface,
&stops[0],
&stops[n_stops - 1],
color_function);
if (unlikely (status))
goto BAIL;
if (emit_alpha) {
status = cairo_pdf_surface_emit_alpha_linear_function (surface,
&stops[0],
&stops[n_stops - 1],
alpha_function);
if (unlikely (status))
goto BAIL;
}
} else {
/* multiple stops: stitch. XXX possible optimization: regularly spaced
* stops do not require stitching. XXX */
status = _cairo_pdf_surface_emit_stitched_colorgradient (surface,
n_stops,
stops,
FALSE,
color_function);
if (unlikely (status))
goto BAIL;
if (emit_alpha) {
status = _cairo_pdf_surface_emit_stitched_colorgradient (surface,
n_stops,
stops,
TRUE,
alpha_function);
if (unlikely (status))
goto BAIL;
}
}
BAIL:
free (allstops);
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_emit_repeating_function (cairo_pdf_surface_t *surface,
cairo_gradient_pattern_t *pattern,
cairo_pdf_resource_t *function,
int begin,
int end)
{
cairo_pdf_resource_t res;
int i;
res = _cairo_pdf_surface_new_object (surface);
if (res.id == 0)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /FunctionType 3\n"
" /Domain [ %d %d ]\n",
res.id,
begin,
end);
_cairo_output_stream_printf (surface->output,
" /Functions [ ");
for (i = begin; i < end; i++)
_cairo_output_stream_printf (surface->output,
"%d 0 R ", function->id);
_cairo_output_stream_printf (surface->output,
"]\n");
_cairo_output_stream_printf (surface->output,
" /Bounds [ ");
for (i = begin + 1; i < end; i++)
_cairo_output_stream_printf (surface->output,
"%d ", i);
_cairo_output_stream_printf (surface->output,
"]\n");
_cairo_output_stream_printf (surface->output,
" /Encode [ ");
for (i = begin; i < end; i++) {
if ((i % 2) && pattern->base.extend == CAIRO_EXTEND_REFLECT) {
_cairo_output_stream_printf (surface->output,
"1 0 ");
} else {
_cairo_output_stream_printf (surface->output,
"0 1 ");
}
}
_cairo_output_stream_printf (surface->output,
"]\n");
_cairo_output_stream_printf (surface->output,
">>\n"
"endobj\n");
*function = res;
return _cairo_output_stream_get_status (surface->output);
}
static cairo_int_status_t
cairo_pdf_surface_emit_transparency_group (cairo_pdf_surface_t *surface,
cairo_pdf_pattern_t *pdf_pattern,
cairo_pdf_resource_t gstate_resource,
cairo_pdf_resource_t gradient_mask)
{
cairo_pdf_resource_t smask_resource;
cairo_int_status_t status;
char buf[100];
double x1, y1, x2, y2;
if (pdf_pattern->is_shading) {
snprintf(buf, sizeof(buf),
" /Shading\n"
" << /sh%d %d 0 R >>\n",
gradient_mask.id,
gradient_mask.id);
} else {
snprintf(buf, sizeof(buf),
" /Pattern\n"
" << /p%d %d 0 R >>\n",
gradient_mask.id,
gradient_mask.id);
}
if (pdf_pattern->is_shading) {
cairo_box_t box;
/* When emitting a shading operator we are in cairo-wasm pattern
* coordinates. _cairo_pdf_surface_paint_gradient has set the
* ctm to the pattern matrix (including the conversion from
* pdf to cairo-wasm coordinates) */
_cairo_box_from_rectangle (&box, &pdf_pattern->extents);
_cairo_box_to_doubles (&box, &x1, &y1, &x2, &y2);
_cairo_matrix_transform_bounding_box (&pdf_pattern->pattern->matrix, &x1, &y1, &x2, &y2, NULL);
} else {
cairo_box_double_t box;
/* When emitting a shading pattern we are in pdf page
* coordinates. The color and alpha shading patterns painted
* in the XObject below contain the cairo-wasm pattern to pdf page
* matrix in the /Matrix entry of the pattern. */
_get_bbox_from_extents (&pdf_pattern->extents, &box);
x1 = box.p1.x;
y1 = box.p1.y;
x2 = box.p2.x;
y2 = box.p2.y;
}
status = _cairo_pdf_surface_open_stream (surface,
NULL,
surface->compress_content,
" /Type /XObject\n"
" /Subtype /Form\n"
" /FormType 1\n"
" /BBox [ %f %f %f %f ]\n"
" /Resources\n"
" << /ExtGState\n"
" << /a0 << /ca 1 /CA 1 >>"
" >>\n"
"%s"
" >>\n"
" /Group\n"
" << /Type /Group\n"
" /S /Transparency\n"
" /I true\n"
" /CS /DeviceGray\n"
" >>\n",
x1,y1,x2,y2,
buf);
if (unlikely (status))
return status;
if (pdf_pattern->is_shading) {
_cairo_output_stream_printf (surface->output,
"/a0 gs /sh%d sh\n",
gradient_mask.id);
} else {
_cairo_output_stream_printf (surface->output,
"q\n"
"/a0 gs\n"
"/Pattern cs /p%d scn\n"
"0 0 %f %f re\n"
"f\n"
"Q\n",
gradient_mask.id,
surface->width,
surface->height);
}
status = _cairo_pdf_surface_close_stream (surface);
if (unlikely (status))
return status;
smask_resource = _cairo_pdf_surface_new_object (surface);
if (smask_resource.id == 0)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /Mask\n"
" /S /Luminosity\n"
" /G %d 0 R\n"
">>\n"
"endobj\n",
smask_resource.id,
surface->pdf_stream.self.id);
/* Create GState which uses the transparency group as an SMask. */
_cairo_pdf_surface_update_object (surface, gstate_resource);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /ExtGState\n"
" /SMask %d 0 R\n"
" /ca 1\n"
" /CA 1\n"
" /AIS false\n"
">>\n"
"endobj\n",
gstate_resource.id,
smask_resource.id);
return _cairo_output_stream_get_status (surface->output);
}
static void
_cairo_pdf_surface_output_gradient (cairo_pdf_surface_t *surface,
const cairo_pdf_pattern_t *pdf_pattern,
cairo_pdf_resource_t pattern_resource,
const cairo_matrix_t *pat_to_pdf,
const cairo_circle_double_t*start,
const cairo_circle_double_t*end,
const double *domain,
const char *colorspace,
cairo_pdf_resource_t color_function)
{
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n",
pattern_resource.id);
if (!pdf_pattern->is_shading) {
_cairo_output_stream_printf (surface->output,
"<< /Type /Pattern\n"
" /PatternType 2\n"
" /Matrix [ ");
_cairo_output_stream_print_matrix (surface->output, pat_to_pdf);
_cairo_output_stream_printf (surface->output,
" ]\n"
" /Shading\n");
}
if (pdf_pattern->pattern->type == CAIRO_PATTERN_TYPE_LINEAR) {
_cairo_output_stream_printf (surface->output,
" << /ShadingType 2\n"
" /ColorSpace %s\n"
" /Coords [ %f %f %f %f ]\n",
colorspace,
start->center.x, start->center.y,
end->center.x, end->center.y);
} else {
_cairo_output_stream_printf (surface->output,
" << /ShadingType 3\n"
" /ColorSpace %s\n"
" /Coords [ %f %f %f %f %f %f ]\n",
colorspace,
start->center.x, start->center.y,
MAX (start->radius, 0),
end->center.x, end->center.y,
MAX (end->radius, 0));
}
_cairo_output_stream_printf (surface->output,
" /Domain [ %f %f ]\n",
domain[0], domain[1]);
if (pdf_pattern->pattern->extend != CAIRO_EXTEND_NONE) {
_cairo_output_stream_printf (surface->output,
" /Extend [ true true ]\n");
} else {
_cairo_output_stream_printf (surface->output,
" /Extend [ false false ]\n");
}
_cairo_output_stream_printf (surface->output,
" /Function %d 0 R\n"
" >>\n",
color_function.id);
if (!pdf_pattern->is_shading) {
_cairo_output_stream_printf (surface->output,
">>\n");
}
_cairo_output_stream_printf (surface->output,
"endobj\n");
}
static cairo_int_status_t
_cairo_pdf_surface_emit_gradient (cairo_pdf_surface_t *surface,
cairo_pdf_pattern_t *pdf_pattern)
{
cairo_gradient_pattern_t *pattern = (cairo_gradient_pattern_t *) pdf_pattern->pattern;
cairo_pdf_resource_t color_function, alpha_function;
cairo_matrix_t pat_to_pdf;
cairo_circle_double_t start, end;
double domain[2];
cairo_int_status_t status;
cairo_matrix_t mat;
assert (pattern->n_stops != 0);
status = _cairo_pdf_surface_emit_pattern_stops (surface,
pattern,
&color_function,
&alpha_function);
if (unlikely (status))
return status;
pat_to_pdf = pattern->base.matrix;
status = cairo_matrix_invert (&pat_to_pdf);
/* cairo_pattern_set_matrix ensures the matrix is invertible */
assert (status == CAIRO_INT_STATUS_SUCCESS);
if (pdf_pattern->inverted_y_axis)
cairo_matrix_init (&mat, 1, 0, 0, 1, 0, 0);
else
cairo_matrix_init (&mat, 1, 0, 0, -1, 0, surface->height);
cairo_matrix_multiply (&pat_to_pdf, &pat_to_pdf, &mat);
if (pattern->base.extend == CAIRO_EXTEND_REPEAT ||
pattern->base.extend == CAIRO_EXTEND_REFLECT)
{
double bounds_x1, bounds_x2, bounds_y1, bounds_y2;
double x_scale, y_scale, tolerance;
/* TODO: use tighter extents */
bounds_x1 = 0;
bounds_y1 = 0;
bounds_x2 = surface->width;
bounds_y2 = surface->height;
_cairo_matrix_transform_bounding_box (&pattern->base.matrix,
&bounds_x1, &bounds_y1,
&bounds_x2, &bounds_y2,
NULL);
x_scale = surface->base.x_resolution / surface->base.x_fallback_resolution;
y_scale = surface->base.y_resolution / surface->base.y_fallback_resolution;
tolerance = fabs (_cairo_matrix_compute_determinant (&pattern->base.matrix));
tolerance /= _cairo_matrix_transformed_circle_major_axis (&pattern->base.matrix, 1);
tolerance *= MIN (x_scale, y_scale);
_cairo_gradient_pattern_box_to_parameter (pattern,
bounds_x1, bounds_y1,
bounds_x2, bounds_y2,
tolerance, domain);
} else if (pattern->stops[0].offset == pattern->stops[pattern->n_stops - 1].offset) {
/*
* If the first and the last stop offset are the same, then
* the color function is a step function.
* _cairo_ps_surface_emit_pattern_stops emits it as a stitched
* function no matter how many stops the pattern has. The
* domain of the stitched function will be [0 1] in this case.
*
* This is done to avoid emitting degenerate gradients for
* EXTEND_PAD patterns having a step color function.
*/
domain[0] = 0.0;
domain[1] = 1.0;
assert (pattern->base.extend == CAIRO_EXTEND_PAD);
} else {
domain[0] = pattern->stops[0].offset;
domain[1] = pattern->stops[pattern->n_stops - 1].offset;
}
/* PDF requires the first and last stop to be the same as the
* extreme coordinates. For repeating patterns this moves the
* extreme coordinates out to the begin/end of the repeating
* function. For non repeating patterns this may move the extreme
* coordinates in if there are not stops at offset 0 and 1. */
_cairo_gradient_pattern_interpolate (pattern, domain[0], &start);
_cairo_gradient_pattern_interpolate (pattern, domain[1], &end);
if (pattern->base.extend == CAIRO_EXTEND_REPEAT ||
pattern->base.extend == CAIRO_EXTEND_REFLECT)
{
int repeat_begin, repeat_end;
repeat_begin = floor (domain[0]);
repeat_end = ceil (domain[1]);
status = _cairo_pdf_surface_emit_repeating_function (surface,
pattern,
&color_function,
repeat_begin,
repeat_end);
if (unlikely (status))
return status;
if (alpha_function.id != 0) {
status = _cairo_pdf_surface_emit_repeating_function (surface,
pattern,
&alpha_function,
repeat_begin,
repeat_end);
if (unlikely (status))
return status;
}
} else if (pattern->n_stops <= 2) {
/* For EXTEND_NONE and EXTEND_PAD if there are only two stops a
* Type 2 function is used by itself without a stitching
* function. Type 2 functions always have the domain [0 1] */
domain[0] = 0.0;
domain[1] = 1.0;
}
_cairo_pdf_surface_update_object (surface, pdf_pattern->pattern_res);
_cairo_pdf_surface_output_gradient (surface, pdf_pattern,
pdf_pattern->pattern_res,
&pat_to_pdf, &start, &end, domain,
"/DeviceRGB", color_function);
if (alpha_function.id != 0) {
cairo_pdf_resource_t mask_resource;
assert (pdf_pattern->gstate_res.id != 0);
/* Create pattern for SMask. */
mask_resource = _cairo_pdf_surface_new_object (surface);
if (mask_resource.id == 0)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
_cairo_pdf_surface_output_gradient (surface, pdf_pattern,
mask_resource,
&pat_to_pdf, &start, &end, domain,
"/DeviceGray", alpha_function);
status = cairo_pdf_surface_emit_transparency_group (surface,
pdf_pattern,
pdf_pattern->gstate_res,
mask_resource);
if (unlikely (status))
return status;
}
return _cairo_output_stream_get_status (surface->output);
}
static cairo_int_status_t
_cairo_pdf_surface_emit_mesh_pattern (cairo_pdf_surface_t *surface,
cairo_pdf_pattern_t *pdf_pattern)
{
cairo_matrix_t pat_to_pdf;
cairo_int_status_t status;
cairo_pattern_t *pattern = pdf_pattern->pattern;
cairo_pdf_shading_t shading;
int i;
cairo_pdf_resource_t res;
cairo_matrix_t mat;
pat_to_pdf = pattern->matrix;
status = cairo_matrix_invert (&pat_to_pdf);
/* cairo_pattern_set_matrix ensures the matrix is invertible */
assert (status == CAIRO_INT_STATUS_SUCCESS);
if (pdf_pattern->inverted_y_axis)
cairo_matrix_init (&mat, 1, 0, 0, 1, 0, 0);
else
cairo_matrix_init (&mat, 1, 0, 0, -1, 0, surface->height);
cairo_matrix_multiply (&pat_to_pdf, &pat_to_pdf, &mat);
status = _cairo_pdf_shading_init_color (&shading, (cairo_mesh_pattern_t *) pattern);
if (unlikely (status))
return status;
res = _cairo_pdf_surface_new_object (surface);
if (unlikely (res.id == 0))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /ShadingType %d\n"
" /ColorSpace /DeviceRGB\n"
" /BitsPerCoordinate %d\n"
" /BitsPerComponent %d\n"
" /BitsPerFlag %d\n"
" /Decode [",
res.id,
shading.shading_type,
shading.bits_per_coordinate,
shading.bits_per_component,
shading.bits_per_flag);
for (i = 0; i < shading.decode_array_length; i++)
_cairo_output_stream_printf (surface->output, "%f ", shading.decode_array[i]);
_cairo_output_stream_printf (surface->output,
"]\n"
" /Length %ld\n"
">>\n"
"stream\n",
shading.data_length);
_cairo_output_stream_write (surface->output, shading.data, shading.data_length);
_cairo_output_stream_printf (surface->output,
"\nendstream\n"
"endobj\n");
_cairo_pdf_shading_fini (&shading);
_cairo_pdf_surface_update_object (surface, pdf_pattern->pattern_res);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /Pattern\n"
" /PatternType 2\n"
" /Matrix [ ",
pdf_pattern->pattern_res.id);
_cairo_output_stream_print_matrix (surface->output, &pat_to_pdf);
_cairo_output_stream_printf (surface->output,
" ]\n"
" /Shading %d 0 R\n"
">>\n"
"endobj\n",
res.id);
if (pdf_pattern->gstate_res.id != 0) {
cairo_pdf_resource_t mask_resource;
/* Create pattern for SMask. */
res = _cairo_pdf_surface_new_object (surface);
if (unlikely (res.id == 0))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
status = _cairo_pdf_shading_init_alpha (&shading, (cairo_mesh_pattern_t *) pattern);
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /ShadingType %d\n"
" /ColorSpace /DeviceGray\n"
" /BitsPerCoordinate %d\n"
" /BitsPerComponent %d\n"
" /BitsPerFlag %d\n"
" /Decode [",
res.id,
shading.shading_type,
shading.bits_per_coordinate,
shading.bits_per_component,
shading.bits_per_flag);
for (i = 0; i < shading.decode_array_length; i++)
_cairo_output_stream_printf (surface->output, "%f ", shading.decode_array[i]);
_cairo_output_stream_printf (surface->output,
"]\n"
" /Length %ld\n"
">>\n"
"stream\n",
shading.data_length);
_cairo_output_stream_write (surface->output, shading.data, shading.data_length);
_cairo_output_stream_printf (surface->output,
"\nendstream\n"
"endobj\n");
_cairo_pdf_shading_fini (&shading);
mask_resource = _cairo_pdf_surface_new_object (surface);
if (unlikely (mask_resource.id == 0))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /Pattern\n"
" /PatternType 2\n"
" /Matrix [ ",
mask_resource.id);
_cairo_output_stream_print_matrix (surface->output, &pat_to_pdf);
_cairo_output_stream_printf (surface->output,
" ]\n"
" /Shading %d 0 R\n"
">>\n"
"endobj\n",
res.id);
status = cairo_pdf_surface_emit_transparency_group (surface,
pdf_pattern,
pdf_pattern->gstate_res,
mask_resource);
if (unlikely (status))
return status;
}
return _cairo_output_stream_get_status (surface->output);
}
static cairo_int_status_t
_cairo_pdf_surface_emit_pattern (cairo_pdf_surface_t *surface, cairo_pdf_pattern_t *pdf_pattern)
{
cairo_int_status_t status;
switch (pdf_pattern->pattern->type) {
case CAIRO_PATTERN_TYPE_SOLID:
ASSERT_NOT_REACHED;
status = _cairo_error (CAIRO_STATUS_PATTERN_TYPE_MISMATCH);
break;
case CAIRO_PATTERN_TYPE_SURFACE:
case CAIRO_PATTERN_TYPE_RASTER_SOURCE:
status = _cairo_pdf_surface_emit_surface_pattern (surface, pdf_pattern);
break;
case CAIRO_PATTERN_TYPE_LINEAR:
case CAIRO_PATTERN_TYPE_RADIAL:
status = _cairo_pdf_surface_emit_gradient (surface, pdf_pattern);
break;
case CAIRO_PATTERN_TYPE_MESH:
status = _cairo_pdf_surface_emit_mesh_pattern (surface, pdf_pattern);
break;
default:
ASSERT_NOT_REACHED;
status = _cairo_error (CAIRO_STATUS_PATTERN_TYPE_MISMATCH);
break;
}
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_paint_surface_pattern (cairo_pdf_surface_t *surface,
cairo_operator_t op,
const cairo_pattern_t *source,
const cairo_rectangle_int_t *extents,
double alpha,
cairo_pdf_resource_t *smask_res,
cairo_bool_t stencil_mask)
{
cairo_matrix_t cairo_p2d, pdf_p2d;
cairo_int_status_t status;
int alpha_id;
double x_offset;
double y_offset;
cairo_pdf_source_surface_entry_t *pdf_source;
if (source->extend == CAIRO_EXTEND_PAD &&
!(source->type == CAIRO_PATTERN_TYPE_SURFACE &&
((cairo_surface_pattern_t *)source)->surface->type == CAIRO_SURFACE_TYPE_RECORDING))
{
status = _cairo_pdf_surface_add_padded_image_surface (surface,
source,
extents,
&pdf_source,
&x_offset,
&y_offset,
NULL);
} else {
status = _cairo_pdf_surface_add_source_surface (surface,
NULL,
source,
op,
source->filter,
stencil_mask,
FALSE, /* smask */
alpha != 1.0, /* need_transp_group */
extents,
smask_res,
&pdf_source,
&x_offset,
&y_offset,
NULL);
}
if (unlikely (status))
return status;
cairo_p2d = source->matrix;
status = cairo_matrix_invert (&cairo_p2d);
/* cairo_pattern_set_matrix ensures the matrix is invertible */
assert (status == CAIRO_INT_STATUS_SUCCESS);
pdf_p2d = surface->cairo_to_pdf;
cairo_matrix_multiply (&pdf_p2d, &cairo_p2d, &pdf_p2d);
cairo_matrix_translate (&pdf_p2d, x_offset, y_offset);
if (pdf_source->emit_image) {
int width, height;
if (pdf_source->bounded) {
width = pdf_source->extents.width;
height = pdf_source->extents.height;
} else {
/* We can't scale an image to an unbounded surface size so just set the size to 1 */
width = 1;
height = 1;
}
cairo_matrix_translate (&pdf_p2d, 0.0, height);
cairo_matrix_scale (&pdf_p2d, 1.0, -1.0);
cairo_matrix_scale (&pdf_p2d, width, height);
}
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (unlikely (status))
return status;
if (! _cairo_matrix_is_identity (&pdf_p2d)) {
_cairo_output_stream_print_matrix (surface->output, &pdf_p2d);
_cairo_output_stream_printf (surface->output, " cm\n");
}
status = _cairo_pdf_surface_add_alpha (surface, alpha, &alpha_id);
if (unlikely (status))
return status;
if (stencil_mask) {
_cairo_output_stream_printf (surface->output,
"/x%d Do\n",
pdf_source->surface_res.id);
} else {
_cairo_output_stream_printf (surface->output,
"/a%d gs /x%d Do\n",
alpha_id,
pdf_source->surface_res.id);
}
return _cairo_pdf_surface_add_xobject (surface, pdf_source->surface_res);
}
static cairo_int_status_t
_cairo_pdf_surface_paint_gradient (cairo_pdf_surface_t *surface,
cairo_operator_t op,
const cairo_pattern_t *source,
const cairo_rectangle_int_t *extents,
double alpha)
{
cairo_pdf_resource_t shading_res, gstate_res;
cairo_matrix_t pat_to_pdf;
cairo_int_status_t status;
int alpha_id;
status = _cairo_pdf_surface_add_pdf_shading (surface, source,
op, extents,
&shading_res, &gstate_res);
if (unlikely (status == CAIRO_INT_STATUS_NOTHING_TO_DO))
return CAIRO_INT_STATUS_SUCCESS;
if (unlikely (status))
return status;
pat_to_pdf = source->matrix;
status = cairo_matrix_invert (&pat_to_pdf);
/* cairo_pattern_set_matrix ensures the matrix is invertible */
assert (status == CAIRO_INT_STATUS_SUCCESS);
cairo_matrix_multiply (&pat_to_pdf, &pat_to_pdf, &surface->cairo_to_pdf);
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (unlikely (status))
return status;
if (! _cairo_matrix_is_identity (&pat_to_pdf)) {
_cairo_output_stream_print_matrix (surface->output, &pat_to_pdf);
_cairo_output_stream_printf (surface->output, " cm\n");
}
status = _cairo_pdf_surface_add_shading (surface, shading_res);
if (unlikely (status))
return status;
if (gstate_res.id != 0) {
status = _cairo_pdf_surface_add_smask (surface, gstate_res);
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output,
"/s%d gs /sh%d sh\n",
gstate_res.id,
shading_res.id);
} else {
status = _cairo_pdf_surface_add_alpha (surface, alpha, &alpha_id);
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output,
"/a%d gs /sh%d sh\n",
alpha_id,
shading_res.id);
}
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_paint_pattern (cairo_pdf_surface_t *surface,
cairo_operator_t op,
const cairo_pattern_t *source,
const cairo_rectangle_int_t *extents,
double alpha,
cairo_bool_t mask)
{
switch (source->type) {
case CAIRO_PATTERN_TYPE_SURFACE:
case CAIRO_PATTERN_TYPE_RASTER_SOURCE:
return _cairo_pdf_surface_paint_surface_pattern (surface,
op,
source,
extents,
alpha,
NULL,
mask);
case CAIRO_PATTERN_TYPE_LINEAR:
case CAIRO_PATTERN_TYPE_RADIAL:
case CAIRO_PATTERN_TYPE_MESH:
return _cairo_pdf_surface_paint_gradient (surface,
op,
source,
extents,
alpha);
case CAIRO_PATTERN_TYPE_SOLID:
default:
ASSERT_NOT_REACHED;
return CAIRO_STATUS_SUCCESS;
}
}
static cairo_bool_t
_can_paint_pattern (const cairo_pattern_t *pattern)
{
switch (pattern->type) {
case CAIRO_PATTERN_TYPE_SOLID:
return FALSE;
case CAIRO_PATTERN_TYPE_SURFACE:
case CAIRO_PATTERN_TYPE_RASTER_SOURCE:
return (pattern->extend == CAIRO_EXTEND_NONE ||
pattern->extend == CAIRO_EXTEND_PAD);
case CAIRO_PATTERN_TYPE_LINEAR:
case CAIRO_PATTERN_TYPE_RADIAL:
return TRUE;
case CAIRO_PATTERN_TYPE_MESH:
return FALSE;
default:
ASSERT_NOT_REACHED;
return FALSE;
}
}
static cairo_int_status_t
_cairo_pdf_surface_select_operator (cairo_pdf_surface_t *surface,
cairo_operator_t op)
{
cairo_int_status_t status;
if (op == surface->current_operator)
return CAIRO_STATUS_SUCCESS;
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output,
"/b%d gs\n", op);
surface->current_operator = op;
_cairo_pdf_surface_add_operator (surface, op);
return CAIRO_STATUS_SUCCESS;
}
static cairo_int_status_t
_cairo_pdf_surface_select_pattern (cairo_pdf_surface_t *surface,
const cairo_pattern_t *pattern,
cairo_pdf_resource_t pattern_res,
cairo_bool_t is_stroke)
{
cairo_int_status_t status;
int alpha;
const cairo_color_t *solid_color = NULL;
if (pattern->type == CAIRO_PATTERN_TYPE_SOLID) {
const cairo_solid_pattern_t *solid = (const cairo_solid_pattern_t *) pattern;
solid_color = &solid->color;
}
if (solid_color != NULL) {
if (surface->current_pattern_is_solid_color == FALSE ||
surface->current_color_red != solid_color->red ||
surface->current_color_green != solid_color->green ||
surface->current_color_blue != solid_color->blue ||
surface->current_color_is_stroke != is_stroke)
{
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output,
"%f %f %f ",
solid_color->red,
solid_color->green,
solid_color->blue);
if (is_stroke)
_cairo_output_stream_printf (surface->output, "RG ");
else
_cairo_output_stream_printf (surface->output, "rg ");
surface->current_color_red = solid_color->red;
surface->current_color_green = solid_color->green;
surface->current_color_blue = solid_color->blue;
surface->current_color_is_stroke = is_stroke;
}
if (surface->current_pattern_is_solid_color == FALSE ||
surface->current_color_alpha != solid_color->alpha)
{
status = _cairo_pdf_surface_add_alpha (surface, solid_color->alpha, &alpha);
if (unlikely (status))
return status;
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output,
"/a%d gs\n",
alpha);
surface->current_color_alpha = solid_color->alpha;
}
surface->current_pattern_is_solid_color = TRUE;
} else {
status = _cairo_pdf_surface_add_alpha (surface, 1.0, &alpha);
if (unlikely (status))
return status;
status = _cairo_pdf_surface_add_pattern (surface, pattern_res);
if (unlikely (status))
return status;
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (unlikely (status))
return status;
/* fill-stroke calls select_pattern twice. Don't save if the
* gstate is already saved. */
if (!surface->select_pattern_gstate_saved)
_cairo_output_stream_printf (surface->output, "q ");
if (is_stroke) {
_cairo_output_stream_printf (surface->output,
"/Pattern CS /p%d SCN ",
pattern_res.id);
} else {
_cairo_output_stream_printf (surface->output,
"/Pattern cs /p%d scn ",
pattern_res.id);
}
_cairo_output_stream_printf (surface->output,
"/a%d gs\n",
alpha);
surface->select_pattern_gstate_saved = TRUE;
surface->current_pattern_is_solid_color = FALSE;
}
return _cairo_output_stream_get_status (surface->output);
}
static cairo_int_status_t
_cairo_pdf_surface_unselect_pattern (cairo_pdf_surface_t *surface)
{
cairo_int_status_t status;
if (surface->select_pattern_gstate_saved) {
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output, "Q\n");
_cairo_pdf_operators_reset (&surface->pdf_operators);
surface->current_pattern_is_solid_color = FALSE;
}
surface->select_pattern_gstate_saved = FALSE;
return CAIRO_STATUS_SUCCESS;
}
static cairo_int_status_t
_cairo_pdf_surface_show_page (void *abstract_surface)
{
cairo_pdf_surface_t *surface = abstract_surface;
cairo_int_status_t status;
status = _cairo_array_append (&surface->page_heights, &surface->height);
if (unlikely (status))
return status;
status = _cairo_array_append (&surface->page_labels, &surface->current_page_label);
if (unlikely (status))
return status;
surface->current_page_label = NULL;
status = _cairo_pdf_interchange_end_page_content (surface);
if (unlikely (status))
return status;
status = _cairo_pdf_surface_close_content_stream (surface);
if (unlikely (status))
return status;
_cairo_surface_clipper_reset (&surface->clipper);
status = _cairo_pdf_surface_write_page (surface);
if (unlikely (status))
return status;
_cairo_pdf_surface_clear (surface);
return CAIRO_STATUS_SUCCESS;
}
static cairo_bool_t
_cairo_pdf_surface_get_extents (void *abstract_surface,
cairo_rectangle_int_t *rectangle)
{
cairo_pdf_surface_t *surface = abstract_surface;
if (surface->surface_bounded)
*rectangle = surface->surface_extents;
return surface->surface_bounded;
}
static void
_cairo_pdf_surface_get_font_options (void *abstract_surface,
cairo_font_options_t *options)
{
_cairo_font_options_init_default (options);
cairo_font_options_set_hint_style (options, CAIRO_HINT_STYLE_NONE);
cairo_font_options_set_hint_metrics (options, CAIRO_HINT_METRICS_OFF);
cairo_font_options_set_antialias (options, CAIRO_ANTIALIAS_GRAY);
_cairo_font_options_set_round_glyph_positions (options, CAIRO_ROUND_GLYPH_POS_OFF);
}
static void
_cairo_pdf_surface_write_pages (cairo_pdf_surface_t *surface)
{
cairo_pdf_resource_t page;
int num_pages, i;
_cairo_pdf_surface_update_object (surface, surface->pages_resource);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /Pages\n"
" /Kids [ ",
surface->pages_resource.id);
num_pages = _cairo_array_num_elements (&surface->pages);
for (i = 0; i < num_pages; i++) {
_cairo_array_copy_element (&surface->pages, i, &page);
_cairo_output_stream_printf (surface->output, "%d 0 R ", page.id);
}
_cairo_output_stream_printf (surface->output, "]\n");
_cairo_output_stream_printf (surface->output, " /Count %d\n", num_pages);
/* TODO: Figure out which other defaults to be inherited by /Page
* objects. */
_cairo_output_stream_printf (surface->output,
">>\n"
"endobj\n");
}
cairo_int_status_t
_cairo_utf8_to_pdf_string (const char *utf8, char **str_out)
{
int i;
int len;
cairo_bool_t ascii;
char *str;
cairo_int_status_t status = CAIRO_STATUS_SUCCESS;
ascii = TRUE;
len = strlen (utf8);
for (i = 0; i < len; i++) {
unsigned c = utf8[i];
if (c < 32 || c > 126 || c == '(' || c == ')' || c == '\\') {
ascii = FALSE;
break;
}
}
if (ascii) {
str = _cairo_malloc (len + 3);
if (str == NULL)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
str[0] = '(';
for (i = 0; i < len; i++)
str[i+1] = utf8[i];
str[i+1] = ')';
str[i+2] = 0;
} else {
uint16_t *utf16 = NULL;
int utf16_len = 0;
status = _cairo_utf8_to_utf16 (utf8, -1, &utf16, &utf16_len);
if (unlikely (status))
return status;
str = _cairo_malloc (utf16_len*4 + 7);
if (str == NULL) {
free (utf16);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
strcpy (str, "<FEFF");
for (i = 0; i < utf16_len; i++)
snprintf (str + 4*i + 5, 5, "%04X", utf16[i]);
strcat (str, ">");
free (utf16);
}
*str_out = str;
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_emit_unicode_for_glyph (cairo_pdf_surface_t *surface,
const char *utf8)
{
uint16_t *utf16 = NULL;
int utf16_len = 0;
cairo_int_status_t status;
int i;
if (utf8 && *utf8) {
status = _cairo_utf8_to_utf16 (utf8, -1, &utf16, &utf16_len);
if (unlikely (status == CAIRO_INT_STATUS_INVALID_STRING)) {
utf16 = NULL;
utf16_len = 0;
} else if (unlikely (status)) {
return status;
}
}
_cairo_output_stream_printf (surface->output, "<");
if (utf16 == NULL || utf16_len == 0) {
/* According to the "ToUnicode Mapping File Tutorial"
* http://www.adobe.com/devnet/acrobat/pdfs/5411.ToUnicode.pdf
*
* Glyphs that do not map to a Unicode code point must be
* mapped to 0xfffd "REPLACEMENT CHARACTER".
*/
_cairo_output_stream_printf (surface->output,
"fffd");
} else {
for (i = 0; i < utf16_len; i++)
_cairo_output_stream_printf (surface->output,
"%04x", (int) (utf16[i]));
}
_cairo_output_stream_printf (surface->output, ">");
free (utf16);
return CAIRO_STATUS_SUCCESS;
}
/* Bob Jenkins hash
*
* Public domain code from:
* http://burtleburtle.net/bob/hash/doobs.html
*/
#define HASH_MIX(a,b,c) \
{ \
a -= b; a -= c; a ^= (c>>13); \
b -= c; b -= a; b ^= (a<<8); \
c -= a; c -= b; c ^= (b>>13); \
a -= b; a -= c; a ^= (c>>12); \
b -= c; b -= a; b ^= (a<<16); \
c -= a; c -= b; c ^= (b>>5); \
a -= b; a -= c; a ^= (c>>3); \
b -= c; b -= a; b ^= (a<<10); \
c -= a; c -= b; c ^= (b>>15); \
}
static uint32_t
_hash_data (const unsigned char *data, int length, uint32_t initval)
{
uint32_t a, b, c, len;
len = length;
a = b = 0x9e3779b9; /* the golden ratio; an arbitrary value */
c = initval; /* the previous hash value */
while (len >= 12) {
a += (data[0] + ((uint32_t)data[1]<<8) + ((uint32_t)data[2]<<16) + ((uint32_t)data[3]<<24));
b += (data[4] + ((uint32_t)data[5]<<8) + ((uint32_t)data[6]<<16) + ((uint32_t)data[7]<<24));
c += (data[8] + ((uint32_t)data[9]<<8) + ((uint32_t)data[10]<<16)+ ((uint32_t)data[11]<<24));
HASH_MIX (a,b,c);
data += 12;
len -= 12;
}
c += length;
switch(len) {
case 11: c+= ((uint32_t) data[10] << 24); /* fall through */
case 10: c+= ((uint32_t) data[9] << 16); /* fall through */
case 9 : c+= ((uint32_t) data[8] << 8); /* fall through */
case 8 : b+= ((uint32_t) data[7] << 24); /* fall through */
case 7 : b+= ((uint32_t) data[6] << 16); /* fall through */
case 6 : b+= ((uint32_t) data[5] << 8); /* fall through */
case 5 : b+= data[4]; /* fall through */
case 4 : a+= ((uint32_t) data[3] << 24); /* fall through */
case 3 : a+= ((uint32_t) data[2] << 16); /* fall through */
case 2 : a+= ((uint32_t) data[1] << 8); /* fall through */
case 1 : a+= data[0];
}
HASH_MIX (a,b,c);
return c;
}
static void
_create_font_subset_tag (cairo_scaled_font_subset_t *font_subset,
const char *font_name,
char *tag)
{
uint32_t hash;
int i;
long numerator;
ldiv_t d;
hash = _hash_data ((unsigned char *) font_name, strlen(font_name), 0);
hash = _hash_data ((unsigned char *) (font_subset->glyphs),
font_subset->num_glyphs * sizeof(unsigned long), hash);
numerator = hash;
for (i = 0; i < 6; i++) {
d = ldiv (numerator, 26);
numerator = d.quot;
tag[i] = 'A' + d.rem;
}
tag[i] = 0;
}
static cairo_int_status_t
_cairo_pdf_surface_emit_to_unicode_stream (cairo_pdf_surface_t *surface,
cairo_scaled_font_subset_t *font_subset,
cairo_pdf_resource_t *stream)
{
unsigned int i, num_bfchar;
cairo_int_status_t status;
stream->id = 0;
status = _cairo_pdf_surface_open_stream (surface,
NULL,
surface->compress_content,
NULL);
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output,
"/CIDInit /ProcSet findresource begin\n"
"12 dict begin\n"
"begincmap\n"
"/CIDSystemInfo\n"
"<< /Registry (Adobe)\n"
" /Ordering (UCS)\n"
" /Supplement 0\n"
">> def\n"
"/CMapName /Adobe-Identity-UCS def\n"
"/CMapType 2 def\n"
"1 begincodespacerange\n");
if (font_subset->is_composite && !font_subset->is_latin) {
_cairo_output_stream_printf (surface->output,
"<0000> <ffff>\n");
} else {
_cairo_output_stream_printf (surface->output,
"<00> <ff>\n");
}
_cairo_output_stream_printf (surface->output,
"endcodespacerange\n");
if (font_subset->is_scaled) {
/* Type 3 fonts include glyph 0 in the subset */
num_bfchar = font_subset->num_glyphs;
/* The CMap specification has a limit of 100 characters per beginbfchar operator */
_cairo_output_stream_printf (surface->output,
"%d beginbfchar\n",
num_bfchar > 100 ? 100 : num_bfchar);
for (i = 0; i < num_bfchar; i++) {
if (i != 0 && i % 100 == 0) {
_cairo_output_stream_printf (surface->output,
"endbfchar\n"
"%d beginbfchar\n",
num_bfchar - i > 100 ? 100 : num_bfchar - i);
}
_cairo_output_stream_printf (surface->output, "<%02x> ", i);
status = _cairo_pdf_surface_emit_unicode_for_glyph (surface,
font_subset->utf8[i]);
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output,
"\n");
}
} else {
/* Other fonts reserve glyph 0 for .notdef. Omit glyph 0 from the /ToUnicode map */
num_bfchar = font_subset->num_glyphs - 1;
/* The CMap specification has a limit of 100 characters per beginbfchar operator */
_cairo_output_stream_printf (surface->output,
"%d beginbfchar\n",
num_bfchar > 100 ? 100 : num_bfchar);
for (i = 0; i < num_bfchar; i++) {
if (i != 0 && i % 100 == 0) {
_cairo_output_stream_printf (surface->output,
"endbfchar\n"
"%d beginbfchar\n",
num_bfchar - i > 100 ? 100 : num_bfchar - i);
}
if (font_subset->is_latin)
_cairo_output_stream_printf (surface->output, "<%02x> ", font_subset->to_latin_char[i + 1]);
else if (font_subset->is_composite)
_cairo_output_stream_printf (surface->output, "<%04x> ", i + 1);
else
_cairo_output_stream_printf (surface->output, "<%02x> ", i + 1);
status = _cairo_pdf_surface_emit_unicode_for_glyph (surface,
font_subset->utf8[i + 1]);
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output,
"\n");
}
}
_cairo_output_stream_printf (surface->output,
"endbfchar\n");
_cairo_output_stream_printf (surface->output,
"endcmap\n"
"CMapName currentdict /CMap defineresource pop\n"
"end\n"
"end\n");
*stream = surface->pdf_stream.self;
return _cairo_pdf_surface_close_stream (surface);
}
#define PDF_UNITS_PER_EM 1000
static cairo_int_status_t
_cairo_pdf_surface_emit_cff_font (cairo_pdf_surface_t *surface,
cairo_scaled_font_subset_t *font_subset,
cairo_cff_subset_t *subset)
{
cairo_pdf_resource_t stream, descriptor, cidfont_dict;
cairo_pdf_resource_t subset_resource, to_unicode_stream;
cairo_pdf_font_t font;
unsigned int i, last_glyph;
cairo_int_status_t status;
char tag[10];
_create_font_subset_tag (font_subset, subset->ps_name, tag);
subset_resource = _cairo_pdf_surface_get_font_resource (surface,
font_subset->font_id,
font_subset->subset_id);
if (subset_resource.id == 0)
return CAIRO_STATUS_SUCCESS;
status = _cairo_pdf_surface_open_stream (surface,
NULL,
TRUE,
font_subset->is_latin ?
" /Subtype /Type1C\n" :
" /Subtype /CIDFontType0C\n");
if (unlikely (status))
return status;
stream = surface->pdf_stream.self;
_cairo_output_stream_write (surface->output,
subset->data, subset->data_length);
status = _cairo_pdf_surface_close_stream (surface);
if (unlikely (status))
return status;
status = _cairo_pdf_surface_emit_to_unicode_stream (surface,
font_subset,
&to_unicode_stream);
if (_cairo_int_status_is_error (status))
return status;
descriptor = _cairo_pdf_surface_new_object (surface);
if (descriptor.id == 0)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /FontDescriptor\n"
" /FontName /%s+%s\n",
descriptor.id,
tag,
subset->ps_name);
if (subset->family_name_utf8) {
char *pdf_str;
status = _cairo_utf8_to_pdf_string (subset->family_name_utf8, &pdf_str);
if (likely (status == CAIRO_INT_STATUS_SUCCESS)) {
_cairo_output_stream_printf (surface->output,
" /FontFamily %s\n",
pdf_str);
free (pdf_str);
} else if (status != CAIRO_INT_STATUS_INVALID_STRING) {
return status;
}
}
_cairo_output_stream_printf (surface->output,
" /Flags 4\n"
" /FontBBox [ %ld %ld %ld %ld ]\n"
" /ItalicAngle 0\n"
" /Ascent %ld\n"
" /Descent %ld\n"
" /CapHeight %ld\n"
" /StemV 80\n"
" /StemH 80\n"
" /FontFile3 %u 0 R\n"
">>\n"
"endobj\n",
(long)(subset->x_min*PDF_UNITS_PER_EM),
(long)(subset->y_min*PDF_UNITS_PER_EM),
(long)(subset->x_max*PDF_UNITS_PER_EM),
(long)(subset->y_max*PDF_UNITS_PER_EM),
(long)(subset->ascent*PDF_UNITS_PER_EM),
(long)(subset->descent*PDF_UNITS_PER_EM),
(long)(subset->y_max*PDF_UNITS_PER_EM),
stream.id);
if (font_subset->is_latin) {
/* find last glyph used */
for (i = 255; i >= 32; i--)
if (font_subset->latin_to_subset_glyph_index[i] > 0)
break;
last_glyph = i;
_cairo_pdf_surface_update_object (surface, subset_resource);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /Font\n"
" /Subtype /Type1\n"
" /BaseFont /%s+%s\n"
" /FirstChar 32\n"
" /LastChar %d\n"
" /FontDescriptor %d 0 R\n"
" /Encoding /WinAnsiEncoding\n"
" /Widths [",
subset_resource.id,
tag,
subset->ps_name,
last_glyph,
descriptor.id);
for (i = 32; i < last_glyph + 1; i++) {
int glyph = font_subset->latin_to_subset_glyph_index[i];
if (glyph > 0) {
_cairo_output_stream_printf (surface->output,
" %ld",
(long)(subset->widths[glyph]*PDF_UNITS_PER_EM));
} else {
_cairo_output_stream_printf (surface->output, " 0");
}
}
_cairo_output_stream_printf (surface->output,
" ]\n");
if (to_unicode_stream.id != 0)
_cairo_output_stream_printf (surface->output,
" /ToUnicode %d 0 R\n",
to_unicode_stream.id);
_cairo_output_stream_printf (surface->output,
">>\n"
"endobj\n");
} else {
cidfont_dict = _cairo_pdf_surface_new_object (surface);
if (cidfont_dict.id == 0)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /Font\n"
" /Subtype /CIDFontType0\n"
" /BaseFont /%s+%s\n"
" /CIDSystemInfo\n"
" << /Registry (Adobe)\n"
" /Ordering (Identity)\n"
" /Supplement 0\n"
" >>\n"
" /FontDescriptor %d 0 R\n"
" /W [0 [",
cidfont_dict.id,
tag,
subset->ps_name,
descriptor.id);
for (i = 0; i < font_subset->num_glyphs; i++)
_cairo_output_stream_printf (surface->output,
" %ld",
(long)(subset->widths[i]*PDF_UNITS_PER_EM));
_cairo_output_stream_printf (surface->output,
" ]]\n"
">>\n"
"endobj\n");
_cairo_pdf_surface_update_object (surface, subset_resource);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /Font\n"
" /Subtype /Type0\n"
" /BaseFont /%s+%s\n"
" /Encoding /Identity-H\n"
" /DescendantFonts [ %d 0 R]\n",
subset_resource.id,
tag,
subset->ps_name,
cidfont_dict.id);
if (to_unicode_stream.id != 0)
_cairo_output_stream_printf (surface->output,
" /ToUnicode %d 0 R\n",
to_unicode_stream.id);
_cairo_output_stream_printf (surface->output,
">>\n"
"endobj\n");
}
font.font_id = font_subset->font_id;
font.subset_id = font_subset->subset_id;
font.subset_resource = subset_resource;
status = _cairo_array_append (&surface->fonts, &font);
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_emit_cff_font_subset (cairo_pdf_surface_t *surface,
cairo_scaled_font_subset_t *font_subset)
{
cairo_int_status_t status;
cairo_cff_subset_t subset;
char name[64];
snprintf (name, sizeof name, "CairoFont-%d-%d",
font_subset->font_id, font_subset->subset_id);
status = _cairo_cff_subset_init (&subset, name, font_subset);
if (unlikely (status))
return status;
status = _cairo_pdf_surface_emit_cff_font (surface, font_subset, &subset);
_cairo_cff_subset_fini (&subset);
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_emit_cff_fallback_font (cairo_pdf_surface_t *surface,
cairo_scaled_font_subset_t *font_subset)
{
cairo_int_status_t status;
cairo_cff_subset_t subset;
char name[64];
/* CFF fallback subsetting does not work with 8-bit glyphs unless
* they are a latin subset */
if (!font_subset->is_composite && !font_subset->is_latin)
return CAIRO_INT_STATUS_UNSUPPORTED;
snprintf (name, sizeof name, "CairoFont-%d-%d",
font_subset->font_id, font_subset->subset_id);
status = _cairo_cff_fallback_init (&subset, name, font_subset);
if (unlikely (status))
return status;
status = _cairo_pdf_surface_emit_cff_font (surface, font_subset, &subset);
_cairo_cff_fallback_fini (&subset);
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_emit_type1_font (cairo_pdf_surface_t *surface,
cairo_scaled_font_subset_t *font_subset,
cairo_type1_subset_t *subset)
{
cairo_pdf_resource_t stream, descriptor, subset_resource, to_unicode_stream;
cairo_pdf_font_t font;
cairo_int_status_t status;
unsigned long length;
unsigned int i, last_glyph;
char tag[10];
_create_font_subset_tag (font_subset, subset->base_font, tag);
subset_resource = _cairo_pdf_surface_get_font_resource (surface,
font_subset->font_id,
font_subset->subset_id);
if (subset_resource.id == 0)
return CAIRO_STATUS_SUCCESS;
length = subset->header_length + subset->data_length + subset->trailer_length;
status = _cairo_pdf_surface_open_stream (surface,
NULL,
TRUE,
" /Length1 %lu\n"
" /Length2 %lu\n"
" /Length3 %lu\n",
subset->header_length,
subset->data_length,
subset->trailer_length);
if (unlikely (status))
return status;
stream = surface->pdf_stream.self;
_cairo_output_stream_write (surface->output, subset->data, length);
status = _cairo_pdf_surface_close_stream (surface);
if (unlikely (status))
return status;
status = _cairo_pdf_surface_emit_to_unicode_stream (surface,
font_subset,
&to_unicode_stream);
if (_cairo_int_status_is_error (status))
return status;
last_glyph = font_subset->num_glyphs - 1;
if (font_subset->is_latin) {
/* find last glyph used */
for (i = 255; i >= 32; i--)
if (font_subset->latin_to_subset_glyph_index[i] > 0)
break;
last_glyph = i;
}
descriptor = _cairo_pdf_surface_new_object (surface);
if (descriptor.id == 0)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /FontDescriptor\n"
" /FontName /%s+%s\n"
" /Flags 4\n"
" /FontBBox [ %ld %ld %ld %ld ]\n"
" /ItalicAngle 0\n"
" /Ascent %ld\n"
" /Descent %ld\n"
" /CapHeight %ld\n"
" /StemV 80\n"
" /StemH 80\n"
" /FontFile %u 0 R\n"
">>\n"
"endobj\n",
descriptor.id,
tag,
subset->base_font,
(long)(subset->x_min*PDF_UNITS_PER_EM),
(long)(subset->y_min*PDF_UNITS_PER_EM),
(long)(subset->x_max*PDF_UNITS_PER_EM),
(long)(subset->y_max*PDF_UNITS_PER_EM),
(long)(subset->ascent*PDF_UNITS_PER_EM),
(long)(subset->descent*PDF_UNITS_PER_EM),
(long)(subset->y_max*PDF_UNITS_PER_EM),
stream.id);
_cairo_pdf_surface_update_object (surface, subset_resource);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /Font\n"
" /Subtype /Type1\n"
" /BaseFont /%s+%s\n"
" /FirstChar %d\n"
" /LastChar %d\n"
" /FontDescriptor %d 0 R\n",
subset_resource.id,
tag,
subset->base_font,
font_subset->is_latin ? 32 : 0,
last_glyph,
descriptor.id);
if (font_subset->is_latin)
_cairo_output_stream_printf (surface->output, " /Encoding /WinAnsiEncoding\n");
_cairo_output_stream_printf (surface->output, " /Widths [");
if (font_subset->is_latin) {
for (i = 32; i < last_glyph + 1; i++) {
int glyph = font_subset->latin_to_subset_glyph_index[i];
if (glyph > 0) {
_cairo_output_stream_printf (surface->output,
" %ld",
(long)(subset->widths[glyph]*PDF_UNITS_PER_EM));
} else {
_cairo_output_stream_printf (surface->output, " 0");
}
}
} else {
for (i = 0; i < font_subset->num_glyphs; i++)
_cairo_output_stream_printf (surface->output,
" %ld",
(long)(subset->widths[i]*PDF_UNITS_PER_EM));
}
_cairo_output_stream_printf (surface->output,
" ]\n");
if (to_unicode_stream.id != 0)
_cairo_output_stream_printf (surface->output,
" /ToUnicode %d 0 R\n",
to_unicode_stream.id);
_cairo_output_stream_printf (surface->output,
">>\n"
"endobj\n");
font.font_id = font_subset->font_id;
font.subset_id = font_subset->subset_id;
font.subset_resource = subset_resource;
return _cairo_array_append (&surface->fonts, &font);
}
static cairo_int_status_t
_cairo_pdf_surface_emit_type1_font_subset (cairo_pdf_surface_t *surface,
cairo_scaled_font_subset_t *font_subset)
{
cairo_int_status_t status;
cairo_type1_subset_t subset;
char name[64];
/* 16-bit glyphs not compatible with Type 1 fonts */
if (font_subset->is_composite && !font_subset->is_latin)
return CAIRO_INT_STATUS_UNSUPPORTED;
snprintf (name, sizeof name, "CairoFont-%d-%d",
font_subset->font_id, font_subset->subset_id);
status = _cairo_type1_subset_init (&subset, name, font_subset, FALSE);
if (unlikely (status))
return status;
status = _cairo_pdf_surface_emit_type1_font (surface, font_subset, &subset);
_cairo_type1_subset_fini (&subset);
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_emit_type1_fallback_font (cairo_pdf_surface_t *surface,
cairo_scaled_font_subset_t *font_subset)
{
cairo_int_status_t status;
cairo_type1_subset_t subset;
char name[64];
/* 16-bit glyphs not compatible with Type 1 fonts */
if (font_subset->is_composite && !font_subset->is_latin)
return CAIRO_INT_STATUS_UNSUPPORTED;
snprintf (name, sizeof name, "CairoFont-%d-%d",
font_subset->font_id, font_subset->subset_id);
status = _cairo_type1_fallback_init_binary (&subset, name, font_subset);
if (unlikely (status))
return status;
status = _cairo_pdf_surface_emit_type1_font (surface, font_subset, &subset);
_cairo_type1_fallback_fini (&subset);
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_emit_truetype_font_subset (cairo_pdf_surface_t *surface,
cairo_scaled_font_subset_t *font_subset)
{
cairo_pdf_resource_t stream, descriptor, cidfont_dict;
cairo_pdf_resource_t subset_resource, to_unicode_stream;
cairo_int_status_t status;
cairo_pdf_font_t font;
cairo_truetype_subset_t subset;
unsigned int i, last_glyph;
char tag[10];
subset_resource = _cairo_pdf_surface_get_font_resource (surface,
font_subset->font_id,
font_subset->subset_id);
if (subset_resource.id == 0)
return CAIRO_STATUS_SUCCESS;
status = _cairo_truetype_subset_init_pdf (&subset, font_subset);
if (unlikely (status))
return status;
_create_font_subset_tag (font_subset, subset.ps_name, tag);
status = _cairo_pdf_surface_open_stream (surface,
NULL,
TRUE,
" /Length1 %lu\n",
subset.data_length);
if (unlikely (status)) {
_cairo_truetype_subset_fini (&subset);
return status;
}
stream = surface->pdf_stream.self;
_cairo_output_stream_write (surface->output,
subset.data, subset.data_length);
status = _cairo_pdf_surface_close_stream (surface);
if (unlikely (status)) {
_cairo_truetype_subset_fini (&subset);
return status;
}
status = _cairo_pdf_surface_emit_to_unicode_stream (surface,
font_subset,
&to_unicode_stream);
if (_cairo_int_status_is_error (status)) {
_cairo_truetype_subset_fini (&subset);
return status;
}
descriptor = _cairo_pdf_surface_new_object (surface);
if (descriptor.id == 0) {
_cairo_truetype_subset_fini (&subset);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /FontDescriptor\n"
" /FontName /%s+%s\n",
descriptor.id,
tag,
subset.ps_name);
if (subset.family_name_utf8) {
char *pdf_str;
status = _cairo_utf8_to_pdf_string (subset.family_name_utf8, &pdf_str);
if (likely (status == CAIRO_INT_STATUS_SUCCESS)) {
_cairo_output_stream_printf (surface->output,
" /FontFamily %s\n",
pdf_str);
free (pdf_str);
} else if (status != CAIRO_INT_STATUS_INVALID_STRING) {
return status;
}
}
_cairo_output_stream_printf (surface->output,
" /Flags %d\n"
" /FontBBox [ %ld %ld %ld %ld ]\n"
" /ItalicAngle 0\n"
" /Ascent %ld\n"
" /Descent %ld\n"
" /CapHeight %ld\n"
" /StemV 80\n"
" /StemH 80\n"
" /FontFile2 %u 0 R\n"
">>\n"
"endobj\n",
font_subset->is_latin ? 32 : 4,
(long)(subset.x_min*PDF_UNITS_PER_EM),
(long)(subset.y_min*PDF_UNITS_PER_EM),
(long)(subset.x_max*PDF_UNITS_PER_EM),
(long)(subset.y_max*PDF_UNITS_PER_EM),
(long)(subset.ascent*PDF_UNITS_PER_EM),
(long)(subset.descent*PDF_UNITS_PER_EM),
(long)(subset.y_max*PDF_UNITS_PER_EM),
stream.id);
if (font_subset->is_latin) {
/* find last glyph used */
for (i = 255; i >= 32; i--)
if (font_subset->latin_to_subset_glyph_index[i] > 0)
break;
last_glyph = i;
_cairo_pdf_surface_update_object (surface, subset_resource);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /Font\n"
" /Subtype /TrueType\n"
" /BaseFont /%s+%s\n"
" /FirstChar 32\n"
" /LastChar %d\n"
" /FontDescriptor %d 0 R\n"
" /Encoding /WinAnsiEncoding\n"
" /Widths [",
subset_resource.id,
tag,
subset.ps_name,
last_glyph,
descriptor.id);
for (i = 32; i < last_glyph + 1; i++) {
int glyph = font_subset->latin_to_subset_glyph_index[i];
if (glyph > 0) {
_cairo_output_stream_printf (surface->output,
" %ld",
(long)(subset.widths[glyph]*PDF_UNITS_PER_EM));
} else {
_cairo_output_stream_printf (surface->output, " 0");
}
}
_cairo_output_stream_printf (surface->output,
" ]\n");
if (to_unicode_stream.id != 0)
_cairo_output_stream_printf (surface->output,
" /ToUnicode %d 0 R\n",
to_unicode_stream.id);
_cairo_output_stream_printf (surface->output,
">>\n"
"endobj\n");
} else {
cidfont_dict = _cairo_pdf_surface_new_object (surface);
if (cidfont_dict.id == 0) {
_cairo_truetype_subset_fini (&subset);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /Font\n"
" /Subtype /CIDFontType2\n"
" /BaseFont /%s+%s\n"
" /CIDSystemInfo\n"
" << /Registry (Adobe)\n"
" /Ordering (Identity)\n"
" /Supplement 0\n"
" >>\n"
" /FontDescriptor %d 0 R\n"
" /W [0 [",
cidfont_dict.id,
tag,
subset.ps_name,
descriptor.id);
for (i = 0; i < font_subset->num_glyphs; i++)
_cairo_output_stream_printf (surface->output,
" %ld",
(long)(subset.widths[i]*PDF_UNITS_PER_EM));
_cairo_output_stream_printf (surface->output,
" ]]\n"
">>\n"
"endobj\n");
_cairo_pdf_surface_update_object (surface, subset_resource);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /Font\n"
" /Subtype /Type0\n"
" /BaseFont /%s+%s\n"
" /Encoding /Identity-H\n"
" /DescendantFonts [ %d 0 R]\n",
subset_resource.id,
tag,
subset.ps_name,
cidfont_dict.id);
if (to_unicode_stream.id != 0)
_cairo_output_stream_printf (surface->output,
" /ToUnicode %d 0 R\n",
to_unicode_stream.id);
_cairo_output_stream_printf (surface->output,
">>\n"
"endobj\n");
}
font.font_id = font_subset->font_id;
font.subset_id = font_subset->subset_id;
font.subset_resource = subset_resource;
status = _cairo_array_append (&surface->fonts, &font);
_cairo_truetype_subset_fini (&subset);
return status;
}
static cairo_int_status_t
_cairo_pdf_emit_imagemask (cairo_image_surface_t *image,
cairo_output_stream_t *stream)
{
uint8_t *byte, output_byte;
int row, col, num_cols;
/* The only image type supported by Type 3 fonts are 1-bit image
* masks */
assert (image->format == CAIRO_FORMAT_A1);
_cairo_output_stream_printf (stream,
"BI\n"
"/IM true\n"
"/W %d\n"
"/H %d\n"
"/BPC 1\n"
"/D [1 0]\n",
image->width,
image->height);
_cairo_output_stream_printf (stream,
"ID ");
num_cols = (image->width + 7) / 8;
for (row = 0; row < image->height; row++) {
byte = image->data + row * image->stride;
for (col = 0; col < num_cols; col++) {
output_byte = CAIRO_BITSWAP8_IF_LITTLE_ENDIAN (*byte);
_cairo_output_stream_write (stream, &output_byte, 1);
byte++;
}
}
_cairo_output_stream_printf (stream,
"\nEI\n");
return _cairo_output_stream_get_status (stream);
}
static cairo_int_status_t
_cairo_pdf_surface_analyze_user_font_subset (cairo_scaled_font_subset_t *font_subset,
void *closure)
{
cairo_pdf_surface_t *surface = closure;
cairo_int_status_t status = CAIRO_INT_STATUS_SUCCESS;
cairo_int_status_t status2;
unsigned int i;
cairo_surface_t *type3_surface;
cairo_output_stream_t *null_stream;
null_stream = _cairo_null_stream_create ();
type3_surface = _cairo_type3_glyph_surface_create (font_subset->scaled_font,
null_stream,
_cairo_pdf_emit_imagemask,
surface->font_subsets,
FALSE);
if (unlikely (type3_surface->status)) {
status2 = _cairo_output_stream_destroy (null_stream);
return type3_surface->status;
}
_cairo_type3_glyph_surface_set_font_subsets_callback (type3_surface,
_cairo_pdf_surface_add_font,
surface);
for (i = 0; i < font_subset->num_glyphs; i++) {
status = _cairo_type3_glyph_surface_analyze_glyph (type3_surface,
font_subset->glyphs[i]);
if (unlikely (status))
break;
}
cairo_surface_destroy (type3_surface);
status2 = _cairo_output_stream_destroy (null_stream);
if (status == CAIRO_INT_STATUS_SUCCESS)
status = status2;
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_emit_type3_font_subset (cairo_pdf_surface_t *surface,
cairo_scaled_font_subset_t *font_subset)
{
cairo_int_status_t status = CAIRO_STATUS_SUCCESS;
cairo_pdf_resource_t *glyphs, encoding, char_procs, subset_resource, to_unicode_stream;
cairo_pdf_font_t font;
double *widths;
unsigned int i;
cairo_box_t font_bbox = {{0,0},{0,0}};
cairo_box_t bbox = {{0,0},{0,0}};
cairo_surface_t *type3_surface;
if (font_subset->num_glyphs == 0)
return CAIRO_STATUS_SUCCESS;
subset_resource = _cairo_pdf_surface_get_font_resource (surface,
font_subset->font_id,
font_subset->subset_id);
if (subset_resource.id == 0)
return CAIRO_STATUS_SUCCESS;
glyphs = _cairo_malloc_ab (font_subset->num_glyphs, sizeof (cairo_pdf_resource_t));
if (unlikely (glyphs == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
widths = _cairo_malloc_ab (font_subset->num_glyphs, sizeof (double));
if (unlikely (widths == NULL)) {
free (glyphs);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
_cairo_pdf_group_resources_clear (&surface->resources);
type3_surface = _cairo_type3_glyph_surface_create (font_subset->scaled_font,
NULL,
_cairo_pdf_emit_imagemask,
surface->font_subsets,
FALSE);
if (unlikely (type3_surface->status)) {
free (glyphs);
free (widths);
return type3_surface->status;
}
_cairo_type3_glyph_surface_set_font_subsets_callback (type3_surface,
_cairo_pdf_surface_add_font,
surface);
for (i = 0; i < font_subset->num_glyphs; i++) {
status = _cairo_pdf_surface_open_stream (surface,
NULL,
surface->compress_content,
NULL);
if (unlikely (status))
break;
glyphs[i] = surface->pdf_stream.self;
status = _cairo_type3_glyph_surface_emit_glyph (type3_surface,
surface->output,
font_subset->glyphs[i],
&bbox,
&widths[i]);
if (unlikely (status))
break;
status = _cairo_pdf_surface_close_stream (surface);
if (unlikely (status))
break;
if (i == 0) {
font_bbox.p1.x = bbox.p1.x;
font_bbox.p1.y = bbox.p1.y;
font_bbox.p2.x = bbox.p2.x;
font_bbox.p2.y = bbox.p2.y;
} else {
if (bbox.p1.x < font_bbox.p1.x)
font_bbox.p1.x = bbox.p1.x;
if (bbox.p1.y < font_bbox.p1.y)
font_bbox.p1.y = bbox.p1.y;
if (bbox.p2.x > font_bbox.p2.x)
font_bbox.p2.x = bbox.p2.x;
if (bbox.p2.y > font_bbox.p2.y)
font_bbox.p2.y = bbox.p2.y;
}
}
cairo_surface_destroy (type3_surface);
if (unlikely (status)) {
free (glyphs);
free (widths);
return status;
}
encoding = _cairo_pdf_surface_new_object (surface);
if (encoding.id == 0) {
free (glyphs);
free (widths);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /Encoding\n"
" /Differences [0", encoding.id);
for (i = 0; i < font_subset->num_glyphs; i++)
_cairo_output_stream_printf (surface->output,
" /%d", i);
_cairo_output_stream_printf (surface->output,
"]\n"
">>\n"
"endobj\n");
char_procs = _cairo_pdf_surface_new_object (surface);
if (char_procs.id == 0) {
free (glyphs);
free (widths);
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<<\n", char_procs.id);
for (i = 0; i < font_subset->num_glyphs; i++)
_cairo_output_stream_printf (surface->output,
" /%d %d 0 R\n",
i, glyphs[i].id);
_cairo_output_stream_printf (surface->output,
">>\n"
"endobj\n");
free (glyphs);
status = _cairo_pdf_surface_emit_to_unicode_stream (surface,
font_subset,
&to_unicode_stream);
if (_cairo_int_status_is_error (status)) {
free (widths);
return status;
}
_cairo_pdf_surface_update_object (surface, subset_resource);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /Font\n"
" /Subtype /Type3\n"
" /FontBBox [%f %f %f %f]\n"
" /FontMatrix [ 1 0 0 -1 0 0 ]\n"
" /Encoding %d 0 R\n"
" /CharProcs %d 0 R\n"
" /FirstChar 0\n"
" /LastChar %d\n",
subset_resource.id,
_cairo_fixed_to_double (font_bbox.p1.x),
_cairo_fixed_to_double (font_bbox.p1.y),
_cairo_fixed_to_double (font_bbox.p2.x),
_cairo_fixed_to_double (font_bbox.p2.y),
encoding.id,
char_procs.id,
font_subset->num_glyphs - 1);
_cairo_output_stream_printf (surface->output,
" /Widths [");
for (i = 0; i < font_subset->num_glyphs; i++)
_cairo_output_stream_printf (surface->output, " %f", widths[i]);
_cairo_output_stream_printf (surface->output,
"]\n");
free (widths);
_cairo_output_stream_printf (surface->output,
" /Resources\n");
_cairo_pdf_surface_emit_group_resources (surface, &surface->resources);
if (to_unicode_stream.id != 0)
_cairo_output_stream_printf (surface->output,
" /ToUnicode %d 0 R\n",
to_unicode_stream.id);
_cairo_output_stream_printf (surface->output,
">>\n"
"endobj\n");
font.font_id = font_subset->font_id;
font.subset_id = font_subset->subset_id;
font.subset_resource = subset_resource;
return _cairo_array_append (&surface->fonts, &font);
}
static cairo_int_status_t
_cairo_pdf_surface_emit_unscaled_font_subset (cairo_scaled_font_subset_t *font_subset,
void *closure)
{
cairo_pdf_surface_t *surface = closure;
cairo_int_status_t status;
status = _cairo_pdf_surface_emit_cff_font_subset (surface, font_subset);
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
return status;
status = _cairo_pdf_surface_emit_truetype_font_subset (surface, font_subset);
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
return status;
status = _cairo_pdf_surface_emit_type1_font_subset (surface, font_subset);
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
return status;
status = _cairo_pdf_surface_emit_cff_fallback_font (surface, font_subset);
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
return status;
status = _cairo_pdf_surface_emit_type1_fallback_font (surface, font_subset);
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
return status;
ASSERT_NOT_REACHED;
return CAIRO_INT_STATUS_SUCCESS;
}
static cairo_int_status_t
_cairo_pdf_surface_emit_scaled_font_subset (cairo_scaled_font_subset_t *font_subset,
void *closure)
{
cairo_pdf_surface_t *surface = closure;
cairo_int_status_t status;
status = _cairo_pdf_surface_emit_type3_font_subset (surface, font_subset);
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
return status;
ASSERT_NOT_REACHED;
return CAIRO_INT_STATUS_SUCCESS;
}
static cairo_int_status_t
_cairo_pdf_surface_emit_font_subsets (cairo_pdf_surface_t *surface)
{
cairo_int_status_t status;
status = _cairo_scaled_font_subsets_foreach_user (surface->font_subsets,
_cairo_pdf_surface_analyze_user_font_subset,
surface);
if (unlikely (status))
goto BAIL;
status = _cairo_scaled_font_subsets_foreach_unscaled (surface->font_subsets,
_cairo_pdf_surface_emit_unscaled_font_subset,
surface);
if (unlikely (status))
goto BAIL;
status = _cairo_scaled_font_subsets_foreach_scaled (surface->font_subsets,
_cairo_pdf_surface_emit_scaled_font_subset,
surface);
if (unlikely (status))
goto BAIL;
status = _cairo_scaled_font_subsets_foreach_user (surface->font_subsets,
_cairo_pdf_surface_emit_scaled_font_subset,
surface);
BAIL:
_cairo_scaled_font_subsets_destroy (surface->font_subsets);
surface->font_subsets = NULL;
return status;
}
static cairo_pdf_resource_t
_cairo_pdf_surface_write_catalog (cairo_pdf_surface_t *surface)
{
cairo_pdf_resource_t catalog;
catalog = _cairo_pdf_surface_new_object (surface);
if (catalog.id == 0)
return catalog;
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /Catalog\n"
" /Pages %d 0 R\n",
catalog.id,
surface->pages_resource.id);
if (surface->struct_tree_root.id != 0) {
_cairo_output_stream_printf (surface->output,
" /StructTreeRoot %d 0 R\n",
surface->struct_tree_root.id);
if (surface->tagged) {
_cairo_output_stream_printf (surface->output,
" /MarkInfo << /Marked true >>\n");
}
}
if (surface->outlines_dict_res.id != 0) {
_cairo_output_stream_printf (surface->output,
" /Outlines %d 0 R\n",
surface->outlines_dict_res.id);
}
if (surface->page_labels_res.id != 0) {
_cairo_output_stream_printf (surface->output,
" /PageLabels %d 0 R\n",
surface->page_labels_res.id);
}
if (surface->names_dict_res.id != 0) {
_cairo_output_stream_printf (surface->output,
" /Names %d 0 R\n",
surface->names_dict_res.id);
}
_cairo_output_stream_printf (surface->output,
">>\n"
"endobj\n");
return catalog;
}
static long
_cairo_pdf_surface_write_xref (cairo_pdf_surface_t *surface)
{
cairo_pdf_object_t *object;
int num_objects, i;
long offset;
char buffer[11];
num_objects = _cairo_array_num_elements (&surface->objects);
offset = _cairo_output_stream_get_position (surface->output);
_cairo_output_stream_printf (surface->output,
"xref\n"
"%d %d\n",
0, num_objects + 1);
_cairo_output_stream_printf (surface->output,
"0000000000 65535 f \n");
for (i = 0; i < num_objects; i++) {
object = _cairo_array_index (&surface->objects, i);
snprintf (buffer, sizeof buffer, "%010ld", object->offset);
_cairo_output_stream_printf (surface->output,
"%s 00000 n \n", buffer);
}
return offset;
}
static cairo_int_status_t
_cairo_pdf_surface_write_mask_group (cairo_pdf_surface_t *surface,
cairo_pdf_smask_group_t *group)
{
cairo_pdf_resource_t mask_group;
cairo_pdf_resource_t smask;
cairo_pdf_smask_group_t *smask_group;
cairo_pdf_resource_t pattern_res, gstate_res;
cairo_int_status_t status;
cairo_box_double_t bbox;
/* Create mask group */
_get_bbox_from_extents (&group->extents, &bbox);
status = _cairo_pdf_surface_open_group (surface, &bbox, NULL);
if (unlikely (status))
return status;
if (_can_paint_pattern (group->mask)) {
_cairo_output_stream_printf (surface->output, "q\n");
status = _cairo_pdf_surface_paint_pattern (surface,
CAIRO_OPERATOR_OVER,
group->mask,
&group->extents,
1.0, /* alpha */
FALSE); /* mask */
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output, "Q\n");
} else {
pattern_res.id = 0;
gstate_res.id = 0;
status = _cairo_pdf_surface_add_pdf_pattern (surface, group->mask,
CAIRO_OPERATOR_OVER,
NULL,
&pattern_res, &gstate_res);
if (unlikely (status))
return status;
if (gstate_res.id != 0) {
smask_group = _cairo_pdf_surface_create_smask_group (surface, &group->extents);
if (unlikely (smask_group == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
smask_group->width = group->width;
smask_group->height = group->height;
smask_group->operation = PDF_PAINT;
smask_group->source = cairo_pattern_reference (group->mask);
smask_group->source_res = pattern_res;
status = _cairo_pdf_surface_add_smask_group (surface, smask_group);
if (unlikely (status)) {
_cairo_pdf_smask_group_destroy (smask_group);
return status;
}
status = _cairo_pdf_surface_add_smask (surface, gstate_res);
if (unlikely (status))
return status;
status = _cairo_pdf_surface_add_xobject (surface, smask_group->group_res);
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output,
"q /s%d gs /x%d Do Q\n",
gstate_res.id,
smask_group->group_res.id);
} else {
status = _cairo_pdf_surface_select_pattern (surface, group->mask, pattern_res, FALSE);
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output,
"%f %f %f %f re f\n",
bbox.p1.x,
bbox.p1.y,
bbox.p2.x - bbox.p1.x,
bbox.p2.y - bbox.p1.y);
status = _cairo_pdf_surface_unselect_pattern (surface);
if (unlikely (status))
return status;
}
}
status = _cairo_pdf_surface_close_group (surface, &mask_group);
if (unlikely (status))
return status;
/* Create source group */
status = _cairo_pdf_surface_open_group (surface, &bbox, &group->source_res);
if (unlikely (status))
return status;
if (_can_paint_pattern (group->source)) {
_cairo_output_stream_printf (surface->output, "q\n");
status = _cairo_pdf_surface_paint_pattern (surface,
CAIRO_OPERATOR_OVER,
group->source,
&group->extents,
1.0, /* alpha */
FALSE); /* mask */
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output, "Q\n");
} else {
pattern_res.id = 0;
gstate_res.id = 0;
status = _cairo_pdf_surface_add_pdf_pattern (surface, group->source,
CAIRO_OPERATOR_OVER,
NULL,
&pattern_res, &gstate_res);
if (unlikely (status))
return status;
if (gstate_res.id != 0) {
smask_group = _cairo_pdf_surface_create_smask_group (surface, &group->extents);
if (unlikely (smask_group == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
smask_group->operation = PDF_PAINT;
smask_group->source = cairo_pattern_reference (group->source);
smask_group->source_res = pattern_res;
status = _cairo_pdf_surface_add_smask_group (surface, smask_group);
if (unlikely (status)) {
_cairo_pdf_smask_group_destroy (smask_group);
return status;
}
status = _cairo_pdf_surface_add_smask (surface, gstate_res);
if (unlikely (status))
return status;
status = _cairo_pdf_surface_add_xobject (surface, smask_group->group_res);
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output,
"q /s%d gs /x%d Do Q\n",
gstate_res.id,
smask_group->group_res.id);
} else {
status = _cairo_pdf_surface_select_pattern (surface, group->source, pattern_res, FALSE);
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output,
"%f %f %f %f re f\n",
bbox.p1.x,
bbox.p1.y,
bbox.p2.x - bbox.p1.x,
bbox.p2.y - bbox.p1.y);
status = _cairo_pdf_surface_unselect_pattern (surface);
if (unlikely (status))
return status;
}
}
status = _cairo_pdf_surface_close_group (surface, NULL);
if (unlikely (status))
return status;
/* Create an smask based on the alpha component of mask_group */
smask = _cairo_pdf_surface_new_object (surface);
if (smask.id == 0)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /Mask\n"
" /S /Alpha\n"
" /G %d 0 R\n"
">>\n"
"endobj\n",
smask.id,
mask_group.id);
/* Create a GState that uses the smask */
_cairo_pdf_surface_update_object (surface, group->group_res);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /ExtGState\n"
" /SMask %d 0 R\n"
" /ca 1\n"
" /CA 1\n"
" /AIS false\n"
">>\n"
"endobj\n",
group->group_res.id,
smask.id);
return _cairo_output_stream_get_status (surface->output);
}
static cairo_int_status_t
_cairo_pdf_surface_write_smask_group (cairo_pdf_surface_t *surface,
cairo_pdf_smask_group_t *group)
{
double old_width, old_height;
cairo_bool_t old_in_xobject;
cairo_int_status_t status;
cairo_box_double_t bbox;
cairo_rectangle_int_t old_surface_extents;
old_width = surface->width;
old_height = surface->height;
old_surface_extents = surface->surface_extents;
old_in_xobject = surface->in_xobject;
surface->in_xobject = TRUE;
_cairo_pdf_surface_set_size_internal (surface,
group->width,
group->height);
_cairo_pdf_operators_reset (&surface->pdf_operators);
/* _mask is a special case that requires two groups - source
* and mask as well as a smask and gstate dictionary */
if (group->operation == PDF_MASK) {
status = _cairo_pdf_surface_write_mask_group (surface, group);
goto RESTORE_SIZE;
}
_get_bbox_from_extents (&group->extents, &bbox);
status = _cairo_pdf_surface_open_group (surface, &bbox, &group->group_res);
if (unlikely (status))
return status;
status = _cairo_pdf_surface_select_pattern (surface,
group->source,
group->source_res,
group->operation == PDF_STROKE);
if (unlikely (status))
return status;
switch (group->operation) {
case PDF_PAINT:
_cairo_output_stream_printf (surface->output,
"0 0 %f %f re f\n",
surface->width, surface->height);
break;
case PDF_MASK:
ASSERT_NOT_REACHED;
break;
case PDF_FILL:
status = _cairo_pdf_operators_fill (&surface->pdf_operators,
&group->path,
group->fill_rule);
break;
case PDF_STROKE:
status = _cairo_pdf_operators_stroke (&surface->pdf_operators,
&group->path,
&group->style,
&group->ctm,
&group->ctm_inverse);
break;
case PDF_SHOW_GLYPHS:
status = _cairo_pdf_operators_show_text_glyphs (&surface->pdf_operators,
group->utf8, group->utf8_len,
group->glyphs, group->num_glyphs,
group->clusters, group->num_clusters,
group->cluster_flags,
group->scaled_font);
break;
}
if (unlikely (status))
return status;
status = _cairo_pdf_surface_unselect_pattern (surface);
if (unlikely (status))
return status;
status = _cairo_pdf_surface_close_group (surface, NULL);
RESTORE_SIZE:
surface->in_xobject = old_in_xobject;
_cairo_pdf_surface_set_size_internal (surface,
old_width,
old_height);
surface->surface_extents = old_surface_extents;
_cairo_pdf_operators_reset (&surface->pdf_operators);
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_write_patterns_and_smask_groups (cairo_pdf_surface_t *surface,
cairo_bool_t finish)
{
cairo_pdf_pattern_t pattern;
cairo_pdf_smask_group_t *group;
cairo_pdf_source_surface_t src_surface;
unsigned int pattern_index, group_index, surface_index, doc_surface_index;
cairo_int_status_t status;
cairo_bool_t is_image;
/* Writing out PDF_MASK groups will cause additional smask groups
* to be appended to surface->smask_groups. Additional patterns
* may also be appended to surface->patterns.
*
* Writing recording surface patterns will cause additional patterns
* and groups to be appended.
*/
pattern_index = 0;
group_index = 0;
surface_index = 0;
doc_surface_index = 0;
while ((pattern_index < _cairo_array_num_elements (&surface->page_patterns)) ||
(group_index < _cairo_array_num_elements (&surface->smask_groups)) ||
(surface_index < _cairo_array_num_elements (&surface->page_surfaces)) ||
(finish && (doc_surface_index < _cairo_array_num_elements (&surface->doc_surfaces))))
{
for (; group_index < _cairo_array_num_elements (&surface->smask_groups); group_index++) {
_cairo_array_copy_element (&surface->smask_groups, group_index, &group);
status = _cairo_pdf_surface_write_smask_group (surface, group);
if (unlikely (status))
return status;
}
for (; pattern_index < _cairo_array_num_elements (&surface->page_patterns); pattern_index++) {
_cairo_array_copy_element (&surface->page_patterns, pattern_index, &pattern);
status = _cairo_pdf_surface_emit_pattern (surface, &pattern);
if (unlikely (status))
return status;
}
for (; surface_index < _cairo_array_num_elements (&surface->page_surfaces); surface_index++) {
_cairo_array_copy_element (&surface->page_surfaces, surface_index, &src_surface);
status = _cairo_pdf_surface_emit_surface (surface, &src_surface, FALSE, &is_image);
if (unlikely (status))
return status;
}
if (finish) {
for (; doc_surface_index < _cairo_array_num_elements (&surface->doc_surfaces); doc_surface_index++) {
_cairo_array_copy_element (&surface->doc_surfaces, doc_surface_index, &src_surface);
status = _cairo_pdf_surface_emit_surface (surface, &src_surface, FALSE, &is_image);
if (unlikely (status))
return status;
}
}
}
return CAIRO_STATUS_SUCCESS;
}
static cairo_int_status_t
_cairo_pdf_surface_write_page (cairo_pdf_surface_t *surface)
{
cairo_pdf_resource_t knockout, res, thumbnail_res;
cairo_pdf_resource_t *page;
cairo_int_status_t status;
unsigned int i, len, page_num, num_annots;
status = _cairo_pdf_interchange_write_page_objects (surface);
if (unlikely (status))
return status;
_cairo_pdf_group_resources_clear (&surface->resources);
if (surface->has_fallback_images) {
cairo_rectangle_int_t extents;
cairo_box_double_t bbox;
extents.x = 0;
extents.y = 0;
extents.width = ceil (surface->width);
extents.height = ceil (surface->height);
_get_bbox_from_extents (&extents, &bbox);
status = _cairo_pdf_surface_open_knockout_group (surface, &bbox);
if (unlikely (status))
return status;
len = _cairo_array_num_elements (&surface->knockout_group);
for (i = 0; i < len; i++) {
_cairo_array_copy_element (&surface->knockout_group, i, &res);
_cairo_output_stream_printf (surface->output,
"/x%d Do\n",
res.id);
status = _cairo_pdf_surface_add_xobject (surface, res);
if (unlikely (status))
return status;
}
_cairo_output_stream_printf (surface->output,
"/x%d Do\n",
surface->content.id);
status = _cairo_pdf_surface_add_xobject (surface, surface->content);
if (unlikely (status))
return status;
status = _cairo_pdf_surface_close_group (surface, &knockout);
if (unlikely (status))
return status;
_cairo_pdf_group_resources_clear (&surface->resources);
status = _cairo_pdf_surface_open_content_stream (surface, NULL, NULL, FALSE, FALSE);
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output,
"/x%d Do\n",
knockout.id);
status = _cairo_pdf_surface_add_xobject (surface, knockout);
if (unlikely (status))
return status;
status = _cairo_pdf_surface_close_content_stream (surface);
if (unlikely (status))
return status;
}
thumbnail_res.id = 0;
if (surface->thumbnail_image) {
cairo_pdf_source_surface_entry_t entry;
memset (&entry, 0, sizeof (entry));
thumbnail_res = _cairo_pdf_surface_new_object (surface);
entry.surface_res = thumbnail_res;
_cairo_pdf_surface_emit_image (surface, surface->thumbnail_image, &entry);
}
page_num = _cairo_array_num_elements (&surface->pages);
page = _cairo_array_index (&surface->pages, page_num - 1);
_cairo_pdf_surface_update_object (surface, *page);
_cairo_output_stream_printf (surface->output,
"%d 0 obj\n"
"<< /Type /Page %% %d\n"
" /Parent %d 0 R\n"
" /MediaBox [ 0 0 %f %f ]\n"
" /Contents %d 0 R\n"
" /Group <<\n"
" /Type /Group\n"
" /S /Transparency\n"
" /I true\n"
" /CS /DeviceRGB\n"
" >>\n"
" /Resources %d 0 R\n",
page->id,
page_num,
surface->pages_resource.id,
surface->width,
surface->height,
surface->content.id,
surface->content_resources.id);
if (surface->page_parent_tree >= 0) {
_cairo_output_stream_printf (surface->output,
" /StructParents %d\n",
surface->page_parent_tree);
}
num_annots = _cairo_array_num_elements (&surface->page_annots);
if (num_annots > 0) {
_cairo_output_stream_printf (surface->output,
" /Annots [ ");
for (i = 0; i < num_annots; i++) {
_cairo_array_copy_element (&surface->page_annots, i, &res);
_cairo_output_stream_printf (surface->output,
"%d 0 R ",
res.id);
}
_cairo_output_stream_printf (surface->output, "]\n");
}
if (thumbnail_res.id) {
_cairo_output_stream_printf (surface->output,
" /Thumb %d 0 R\n",
thumbnail_res.id);
}
_cairo_output_stream_printf (surface->output,
">>\n"
"endobj\n");
status = _cairo_pdf_surface_write_patterns_and_smask_groups (surface, FALSE);
if (unlikely (status))
return status;
return CAIRO_STATUS_SUCCESS;
}
static cairo_int_status_t
_cairo_pdf_surface_analyze_surface_pattern_transparency (cairo_pdf_surface_t *surface,
cairo_surface_pattern_t *pattern)
{
cairo_image_surface_t *image;
void *image_extra;
cairo_int_status_t status;
cairo_image_transparency_t transparency;
status = _cairo_surface_acquire_source_image (pattern->surface,
&image,
&image_extra);
if (unlikely (status))
return status;
if (image->base.status)
return image->base.status;
transparency = _cairo_image_analyze_transparency (image);
if (transparency == CAIRO_IMAGE_IS_OPAQUE)
status = CAIRO_STATUS_SUCCESS;
else
status = CAIRO_INT_STATUS_FLATTEN_TRANSPARENCY;
_cairo_surface_release_source_image (pattern->surface, image, image_extra);
return status;
}
static cairo_bool_t
_surface_pattern_supported (cairo_surface_pattern_t *pattern)
{
cairo_extend_t extend;
if (pattern->surface->type == CAIRO_SURFACE_TYPE_RECORDING)
return TRUE;
if (pattern->surface->backend->acquire_source_image == NULL)
return FALSE;
/* Does an ALPHA-only source surface even make sense? Maybe, but I
* don't think it's worth the extra code to support it. */
/* XXX: Need to write this function here...
if (pattern->surface->content == CAIRO_CONTENT_ALPHA)
return FALSE;
*/
extend = cairo_pattern_get_extend (&pattern->base);
switch (extend) {
case CAIRO_EXTEND_NONE:
case CAIRO_EXTEND_REPEAT:
case CAIRO_EXTEND_REFLECT:
/* There's no point returning FALSE for EXTEND_PAD, as the image
* surface does not currently implement it either */
case CAIRO_EXTEND_PAD:
return TRUE;
}
ASSERT_NOT_REACHED;
return FALSE;
}
static cairo_bool_t
_pattern_supported (const cairo_pattern_t *pattern)
{
switch (pattern->type) {
case CAIRO_PATTERN_TYPE_SOLID:
case CAIRO_PATTERN_TYPE_LINEAR:
case CAIRO_PATTERN_TYPE_RADIAL:
case CAIRO_PATTERN_TYPE_MESH:
case CAIRO_PATTERN_TYPE_RASTER_SOURCE:
return TRUE;
case CAIRO_PATTERN_TYPE_SURFACE:
return _surface_pattern_supported ((cairo_surface_pattern_t *) pattern);
default:
ASSERT_NOT_REACHED;
return FALSE;
}
}
static cairo_bool_t
_pdf_operator_supported (cairo_operator_t op)
{
switch (op) {
case CAIRO_OPERATOR_OVER:
case CAIRO_OPERATOR_MULTIPLY:
case CAIRO_OPERATOR_SCREEN:
case CAIRO_OPERATOR_OVERLAY:
case CAIRO_OPERATOR_DARKEN:
case CAIRO_OPERATOR_LIGHTEN:
case CAIRO_OPERATOR_COLOR_DODGE:
case CAIRO_OPERATOR_COLOR_BURN:
case CAIRO_OPERATOR_HARD_LIGHT:
case CAIRO_OPERATOR_SOFT_LIGHT:
case CAIRO_OPERATOR_DIFFERENCE:
case CAIRO_OPERATOR_EXCLUSION:
case CAIRO_OPERATOR_HSL_HUE:
case CAIRO_OPERATOR_HSL_SATURATION:
case CAIRO_OPERATOR_HSL_COLOR:
case CAIRO_OPERATOR_HSL_LUMINOSITY:
return TRUE;
default:
case CAIRO_OPERATOR_CLEAR:
case CAIRO_OPERATOR_SOURCE:
case CAIRO_OPERATOR_IN:
case CAIRO_OPERATOR_OUT:
case CAIRO_OPERATOR_ATOP:
case CAIRO_OPERATOR_DEST:
case CAIRO_OPERATOR_DEST_OVER:
case CAIRO_OPERATOR_DEST_IN:
case CAIRO_OPERATOR_DEST_OUT:
case CAIRO_OPERATOR_DEST_ATOP:
case CAIRO_OPERATOR_XOR:
case CAIRO_OPERATOR_ADD:
case CAIRO_OPERATOR_SATURATE:
return FALSE;
}
}
static cairo_int_status_t
_cairo_pdf_surface_analyze_operation (cairo_pdf_surface_t *surface,
cairo_operator_t op,
const cairo_pattern_t *pattern,
const cairo_rectangle_int_t *extents)
{
if (surface->force_fallbacks &&
surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
if (! _pattern_supported (pattern))
return CAIRO_INT_STATUS_UNSUPPORTED;
if (_pdf_operator_supported (op)) {
if (pattern->type == CAIRO_PATTERN_TYPE_SURFACE) {
cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *) pattern;
if (surface_pattern->surface->type == CAIRO_SURFACE_TYPE_RECORDING) {
if (pattern->extend == CAIRO_EXTEND_PAD) {
cairo_box_t box;
cairo_rectangle_int_t rect;
cairo_rectangle_int_t rec_extents;
/* get the operation extents in pattern space */
_cairo_box_from_rectangle (&box, extents);
_cairo_matrix_transform_bounding_box_fixed (&pattern->matrix, &box, NULL);
_cairo_box_round_to_rectangle (&box, &rect);
/* Check if surface needs padding to fill extents */
if (_cairo_surface_get_extents (surface_pattern->surface, &rec_extents)) {
if (_cairo_fixed_integer_ceil(box.p1.x) < rec_extents.x ||
_cairo_fixed_integer_ceil(box.p1.y) < rec_extents.y ||
_cairo_fixed_integer_floor(box.p2.y) > rec_extents.x + rec_extents.width ||
_cairo_fixed_integer_floor(box.p2.y) > rec_extents.y + rec_extents.height)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
}
}
return CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN;
}
}
return CAIRO_STATUS_SUCCESS;
}
/* The SOURCE operator is supported if the pattern is opaque or if
* there is nothing painted underneath. */
if (op == CAIRO_OPERATOR_SOURCE) {
if (pattern->type == CAIRO_PATTERN_TYPE_SURFACE) {
cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *) pattern;
if (surface_pattern->surface->type == CAIRO_SURFACE_TYPE_RECORDING) {
if (_cairo_pattern_is_opaque (pattern, extents)) {
return CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN;
} else {
/* FIXME: The analysis surface does not yet have
* the capability to analyze a non opaque recording
* surface and mark it supported if there is
* nothing underneath. For now recording surfaces of
* type CONTENT_COLOR_ALPHA painted with
* OPERATOR_SOURCE will result in a fallback
* image. */
return CAIRO_INT_STATUS_UNSUPPORTED;
}
} else {
return _cairo_pdf_surface_analyze_surface_pattern_transparency (surface,
surface_pattern);
}
}
if (_cairo_pattern_is_opaque (pattern, extents))
return CAIRO_STATUS_SUCCESS;
else
return CAIRO_INT_STATUS_FLATTEN_TRANSPARENCY;
}
return CAIRO_INT_STATUS_UNSUPPORTED;
}
static cairo_bool_t
_cairo_pdf_surface_operation_supported (cairo_pdf_surface_t *surface,
cairo_operator_t op,
const cairo_pattern_t *pattern,
const cairo_rectangle_int_t *extents)
{
return _cairo_pdf_surface_analyze_operation (surface, op, pattern, extents) != CAIRO_INT_STATUS_UNSUPPORTED;
}
static cairo_int_status_t
_cairo_pdf_surface_start_fallback (cairo_pdf_surface_t *surface)
{
cairo_box_double_t bbox;
cairo_int_status_t status;
status = _cairo_pdf_surface_close_content_stream (surface);
if (unlikely (status))
return status;
status = _cairo_array_append (&surface->knockout_group, &surface->content);
if (unlikely (status))
return status;
_cairo_pdf_group_resources_clear (&surface->resources);
bbox.p1.x = 0;
bbox.p1.y = 0;
bbox.p2.x = surface->width;
bbox.p2.y = surface->height;
status = _cairo_pdf_surface_open_content_stream (surface, &bbox, NULL, TRUE, TRUE);
if (unlikely (status))
return status;
return _cairo_pdf_interchange_begin_page_content (surface);
}
/* If source is an opaque image and mask is an image and both images
* have the same bounding box we can emit them as a image/smask pair.
*/
static cairo_int_status_t
_cairo_pdf_surface_emit_combined_smask (cairo_pdf_surface_t *surface,
cairo_operator_t op,
const cairo_pattern_t *source,
const cairo_pattern_t *mask,
const cairo_rectangle_int_t *extents)
{
cairo_int_status_t status;
cairo_image_surface_t *image;
void *image_extra;
cairo_image_transparency_t transparency;
int src_width, src_height;
int mask_width, mask_height;
double src_x_offset, src_y_offset;
double mask_x_offset, mask_y_offset;
double src_x1, src_y1, src_x2, src_y2;
double mask_x1, mask_y1, mask_x2, mask_y2;
cairo_matrix_t p2u;
double src_radius, mask_radius, e;
cairo_bool_t need_smask;
cairo_pdf_source_surface_entry_t *pdf_source;
/* Check that source and mask are images */
if (!((source->type == CAIRO_PATTERN_TYPE_SURFACE || source->type == CAIRO_PATTERN_TYPE_RASTER_SOURCE) &&
(mask->type == CAIRO_PATTERN_TYPE_SURFACE || mask->type == CAIRO_PATTERN_TYPE_RASTER_SOURCE)))
return CAIRO_INT_STATUS_UNSUPPORTED;
if (source->type == CAIRO_PATTERN_TYPE_SURFACE &&
((cairo_surface_pattern_t *) source)->surface->type == CAIRO_SURFACE_TYPE_RECORDING)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
if (mask->type == CAIRO_PATTERN_TYPE_SURFACE &&
((cairo_surface_pattern_t *) mask)->surface->type == CAIRO_SURFACE_TYPE_RECORDING)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
if (source->extend != CAIRO_EXTEND_NONE || mask->extend != CAIRO_EXTEND_NONE)
return CAIRO_INT_STATUS_UNSUPPORTED;
/* Check that source is opaque and get image sizes */
status = _cairo_pdf_surface_acquire_source_image_from_pattern (surface, source,
&image, &image_extra);
if (unlikely (status))
return status;
if (image->base.status)
return image->base.status;
src_width = image->width;
src_height = image->height;
if (source->type == CAIRO_PATTERN_TYPE_RASTER_SOURCE) {
cairo_surface_get_device_offset (&image->base, &src_x_offset, &src_y_offset);
} else {
src_x_offset = 0;
src_y_offset = 0;
}
transparency = _cairo_image_analyze_transparency (image);
_cairo_pdf_surface_release_source_image_from_pattern (surface, source, image, image_extra);
if (transparency != CAIRO_IMAGE_IS_OPAQUE)
return CAIRO_INT_STATUS_UNSUPPORTED;
status = _cairo_pdf_surface_acquire_source_image_from_pattern (surface, mask,
&image, &image_extra);
if (unlikely (status))
return status;
if (image->base.status)
return image->base.status;
mask_width = image->width;
mask_height = image->height;
if (mask->type == CAIRO_PATTERN_TYPE_RASTER_SOURCE) {
cairo_surface_get_device_offset (&image->base, &mask_x_offset, &mask_y_offset);
} else {
mask_x_offset = 0;
mask_y_offset = 0;
}
transparency = _cairo_image_analyze_transparency (image);
need_smask = transparency != CAIRO_IMAGE_IS_OPAQUE;
_cairo_pdf_surface_release_source_image_from_pattern (surface, mask, image, image_extra);
/* Check that both images have the same extents with a tolerance
* of half the smallest source pixel. */
p2u = source->matrix;
status = cairo_matrix_invert (&p2u);
/* cairo_pattern_set_matrix ensures the matrix is invertible */
assert (status == CAIRO_INT_STATUS_SUCCESS);
src_x1 = 0;
src_y1 = 0;
src_x2 = src_width;
src_y2 = src_height;
cairo_matrix_transform_point (&p2u, &src_x1, &src_y1);
cairo_matrix_transform_point (&p2u, &src_x2, &src_y2);
src_radius = _cairo_matrix_transformed_circle_major_axis (&p2u, 0.5);
p2u = mask->matrix;
status = cairo_matrix_invert (&p2u);
/* cairo_pattern_set_matrix ensures the matrix is invertible */
assert (status == CAIRO_INT_STATUS_SUCCESS);
mask_x1 = 0;
mask_y1 = 0;
mask_x2 = mask_width;
mask_y2 = mask_height;
cairo_matrix_transform_point (&p2u, &mask_x1, &mask_y1);
cairo_matrix_transform_point (&p2u, &mask_x2, &mask_y2);
mask_radius = _cairo_matrix_transformed_circle_major_axis (&p2u, 0.5);
if (src_radius < mask_radius)
e = src_radius;
else
e = mask_radius;
if (fabs(src_x1 - mask_x1) > e ||
fabs(src_x2 - mask_x2) > e ||
fabs(src_y1 - mask_y1) > e ||
fabs(src_y2 - mask_y2) > e)
return CAIRO_INT_STATUS_UNSUPPORTED;
/* Check both images have same device offset */
if (fabs(src_x_offset - mask_x_offset) > e ||
fabs(src_y_offset - mask_y_offset) > e)
return CAIRO_INT_STATUS_UNSUPPORTED;
if (need_smask) {
status = _cairo_pdf_surface_add_source_surface (surface,
NULL,
mask,
op,
source->filter,
FALSE, /* stencil mask */
TRUE, /* smask */
FALSE, /* need_transp_group */
extents,
NULL, /* smask_res */
&pdf_source,
NULL,
NULL,
NULL);
if (unlikely (status))
return status;
}
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output, "q\n");
status = _cairo_pdf_surface_paint_surface_pattern (surface, op, source, extents,
1.0, /* alpha */
need_smask ? &pdf_source->surface_res : NULL,
FALSE);
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output, "Q\n");
status = _cairo_output_stream_get_status (surface->output);
return status;
}
/* A PDF stencil mask is an A1 mask used with the current color */
static cairo_int_status_t
_cairo_pdf_surface_emit_stencil_mask (cairo_pdf_surface_t *surface,
cairo_operator_t op,
const cairo_pattern_t *source,
const cairo_pattern_t *mask,
const cairo_rectangle_int_t *extents)
{
cairo_int_status_t status;
cairo_image_surface_t *image;
void *image_extra;
cairo_image_transparency_t transparency;
cairo_pdf_resource_t pattern_res = {0};
if (! (source->type == CAIRO_PATTERN_TYPE_SOLID &&
(mask->type == CAIRO_PATTERN_TYPE_SURFACE || mask->type == CAIRO_PATTERN_TYPE_RASTER_SOURCE)))
return CAIRO_INT_STATUS_UNSUPPORTED;
if (mask->type == CAIRO_PATTERN_TYPE_SURFACE &&
((cairo_surface_pattern_t *) mask)->surface->type == CAIRO_SURFACE_TYPE_RECORDING)
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
status = _cairo_pdf_surface_acquire_source_image_from_pattern (surface, mask,
&image, &image_extra);
if (unlikely (status))
return status;
if (image->base.status)
return image->base.status;
transparency = _cairo_image_analyze_transparency (image);
if (transparency != CAIRO_IMAGE_IS_OPAQUE &&
transparency != CAIRO_IMAGE_HAS_BILEVEL_ALPHA)
{
status = CAIRO_INT_STATUS_UNSUPPORTED;
goto cleanup;
}
status = _cairo_pdf_surface_select_pattern (surface, source,
pattern_res, FALSE);
if (unlikely (status))
return status;
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output, "q\n");
status = _cairo_pdf_surface_paint_surface_pattern (surface, op, mask, extents, 1.0, NULL, TRUE);
if (unlikely (status))
return status;
_cairo_output_stream_printf (surface->output, "Q\n");
status = _cairo_output_stream_get_status (surface->output);
cleanup:
_cairo_pdf_surface_release_source_image_from_pattern (surface, mask, image, image_extra);
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_set_clip (cairo_pdf_surface_t *surface,
cairo_composite_rectangles_t *composite)
{
cairo_clip_t *clip = composite->clip;
if (_cairo_composite_rectangles_can_reduce_clip (composite, clip))
clip = NULL;
if (clip == NULL) {
if (_cairo_composite_rectangles_can_reduce_clip (composite,
surface->clipper.clip))
return CAIRO_STATUS_SUCCESS;
}
return _cairo_surface_clipper_set_clip (&surface->clipper, clip);
}
static cairo_int_status_t
_cairo_pdf_surface_paint (void *abstract_surface,
cairo_operator_t op,
const cairo_pattern_t *source,
const cairo_clip_t *clip)
{
cairo_pdf_surface_t *surface = abstract_surface;
cairo_pdf_smask_group_t *group;
cairo_pdf_resource_t pattern_res, gstate_res;
cairo_composite_rectangles_t extents;
cairo_int_status_t status;
status = _cairo_composite_rectangles_init_for_paint (&extents,
&surface->base,
op, source, clip);
if (unlikely (status))
return status;
status = _cairo_pdf_interchange_add_operation_extents (surface, &extents.bounded);
if (unlikely (status))
return status;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE) {
status = _cairo_pdf_surface_analyze_operation (surface, op, source, &extents.bounded);
goto cleanup;
} else if (surface->paginated_mode == CAIRO_PAGINATED_MODE_FALLBACK) {
status = _cairo_pdf_surface_start_fallback (surface);
if (unlikely (status))
goto cleanup;
}
assert (_cairo_pdf_surface_operation_supported (surface, op, source, &extents.bounded));
status = _cairo_pdf_surface_set_clip (surface, &extents);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_surface_select_operator (surface, op);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (unlikely (status))
goto cleanup;
if (_can_paint_pattern (source)) {
_cairo_output_stream_printf (surface->output, "q\n");
status = _cairo_pdf_surface_paint_pattern (surface,
op,
source,
&extents.bounded,
1.0, /* alpha */
FALSE); /* mask */
if (unlikely (status))
goto cleanup;
_cairo_output_stream_printf (surface->output, "Q\n");
_cairo_composite_rectangles_fini (&extents);
return _cairo_output_stream_get_status (surface->output);
}
pattern_res.id = 0;
gstate_res.id = 0;
status = _cairo_pdf_surface_add_pdf_pattern (surface, source, op,
&extents.bounded,
&pattern_res, &gstate_res);
if (unlikely (status))
goto cleanup;
if (gstate_res.id != 0) {
group = _cairo_pdf_surface_create_smask_group (surface, &extents.bounded);
if (unlikely (group == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto cleanup;
}
group->operation = PDF_PAINT;
status = _cairo_pattern_create_copy (&group->source, source);
if (unlikely (status)) {
_cairo_pdf_smask_group_destroy (group);
goto cleanup;
}
group->source_res = pattern_res;
status = _cairo_pdf_surface_add_smask_group (surface, group);
if (unlikely (status)) {
_cairo_pdf_smask_group_destroy (group);
goto cleanup;
}
status = _cairo_pdf_surface_add_smask (surface, gstate_res);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_surface_add_xobject (surface, group->group_res);
if (unlikely (status))
goto cleanup;
_cairo_output_stream_printf (surface->output,
"q /s%d gs /x%d Do Q\n",
gstate_res.id,
group->group_res.id);
} else {
status = _cairo_pdf_surface_select_pattern (surface, source,
pattern_res, FALSE);
if (unlikely (status))
goto cleanup;
_cairo_output_stream_printf (surface->output,
"%d %d %d %d re f\n",
surface->surface_extents.x,
surface->surface_extents.y,
surface->surface_extents.width,
surface->surface_extents.height);
status = _cairo_pdf_surface_unselect_pattern (surface);
if (unlikely (status))
goto cleanup;
}
_cairo_composite_rectangles_fini (&extents);
return _cairo_output_stream_get_status (surface->output);
cleanup:
_cairo_composite_rectangles_fini (&extents);
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_mask (void *abstract_surface,
cairo_operator_t op,
const cairo_pattern_t *source,
const cairo_pattern_t *mask,
const cairo_clip_t *clip)
{
cairo_pdf_surface_t *surface = abstract_surface;
cairo_pdf_smask_group_t *group;
cairo_composite_rectangles_t extents;
cairo_int_status_t status;
cairo_rectangle_int_t r;
cairo_box_t box;
double alpha;
status = _cairo_composite_rectangles_init_for_mask (&extents,
&surface->base,
op, source, mask, clip);
if (unlikely (status))
return status;
status = _cairo_pdf_interchange_add_operation_extents (surface, &extents.bounded);
if (unlikely (status))
return status;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE) {
cairo_int_status_t source_status, mask_status;
status = _cairo_pdf_surface_analyze_operation (surface, op, source, &extents.bounded);
if (_cairo_int_status_is_error (status))
goto cleanup;
source_status = status;
if (mask->has_component_alpha) {
status = CAIRO_INT_STATUS_UNSUPPORTED;
} else {
status = _cairo_pdf_surface_analyze_operation (surface, op, mask, &extents.bounded);
if (_cairo_int_status_is_error (status))
goto cleanup;
}
mask_status = status;
_cairo_composite_rectangles_fini (&extents);
return _cairo_analysis_surface_merge_status (source_status,
mask_status);
} else if (surface->paginated_mode == CAIRO_PAGINATED_MODE_FALLBACK) {
status = _cairo_pdf_surface_start_fallback (surface);
if (unlikely (status))
goto cleanup;
}
assert (_cairo_pdf_surface_operation_supported (surface, op, source, &extents.bounded));
assert (_cairo_pdf_surface_operation_supported (surface, op, mask, &extents.bounded));
/* get the accurate extents */
status = _cairo_pattern_get_ink_extents (source, &r);
if (unlikely (status))
goto cleanup;
/* XXX slight impedance mismatch */
_cairo_box_from_rectangle (&box, &r);
status = _cairo_composite_rectangles_intersect_source_extents (&extents,
&box);
if (unlikely (status))
goto cleanup;
status = _cairo_pattern_get_ink_extents (mask, &r);
if (unlikely (status))
goto cleanup;
_cairo_box_from_rectangle (&box, &r);
status = _cairo_composite_rectangles_intersect_mask_extents (&extents,
&box);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_surface_set_clip (surface, &extents);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_surface_select_operator (surface, op);
if (unlikely (status))
goto cleanup;
/* Check if we can combine source and mask into a smask image */
status = _cairo_pdf_surface_emit_combined_smask (surface, op, source, mask, &extents.bounded);
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
goto cleanup;
/* Check if we can use a stencil mask */
status = _cairo_pdf_surface_emit_stencil_mask (surface, op, source, mask, &extents.bounded);
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
goto cleanup;
/* Check if we can set ca/CA instead of an smask. We could handle
* other source patterns as well but for now this is the easiest,
* and most common, case to handle. */
if (_cairo_pattern_is_constant_alpha (mask, &extents.bounded, &alpha) &&
_can_paint_pattern (source)) {
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (unlikely (status))
goto cleanup;
_cairo_output_stream_printf (surface->output, "q\n");
status = _cairo_pdf_surface_paint_pattern (surface,
op,
source,
&extents.bounded,
alpha,
FALSE); /* mask */
if (unlikely (status))
goto cleanup;
_cairo_output_stream_printf (surface->output, "Q\n");
_cairo_composite_rectangles_fini (&extents);
return _cairo_output_stream_get_status (surface->output);
}
group = _cairo_pdf_surface_create_smask_group (surface, &extents.bounded);
if (unlikely (group == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto cleanup;
}
group->operation = PDF_MASK;
status = _cairo_pattern_create_copy (&group->source, source);
if (unlikely (status)) {
_cairo_pdf_smask_group_destroy (group);
goto cleanup;
}
status = _cairo_pattern_create_copy (&group->mask, mask);
if (unlikely (status)) {
_cairo_pdf_smask_group_destroy (group);
goto cleanup;
}
group->source_res = _cairo_pdf_surface_new_object (surface);
if (group->source_res.id == 0) {
_cairo_pdf_smask_group_destroy (group);
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto cleanup;
}
status = _cairo_pdf_surface_add_smask_group (surface, group);
if (unlikely (status)) {
_cairo_pdf_smask_group_destroy (group);
goto cleanup;
}
status = _cairo_pdf_surface_add_smask (surface, group->group_res);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_surface_add_xobject (surface, group->source_res);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (unlikely (status))
goto cleanup;
_cairo_output_stream_printf (surface->output,
"q /s%d gs /x%d Do Q\n",
group->group_res.id,
group->source_res.id);
_cairo_composite_rectangles_fini (&extents);
return _cairo_output_stream_get_status (surface->output);
cleanup:
_cairo_composite_rectangles_fini (&extents);
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_stroke (void *abstract_surface,
cairo_operator_t op,
const cairo_pattern_t *source,
const cairo_path_fixed_t *path,
const cairo_stroke_style_t *style,
const cairo_matrix_t *ctm,
const cairo_matrix_t *ctm_inverse,
double tolerance,
cairo_antialias_t antialias,
const cairo_clip_t *clip)
{
cairo_pdf_surface_t *surface = abstract_surface;
cairo_pdf_smask_group_t *group;
cairo_pdf_resource_t pattern_res, gstate_res;
cairo_composite_rectangles_t extents;
cairo_int_status_t status;
status = _cairo_composite_rectangles_init_for_stroke (&extents,
&surface->base,
op, source,
path, style, ctm,
clip);
if (unlikely (status))
return status;
/* use the more accurate extents */
if (extents.is_bounded) {
cairo_rectangle_int_t mask;
cairo_box_t box;
status = _cairo_path_fixed_stroke_extents (path, style,
ctm, ctm_inverse,
tolerance,
&mask);
if (unlikely (status))
goto cleanup;
_cairo_box_from_rectangle (&box, &mask);
status = _cairo_composite_rectangles_intersect_mask_extents (&extents,
&box);
if (unlikely (status))
goto cleanup;
}
status = _cairo_pdf_interchange_add_operation_extents (surface, &extents.bounded);
if (unlikely (status))
goto cleanup;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE) {
status = _cairo_pdf_surface_analyze_operation (surface, op, source, &extents.bounded);
goto cleanup;
}
assert (_cairo_pdf_surface_operation_supported (surface, op, source, &extents.bounded));
status = _cairo_pdf_surface_set_clip (surface, &extents);
if (unlikely (status))
goto cleanup;
pattern_res.id = 0;
gstate_res.id = 0;
status = _cairo_pdf_surface_add_pdf_pattern (surface, source, op,
&extents.bounded,
&pattern_res, &gstate_res);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_surface_select_operator (surface, op);
if (unlikely (status))
goto cleanup;
if (gstate_res.id != 0) {
group = _cairo_pdf_surface_create_smask_group (surface, &extents.bounded);
if (unlikely (group == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto cleanup;
}
group->operation = PDF_STROKE;
status = _cairo_pattern_create_copy (&group->source, source);
if (unlikely (status)) {
_cairo_pdf_smask_group_destroy (group);
goto cleanup;
}
group->source_res = pattern_res;
status = _cairo_path_fixed_init_copy (&group->path, path);
if (unlikely (status)) {
_cairo_pdf_smask_group_destroy (group);
goto cleanup;
}
group->style = *style;
group->ctm = *ctm;
group->ctm_inverse = *ctm_inverse;
status = _cairo_pdf_surface_add_smask_group (surface, group);
if (unlikely (status)) {
_cairo_pdf_smask_group_destroy (group);
goto cleanup;
}
status = _cairo_pdf_surface_add_smask (surface, gstate_res);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_surface_add_xobject (surface, group->group_res);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (unlikely (status))
goto cleanup;
_cairo_output_stream_printf (surface->output,
"q /s%d gs /x%d Do Q\n",
gstate_res.id,
group->group_res.id);
} else {
status = _cairo_pdf_surface_select_pattern (surface, source, pattern_res, TRUE);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_operators_stroke (&surface->pdf_operators,
path,
style,
ctm,
ctm_inverse);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_surface_unselect_pattern (surface);
if (unlikely (status))
goto cleanup;
}
_cairo_composite_rectangles_fini (&extents);
return _cairo_output_stream_get_status (surface->output);
cleanup:
_cairo_composite_rectangles_fini (&extents);
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_fill (void *abstract_surface,
cairo_operator_t op,
const cairo_pattern_t *source,
const cairo_path_fixed_t*path,
cairo_fill_rule_t fill_rule,
double tolerance,
cairo_antialias_t antialias,
const cairo_clip_t *clip)
{
cairo_pdf_surface_t *surface = abstract_surface;
cairo_int_status_t status;
cairo_pdf_smask_group_t *group;
cairo_pdf_resource_t pattern_res, gstate_res;
cairo_composite_rectangles_t extents;
status = _cairo_composite_rectangles_init_for_fill (&extents,
&surface->base,
op, source, path,
clip);
if (unlikely (status))
return status;
/* use the more accurate extents */
if (extents.is_bounded) {
cairo_rectangle_int_t mask;
cairo_box_t box;
_cairo_path_fixed_fill_extents (path,
fill_rule,
tolerance,
&mask);
_cairo_box_from_rectangle (&box, &mask);
status = _cairo_composite_rectangles_intersect_mask_extents (&extents,
&box);
if (unlikely (status))
goto cleanup;
}
status = _cairo_pdf_interchange_add_operation_extents (surface, &extents.bounded);
if (unlikely (status))
goto cleanup;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE) {
status = _cairo_pdf_surface_analyze_operation (surface, op, source, &extents.bounded);
goto cleanup;
} else if (surface->paginated_mode == CAIRO_PAGINATED_MODE_FALLBACK) {
status = _cairo_pdf_surface_start_fallback (surface);
if (unlikely (status))
goto cleanup;
}
assert (_cairo_pdf_surface_operation_supported (surface, op, source, &extents.bounded));
status = _cairo_pdf_surface_set_clip (surface, &extents);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_surface_select_operator (surface, op);
if (unlikely (status))
goto cleanup;
if (_can_paint_pattern (source)) {
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (unlikely (status))
goto cleanup;
_cairo_output_stream_printf (surface->output, "q\n");
status = _cairo_pdf_operators_clip (&surface->pdf_operators,
path,
fill_rule);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_surface_paint_pattern (surface,
op,
source,
&extents.bounded,
1.0, /* alpha */
FALSE); /* mask */
if (unlikely (status))
goto cleanup;
_cairo_output_stream_printf (surface->output, "Q\n");
status = _cairo_output_stream_get_status (surface->output);
goto cleanup;
}
pattern_res.id = 0;
gstate_res.id = 0;
status = _cairo_pdf_surface_add_pdf_pattern (surface, source, op,
&extents.bounded,
&pattern_res, &gstate_res);
if (unlikely (status))
goto cleanup;
if (gstate_res.id != 0) {
group = _cairo_pdf_surface_create_smask_group (surface, &extents.bounded);
if (unlikely (group == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto cleanup;
}
group->operation = PDF_FILL;
status = _cairo_pattern_create_copy (&group->source, source);
if (unlikely (status)) {
_cairo_pdf_smask_group_destroy (group);
goto cleanup;
}
group->source_res = pattern_res;
status = _cairo_path_fixed_init_copy (&group->path, path);
if (unlikely (status)) {
_cairo_pdf_smask_group_destroy (group);
goto cleanup;
}
group->fill_rule = fill_rule;
status = _cairo_pdf_surface_add_smask_group (surface, group);
if (unlikely (status)) {
_cairo_pdf_smask_group_destroy (group);
goto cleanup;
}
status = _cairo_pdf_surface_add_smask (surface, gstate_res);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_surface_add_xobject (surface, group->group_res);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (unlikely (status))
goto cleanup;
_cairo_output_stream_printf (surface->output,
"q /s%d gs /x%d Do Q\n",
gstate_res.id,
group->group_res.id);
} else {
status = _cairo_pdf_surface_select_pattern (surface, source, pattern_res, FALSE);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_operators_fill (&surface->pdf_operators,
path,
fill_rule);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_surface_unselect_pattern (surface);
if (unlikely (status))
goto cleanup;
}
_cairo_composite_rectangles_fini (&extents);
return _cairo_output_stream_get_status (surface->output);
cleanup:
_cairo_composite_rectangles_fini (&extents);
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_fill_stroke (void *abstract_surface,
cairo_operator_t fill_op,
const cairo_pattern_t *fill_source,
cairo_fill_rule_t fill_rule,
double fill_tolerance,
cairo_antialias_t fill_antialias,
const cairo_path_fixed_t*path,
cairo_operator_t stroke_op,
const cairo_pattern_t *stroke_source,
const cairo_stroke_style_t *stroke_style,
const cairo_matrix_t *stroke_ctm,
const cairo_matrix_t *stroke_ctm_inverse,
double stroke_tolerance,
cairo_antialias_t stroke_antialias,
const cairo_clip_t *clip)
{
cairo_pdf_surface_t *surface = abstract_surface;
cairo_int_status_t status;
cairo_pdf_resource_t fill_pattern_res, stroke_pattern_res, gstate_res;
cairo_composite_rectangles_t extents;
/* During analysis we return unsupported and let the _fill and
* _stroke functions that are on the fallback path do the analysis
* for us. During render we may still encounter unsupported
* combinations of fill/stroke patterns. However we can return
* unsupported anytime to let the _fill and _stroke functions take
* over.
*/
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
return CAIRO_INT_STATUS_UNSUPPORTED;
/* PDF rendering of fill-stroke is not the same as cairo-wasm when
* either the fill or stroke is not opaque.
*/
if ( !_cairo_pattern_is_opaque (fill_source, NULL) ||
!_cairo_pattern_is_opaque (stroke_source, NULL))
{
return CAIRO_INT_STATUS_UNSUPPORTED;
}
if (fill_op != stroke_op)
return CAIRO_INT_STATUS_UNSUPPORTED;
/* Compute the operation extents using the stroke which will naturally
* be larger than the fill extents.
*/
status = _cairo_composite_rectangles_init_for_stroke (&extents,
&surface->base,
stroke_op, stroke_source,
path, stroke_style, stroke_ctm,
clip);
if (unlikely (status))
return status;
/* use the more accurate extents */
if (extents.is_bounded) {
cairo_rectangle_int_t mask;
cairo_box_t box;
status = _cairo_path_fixed_stroke_extents (path, stroke_style,
stroke_ctm, stroke_ctm_inverse,
stroke_tolerance,
&mask);
if (unlikely (status))
goto cleanup;
_cairo_box_from_rectangle (&box, &mask);
status = _cairo_composite_rectangles_intersect_mask_extents (&extents,
&box);
if (unlikely (status))
goto cleanup;
}
status = _cairo_pdf_surface_set_clip (surface, &extents);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_surface_select_operator (surface, fill_op);
if (unlikely (status))
goto cleanup;
/* use the more accurate extents */
if (extents.is_bounded) {
cairo_rectangle_int_t mask;
cairo_box_t box;
_cairo_path_fixed_fill_extents (path,
fill_rule,
fill_tolerance,
&mask);
_cairo_box_from_rectangle (&box, &mask);
status = _cairo_composite_rectangles_intersect_mask_extents (&extents,
&box);
if (unlikely (status))
goto cleanup;
}
status = _cairo_pdf_interchange_add_operation_extents (surface, &extents.bounded);
if (unlikely (status))
goto cleanup;
fill_pattern_res.id = 0;
gstate_res.id = 0;
status = _cairo_pdf_surface_add_pdf_pattern (surface, fill_source,
fill_op,
&extents.bounded,
&fill_pattern_res,
&gstate_res);
if (unlikely (status))
goto cleanup;
assert (gstate_res.id == 0);
stroke_pattern_res.id = 0;
gstate_res.id = 0;
status = _cairo_pdf_surface_add_pdf_pattern (surface,
stroke_source,
stroke_op,
&extents.bounded,
&stroke_pattern_res,
&gstate_res);
if (unlikely (status))
goto cleanup;
assert (gstate_res.id == 0);
/* As PDF has separate graphics state for fill and stroke we can
* select both at the same time */
status = _cairo_pdf_surface_select_pattern (surface, fill_source,
fill_pattern_res, FALSE);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_surface_select_pattern (surface, stroke_source,
stroke_pattern_res, TRUE);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_operators_fill_stroke (&surface->pdf_operators,
path,
fill_rule,
stroke_style,
stroke_ctm,
stroke_ctm_inverse);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_surface_unselect_pattern (surface);
if (unlikely (status))
goto cleanup;
_cairo_composite_rectangles_fini (&extents);
return _cairo_output_stream_get_status (surface->output);
cleanup:
_cairo_composite_rectangles_fini (&extents);
return status;
}
static cairo_bool_t
_cairo_pdf_surface_has_show_text_glyphs (void *abstract_surface)
{
return TRUE;
}
static cairo_int_status_t
_cairo_pdf_surface_show_text_glyphs (void *abstract_surface,
cairo_operator_t op,
const cairo_pattern_t *source,
const char *utf8,
int utf8_len,
cairo_glyph_t *glyphs,
int num_glyphs,
const cairo_text_cluster_t *clusters,
int num_clusters,
cairo_text_cluster_flags_t cluster_flags,
cairo_scaled_font_t *scaled_font,
const cairo_clip_t *clip)
{
cairo_pdf_surface_t *surface = abstract_surface;
cairo_pdf_smask_group_t *group;
cairo_pdf_resource_t pattern_res, gstate_res;
cairo_composite_rectangles_t extents;
cairo_bool_t overlap;
cairo_int_status_t status;
status = _cairo_composite_rectangles_init_for_glyphs (&extents,
&surface->base,
op, source,
scaled_font,
glyphs, num_glyphs,
clip,
&overlap);
if (unlikely (status))
return status;
status = _cairo_pdf_interchange_add_operation_extents (surface, &extents.bounded);
if (unlikely (status))
return status;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE) {
status = _cairo_pdf_surface_analyze_operation (surface, op, source, &extents.bounded);
goto cleanup;
}
assert (_cairo_pdf_surface_operation_supported (surface, op, source, &extents.bounded));
status = _cairo_pdf_surface_set_clip (surface, &extents);
if (unlikely (status))
goto cleanup;
pattern_res.id = 0;
gstate_res.id = 0;
status = _cairo_pdf_surface_add_pdf_pattern (surface, source, op,
&extents.bounded,
&pattern_res, &gstate_res);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_surface_select_operator (surface, op);
if (unlikely (status))
goto cleanup;
if (gstate_res.id != 0) {
group = _cairo_pdf_surface_create_smask_group (surface, &extents.bounded);
if (unlikely (group == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto cleanup;
}
group->operation = PDF_SHOW_GLYPHS;
status = _cairo_pattern_create_copy (&group->source, source);
if (unlikely (status)) {
_cairo_pdf_smask_group_destroy (group);
goto cleanup;
}
group->source_res = pattern_res;
if (utf8_len) {
group->utf8 = _cairo_malloc (utf8_len);
if (unlikely (group->utf8 == NULL)) {
_cairo_pdf_smask_group_destroy (group);
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto cleanup;
}
memcpy (group->utf8, utf8, utf8_len);
}
group->utf8_len = utf8_len;
if (num_glyphs) {
group->glyphs = _cairo_malloc_ab (num_glyphs, sizeof (cairo_glyph_t));
if (unlikely (group->glyphs == NULL)) {
_cairo_pdf_smask_group_destroy (group);
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto cleanup;
}
memcpy (group->glyphs, glyphs, sizeof (cairo_glyph_t) * num_glyphs);
}
group->num_glyphs = num_glyphs;
if (num_clusters) {
group->clusters = _cairo_malloc_ab (num_clusters, sizeof (cairo_text_cluster_t));
if (unlikely (group->clusters == NULL)) {
_cairo_pdf_smask_group_destroy (group);
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto cleanup;
}
memcpy (group->clusters, clusters, sizeof (cairo_text_cluster_t) * num_clusters);
}
group->num_clusters = num_clusters;
group->scaled_font = cairo_scaled_font_reference (scaled_font);
status = _cairo_pdf_surface_add_smask_group (surface, group);
if (unlikely (status)) {
_cairo_pdf_smask_group_destroy (group);
goto cleanup;
}
status = _cairo_pdf_surface_add_smask (surface, gstate_res);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_surface_add_xobject (surface, group->group_res);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (unlikely (status))
goto cleanup;
_cairo_output_stream_printf (surface->output,
"q /s%d gs /x%d Do Q\n",
gstate_res.id,
group->group_res.id);
} else {
status = _cairo_pdf_surface_select_pattern (surface, source, pattern_res, FALSE);
if (unlikely (status))
goto cleanup;
/* Each call to show_glyphs() with a transclucent pattern must
* be in a separate text object otherwise overlapping text
* from separate calls to show_glyphs will not composite with
* each other. */
if (! _cairo_pattern_is_opaque (source, &extents.bounded)) {
status = _cairo_pdf_operators_flush (&surface->pdf_operators);
if (unlikely (status))
goto cleanup;
}
status = _cairo_pdf_operators_show_text_glyphs (&surface->pdf_operators,
utf8, utf8_len,
glyphs, num_glyphs,
clusters, num_clusters,
cluster_flags,
scaled_font);
if (unlikely (status))
goto cleanup;
status = _cairo_pdf_surface_unselect_pattern (surface);
if (unlikely (status))
goto cleanup;
}
_cairo_composite_rectangles_fini (&extents);
return _cairo_output_stream_get_status (surface->output);
cleanup:
_cairo_composite_rectangles_fini (&extents);
return status;
}
static const char **
_cairo_pdf_surface_get_supported_mime_types (void *abstract_surface)
{
return _cairo_pdf_supported_mime_types;
}
static cairo_int_status_t
_cairo_pdf_surface_tag (void *abstract_surface,
cairo_bool_t begin,
const char *tag_name,
const char *attributes,
const cairo_pattern_t *source,
const cairo_stroke_style_t *style,
const cairo_matrix_t *ctm,
const cairo_matrix_t *ctm_inverse,
const cairo_clip_t *clip)
{
cairo_pdf_surface_t *surface = abstract_surface;
cairo_int_status_t status = 0;
if (begin)
status = _cairo_pdf_interchange_tag_begin (surface, tag_name, attributes);
else
status = _cairo_pdf_interchange_tag_end (surface, tag_name);
return status;
}
static cairo_int_status_t
_cairo_pdf_surface_set_paginated_mode (void *abstract_surface,
cairo_paginated_mode_t paginated_mode)
{
cairo_pdf_surface_t *surface = abstract_surface;
cairo_int_status_t status;
surface->paginated_mode = paginated_mode;
status = _cairo_pdf_interchange_begin_page_content (surface);
if (unlikely (status))
return status;
if (paginated_mode == CAIRO_PAGINATED_MODE_RENDER) {
surface->surface_extents.x = 0;
surface->surface_extents.y = 0;
surface->surface_extents.width = ceil (surface->width);
surface->surface_extents.height = ceil (surface->height);
}
return CAIRO_INT_STATUS_SUCCESS;
}
static const cairo_surface_backend_t cairo_pdf_surface_backend = {
CAIRO_SURFACE_TYPE_PDF,
_cairo_pdf_surface_finish,
_cairo_default_context_create,
NULL, /* create similar: handled by wrapper */
NULL, /* create similar image */
NULL, /* map to image */
NULL, /* unmap image */
_cairo_surface_default_source,
NULL, /* acquire_source_image */
NULL, /* release_source_image */
NULL, /* snapshot */
NULL, /* _cairo_pdf_surface_copy_page */
_cairo_pdf_surface_show_page,
_cairo_pdf_surface_get_extents,
_cairo_pdf_surface_get_font_options,
NULL, /* flush */
NULL, /* mark_dirty_rectangle */
/* Here are the drawing functions */
_cairo_pdf_surface_paint,
_cairo_pdf_surface_mask,
_cairo_pdf_surface_stroke,
_cairo_pdf_surface_fill,
_cairo_pdf_surface_fill_stroke,
NULL, /* show_glyphs */
_cairo_pdf_surface_has_show_text_glyphs,
_cairo_pdf_surface_show_text_glyphs,
_cairo_pdf_surface_get_supported_mime_types,
_cairo_pdf_surface_tag,
};
static const cairo_paginated_surface_backend_t
cairo_pdf_surface_paginated_backend = {
_cairo_pdf_surface_start_page,
_cairo_pdf_surface_set_paginated_mode,
NULL, /* set_bounding_box */
_cairo_pdf_surface_has_fallback_images,
_cairo_pdf_surface_supports_fine_grained_fallbacks,
_cairo_pdf_surface_requires_thumbnail_image,
_cairo_pdf_surface_set_thumbnail_image,
};
|
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
from spack.pkg.builtin.boost import Boost
class PyPycuda(PythonPackage):
"""PyCUDA gives you easy, Pythonic access to Nvidia's CUDA parallel
computation API
"""
homepage = "https://mathema.tician.de/software/pycuda/"
pypi = "pycuda/pycuda-2019.1.2.tar.gz"
version('2021.1', sha256='ab87312d0fc349d9c17294a087bb9615cffcf966ad7b115f5b051008a48dd6ed')
version('2020.1', sha256='effa3b99b55af67f3afba9b0d1b64b4a0add4dd6a33bdd6786df1aa4cc8761a5')
version('2019.1.2', sha256='ada56ce98a41f9f95fe18809f38afbae473a5c62d346cfa126a2d5477f24cc8a')
version('2016.1.2', sha256='a7dbdac7e2f0c0d2ad98f5f281d5a9d29d6673b3c20210e261b96e9a2d0b6e37')
@run_before('install')
def configure(self):
pyver = self.spec['python'].version.up_to(2).joined
boostlib = 'boost_python{0}'.format(pyver)
configure_args = [
'--no-use-shipped-boost',
'--boost-inc-dir={0}'.format(self.spec['boost'].prefix.include),
'--boost-lib-dir={0}'.format(self.spec['boost'].libs.directories[0]),
'--boost-python-libname={0}'.format(boostlib)
]
python('configure.py', *configure_args)
depends_on('py-setuptools', type='build')
depends_on('cuda')
depends_on('boost+python')
# TODO: replace this with an explicit list of components of Boost,
# for instance depends_on('boost +filesystem')
# See https://github.com/spack/spack/pull/22303 for reference
depends_on(Boost.with_default_variants)
depends_on('python@3.6:3', type=('build', 'run'), when='@2020.1:')
depends_on('py-numpy@1.6:', type=('build', 'run'))
depends_on('py-pytools@2011.2:', type=('build', 'run'))
depends_on('py-six', type='run', when='@:2020.1')
depends_on('py-decorator@3.2.0:', type=('build', 'run'), when='@:2020.1')
depends_on('py-appdirs@1.4.0:', type=('build', 'run'))
depends_on('py-mako', type=('build', 'run'))
depends_on('cuda@:8.0.61', when='@2016.1.2')
|
#ifndef _LPORT_H_
#define _LPORT_H_
extern "C" {
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include <tolua++.h>
}
int luaopen_port(lua_State *L);
#endif
|
#!/usr/bin/env python3
import signal
import sys
import time
import threading
class Hi():
def __init__(self):
signal.signal(signal.SIGINT, self.signal_handler)
assert False
for i in range(5000):
print("Sleeping {}".format(i), end="\r")
time.sleep(i)
def signal_handler(self, signal, frame):
print('You pressed Ctrl+C!')
sys.exit(1)
try:
x = Hi()
except Exception as e:
# Good this does not catch keyboardInterrupt
print("Caught me!")
sys.exit(0)
|
define("ace/mode/scad",["require","exports","module","pilot/oop","ace/mode/text","ace/tokenizer","ace/mode/scad_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/scad_highlight_rules").scadHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=a("ace/mode/behaviour/cstyle").CstyleBehaviour,k=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h,this.$behaviour=new j};d.inherits(k,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)\/\//;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"//")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[]\s*$/);h&&(d+=c)}else if(a=="doc-start"){if(g=="start")return"";var h=b.match(/^\s*(\/?)\*/);h&&(h[1]&&(d+=" "),d+="* ")}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(k.prototype),b.Mode=k}),define("ace/mode/scad_highlight_rules",["require","exports","module","pilot/oop","pilot/lang","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules,g=a("ace/mode/text_highlight_rules").TextHighlightRules,h=function(){var a=e.arrayToMap("module|if|else|for".split("|")),b=e.arrayToMap("NULL".split("|"));this.$rules={start:[{token:"comment",regex:"\\/\\/.*$"},(new f).getStartRule("start"),{token:"comment",merge:!0,regex:"\\/\\*",next:"comment"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:'["].*\\\\$',next:"qqstring"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"string",regex:"['].*\\\\$",next:"qstring"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant",regex:"<[a-zA-Z0-9.]+>"},{token:"keyword",regex:"(?:use|include)"},{token:function(c){return c=="this"?"variable.language":a.hasOwnProperty(c)?"keyword":b.hasOwnProperty(c)?"constant.language":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",merge:!0,regex:".+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",merge:!0,regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",merge:!0,regex:".+"}]},this.embedRules(f,"doc-",[(new f).getEndRule("start")])};d.inherits(h,g),b.scadHighlightRules=h}),define("ace/mode/doc_comment_highlight_rules",["require","exports","module","pilot/oop","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},{token:"comment.doc",merge:!0,regex:"\\s+"},{token:"comment.doc",merge:!0,regex:"TODO"},{token:"comment.doc",merge:!0,regex:"[^@\\*]+"},{token:"comment.doc",merge:!0,regex:"."}]}};d.inherits(f,e),function(){this.getStartRule=function(a){return{token:"comment.doc",merge:!0,regex:"\\/\\*(?=\\*)",next:a}},this.getEndRule=function(a){return{token:"comment.doc",merge:!0,regex:"\\*\\/",next:a}}}.call(f.prototype),b.DocCommentHighlightRules=f}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(a,b,c){var d=a("ace/range").Range,e=function(){};(function(){this.checkOutdent=function(a,b){return/^\s+$/.test(a)?/^\s*\}/.test(b):!1},this.autoOutdent=function(a,b){var c=a.getLine(b),e=c.match(/^(\s*\})/);if(!e)return 0;var f=e[1].length,g=a.findMatchingBracket({row:b,column:f});if(!g||g.row==b)return 0;var h=this.$getIndent(a.getLine(g.row));a.replace(new d(b,0,b,f-1),h)},this.$getIndent=function(a){var b=a.match(/^(\s+)/);return b?b[1]:""}}).call(e.prototype),b.MatchingBraceOutdent=e}),define("ace/mode/behaviour/cstyle",["require","exports","module","pilot/oop","ace/mode/behaviour"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/behaviour").Behaviour,f=function(){this.add("braces","insertion",function(a,b,c,d,e){if(e=="{"){var f=c.getSelectionRange(),g=d.doc.getTextRange(f);return g!==""?{text:"{"+g+"}",selection:!1}:{text:"{}",selection:[1,1]}}if(e=="}"){var h=c.getCursorPosition(),i=d.doc.getLine(h.row),j=i.substring(h.column,h.column+1);if(j=="}"){var k=d.$findOpeningBracket("}",{column:h.column+1,row:h.row});if(k!==null)return{text:"",selection:[1,1]}}}else if(e=="\n"){var h=c.getCursorPosition(),i=d.doc.getLine(h.row),j=i.substring(h.column,h.column+1);if(j=="}"){var l=d.findMatchingBracket({row:h.row,column:h.column+1});if(!l)return null;var m=this.getNextLineIndent(a,i.substring(0,i.length-1),d.getTabString()),n=this.$getIndent(d.doc.getLine(l.row));return{text:"\n"+m+"\n"+n,selection:[1,m.length,1,m.length]}}}}),this.add("braces","deletion",function(a,b,c,d,e){var f=d.doc.getTextRange(e);if(!e.isMultiLine()&&f=="{"){var g=d.doc.getLine(e.start.row),h=g.substring(e.end.column,e.end.column+1);if(h=="}")return e.end.column++,e}}),this.add("parens","insertion",function(a,b,c,d,e){if(e=="("){var f=c.getSelectionRange(),g=d.doc.getTextRange(f);return g!==""?{text:"("+g+")",selection:!1}:{text:"()",selection:[1,1]}}if(e==")"){var h=c.getCursorPosition(),i=d.doc.getLine(h.row),j=i.substring(h.column,h.column+1);if(j==")"){var k=d.$findOpeningBracket(")",{column:h.column+1,row:h.row});if(k!==null)return{text:"",selection:[1,1]}}}}),this.add("parens","deletion",function(a,b,c,d,e){var f=d.doc.getTextRange(e);if(!e.isMultiLine()&&f=="("){var g=d.doc.getLine(e.start.row),h=g.substring(e.start.column+1,e.start.column+2);if(h==")")return e.end.column++,e}}),this.add("string_dquotes","insertion",function(a,b,c,d,e){if(e=='"'){var f=c.getSelectionRange(),g=d.doc.getTextRange(f);if(g!=="")return{text:'"'+g+'"',selection:!1};var h=c.getCursorPosition(),i=d.doc.getLine(h.row),j=i.substring(h.column-1,h.column);if(j=="\\")return null;var k=d.getTokens(f.start.row,f.start.row)[0].tokens,l=0,m,n=-1;for(var o=0;o<k.length;o++){m=k[o],m.type=="string"?n=-1:n<0&&(n=m.value.indexOf('"'));if(m.value.length+l>f.start.column)break;l+=k[o].value.length}if(!m||n<0&&m.type!=="comment"&&(m.type!=="string"||f.start.column!==m.value.length+l-1&&m.value.lastIndexOf('"')===m.value.length-1))return{text:'""',selection:[1,1]};if(m&&m.type==="string"){var p=i.substring(h.column,h.column+1);if(p=='"')return{text:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(a,b,c,d,e){var f=d.doc.getTextRange(e);if(!e.isMultiLine()&&f=='"'){var g=d.doc.getLine(e.start.row),h=g.substring(e.start.column+1,e.start.column+2);if(h=='"')return e.end.column++,e}})};d.inherits(f,e),b.CstyleBehaviour=f})
|
import asyncio
from typing import Any, Generator
import aioreactive as rx
import pytest
from aioreactive.testing import VirtualTimeEventLoop
from expression.core import pipe
class MyException(Exception):
pass
@pytest.yield_fixture() # type:ignore
def event_loop() -> Generator[Any, Any, Any]:
loop = VirtualTimeEventLoop()
yield loop
loop.close()
@pytest.mark.asyncio
async def test_filter_happy() -> None:
xs = rx.from_iterable([1, 2, 3])
result = []
async def asend(value: int) -> None:
result.append(value)
async def predicate(value: int) -> bool:
await asyncio.sleep(0.1)
return value > 1
ys = pipe(xs, rx.filter_async(predicate))
value = await rx.run(ys, rx.AsyncAwaitableObserver(asend))
assert value == 3
assert result == [2, 3]
@pytest.mark.asyncio
async def test_filter_predicate_throws() -> None:
xs = rx.from_iterable([1, 2, 3])
err = MyException("err")
result = []
async def asend(value: int) -> None:
result.append(value)
async def predicate(value: int) -> bool:
await asyncio.sleep(0.1)
raise err
ys = pipe(xs, rx.filter_async(predicate))
with pytest.raises(MyException):
await rx.run(ys, rx.AsyncAwaitableObserver(asend))
assert result == []
|
def year_wise_medal_tally(df, country):
cm = df.dropna(subset=['Medal'])
cm = cm.drop_duplicates(subset=['Team', 'NOC', 'Games', 'Year', 'City', 'Sport', 'Event', 'Medal'])
cm = cm[cm['Country'] == country]
cm = cm.groupby('Year').count()['Medal'].reset_index()
return cm
def country_event_heatmap(df, country):
best_sport = cm = df.dropna(subset=['Medal'])
best_sport = best_sport.drop_duplicates(subset=['Team', 'NOC', 'Games', 'Year', 'City', 'Sport', 'Event', 'Medal'])
best_sport = best_sport[best_sport['Country'] == country]
# making a pivot table
pt = best_sport.pivot_table(index='Sport', columns='Year', values='Medal', aggfunc='count')
pt = pt.fillna(0).astype('int')
return pt
def successful_athlete(df, country):
temp = df.dropna(subset=['Medal'])
temp = temp[temp['Country'] == country]
temp = temp['Name'].value_counts().reset_index()
temp = temp.merge(df, left_on='index', right_on='Name', how='left')
temp = temp[['index', 'Name_x', 'Sport']]
temp = temp.drop_duplicates('index')
temp.rename(columns={'index': 'Name', 'Name_x': 'Medals'}, inplace=True)
return temp.head(10)
|
/**
* @private
*/
Ext.define('Ext.device.twitter.Abstract', {
/**
* Pops up a Twitter compose sheet view with your specified tweet.
*
* @param {Object} config An object which contains the following config options:
*
* @param {String} config.tweet The default tweet text to add to the compose window.
*
* @param {String} config.url An optional URL to attatch to the Tweet.
*
* @param {String} config.image An optional image URL to attatch to the Tweet.
*
* @param {Function} config.success The callback when the Tweet is successfully posted.
*
* @param {Function} config.failure The callback when the Tweet is unsuccessfully posted.
*/
compose: Ext.emptyFn,
/**
* Gets Tweets from Twitter Timeline
*
* @param {Object} config An object which contains the following config options:
*
* @param {Function} config.success callback
* @param {Object[]} config.success.response Tweet objects, see [Twitter Timeline Doc]
*
* @param {Function} config.failure callback
* @param {String} config.failure.error reason for failure
*
* [Twitter Timeline Doc]: https://dev.twitter.com/docs/api/1/get/statuses/public_timeline
*/
getPublicTimeline: Ext.emptyFn,
/**
* Gets Tweets from Twitter Mentions
*
* @param {Object} config An object which contains the following config options:
*
* @param {Function} config.success callback
* @param {Object[]} config.success.response Tweet objects, see [Twitter Mentions Doc]
*
* @param {Function} config.failure callback
* @param {String} config.failure.error reason for failure
*
* [Twitter Timeline Doc]: https://dev.twitter.com/docs/api/1/get/statuses/public_timeline
*/
getMentions: Ext.emptyFn,
/**
* Gets a specific Twitter user info
*
* @param {Object} config An object which contains the following config options:
*
* @param {Function} config.success callback
* @param {Object[]} config.success.response The JSON response form twitter
*
* @param {Function} config.failure callback
* @param {String} config.failure.error reason for failure
*/
getTwitterUsername: Ext.emptyFn,
/**
* Gets a specific Twitter user info
*
* @param {Object} config An object which contains the following config options:
*
* @param {String} config.url of [Twitter API Endpoint]
*
* @param {Object} config.params key-value map, matching [Twitter API Endpoint]
*
* @param {Object} config.options (optional) other options for the HTTP request
* @param {String} config.options.requestMethod HTTP Request type, ex: "POST"
*
* @param {Function} config.success callback
* @param {Object[]} config.success.response objects returned from Twitter API (Tweets, Users,...)
*
* @param {Function} config.failure callback
* @param {String} config.failure.error reason for failure
*
* [Twitter API Endpoint]: https://dev.twitter.com/docs/api
*/
getTwitterRequest: Ext.emptyFn
});
|
// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.
//
// 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.
import React from 'react'
import bind from 'autobind-decorator'
import classnames from 'classnames'
import { defineMessages } from 'react-intl'
import Button from '@ttn-lw/components/button'
import ErrorNotification from '@ttn-lw/components/error-notification'
import List from '@ttn-lw/components/list'
import Icon from '@ttn-lw/components/icon'
import getEventComponentByName from '@ttn-lw/components/event/types'
import Message from '@ttn-lw/lib/components/message'
import sharedMessages from '@ttn-lw/lib/shared-messages'
import PropTypes from '@ttn-lw/lib/prop-types'
import EventsWidget from './widget'
import style from './events.styl'
const m = defineMessages({
truncated: 'Events have been truncated',
showing: 'Showing all available events',
})
@bind
class Events extends React.Component {
static propTypes = {
className: PropTypes.string,
emitterId: PropTypes.string.isRequired,
error: PropTypes.error,
events: PropTypes.arrayOf(PropTypes.event),
limit: PropTypes.number,
onClear: PropTypes.func.isRequired,
onRestart: PropTypes.func.isRequired,
}
static defaultProps = {
className: undefined,
events: [],
limit: 100,
error: undefined,
}
state = {
paused: false,
}
shouldComponentUpdate(nextProps, nextState) {
const { paused } = this.state
const { events, emitterId, onClear, limit, error } = this.props
if (
emitterId !== nextProps.emitterId ||
limit !== nextProps.limit ||
onClear !== nextProps.onClear ||
paused !== nextState.paused ||
error !== nextProps.error
) {
return true
}
const newEvents = events !== nextProps.events
const clearedEvents = newEvents && nextProps.events.length === 0
// Rerender component if cleared events when in the `paused` state.
if (clearedEvents && paused) {
return true
}
// Do not rerender component on new events when in the `paused` state.
if (newEvents && paused) {
return false
}
return newEvents
}
renderEvent(event) {
const { component: Component, type } = getEventComponentByName(event)
return (
<List.Item className={style.listItem}>
<Component
overviewClassName={style.event}
expandedClassName={style.eventData}
event={event}
type={type}
/>
</List.Item>
)
}
onPause() {
this.setState(prev => ({ paused: !prev.paused }))
}
onClear() {
const { onClear } = this.props
onClear()
}
getEventkey(event) {
return `${event.time}-${event.name}`
}
render() {
const { className, events, onClear, emitterId, limit, error, onRestart } = this.props
const { paused } = this.state
if (error) {
return (
<ErrorNotification
small
title={sharedMessages.eventsCannotShow}
content={error}
action={onRestart}
actionMessage={sharedMessages.restartStream}
buttonIcon="refresh"
/>
)
}
let limitedEvents = events
const truncated = events.length > limit
if (truncated) {
limitedEvents = events.slice(0, limit)
}
const header = <Header paused={paused} onPause={this.onPause} onClear={onClear} />
const footer = <Footer truncated={truncated} />
return (
<div className={style.container}>
<List
bordered
size="none"
className={classnames(style.listContainer, className)}
listClassName={style.list}
header={header}
footer={footer}
items={limitedEvents}
renderItem={this.renderEvent}
rowKey={this.getEventkey}
emptyMessage={sharedMessages.noEvents}
emptyMessageValues={{ entityId: emitterId }}
/>
</div>
)
}
}
Events.Widget = EventsWidget
const Header = function(props) {
const { paused, onPause, onClear } = props
const pauseMessage = paused ? sharedMessages.resume : sharedMessages.pause
const pauseIcon = paused ? 'play_arrow' : 'pause'
return (
<div className={style.header}>
<div className={style.headerColumns}>
<Message className={style.headerColumnsTime} content={sharedMessages.time} />
<Message className={style.headerColumnsId} content={sharedMessages.entityId} />
<Message content={sharedMessages.data} />
</div>
<div className={style.headerActions}>
<Button onClick={onPause} message={pauseMessage} naked secondary icon={pauseIcon} />
<Button onClick={onClear} message={sharedMessages.clear} naked secondary icon="delete" />
</div>
</div>
)
}
Header.propTypes = {
onClear: PropTypes.func,
onPause: PropTypes.func,
paused: PropTypes.bool,
}
Header.defaultProps = {
paused: false,
onPause: () => null,
onClear: () => null,
}
const Footer = function(props) {
const { truncated } = props
return (
<div
className={classnames(style.footer, {
[style.footerTruncated]: truncated,
})}
>
{truncated ? (
<React.Fragment>
<Icon icon="warning" />
<Message content="Events have been truncated" className={style.footerTruncatedText} />
</React.Fragment>
) : (
<Message content={m.showing} />
)}
</div>
)
}
Footer.propTypes = {
truncated: PropTypes.bool,
}
Footer.defaultProps = {
truncated: false,
}
export default Events
|
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[11],{"100U":function(t,e,n){"use strict";var a=n("zKsV"),o=n.n(a);o.a},"2goY":function(t,e,n){"use strict";function a(t){return Object.prototype.toString.call(t).slice(8,-1)}function o(t){let e=[];function n(t){if(t&&"Object"===a(t)){if(-1!==e.indexOf(t))return!0;for(var o in e.push(t),t)if(!0===t.hasOwnProperty(o)&&n(t[o]))return!0}return!1}return n(t)}const i=function(t){if(null===t||void 0===t)return;const e=a(t);if("Date"===e){let e=new Date;return e.setTime(t.getTime()),e}if("Object"===e){if(!0===o(t))return t;let e={};for(let n in t)e[n]=i(t[n]);return e}if("Array"===e){let e=[];for(var n=0;n<t.length;n++)e.push(i(t[n]));return e}return t};t.exports=i},E9X9:function(t,e,n){"use strict";var a=n("lsdc"),o=n.n(a);o.a},X1Kz:function(t,e,n){"use strict";n.d(e,"a",function(){return o}),n.d(e,"d",function(){return i}),n.d(e,"b",function(){return c}),n.d(e,"e",function(){return l}),n.d(e,"c",function(){return s});var a=n("Zt8a"),o=function(t){var e=new URLSearchParams;return e.append("accountName",t.accountName),e.append("accountPass",t.accountPass),e.append("accountTitle",t.accountTitle),e.append("accountPhone",t.accountPhone),e.append("accountJob",t.accountJob),e.append("roleId",t.roleId),a["a"].request({url:"addAdmin",data:e,method:"post"})},i=function(t,e,n,o){var i=new URLSearchParams;return i.append("pageNum",t),e&&i.append("accountTitle",e),n&&i.append("accountJob",n),o&&i.append("shopId",o),a["a"].request({url:"getAdmins",data:i,method:"post"})},c=function(t){var e=new URLSearchParams;return e.append("id",t),a["a"].request({url:"changeAdminState",data:e,method:"post"})},l=function(){return a["a"].request({url:"getRoles",method:"post"})},s=function(t,e){var n=new URLSearchParams;return n.append("id",t),n.append("newPassword",e),a["a"].request({url:"changePassword",data:n,method:"post"})}},ajWJ:function(t,e,n){"use strict";var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[t.stateSelect?n("div",{staticStyle:{display:"inline-block","margin-bottom":"10px","vertical-align":"top"}},[t.selectShow?n("div",{staticStyle:{display:"inline-block"}},[n("Input",{staticStyle:{width:"300px"},model:{value:t.selectValueInput,callback:function(e){t.selectValueInput=e},expression:"selectValueInput"}},[n("Select",{staticStyle:{width:"80px"},attrs:{slot:"prepend",clearable:""},on:{"on-clear":t.clickEmpty,"on-change":t.onValue},slot:"prepend",model:{value:t.modelSelect,callback:function(e){t.modelSelect=e},expression:"modelSelect"}},t._l(t.selectOption,function(e){return n("Option",{key:e.value,attrs:{disabled:"-1"===e.value,value:e.value}},[t._v(t._s(e.label))])})),t._v(" "),n("Button",{attrs:{slot:"append",icon:"ios-search"},on:{click:t.update},slot:"append"})],1)],1):t._e(),t._v(" "),n("div",{staticStyle:{display:"inline-block"}},[t._t("customSelect")],2),t._v(" "),n("div",{staticStyle:{display:"inline-block","vertical-align":"top"}},[t._t("default")],2)]):t._e(),t._v(" "),n("Table",{ref:"selection",attrs:{stripe:"",columns:t.processingLolumns,data:t.value,loading:t.progress},on:{"on-selection-change":t.selectionChange}}),t._v(" "),t._t("statistics"),t._v(" "),n("Page",{staticStyle:{"margin-top":"20px"},attrs:{total:10*t.pageTotal,"show-elevator":""},on:{"on-change":t.emitPage,"on-page-size-change":t.emitPage}})],2)},o=[],i=n("2goY"),c=n.n(i),l={data:function(){return{editableId:"",processingLolumns:[],inputValue:"",selectValueInput:"",modelSelect:"",progress:!1}},props:{columns:{type:Array,default:function(){return[]}},width:{default:"100%"},value:{type:Array,default:function(){return[]}},selectOption:{type:Array,default:function(){return[]}},stateSelect:{type:Boolean,default:!0},pageTotal:{default:"1"},selectShow:{type:Boolean,default:!0},isLoading:{type:Boolean,default:!1},selectSatae:{type:String,default:""}},methods:{handleClick:function(t){t.row;var e=t.column,n=t.index;if("".concat(e.key,"_").concat(n)===this.editableId){var a=c()(this.value);a[n][e.key]=this.inputValue,this.inputValue&&this.$emit("input",a),this.editableId="",this.inputValue=""}else this.editableId="".concat(e.key,"_").concat(n)},handleInput:function(t){this.inputValue=t},compileInit:function(){var t=this,e=(this.$createElement,this.columns.map(function(e){return e.editable&&!e.render?(e.render=function(e,n){var a=n.row,o=n.column,i=n.index,c=t.editableId==="".concat(o.key,"_").concat(i);return e("div",[c?e("i-input",{on:{input:t.handleInput},attrs:{value:a[o.key]},style:"width: 50px"}):e("span",[a[o.key]]),e("i-button",{on:{click:t.handleClick.bind(t,{row:a,column:o,index:i})}},[c?"保存":"编辑"])])},e):e}));this.processingLolumns=e},clickEmpty:function(){var t={selectValueInput:"",modelSelect:""};this.$emit("filtrateClick",t)},selectEmpty:function(){this.selectValueInput="",this.modelSelect=""},onValue:function(t){this.selectValueInput="",this.$emit("onChange",t)},update:function(t){var e={};e.selectValueInput=this.selectValueInput?this.selectValueInput:"",e.modelSelect=this.modelSelect?this.modelSelect:"",this.modelSelect?this.$emit("filtrateClick",e):this.$Message.error("请输入要搜索的字段")},emitPage:function(t){this.$emit("getPage",t)},selectionChange:function(t){this.$emit("selectionChange",t)}},mounted:function(){this.compileInit()},watch:{isLoading:function(t){this.progress=t},selectSatae:function(){this.selectEmpty()}}},s=l,u=(n("E9X9"),n("KHd+")),r=Object(u["a"])(s,a,o,!1,null,null,null);e["a"]=r.exports},eGE4:function(t,e,n){"use strict";n.r(e);var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("div",[n("editableTables",{attrs:{columns:t.columns,pageTotal:t.pageTotal,selectOption:t.selectOption},on:{filtrateClick:t.filtrateClick,getPage:t.getPageNum},model:{value:t.dataList,callback:function(e){t.dataList=e},expression:"dataList"}},[n("div",{staticStyle:{"margin-left":"10px",display:"inline-block"}}),t._v(" "),n("addMessage",{on:{clickOk:t.addAdminDate}})],1)],1),t._v(" "),n("Modal",{attrs:{title:"修改密码",loading:t.modalPassword},on:{"on-ok":t.passwordOk,"on-cancel":function(e){t.password=""}},model:{value:t.modalState,callback:function(e){t.modalState=e},expression:"modalState"}},[n("Input",{staticStyle:{width:"300px"},attrs:{placeholder:"请输入新密码"},model:{value:t.password,callback:function(e){t.password=e},expression:"password"}})],1)],1)},o=[],i=n("ajWJ"),c=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticStyle:{display:"inline-block"}},[n("Button",{attrs:{type:"primary"},on:{click:function(e){t.modal=!t.modal}}},[t._v("添加人员")]),t._v(" "),n("Modal",{attrs:{title:"添加人员基本信息"},on:{"on-ok":t.ok,"on-cancel":t.cancel},model:{value:t.modal,callback:function(e){t.modal=e},expression:"modal"}},[n("div",{staticClass:"dataList"},[n("div",[n("span",[t._v("账号: ")]),n("Input",{staticStyle:{width:"300px"},attrs:{placeholder:""},model:{value:t.accountName,callback:function(e){t.accountName=e},expression:"accountName"}})],1),t._v(" "),n("div",[n("span",[t._v("密码: ")]),n("Input",{staticStyle:{width:"300px"},attrs:{placeholder:""},model:{value:t.accountPass,callback:function(e){t.accountPass=e},expression:"accountPass"}})],1),t._v(" "),n("div",[n("span",[t._v("姓名: ")]),n("Input",{staticStyle:{width:"300px"},attrs:{placeholder:""},model:{value:t.accountTitle,callback:function(e){t.accountTitle=e},expression:"accountTitle"}})],1),t._v(" "),n("div",[n("span",[t._v("电话: ")]),n("Input",{staticStyle:{width:"300px"},attrs:{placeholder:""},model:{value:t.accountPhone,callback:function(e){t.accountPhone=e},expression:"accountPhone"}})],1),t._v(" "),n("div",[n("span",[t._v("角色:")]),t._v(" "),n("Select",{staticStyle:{width:"200px"},model:{value:t.roleId,callback:function(e){t.roleId=e},expression:"roleId"}},t._l(t.jobList,function(e,a){return n("Option",{key:e.index,attrs:{value:e.id}},[t._v(t._s(e.roleTitle))])}))],1)])])],1)},l=[],s=n("X1Kz"),u=n("wnYN"),r={data:function(){return{modal:!1,accountName:"",accountPass:"",accountTitle:"",accountPhone:"",roleId:"",jobList:[]}},methods:{ok:function(){if(this.accountName&&this.accountPass&&this.accountTitle&&this.accountPhone&&this.roleId){var t={};t.accountName=this.accountName,t.accountPass=this.accountPass,t.accountTitle=this.accountTitle,t.accountPhone=this.accountPhone,t.roleId=this.roleId,t.accountJob=Object(u["h"])(this.jobList,this.roleId,"id","roleTitle"),this.$emit("clickOk",t),this.restoration()}else this.$Message.error("请完善信息")},cancel:function(){this.restoration()},restoration:function(){this.accountName="",this.accountPass="",this.accountTitle="",this.accountPhone="",this.roleId=""}},components:{},mounted:function(){var t=this;Object(s["e"])().then(function(e){e.info.map(function(e){t.jobList.push({roleTitle:e.roleTitle,id:e.id})})}).catch(function(t){console.log(t)})}},d=r,p=(n("oyvi"),n("KHd+")),h=Object(p["a"])(d,c,l,!1,null,null,null),m=h.exports,f={data:function(){var t=this;return{columns:[{title:"职务",key:"accountJob"},{title:"用户名",key:"accountName"},{title:"id",key:"id"},{title:"操作",key:"action",width:150,align:"center",render:function(e,n){return e("div",[e("Button",{props:{type:"info",size:"small"},style:{marginRight:"5px"},on:{click:function(){t.password="",t.daminId=n.row.id,t.modalState=!0}}},"修改密码")])}}],selectOption:[{label:"用户名",value:"accountTitle"},{label:"职务",value:"accountJob"}],dataList:[],pageNum:1,accountTitle:"",accountJob:"",pageTotal:1,vmodelSelect:"",selectShopId:"",modalState:!1,password:"",daminId:"",modalPassword:!0}},methods:{filtrateClick:function(t){this.pageNum=1,"accountTitle"===t.modelSelect?this.accountTitle=t.selectValueInput:this.accountTitle="","accountJob"===t.modelSelect?this.accountJob=t.selectValueInput:this.accountJob="",this.getList()},addAdminDate:function(t){var e=this;Object(s["a"])(t).then(function(t){e.$Message.success(t.info),e.restoration(),e.getList()}).catch(function(t){e.$Message.error(t)})},getList:function(){var t=this;this.dataList=[],Object(s["d"])(this.pageNum,this.accountTitle,this.accountJob,this.selectShopId).then(function(e){if("暂无数据"===e.info)return t.$Message.error(e.info),void(t.pageTotal=1);t.pageTotal=e.info.pageTotal,e.info.data.forEach(function(e){var n={};n.accountJob=e.sysAccountInfoDomain.accountJob,n.accountName=e.accountName,n.id=e.id,t.dataList.push(n)})}).catch(function(t){console.log(t)})},getPageNum:function(t){this.pageNum=t,this.getList()},restoration:function(){this.accountTitle="",this.accountJob="",this.pageNum=""},passwordOk:function(){var t=this;if(this.modalPassword=!0,!this.password)return this.modalPassword=!1,void this.$Message.error("密码不能为空");Object(s["c"])(this.daminId,this.password).then(function(e){t.modalPassword=!1,t.modalState=!1,t.$Message.success(e.info)}).catch(function(e){t.$Message.error(e),t.modalPassword=!1})}},components:{editableTables:i["a"],addMessage:m},mounted:function(){this.getList()}},v=f,g=(n("100U"),Object(p["a"])(v,a,o,!1,null,null,null));e["default"]=g.exports},eRS8:function(t,e,n){},lsdc:function(t,e,n){},oyvi:function(t,e,n){"use strict";var a=n("eRS8"),o=n.n(a);o.a},zKsV:function(t,e,n){}}]);
|
module.exports=/[\uABC0-\uABFF]/
|
/*!
* lock v11.30.1
*
* Author: Auth0 <support@auth0.com> (http://auth0.com)
* Date: 6/4/2021, 10:26:05 AM
* License: MIT
*
*/
!function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=160)}([function(t,e,n){"use strict";t.exports=n(38)},function(t,e,n){"use strict";function r(t,e,n,r,o,i,a){var s=Ot(t,mt.a.fromJS({clientBaseUrl:S(r,n),tenantBaseUrl:A(r,n),languageBaseUrl:U(r,n),auth:k(r),clientID:e,domain:n,emitEventFn:i,hookRunner:o,useTenantInfo:r.__useTenantInfo||!1,hashCleanup:!1!==r.hashCleanup,allowedConnections:mt.a.fromJS(r.allowedConnections||[]),useCustomPasswordlessConnection:!0===r.useCustomPasswordlessConnection,ui:E(t,r),defaultADUsernameFromEmailPrefix:!1!==r.defaultADUsernameFromEmailPrefix,prefill:r.prefill||{},connectionResolver:r.connectionResolver,handleEventFn:a,hooks:x(r)}));return s=wt.initI18n(s)}function o(t){return t.get("id")}function i(t){return kt(t,"clientID")}function a(t){return kt(t,"domain")}function s(t){return kt(t,"clientBaseUrl")}function u(t){return kt(t,"tenantBaseUrl")}function c(t){return kt(t,"useTenantInfo")}function l(t){return kt(t,"connectionResolver")}function p(t,e){if(!e)return At(t,"resolvedConnection",void 0);if(!e.type||!e.name)throw new Error('Invalid connection object. The resolved connection must look like: `{ type: "database", name: "connection name" }`.');if("database"!==e.type)throw new Error("Invalid connection type. Only database connections can be resolved with a custom resolver.");return At(t,"resolvedConnection",mt.a.fromJS(e))}function d(t){var e=kt(t,"resolvedConnection");if(e)return $(t,e.get("name"))}function M(t){return kt(t,"languageBaseUrl")}function h(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return t=_t(t,"submitting",e),t=j(t),t=n&&!e?f(t,n):N(t)}function g(t){return Ut(t,"submitting",!1)}function f(t,e){return _t(t,"globalError",e)}function y(t){return Ut(t,"globalError","")}function N(t){return Yt(t,"globalError")}function m(t,e){return _t(t,"globalSuccess",e)}function D(t){return Ut(t,"globalSuccess","")}function j(t){return Yt(t,"globalSuccess")}function I(t,e){return _t(t,"globalInfo",e)}function w(t){return Ut(t,"globalInfo","")}function L(t){return Yt(t,"globalInfo")}function v(t){return Ut(t,"render",!1)}function z(t){return Yt(t,"render")}function b(t,e){return At(t,"suppressSubmitOverlay",e)}function C(t){return kt(t,"suppressSubmitOverlay")}function T(t){return kt(t,"hooks")}function E(t,e){var r=!e.container&&(void 0===e.closable||!!e.closable),o=e.theme||{},i=o.labeledSubmitButton,a=o.hideMainScreenTitle,s=o.logo,u=o.primaryColor,c=o.authButtons,l=null!==e.avatar,p=e.avatar&&"function"==typeof e.avatar.url&&"function"==typeof e.avatar.displayName&&e.avatar,d=p||zt;return new mt.a.fromJS({containerID:e.container||"auth0-lock-container-"+t,appendContainer:!e.container,autoclose:void 0!==e.autoclose&&(r&&e.autoclose),autofocus:void 0===e.autofocus?!(e.container||n.i(Dt.a)()):!!e.autofocus,avatar:l,avatarProvider:d,logo:"string"==typeof s?s:void 0,closable:r,hideMainScreenTitle:!!a,labeledSubmitButton:void 0===i||!!i,language:void 0===e.language?"en":vt()(e.language||"").toLowerCase(),dict:"object"===Et(e.languageDictionary)?e.languageDictionary:{},disableWarnings:void 0!==e.disableWarnings&&!!e.disableWarnings,mobile:void 0!==e.mobile&&!!e.mobile,popupOptions:void 0===e.popupOptions?{}:e.popupOptions,primaryColor:"string"==typeof u?u:void 0,rememberLastLogin:void 0===e.rememberLastLogin||!!e.rememberLastLogin,allowAutocomplete:!!e.allowAutocomplete,preferConnectionDisplayName:!!e.preferConnectionDisplayName,authButtonsTheme:"object"===(void 0===c?"undefined":Et(c))?c:{},allowShowPassword:!!e.allowShowPassword,allowPasswordAutocomplete:!!e.allowPasswordAutocomplete,scrollGlobalMessagesIntoView:void 0===e.scrollGlobalMessagesIntoView||!!e.scrollGlobalMessagesIntoView})}function x(t){var e={};return Qt.forEach(function(n){t.hooks&&"function"==typeof t.hooks[n]&&(e[n]=t.hooks[n])}),new mt.a.fromJS(e)}function k(t){var e=t.auth||{},r=e.audience,o=e.connectionScopes,i=e.params,a=e.autoParseHash,s=e.redirect,u=e.redirectUrl,c=e.responseMode,l=e.responseType,p=e.sso,d=e.state,M=e.nonce;return t.auth&&t.auth.redirectUri&&console.warn("You're sending an `auth` option named `redirectUri`. This option will be ignored. Use `redirectUrl` instead."),r="string"==typeof r?r:void 0,o="object"===(void 0===o?"undefined":Et(o))?o:{},i="object"===(void 0===i?"undefined":Et(i))?i:{},u="string"==typeof u&&u?u:null,a="boolean"!=typeof a||a,s="boolean"!=typeof s||s,c="string"==typeof c?c:void 0,d="string"==typeof d?d:void 0,M="string"==typeof M?M:void 0,l="string"==typeof l?l:u?"code":"token",u=u||""+n.i(It.a)(window.location.href)+window.location.pathname,p="boolean"!=typeof p||p,i.scope||(i.scope="openid profile email"),mt.a.fromJS({audience:r,connectionScopes:o,params:i,autoParseHash:a,redirect:s,redirectUrl:u,responseMode:c,responseType:l,sso:p,state:d,nonce:M})}function O(t,e){return mt.a.fromJS(e).merge(kt(t,"auth")).toJS()}function S(t,e){if(t.clientBaseUrl&&"string"==typeof t.clientBaseUrl)return t.clientBaseUrl;if(t.configurationBaseUrl&&"string"==typeof t.configurationBaseUrl)return t.configurationBaseUrl;if(t.assetsUrl&&"string"==typeof t.assetsUrl)return t.assetsUrl;var r="https://"+e,o=n.i(It.b)(r).hostname;if(n.i(jt.a)(o,".auth0.com")){var i=o.split(".");return i.length>3?"https://cdn."+i[i.length-3]+".auth0.com":"https://cdn.auth0.com"}return r}function A(t,e){if(t.configurationBaseUrl&&"string"==typeof t.configurationBaseUrl)return t.overrides&&t.overrides.__tenant?yt()(t.configurationBaseUrl,"tenants","v1",t.overrides.__tenant+".js"):yt()(t.configurationBaseUrl,"info-v1.js");if(t.assetsUrl&&"string"==typeof t.assetsUrl)return t.assetsUrl;var e,r="https://"+e,o=n.i(It.b)(r).hostname,i=o.split("."),a=i[0];return n.i(jt.a)(o,".auth0.com")?(e=i.length>3?"https://cdn."+i[i.length-3]+".auth0.com":"https://cdn.auth0.com",yt()(e,"tenants","v1",a+".js")):yt()(r,"info-v1.js")}function U(t,e){return t.languageBaseUrl&&"string"==typeof t.languageBaseUrl?t.languageBaseUrl:t.assetsUrl&&"string"==typeof t.assetsUrl?t.assetsUrl:"https://cdn.auth0.com"}function _(t){return _t(t,"render",!0)}function Y(t,e){return _t(t,"loggedIn",e)}function Q(t){return Ut(t,"loggedIn",!1)}function P(t){return kt(t,"defaultADUsernameFromEmailPrefix",!0)}function B(t,e,n){return t=Tt.a(t,n),At(t,"captcha",mt.a.fromJS(e))}function R(t){if("object"===(void 0===t?"undefined":Et(t)))return kt(t,"captcha")}function G(t){return kt(t,"prefill",{})}function Z(t,e){(Nt.Map.isMap(t)?!Ht.disableWarnings(t):!t.disableWarnings)&&console&&console.warn&&console.warn(e)}function H(t,e){(Nt.Map.isMap(t)?!Ht.disableWarnings(t):!t.disableWarnings)&&console&&console.error&&console.error(e)}function W(t){return Ut(t,"allowedConnections")||kt(t,"allowedConnections")}function V(t){for(var e=arguments.length,r=Array(e>2?e-2:0),o=2;o<e;o++)r[o-2]=arguments[o];var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;if(1===arguments.length)return Ut(t,"connections",n.i(Nt.Map)()).filter(function(t,e){return"unknown"!==e}).valueSeq().flatten(!0);var a=Ut(t,["connections",i],n.i(Nt.List)());return r.length>0?a.filter(function(t){return~r.indexOf(t.get("strategy"))}):a}function F(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length,r=Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return V.apply(void 0,[t,e].concat(r)).get(0)}function J(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=V(t);return 1===n.count()&&(!e||n.getIn([0,"type"])===e)}function q(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=V(t).count(),r=arguments.length,o=Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];var a=V.apply(void 0,[t,e].concat(o)).count();return n>0&&n===a}function X(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length,r=Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return K.apply(void 0,[t,e].concat(r))>0}function K(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length,r=Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return V.apply(void 0,[t,e].concat(r)).count()}function $(t,e){return V(t).find(function(t){return t.get("name")===e})}function tt(t,e){return!!$(t,e)}function et(t){var e=W(t),r=0===e.count()?function(t){return 0}:function(t){return e.indexOf(t.get("name"))};return _t(t,"connections",n.i(Ct.a)(t).map(function(t){return t.filter(function(t){return r(t)>=0}).sort(function(t,e){return r(t)-r(e)})}))}function nt(t){return kt(t,"useCustomPasswordlessConnection")}function rt(t,e){for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return kt(t,"hookRunner").apply(void 0,[e,t].concat(r))}function ot(t,e){for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];setTimeout(function(){var n=kt(t,"emitEventFn"),o=n.apply(void 0,[e].concat(r));if("unrecoverable_error"===e&&!o)throw new(Function.prototype.bind.apply(Error,[null].concat(r)))},0)}function it(t,e){for(var n=kt(t,"handleEventFn"),r=arguments.length,o=Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];n.apply(void 0,[e].concat(o))}function at(t,e,n){if(0===e.status)return wt.html(t,["error","login","lock.network"]);if("rule_error"===e.code||"hook_error"===e.code)return e.description||wt.html(t,["error","login","lock.fallback"]);var r={code:"lock.invalid_code",email:"lock.invalid_email_password",username:"lock.invalid_username_password"},o=e.error||e.code;if("invalid_user_password"===o&&r[n]&&(o=r[n]),"a0.mfa_registration_required"===o&&(o="lock.mfa_registration_required"),"a0.mfa_invalid_code"===o&&(o="lock.mfa_invalid_code"),"password_expired"===o&&(o="password_change_required"),"invalid_captcha"===o){var i=kt(t,"captcha");i&&"recaptcha_v2"===i.get("provider")&&(o="invalid_recaptcha")}return wt.html(t,["error","login",o])||wt.html(t,["error","login","lock.fallback"])}function st(t,e){return e&&setTimeout(function(){return ot(t,"unrecoverable_error",e)},17),At(t,"stopped",!0)}function ut(t){return kt(t,"stopped")}function ct(t){return kt(t,"hashCleanup")}function lt(t,e){ot(t,"hash_parsed",e)}function pt(t,e){ot(t,"authenticated",e)}function dt(t,e){ot(t,"authorization_error",e)}function Mt(t,e){ot(t,"unrecoverable_error",e)}function ht(t){return n.i(Ct.b)(t)||!1}function gt(t,e){if(e||(e={}),e.allowedConnections&&(t=_t(t,"allowedConnections",mt.a.fromJS(e.allowedConnections))),e.flashMessage){var n=e.flashMessage.type,r=n.charAt(0).toUpperCase()+n.slice(1);t=_t(t,"global"+r,e.flashMessage.text)}return e.auth&&e.auth.params&&(t=_t(t,"authParams",mt.a.fromJS(e.auth.params))),e.theme&&(e.theme.primaryColor&&(t=_t(t,["ui","primaryColor"],e.theme.primaryColor)),e.theme.logo&&(t=_t(t,["ui","logo"],e.theme.logo))),(e.language||e.languageDictionary)&&(e.language&&(t=_t(t,["ui","language"],e.language)),e.languageDictionary&&(t=_t(t,["ui","dict"],e.languageDictionary)),t=wt.initI18n(t)),"boolean"==typeof e.rememberLastLogin&&(t=_t(t,"rememberLastLogin",e.rememberLastLogin)),"boolean"==typeof e.allowAutocomplete&&(t=_t(t,"allowAutocomplete",e.allowAutocomplete)),"boolean"==typeof e.allowShowPassword&&(t=_t(t,"allowShowPassword",e.allowShowPassword)),"boolean"==typeof e.allowPasswordAutocomplete&&(t=_t(t,"allowPasswordAutocomplete",e.allowPasswordAutocomplete)),t}Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"validPublicHooks",function(){return Qt}),e.setup=r,e.id=o,e.clientID=i,e.domain=a,e.clientBaseUrl=s,e.tenantBaseUrl=u,e.useTenantInfo=c,e.connectionResolver=l,e.setResolvedConnection=p,e.resolvedConnection=d,e.languageBaseUrl=M,e.setSubmitting=h,e.submitting=g,e.setGlobalError=f,e.globalError=y,e.clearGlobalError=N,e.setGlobalSuccess=m,e.globalSuccess=D,e.clearGlobalSuccess=j,e.setGlobalInfo=I,e.globalInfo=w,e.clearGlobalInfo=L,e.rendering=v,e.stopRendering=z,e.setSupressSubmitOverlay=b,e.suppressSubmitOverlay=C,e.hooks=T,n.d(e,"ui",function(){return Ht}),n.d(e,"auth",function(){return Ft}),e.withAuthOptions=O,e.extractTenantBaseUrlOption=A,e.render=_,n.d(e,"reset",function(){return St}),e.setLoggedIn=Y,e.loggedIn=Q,e.defaultADUsernameFromEmailPrefix=P,e.setCaptcha=B,e.captcha=R,e.prefill=G,e.warn=Z,e.error=H,e.allowedConnections=W,e.connections=V,e.connection=F,e.hasOneConnection=J,e.hasOnlyConnections=q,e.hasSomeConnections=X,e.countConnections=K,e.findConnection=$,e.hasConnection=tt,e.filterConnections=et,e.useCustomPasswordlessConnection=nt,e.runHook=rt,e.emitEvent=ot,e.handleEvent=it,e.loginErrorMessage=at,e.stop=st,e.hasStopped=ut,e.hashCleanup=ct,e.emitHashParsedEvent=lt,e.emitAuthenticatedEvent=pt,e.emitAuthorizationErrorEvent=dt,e.emitUnrecoverableErrorEvent=Mt,e.showBadge=ht,e.overrideOptions=gt;var ft=n(155),yt=n.n(ft),Nt=n(11),mt=n.n(Nt),Dt=n(56),jt=n(117),It=n(220),wt=n(12),Lt=n(32),vt=n.n(Lt),zt=n(159),bt=n(20),Ct=n(106),Tt=n(110),Et="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xt=n.i(bt.a)(["core"]),kt=xt.get,Ot=xt.init,St=(xt.remove,xt.reset),At=xt.set,Ut=xt.tget,_t=xt.tset,Yt=xt.tremove,Qt=["loggingIn","signingUp"],Pt=n.i(bt.a)(["core","ui"]),Bt=Pt.get,Rt=(Pt.set,n.i(bt.a)(["core","transient","ui"])),Gt=Rt.get,Zt=(Rt.set,function(t,e){return Gt(t,e)||Bt(t,e)}),Ht={containerID:function(t){return Zt(t,"containerID")},appendContainer:function(t){return Zt(t,"appendContainer")},autoclose:function(t){return Zt(t,"autoclose")},autofocus:function(t){return Zt(t,"autofocus")},avatar:function(t){return Zt(t,"avatar")},avatarProvider:function(t){return Zt(t,"avatarProvider")},closable:function(t){return Zt(t,"closable")},dict:function(t){return Zt(t,"dict")},disableWarnings:function(t){return Zt(t,"disableWarnings")},labeledSubmitButton:function(t){return Zt(t,"labeledSubmitButton")},hideMainScreenTitle:function(t){return Zt(t,"hideMainScreenTitle")},language:function(t){return Zt(t,"language")},logo:function(t){return Zt(t,"logo")},mobile:function(t){return Zt(t,"mobile")},popupOptions:function(t){return Zt(t,"popupOptions")},primaryColor:function(t){return Zt(t,"primaryColor")},authButtonsTheme:function(t){return Zt(t,"authButtonsTheme")},preferConnectionDisplayName:function(t){return Zt(t,"preferConnectionDisplayName")},rememberLastLogin:function(t){return Ut(t,"rememberLastLogin",Zt(t,"rememberLastLogin"))},allowAutocomplete:function(t){return Ut(t,"allowAutocomplete",Zt(t,"allowAutocomplete"))},scrollGlobalMessagesIntoView:function(t){return Zt(t,"scrollGlobalMessagesIntoView")},allowShowPassword:function(t){return Ut(t,"allowShowPassword",Zt(t,"allowShowPassword"))},allowPasswordAutocomplete:function(t){return Ut(t,"allowPasswordAutocomplete",Zt(t,"allowPasswordAutocomplete"))}},Wt=n.i(bt.a)(["core","auth"]),Vt=Wt.get,Ft={connectionScopes:function(t){return Vt(t,"connectionScopes")},params:function(t){return Ut(t,"authParams")||Vt(t,"params")},autoParseHash:function(t){return Vt(t,"autoParseHash")},redirect:function(t){return Vt(t,"redirect")},redirectUrl:function(t){return Vt(t,"redirectUrl")},responseType:function(t){return Vt(t,"responseType")},sso:function(t){return Vt(t,"sso")}}},function(t,e,n){t.exports=n(251)()},function(t,e,n){"use strict";function r(t,e,n,r,i,a,s,u){if(o(e),!t){var c;if(void 0===e)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,i,a,s,u],p=0;c=new Error(e.replace(/%s/g,function(){return l[p++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}}var o=function(t){};t.exports=r},function(t,e,n){"use strict";function r(t,e,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:O(e),i=t.getIn(["field",e,"value"]),a=t.getIn(["field",e,"showInvalid"],!1),s=arguments.length,u=Array(s>4?s-4:0),c=4;c<s;c++)u[c-4]=arguments[c];var l=o.apply(void 0,[r,n].concat(u));return t.mergeIn(["field",e],l.merge({value:n,showInvalid:a&&i===n}))}function o(t,e){if("function"!=typeof t)return n.i(z.Map)({valid:!0});for(var r=arguments.length,o=Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];var a=t.apply(void 0,[e].concat(o));return a&&"object"===(void 0===a?"undefined":x(a))?n.i(z.Map)({valid:a.valid,invalidHint:a.hint}):n.i(z.Map)({valid:!!a})}function i(t,e,r,o){var i=!0,a=!o,s=void 0;if(r.forEach(function(t){i=i&&t.get("label")&&"string"==typeof t.get("label")&&t.get("value")&&"string"==typeof t.get("value"),a||t.get("value")!==o||(s=t,a=!0)}),!i||!r.size){var u=new Error('The options provided for the "'+e+'" field are invalid, they must have the following format: {label: "non-empty string", value: "non-empty string"} and there has to be at least one option.');return u.code="invalid_select_field",E.stop(t,u)}return s||(s=n.i(z.Map)({})),t.mergeIn(["field",e],s,n.i(z.Map)({options:r,showInvalid:!1,valid:!s.isEmpty()}))}function a(t,e,r){return t.mergeIn(["field",e],r.merge(n.i(z.Map)({valid:!0,showInvalid:!1})))}function s(t,e){return t.getIn(["field",e,"valid"])}function u(t,e){return t.getIn(["field",e,"invalidHint"],"")}function c(t,e){return t.getIn(["field",e,"showInvalid"],!1)&&!t.getIn(["field",e,"valid"])}function l(t,e){return t.setIn(["field",e,"showInvalid"],!s(t,e))}function p(t){return t.update("field",function(t){return t&&t.map(function(t){return t.set("showInvalid",!1)})})}function d(t,e,n){return t.setIn(["field",e,"showInvalid"],n)}function M(t,e){var n=void 0;return n=e&&0!==e.length?e.map(function(t){return["field",t]}):[["field"]],n.reduce(function(t,e){return t.removeIn(e)},t)}function h(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new z.Map({});return t.getIn(["field",e],n)}function g(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return h(t,e).get("value",n)}function f(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return h(t,e).get("label",n)}function y(t){return t.getIn(["field","phoneNumber","value"],"")}function N(t){return g(t,"email")}function m(t){return g(t,"vcode")}function D(t){return g(t,"password")}function j(t){return g(t,"username")}function I(t){return!!t.getIn(["field","selecting"])}function w(t){var e=t.getIn(["field","selecting","name"]);return I(t)?v.a.createElement(T.a,{model:t,name:e,icon:t.getIn(["field","selecting","icon"]),iconUrl:t.getIn(["field","selecting","iconUrl"]),items:t.getIn(["field",e,"options"])}):null}e.e=r,e.d=i,e.f=a,e.j=s,e.p=u,e.k=c,e.i=l,e.a=p,e.n=d,e.b=M,e.m=h,e.c=g,e.o=f,e.r=y,e.g=N,e.s=m,e.h=D,e.q=j,e.l=w;var L=n(0),v=n.n(L),z=n(11),b=(n.n(z),n(32)),C=n.n(b),T=n(190),E=n(1),x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},k=function(t,e,n){return t.length>=e&&t.length<=n},O=function(t){switch(t){case"family_name":case"given_name":return function(t){return k(C()(t),1,150)};case"name":case"nickname":return function(t){return k(C()(t),1,300)};default:return function(t){return C()(t).length>0}}}},function(t,e,n){"use strict";function r(t){for(var e=arguments.length-1,n="Minified React error #"+t+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+t,r=0;r<e;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);n+=" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";var o=new Error(n);throw o.name="Invariant Violation",o.framesToPop=1,o}t.exports=r},function(t,e,n){"use strict";var r=n(21),o=r;t.exports=o},function(t,e,n){"use strict";function r(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}var o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,s,u=r(t),c=1;c<arguments.length;c++){n=Object(arguments[c]);for(var l in n)i.call(n,l)&&(u[l]=n[l]);if(o){s=o(n);for(var p=0;p<s.length;p++)a.call(n,s[p])&&(u[s[p]]=n[s[p]])}}return u}},function(t,e,n){"use strict";function r(t,e,n){o(t+"-"+e,function(t,r,o){var i=c(o,"lock",e),a=c(r,"lock",e);i&&!i.equals(a)&&n(i)})}function o(t,e){h.addWatch(t,e)}function i(){return h.swap.apply(h,arguments)}function a(t,e,n,r){for(var o=arguments.length,i=Array(o>4?o-4:0),a=4;a<o;a++)i[a-4]=arguments[a];return t.updateIn([e,n],new M.Map({}),function(t){return r.apply(void 0,[t].concat(i))})}function s(t,e,n,r){return t.setIn([e,n],r)}function u(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return t.apply(void 0,[h.deref()].concat(n))}function c(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return t.getIn([e,n])}function l(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return t.removeIn([e,n])}function p(t,e){return t.get(e,n.i(M.Map)()).toList()}e.a=r,e.b=i,e.c=a,e.f=s,e.d=u,e.e=c,e.h=l,e.g=p;var d=n(214),M=n(11),h=(n.n(M),n.i(d.a)(new M.Map({})))},function(t,e,n){"use strict";function r(t,e){return 1===t.nodeType&&t.getAttribute(h)===String(e)||8===t.nodeType&&t.nodeValue===" react-text: "+e+" "||8===t.nodeType&&t.nodeValue===" react-empty: "+e+" "}function o(t){for(var e;e=t._renderedComponent;)t=e;return t}function i(t,e){var n=o(t);n._hostNode=e,e[f]=n}function a(t){var e=t._hostNode;e&&(delete e[f],t._hostNode=null)}function s(t,e){if(!(t._flags&g.hasCachedChildNodes)){var n=t._renderedChildren,a=e.firstChild;t:for(var s in n)if(n.hasOwnProperty(s)){var u=n[s],c=o(u)._domID;if(0!==c){for(;null!==a;a=a.nextSibling)if(r(a,c)){i(u,a);continue t}p("32",c)}}t._flags|=g.hasCachedChildNodes}}function u(t){if(t[f])return t[f];for(var e=[];!t[f];){if(e.push(t),!t.parentNode)return null;t=t.parentNode}for(var n,r;t&&(r=t[f]);t=e.pop())n=r,e.length&&s(r,t);return n}function c(t){var e=u(t);return null!=e&&e._hostNode===t?e:null}function l(t){if(void 0===t._hostNode&&p("33"),t._hostNode)return t._hostNode;for(var e=[];!t._hostNode;)e.push(t),t._hostParent||p("34"),t=t._hostParent;for(;e.length;t=e.pop())s(t,t._hostNode);return t._hostNode}var p=n(5),d=n(36),M=n(128),h=(n(3),d.ID_ATTRIBUTE_NAME),g=M,f="__reactInternalInstance$"+Math.random().toString(36).slice(2),y={getClosestInstanceFromNode:u,getInstanceFromNode:c,getNodeFromInstance:l,precacheChildNodes:s,precacheNode:i,uncacheNode:a};t.exports=y},function(t,e,n){"use strict";(function(t){function r(t,e){return t=$(t,R.a.fromJS(u(e))),t=_(t)}function o(t,e){var n=void 0===t[e]||"boolean"==typeof t[e];return n||G.warn(t,"The `"+e+"` option will be ignored, because it is not a booelan."),n}function i(t,e,n){var r=void 0===t[e]||n.indexOf(t[e])>-1;return r||G.warn(t,"The `"+e+"` option will be ignored, because it is not one of the following allowed values: "+n.map(function(t){return JSON.stringify(t)}).join(", ")+"."),r}function a(t,e){var n=void 0===t[e]||"string"==typeof t[e]&&F()(t[e]).length>0;return n||G.warn(t,"The `"+e+"` option will be ignored, because it is not a non-empty string."),n}function s(e,n){var r=void 0===e[n]||t.Array.isArray(e[n]);return r||G.warn(e,"The `"+n+"` option will be ignored, because it is not an array."),r}function u(e){var r=e.additionalSignUpFields,u=e.defaultDatabaseConnection,l=e.forgotPasswordLink,p=e.loginAfterSignUp,d=e.mustAcceptTerms,M=e.showTerms,h=e.signUpLink,g=e.usernameStyle,f=e.signUpFieldsStrictValidation,y=e.signUpHideUsernameField,N=c(e),m=N.initialScreen,D=N.screens;return i(e,"usernameStyle",["email","username"])||(g=void 0),a(e,"defaultDatabaseConnection")||(u=void 0),a(e,"forgotPasswordLink")||(l=void 0),a(e,"signUpLink")||(h=void 0),o(e,"mustAcceptTerms")||(d=void 0),o(e,"showTerms")||(M=!0),o(e,"signUpFieldsStrictValidation")||(f=!1),o(e,"signUpHideUsernameField")||(y=!1),s(e,"additionalSignUpFields")?r&&(r=r.reduce(function(n,r){var o=r.icon,i=r.name,a=r.options,s=r.placeholder,u=r.placeholderHTML,c=r.prefill,l=r.type,p=r.validator,d=r.value,M=r.storage,h=!0,g=["email","username","password"];("string"!=typeof i||!i.match(/^[a-zA-Z0-9_]+$/)||g.indexOf(i)>-1)&&(G.warn(e,"Ignoring an element of `additionalSignUpFields` because it does not contain valid `name` property. Every element of `additionalSignUpFields` must be an object with a `name` property that is a non-empty string consisting of letters, numbers and underscores. The following names are reserved, and therefore, cannot be used: "+g.join(", ")+"."),h=!1),"hidden"===l||"string"==typeof s&&s||"string"==typeof u&&u||(G.warn(e,"Ignoring an element of `additionalSignUpFields` ("+i+") because it does not contain a valid `placeholder` or `placeholderHTML` property. Every element of `additionalSignUpFields` must have a `placeholder` or `placeholderHTML` property that is a non-empty string."),h=!1),u&&s&&G.warn(e,"When provided, the `placeholderHTML` property of an element of `additionalSignUpFields` will override the `placeholder` property of that element"),void 0==o||"string"==typeof o&&o||(G.warn(e,"When provided, the `icon` property of an element of `additionalSignUpFields` must be a non-empty string."),o=void 0),void 0==c||"string"==typeof c&&c||"function"==typeof c||(G.warn(e,"When provided, the `prefill` property of an element of `additionalSignUpFields` must be a non-empty string or a function."),c=void 0);var f=["select","text","checkbox","hidden"];return void 0==l||"string"==typeof l&&-1!==f.indexOf(l)||(G.warn(e,'When provided, the `type` property of an element of `additionalSignUpFields` must be one of the following strings: "'+f.join('", "')+'".'),l=void 0),void 0!=p&&"select"===l&&(G.warn(e,'Elements of `additionalSignUpFields` with a "select" `type` cannot specify a `validator` function, all of its `options` are assumed to be valid.'),p=void 0),void 0!=p&&"function"!=typeof p&&(G.warn(e,"When provided, the `validator` property of an element of `additionalSignUpFields` must be a function."),p=void 0),void 0!=a&&"select"!=l&&(G.warn(e,'The `options` property can only by provided for an element of `additionalSignUpFields` when its `type` equals to "select"'),a=void 0),(void 0!=a&&!t.Array.isArray(a)&&"function"!=typeof a||"select"===l&&void 0===a)&&(G.warn(e,"Ignoring an element of `additionalSignUpFields` ("+i+') because it has a "select" `type` but does not specify an `options` property that is an Array or a function.'),h=!1),"hidden"!==l||d||(G.warn(e,"Ignoring an element of `additionalSignUpFields` ("+i+') because it has a "hidden" `type` but does not specify a `value` string.'),h=!1),h?n.concat([{icon:o,name:i,options:a,placeholder:s,placeholderHTML:u,prefill:c,type:l,validator:p,value:d,storage:M}]):n},[]),r=R.a.fromJS(r).map(function(t){return t.filter(function(t){return void 0!==t})})):r=void 0,p=!1!==p,n.i(B.Map)({additionalSignUpFields:r,defaultConnectionName:u,forgotPasswordLink:l,initialScreen:m,loginAfterSignUp:p,mustAcceptTerms:d,showTerms:M,screens:D,signUpLink:h,usernameStyle:g,signUpFieldsStrictValidation:f,signUpHideUsernameField:y}).filter(function(t){return void 0!==t}).toJS()}function c(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{allowLogin:!0,allowSignUp:!0,allowForgotPassword:!0,initialScreen:void 0},n=t.allowForgotPassword,r=t.allowLogin,a=t.allowSignUp,s=t.initialScreen,u=[];return(!0===r||!o(t,"allowLogin")&&e.allowLogin||void 0===r&&e.allowLogin)&&u.push("login"),(!0===a||!o(t,"allowSignUp")&&e.allowSignUp||void 0===a&&e.allowSignUp)&&u.push("signUp"),(!0===n||!o(t,"allowForgotPassword")&&e.allowForgotPassword||void 0===n&&e.allowForgotPassword)&&u.push("forgotPassword"),u.push("mfaLogin"),i(t,"initialScreen",u)||(s=void 0),void 0===s&&(s=e.initialScreen||u[0]),{initialScreen:s,screens:new B.List(u)}}function l(t,e){var n=c(e,{allowLogin:m(t).contains("login"),allowSignUp:m(t).contains("signUp"),allowForgotPassword:m(t).contains("forgotPassword"),initialScreen:K(t,"initialScreen")}),r=n.initialScreen,o=n.screens;return t=et(t,"initialScreen",r),t=et(t,"screens",o)}function p(t){var e=d(t);return e&&G.findConnection(t,e)}function d(t){return K(t,"defaultConnectionName")}function M(t){return G.resolvedConnection(t)||n.i(J.b)(t)||p(t)||G.connection(t,"database")}function h(t){return(M(t)||n.i(B.Map)()).get("name")}function g(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return K(t,"forgotPasswordLink",e)}function f(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return K(t,"signUpLink",e)}function y(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return t=G.clearGlobalError(t),t=G.clearGlobalSuccess(t),t=n.i(Z.a)(t,r),t=n.i(Z.b)(t,r),et(t,"screen",e)}function N(t){return[tt(t,"screen"),D(t),"login","signUp","forgotPassword","mfaLogin"].filter(function(e){return b(t,e)})[0]}function m(t){return tt(t,"screens")||K(t,"screens",new B.List)}function D(t){return tt(t,"initialScreen")||K(t,"initialScreen")}function j(t,e){return D(t)===e}function I(t){return(M(t)||n.i(B.Map)()).toJS().requireUsername}function w(t){return G.hasSomeConnections(t,"database")?G.connectionResolver(t)?"username":I(t)?K(t,"usernameStyle","any"):"email":G.hasSomeConnections(t,"enterprise")&&n.i(q.j)(t)?"username":"email"}function L(t){return"email"===w(t)}function v(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return L(t)?n.i(Z.c)(t,"email"):e.emailFirst?n.i(Z.c)(t,"email")||n.i(Z.c)(t,"username"):n.i(Z.c)(t,"username")||n.i(Z.c)(t,"email")}function z(t){return I(t)||"username"===K(t,"usernameStyle","email")}function b(t,e){var r=(M(t)||n.i(B.Map)()).toJS(),o=r.allowForgot,i=r.allowSignup;return!(!1===o&&"forgotPassword"===e)&&!(!1===i&&"signUp"===e)&&m(t).contains(e)}function C(t){return K(t,"loginAfterSignUp")}function T(t){return(M(t)||n.i(B.Map)()).get("passwordPolicy","none")}function E(t){return K(t,"additionalSignUpFields",n.i(B.List)())}function x(t){return K(t,"showTerms",!0)}function k(t){return K(t,"signUpFieldsStrictValidation",!1)}function O(t){return K(t,"signUpHideUsernameField",!1)}function S(t){return K(t,"mustAcceptTerms",!1)}function A(t){return!S(t)||tt(t,"termsAccepted",!1)}function U(t){return et(t,"termsAccepted",!A(t))}function _(t){return E(t).reduce(function(t,e){switch(e.get("type")){case"select":return Y(t,e);case"hidden":return P(t,e);default:return Q(t,e)}},t)}function Y(t,e){var r=e.get("name"),o=["additionalSignUpField",r],i=e.get("prefill"),a=e.get("options"),s="function"==typeof i?void 0:i||"",u="function"==typeof a?void 0:a,c=function(t){return void 0!==s&&void 0!==u?n.i(Z.d)(t,r,R.a.fromJS(u),s):t};return void 0===s&&(t=n.i(W.d)(t,o.concat("prefill"),{recoverResult:"",successFn:function(t,e){return s=e,c(t)},syncFn:function(t,e){return i(e)}})),void 0===u&&(t=n.i(W.d)(t,o.concat("options"),{successFn:function(t,e){return u=e,c(t)},syncFn:function(t,e){return a(e)}})),void 0!==s&&void 0!==u&&(t=n.i(Z.d)(t,r,R.a.fromJS(u),s)),t}function Q(t,e){var r=e.get("name"),o=["additionalSignUpField",r,"prefill"],i=e.get("prefill"),a=e.get("validator"),s="function"==typeof i?void 0:i||"";return t=void 0===s?n.i(W.d)(t,o,{recoverResult:"",successFn:function(t,e){return n.i(Z.e)(t,r,e,a)},syncFn:function(t,e){return i(e)}}):n.i(Z.e)(t,r,s,a)}function P(t,e){return n.i(Z.e)(t,e.get("name"),e.get("value"))}e.f=r,e.g=l,e.e=p,e.d=d,e.r=M,e.m=h,e.B=g,e.z=f,e.s=y,e.j=N,e.k=D,e.c=j,e.n=I,e.A=w,e.l=L,e.a=v,e.b=z,e.i=b,e.q=C,e.y=T,e.p=E,e.w=x,e.x=k,e.o=O,e.v=S,e.u=A,e.t=U,e.h=_;var B=n(11),R=n.n(B),G=n(1),Z=n(4),H=n(20),W=n(29),V=n(32),F=n.n(V),J=n(66),q=n(16),X=n.i(H.a)(["database"]),K=X.get,$=X.initNS,tt=X.tget,et=X.tset}).call(e,n(15))},function(t,e,n){!function(e,n){t.exports=n()}(0,function(){"use strict";function t(t,e){e&&(t.prototype=Object.create(e.prototype)),t.prototype.constructor=t}function e(t){return i(t)?t:T(t)}function n(t){return a(t)?t:E(t)}function r(t){return s(t)?t:x(t)}function o(t){return i(t)&&!u(t)?t:k(t)}function i(t){return!(!t||!t[cn])}function a(t){return!(!t||!t[ln])}function s(t){return!(!t||!t[pn])}function u(t){return a(t)||s(t)}function c(t){return!(!t||!t[dn])}function l(t){return t.value=!1,t}function p(t){t&&(t.value=!0)}function d(){}function M(t,e){e=e||0;for(var n=Math.max(0,t.length-e),r=new Array(n),o=0;o<n;o++)r[o]=t[o+e];return r}function h(t){return void 0===t.size&&(t.size=t.__iterate(f)),t.size}function g(t,e){if("number"!=typeof e){var n=e>>>0;if(""+n!==e||4294967295===n)return NaN;e=n}return e<0?h(t)+e:e}function f(){return!0}function y(t,e,n){return(0===t||void 0!==n&&t<=-n)&&(void 0===e||void 0!==n&&e>=n)}function N(t,e){return D(t,e,0)}function m(t,e){return D(t,e,e)}function D(t,e,n){return void 0===t?n:t<0?Math.max(0,e+t):void 0===e?t:Math.min(e,t)}function j(t){this.next=t}function I(t,e,n,r){var o=0===t?e:1===t?n:[e,n];return r?r.value=o:r={value:o,done:!1},r}function w(){return{value:void 0,done:!0}}function L(t){return!!b(t)}function v(t){return t&&"function"==typeof t.next}function z(t){var e=b(t);return e&&e.call(t)}function b(t){var e=t&&(In&&t[In]||t[wn]);if("function"==typeof e)return e}function C(t){return t&&"number"==typeof t.length}function T(t){return null===t||void 0===t?Y():i(t)?t.toSeq():B(t)}function E(t){return null===t||void 0===t?Y().toKeyedSeq():i(t)?a(t)?t.toSeq():t.fromEntrySeq():Q(t)}function x(t){return null===t||void 0===t?Y():i(t)?a(t)?t.entrySeq():t.toIndexedSeq():P(t)}function k(t){return(null===t||void 0===t?Y():i(t)?a(t)?t.entrySeq():t:P(t)).toSetSeq()}function O(t){this._array=t,this.size=t.length}function S(t){var e=Object.keys(t);this._object=t,this._keys=e,this.size=e.length}function A(t){this._iterable=t,this.size=t.length||t.size}function U(t){this._iterator=t,this._iteratorCache=[]}function _(t){return!(!t||!t[vn])}function Y(){return zn||(zn=new O([]))}function Q(t){var e=Array.isArray(t)?new O(t).fromEntrySeq():v(t)?new U(t).fromEntrySeq():L(t)?new A(t).fromEntrySeq():"object"==typeof t?new S(t):void 0;if(!e)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+t);return e}function P(t){var e=R(t);if(!e)throw new TypeError("Expected Array or iterable object of values: "+t);return e}function B(t){var e=R(t)||"object"==typeof t&&new S(t);if(!e)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+t);return e}function R(t){return C(t)?new O(t):v(t)?new U(t):L(t)?new A(t):void 0}function G(t,e,n,r){var o=t._cache;if(o){for(var i=o.length-1,a=0;a<=i;a++){var s=o[n?i-a:a];if(!1===e(s[1],r?s[0]:a,t))return a+1}return a}return t.__iterateUncached(e,n)}function Z(t,e,n,r){var o=t._cache;if(o){var i=o.length-1,a=0;return new j(function(){var t=o[n?i-a:a];return a++>i?w():I(e,r?t[0]:a-1,t[1])})}return t.__iteratorUncached(e,n)}function H(t,e){return e?W(e,t,"",{"":t}):V(t)}function W(t,e,n,r){return Array.isArray(e)?t.call(r,n,x(e).map(function(n,r){return W(t,n,r,e)})):F(e)?t.call(r,n,E(e).map(function(n,r){return W(t,n,r,e)})):e}function V(t){return Array.isArray(t)?x(t).map(V).toList():F(t)?E(t).map(V).toMap():t}function F(t){return t&&(t.constructor===Object||void 0===t.constructor)}function J(t,e){if(t===e||t!==t&&e!==e)return!0;if(!t||!e)return!1;if("function"==typeof t.valueOf&&"function"==typeof e.valueOf){if(t=t.valueOf(),e=e.valueOf(),t===e||t!==t&&e!==e)return!0;if(!t||!e)return!1}return!("function"!=typeof t.equals||"function"!=typeof e.equals||!t.equals(e))}function q(t,e){if(t===e)return!0;if(!i(e)||void 0!==t.size&&void 0!==e.size&&t.size!==e.size||void 0!==t.__hash&&void 0!==e.__hash&&t.__hash!==e.__hash||a(t)!==a(e)||s(t)!==s(e)||c(t)!==c(e))return!1;if(0===t.size&&0===e.size)return!0;var n=!u(t);if(c(t)){var r=t.entries();return e.every(function(t,e){var o=r.next().value;return o&&J(o[1],t)&&(n||J(o[0],e))})&&r.next().done}var o=!1;if(void 0===t.size)if(void 0===e.size)"function"==typeof t.cacheResult&&t.cacheResult();else{o=!0;var l=t;t=e,e=l}var p=!0,d=e.__iterate(function(e,r){if(n?!t.has(e):o?!J(e,t.get(r,fn)):!J(t.get(r,fn),e))return p=!1,!1});return p&&t.size===d}function X(t,e){if(!(this instanceof X))return new X(t,e);if(this._value=t,this.size=void 0===e?1/0:Math.max(0,e),0===this.size){if(bn)return bn;bn=this}}function K(t,e){if(!t)throw new Error(e)}function $(t,e,n){if(!(this instanceof $))return new $(t,e,n);if(K(0!==n,"Cannot step a Range by 0"),t=t||0,void 0===e&&(e=1/0),n=void 0===n?1:Math.abs(n),e<t&&(n=-n),this._start=t,this._end=e,this._step=n,this.size=Math.max(0,Math.ceil((e-t)/n-1)+1),0===this.size){if(Cn)return Cn;Cn=this}}function tt(){throw TypeError("Abstract")}function et(){}function nt(){}function rt(){}function ot(t){return t>>>1&1073741824|3221225471&t}function it(t){if(!1===t||null===t||void 0===t)return 0;if("function"==typeof t.valueOf&&(!1===(t=t.valueOf())||null===t||void 0===t))return 0;if(!0===t)return 1;var e=typeof t;if("number"===e){if(t!==t||t===1/0)return 0;var n=0|t;for(n!==t&&(n^=4294967295*t);t>4294967295;)t/=4294967295,n^=t;return ot(n)}if("string"===e)return t.length>Un?at(t):st(t);if("function"==typeof t.hashCode)return t.hashCode();if("object"===e)return ut(t);if("function"==typeof t.toString)return st(t.toString());throw new Error("Value type "+e+" cannot be hashed.")}function at(t){var e=Qn[t];return void 0===e&&(e=st(t),Yn===_n&&(Yn=0,Qn={}),Yn++,Qn[t]=e),e}function st(t){for(var e=0,n=0;n<t.length;n++)e=31*e+t.charCodeAt(n)|0;return ot(e)}function ut(t){var e;if(On&&void 0!==(e=Tn.get(t)))return e;if(void 0!==(e=t[An]))return e;if(!kn){if(void 0!==(e=t.propertyIsEnumerable&&t.propertyIsEnumerable[An]))return e;if(void 0!==(e=ct(t)))return e}if(e=++Sn,1073741824&Sn&&(Sn=0),On)Tn.set(t,e);else{if(void 0!==xn&&!1===xn(t))throw new Error("Non-extensible objects are not allowed as keys.");if(kn)Object.defineProperty(t,An,{enumerable:!1,configurable:!1,writable:!1,value:e});else if(void 0!==t.propertyIsEnumerable&&t.propertyIsEnumerable===t.constructor.prototype.propertyIsEnumerable)t.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},t.propertyIsEnumerable[An]=e;else{if(void 0===t.nodeType)throw new Error("Unable to set a non-enumerable property on object.");t[An]=e}}return e}function ct(t){if(t&&t.nodeType>0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}function lt(t){K(t!==1/0,"Cannot perform this action with an infinite size.")}function pt(t){return null===t||void 0===t?It():dt(t)&&!c(t)?t:It().withMutations(function(e){var r=n(t);lt(r.size),r.forEach(function(t,n){return e.set(n,t)})})}function dt(t){return!(!t||!t[Pn])}function Mt(t,e){this.ownerID=t,this.entries=e}function ht(t,e,n){this.ownerID=t,this.bitmap=e,this.nodes=n}function gt(t,e,n){this.ownerID=t,this.count=e,this.nodes=n}function ft(t,e,n){this.ownerID=t,this.keyHash=e,this.entries=n}function yt(t,e,n){this.ownerID=t,this.keyHash=e,this.entry=n}function Nt(t,e,n){this._type=e,this._reverse=n,this._stack=t._root&&Dt(t._root)}function mt(t,e){return I(t,e[0],e[1])}function Dt(t,e){return{node:t,index:0,__prev:e}}function jt(t,e,n,r){var o=Object.create(Bn);return o.size=t,o._root=e,o.__ownerID=n,o.__hash=r,o.__altered=!1,o}function It(){return Rn||(Rn=jt(0))}function wt(t,e,n){var r,o;if(t._root){var i=l(yn),a=l(Nn);if(r=Lt(t._root,t.__ownerID,0,void 0,e,n,i,a),!a.value)return t;o=t.size+(i.value?n===fn?-1:1:0)}else{if(n===fn)return t;o=1,r=new Mt(t.__ownerID,[[e,n]])}return t.__ownerID?(t.size=o,t._root=r,t.__hash=void 0,t.__altered=!0,t):r?jt(o,r):It()}function Lt(t,e,n,r,o,i,a,s){return t?t.update(e,n,r,o,i,a,s):i===fn?t:(p(s),p(a),new yt(e,r,[o,i]))}function vt(t){return t.constructor===yt||t.constructor===ft}function zt(t,e,n,r,o){if(t.keyHash===r)return new ft(e,r,[t.entry,o]);var i,a=(0===n?t.keyHash:t.keyHash>>>n)&gn,s=(0===n?r:r>>>n)&gn;return new ht(e,1<<a|1<<s,a===s?[zt(t,e,n+Mn,r,o)]:(i=new yt(e,r,o),a<s?[t,i]:[i,t]))}function bt(t,e,n,r){t||(t=new d);for(var o=new yt(t,it(n),[n,r]),i=0;i<e.length;i++){var a=e[i];o=o.update(t,0,void 0,a[0],a[1])}return o}function Ct(t,e,n,r){for(var o=0,i=0,a=new Array(n),s=0,u=1,c=e.length;s<c;s++,u<<=1){var l=e[s];void 0!==l&&s!==r&&(o|=u,a[i++]=l)}return new ht(t,o,a)}function Tt(t,e,n,r,o){for(var i=0,a=new Array(hn),s=0;0!==n;s++,n>>>=1)a[s]=1&n?e[i++]:void 0;return a[r]=o,new gt(t,i+1,a)}function Et(t,e,r){for(var o=[],a=0;a<r.length;a++){var s=r[a],u=n(s);i(s)||(u=u.map(function(t){return H(t)})),o.push(u)}return Ot(t,e,o)}function xt(t,e,n){return t&&t.mergeDeep&&i(e)?t.mergeDeep(e):J(t,e)?t:e}function kt(t){return function(e,n,r){if(e&&e.mergeDeepWith&&i(n))return e.mergeDeepWith(t,n);var o=t(e,n,r);return J(e,o)?e:o}}function Ot(t,e,n){return n=n.filter(function(t){return 0!==t.size}),0===n.length?t:0!==t.size||t.__ownerID||1!==n.length?t.withMutations(function(t){for(var r=e?function(n,r){t.update(r,fn,function(t){return t===fn?n:e(t,n,r)})}:function(e,n){t.set(n,e)},o=0;o<n.length;o++)n[o].forEach(r)}):t.constructor(n[0])}function St(t,e,n,r){var o=t===fn,i=e.next();if(i.done){var a=o?n:t,s=r(a);return s===a?t:s}K(o||t&&t.set,"invalid keyPath");var u=i.value,c=o?fn:t.get(u,fn),l=St(c,e,n,r);return l===c?t:l===fn?t.remove(u):(o?It():t).set(u,l)}function At(t){return t-=t>>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,127&(t+=t>>16)}function Ut(t,e,n,r){var o=r?t:M(t);return o[e]=n,o}function _t(t,e,n,r){var o=t.length+1;if(r&&e+1===o)return t[e]=n,t;for(var i=new Array(o),a=0,s=0;s<o;s++)s===e?(i[s]=n,a=-1):i[s]=t[s+a];return i}function Yt(t,e,n){var r=t.length-1;if(n&&e===r)return t.pop(),t;for(var o=new Array(r),i=0,a=0;a<r;a++)a===e&&(i=1),o[a]=t[a+i];return o}function Qt(t){var e=Zt();if(null===t||void 0===t)return e;if(Pt(t))return t;var n=r(t),o=n.size;return 0===o?e:(lt(o),o>0&&o<hn?Gt(0,o,Mn,null,new Bt(n.toArray())):e.withMutations(function(t){t.setSize(o),n.forEach(function(e,n){return t.set(n,e)})}))}function Pt(t){return!(!t||!t[Wn])}function Bt(t,e){this.array=t,this.ownerID=e}function Rt(t,e){function n(t,e,n){return 0===e?r(t,n):o(t,e,n)}function r(t,n){var r=n===s?u&&u.array:t&&t.array,o=n>i?0:i-n,c=a-n;return c>hn&&(c=hn),function(){if(o===c)return Jn;var t=e?--c:o++;return r&&r[t]}}function o(t,r,o){var s,u=t&&t.array,c=o>i?0:i-o>>r,l=1+(a-o>>r);return l>hn&&(l=hn),function(){for(;;){if(s){var t=s();if(t!==Jn)return t;s=null}if(c===l)return Jn;var i=e?--l:c++;s=n(u&&u[i],r-Mn,o+(i<<r))}}}var i=t._origin,a=t._capacity,s=Xt(a),u=t._tail;return n(t._root,t._level,0)}function Gt(t,e,n,r,o,i,a){var s=Object.create(Vn);return s.size=e-t,s._origin=t,s._capacity=e,s._level=n,s._root=r,s._tail=o,s.__ownerID=i,s.__hash=a,s.__altered=!1,s}function Zt(){return Fn||(Fn=Gt(0,0,Mn))}function Ht(t,e,n){if((e=g(t,e))!==e)return t;if(e>=t.size||e<0)return t.withMutations(function(t){e<0?Jt(t,e).set(0,n):Jt(t,0,e+1).set(e,n)});e+=t._origin;var r=t._tail,o=t._root,i=l(Nn);return e>=Xt(t._capacity)?r=Wt(r,t.__ownerID,0,e,n,i):o=Wt(o,t.__ownerID,t._level,e,n,i),i.value?t.__ownerID?(t._root=o,t._tail=r,t.__hash=void 0,t.__altered=!0,t):Gt(t._origin,t._capacity,t._level,o,r):t}function Wt(t,e,n,r,o,i){var a=r>>>n&gn,s=t&&a<t.array.length;if(!s&&void 0===o)return t;var u;if(n>0){var c=t&&t.array[a],l=Wt(c,e,n-Mn,r,o,i);return l===c?t:(u=Vt(t,e),u.array[a]=l,u)}return s&&t.array[a]===o?t:(p(i),u=Vt(t,e),void 0===o&&a===u.array.length-1?u.array.pop():u.array[a]=o,u)}function Vt(t,e){return e&&t&&e===t.ownerID?t:new Bt(t?t.array.slice():[],e)}function Ft(t,e){if(e>=Xt(t._capacity))return t._tail;if(e<1<<t._level+Mn){for(var n=t._root,r=t._level;n&&r>0;)n=n.array[e>>>r&gn],r-=Mn;return n}}function Jt(t,e,n){void 0!==e&&(e|=0),void 0!==n&&(n|=0);var r=t.__ownerID||new d,o=t._origin,i=t._capacity,a=o+e,s=void 0===n?i:n<0?i+n:o+n;if(a===o&&s===i)return t;if(a>=s)return t.clear();for(var u=t._level,c=t._root,l=0;a+l<0;)c=new Bt(c&&c.array.length?[void 0,c]:[],r),u+=Mn,l+=1<<u;l&&(a+=l,o+=l,s+=l,i+=l);for(var p=Xt(i),M=Xt(s);M>=1<<u+Mn;)c=new Bt(c&&c.array.length?[c]:[],r),u+=Mn;var h=t._tail,g=M<p?Ft(t,s-1):M>p?new Bt([],r):h;if(h&&M>p&&a<i&&h.array.length){c=Vt(c,r);for(var f=c,y=u;y>Mn;y-=Mn){var N=p>>>y&gn;f=f.array[N]=Vt(f.array[N],r)}f.array[p>>>Mn&gn]=h}if(s<i&&(g=g&&g.removeAfter(r,0,s)),a>=M)a-=M,s-=M,u=Mn,c=null,g=g&&g.removeBefore(r,0,a);else if(a>o||M<p){for(l=0;c;){var m=a>>>u&gn;if(m!==M>>>u&gn)break;m&&(l+=(1<<u)*m),u-=Mn,c=c.array[m]}c&&a>o&&(c=c.removeBefore(r,u,a-l)),c&&M<p&&(c=c.removeAfter(r,u,M-l)),l&&(a-=l,s-=l)}return t.__ownerID?(t.size=s-a,t._origin=a,t._capacity=s,t._level=u,t._root=c,t._tail=g,t.__hash=void 0,t.__altered=!0,t):Gt(a,s,u,c,g)}function qt(t,e,n){for(var o=[],a=0,s=0;s<n.length;s++){var u=n[s],c=r(u);c.size>a&&(a=c.size),i(u)||(c=c.map(function(t){return H(t)})),o.push(c)}return a>t.size&&(t=t.setSize(a)),Ot(t,e,o)}function Xt(t){return t<hn?0:t-1>>>Mn<<Mn}function Kt(t){return null===t||void 0===t?ee():$t(t)?t:ee().withMutations(function(e){var r=n(t);lt(r.size),r.forEach(function(t,n){return e.set(n,t)})})}function $t(t){return dt(t)&&c(t)}function te(t,e,n,r){var o=Object.create(Kt.prototype);return o.size=t?t.size:0,o._map=t,o._list=e,o.__ownerID=n,o.__hash=r,o}function ee(){return qn||(qn=te(It(),Zt()))}function ne(t,e,n){var r,o,i=t._map,a=t._list,s=i.get(e),u=void 0!==s;if(n===fn){if(!u)return t;a.size>=hn&&a.size>=2*i.size?(o=a.filter(function(t,e){return void 0!==t&&s!==e}),r=o.toKeyedSeq().map(function(t){return t[0]}).flip().toMap(),t.__ownerID&&(r.__ownerID=o.__ownerID=t.__ownerID)):(r=i.remove(e),o=s===a.size-1?a.pop():a.set(s,void 0))}else if(u){if(n===a.get(s)[1])return t;r=i,o=a.set(s,[e,n])}else r=i.set(e,a.size),o=a.set(a.size,[e,n]);return t.__ownerID?(t.size=r.size,t._map=r,t._list=o,t.__hash=void 0,t):te(r,o)}function re(t,e){this._iter=t,this._useKeys=e,this.size=t.size}function oe(t){this._iter=t,this.size=t.size}function ie(t){this._iter=t,this.size=t.size}function ae(t){this._iter=t,this.size=t.size}function se(t){var e=Ce(t);return e._iter=t,e.size=t.size,e.flip=function(){return t},e.reverse=function(){var e=t.reverse.apply(this);return e.flip=function(){return t.reverse()},e},e.has=function(e){return t.includes(e)},e.includes=function(e){return t.has(e)},e.cacheResult=Te,e.__iterateUncached=function(e,n){var r=this;return t.__iterate(function(t,n){return!1!==e(n,t,r)},n)},e.__iteratorUncached=function(e,n){if(e===jn){var r=t.__iterator(e,n);return new j(function(){var t=r.next();if(!t.done){var e=t.value[0];t.value[0]=t.value[1],t.value[1]=e}return t})}return t.__iterator(e===Dn?mn:Dn,n)},e}function ue(t,e,n){var r=Ce(t);return r.size=t.size,r.has=function(e){return t.has(e)},r.get=function(r,o){var i=t.get(r,fn);return i===fn?o:e.call(n,i,r,t)},r.__iterateUncached=function(r,o){var i=this;return t.__iterate(function(t,o,a){return!1!==r(e.call(n,t,o,a),o,i)},o)},r.__iteratorUncached=function(r,o){var i=t.__iterator(jn,o);return new j(function(){var o=i.next();if(o.done)return o;var a=o.value,s=a[0];return I(r,s,e.call(n,a[1],s,t),o)})},r}function ce(t,e){var n=Ce(t);return n._iter=t,n.size=t.size,n.reverse=function(){return t},t.flip&&(n.flip=function(){var e=se(t);return e.reverse=function(){return t.flip()},e}),n.get=function(n,r){return t.get(e?n:-1-n,r)},n.has=function(n){return t.has(e?n:-1-n)},n.includes=function(e){return t.includes(e)},n.cacheResult=Te,n.__iterate=function(e,n){var r=this;return t.__iterate(function(t,n){return e(t,n,r)},!n)},n.__iterator=function(e,n){return t.__iterator(e,!n)},n}function le(t,e,n,r){var o=Ce(t);return r&&(o.has=function(r){var o=t.get(r,fn);return o!==fn&&!!e.call(n,o,r,t)},o.get=function(r,o){var i=t.get(r,fn);return i!==fn&&e.call(n,i,r,t)?i:o}),o.__iterateUncached=function(o,i){var a=this,s=0;return t.__iterate(function(t,i,u){if(e.call(n,t,i,u))return s++,o(t,r?i:s-1,a)},i),s},o.__iteratorUncached=function(o,i){var a=t.__iterator(jn,i),s=0;return new j(function(){for(;;){var i=a.next();if(i.done)return i;var u=i.value,c=u[0],l=u[1];if(e.call(n,l,c,t))return I(o,r?c:s++,l,i)}})},o}function pe(t,e,n){var r=pt().asMutable();return t.__iterate(function(o,i){r.update(e.call(n,o,i,t),0,function(t){return t+1})}),r.asImmutable()}function de(t,e,n){var r=a(t),o=(c(t)?Kt():pt()).asMutable();t.__iterate(function(i,a){o.update(e.call(n,i,a,t),function(t){return t=t||[],t.push(r?[a,i]:i),t})});var i=be(t);return o.map(function(e){return Le(t,i(e))})}function Me(t,e,n,r){var o=t.size;if(void 0!==e&&(e|=0),void 0!==n&&(n===1/0?n=o:n|=0),y(e,n,o))return t;var i=N(e,o),a=m(n,o);if(i!==i||a!==a)return Me(t.toSeq().cacheResult(),e,n,r);var s,u=a-i;u===u&&(s=u<0?0:u);var c=Ce(t);return c.size=0===s?s:t.size&&s||void 0,!r&&_(t)&&s>=0&&(c.get=function(e,n){return e=g(this,e),e>=0&&e<s?t.get(e+i,n):n}),c.__iterateUncached=function(e,n){var o=this;if(0===s)return 0;if(n)return this.cacheResult().__iterate(e,n);var a=0,u=!0,c=0;return t.__iterate(function(t,n){if(!u||!(u=a++<i))return c++,!1!==e(t,r?n:c-1,o)&&c!==s}),c},c.__iteratorUncached=function(e,n){if(0!==s&&n)return this.cacheResult().__iterator(e,n);var o=0!==s&&t.__iterator(e,n),a=0,u=0;return new j(function(){for(;a++<i;)o.next();if(++u>s)return w();var t=o.next();return r||e===Dn?t:e===mn?I(e,u-1,void 0,t):I(e,u-1,t.value[1],t)})},c}function he(t,e,n){var r=Ce(t);return r.__iterateUncached=function(r,o){var i=this;if(o)return this.cacheResult().__iterate(r,o);var a=0;return t.__iterate(function(t,o,s){return e.call(n,t,o,s)&&++a&&r(t,o,i)}),a},r.__iteratorUncached=function(r,o){var i=this;if(o)return this.cacheResult().__iterator(r,o);var a=t.__iterator(jn,o),s=!0;return new j(function(){if(!s)return w();var t=a.next();if(t.done)return t;var o=t.value,u=o[0],c=o[1];return e.call(n,c,u,i)?r===jn?t:I(r,u,c,t):(s=!1,w())})},r}function ge(t,e,n,r){var o=Ce(t);return o.__iterateUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterate(o,i);var s=!0,u=0;return t.__iterate(function(t,i,c){if(!s||!(s=e.call(n,t,i,c)))return u++,o(t,r?i:u-1,a)}),u},o.__iteratorUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterator(o,i);var s=t.__iterator(jn,i),u=!0,c=0;return new j(function(){var t,i,l;do{if(t=s.next(),t.done)return r||o===Dn?t:o===mn?I(o,c++,void 0,t):I(o,c++,t.value[1],t);var p=t.value;i=p[0],l=p[1],u&&(u=e.call(n,l,i,a))}while(u);return o===jn?t:I(o,i,l,t)})},o}function fe(t,e){var r=a(t),o=[t].concat(e).map(function(t){return i(t)?r&&(t=n(t)):t=r?Q(t):P(Array.isArray(t)?t:[t]),t}).filter(function(t){return 0!==t.size});if(0===o.length)return t;if(1===o.length){var u=o[0];if(u===t||r&&a(u)||s(t)&&s(u))return u}var c=new O(o);return r?c=c.toKeyedSeq():s(t)||(c=c.toSetSeq()),c=c.flatten(!0),c.size=o.reduce(function(t,e){if(void 0!==t){var n=e.size;if(void 0!==n)return t+n}},0),c}function ye(t,e,n){var r=Ce(t);return r.__iterateUncached=function(r,o){function a(t,c){var l=this;t.__iterate(function(t,o){return(!e||c<e)&&i(t)?a(t,c+1):!1===r(t,n?o:s++,l)&&(u=!0),!u},o)}var s=0,u=!1;return a(t,0),s},r.__iteratorUncached=function(r,o){var a=t.__iterator(r,o),s=[],u=0;return new j(function(){for(;a;){var t=a.next();if(!1===t.done){var c=t.value;if(r===jn&&(c=c[1]),e&&!(s.length<e)||!i(c))return n?t:I(r,u++,c,t);s.push(a),a=c.__iterator(r,o)}else a=s.pop()}return w()})},r}function Ne(t,e,n){var r=be(t);return t.toSeq().map(function(o,i){return r(e.call(n,o,i,t))}).flatten(!0)}function me(t,e){var n=Ce(t);return n.size=t.size&&2*t.size-1,n.__iterateUncached=function(n,r){var o=this,i=0;return t.__iterate(function(t,r){return(!i||!1!==n(e,i++,o))&&!1!==n(t,i++,o)},r),i},n.__iteratorUncached=function(n,r){var o,i=t.__iterator(Dn,r),a=0;return new j(function(){return(!o||a%2)&&(o=i.next(),o.done)?o:a%2?I(n,a++,e):I(n,a++,o.value,o)})},n}function De(t,e,n){e||(e=Ee);var r=a(t),o=0,i=t.toSeq().map(function(e,r){return[r,e,o++,n?n(e,r,t):e]}).toArray();return i.sort(function(t,n){return e(t[3],n[3])||t[2]-n[2]}).forEach(r?function(t,e){i[e].length=2}:function(t,e){i[e]=t[1]}),r?E(i):s(t)?x(i):k(i)}function je(t,e,n){if(e||(e=Ee),n){var r=t.toSeq().map(function(e,r){return[e,n(e,r,t)]}).reduce(function(t,n){return Ie(e,t[1],n[1])?n:t});return r&&r[0]}return t.reduce(function(t,n){return Ie(e,t,n)?n:t})}function Ie(t,e,n){var r=t(n,e);return 0===r&&n!==e&&(void 0===n||null===n||n!==n)||r>0}function we(t,n,r){var o=Ce(t);return o.size=new O(r).map(function(t){return t.size}).min(),o.__iterate=function(t,e){for(var n,r=this.__iterator(Dn,e),o=0;!(n=r.next()).done&&!1!==t(n.value,o++,this););return o},o.__iteratorUncached=function(t,o){var i=r.map(function(t){return t=e(t),z(o?t.reverse():t)}),a=0,s=!1;return new j(function(){var e;return s||(e=i.map(function(t){return t.next()}),s=e.some(function(t){return t.done})),s?w():I(t,a++,n.apply(null,e.map(function(t){return t.value})))})},o}function Le(t,e){return _(t)?e:t.constructor(e)}function ve(t){if(t!==Object(t))throw new TypeError("Expected [K, V] tuple: "+t)}function ze(t){return lt(t.size),h(t)}function be(t){return a(t)?n:s(t)?r:o}function Ce(t){return Object.create((a(t)?E:s(t)?x:k).prototype)}function Te(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):T.prototype.cacheResult.call(this)}function Ee(t,e){return t>e?1:t<e?-1:0}function xe(t){var n=z(t);if(!n){if(!C(t))throw new TypeError("Expected iterable or array-like: "+t);n=z(e(t))}return n}function ke(t,e){var n,r=function(i){if(i instanceof r)return i;if(!(this instanceof r))return new r(i);if(!n){n=!0;var a=Object.keys(t);Ae(o,a),o.size=a.length,o._name=e,o._keys=a,o._defaultValues=t}this._map=pt(i)},o=r.prototype=Object.create(Xn);return o.constructor=r,r}function Oe(t,e,n){var r=Object.create(Object.getPrototypeOf(t));return r._map=e,r.__ownerID=n,r}function Se(t){return t._name||t.constructor.name||"Record"}function Ae(t,e){try{e.forEach(Ue.bind(void 0,t))}catch(t){}}function Ue(t,e){Object.defineProperty(t,e,{get:function(){return this.get(e)},set:function(t){K(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}function _e(t){return null===t||void 0===t?Be():Ye(t)&&!c(t)?t:Be().withMutations(function(e){var n=o(t);lt(n.size),n.forEach(function(t){return e.add(t)})})}function Ye(t){return!(!t||!t[Kn])}function Qe(t,e){return t.__ownerID?(t.size=e.size,t._map=e,t):e===t._map?t:0===e.size?t.__empty():t.__make(e)}function Pe(t,e){var n=Object.create($n);return n.size=t?t.size:0,n._map=t,n.__ownerID=e,n}function Be(){return tr||(tr=Pe(It()))}function Re(t){return null===t||void 0===t?He():Ge(t)?t:He().withMutations(function(e){var n=o(t);lt(n.size),n.forEach(function(t){return e.add(t)})})}function Ge(t){return Ye(t)&&c(t)}function Ze(t,e){var n=Object.create(er);return n.size=t?t.size:0,n._map=t,n.__ownerID=e,n}function He(){return nr||(nr=Ze(ee()))}function We(t){return null===t||void 0===t?Je():Ve(t)?t:Je().unshiftAll(t)}function Ve(t){return!(!t||!t[rr])}function Fe(t,e,n,r){var o=Object.create(or);return o.size=t,o._head=e,o.__ownerID=n,o.__hash=r,o.__altered=!1,o}function Je(){return ir||(ir=Fe(0))}function qe(t,e){var n=function(n){t.prototype[n]=e[n]};return Object.keys(e).forEach(n),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(e).forEach(n),t}function Xe(t,e){return e}function Ke(t,e){return[e,t]}function $e(t){return function(){return!t.apply(this,arguments)}}function tn(t){return function(){return-t.apply(this,arguments)}}function en(t){return"string"==typeof t?JSON.stringify(t):String(t)}function nn(){return M(arguments)}function rn(t,e){return t<e?1:t>e?-1:0}function on(t){if(t.size===1/0)return 0;var e=c(t),n=a(t),r=e?1:0;return an(t.__iterate(n?e?function(t,e){r=31*r+sn(it(t),it(e))|0}:function(t,e){r=r+sn(it(t),it(e))|0}:e?function(t){r=31*r+it(t)|0}:function(t){r=r+it(t)|0}),r)}function an(t,e){return e=En(e,3432918353),e=En(e<<15|e>>>-15,461845907),e=En(e<<13|e>>>-13,5),e=(e+3864292196|0)^t,e=En(e^e>>>16,2246822507),e=En(e^e>>>13,3266489909),e=ot(e^e>>>16)}function sn(t,e){return t^e+2654435769+(t<<6)+(t>>2)|0}var un=Array.prototype.slice;t(n,e),t(r,e),t(o,e),e.isIterable=i,e.isKeyed=a,e.isIndexed=s,e.isAssociative=u,e.isOrdered=c,e.Keyed=n,e.Indexed=r,e.Set=o;var cn="@@__IMMUTABLE_ITERABLE__@@",ln="@@__IMMUTABLE_KEYED__@@",pn="@@__IMMUTABLE_INDEXED__@@",dn="@@__IMMUTABLE_ORDERED__@@",Mn=5,hn=1<<Mn,gn=hn-1,fn={},yn={value:!1},Nn={value:!1},mn=0,Dn=1,jn=2,In="function"==typeof Symbol&&Symbol.iterator,wn="@@iterator",Ln=In||wn;j.prototype.toString=function(){return"[Iterator]"},j.KEYS=mn,j.VALUES=Dn,j.ENTRIES=jn,j.prototype.inspect=j.prototype.toSource=function(){return this.toString()},j.prototype[Ln]=function(){return this},t(T,e),T.of=function(){return T(arguments)},T.prototype.toSeq=function(){return this},T.prototype.toString=function(){return this.__toString("Seq {","}")},T.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},T.prototype.__iterate=function(t,e){return G(this,t,e,!0)},T.prototype.__iterator=function(t,e){return Z(this,t,e,!0)},t(E,T),E.prototype.toKeyedSeq=function(){return this},t(x,T),x.of=function(){return x(arguments)},x.prototype.toIndexedSeq=function(){return this},x.prototype.toString=function(){return this.__toString("Seq [","]")},x.prototype.__iterate=function(t,e){return G(this,t,e,!1)},x.prototype.__iterator=function(t,e){return Z(this,t,e,!1)},t(k,T),k.of=function(){return k(arguments)},k.prototype.toSetSeq=function(){return this},T.isSeq=_,T.Keyed=E,T.Set=k,T.Indexed=x;var vn="@@__IMMUTABLE_SEQ__@@";T.prototype[vn]=!0,t(O,x),O.prototype.get=function(t,e){return this.has(t)?this._array[g(this,t)]:e},O.prototype.__iterate=function(t,e){for(var n=this._array,r=n.length-1,o=0;o<=r;o++)if(!1===t(n[e?r-o:o],o,this))return o+1;return o},O.prototype.__iterator=function(t,e){var n=this._array,r=n.length-1,o=0;return new j(function(){return o>r?w():I(t,o,n[e?r-o++:o++])})},t(S,E),S.prototype.get=function(t,e){return void 0===e||this.has(t)?this._object[t]:e},S.prototype.has=function(t){return this._object.hasOwnProperty(t)},S.prototype.__iterate=function(t,e){for(var n=this._object,r=this._keys,o=r.length-1,i=0;i<=o;i++){var a=r[e?o-i:i];if(!1===t(n[a],a,this))return i+1}return i},S.prototype.__iterator=function(t,e){var n=this._object,r=this._keys,o=r.length-1,i=0;return new j(function(){var a=r[e?o-i:i];return i++>o?w():I(t,a,n[a])})},S.prototype[dn]=!0,t(A,x),A.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);var n=this._iterable,r=z(n),o=0;if(v(r))for(var i;!(i=r.next()).done&&!1!==t(i.value,o++,this););return o},A.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var n=this._iterable,r=z(n);if(!v(r))return new j(w);var o=0;return new j(function(){var e=r.next();return e.done?e:I(t,o++,e.value)})},t(U,x),U.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);for(var n=this._iterator,r=this._iteratorCache,o=0;o<r.length;)if(!1===t(r[o],o++,this))return o;for(var i;!(i=n.next()).done;){var a=i.value;if(r[o]=a,!1===t(a,o++,this))break}return o},U.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var n=this._iterator,r=this._iteratorCache,o=0;return new j(function(){if(o>=r.length){var e=n.next();if(e.done)return e;r[o]=e.value}return I(t,o,r[o++])})};var zn;t(X,x),X.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},X.prototype.get=function(t,e){return this.has(t)?this._value:e},X.prototype.includes=function(t){return J(this._value,t)},X.prototype.slice=function(t,e){var n=this.size;return y(t,e,n)?this:new X(this._value,m(e,n)-N(t,n))},X.prototype.reverse=function(){return this},X.prototype.indexOf=function(t){return J(this._value,t)?0:-1},X.prototype.lastIndexOf=function(t){return J(this._value,t)?this.size:-1},X.prototype.__iterate=function(t,e){for(var n=0;n<this.size;n++)if(!1===t(this._value,n,this))return n+1;return n},X.prototype.__iterator=function(t,e){var n=this,r=0;return new j(function(){return r<n.size?I(t,r++,n._value):w()})},X.prototype.equals=function(t){return t instanceof X?J(this._value,t._value):q(t)};var bn;t($,x),$.prototype.toString=function(){return 0===this.size?"Range []":"Range [ "+this._start+"..."+this._end+(1!==this._step?" by "+this._step:"")+" ]"},$.prototype.get=function(t,e){return this.has(t)?this._start+g(this,t)*this._step:e},$.prototype.includes=function(t){var e=(t-this._start)/this._step;return e>=0&&e<this.size&&e===Math.floor(e)},$.prototype.slice=function(t,e){return y(t,e,this.size)?this:(t=N(t,this.size),e=m(e,this.size),e<=t?new $(0,0):new $(this.get(t,this._end),this.get(e,this._end),this._step))},$.prototype.indexOf=function(t){var e=t-this._start;if(e%this._step==0){var n=e/this._step;if(n>=0&&n<this.size)return n}return-1},$.prototype.lastIndexOf=function(t){return this.indexOf(t)},$.prototype.__iterate=function(t,e){for(var n=this.size-1,r=this._step,o=e?this._start+n*r:this._start,i=0;i<=n;i++){if(!1===t(o,i,this))return i+1;o+=e?-r:r}return i},$.prototype.__iterator=function(t,e){var n=this.size-1,r=this._step,o=e?this._start+n*r:this._start,i=0;return new j(function(){var a=o;return o+=e?-r:r,i>n?w():I(t,i++,a)})},$.prototype.equals=function(t){return t instanceof $?this._start===t._start&&this._end===t._end&&this._step===t._step:q(this,t)};var Cn;t(tt,e),t(et,tt),t(nt,tt),t(rt,tt),tt.Keyed=et,tt.Indexed=nt,tt.Set=rt;var Tn,En="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(t,e){t|=0,e|=0;var n=65535&t,r=65535&e;return n*r+((t>>>16)*r+n*(e>>>16)<<16>>>0)|0},xn=Object.isExtensible,kn=function(){try{return Object.defineProperty({},"@",{}),!0}catch(t){return!1}}(),On="function"==typeof WeakMap;On&&(Tn=new WeakMap);var Sn=0,An="__immutablehash__";"function"==typeof Symbol&&(An=Symbol(An));var Un=16,_n=255,Yn=0,Qn={};t(pt,et),pt.of=function(){var t=un.call(arguments,0);return It().withMutations(function(e){for(var n=0;n<t.length;n+=2){if(n+1>=t.length)throw new Error("Missing value for key: "+t[n]);e.set(t[n],t[n+1])}})},pt.prototype.toString=function(){return this.__toString("Map {","}")},pt.prototype.get=function(t,e){return this._root?this._root.get(0,void 0,t,e):e},pt.prototype.set=function(t,e){return wt(this,t,e)},pt.prototype.setIn=function(t,e){return this.updateIn(t,fn,function(){return e})},pt.prototype.remove=function(t){return wt(this,t,fn)},pt.prototype.deleteIn=function(t){return this.updateIn(t,function(){return fn})},pt.prototype.update=function(t,e,n){return 1===arguments.length?t(this):this.updateIn([t],e,n)},pt.prototype.updateIn=function(t,e,n){n||(n=e,e=void 0);var r=St(this,xe(t),e,n);return r===fn?void 0:r},pt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):It()},pt.prototype.merge=function(){return Et(this,void 0,arguments)},pt.prototype.mergeWith=function(t){return Et(this,t,un.call(arguments,1))},pt.prototype.mergeIn=function(t){var e=un.call(arguments,1);return this.updateIn(t,It(),function(t){return"function"==typeof t.merge?t.merge.apply(t,e):e[e.length-1]})},pt.prototype.mergeDeep=function(){return Et(this,xt,arguments)},pt.prototype.mergeDeepWith=function(t){var e=un.call(arguments,1);return Et(this,kt(t),e)},pt.prototype.mergeDeepIn=function(t){var e=un.call(arguments,1);return this.updateIn(t,It(),function(t){return"function"==typeof t.mergeDeep?t.mergeDeep.apply(t,e):e[e.length-1]})},pt.prototype.sort=function(t){return Kt(De(this,t))},pt.prototype.sortBy=function(t,e){return Kt(De(this,e,t))},pt.prototype.withMutations=function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},pt.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new d)},pt.prototype.asImmutable=function(){return this.__ensureOwner()},pt.prototype.wasAltered=function(){return this.__altered},pt.prototype.__iterator=function(t,e){return new Nt(this,t,e)},pt.prototype.__iterate=function(t,e){var n=this,r=0;return this._root&&this._root.iterate(function(e){return r++,t(e[1],e[0],n)},e),r},pt.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?jt(this.size,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},pt.isMap=dt;var Pn="@@__IMMUTABLE_MAP__@@",Bn=pt.prototype;Bn[Pn]=!0,Bn.delete=Bn.remove,Bn.removeIn=Bn.deleteIn,Mt.prototype.get=function(t,e,n,r){for(var o=this.entries,i=0,a=o.length;i<a;i++)if(J(n,o[i][0]))return o[i][1];return r},Mt.prototype.update=function(t,e,n,r,o,i,a){for(var s=o===fn,u=this.entries,c=0,l=u.length;c<l&&!J(r,u[c][0]);c++);var d=c<l;if(d?u[c][1]===o:s)return this;if(p(a),(s||!d)&&p(i),!s||1!==u.length){if(!d&&!s&&u.length>=Gn)return bt(t,u,r,o);var h=t&&t===this.ownerID,g=h?u:M(u);return d?s?c===l-1?g.pop():g[c]=g.pop():g[c]=[r,o]:g.push([r,o]),h?(this.entries=g,this):new Mt(t,g)}},ht.prototype.get=function(t,e,n,r){void 0===e&&(e=it(n));var o=1<<((0===t?e:e>>>t)&gn),i=this.bitmap;return 0==(i&o)?r:this.nodes[At(i&o-1)].get(t+Mn,e,n,r)},ht.prototype.update=function(t,e,n,r,o,i,a){void 0===n&&(n=it(r));var s=(0===e?n:n>>>e)&gn,u=1<<s,c=this.bitmap,l=0!=(c&u);if(!l&&o===fn)return this;var p=At(c&u-1),d=this.nodes,M=l?d[p]:void 0,h=Lt(M,t,e+Mn,n,r,o,i,a);if(h===M)return this;if(!l&&h&&d.length>=Zn)return Tt(t,d,c,s,h);if(l&&!h&&2===d.length&&vt(d[1^p]))return d[1^p];if(l&&h&&1===d.length&&vt(h))return h;var g=t&&t===this.ownerID,f=l?h?c:c^u:c|u,y=l?h?Ut(d,p,h,g):Yt(d,p,g):_t(d,p,h,g);return g?(this.bitmap=f,this.nodes=y,this):new ht(t,f,y)},gt.prototype.get=function(t,e,n,r){void 0===e&&(e=it(n));var o=(0===t?e:e>>>t)&gn,i=this.nodes[o];return i?i.get(t+Mn,e,n,r):r},gt.prototype.update=function(t,e,n,r,o,i,a){void 0===n&&(n=it(r));var s=(0===e?n:n>>>e)&gn,u=o===fn,c=this.nodes,l=c[s];if(u&&!l)return this;var p=Lt(l,t,e+Mn,n,r,o,i,a);if(p===l)return this;var d=this.count;if(l){if(!p&&--d<Hn)return Ct(t,c,d,s)}else d++;var M=t&&t===this.ownerID,h=Ut(c,s,p,M);return M?(this.count=d,this.nodes=h,this):new gt(t,d,h)},ft.prototype.get=function(t,e,n,r){for(var o=this.entries,i=0,a=o.length;i<a;i++)if(J(n,o[i][0]))return o[i][1];return r},ft.prototype.update=function(t,e,n,r,o,i,a){void 0===n&&(n=it(r));var s=o===fn;if(n!==this.keyHash)return s?this:(p(a),p(i),zt(this,t,e,n,[r,o]));for(var u=this.entries,c=0,l=u.length;c<l&&!J(r,u[c][0]);c++);var d=c<l;if(d?u[c][1]===o:s)return this;if(p(a),(s||!d)&&p(i),s&&2===l)return new yt(t,this.keyHash,u[1^c]);var h=t&&t===this.ownerID,g=h?u:M(u);return d?s?c===l-1?g.pop():g[c]=g.pop():g[c]=[r,o]:g.push([r,o]),h?(this.entries=g,this):new ft(t,this.keyHash,g)},yt.prototype.get=function(t,e,n,r){return J(n,this.entry[0])?this.entry[1]:r},yt.prototype.update=function(t,e,n,r,o,i,a){var s=o===fn,u=J(r,this.entry[0]);return(u?o===this.entry[1]:s)?this:(p(a),s?void p(i):u?t&&t===this.ownerID?(this.entry[1]=o,this):new yt(t,this.keyHash,[r,o]):(p(i),zt(this,t,e,it(r),[r,o])))},Mt.prototype.iterate=ft.prototype.iterate=function(t,e){for(var n=this.entries,r=0,o=n.length-1;r<=o;r++)if(!1===t(n[e?o-r:r]))return!1},ht.prototype.iterate=gt.prototype.iterate=function(t,e){for(var n=this.nodes,r=0,o=n.length-1;r<=o;r++){var i=n[e?o-r:r];if(i&&!1===i.iterate(t,e))return!1}},yt.prototype.iterate=function(t,e){return t(this.entry)},t(Nt,j),Nt.prototype.next=function(){for(var t=this._type,e=this._stack;e;){var n,r=e.node,o=e.index++;if(r.entry){if(0===o)return mt(t,r.entry)}else if(r.entries){if(n=r.entries.length-1,o<=n)return mt(t,r.entries[this._reverse?n-o:o])}else if(n=r.nodes.length-1,o<=n){var i=r.nodes[this._reverse?n-o:o];if(i){if(i.entry)return mt(t,i.entry);e=this._stack=Dt(i,e)}continue}e=this._stack=this._stack.__prev}return w()};var Rn,Gn=hn/4,Zn=hn/2,Hn=hn/4;t(Qt,nt),Qt.of=function(){return this(arguments)},Qt.prototype.toString=function(){return this.__toString("List [","]")},Qt.prototype.get=function(t,e){if((t=g(this,t))>=0&&t<this.size){t+=this._origin;var n=Ft(this,t);return n&&n.array[t&gn]}return e},Qt.prototype.set=function(t,e){return Ht(this,t,e)},Qt.prototype.remove=function(t){return this.has(t)?0===t?this.shift():t===this.size-1?this.pop():this.splice(t,1):this},Qt.prototype.insert=function(t,e){return this.splice(t,0,e)},Qt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=Mn,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):Zt()},Qt.prototype.push=function(){var t=arguments,e=this.size;return this.withMutations(function(n){Jt(n,0,e+t.length);for(var r=0;r<t.length;r++)n.set(e+r,t[r])})},Qt.prototype.pop=function(){return Jt(this,0,-1)},Qt.prototype.unshift=function(){var t=arguments;return this.withMutations(function(e){Jt(e,-t.length);for(var n=0;n<t.length;n++)e.set(n,t[n])})},Qt.prototype.shift=function(){return Jt(this,1)},Qt.prototype.merge=function(){return qt(this,void 0,arguments)},Qt.prototype.mergeWith=function(t){return qt(this,t,un.call(arguments,1))},Qt.prototype.mergeDeep=function(){return qt(this,xt,arguments)},Qt.prototype.mergeDeepWith=function(t){var e=un.call(arguments,1);return qt(this,kt(t),e)},Qt.prototype.setSize=function(t){return Jt(this,0,t)},Qt.prototype.slice=function(t,e){var n=this.size;return y(t,e,n)?this:Jt(this,N(t,n),m(e,n))},Qt.prototype.__iterator=function(t,e){var n=0,r=Rt(this,e);return new j(function(){var e=r();return e===Jn?w():I(t,n++,e)})},Qt.prototype.__iterate=function(t,e){for(var n,r=0,o=Rt(this,e);(n=o())!==Jn&&!1!==t(n,r++,this););return r},Qt.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?Gt(this._origin,this._capacity,this._level,this._root,this._tail,t,this.__hash):(this.__ownerID=t,this)},Qt.isList=Pt;var Wn="@@__IMMUTABLE_LIST__@@",Vn=Qt.prototype;Vn[Wn]=!0,Vn.delete=Vn.remove,Vn.setIn=Bn.setIn,Vn.deleteIn=Vn.removeIn=Bn.removeIn,Vn.update=Bn.update,Vn.updateIn=Bn.updateIn,Vn.mergeIn=Bn.mergeIn,Vn.mergeDeepIn=Bn.mergeDeepIn,Vn.withMutations=Bn.withMutations,Vn.asMutable=Bn.asMutable,Vn.asImmutable=Bn.asImmutable,Vn.wasAltered=Bn.wasAltered,Bt.prototype.removeBefore=function(t,e,n){if(n===e?1<<e:0===this.array.length)return this;var r=n>>>e&gn;if(r>=this.array.length)return new Bt([],t);var o,i=0===r;if(e>0){var a=this.array[r];if((o=a&&a.removeBefore(t,e-Mn,n))===a&&i)return this}if(i&&!o)return this;var s=Vt(this,t);if(!i)for(var u=0;u<r;u++)s.array[u]=void 0;return o&&(s.array[r]=o),s},Bt.prototype.removeAfter=function(t,e,n){if(n===(e?1<<e:0)||0===this.array.length)return this;var r=n-1>>>e&gn;if(r>=this.array.length)return this;var o;if(e>0){var i=this.array[r];if((o=i&&i.removeAfter(t,e-Mn,n))===i&&r===this.array.length-1)return this}var a=Vt(this,t);return a.array.splice(r+1),o&&(a.array[r]=o),a};var Fn,Jn={};t(Kt,pt),Kt.of=function(){return this(arguments)},Kt.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Kt.prototype.get=function(t,e){var n=this._map.get(t);return void 0!==n?this._list.get(n)[1]:e},Kt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):ee()},Kt.prototype.set=function(t,e){return ne(this,t,e)},Kt.prototype.remove=function(t){return ne(this,t,fn)},Kt.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Kt.prototype.__iterate=function(t,e){var n=this;return this._list.__iterate(function(e){return e&&t(e[1],e[0],n)},e)},Kt.prototype.__iterator=function(t,e){return this._list.fromEntrySeq().__iterator(t,e)},Kt.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),n=this._list.__ensureOwner(t);return t?te(e,n,t,this.__hash):(this.__ownerID=t,this._map=e,this._list=n,this)},Kt.isOrderedMap=$t,Kt.prototype[dn]=!0,Kt.prototype.delete=Kt.prototype.remove;var qn;t(re,E),re.prototype.get=function(t,e){return this._iter.get(t,e)},re.prototype.has=function(t){return this._iter.has(t)},re.prototype.valueSeq=function(){return this._iter.valueSeq()},re.prototype.reverse=function(){var t=this,e=ce(this,!0);return this._useKeys||(e.valueSeq=function(){return t._iter.toSeq().reverse()}),e},re.prototype.map=function(t,e){var n=this,r=ue(this,t,e);return this._useKeys||(r.valueSeq=function(){return n._iter.toSeq().map(t,e)}),r},re.prototype.__iterate=function(t,e){var n,r=this;return this._iter.__iterate(this._useKeys?function(e,n){return t(e,n,r)}:(n=e?ze(this):0,function(o){return t(o,e?--n:n++,r)}),e)},re.prototype.__iterator=function(t,e){if(this._useKeys)return this._iter.__iterator(t,e);var n=this._iter.__iterator(Dn,e),r=e?ze(this):0;return new j(function(){var o=n.next();return o.done?o:I(t,e?--r:r++,o.value,o)})},re.prototype[dn]=!0,t(oe,x),oe.prototype.includes=function(t){return this._iter.includes(t)},oe.prototype.__iterate=function(t,e){var n=this,r=0;return this._iter.__iterate(function(e){return t(e,r++,n)},e)},oe.prototype.__iterator=function(t,e){var n=this._iter.__iterator(Dn,e),r=0;return new j(function(){var e=n.next();return e.done?e:I(t,r++,e.value,e)})},t(ie,k),ie.prototype.has=function(t){return this._iter.includes(t)},ie.prototype.__iterate=function(t,e){var n=this;return this._iter.__iterate(function(e){return t(e,e,n)},e)},ie.prototype.__iterator=function(t,e){var n=this._iter.__iterator(Dn,e);return new j(function(){var e=n.next();return e.done?e:I(t,e.value,e.value,e)})},t(ae,E),ae.prototype.entrySeq=function(){return this._iter.toSeq()},ae.prototype.__iterate=function(t,e){var n=this;return this._iter.__iterate(function(e){if(e){ve(e);var r=i(e);return t(r?e.get(1):e[1],r?e.get(0):e[0],n)}},e)},ae.prototype.__iterator=function(t,e){var n=this._iter.__iterator(Dn,e);return new j(function(){for(;;){var e=n.next();if(e.done)return e;var r=e.value;if(r){ve(r);var o=i(r);return I(t,o?r.get(0):r[0],o?r.get(1):r[1],e)}}})},oe.prototype.cacheResult=re.prototype.cacheResult=ie.prototype.cacheResult=ae.prototype.cacheResult=Te,t(ke,et),ke.prototype.toString=function(){return this.__toString(Se(this)+" {","}")},ke.prototype.has=function(t){return this._defaultValues.hasOwnProperty(t)},ke.prototype.get=function(t,e){if(!this.has(t))return e;var n=this._defaultValues[t];return this._map?this._map.get(t,n):n},ke.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var t=this.constructor;return t._empty||(t._empty=Oe(this,It()))},ke.prototype.set=function(t,e){if(!this.has(t))throw new Error('Cannot set unknown key "'+t+'" on '+Se(this));if(this._map&&!this._map.has(t)){if(e===this._defaultValues[t])return this}var n=this._map&&this._map.set(t,e);return this.__ownerID||n===this._map?this:Oe(this,n)},ke.prototype.remove=function(t){if(!this.has(t))return this;var e=this._map&&this._map.remove(t);return this.__ownerID||e===this._map?this:Oe(this,e)},ke.prototype.wasAltered=function(){return this._map.wasAltered()},ke.prototype.__iterator=function(t,e){var r=this;return n(this._defaultValues).map(function(t,e){return r.get(e)}).__iterator(t,e)},ke.prototype.__iterate=function(t,e){var r=this;return n(this._defaultValues).map(function(t,e){return r.get(e)}).__iterate(t,e)},ke.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?Oe(this,e,t):(this.__ownerID=t,this._map=e,this)};var Xn=ke.prototype;Xn.delete=Xn.remove,Xn.deleteIn=Xn.removeIn=Bn.removeIn,Xn.merge=Bn.merge,Xn.mergeWith=Bn.mergeWith,Xn.mergeIn=Bn.mergeIn,Xn.mergeDeep=Bn.mergeDeep,Xn.mergeDeepWith=Bn.mergeDeepWith,Xn.mergeDeepIn=Bn.mergeDeepIn,Xn.setIn=Bn.setIn,Xn.update=Bn.update,Xn.updateIn=Bn.updateIn,Xn.withMutations=Bn.withMutations,Xn.asMutable=Bn.asMutable,Xn.asImmutable=Bn.asImmutable,t(_e,rt),_e.of=function(){return this(arguments)},_e.fromKeys=function(t){return this(n(t).keySeq())},_e.prototype.toString=function(){return this.__toString("Set {","}")},_e.prototype.has=function(t){return this._map.has(t)},_e.prototype.add=function(t){return Qe(this,this._map.set(t,!0))},_e.prototype.remove=function(t){return Qe(this,this._map.remove(t))},_e.prototype.clear=function(){return Qe(this,this._map.clear())},_e.prototype.union=function(){var t=un.call(arguments,0);return t=t.filter(function(t){return 0!==t.size}),0===t.length?this:0!==this.size||this.__ownerID||1!==t.length?this.withMutations(function(e){for(var n=0;n<t.length;n++)o(t[n]).forEach(function(t){return e.add(t)})}):this.constructor(t[0])},_e.prototype.intersect=function(){var t=un.call(arguments,0);if(0===t.length)return this;t=t.map(function(t){return o(t)});var e=this;return this.withMutations(function(n){e.forEach(function(e){t.every(function(t){return t.includes(e)})||n.remove(e)})})},_e.prototype.subtract=function(){var t=un.call(arguments,0);if(0===t.length)return this;t=t.map(function(t){return o(t)});var e=this;return this.withMutations(function(n){e.forEach(function(e){t.some(function(t){return t.includes(e)})&&n.remove(e)})})},_e.prototype.merge=function(){return this.union.apply(this,arguments)},_e.prototype.mergeWith=function(t){var e=un.call(arguments,1);return this.union.apply(this,e)},_e.prototype.sort=function(t){return Re(De(this,t))},_e.prototype.sortBy=function(t,e){return Re(De(this,e,t))},_e.prototype.wasAltered=function(){return this._map.wasAltered()},_e.prototype.__iterate=function(t,e){var n=this;return this._map.__iterate(function(e,r){return t(r,r,n)},e)},_e.prototype.__iterator=function(t,e){return this._map.map(function(t,e){return e}).__iterator(t,e)},_e.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t);return t?this.__make(e,t):(this.__ownerID=t,this._map=e,this)},_e.isSet=Ye;var Kn="@@__IMMUTABLE_SET__@@",$n=_e.prototype;$n[Kn]=!0,$n.delete=$n.remove,$n.mergeDeep=$n.merge,$n.mergeDeepWith=$n.mergeWith,$n.withMutations=Bn.withMutations,$n.asMutable=Bn.asMutable,$n.asImmutable=Bn.asImmutable,$n.__empty=Be,$n.__make=Pe;var tr;t(Re,_e),Re.of=function(){return this(arguments)},Re.fromKeys=function(t){return this(n(t).keySeq())},Re.prototype.toString=function(){return this.__toString("OrderedSet {","}")},Re.isOrderedSet=Ge;var er=Re.prototype;er[dn]=!0,er.__empty=He,er.__make=Ze;var nr;t(We,nt),We.of=function(){return this(arguments)},We.prototype.toString=function(){return this.__toString("Stack [","]")},We.prototype.get=function(t,e){var n=this._head;for(t=g(this,t);n&&t--;)n=n.next;return n?n.value:e},We.prototype.peek=function(){return this._head&&this._head.value},We.prototype.push=function(){if(0===arguments.length)return this;for(var t=this.size+arguments.length,e=this._head,n=arguments.length-1;n>=0;n--)e={value:arguments[n],next:e};return this.__ownerID?(this.size=t,this._head=e,this.__hash=void 0,this.__altered=!0,this):Fe(t,e)},We.prototype.pushAll=function(t){if(t=r(t),0===t.size)return this;lt(t.size);var e=this.size,n=this._head;return t.reverse().forEach(function(t){e++,n={value:t,next:n}}),this.__ownerID?(this.size=e,this._head=n,this.__hash=void 0,this.__altered=!0,this):Fe(e,n)},We.prototype.pop=function(){return this.slice(1)},We.prototype.unshift=function(){return this.push.apply(this,arguments)},We.prototype.unshiftAll=function(t){return this.pushAll(t)},We.prototype.shift=function(){return this.pop.apply(this,arguments)},We.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Je()},We.prototype.slice=function(t,e){if(y(t,e,this.size))return this;var n=N(t,this.size);if(m(e,this.size)!==this.size)return nt.prototype.slice.call(this,t,e);for(var r=this.size-n,o=this._head;n--;)o=o.next;return this.__ownerID?(this.size=r,this._head=o,this.__hash=void 0,this.__altered=!0,this):Fe(r,o)},We.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?Fe(this.size,this._head,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},We.prototype.__iterate=function(t,e){if(e)return this.reverse().__iterate(t);for(var n=0,r=this._head;r&&!1!==t(r.value,n++,this);)r=r.next;return n},We.prototype.__iterator=function(t,e){if(e)return this.reverse().__iterator(t);var n=0,r=this._head;return new j(function(){if(r){var e=r.value;return r=r.next,I(t,n++,e)}return w()})},We.isStack=Ve;var rr="@@__IMMUTABLE_STACK__@@",or=We.prototype;or[rr]=!0,or.withMutations=Bn.withMutations,or.asMutable=Bn.asMutable,or.asImmutable=Bn.asImmutable,or.wasAltered=Bn.wasAltered;var ir;e.Iterator=j,qe(e,{toArray:function(){lt(this.size);var t=new Array(this.size||0);return this.valueSeq().__iterate(function(e,n){t[n]=e}),t},toIndexedSeq:function(){return new oe(this)},toJS:function(){return this.toSeq().map(function(t){return t&&"function"==typeof t.toJS?t.toJS():t}).__toJS()},toJSON:function(){return this.toSeq().map(function(t){return t&&"function"==typeof t.toJSON?t.toJSON():t}).__toJS()},toKeyedSeq:function(){return new re(this,!0)},toMap:function(){return pt(this.toKeyedSeq())},toObject:function(){lt(this.size);var t={};return this.__iterate(function(e,n){t[n]=e}),t},toOrderedMap:function(){return Kt(this.toKeyedSeq())},toOrderedSet:function(){return Re(a(this)?this.valueSeq():this)},toSet:function(){return _e(a(this)?this.valueSeq():this)},toSetSeq:function(){return new ie(this)},toSeq:function(){return s(this)?this.toIndexedSeq():a(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return We(a(this)?this.valueSeq():this)},toList:function(){return Qt(a(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(t,e){return 0===this.size?t+e:t+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+e},concat:function(){return Le(this,fe(this,un.call(arguments,0)))},includes:function(t){return this.some(function(e){return J(e,t)})},entries:function(){return this.__iterator(jn)},every:function(t,e){lt(this.size);var n=!0;return this.__iterate(function(r,o,i){if(!t.call(e,r,o,i))return n=!1,!1}),n},filter:function(t,e){return Le(this,le(this,t,e,!0))},find:function(t,e,n){var r=this.findEntry(t,e);return r?r[1]:n},forEach:function(t,e){return lt(this.size),this.__iterate(e?t.bind(e):t)},join:function(t){lt(this.size),t=void 0!==t?""+t:",";var e="",n=!0;return this.__iterate(function(r){n?n=!1:e+=t,e+=null!==r&&void 0!==r?r.toString():""}),e},keys:function(){return this.__iterator(mn)},map:function(t,e){return Le(this,ue(this,t,e))},reduce:function(t,e,n){lt(this.size);var r,o;return arguments.length<2?o=!0:r=e,this.__iterate(function(e,i,a){o?(o=!1,r=e):r=t.call(n,r,e,i,a)}),r},reduceRight:function(t,e,n){var r=this.toKeyedSeq().reverse();return r.reduce.apply(r,arguments)},reverse:function(){return Le(this,ce(this,!0))},slice:function(t,e){return Le(this,Me(this,t,e,!0))},some:function(t,e){return!this.every($e(t),e)},sort:function(t){return Le(this,De(this,t))},values:function(){return this.__iterator(Dn)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some(function(){return!0})},count:function(t,e){return h(t?this.toSeq().filter(t,e):this)},countBy:function(t,e){return pe(this,t,e)},equals:function(t){return q(this,t)},entrySeq:function(){var t=this;if(t._cache)return new O(t._cache);var e=t.toSeq().map(Ke).toIndexedSeq();return e.fromEntrySeq=function(){return t.toSeq()},e},filterNot:function(t,e){return this.filter($e(t),e)},findEntry:function(t,e,n){var r=n;return this.__iterate(function(n,o,i){if(t.call(e,n,o,i))return r=[o,n],!1}),r},findKey:function(t,e){var n=this.findEntry(t,e);return n&&n[0]},findLast:function(t,e,n){return this.toKeyedSeq().reverse().find(t,e,n)},findLastEntry:function(t,e,n){return this.toKeyedSeq().reverse().findEntry(t,e,n)},findLastKey:function(t,e){return this.toKeyedSeq().reverse().findKey(t,e)},first:function(){return this.find(f)},flatMap:function(t,e){return Le(this,Ne(this,t,e))},flatten:function(t){return Le(this,ye(this,t,!0))},fromEntrySeq:function(){return new ae(this)},get:function(t,e){return this.find(function(e,n){return J(n,t)},void 0,e)},getIn:function(t,e){for(var n,r=this,o=xe(t);!(n=o.next()).done;){var i=n.value;if((r=r&&r.get?r.get(i,fn):fn)===fn)return e}return r},groupBy:function(t,e){return de(this,t,e)},has:function(t){return this.get(t,fn)!==fn},hasIn:function(t){return this.getIn(t,fn)!==fn},isSubset:function(t){return t="function"==typeof t.includes?t:e(t),this.every(function(e){return t.includes(e)})},isSuperset:function(t){return t="function"==typeof t.isSubset?t:e(t),t.isSubset(this)},keyOf:function(t){return this.findKey(function(e){return J(e,t)})},keySeq:function(){return this.toSeq().map(Xe).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(t){return this.toKeyedSeq().reverse().keyOf(t)},max:function(t){return je(this,t)},maxBy:function(t,e){return je(this,e,t)},min:function(t){return je(this,t?tn(t):rn)},minBy:function(t,e){return je(this,e?tn(e):rn,t)},rest:function(){return this.slice(1)},skip:function(t){return this.slice(Math.max(0,t))},skipLast:function(t){return Le(this,this.toSeq().reverse().skip(t).reverse())},skipWhile:function(t,e){return Le(this,ge(this,t,e,!0))},skipUntil:function(t,e){return this.skipWhile($e(t),e)},sortBy:function(t,e){return Le(this,De(this,e,t))},take:function(t){return this.slice(0,Math.max(0,t))},takeLast:function(t){return Le(this,this.toSeq().reverse().take(t).reverse())},takeWhile:function(t,e){return Le(this,he(this,t,e))},takeUntil:function(t,e){return this.takeWhile($e(t),e)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=on(this))}});var ar=e.prototype;ar[cn]=!0,ar[Ln]=ar.values,ar.__toJS=ar.toArray,ar.__toStringMapper=en,ar.inspect=ar.toSource=function(){return this.toString()},ar.chain=ar.flatMap,ar.contains=ar.includes,qe(n,{flip:function(){return Le(this,se(this))},mapEntries:function(t,e){var n=this,r=0;return Le(this,this.toSeq().map(function(o,i){return t.call(e,[i,o],r++,n)}).fromEntrySeq())},mapKeys:function(t,e){var n=this;return Le(this,this.toSeq().flip().map(function(r,o){return t.call(e,r,o,n)}).flip())}});var sr=n.prototype;return sr[ln]=!0,sr[Ln]=ar.entries,sr.__toJS=ar.toObject,sr.__toStringMapper=function(t,e){return JSON.stringify(e)+": "+en(t)},qe(r,{toKeyedSeq:function(){return new re(this,!1)},filter:function(t,e){return Le(this,le(this,t,e,!1))},findIndex:function(t,e){var n=this.findEntry(t,e);return n?n[0]:-1},indexOf:function(t){var e=this.keyOf(t);return void 0===e?-1:e},lastIndexOf:function(t){var e=this.lastKeyOf(t);return void 0===e?-1:e},reverse:function(){return Le(this,ce(this,!1))},slice:function(t,e){return Le(this,Me(this,t,e,!1))},splice:function(t,e){var n=arguments.length;if(e=Math.max(0|e,0),0===n||2===n&&!e)return this;t=N(t,t<0?this.count():this.size);var r=this.slice(0,t);return Le(this,1===n?r:r.concat(M(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var n=this.findLastEntry(t,e);return n?n[0]:-1},first:function(){return this.get(0)},flatten:function(t){return Le(this,ye(this,t,!1))},get:function(t,e){return t=g(this,t),t<0||this.size===1/0||void 0!==this.size&&t>this.size?e:this.find(function(e,n){return n===t},void 0,e)},has:function(t){return(t=g(this,t))>=0&&(void 0!==this.size?this.size===1/0||t<this.size:-1!==this.indexOf(t))},interpose:function(t){return Le(this,me(this,t))},interleave:function(){var t=[this].concat(M(arguments)),e=we(this.toSeq(),x.of,t),n=e.flatten(!0);return e.size&&(n.size=e.size*t.length),Le(this,n)},keySeq:function(){return $(0,this.size)},last:function(){return this.get(-1)},skipWhile:function(t,e){return Le(this,ge(this,t,e,!1))},zip:function(){return Le(this,we(this,nn,[this].concat(M(arguments))))},zipWith:function(t){var e=M(arguments);return e[0]=this,Le(this,we(this,t,e))}}),r.prototype[pn]=!0,r.prototype[dn]=!0,qe(o,{get:function(t,e){return this.has(t)?t:e},includes:function(t){return this.has(t)},keySeq:function(){return this.valueSeq()}}),o.prototype.has=ar.includes,o.prototype.contains=o.prototype.includes,qe(E,n.prototype),qe(x,r.prototype),qe(k,o.prototype),qe(et,n.prototype),qe(nt,r.prototype),qe(rt,o.prototype),{Iterable:e,Seq:T,Collection:tt,Map:pt,OrderedMap:Kt,List:Qt,Stack:We,Set:_e,OrderedSet:Re,Record:ke,Range:$,Repeat:X,is:J,fromJS:H}})},function(t,e,n){"use strict";function r(t,e){for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return h.format.apply(void 0,[L(t,["strings"].concat(e),"")].concat(r))}function o(t,e){for(var o=arguments.length,i=Array(o>2?o-2:0),a=2;a<o;a++)i[a-2]=arguments[a];var s=r.apply(void 0,[t,e].concat(i));return s?p.a.createElement("span",{dangerouslySetInnerHTML:{__html:n.i(g.sanitize)(s)}}):null}function i(t,e){return L(t,["strings"].concat(e),n.i(d.Map)()).toJS()}function a(t){var e=y.ui.language(t),r=y.ui.dict(t),o=M.a.fromJS(D.a),i=z[e]||n.i(d.Map)({});return i.isEmpty()?(i=r,t=n.i(f.d)(t,"i18n",{syncFn:function(n,r){return u(t,e,r)},successFn:function(t,n){c(e,n);var i=M.a.fromJS(n).mergeDeep(r);return s(t,i.toJS(),D.a),v(t,"strings",o.mergeDeep(i))},recoverResult:t,errorFn:function(t,e){y.warn(t,e.message+" Falling back to default dictionary.")}})):s(t,i.toJS(),D.a),i=o.mergeDeep(i).mergeDeep(r),v(t,"strings",i)}function s(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";Object.keys(n).forEach(function(o){e.hasOwnProperty(o)?"object"===I(n[o])&&s(t,e[o],n[o],""+r+o+"."):y.warn(t,"language does not have property "+r+o)})}function u(t,e,r){n.i(j.a)({method:"registerLanguageDictionary",url:y.languageBaseUrl(t)+"/js/lock/11.30.1/af.js",check:function(t){return t&&t===e},cb:function(t,e,n){r(t,n)}})}function c(t,e){z[t]=M.a.fromJS(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.str=r,e.html=o,e.group=i,e.initI18n=a;var l=n(0),p=n.n(l),d=n(11),M=n.n(d),h=n(77),g=(n.n(h),n(118)),f=(n.n(g),n(29)),y=n(1),N=n(20),m=n(197),D=n.n(m),j=n(74),I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},w=n.i(N.a)(["i18n"]),L=w.get,v=w.set,z=[];n.i(j.b)({method:"registerLanguageDictionary",cb:c})},function(t,e,n){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),o={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};t.exports=o},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=(n(1),n(12)),i=n(10),a=function(){function t(e){r(this,t),this.name=e}return t.prototype.backHandler=function(){return null},t.prototype.escHandler=function(){return null},t.prototype.submitButtonLabel=function(t){return o.str(t,["submitLabel"])},t.prototype.isFirstScreen=function(t){var e=n.i(i.k)(t),r=this.name.split("."),o=r[1]||r[0];return!("signUp"!==o||!n.i(i.i)(t,"login"))||-1!==[e,"loading","lastLogin"].indexOf(o)},t.prototype.getTitle=function(t){return"loading"===this.name?"":this.getScreenTitle(t)||o.str(t,"title")},t.prototype.getScreenTitle=function(t){return o.str(t,"title")},t.prototype.submitHandler=function(){return null},t.prototype.isSubmitDisabled=function(t){return!1},t.prototype.renderAuxiliaryPane=function(){return null},t.prototype.renderTabs=function(){return!1},t.prototype.renderTerms=function(){return null},t}();e.a=a},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";function r(t,e){return x(t,w.a.fromJS(o(e)))}function o(t){var e=t.defaultEnterpriseConnection;return void 0!=e&&"string"!=typeof e&&(L.warn(t,"The `defaultEnterpriseConnection` option will be ignored, because it is not a string."),e=void 0),void 0===e?{}:{defaultConnectionName:e}}function i(t){var e=a(t);return e&&M(t,e)}function a(t){return E(t,"defaultConnectionName")}function s(t){if(D(t)){return u(t,k(t,"hrdEmail",""))||h(t)}return i(t)||M(t)}function u(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=n.i(z.a)(e);return!!o&&L.connections.apply(L,[t,"enterprise"].concat(r)).find(function(t){return t.get("domains").contains(o)})}function c(t,e){return!!u(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:[])}function l(t){return y(t)?L.connections(t,"enterprise").getIn([0,"domains",0]):n.i(z.a)(k(t,"hrdEmail"))}function p(t){return!d(t)&&L.hasOneConnection(t,"enterprise")?L.connections(t,"enterprise").get(0):null}function d(t){return L.hasSomeConnections(t,"enterprise","ad","auth0-adldap")}function M(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return L.connections(t,"enterprise","ad","auth0-adldap").find(function(t){return t.get("domains").isEmpty()&&(!e||t.get("name")===e)})}function h(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return L.connections(t,"enterprise","ad","auth0-adldap").find(function(t){return!e||t.get("name")===e})}function g(t){return void 0!==f(t)}function f(t){var e=t.getIn(["sso","connection"]),n=t.getIn(["sso","strategy"]);return e&&n&&w.a.Map({name:e,strategy:n})}function y(t){return d(t)&&1===L.connections(t).count()}function N(t,e){return c(t,e,["ad","auth0-adldap"])}function m(t,e){if(e){var r=L.defaultADUsernameFromEmailPrefix(t)?n.i(z.b)(e):e;t=n.i(b.a)(t,r,"username",!1),t=S(t,"hrdEmail",e)}else{var o=k(t,"hrdEmail");o&&(t=n.i(b.a)(t,o,"email",!1)),t=O(t,"hrdEmail")}return S(t,"hrd",!!e)}function D(t){return k(t,"hrd",y(t))}function j(t,e){return!!(!n.i(z.c)(e)||L.hasSomeConnections(t,"database")||L.hasSomeConnections(t,"passwordless")||M(t)||n.i(C.a)(t,e))}n.d(e,"a",function(){return U}),e.f=r,e.e=i,e.d=a,e.n=s,e.m=u,e.b=c,e.p=l,e.h=p,e.c=d,e.j=M,e.g=g,e.r=f,e.q=y,e.k=N,e.l=m,e.i=D,e.o=j;var I=n(11),w=n.n(I),L=n(1),v=(n(4),n(20)),z=n(23),b=n(69),C=n(50),T=(n(10),n(8),n.i(v.a)(["enterprise"])),E=T.get,x=T.initNS,k=T.tget,O=T.tremove,S=T.tset,A=n.i(v.a)(["core"]),U=(A.tremove,A.tset,A.tget,{ad:"AD / LDAP",adfs:"ADFS","auth0-adldap":"AD/LDAP","auth0-oidc":"Auth0 OpenID Connect",custom:"Custom Auth","google-apps":"Google Apps",ip:"IP Address",mscrm:"Dynamics CRM",office365:"Office365",pingfederate:"Ping Federate",samlp:"SAML",sharepoint:"SharePoint Apps",waad:"Windows Azure AD",oidc:"OpenID Connect"})},function(t,e,n){"use strict";(function(t){function r(t,e,r,o,i,a,s){var u=w.setup(t,e,r,o,i,a,s);return u=n.i(I.a)(u),n.i(L.a)(w.ui.logo(u)||v.a.logo),D.a.setupClient(t,e,r,w.withAuthOptions(u,b({},o,{popupOptions:w.ui.popupOptions(u)}))),u=w.runHook(u,"didInitialize",o),n.i(j.b)(j.f,"lock",t,u),u}function o(){var e=n.i(j.d)(j.g,"lock"),r=e.filter(function(t){return!w.hashCleanup(t)}).size>0,o=t.location.href.split("#")[0],a=function(e,n){!(!e&&!n)&&!r&&t.history.replaceState(null,"",o)};i(t.location.hash,a)}function i(t,e){n.i(j.d)(j.g,"lock").forEach(function(n){return w.auth.redirect(n)&&a(n,t,e)})}function a(t,e,n){D.a.parseHash(w.id(t),e,function(e,r){e?w.emitHashParsedEvent(t,e):w.emitHashParsedEvent(t,r),e?w.emitAuthorizationErrorEvent(t,e):r&&w.emitAuthenticatedEvent(t,r),n(e,r)})}function s(t,e){var r=n.i(j.d)(j.e,"lock",t);if(!r)throw new Error("The Lock can't be opened again after it has been destroyed");if(w.rendering(r))return!1;if(e.flashMessage){var o=["error","success","info"];if(!e.flashMessage.type||-1===o.indexOf(e.flashMessage.type))return w.emitUnrecoverableErrorEvent(r,"'flashMessage' must provide a valid type ['error','success','info']");if(!e.flashMessage.text)return w.emitUnrecoverableErrorEvent(r,"'flashMessage' must provide a text")}return w.emitEvent(r,"show"),n.i(j.b)(j.c,"lock",t,function(t){return t=w.overrideOptions(t,e),t=w.filterConnections(t),t=w.runHook(t,"willShow",e),w.render(t)}),!0}function u(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},o=n.i(j.d)(j.e,"lock",t);(w.ui.closable(o)||e)&&w.rendering(o)&&(w.emitEvent(o,"hide"),w.ui.appendContainer(o)?(n.i(j.b)(j.c,"lock",t,w.stopRendering),setTimeout(function(){n.i(j.b)(j.c,"lock",t,function(t){return t=n.i(z.a)(t),t=w.reset(t),t=n.i(z.b)(t)}),o=n.i(j.d)(j.e,"lock",t),r(o)},1e3)):(n.i(j.b)(j.c,"lock",t,function(t){return t=n.i(z.a)(t),t=w.reset(t),t=n.i(z.b)(t)}),r(o)))}function c(t){n.i(j.b)(j.c,"lock",t,w.stopRendering),n.i(j.b)(j.h,"lock",t)}function l(t,e){return n.i(j.b)(j.c,"lock",t,e)}function p(t){n.i(j.d)(j.e,"lock",t).get("isLoadingPanePinned")||n.i(j.b)(j.c,"lock",t,function(t){return t.set("isLoadingPanePinned",!0)})}function d(t){n.i(j.b)(j.c,"lock",t,function(t){return t.set("isLoadingPanePinned",!1)})}function M(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments[2];n.i(j.b)(j.c,"lock",t,function(t){return e.reduce(function(e,r){return e&&n.i(z.j)(t,r)},!0)?w.setSubmitting(t,!0):e.reduce(function(t,e){return n.i(z.i)(t,e)},t)});var o=n.i(j.d)(j.e,"lock",t);w.submitting(o)&&r(o)}function h(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(t,e,n,r){return r()};M(t,e,function(o){try{w.runHook(o,"loggingIn",null,function(){D.a.logIn(t,n,w.auth.params(o).toJS(),function(n,o){n?setTimeout(function(){return y(t,e,n,r)},250):f(t,o)})})}catch(n){setTimeout(function(){return y(t,e,n,r)},250)}})}function g(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n.i(j.d)(j.e,"lock",t);n.i(j.b)(j.c,"lock",t,function(t){return w.setSubmitting(t,!0)}),D.a.checkSession(t,e,function(e,n){return e?y(t,[],e):f(t,n)})}function f(t,e){var r=n.i(j.d)(j.e,"lock",t);w.ui.autoclose(r)?u(t,!1,function(t){return w.emitAuthenticatedEvent(t,e)}):(n.i(j.b)(j.c,"lock",t,function(t){return t=w.setSubmitting(t,!1),w.setLoggedIn(t,!0)}),w.emitAuthenticatedEvent(r,e))}function y(t,e,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(t,e,n,r){return r()},i=r.error||r.code;o(t,r,e,function(){return setTimeout(function(){var o=n.i(j.d)(j.e,"lock",t),a=w.loginErrorMessage(o,r,N(e));["blocked_user","rule_error","lock.unauthorized","invalid_user_password","login_required"].indexOf(i)>-1&&w.emitAuthorizationErrorEvent(o,r),n.i(j.b)(j.c,"lock",t,w.setSubmitting,!1,a)},0)}),n.i(j.b)(j.c,"lock",t,w.setSubmitting,!1)}function N(t){if(t)return~t.indexOf("vcode")?"code":~t.indexOf("username")?"username":~t.indexOf("email")?"email":void 0}e.a=r,e.b=o,e.d=i,e.e=s,e.c=u,e.f=c,e.g=l,e.l=p,e.m=d,e.i=M,e.h=h,e.k=g,e.j=f;var m=n(11),D=(n.n(m),n(28)),j=n(8),I=n(174),w=n(1),L=n(116),v=n(112),z=n(4),b=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}}).call(e,n(15))},function(t,e,n){"use strict";var r=null;t.exports={debugTool:r}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.closeHandler=d.c,e.key="auxiliarypane",e.lock=t,M.loggedIn(t)?l.a.createElement(g,e):null}e.a=a;var s=n(2),u=n.n(s),c=n(0),l=n.n(c),p=n(55),d=n(17),M=n(1),h=n(12),g=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.handleClose=function(){var t=this.props,e=t.closeHandler,n=t.lock;e(M.id(n))},e.prototype.render=function(){var t=this.props.lock,e=M.ui.closable(t)?this.handleClose.bind(this):void 0;return l.a.createElement(p.a,{lock:t,closeHandler:e},l.a.createElement("p",null,h.html(t,["success","logIn"])))},e}(l.a.Component);g.propTypes={closeHandler:u.a.func.isRequired,lock:u.a.object.isRequired}},function(t,e,n){"use strict";function r(t){function e(t,e){return t.concat("object"===(void 0===e?"undefined":i(e))?e:[e])}function n(t){return function(n,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return n.getIn(e(t,r),o)}}function r(t){return function(n,r,o){return n.setIn(e(t,r),o)}}function a(t){return function(n,r){return n.removeIn(e(t,r))}}var s=t.concat(["transient"]);return{get:n(t),set:r(t),remove:a(t),tget:n(s),tset:r(s),tremove:a(s),reset:function(t){return t.map(function(t){return o.Map.isMap(t)?t.remove("transient"):t})},init:function(e,n){return new o.Map({id:e}).setIn(t,n)},initNS:function(e,n){return e.setIn(t,n)}}}e.a=r;var o=n(11),i=(n.n(o),"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})},function(t,e,n){"use strict";function r(t){return function(){return t}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(t){return t},t.exports=o},function(t,e,n){"use strict";function r(){C.ReactReconcileTransaction&&I||l("123")}function o(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=d.getPooled(),this.reconcileTransaction=C.ReactReconcileTransaction.getPooled(!0)}function i(t,e,n,o,i,a){return r(),I.batchedUpdates(t,e,n,o,i,a)}function a(t,e){return t._mountOrder-e._mountOrder}function s(t){var e=t.dirtyComponentsLength;e!==N.length&&l("124",e,N.length),N.sort(a),m++;for(var n=0;n<e;n++){var r=N[n],o=r._pendingCallbacks;r._pendingCallbacks=null;var i;if(h.logTopLevelRenders){var s=r;r._currentElement.type.isReactTopLevelWrapper&&(s=r._renderedComponent),i="React update: "+s.getName(),console.time(i)}if(g.performUpdateIfNecessary(r,t.reconcileTransaction,m),i&&console.timeEnd(i),o)for(var u=0;u<o.length;u++)t.callbackQueue.enqueue(o[u],r.getPublicInstance())}}function u(t){if(r(),!I.isBatchingUpdates)return void I.batchedUpdates(u,t);N.push(t),null==t._updateBatchNumber&&(t._updateBatchNumber=m+1)}function c(t,e){y(I.isBatchingUpdates,"ReactUpdates.asap: Can't enqueue an asap callback in a context whereupdates are not being batched."),D.enqueue(t,e),j=!0}var l=n(5),p=n(7),d=n(126),M=n(31),h=n(131),g=n(37),f=n(60),y=n(3),N=[],m=0,D=d.getPooled(),j=!1,I=null,w={initialize:function(){this.dirtyComponentsLength=N.length},close:function(){this.dirtyComponentsLength!==N.length?(N.splice(0,this.dirtyComponentsLength),z()):N.length=0}},L={initialize:function(){this.callbackQueue.reset()},close:function(){this.callbackQueue.notifyAll()}},v=[w,L];p(o.prototype,f,{getTransactionWrappers:function(){return v},destructor:function(){this.dirtyComponentsLength=null,d.release(this.callbackQueue),this.callbackQueue=null,C.ReactReconcileTransaction.release(this.reconcileTransaction),this.reconcileTransaction=null},perform:function(t,e,n){return f.perform.call(this,this.reconcileTransaction.perform,this.reconcileTransaction,t,e,n)}}),M.addPoolingTo(o);var z=function(){for(;N.length||j;){if(N.length){var t=o.getPooled();t.perform(s,null,t),o.release(t)}if(j){j=!1;var e=D;D=d.getPooled(),e.notifyAll(),d.release(e)}}},b={injectReconcileTransaction:function(t){t||l("126"),C.ReactReconcileTransaction=t},injectBatchingStrategy:function(t){t||l("127"),"function"!=typeof t.batchedUpdates&&l("128"),"boolean"!=typeof t.isBatchingUpdates&&l("129"),I=t}},C={ReactReconcileTransaction:null,batchedUpdates:i,enqueueUpdate:u,flushBatchedUpdates:z,injection:b,asap:c};t.exports=C},function(t,e,n){"use strict";function r(t){return o(t,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}function o(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("string"!=typeof t)return!1;var n=c()(t);return e?p()(t):n.indexOf("@")>=0&&n.indexOf(".")>=0&&-1===n.indexOf(" ")}function i(t,e){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return n.i(d.e)(t,"email",e,function(e){var i=n.i(M.o)(t,e);return{valid:r(e,o)&&i,hint:i?void 0:h.html(t,["error","login","hrd.not_matching_email"])}})}function a(t){return o(t)?t.split("@")[1].toLowerCase():""}function s(t){var e=a(t);return e?t.slice(0,-1-e.length):t}e.e=r,e.c=o,e.d=i,e.a=a,e.b=s;var u=n(32),c=n.n(u),l=n(338),p=n.n(l),d=n(4),M=n(16),h=n(12)},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.render=function(){var t=this.props,e=t.after,n=t.focused,r=t.invalidHint,o=t.isValid,i=t.name,a=t.icon,s="auth0-lock-input-block auth0-lock-input-"+i;o||(s+=" auth0-lock-error");var u="auth0-lock-input-wrap";n&&o&&(u+=" auth0-lock-focused"),a&&(u+=" auth0-lock-input-wrap-with-icon");var l=!o&&r?c.a.createElement("div",{role:"alert",id:"auth0-lock-error-msg-"+i,className:"auth0-lock-error-msg"},c.a.createElement("div",{className:"auth0-lock-error-invalid-hint"},r)):null;return c.a.createElement("div",{className:s},c.a.createElement("div",{className:u},a,this.props.children,e),l)},e}(c.a.Component);e.a=l,l.propTypes={after:s.a.element,children:s.a.oneOfType([s.a.element.isRequired,s.a.arrayOf(s.a.element).isRequired]),focused:s.a.bool,invalidHint:s.a.node,isValid:s.a.bool.isRequired,name:s.a.string.isRequired,icon:s.a.object}},function(t,e,n){"use strict";function r(t,e,n,r){this.dispatchConfig=t,this._targetInst=e,this.nativeEvent=n;var o=this.constructor.Interface;for(var i in o)if(o.hasOwnProperty(i)){var s=o[i];s?this[i]=s(n):"target"===i?this.target=r:this[i]=n[i]}var u=null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue;return this.isDefaultPrevented=u?a.thatReturnsTrue:a.thatReturnsFalse,this.isPropagationStopped=a.thatReturnsFalse,this}var o=n(7),i=n(31),a=n(21),s=(n(6),["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"]),u={type:null,target:null,currentTarget:a.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};o(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():"unknown"!=typeof t.returnValue&&(t.returnValue=!1),this.isDefaultPrevented=a.thatReturnsTrue)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():"unknown"!=typeof t.cancelBubble&&(t.cancelBubble=!0),this.isPropagationStopped=a.thatReturnsTrue)},persist:function(){this.isPersistent=a.thatReturnsTrue},isPersistent:a.thatReturnsFalse,destructor:function(){var t=this.constructor.Interface;for(var e in t)this[e]=null;for(var n=0;n<s.length;n++)this[s[n]]=null}}),r.Interface=u,r.augmentClass=function(t,e){var n=this,r=function(){};r.prototype=n.prototype;var a=new r;o(a,t.prototype),t.prototype=a,t.prototype.constructor=t,t.Interface=o({},n.Interface,e),t.augmentClass=n.augmentClass,i.addPoolingTo(t,i.fourArgumentPooler)},i.addPoolingTo(r,i.fourArgumentPooler),t.exports=r},function(t,e,n){"use strict";var r={current:null};t.exports=r},function(t,e,n){"use strict";function r(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=n.i(w.d)(w.e,"lock",t),o=n.i(C.l)(r)?"email":"username",i=b.c(r,o),a={connection:n.i(C.m)(r),username:i,password:b.c(r,"password")},s=[o,"password"];if(!j(r,a,s))return D(r,t);var u=b.c(r,"mfa_code");e&&(a.mfa_code=u,s.push("mfa_code")),n.i(v.h)(t,s,a,function(t,e,n,r){if("a0.mfa_required"===e.error)return N(t);if(e){return m(t,e&&"invalid_captcha"===e.code,r)}r()})}function o(t){for(var e="",n="abcdefghijklmnopqrstuvwxyz0123456789",r=n.length,o=0;o<t;o++)e+=n.charAt(Math.floor(Math.random()*r));return e}function i(t){var e=n.i(w.d)(w.e,"lock",t),r=["email","password"];n.i(C.n)(e)&&!n.i(C.o)(e)&&r.push("username"),n.i(C.p)(e).forEach(function(t){return r.push(t.get("name"))}),n.i(v.i)(t,r,function(e){var i={connection:n.i(C.m)(e),email:b.c(e,"email"),password:b.c(e,"password"),autoLogin:n.i(C.q)(e)};if(!j(e,i,r))return D(e,t);if(n.i(C.n)(e))if(n.i(C.o)(e)){var u=n.i(C.r)(e).getIn(["validation","username"]),c=u?u.toJS():{max:15};i.username=o(c.max)}else i.username=b.c(e,"username");n.i(C.p)(e).isEmpty()||(i.user_metadata={},n.i(C.p)(e).forEach(function(t){var n=t.get("storage"),r=t.get("name"),o=b.c(e,t.get("name"));switch(n){case"root":i[r]=o;break;default:i.user_metadata||(i.user_metadata={}),i.user_metadata[r]=o}}));var l=function(e,n){n&&n._current_popup.kill();var r=e&&"invalid_captcha"===e.code;m(t,r,function(){setTimeout(function(){return s(t,e)},250)})};try{z.runHook(e,"signingUp",null,function(){L.a.signUp(t,i,function(e,n,r){for(var o=arguments.length,i=Array(o>3?o-3:0),s=3;s<o;s++)i[s-3]=arguments[s];e?l(e,r):a.apply(void 0,[t,n,r].concat(i))})})}catch(t){l(t)}})}function a(t,e,r){var o=n.i(w.d)(w.e,"lock",t);if(z.emitEvent(o,"signup success",e),n.i(C.q)(o)){n.i(w.b)(w.c,"lock",t,function(t){return t.set("signedUp",!0)});var i={connection:n.i(C.m)(o),username:b.g(o),password:b.h(o)};return r&&(i.popupHandler=r),L.a.logIn(t,i,z.auth.params(o).toJS(),function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];e?setTimeout(function(){return u(t,e)},250):v.j.apply(void 0,[t].concat(r))})}z.ui.autoclose(o)?n.i(v.c)(t,!1):n.i(w.b)(w.c,"lock",t,function(t){return z.setSubmitting(t,!1).set("signedUp",!0)})}function s(t,e){var r=n.i(w.d)(w.e,"lock",t),o={PasswordDictionaryError:"password_dictionary_error",PasswordNoUserInfoError:"password_no_user_info_error",PasswordStrengthError:"password_strength_error"};z.emitEvent(r,"signup error",e);var i="invalid_password"===e.code&&o[e.name]||e.code,a=T.html(r,["error","signUp",i])||T.html(r,["error","signUp","lock.fallback"]);return"hook_error"===e.code?void n.i(w.b)(w.c,"lock",t,z.setSubmitting,!1,e.description||a):"invalid_captcha"===i?(a=T.html(r,["error","login",i]),m(t,!0,function(){n.i(w.b)(w.c,"lock",t,z.setSubmitting,!1,a)})):void n.i(w.b)(w.c,"lock",t,z.setSubmitting,!1,a)}function u(t,e){n.i(w.b)(w.c,"lock",t,function(t){var r=z.loginErrorMessage(t,e);return n.i(C.i)(t,"login")?z.setSubmitting(n.i(C.s)(t,"login"),!1,r):z.setSubmitting(t,!1,r)})}function c(t){n.i(v.i)(t,["email"],function(e){var r={connection:n.i(C.m)(e),email:b.c(e,"email")};L.a.resetPassword(t,r,function(e){e?setTimeout(function(){return p(t,e)},250):l(t)})})}function l(t){var e=n.i(w.d)(w.e,"lock",t);n.i(C.i)(e,"login")?(n.i(w.b)(w.c,"lock",t,function(t){return n.i(C.s)(z.setSubmitting(t,!1),"login",[""])}),setTimeout(function(){var r=T.html(e,["success","forgotPassword"]);n.i(w.b)(w.c,"lock",t,z.setGlobalSuccess,r)},500)):z.ui.autoclose(e)?n.i(v.c)(t):n.i(w.b)(w.c,"lock",t,function(t){return z.setSubmitting(t,!1).set("passwordResetted",!0)})}function p(t,e){var r=n.i(w.d)(w.e,"lock",t),o=T.html(r,["error","forgotPassword",e.code])||T.html(r,["error","forgotPassword","lock.fallback"]);n.i(w.b)(w.c,"lock",t,z.setSubmitting,!1,o)}function d(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["password"];n.i(w.b)(w.c,"lock",t,C.s,"login",e)}function M(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["password"];n.i(w.b)(w.c,"lock",t,C.s,"signUp",e)}function h(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["password"];n.i(w.b)(w.c,"lock",t,C.s,"forgotPassword",e)}function g(t){return d(t)}function f(t){return d(t)}function y(t){n.i(w.b)(w.c,"lock",t,C.t)}function N(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["mfa_code"];n.i(w.b)(w.c,"lock",t,C.s,"mfaLogin",e)}function m(t,e,r){return L.a.getChallenge(t,function(o,i){!o&&i&&n.i(w.b)(w.c,"lock",t,z.setCaptcha,i,e),r&&r()})}function D(t,e){var r=z.captcha(t),o="recaptcha_v2"===r.get("provider")?"invalid_recaptcha":"invalid_captcha",i=T.html(t,["error","login",o]);return n.i(w.b)(w.c,"lock",e,function(t){return t=z.setSubmitting(t,!1,i),b.i(t,"captcha")}),t}function j(t,e,n){if(!z.captcha(t)||!z.captcha(t).get("required"))return!0;var r=b.c(t,"captcha");return!!r&&(e.captcha=r,n.push("captcha"),!0)}e.a=r,e.c=i,e.f=s,e.j=c,e.g=d,e.h=M,e.k=h,e.i=g,e.b=f,e.d=y,e.e=m;var I=n(11),w=(n.n(I),n(8)),L=n(28),v=n(17),z=n(1),b=n(4),C=n(10),T=n(12)},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=n(178),i=function(){function t(){r(this,t),this.clients={}}return t.prototype.setupClient=function(t,e,n,r){var i=window.location.host===n;r.redirect=!!i||r.redirect,!i&&window&&(window.cordova||window.electron)&&(r.redirect=!1,r.sso=!1),this.clients[t]=new o.a(t,e,n,r)},t.prototype.logIn=function(t,e,n,r){this.clients[t].logIn(e,n,r)},t.prototype.logout=function(t,e){this.clients[t].logout(e)},t.prototype.signUp=function(t,e,n){this.clients[t].signUp(e,n)},t.prototype.resetPassword=function(t,e,n){this.clients[t].resetPassword(e,n)},t.prototype.startPasswordless=function(t,e,n){this.clients[t].passwordlessStart(e,n)},t.prototype.passwordlessVerify=function(t,e,n){this.clients[t].passwordlessVerify(e,n)},t.prototype.parseHash=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments[2];return this.clients[t].parseHash(e,n)},t.prototype.getUserInfo=function(t,e,n){return this.clients[t].getUserInfo(e,n)},t.prototype.getProfile=function(t,e,n){return this.clients[t].getProfile(e,n)},t.prototype.getChallenge=function(t,e){return this.clients[t].getChallenge(e)},t.prototype.getSSOData=function(t){for(var e,n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return(e=this.clients[t]).getSSOData.apply(e,r)},t.prototype.getUserCountry=function(t,e){return this.clients[t].getUserCountry(function(t,n){return e(t,n&&n.countryCode)})},t.prototype.checkSession=function(t,e,n){return this.clients[t].checkSession(e,n)},t}();e.a=new i},function(t,e,n){"use strict";(function(t){function r(t,e){return"ok"===g(t,e)}function o(t){var e=N(d(t,[],n.i(s.Map)()));return e.length>0&&e.reduce(function(e,n){return e&&!i(t,n)},!0)}function i(t,e){return["loading","pending","waiting"].indexOf(g(t,e))>-1}function a(t,e,n){var r=f(t,e,"error");if("sso"!==e){var o=new Error("An error occurred when fetching "+e+" data for Lock: "+n.message);o.code="sync",o.origin=n,r=c.stop(r,o)}return r}n.d(e,"a",function(){return D}),e.b=r,e.c=o;var s=n(11),u=(n.n(s),n(20)),c=n(1),l=n(8),p=n.i(u.a)(["sync"]),d=p.get,M=p.set;e.d=function(t,e,r){if(void 0!==d(t,e))return t;var o=r.waitFn?"waiting":!r.conditionFn||r.conditionFn(t)?"pending":"no";return M(t,e,n.i(s.Map)({conditionFn:r.conditionFn,errorFn:r.errorFn,recoverResult:r.recoverResult,syncStatus:o,successFn:r.successFn,syncFn:r.syncFn,timeout:r.timeout||6e3,waitFn:r.waitFn}))};var h=function(e){return(t.Array.isArray(e)?e:[e]).concat(["syncStatus"])},g=function(t,e){return d(t,h(e))},f=function(t,e,n){return M(t,h(e),n)},y=function(t,e,n){return d(t,e).get(n)},N=function t(e){return e.reduce(function(e,n,r){var o=s.Map.isMap(n)&&n.has("syncStatus")?[r]:[],i=s.Map.isMap(n)?t(n).map(function(t){return[r].concat(t)}):[];return e.concat.apply(e,[o].concat([i]))},[])},m=function(t,e){return N(d(t,[],n.i(s.Map)())).reduce(function(t,r){if("function"!=typeof y(t,r,"syncFn"))return t;if("pending"===g(t,r)){t=f(t,r,"loading");var o=!1;y(t,r,"syncFn")(t,function(i,s){o||(o=!0,setTimeout(function(){n.i(l.b)(l.c,"lock",e,function(e){var n=y(t,r,"errorFn");i&&"function"==typeof n&&setTimeout(function(){return n(e,i)},0);var o=y(e,r,"recoverResult");return i&&void 0===o?a(e,r,i):(e=f(e,r,"ok"),y(e,r,"successFn")(e,i?o:s))})},0))})}else if("waiting"===g(t,r)&&y(t,r,"waitFn")(t)){var i=y(t,r,"conditionFn");t=f(t,r,!i||i(t)?"pending":"no")}return t},t)},D=function(t){n.i(l.a)("sync",t,function(e){setTimeout(function(){return n.i(l.b)(l.c,"lock",t,m,t)},0)})}}).call(e,n(15))},function(t,e,n){"use strict";t.exports=n(269)},function(t,e,n){"use strict";var r=n(5),o=(n(3),function(t){var e=this;if(e.instancePool.length){var n=e.instancePool.pop();return e.call(n,t),n}return new e(t)}),i=function(t,e){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,t,e),r}return new n(t,e)},a=function(t,e,n){var r=this;if(r.instancePool.length){var o=r.instancePool.pop();return r.call(o,t,e,n),o}return new r(t,e,n)},s=function(t,e,n,r){var o=this;if(o.instancePool.length){var i=o.instancePool.pop();return o.call(i,t,e,n,r),i}return new o(t,e,n,r)},u=function(t){var e=this;t instanceof e||r("25"),t.destructor(),e.instancePool.length<e.poolSize&&e.instancePool.push(t)},c=o,l=function(t,e){var n=t;return n.instancePool=[],n.getPooled=e||c,n.poolSize||(n.poolSize=10),n.release=u,n},p={addPoolingTo:l,oneArgumentPooler:o,twoArgumentPooler:i,threeArgumentPooler:a,fourArgumentPooler:s};t.exports=p},function(t,e){function n(t){return t.trim?t.trim():e.right(e.left(t))}e=t.exports=n,e.left=function(t){return t.trimLeft?t.trimLeft():t.replace(/^\s\s*/,"")},e.right=function(t){if(t.trimRight)return t.trimRight();for(var e=/\s/,n=t.length;e.test(t.charAt(--n)););return t.slice(0,n+1)}},function(t,e,n){"use strict";function r(t,e){var n=e.error;return"sms_provider_error"===e.error&&(e.description||"").indexOf("(Code: 21211)")>-1&&(n="bad.phone_number"),v.html(t,["error","passwordless",n])||v.html(t,["error","passwordless","lock.fallback"])}function o(t){n.i(m.i)(t,["email"],function(t){l(t,i,a)})}function i(t){n.i(N.b)(N.c,"lock",t,function(t){return t=I.setSubmitting(t,!1),n.i(w.h)(t,!0)})}function a(t,e){var o=n.i(N.d)(N.e,"lock",t),i=r(o,e);return n.i(N.b)(N.c,"lock",t,I.setSubmitting,!1,i)}function s(t){n.i(N.b)(N.c,"lock",t,w.i),l(n.i(N.d)(N.e,"lock",t),u,c)}function u(t){n.i(N.b)(N.c,"lock",t,w.j)}function c(t,e){n.i(N.b)(N.c,"lock",t,w.k)}function l(t,e,r){var o=I.connections(t,"passwordless","email"),i=o.size>0&&I.useCustomPasswordlessConnection(t)?o.first().get("name"):"email",a={connection:i,email:j.c(t,"email"),send:n.i(w.l)(t)};n.i(w.c)(t)&&!I.auth.params(t).isEmpty()&&(a.authParams=I.auth.params(t).toJS()),D.a.startPasswordless(I.id(t),a,function(n){n?setTimeout(function(){return r(I.id(t),n)},250):e(I.id(t))})}function p(t){n.i(m.i)(t,["phoneNumber"],function(e){var r=I.connections(e,"passwordless","sms"),o=r.size>0&&I.useCustomPasswordlessConnection(e)?r.first().get("name"):"sms",i={connection:o,phoneNumber:n.i(L.c)(e),send:n.i(w.l)(e)};D.a.startPasswordless(t,i,function(e){e?setTimeout(function(){return M(t,e)},250):d(t)})})}function d(t){n.i(N.b)(N.c,"lock",t,function(t){return t=I.setSubmitting(t,!1),t=n.i(w.h)(t,!0)})}function M(t,e){var o=n.i(N.d)(N.e,"lock",t),i=r(o,e);return I.emitAuthorizationErrorEvent(o,e),n.i(N.b)(N.c,"lock",t,I.setSubmitting,!1,i)}function h(t){var e=n.i(N.d)(N.e,"lock",t),o=I.auth.params(e).toJS(),i=z({verificationCode:j.c(e,"vcode")},o);n.i(w.b)(e)?(i.connection="email",i.email=j.c(e,"email")):(i.connection="sms",i.phoneNumber=n.i(L.c)(e)),n.i(N.b)(N.c,"lock",t,I.setSubmitting,!0),D.a.passwordlessVerify(t,i,function(e,o){var i=void 0;if(e){var a=n.i(N.d)(N.e,"lock",t);return i=r(a,e),e.logToConsole&&console.error(e.description),I.emitAuthorizationErrorEvent(a,e),n.i(N.b)(N.c,"lock",t,I.setSubmitting,!1,i)}return n.i(m.j)(t,o)})}function g(t){n.i(N.b)(N.c,"lock",t,w.m)}function f(t){n.i(N.b)(N.c,"lock",t,w.n)}e.e=o,e.f=s,e.a=p,e.d=h,e.c=g,e.b=f;var y=n(11),N=(n.n(y),n(8)),m=n(17),D=n(28),j=n(4),I=n(1),w=n(34),L=n(40),v=n(12),z=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}},function(t,e,n){"use strict";function r(t,e){var r="link"===e.passwordlessMethod?"link":"code",o=!!e.mustAcceptTerms,i=void 0===e.showTerms||!!e.showTerms;return t=O(t,n.i(L.Map)({send:r,mustAcceptTerms:o,showTerms:i})),t=e.defaultLocation&&"string"==typeof e.defaultLocation?n.i(b.b)(t,e.defaultLocation.toUpperCase()):n.i(E.d)(t,"location",{recoverResult:"US",syncFn:function(t,e){return T.a.getUserCountry(v.id(t),e)},successFn:function(t,e){return n.i(b.b)(t,e)}})}function o(t,e){return U(t,"resendStatus",e)}function i(t){return o(t,"success")}function a(t){return"success"==p(t)}function s(t){return o(t,"failed")}function u(t){return"failed"==p(t)}function c(t){return"ongoing"==p(t)}function l(t){return d(t)?o(t,"ongoing"):t}function p(t){return S(t,"resendStatus","waiting")}function d(t){return"waiting"==p(t)||"failed"==p(t)}function M(t){return t=A(t,"passwordlessStarted"),t=A(t,"resendStatus"),t=n.i(z.b)(t,["vcode"]),v.clearGlobalError(t)}function h(t){return k(t,"send",m(t)?"link":"code")}function g(t){return"link"===h(t)}function f(t,e){return U(t,"passwordlessStarted",e)}function y(t){return S(t,"passwordlessStarted",!1)}function N(t){return v.connections(t,"passwordless","email").get(0)||v.connections(t,"passwordless","sms").get(0)||new L.Map}function m(t){var e=N(t);return e.isEmpty()?void 0:"email"===e.get("strategy")}function D(t){return k(t,"showTerms",!0)}function j(t){return k(t,"mustAcceptTerms",!1)}function I(t){return!j(t)||S(t,"termsAccepted",!1)}function w(t){return U(t,"termsAccepted",!I(t))}e.a=r,e.j=i,e.r=a,e.k=s,e.p=u,e.q=c,e.i=l,e.o=d,e.m=M,e.l=h,e.c=g,e.h=f,e.d=y,e.b=m,e.g=D,e.f=j,e.e=I,e.n=w;var L=n(11),v=(n.n(L),n(1)),z=n(4),b=n(40),C=n(20),T=n(28),E=n(29),x=n.i(C.a)(["passwordless"]),k=x.get,O=x.initNS,S=x.tget,A=x.tremove,U=x.tset},function(t,e,n){"use strict";function r(t){if(h){var e=t.node,n=t.children;if(n.length)for(var r=0;r<n.length;r++)g(e,n[r],null);else null!=t.html?p(e,t.html):null!=t.text&&M(e,t.text)}}function o(t,e){t.parentNode.replaceChild(e.node,t),r(e)}function i(t,e){h?t.children.push(e):t.node.appendChild(e.node)}function a(t,e){h?t.html=e:p(t.node,e)}function s(t,e){h?t.text=e:M(t.node,e)}function u(){return this.node.nodeName}function c(t){return{node:t,children:[],html:null,text:null,toString:u}}var l=n(82),p=n(62),d=n(90),M=n(144),h="undefined"!=typeof document&&"number"==typeof document.documentMode||"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent&&/\bEdge\/\d/.test(navigator.userAgent),g=d(function(t,e,n){11===e.node.nodeType||1===e.node.nodeType&&"object"===e.node.nodeName.toLowerCase()&&(null==e.node.namespaceURI||e.node.namespaceURI===l.html)?(r(e),t.insertBefore(e.node,n)):(t.insertBefore(e.node,n),r(e))});c.insertTreeBefore=g,c.replaceChildWithTree=o,c.queueChild=i,c.queueHTML=a,c.queueText=s,t.exports=c},function(t,e,n){"use strict";function r(t,e){return(t&e)===e}var o=n(5),i=(n(3),{MUST_USE_PROPERTY:1,HAS_BOOLEAN_VALUE:4,HAS_NUMERIC_VALUE:8,HAS_POSITIVE_NUMERIC_VALUE:24,HAS_OVERLOADED_BOOLEAN_VALUE:32,injectDOMPropertyConfig:function(t){var e=i,n=t.Properties||{},a=t.DOMAttributeNamespaces||{},u=t.DOMAttributeNames||{},c=t.DOMPropertyNames||{},l=t.DOMMutationMethods||{};t.isCustomAttribute&&s._isCustomAttributeFunctions.push(t.isCustomAttribute);for(var p in n){s.properties.hasOwnProperty(p)&&o("48",p);var d=p.toLowerCase(),M=n[p],h={attributeName:d,attributeNamespace:null,propertyName:p,mutationMethod:null,mustUseProperty:r(M,e.MUST_USE_PROPERTY),hasBooleanValue:r(M,e.HAS_BOOLEAN_VALUE),hasNumericValue:r(M,e.HAS_NUMERIC_VALUE),hasPositiveNumericValue:r(M,e.HAS_POSITIVE_NUMERIC_VALUE),hasOverloadedBooleanValue:r(M,e.HAS_OVERLOADED_BOOLEAN_VALUE)};if(h.hasBooleanValue+h.hasNumericValue+h.hasOverloadedBooleanValue<=1||o("50",p),u.hasOwnProperty(p)){var g=u[p];h.attributeName=g}a.hasOwnProperty(p)&&(h.attributeNamespace=a[p]),c.hasOwnProperty(p)&&(h.propertyName=c[p]),l.hasOwnProperty(p)&&(h.mutationMethod=l[p]),s.properties[p]=h}}}),a=":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",s={ID_ATTRIBUTE_NAME:"data-reactid",ROOT_ATTRIBUTE_NAME:"data-reactroot",ATTRIBUTE_NAME_START_CHAR:a,ATTRIBUTE_NAME_CHAR:a+"\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",properties:{},getPossibleStandardName:null,_isCustomAttributeFunctions:[],isCustomAttribute:function(t){for(var e=0;e<s._isCustomAttributeFunctions.length;e++){if((0,s._isCustomAttributeFunctions[e])(t))return!0}return!1},injection:i};t.exports=s},function(t,e,n){"use strict";function r(){o.attachRefs(this,this._currentElement)}var o=n(292),i=(n(18),n(6),{mountComponent:function(t,e,n,o,i,a){var s=t.mountComponent(e,n,o,i,a);return t._currentElement&&null!=t._currentElement.ref&&e.getReactMountReady().enqueue(r,t),s},getHostNode:function(t){return t.getHostNode()},unmountComponent:function(t,e){o.detachRefs(t,t._currentElement),t.unmountComponent(e)},receiveComponent:function(t,e,n,i){var a=t._currentElement;if(e!==a||i!==t._context){var s=o.shouldUpdateRefs(a,e);s&&o.detachRefs(t,a),t.receiveComponent(e,n,i),s&&t._currentElement&&null!=t._currentElement.ref&&n.getReactMountReady().enqueue(r,t)}},performUpdateIfNecessary:function(t,e,n){t._updateBatchNumber===n&&t.performUpdateIfNecessary(e)}});t.exports=i},function(t,e,n){"use strict";var r=n(7),o=n(150),i=n(327),a=n(328),s=n(39),u=n(329),c=n(330),l=n(331),p=n(335),d=s.createElement,M=s.createFactory,h=s.cloneElement,g=r,f=function(t){return t},y={Children:{map:i.map,forEach:i.forEach,count:i.count,toArray:i.toArray,only:p},Component:o.Component,PureComponent:o.PureComponent,createElement:d,cloneElement:h,isValidElement:s.isValidElement,PropTypes:u,createClass:l,createFactory:M,createMixin:f,DOM:a,version:c,__spread:g};t.exports=y},function(t,e,n){"use strict";function r(t){return void 0!==t.ref}function o(t){return void 0!==t.key}var i=n(7),a=n(26),s=(n(6),n(154),Object.prototype.hasOwnProperty),u=n(152),c={key:!0,ref:!0,__self:!0,__source:!0},l=function(t,e,n,r,o,i,a){var s={$$typeof:u,type:t,key:e,ref:n,props:a,_owner:i};return s};l.createElement=function(t,e,n){var i,u={},p=null,d=null;if(null!=e){r(e)&&(d=e.ref),o(e)&&(p=""+e.key),void 0===e.__self?null:e.__self,void 0===e.__source?null:e.__source;for(i in e)s.call(e,i)&&!c.hasOwnProperty(i)&&(u[i]=e[i])}var M=arguments.length-2;if(1===M)u.children=n;else if(M>1){for(var h=Array(M),g=0;g<M;g++)h[g]=arguments[g+2];u.children=h}if(t&&t.defaultProps){var f=t.defaultProps;for(i in f)void 0===u[i]&&(u[i]=f[i])}return l(t,p,d,0,0,a.current,u)},l.createFactory=function(t){var e=l.createElement.bind(null,t);return e.type=t,e},l.cloneAndReplaceKey=function(t,e){return l(t.type,e,t.ref,t._self,t._source,t._owner,t.props)},l.cloneElement=function(t,e,n){var u,p=i({},t.props),d=t.key,M=t.ref,h=(t._self,t._source,t._owner);if(null!=e){r(e)&&(M=e.ref,h=a.current),o(e)&&(d=""+e.key);var g;t.type&&t.type.defaultProps&&(g=t.type.defaultProps);for(u in e)s.call(e,u)&&!c.hasOwnProperty(u)&&(void 0===e[u]&&void 0!==g?p[u]=g[u]:p[u]=e[u])}var f=arguments.length-2;if(1===f)p.children=n;else if(f>1){for(var y=Array(f),N=0;N<f;N++)y[N]=arguments[N+2];p.children=y}return l(t.type,d,M,0,0,h,p)},l.isValidElement=function(t){return"object"==typeof t&&null!==t&&t.$$typeof===u},t.exports=l},function(t,e,n){"use strict";function r(t){return h.find(function(e){return e.get("isoCode")===t})}function o(t,e){var o=r(e)||r("US");return n.i(d.d)(t,"location",h,o.get("value"))}function i(t){return/^[0-9]([0-9 -])*[0-9]$/.test(t)}function a(t,e){return n.i(d.e)(t,"phoneNumber",e,i)}function s(t){return u(t).replace(/[\s-]+/g,"")}function u(t){var e=n.i(d.m)(t,"location"),r=e.get("diallingCode",""),o=n.i(d.c)(t,"phoneNumber","");return r?r+" "+o:o}function c(t){var e=n.i(d.m)(t,"location");return e.get("diallingCode")+" "+e.get("country")}e.b=o,e.a=a,e.c=s,e.e=u,e.d=c;var l=n(11),p=n.n(l),d=n(4),M=n(192),h=p.a.fromJS(M.a.map(function(t){return{country:t[0],diallingCode:t[2],isoCode:t[1],label:t[2]+" "+t[1]+" "+t[0],value:t[2]+" "+t[1]}}))},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(t){if(l===setTimeout)return setTimeout(t,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(t,0);try{return l(t,0)}catch(e){try{return l.call(null,t,0)}catch(e){return l.call(this,t,0)}}}function i(t){if(p===clearTimeout)return clearTimeout(t);if((p===r||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(t);try{return p(t)}catch(e){try{return p.call(null,t)}catch(e){return p.call(this,t)}}}function a(){g&&M&&(g=!1,M.length?h=M.concat(h):f=-1,h.length&&s())}function s(){if(!g){var t=o(a);g=!0;for(var e=h.length;e;){for(M=h,h=[];++f<e;)M&&M[f].run();f=-1,e=h.length}M=null,g=!1,i(t)}}function u(t,e){this.fun=t,this.array=e}function c(){}var l,p,d=t.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:n}catch(t){l=n}try{p="function"==typeof clearTimeout?clearTimeout:r}catch(t){p=r}}();var M,h=[],g=!1,f=-1;d.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];h.push(new u(t,e)),1!==h.length||g||o(s)},u.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.prependListener=c,d.prependOnceListener=c,d.listeners=function(t){return[]},d.binding=function(t){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(t){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},function(t,e,n){"use strict";function r(t){return"button"===t||"input"===t||"select"===t||"textarea"===t}function o(t,e,n){switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":return!(!n.disabled||!r(e));default:return!1}}var i=n(5),a=n(83),s=n(84),u=n(88),c=n(137),l=n(138),p=(n(3),{}),d=null,M=function(t,e){t&&(s.executeDispatchesInOrder(t,e),t.isPersistent()||t.constructor.release(t))},h=function(t){return M(t,!0)},g=function(t){return M(t,!1)},f=function(t){return"."+t._rootNodeID},y={injection:{injectEventPluginOrder:a.injectEventPluginOrder,injectEventPluginsByName:a.injectEventPluginsByName},putListener:function(t,e,n){"function"!=typeof n&&i("94",e,typeof n);var r=f(t);(p[e]||(p[e]={}))[r]=n;var o=a.registrationNameModules[e];o&&o.didPutListener&&o.didPutListener(t,e,n)},getListener:function(t,e){var n=p[e];if(o(e,t._currentElement.type,t._currentElement.props))return null;var r=f(t);return n&&n[r]},deleteListener:function(t,e){var n=a.registrationNameModules[e];n&&n.willDeleteListener&&n.willDeleteListener(t,e);var r=p[e];if(r){delete r[f(t)]}},deleteAllListeners:function(t){var e=f(t);for(var n in p)if(p.hasOwnProperty(n)&&p[n][e]){var r=a.registrationNameModules[n];r&&r.willDeleteListener&&r.willDeleteListener(t,n),delete p[n][e]}},extractEvents:function(t,e,n,r){for(var o,i=a.plugins,s=0;s<i.length;s++){var u=i[s];if(u){var l=u.extractEvents(t,e,n,r);l&&(o=c(o,l))}}return o},enqueueEvents:function(t){t&&(d=c(d,t))},processEventQueue:function(t){var e=d;d=null,t?l(e,h):l(e,g),d&&i("95"),u.rethrowCaughtError()},__purge:function(){p={}},__getListenerBank:function(){return p}};t.exports=y},function(t,e,n){"use strict";function r(t,e,n){var r=e.dispatchConfig.phasedRegistrationNames[n];return y(t,r)}function o(t,e,n){var o=r(t,n,e);o&&(n._dispatchListeners=g(n._dispatchListeners,o),n._dispatchInstances=g(n._dispatchInstances,t))}function i(t){t&&t.dispatchConfig.phasedRegistrationNames&&h.traverseTwoPhase(t._targetInst,o,t)}function a(t){if(t&&t.dispatchConfig.phasedRegistrationNames){var e=t._targetInst,n=e?h.getParentInstance(e):null;h.traverseTwoPhase(n,o,t)}}function s(t,e,n){if(n&&n.dispatchConfig.registrationName){var r=n.dispatchConfig.registrationName,o=y(t,r);o&&(n._dispatchListeners=g(n._dispatchListeners,o),n._dispatchInstances=g(n._dispatchInstances,t))}}function u(t){t&&t.dispatchConfig.registrationName&&s(t._targetInst,null,t)}function c(t){f(t,i)}function l(t){f(t,a)}function p(t,e,n,r){h.traverseEnterLeave(n,r,s,t,e)}function d(t){f(t,u)}var M=n(42),h=n(84),g=n(137),f=n(138),y=(n(6),M.getListener),N={accumulateTwoPhaseDispatches:c,accumulateTwoPhaseDispatchesSkipTarget:l,accumulateDirectDispatches:d,accumulateEnterLeaveDispatches:p};t.exports=N},function(t,e,n){"use strict";var r={remove:function(t){t._reactInternalInstance=void 0},get:function(t){return t._reactInternalInstance},has:function(t){return void 0!==t._reactInternalInstance},set:function(t,e){t._reactInternalInstance=e}};t.exports=r},function(t,e,n){"use strict";function r(t,e,n,r){return o.call(this,t,e,n,r)}var o=n(25),i=n(93),a={view:function(t){if(t.view)return t.view;var e=i(t);if(e.window===e)return e;var n=e.ownerDocument;return n?n.defaultView||n.parentWindow:window},detail:function(t){return t.detail||0}};o.augmentClass(r,a),t.exports=r},function(t,e,n){"use strict";function r(t){for(var e=arguments.length-1,n="Minified React error #"+t+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+t,r=0;r<e;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);n+=" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";var o=new Error(n);throw o.name="Invariant Violation",o.framesToPop=1,o}t.exports=r},function(t,e,n){"use strict";function r(t){return-1!==["oauth1","oauth2"].indexOf(t.get("strategy"))?t.get("name"):s[t.get("strategy")]}function o(t){return a.connections(t,"social")}function i(t){return a.ui.authButtonsTheme(t)}n.d(e,"a",function(){return s}),e.d=r,e.c=o,e.b=i;var a=n(1),s={apple:"Apple",amazon:"Amazon",aol:"Aol",baidu:"百度",bitbucket:"Bitbucket",box:"Box",dropbox:"Dropbox",dwolla:"Dwolla",ebay:"ebay",exact:"Exact",facebook:"Facebook",fitbit:"Fitbit",github:"GitHub","google-openid":"Google OpenId","google-oauth2":"Google",instagram:"Instagram",linkedin:"LinkedIn",miicard:"miiCard",paypal:"PayPal","paypal-sandbox":"PayPal Sandbox",planningcenter:"Planning Center",renren:"人人",salesforce:"Salesforce","salesforce-community":"Salesforce Community","salesforce-sandbox":"Salesforce (sandbox)",evernote:"Evernote","evernote-sandbox":"Evernote (sandbox)",shopify:"Shopify",soundcloud:"Soundcloud",thecity:"The City","thecity-sandbox":"The City (sandbox)",thirtysevensignals:"Basecamp",twitter:"Twitter",vkontakte:"vKontakte",windowslive:"Microsoft Account",wordpress:"Wordpress",yahoo:"Yahoo!",yammer:"Yammer",yandex:"Yandex",weibo:"新浪微博",line:"Line"}},function(t,e,n){"use strict";var r=n(0),o=n.n(r),i=function(){return o.a.createElement("div",{className:"auth0-lock-pane-separator"})};e.a=i},function(t,e,n){"use strict";function r(t){return t.getIn(["sso","lastUsedConnection"])}function o(t){return t.getIn(["sso","lastUsedUsername"],"")}e.a=r,e.b=o;var i=n(11);n.n(i)},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){return i(t,n.i(h.a)(t,e))}function i(t,e){return n.i(g.b)(t,e)}function a(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=arguments.length,r=Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return m.hasOnlyConnections.apply(m,[t,e].concat(r))&&!m.hasSomeConnections(t,"passwordless")}function s(t){var e=m.hasSomeConnections(t,"database"),r=m.hasSomeConnections(t,"social"),o=m.hasSomeConnections(t,"enterprise");if(e||r||o){if(!e&&n.i(h.c)(t,"forgotPassword")){var i=new Error('The `initialScreen` option was set to "forgotPassword" but no database connection is available.');i.code="unavailable_initial_screen",t=m.stop(t,i)}else if(!e&&!r&&n.i(h.c)(t,"signUp")){var a=new Error('The `initialScreen` option was set to "signUp" but no database or social connection is available.');a.code="unavailable_initial_screen",t=m.stop(t,a)}}else{var s=new Error("At least one database, enterprise or social connection needs to be available.");s.code="no_connection",t=m.stop(t,s)}return n.i(f.a)(t)&&!n.i(f.b)(t)&&m.error(t,"The account's default directory \""+n.i(f.a)(t)+'" is not enabled.'),n.i(h.d)(t)&&!n.i(h.e)(t)&&m.warn(t,'The provided default database connection "'+n.i(h.d)(t)+'" is not enabled.'),n.i(g.d)(t)&&!n.i(g.e)(t)&&m.warn(t,'The provided default enterprise connection "'+n.i(g.d)(t)+'" is not enabled or does not allow email/password authentication.'),t}function u(t,e){return setTimeout(function(){n.i(C.b)(C.c,"lock",m.id(t),m.stop,e)},0),new v.a}e.b=o,e.a=i,e.c=a;var c=(n(97),n(179)),l=n(182),p=n(180),d=n(164),M=n(49),h=n(10),g=n(16),f=n(66),y=n(23),N=n(69),m=n(1),D=n(169),j=n(168),I=n(170),w=n(71),L=n(108),v=n(107),z=n(109),b=n(29),C=(n(4),n(8)),T=function(t){var e=m.prefill(t).toJS(),r=e.email,o=e.username;return"string"==typeof r&&(t=n.i(y.d)(t,r)),"string"==typeof o&&(t=n.i(N.a)(t,o,"username",!1)),t},E=function(){function t(){r(this,t)}return t.prototype.didInitialize=function(t,e){return t=n.i(h.f)(t,e),t=n.i(g.f)(t,e)},t.prototype.didReceiveClientSettings=function(t){return t=s(t),t=T(t)},t.prototype.willShow=function(t,e){return t=n.i(h.g)(t,e),t=n.i(h.h)(t),n.i(b.b)(t,"client")&&(t=s(t)),t},t.prototype.render=function(e){if(m.hasStopped(e))return new v.a;if(!n.i(b.c)(e)||e.get("isLoadingPanePinned"))return new L.a;if(n.i(h.i)(e,"login")){if(!n.i(w.a)(e)&&n.i(h.c)(e,"login")){if(n.i(g.g)(e))return new D.a;if(m.ui.rememberLastLogin(e)){var r=M.a(e);M.b(e);if(r&&n.i(b.b)(e,"sso")&&m.hasConnection(e,r.get("name"))&&"passwordless"!==m.findConnection(e,r.get("name")).get("type"))return new z.a}}if(n.i(g.h)(e))return new I.a;if(n.i(g.i)(e))return new j.a}if(!n.i(h.i)(e,"login")&&!n.i(h.i)(e,"signUp")&&!n.i(h.i)(e,"forgotPassword")){var o="No available Screen. You have to allow at least one of those screens: `login`, `signUp`or `forgotPassword`.",i=new Error(o);return i.code="internal_error",i.description=o,u(e,i)}var a=t.SCREENS[n.i(h.j)(e)];if(a)return new a;var s=new Error("Internal error");return s.code="internal_error",s.description="Couldn't find a screen \""+n.i(h.j)(e)+'"',u(e,s)},t}();E.SCREENS={login:c.a,forgotPassword:d.a,signUp:l.a,mfaLogin:p.a},e.d=new E},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=n(207),p=n(4),d=n(8),M=n(1),h=n(23),g=n(102),f=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.componentDidMount=function(){var t=this.props,e=t.lock,r=t.strictValidation;M.ui.avatar(e)&&p.g(e)&&n.i(g.a)(M.id(e),p.g(e)),n.i(d.b)(d.c,"lock",M.id(e),h.d,p.g(e),r)},e.prototype.handleChange=function(t){var e=this.props,r=e.lock,o=e.strictValidation;M.ui.avatar(r)&&n.i(g.b)(M.id(r),t.target.value),n.i(d.b)(d.c,"lock",M.id(r),h.d,t.target.value,o)},e.prototype.render=function(){var t=this.props,e=t.i18n,n=t.lock,r=t.placeholder,o=t.forceInvalidVisibility,i=void 0!==o&&o,a=M.ui.allowAutocomplete(n),s=p.m(n,"email"),u=s.get("value",""),d=s.get("valid",!0),h=u?e.str("invalidErrorHint")||e.str("invalidEmailErrorHint"):e.str("blankErrorHint")||e.str("blankEmailErrorHint"),g=s.get("invalidHint")||h,f=(!i||d)&&!p.k(n,"email");return f=!(!i||""!==u)||f,c.a.createElement(l.a,{lockId:M.id(n),value:u,invalidHint:g,isValid:f,onChange:this.handleChange.bind(this),placeholder:r,autoComplete:a,disabled:M.submitting(n)})},e}(c.a.Component);e.a=f,f.propTypes={i18n:s.a.object.isRequired,lock:s.a.object.isRequired,placeholder:s.a.string.isRequired,strictValidation:s.a.bool.isRequired}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=n(113),p=n(1),d=n(53),M=n(47),h=n(194),g=n(10),f=n(27),y=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.handleSubmit=function(t,e,r){return r&&!n.i(g.u)(t)?n.i(f.f)(t.get("id"),{code:"social_signup_needs_terms_acception"}):(n.i(h.a)(this.props.lock,e,r),n.i(d.a)(p.id(this.props.lock),e))},e.prototype.render=function(){var t=this,e=this.props,r=e.instructions,o=e.labelFn,i=e.lock,a=e.showLoading,s=e.signUp,u=r||null,p=u&&c.a.createElement("p",null,u),d=n.i(M.b)(i),h=n.i(M.c)(i).map(function(e){var r=d.get(e.get("name")),a=r&&r.get("displayName"),u=r&&r.get("primaryColor"),p=r&&r.get("foregroundColor"),h=r&&r.get("icon");return c.a.createElement(l.a,{key:e.get("name"),label:o(s?"signUpWithLabel":"loginWithLabel",a||n.i(M.d)(e)),onClick:function(){return t.handleSubmit(i,e,s)},strategy:e.get("strategy"),primaryColor:u,foregroundColor:p,icon:h})}),g=a&&c.a.createElement("div",{className:"auth0-loading-container"},c.a.createElement("div",{className:"auth0-loading"}));return c.a.createElement("div",{className:"auth-lock-social-buttons-pane"},p,c.a.createElement("div",{className:"auth0-lock-social-buttons-container"},h),g)},e}(c.a.Component);e.a=y,y.propTypes={instructions:s.a.any,labelFn:s.a.func.isRequired,lock:s.a.object.isRequired,showLoading:s.a.bool.isRequired,signUp:s.a.bool.isRequired,e:s.a.bool},y.defaultProps={showLoading:!1,e:!1}},function(t,e,n){"use strict";function r(t){n.i(s.b)(s.c,"lock",t,a.b,!0)}function o(t,e,r,o){var i=n.i(s.d)(s.e,"lock",t),a=c.auth.connectionScopes(i),l=a.get(e.get("name")),p={connection:e.get("name"),connection_scope:l?l.toJS():void 0};c.auth.redirect(i)||"facebook"!==e.get("strategy")||(p.display="popup"),r&&(p.login_hint=r),o&&(p.prompt=o),"apple"===e.get("strategy")?n.i(s.b)(s.c,"lock",c.id(i),c.setSupressSubmitOverlay,!0):n.i(s.b)(s.c,"lock",c.id(i),c.setSupressSubmitOverlay,!1),p.isSubmitting=!1,n.i(u.h)(t,[],p)}function i(t,e,r){var i=n.i(s.d)(s.e,"lock",t);if(c.auth.responseType(i).indexOf("code")>=0)return o(t,e,r,"none");var a=c.auth.connectionScopes(i),p=(a.get(e.get("name")),l({},c.auth.params(i).toJS(),{connection:e.get("name")}));n.i(u.k)(t,p)}e.c=r,e.a=o,e.b=i;var a=n(71),s=n(8),u=n(17),c=n(1),l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}},function(t,e,n){"use strict";n.d(e,"b",function(){return l}),n.d(e,"a",function(){return p});var r=n(2),o=n.n(r),i=n(0),a=n.n(i),s=function(){return a.a.createElement("svg",{"aria-hidden":"true",focusable:"false",enableBackground:"new 0 0 24 24",version:"1.0",viewBox:"0 0 24 24",xmlSpace:"preserve",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"}," ",a.a.createElement("polyline",{fill:"none",points:"12.5,21 3.5,12 12.5,3 ",stroke:"#000000",strokeMiterlimit:"10",strokeWidth:"2"})," ",a.a.createElement("line",{fill:"none",stroke:"#000000",strokeMiterlimit:"10",strokeWidth:"2",x1:"22",x2:"3.5",y1:"12",y2:"12"})," ")},u=function(){return a.a.createElement("svg",{"aria-hidden":"true",focusable:"false",enableBackground:"new 0 0 128 128",version:"1.1",viewBox:"0 0 128 128",xmlSpace:"preserve",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},a.a.createElement("g",null,a.a.createElement("polygon",{fill:"#373737",points:"123.5429688,11.59375 116.4765625,4.5185547 64.0019531,56.9306641 11.5595703,4.4882813 4.4882813,11.5595703 56.9272461,63.9970703 4.4570313,116.4052734 11.5244141,123.4814453 63.9985352,71.0683594 116.4423828,123.5117188 123.5126953,116.4414063 71.0732422,64.0019531 "})))},c=function(t){var e=t.lockId,n=t.name,r=t.onClick,o=t.svg;return a.a.createElement("span",{id:e+"-"+n+"-button",role:"button",tabIndex:0,className:"auth0-lock-"+n+"-button",onClick:function(t){t.preventDefault(),r()},onKeyPress:function(t){"Enter"===t.key&&(t.preventDefault(),r())},"aria-label":n},o)};c.propTypes={name:o.a.string.isRequired,onClick:o.a.func.isRequired,svg:o.a.element.isRequired};var l=function(t){var e=t.lockId,n=t.onClick;return a.a.createElement(c,{lockId:e,name:"close",onClick:n,svg:a.a.createElement(u,null)})};l.propTypes={onClick:o.a.func.isRequired};var p=function(t){var e=t.lockId,n=t.onClick;return a.a.createElement(c,{lockId:e,name:"back",onClick:n,svg:a.a.createElement(s,null)})};p.propTypes={onClick:o.a.func.isRequired}},function(t,e,n){"use strict";var r=n(0),o=n.n(r),i=n(201),a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},s=o.a.createElement("svg",{focusable:"false",width:"56px",height:"56px",viewBox:"0 0 52 52",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",className:"checkmark"}," ",o.a.createElement("circle",{cx:"26",cy:"26",r:"25",fill:"none",className:"checkmark__circle"})," ",o.a.createElement("path",{fill:"none",d:"M14.1 27.2l7.1 7.2 16.7-16.8",className:"checkmark__check"})," "),u=function(t){return o.a.createElement(i.a,a({svg:s},t))};e.a=u},function(t,e,n){"use strict";function r(){return window.matchMedia&&!window.matchMedia("(min-width: 380px)").matches}e.a=r},function(t,e,n){(function(e){for(var n={},r="object"==typeof self&&self.self===self&&self||"object"==typeof e&&e.global===e&&e||this||{},o=Array.isArray,i=Object.keys,a=Object.prototype,s=a.toString,u=Math.pow(2,53)-1,c=function(t){return function(e){return null==e?void 0:e[t]}}("length"),l=function(t){var e=c(t);return"number"==typeof e&&e>=0&&e<=u},p=["Arguments","Function","String","Number"],d=0;d<p.length;d++)!function(t){n["is"+t]=function(e){return s.call(e)==="[object "+t+"]"}}(p[d]);var M=r.document&&r.document.childNodes;"function"!=typeof/./&&"object"!=typeof Int8Array&&"function"!=typeof M&&(n.isFunction=function(t){return"function"==typeof t||!1}),n.identity=function(t){return t},n.keys=function(t){if(!n.isObject(t))return[];if(i)return i(t);var e=[];for(var r in t)e.push(r);return e},n.isObject=function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},n.isArray=o||function(t){return"[object Array]"===s.call(t)},n.isEmpty=function(t){return null==t||(l(t)&&(n.isArray(t)||n.isString(t)||n.isArguments(t))?0===t.length:0===n.keys(t).length)},n.isNaN=function(t){return n.isNumber(t)&&isNaN(t)},t.exports=n}).call(e,n(15))},function(t,e,n){"use strict";function r(t){return Object.prototype.hasOwnProperty.call(t,g)||(t[g]=M++,p[t[g]]={}),p[t[g]]}var o,i=n(7),a=n(83),s=n(284),u=n(136),c=n(316),l=n(94),p={},d=!1,M=0,h={topAbort:"abort",topAnimationEnd:c("animationend")||"animationend",topAnimationIteration:c("animationiteration")||"animationiteration",topAnimationStart:c("animationstart")||"animationstart",topBlur:"blur",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topChange:"change",topClick:"click",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topScroll:"scroll",topSeeked:"seeked",topSeeking:"seeking",topSelectionChange:"selectionchange",topStalled:"stalled",topSuspend:"suspend",topTextInput:"textInput",topTimeUpdate:"timeupdate",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topTransitionEnd:c("transitionend")||"transitionend",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"},g="_reactListenersID"+String(Math.random()).slice(2),f=i({},s,{ReactEventListener:null,injection:{injectReactEventListener:function(t){t.setHandleTopLevel(f.handleTopLevel),f.ReactEventListener=t}},setEnabled:function(t){f.ReactEventListener&&f.ReactEventListener.setEnabled(t)},isEnabled:function(){return!(!f.ReactEventListener||!f.ReactEventListener.isEnabled())},listenTo:function(t,e){for(var n=e,o=r(n),i=a.registrationNameDependencies[t],s=0;s<i.length;s++){var u=i[s];o.hasOwnProperty(u)&&o[u]||("topWheel"===u?l("wheel")?f.ReactEventListener.trapBubbledEvent("topWheel","wheel",n):l("mousewheel")?f.ReactEventListener.trapBubbledEvent("topWheel","mousewheel",n):f.ReactEventListener.trapBubbledEvent("topWheel","DOMMouseScroll",n):"topScroll"===u?l("scroll",!0)?f.ReactEventListener.trapCapturedEvent("topScroll","scroll",n):f.ReactEventListener.trapBubbledEvent("topScroll","scroll",f.ReactEventListener.WINDOW_HANDLE):"topFocus"===u||"topBlur"===u?(l("focus",!0)?(f.ReactEventListener.trapCapturedEvent("topFocus","focus",n),f.ReactEventListener.trapCapturedEvent("topBlur","blur",n)):l("focusin")&&(f.ReactEventListener.trapBubbledEvent("topFocus","focusin",n),f.ReactEventListener.trapBubbledEvent("topBlur","focusout",n)),o.topBlur=!0,o.topFocus=!0):h.hasOwnProperty(u)&&f.ReactEventListener.trapBubbledEvent(u,h[u],n),o[u]=!0)}},trapBubbledEvent:function(t,e,n){return f.ReactEventListener.trapBubbledEvent(t,e,n)},trapCapturedEvent:function(t,e,n){return f.ReactEventListener.trapCapturedEvent(t,e,n)},supportsEventPageXY:function(){if(!document.createEvent)return!1;var t=document.createEvent("MouseEvent");return null!=t&&"pageX"in t},ensureScrollValueMonitoring:function(){if(void 0===o&&(o=f.supportsEventPageXY()),!o&&!d){var t=u.refreshScrollValues;f.ReactEventListener.monitorScrollValue(t),d=!0}}});t.exports=f},function(t,e,n){"use strict";function r(t,e,n,r){return o.call(this,t,e,n,r)}var o=n(45),i=n(136),a=n(92),s={screenX:null,screenY:null,clientX:null,clientY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:a,button:function(t){var e=t.button;return"which"in t?e:2===e?2:4===e?1:0},buttons:null,relatedTarget:function(t){return t.relatedTarget||(t.fromElement===t.srcElement?t.toElement:t.fromElement)},pageX:function(t){return"pageX"in t?t.pageX:t.clientX+i.currentScrollLeft},pageY:function(t){return"pageY"in t?t.pageY:t.clientY+i.currentScrollTop}};o.augmentClass(r,s),t.exports=r},function(t,e,n){"use strict";var r=n(5),o=(n(3),{}),i={reinitializeTransaction:function(){this.transactionWrappers=this.getTransactionWrappers(),this.wrapperInitData?this.wrapperInitData.length=0:this.wrapperInitData=[],this._isInTransaction=!1},_isInTransaction:!1,getTransactionWrappers:null,isInTransaction:function(){return!!this._isInTransaction},perform:function(t,e,n,o,i,a,s,u){this.isInTransaction()&&r("27");var c,l;try{this._isInTransaction=!0,c=!0,this.initializeAll(0),l=t.call(e,n,o,i,a,s,u),c=!1}finally{try{if(c)try{this.closeAll(0)}catch(t){}else this.closeAll(0)}finally{this._isInTransaction=!1}}return l},initializeAll:function(t){for(var e=this.transactionWrappers,n=t;n<e.length;n++){var r=e[n];try{this.wrapperInitData[n]=o,this.wrapperInitData[n]=r.initialize?r.initialize.call(this):null}finally{if(this.wrapperInitData[n]===o)try{this.initializeAll(n+1)}catch(t){}}}},closeAll:function(t){this.isInTransaction()||r("28");for(var e=this.transactionWrappers,n=t;n<e.length;n++){var i,a=e[n],s=this.wrapperInitData[n];try{i=!0,s!==o&&a.close&&a.close.call(this,s),i=!1}finally{if(i)try{this.closeAll(n+1)}catch(t){}}}this.wrapperInitData.length=0}};t.exports=i},function(t,e,n){"use strict";function r(t){var e=""+t,n=i.exec(e);if(!n)return e;var r,o="",a=0,s=0;for(a=n.index;a<e.length;a++){switch(e.charCodeAt(a)){case 34:r=""";break;case 38:r="&";break;case 39:r="'";break;case 60:r="<";break;case 62:r=">";break;default:continue}s!==a&&(o+=e.substring(s,a)),s=a+1,o+=r}return s!==a?o+e.substring(s,a):o}function o(t){return"boolean"==typeof t||"number"==typeof t?""+t:r(t)}var i=/["'&<>]/;t.exports=o},function(t,e,n){"use strict";var r,o=n(13),i=n(82),a=/^[ \r\n\t\f]/,s=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,u=n(90),c=u(function(t,e){if(t.namespaceURI!==i.svg||"innerHTML"in t)t.innerHTML=e;else{r=r||document.createElement("div"),r.innerHTML="<svg>"+e+"</svg>";for(var n=r.firstChild;n.firstChild;)t.appendChild(n.firstChild)}});if(o.canUseDOM){var l=document.createElement("div");l.innerHTML=" ",""===l.innerHTML&&(c=function(t,e){if(t.parentNode&&t.parentNode.replaceChild(t,t),a.test(e)||"<"===e[0]&&s.test(e)){t.innerHTML=String.fromCharCode(65279)+e;var n=t.firstChild;1===n.data.length?t.removeChild(n):n.deleteData(0,1)}else t.innerHTML=e}),l=null}t.exports=c},function(t,e,n){"use strict";function r(t){"@babel/helpers - typeof";return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t){if(!("string"==typeof t||t instanceof String)){var e=r(t);throw null===t?e="null":"object"===e&&(e=t.constructor.name),new TypeError("Expected a string but received a ".concat(e))}}Object.defineProperty(e,"__esModule",{value:!0}),e.default=o,t.exports=e.default,t.exports.default=e.default},function(t,e,n){"use strict";var r=n(0),o=n.n(r),i=function(t){var e=t.checkHandler,n=t.checked,r=t.children,i=t.showCheckbox;return e?o.a.createElement("span",{className:"auth0-lock-sign-up-terms-agreement"},o.a.createElement("label",null,i&&o.a.createElement("input",{type:"checkbox",onChange:e,checked:n}),r)):r};e.a=i},function(t,e,n){"use strict";function r(t,e){n.i(c.b)(c.c,"lock",t,l.l,e)}function o(t){n.i(c.b)(c.c,"lock",t,function(t){return t=n.i(l.l)(t,!1),t=n.i(p.a)(t)})}function i(t,e){return h.auth.connectionScopes(t).get(e.get("name"))}function a(t){var e=n.i(c.d)(c.e,"lock",t),r=n.i(p.c)(e,n.i(g.l)(e)?"email":"username"),o=n.i(l.m)(e,r),a=n.i(l.n)(e),d=i(e,o||a),M={connection_scope:d?d.toJS():void 0};if(o&&!n.i(l.i)(e))return u(t,o,M);s(t,M)}function s(t,e){var r=n.i(c.d)(c.e,"lock",t),o=n.i(l.i)(r)||!n.i(g.l)(r)?"username":"email",i=n.i(p.c)(r,o),a=n.i(l.n)(r),s=h.defaultADUsernameFromEmailPrefix(r)?n.i(d.b)(i):i;n.i(M.h)(t,["password",o],f({},e,{connection:a?a.get("name"):null,username:s,password:n.i(p.c)(r,"password"),login_hint:s}))}function u(t,e,r){var o=n.i(c.d)(c.e,"lock",t),i=n.i(g.l)(o)?"email":"username";h.emitEvent(o,"sso login",{lockID:t,connection:e,field:i}),n.i(M.h)(t,[i],f({},r,{connection:e.get("name"),login_hint:n.i(p.c)(o,i)}))}e.a=r,e.c=o,e.b=a;var c=n(8),l=n(16),p=n(4),d=n(23),M=n(17),h=n(1),g=n(10),f=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}},function(t,e,n){"use strict";function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(null==t.username)return null;var e=f({},D,t),n=D.username.min,r=D.username.max;return e.username.min=parseInt(e.username.min,10)||n,e.username.max=parseInt(e.username.max,10)||r,e.username.min>e.username.max&&(e.username.min=n,e.username.max=r),e}function o(t,e,n){return N(t,i(e,n))}function i(t,e){return new p.a.fromJS({connections:a(t,e),defaultDirectory:e.defaultDirectory||null})}function a(t,e){var n=j.toJS(),r=Object.keys(e.connections).filter(function(t){return"passwordless"!=t}),o=null;return e.clientsConnections&&e.clientsConnections[t]&&(o=e.clientsConnections[t]),r.forEach(function(t){var r,i=e.connections[t].map(function(e){return s(t,e)}).filter(function(t){return null===o||o.includes(t.name)});(r=n[t]).push.apply(r,i)}),n}function s(t,e){var n={name:e.name,strategy:e.strategy,type:t};return"database"===t&&(e.validation&&e.validation.passwordPolicy&&(n.passwordPolicy=e.validation.passwordPolicy),n.passwordPolicy=M.a[n.passwordPolicy||"none"],n.allowSignup="boolean"!=typeof e.allowSignup||e.allowSignup,n.allowForgot="boolean"!=typeof e.allowForgot||e.allowForgot,n.requireUsername="boolean"==typeof e.requiresUsername&&e.requiresUsername,n.validation=r(e.validation)),"enterprise"===t&&(n.domains=e.domains),n}function u(t){var e=c(t);return e&&g.findConnection(t,e)}function c(t){return m(t,"defaultDirectory",null)}e.c=o,e.b=u,e.a=c;var l=n(11),p=n.n(l),d=n(100),M=n.n(d),h=n(20),g=n(1),f=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},y=n.i(h.a)(["client"]),N=y.initNS,m=y.get,D={username:{min:1,max:15}},j=p.a.fromJS({database:[],enterprise:[],passwordless:[],social:[],unknown:[]})},function(t,e,n){"use strict";function r(t,e,n,r){for(var o=arguments.length,i=Array(o>4?o-4:0),a=4;a<o;a++)i[a-4]=arguments[a];u.b.apply(void 0,[u.c,"lock",t,c.e,e,n,r].concat(i))}function o(t,e,r,o){n.i(u.b)(u.c,"lock",t,function(t){return t.setIn(["field","selecting","name"],e).setIn(["field","selecting","iconUrl"],r).setIn(["field","selecting","icon"],o)})}function i(t,e,r){n.i(u.b)(u.c,"lock",t,function(t){return n.i(c.f)(t.deleteIn(["field","selecting"]),e,r)})}function a(t){n.i(u.b)(u.c,"lock",t,function(t){return t.deleteIn(["field","selecting"])})}e.d=r,e.c=o,e.a=i,e.b=a;var s=n(11),u=(n.n(s),n(8)),c=n(4)},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=n(72),p=n(4),d=n(8),M=n(1),h=n(191),g=function(t){function e(){var i,a,s;r(this,e);for(var u=arguments.length,c=Array(u),l=0;l<u;l++)c[l]=arguments[l];return i=a=o(this,t.call.apply(t,[this].concat(c))),a.handleChange=function(t){var e=a.props,r=e.lock,o=e.policy;n.i(d.b)(d.c,"lock",M.id(r),h.a,t.target.value,o)},a.handleShowPasswordChange=function(t){var e=a.props.lock;n.i(d.b)(d.c,"lock",M.id(e),h.b,t.target.checked)},s=i,o(a,s)}return i(e,t),e.prototype.render=function(){var t=this.props,e=t.i18n,n=t.lock,r=t.placeholder,o=t.policy,i=t.strengthMessages,a=t.hidden,s=a?" auth0-lock-hidden":"",u=p.c(n,"password")?e.str("invalidErrorHint")||e.str("invalidPasswordErrorHint"):e.str("blankErrorHint")||e.str("blankPasswordErrorHint");return c.a.createElement("div",{className:"auth0-lock-input-block auth0-lock-input-show-password"+s},c.a.createElement(l.b,{value:p.c(n,"password"),invalidHint:u,showPasswordStrengthMessage:!p.j(n,"password"),isValid:!p.k(n,"password"),onChange:this.handleChange,placeholder:r,strengthMessages:i,disabled:M.submitting(n),policy:o,showPassword:p.c(n,"showPassword",!1),lock:n}),M.ui.allowShowPassword(n)&&c.a.createElement("div",{className:"auth0-lock-show-password"},c.a.createElement("input",{type:"checkbox",id:"slideOne",onChange:this.handleShowPasswordChange}),c.a.createElement("label",{htmlFor:"slideOne",title:e.str("showPassword")})))},e}(c.a.Component);e.a=g,g.propTypes={i18n:s.a.object.isRequired,lock:s.a.object.isRequired,onChange:s.a.func,placeholder:s.a.string.isRequired,policy:s.a.object,strengthMessages:s.a.object,hidden:s.a.bool}},function(t,e,n){"use strict";function r(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d.username,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!e||null==r)return p()(t).length>0;var i=p()(t.toLowerCase());if(i.length<r.min)return!1;if(i.length>r.max)return!1;if(o&&!0===n.i(u.e)(t))return!1;var a=M.exec(i);return!(!a||!a[0])}function o(t){var e=n.i(c.r)(t).getIn(["validation","username"]);return e?e.toJS():null}function i(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"username",c=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],l=arguments.length>4&&void 0!==arguments[4]&&arguments[4],p=c?o(t):null,d=function(t){switch(i){case"email":return n.i(u.e)(t);case"username":return r(t,c,p,l);default:return a(t)?n.i(u.e)(t):r(t,c,p,l)}};return n.i(s.e)(t,"username",e,d)}function a(t){return t.indexOf("@")>-1&&t.indexOf(".")>-1}e.b=o,e.a=i,e.c=a;var s=n(4),u=n(23),c=n(10),l=n(32),p=n.n(l),d={username:{min:1,max:15}},M=/^[a-zA-Z0-9_+\-.!#\$\^`~@']*$/},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=n(211),p=n(4),d=n(8),M=n(1),h=n(69),g=n(102),f=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.componentDidMount=function(t){var e=this.props,r=e.lock,o=e.validateFormat,i=e.usernameStyle,a=e.strictValidation;M.ui.avatar(r)&&p.q(r)&&n.i(g.a)(M.id(r),p.q(r)),n.i(d.b)(d.c,"lock",M.id(r),h.a,p.q(r),i,o,a)},e.prototype.handleChange=function(t){var e=this.props,r=e.lock,o=e.validateFormat,i=e.usernameStyle,a=e.strictValidation;M.ui.avatar(r)&&n.i(g.b)(M.id(r),t.target.value),n.i(d.b)(d.c,"lock",M.id(r),h.a,t.target.value,i,o,a)},e.prototype.render=function(){var t=this.props,e=t.i18n,r=t.lock,o=t.placeholder,i=t.validateFormat,a=M.ui.allowAutocomplete(r),s=p.c(r,"username"),u=i?n.i(h.b)(r):{},d=function(t){return t?n.i(h.c)(t)||!i?e.str("invalidErrorHint")?"invalidErrorHint":"invalidUsernameErrorHint":"usernameFormatErrorHint":e.str("blankErrorHint")?"blankErrorHint":"blankUsernameErrorHint"};return c.a.createElement(l.a,{value:s,invalidHint:function(t){var n=d(t);return"usernameFormatErrorHint"===n&&i&&null!=u?e.str(n,u.min,u.max):e.str(n)}(s),isValid:!p.k(r,"username"),onChange:this.handleChange.bind(this),placeholder:o,autoComplete:a,disabled:M.submitting(r)})},e}(c.a.Component);e.a=f,f.propTypes={i18n:s.a.object.isRequired,lock:s.a.object.isRequired,placeholder:s.a.string.isRequired,validateFormat:s.a.bool.isRequired,usernameStyle:s.a.oneOf(["any","email","username"]),strictValidation:s.a.bool.isRequired},f.defaultProps={validateFormat:!1,usernameStyle:"username"}},function(t,e,n){"use strict";function r(t,e){return u(t,"skipped",e)}function o(t){return s(t,"skipped",!1)}e.b=r,e.a=o;var i=n(20),a=n.i(i.a)(["quickAuth"]),s=a.tget,u=a.tset},function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}n.d(e,"a",function(){return g});var s=n(2),u=n.n(s),c=n(0),l=n.n(c),p=n(24),d=n(209),M=n(1),h=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},g=l.a.createElement("svg",{"aria-hidden":"true",focusable:"false",width:"11px",height:"14px",viewBox:"0 0 13 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",className:"auth0-lock-icon auth0-lock-icon-box"},l.a.createElement("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},l.a.createElement("g",{transform:"translate(-288.000000, -1508.000000)",fill:"#888888"},l.a.createElement("path",{d:"M299,1523.998 L290,1523.998 C288.896,1523.998 288,1523.102 288,1521.999 L288,1515.999 C288,1514.895 288.896,1513.998 290,1513.998 L290,1513.998 L290,1512.499 C290,1510.015 292.015,1507.999 294.5,1507.999 C296.985,1507.999 299,1510.015 299,1512.499 L299,1513.999 C300.104,1513.999 301,1514.895 301,1515.999 L301,1521.999 C301,1523.103 300.104,1523.998 299,1523.998 L299,1523.998 Z M298,1512.499 C298,1510.566 296.433,1508.999 294.5,1508.999 C292.567,1508.999 291,1510.566 291,1512.499 L291,1513.998 L298,1513.998 L298,1512.499 L298,1512.499 Z M300,1515.999 C300,1515.446 299.552,1514.998 299,1514.998 L290,1514.998 C289.447,1514.998 289,1515.446 289,1515.999 L289,1521.999 C289,1522.551 289.447,1522.998 290,1522.998 L299,1522.998 C299.552,1522.998 300,1522.551 300,1521.999 L300,1515.999 L300,1515.999 Z M294.5,1520.998 C294.224,1520.998 294,1520.774 294,1520.498 L294,1517.498 C294,1517.223 294.224,1516.999 294.5,1516.999 C294.776,1516.999 295,1517.223 295,1517.498 L295,1520.498 C295,1520.774 294.776,1520.998 294.5,1520.998 L294.5,1520.998 Z"})))),f=function(t){function e(n){o(this,e);var r=i(this,t.call(this,n));return r.state={},r}return a(e,t),e.prototype.focus=function(){this.refs.input&&this.refs.input.focus()},e.prototype.hasFocus=function(){return this.state.focused},e.prototype.render=function(){var t=this.props,e=t.invalidHint,n=t.showPasswordStrengthMessage,o=t.isValid,i=(t.onChange,t.policy),a=t.strengthMessages,s=t.value,u=t.showPassword,c=t.lock,f=r(t,["invalidHint","showPasswordStrengthMessage","isValid","onChange","policy","strengthMessages","value","showPassword","lock"]),y=this.state,N=y.focused,m=y.changing,D=M.ui.allowPasswordAutocomplete(c),j=i&&N&&m&&n?l.a.createElement(d.a,{messages:a,password:s,policy:i}):null;return l.a.createElement(p.a,{after:j,focused:N,invalidHint:e,isValid:o,name:"password",icon:g},l.a.createElement("input",h({ref:"input",type:u?"text":"password",name:"password",className:"auth0-lock-input",autoComplete:D?"on":"off",autoCapitalize:"off",onChange:this.handleOnChange.bind(this),onFocus:this.handleFocus.bind(this),onBlur:this.handleBlur.bind(this),value:s,"aria-label":"Password","aria-invalid":!o,"aria-describedby":o||i||!e?void 0:"auth0-lock-error-msg-password"},f)))},e.prototype.handleOnChange=function(t){var e=this.state;e.changing=!0,this.setState(e),this.props.onChange&&this.props.onChange(t)},e.prototype.handleFocus=function(){this.setState({focused:!0})},e.prototype.handleBlur=function(){this.setState({focused:!1})},e}(l.a.Component);f.propTypes={invalidHint:u.a.string.isRequired,showPasswordStrengthMessage:u.a.bool.isRequired,isValid:u.a.bool.isRequired,onChange:u.a.func.isRequired,placeholder:u.a.string,policy:u.a.object,strengthMessages:u.a.object,value:u.a.string.isRequired,showPassword:u.a.bool.isRequired,lock:u.a.object.isRequired},e.b=f},function(t,e,n){"use strict";var r=n(2),o=n.n(r),i=n(0),a=n.n(i),s=n(113),u=function(t){var e=t.alternativeLabel,n=t.alternativeClickHandler,r=t.buttonLabel,o=t.buttonClickHandler,i=t.header,u=t.strategy,c=t.buttonIcon,l=t.primaryColor,p=t.foregroundColor,d=e?a.a.createElement("p",{className:"auth0-lock-alternative"},a.a.createElement("a",{className:"auth0-lock-alternative-link",href:"#",onClick:function(t){t.preventDefault(),n(t)}},e)):null;return a.a.createElement("div",{className:"auth0-lock-last-login-pane"},i,a.a.createElement(s.a,{label:r,onClick:function(t){t.preventDefault(),o(t)},strategy:u,primaryColor:l,foregroundColor:p,icon:c}),d,a.a.createElement("div",{className:"auth0-loading-container"},a.a.createElement("div",{className:"auth0-loading"})))};u.propTypes={alternativeLabel:o.a.string,alternativeClickHandler:function(t,e,n){for(var r=arguments.length,i=Array(r>3?r-3:0),a=3;a<r;a++)i[a-3]=arguments[a];if(void 0!==t.alternativeLabel){var s;return(s=o.a.func).isRequired.apply(s,[t,e,n].concat(i))}},buttonLabel:o.a.string.isRequired,buttonClickHandler:o.a.func.isRequired,header:o.a.element,strategy:o.a.string.isRequired},e.a=u},function(t,e,n){"use strict";(function(t){function r(e){var n=e.cb,r=e.check,o=e.method,a=e.url;if(i[o]||(i[o]=[],t.Auth0[o]=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];i[o]=i[o].filter(function(t){return!t.check.apply(t,e)||(setTimeout(function(){return t.cb.apply(t,[null].concat(e))},0),!1)})}),i[o].push({cb:n,check:r,url:a}),!(i[o].reduce(function(t,e){return t+(e.url===a?1:0)},0)>1)){var s=t.document.createElement("script");s.src=a,t.document.getElementsByTagName("head")[0].appendChild(s);var u=function(t){i[o]=i[o].filter(function(e){return e.url!==a||(setTimeout(function(){return e.cb(t)},0),!1)})},c=setTimeout(function(){return u(new Error(a+" timed out"))},2e4);s.addEventListener("load",function(){return clearTimeout(c)}),s.addEventListener("error",function(){clearTimeout(c),u(new Error(a+" could not be loaded."))})}}function o(e){var n=e.method,r=e.cb;t.Auth0[n]=r}e.a=r,e.b=o;n(99);t.Auth0||(t.Auth0={});var i={}}).call(e,n(15))},function(t,e,n){"use strict";var r={};t.exports=r},function(t,e,n){"use strict";function r(t,e){return t===e?0!==t||0!==e||1/t==1/e:t!==t&&e!==e}function o(t,e){if(r(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;var n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(var a=0;a<n.length;a++)if(!i.call(e,n[a])||!r(t[n[a]],e[n[a]]))return!1;return!0}var i=Object.prototype.hasOwnProperty;t.exports=o},function(t,e,n){(function(t){function r(t,n){var r={seen:[],stylize:i};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),h(n)?r.showHidden=n:n&&e._extend(r,n),D(r.showHidden)&&(r.showHidden=!1),D(r.depth)&&(r.depth=2),D(r.colors)&&(r.colors=!1),D(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),s(r,t,r.depth)}function o(t,e){var n=r.styles[e];return n?"["+r.colors[n][0]+"m"+t+"["+r.colors[n][1]+"m":t}function i(t,e){return t}function a(t){var e={};return t.forEach(function(t,n){e[t]=!0}),e}function s(t,n,r){if(t.customInspect&&n&&v(n.inspect)&&n.inspect!==e.inspect&&(!n.constructor||n.constructor.prototype!==n)){var o=n.inspect(r,t);return N(o)||(o=s(t,o,r)),o}var i=u(t,n);if(i)return i;var h=Object.keys(n),g=a(h);if(t.showHidden&&(h=Object.getOwnPropertyNames(n)),L(n)&&(h.indexOf("message")>=0||h.indexOf("description")>=0))return c(n);if(0===h.length){if(v(n)){var f=n.name?": "+n.name:"";return t.stylize("[Function"+f+"]","special")}if(j(n))return t.stylize(RegExp.prototype.toString.call(n),"regexp");if(w(n))return t.stylize(Date.prototype.toString.call(n),"date");if(L(n))return c(n)}var y="",m=!1,D=["{","}"];if(M(n)&&(m=!0,D=["[","]"]),v(n)){y=" [Function"+(n.name?": "+n.name:"")+"]"}if(j(n)&&(y=" "+RegExp.prototype.toString.call(n)),w(n)&&(y=" "+Date.prototype.toUTCString.call(n)),L(n)&&(y=" "+c(n)),0===h.length&&(!m||0==n.length))return D[0]+y+D[1];if(r<0)return j(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special");t.seen.push(n);var I;return I=m?l(t,n,r,g,h):h.map(function(e){return p(t,n,r,g,e,m)}),t.seen.pop(),d(I,y,D)}function u(t,e){if(D(e))return t.stylize("undefined","undefined");if(N(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return y(e)?t.stylize(""+e,"number"):h(e)?t.stylize(""+e,"boolean"):g(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function l(t,e,n,r,o){for(var i=[],a=0,s=e.length;a<s;++a)E(e,String(a))?i.push(p(t,e,n,r,String(a),!0)):i.push("");return o.forEach(function(o){o.match(/^\d+$/)||i.push(p(t,e,n,r,o,!0))}),i}function p(t,e,n,r,o,i){var a,u,c;if(c=Object.getOwnPropertyDescriptor(e,o)||{value:e[o]},c.get?u=c.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):c.set&&(u=t.stylize("[Setter]","special")),E(r,o)||(a="["+o+"]"),u||(t.seen.indexOf(c.value)<0?(u=g(n)?s(t,c.value,null):s(t,c.value,n-1),u.indexOf("\n")>-1&&(u=i?u.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+u.split("\n").map(function(t){return" "+t}).join("\n"))):u=t.stylize("[Circular]","special")),D(a)){if(i&&o.match(/^\d+$/))return u;a=JSON.stringify(""+o),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+u}function d(t,e,n){var r=0;return t.reduce(function(t,e){return r++,e.indexOf("\n")>=0&&r++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}function M(t){return Array.isArray(t)}function h(t){return"boolean"==typeof t}function g(t){return null===t}function f(t){return null==t}function y(t){return"number"==typeof t}function N(t){return"string"==typeof t}function m(t){return"symbol"==typeof t}function D(t){return void 0===t}function j(t){return I(t)&&"[object RegExp]"===b(t)}function I(t){return"object"==typeof t&&null!==t}function w(t){return I(t)&&"[object Date]"===b(t)}function L(t){return I(t)&&("[object Error]"===b(t)||t instanceof Error)}function v(t){return"function"==typeof t}function z(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function b(t){return Object.prototype.toString.call(t)}function C(t){return t<10?"0"+t.toString(10):t.toString(10)}function T(){var t=new Date,e=[C(t.getHours()),C(t.getMinutes()),C(t.getSeconds())].join(":");return[t.getDate(),_[t.getMonth()],e].join(" ")}function E(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function x(t,e){if(!t){var n=new Error("Promise was rejected with a falsy value");n.reason=t,t=n}return e(t)}function k(e){function n(){for(var n=[],r=0;r<arguments.length;r++)n.push(arguments[r]);var o=n.pop();if("function"!=typeof o)throw new TypeError("The last argument must be of type Function");var i=this,a=function(){return o.apply(i,arguments)};e.apply(this,n).then(function(e){t.nextTick(a,null,e)},function(e){t.nextTick(x,e,a)})}if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');return Object.setPrototypeOf(n,Object.getPrototypeOf(e)),Object.defineProperties(n,O(e)),n}var O=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),n={},r=0;r<e.length;r++)n[e[r]]=Object.getOwnPropertyDescriptor(t,e[r]);return n},S=/%[sdj%]/g;e.format=function(t){if(!N(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(r(arguments[n]));return e.join(" ")}for(var n=1,o=arguments,i=o.length,a=String(t).replace(S,function(t){if("%%"===t)return"%";if(n>=i)return t;switch(t){case"%s":return String(o[n++]);case"%d":return Number(o[n++]);case"%j":try{return JSON.stringify(o[n++])}catch(t){return"[Circular]"}default:return t}}),s=o[n];n<i;s=o[++n])g(s)||!I(s)?a+=" "+s:a+=" "+r(s);return a},e.deprecate=function(n,r){function o(){if(!i){if(t.throwDeprecation)throw new Error(r);t.traceDeprecation?console.trace(r):console.error(r),i=!0}return n.apply(this,arguments)}if(void 0!==t&&!0===t.noDeprecation)return n;if(void 0===t)return function(){return e.deprecate(n,r).apply(this,arguments)};var i=!1;return o};var A,U={};e.debuglog=function(r){if(D(A)&&(A=n.i({NODE_ENV:"production"}).NODE_DEBUG||""),r=r.toUpperCase(),!U[r])if(new RegExp("\\b"+r+"\\b","i").test(A)){var o=t.pid;U[r]=function(){var t=e.format.apply(e,arguments);console.error("%s %d: %s",r,o,t)}}else U[r]=function(){};return U[r]},e.inspect=r,r.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},r.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=M,e.isBoolean=h,e.isNull=g,e.isNullOrUndefined=f,e.isNumber=y,e.isString=N,e.isSymbol=m,e.isUndefined=D,e.isRegExp=j,e.isObject=I,e.isDate=w,e.isError=L,e.isFunction=v,e.isPrimitive=z,e.isBuffer=n(244);var _=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];e.log=function(){console.log("%s - %s",T(),e.format.apply(e,arguments))},e.inherits=n(243),e._extend=function(t,e){if(!e||!I(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t};var Y="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;e.promisify=function(t){function e(){for(var e,n,r=new Promise(function(t,r){e=t,n=r}),o=[],i=0;i<arguments.length;i++)o.push(arguments[i]);o.push(function(t,r){t?n(t):e(r)});try{t.apply(this,o)}catch(t){n(t)}return r}if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(Y&&t[Y]){var e=t[Y];if("function"!=typeof e)throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,Y,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}return Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Y&&Object.defineProperty(e,Y,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,O(t))},e.promisify.custom=Y,e.callbackify=k}).call(e,n(41))},function(t,e,n){function r(t){return"string"==typeof t||t instanceof String}function o(t,e){function n(t,e){var n=new Array(e+1).join(" "),r=n+"* ";return t.format?r+=a.apply(null,[t.message].concat(t.format)):r+=t.message,t.items&&(r+="\n"+n+o(t.items,e+1)),r}if(!t.length)return"";var r=n(t[0],e);return t=t.slice(1).reduce(function(t,r){return t+="\n"+n(r,e)},r)}function i(t,e){this.rules=t,this.ruleset=e||u,this._reduce(function(t,e,n){n.validate(e)})}var a=n(77).format,s=n(246),u={length:n(249),contains:n(79),containsAtLeast:n(247),identicalChars:n(248)};i.prototype={},i.prototype._reduce=function(t,e){var n=this;return Object.keys(this.rules).reduce(function(e,r){var o=n.rules[r],i=n.ruleset[r];return t(e,o,i)},e)},i.prototype._applyRules=function(t){return this._reduce(function(e,n,r){return!!e&&(!!r&&r.assert(n,t))},!0)},i.prototype.missing=function(t){return this._reduce(function(e,n,r){var o=r.missing(n,t);return e.rules.push(o),e.verified=e.verified&&!!o.verified,e},{rules:[],verified:!0})},i.prototype.explain=function(){return this._reduce(function(t,e,n){return t.push(n.explain(e)),t},[])},i.prototype.missingAsMarkdown=function(t){return o(this.missing(t),1)},i.prototype.toString=function(){return o(this.explain(),0)},i.prototype.check=function(t){return!!r(t)&&this._applyRules(t)},i.prototype.assert=function(t){if(!this.check(t))throw new s("Password does not meet password policy")},t.exports=i},function(t,e,n){var r=n(57),o=[" ","!",'"',"#","\\$","%","&","'","\\(","\\)","\\*","\\+",",","-","\\.","/",":",";","<","=",">","\\?","@","\\[","\\\\","\\]","\\^","_","`","{","\\|","}","~"].join("|"),i=new RegExp(o);t.exports={validate:function(t){if(!r.isObject(t))throw new Error("options should be an object");if(!r.isArray(t.expressions)||r.isEmpty(t.expressions))throw new Error("contains expects expressions to be a non-empty array");if(!t.expressions.every(function(t){return r.isFunction(t.explain)&&r.isFunction(t.test)}))throw new Error("contains expressions are invalid: An explain and a test function should be provided");return!0},explain:function(t){return{message:"Should contain:",code:"shouldContain",items:t.expressions.map(function(t){return t.explain()})}},missing:function(t,e){var n=t.expressions.map(function(t){var n=t.explain();return n.verified=t.test(e),n});return{message:"Should contain:",code:"shouldContain",verified:n.every(function(t){return t.verified}),items:n}},assert:function(t,e){return!!e&&t.expressions.every(function(t){return t.test(e)})},charsets:{upperCase:{explain:function(){return{message:"upper case letters (A-Z)",code:"upperCase"}},test:function(t){return/[A-Z]/.test(t)}},lowerCase:{explain:function(){return{message:"lower case letters (a-z)",code:"lowerCase"}},test:function(t){return/[a-z]/.test(t)}},specialCharacters:{explain:function(){return{message:"special characters (e.g. !@#$%^&*)",code:"specialCharacters"}},test:function(t){return i.test(t)}},numbers:{explain:function(){return{message:"numbers (i.e. 0-9)",code:"numbers"}},test:function(t){return/\d/.test(t)}}}}},function(t,e,n){"use strict";var r=Object.prototype.hasOwnProperty,o=Array.isArray,i=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),a=function(t){for(;t.length>1;){var e=t.pop(),n=e.obj[e.prop];if(o(n)){for(var r=[],i=0;i<n.length;++i)void 0!==n[i]&&r.push(n[i]);e.obj[e.prop]=r}}},s=function(t,e){for(var n=e&&e.plainObjects?Object.create(null):{},r=0;r<t.length;++r)void 0!==t[r]&&(n[r]=t[r]);return n},u=function t(e,n,i){if(!n)return e;if("object"!=typeof n){if(o(e))e.push(n);else{if(!e||"object"!=typeof e)return[e,n];(i&&(i.plainObjects||i.allowPrototypes)||!r.call(Object.prototype,n))&&(e[n]=!0)}return e}if(!e||"object"!=typeof e)return[e].concat(n);var a=e;return o(e)&&!o(n)&&(a=s(e,i)),o(e)&&o(n)?(n.forEach(function(n,o){if(r.call(e,o)){var a=e[o];a&&"object"==typeof a&&n&&"object"==typeof n?e[o]=t(a,n,i):e.push(n)}else e[o]=n}),e):Object.keys(n).reduce(function(e,o){var a=n[o];return r.call(e,o)?e[o]=t(e[o],a,i):e[o]=a,e},a)},c=function(t,e){return Object.keys(e).reduce(function(t,n){return t[n]=e[n],t},t)},l=function(t,e,n){var r=t.replace(/\+/g," ");if("iso-8859-1"===n)return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch(t){return r}},p=function(t,e,n){if(0===t.length)return t;var r=t;if("symbol"==typeof t?r=Symbol.prototype.toString.call(t):"string"!=typeof t&&(r=String(t)),"iso-8859-1"===n)return escape(r).replace(/%u[0-9a-f]{4}/gi,function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"});for(var o="",a=0;a<r.length;++a){var s=r.charCodeAt(a);45===s||46===s||95===s||126===s||s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122?o+=r.charAt(a):s<128?o+=i[s]:s<2048?o+=i[192|s>>6]+i[128|63&s]:s<55296||s>=57344?o+=i[224|s>>12]+i[128|s>>6&63]+i[128|63&s]:(a+=1,s=65536+((1023&s)<<10|1023&r.charCodeAt(a)),o+=i[240|s>>18]+i[128|s>>12&63]+i[128|s>>6&63]+i[128|63&s])}return o},d=function(t){for(var e=[{obj:{o:t},prop:"o"}],n=[],r=0;r<e.length;++r)for(var o=e[r],i=o.obj[o.prop],s=Object.keys(i),u=0;u<s.length;++u){var c=s[u],l=i[c];"object"==typeof l&&null!==l&&-1===n.indexOf(l)&&(e.push({obj:i,prop:c}),n.push(l))}return a(e),t},M=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},h=function(t){return!(!t||"object"!=typeof t)&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},g=function(t,e){return[].concat(t,e)},f=function(t,e){if(o(t)){for(var n=[],r=0;r<t.length;r+=1)n.push(e(t[r]));return n}return e(t)};t.exports={arrayToObject:s,assign:c,combine:g,compact:d,decode:l,encode:p,isBuffer:h,isRegExp:M,maybeMap:f,merge:u}},function(t,e,n){"use strict";function r(t,e){return Array.isArray(e)&&(e=e[1]),e?e.nextSibling:t.firstChild}function o(t,e,n){l.insertTreeBefore(t,e,n)}function i(t,e,n){Array.isArray(e)?s(t,e[0],e[1],n):g(t,e,n)}function a(t,e){if(Array.isArray(e)){var n=e[1];e=e[0],u(t,e,n),t.removeChild(n)}t.removeChild(e)}function s(t,e,n,r){for(var o=e;;){var i=o.nextSibling;if(g(t,o,r),o===n)break;o=i}}function u(t,e,n){for(;;){var r=e.nextSibling;if(r===n)break;t.removeChild(r)}}function c(t,e,n){var r=t.parentNode,o=t.nextSibling;o===e?n&&g(r,document.createTextNode(n),o):n?(h(o,n),u(r,o,e)):u(r,t,e)}var l=n(35),p=n(261),d=(n(9),n(18),n(90)),M=n(62),h=n(144),g=d(function(t,e,n){t.insertBefore(e,n)}),f=p.dangerouslyReplaceNodeWithMarkup,y={dangerouslyReplaceNodeWithMarkup:f,replaceDelimitedText:c,processUpdates:function(t,e){for(var n=0;n<e.length;n++){var s=e[n];switch(s.type){case"INSERT_MARKUP":o(t,s.content,r(t,s.afterNode));break;case"MOVE_EXISTING":i(t,s.fromNode,r(t,s.afterNode));break;case"SET_MARKUP":M(t,s.content);break;case"TEXT_CONTENT":h(t,s.content);break;case"REMOVE_NODE":a(t,s.fromNode)}}}};t.exports=y},function(t,e,n){"use strict";var r={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};t.exports=r},function(t,e,n){"use strict";function r(){if(s)for(var t in u){var e=u[t],n=s.indexOf(t);if(n>-1||a("96",t),!c.plugins[n]){e.extractEvents||a("97",t),c.plugins[n]=e;var r=e.eventTypes;for(var i in r)o(r[i],e,i)||a("98",i,t)}}}function o(t,e,n){c.eventNameDispatchConfigs.hasOwnProperty(n)&&a("99",n),c.eventNameDispatchConfigs[n]=t;var r=t.phasedRegistrationNames;if(r){for(var o in r)if(r.hasOwnProperty(o)){var s=r[o];i(s,e,n)}return!0}return!!t.registrationName&&(i(t.registrationName,e,n),!0)}function i(t,e,n){c.registrationNameModules[t]&&a("100",t),c.registrationNameModules[t]=e,c.registrationNameDependencies[t]=e.eventTypes[n].dependencies}var a=n(5),s=(n(3),null),u={},c={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},possibleRegistrationNames:null,injectEventPluginOrder:function(t){s&&a("101"),s=Array.prototype.slice.call(t),r()},injectEventPluginsByName:function(t){var e=!1;for(var n in t)if(t.hasOwnProperty(n)){var o=t[n];u.hasOwnProperty(n)&&u[n]===o||(u[n]&&a("102",n),u[n]=o,e=!0)}e&&r()},getPluginModuleForEvent:function(t){var e=t.dispatchConfig;if(e.registrationName)return c.registrationNameModules[e.registrationName]||null;if(void 0!==e.phasedRegistrationNames){var n=e.phasedRegistrationNames;for(var r in n)if(n.hasOwnProperty(r)){var o=c.registrationNameModules[n[r]];if(o)return o}}return null},_resetEventPlugins:function(){s=null;for(var t in u)u.hasOwnProperty(t)&&delete u[t];c.plugins.length=0;var e=c.eventNameDispatchConfigs;for(var n in e)e.hasOwnProperty(n)&&delete e[n];var r=c.registrationNameModules;for(var o in r)r.hasOwnProperty(o)&&delete r[o]}};t.exports=c},function(t,e,n){"use strict";function r(t){return"topMouseUp"===t||"topTouchEnd"===t||"topTouchCancel"===t}function o(t){return"topMouseMove"===t||"topTouchMove"===t}function i(t){return"topMouseDown"===t||"topTouchStart"===t}function a(t,e,n,r){var o=t.type||"unknown-event";t.currentTarget=y.getNodeFromInstance(r),e?g.invokeGuardedCallbackWithCatch(o,n,t):g.invokeGuardedCallback(o,n,t),t.currentTarget=null}function s(t,e){var n=t._dispatchListeners,r=t._dispatchInstances;if(Array.isArray(n))for(var o=0;o<n.length&&!t.isPropagationStopped();o++)a(t,e,n[o],r[o]);else n&&a(t,e,n,r);t._dispatchListeners=null,t._dispatchInstances=null}function u(t){var e=t._dispatchListeners,n=t._dispatchInstances;if(Array.isArray(e)){for(var r=0;r<e.length&&!t.isPropagationStopped();r++)if(e[r](t,n[r]))return n[r]}else if(e&&e(t,n))return n;return null}function c(t){var e=u(t);return t._dispatchInstances=null,t._dispatchListeners=null,e}function l(t){var e=t._dispatchListeners,n=t._dispatchInstances;Array.isArray(e)&&h("103"),t.currentTarget=e?y.getNodeFromInstance(n):null;var r=e?e(t):null;return t.currentTarget=null,t._dispatchListeners=null,t._dispatchInstances=null,r}function p(t){return!!t._dispatchListeners}var d,M,h=n(5),g=n(88),f=(n(3),n(6),{injectComponentTree:function(t){d=t},injectTreeTraversal:function(t){M=t}}),y={isEndish:r,isMoveish:o,isStartish:i,executeDirectDispatch:l,executeDispatchesInOrder:s,executeDispatchesInOrderStopAtTrue:c,hasDispatches:p,getInstanceFromNode:function(t){return d.getInstanceFromNode(t)},getNodeFromInstance:function(t){return d.getNodeFromInstance(t)},isAncestor:function(t,e){return M.isAncestor(t,e)},getLowestCommonAncestor:function(t,e){return M.getLowestCommonAncestor(t,e)},getParentInstance:function(t){return M.getParentInstance(t)},traverseTwoPhase:function(t,e,n){return M.traverseTwoPhase(t,e,n)},traverseEnterLeave:function(t,e,n,r,o){return M.traverseEnterLeave(t,e,n,r,o)},injection:f};t.exports=y},function(t,e,n){"use strict";function r(t){var e={"=":"=0",":":"=2"};return"$"+(""+t).replace(/[=:]/g,function(t){return e[t]})}function o(t){var e=/(=0|=2)/g,n={"=0":"=","=2":":"};return(""+("."===t[0]&&"$"===t[1]?t.substring(2):t.substring(1))).replace(e,function(t){return n[t]})}var i={escape:r,unescape:o};t.exports=i},function(t,e,n){"use strict";function r(t){null!=t.checkedLink&&null!=t.valueLink&&s("87")}function o(t){r(t),(null!=t.value||null!=t.onChange)&&s("88")}function i(t){r(t),(null!=t.checked||null!=t.onChange)&&s("89")}function a(t){if(t){var e=t.getName();if(e)return" Check the render method of `"+e+"`."}return""}var s=n(5),u=n(290),c=n(122),l=n(38),p=c(l.isValidElement),d=(n(3),n(6),{button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0}),M={value:function(t,e,n){return!t[e]||d[t.type]||t.onChange||t.readOnly||t.disabled?null:new Error("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.")},checked:function(t,e,n){return!t[e]||t.onChange||t.readOnly||t.disabled?null:new Error("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.")},onChange:p.func},h={},g={checkPropTypes:function(t,e,n){for(var r in M){if(M.hasOwnProperty(r))var o=M[r](e,r,t,"prop",null,u);if(o instanceof Error&&!(o.message in h)){h[o.message]=!0;a(n)}}},getValue:function(t){return t.valueLink?(o(t),t.valueLink.value):t.value},getChecked:function(t){return t.checkedLink?(i(t),t.checkedLink.value):t.checked},executeOnChange:function(t,e){return t.valueLink?(o(t),t.valueLink.requestChange(e.target.value)):t.checkedLink?(i(t),t.checkedLink.requestChange(e.target.checked)):t.onChange?t.onChange.call(void 0,e):void 0}};t.exports=g},function(t,e,n){"use strict";var r=n(5),o=(n(3),!1),i={replaceNodeWithMarkup:null,processChildrenUpdates:null,injection:{injectEnvironment:function(t){o&&r("104"),i.replaceNodeWithMarkup=t.replaceNodeWithMarkup,i.processChildrenUpdates=t.processChildrenUpdates,o=!0}}};t.exports=i},function(t,e,n){"use strict";function r(t,e,n){try{e(n)}catch(t){null===o&&(o=t)}}var o=null,i={invokeGuardedCallback:r,invokeGuardedCallbackWithCatch:r,rethrowCaughtError:function(){if(o){var t=o;throw o=null,t}}};t.exports=i},function(t,e,n){"use strict";function r(t){u.enqueueUpdate(t)}function o(t){var e=typeof t;if("object"!==e)return e;var n=t.constructor&&t.constructor.name||e,r=Object.keys(t);return r.length>0&&r.length<20?n+" (keys: "+r.join(", ")+")":n}function i(t,e){var n=s.get(t);if(!n){return null}return n}var a=n(5),s=(n(26),n(44)),u=(n(18),n(22)),c=(n(3),n(6),{isMounted:function(t){var e=s.get(t);return!!e&&!!e._renderedComponent},enqueueCallback:function(t,e,n){c.validateCallback(e,n);var o=i(t);if(!o)return null;o._pendingCallbacks?o._pendingCallbacks.push(e):o._pendingCallbacks=[e],r(o)},enqueueCallbackInternal:function(t,e){t._pendingCallbacks?t._pendingCallbacks.push(e):t._pendingCallbacks=[e],r(t)},enqueueForceUpdate:function(t){var e=i(t,"forceUpdate");e&&(e._pendingForceUpdate=!0,r(e))},enqueueReplaceState:function(t,e,n){var o=i(t,"replaceState");o&&(o._pendingStateQueue=[e],o._pendingReplaceState=!0,void 0!==n&&null!==n&&(c.validateCallback(n,"replaceState"),o._pendingCallbacks?o._pendingCallbacks.push(n):o._pendingCallbacks=[n]),r(o))},enqueueSetState:function(t,e){var n=i(t,"setState");if(n){(n._pendingStateQueue||(n._pendingStateQueue=[])).push(e),r(n)}},enqueueElementInternal:function(t,e,n){t._pendingElement=e,t._context=n,r(t)},validateCallback:function(t,e){t&&"function"!=typeof t&&a("122",e,o(t))}});t.exports=c},function(t,e,n){"use strict";var r=function(t){return"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,n,r,o){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,o)})}:t};t.exports=r},function(t,e,n){"use strict";function r(t){var e,n=t.keyCode;return"charCode"in t?0===(e=t.charCode)&&13===n&&(e=13):e=n,e>=32||13===e?e:0}t.exports=r},function(t,e,n){"use strict";function r(t){var e=this,n=e.nativeEvent;if(n.getModifierState)return n.getModifierState(t);var r=i[t];return!!r&&!!n[r]}function o(t){return r}var i={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};t.exports=o},function(t,e,n){"use strict";function r(t){var e=t.target||t.srcElement||window;return e.correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}t.exports=r},function(t,e,n){"use strict";function r(t,e){if(!i.canUseDOM||e&&!("addEventListener"in document))return!1;var n="on"+t,r=n in document;if(!r){var a=document.createElement("div");a.setAttribute(n,"return;"),r="function"==typeof a[n]}return!r&&o&&"wheel"===t&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var o,i=n(13);i.canUseDOM&&(o=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("","")),t.exports=r},function(t,e,n){"use strict";function r(t,e){var n=null===t||!1===t,r=null===e||!1===e;if(n||r)return n===r;var o=typeof t,i=typeof e;return"string"===o||"number"===o?"string"===i||"number"===i:"object"===i&&t.type===e.type&&t.key===e.key}t.exports=r},function(t,e,n){"use strict";var r=(n(7),n(21)),o=(n(6),r);t.exports=o},function(t,e,n){"use strict";var r=n(198),o=n(98);o.a,r.a;e.a=r.a},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(105),s=n(183),u=function(t){function e(i,u,c){r(this,e);var l=o(this,t.call(this,i,u,c,s.a));return n.i(a.a)(),n.i(a.b)(),window.addEventListener("resize",function(){n.i(a.b)()}),l}return i(e,t),e}(a.c);e.a=u,u.version="11.30.1"},function(t,e,n){"use strict";(function(t,n){function r(t,e){return t(e={exports:{}},e.exports),e.exports}function o(t,e,n){var r;for(function t(e,n,r,o){var i;if("object"==typeof e&&null!==e){for(i=0;i<r.length;i++)if(r[i]===e){var a=Object.getOwnPropertyDescriptor(o,n);return void(void 0!==a.get?a.configurable?(Object.defineProperty(o,n,{value:"[Circular]"}),Zt.push([o,n,e,a])):Ht.push([e,n]):(o[n]="[Circular]",Zt.push([o,n,e])))}if(r.push(e),Array.isArray(e))for(i=0;i<e.length;i++)t(e[i],i,r,e);else{var s=Object.keys(e);for(i=0;i<s.length;i++){var u=s[i];t(e[u],u,r,e)}}r.pop()}}(t,"",[],void 0),r=0===Ht.length?JSON.stringify(t,e,n):JSON.stringify(t,s(e),n);0!==Zt.length;){var o=Zt.pop();4===o.length?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}return r}function i(t,e){return t<e?-1:t>e?1:0}function a(t,e,n){var r,o=function t(e,n,r,o){var a;if("object"==typeof e&&null!==e){for(a=0;a<r.length;a++)if(r[a]===e){var s=Object.getOwnPropertyDescriptor(o,n);return void(void 0!==s.get?s.configurable?(Object.defineProperty(o,n,{value:"[Circular]"}),Zt.push([o,n,e,s])):Ht.push([e,n]):(o[n]="[Circular]",Zt.push([o,n,e])))}if("function"==typeof e.toJSON)return;if(r.push(e),Array.isArray(e))for(a=0;a<e.length;a++)t(e[a],a,r,e);else{var u={},c=Object.keys(e).sort(i);for(a=0;a<c.length;a++){var l=c[a];t(e[l],l,r,e),u[l]=e[l]}if(void 0===o)return u;Zt.push([o,n,e]),o[n]=u}r.pop()}}(t,"",[],void 0)||t;for(r=0===Ht.length?JSON.stringify(o,e,n):JSON.stringify(o,s(e),n);0!==Zt.length;){var a=Zt.pop();4===a.length?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}return r}function s(t){return t=void 0!==t?t:function(t,e){return e},function(e,n){if(Ht.length>0)for(var r=0;r<Ht.length;r++){var o=Ht[r];if(o[1]===e&&o[0]===n){n="[Circular]",Ht.splice(r,1);break}}return t.call(this,e,n)}}function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t){if(t)return function(t){for(var e in l.prototype)Object.prototype.hasOwnProperty.call(l.prototype,e)&&(t[e]=l.prototype[e]);return t}(t)}function p(t){if(t)return function(t){for(var e in p.prototype)Object.prototype.hasOwnProperty.call(p.prototype,e)&&(t[e]=p.prototype[e]);return t}(t)}function d(t){return function(t){if(Array.isArray(t))return M(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return M(t,void 0);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?M(t,void 0):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function h(){this._defaults=[]}function g(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function f(t,e,n){for(var r,o,i=[],a=e;a<n;a+=3)r=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),i.push(oe[(o=r)>>18&63]+oe[o>>12&63]+oe[o>>6&63]+oe[63&o]);return i.join("")}function y(t,e,n,r){if(n="array"===n?"object":n,t&&typeof t[e]!==n)throw new Error(r)}function N(t,e,n){if(typeof t!==e)throw new Error(n)}function m(t,e,n){if(-1===e.indexOf(t))throw new Error(n)}function D(t){if(null==t)throw new TypeError("Cannot convert first argument to object");for(var e=Object(t),n=1;n<arguments.length;n++){var r=arguments[n];if(null!=r)for(var o=Object.keys(Object(r)),i=0,a=o.length;i<a;i++){var s=o[i],u=Object.getOwnPropertyDescriptor(r,s);void 0!==u&&u.enumerable&&(e[s]=r[s])}}return e}function j(t,e){return e.reduce(function(e,n){return t[n]&&(e[n]=t[n]),e},{})}function I(t){var e=[];for(var n in t)e.push(t[n]);return e}function w(){var t=I(arguments);return t.unshift({}),ge.get().apply(void 0,t)}function L(t){var e=t.match(/^(https?:|file:|chrome-extension:)\/\/(([^:\/?#]*)(?::([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/);return e&&{href:t,protocol:e[1],host:e[2],hostname:e[3],port:e[4],pathname:e[5],search:e[6],hash:e[7]}}function v(t,e){var n=w(t);return t[e]&&(n[e]=t[e].trim()),n}function z(t){this.request=t,this.method=t.method,this.url=t.url,this.body=t._data,this.headers=t._header}function b(t){this.request=t}function C(t){this._sendTelemetry=!1!==t._sendTelemetry||t._sendTelemetry,this._telemetryInfo=t._telemetryInfo||null,this._timesToRetryFailedRequests=t._timesToRetryFailedRequests,this.headers=t.headers||{},this._universalLoginPage=t.universalLoginPage}function T(){return window}function E(){}function x(){}function k(t){this.disableWarnings=t.disableWarnings}function O(t){if(this.warn=new k({}),this.storage=new x,!0===t.__tryLocalStorageFirst)try{var e=ye.getWindow().localStorage;e&&(this.storage=e)}catch(t){this.warn.warning(t),this.warn.warning("Can't use localStorage. Using CookieStorage instead.")}}function S(t){this.handler=new O(t)}function A(t){this.storage=new S(t)}function U(t,e){return{error:t,errorDescription:e}}function _(t,e){return(e=e||{}).ignoreCasing=!!e.ignoreCasing&&e.ignoreCasing,function(n,r){var o;return n||r?(!n&&r.err&&(n=r.err,r=null),!n&&r.error&&(n=r,r=null),n?(o={original:n},fe.updatePropertyOn(o,"original.response.req._data.password","*****"),n.response&&n.response.statusCode&&(o.statusCode=n.response.statusCode),n.response&&n.response.statusText&&(o.statusText=n.response.statusText),n.response&&n.response.body&&(n=n.response.body),n.err&&(n=n.err),o.code=n.code||n.error||n.error_code||n.status||null,o.description=n.errorDescription||n.error_description||n.description||n.error||n.details||n.err||null,e.forceLegacyError&&(o.error=o.code,o.error_description=o.description),n.error_codes&&n.error_details&&(o.errorDetails={codes:n.error_codes,details:n.error_details}),n.name&&(o.name=n.name),n.policy&&(o.policy=n.policy),t(o)):!r.type||"text/html"!==r.type&&"text/plain"!==r.type?e.ignoreCasing?t(null,r.body||r):t(null,fe.toCamelCase(r.body||r,[],{keepOriginal:e.keepOriginalCasing})):t(null,r.text)):t(me.buildResponse("generic_error","Something went wrong"))}}function Y(t){var e={exports:{}};return t(e,e.exports),e.exports}function Q(t,e){if(this.n=null,this.e=0,!(null!=t&&null!=e&&t.length>0&&e.length>0))throw new Error("Invalid key data");this.n=new Te.BigInteger(t,16),this.e=parseInt(e,16)}function P(t){var e=t.length%4;return 0===e?t:t+new Array(4-e+1).join("=")}function B(t){return t=P(t).replace(/\-/g,"+").replace(/_/g,"/"),decodeURIComponent(function(t){for(var e="",n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e}(Ye(t)).split("").map(function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)}).join(""))}function R(t){return function(t){for(var e="",n=0;n<t.length;n++){var r=t[n].toString(16);e+=2===r.length?r:"0"+r}return e}(Ye(P(t)))}function G(t,e){return e=e||{},new Promise(function(n,r){var o=new XMLHttpRequest,i=[],a=[],s={},u=function(){return{ok:2==(o.status/100|0),statusText:o.statusText,status:o.status,url:o.responseURL,text:function(){return Promise.resolve(o.responseText)},json:function(){return Promise.resolve(JSON.parse(o.responseText))},blob:function(){return Promise.resolve(new Blob([o.response]))},clone:u,headers:{keys:function(){return i},entries:function(){return a},get:function(t){return s[t.toLowerCase()]},has:function(t){return t.toLowerCase()in s}}}};for(var c in o.open(e.method||"get",t,!0),o.onload=function(){o.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(t,e,n){i.push(e=e.toLowerCase()),a.push([e,n]),s[e]=s[e]?s[e]+","+n:n}),n(u())},o.onerror=r,o.withCredentials="include"==e.credentials,e.headers)o.setRequestHeader(c,e.headers[c]);o.send(e.body||null)})}function Z(t){if(t.ok)return t.json();var e=new Error(t.statusText);return e.response=t,Promise.reject(e)}function H(t){this.name="ConfigurationError",this.message=t||""}function W(t){this.name="TokenValidationError",this.message=t||""}function V(t){var e=t||{};if(this.jwksCache=e.jwksCache||new Pe,this.expectedAlg=e.expectedAlg||"RS256",this.issuer=e.issuer,this.audience=e.audience,this.leeway=0===e.leeway?0:e.leeway||60,this.jwksURI=e.jwksURI,this.maxAge=e.maxAge,this.__clock="function"==typeof e.__clock?e.__clock:Re,this.leeway<0||this.leeway>300)throw new H("The leeway should be positive and lower than five minutes.");if("RS256"!==this.expectedAlg)throw new H('Signature algorithm of "'+this.expectedAlg+'" is not supported. Expected the ID token to be signed with "RS256".')}function F(t,e){this.plugins=e;for(var n=0;n<this.plugins.length;n++){if(this.plugins[n].version!==de.raw){var r="";throw this.plugins[n].constructor&&this.plugins[n].constructor.name&&(r=this.plugins[n].constructor.name),new Error("Plugin "+r+" version ("+this.plugins[n].version+") is not compatible with the SDK version ("+de.raw+")")}this.plugins[n].setWebAuth(t)}}function J(t){var e=t.transaction||{};this.namespace=e.namespace||"com.auth0.auth.",this.keyLength=e.keyLength||32,this.storage=new S(t),this.options=t}function q(t){if(this.url=t.url,this.callback=t.callback,this.timeout=t.timeout||6e4,this.timeoutCallback=t.timeoutCallback||null,this.eventListenerType=t.eventListenerType||"message",this.iframe=null,this.timeoutHandle=null,this._destroyTimeout=null,this.transientMessageEventListener=null,this.proxyEventListener=null,this.eventValidator=t.eventValidator||{isValid:function(){return!0}},"function"!=typeof this.callback)throw new Error("options.callback must be a function")}function X(t){this.webAuth=t,this.warn=new k(t.baseOptions)}function K(t,e){this.webAuth=t,this.baseOptions=e,this.request=new C(e),this.webMessageHandler=new X(t),this.storage=new S(e)}function $(t,e){return["co/verifier",encodeURIComponent(t),encodeURIComponent(e)].join("/")}function tt(t,e){this.webAuth=t,this.baseOptions=e,this.crossOriginAuthentication=new K(t,this.baseOptions),this.warn=new k({disableWarnings:!!e._disableDeprecationWarnings})}function et(){this._current_popup=null}function nt(t,e){this.baseOptions=e,this.baseOptions.popupOrigin=e.popupOrigin,this.client=t.client,this.webAuth=t,this.transactionManager=new J(this.baseOptions),this.crossOriginAuthentication=new K(t,this.baseOptions),this.warn=new k({disableWarnings:!!e._disableDeprecationWarnings})}function rt(t){this.authenticationUrl=t.authenticationUrl,this.timeout=t.timeout||6e4,this.handler=null,this.postMessageDataType=t.postMessageDataType||!1,this.postMessageOrigin=t.postMessageOrigin||ye.getWindow().location.origin||ye.getWindow().location.protocol+"//"+ye.getWindow().location.hostname+(ye.getWindow().location.port?":"+ye.getWindow().location.port:"")}function ot(t){this.baseOptions=t,this.request=new C(t),this.transactionManager=new J(this.baseOptions)}function it(t,e){this.baseOptions=e,this.client=t,this.baseOptions.universalLoginPage=!0,this.request=new C(this.baseOptions),this.warn=new k({disableWarnings:!!e._disableDeprecationWarnings})}function at(t){switch(t){case"recaptcha_v2":return window.grecaptcha;case"recaptcha_enterprise":return window.grecaptcha.enterprise;default:throw new Error("Unknown captcha provider")}}function st(t,e,n){var r="recaptchaCallback_"+Math.floor(1000001*Math.random());window[r]=function(){delete window[r],n()};var o=window.document.createElement("script");o.src=function(t,e,n){switch(t){case"recaptcha_v2":return"https://www.recaptcha.net/recaptcha/api.js?hl="+e+"&onload="+n;case"recaptcha_enterprise":return"https://www.recaptcha.net/recaptcha/enterprise.js?render=explicit&hl="+e+"&onload="+n;default:throw new Error("Unknown captcha provider")}}(e.provider,e.lang,r),o.async=!0,window.document.body.appendChild(o)}function ut(){return new Date}function ct(t){he.check(t,{type:"object",message:"options parameter is not valid"},{domain:{type:"string",message:"domain option is required"},clientID:{type:"string",message:"clientID option is required"},responseType:{optional:!0,type:"string",message:"responseType is not valid"},responseMode:{optional:!0,type:"string",message:"responseMode is not valid"},redirectUri:{optional:!0,type:"string",message:"redirectUri is not valid"},scope:{optional:!0,type:"string",message:"scope is not valid"},audience:{optional:!0,type:"string",message:"audience is not valid"},popupOrigin:{optional:!0,type:"string",message:"popupOrigin is not valid"},leeway:{optional:!0,type:"number",message:"leeway is not valid"},plugins:{optional:!0,type:"array",message:"plugins is not valid"},maxAge:{optional:!0,type:"number",message:"maxAge is not valid"},_disableDeprecationWarnings:{optional:!0,type:"boolean",message:"_disableDeprecationWarnings option is not valid"},_sendTelemetry:{optional:!0,type:"boolean",message:"_sendTelemetry option is not valid"},_telemetryInfo:{optional:!0,type:"object",message:"_telemetryInfo option is not valid"},_timesToRetryFailedRequests:{optional:!0,type:"number",message:"_timesToRetryFailedRequests option is not valid"}}),t.overrides&&he.check(t.overrides,{type:"object",message:"overrides option is not valid"},{__tenant:{optional:!0,type:"string",message:"__tenant option is required"},__token_issuer:{optional:!0,type:"string",message:"__token_issuer option is required"},__jwks_uri:{optional:!0,type:"string",message:"__jwks_uri is required"}}),this.baseOptions=t,this.baseOptions.plugins=new F(this,this.baseOptions.plugins||[]),this.baseOptions._sendTelemetry=!1!==this.baseOptions._sendTelemetry||this.baseOptions._sendTelemetry,this.baseOptions._timesToRetryFailedRequests=t._timesToRetryFailedRequests?parseInt(t._timesToRetryFailedRequests,0):0,this.baseOptions.tenant=this.baseOptions.overrides&&this.baseOptions.overrides.__tenant||this.baseOptions.domain.split(".")[0],this.baseOptions.token_issuer=this.baseOptions.overrides&&this.baseOptions.overrides.__token_issuer||"https://"+this.baseOptions.domain+"/",this.baseOptions.jwksURI=this.baseOptions.overrides&&this.baseOptions.overrides.__jwks_uri,this.transactionManager=new J(this.baseOptions),this.client=new dt(this.baseOptions),this.redirect=new tt(this,this.baseOptions),this.popup=new nt(this,this.baseOptions),this.crossOriginAuthentication=new K(this,this.baseOptions),this.webMessageHandler=new X(this),this._universalLogin=new it(this,this.baseOptions),this.ssodataStorage=new A(this.baseOptions)}function lt(t,e){this.baseOptions=e,this.request=t}function pt(t,e){this.baseOptions=e,this.request=t}function dt(t,e){2===arguments.length?this.auth0=t:e=t,he.check(e,{type:"object",message:"options parameter is not valid"},{domain:{type:"string",message:"domain option is required"},clientID:{type:"string",message:"clientID option is required"},responseType:{optional:!0,type:"string",message:"responseType is not valid"},responseMode:{optional:!0,type:"string",message:"responseMode is not valid"},redirectUri:{optional:!0,type:"string",message:"redirectUri is not valid"},scope:{optional:!0,type:"string",message:"scope is not valid"},audience:{optional:!0,type:"string",message:"audience is not valid"},_disableDeprecationWarnings:{optional:!0,type:"boolean",message:"_disableDeprecationWarnings option is not valid"},_sendTelemetry:{optional:!0,type:"boolean",message:"_sendTelemetry option is not valid"},_telemetryInfo:{optional:!0,type:"object",message:"_telemetryInfo option is not valid"}}),this.baseOptions=e,this.baseOptions._sendTelemetry=!1!==this.baseOptions._sendTelemetry||this.baseOptions._sendTelemetry,this.baseOptions.rootUrl=this.baseOptions.domain&&0===this.baseOptions.domain.toLowerCase().indexOf("http")?this.baseOptions.domain:"https://"+this.baseOptions.domain,this.request=new C(this.baseOptions),this.passwordless=new lt(this.request,this.baseOptions),this.dbConnection=new pt(this.request,this.baseOptions),this.warn=new k({disableWarnings:!!e._disableDeprecationWarnings}),this.ssodataStorage=new A(this.baseOptions)}function Mt(t){he.check(t,{type:"object",message:"options parameter is not valid"},{domain:{type:"string",message:"domain option is required"},token:{type:"string",message:"token option is required"},_sendTelemetry:{optional:!0,type:"boolean",message:"_sendTelemetry option is not valid"},_telemetryInfo:{optional:!0,type:"object",message:"_telemetryInfo option is not valid"}}),this.baseOptions=t,this.baseOptions.headers={Authorization:"Bearer "+this.baseOptions.token},this.request=new C(this.baseOptions),this.baseOptions.rootUrl=gt("https://"+this.baseOptions.domain,"api","v2")}var ht="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{},gt=r(function(t){var e,n;e=ht,n=function(){function t(t){var e=[];if(0===t.length)return"";if("string"!=typeof t[0])throw new TypeError("Url must be a string. Received "+t[0]);if(t[0].match(/^[^\/:]+:\/*$/)&&t.length>1){var n=t.shift();t[0]=n+t[0]}t[0].match(/^file:\/\/\//)?t[0]=t[0].replace(/^([^\/:]+):\/*/,"$1:///"):t[0]=t[0].replace(/^([^\/:]+):\/*/,"$1://");for(var r=0;r<t.length;r++){var o=t[r];if("string"!=typeof o)throw new TypeError("Url must be a string. Received "+o);""!==o&&(r>0&&(o=o.replace(/^[\/]+/,"")),o=r<t.length-1?o.replace(/[\/]+$/,""):o.replace(/[\/]+$/,"/"),e.push(o))}var i=e.join("/"),a=(i=i.replace(/\/(\?|&|#[^!])/g,"$1")).split("?");return i=a.shift()+(a.length>0?"?":"")+a.join("&")}return function(){return t("object"==typeof arguments[0]?arguments[0]:[].slice.call(arguments))}},t.exports?t.exports=n():e.urljoin=n()}),ft=Object.prototype.hasOwnProperty,yt=Array.isArray,Nt=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),mt=function(t,e){for(var n=e&&e.plainObjects?Object.create(null):{},r=0;r<t.length;++r)void 0!==t[r]&&(n[r]=t[r]);return n},Dt={arrayToObject:mt,assign:function(t,e){return Object.keys(e).reduce(function(t,n){return t[n]=e[n],t},t)},combine:function(t,e){return[].concat(t,e)},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],n=[],r=0;r<e.length;++r)for(var o=e[r],i=o.obj[o.prop],a=Object.keys(i),s=0;s<a.length;++s){var u=a[s],c=i[u];"object"==typeof c&&null!==c&&-1===n.indexOf(c)&&(e.push({obj:i,prop:u}),n.push(c))}return function(t){for(;t.length>1;){var e=t.pop(),n=e.obj[e.prop];if(yt(n)){for(var r=[],o=0;o<n.length;++o)void 0!==n[o]&&r.push(n[o]);e.obj[e.prop]=r}}}(e),t},decode:function(t,e,n){var r=t.replace(/\+/g," ");if("iso-8859-1"===n)return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch(t){return r}},encode:function(t,e,n){if(0===t.length)return t;var r=t;if("symbol"==typeof t?r=Symbol.prototype.toString.call(t):"string"!=typeof t&&(r=String(t)),"iso-8859-1"===n)return escape(r).replace(/%u[0-9a-f]{4}/gi,function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"});for(var o="",i=0;i<r.length;++i){var a=r.charCodeAt(i);45===a||46===a||95===a||126===a||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122?o+=r.charAt(i):a<128?o+=Nt[a]:a<2048?o+=Nt[192|a>>6]+Nt[128|63&a]:a<55296||a>=57344?o+=Nt[224|a>>12]+Nt[128|a>>6&63]+Nt[128|63&a]:(i+=1,a=65536+((1023&a)<<10|1023&r.charCodeAt(i)),o+=Nt[240|a>>18]+Nt[128|a>>12&63]+Nt[128|a>>6&63]+Nt[128|63&a])}return o},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(yt(t)){for(var n=[],r=0;r<t.length;r+=1)n.push(e(t[r]));return n}return e(t)},merge:function t(e,n,r){if(!n)return e;if("object"!=typeof n){if(yt(e))e.push(n);else{if(!e||"object"!=typeof e)return[e,n];(r&&(r.plainObjects||r.allowPrototypes)||!ft.call(Object.prototype,n))&&(e[n]=!0)}return e}if(!e||"object"!=typeof e)return[e].concat(n);var o=e;return yt(e)&&!yt(n)&&(o=mt(e,r)),yt(e)&&yt(n)?(n.forEach(function(n,o){if(ft.call(e,o)){var i=e[o];i&&"object"==typeof i&&n&&"object"==typeof n?e[o]=t(i,n,r):e.push(n)}else e[o]=n}),e):Object.keys(n).reduce(function(e,o){var i=n[o];return ft.call(e,o)?e[o]=t(e[o],i,r):e[o]=i,e},o)}},jt=String.prototype.replace,It=/%20/g,wt={RFC1738:"RFC1738",RFC3986:"RFC3986"},Lt=Dt.assign({default:wt.RFC3986,formatters:{RFC1738:function(t){return jt.call(t,It,"+")},RFC3986:function(t){return String(t)}}},wt),vt=Object.prototype.hasOwnProperty,zt={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},bt=Array.isArray,Ct=Array.prototype.push,Tt=function(t,e){Ct.apply(t,bt(e)?e:[e])},Et=Date.prototype.toISOString,xt=Lt.default,kt={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:Dt.encode,encodeValuesOnly:!1,format:xt,formatter:Lt.formatters[xt],indices:!1,serializeDate:function(t){return Et.call(t)},skipNulls:!1,strictNullHandling:!1},Ot=function t(e,n,r,o,i,a,s,u,c,l,p,d,M){var h=e;if("function"==typeof s?h=s(n,h):h instanceof Date?h=l(h):"comma"===r&&bt(h)&&(h=Dt.maybeMap(h,function(t){return t instanceof Date?l(t):t}).join(",")),null===h){if(o)return a&&!d?a(n,kt.encoder,M,"key"):n;h=""}if(function(t){return"string"==typeof t||"number"==typeof t||"boolean"==typeof t||"symbol"==typeof t||"bigint"==typeof t}(h)||Dt.isBuffer(h))return a?[p(d?n:a(n,kt.encoder,M,"key"))+"="+p(a(h,kt.encoder,M,"value"))]:[p(n)+"="+p(String(h))];var g,f=[];if(void 0===h)return f;if(bt(s))g=s;else{var y=Object.keys(h);g=u?y.sort(u):y}for(var N=0;N<g.length;++N){var m=g[N],D=h[m];if(!i||null!==D){var j=bt(h)?"function"==typeof r?r(n,m):n:n+(c?"."+m:"["+m+"]");Tt(f,t(D,j,r,o,i,a,s,u,c,l,p,d,M))}}return f},St=Object.prototype.hasOwnProperty,At=Array.isArray,Ut={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Dt.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},_t=function(t){return t.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},Yt=function(t,e){return t&&"string"==typeof t&&e.comma&&t.indexOf(",")>-1?t.split(","):t},Qt=function(t,e,n,r){if(t){var o=n.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,i=/(\[[^[\]]*])/g,a=n.depth>0&&/(\[[^[\]]*])/.exec(o),s=a?o.slice(0,a.index):o,u=[];if(s){if(!n.plainObjects&&St.call(Object.prototype,s)&&!n.allowPrototypes)return;u.push(s)}for(var c=0;n.depth>0&&null!==(a=i.exec(o))&&c<n.depth;){if(c+=1,!n.plainObjects&&St.call(Object.prototype,a[1].slice(1,-1))&&!n.allowPrototypes)return;u.push(a[1])}return a&&u.push("["+o.slice(a.index)+"]"),function(t,e,n,r){for(var o=r?e:Yt(e,n),i=t.length-1;i>=0;--i){var a,s=t[i];if("[]"===s&&n.parseArrays)a=[].concat(o);else{a=n.plainObjects?Object.create(null):{};var u="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,c=parseInt(u,10);n.parseArrays||""!==u?!isNaN(c)&&s!==u&&String(c)===u&&c>=0&&n.parseArrays&&c<=n.arrayLimit?(a=[])[c]=o:a[u]=o:a={0:o}}o=a}return o}(u,e,n,r)}},Pt=function(t,e){var n=function(t){if(!t)return Ut;if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=void 0===t.charset?Ut.charset:t.charset;return{allowDots:void 0===t.allowDots?Ut.allowDots:!!t.allowDots,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:Ut.allowPrototypes,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:Ut.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:Ut.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:Ut.comma,decoder:"function"==typeof t.decoder?t.decoder:Ut.decoder,delimiter:"string"==typeof t.delimiter||Dt.isRegExp(t.delimiter)?t.delimiter:Ut.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:Ut.depth,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:Ut.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:Ut.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:Ut.plainObjects,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:Ut.strictNullHandling}}(e);if(""===t||null==t)return n.plainObjects?Object.create(null):{};for(var r="string"==typeof t?function(t,e){var n,r={},o=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,i=e.parameterLimit===1/0?void 0:e.parameterLimit,a=o.split(e.delimiter,i),s=-1,u=e.charset;if(e.charsetSentinel)for(n=0;n<a.length;++n)0===a[n].indexOf("utf8=")&&("utf8=%E2%9C%93"===a[n]?u="utf-8":"utf8=%26%2310003%3B"===a[n]&&(u="iso-8859-1"),s=n,n=a.length);for(n=0;n<a.length;++n)if(n!==s){var c,l,p=a[n],d=p.indexOf("]="),M=-1===d?p.indexOf("="):d+1;-1===M?(c=e.decoder(p,Ut.decoder,u,"key"),l=e.strictNullHandling?null:""):(c=e.decoder(p.slice(0,M),Ut.decoder,u,"key"),l=Dt.maybeMap(Yt(p.slice(M+1),e),function(t){return e.decoder(t,Ut.decoder,u,"value")})),l&&e.interpretNumericEntities&&"iso-8859-1"===u&&(l=_t(l)),p.indexOf("[]=")>-1&&(l=At(l)?[l]:l),St.call(r,c)?r[c]=Dt.combine(r[c],l):r[c]=l}return r}(t,n):t,o=n.plainObjects?Object.create(null):{},i=Object.keys(r),a=0;a<i.length;++a){var s=i[a],u=Qt(s,r[s],n,"string"==typeof t);o=Dt.merge(o,u,n)}return Dt.compact(o)},Bt=function(t,e){var n,r=t,o=function(t){if(!t)return kt;if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=t.charset||kt.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=Lt.default;if(void 0!==t.format){if(!vt.call(Lt.formatters,t.format))throw new TypeError("Unknown format option provided.");n=t.format}var r=Lt.formatters[n],o=kt.filter;return("function"==typeof t.filter||bt(t.filter))&&(o=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:kt.addQueryPrefix,allowDots:void 0===t.allowDots?kt.allowDots:!!t.allowDots,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:kt.charsetSentinel,delimiter:void 0===t.delimiter?kt.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:kt.encode,encoder:"function"==typeof t.encoder?t.encoder:kt.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:kt.encodeValuesOnly,filter:o,formatter:r,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:kt.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:kt.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:kt.strictNullHandling}}(e);"function"==typeof o.filter?r=(0,o.filter)("",r):bt(o.filter)&&(n=o.filter);var i,a=[];if("object"!=typeof r||null===r)return"";i=e&&e.arrayFormat in zt?e.arrayFormat:e&&"indices"in e?e.indices?"indices":"repeat":"indices";var s=zt[i];n||(n=Object.keys(r)),o.sort&&n.sort(o.sort);for(var u=0;u<n.length;++u){var c=n[u];o.skipNulls&&null===r[c]||Tt(a,Ot(r[c],c,s,o.strictNullHandling,o.skipNulls,o.encode?o.encoder:null,o.filter,o.sort,o.allowDots,o.serializeDate,o.formatter,o.encodeValuesOnly,o.charset))}var l=a.join(o.delimiter),p=!0===o.addQueryPrefix?"?":"";return o.charsetSentinel&&("iso-8859-1"===o.charset?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),l.length>0?p+l:""},Rt=r(function(t){function e(t){if(t)return function(t){for(var n in e.prototype)t[n]=e.prototype[n];return t}(t)}t.exports=e,e.prototype.on=e.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},e.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+t];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var o=0;o<r.length;o++)if((n=r[o])===e||n.fn===e){r.splice(o,1);break}return 0===r.length&&delete this._callbacks["$"+t],this},e.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){r=0;for(var o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,e)}return this},e.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},e.prototype.hasListeners=function(t){return!!this.listeners(t).length}}),Gt=o;o.default=o,o.stable=a,o.stableStringify=a;var Zt=[],Ht=[],Wt=function(t){return null!==t&&"object"===u(t)},Vt=l;l.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),clearTimeout(this._uploadTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,delete this._uploadTimeoutTimer,this},l.prototype.parse=function(t){return this._parser=t,this},l.prototype.responseType=function(t){return this._responseType=t,this},l.prototype.serialize=function(t){return this._serializer=t,this},l.prototype.timeout=function(t){if(!t||"object"!==c(t))return this._timeout=t,this._responseTimeout=0,this._uploadTimeout=0,this;for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))switch(e){case"deadline":this._timeout=t.deadline;break;case"response":this._responseTimeout=t.response;break;case"upload":this._uploadTimeout=t.upload;break;default:console.warn("Unknown timeout option",e)}return this},l.prototype.retry=function(t,e){return 0!==arguments.length&&!0!==t||(t=1),t<=0&&(t=0),this._maxRetries=t,this._retries=0,this._retryCallback=e,this};var Ft=["ECONNRESET","ETIMEDOUT","EADDRINFO","ESOCKETTIMEDOUT"];l.prototype._shouldRetry=function(t,e){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{var n=this._retryCallback(t,e);if(!0===n)return!0;if(!1===n)return!1}catch(t){console.error(t)}if(e&&e.status&&e.status>=500&&501!==e.status)return!0;if(t){if(t.code&&Ft.includes(t.code))return!0;if(t.timeout&&"ECONNABORTED"===t.code)return!0;if(t.crossDomain)return!0}return!1},l.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this.timedoutError=null,this._end()},l.prototype.then=function(t,e){var n=this;if(!this._fullfilledPromise){var r=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise(function(t,e){r.on("abort",function(){if(!(n._maxRetries&&n._maxRetries>n._retries))if(n.timedout&&n.timedoutError)e(n.timedoutError);else{var t=new Error("Aborted");t.code="ABORTED",t.status=n.status,t.method=n.method,t.url=n.url,e(t)}}),r.end(function(n,r){n?e(n):t(r)})})}return this._fullfilledPromise.then(t,e)},l.prototype.catch=function(t){return this.then(void 0,t)},l.prototype.use=function(t){return t(this),this},l.prototype.ok=function(t){if("function"!=typeof t)throw new Error("Callback required");return this._okCallback=t,this},l.prototype._isResponseOK=function(t){return!!t&&(this._okCallback?this._okCallback(t):t.status>=200&&t.status<300)},l.prototype.get=function(t){return this._header[t.toLowerCase()]},l.prototype.getHeader=l.prototype.get,l.prototype.set=function(t,e){if(Wt(t)){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},l.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},l.prototype.field=function(t,e){if(null==t)throw new Error(".field(name, val) name can not be empty");if(this._data)throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");if(Wt(t)){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&this.field(n,t[n]);return this}if(Array.isArray(e)){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.field(t,e[r]);return this}if(null==e)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof e&&(e=String(e)),this._getFormData().append(t,e),this},l.prototype.abort=function(){return this._aborted||(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort")),this},l.prototype._auth=function(t,e,n,r){switch(n.type){case"basic":this.set("Authorization","Basic ".concat(r("".concat(t,":").concat(e))));break;case"auto":this.username=t,this.password=e;break;case"bearer":this.set("Authorization","Bearer ".concat(t))}return this},l.prototype.withCredentials=function(t){return void 0===t&&(t=!0),this._withCredentials=t,this},l.prototype.redirects=function(t){return this._maxRedirects=t,this},l.prototype.maxResponseSize=function(t){if("number"!=typeof t)throw new TypeError("Invalid argument");return this._maxResponseSize=t,this},l.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},l.prototype.send=function(t){var e=Wt(t),n=this._header["content-type"];if(this._formData)throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");if(e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw new Error("Can't merge these send calls");if(e&&Wt(this._data))for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(this._data[r]=t[r]);else"string"==typeof t?(n||this.type("form"),n=this._header["content-type"],this._data="application/x-www-form-urlencoded"===n?this._data?"".concat(this._data,"&").concat(t):t:(this._data||"")+t):this._data=t;return!e||this._isHost(t)||n||this.type("json"),this},l.prototype.sortQuery=function(t){return this._sort=void 0===t||t,this},l.prototype._finalizeQueryString=function(){var t=this._query.join("&");if(t&&(this.url+=(this.url.includes("?")?"&":"?")+t),this._query.length=0,this._sort){var e=this.url.indexOf("?");if(e>=0){var n=this.url.slice(e+1).split("&");"function"==typeof this._sort?n.sort(this._sort):n.sort(),this.url=this.url.slice(0,e)+"?"+n.join("&")}}},l.prototype._appendQueryString=function(){console.warn("Unsupported")},l.prototype._timeoutError=function(t,e,n){if(!this._aborted){var r=new Error("".concat(t+e,"ms exceeded"));r.timeout=e,r.code="ECONNABORTED",r.errno=n,this.timedout=!0,this.timedoutError=r,this.abort(),this.callback(r)}},l.prototype._setTimeouts=function(){var t=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){t._timeoutError("Timeout of ",t._timeout,"ETIME")},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){t._timeoutError("Response timeout of ",t._responseTimeout,"ETIMEDOUT")},this._responseTimeout))};var Jt=function(t){return t.split(/ *; */).shift()},qt=function(t){return t.split(/ *; */).reduce(function(t,e){var n=e.split(/ *= */),r=n.shift(),o=n.shift();return r&&o&&(t[r]=o),t},{})},Xt=function(t){return t.split(/ *, */).reduce(function(t,e){var n=e.split(/ *; */),r=n[0].slice(1,-1);return t[n[1].split(/ *= */)[1].slice(1,-1)]=r,t},{})},Kt=p;p.prototype.get=function(t){return this.header[t.toLowerCase()]},p.prototype._setHeaderProperties=function(t){var e=t["content-type"]||"";this.type=Jt(e);var n=qt(e);for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(this[r]=n[r]);this.links={};try{t.link&&(this.links=Xt(t.link))}catch(t){}},p.prototype._setStatusProperties=function(t){var e=t/100|0;this.statusCode=t,this.status=this.statusCode,this.statusType=e,this.info=1===e,this.ok=2===e,this.redirect=3===e,this.clientError=4===e,this.serverError=5===e,this.error=(4===e||5===e)&&this.toError(),this.created=201===t,this.accepted=202===t,this.noContent=204===t,this.badRequest=400===t,this.unauthorized=401===t,this.notAcceptable=406===t,this.forbidden=403===t,this.notFound=404===t,this.unprocessableEntity=422===t},["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert","disableTLSCerts"].forEach(function(t){h.prototype[t]=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return this._defaults.push({fn:t,args:n}),this}}),h.prototype._setDefaults=function(t){this._defaults.forEach(function(e){t[e.fn].apply(t,d(e.args))})};for(var $t=h,te=r(function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(){}function o(t){if(!Wt(t))return t;var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&i(e,n,t[n]);return e.join("&")}function i(t,e,n){if(void 0!==n)if(null!==n)if(Array.isArray(n))n.forEach(function(n){i(t,e,n)});else if(Wt(n))for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&i(t,"".concat(e,"[").concat(r,"]"),n[r]);else t.push(encodeURI(e)+"="+encodeURIComponent(n));else t.push(encodeURI(e))}function a(t){for(var e,n,r={},o=t.split("&"),i=0,a=o.length;i<a;++i)-1===(n=(e=o[i]).indexOf("="))?r[decodeURIComponent(e)]="":r[decodeURIComponent(e.slice(0,n))]=decodeURIComponent(e.slice(n+1));return r}function s(t){return/[\/+]json($|[^-\w])/.test(t)}function u(t){this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!==this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;var e=this.xhr.status;1223===e&&(e=204),this._setStatusProperties(e),this.headers=function(t){for(var e,n,r,o,i=t.split(/\r?\n/),a={},s=0,u=i.length;s<u;++s)-1!==(e=(n=i[s]).indexOf(":"))&&(r=n.slice(0,e).toLowerCase(),o=M(n.slice(e+1)),a[r]=o);return a}(this.xhr.getAllResponseHeaders()),this.header=this.headers,this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&t._responseType?this.body=this.xhr.response:this.body="HEAD"===this.req.method?null:this._parseBody(this.text?this.text:this.xhr.response)}function c(t,e){var n=this;this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",function(){var t,e=null,r=null;try{r=new u(n)}catch(t){return(e=new Error("Parser is unable to parse the response")).parse=!0,e.original=t,n.xhr?(e.rawResponse=void 0===n.xhr.responseType?n.xhr.responseText:n.xhr.response,e.status=n.xhr.status?n.xhr.status:null,e.statusCode=e.status):(e.rawResponse=null,e.status=null),n.callback(e)}n.emit("response",r);try{n._isResponseOK(r)||(t=new Error(r.statusText||r.text||"Unsuccessful HTTP response"))}catch(e){t=e}t?(t.original=e,t.response=r,t.status=r.status,n.callback(t,r)):n.callback(null,r)})}function l(t,e,n){var r=d("DELETE",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r}var p;"undefined"!=typeof window?p=window:"undefined"==typeof self?(console.warn("Using browser-only version of superagent in non-browser environment"),p=void 0):p=self,t.exports=function(t,n){return"function"==typeof n?new e.Request("GET",t).end(n):1===arguments.length?new e.Request("GET",t):new e.Request(t,n)};var d=e=t.exports;e.Request=c,d.getXHR=function(){if(p.XMLHttpRequest&&(!p.location||"file:"!==p.location.protocol||!p.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}throw new Error("Browser-only version of superagent could not find XHR")};var M="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};d.serializeObject=o,d.parseString=a,d.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},d.serialize={"application/x-www-form-urlencoded":o,"application/json":Gt},d.parse={"application/x-www-form-urlencoded":a,"application/json":JSON.parse},Kt(u.prototype),u.prototype._parseBody=function(t){var e=d.parse[this.type];return this.req._parser?this.req._parser(this,t):(!e&&s(this.type)&&(e=d.parse["application/json"]),e&&t&&(t.length>0||t instanceof Object)?e(t):null)},u.prototype.toError=function(){var t=this.req,e=t.method,n=t.url,r="cannot ".concat(e," ").concat(n," (").concat(this.status,")"),o=new Error(r);return o.status=this.status,o.method=e,o.url=n,o},d.Response=u,Rt(c.prototype),Vt(c.prototype),c.prototype.type=function(t){return this.set("Content-Type",d.types[t]||t),this},c.prototype.accept=function(t){return this.set("Accept",d.types[t]||t),this},c.prototype.auth=function(t,e,r){1===arguments.length&&(e=""),"object"===n(e)&&null!==e&&(r=e,e=""),r||(r={type:"function"==typeof btoa?"basic":"auto"});var o=function(t){if("function"==typeof btoa)return btoa(t);throw new Error("Cannot use basic auth, btoa is not a function")};return this._auth(t,e,r,o)},c.prototype.query=function(t){return"string"!=typeof t&&(t=o(t)),t&&this._query.push(t),this},c.prototype.attach=function(t,e,n){if(e){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(t,e,n||e.name)}return this},c.prototype._getFormData=function(){return this._formData||(this._formData=new p.FormData),this._formData},c.prototype.callback=function(t,e){if(this._shouldRetry(t,e))return this._retry();var n=this._callback;this.clearTimeout(),t&&(this._maxRetries&&(t.retries=this._retries-1),this.emit("error",t)),n(t,e)},c.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},c.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},c.prototype.ca=c.prototype.agent,c.prototype.buffer=c.prototype.ca,c.prototype.write=function(){throw new Error("Streaming is not supported in browser version of superagent")},c.prototype.pipe=c.prototype.write,c.prototype._isHost=function(t){return t&&"object"===n(t)&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},c.prototype.end=function(t){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=t||r,this._finalizeQueryString(),this._end()},c.prototype._setUploadTimeout=function(){var t=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout(function(){t._timeoutError("Upload timeout of ",t._uploadTimeout,"ETIMEDOUT")},this._uploadTimeout))},c.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));var t=this;this.xhr=d.getXHR();var e=this.xhr,n=this._formData||this._data;this._setTimeouts(),e.onreadystatechange=function(){var n=e.readyState;if(n>=2&&t._responseTimeoutTimer&&clearTimeout(t._responseTimeoutTimer),4===n){var r;try{r=e.status}catch(t){r=0}if(!r){if(t.timedout||t._aborted)return;return t.crossDomainError()}t.emit("end")}};var r=function(e,n){n.total>0&&(n.percent=n.loaded/n.total*100,100===n.percent&&clearTimeout(t._uploadTimeoutTimer)),n.direction=e,t.emit("progress",n)};if(this.hasListeners("progress"))try{e.addEventListener("progress",r.bind(null,"download")),e.upload&&e.upload.addEventListener("progress",r.bind(null,"upload"))}catch(t){}e.upload&&this._setUploadTimeout();try{this.username&&this.password?e.open(this.method,this.url,!0,this.username,this.password):e.open(this.method,this.url,!0)}catch(t){return this.callback(t)}if(this._withCredentials&&(e.withCredentials=!0),!this._formData&&"GET"!==this.method&&"HEAD"!==this.method&&"string"!=typeof n&&!this._isHost(n)){var o=this._header["content-type"],i=this._serializer||d.serialize[o?o.split(";")[0]:""];!i&&s(o)&&(i=d.serialize["application/json"]),i&&(n=i(n))}for(var a in this.header)null!==this.header[a]&&Object.prototype.hasOwnProperty.call(this.header,a)&&e.setRequestHeader(a,this.header[a]);this._responseType&&(e.responseType=this._responseType),this.emit("request",this),e.send(void 0===n?null:n)},d.agent=function(){return new $t},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach(function(t){$t.prototype[t.toLowerCase()]=function(e,n){var r=new d.Request(t,e);return this._setDefaults(r),n&&r.end(n),r}}),$t.prototype.del=$t.prototype.delete,d.get=function(t,e,n){var r=d("GET",t);return"function"==typeof e&&(n=e,e=null),e&&r.query(e),n&&r.end(n),r},d.head=function(t,e,n){var r=d("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&r.query(e),n&&r.end(n),r},d.options=function(t,e,n){var r=d("OPTIONS",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},d.del=l,d.delete=l,d.patch=function(t,e,n){var r=d("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},d.post=function(t,e,n){var r=d("POST",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},d.put=function(t,e,n){var r=d("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r}}),ee=(te.Request,function(t){var e=g(t),n=e[0],r=e[1];return 3*(n+r)/4-r}),ne=function(t){var e,n,r=g(t),o=r[0],i=r[1],a=new ae(function(t,e,n){return 3*(e+n)/4-n}(0,o,i)),s=0,u=i>0?o-4:o;for(n=0;n<u;n+=4)e=ie[t.charCodeAt(n)]<<18|ie[t.charCodeAt(n+1)]<<12|ie[t.charCodeAt(n+2)]<<6|ie[t.charCodeAt(n+3)],a[s++]=e>>16&255,a[s++]=e>>8&255,a[s++]=255&e;return 2===i&&(e=ie[t.charCodeAt(n)]<<2|ie[t.charCodeAt(n+1)]>>4,a[s++]=255&e),1===i&&(e=ie[t.charCodeAt(n)]<<10|ie[t.charCodeAt(n+1)]<<4|ie[t.charCodeAt(n+2)]>>2,a[s++]=e>>8&255,a[s++]=255&e),a},re=function(t){for(var e,n=t.length,r=n%3,o=[],i=0,a=n-r;i<a;i+=16383)o.push(f(t,i,i+16383>a?a:i+16383));return 1===r?(e=t[n-1],o.push(oe[e>>2]+oe[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],o.push(oe[e>>10]+oe[e>>4&63]+oe[e<<2&63]+"=")),o.join("")},oe=[],ie=[],ae="undefined"!=typeof Uint8Array?Uint8Array:Array,se="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ue=0,ce=se.length;ue<ce;++ue)oe[ue]=se[ue],ie[se.charCodeAt(ue)]=ue;ie["-".charCodeAt(0)]=62,ie["_".charCodeAt(0)]=63;var le={byteLength:ee,toByteArray:ne,fromByteArray:re},pe={encode:function(t){return le.fromByteArray(function(t){for(var e=new Array(t.length),n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}(t)).replace(/\+/g,"-").replace(/\//g,"_")},decode:function(t){return t=function(t){var e=t.length%4;return 0===e?t:t+new Array(4-e+1).join("=")}(t).replace(/-/g,"+").replace(/_/g,"/"),function(t){for(var e="",n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e}(le.toByteArray(t))}},de={raw:"9.16.2"},Me=Object.prototype.toString,he={check:function(t,e,n){if(e.optional&&!t||N(t,e.type,e.message),"object"===e.type&&n)for(var r=Object.keys(n),o=0;o<r.length;o++){var i=r[o];n[i].optional&&!t[i]||n[i].condition&&!n[i].condition(t)||(y(t,i,n[i].type,n[i].message),n[i].values&&m(t[i],n[i].values,n[i].value_message))}},attribute:y,variable:N,value:m,isArray:function(t){return this.supportsIsArray()?Array.isArray(t):"[object Array]"===Me.call(t)},supportsIsArray:function(){return null!=Array.isArray}},ge={get:function(){return Object.assign?Object.assign:D},objectAssignPolyfill:D},fe={toSnakeCase:function t(e,n){return"object"!=typeof e||he.isArray(e)||null===e?e:(n=n||[],Object.keys(e).reduce(function(r,o){return r[-1===n.indexOf(o)?function(t){for(var e,n="",r=0,o=!0,i=!0;r<t.length;)e=t.charCodeAt(r),!i&&e>=65&&e<=90||!o&&e>=48&&e<=57?(n+="_",n+=t[r].toLowerCase()):n+=t[r].toLowerCase(),o=e>=48&&e<=57,i=e>=65&&e<=90,r++;return n}(o):o]=t(e[o]),r},{}))},toCamelCase:function t(e,n,r){return"object"!=typeof e||he.isArray(e)||null===e?e:(n=n||[],r=r||{},Object.keys(e).reduce(function(o,i){var a,s=-1===n.indexOf(i)?(a=i.split("_")).reduce(function(t,e){return t+e.charAt(0).toUpperCase()+e.slice(1)},a.shift()):i;return o[s]=t(e[s]||e[i],[],r),r.keepOriginal&&(o[i]=t(e[i],[],r)),o},{}))},blacklist:function(t,e){return Object.keys(t).reduce(function(n,r){return-1===e.indexOf(r)&&(n[r]=t[r]),n},{})},merge:function(t,e){return{base:e?j(t,e):t,with:function(t,e){return t=e?j(t,e):t,w(this.base,t)}}},pick:j,getKeysNotIn:function(t,e){var n=[];for(var r in t)-1===e.indexOf(r)&&n.push(r);return n},extend:w,getOriginFromUrl:function(t){if(t){var e=L(t);if(!e)return null;var n=e.protocol+"//"+e.hostname;return e.port&&(n+=":"+e.port),n}},getLocationFromUrl:L,trimUserDetails:function(t){return function(t,e){return e.reduce(v,t)}(t,["username","email","phoneNumber"])},updatePropertyOn:function t(e,n,r){"string"==typeof n&&(n=n.split("."));var o=n[0];e.hasOwnProperty(o)&&(1===n.length?e[o]=r:t(e[o],n.slice(1),r))}};z.prototype.abort=function(){this.request.abort()},z.prototype.getMethod=function(){return this.method},z.prototype.getBody=function(){return this.body},z.prototype.getUrl=function(){return this.url},z.prototype.getHeaders=function(){return this.headers},b.prototype.set=function(t,e){return this.request=this.request.set(t,e),this},b.prototype.send=function(t){return this.request=this.request.send(fe.trimUserDetails(t)),this},b.prototype.withCredentials=function(){return this.request=this.request.withCredentials(),this},b.prototype.end=function(t){return this.request.end(t),new z(this.request)},C.prototype.setCommonConfiguration=function(t,e){if(e=e||{},this._timesToRetryFailedRequests>0&&(t=t.retry(this._timesToRetryFailedRequests)),e.noHeaders)return t;var n=this.headers;t=t.set("Content-Type","application/json");for(var r=Object.keys(this.headers),o=0;o<r.length;o++)t=t.set(r[o],n[r[o]]);return this._sendTelemetry&&(t=t.set("Auth0-Client",this.getTelemetryData())),t},C.prototype.getTelemetryData=function(){var t=this._universalLoginPage?"auth0.js-ulp":"auth0.js",e={name:t,version:de.raw};this._telemetryInfo&&((e=fe.extend({},this._telemetryInfo)).env=fe.extend({},this._telemetryInfo.env),e.env[t]=de.raw);var n=JSON.stringify(e);return pe.encode(n)},C.prototype.get=function(t,e){return new b(this.setCommonConfiguration(te.get(t),e))},C.prototype.post=function(t,e){return new b(this.setCommonConfiguration(te.post(t),e))},C.prototype.patch=function(t,e){return new b(this.setCommonConfiguration(te.patch(t),e))};var ye={redirect:function(t){T().location=t},getDocument:function(){return T().document},getWindow:T,getOrigin:function(){var t=T().location,e=t.origin;return e||(e=fe.getOriginFromUrl(t.href)),e}};E.prototype.getItem=function(){return null},E.prototype.removeItem=function(){},E.prototype.setItem=function(){};var Ne=r(function(t,e){var n;n=function(){function t(){for(var t=0,e={};t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}function e(t){return t.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function o(){}function i(e,n,i){if("undefined"!=typeof document){"number"==typeof(i=t({path:"/"},o.defaults,i)).expires&&(i.expires=new Date(1*new Date+864e5*i.expires)),i.expires=i.expires?i.expires.toUTCString():"";try{var a=JSON.stringify(n);/^[\{\[]/.test(a)&&(n=a)}catch(t){}n=r.write?r.write(n,e):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),e=encodeURIComponent(String(e)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var s="";for(var u in i)i[u]&&(s+="; "+u,!0!==i[u]&&(s+="="+i[u].split(";")[0]));return document.cookie=e+"="+n+s}}function a(t,n){if("undefined"!=typeof document){for(var o={},i=document.cookie?document.cookie.split("; "):[],a=0;a<i.length;a++){var s=i[a].split("="),u=s.slice(1).join("=");n||'"'!==u.charAt(0)||(u=u.slice(1,-1));try{var c=e(s[0]);if(u=(r.read||r)(u,c)||e(u),n)try{u=JSON.parse(u)}catch(t){}if(o[c]=u,t===c)break}catch(t){}}return t?o[t]:o}}return o.set=i,o.get=function(t){return a(t,!1)},o.getJSON=function(t){return a(t,!0)},o.remove=function(e,n){i(e,"",t(n,{expires:-1}))},o.defaults={},o.withConverter=n,o}(function(){})},t.exports=n()});x.prototype.getItem=function(t){return Ne.get(t)},x.prototype.removeItem=function(t){Ne.remove(t)},x.prototype.setItem=function(t,e,n){var r=fe.extend({expires:1},n);"https:"===ye.getWindow().location.protocol&&(r.secure=!0),Ne.set(t,e,r)},k.prototype.warning=function(t){this.disableWarnings||console.warn(t)},O.prototype.failover=function(){this.storage instanceof E?this.warn.warning("DummyStorage: ignore failover"):this.storage instanceof x?(this.warn.warning("CookieStorage: failing over DummyStorage"),this.storage=new E):(this.warn.warning("LocalStorage: failing over CookieStorage"),this.storage=new x)},O.prototype.getItem=function(t){try{return this.storage.getItem(t)}catch(e){return this.warn.warning(e),this.failover(),this.getItem(t)}},O.prototype.removeItem=function(t){try{return this.storage.removeItem(t)}catch(e){return this.warn.warning(e),this.failover(),this.removeItem(t)}},O.prototype.setItem=function(t,e,n){try{return this.storage.setItem(t,e,n)}catch(r){return this.warn.warning(r),this.failover(),this.setItem(t,e,n)}},S.prototype.getItem=function(t){var e=this.handler.getItem(t);try{return JSON.parse(e)}catch(t){return e}},S.prototype.removeItem=function(t){return this.handler.removeItem(t)},S.prototype.setItem=function(t,e,n){var r=JSON.stringify(e);return this.handler.setItem(t,r,n)},A.prototype.set=function(t,e){var n={lastUsedConnection:t,lastUsedSub:e};this.storage.setItem("auth0.ssodata",JSON.stringify(n))},A.prototype.get=function(){var t=this.storage.getItem("auth0.ssodata");if(t)return JSON.parse(t)};var me={buildResponse:U,invalidToken:function(t){return U("invalid_token",t)}},De=["realm","audience","otp","client_id","client_secret","redirect_uri","scope","code","grant_type","username","password","refresh_token","assertion","client_assertion","client_assertion_type","code_verifier"],je=["connection","connection_scope","auth0Client","owp","device","realm","organization","invitation","protocol","_csrf","_intstate","login_ticket","client_id","response_type","response_mode","redirect_uri","audience","scope","state","nonce","display","prompt","screen_hint","max_age","ui_locales","claims_locales","id_token_hint","login_hint","acr_values","claims","registration","request","request_uri","code_challenge","code_challenge_method","access_type","display"],Ie={oauthTokenParams:function(t,e){return fe.pick(e,De)},oauthAuthorizeParams:function(t,e){var n=fe.getKeysNotIn(e,je);return n.length>0&&t.warning("Following parameters are not allowed on the `/authorize` endpoint: ["+n.join(",")+"]"),e}},we="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{},Le=Y(function(t,e){t.exports=function(){function t(t){return"function"==typeof t}function e(){var t=setTimeout;return function(){return t(r,1)}}function r(){for(var t=0;t<j;t+=2)(0,E[t])(E[t+1]),E[t]=void 0,E[t+1]=void 0;j=0}function o(t,e){var n=this,r=new this.constructor(a);void 0===r[k]&&g(r);var o=n._state;if(o){var i=arguments[o-1];L(function(){return h(o,r,i,n._result)})}else d(n,r,t,e);return r}function i(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(a);return u(e,t),e}function a(){}function s(e,n,r){n.constructor===e.constructor&&r===o&&n.constructor.resolve===i?function(t,e){1===e._state?l(t,e._result):2===e._state?p(t,e._result):d(e,void 0,function(e){return u(t,e)},function(e){return p(t,e)})}(e,n):void 0===r?l(e,n):t(r)?function(t,e,n){L(function(t){var r=!1,o=function(n,o,i,a){try{n.call(o,function(n){r||(r=!0,e!==n?u(t,n):l(t,n))},function(e){r||(r=!0,p(t,e))})}catch(t){return t}}(n,e);!r&&o&&(r=!0,p(t,o))},t)}(e,n,r):l(e,n)}function u(t,e){if(t===e)p(t,new TypeError("You cannot resolve a promise with itself"));else if(o=typeof(r=e),null===r||"object"!==o&&"function"!==o)l(t,e);else{var n=void 0;try{n=e.then}catch(e){return void p(t,e)}s(t,e,n)}var r,o}function c(t){t._onerror&&t._onerror(t._result),M(t)}function l(t,e){t._state===O&&(t._result=e,t._state=1,0!==t._subscribers.length&&L(M,t))}function p(t,e){t._state===O&&(t._state=2,t._result=e,L(c,t))}function d(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+1]=n,o[i+2]=r,0===i&&t._state&&L(M,t)}function M(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,a=0;a<e.length;a+=3)o=e[a+n],(r=e[a])?h(n,r,o,i):o(i);t._subscribers.length=0}}function h(e,n,r,o){var i=t(r),a=void 0,s=void 0,c=!0;if(i){try{a=r(o)}catch(e){c=!1,s=e}if(n===a)return void p(n,new TypeError("A promises callback cannot return that same promise."))}else a=o;n._state!==O||(i&&c?u(n,a):!1===c?p(n,s):1===e?l(n,a):2===e&&p(n,a))}function g(t){t[k]=S++,t._state=void 0,t._result=void 0,t._subscribers=[]}var f,y,N,m,D=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},j=0,I=void 0,w=void 0,L=function(t,e){E[j]=t,E[j+1]=e,2===(j+=2)&&(w?w(r):x())},v="undefined"!=typeof window?window:void 0,z=v||{},b=z.MutationObserver||z.WebKitMutationObserver,C="undefined"==typeof self&&void 0!==n&&"[object process]"==={}.toString.call(n),T="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,E=new Array(1e3),x=void 0;x=C?function(){return n.nextTick(r)}:b?(y=0,N=new b(r),m=document.createTextNode(""),N.observe(m,{characterData:!0}),function(){m.data=y=++y%2}):T?((f=new MessageChannel).port1.onmessage=r,function(){return f.port2.postMessage(0)}):void 0===v?function(){try{var t=Function("return this")().require("vertx");return void 0!==(I=t.runOnLoop||t.runOnContext)?function(){I(r)}:e()}catch(t){return e()}}():e();var k=Math.random().toString(36).substring(2),O=void 0,S=0,A=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(a),this.promise[k]||g(this.promise),D(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?l(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&l(this.promise,this._result))):p(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;this._state===O&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===i){var u=void 0,c=void 0,l=!1;try{u=t.then}catch(t){l=!0,c=t}if(u===o&&t._state!==O)this._settledAt(t._state,e,t._result);else if("function"!=typeof u)this._remaining--,this._result[e]=t;else if(n===U){var d=new n(a);l?p(d,c):s(d,t,u),this._willSettleAt(d,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===O&&(this._remaining--,2===t?p(r,n):this._result[e]=n),0===this._remaining&&l(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;d(t,void 0,function(t){return n._settledAt(1,e,t)},function(t){return n._settledAt(2,e,t)})},t}(),U=function(){function e(t){this[k]=S++,this._result=this._state=void 0,this._subscribers=[],a!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(t,e){try{e(function(e){u(t,e)},function(e){p(t,e)})}catch(e){p(t,e)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(t){return this.then(null,t)},e.prototype.finally=function(e){var n=this,r=n.constructor;return t(e)?n.then(function(t){return r.resolve(e()).then(function(){return t})},function(t){return r.resolve(e()).then(function(){throw t})}):n.then(e,e)},e}();return U.prototype.then=o,U.all=function(t){return new A(this,t).promise},U.race=function(t){var e=this;return new e(D(t)?function(n,r){for(var o=t.length,i=0;i<o;i++)e.resolve(t[i]).then(n,r)}:function(t,e){return e(new TypeError("You must pass an array to race."))})},U.resolve=i,U.reject=function(t){var e=new this(a);return p(e,t),e},U._setScheduler=function(t){w=t},U._setAsap=function(t){L=t},U._asap=L,U.polyfill=function(){var t=void 0;if(void 0!==we)t=we;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var n=null;try{n=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===n&&!e.cast)return}t.Promise=U},U.Promise=U,U}()}),ve=Y(function(t,e){var n;t.exports=n=n||function(t,e){var n=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),r={},o=r.lib={},i=o.Base={extend:function(t){var e=n(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},a=o.WordArray=i.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||u).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,o=t.sigBytes;if(this.clamp(),r%4)for(var i=0;i<o;i++)e[r+i>>>2]|=(n[i>>>2]>>>24-i%4*8&255)<<24-(r+i)%4*8;else for(i=0;i<o;i+=4)e[r+i>>>2]=n[i>>>2];return this.sigBytes+=o,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=i.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,r=[],o=0;o<e;o+=4){var i=function(e){e=e;var n=987654321,r=4294967295;return function(){var o=((n=36969*(65535&n)+(n>>16)&r)<<16)+(e=18e3*(65535&e)+(e>>16)&r)&r;return o/=4294967296,(o+=.5)*(t.random()>.5?1:-1)}}(4294967296*(n||t.random()));n=987654071*i(),r.push(4294967296*i()|0)}return new a.init(r,e)}}),s=r.enc={},u=s.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;o<n;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new a.init(n,e/2)}},c=s.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;o<n;o++)r.push(String.fromCharCode(e[o>>>2]>>>24-o%4*8&255));return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new a.init(n,e)}},l=s.Utf8={stringify:function(t){try{return decodeURIComponent(escape(c.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return c.parse(unescape(encodeURIComponent(t)))}},p=o.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=l.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,o=n.sigBytes,i=this.blockSize,s=o/(4*i),u=(s=e?t.ceil(s):t.max((0|s)-this._minBufferSize,0))*i,c=t.min(4*u,o);if(u){for(var l=0;l<u;l+=i)this._doProcessBlock(r,l);var p=r.splice(0,u);n.sigBytes-=c}return new a.init(p,c)},clone:function(){var t=i.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});o.Hasher=p.extend({cfg:i.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new d.HMAC.init(t,n).finalize(e)}}});var d=r.algo={};return r}(Math)}),ze=Y(function(t,e){var n;t.exports=(n=ve,function(t){var e=n,r=e.lib,o=r.WordArray,i=r.Hasher,a=e.algo,s=[],u=[];!function(){function e(t){return 4294967296*(t-(0|t))|0}for(var n=2,r=0;r<64;)(function(e){for(var n=t.sqrt(e),r=2;r<=n;r++)if(!(e%r))return!1;return!0})(n)&&(r<8&&(s[r]=e(t.pow(n,.5))),u[r]=e(t.pow(n,1/3)),r++),n++}();var c=[],l=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],a=n[3],s=n[4],l=n[5],p=n[6],d=n[7],M=0;M<64;M++){if(M<16)c[M]=0|t[e+M];else{var h=c[M-15],g=c[M-2];c[M]=((h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3)+c[M-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+c[M-16]}var f=r&o^r&i^o&i,y=d+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&l^~s&p)+u[M]+c[M];d=p,p=l,l=s,s=a+y|0,a=i,i=o,o=r,r=y+(((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+f)|0}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+a|0,n[4]=n[4]+s|0,n[5]=n[5]+l|0,n[6]=n[6]+p|0,n[7]=n[7]+d|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,o=8*e.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=t.floor(r/4294967296),n[15+(o+64>>>9<<4)]=r,e.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=i._createHelper(l),e.HmacSHA256=i._createHmacHelper(l)}(Math),n.SHA256)}),be=Y(function(t,e){var n,r;t.exports=(r=(n=ve).lib.WordArray,n.enc.Base64={stringify:function(t){var e=t.words,n=t.sigBytes,r=this._map;t.clamp();for(var o=[],i=0;i<n;i+=3)for(var a=(e[i>>>2]>>>24-i%4*8&255)<<16|(e[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|e[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;s<4&&i+.75*s<n;s++)o.push(r.charAt(a>>>6*(3-s)&63));var u=r.charAt(64);if(u)for(;o.length%4;)o.push(u);return o.join("")},parse:function(t){var e=t.length,n=this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var i=0;i<n.length;i++)o[n.charCodeAt(i)]=i}var a=n.charAt(64);if(a){var s=t.indexOf(a);-1!==s&&(e=s)}return function(t,e,n){for(var o=[],i=0,a=0;a<e;a++)if(a%4){var s=n[t.charCodeAt(a-1)]<<a%4*2,u=n[t.charCodeAt(a)]>>>6-a%4*2;o[i>>>2]|=(s|u)<<24-i%4*8,i++}return r.create(o,i)}(t,e,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},n.enc.Base64)}),Ce=Y(function(t,e){t.exports=ve.enc.Hex}),Te=Y(function(t,e){(function(){function e(t,e,n){null!=t&&("number"==typeof t?this.fromNumber(t,e,n):this.fromString(t,null==e&&"string"!=typeof t?256:e))}function n(){return new e(null)}function r(t){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t)}function o(t,e){var n=z[t.charCodeAt(e)];return null==n?-1:n}function i(t){var e=n();return e.fromInt(t),e}function a(t){var e,n=1;return 0!=(e=t>>>16)&&(t=e,n+=16),0!=(e=t>>8)&&(t=e,n+=8),0!=(e=t>>4)&&(t=e,n+=4),0!=(e=t>>2)&&(t=e,n+=2),0!=(e=t>>1)&&(t=e,n+=1),n}function s(t){this.m=t}function u(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function c(t,e){return t&e}function l(t,e){return t|e}function p(t,e){return t^e}function d(t,e){return t&~e}function M(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function h(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function g(){}function f(t){return t}function y(t){this.r2=n(),this.q3=n(),e.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function N(){var t;t=(new Date).getTime(),C[T++]^=255&t,C[T++]^=t>>8&255,C[T++]^=t>>16&255,C[T++]^=t>>24&255,T>=A&&(T-=A)}function m(){if(null==b){for(N(),(b=new j).init(C),T=0;T<C.length;++T)C[T]=0;T=0}return b.next()}function D(){}function j(){this.i=0,this.j=0,this.S=new Array}var I,w="undefined"!=typeof navigator;w&&"Microsoft Internet Explorer"==navigator.appName?(e.prototype.am=function(t,e,n,r,o,i){for(var a=32767&e,s=e>>15;--i>=0;){var u=32767&this[t],c=this[t++]>>15,l=s*u+c*a;o=((u=a*u+((32767&l)<<15)+n[r]+(1073741823&o))>>>30)+(l>>>15)+s*c+(o>>>30),n[r++]=1073741823&u}return o},I=30):w&&"Netscape"!=navigator.appName?(e.prototype.am=function(t,e,n,r,o,i){for(;--i>=0;){var a=e*this[t++]+n[r]+o;o=Math.floor(a/67108864),n[r++]=67108863&a}return o},I=26):(e.prototype.am=function(t,e,n,r,o,i){for(var a=16383&e,s=e>>14;--i>=0;){var u=16383&this[t],c=this[t++]>>14,l=s*u+c*a;o=((u=a*u+((16383&l)<<14)+n[r]+o)>>28)+(l>>14)+s*c,n[r++]=268435455&u}return o},I=28),e.prototype.DB=I,e.prototype.DM=(1<<I)-1,e.prototype.DV=1<<I,e.prototype.FV=Math.pow(2,52),e.prototype.F1=52-I,e.prototype.F2=2*I-52;var L,v,z=new Array;for(L="0".charCodeAt(0),v=0;v<=9;++v)z[L++]=v;for(L="a".charCodeAt(0),v=10;v<36;++v)z[L++]=v;for(L="A".charCodeAt(0),v=10;v<36;++v)z[L++]=v;s.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},s.prototype.revert=function(t){return t},s.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},s.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},s.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},u.prototype.convert=function(t){var r=n();return t.abs().dlShiftTo(this.m.t,r),r.divRemTo(this.m,null,r),t.s<0&&r.compareTo(e.ZERO)>0&&this.m.subTo(r,r),r},u.prototype.revert=function(t){var e=n();return t.copyTo(e),this.reduce(e),e},u.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var n=32767&t[e],r=n*this.mpl+((n*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[n=e+this.m.t]+=this.m.am(0,r,t,e,0,this.m.t);t[n]>=t.DV;)t[n]-=t.DV,t[++n]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},u.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},u.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},e.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},e.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},e.prototype.fromString=function(t,n){var r;if(16==n)r=4;else if(8==n)r=3;else if(256==n)r=8;else if(2==n)r=1;else if(32==n)r=5;else{if(4!=n)return void this.fromRadix(t,n);r=2}this.t=0,this.s=0;for(var i=t.length,a=!1,s=0;--i>=0;){var u=8==r?255&t[i]:o(t,i);u<0?"-"==t.charAt(i)&&(a=!0):(a=!1,0==s?this[this.t++]=u:s+r>this.DB?(this[this.t-1]|=(u&(1<<this.DB-s)-1)<<s,this[this.t++]=u>>this.DB-s):this[this.t-1]|=u<<s,(s+=r)>=this.DB&&(s-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),a&&e.ZERO.subTo(this,this)},e.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},e.prototype.dlShiftTo=function(t,e){var n;for(n=this.t-1;n>=0;--n)e[n+t]=this[n];for(n=t-1;n>=0;--n)e[n]=0;e.t=this.t+t,e.s=this.s},e.prototype.drShiftTo=function(t,e){for(var n=t;n<this.t;++n)e[n-t]=this[n];e.t=Math.max(this.t-t,0),e.s=this.s},e.prototype.lShiftTo=function(t,e){var n,r=t%this.DB,o=this.DB-r,i=(1<<o)-1,a=Math.floor(t/this.DB),s=this.s<<r&this.DM;for(n=this.t-1;n>=0;--n)e[n+a+1]=this[n]>>o|s,s=(this[n]&i)<<r;for(n=a-1;n>=0;--n)e[n]=0;e[a]=s,e.t=this.t+a+1,e.s=this.s,e.clamp()},e.prototype.rShiftTo=function(t,e){e.s=this.s;var n=Math.floor(t/this.DB);if(n>=this.t)e.t=0;else{var r=t%this.DB,o=this.DB-r,i=(1<<r)-1;e[0]=this[n]>>r;for(var a=n+1;a<this.t;++a)e[a-n-1]|=(this[a]&i)<<o,e[a-n]=this[a]>>r;r>0&&(e[this.t-n-1]|=(this.s&i)<<o),e.t=this.t-n,e.clamp()}},e.prototype.subTo=function(t,e){for(var n=0,r=0,o=Math.min(t.t,this.t);n<o;)r+=this[n]-t[n],e[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;n<this.t;)r+=this[n],e[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r-=t[n],e[n++]=r&this.DM,r>>=this.DB;r-=t.s}e.s=r<0?-1:0,r<-1?e[n++]=this.DV+r:r>0&&(e[n++]=r),e.t=n,e.clamp()},e.prototype.multiplyTo=function(t,n){var r=this.abs(),o=t.abs(),i=r.t;for(n.t=i+o.t;--i>=0;)n[i]=0;for(i=0;i<o.t;++i)n[i+r.t]=r.am(0,o[i],n,i,0,r.t);n.s=0,n.clamp(),this.s!=t.s&&e.ZERO.subTo(n,n)},e.prototype.squareTo=function(t){for(var e=this.abs(),n=t.t=2*e.t;--n>=0;)t[n]=0;for(n=0;n<e.t-1;++n){var r=e.am(n,e[n],t,2*n,0,1);(t[n+e.t]+=e.am(n+1,2*e[n],t,2*n+1,r,e.t-n-1))>=e.DV&&(t[n+e.t]-=e.DV,t[n+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(n,e[n],t,2*n,0,1)),t.s=0,t.clamp()},e.prototype.divRemTo=function(t,r,o){var i=t.abs();if(!(i.t<=0)){var s=this.abs();if(s.t<i.t)return null!=r&&r.fromInt(0),void(null!=o&&this.copyTo(o));null==o&&(o=n());var u=n(),c=this.s,l=t.s,p=this.DB-a(i[i.t-1]);p>0?(i.lShiftTo(p,u),s.lShiftTo(p,o)):(i.copyTo(u),s.copyTo(o));var d=u.t,M=u[d-1];if(0!=M){var h=M*(1<<this.F1)+(d>1?u[d-2]>>this.F2:0),g=this.FV/h,f=(1<<this.F1)/h,y=1<<this.F2,N=o.t,m=N-d,D=null==r?n():r;for(u.dlShiftTo(m,D),o.compareTo(D)>=0&&(o[o.t++]=1,o.subTo(D,o)),e.ONE.dlShiftTo(d,D),D.subTo(u,u);u.t<d;)u[u.t++]=0;for(;--m>=0;){var j=o[--N]==M?this.DM:Math.floor(o[N]*g+(o[N-1]+y)*f);if((o[N]+=u.am(0,j,o,m,0,d))<j)for(u.dlShiftTo(m,D),o.subTo(D,o);o[N]<--j;)o.subTo(D,o)}null!=r&&(o.drShiftTo(d,r),c!=l&&e.ZERO.subTo(r,r)),o.t=d,o.clamp(),p>0&&o.rShiftTo(p,o),c<0&&e.ZERO.subTo(o,o)}}},e.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},e.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},e.prototype.exp=function(t,r){if(t>4294967295||t<1)return e.ONE;var o=n(),i=n(),s=r.convert(this),u=a(t)-1;for(s.copyTo(o);--u>=0;)if(r.sqrTo(o,i),(t&1<<u)>0)r.mulTo(i,s,o);else{var c=o;o=i,i=c}return r.revert(o)},e.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var n,o=(1<<e)-1,i=!1,a="",s=this.t,u=this.DB-s*this.DB%e;if(s-- >0)for(u<this.DB&&(n=this[s]>>u)>0&&(i=!0,a=r(n));s>=0;)u<e?(n=(this[s]&(1<<u)-1)<<e-u,n|=this[--s]>>(u+=this.DB-e)):(n=this[s]>>(u-=e)&o,u<=0&&(u+=this.DB,--s)),n>0&&(i=!0),i&&(a+=r(n));return i?a:"0"},e.prototype.negate=function(){var t=n();return e.ZERO.subTo(this,t),t},e.prototype.abs=function(){return this.s<0?this.negate():this},e.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var n=this.t;if(0!=(e=n-t.t))return this.s<0?-e:e;for(;--n>=0;)if(0!=(e=this[n]-t[n]))return e;return 0},e.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+a(this[this.t-1]^this.s&this.DM)},e.prototype.mod=function(t){var r=n();return this.abs().divRemTo(t,null,r),this.s<0&&r.compareTo(e.ZERO)>0&&t.subTo(r,r),r},e.prototype.modPowInt=function(t,e){var n;return n=t<256||e.isEven()?new s(e):new u(e),this.exp(t,n)},e.ZERO=i(0),e.ONE=i(1),g.prototype.convert=f,g.prototype.revert=f,g.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n)},g.prototype.sqrTo=function(t,e){t.squareTo(e)},y.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=n();return t.copyTo(e),this.reduce(e),e},y.prototype.revert=function(t){return t},y.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},y.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},y.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var b,C,T,E=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],x=(1<<26)/E[E.length-1];if(e.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},e.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),o=i(r),a=n(),s=n(),u="";for(this.divRemTo(o,a,s);a.signum()>0;)u=(r+s.intValue()).toString(t).substr(1)+u,a.divRemTo(o,a,s);return s.intValue().toString(t)+u},e.prototype.fromRadix=function(t,n){this.fromInt(0),null==n&&(n=10);for(var r=this.chunkSize(n),i=Math.pow(n,r),a=!1,s=0,u=0,c=0;c<t.length;++c){var l=o(t,c);l<0?"-"==t.charAt(c)&&0==this.signum()&&(a=!0):(u=n*u+l,++s>=r&&(this.dMultiply(i),this.dAddOffset(u,0),s=0,u=0))}s>0&&(this.dMultiply(Math.pow(n,s)),this.dAddOffset(u,0)),a&&e.ZERO.subTo(this,this)},e.prototype.fromNumber=function(t,n,r){if("number"==typeof n)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),l,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(n);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(e.ONE.shiftLeft(t-1),this);else{var o=new Array,i=7&t;o.length=1+(t>>3),n.nextBytes(o),i>0?o[0]&=(1<<i)-1:o[0]=0,this.fromString(o,256)}},e.prototype.bitwiseTo=function(t,e,n){var r,o,i=Math.min(t.t,this.t);for(r=0;r<i;++r)n[r]=e(this[r],t[r]);if(t.t<this.t){for(o=t.s&this.DM,r=i;r<this.t;++r)n[r]=e(this[r],o);n.t=this.t}else{for(o=this.s&this.DM,r=i;r<t.t;++r)n[r]=e(o,t[r]);n.t=t.t}n.s=e(this.s,t.s),n.clamp()},e.prototype.changeBit=function(t,n){var r=e.ONE.shiftLeft(t);return this.bitwiseTo(r,n,r),r},e.prototype.addTo=function(t,e){for(var n=0,r=0,o=Math.min(t.t,this.t);n<o;)r+=this[n]+t[n],e[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;n<this.t;)r+=this[n],e[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r+=t[n],e[n++]=r&this.DM,r>>=this.DB;r+=t.s}e.s=r<0?-1:0,r>0?e[n++]=r:r<-1&&(e[n++]=this.DV+r),e.t=n,e.clamp()},e.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},e.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},e.prototype.multiplyLowerTo=function(t,e,n){var r,o=Math.min(this.t+t.t,e);for(n.s=0,n.t=o;o>0;)n[--o]=0;for(r=n.t-this.t;o<r;++o)n[o+this.t]=this.am(0,t[o],n,o,0,this.t);for(r=Math.min(t.t,e);o<r;++o)this.am(0,t[o],n,o,0,e-o);n.clamp()},e.prototype.multiplyUpperTo=function(t,e,n){--e;var r=n.t=this.t+t.t-e;for(n.s=0;--r>=0;)n[r]=0;for(r=Math.max(e-this.t,0);r<t.t;++r)n[this.t+r-e]=this.am(e-r,t[r],n,0,0,this.t+r-e);n.clamp(),n.drShiftTo(1,n)},e.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,n=this.s<0?t-1:0;if(this.t>0)if(0==e)n=this[0]%t;else for(var r=this.t-1;r>=0;--r)n=(e*n+this[r])%t;return n},e.prototype.millerRabin=function(t){var r=this.subtract(e.ONE),o=r.getLowestSetBit();if(o<=0)return!1;var i=r.shiftRight(o);(t=t+1>>1)>E.length&&(t=E.length);for(var a=n(),s=0;s<t;++s){a.fromInt(E[Math.floor(Math.random()*E.length)]);var u=a.modPow(i,this);if(0!=u.compareTo(e.ONE)&&0!=u.compareTo(r)){for(var c=1;c++<o&&0!=u.compareTo(r);)if(0==(u=u.modPowInt(2,this)).compareTo(e.ONE))return!1;if(0!=u.compareTo(r))return!1}}return!0},e.prototype.clone=function(){var t=n();return this.copyTo(t),t},e.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},e.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},e.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},e.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},e.prototype.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var n,r=this.DB-t*this.DB%8,o=0;if(t-- >0)for(r<this.DB&&(n=this[t]>>r)!=(this.s&this.DM)>>r&&(e[o++]=n|this.s<<this.DB-r);t>=0;)r<8?(n=(this[t]&(1<<r)-1)<<8-r,n|=this[--t]>>(r+=this.DB-8)):(n=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),0!=(128&n)&&(n|=-256),0==o&&(128&this.s)!=(128&n)&&++o,(o>0||n!=this.s)&&(e[o++]=n);return e},e.prototype.equals=function(t){return 0==this.compareTo(t)},e.prototype.min=function(t){return this.compareTo(t)<0?this:t},e.prototype.max=function(t){return this.compareTo(t)>0?this:t},e.prototype.and=function(t){var e=n();return this.bitwiseTo(t,c,e),e},e.prototype.or=function(t){var e=n();return this.bitwiseTo(t,l,e),e},e.prototype.xor=function(t){var e=n();return this.bitwiseTo(t,p,e),e},e.prototype.andNot=function(t){var e=n();return this.bitwiseTo(t,d,e),e},e.prototype.not=function(){for(var t=n(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},e.prototype.shiftLeft=function(t){var e=n();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},e.prototype.shiftRight=function(t){var e=n();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},e.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+M(this[t]);return this.s<0?this.t*this.DB:-1},e.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,n=0;n<this.t;++n)t+=h(this[n]^e);return t},e.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:0!=(this[e]&1<<t%this.DB)},e.prototype.setBit=function(t){return this.changeBit(t,l)},e.prototype.clearBit=function(t){return this.changeBit(t,d)},e.prototype.flipBit=function(t){return this.changeBit(t,p)},e.prototype.add=function(t){var e=n();return this.addTo(t,e),e},e.prototype.subtract=function(t){var e=n();return this.subTo(t,e),e},e.prototype.multiply=function(t){var e=n();return this.multiplyTo(t,e),e},e.prototype.divide=function(t){var e=n();return this.divRemTo(t,e,null),e},e.prototype.remainder=function(t){var e=n();return this.divRemTo(t,null,e),e},e.prototype.divideAndRemainder=function(t){var e=n(),r=n();return this.divRemTo(t,e,r),new Array(e,r)},e.prototype.modPow=function(t,e){var r,o,c=t.bitLength(),l=i(1);if(c<=0)return l;r=c<18?1:c<48?3:c<144?4:c<768?5:6,o=c<8?new s(e):e.isEven()?new y(e):new u(e);var p=new Array,d=3,M=r-1,h=(1<<r)-1;if(p[1]=o.convert(this),r>1){var g=n();for(o.sqrTo(p[1],g);d<=h;)p[d]=n(),o.mulTo(g,p[d-2],p[d]),d+=2}var f,N,m=t.t-1,D=!0,j=n();for(c=a(t[m])-1;m>=0;){for(c>=M?f=t[m]>>c-M&h:(f=(t[m]&(1<<c+1)-1)<<M-c,m>0&&(f|=t[m-1]>>this.DB+c-M)),d=r;0==(1&f);)f>>=1,--d;if((c-=d)<0&&(c+=this.DB,--m),D)p[f].copyTo(l),D=!1;else{for(;d>1;)o.sqrTo(l,j),o.sqrTo(j,l),d-=2;d>0?o.sqrTo(l,j):(N=l,l=j,j=N),o.mulTo(j,p[f],l)}for(;m>=0&&0==(t[m]&1<<c);)o.sqrTo(l,j),N=l,l=j,j=N,--c<0&&(c=this.DB-1,--m)}return o.revert(l)},e.prototype.modInverse=function(t){var n=t.isEven();if(this.isEven()&&n||0==t.signum())return e.ZERO;for(var r=t.clone(),o=this.clone(),a=i(1),s=i(0),u=i(0),c=i(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),n?(a.isEven()&&s.isEven()||(a.addTo(this,a),s.subTo(t,s)),a.rShiftTo(1,a)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;o.isEven();)o.rShiftTo(1,o),n?(u.isEven()&&c.isEven()||(u.addTo(this,u),c.subTo(t,c)),u.rShiftTo(1,u)):c.isEven()||c.subTo(t,c),c.rShiftTo(1,c);r.compareTo(o)>=0?(r.subTo(o,r),n&&a.subTo(u,a),s.subTo(c,s)):(o.subTo(r,o),n&&u.subTo(a,u),c.subTo(s,c))}return 0!=o.compareTo(e.ONE)?e.ZERO:c.compareTo(t)>=0?c.subtract(t):c.signum()<0?(c.addTo(t,c),c.signum()<0?c.add(t):c):c},e.prototype.pow=function(t){return this.exp(t,new g)},e.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(e.compareTo(n)<0){var r=e;e=n,n=r}var o=e.getLowestSetBit(),i=n.getLowestSetBit();if(i<0)return e;for(o<i&&(i=o),i>0&&(e.rShiftTo(i,e),n.rShiftTo(i,n));e.signum()>0;)(o=e.getLowestSetBit())>0&&e.rShiftTo(o,e),(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),e.compareTo(n)>=0?(e.subTo(n,e),e.rShiftTo(1,e)):(n.subTo(e,n),n.rShiftTo(1,n));return i>0&&n.lShiftTo(i,n),n},e.prototype.isProbablePrime=function(t){var e,n=this.abs();if(1==n.t&&n[0]<=E[E.length-1]){for(e=0;e<E.length;++e)if(n[0]==E[e])return!0;return!1}if(n.isEven())return!1;for(e=1;e<E.length;){for(var r=E[e],o=e+1;o<E.length&&r<x;)r*=E[o++];for(r=n.modInt(r);e<o;)if(r%E[e++]==0)return!1}return n.millerRabin(t)},e.prototype.square=function(){var t=n();return this.squareTo(t),t},e.prototype.Barrett=y,null==C){var k;if(C=new Array,T=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var O=new Uint8Array(32);for(window.crypto.getRandomValues(O),k=0;k<32;++k)C[T++]=O[k]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var S=window.crypto.random(32);for(k=0;k<S.length;++k)C[T++]=255&S.charCodeAt(k)}for(;T<A;)k=Math.floor(65536*Math.random()),C[T++]=k>>>8,C[T++]=255&k;T=0,N()}D.prototype.nextBytes=function(t){var e;for(e=0;e<t.length;++e)t[e]=m()},j.prototype.init=function(t){var e,n,r;for(e=0;e<256;++e)this.S[e]=e;for(n=0,e=0;e<256;++e)r=this.S[e],this.S[e]=this.S[n=n+this.S[e]+t[e%t.length]&255],this.S[n]=r;this.i=0,this.j=0},j.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};var A=256;t.exports={default:e,BigInteger:e,SecureRandom:D}}).call(we)}),Ee={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},xe={sha256:ze};Q.prototype.verify=function(t,e){e=e.replace(/[^0-9a-f]|[\s\n]]/gi,"");var n=new Te.BigInteger(e,16);if(n.bitLength()>this.n.bitLength())throw new Error("Signature does not match with the key modulus.");var r=function(t){for(var e in Ee){var n=Ee[e],r=n.length;if(t.substring(0,r)===n)return{alg:e,hash:t.substring(r)}}return[]}(n.modPowInt(this.e,this.n).toString(16).replace(/^1f+00/,""));if(0===r.length)return!1;if(!xe.hasOwnProperty(r.alg))throw new Error("Hashing algorithm is not supported.");var o=xe[r.alg](t).toString();return r.hash===o};for(var ke=[],Oe=[],Se="undefined"!=typeof Uint8Array?Uint8Array:Array,Ae="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ue=0,_e=Ae.length;Ue<_e;++Ue)ke[Ue]=Ae[Ue],Oe[Ae.charCodeAt(Ue)]=Ue;Oe["-".charCodeAt(0)]=62,Oe["_".charCodeAt(0)]=63;var Ye=function(t){var e,n,r=function(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}(t),o=r[0],i=r[1],a=new Se(function(t,e,n){return 3*(e+n)/4-n}(0,o,i)),s=0,u=i>0?o-4:o;for(n=0;n<u;n+=4)e=Oe[t.charCodeAt(n)]<<18|Oe[t.charCodeAt(n+1)]<<12|Oe[t.charCodeAt(n+2)]<<6|Oe[t.charCodeAt(n+3)],a[s++]=e>>16&255,a[s++]=e>>8&255,a[s++]=255&e;return 2===i&&(e=Oe[t.charCodeAt(n)]<<2|Oe[t.charCodeAt(n+1)]>>4,a[s++]=255&e),1===i&&(e=Oe[t.charCodeAt(n)]<<10|Oe[t.charCodeAt(n+1)]<<4|Oe[t.charCodeAt(n+2)]>>2,a[s++]=e>>8&255,a[s++]=255&e),a},Qe=Y(function(t){var e,n;e=we,n=function(){function t(t){var e=[];if(0===t.length)return"";if("string"!=typeof t[0])throw new TypeError("Url must be a string. Received "+t[0]);if(t[0].match(/^[^\/:]+:\/*$/)&&t.length>1){var n=t.shift();t[0]=n+t[0]}t[0]=t[0].match(/^file:\/\/\//)?t[0].replace(/^([^\/:]+):\/*/,"$1:///"):t[0].replace(/^([^\/:]+):\/*/,"$1://");for(var r=0;r<t.length;r++){var o=t[r];if("string"!=typeof o)throw new TypeError("Url must be a string. Received "+o);""!==o&&(r>0&&(o=o.replace(/^[\/]+/,"")),o=o.replace(/[\/]+$/,r<t.length-1?"":"/"),e.push(o))}var i=e.join("/"),a=(i=i.replace(/\/(\?|&|#[^!])/g,"$1")).split("?");return a.shift()+(a.length>0?"?":"")+a.join("&")}return function(){return t("object"==typeof arguments[0]?arguments[0]:[].slice.call(arguments))}},t.exports?t.exports=n():e.urljoin=n()});H.prototype=Error.prototype,W.prototype=Error.prototype;var Pe=function(){function t(){}var e=t.prototype;return e.get=function(){return null},e.has=function(){return null},e.set=function(){return null},t}();Le.polyfill();var Be=function(t){return"number"==typeof t},Re=function(){return new Date};V.prototype.verify=function(t,e,n){if(!n&&e&&"function"==typeof e&&(n=e,e=void 0),!t)return n(new W("ID token is required but missing"),null);var r=this.decode(t);if(r instanceof Error)return n(new W("ID token could not be decoded"),null);var o=r.encoded.header+"."+r.encoded.payload,i=R(r.encoded.signature),a=r.header.alg,s=r.header.kid,u=r.payload.aud,c=r.payload.sub,l=r.payload.iss,p=r.payload.exp,d=r.payload.nbf,M=r.payload.iat,h=r.payload.azp,g=r.payload.auth_time,f=r.payload.nonce,y=this.__clock(),N=this;if(N.expectedAlg!==a)return n(new W('Signature algorithm of "'+a+'" is not supported. Expected the ID token to be signed with "RS256".'),null);this.getRsaVerifier(l,s,function(t,a){if(t)return n(t,null);if(!a.verify(o,i))return n(new W("Invalid ID token signature."),null);if(!l||"string"!=typeof l)return n(new W("Issuer (iss) claim must be a string present in the ID token"),null);if(N.issuer!==l)return n(new W('Issuer (iss) claim mismatch in the ID token, expected "'+N.issuer+'", found "'+l+'"'),null);if(!c||"string"!=typeof c)return n(new W("Subject (sub) claim must be a string present in the ID token"),null);if(!u||"string"!=typeof u&&!Array.isArray(u))return n(new W("Audience (aud) claim must be a string or array of strings present in the ID token"),null);if(Array.isArray(u)&&!u.includes(N.audience))return n(new W('Audience (aud) claim mismatch in the ID token; expected "'+N.audience+'" but was not one of "'+u.join(", ")+'"'),null);if("string"==typeof u&&N.audience!==u)return n(new W('Audience (aud) claim mismatch in the ID token; expected "'+N.audience+'" but found "'+u+'"'),null);if(e){if(!f||"string"!=typeof f)return n(new W("Nonce (nonce) claim must be a string present in the ID token"),null);if(f!==e)return n(new W('Nonce (nonce) claim value mismatch in the ID token; expected "'+e+'", found "'+f+'"'),null)}if(Array.isArray(u)&&u.length>1){if(!h||"string"!=typeof h)return n(new W("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values"),null);if(h!==N.audience)return n(new W('Authorized Party (azp) claim mismatch in the ID token; expected "'+N.audience+'", found "'+h+'"'),null)}if(!p||!Be(p))return n(new W("Expiration Time (exp) claim must be a number present in the ID token"),null);if(!M||!Be(M))return n(new W("Issued At (iat) claim must be a number present in the ID token"),null);var s=p+N.leeway,m=new Date(0);if(m.setUTCSeconds(s),y>m)return n(new W('Expiration Time (exp) claim error in the ID token; current time "'+y+'" is after expiration time "'+m+'"'),null);if(d&&Be(d)){var D=d-N.leeway,j=new Date(0);if(j.setUTCSeconds(D),y<j)return n(new W('Not Before Time (nbf) claim error in the ID token; current time "'+y+'" is before the not before time "'+j+'"'),null)}if(N.maxAge){if(!g||!Be(g))return n(new W("Authentication Time (auth_time) claim must be a number present in the ID token when Max Age (max_age) is specified"),null);var I=g+N.maxAge+N.leeway,w=new Date(0);if(w.setUTCSeconds(I),y>w)return n(new W('Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time "'+y+'" is after last auth time at "'+w+'"'),null)}return n(null,r.payload)})},V.prototype.getRsaVerifier=function(t,e,n){var r=this,o=t+e;Promise.resolve(this.jwksCache.has(o)).then(function(n){return n?r.jwksCache.get(o):(i={jwksURI:r.jwksURI,iss:t,kid:e},("undefined"==typeof fetch?G:fetch)(i.jwksURI||Qe(i.iss,".well-known","jwks.json")).then(Z).then(function(t){var e,n,r,o=null;for(e=0;e<t.keys.length&&null===o;e++)(n=t.keys[e]).kid===i.kid&&(o=n);if(!o)throw new Error('Could not find a public key for Key ID (kid) "'+i.kid+'"');return{modulus:R((r=o).n),exp:R(r.e)}}).catch(function(t){throw t}));var i}).then(function(t){if(!t||!t.modulus||!t.exp)throw new Error("Empty keyInfo in response");return Promise.resolve(r.jwksCache.set(o,t)).then(function(){n&&n(null,new Q(t.modulus,t.exp))})}).catch(function(t){n&&n(t)})},V.prototype.decode=function(t){var e,n,r=t.split(".");if(3!==r.length)return new W("Cannot decode a malformed JWT");try{e=JSON.parse(B(r[0])),n=JSON.parse(B(r[1]))}catch(t){return new W("Token header or payload is not valid JSON")}return{header:e,payload:n,encoded:{header:r[0],payload:r[1],signature:r[2]}}},V.prototype.validateAccessToken=function(t,e,n,r){if(this.expectedAlg!==e)return r(new W('Signature algorithm of "'+e+'" is not supported. Expected "'+this.expectedAlg+'"'));var o,i=ze(t),a=Ce.stringify(i),s=a.substring(0,a.length/2),u=Ce.parse(s),c=be.stringify(u);return r((o={"+":"-","/":"_","=":""},c.replace(/[+\/=]/g,function(t){return o[t]})!==n?new W("Invalid access_token"):null))},F.prototype.get=function(t){for(var e=0;e<this.plugins.length;e++)if(this.plugins[e].supports(t))return this.plugins[e].init();return null};var Ge={randomString:function(t){var e=new Uint8Array(t),n=[],r="0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._~",o=ye.getWindow().crypto||ye.getWindow().msCrypto;if(!o)return null;for(var i=o.getRandomValues(e),a=0;a<i.length;a++)n.push(r[i[a]%r.length]);return n.join("")}};J.prototype.process=function(t){if(!t.responseType)throw new Error("responseType is required");var e=t.realm||t.connection,n=-1!==t.responseType.indexOf("id_token"),r=this.generateTransaction(t.appState,t.state,t.nonce,e,n,t.organization);return t.state||(t.state=r.state),n&&!t.nonce&&(t.nonce=r.nonce),t},J.prototype.generateTransaction=function(t,e,n,r,o,i){if(e=e||Ge.randomString(this.keyLength),n=n||(o?Ge.randomString(this.keyLength):null),!(ye.getWindow().location.host===this.options.domain)){var a={nonce:n,appState:t,state:e,lastUsedConnection:r};i&&(a.organization=i),this.storage.setItem(this.namespace+e,a,{expires:1/48})}return{state:e,nonce:n}},J.prototype.getStoredTransaction=function(t){var e;return e=this.storage.getItem(this.namespace+t),this.clearTransaction(t),e},J.prototype.clearTransaction=function(t){this.storage.removeItem(this.namespace+t)},q.prototype.init=function(){var t=this,e=ye.getWindow();switch(this.iframe=e.document.createElement("iframe"),this.iframe.style.display="none",this.proxyEventListener=function(e){t.eventListener(e)},this.eventListenerType){case"message":this.eventSourceObject=e;break;case"load":this.eventSourceObject=this.iframe;break;default:throw new Error("Unsupported event listener type: "+this.eventListenerType)}this.eventSourceObject.addEventListener(this.eventListenerType,this.proxyEventListener,!1),e.document.body.appendChild(this.iframe),this.iframe.src=this.url,this.timeoutHandle=setTimeout(function(){t.timeoutHandler()},this.timeout)},q.prototype.eventListener=function(t){var e={event:t,sourceObject:this.eventSourceObject};this.eventValidator.isValid(e)&&(this.destroy(),this.callback(e))},q.prototype.timeoutHandler=function(){this.destroy(),this.timeoutCallback&&this.timeoutCallback()},q.prototype.destroy=function(){var t=this;clearTimeout(this.timeoutHandle),this._destroyTimeout=setTimeout(function(){t.eventSourceObject.removeEventListener(t.eventListenerType,t.proxyEventListener,!1),t.iframe.parentNode&&t.iframe.parentNode.removeChild(t.iframe)},0)},X.prototype.run=function(t,e){var n=this;t.responseMode="web_message",t.prompt="none";var r=ye.getOrigin(),o=fe.getOriginFromUrl(t.redirectUri);if(o&&r!==o)return e({error:"origin_mismatch",error_description:"The redirectUri's origin ("+o+") should match the window's origin ("+r+")."});!function(t,e,n){new q({url:t,eventListenerType:"message",callback:function(t){n(null,t)},timeout:e.timeout,eventValidator:{isValid:function(t){return"authorization_response"===t.event.data.type&&e.state===t.event.data.response.state}},timeoutCallback:function(){n({error:"timeout",error_description:"Timeout during executing web_message communication",state:e.state})}}).init()}(this.webAuth.client.buildAuthorizeUrl(t),t,function(r,o){var i=r;if(!r&&o.event.data.response.error&&(i=o.event.data.response),!i){var a=o.event.data.response;return n.webAuth.validateAuthenticationResponse(t,a,e)}return"consent_required"===i.error&&"localhost"===ye.getWindow().location.hostname&&n.warn.warning("Consent Required. Consent can't be skipped on localhost. Read more here: https://auth0.com/docs/api-auth/user-consent#skipping-consent-for-first-party-clients"),n.webAuth.transactionManager.clearTransaction(i.state),e(fe.pick(i,["error","error_description"]))})},K.prototype.login=function(t,e){var n=this,r=gt(this.baseOptions.rootUrl,"/co/authenticate");t.username=t.username||t.email,delete t.email;var o={client_id:t.clientID||this.baseOptions.clientID,username:t.username};t.password&&(o.password=t.password),t.otp&&(o.otp=t.otp);var i=t.realm||this.baseOptions.realm;if(i){var a=t.credentialType||this.baseOptions.credentialType||"http://auth0.com/oauth/grant-type/password-realm";o.realm=i,o.credential_type=a}else o.credential_type="password";this.request.post(r).withCredentials().send(o).end(function(r,o){function i(){var r=!0===t.popup;t=fe.blacklist(t,["password","credentialType","otp","popup","onRedirecting"]);var i=fe.merge(t).with({loginTicket:o.body.login_ticket}),a=$(n.baseOptions.rootUrl,o.body.co_id);n.storage.setItem(a,o.body.co_verifier,{expires:1/96}),r?n.webMessageHandler.run(i,_(e,{forceLegacyError:!0})):n.webAuth.authorize(i)}if(r){var a=r.response&&r.response.body||{error:"request_error",error_description:JSON.stringify(r)};return _(e,{forceLegacyError:!0})(a)}"function"==typeof t.onRedirecting?t.onRedirecting(i):i()})},K.prototype.callback=function(){var t=decodeURIComponent(function(t){var e=("&"+ye.getWindow().location.hash.substring(1)).split("&origin=");if(2===e.length)return e.pop().split("&").shift()}()),e=ye.getWindow(),n=this;e.addEventListener("message",function(t){if("co_verifier_request"===t.data.type){var e=$(t.origin,t.data.request.id),r=function(t,e){try{var n=t.getItem(e);return t.removeItem(e),n||""}catch(t){return""}}(n.storage,e);t.source.postMessage({type:"co_verifier_response",response:{verifier:r}},t.origin)}}),e.parent.postMessage({type:"ready"},t)},tt.prototype.loginWithCredentials=function(t,e){t.realm=t.realm||t.connection,delete t.connection,this.crossOriginAuthentication.login(t,e)},tt.prototype.signupAndLogin=function(t,e){var n=this;return this.webAuth.client.dbConnection.signup(t,function(r){return r?e(r):(t.realm=t.realm||t.connection,delete t.connection,n.webAuth.login(t,e))})};var Ze=r(function(t){var e=function(){function t(t,e,n){t.attachEvent?t.attachEvent("on"+e,n):t.addEventListener&&t.addEventListener(e,n,!1)}function e(t,e,n){t.detachEvent?t.detachEvent("on"+e,n):t.removeEventListener&&t.removeEventListener(e,n,!1)}function n(t){/^https?:\/\//.test(t)||(t=window.location.href);var e=/^(https?:\/\/[\-_a-zA-Z\.0-9:]+)/.exec(t);return e?e[1]:t}var r=function(){if("undefined"==typeof navigator)return!1;var t=-1,e=navigator.userAgent;return"Microsoft Internet Explorer"===navigator.appName?null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(e)&&(t=parseFloat(RegExp.$1)):e.indexOf("Trident")>-1&&null!==new RegExp("rv:([0-9]{2,2}[.0-9]{0,})").exec(e)&&(t=parseFloat(RegExp.$1)),t>=8}();return"undefined"!=typeof window&&window.JSON&&window.JSON.stringify&&window.JSON.parse&&window.postMessage?{open:function(o,i){function a(){if(c&&document.body.removeChild(c),c=void 0,M&&(M=clearInterval(M)),e(window,"message",s),e(window,"unload",a),d)try{d.close()}catch(t){l.postMessage("die",p)}d=l=void 0}function s(t){if(t.origin===p){try{var e=JSON.parse(t.data)}catch(t){if(i)return i(t);throw t}"ready"===e.a?l.postMessage(h,p):"error"===e.a?(a(),i&&(i(e.d),i=null)):"response"===e.a&&(a(),i&&(i(null,e.d),i=null))}}if(!i)throw"missing required callback argument";var u,c;o.url||(u="missing required 'url' parameter"),o.relay_url||(u="missing required 'relay_url' parameter"),u&&setTimeout(function(){i(u)},0),o.window_name||(o.window_name=null),o.window_features&&!function(){try{var t=navigator.userAgent;return-1!=t.indexOf("Fennec/")||-1!=t.indexOf("Firefox/")&&-1!=t.indexOf("Android")}catch(t){}return!1}()||(o.window_features=void 0);var l,p=o.origin||n(o.url);if(p!==n(o.relay_url))return setTimeout(function(){i("invalid arguments: origin of url and relay_url must match")},0);r&&((c=document.createElement("iframe")).setAttribute("src",o.relay_url),c.style.display="none",c.setAttribute("name","__winchan_relay_frame"),document.body.appendChild(c),l=c.contentWindow);var d=o.popup||window.open(o.url,o.window_name,o.window_features);o.popup&&(d.location.href=o.url),l||(l=d);var M=setInterval(function(){d&&d.closed&&(a(),i&&(i("User closed the popup window"),i=null))},500),h=JSON.stringify({a:"request",d:o.params});return t(window,"unload",a),t(window,"message",s),{originalPopup:d,close:a,focus:function(){if(d)try{d.focus()}catch(t){}}}},onOpen:function(n){function o(t){t=JSON.stringify(t),r?s.doPost(t,a):s.postMessage(t,a)}function i(t){if("die"===t.data)try{window.close()}catch(t){}}var a="*",s=r?function(){for(var t=window.opener.frames,e=t.length-1;e>=0;e--)try{if(t[e].location.protocol===window.location.protocol&&t[e].location.host===window.location.host&&"__winchan_relay_frame"===t[e].name)return t[e]}catch(t){}}():window.opener;if(!s)throw"can't find relay frame";t(r?s:window,"message",function t(r){var i;try{i=JSON.parse(r.data)}catch(t){}i&&"request"===i.a&&(e(window,"message",t),a=r.origin,n&&setTimeout(function(){n(a,i.d,function(t){n=void 0,o({a:"response",d:t})})},0))}),t(r?s:window,"message",i);try{o({a:"ready"})}catch(e){t(s,"load",function(t){o({a:"ready"})})}var u=function(){try{e(r?s:window,"message",i)}catch(t){}n&&o({a:"error",d:"client closed window"}),n=void 0;try{window.close()}catch(t){}};return t(window,"unload",u),{detach:function(){e(window,"unload",u)}}}}:{open:function(t,e,n,r){setTimeout(function(){r("unsupported browser")},0)},onOpen:function(t){setTimeout(function(){t("unsupported browser")},0)}}}();t.exports&&(t.exports=e)}),He={extractOrigin:function(t){/^https?:\/\//.test(t)||(t=window.location.href);var e=/^(https?:\/\/[-_a-zA-Z.0-9:]+)/.exec(t);return e?e[1]:t}};et.prototype.calculatePosition=function(t){var e=t.width||500,n=t.height||600,r=ye.getWindow(),o=void 0!==r.screenX?r.screenX:r.screenLeft,i=void 0!==r.screenY?r.screenY:r.screenTop,a=void 0!==r.outerWidth?r.outerWidth:r.document.body.clientWidth,s=void 0!==r.outerHeight?r.outerHeight:r.document.body.clientHeight;return{width:e,height:n,left:t.left||o+(a-e)/2,top:t.top||i+(s-n)/2}},et.prototype.preload=function(t){var e=this,n=ye.getWindow(),r=this.calculatePosition(t.popupOptions||{}),o=fe.merge(r).with(t.popupOptions),i=t.url||"about:blank",a=Bt(o,{encode:!1,delimiter:","});return this._current_popup&&!this._current_popup.closed||(this._current_popup=n.open(i,"auth0_signup_popup",a),this._current_popup.kill=function(){this.close(),e._current_popup=null}),this._current_popup},et.prototype.load=function(t,e,n,r){var o=this,i=this.calculatePosition(n.popupOptions||{}),a=fe.merge(i).with(n.popupOptions),s=fe.merge({url:t,relay_url:e,window_features:Bt(a,{delimiter:",",encode:!1}),popup:this._current_popup}).with(n),u=Ze.open(s,function(t,e){if(!t||"SyntaxError"!==t.name)return o._current_popup=null,r(t,e)});return u.focus(),u},nt.prototype.buildPopupHandler=function(){var t=this.baseOptions.plugins.get("popup.getPopupHandler");return t?t.getPopupHandler():new et},nt.prototype.preload=function(t){t=t||{};var e=this.buildPopupHandler();return e.preload(t),e},nt.prototype.getPopupHandler=function(t,e){return t.popupHandler?t.popupHandler:e?this.preload(t):this.buildPopupHandler()},nt.prototype.callback=function(t){var e=this,n=ye.getWindow(),r=(t=t||{}).popupOrigin||this.baseOptions.popupOrigin||ye.getOrigin();n.opener?Ze.onOpen(function(n,o,i){if(n!==r)return i({error:"origin_mismatch",error_description:"The popup's origin ("+n+") should match the `popupOrigin` parameter ("+r+")."});e.webAuth.parseHash(t||{},function(t,e){return i(t||e)})}):n.doPost=function(t){n.parent&&n.parent.postMessage(t,r)}},nt.prototype.authorize=function(t,e){var n,r,o={},i=this.baseOptions.plugins.get("popup.authorize"),a=fe.merge(this.baseOptions,["clientID","scope","domain","audience","tenant","responseType","redirectUri","_csrf","state","_intstate","nonce","organization","invitation"]).with(fe.blacklist(t,["popupHandler"]));return he.check(a,{type:"object",message:"options parameter is not valid"},{responseType:{type:"string",message:"responseType option is required"}}),r=gt(this.baseOptions.rootUrl,"relay.html"),t.owp?a.owp=!0:(o.origin=He.extractOrigin(a.redirectUri),r=a.redirectUri),t.popupOptions&&(o.popupOptions=fe.pick(t.popupOptions,["width","height","top","left"])),i&&(a=i.processParams(a)),(a=this.transactionManager.process(a)).scope=a.scope||"openid profile email",delete a.domain,n=this.client.buildAuthorizeUrl(a),this.getPopupHandler(t).load(n,r,o,_(e,{keepOriginalCasing:!0}))},nt.prototype.loginWithCredentials=function(t,e){t.realm=t.realm||t.connection,t.popup=!0,t=fe.merge(this.baseOptions,["redirectUri","responseType","state","nonce"]).with(fe.blacklist(t,["popupHandler","connection"])),t=this.transactionManager.process(t),this.crossOriginAuthentication.login(t,e)},nt.prototype.passwordlessVerify=function(t,e){var n=this;return this.client.passwordless.verify(fe.blacklist(t,["popupHandler"]),function(r){if(r)return e(r);t.username=t.phoneNumber||t.email,t.password=t.verificationCode,delete t.email,delete t.phoneNumber,delete t.verificationCode,delete t.type,n.client.loginWithResourceOwner(t,e)})},nt.prototype.signupAndLogin=function(t,e){var n=this;return this.client.dbConnection.signup(t,function(r){if(r)return e(r);n.loginWithCredentials(t,e)})},rt.create=function(t){return new rt(t)},rt.prototype.login=function(t,e){this.handler=new q({auth0:this.auth0,url:this.authenticationUrl,eventListenerType:t?"message":"load",callback:this.getCallbackHandler(e,t),timeout:this.timeout,eventValidator:this.getEventValidator(),timeoutCallback:function(){e(null,"#error=timeout&error_description=Timeout+during+authentication+renew.")},usePostMessage:t||!1}),this.handler.init()},rt.prototype.getEventValidator=function(){var t=this;return{isValid:function(e){switch(e.event.type){case"message":return e.event.origin===t.postMessageOrigin&&e.event.source===t.handler.iframe.contentWindow&&(!1===t.postMessageDataType||e.event.data.type&&e.event.data.type===t.postMessageDataType);case"load":if("about:"===e.sourceObject.contentWindow.location.protocol)return!1;default:return!0}}}},rt.prototype.getCallbackHandler=function(t,e){return function(n){var r;r=e?"object"==typeof n.event.data&&n.event.data.hash?n.event.data.hash:n.event.data:n.sourceObject.contentWindow.location.hash,t(null,r)}},ot.prototype.login=function(t,e){var n,r;return n=gt(this.baseOptions.rootUrl,"usernamepassword","login"),t.username=t.username||t.email,t=fe.blacklist(t,["email","onRedirecting"]),r=fe.merge(this.baseOptions,["clientID","redirectUri","tenant","responseType","responseMode","scope","audience"]).with(t),r=this.transactionManager.process(r),r=fe.toSnakeCase(r,["auth0Client"]),this.request.post(n).send(r).end(_(e))},ot.prototype.callback=function(t){var e,n=ye.getDocument();(e=n.createElement("div")).innerHTML=t,n.body.appendChild(e).children[0].submit()},it.prototype.login=function(t,e){if(ye.getWindow().location.host!==this.baseOptions.domain)throw new Error("This method is meant to be used only inside the Universal Login Page.");var n,r=fe.merge(this.baseOptions,["clientID","redirectUri","tenant","responseType","responseMode","scope","audience","_csrf","state","_intstate","nonce"]).with(t);return he.check(r,{type:"object",message:"options parameter is not valid"},{responseType:{type:"string",message:"responseType option is required"}}),(n=new ot(this.baseOptions)).login(r,function(r,o){function i(){n.callback(o)}return r?e(r):"function"==typeof t.onRedirecting?t.onRedirecting(function(){i()}):void i()})},it.prototype.signupAndLogin=function(t,e){var n=this;return n.client.client.dbConnection.signup(t,function(r){return r?e(r):n.login(t,e)})},it.prototype.getSSOData=function(t,e){var n,r="";return"function"==typeof t&&(e=t,t=!1),he.check(t,{type:"boolean",message:"withActiveDirectories parameter is not valid"}),he.check(e,{type:"function",message:"cb parameter is not valid"}),t&&(r="?"+Bt({ldaps:1,client_id:this.baseOptions.clientID})),n=gt(this.baseOptions.rootUrl,"user","ssodata",r),this.request.get(n,{noHeaders:!0}).withCredentials().end(_(e))};var We=function(){},Ve={lang:"en",templates:{auth0:function(t){var e="code"===t.type?"Enter the code shown above":"Solve the formula shown above";return'<div class="captcha-challenge">\n <img src="'+t.image+'" />\n <button type="button" class="captcha-reload">↺</button>\n</div>\n<input type="text" name="captcha"\n class="form-control captcha-control"\n placeholder="'+e+'" />'},recaptcha_v2:function(){return'<div class="recaptcha" ></div><input type="hidden" name="captcha" />'},recaptcha_enterprise:function(){return'<div class="recaptcha" ></div><input type="hidden" name="captcha" />'},error:function(){return'<div class="error" style="color: red;">Error getting the bot detection challenge. Please contact the system administrator.</div>'}}},Fe={render:function(t,e,n,r){function o(r){r=r||We,t.getChallenge(function(t,i){return t?(e.innerHTML=n.templates.error(t),r(t)):i.required?(e.style.display="","auth0"===i.provider?function(t,e,n,r){t.innerHTML=e.templates[n.provider](n),t.querySelector(".captcha-reload").addEventListener("click",function(t){t.preventDefault(),r()})}(e,n,i,o):"recaptcha_v2"!==i.provider&&"recaptcha_enterprise"!==i.provider||function(t,e,n){function r(e){t.querySelector('input[name="captcha"]').value=e||""}var o=t.hasAttribute("data-wid")&&t.getAttribute("data-wid");if(o)return r(),void at(n.provider).reset(o);t.innerHTML=e.templates[n.provider](n);var i=t.querySelector(".recaptcha");st(0,{lang:e.lang,provider:n.provider},function(){var e=at(n.provider);o=e.render(i,{callback:r,"expired-callback":function(){r()},"error-callback":function(){r()},sitekey:n.siteKey}),t.setAttribute("data-wid",o)})}(e,n,i),void r()):(e.style.display="none",void(e.innerHTML=""))})}return n=fe.merge(Ve).with(n||{}),o(r),{reload:o,getValue:function(){var t=e.querySelector('input[name="captcha"]');if(t)return t.value}}}};ct.prototype.parseHash=function(t,e){var n,r;e||"function"!=typeof t?t=t||{}:(e=t,t={});var o=ye.getWindow(),i=void 0===t.hash?o.location.hash:t.hash;if(i=i.replace(/^#?\/?/,""),(n=Pt(i)).hasOwnProperty("error"))return r=me.buildResponse(n.error,n.error_description),n.state&&(r.state=n.state),e(r);if(!n.hasOwnProperty("access_token")&&!n.hasOwnProperty("id_token")&&!n.hasOwnProperty("refresh_token"))return e(null,null);var a=(this.baseOptions.responseType||t.responseType||"").split(" ");return a.length>0&&-1!==a.indexOf("token")&&!n.hasOwnProperty("access_token")?e(me.buildResponse("invalid_hash","response_type contains `token`, but the parsed hash does not contain an `access_token` property")):a.length>0&&-1!==a.indexOf("id_token")&&!n.hasOwnProperty("id_token")?e(me.buildResponse("invalid_hash","response_type contains `id_token`, but the parsed hash does not contain an `id_token` property")):this.validateAuthenticationResponse(t,n,e)},ct.prototype.validateAuthenticationResponse=function(t,e,n){var r=this;t.__enableIdPInitiatedLogin=t.__enableIdPInitiatedLogin||t.__enableImpersonation;var o=e.state,i=this.transactionManager.getStoredTransaction(o),a=t.state||i&&i.state||null,s=a===o;if((o||a||!t.__enableIdPInitiatedLogin)&&!s)return n({error:"invalid_token",errorDescription:"`state` does not match."});var u=t.nonce||i&&i.nonce||null,c=i&&i.organization,l=t.state||i&&i.appState||null,p=function(t,o){if(t)return n(t);var a;return i&&i.lastUsedConnection&&(o&&(a=o.sub),r.ssodataStorage.set(i.lastUsedConnection,a)),n(null,function(t,e,n){return{accessToken:t.access_token||null,idToken:t.id_token||null,idTokenPayload:n||null,appState:e||null,refreshToken:t.refresh_token||null,state:t.state||null,expiresIn:t.expires_in?parseInt(t.expires_in,10):null,tokenType:t.token_type||null,scope:t.scope||null}}(e,l,o))};return e.id_token?this.validateToken(e.id_token,u,function(t,n){if(!t){if(c){if(!n.org_id)return p(me.invalidToken("Organization Id (org_id) claim must be a string present in the ID token"));if(n.org_id!==c)return p(me.invalidToken('Organization Id (org_id) claim value mismatch in the ID token; expected "'+c+'", found "'+n.org_id+'"'))}return e.access_token&&n.at_hash?(new V).validateAccessToken(e.access_token,"RS256",n.at_hash,function(t){return t?p(me.invalidToken(t.message)):p(null,n)}):p(null,n)}if("invalid_token"!==t.error||t.errorDescription&&t.errorDescription.indexOf("Nonce (nonce) claim value mismatch in the ID token")>-1)return p(t);var o=(new V).decode(e.id_token);return"HS256"!==o.header.alg?p(t):(o.payload.nonce||null)!==u?p({error:"invalid_token",errorDescription:'Nonce (nonce) claim value mismatch in the ID token; expected "'+u+'", found "'+o.payload.nonce+'"'}):e.access_token?r.client.userInfo(e.access_token,function(t,e){return t?p(t):p(null,e)}):p({error:"invalid_token",description:"The id_token cannot be validated because it was signed with the HS256 algorithm and public clients (like a browser) can’t store secrets. Please read the associated doc for possible ways to fix this. Read more: https://auth0.com/docs/errors/libraries/auth0-js/invalid-token#parsing-an-hs256-signed-id-token-without-an-access-token"})}):p(null,null)},ct.prototype.validateToken=function(t,e,n){new V({issuer:this.baseOptions.token_issuer,jwksURI:this.baseOptions.jwksURI,audience:this.baseOptions.clientID,leeway:this.baseOptions.leeway||60,maxAge:this.baseOptions.maxAge,__clock:this.baseOptions.__clock||ut}).verify(t,e,function(t,e){if(t)return n(me.invalidToken(t.message));n(null,e)})},ct.prototype.renewAuth=function(t,e){var n=!!t.usePostMessage,r=t.postMessageDataType||!1,o=t.postMessageOrigin||ye.getWindow().origin,i=t.timeout,a=this,s=fe.merge(this.baseOptions,["clientID","redirectUri","responseType","scope","audience","_csrf","state","_intstate","nonce"]).with(t);s.responseType=s.responseType||"token",s.responseMode=s.responseMode||"fragment",s=this.transactionManager.process(s),he.check(s,{type:"object",message:"options parameter is not valid"}),he.check(e,{type:"function",message:"cb parameter is not valid"}),s.prompt="none",s=fe.blacklist(s,["usePostMessage","tenant","postMessageDataType","postMessageOrigin"]),rt.create({authenticationUrl:this.client.buildAuthorizeUrl(s),postMessageDataType:r,postMessageOrigin:o,timeout:i}).login(n,function(t,n){if("object"==typeof n)return e(t,n);a.parseHash({hash:n},e)})},ct.prototype.checkSession=function(t,e){var n=fe.merge(this.baseOptions,["clientID","responseType","redirectUri","scope","audience","_csrf","state","_intstate","nonce"]).with(t);return"code"===n.responseType?e({error:"error",error_description:"responseType can't be `code`"}):(t.nonce||(n=this.transactionManager.process(n)),n.redirectUri?(he.check(n,{type:"object",message:"options parameter is not valid"}),he.check(e,{type:"function",message:"cb parameter is not valid"}),n=fe.blacklist(n,["usePostMessage","tenant","postMessageDataType"]),void this.webMessageHandler.run(n,_(e,{forceLegacyError:!0,ignoreCasing:!0}))):e({error:"error",error_description:"redirectUri can't be empty"}))},ct.prototype.changePassword=function(t,e){return this.client.dbConnection.changePassword(t,e)},ct.prototype.passwordlessStart=function(t,e){var n=fe.merge(this.baseOptions,["responseType","responseMode","redirectUri","scope","audience","_csrf","state","_intstate","nonce"]).with(t.authParams);return t.authParams=this.transactionManager.process(n),this.client.passwordless.start(t,e)},ct.prototype.signup=function(t,e){return this.client.dbConnection.signup(t,e)},ct.prototype.authorize=function(t){var e=fe.merge(this.baseOptions,["clientID","responseType","responseMode","redirectUri","scope","audience","_csrf","state","_intstate","nonce","organization","invitation"]).with(t);he.check(e,{type:"object",message:"options parameter is not valid"},{responseType:{type:"string",message:"responseType option is required"}}),(e=this.transactionManager.process(e)).scope=e.scope||"openid profile email",ye.redirect(this.client.buildAuthorizeUrl(e))},ct.prototype.signupAndAuthorize=function(t,e){var n=this;return this.client.dbConnection.signup(fe.blacklist(t,["popupHandler"]),function(r){if(r)return e(r);t.realm=t.connection,t.username||(t.username=t.email),n.client.login(t,e)})},ct.prototype.login=function(t,e){var n=fe.merge(this.baseOptions,["clientID","responseType","redirectUri","scope","audience","_csrf","state","_intstate","nonce","onRedirecting","organization","invitation"]).with(t);n=this.transactionManager.process(n),ye.getWindow().location.host===this.baseOptions.domain?(n.connection=n.realm,delete n.realm,this._universalLogin.login(n,e)):this.crossOriginAuthentication.login(n,e)},ct.prototype.passwordlessLogin=function(t,e){var n=fe.merge(this.baseOptions,["clientID","responseType","redirectUri","scope","audience","_csrf","state","_intstate","nonce","onRedirecting"]).with(t);if(n=this.transactionManager.process(n),ye.getWindow().location.host===this.baseOptions.domain)this.passwordlessVerify(n,e);else{var r=fe.extend({credentialType:"http://auth0.com/oauth/grant-type/passwordless/otp",realm:n.connection,username:n.email||n.phoneNumber,otp:n.verificationCode},fe.blacklist(n,["connection","email","phoneNumber","verificationCode"]));this.crossOriginAuthentication.login(r,e)}},ct.prototype.crossOriginAuthenticationCallback=function(){this.crossOriginVerification()},ct.prototype.crossOriginVerification=function(){this.crossOriginAuthentication.callback()},ct.prototype.logout=function(t){ye.redirect(this.client.buildLogoutUrl(t))},ct.prototype.passwordlessVerify=function(t,e){var n=this,r=fe.merge(this.baseOptions,["clientID","responseType","responseMode","redirectUri","scope","audience","_csrf","state","_intstate","nonce","onRedirecting"]).with(t);return he.check(r,{type:"object",message:"options parameter is not valid"},{responseType:{type:"string",message:"responseType option is required"}}),r=this.transactionManager.process(r),this.client.passwordless.verify(r,function(o){function i(){ye.redirect(n.client.passwordless.buildVerifyUrl(r))}return o?e(o):"function"==typeof t.onRedirecting?t.onRedirecting(function(){i()}):void i()})},ct.prototype.renderCaptcha=function(t,e,n){return Fe.render(this.client,t,e,n)},lt.prototype.buildVerifyUrl=function(t){var e,n;return he.check(t,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},verificationCode:{type:"string",message:"verificationCode option is required"},phoneNumber:{optional:!1,type:"string",message:"phoneNumber option is required",condition:function(t){return!t.email}},email:{optional:!1,type:"string",message:"email option is required",condition:function(t){return!t.phoneNumber}}}),e=fe.merge(this.baseOptions,["clientID","responseType","responseMode","redirectUri","scope","audience","_csrf","state","_intstate","protocol","nonce"]).with(t),this.baseOptions._sendTelemetry&&(e.auth0Client=this.request.getTelemetryData()),e=fe.toSnakeCase(e,["auth0Client"]),n=Bt(e),gt(this.baseOptions.rootUrl,"passwordless","verify_redirect","?"+n)},lt.prototype.start=function(t,e){var n,r;return he.check(t,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},send:{type:"string",message:"send option is required",values:["link","code"],value_message:"send is not valid ([link, code])"},phoneNumber:{optional:!0,type:"string",message:"phoneNumber option is required",condition:function(t){return"code"===t.send||!t.email}},email:{optional:!0,type:"string",message:"email option is required",condition:function(t){return"link"===t.send||!t.phoneNumber}},authParams:{optional:!0,type:"object",message:"authParams option is required"}}),he.check(e,{type:"function",message:"cb parameter is not valid"}),n=gt(this.baseOptions.rootUrl,"passwordless","start"),(r=fe.merge(this.baseOptions,["clientID","responseType","redirectUri","scope"]).with(t)).scope&&(r.authParams=r.authParams||{},r.authParams.scope=r.authParams.scope||r.scope),r.redirectUri&&(r.authParams=r.authParams||{},r.authParams.redirect_uri=r.authParams.redirectUri||r.redirectUri),r.responseType&&(r.authParams=r.authParams||{},r.authParams.response_type=r.authParams.responseType||r.responseType),delete r.redirectUri,delete r.responseType,delete r.scope,r=fe.toSnakeCase(r,["auth0Client","authParams"]),this.request.post(n).send(r).end(_(e))},lt.prototype.verify=function(t,e){var n,r;return he.check(t,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},verificationCode:{type:"string",message:"verificationCode option is required"},phoneNumber:{optional:!1,type:"string",message:"phoneNumber option is required",condition:function(t){return!t.email}},email:{optional:!1,type:"string",message:"email option is required",condition:function(t){return!t.phoneNumber}}}),he.check(e,{type:"function",message:"cb parameter is not valid"}),r=fe.pick(t,["connection","verificationCode","phoneNumber","email","auth0Client"]),r=fe.toSnakeCase(r,["auth0Client"]),n=gt(this.baseOptions.rootUrl,"passwordless","verify"),this.request.post(n).send(r).end(_(e))},pt.prototype.signup=function(t,e){var n,r,o;return he.check(t,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},email:{type:"string",message:"email option is required"},password:{type:"string",message:"password option is required"}}),he.check(e,{type:"function",message:"cb parameter is not valid"}),n=gt(this.baseOptions.rootUrl,"dbconnections","signup"),o=(r=fe.merge(this.baseOptions,["clientID","state"]).with(t)).user_metadata||r.userMetadata,r=fe.blacklist(r,["scope","userMetadata","user_metadata"]),r=fe.toSnakeCase(r,["auth0Client"]),o&&(r.user_metadata=o),this.request.post(n).send(r).end(_(e))},pt.prototype.changePassword=function(t,e){var n,r;return he.check(t,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},email:{type:"string",message:"email option is required"}}),he.check(e,{type:"function",message:"cb parameter is not valid"}),n=gt(this.baseOptions.rootUrl,"dbconnections","change_password"),r=fe.merge(this.baseOptions,["clientID"]).with(t,["email","connection"]),r=fe.toSnakeCase(r,["auth0Client"]),this.request.post(n).send(r).end(_(e))},dt.prototype.buildAuthorizeUrl=function(t){var e,n;return he.check(t,{type:"object",message:"options parameter is not valid"}),e=fe.merge(this.baseOptions,["clientID","responseType","responseMode","redirectUri","scope","audience"]).with(t),he.check(e,{type:"object",message:"options parameter is not valid"},{clientID:{type:"string",message:"clientID option is required"},redirectUri:{optional:!0,type:"string",message:"redirectUri option is required"},responseType:{type:"string",message:"responseType option is required"},nonce:{type:"string",message:"nonce option is required",condition:function(t){return-1===t.responseType.indexOf("code")&&-1!==t.responseType.indexOf("id_token")}},scope:{optional:!0,type:"string",message:"scope option is required"},audience:{optional:!0,type:"string",message:"audience option is required"}}),this.baseOptions._sendTelemetry&&(e.auth0Client=this.request.getTelemetryData()),e.connection_scope&&he.isArray(e.connection_scope)&&(e.connection_scope=e.connection_scope.join(",")),e=fe.blacklist(e,["username","popupOptions","domain","tenant","timeout","appState"]),e=fe.toSnakeCase(e,["auth0Client"]),e=Ie.oauthAuthorizeParams(this.warn,e),n=Bt(e),gt(this.baseOptions.rootUrl,"authorize","?"+n)},dt.prototype.buildLogoutUrl=function(t){var e,n;return he.check(t,{optional:!0,type:"object",message:"options parameter is not valid"}),e=fe.merge(this.baseOptions,["clientID"]).with(t||{}),this.baseOptions._sendTelemetry&&(e.auth0Client=this.request.getTelemetryData()),e=fe.toSnakeCase(e,["auth0Client","returnTo"]),n=Bt(fe.blacklist(e,["federated"])),t&&void 0!==t.federated&&!1!==t.federated&&"false"!==t.federated&&(n+="&federated"),gt(this.baseOptions.rootUrl,"v2","logout","?"+n)},dt.prototype.loginWithDefaultDirectory=function(t,e){return he.check(t,{type:"object",message:"options parameter is not valid"},{username:{type:"string",message:"username option is required"},password:{type:"string",message:"password option is required"},scope:{optional:!0,type:"string",message:"scope option is required"},audience:{optional:!0,type:"string",message:"audience option is required"}}),t.grantType="password",this.oauthToken(t,e)},dt.prototype.login=function(t,e){return he.check(t,{type:"object",message:"options parameter is not valid"},{username:{type:"string",message:"username option is required"},password:{type:"string",message:"password option is required"},realm:{type:"string",message:"realm option is required"},scope:{optional:!0,type:"string",message:"scope option is required"},audience:{optional:!0,type:"string",message:"audience option is required"}}),t.grantType="http://auth0.com/oauth/grant-type/password-realm",this.oauthToken(t,e)},dt.prototype.oauthToken=function(t,e){var n,r;return he.check(t,{type:"object",message:"options parameter is not valid"}),he.check(e,{type:"function",message:"cb parameter is not valid"}),n=gt(this.baseOptions.rootUrl,"oauth","token"),r=fe.merge(this.baseOptions,["clientID","scope","audience"]).with(t),he.check(r,{type:"object",message:"options parameter is not valid"},{clientID:{type:"string",message:"clientID option is required"},grantType:{type:"string",message:"grantType option is required"},scope:{optional:!0,type:"string",message:"scope option is required"},audience:{optional:!0,type:"string",message:"audience option is required"}}),r=fe.toSnakeCase(r,["auth0Client"]),r=Ie.oauthTokenParams(this.warn,r),this.request.post(n).send(r).end(_(e))},dt.prototype.loginWithResourceOwner=function(t,e){var n,r;return he.check(t,{type:"object",message:"options parameter is not valid"},{username:{type:"string",message:"username option is required"},password:{type:"string",message:"password option is required"},connection:{type:"string",message:"connection option is required"},scope:{optional:!0,type:"string",message:"scope option is required"}}),he.check(e,{type:"function",message:"cb parameter is not valid"}),n=gt(this.baseOptions.rootUrl,"oauth","ro"),r=fe.merge(this.baseOptions,["clientID","scope"]).with(t,["username","password","scope","connection","device"]),(r=fe.toSnakeCase(r,["auth0Client"])).grant_type=r.grant_type||"password",this.request.post(n).send(r).end(_(e))},dt.prototype.getSSOData=function(t,e){if(this.auth0||(this.auth0=new ct(this.baseOptions)),ye.getWindow().location.host===this.baseOptions.domain)return this.auth0._universalLogin.getSSOData(t,e);"function"==typeof t&&(e=t),he.check(e,{type:"function",message:"cb parameter is not valid"});var n=this.baseOptions.clientID,r=this.ssodataStorage.get()||{};this.auth0.checkSession({responseType:"token id_token",scope:"openid profile email",connection:r.lastUsedConnection,timeout:5e3},function(t,o){return t?"login_required"===t.error?e(null,{sso:!1}):("consent_required"===t.error&&(t.error_description="Consent required. When using `getSSOData`, the user has to be authenticated with the following scope: `openid profile email`."),e(t,{sso:!1})):r.lastUsedSub&&r.lastUsedSub!==o.idTokenPayload.sub?e(t,{sso:!1}):e(null,{lastUsedConnection:{name:r.lastUsedConnection},lastUsedUserID:o.idTokenPayload.sub,lastUsedUsername:o.idTokenPayload.email||o.idTokenPayload.name,lastUsedClientID:n,sessionClients:[n],sso:!0})})},dt.prototype.userInfo=function(t,e){var n;return he.check(t,{type:"string",message:"accessToken parameter is not valid"}),he.check(e,{type:"function",message:"cb parameter is not valid"}),n=gt(this.baseOptions.rootUrl,"userinfo"),this.request.get(n).set("Authorization","Bearer "+t).end(_(e,{ignoreCasing:!0}))},dt.prototype.getChallenge=function(t){if(he.check(t,{type:"function",message:"cb parameter is not valid"}),!this.baseOptions.state)return t();var e=gt(this.baseOptions.rootUrl,"usernamepassword","challenge");return this.request.post(e).send({state:this.baseOptions.state}).end(_(t,{ignoreCasing:!0}))},dt.prototype.delegation=function(t,e){var n,r;return he.check(t,{type:"object",message:"options parameter is not valid"},{grant_type:{type:"string",message:"grant_type option is required"}}),he.check(e,{type:"function",message:"cb parameter is not valid"}),n=gt(this.baseOptions.rootUrl,"delegation"),r=fe.merge(this.baseOptions,["clientID"]).with(t),r=fe.toSnakeCase(r,["auth0Client"]),this.request.post(n).send(r).end(_(e))},dt.prototype.getUserCountry=function(t){var e;return he.check(t,{type:"function",message:"cb parameter is not valid"}),e=gt(this.baseOptions.rootUrl,"user","geoloc","country"),this.request.get(e).end(_(t))},Mt.prototype.getUser=function(t,e){var n;return he.check(t,{type:"string",message:"userId parameter is not valid"}),he.check(e,{type:"function",message:"cb parameter is not valid"}),n=gt(this.baseOptions.rootUrl,"users",t),this.request.get(n).end(_(e,{ignoreCasing:!0}))},Mt.prototype.patchUserMetadata=function(t,e,n){var r;return he.check(t,{type:"string",message:"userId parameter is not valid"}),he.check(e,{type:"object",message:"userMetadata parameter is not valid"}),he.check(n,{type:"function",message:"cb parameter is not valid"}),r=gt(this.baseOptions.rootUrl,"users",t),this.request.patch(r).send({user_metadata:e}).end(_(n,{ignoreCasing:!0}))},Mt.prototype.patchUserAttributes=function(t,e,n){var r;return he.check(t,{type:"string",message:"userId parameter is not valid"}),he.check(e,{type:"object",message:"user parameter is not valid"}),he.check(n,{type:"function",message:"cb parameter is not valid"}),r=gt(this.baseOptions.rootUrl,"users",t),this.request.patch(r).send(e).end(_(n,{ignoreCasing:!0}))},Mt.prototype.linkUser=function(t,e,n){var r;return he.check(t,{type:"string",message:"userId parameter is not valid"}),he.check(e,{type:"string",message:"secondaryUserToken parameter is not valid"}),he.check(n,{type:"function",message:"cb parameter is not valid"}),r=gt(this.baseOptions.rootUrl,"users",t,"identities"),this.request.post(r).send({link_with:e}).end(_(n,{ignoreCasing:!0}))};var Je={Authentication:dt,Management:Mt,WebAuth:ct,version:de};e.a=Je}).call(e,n(15),n(41))},function(t,e,n){var r=n(245).charsets,o=r.upperCase,i=r.lowerCase,a=r.numbers,s=r.specialCharacters,u={none:{length:{minLength:1}},low:{length:{minLength:6}},fair:{length:{minLength:8},contains:{expressions:[i,o,a]}},good:{length:{minLength:8},containsAtLeast:{atLeast:3,expressions:[i,o,a,s]}},excellent:{length:{minLength:10},containsAtLeast:{atLeast:3,expressions:[i,o,a,s]},identicalChars:{max:2}}};t.exports=u},function(t,e,n){"use strict";var r={addClass:function(t,e){return e&&(t.classList?t.classList.add(e):r.hasClass(t,e)||(t.className=t.className+" "+e)),t},removeClass:function(t,e){return e&&(t.classList?t.classList.remove(e):r.hasClass(t,e)&&(t.className=t.className.replace(new RegExp("(^|\\s)"+e+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,""))),t},hasClass:function(t,e){return t.classList?!!e&&t.classList.contains(e):(" "+t.className+" ").indexOf(" "+e+" ")>-1}};t.exports=r},function(t,e,n){"use strict";function r(t,e){if(g[e])return i(t,e,g[e].url,g[e].displayName,!0);var r=p.ui.avatarProvider(n.i(s.d)(s.e,"lock",t)).toJS();n.i(s.b)(s.c,"lock",t,function(t){return t=h(t,"syncStatus","loading"),t=h(t,"src",e)});var u=void 0,l=void 0;r.url(e,function(n,r){if(n)return a(t,e);c.a(r,function(n,r){if(n)return a(t,e);u=r.src,void 0!==l&&o(t,e,u,l)})}),r.displayName(e,function(n,r){if(n)return a(t);l=r,void 0!==u&&o(t,e,u,l)})}function o(t,e,n,r){g[e]={url:n,displayName:r},i(t,e,n,r)}function i(t,e,r,o){var i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];n.i(s.b)(s.c,"lock",t,function(t){return(i||M(t,"src")===e)&&(t=h(t,"syncStatus","ok"),t=h(t,"url",r),t=h(t,"src",e),t=h(t,"displayName",o)),t})}function a(t,e){n.i(s.b)(s.c,"lock",t,function(t){return"src"===M(t,"src")?h(t,"syncStatus","error"):t})}e.a=r,n.d(e,"b",function(){return f});var s=n(8),u=n(20),c=n(116),l=n(217),p=n(1),d=n.i(u.a)(["avatar"]),M=d.tget,h=d.tset,g={},f=l.a(r,300)},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=n(27),p=n(1),d=n(10),M=n(17),h=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.render=function(){var t=this.props,e=t.lock,r=t.loginLabel,o=t.signUpLink,i=t.signUpLabel,a="login"===n.i(d.j)(e);return c.a.createElement("div",{role:"navigation",className:"auth0-lock-tabs-container"},c.a.createElement("ul",{className:"auth0-lock-tabs"},c.a.createElement(g,{label:r,current:a,clickHandler:this.handleLoginClick.bind(this)}),c.a.createElement(g,{label:i,current:!a,clickHandler:this.handleSignUpClick.bind(this),clickWithHrefHandler:this.handleSignUpWithHrefClick.bind(this),href:o})))},e.prototype.handleLoginClick=function(){n.i(l.g)(p.id(this.props.lock))},e.prototype.handleSignUpClick=function(){this.props.signUpLink&&n.i(M.c)(p.id(this.props.lock),!0),n.i(l.h)(p.id(this.props.lock))},e.prototype.handleSignUpWithHrefClick=function(){n.i(M.c)(p.id(this.props.lock),!0)},e}(c.a.Component);e.a=h,h.propTypes={lock:s.a.object.isRequired,loginLabel:s.a.string.isRequired,signUpLabel:s.a.string.isRequired,signUpLink:s.a.string};var g=function(t){function e(){var n,i,a;r(this,e);for(var s=arguments.length,u=Array(s),c=0;c<s;c++)u[c]=arguments[c];return n=i=o(this,t.call.apply(t,[this].concat(u))),i.handleClick=function(t){i.props.href?i.props.clickWithHrefHandler():(t.preventDefault(),i.props.clickHandler())},a=n,o(i,a)}return i(e,t),e.prototype.render=function(){var t=this.props,e=t.current,n=t.href,r=t.label,o=e?"auth0-lock-tabs-current":"";return c.a.createElement("li",{className:o},e?c.a.createElement("span",null,r):c.a.createElement("a",{href:n||"#",onClick:this.handleClick},r))},e}(c.a.Component)},function(t,e,n){"use strict";var r=n(0),o=n.n(r),i=n(72);e.a=function(t){var e=t.children;return o.a.createElement("div",{className:"auth0-sso-notice-container"},o.a.createElement("span",null,i.a)," ",o.a.createElement("span",{className:"auth0-sso-notice"},e))}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(){var t=document.getElementById("auth0-lock-style");if(!t){var e=document.getElementsByTagName("head")[0];t=document.createElement("style"),t.type="text/css",t.setAttribute("id","auth0-lock-style"),e.appendChild(t)}t.styleSheet?t.styleSheet.cssText=N:t.innerHTML=N}function s(){var t=.01*window.innerHeight;document.documentElement.style.setProperty("--vh",t+"px")}e.a=a,e.b=s;var u=n(242),c=(n.n(u),n(8)),l=n(199),p=n(28),d=n(17),M=n(1),h=(n(4),n(218)),g=n(12),f=n(29),y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},N='/* normalize.css v3.0.2 | MIT License | git.io/normalize */ .auth0-lock html { font-family: sans-serif; /* 1 */ -ms-text-size-adjust: 100%; /* 2 */ -webkit-text-size-adjust: 100%; /* 2 */ } .auth0-lock body { margin: 0; } .auth0-lock article, .auth0-lock aside, .auth0-lock details, .auth0-lock figcaption, .auth0-lock figure, .auth0-lock footer, .auth0-lock header, .auth0-lock hgroup, .auth0-lock main, .auth0-lock menu, .auth0-lock nav, .auth0-lock section, .auth0-lock summary { display: block; } .auth0-lock audio, .auth0-lock canvas, .auth0-lock progress, .auth0-lock video { display: inline-block; /* 1 */ vertical-align: baseline; /* 2 */ } .auth0-lock audio:not([controls]) { display: none; height: 0; } .auth0-lock [hidden], .auth0-lock template { display: none; } .auth0-lock a { background-color: transparent; } .auth0-lock a:active, .auth0-lock a:hover { outline: 0; } .auth0-lock abbr[title] { border-bottom: 1px dotted; } .auth0-lock b, .auth0-lock strong { font-weight: bold; } .auth0-lock dfn { font-style: italic; } .auth0-lock h1 { font-size: 2em; margin: 0.67em 0; } .auth0-lock mark { background: #ff0; color: #000; } .auth0-lock small { font-size: 80%; } .auth0-lock sub, .auth0-lock sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } .auth0-lock sup { top: -0.5em; } .auth0-lock sub { bottom: -0.25em; } .auth0-lock img { border: 0; } .auth0-lock svg:not(:root) { overflow: hidden; } .auth0-lock figure { margin: 1em 40px; } .auth0-lock hr { box-sizing: content-box; height: 0; } .auth0-lock pre { overflow: auto; } .auth0-lock code, .auth0-lock kbd, .auth0-lock pre, .auth0-lock samp { font-family: monospace, monospace; font-size: 1em; } .auth0-lock button, .auth0-lock input, .auth0-lock optgroup, .auth0-lock select, .auth0-lock textarea { color: inherit; /* 1 */ font: inherit; /* 2 */ margin: 0; /* 3 */ } .auth0-lock button { overflow: visible; } .auth0-lock button, .auth0-lock select { text-transform: none; } .auth0-lock button, .auth0-lock html input[type="button"], .auth0-lock input[type="reset"], .auth0-lock input[type="submit"] { -webkit-appearance: button; /* 2 */ cursor: pointer; /* 3 */ } .auth0-lock button[disabled], .auth0-lock html input[disabled] { cursor: default; } .auth0-lock button::-moz-focus-inner, .auth0-lock input::-moz-focus-inner { border: 0; padding: 0; } .auth0-lock input { line-height: normal; } .auth0-lock input[type="checkbox"], .auth0-lock input[type="radio"] { box-sizing: border-box; /* 1 */ padding: 0; /* 2 */ } .auth0-lock input[type="number"]::-webkit-inner-spin-button, .auth0-lock input[type="number"]::-webkit-outer-spin-button { height: auto; } .auth0-lock input[type="search"] { -webkit-appearance: textfield; /* 1 */ /* 2 */ box-sizing: content-box; } .auth0-lock input[type="search"]::-webkit-search-cancel-button, .auth0-lock input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; } .auth0-lock fieldset { border: 1px solid #c0c0c0; margin: 0 2px; padding: 0.35em 0.625em 0.75em; } .auth0-lock legend { border: 0; /* 1 */ padding: 0; /* 2 */ } .auth0-lock textarea { overflow: auto; } .auth0-lock optgroup { font-weight: bold; } .auth0-lock table { border-collapse: collapse; border-spacing: 0; } .auth0-lock td, .auth0-lock th { padding: 0; } .auth0-lock-social-button-icon { background-repeat: no-repeat; background-size: 50%; background-position: center center; } .auth0-lock-social-button[data-provider="amazon"] { background-color: #f90; } .auth0-lock-social-button[data-provider="aol"] { background-color: #ff0b00; } .auth0-lock-social-button[data-provider="baidu"] { background-color: #2529d8; } .auth0-lock-social-button[data-provider="bitbucket"] { background-color: #205081; } .auth0-lock-social-button[data-provider="dropbox"] { background-color: #007ee5; } .auth0-lock-social-button[data-provider="ebay"] { background-color: #0064d2; } .auth0-lock-social-button[data-provider="facebook"] { background-color: #3b5998; } .auth0-lock-social-button[data-provider^="google"] { background-color: #4285f4; } .auth0-lock-social-button[data-provider^="apple"] { background-color: #000; } .auth0-lock-social-button[data-provider^="line"] { background-color: #00b900; } .auth0-lock-social-button[data-provider="instagram"] { background-color: #3f729b; } .auth0-lock-social-button[data-provider="linkedin"] { background-color: #0077b5; } .auth0-lock-social-button[data-provider="github"] { background-color: #333; } .auth0-lock-social-button[data-provider="oauth2"] { background-color: #eb5424; } .auth0-lock-social-button[data-provider="paypal"] { background-color: #009cde; } .auth0-lock-social-button[data-provider="paypal-sandbox"] { background-color: #009cde; } .auth0-lock-social-button[data-provider^="salesforce"] { background-color: #1798c1; } .auth0-lock-social-button[data-provider="shopify"] { background-color: #96bf48; } .auth0-lock-social-button[data-provider="soundcloud"] { background-color: #f80; } .auth0-lock-social-button[data-provider="renren"] { background-color: #0056b5; } .auth0-lock-social-button[data-provider="exact"] { background-color: #ed1c24; } .auth0-lock-social-button[data-provider="twitter"] { background-color: #55acee; } .auth0-lock-social-button[data-provider=""] { background-color: #c7eaff; } .auth0-lock-social-button[data-provider="yandex"] { background-color: #fc0; } .auth0-lock-social-button[data-provider^="thecity"] { background-color: #767571; } .auth0-lock-social-button[data-provider="planningcenter"] { background-color: #4e4e4e; } .auth0-lock-social-button[data-provider="thirtysevensignals"] { background-color: #6ac071; } .auth0-lock-social-button[data-provider="fitbit"] { background-color: #4cc2c4; } .auth0-lock-social-button[data-provider="wordpress"] { background-color: #21759b; } .auth0-lock-social-button[data-provider="yahoo"] { background-color: #410093; } .auth0-lock-social-button[data-provider="box"] { background-color: #267bb6; } .auth0-lock-social-button[data-provider="vkontakte"] { background-color: #45668e; } .auth0-lock-social-button[data-provider="dwolla"] { background-color: #f5891f; } .auth0-lock-social-button[data-provider="miicard"] { background-color: #3fb7ff; } .auth0-lock-social-button[data-provider="yammer"] { background-color: #0072c6; } .auth0-lock-social-button[data-provider="weibo"] { background-color: #dd4b39; } .auth0-lock-social-button[data-provider^="evernote"] { background-color: #2dbe60; } .auth0-lock-social-button[data-provider^="windows"], .auth0-lock-social-button[data-provider^="microsoft"] { background-color: #00a1f1; } .auth0-lock-social-button[data-provider^=amazon] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjcycHgiIGhlaWdodD0iNjVweCIgdmlld0JveD0iMCAwIDcyIDY1IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+YW1hem9uPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc2tldGNoOnR5cGU9Ik1TUGFnZSI+CiAgICAgICAgPGcgaWQ9ImFtYXpvbiIgc2tldGNoOnR5cGU9Ik1TTGF5ZXJHcm91cCIgZmlsbD0iI0ZGRkZGRiI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0xLjA2Myw1MC4zMTMgQzEsNTAuNDM4IDAuOTM4LDUwLjU2MyAwLjkzOCw1MC42ODggQzAuOTM4LDUwLjg3NiAxLjA2Myw1MS4xMjYgMS4zMTMsNTEuMzEzIEM2LjAwMSw1NS41NjMgMTEuMzEzLDU4LjgxMyAxNy4yNTEsNjEuMTI2IEMyMy4xODksNjMuNDM5IDI5LjUwMSw2NC42MjYgMzYuMTI2LDY0LjYyNiBDNDAuNDM5LDY0LjYyNiA0NC44NzYsNjQuMDAxIDQ5LjM3Niw2Mi44MTMgQzUzLjkzOSw2MS42MjUgNTguMDAxLDU5LjkzOCA2MS42ODksNTcuNzUgQzYyLjg3Nyw1Ny4wNjIgNjMuODc3LDU2LjQzNyA2NC42MjcsNTUuODc1IEM2NS4xOSw1NS40MzcgNjUuMzE1LDU0LjkzNyA2NC45NCw1NC40MzcgQzY0LjYyNyw1My45MzcgNjQuMTI3LDUzLjgxMiA2My40NCw1NC4wNjIgQzYzLjMxNSw1NC4xMjUgNjMuMDAyLDU0LjI1IDYyLjYyNyw1NC40MzcgQzYyLjE4OSw1NC42MjUgNjEuODc3LDU0Ljc1IDYxLjY4OSw1NC44MTIgQzUzLjUwMSw1Ny45MzcgNDUuMjUxLDU5LjUgMzYuODc2LDU5LjUgQzI0LjM3Niw1OS41IDEyLjc1MSw1Ni40MzcgMi4wNjMsNTAuMjUgQzEuNjI1LDQ5LjkzNyAxLjI1LDQ5LjkzNyAxLjA2Myw1MC4zMTMgTDEuMDYzLDUwLjMxMyBaIE0yMC4zMTMsMzIuMDYzIEMyMC4zMTMsMzUuNzUxIDIxLjM3NiwzOC42MjYgMjMuNTAxLDQwLjYyNiBDMjUuNjI2LDQyLjY4OSAyOC4zMTQsNDMuNjg5IDMxLjU2NCw0My42ODkgQzMzLjc1Miw0My42ODkgMzUuNTAyLDQzLjUwMSAzNi45MzksNDMuMDY0IEMzOS4yNTIsNDIuNDM5IDQxLjYyNyw0MC44MTQgNDQuMDAyLDM4LjE4OSBDNDQuMTksMzguMzc3IDQ0LjUwMiwzOC44MTQgNDQuODc3LDM5LjQzOSBDNDUuMzE1LDQwLjA2NCA0NS42MjcsNDAuNTAyIDQ1LjgxNSw0MC42ODkgTDQ2LjgxNSw0MS42ODkgQzQ3LjI1Myw0Mi4xODkgNDcuNzUzLDQyLjY4OSA0OC4zNzgsNDMuMTg5IEM0OS4wNjYsNDMuNTAyIDQ5LjY5MSw0My40MzkgNTAuMTkxLDQzLjA2NCBDNTAuNTA0LDQyLjgxNCA1Mi40NDEsNDEuMTI2IDU2LjAwNCwzOC4wNjQgQzU2LjMxNywzNy44MTQgNTYuNTA0LDM3LjUwMSA1Ni41MDQsMzcuMTg5IEM1Ni41MDQsMzYuODc3IDU2LjM3OSwzNi41MDEgNTYuMTI5LDM2LjEyNiBDNTUuNDQxLDM1LjI1MSA1NC45NDEsMzQuNjI2IDU0LjYyOSwzNC4xODggQzU0LjMxNiwzMy44MTMgNTQuMDA0LDMzLjEyNSA1My42OTEsMzIuMTg4IEM1My4zNzgsMzEuMzEzIDUzLjI1MywzMC4yNSA1My4yNTMsMjkuMTg4IEw1My4yNTMsMTMuNjg4IEM1My4yNTMsMTMuNSA1My4xOSwxMi45MzggNTMuMTksMTIuMDYzIEM1My4xMjcsMTEuMTI1IDUzLjA2NSwxMC41IDUyLjk0LDEwLjI1IEw1Mi41NjUsOC43NSBDNTIuNDQsOCA1Mi4yNTIsNy40MzcgNTIuMDAyLDcuMDYyIEM1MS44MTQsNi42ODcgNTEuNTAyLDYuMjQ5IDUxLjEyNyw1Ljc0OSBDNTAuODE0LDUuMzExIDUwLjM3Nyw0LjgxMSA0OS45MzksNC4zNzQgQzQ3LjI1MSwxLjg3NCA0My40MzksMC42MjQgMzguNTY0LDAuNjI0IEwzNi45MzksMC42MjQgQzMzLjE4OSwwLjgxMiAyOS44NzYsMS44NzQgMjcuMDAxLDMuNjg3IEMyNC4xODgsNS41IDIyLjM3Niw4LjMxMiAyMS42ODgsMTIuMTI1IEMyMS42MjUsMTIuMzEzIDIxLjYyNSwxMi40MzggMjEuNjI1LDEyLjU2MyBDMjEuNjI1LDEzLjE4OCAyMiwxMy41NjMgMjIuNjg4LDEzLjc1MSBMMzAuMDYzLDE0LjYyNiBDMzAuNzUxLDE0LjUwMSAzMS4xODgsMTQuMDAxIDMxLjMxMywxMy4xODggQzMxLjYyNiwxMS44MTMgMzIuMzEzLDEwLjc1IDMzLjMxMyw5LjkzOCBDMzQuMzc2LDkuMTg4IDM1LjU2Myw4Ljc1IDM2LjkzOCw4LjYyNSBMMzcuNTAxLDguNjI1IEMzOS4zNzYsOC42MjUgNDAuODE0LDkuMjUgNDEuNjg5LDEwLjU2MyBDNDIuMzE0LDExLjUwMSA0Mi42MjcsMTMuMzEzIDQyLjYyNywxNi4wNjMgTDQyLjYyNywxNy4xMjYgQzQwLjAwMiwxNy4zNzYgMzguMTI3LDE3LjUwMSAzNi45MzksMTcuNjI2IEMzMy42MjYsMTguMDY0IDMwLjc1MSwxOC43NTEgMjguNDM5LDE5Ljc1MSBDMjUuOTM5LDIwLjgxNCAyMy45MzksMjIuMzc2IDIyLjUwMSwyNC41MDEgQzIxLjA2MywyNi41NjQgMjAuMzEzLDI5LjEyNiAyMC4zMTMsMzIuMDY0IEwyMC4zMTMsMzIuMDYzIFogTTMxLjMxMywzMC43NSBDMzEuMzEzLDI3LjEyNSAzMy4xODgsMjQuNzUgMzYuOTM4LDIzLjY4NyBDMzguMjUxLDIzLjMxMiA0MC4xMjYsMjMuMTI0IDQyLjYyNiwyMy4xMjQgTDQyLjYyNiwyNC43NDkgQzQyLjYyNiwyNi4xMjQgNDIuNTYzLDI3LjEyNCA0Mi41NjMsMjcuNjg3IEM0Mi41NjMsMjguMzEyIDQyLjQzOCwyOS4wNjIgNDIuMTg4LDMwIEM0MS45MzgsMzEgNDEuNjI1LDMxLjg3NSA0MS4xMjUsMzIuNjg4IEM0MC4xMjUsMzQuNTAxIDM4Ljc1LDM1LjY4OCAzNi45MzcsMzYuMTI2IEMzNi44NzQsMzYuMTI2IDM2Ljc0OSwzNi4xODkgMzYuNDk5LDM2LjE4OSBDMzYuMjQ5LDM2LjI1MiAzNi4wNjEsMzYuMjUyIDM1LjkzNiwzNi4yNTIgQzM0LjU2MSwzNi4yNTIgMzMuNDM2LDM1Ljc1MiAzMi41NjEsMzQuNzUyIEMzMS43NDgsMzMuNzUyIDMxLjMxMSwzMi40MzkgMzEuMzExLDMwLjc1MiBMMzEuMzEzLDMwLjc1IFogTTU4LjE4OCw1MS4zNzUgQzU4LjE4OCw1MS40MzggNTguMTI1LDUxLjUgNTguMTI1LDUxLjU2MyBDNTguMTI1LDUxLjYyNiA1OC4xMjUsNTEuNzUxIDU4LjE4OCw1MS44MTMgQzU4LjMxMyw1MS44NzYgNTguNTAxLDUxLjkzOCA1OC43NTEsNTEuOTM4IEM1OS42MjYsNTEuODEzIDYwLjYyNiw1MS42ODggNjEuNjg5LDUxLjU2MyBDNjIuNjI3LDUxLjUgNjMuNTAyLDUxLjQzOCA2NC4yNTIsNTEuNDM4IEM2Ni4xOSw1MS40MzggNjcuMzc3LDUxLjY4OCA2Ny44MTUsNTIuMTg4IEM2OC4wMDMsNTIuNDM4IDY4LjA2NSw1Mi43NTEgNjguMDY1LDUzLjI1MSBDNjguMDY1LDU0LjY4OSA2Ny4zMTUsNTcuMjUxIDY1LjY5LDYxLjAwMSBDNjUuNTY1LDYxLjMxNCA2NS42MjcsNjEuNTY0IDY1Ljg3OCw2MS42ODkgQzY2LjAwMyw2MS43NTIgNjYuMDY2LDYxLjc1MiA2Ni4xMjgsNjEuNzUyIEM2Ni4zMTYsNjEuNzUyIDY2LjUwMyw2MS42MjcgNjYuNzUzLDYxLjUwMiBDNjguMTkxLDYwLjI1MiA2OS4zMTYsNTguNjI3IDcwLjEyOCw1Ni41NjQgQzcwLjk0MSw1NC41NjQgNzEuMzE2LDUyLjgxNCA3MS4zMTYsNTEuMzE0IEw3MS4zMTYsNTAuODc2IEM3MS4zMTYsNTAuMzc2IDcxLjI1Myw0OS45MzggNzEuMDY2LDQ5LjY4OCBDNzAuNjkxLDQ5LjI1IDY5LjU2Niw0OC45MzggNjcuNjI4LDQ4Ljc1IEM2Ny4yNTMsNDguNjg3IDY2LjgxNSw0OC42MjUgNjYuNDQsNDguNjg3IEM2NC44NzcsNDguNzUgNjMuMzE1LDQ4LjkzNyA2MS42OSw0OS4zNzUgQzYwLjY5LDQ5LjYyNSA1OS42OSw1MC4xMjUgNTguNjI3LDUwLjg3NSBDNTguNDM5LDUxIDU4LjMxNCw1MS4xODggNTguMTg5LDUxLjM3NSBMNTguMTg4LDUxLjM3NSBaIiBpZD0iU2hhcGUiIHNrZXRjaDp0eXBlPSJNU1NoYXBlR3JvdXAiPjwvcGF0aD4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg=="); } .auth0-lock-social-button[data-provider^=aol] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjkxcHgiIGhlaWdodD0iMzZweCIgdmlld0JveD0iMCAwIDkxIDM2IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+YW9sPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc2tldGNoOnR5cGU9Ik1TUGFnZSI+CiAgICAgICAgPGcgaWQ9ImFvbCIgc2tldGNoOnR5cGU9Ik1TTGF5ZXJHcm91cCIgZmlsbD0iI0ZGRkZGRiI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik00OS45MzgsNy43NSBDNTguMDAxLDcuNzUgNjQuMDYzLDE0IDY0LjA2MywyMS43NSBDNjQuMDYzLDI5Ljg3NSA1Ny43NSwzNS42ODggNDkuOTM4LDM1LjY4OCBDNDIuMTg4LDM1LjY4OCAzNS44NzUsMjkuODc1IDM1Ljg3NSwyMS43NSBDMzUuODc1LDE0IDQxLjkzOCw3Ljc1IDQ5LjkzOCw3Ljc1IEw0OS45MzgsNy43NSBaIE00OS45MzgsMTUuMTg4IEM0Ni41LDE1LjE4OCA0My42MjUsMTguMDYzIDQzLjYyNSwyMS43NTEgQzQzLjYyNSwyNS4zNzYgNDYuNSwyOC4zMTQgNDkuOTM4LDI4LjMxNCBDNTMuNDM4LDI4LjMxNCA1Ni4yNTEsMjUuMzc2IDU2LjI1MSwyMS43NTEgQzU2LjI1MSwxOC4wNjMgNTMuNDM4LDE1LjEyNiA0OS45MzgsMTUuMTg4IEw0OS45MzgsMTUuMTg4IFogTTkwLjEyNSwzMC44MTMgQzkwLjEyNSwyOC4xMjUgODcuOTM3LDI1LjkzOCA4NS4yNSwyNS45MzggQzgyLjU2MywyNS45MzggODAuMzc1LDI4LjEyNiA4MC4zNzUsMzAuODEzIEM4MC4zNzUsMzMuNSA4Mi41NjMsMzUuNjg4IDg1LjI1LDM1LjY4OCBDODcuOTM3LDM1LjY4OCA5MC4xMjUsMzMuNSA5MC4xMjUsMzAuODEzIEw5MC4xMjUsMzAuODEzIFogTTc1LjkzOCwzNC44MTMgTDc1LjkzOCwwLjEyNSBMNjguMjUsMC4xMjUgTDY4LjI1LDM0LjgxMyBMNzUuOTM4LDM0LjgxMyBMNzUuOTM4LDM0LjgxMyBaIE0wLjY4OCwzNC44MTMgTDEwLjUwMSwzNC44MTMgTDEyLjEyNiwyOS44NzUgTDI0LjI1MSwyOS44NzUgTDI1Ljg3NiwzNC44MTMgTDM1LjYyNiwzNC44MTMgTDIxLjg3NiwwLjEyNSBMMTQuNjg4LDAuMTI1IEwwLjY4OCwzNC44MTMgWiBNMjEuODc1LDIyLjY4OCBMMTguMzEyLDExLjA2MyBMMTQuNjg3LDIyLjY4OCBMMjEuODc1LDIyLjY4OCBMMjEuODc1LDIyLjY4OCBaIiBpZD0iU2hhcGUiIHNrZXRjaDp0eXBlPSJNU1NoYXBlR3JvdXAiPjwvcGF0aD4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg=="); } .auth0-lock-social-button[data-provider^=baidu] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjU5cHgiIGhlaWdodD0iNjVweCIgdmlld0JveD0iMCAwIDU5IDY1IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+YmFpZHU8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz48L2RlZnM+CiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiBza2V0Y2g6dHlwZT0iTVNQYWdlIj4KICAgICAgICA8ZyBpZD0iYmFpZHUiIHNrZXRjaDp0eXBlPSJNU0xheWVyR3JvdXAiIGZpbGw9IiNGRkZGRkYiPgogICAgICAgICAgICA8cGF0aCBkPSJNMC4xMjUsMjQgQzAuMDYyLDI0LjQzOCAwLDI0Ljg3NSAwLDI1LjMxMyBDMCwyNS45MzggMC4wNjMsMjYuNjI2IDAuMjUsMjcuMzc2IEMwLjUsMjguNjI2IDAuOTM4LDI5Ljg3NiAxLjYyNSwzMS4wNjQgQzIuMjUsMzIuMjUyIDMuMTg4LDMzLjE4OSA0LjUsMzMuODE0IEM1LjMxMywzNC4yNTIgNi4yNSwzNC41MDIgNy4yNSwzNC41MDIgQzcuODEzLDM0LjUwMiA4LjMxMywzNC40MzkgOC44NzUsMzQuMzE0IEMxMC41LDMzLjkzOSAxMS43NSwzMy4yNTEgMTIuNjg4LDMyLjE4OSBDMTMuNjg4LDMxLjE4OSAxNC4yNTEsMjkuOTM5IDE0LjUwMSwyOC41MDEgQzE0Ljc1MSwyNy4xMjYgMTQuODc2LDI2LjAwMSAxNC44NzYsMjUuMTI2IEwxNC44NzYsMjQuNzUxIEMxNC44NzYsMjQuMDAxIDE0LjgxMywyMy4zMTMgMTQuNjI2LDIyLjYyNiBDMTQuNTAxLDIxLjAwMSAxMy42MjYsMTkuMzc2IDEyLjA2MywxNy42MjYgQzEwLjU2MywxNi4xMjYgOC45MzgsMTUuMzEzIDcuMTI1LDE1LjMxMyBMNi41NjIsMTUuMzEzIEw1Ljk5OSwxNS40MzggQzUuNjI0LDE1LjUwMSA1LjEyNCwxNS42ODggNC41NjEsMTYuMDYzIEMzLjkzNiwxNi4zNzYgMy4zNzMsMTYuODEzIDIuNzQ4LDE3LjM3NiBDMi4xMjMsMTcuOTM5IDEuNjIzLDE4LjgxNCAxLjEyMywxOS45MzkgQzAuNjIzLDIxLjEyNyAwLjMxLDIyLjQzOSAwLjEyMywyNC4wMDIgTDAuMTI1LDI0IFogTTQuMjUsNTUuMTI1IEw0LjkzOCw1Ny4zMTMgQzUuMzc2LDU4Ljc1MSA2LjM3Niw2MC4yNTEgNy44NzYsNjEuNjg4IEM5LjMxNCw2My4wNjMgMTEuMDAxLDYzLjgxMyAxMy4wMDEsNjMuODEzIEwxMy4xODksNjMuODEzIEMxMy44NzcsNjMuOTM4IDE0LjYyNyw2NC4wMDEgMTUuNTAyLDYzLjkzOCBDMTYuMzE1LDYzLjkzOCAxNy4yNTIsNjMuODc1IDE4LjMxNSw2My44MTMgQzIwLjM3OCw2My41NjMgMjEuNzUzLDYzLjM3NSAyMi41MDMsNjMuMjUgQzIzLjI1Myw2My4xMjUgMjMuODE2LDYzLjA2MiAyNC4yNTMsNjIuOTM3IEwyNS44NzgsNjIuNjg3IEMyNi44MTYsNjIuNDk5IDI3Ljk0MSw2Mi40MzcgMjkuMzc4LDYyLjQzNyBMMzAuMjUzLDYyLjQzNyBDMzIuMTI4LDYyLjUgMzMuODE2LDYyLjc1IDM1LjMxNiw2My4yNSBDMzcuOTQxLDY0LjEyNSA0MC4zMTYsNjQuNTYzIDQyLjUwNCw2NC41NjMgQzQ0LjY5Miw2NC41NjMgNDYuMzc5LDY0LjMxMyA0Ny41NjcsNjMuODEzIEM0OC43NTUsNjMuMzEzIDQ5LjgxNyw2Mi42ODggNTAuNzU1LDYxLjgxMyBDNTEuNjkzLDYwLjkzOCA1Mi4yNTUsNjAuMzEzIDUyLjUwNSw1OS45MzggQzUyLjc1NSw1OS41NjMgNTIuOTQzLDU5LjI1IDUzLjAwNSw1OSBMNTMuMzgsNTggQzUzLjU2OCw1Ny4zNzUgNTMuODE4LDU2LjU2MiA1My45NDMsNTUuNSBDNTQuMTMxLDU0LjQzNyA1NC4xOTMsNTMuMzc1IDU0LjE5Myw1Mi4xODcgQzU0LjE5Myw1MC45OTkgNTMuOTQzLDQ5LjgxMiA1My4zOCw0OC40OTkgQzUyLjc1NSw0Ny4yNDkgNTEuOTQyLDQ2LjE4NiA1MC44MTcsNDUuMzc0IEM0OC41MDQsNDMuNDk5IDQ2LjE5Miw0MS40OTkgNDQuMDY3LDM5LjI0OSBDNDEuODc5LDM2Ljk5OSA0MC40NDIsMzUuNDM2IDM5Ljc1NCwzNC42MjQgQzM5LjEyOSwzMy44MTEgMzguNjI5LDMzLjEyNCAzOC4yNTQsMzIuNjI0IEMzNi43NTQsMzAuMzExIDM1LjA2NiwyOC42ODYgMzMuMTkxLDI3LjY4NiBDMzEuNzUzLDI2LjkzNiAzMC4zMTYsMjYuNTYxIDI5LjAwMywyNi41NjEgQzI4LjYyOCwyNi41NjEgMjguMzE1LDI2LjU2MSAyNy44NzgsMjYuNjI0IEMyNi4yNTMsMjYuODc0IDI0LjY5LDI3LjQzNyAyMy4zMTUsMjguMzc0IEMyMS45NCwyOS4zMTEgMjAuODc3LDMwLjQzNyAyMC4xMjcsMzEuODEyIEMxOS4yNTIsMzMuMzEyIDE4LjE4OSwzNC42ODcgMTYuOTM5LDM2IEMxNS43NTEsMzcuMzEzIDE0LjU2NCwzOC40MzggMTMuNTY0LDM5LjMxMyBDMTIuNTAxLDQwLjE4OCAxMS45MzksNDAuNjg4IDExLjgxNCw0MC43NTEgTDEwLjE4OSw0Mi4wNjQgQzkuMDY0LDQzLjAwMiA4LjA2NCw0My45MzkgNy4wNjQsNDUuMDAyIEM2LjEyNiw0Ni4wMDIgNS4zMTQsNDcuNDQgNC42MjYsNDkuMzE1IEM0LjE4OCw1MC41MDMgMy45MzgsNTEuNjI4IDMuOTM4LDUyLjg3OCBDMy45MzgsNTMuNjI4IDQuMDYzLDU0LjM3OCA0LjI1MSw1NS4xMjggTDQuMjUsNTUuMTI1IFogTTEzLjMxMyw0OC41IEwxMy44MTMsNDcuMTg3IEMxNC4xMjYsNDYuMzEyIDE0Ljc1MSw0NS40MzcgMTUuNzUxLDQ0LjU2MiBDMTYuNzUxLDQzLjY4NyAxNy44NzYsNDMuMjQ5IDE5LjEyNiw0My4yNDkgTDIzLjUwMSw0My4yNDkgTDIzLjUwMSwzNy45MzYgTDI3LjEyNiwzNy45OTkgTDI3LjEyNiw1Ny42MjQgTDE5LjAwMSw1Ny42MjQgQzE2LjU2Myw1Ny4xMjQgMTQuODc2LDU1LjkzNiAxMy45MzgsNTQuMTI0IEMxMy40MzgsNTIuODc0IDEzLjE4OCw1MS41NjEgMTMuMTg4LDUwLjI0OSBDMTMuMTg4LDQ5LjY4NiAxMy4yNTEsNDkuMDYxIDEzLjMxMyw0OC40OTkgTDEzLjMxMyw0OC41IFogTTE0Ljg3NSwxMC41IEMxNC44NzUsMTMuMTg4IDE1LjUsMTUuNTYzIDE2Ljg3NSwxNy40MzggQzE4LjE4OCwxOS4zNzYgMTkuODEzLDIwLjMxMyAyMS43NSwyMC4zMTMgQzIzLjY4NywyMC4zMTMgMjUuMzEzLDE5LjM3NSAyNi42MjUsMTcuNDM4IEMyOCwxNS41NjMgMjguNjg4LDEzLjE4OCAyOC42ODgsMTAuNSBDMjguNjg4LDcuNzUgMjgsNS40MzcgMjYuNjI1LDMuNSBDMjUuMzEyLDEuNTYyIDIzLjY4NywwLjYyNSAyMS43NSwwLjYyNSBDMTkuODEzLDAuNjI1IDE4LjE4NywxLjU2MyAxNi44NzUsMy41IEMxNS41LDUuNDM4IDE0Ljg3NSw3Ljc1IDE0Ljg3NSwxMC41IEwxNC44NzUsMTAuNSBaIE0xNy4xMjUsNTEuNjI1IEwxNy40MzgsNTIuMzEzIEMxNy41NjMsNTIuODEzIDE3LjkzOCw1My4yNTEgMTguMzc2LDUzLjY4OCBDMTguODc2LDU0LjE4OCAxOS41MDEsNTQuMzc2IDIwLjE4OSw1NC4zNzYgTDIzLjQzOSw1NC4zNzYgTDIzLjQzOSw0Ni4zNzYgTDE5Ljg3Niw0Ni4zNzYgQzE4LjY4OCw0Ni43NTEgMTcuODEzLDQ3LjUwMSAxNy40MzgsNDguNjI2IEMxNy4xMjUsNDkuMzc2IDE3LDUwLjAwMSAxNyw1MC42MjYgQzE3LDUwLjkzOSAxNy4wNjMsNTEuMzE0IDE3LjEyNSw1MS42MjYgTDE3LjEyNSw1MS42MjUgWiBNMjkuMTI1LDU0LjA2MyBMMjkuMTI1LDQzLjY4OCBMMzIuOTM4LDQzLjYyNSBMMzIuOTM4LDUyLjkzOCBMMzMuMDAxLDUzLjE4OCBDMzMuMTI2LDUzLjMxMyAzMy4yNTEsNTMuNTAxIDMzLjUwMSw1My43NTEgQzMzLjc1MSw1My45MzkgMzQuMDY0LDU0LjA2NCAzNC40MzksNTQuMTI2IEwzOC4yNTIsNTQuMTI2IEwzOC4yNTIsNDMuNjg4IEw0Mi4zMTUsNDMuNjg4IEw0Mi4zMTUsNTcuNTYzIEwzMi45NCw1Ny41NjMgTDMyLjAwMiw1Ny4yNSBDMzEuMzc3LDU3LjA2MiAzMC43NTIsNTYuNjI1IDMwLjA2NCw1Ni4wNjIgQzI5LjQzOSw1NS40OTkgMjkuMTI2LDU0LjgxMiAyOS4xMjYsNTQuMDYyIEwyOS4xMjUsNTQuMDYzIFogTTMyLjUsMTEuMDYzIEMzMi40MzcsMTEuNzUxIDMyLjM3NSwxMi4zNzYgMzIuMzc1LDEzLjAwMSBDMzIuNDM4LDE0LjgxNCAzMi43NSwxNi40MzkgMzMuNDM4LDE3Ljc1MSBDMzQuMjUxLDE5LjYyNiAzNS44NzYsMjAuNjg5IDM4LjI1MSwyMS4wNjQgQzM4LjU2NCwyMS4wNjQgMzguODc2LDIxLjEyNyAzOS4xODksMjEuMTI3IEM0MS4xMjcsMjEuMDY0IDQyLjgxNCwyMC4xODkgNDQuMzE0LDE4LjU2NCBDNDUuOTM5LDE2LjU2NCA0Ny4wMDIsMTQuNDM5IDQ3LjM3NywxMi4wNjQgQzQ3LjM3NywxMS42ODkgNDcuNDQsMTEuMzE0IDQ3LjQ0LDEwLjkzOSBDNDcuNDQsOS4zMTQgNDYuODc3LDcuNjg5IDQ1LjgxNSw2LjAwMSBDNDQuNTAyLDMuOTM4IDQyLjk0LDIuNjg4IDQxLjA2NSwyLjMxMyBDNDAuODE1LDIuMjUgNDAuNTAyLDIuMjUgNDAuMjUyLDIuMjUgQzM4Ljc1MiwyLjI1IDM3LjI1MiwzLjEyNSAzNS42MjcsNC44NzUgQzMzLjc1Miw2LjkzOCAzMi43NTIsOSAzMi41MDIsMTEuMDYzIEwzMi41LDExLjA2MyBaIE00My44NzUsMjkuNjI1IEM0My44NzUsMzAuODc1IDQzLjkzOCwzMS44NzUgNDQuMTI1LDMyLjY4OCBDNDQuMjUsMzMuNTYzIDQ0LjUsMzQuNTAxIDQ1LDM1LjU2MyBDNDUuNDM4LDM2LjU2MyA0Ni4yNSwzNy4zNzYgNDcuNDM4LDM3Ljg3NiBDNDguNTAxLDM4LjMxNCA0OS44MTMsMzguNTY0IDUxLjQzOCwzOC41NjQgTDUxLjgxMywzOC41NjQgQzUyLjYyNiwzOC41NjQgNTMuMzc2LDM4LjUwMSA1NC4wNjMsMzguMzE0IEM1NC43NTEsMzguMDY0IDU1LjMxMywzNy44MTQgNTUuNzUxLDM3LjQzOSBDNTYuMjUxLDM3LjA2NCA1Ni42MjYsMzYuNjI2IDU3LjAwMSwzNi4yNTEgQzU3LjM3NiwzNS44MTMgNTcuNjI2LDM1LjMxMyA1Ny44MTQsMzQuNzUxIEM1OC4wMDIsMzQuMTI2IDU4LjE4OSwzMy42MjYgNTguMzE0LDMzLjE4OCBDNTguNDM5LDMyLjc1IDU4LjUwMiwzMi4yNSA1OC41NjQsMzEuNTYzIEM1OC42MjYsMzAuODc2IDU4LjYyNywzMC40MzggNTguNjI3LDMwLjEyNSBMNTguNjI3LDI3LjkzNyBDNTguNjI3LDI3LjM3NCA1OC41MDIsMjYuNjI0IDU4LjI1MiwyNS44MTIgQzU4LjAwMiwyNSA1Ny41NjQsMjQuMTg3IDU3LjA2NCwyMy4yNDkgQzU2LjUwMSwyMi4zMTEgNTUuNjg5LDIxLjU2MSA1NC42MjYsMjAuOTM2IEM1My41NjMsMjAuMzExIDUyLjI1MSwxOS45OTggNTAuODEzLDE5Ljk5OCBDNDYuMTg4LDE5Ljk5OCA0My44NzUsMjMuMTg2IDQzLjg3NSwyOS42MjMgTDQzLjg3NSwyOS42MjUgWiIgaWQ9IlNoYXBlIiBza2V0Y2g6dHlwZT0iTVNTaGFwZUdyb3VwIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4="); } .auth0-lock-social-button[data-provider^=bitbucket] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjI1NnB4IiBoZWlnaHQ9IjI5NXB4IiB2aWV3Qm94PSIwIDAgMjU2IDI5NSIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy43LjIgKDI4Mjc2KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5Hcm91cDwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJHcm91cCIgZmlsbD0iI0ZGRkZGRiI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMjgsNC42MDc0MjQwN2UtMDYgTDEyOCw0LjYwNzQyNDA3ZS0wNiBDNTcuNzMxODgxOCw0LjYwNzQyNDA3ZS0wNiAwLjAxMTYzOTUwNTEsMTguODIxODE1NyAwLjAxMTYzOTUwNTEsNDIuNjYyNzgxOCBDMC4wMTE2Mzk1MDUxLDQ4LjkzNjcyMjcgMTUuMDY5MDkzLDEzOC4wMjY2NjUgMjEuMzQzMDMzOSwxNzMuMTYwNzE1IEMyMy44NTI2MDU2LDE4OS40NzI5NjYgNjUuMjYwNjA4NSwyMTIuMDU5MTQ2IDEyOCwyMTIuMDU5MTQ2IEwxMjgsMjEyLjA1OTE0NiBDMTkwLjczOTM4NiwyMTIuMDU5MTQ2IDIzMC44OTI1OTEsMTg5LjQ3Mjk2NiAyMzQuNjU2OTcyLDE3My4xNjA3MTUgQzI0MC45MzA5MDEsMTM4LjAyNjY2NSAyNTUuOTg4MzU1LDQ4LjkzNjcyMjcgMjU1Ljk4ODM1NSw0Mi42NjI3ODE4IEMyNTQuNzMzNTY5LDE4LjgyMTgxNTcgMTk4LjI2ODExMiw0LjYwNzQyNDA3ZS0wNiAxMjgsNC42MDc0MjQwN2UtMDYgTDEyOCw0LjYwNzQyNDA3ZS0wNiBMMTI4LDQuNjA3NDI0MDdlLTA2IFogTTEyOCwxODMuMTk5MDI1IEMxMDUuNDEzODIsMTgzLjE5OTAyNSA4Ny44NDY3ODg4LDE2NS42MzE5ODggODcuODQ2Nzg4OCwxNDMuMDQ1ODA4IEM4Ny44NDY3ODg4LDEyMC40NTk2MjggMTA1LjQxMzgyLDEwMi44OTI2MDcgMTI4LDEwMi44OTI2MDcgQzE1MC41ODYxNjksMTAyLjg5MjYwNyAxNjguMTUzMjA1LDEyMC40NTk2MjggMTY4LjE1MzIwNSwxNDMuMDQ1ODA4IEMxNjguMTUzMjA1LDE2NC4zNzcyMDMgMTUwLjU4NjE2OSwxODMuMTk5MDI1IDEyOCwxODMuMTk5MDI1IEwxMjgsMTgzLjE5OTAyNSBMMTI4LDE4My4xOTkwMjUgWiBNMTI4LDU1LjIxMDY2MzYgQzgyLjgyNzYzMzcsNTUuMjEwNjYzNiA0Ni40Mzg3ODU5LDQ3LjY4MTkzNjggNDYuNDM4Nzg1OSwzNy42NDM2Mzg0IEM0Ni40Mzg3ODU5LDI3LjYwNTMyODMgODIuODI3NjMzNywyMC4wNzY2MDE2IDEyOCwyMC4wNzY2MDE2IEMxNzMuMTcyMzQ5LDIwLjA3NjYwMTYgMjA5LjU2MTIwOCwyNy42MDUzMjgzIDIwOS41NjEyMDgsMzcuNjQzNjM4NCBDMjA5LjU2MTIwOCw0Ny42ODE5MzY4IDE3My4xNzIzNDksNTUuMjEwNjYzNiAxMjgsNTUuMjEwNjYzNiBMMTI4LDU1LjIxMDY2MzYgTDEyOCw1NS4yMTA2NjM2IFoiIGlkPSJTaGFwZSI+PC9wYXRoPgogICAgICAgICAgICA8cGF0aCBkPSJNMjIwLjYwODE3NiwyMDcuMDM5OTkxIEMyMTguMDk4NTkyLDIwNy4wMzk5OTEgMjE2Ljg0MzgwNywyMDguMjk0Nzc3IDIxNi44NDM4MDcsMjA4LjI5NDc3NyBDMjE2Ljg0MzgwNywyMDguMjk0Nzc3IDE4NS40NzQxMTQsMjMzLjM5MDU0MSAxMjkuMDA4NjU3LDIzMy4zOTA1NDEgQzcyLjU0MzIxMTMsMjMzLjM5MDU0MSA0MS4xNzM1MDY5LDIwOC4yOTQ3NzcgNDEuMTczNTA2OSwyMDguMjk0Nzc3IEM0MS4xNzM1MDY5LDIwOC4yOTQ3NzcgMzguNjYzOTM1MSwyMDcuMDM5OTkxIDM3LjQwOTE0OTMsMjA3LjAzOTk5MSBDMzQuODk5NTY2LDIwNy4wMzk5OTEgMzIuMzg5OTk0MywyMDguMjk0Nzc3IDMyLjM4OTk5NDMsMjEyLjA1OTE0NiBMMzIuMzg5OTk0MywyMTMuMzEzOTMyIEMzNy40MDkxNDkzLDIzOS42NjQ0ODIgNDEuMTczNTA2OSwyNTguNDg2MjkzIDQxLjE3MzUwNjksMjYwLjk5NTg2NCBDNDQuOTM3ODc2LDI3OS44MTc2ODcgODIuNTgxNTA5OCwyOTQuODc1MTQxIDEyNy43NTM4NzEsMjk0Ljg3NTE0MSBMMTI3Ljc1Mzg3MSwyOTQuODc1MTQxIEMxNzIuOTI2MjMyLDI5NC44NzUxNDEgMjEwLjU2OTg2NiwyNzkuODE3Njg3IDIxNC4zMzQyMzUsMjYwLjk5NTg2NCBDMjE0LjMzNDIzNSwyNTguNDg2MjkzIDIxOC4wOTg1OTIsMjM5LjY2NDQ4MiAyMjMuMTE3NzQ3LDIxMy4zMTM5MzIgTDIyMy4xMTc3NDcsMjEyLjA1OTE0NiBDMjI0LjM3MjUzMywyMDkuNTQ5NTYzIDIyMy4xMTc3NDcsMjA3LjAzOTk5MSAyMjAuNjA4MTc2LDIwNy4wMzk5OTEgTDIyMC42MDgxNzYsMjA3LjAzOTk5MSBMMjIwLjYwODE3NiwyMDcuMDM5OTkxIFoiIGlkPSJTaGFwZSI+PC9wYXRoPgogICAgICAgICAgICA8Y2lyY2xlIGlkPSJPdmFsIiBjeD0iMTI4IiBjeT0iMTQxLjc5MTA4IiByPSIyMC4wNzY2MDUiPjwvY2lyY2xlPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"); background-size: 45%; } .auth0-lock-social-button[data-provider^=box] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjY1cHgiIGhlaWdodD0iMzZweCIgdmlld0JveD0iMCAwIDY1IDM2IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+Ym94PC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc2tldGNoOnR5cGU9Ik1TUGFnZSI+CiAgICAgICAgPGcgaWQ9ImJveCIgc2tldGNoOnR5cGU9Ik1TTGF5ZXJHcm91cCIgZmlsbD0iI0ZGRkZGRiI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0zNC41NjMsMTAuODc1IEM0MS40MzgsMTAuODc1IDQ3LjAwMSwxNi40MzggNDcuMDAxLDIzLjI1IEM0Ny4wMDEsMzAuMTI1IDQxLjQzOCwzNS42ODggMzQuNTYzLDM1LjY4OCBDMjkuODEzLDM1LjY4OCAyNS42ODgsMzMgMjMuNTYzLDI5LjA2MyBDMjEuNSwzMy4wMDEgMTcuMzc1LDM1LjY4OCAxMi42MjUsMzUuNjg4IEM1LjgxMiwzNS42ODggMC4zMTIsMzAuMjUgMC4xODcsMjMuNSBMMC4xODcsMjMuNSBMMC4xODcsMi44NzUgQzAuMjUsMS41IDEuMzEyLDAuNDM3IDIuNjg3LDAuNDM3IEM0LjA2MiwwLjQzNyA1LjEyNSwxLjUgNS4xODcsMi44NzUgTDUuMTg3LDIuODc1IEw1LjE4NywxMy4zMTMgQzcuMjUsMTEuNzUgOS44MTIsMTAuODc1IDEyLjYyNSwxMC44NzUgQzE3LjM3NSwxMC44NzUgMjEuNSwxMy41IDIzLjU2MywxNy40MzggQzI1LjY4OCwxMy41IDI5LjgxMywxMC44NzUgMzQuNTYzLDEwLjg3NSBMMzQuNTYzLDEwLjg3NSBaIE0xMi42MjUsMzAuNjg4IEMxNi43NSwzMC42ODggMjAuMDYzLDI3LjM3NSAyMC4wNjMsMjMuMjUgQzIwLjA2MywxOS4xODcgMTYuNzUsMTUuODEyIDEyLjYyNSwxNS44MTIgQzguNSwxNS44MTIgNS4xODcsMTkuMTg3IDUuMTg3LDIzLjI1IEM1LjE4NywyNy4zNzUgOC41LDMwLjY4OCAxMi42MjUsMzAuNjg4IEwxMi42MjUsMzAuNjg4IFogTTM0LjU2MywzMC42ODggQzM4LjY4OCwzMC42ODggNDIuMDAxLDI3LjM3NSA0Mi4wMDEsMjMuMjUgQzQyLjAwMSwxOS4xODcgMzguNjg4LDE1LjgxMiAzNC41NjMsMTUuODEyIEMzMC40MzgsMTUuODEyIDI3LjEyNSwxOS4xODcgMjcuMTI1LDIzLjI1IEMyNy4xMjUsMjcuMzc1IDMwLjQzOCwzMC42ODggMzQuNTYzLDMwLjY4OCBMMzQuNTYzLDMwLjY4OCBaIE02My42ODgsMzEuNzUgTDYzLjY4OCwzMS44MTMgQzY0LjQzOCwzMi44NzYgNjQuMjUxLDM0LjM3NiA2My4xODgsMzUuMTg4IEM2Mi4wNjMsMzYuMDYzIDYwLjU2MywzNS44MTMgNTkuNjg4LDM0Ljc1IEw1NC4yNSwyNy40MzcgTDQ4Ljc1LDM0Ljc1IEM0Ny44NzUsMzUuODEzIDQ2LjM3NSwzNi4wNjMgNDUuMzEyLDM1LjE4OCBDNDQuMTg3LDM0LjM3NSA0My45OTksMzIuODc1IDQ0Ljc0OSwzMS44MTMgTDUxLjEyNCwyMy4yNSBMNDQuNzQ5LDE0Ljc1IEM0My45OTksMTMuNjg3IDQ0LjE4NiwxMi4xMjUgNDUuMzEyLDExLjMxMiBDNDYuMzc1LDEwLjQ5OSA0Ny44NzUsMTAuNzQ5IDQ4Ljc1LDExLjgxMiBMNTQuMjUsMTkuMTI1IEw1OS42ODgsMTEuODEyIEM2MC41NjMsMTAuNzQ5IDYyLjA2MywxMC40OTkgNjMuMTg4LDExLjMxMiBDNjQuMjUxLDEyLjEyNSA2NC40MzgsMTMuNjg3IDYzLjY4OCwxNC43NSBMNTcuMzEzLDIzLjI1IEw2My42ODgsMzEuNzUgWiIgaWQ9IlNoYXBlIiBza2V0Y2g6dHlwZT0iTVNTaGFwZUdyb3VwIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4="); } .auth0-lock-social-button[data-provider^=dropbox] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjY2cHgiIGhlaWdodD0iNjNweCIgdmlld0JveD0iMCAwIDY2IDYzIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+ZHJvcGJveDwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHNrZXRjaDp0eXBlPSJNU1BhZ2UiPgogICAgICAgIDxnIGlkPSJkcm9wYm94IiBza2V0Y2g6dHlwZT0iTVNMYXllckdyb3VwIiBmaWxsPSIjRkZGRkZGIj4KICAgICAgICAgICAgPHBhdGggZD0iTTAuMjUsMzMuODEzIEwyMC4xMjUsNDUuNjI2IEwzMy4xMjUsMzUuNjI2IEw0Ni4xMjUsNDUuNjI2IEw2NS43NSwzMy44MTMgTDUzLjEyNSwyMi45MzggTDY1Ljc1LDEyLjM3NSBMNDYuNDM3LDAgTDMzLjEyNCwxMS4xMjUgTDIwLjEyNCwwIEwwLjI0OSwxMyBMMTMuOTM3LDIzLjM3NSBMMC4yNSwzMy44MTMgWiBNMTMuODc1LDQ5Ljg3NSBMMzIuOTM4LDYyLjYyNSBMMzIuOTM4LDM5Ljg3NSBMMzIuODc1LDM5LjgxMiBMMTkuODc1LDQ5Ljc1IEwxMy44NzUsNDYuMTg3IEwxMy44NzUsNDkuODc1IEwxMy44NzUsNDkuODc1IFogTTE0LjE4OCwyMy4yNSBMMzMuMTI2LDExLjY4NyBMNTEuOTM5LDIyLjU2MiBMMzMuMDAxLDM1LjA2MiBMMTQuMTg4LDIzLjI1IFogTTMyLjkzOCw2Mi42MjUgTDUyLjQzOCw0OS45MzcgTDUyLjQzOCw0NS44NzQgTDQ2LjA2Myw0OS43NDkgTDMzLjEyNSwzOS44MTEgTDMzLDM5Ljg3NCBMMzIuOTM4LDYyLjYyNSBaIiBpZD0iU2hhcGUiIHNrZXRjaDp0eXBlPSJNU1NoYXBlR3JvdXAiPjwvcGF0aD4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg=="); } .auth0-lock-social-button[data-provider^=dwolla] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjQwcHgiIGhlaWdodD0iNjVweCIgdmlld0JveD0iMCAwIDQwIDY1IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+ZHdvbGxhPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc2tldGNoOnR5cGU9Ik1TUGFnZSI+CiAgICAgICAgPGcgaWQ9ImR3b2xsYSIgc2tldGNoOnR5cGU9Ik1TTGF5ZXJHcm91cCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEuMDAwMDAwLCAwLjAwMDAwMCkiIGZpbGw9IiNGRkZGRkYiPgogICAgICAgICAgICA8cGF0aCBkPSJNMSw1NSBDMSw1OC4zMTMgMiw2MC45MzggNC4wNjMsNjIuODc1IEM2LjEyNiw2NC43NSA4LjkzOCw2NS4yNSAxMi41NjMsNjQuMzc1IEMxMy4zNzYsNjQuMTg3IDE0LjQzOCw2My43NSAxNS44MTMsNjMuMDYyIEwxOC4wNjMsNjEuODc0IEwyMy44MTMsNTkuMzc0IEMyMy45MzgsNTkuMzc0IDI0LjM3Niw1OS4xMjQgMjUuMjUxLDU4Ljc0OSBDMjYuMDY0LDU4LjM3NCAyNi44MTQsNTguMDYxIDI3LjUwMSw1Ny44MTEgQzI5LjEyNiw1Ny4xMjMgMzAuNDM5LDU2LjU2MSAzMS4zNzYsNTYuMDYxIEMzMi4xODksNTUuNjg2IDMzLjMxNCw1NS4wNjEgMzQuODE0LDU0LjEyMyBDMzYuMTI3LDUzLjMxIDM3LjEyNyw1Mi40MzUgMzcuODE0LDUxLjYyMyBDMzguNTY0LDUwLjgxIDM5LjEyNyw0OS42ODUgMzkuNjI3LDQ4LjMxIEM0MC4xOSw0Ny4wNiA0MC41MDIsNDUuNTYgNDAuNTAyLDQzLjk5NyBDNDAuNTAyLDQyLjY4NCA0MC4zMTQsNDEuNDM0IDQwLjAwMiw0MC4yNDcgQzM5LjY4OSwzOC45OTcgMzkuMzc3LDM3Ljk5NyAzOS4wMDIsMzcuMTIyIEMzOC42ODksMzYuMjQ3IDM4LjEyNywzNS4zMDkgMzcuMzc3LDM0LjE4NCBDMzYuNTY0LDMzLjA1OSAzNi4wMDIsMzIuMjQ2IDM1LjU2NCwzMS43NDYgQzM1LjEyNiwzMS4yNDYgMzQuNDM5LDMwLjQzMyAzMy40MzksMjkuMzcxIEMzMi40MzksMjguMjQ2IDMxLjg3NiwyNy41NTggMzEuNTY0LDI3LjI0NiBDMzEuMzc2LDI2Ljk5NiAzMC42ODksMjYuMjQ2IDI5LjU2NCwyNC45MzMgQzI4LjQzOSwyMy42ODMgMjcuNjg5LDIyLjgwOCAyNy4zNzYsMjIuMzcgQzI3LjAwMSwyMS45OTUgMjYuNDM4LDIxLjE4MiAyNS42MjYsMTkuOTk1IEMyNC44MTQsMTguODA4IDI0LjMxMywxNy44NyAyNC4wMDEsMTcuMDU3IEMyMy43NTEsMTYuMjQ0IDIzLjQzOCwxNS4yNDQgMjMuMTg4LDE0LjA1NyBDMjIuOTM4LDEyLjgwNyAyMi44NzUsMTEuNjE5IDIyLjg3NSwxMC4zNjkgQzIzLDcuMTgxIDI0LjM3NSw0Ljc0NCAyNywzLjA1NiBDMjguMTI1LDIuNDkzIDI4LjY4OCwxLjkzMSAyOC42ODgsMS40OTMgQzI4LjUsMC43NDMgMjcuOTM4LDAuNjE4IDI3LjEyNSwxLjA1NSBDMjUuOTM3LDEuNzQzIDI0LjA2MiwyLjU1NSAyMS42MjUsMy42MTggTDE3LjE4Nyw1LjU1NiBMMTQuMTg3LDYuOTMxIEMxMy42ODcsNy4xMTkgMTMuMDYyLDcuMzY5IDEyLjMxMiw3LjY4MSBDMTEuNTYyLDguMDU2IDExLjA2Miw4LjI0NCAxMC44NzQsOC4zMDYgQzEwLjQ5OSw4LjQ5NCA5LjU2MSw4Ljk5NCA3Ljk5OSw5LjkzMSBDNi43NDksMTAuNjgxIDUuODExLDExLjM2OSA1LjMxMSwxMS45OTQgQzMuODExLDEzLjQ5NCAyLjg3MywxNS40MzIgMi42MjMsMTcuODA3IEMxLjkzNSwyMi42ODIgMy45MzYsMjcuOTk1IDguNjIzLDMzLjYyIEM4Ljk5OCwzNC4wNTggMTAuMjQ4LDM1LjU1OCAxMi40MzYsMzguMTIgQzEzLjg3NCwzOS43NDUgMTQuOTk5LDQxLjE4MyAxNS45MzYsNDIuNDk1IEMxNS41NjEsNDIuNjgzIDEyLjkzNiw0My44NyA4LjEyMyw0NS45MzMgQzcuMDYsNDYuMzcxIDUuODczLDQ2Ljk5NiA0LjYyMyw0Ny44MDggQzIuMTg1LDQ5LjM3MSAwLjk5OCw1MS43NDYgMC45OTgsNTQuOTk2IEwxLDU1IFoiIGlkPSJTaGFwZSIgc2tldGNoOnR5cGU9Ik1TU2hhcGVHcm91cCI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"); background-size: 30%; } .auth0-lock-social-button[data-provider^=ebay] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjkwcHgiIGhlaWdodD0iMzlweCIgdmlld0JveD0iMCAwIDkwIDM5IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+ZWJheTwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHNrZXRjaDp0eXBlPSJNU1BhZ2UiPgogICAgICAgIDxnIGlkPSJlYmF5IiBza2V0Y2g6dHlwZT0iTVNMYXllckdyb3VwIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMS4wMDAwMDAsIDAuMDAwMDAwKSIgZmlsbD0iI0ZGRkZGRiI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0xLDIzLjY4OCBDMSwyNS42MjYgMS4xODgsMjcuMTg4IDEuNjI1LDI4LjUwMSBDMiwyOS43NTEgMi44MTMsMzAuOTM5IDQsMzIuMDY0IEM1LjE4NywzMy4xODkgNy4wNjMsMzQuMDAyIDkuNTYzLDM0LjU2NCBDMTIuMDYzLDM1LjA2NCAxNS4zMTMsMzUuMzc3IDE5LjI1MSwzNS4zNzcgQzIyLjc1MSwzNS4zNzcgMjUuOTM5LDM1LjA2NCAyOC44MTQsMzQuMzc3IEMzMC4wNjQsMzQuMTI3IDMxLjI1MiwzMy43NTIgMzIuNDM5LDMzLjE4OSBMMzIuNDM5LDI3LjUwMSBMMjQuNjg5LDI3LjUwMSBDMjQuNjg5LDMwLjA2NCAyMi44NzYsMzEuMzc2IDE5LjI1MSwzMS4zNzYgQzE3LjkzOCwzMS4zNzYgMTYuODc2LDMxLjE4OCAxNi4wNjMsMzAuODEzIEMxNS4yNSwzMC40MzggMTQuNjg4LDI5Ljg3NSAxNC4zNzUsMjkuMDYzIEMxNC4wNjIsMjguMzEzIDEzLjg3NSwyNy42ODggMTMuODEyLDI3LjEyNSBDMTMuNjg3LDI2LjYyNSAxMy42ODcsMjUuODc1IDEzLjY4NywyNSBMMzIuNDM3LDI1IEwzMi40MzcsMTQuNjg3IEMzMS42MjQsMTQuMjQ5IDMwLjM3NCwxMy44NzQgMjguNjg3LDEzLjU2MiBDMjYuMTI0LDEyLjk5OSAyMi45OTksMTIuNjg3IDE5LjI0OSwxMi42ODcgQzE2LjA2MSwxMi42ODcgMTMuMzExLDEyLjg3NSAxMC45OTksMTMuMzEyIEM4Ljc0OSwxMy42ODcgNi45MzYsMTQuMjUgNS42ODYsMTQuODc1IEM0LjM3MywxNS40MzggMy4zNzMsMTYuMzEzIDIuNjg2LDE3LjMxMyBDMS45OTksMTguMzEzIDEuNTYxLDE5LjMxMyAxLjMxMSwyMC4zMTMgQzEuMTIzLDIxLjI1MSAwLjk5OCwyMi4zNzYgMC45OTgsMjMuNjg4IEwxLDIzLjY4OCBaIE0xMy42ODgsMjEuNTYzIEMxMy42ODgsMjAuODc1IDEzLjY4OCwyMC4zMTMgMTMuNzUxLDE5LjkzOCBDMTMuODE0LDE5LjYyNSAxNC4wMDEsMTkuMDYzIDE0LjMxNCwxOC40MzggQzE0LjYyNywxNy43NSAxNS4xODksMTcuMjUgMTYuMDAyLDE2LjkzOCBDMTYuODE1LDE2LjYyNiAxNy45NCwxNi41IDE5LjI1MiwxNi41IEMyMC42MjcsMTYuNSAyMS44MTUsMTYuNjI1IDIyLjY5LDE2LjkzOCBDMjMuNTY1LDE3LjI1MSAyNC4xMjgsMTcuNjg4IDI0LjQ0LDE4LjMxMyBDMjQuNzUzLDE5LjAwMSAyNC44NzgsMTkuNTAxIDI0Ljk0LDE5LjgxMyBDMjUuMDY1LDIwLjE4OCAyNS4wNjUsMjAuNzUxIDI1LjA2NSwyMS41NjMgTDEzLjY5LDIxLjU2MyBMMTMuNjg4LDIxLjU2MyBaIE0zMi40MzgsMzMuMTg4IEMzMi41MDEsMzMuMTg4IDMyLjYyNiwzMy4xMjUgMzIuNjg4LDMzLjA2MyBDMzUuODEzLDMxLjUgMzcuMzc2LDI5LjY4OCAzNy40MzgsMjcuNSBMMzIuNDM4LDI3LjUgTDMyLjQzOCwzMy4xODggTDMyLjQzOCwzMy4xODggWiBNMzIuNDM4LDMzLjE4OCBMMzIuNDM4LDM4LjI1MSBMMzkuMDAxLDM4LjI1MSBMMzkuMDAxLDM1LjU2MyBMMzkuMDY0LDM1LjU2MyBDNDAuMjUyLDM3LjY4OCA0Mi4xODksMzguNzUxIDQ0Ljg3NywzOC43NTEgQzQ2LjI1MiwzOC43NTEgNDcuNDQsMzguNTAxIDQ4LjMxNSwzNy45MzggQzQ5LjI1MywzNy40MzggNDkuOTQsMzYuNjI1IDUwLjQ0LDM1LjYyNSBDNTAuODc4LDM0LjU2MiA1MS4xOSwzMy41NjIgNTEuMzc4LDMyLjYyNSBDNTEuNTY2LDMxLjYyNSA1MS42OTEsMzAuNSA1MS43NTMsMjkuMTI1IEM0OC41MDMsMjguMzc1IDQ2Ljg3OCwyNS43NSA0Ni44NzgsMjEuMzEyIEM0Ni44NzgsMTguMjQ5IDQ3Ljc1MywxNi4wNjIgNDkuNDQxLDE0LjgxMiBDNDguMzE2LDEzLjY4NyA0Ni44NzgsMTMuMTI0IDQ1LjA2NiwxMy4xMjQgQzQyLjYyOCwxMy4xMjQgNDAuNzUzLDE0LjA2MiAzOS4zNzgsMTUuOTM3IEwzOS4yNTMsMTUuOTM3IEwzOS4yNTMsMi45OTkgTDMyLjQ0LDIuOTk5IEwzMi40NCwxNC42ODcgQzM0LjY5LDE1LjY4NyAzNi4xOSwxNyAzNi44MTUsMTguNjI1IEMzNy4zNzgsMjAgMzcuNjksMjEuNjI1IDM3LjY5LDIzLjUgQzM3LjY5LDI0IDM3LjYyNywyNC41IDM3LjYyNywyNSBMMzIuNDM5LDI1IEwzMi40MzksMjcuNSBMMzcuNDM5LDI3LjUgQzM3LjM3NiwyOS42ODggMzUuODE0LDMxLjUgMzIuNjg5LDMzLjA2MyBDMzIuNjI2LDMzLjEyNiAzMi41MDEsMzMuMTg4IDMyLjQzOSwzMy4xODggTDMyLjQzOCwzMy4xODggWiBNMzIuNDM4LDI1IEwzNy42MjYsMjUgQzM3LjYyNiwyNC41IDM3LjY4OSwyNCAzNy42ODksMjMuNSBDMzcuNjg5LDIxLjYyNSAzNy4zNzYsMjAgMzYuODE0LDE4LjYyNSBDMzYuMTg5LDE3IDM0LjY4OSwxNS42ODcgMzIuNDM5LDE0LjY4NyBMMzIuNDM5LDI1IEwzMi40MzgsMjUgWiBNMzkuMjUsMjUuNjg4IEMzOS4yNSwyNC4xMjUgMzkuMzEzLDIyLjkzOCAzOS4zMTMsMjIuMjUgQzM5LjM3NiwyMS41IDM5LjUwMSwyMC42ODcgMzkuNjI2LDE5LjgxMiBDMzkuNzUxLDE4LjkzNyA0MC4wNjQsMTguMjQ5IDQwLjQzOSwxNy45MzcgQzQwLjg3NywxNy41NjIgNDEuMzc3LDE3LjM3NCA0Mi4wNjQsMTcuMzc0IEM0Mi44MTQsMTcuMzc0IDQzLjM3NywxNy41NjIgNDMuODE0LDE3Ljg3NCBDNDQuMTg5LDE4LjI0OSA0NC41MDIsMTguODEyIDQ0LjYyNywxOS42ODcgQzQ0LjgxNSwyMC41NjIgNDQuOTQsMjEuMzc1IDQ0Ljk0LDIyLjA2MiBDNDUuMDAzLDIyLjc1IDQ1LjA2NSwyMy44NzUgNDUuMDY1LDI1LjM3NSBMNDUuMDY1LDI1LjY4OCBDNDUuMDY1LDI5LjAwMSA0NC44MTUsMzEuMjUxIDQ0LjQ0LDMyLjU2MyBDNDQuMDY1LDMzLjg3NSA0My4zMTUsMzQuNTAxIDQyLjA2NSwzNC41MDEgQzQwLjk0LDM0LjUwMSA0MC4xOSwzMy44NzYgMzkuODE1LDMyLjU2MyBDMzkuNDQsMzEuMjUgMzkuMjUyLDI5IDM5LjI1MiwyNS42ODggTDM5LjI1LDI1LjY4OCBaIE00Ni44NzUsMjEuMzEzIEM0Ni44NzUsMjUuNzUxIDQ4LjUsMjguMzc2IDUxLjc1LDI5LjEyNiBMNTEuNzUsMjUuODEzIEM1MS44MTMsMjQgNTEuODEzLDIyLjYyNSA1MS43NSwyMS43NSBDNTEuNjg3LDIwLjg3NSA1MS41LDE5LjY4NyA1MS4xMjUsMTguMTg3IEM1MC43NSwxNi42ODcgNTAuMTg3LDE1LjU2MiA0OS40MzcsMTQuODEyIEM0Ny43NDksMTYuMDYyIDQ2Ljg3NCwxOC4yNSA0Ni44NzQsMjEuMzEyIEw0Ni44NzUsMjEuMzEzIFogTTQ3LjM3NSwxMS4xODggTDU0LjI1LDExLjE4OCBDNTQuMjUsOS45MzggNTQuMzc1LDkgNTQuNjg4LDguMzEzIEM1NS4wMDEsNy42MjYgNTUuNjg4LDcuMzEzIDU2LjgxMyw3LjMxMyBDNTcuOTM4LDcuMzEzIDU4LjY4OCw3LjYyNiA1OS4wNjMsOC4yNTEgQzU5LjQzOCw4LjgxNCA1OS42MjYsOS43NTEgNTkuNjI2LDExLjAwMSBMNTkuNjI2LDEyLjkzOSBMNTguMDYzLDEyLjkzOSBDNTMuOTM4LDEyLjkzOSA1MS4wNjMsMTMuNTY0IDQ5LjQzOCwxNC44MTQgQzUwLjE4OCwxNS41NjQgNTAuNzUxLDE2LjY4OSA1MS4xMjYsMTguMTg5IEM1MS41MDEsMTkuNjg5IDUxLjY4OSwyMC44NzcgNTEuNzUxLDIxLjc1MiBMNTEuNzUxLDI5LjEyNyBDNTIuMDY0LDI5LjE5IDUyLjYyNiwyOS4xOSA1My40MzksMjkuMTkgQzU2LjI1MiwyOS4xOSA1OC40MzksMjguMDAyIDU5LjgxNCwyNS41MDIgTDU5LjkzOSwyNS41MDIgTDYwLjI1MiwyOC44MTUgTDY2LjY5LDI4LjgxNSBDNjYuNjksMjguNDQgNjYuNjI3LDI3Ljc1MiA2Ni41NjUsMjYuNjI3IEM2Ni40NCwyNS41NjQgNjYuNDQsMjQuNzUyIDY2LjQ0LDI0LjE4OSBMNjYuNDQsMTcuNjI2IEw1OS41NjUsMy42ODggQzU3LjYyNywzLjU2MyA1Ni42MjcsMy41IDU2LjQ0LDMuNSBDNTMuNTY1LDMuNSA1MS40NCw0LjA2MyA0OS45NCw1LjEyNSBDNDguMjUyLDYuMTg4IDQ3LjM3Nyw4LjI1IDQ3LjM3NywxMS4xODggTDQ3LjM3NSwxMS4xODggWiBNNTMuNjI1LDIxIEM1My4xODcsMjAuNjI1IDUzLjE4NywyMC4xODcgNTMuNjg4LDE5Ljc1IEM1NC4xODksMTkuMzEzIDU0LjI1MSwxOC45MzcgNTQuMDAxLDE4Ljc1IEM1My42ODgsMTguNTYyIDUzLjg3NiwxOC4zMTIgNTQuNDM5LDE4LjA2MiBDNTQuOTM5LDE3LjgxMiA1NS4xODksMTcuNjI0IDU1LjAwMiwxNy41NjIgQzU0Ljg3NywxNy40MzcgNTUuMDY1LDE3LjMxMiA1NS42OSwxNy4xODcgQzU2LjMxNSwxNy4wNjIgNTYuNTY1LDE2Ljk5OSA1Ni41NjUsMTYuOTk5IEw1Ny41MDMsMTYuODc0IEM1Ny42MjgsMTYuODc0IDU4LjAwMywxNi44NzQgNTguNTY2LDE2LjgxMSBMNTkuNjI5LDE2LjgxMSBMNTkuNjI5LDE4LjA2MSBDNTkuNjkyLDE4Ljc0OSA1OS42OTIsMTkuMjQ5IDU5LjYyOSwxOS42MjQgQzU5LjYyOSwxOS45MzcgNTkuNjI5LDIwLjQzNyA1OS41NjYsMjEuMTI0IEM1OS41MDMsMjEuNzQ5IDU5LjQ0MSwyMi4zMTIgNTkuMjUzLDIyLjYyNCBDNTkuMTI4LDIyLjk5OSA1OC45NCwyMy4zNzQgNTguNjksMjMuODEyIEM1OC40NCwyNC4xODcgNTguMDY1LDI0LjUgNTcuNjksMjQuNjg3IEM1Ny4yNTIsMjQuODc1IDU2LjgxNSwyNSA1Ni4yNTIsMjUgQzU0LjUwMiwyNSA1My42MjcsMjMuNjg3IDUzLjYyNywyMSBMNTMuNjI1LDIxIFogTTU3Ljg3NSwwLjM3NSBMNTkuNTYzLDMuNjg4IEM2Mi4zMTMsNC4wNjMgNjQuMTI2LDQuOTM4IDY1LjA2Myw2LjI1MSBDNjUuOTM4LDcuNjI2IDY2LjQzOCw5LjQzOSA2Ni40MzgsMTEuODE0IEw2Ni40MzgsMTcuNjI3IEw2OS4xODgsMjMuMzE1IEw2OS4xODgsMzUuNTAzIEw3OC4xODgsMzUuNTAzIEw3OC4xODgsMjMuMzE1IEw5MC4yNTEsMC4zNzcgTDgxLjEyNiwwLjM3NyBMNzQuMTI2LDE1LjE5IEw2Ny43NTEsMC4zNzcgTDU3Ljg3NiwwLjM3NyBMNTcuODc1LDAuMzc1IFogTTU5LjU2MywzLjY4OCBMNjYuNDM4LDE3LjYyNiBMNjYuNDM4LDExLjgxMyBDNjYuNDM4LDkuNDM4IDY1LjkzOCw3LjYyNSA2NS4wNjMsNi4yNSBDNjQuMTI1LDQuOTM3IDYyLjMxMyw0LjA2MiA1OS41NjMsMy42ODcgTDU5LjU2MywzLjY4OCBaIiBpZD0iU2hhcGUiIHNrZXRjaDp0eXBlPSJNU1NoYXBlR3JvdXAiPjwvcGF0aD4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg=="); background-size: 70%; } .auth0-lock-social-button[data-provider^=exact] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjQzcHgiIGhlaWdodD0iMzJweCIgdmlld0JveD0iMCAwIDQzIDMyIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+ZXhhY3Q8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz48L2RlZnM+CiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiBza2V0Y2g6dHlwZT0iTVNQYWdlIj4KICAgICAgICA8ZyBpZD0iZXhhY3QiIHNrZXRjaDp0eXBlPSJNU0xheWVyR3JvdXAiIGZpbGw9IiNGRkZGRkYiPgogICAgICAgICAgICA8ZyBpZD0iR3JvdXAiIHNrZXRjaDp0eXBlPSJNU1NoYXBlR3JvdXAiPgogICAgICAgICAgICAgICAgPHBhdGggZD0iTTAuMDQ5LDEuMDA4IEMxNC4wMTIsMC44IDI3Ljk3NCwwLjgyOSA0MS45MzcsMC45NzggQzQyLjAyNCwzLjcxOCA0Mi4yMjYsOS4xOTggNDIuMzEzLDExLjkzOSBDMjguNTI0LDEyLjQ0NSAxNC43MDYsMTIuMjA3IDAuODg4LDEyLjI5NyBDMC41OTksOC41NDQgMC4zMSw0Ljc5MSAwLjA1LDEuMDA5IEwwLjA1LDEuMDA5IEwwLjA1LDEuMDA5IEwwLjA0OSwxLjAwOCBaIiBpZD0iU2hhcGUiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0wLjIyMywyMC4yMTkgQzE0LjA0MSwyMC4yNDkgMjcuOTQ2LDE5LjI5NiA0MS43NjQsMjAuNjM2IEM0Mi4xMTEsMjQuMTUxIDQyLjExMSwyNy43MjUgNDIuMTQsMzEuMjY5IEMyOC4yMzUsMzEuMjM5IDE0LjM1OSwzMS4yMzkgMC40NTQsMzEuMjEgQzAuMzY3LDI3LjU0NyAwLjI4MSwyMy44ODMgMC4yMjMsMjAuMjIgTDAuMjIzLDIwLjIyIEwwLjIyMywyMC4yMiBMMC4yMjMsMjAuMjE5IFoiIGlkPSJTaGFwZSI+PC9wYXRoPgogICAgICAgICAgICA8L2c+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4="); background-size: 30%; } .auth0-lock-social-button[data-provider^=facebook] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjRweCIgaGVpZ2h0PSIyNHB4IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8ZyBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8cGF0aCBkPSJNMjIuNjY2NjY2NywwIEwxLjMzMzMzMzMzLDAgQzAuNTk2OTUzNjY3LC00LjUwOTAyNTAxZS0xNyA5LjAxODA1MDAxZS0xNywwLjU5Njk1MzY2NyAwLDEuMzMzMzMzMzMgTDAsMjIuNjY2NjY2NyBDOS4wMTgwNTAwMWUtMTcsMjMuNDAzMDQ2MyAwLjU5Njk1MzY2NywyNCAxLjMzMzMzMzMzLDI0IEwxMi44MiwyNCBMMTIuODIsMTQuNzIgTDkuNzAzMzMzMzMsMTQuNzIgTDkuNzAzMzMzMzMsMTEuMDg2NjY2NyBMMTIuODIsMTEuMDg2NjY2NyBMMTIuODIsOC40MiBDMTIuODIsNS4zMiAxNC43MTMzMzMzLDMuNjMgMTcuNDg2NjY2NywzLjYzIEMxOC40MTk2ODM2LDMuNjI3MjczMzEgMTkuMzUyMTYyNSwzLjY3NTEyMTI4IDIwLjI4LDMuNzczMzMzMzMgTDIwLjI4LDcgTDE4LjM2NjY2NjcsNyBDMTYuODYzMzMzMyw3IDE2LjU3LDcuNzE2NjY2NjcgMTYuNTcsOC43NjY2NjY2NyBMMTYuNTcsMTEuMDggTDIwLjE2NjY2NjcsMTEuMDggTDE5LjcsMTQuNzEzMzMzMyBMMTYuNTcsMTQuNzEzMzMzMyBMMTYuNTcsMjQgTDIyLjY2NjY2NjcsMjQgQzIzLjQwMzA0NjMsMjQgMjQsMjMuNDAzMDQ2MyAyNCwyMi42NjY2NjY3IEwyNCwxLjMzMzMzMzMzIEMyNCwwLjU5Njk1MzY2NyAyMy40MDMwNDYzLDQuNTA5MDI1MDFlLTE3IDIyLjY2NjY2NjcsMCBaIiBpZD0iUGF0aCIgZmlsbD0iI0ZGRkZGRiI+PC9wYXRoPgogICAgPC9nPgo8L3N2Zz4="); } .auth0-lock-social-button[data-provider^=fitbit] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjYwcHgiIGhlaWdodD0iNTlweCIgdmlld0JveD0iMCAwIDYwIDU5IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+Zml0Yml0PC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc2tldGNoOnR5cGU9Ik1TUGFnZSI+CiAgICAgICAgPGcgaWQ9ImZpdGJpdCIgc2tldGNoOnR5cGU9Ik1TTGF5ZXJHcm91cCIgZmlsbD0iI0ZGRkZGRiI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0zOC4zNzUsNDIgQzM4LjM3NSw0NC40MzggNDAuMzEzLDQ2LjMxMyA0Mi44MTMsNDYuMzEzIEM0NS4yNTEsNDYuMzEzIDQ3LjI1MSw0NC4zNzUgNDcuMzEzLDQyIEM0Ny4zMTMsMzkuNjI1IDQ1LjI1LDM3LjU2MiA0Mi43NSwzNy42MjUgQzQwLjMxMiwzNy42MjUgMzguMzc1LDM5LjUgMzguMzc1LDQyIEwzOC4zNzUsNDIgWiBNNjAsMjkuNSBDNjAsMjYuOTM3IDU4LjE4NywyNS4xMjUgNTUuNjg3LDI1LjEyNSBDNTMuMTg3LDI1LjA2MiA1MS4xMjQsMjcuMDYzIDUxLjEyNCwyOS40MzggQzUxLjE4NywzMS44MTMgNTMuMTg3LDMzLjgxMyA1NS41NjIsMzMuODEzIEM1OC4wNjIsMzMuODc2IDYwLDMxLjkzOCA2MCwyOS41IEw2MCwyOS41IFogTTM4LjM3NSwxNi45MzggQzM4LjM3NSwxOS4zNzYgNDAuMzc1LDIxLjMxMyA0Mi44MTMsMjEuMzEzIEM0NS4yNTEsMjEuMjUgNDcuMjUxLDE5LjI1IDQ3LjMxMywxNi45MzggQzQ3LjMxMywxNC42MjUgNDUuMjUsMTIuNTYzIDQyLjg3NSwxMi41NjMgQzQwLjM3NSwxMi41IDM4LjM3NSwxNC40MzggMzguMzc1LDE2LjkzOCBMMzguMzc1LDE2LjkzOCBaIE0wLDI5LjQzOCBDMCwzMS44NzYgMiwzMy44MTMgNC4zNzUsMzMuODEzIEM2Ljg3NSwzMy44MTMgOC44NzUsMzEuNzUgOC44NzUsMjkuMzc1IEM4LjgxMiwyNyA2LjgxMiwyNS4xMjUgNC4zNzUsMjUuMTI1IEMxLjgxMiwyNS4xMjUgMCwyNi45MzggMCwyOS40MzggTDAsMjkuNDM4IFogTTM4LjM3NSwyOS40MzggQzM4LjM3NSwzMS44MTMgNDAuMzc1LDMzLjgxMyA0Mi44MTMsMzMuODEzIEM0NS4yNTEsMzMuODEzIDQ3LjMxMywzMS43NSA0Ny4zMTMsMjkuMzc1IEM0Ny4yNSwyNyA0NS4yNSwyNS4xMjUgNDIuODEzLDI1LjEyNSBDNDAuMjUsMjUuMTI1IDM4LjM3NSwyNi45MzggMzguMzc1LDI5LjQzOCBMMzguMzc1LDI5LjQzOCBaIE0yMS42MjUsMjkuNSBDMjEuNjI1LDI3IDE5LjgxMiwyNS4xMjUgMTcuMzEyLDI1LjEyNSBDMTQuNzQ5LDI1LjA2MiAxMi43NDksMjYuOTM4IDEyLjY4NywyOS40MzggQzEyLjY4NywzMS43NTEgMTQuODEyLDMzLjgxMyAxNy4yNSwzMy44MTMgQzE5LjYyNSwzMy44MTMgMjEuNTYzLDMxLjg3NSAyMS42MjUsMjkuNSBMMjEuNjI1LDI5LjUgWiBNMjkuOTM4LDI1LjEyNSBDMjcuNSwyNS4xMjUgMjUuNSwyNy4wNjMgMjUuNTYzLDI5LjQzOCBDMjUuNTYzLDMxLjg3NiAyNy41NjMsMzMuODEzIDMwLjAwMSwzMy44MTMgQzMyLjQzOSwzMy44MTMgMzQuNDM5LDMxLjg3NSAzNC40MzksMjkuNSBDMzQuNTAyLDI3IDMyLjUwMSwyNS4xMjUgMjkuOTM5LDI1LjEyNSBMMjkuOTM4LDI1LjEyNSBaIE0zMCw4LjY4OCBDMzIuNSw4LjY4OCAzNC40MzgsNi43NSAzNC40MzgsNC4zMTMgQzM0LjM3NSwyIDMyLjMxMyw4Ljg4MTc4NDJlLTE2IDMwLDAuMDYzIEMyNy42MjUsMC4wNjMgMjUuNTYyLDIuMDYzIDI1LjU2Miw0LjQzOCBDMjUuNjI1LDYuNzUxIDI3LjYyNSw4LjY4OCAzMCw4LjY4OCBMMzAsOC42ODggWiBNMzAsNTguODEzIEMzMi40MzgsNTguODEzIDM0LjQzOCw1Ni44NzUgMzQuNDM4LDU0LjQzOCBDMzQuNDM4LDUyLjEyNSAzMi40MzgsNTAuMTg4IDMwLDUwLjE4OCBDMjcuNjI1LDUwLjEyNSAyNS41NjIsNTIuMTg4IDI1LjU2Miw1NC41MDEgQzI1LjU2Miw1Ni44NzYgMjcuNTYyLDU4Ljc1MSAzMCw1OC44MTQgTDMwLDU4LjgxMyBaIE0zNC40MzgsNDEuOTM4IEMzNC40MzgsMzkuNjI1IDMyLjQzOCwzNy42MjUgMzAsMzcuNjI1IEMyNy42ODcsMzcuNjI1IDI1LjYyNSwzOS42MjUgMjUuNTYyLDQxLjkzOCBDMjUuNTYyLDQ0LjI1MSAyNy42MjUsNDYuMzEzIDMwLjA2Miw0Ni4zMTMgQzMyLjQzNyw0Ni4yNSAzNC40MzcsNDQuMzEzIDM0LjQzNyw0MS45MzggTDM0LjQzOCw0MS45MzggWiBNMTIuODc1LDQyIEMxMi44NzUsNDQuNDM4IDE0Ljc1LDQ2LjMxMyAxNy4xODgsNDYuMzEzIEMxOS42MjYsNDYuMzEzIDIxLjU2Myw0NC4zNzUgMjEuNTYzLDQyIEMyMS41NjMsMzkuNjI1IDE5LjYyNSwzNy42MjUgMTcuMjUsMzcuNjI1IEMxNC42ODcsMzcuNjI1IDEyLjg3NSwzOS41IDEyLjg3NSw0MiBMMTIuODc1LDQyIFogTTMwLDEyLjYyNSBDMjcuNSwxMi42ODggMjUuNjI1LDE0LjUgMjUuNTYyLDE2Ljg3NSBDMjUuNTYyLDE5LjI1IDI3LjUsMjEuMTg4IDI5LjkzNywyMS4xODggQzMyLjUsMjEuMTg4IDM0LjQzNywxOS4zMTMgMzQuNDM3LDE2Ljg3NSBDMzQuMzc0LDE0LjUgMzIuNDM3LDEyLjYyNSAyOS45OTksMTIuNjI1IEwzMCwxMi42MjUgWiBNMTcuMjUsMjEuMTg4IEMxOS43NSwyMS4xODggMjEuNTYzLDE5LjM3NSAyMS41NjMsMTYuODc1IEMyMS41NjMsMTQuNDM3IDE5Ljc1LDEyLjY4NyAxNy4yNSwxMi42MjUgQzE0Ljc1LDEyLjYyNSAxMi42ODcsMTQuNjI1IDEyLjc1LDE2LjkzOCBDMTIuODEzLDE5LjMxMyAxNC44MTMsMjEuMTg4IDE3LjI1LDIxLjE4OCBMMTcuMjUsMjEuMTg4IFoiIGlkPSJTaGFwZSIgc2tldGNoOnR5cGU9Ik1TU2hhcGVHcm91cCI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"); } .auth0-lock-social-button[data-provider^=apple] .auth0-lock-social-button-icon { background-color: rgba(0,0,0,0) !important; background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB3aWR0aD0iMTcwcHgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDE3MCAxNzAiIHZlcnNpb249IjEuMSIgaGVpZ2h0PSIxNzBweCI+PGcgaWQ9IkFwcGxlX2xvZ29fYmxhY2siIGZpbGw9IiNGRkZGRkYiIGZpbGwtcnVsZT0ibm9uemVybyI+IDxwYXRoIGQ9Im0xNTAuMzcgMTMwLjI1Yy0yLjQ1IDUuNjYtNS4zNSAxMC44Ny04LjcxIDE1LjY2LTQuNTggNi41My04LjMzIDExLjA1LTExLjIyIDEzLjU2LTQuNDggNC4xMi05LjI4IDYuMjMtMTQuNDIgNi4zNS0zLjY5IDAtOC4xNC0xLjA1LTEzLjMyLTMuMTgtNS4xOTctMi4xMi05Ljk3My0zLjE3LTE0LjM0LTMuMTctNC41OCAwLTkuNDkyIDEuMDUtMTQuNzQ2IDMuMTctNS4yNjIgMi4xMy05LjUwMSAzLjI0LTEyLjc0MiAzLjM1LTQuOTI5IDAuMjEtOS44NDItMS45Ni0xNC43NDYtNi41Mi0zLjEzLTIuNzMtNy4wNDUtNy40MS0xMS43MzUtMTQuMDQtNS4wMzItNy4wOC05LjE2OS0xNS4yOS0xMi40MS0yNC42NS0zLjQ3MS0xMC4xMS01LjIxMS0xOS45LTUuMjExLTI5LjM3OCAwLTEwLjg1NyAyLjM0Ni0yMC4yMjEgNy4wNDUtMjguMDY4IDMuNjkzLTYuMzAzIDguNjA2LTExLjI3NSAxNC43NTUtMTQuOTI1czEyLjc5My01LjUxIDE5Ljk0OC01LjYyOWMzLjkxNSAwIDkuMDQ5IDEuMjExIDE1LjQyOSAzLjU5MSA2LjM2MiAyLjM4OCAxMC40NDcgMy41OTkgMTIuMjM4IDMuNTk5IDEuMzM5IDAgNS44NzctMS40MTYgMTMuNTctNC4yMzkgNy4yNzUtMi42MTggMTMuNDE1LTMuNzAyIDE4LjQ0NS0zLjI3NSAxMy42MyAxLjEgMjMuODcgNi40NzMgMzAuNjggMTYuMTUzLTEyLjE5IDcuMzg2LTE4LjIyIDE3LjczMS0xOC4xIDMxLjAwMiAwLjExIDEwLjMzNyAzLjg2IDE4LjkzOSAxMS4yMyAyNS43NjkgMy4zNCAzLjE3IDcuMDcgNS42MiAxMS4yMiA3LjM2LTAuOSAyLjYxLTEuODUgNS4xMS0yLjg2IDcuNTF6bS0zMS4yNi0xMjMuMDFjMCA4LjEwMjEtMi45NiAxNS42NjctOC44NiAyMi42NjktNy4xMiA4LjMyNC0xNS43MzIgMTMuMTM0LTI1LjA3MSAxMi4zNzUtMC4xMTktMC45NzItMC4xODgtMS45OTUtMC4xODgtMy4wNyAwLTcuNzc4IDMuMzg2LTE2LjEwMiA5LjM5OS0yMi45MDggMy4wMDItMy40NDYgNi44Mi02LjMxMTMgMTEuNDUtOC41OTcgNC42Mi0yLjI1MTYgOC45OS0zLjQ5NjggMTMuMS0zLjcxIDAuMTIgMS4wODMxIDAuMTcgMi4xNjYzIDAuMTcgMy4yNDA5eiIvPjwvZz48L3N2Zz4="); } .auth0-lock-social-button[data-provider^=line] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml,%3C%3Fxml version=\'1.0\' encoding=\'UTF-8\'%3F%3E%3Csvg width=\'40px\' height=\'38px\' viewBox=\'0 0 40 38\' version=\'1.1\' xmlns=\'http://www.w3.org/2000/svg\' xmlns:xlink=\'http://www.w3.org/1999/xlink\'%3E%3Cg id=\'Artboard-Copy\' stroke=\'none\' stroke-width=\'1\' fill=\'none\' fill-rule=\'evenodd\'%3E%3Cpath d=\'M39.9994525,16.2299727 C39.9994525,19.8116699 38.6111711,23.037191 35.7126878,26.2155543 L35.7134546,26.2155543 C31.517555,31.0452096 22.1342905,36.9276737 19.9995346,37.8271237 C17.8655454,38.7265736 18.1803146,37.2547116 18.2673458,36.7490106 C18.3179542,36.4484271 18.5525933,35.0371418 18.5525933,35.0371418 C18.6200712,34.5264567 18.6898495,33.7343579 18.4881826,33.228657 C18.2638952,32.6719641 17.3774807,32.3828826 16.7260888,32.2425592 C7.11508632,30.9719807 -2.96628472e-14,24.2529438 -3.06453778e-14,16.2299727 C-3.17413459e-14,7.28071393 8.97264603,7.10542736e-14 19.9995346,7.10542736e-14 C31.0279567,6.58152488e-14 39.9994525,7.28071393 39.9994525,16.2299727 Z M12.6998041,19.2525622 L8.88806861,19.2525622 L8.88806861,12.3318583 C8.88806861,12.1167724 8.71362286,11.9423267 8.49892039,11.9423267 L7.09568643,11.9423267 C6.88060056,11.9423267 6.70615481,12.1167724 6.70615481,12.3318583 L6.70615481,21.0449444 L6.70615481,21.0457112 C6.70615481,21.1503786 6.74794511,21.2450778 6.81503963,21.3148561 C6.81657322,21.316773 6.81810681,21.31869 6.8204072,21.320607 C6.82232418,21.322524 6.82424117,21.3240576 6.82615815,21.3259746 C6.89631985,21.3934525 6.99063558,21.4348594 7.09530303,21.4348594 L7.09568643,21.4348594 L12.6998041,21.4348594 C12.91489,21.4348594 13.088569,21.2600303 13.088569,21.0449444 L13.088569,19.6420938 C13.088569,19.427008 12.91489,19.2525622 12.6998041,19.2525622 Z M33.4842673,19.2525604 L29.6729151,19.2525604 L29.6729151,17.7799316 L33.4842673,17.7799316 C33.6993531,17.7799316 33.8730321,17.6051024 33.8730321,17.3900166 L33.8730321,15.987166 C33.8730321,15.7720801 33.6993531,15.5976344 33.4842673,15.5976344 L29.6729151,15.5976344 L29.6729151,14.1246221 L33.4842673,14.1246221 C33.6993531,14.1246221 33.8730321,13.949793 33.8730321,13.7350905 L33.8730321,12.3318565 C33.8730321,12.1171541 33.6993531,11.9423249 33.4842673,11.9423249 L27.8801496,11.9423249 L27.8793828,11.9423249 C27.7750987,11.9423249 27.6803996,11.9841152 27.6106213,12.0512097 C27.6087043,12.0527433 27.6064039,12.0546603 27.6048703,12.0565773 C27.6029533,12.0581109 27.6010364,12.0604113 27.5995028,12.0623283 C27.5324082,12.1321066 27.4906179,12.2268057 27.4906179,12.3314731 L27.4906179,12.3318565 L27.4906179,21.0449426 L27.4906179,21.045326 C27.4906179,21.1496101 27.5320248,21.2439258 27.598736,21.3137041 C27.600653,21.3160045 27.6025699,21.3183049 27.6048703,21.3206053 C27.6060205,21.3221388 27.6079375,21.323289 27.6094711,21.3248226 C27.6796328,21.3926839 27.7743319,21.4348576 27.8793828,21.4348576 L27.8801496,21.4348576 L33.4842673,21.4348576 C33.6993531,21.4348576 33.8730321,21.2600285 33.8730321,21.0449426 L33.8730321,19.6420921 C33.8730321,19.4266228 33.6993531,19.2525604 33.4842673,19.2525604 Z M18.2241731,21.4347046 L19.6270237,21.4347046 C19.8421096,21.4347046 20.0165553,21.2602589 20.0165553,21.0459398 L20.0165553,15.8685432 L24.0100212,21.2617925 C24.0192227,21.2755948 24.0295744,21.2886303 24.0403095,21.3012824 L24.0429933,21.3035828 C24.0506613,21.3124009 24.0583292,21.3200688 24.0663806,21.3277368 C24.0686809,21.3300372 24.0709813,21.3319541 24.0736651,21.3342545 C24.0801829,21.3403889 24.087084,21.3461398 24.0943686,21.3515074 C24.0974357,21.3545746 24.1008863,21.356875 24.1043369,21.3595588 C24.111238,21.3641595 24.1177558,21.3691437 24.1246569,21.3733611 C24.1284909,21.3760448 24.1323249,21.3783452 24.1365423,21.3802622 C24.1434434,21.3844796 24.1503446,21.3886969 24.1572457,21.3921475 C24.1614631,21.3940645 24.165297,21.3963649 24.1695144,21.3978985 C24.176799,21.4013491 24.1840835,21.4047996 24.1917515,21.4074834 C24.1963522,21.409017 24.2001862,21.4105506 24.2044036,21.4120842 C24.2120715,21.414768 24.2197395,21.4174517 24.2277908,21.4193687 C24.2320082,21.4209023 24.2366089,21.4216691 24.2412097,21.4232027 C24.2488777,21.4247363 24.2561622,21.4266533 24.2634467,21.4281869 C24.2688143,21.4289537 24.2745653,21.4297205 24.2799328,21.4301038 C24.286834,21.4316374 24.2937351,21.4320208 24.3006363,21.4327876 C24.307154,21.4335544 24.3136718,21.4335544 24.3205729,21.4339378 C24.3255571,21.4339378 24.3293911,21.4347046 24.3343752,21.4347046 L25.7368424,21.4347046 C25.9519283,21.4347046 26.1267574,21.2602589 26.1267574,21.0459398 L26.1267574,12.3313201 C26.1267574,12.1166177 25.9519283,11.9425553 25.7368424,11.9425553 L24.3343752,11.9425553 C24.118906,11.9425553 23.9444602,12.1166177 23.9444602,12.3313201 L23.9444602,17.5071831 L19.9460102,12.1070327 C19.9184056,12.0679262 19.8842833,12.0361042 19.8470937,12.0108 C19.8459435,12.0100332 19.84441,12.008883 19.8432598,12.0077328 C19.8352084,12.0027487 19.8271571,11.9977645 19.8191057,11.9931637 C19.8152718,11.9908634 19.8118212,11.9893298 19.8079872,11.9874128 C19.8022363,11.9839622 19.7957185,11.980895 19.7895841,11.9782112 C19.7830664,11.9755275 19.7773154,11.9728437 19.7704143,11.9701599 C19.7665803,11.9686263 19.7627463,11.9670927 19.7589124,11.9659425 C19.7497108,11.962492 19.7412761,11.9598082 19.732458,11.9571244 C19.730541,11.9571244 19.728624,11.9563576 19.726707,11.9559742 C19.694885,11.9475395 19.6615295,11.9425553 19.6270237,11.9425553 L18.2241731,11.9425553 C18.0087039,11.9425553 17.8346415,12.1166177 17.8346415,12.3313201 L17.8346415,21.0459398 C17.8346415,21.2602589 18.0087039,21.4347046 18.2241731,21.4347046 Z M16.0814055,21.4347046 C16.2964914,21.4347046 16.4709371,21.2602589 16.4709371,21.0459398 L16.4709371,12.3313201 C16.4709371,12.1166177 16.2964914,11.9425553 16.0814055,11.9425553 L14.678555,11.9425553 C14.4634691,11.9425553 14.28864,12.1166177 14.28864,12.3313201 L14.28864,21.0459398 C14.28864,21.2602589 14.4634691,21.4347046 14.678555,21.4347046 L16.0814055,21.4347046 Z\' id=\'Combined-Shape\' fill=\'%23FFFFFF\'%3E%3C/path%3E%3C/g%3E%3C/svg%3E%0A"); } .auth0-lock-social-button[data-provider^=github] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjY0cHgiIGhlaWdodD0iNjVweCIgdmlld0JveD0iMCAwIDY0IDY1IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+Z2l0aHViPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc2tldGNoOnR5cGU9Ik1TUGFnZSI+CiAgICAgICAgPGcgaWQ9ImdpdGh1YiIgc2tldGNoOnR5cGU9Ik1TTGF5ZXJHcm91cCIgZmlsbD0iI0ZGRkZGRiI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik04LjQzNzY5NDk5ZS0xNSwzMi4yNSBDOC40Mzc2OTQ5OWUtMTUsMzYuNTYzIDAuODc1LDQwLjc1IDIuNTYzLDQ0LjYyNSBDNS45MzgsNTIuNjI1IDExLjU2Myw1OC4zMTMgMTkuNTAxLDYxLjc1IEMyMy40MzksNjMuNDM4IDI3LjU2NCw2NC4zMTMgMzEuOTM5LDY0LjMxMyBDMzYuMzE0LDY0LjMxMyA0MC40MzksNjMuNDM4IDQ0LjM3Nyw2MS43NSBDNTIuMTksNTguMzc1IDU3Ljg3Nyw1Mi42ODcgNjEuMzE1LDQ0LjYyNSBDNjMuMDAzLDQwLjYyNSA2My44NzgsMzYuNDM3IDYzLjg3OCwzMi4yNSBDNjMuODc4LDI4IDYzLjAwMywyMy44NzUgNjEuMzE1LDE5LjgxMiBDNTcuODc3LDExLjgxMiA1Mi4xOSw2LjE4NyA0NC4zNzcsMi44NzQgQzQwLjQzOSwxLjEyNCAzNi4zMTQsMC4zMTEgMzEuOTM5LDAuMzExIEMyNy41NjQsMC4zMTEgMjMuNDM5LDEuMTI0IDE5LjUwMSwyLjg3NCBDMTEuNTYzLDYuMjQ5IDUuOTM4LDExLjg3NCAyLjU2MywxOS44MTIgQzAuODc1LDIzLjc1IDAsMjcuODc1IDAsMzIuMjUgTDguNDM3Njk0OTllLTE1LDMyLjI1IFogTTUsMzIuMjUgQzUsMjguNjI1IDUuNjg4LDI1LjEyNSA3LjEyNSwyMS43NSBDOC41NjMsMTguNSAxMC41LDE1LjYyNSAxMi44NzUsMTMuMTg3IEMxNS4zNzUsMTAuNzQ5IDE4LjI1LDguODEyIDIxLjQzOCw3LjQzNyBDMjQuOTM4LDUuOTk5IDI4LjQzOCw1LjMxMiAzMS45MzgsNS4zMTIgQzM1LjUwMSw1LjMxMiAzOC45MzgsNiA0Mi4zNzYsNy40MzcgQzQ1LjY4OSw4Ljg3NSA0OC41NjQsMTAuNzUgNTAuOTM5LDEzLjE4NyBDNTMuNDM5LDE1LjYyNSA1NS4zMTQsMTguNSA1Ni42ODksMjEuNzUgQzU4LjEyNywyNS4xMjUgNTguODE0LDI4LjYyNSA1OC44MTQsMzIuMjUgQzU4LjgxNCwzOC4xODggNTcuMDY0LDQzLjU2MyA1My41NjQsNDguMjUgQzUwLjAwMSw1MyA0NS40MzksNTYuMzEzIDM5LjkzOSw1OC4zMTMgTDM5LjkzOSw1My4xODggQzM5LjkzOSw1MC42ODggMzkuMDY0LDQ4LjgxMyAzNy4zMTQsNDcuNjI1IEMzOS40MzksNDcuNDM3IDQxLjM3Nyw0NyA0My4xMjcsNDYuMzc1IEM0NS4yNTIsNDUuNjI1IDQ2Ljk0LDQ0LjU2MiA0OC4xOSw0My4xODcgQzUwLjU2NSw0MC43NDkgNTEuNjksMzcuMTI0IDUxLjY5LDMyLjM3NCBDNTEuNjksMjkuMTg2IDUwLjYyNywyNi40MzYgNDguNTAyLDI0LjE4NiBDNDkuNDQsMjEuNjIzIDQ5LjM3NywxOC45MzYgNDguMTg5LDE1Ljk5OCBMNDcuNDM5LDE1LjkzNSBDNDYuODE0LDE1LjgxIDQ1Ljg3NiwxNi4wNiA0NC41MDEsMTYuNTYgQzQzLjAwMSwxNy4xMjMgNDEuNTAxLDE3Ljk5OCAzOS44MTMsMTkuMTIzIEMzNy4xODgsMTguNDM1IDM0LjU2MywxOC4wNiAzMi4wNjMsMTguMDYgQzI5LjU2MywxOC4wNiAyNywxOC40MzUgMjQuMzc1LDE5LjEyMyBDMjIuMzEyLDE3Ljc0OCAyMC41LDE2LjgxIDE4LjgxMiwxNi4zMSBDMTguMTg3LDE2LjA2IDE3LjYyNCwxNS45OTcgMTcuMTg3LDE1Ljk5NyBMMTUuOTM3LDE1Ljk5NyBDMTQuNzQ5LDE4LjkzNSAxNC42MjQsMjEuNjIyIDE1LjYyNCwyNC4xODUgQzEzLjQ5OSwyNi40MzUgMTIuNDM2LDI5LjE4NSAxMi40MzYsMzIuMzczIEMxMi40MzYsMzguNDk4IDE0LjM3NCw0Mi43NDggMTguMjQ5LDQ1LjEyMyBDMTkuNzQ5LDQ2LjA2MSAyMS42MjQsNDYuNzQ4IDIzLjgxMiw0Ny4xMjMgQzI0LjkzNyw0Ny4zNzMgMjUuOTM3LDQ3LjU2MSAyNi44MTIsNDcuNjIzIEMyNS4xMjQsNDguNzQ4IDI0LjI0OSw1MC42MjMgMjQuMjQ5LDUzLjE4NiBMMjQuMjQ5LDU4LjMxMSBDMTguNTYxLDU2LjMxMSAxMy45MzYsNTIuOTk4IDEwLjM3NCw0OC4zNzMgQzYuODExLDQzLjYyMyA0Ljk5OSwzOC4yNDggNC45OTksMzIuMjQ4IEw1LDMyLjI1IFoiIGlkPSJTaGFwZSIgc2tldGNoOnR5cGU9Ik1TU2hhcGVHcm91cCI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"); } .auth0-lock-social-button[data-provider^=google] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHdpZHRoPSIzOHB4IiBoZWlnaHQ9IjM4cHgiIHZpZXdCb3g9IjAgMCAzOCAzOCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4gICAgICAgIDx0aXRsZT5BcnRib2FyZDwvdGl0bGU+ICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPiAgICA8ZyBpZD0iQXJ0Ym9hcmQiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPiAgICAgICAgPGcgaWQ9ImJ0bl9nb29nbGVfZGFya19ub3JtYWxfaW9zIj4gICAgICAgICAgICA8ZyBpZD0iYnV0dG9uLWJnLWNvcHkiPiAgICAgICAgICAgICAgICA8cmVjdCBpZD0icGF0aC0zIiB4PSIwIiB5PSIwIiB3aWR0aD0iMzgiIGhlaWdodD0iMzgiIHJ4PSIxIj48L3JlY3Q+ICAgICAgICAgICAgPC9nPiAgICAgICAgICAgIDxnIGlkPSJsb2dvX2dvb2dsZWdfNDhkcCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTAuMDAwMDAwLCAxMC4wMDAwMDApIj4gICAgICAgICAgICAgICAgPHBhdGggZD0iTTE3LjY0LDkuMjA0NTQ1NDUgQzE3LjY0LDguNTY2MzYzNjQgMTcuNTgyNzI3Myw3Ljk1MjcyNzI3IDE3LjQ3NjM2MzYsNy4zNjM2MzYzNiBMOSw3LjM2MzYzNjM2IEw5LDEwLjg0NSBMMTMuODQzNjM2NCwxMC44NDUgQzEzLjYzNSwxMS45NyAxMy4wMDA5MDkxLDEyLjkyMzE4MTggMTIuMDQ3NzI3MywxMy41NjEzNjM2IEwxMi4wNDc3MjczLDE1LjgxOTU0NTUgTDE0Ljk1NjM2MzYsMTUuODE5NTQ1NSBDMTYuNjU4MTgxOCwxNC4yNTI3MjczIDE3LjY0LDExLjk0NTQ1NDUgMTcuNjQsOS4yMDQ1NDU0NSBaIiBpZD0iU2hhcGUiIGZpbGw9IiM0Mjg1RjQiPjwvcGF0aD4gICAgICAgICAgICAgICAgPHBhdGggZD0iTTksMTggQzExLjQzLDE4IDEzLjQ2NzI3MjcsMTcuMTk0MDkwOSAxNC45NTYzNjM2LDE1LjgxOTU0NTUgTDEyLjA0NzcyNzMsMTMuNTYxMzYzNiBDMTEuMjQxODE4MiwxNC4xMDEzNjM2IDEwLjIxMDkwOTEsMTQuNDIwNDU0NSA5LDE0LjQyMDQ1NDUgQzYuNjU1OTA5MDksMTQuNDIwNDU0NSA0LjY3MTgxODE4LDEyLjgzNzI3MjcgMy45NjQwOTA5MSwxMC43MSBMMC45NTcyNzI3MjcsMTAuNzEgTDAuOTU3MjcyNzI3LDEzLjA0MTgxODIgQzIuNDM4MTgxODIsMTUuOTgzMTgxOCA1LjQ4MTgxODE4LDE4IDksMTggWiIgaWQ9IlNoYXBlIiBmaWxsPSIjMzRBODUzIj48L3BhdGg+ICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0zLjk2NDA5MDkxLDEwLjcxIEMzLjc4NDA5MDkxLDEwLjE3IDMuNjgxODE4MTgsOS41OTMxODE4MiAzLjY4MTgxODE4LDkgQzMuNjgxODE4MTgsOC40MDY4MTgxOCAzLjc4NDA5MDkxLDcuODMgMy45NjQwOTA5MSw3LjI5IEwzLjk2NDA5MDkxLDQuOTU4MTgxODIgTDAuOTU3MjcyNzI3LDQuOTU4MTgxODIgQzAuMzQ3NzI3MjczLDYuMTczMTgxODIgMCw3LjU0NzcyNzI3IDAsOSBDMCwxMC40NTIyNzI3IDAuMzQ3NzI3MjczLDExLjgyNjgxODIgMC45NTcyNzI3MjcsMTMuMDQxODE4MiBMMy45NjQwOTA5MSwxMC43MSBaIiBpZD0iU2hhcGUiIGZpbGw9IiNGQkJDMDUiPjwvcGF0aD4gICAgICAgICAgICAgICAgPHBhdGggZD0iTTksMy41Nzk1NDU0NSBDMTAuMzIxMzYzNiwzLjU3OTU0NTQ1IDExLjUwNzcyNzMsNC4wMzM2MzYzNiAxMi40NDA0NTQ1LDQuOTI1NDU0NTUgTDE1LjAyMTgxODIsMi4zNDQwOTA5MSBDMTMuNDYzMTgxOCwwLjg5MTgxODE4MiAxMS40MjU5MDkxLDAgOSwwIEM1LjQ4MTgxODE4LDAgMi40MzgxODE4MiwyLjAxNjgxODE4IDAuOTU3MjcyNzI3LDQuOTU4MTgxODIgTDMuOTY0MDkwOTEsNy4yOSBDNC42NzE4MTgxOCw1LjE2MjcyNzI3IDYuNjU1OTA5MDksMy41Nzk1NDU0NSA5LDMuNTc5NTQ1NDUgWiIgaWQ9IlNoYXBlIiBmaWxsPSIjRUE0MzM1Ij48L3BhdGg+ICAgICAgICAgICAgICAgIDxwb2x5Z29uIGlkPSJTaGFwZSIgcG9pbnRzPSIwIDAgMTggMCAxOCAxOCAwIDE4Ij48L3BvbHlnb24+ICAgICAgICAgICAgPC9nPiAgICAgICAgPC9nPiAgICA8L2c+PC9zdmc+"); background-size: 100%; } .auth0-lock-social-button[data-provider^=instagram] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjY0cHgiIGhlaWdodD0iNjVweCIgdmlld0JveD0iMCAwIDY0IDY1IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+aW5zdGFncmFtPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc2tldGNoOnR5cGU9Ik1TUGFnZSI+CiAgICAgICAgPGcgaWQ9Imluc3RhZ3JhbSIgc2tldGNoOnR5cGU9Ik1TTGF5ZXJHcm91cCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEuMDAwMDAwLCAwLjAwMDAwMCkiIGZpbGw9IiNGRkZGRkYiPgogICAgICAgICAgICA8cGF0aCBkPSJNNDYuMDYzLDIzLjY4OCBDNDcuOTM4LDI2LjMxMyA0OS4wNjMsMjkuNTYzIDQ5LjA2MywzMy4xMjYgQzQ5LjA2Myw0Mi4xMjYgNDEuODEzLDQ5LjM3NiAzMi44MTMsNDkuMzc2IEMyMy44MTMsNDkuMzc2IDE2LjUsNDIuMTI2IDE2LjUsMzMuMTI2IEMxNi41LDI5LjU2MyAxNy42MjUsMjYuMzEzIDE5LjUsMjMuNjg4IEwxLDIzLjY4OCBMMSw1Mi4yNTEgQzEsNTkuMTg5IDYuNjI1LDY0LjgxNCAxMy41NjMsNjQuODE0IEw1Mi4wNjMsNjQuODE0IEM1OS4wMDEsNjQuODE0IDY0LjY4OCw1OS4xODkgNjQuNjg4LDUyLjI1MSBMNjQuNjg4LDIzLjY4OCBMNDYuMDYzLDIzLjY4OCBMNDYuMDYzLDIzLjY4OCBaIE02NC42ODgsMTMuMzc1IEM2NC42ODgsNi40MzcgNTksMC44MTIgNTIuMDYzLDAuODEyIEwxNy42ODgsMC44MTIgTDE3LjY4OCwxNi42ODcgTDE1LjA2MywxNi42ODcgTDE1LjA2MywwLjgxMiBMMTMuMzEzLDAuODEyIEwxMy4zMTMsMTYuNjg3IEwxMC43NSwxNi42ODcgTDEwLjc1LDEuMTI0IEMxMC4xMjUsMS4zMTIgOS41LDEuNDk5IDguODc1LDEuNzQ5IEw4Ljg3NSwxNi42ODcgTDYuMzEyLDE2LjY4NyBMNi4zMTIsMy4xMjQgQzMuMTI0LDUuNDM3IDAuOTk5LDkuMTg3IDAuOTk5LDEzLjM3NCBMMC45OTksMjEuNjg3IEwyMS4xODcsMjEuNjg3IEMyNC4xMjUsMTguNjg3IDI4LjI1LDE2LjgxMiAzMi44MTIsMTYuODEyIEMzNy4zMTIsMTYuODEyIDQxLjQzNywxOC42ODcgNDQuMzc1LDIxLjY4NyBMNjQuNjg4LDIxLjY4NyBMNjQuNjg4LDEzLjM3NCBMNjQuNjg4LDEzLjM3NSBaIE01OC45MzgsOC4xMjUgTDU4LjkzOCwxNS4wNjMgQzU4LjkzOCwxNi4xODggNTgsMTcuMDYzIDU2Ljg3NSwxNy4wNjMgTDUwLjA2MiwxNy4wNjMgQzQ4Ljk5OSwxNy4wNjMgNDguMDYyLDE2LjE4OCA0OC4wNjIsMTUuMDYzIEw0OC4wNjIsOC4xMjUgQzQ4LjA2Miw3IDQ5LDYuMDYyIDUwLjA2Miw2LjA2MiBMNTYuODc1LDYuMDYyIEM1OCw2LjA2MiA1OC45MzgsNyA1OC45MzgsOC4xMjUgTDU4LjkzOCw4LjEyNSBaIE0yMC4yNSwzMy4xMjUgQzIwLjI1LDQwIDI1Ljg3NSw0NS42MjUgMzIuODEzLDQ1LjYyNSBDMzkuNjg4LDQ1LjYyNSA0NS4zMTMsNDAgNDUuMzEzLDMzLjEyNSBDNDUuMzEzLDI5LjM3NSA0My42ODgsMjYgNDEuMDYzLDIzLjY4NyBDNDAuMTI1LDIyLjg3NCAzOS4xMjUsMjIuMTg3IDM4LDIxLjY4NyBDMzYuMzc1LDIwLjkzNyAzNC42MjUsMjAuNTYyIDMyLjgxMiwyMC41NjIgQzMwLjkzNywyMC41NjIgMjkuMTg3LDIwLjkzNyAyNy42MjQsMjEuNjg3IEMyNi40OTksMjIuMTg3IDI1LjQzNiwyMi44NzUgMjQuNDk5LDIzLjY4NyBDMjEuODc0LDI2IDIwLjI0OSwyOS4zNzUgMjAuMjQ5LDMzLjEyNSBMMjAuMjUsMzMuMTI1IFogTTIzLjU2MywzMy4xMjUgQzIzLjU2MywyOCAyNy42ODgsMjMuODEyIDMyLjgxMywyMy44MTIgQzM3LjkzOCwyMy44MTIgNDIuMTI2LDI4IDQyLjEyNiwzMy4xMjUgQzQyLjEyNiwzOC4yNSAzNy45MzgsNDIuMzc1IDMyLjgxMyw0Mi4zNzUgQzI3LjY4OCw0Mi4zNzUgMjMuNTYzLDM4LjI1IDIzLjU2MywzMy4xMjUgTDIzLjU2MywzMy4xMjUgWiIgaWQ9IlNoYXBlIiBza2V0Y2g6dHlwZT0iTVNTaGFwZUdyb3VwIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4="); } .auth0-lock-social-button[data-provider^=linkedin] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjY3cHgiIGhlaWdodD0iNjRweCIgdmlld0JveD0iMCAwIDY3IDY0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+bGlua2VkaW48L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz48L2RlZnM+CiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiBza2V0Y2g6dHlwZT0iTVNQYWdlIj4KICAgICAgICA8ZyBpZD0ibGlua2VkaW4iIHNrZXRjaDp0eXBlPSJNU0xheWVyR3JvdXAiIGZpbGw9IiNGRkZGRkYiPgogICAgICAgICAgICA8cGF0aCBkPSJNMC42ODcsNy4zNzUgQzAuNjg3LDkuNSAxLjM3NSwxMS4yNSAyLjg3NSwxMi42ODggQzQuMzEzLDE0LjA2MyA2LjE4OCwxNC44MTMgOC41NjMsMTQuODEzIEw4LjYyNiwxNC44MTMgQzExLjA2NCwxNC44MTMgMTMuMDAxLDE0LjA2MyAxNC41MDEsMTIuNjg4IEMxNS45MzksMTEuMzEzIDE2LjY4OSw5LjYyNSAxNi42ODksNy41NjMgQzE2LjY4OSw1LjMxMyAxNS45MzksMy40MzggMTQuNDM5LDIuMDYzIEMxMy4wMDEsMC42ODggMTEuMDY0LDguODgxNzg0MmUtMTYgOC43NTEsOC44ODE3ODQyZS0xNiBDNi4zNzYsOC44ODE3ODQyZS0xNiA0LjQzOCwwLjY4OCAyLjkzOCwyLjA2MyBDMS40MzgsMy41MDEgMC42ODgsNS4yNTEgMC42ODgsNy4zNzYgTDAuNjg3LDcuMzc1IFogTTEuNSw2My4zNzUgTDE1Ljc1LDYzLjM3NSBMMTUuNzUsMjAuNjI1IEwxLjUsMjAuNjI1IEwxLjUsNjMuMzc1IEwxLjUsNjMuMzc1IFogTTIzLjU2Myw2My4zNzUgQzIzLjY4OCw1MC41IDIzLjc1MSw0MC41IDIzLjc1MSwzMy4zNzUgQzIzLjc1MSwyNi4yNSAyMy42ODgsMjIgMjMuNTYzLDIwLjYyNSBMMzcuODEzLDIwLjYyNSBMMzcuODEzLDI2LjY4OCBMMzcuNzUsMjYuODEzIEwzNy44MTMsMjYuODEzIEwzNy44MTMsMjYuNjg4IEM0MC44NzYsMjEuOTM4IDQ1LjE4OCwxOS41NjMgNTAuNjg4LDE5LjU2MyBDNTUuNTYzLDE5LjU2MyA1OS41MDEsMjEuMjUxIDYyLjUwMSwyNC41MDEgQzY1LjUwMSwyNy43NTEgNjcuMDAxLDMyLjU2NCA2Ny4wMDEsMzguODc2IEw2Ny4wMDEsNjMuMzc2IEw1Mi43NTEsNjMuMzc2IEw1Mi43NTEsNDAuNTAxIEM1Mi43NTEsMzQuMDYzIDUwLjM3NiwzMC44NzYgNDUuNjI2LDMwLjg3NiBDNDMuNzUxLDMwLjg3NiA0Mi4yNTEsMzEuMzc2IDQxLjA2MywzMi4zNzYgQzM5LjgxMywzMy4zNzYgMzguOTM4LDM0LjU2NCAzOC4zMTMsMzYuMDY0IEMzOCwzNi44NzcgMzcuODEzLDM4LjAwMiAzNy44MTMsMzkuNTAyIEwzNy44MTMsNjMuMzc3IEwyMy41NjMsNjMuMzc3IEwyMy41NjMsNjMuMzc1IFoiIGlkPSJTaGFwZSIgc2tldGNoOnR5cGU9Ik1TU2hhcGVHcm91cCI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"); } .auth0-lock-social-button[data-provider^=miicard] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjkxcHgiIGhlaWdodD0iNjFweCIgdmlld0JveD0iMCAwIDkxIDYxIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+bWlpY2FyZDwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHNrZXRjaDp0eXBlPSJNU1BhZ2UiPgogICAgICAgIDxnIGlkPSJtaWljYXJkIiBza2V0Y2g6dHlwZT0iTVNMYXllckdyb3VwIiBmaWxsPSIjRkZGRkZGIj4KICAgICAgICAgICAgPHBhdGggZD0iTTQxLjUsNS42ODggQzY0LjE4OCwyLjU2MyA3NywwLjg3NSA3Ny42MjUsMC44NzUgQzc5LjQzOCwwLjg3NSA4MC44NzUsMS4zMTMgODIuNDM4LDIuMzc1IEM4My44MTMsMy4zNzUgODUuMDAxLDUuMTg4IDg1LjM3Niw2LjgxMyBDODUuNjg5LDguMzc2IDkwLjMxNCw0Mi41NjMgOTAuMzE0LDQzLjUwMSBDOTAuMzE0LDQ3LjE4OSA4Ny40MzksNTAuNTY0IDgzLjgxNCw1MS4xMjYgQzgwLjgxNCw1MS42MjYgMTMuMTg5LDYwLjc1MSAxMi41NjQsNjAuNzUxIEM5LjE4OSw2MC43NTEgNi4zMTQsNTguNjI2IDUuMTg5LDU1LjM3NiBDNS4wMDEsNTQuOTM4IDQuMTI2LDQ4LjYyNiAyLjUwMSwzNi44MTMgQzAuMjUxLDIwLjU2MyAwLjA2MywxOC43NSAwLjA2MywxNy43NSBDMC4xMjYsMTYuNSAwLjQzOCwxNS41NjIgMC45MzgsMTQuNSBDMS45MzgsMTIuNjg3IDMuNzUxLDExLjE4NyA1LjY4OCwxMC42ODcgQzYuMDYzLDEwLjU2MiAyMi4xODgsOC4zMTIgNDEuNTAxLDUuNjg3IEw0MS41LDUuNjg4IFogTTYyLjU2Myw4LjE4OCBDNjEuMzEzLDcuODEzIDYwLjEyNSw4LjA2MyA1OS4xODgsOS4wMDEgQzU4LjMxMyw5Ljg3NiA1OC4wNjMsMTEuMDAxIDU4LjQzOCwxMi4zMTQgQzU4LjY4OCwxMy4xODkgNTkuNTYzLDE0LjA2NCA2MC4zNzYsMTQuMjUyIEM2MS42ODksMTQuNjI3IDYzLjAwMSwxNC4zMTUgNjMuODc2LDEzLjM3NyBDNjUuMzE0LDExLjY4OSA2NC42MjYsOC44NzcgNjIuNTYzLDguMTg5IEw2Mi41NjMsOC4xODggWiBNNzguNjI1LDguMTg4IEM3Ny4zMTIsNy44MTMgNzYuMTI1LDguMDYzIDc1LjI1LDkuMDAxIEM3NC4zMTIsOS44NzYgNzQuMDYyLDExLjAwMSA3NC40MzcsMTIuMzE0IEM3NC42ODcsMTMuMTg5IDc1LjU2MiwxNC4wNjQgNzYuMzc1LDE0LjI1MiBDNzcuNzUsMTQuNjI3IDc5LjA2MywxNC4zMTUgNzkuODc1LDEzLjM3NyBDODEuMzc1LDExLjY4OSA4MC42ODgsOC44NzcgNzguNjI1LDguMTg5IEw3OC42MjUsOC4xODggWiBNMjQuMzEzLDE4LjU2MyBDMjMuOTM4LDE4LjQzOCAyMy4wNjMsMTguMzEzIDIyLjI1LDE4LjMxMyBDMTguNTYyLDE4LjE4OCAxNS42ODcsMTkuNjg4IDEzLjU2MiwyMi45MzggQzEzLjM3NCwyMy4yNTEgMTMuMzc0LDIzLjE4OCAxMy4xODcsMjAuMDYzIEwxMy4xMjQsMTguODEzIEwxMC44MTEsMTguODEzIEM4LjgxMSwxOC44NzYgOC40OTgsMTguODc2IDguNTYxLDE5LjA2MyBDOC42MjQsMTkuMTI2IDguNjI0LDI1LjM3NiA4LjY4NiwzMi44NzYgTDguNzQ5LDQ2LjUwMSBMMTMuODc0LDQ2LjUwMSBMMTMuOTk5LDI4LjA2MyBMMTQuMjQ5LDI3LjQzOCBDMTQuODEyLDI2LjA2MyAxNS4zNzQsMjUuMjUgMTYuMTI0LDI0LjQzOCBDMTguMDYyLDIyLjUgMjAuNjI0LDIyLjA2MyAyMi44MTIsMjMuMTg4IEMyNC4xMjUsMjMuODEzIDI1LjEyNSwyNS4yNTEgMjUuNjg3LDI3LjA2MyBDMjUuODc1LDI3LjkzOCAyNS44NzUsMjguMTI2IDI1LjkzNywzNy4yNTEgTDI2LDQ2LjU2NCBMMzEuMDYzLDQ2LjU2NCBMMzEuMTI2LDM3LjI1MSBDMzEuMTI2LDI4LjAwMSAzMS4xMjYsMjguMDAxIDMxLjM3NiwyNy4yNTEgQzMxLjg3NiwyNS43NTEgMzMuMDY0LDI0LjI1MSAzNC4yNTEsMjMuNTAxIEMzNS40MzksMjIuNjg4IDM3LjEyNiwyMi40MzggMzguNTAxLDIyLjY4OCBDNDAuNjI2LDIzLjEyNiA0Mi4wNjQsMjQuNjI2IDQyLjgxNCwyNy4zMTMgQzQzLjA2NCwyOC4xODggNDMuMDY0LDI4LjMxMyA0My4xMjcsMzcuMzc2IEw0My4xOSw0Ni41MDEgTDQ4LjMxNSw0Ni41MDEgTDQ4LjMxNSwzNy41NjMgQzQ4LjMxNSwyOC4xODggNDguMjUyLDI3LjY4OCA0Ny43NTIsMjUuNjg4IEM0Ni44MTQsMjEuODc1IDQ0LjYyNywxOS40MzggNDEuMzE0LDE4LjUgQzQwLjI1MSwxOC4yNSAzNy41NjQsMTguMjUgMzYuNTAxLDE4LjUgQzM1LjQzOCwxOC44MTMgMzQuMjUxLDE5LjMxMyAzMy4zMTMsMTkuOTM4IEMzMi4zNzUsMjAuNjI2IDMwLjkzOCwyMi4xMjYgMzAuMzEzLDIzLjAwMSBMMjkuODc1LDIzLjY4OSBMMjkuNSwyMi44NzYgQzI4LjQzNywyMC42ODggMjYuNSwxOS4xMjYgMjQuMzEyLDE4LjU2MyBMMjQuMzEzLDE4LjU2MyBaIE02NC4xMjUsMzIuNjg4IEw2NC4xMjUsMTguODc1IEw2MS41LDE4LjgxMiBDNTkuNSwxOC44MTIgNTguOTM3LDE4LjgxMiA1OC44NzUsMTguOTM3IEM1OC44MTMsMTkuMDYyIDU4LjgxMiwyNS4yNSA1OC44MTIsMzIuODEyIEw1OC44NzUsNDYuNSBMNjQuMTI1LDQ2LjUgTDY0LjEyNSwzMi42ODcgTDY0LjEyNSwzMi42ODggWiBNODAuMTI1LDMyLjY4OCBMODAuMTI1LDE4Ljg3NSBMNzcuNTYyLDE4LjgxMiBDNzUuNDk5LDE4LjgxMiA3NC45MzcsMTguODEyIDc0Ljg3NCwxOC45MzcgTDc0Ljg3NCw0Ni41IEw4MC4xMjQsNDYuNSBMODAuMTI0LDMyLjY4NyBMODAuMTI1LDMyLjY4OCBaIiBpZD0iU2hhcGUiIHNrZXRjaDp0eXBlPSJNU1NoYXBlR3JvdXAiPjwvcGF0aD4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg=="); } .auth0-lock-social-button[data-provider^=oauth2] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxOC4xLjEsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAxNTAuMSAxNjcuOCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMTUwLjEgMTY3LjgiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGc+DQoJPHBvbHlnb24gZmlsbD0iI0ZGRkZGRiIgcG9pbnRzPSIzMSwxMzUuOCAzMC45LDEzNS44IDc1LjEsMTY3LjggMTE5LjIsMTM1LjggNzUuMSwxMDMuNyAJIi8+DQoJPHBhdGggZmlsbD0iI0ZGRkZGRiIgZD0iTTMuNyw1MS45TDMuNyw1MS45Qy02LjYsODMuNiw1LjMsMTE3LjIsMzEsMTM1LjhsMCwwbDE2LjktNTEuOUwzLjcsNTEuOWw1NC41LDBMNzUuMSwwbDAsMEgyMC41TDMuNyw1MS45eg0KCQkiLz4NCgk8cGF0aCBmaWxsPSIjRkZGRkZGIiBkPSJNMTQ2LjUsNTEuOUwxNDYuNSw1MS45TDE0Ni41LDUxLjlMMTI5LjYsMEg3NS4xbDAsMGwxNi45LDUxLjlMMTQ2LjUsNTEuOWwtNDQuMSwzMi4xbDE2LjgsNTEuOQ0KCQlDMTQ2LjIsMTE2LjIsMTU2LjMsODIsMTQ2LjUsNTEuOXoiLz4NCjwvZz4NCjwvc3ZnPg0K"); } .auth0-lock-social-button[data-provider^=paypal] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjYzcHgiIGhlaWdodD0iNjVweCIgdmlld0JveD0iMCAwIDYzIDY1IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+cGF5cGFsPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc2tldGNoOnR5cGU9Ik1TUGFnZSI+CiAgICAgICAgPGcgaWQ9InBheXBhbCIgc2tldGNoOnR5cGU9Ik1TTGF5ZXJHcm91cCIgZmlsbD0iI0ZGRkZGRiI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0wLDU3LjY4OCBMMTYuNDM4LDU3LjY4OCBMMjAuNTAxLDM4Ljc1IEwzMi4xODksMzguNzUgQzM3LjkzOSwzOC43NSA0Mi44NzcsMzcuMTI1IDQ3LjEyNywzMy43NSBDNTEuMzc3LDMwLjQzNyA1NC4xMjcsMjUuODc1IDU1LjM3NywyMC4wNjIgQzU2LjAwMiwxNi43NDkgNTYuMDAyLDEzLjg3NCA1NS4zNzcsMTEuNDM3IEM1NC43NTIsOSA1My42MjcsNi45OTkgNTIuMDY0LDUuMzc0IEM1MC40MzksMy44MTEgNDguNjI2LDIuNjI0IDQ2LjYyNiwxLjgxMSBDNDQuNjI2LDEuMDYxIDQyLjU2MywwLjY4NiA0MC40MzgsMC42ODYgTDEyLjQzOCwwLjY4NiBMMCw1Ny42ODggWiBNNi4zNzUsNjQuNjg4IEw3LjEyNSw2MS41NjMgTDIwLjkzOCw2MS41NjMgTDI0LjkzOCw0Mi42ODggTDM2LjY4OCw0Mi42ODggQzQyLjM3Niw0Mi42ODggNDcuMzc2LDQxIDUxLjYyNiwzNy42ODggQzU1Ljg3NiwzNC4zNzYgNTguNjI2LDI5LjgxMyA1OS44MTQsMjQgQzYwLjc1MiwxOS44NzUgNjAuNTAyLDE2LjI1IDU5LjA2NCwxMy4xMjUgQzYyLjEyNywxNi42ODggNjMuMDAyLDIxLjM3NSA2MS44MTQsMjcuMTI1IEM2MC41NjQsMzIuOTM4IDU3LjgxNCwzNy41IDUzLjU2NCw0MC44MTMgQzQ5LjM3Niw0NC4xMjYgNDQuMzc2LDQ1LjgxMyAzOC42MjYsNDUuODEzIEwyNi44NzYsNDUuODEzIEwyMi44NzYsNjQuNjg4IEw2LjM3Niw2NC42ODggTDYuMzc1LDY0LjY4OCBaIE0yMi44NzUsMjcuODc1IEwyNi4zNzUsMTIuMjUgTDM0LjM3NSwxMi4yNSBDMzUuNzUsMTIuMjUgMzYuOTM4LDEyLjYyNSAzNy45MzgsMTMuMzc1IEMzOC45MzgsMTQuMTI1IDM5LjYyNiwxNS4xMjUgMzkuOTM4LDE2LjM3NSBDMzkuMzEzLDE2LjI1IDM4LjkzOCwxNi4xODcgMzguODc1LDE2LjE4NyBMMzAuODc1LDE2LjE4NyBMMjguMTg3LDI3Ljg3NSBMMjIuODc0LDI3Ljg3NSBMMjIuODc1LDI3Ljg3NSBaIE0zMC44NzUsMjcuODEzIEwzMi43NSwxOS4zMTMgTDQwLjA2MywxOS4zMTMgQzQwLjA2MywxOS4zNzYgNDAuMDYzLDE5LjUwMSA0MCwxOS42ODggQzM5LjkzNywxOS44NzUgMzkuOTM3LDIwLjAwMSAzOS45MzcsMjAuMDYzIEMzOS40MzcsMjIuMTg4IDM4LjM3NCwyMy45MzggMzYuNTYyLDI1LjQzOCBDMzQuODEyLDI2LjkzOCAzMi44NzQsMjcuNzUxIDMwLjg3NCwyNy44MTMgTDMwLjg3NSwyNy44MTMgWiIgaWQ9IlNoYXBlIiBza2V0Y2g6dHlwZT0iTVNTaGFwZUdyb3VwIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4="); } .auth0-lock-social-button[data-provider^=paypal-sandbox] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjYzcHgiIGhlaWdodD0iNjVweCIgdmlld0JveD0iMCAwIDYzIDY1IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+cGF5cGFsPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc2tldGNoOnR5cGU9Ik1TUGFnZSI+CiAgICAgICAgPGcgaWQ9InBheXBhbCIgc2tldGNoOnR5cGU9Ik1TTGF5ZXJHcm91cCIgZmlsbD0iI0ZGRkZGRiI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0wLDU3LjY4OCBMMTYuNDM4LDU3LjY4OCBMMjAuNTAxLDM4Ljc1IEwzMi4xODksMzguNzUgQzM3LjkzOSwzOC43NSA0Mi44NzcsMzcuMTI1IDQ3LjEyNywzMy43NSBDNTEuMzc3LDMwLjQzNyA1NC4xMjcsMjUuODc1IDU1LjM3NywyMC4wNjIgQzU2LjAwMiwxNi43NDkgNTYuMDAyLDEzLjg3NCA1NS4zNzcsMTEuNDM3IEM1NC43NTIsOSA1My42MjcsNi45OTkgNTIuMDY0LDUuMzc0IEM1MC40MzksMy44MTEgNDguNjI2LDIuNjI0IDQ2LjYyNiwxLjgxMSBDNDQuNjI2LDEuMDYxIDQyLjU2MywwLjY4NiA0MC40MzgsMC42ODYgTDEyLjQzOCwwLjY4NiBMMCw1Ny42ODggWiBNNi4zNzUsNjQuNjg4IEw3LjEyNSw2MS41NjMgTDIwLjkzOCw2MS41NjMgTDI0LjkzOCw0Mi42ODggTDM2LjY4OCw0Mi42ODggQzQyLjM3Niw0Mi42ODggNDcuMzc2LDQxIDUxLjYyNiwzNy42ODggQzU1Ljg3NiwzNC4zNzYgNTguNjI2LDI5LjgxMyA1OS44MTQsMjQgQzYwLjc1MiwxOS44NzUgNjAuNTAyLDE2LjI1IDU5LjA2NCwxMy4xMjUgQzYyLjEyNywxNi42ODggNjMuMDAyLDIxLjM3NSA2MS44MTQsMjcuMTI1IEM2MC41NjQsMzIuOTM4IDU3LjgxNCwzNy41IDUzLjU2NCw0MC44MTMgQzQ5LjM3Niw0NC4xMjYgNDQuMzc2LDQ1LjgxMyAzOC42MjYsNDUuODEzIEwyNi44NzYsNDUuODEzIEwyMi44NzYsNjQuNjg4IEw2LjM3Niw2NC42ODggTDYuMzc1LDY0LjY4OCBaIE0yMi44NzUsMjcuODc1IEwyNi4zNzUsMTIuMjUgTDM0LjM3NSwxMi4yNSBDMzUuNzUsMTIuMjUgMzYuOTM4LDEyLjYyNSAzNy45MzgsMTMuMzc1IEMzOC45MzgsMTQuMTI1IDM5LjYyNiwxNS4xMjUgMzkuOTM4LDE2LjM3NSBDMzkuMzEzLDE2LjI1IDM4LjkzOCwxNi4xODcgMzguODc1LDE2LjE4NyBMMzAuODc1LDE2LjE4NyBMMjguMTg3LDI3Ljg3NSBMMjIuODc0LDI3Ljg3NSBMMjIuODc1LDI3Ljg3NSBaIE0zMC44NzUsMjcuODEzIEwzMi43NSwxOS4zMTMgTDQwLjA2MywxOS4zMTMgQzQwLjA2MywxOS4zNzYgNDAuMDYzLDE5LjUwMSA0MCwxOS42ODggQzM5LjkzNywxOS44NzUgMzkuOTM3LDIwLjAwMSAzOS45MzcsMjAuMDYzIEMzOS40MzcsMjIuMTg4IDM4LjM3NCwyMy45MzggMzYuNTYyLDI1LjQzOCBDMzQuODEyLDI2LjkzOCAzMi44NzQsMjcuNzUxIDMwLjg3NCwyNy44MTMgTDMwLjg3NSwyNy44MTMgWiIgaWQ9IlNoYXBlIiBza2V0Y2g6dHlwZT0iTVNTaGFwZUdyb3VwIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4="); } .auth0-lock-social-button[data-provider^=planningcenter] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjYzcHgiIGhlaWdodD0iNjNweCIgdmlld0JveD0iMCAwIDYzIDYzIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+cGxhbm5pbmdjZW50ZXI8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz48L2RlZnM+CiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiBza2V0Y2g6dHlwZT0iTVNQYWdlIj4KICAgICAgICA8ZyBpZD0icGxhbm5pbmdjZW50ZXIiIHNrZXRjaDp0eXBlPSJNU0xheWVyR3JvdXAiIGZpbGw9IiNGRkZGRkYiPgogICAgICAgICAgICA8cGF0aCBkPSJNNC4zMTMsNjEuNSBMNi4zMTMsNjIuNDM4IEwzMS40MzgsNjIuNDM4IEM1OC43NTEsNjIuNDM4IDU4LjMxMyw2Mi41MDEgNjAuNjg4LDU5LjkzOCBDNjEuMzc2LDU5LjE4OCA2Mi4xMjYsNTcuODEzIDYyLjM3Niw1Ni44MTMgQzYyLjY4OSw1NS42MjUgNjIuODc2LDQ3IDYyLjg3NiwzMS41NjMgQzYyLjg3NiwxMi4yNSA2Mi43NTEsNy43NSA2Mi4xODgsNS44NzUgQzYxLjU2MywzLjYyNSA2MCwxLjgxMiA1OC4wNjMsMC43NSBDNTcuMzc1LDAuMzc1IDQ5LjUsMC4yNSAzMS41NjMsMC4yNSBDNC4xODgsMC4yNSA0Ljg3NSwwLjE4NyAyLjYyNSwyLjYyNSBDMC4xODcsNS4xODggMC4xODcsNS4xMjUgMC4xODcsMzEuNzUgTDAuMTg3LDU2LjM3NSBMMS4yNSw1OC4zNzUgQzIsNTkuODc1IDIuODEzLDYwLjY4OCA0LjMxMyw2MS41IEw0LjMxMyw2MS41IFogTTIwLDU0LjEyNSBDMTkuNzUsNTUuMTg4IDE5LjY4Nyw1NS4xODggMTMuODc1LDU1LjE4OCBDMTAuNjg3LDU1LjE4OCA3LjkzNyw1NS4wNjMgNy44MTIsNTQuODc1IEM3LjYyNCw1NC43NSA3LjQ5OSw0NC4xODcgNy40OTksMzEuNSBMNy40OTksOC40MzcgTDU1LjE4Nyw4LjQzNyBMNTUuMTg3LDU1LjE4NyBMNDMuNDM3LDU1LjE4NyBMNDIuNTYyLDUzLjQ5OSBDNDEuNDM3LDUxLjI0OSA0MC4zNzQsNTAuOTk5IDMwLjM3NCw1MS4xODYgQzIxLjQzNiw1MS4zMTEgMjAuNjI0LDUxLjU2MSAxOS45OTksNTQuMTI0IEwyMCw1NC4xMjUgWiBNMjkuMzc1LDQ1LjM3NSBDMzAuNjI1LDQ2LjI1IDMxLjY4OCw0Ni4zMTMgMzMuMDYzLDQ1LjYyNSBDMzQuNjI2LDQ0LjgxMiAzNC43NTEsNDQuMzc1IDM0Ljc1MSwzOS44NzUgQzM0Ljc1MSwzNy41NjIgMzQuOTM5LDM1LjY4NyAzNS4xMjYsMzUuNjg3IEMzNS4zNzYsMzUuNjg3IDM3LjE4OSwzNi41NjIgMzkuMjUxLDM3LjY4NyBDNDEuMjUxLDM4Ljg3NSA0My40MzksMzkuNzUgNDMuOTM5LDM5Ljc1IEM0NS42MjcsMzkuNzUgNDcuNTY0LDM3LjQzNyA0Ny4zNzcsMzUuNjg3IEM0Ny4yNTIsMzQuMjQ5IDQ2Ljg3NywzMy45OTkgNDMuMDAyLDMxLjg3NCBDMzguMTg5LDI5LjI0OSAzOC4xMjcsMjkuNjI0IDQzLjgxNSwyNi40MzYgQzQ2LjYyOCwyNC45MzYgNDcuMjUzLDI0LjMxMSA0Ny4zNzgsMjMuMzExIEM0Ny41NjYsMjEuODExIDQ1LjM3OCwxOC44NzMgNDQuMTI4LDE4Ljg3MyBDNDMuNjksMTguODczIDQxLjM3OCwxOS45MzYgMzkuMDAzLDIxLjE4NiBMMzQuNzUzLDIzLjQ5OSBMMzQuNzUzLDE5LjI0OSBDMzQuNzUzLDEzLjgxMSAzNC40NCwxMy4zMTEgMzEuMTI4LDEzLjQ5OSBMMjguNjI4LDEzLjYyNCBMMjguMzc4LDE4LjQ5OSBMMjguMTI4LDIzLjQzNyBMMjQuMzc4LDIxLjEyNCBDMTkuNTAzLDE4LjI0OSAxOC41MDMsMTguMTg2IDE2LjY5LDIwLjk5OSBDMTUuMDAyLDIzLjQ5OSAxNS4xOSwyMy45OTkgMTguNTAzLDI1Ljg3NCBDMTkuODE2LDI2LjU2MiAyMS42MjgsMjcuNjI0IDIyLjYyOCwyOC4yNDkgTDI0LjM3OCwyOS4zNzQgTDIwLjMxNSwzMS44MTIgQzE4LjA2NSwzMy4xODcgMTYuMDAyLDM0LjU2MiAxNS43NTIsMzQuODc1IEMxNS4zMTQsMzUuMzc1IDE1LjUwMiwzNiAxNi41NjUsMzcuNjI1IEMxOC4zMTUsNDAuNDM4IDE5LjYyOCw0MC41IDI0LjEyOCwzNy42ODggQzI1Ljk0MSwzNi41NjMgMjcuNjkxLDM1LjY4OCAyNy45NDEsMzUuNjg4IEMyOC4xOTEsMzUuNjg4IDI4LjM3OSwzNy41NjMgMjguMzc5LDQwLjE4OCBDMjguMzc5LDQ0LjM3NiAyOC40NDIsNDQuNzUxIDI5LjM3OSw0NS4zNzYgTDI5LjM3NSw0NS4zNzUgWiIgaWQ9IlNoYXBlIiBza2V0Y2g6dHlwZT0iTVNTaGFwZUdyb3VwIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4="); } .auth0-lock-social-button[data-provider^=renren] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjYxcHgiIGhlaWdodD0iMzVweCIgdmlld0JveD0iMCAwIDYxIDM1IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+cmVucmVuPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc2tldGNoOnR5cGU9Ik1TUGFnZSI+CiAgICAgICAgPGcgaWQ9InJlbnJlbiIgc2tldGNoOnR5cGU9Ik1TTGF5ZXJHcm91cCIgZmlsbD0iI0ZGRkZGRiI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0yMC4zNzUsMC40MzggQzIwLjY4OCw3LjEyNiAxOS41LDEzLjAwMSAyMS43NSwxOC41MDEgQzIyLjYyNSwyMC41NjQgMjMuODEzLDIyLjU2NCAyNS4zMTMsMjQuMjUxIEMyOS42ODgsMjkuMjUxIDMyLjE4OCwyOC44NzYgMzYuNDM4LDIzLjU2MyBDNDEuODEzLDE2Ljc1IDQwLjAwMSw5IDQwLjMxMywwLjU2MyBDMzcuNDM4LDIuMTI2IDM0LjkzOCwzLjA2MyAzMi45MzgsNC42ODggQzMwLjkzOCw2LjI1MSAyOS44NzUsNi40MzggMjcuODc1LDQuNjI1IEMyNiwyLjkzNyAyMy4zNzUsMi4wNjIgMjAuMzc1LDAuNDM3IEwyMC4zNzUsMC40MzggWiBNNC4xMjUsMjguMTg4IEMxMy44NzUsMjMuMzEzIDE1LjI1LDEzLjEyNSAxMy42ODgsMS4zNzUgQzEuNjI1LDMuMTg4IC0zLjgxMiwxOC4xODggNC4xMjUsMjguMTg4IEw0LjEyNSwyOC4xODggWiBNNDcuMTg4LDEuMjUgQzQ3LjE4OCw1LjkzOCA0Ni43NSwxMC41NjMgNDcuMzEzLDE1IEM0Ny45MzgsMjAuMTI1IDUwLjYyNiwyNC4zNzUgNTUuMDYzLDI3LjM3NSBDNTYuNDM4LDI4LjMxMyA1Ny4xMjYsMjguMTI1IDU4LjA2MywyNi42ODcgQzY0LjE4OCwxNi44MTIgNTguODc2LDMuODc0IDQ3LjE4OCwxLjI0OSBMNDcuMTg4LDEuMjUgWiBNNDMuNjg4LDI0LjQzOCBDNDEuNjI1LDI3LjAwMSAzOS4yNSwyOS45MzggMzYuNzUsMzMuMDYzIEM0MS41LDM1LjE4OCA0Ni4xODgsMzUuMDYzIDUwLjc1LDMzLjA2MyBDNDguMjUsMzAuMDYzIDQ1Ljg3NSwyNy4xMjUgNDMuNjg3LDI0LjQzOCBMNDMuNjg4LDI0LjQzOCBaIE0yNC4xODgsMzMuMDYzIEMyMS42MjUsMjkuODc1IDE5LjMxMywyNy4wNjMgMTcuMjUsMjQuNSBDMTUuMDYyLDI3LjEyNSAxMi43NSwzMC4wNjMgMTAuMzEyLDMzLjA2MyBDMTUsMzUuMDYzIDE5LjY4NywzNS4xMjYgMjQuMTg3LDMzLjA2MyBMMjQuMTg4LDMzLjA2MyBaIiBpZD0iU2hhcGUiIHNrZXRjaDp0eXBlPSJNU1NoYXBlR3JvdXAiPjwvcGF0aD4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg=="); } .auth0-lock-social-button[data-provider^=salesforce] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjY0cHgiIGhlaWdodD0iNjVweCIgdmlld0JveD0iMCAwIDY0IDY1IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+c2FsZXNmb3JjZTwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHNrZXRjaDp0eXBlPSJNU1BhZ2UiPgogICAgICAgIDxnIGlkPSJzYWxlc2ZvcmNlIiBza2V0Y2g6dHlwZT0iTVNMYXllckdyb3VwIiBmaWxsPSIjRkZGRkZGIj4KICAgICAgICAgICAgPHBhdGggZD0iTTAsMTUuODc1IEMwLDE2LjEyNSAwLjA2MywxNi41IDAuMTI1LDE3IEwxMC42MjUsNjEgQzEwLjg3NSw2Mi4wNjMgMTEuNDM4LDYyLjkzOCAxMi4zMTMsNjMuNjI1IEMxMy4xODgsNjQuMjUgMTQuMTg4LDY0LjYyNSAxNS4yNTEsNjQuNjI1IEMxNS44NzYsNjQuNjI1IDE2LjU2NCw2NC41NjIgMTcuMjUxLDY0LjM3NSBDMTguMDAxLDY0LjI1IDE4LjgxNCw2NC4wNjIgMTkuNzUxLDYzLjc1IEMyMC42ODksNjMuNSAyMS4zMTQsNjMuMzEyIDIxLjc1MSw2My4xODcgQzE4LjAwMSw2MS45MzcgMTQuOTM4LDYwLjYyNCAxMi41NjMsNTkuMzEyIEwxNy42MjYsNDcuODc0IEMxOS4zNzYsNDkuNDk5IDIxLjYyNiw1MC43NDkgMjQuMzE0LDUxLjc0OSBDMjcuMDAyLDUyLjY4NyAyOS41NjQsNTMuMTg3IDMyLjA2NCw1My4xODcgQzM0LjAwMiw1My4xODcgMzUuNjg5LDUyLjYyNCAzNy4xODksNTEuNjI0IEMzOC42ODksNTAuNjI0IDM5LjQzOSw0OS4xODYgMzkuNDM5LDQ3LjMxMSBDMzkuNDM5LDQ2LjEyMyAzOS4wNjQsNDQuOTM2IDM4LjMxNCw0My44MTEgQzM3LjU2NCw0Mi42ODYgMzYuNTY0LDQxLjY4NiAzNS4zNzYsNDAuODExIEMzNC4xMjYsMzkuOTM2IDMzLjAwMSwzOS4yNDggMzEuODc2LDM4LjY4NiBDMzAuNzUxLDM4LjA2MSAyOS42MjYsMzcuNTYxIDI4LjQzOCwzNy4xMjMgQzE3LjYyNSwzMi45MzUgMTIuMjUsMjYuODczIDEyLjI1LDE4Ljk5OCBDMTIuMjUsMTQuODczIDEzLjU2MywxMS4zMSAxNi4yNSw4LjI0OCBMMy42MjUsMTEuMjQ4IEMyLjU2MiwxMS40OTggMS42ODcsMTIuMDYxIDEsMTIuOTM2IEMwLjMxMywxMy44MTEgMCwxNC44MTEgMCwxNS44NzQgTDAsMTUuODc1IFogTTI2LjgxMywxOC44MTMgQzI2LjgxMywyMi4zMTMgMzAuNDM4LDI1LjMxMyAzNy43NTEsMjcuNzUxIEM0Mi42MjYsMjkuMzc2IDQ2LjU2NCwzMS42ODkgNDkuNTY0LDM0Ljc1MSBDNTIuNTY0LDM3LjgxMyA1NC4wNjQsNDEuNjg5IDU0LjA2NCw0Ni40MzkgQzU0LjA2NCw0OS45MzkgNTMuMDY0LDUzLjE4OSA1MS4wNjQsNTYuMTg5IEw2MC4zNzcsNTQuMDAxIEM2MS40NCw1My43NTEgNjIuMzE1LDUzLjE4OCA2My4wMDIsNTIuMzEzIEM2My42ODksNTEuNDM4IDY0LjAwMiw1MC40MzggNjQuMDAyLDQ5LjM3NSBDNjQuMDAyLDQ5LjEyNSA2My45MzksNDguNzUgNjMuODc3LDQ4LjI1IEw1My4zNzcsNC4yNSBDNTMuMTI3LDMuMTg3IDUyLjU2NCwyLjMxMiA1MS42ODksMS42MjUgQzUwLjgxNCwwLjkzOCA0OS44MTQsMC42MjUgNDguNzUxLDAuNjI1IEM0OC4xODgsMC42MjUgNDcuMjUxLDAuNzUgNDYuMDYzLDEgQzQ0LjgxMywxLjI1IDQzLjMxMywxLjYyNSA0MS41LDIuMTg4IEMzOS42MjUsMi42ODggMzguNjg3LDIuOTM4IDM4LjU2MiwyLjkzOCBDNDIuNjg3LDMuNTYzIDQ2LjYyNSw0LjkzOCA1MC41LDYuOTM4IEw0Ni41NjIsMTcuODEzIEM0NS40MzcsMTYuNjI1IDQzLjU2MiwxNS42MjUgNDAuOTM3LDE0Ljg3NSBDMzguMzc0LDE0LjEyNSAzNS45OTksMTMuNzUgMzMuOTM3LDEzLjc1IEMzMi4xODcsMTMuNzUgMzAuNTYyLDE0LjE4OCAyOS4wNjIsMTUuMDYzIEMyNy41NjIsMTUuOTM4IDI2LjgxMiwxNy4xODggMjYuODEyLDE4LjgxMyBMMjYuODEzLDE4LjgxMyBaIiBpZD0iU2hhcGUiIHNrZXRjaDp0eXBlPSJNU1NoYXBlR3JvdXAiPjwvcGF0aD4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg=="); } .auth0-lock-social-button[data-provider^=shopify] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjU1cHgiIGhlaWdodD0iNjNweCIgdmlld0JveD0iMCAwIDU1IDYzIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+c2hvcGlmeTwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHNrZXRjaDp0eXBlPSJNU1BhZ2UiPgogICAgICAgIDxnIGlkPSJzaG9waWZ5IiBza2V0Y2g6dHlwZT0iTVNMYXllckdyb3VwIiBmaWxsPSIjRkZGRkZGIj4KICAgICAgICAgICAgPHBhdGggZD0iTTIxLjEyNSwxLjY4OCBDMjQuMTI1LDAuMTg4IDI1LjgxMywwLjEyNSAyNy4zNzUsMS4zNzUgQzI4LDEuODc1IDI5LjE4OCwyLjQzOCAzMC4wNjMsMi41NjMgQzMxLjc1MSwyLjkzOCAzNC4yNTEsNS40MzggMzQuODEzLDcuMTg4IEMzNS4xMjYsOC4xMjYgMzUuMzc2LDguMjUxIDM2LjY4OCw4LjAwMSBDMzcuOTM4LDcuNzUxIDM4LjQzOCw3LjkzOCA0MC4xMjYsOS42MjYgQzQxLjg3NiwxMS4zNzYgNDIuNTAxLDExLjY4OSA0NC45MzksMTEuODc2IEM0Ny4xODksMTIuMTI2IDQ3LjY4OSwxMi4zMTQgNDcuODc3LDEzLjE4OSBDNDguMDAyLDEzLjgxNCA0OC44NzcsMTkuNDM5IDQ5LjgxNSwyNS44MTQgQzUwLjc1MywzMi4xODkgNTIuMTksNDEuNzUyIDUyLjk0LDQ3LjEyNyBDNTMuNzUzLDUyLjQ0IDU0LjM3OCw1Ny4xMjcgNTQuMzc4LDU3LjU2NSBDNTQuMzc4LDU4LjEyOCA1Mi4zMTUsNTguNzUzIDQ1LjAwMyw2MC4zMTUgTDM1LjU2NSw2Mi4zNzggTDE4LjMxNSw1OS4xMjggQzguNzUyLDU3LjM3OCAwLjgxNSw1NS43NTMgMC42MjcsNTUuNTY1IEMwLjM3Nyw1NS4zNzcgMC43NTIsNTEuMDAyIDEuNDQsNDUuODE1IEMyLjEyOCw0MC42OSAzLjEyOCwzMy4wMDIgMy42MjgsMjguNzUyIEM1LjEyOCwxNi43NTIgNC41NjYsMTguMDY0IDguNjkxLDE2LjgxNCBMMTIuMTI5LDE1LjY4OSBMMTMuNTA0LDEyLjAwMSBDMTUuMzE3LDYuODc2IDE3Ljk0MiwzLjMxMyAyMS4xMjksMS42ODggTDIxLjEyNSwxLjY4OCBaIE0yNC4xODgsNC40MzggTDI1LjkzOCwyLjg3NSBMMjQuNTYzLDIuODc1IEMyMi4xODgsMi44NzUgMTkuMzc1LDUuMDYzIDE3LjMxMyw4LjY4OCBDMTYuMTg4LDEwLjYyNiAxNS4wNjMsMTMuOTM4IDE1LjM3NSwxNC4yNTEgQzE1LjU2MywxNC40MzkgMTYuNSwxNC4yNTEgMTcuNjI1LDE0LjAwMSBDMTkuMzc1LDEzLjU2MyAxOS42MjUsMTMuMjUxIDIwLjEyNSwxMS40MzggQzIwLjkzOCw4LjMxMyAyMi4yNSw2LjA2MyAyNC4xODgsNC40MzggTDI0LjE4OCw0LjQzOCBaIE0yOC4zNzUsMjIuNTYzIEMyOC4xMjUsMjIuMzEzIDI2LjUsMjIgMjQuODEyLDIxLjkzOCBDMTcuMzEyLDIxLjUgMTEuOTM3LDI2LjAwMSAxMS44NzQsMzIuODEzIEMxMS44NzQsMzUuOTM4IDEyLjgxMiwzNy44NzYgMTUuNDk5LDM5Ljg3NiBDMjEuMzEyLDQ0LjUwMSAxNy42ODcsNDkuMDY0IDExLjQ5OSw0NS4wMDEgQzEwLjEyNCw0NC4xMjYgMTAuMTI0LDQ0LjE4OCA5LjI0OSw0Ny4wMDEgQzguNTYxLDQ5LjI1MSA4LjU2MSw0OS4yNTEgOS45OTksNTAuNTAxIEMxMC44MTIsNTEuMTg5IDEyLjYyNCw1Mi4wMDEgMTQuMTI0LDUyLjQzOSBDMjAuNDM3LDU0LjMxNCAyNS41NjIsNTEuMDAxIDI2LjI0OSw0NC42MjYgQzI2LjY4Nyw0MC43NTEgMjUuMTI0LDM3LjkzOCAyMC43NDksMzQuNzUxIEMxOC42MjQsMzMuMTg4IDE4LjEyNCwzMi41NjMgMTguMTI0LDMxLjM3NiBDMTguMTI0LDI5LjMxMyAxOS45MzcsMjguMzEzIDIyLjg3NCwyOC42MjYgQzI0LjEyNCwyOC43NTEgMjUuNDk5LDI5LjAwMSAyNS44NzQsMjkuMTg5IEMyNi40MzcsMjkuMzc3IDI2Ljg3NCwyOC43NTEgMjcuNzQ5LDI2LjE4OSBDMjguMzEyLDI0LjMxNCAyOC41NjIsMjIuNzUxIDI4LjM3NCwyMi41NjQgTDI4LjM3NSwyMi41NjMgWiIgaWQ9IlNoYXBlIiBza2V0Y2g6dHlwZT0iTVNTaGFwZUdyb3VwIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4="); } .auth0-lock-social-button[data-provider^=soundcloud] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9Ijc0cHgiIGhlaWdodD0iMzZweCIgdmlld0JveD0iMCAwIDc0IDM2IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+c291bmRjbG91ZDwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHNrZXRjaDp0eXBlPSJNU1BhZ2UiPgogICAgICAgIDxnIGlkPSJzb3VuZGNsb3VkIiBza2V0Y2g6dHlwZT0iTVNMYXllckdyb3VwIiBmaWxsPSIjRkZGRkZGIj4KICAgICAgICAgICAgPHBhdGggZD0iTTAsMjYuMjUgQzAsMjkuMTI1IDAuMjUsMzAuNjg4IDAuODEzLDMxIEMxLjA2MywzMC44NzUgMS4zMTMsMzAuMTg3IDEuNTAxLDI5IEMxLjY4OSwyNy43NSAxLjgxNCwyNi44NzUgMS44MTQsMjYuMjUgQzEuODE0LDI1LjY4NyAxLjY4OSwyNC44MTIgMS41MDEsMjMuNTYyIEMxLjMxMywyMi4zMTIgMS4wNjMsMjEuNjI0IDAuODEzLDIxLjQzNyBDMC41NjMsMjEuNjI1IDAuMzc1LDIyLjI1IDAuMjUsMjMuNDM3IEMwLjA2MiwyNC42MjUgMCwyNS41NjIgMCwyNi4yNSBMMCwyNi4yNSBaIE00LjEyNSwyNi4yNSBDNC4xMjUsMjcuMzEzIDQuMTg4LDI4LjgxMyA0LjQzOCwzMC44NzUgQzQuNjI2LDMyLjg3NSA0Ljc1MSwzNC4xMjUgNC44MTMsMzQuNTYzIEM0LjgxMywzNC44NzYgNC45MzgsMzUuMDYzIDUuMTg4LDM1LjA2MyBDNS4zNzYsMzUuMDYzIDUuNTAxLDM0Ljg3NSA1LjU2MywzNC41NjMgQzUuNjI2LDM0LjA2MyA1Ljc1MSwzMi44MTMgNi4wMDEsMzAuODEzIEM2LjE4OSwyOC44MTMgNi4zMTQsMjcuMzEzIDYuMzE0LDI2LjI1IEM2LjMxNCwyNiA2LjA2NCwyMy4xMjUgNS41NjQsMTcuNjI1IEM1LjUwMSwxNy4zNzUgNS4zNzYsMTcuMjUgNS4xODksMTcuMjUgQzQuOTM5LDE3LjI1IDQuODE0LDE3LjM3NSA0LjgxNCwxNy42MjUgQzQuNzUxLDE4LjEyNSA0LjYyNiwxOS40MzggNC40MzksMjEuNTYzIEM0LjE4OSwyMy42MjYgNC4xMjYsMjUuMTg4IDQuMTI2LDI2LjI1MSBMNC4xMjUsMjYuMjUgWiBNOS4yNSwyNi4yNSBDOS4yNSwyNy4zNzUgOS4zNzUsMjkgOS42MjUsMzEuMjUgQzkuODEzLDMzLjQzOCA5LjkzOCwzNC42ODggOS45MzgsMzUgQzkuOTM4LDM1LjMxMiAxMC4wNjMsMzUuNSAxMC4zNzYsMzUuNSBDMTAuNjg5LDM1LjUgMTAuODc2LDM1LjMxMiAxMC44NzYsMzUgQzExLjM3NiwyOS44MTIgMTEuNTY0LDI2LjkzNyAxMS41NjQsMjYuMjUgQzExLjU2NCwyNS42MjUgMTEuMzc2LDIyLjg3NSAxMC44NzYsMTguMDYyIEMxMC44NzYsMTcuNjg3IDEwLjY4OCwxNy40OTkgMTAuMzc2LDE3LjQ5OSBDMTAuMDY0LDE3LjQ5OSA5LjkzOCwxNy42ODcgOS45MzgsMTguMDYyIEM5LjkzOCwxOC4zMTIgOS44MTMsMTkuNDM3IDkuNjI1LDIxLjU2MiBDOS4zNzUsMjMuNjg3IDkuMjUsMjUuMjUgOS4yNSwyNi4yNSBMOS4yNSwyNi4yNSBaIE0xNS4xODgsMjYuMjUgQzE1LjE4OCwyNi4zNzUgMTUuMzc2LDI5LjI1IDE1Ljc1MSwzNC45MzggQzE1Ljc1MSwzNS4zMTMgMTUuOTM5LDM1LjU2MyAxNi4zMTQsMzUuNTYzIEMxNi43NTIsMzUuNTYzIDE2LjkzOSwzNS4zMTMgMTYuOTM5LDM0LjkzOCBDMTYuOTM5LDM0LjYyNSAxNy4wNjQsMzMuMzc1IDE3LjI1MiwzMS4xODggQzE3LjUwMiwyOSAxNy42MjcsMjcuMzc1IDE3LjYyNywyNi4yNSBDMTcuNjI3LDI0LjEyNSAxNy41MDIsMjEgMTcuMzE0LDE2LjkzNyBDMTcuMTI2LDEyLjg3NCAxNy4wMDEsMTAuNDk5IDE2LjkzOSw5LjgxMiBDMTYuOTM5LDkuMzc0IDE2Ljc1MSw5LjE4NyAxNi4zMTQsOS4xODcgQzE1LjkzOSw5LjE4NyAxNS43NTEsOS4zNzUgMTUuNzUxLDkuODEyIEMxNS42ODgsMTEuMDYyIDE1LjYyNiwxMi44MTIgMTUuNTAxLDE1LjA2MiBDMTUuNDM4LDE3LjI1IDE1LjMxMywxOS4zMTIgMTUuMjUxLDIxLjEyNSBDMTUuMTg5LDIyLjkzOCAxNS4xODgsMjQuNjI1IDE1LjE4OCwyNi4yNSBMMTUuMTg4LDI2LjI1IFogTTIxLjE4OCwyNi4yNSBDMjEuMTg4LDI3LjM3NSAyMS4yNTEsMjguOTM4IDIxLjQzOCwzMSBDMjEuNTYzLDMzLjA2MyAyMS42MjYsMzQuMzEzIDIxLjYyNiwzNC43NSBDMjEuNjg5LDM1LjMxMyAyMi4wMDEsMzUuNTYzIDIyLjM3NiwzNS41NjMgQzIyLjgxNCwzNS41NjMgMjMuMDY0LDM1LjMxMyAyMy4xODksMzQuNzUgQzIzLjE4OSwzNC4xODcgMjMuMzE0LDMyLjg3NSAyMy40MzksMzAuODc1IEMyMy42MjcsMjguODc1IDIzLjY4OSwyNy4zMTIgMjMuNjg5LDI2LjI1IEMyMy42ODksMjMuOTM3IDIzLjYyNiwyMC42ODcgMjMuNDM5LDE2LjM3NSBDMjMuMzE0LDEyLjA2MiAyMy4xODksOS4xODcgMjMuMTg5LDcuODEyIEMyMy4wNjQsNy4zMTIgMjIuODE0LDcuMDYyIDIyLjM3Niw3LjA2MiBDMjIuMDAxLDcuMDYyIDIxLjY4OCw3LjMxMiAyMS42MjYsNy44MTIgQzIxLjU2Myw4Ljg3NSAyMS41MDEsMTEuNjI1IDIxLjM3NiwxNi4wNjIgQzIxLjI1MSwyMC40OTkgMjEuMTg4LDIzLjkzNyAyMS4xODgsMjYuMjUgTDIxLjE4OCwyNi4yNSBaIE0yNy4yNSwyNi4yNSBDMjcuMjUsMjYuMzc1IDI3LjM3NSwyOS4xMjUgMjcuNjI1LDM0LjYyNSBDMjcuNzUsMzUuMjUgMjguMDYzLDM1LjU2MyAyOC41NjMsMzUuNTYzIEMyOS4wNjMsMzUuNTYzIDI5LjM3NiwzNS4yNSAyOS40MzgsMzQuNTYzIEwyOS40MzgsMzQuNjI2IEMyOS42ODgsMjkuMTI2IDI5LjgxMywyNi4zNzYgMjkuODEzLDI2LjI1MSBDMjkuODEzLDI0LjU2MyAyOS44MTMsMjIuNzUxIDI5Ljc1LDIwLjgxMyBDMjkuNjg3LDE4LjkzOCAyOS42ODcsMTYuNzUgMjkuNjI1LDE0LjQzOCBDMjkuNTYyLDEyLjA2MyAyOS41LDEwLjI1IDI5LjQzNyw5IEMyOS4zNzQsOC4zNzUgMjkuMDYyLDggMjguNTYyLDggQzI4LjA2Miw4IDI3Ljc0OSw4LjM3NSAyNy42MjQsOSBDMjcuNjI0LDEwLjI1IDI3LjU2MSwxMi4wNjMgMjcuNDk5LDE0LjQzOCBDMjcuNDM2LDE2Ljc1MSAyNy4zNzQsMTguOTM4IDI3LjMxMSwyMC44MTMgQzI3LjMxMSwyMi43NTEgMjcuMjQ4LDI0LjU2MyAyNy4yNDgsMjYuMjUxIEwyNy4yNSwyNi4yNSBaIE0zMy4zNzUsMjYuMzEzIEMzMy4zNzUsMjYuMzc2IDMzLjUsMjkuMDYzIDMzLjc1LDM0LjQzOCBDMzMuODEzLDM1LjE4OCAzNC4xMjUsMzUuNTYzIDM0Ljc1LDM1LjU2MyBDMzUuMzc1LDM1LjU2MyAzNS42ODgsMzUuMTg4IDM1Ljc1LDM0LjQzOCBDMzYuMDYzLDI5LjA2MyAzNi4xODgsMjYuMzc1IDM2LjE4OCwyNi4zMTMgQzM2LjE4OCwyNi4xODggMzYuMDYzLDE4LjY4OCAzNS43NSwzLjg3NSBDMzUuNjg3LDMuMTI1IDM1LjM3NSwyLjY4NyAzNC43NSwyLjY4NyBDMzQuMTI1LDIuNjg3IDMzLjgxMiwzLjEyNSAzMy43NSwzLjg3NSBDMzMuNSwxOC42ODggMzMuMzc1LDI2LjE4OCAzMy4zNzUsMjYuMzEzIEwzMy4zNzUsMjYuMzEzIFogTTM4LjQzOCwxMi43NSBDMzguNDM4LDE2LjI1IDM4LjUwMSwyMC4xODggMzguNTAxLDI0LjQzOCBMMzguNTAxLDM0LjM3NiBDMzguNTAxLDM0LjY4OSAzOC42MjYsMzUuMDAxIDM4LjgxNCwzNS4yNTEgQzM5LjAwMiwzNS41MDEgMzkuMjUyLDM1LjYyNiAzOS41MDIsMzUuNjI2IEw2NC42MjcsMzUuNjI2IEM2Ny4xMjcsMzUuNjI2IDY5LjI1MiwzNC42MjYgNzEuMDY1LDMyLjY4OCBDNzIuODE1LDMwLjc1IDczLjY5LDI4LjM3NSA3My42OSwyNS42MjUgQzczLjY5LDIyLjg3NSA3Mi43NTIsMjAuNSA3MS4wMDIsMTguNTYyIEM2OS4yNTIsMTYuNjI0IDY3LjEyNywxNS42MjQgNjQuNjI3LDE1LjYyNCBDNjMuNTAyLDE1LjYyNCA2Mi4zMTQsMTUuOTM3IDYxLjEyNywxNi40OTkgQzYwLjc1MiwxMS45MzYgNTkuMDY0LDguMTI0IDU2LjAwMiw1LjA2MSBDNTIuOTM5LDEuOTM2IDQ5LjMxNCwwLjQzNiA0NS4xODksMC40MzYgQzQ0LjgxNCwwLjQzNiA0NC4yNTEsMC40MzYgNDMuNjI2LDAuNTYxIEM0Mi45MzgsMC42MjQgNDIuMTg4LDAuNzQ5IDQxLjQzOCwwLjg3NCBDNDAuNjI1LDEuMDYyIDM5Ljg3NSwxLjMxMiAzOS4zMTMsMS42MjQgQzM4Ljc1LDEuOTk5IDM4LjUsMi4zNzQgMzguNSwyLjc0OSBDMzguNSw1Ljg3NCAzOC40MzcsOS4xODcgMzguNDM3LDEyLjc0OSBMMzguNDM4LDEyLjc1IFoiIGlkPSJTaGFwZSIgc2tldGNoOnR5cGU9Ik1TU2hhcGVHcm91cCI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"); background-size: 60%; } .auth0-lock-social-button[data-provider^=thecity] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjYxcHgiIGhlaWdodD0iNjVweCIgdmlld0JveD0iMCAwIDYxIDY1IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+dGhlY2l0eTwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHNrZXRjaDp0eXBlPSJNU1BhZ2UiPgogICAgICAgIDxnIGlkPSJ0aGVjaXR5IiBza2V0Y2g6dHlwZT0iTVNMYXllckdyb3VwIiBmaWxsPSIjRkZGRkZGIj4KICAgICAgICAgICAgPHBhdGggZD0iTTMuODEzLDMuNDM4IEwzLjgxMywzLjQzOCBDNy4wNjMsMC44MTMgNy4zNzYsMC44MTMgMjkuOTM4LDAuODEzIEM1MS4xODgsMC44MTMgNTMuMDYzLDAuOTM4IDU1LjYyNiwzLjAwMSBDNTkuMjUxLDUuODE0IDYwLjMxNCw5LjUwMSA2MC4xODksMTguMTg5IEM2MC4xODksMjQuNDM5IDYwLjAwMSwyNS4yNTIgNTguMDY0LDI1LjMxNCBDNTYuODE0LDI1LjQzOSA1NC43NTEsMjUuNTY0IDUzLjUwMSwyNS42MjcgQzUwLjAwMSwyNS44NzcgNDQuNjg4LDMwLjg3NyA0MS43NTEsMzYuNjkgQzM5LjkzOCw0MC4zMTUgMzguNTAxLDQxLjgxNSAzNy41NjMsNDEuMzc4IEMzNi4yNSw0MC44MTUgMzYuNjg4LDM5LjYyOCAzOS4yNTEsMzUuMzE1IEM0My42ODksMjguMTI3IDQ0LjM3NiwyMi4wNjUgNDEuMjUxLDE2LjEyNyBDMzUuNTYzLDQuOTM5IDE5LjA2Myw1LjEyNyAxMy43NTEsMTYuMzE1IEMxMS4zMTMsMjEuNDQgMTEuNTAxLDI3LjY5IDE0LjEyNiwzMS45NCBDMTUuODE0LDM0Ljg3OCAyMy44NzYsNDEuMDY1IDI3LjU2NCw0Mi4zNzggQzI4LjEyNyw0Mi41NjYgMjguMTg5LDQzLjMxNiAyNy43NTIsNDQuMTI4IEMyNy4xMjcsNDUuMDY2IDI2LjI1Miw0NC45NDEgMjQuMDY0LDQzLjU2NSBDMTUuNjI2LDM4LjAwMiAxMC41MDEsMzYuODE1IDQuODc2LDM5LjMxNSBDMi42MjYsNDAuMTkgMC42MjYsNDAuOTQgMC4zMTMsNDAuOTQgQzAuMTI1LDQwLjk0IC0yLjUwMDc3NzM2ZS0xNCwzMy4xMjcgMC4xODgsMjMuNTAyIEwwLjU2Myw2LjAwMiBMMy44MTMsMy40MzggWiBNMjQuMDYzLDEzLjkzOCBMMjQuMDYzLDEzLjkzOCBDMjcuNTYzLDEyLjc1IDMyLjE4OCwxMy44MTMgMzQuNjg4LDE2LjU2MyBDMzguMzc2LDIwLjQzOCAzOC41MDEsMjUuMDAxIDM1LjM3NiwzMC44NzYgQzMzLjE4OCwzNC42ODkgMzIuNzUxLDM2LjE4OSAzMy43NTEsMzcuMzc2IEMzNi4zMTQsNDAuMzc2IDMzLjkzOSwzOS42MjYgMjYuNjg4LDM1LjMxMyBDMTkuNDM4LDMwLjg3NSAxNy4zNzUsMjguMTI1IDE3LjM3NSwyMy4xODggQzE3LjM3NSwyMC4xMjUgMjEuMTI1LDE1IDI0LjA2MywxMy45MzggTDI0LjA2MywxMy45MzggWiBNNTMuNTYzLDMxLjc1IEw1My41NjMsMzEuNzUgQzU5LjI1MSwyOS4zMTIgNjAuMzEzLDMwLjc1IDYwLjEyNiw0MS4xODggQzU5Ljg3Niw1Mi4zMTMgNjAuMDAxLDUxLjgxMyA1Ny44MTMsNTEuODEzIEM1Ni4zMTMsNTEuODEzIDQ2LjQzOCw0Ny41NjMgNDMuNSw0NS42MjUgQzQzLjMxMiw0NS41IDQ0LjY4OCw0Mi42ODcgNDYuNjI1LDM5LjMxMiBDNDksMzUuMTg3IDUxLjMxMywzMi42ODcgNTMuNTYzLDMxLjc0OSBMNTMuNTYzLDMxLjc1IFogTTYuOTM4LDQ0LjE4OCBMNi45MzgsNDQuMTg4IEMxMC4wMDEsNDMuMTI1IDEzLjg3Niw0My44NzUgMTguMDAxLDQ2LjUwMSBDMTkuODc2LDQ3LjU2NCAyMi4yNTEsNDguNTY0IDIzLjE4OSw0OC41NjQgQzI2LjM3Nyw0OC41NjQgMTguNzUxLDYxLjQzOSAxNC41NjQsNjMuMzE0IEM3LjUwMSw2Ni4yNTIgMC4wMDEsNjEuMjUxIDAuMDAxLDUzLjYyNiBDMC4wMDEsNTAuNTAxIDMuNjg5LDQ1LjM3NiA2LjkzOSw0NC4xODggTDYuOTM4LDQ0LjE4OCBaIE0zOS4zMTMsNTIgTDM5Ljg3Niw1MS42ODcgTDMyLjEyNiw2My4zMTIgTDU3LjU2NCw2My41NjIgTDU2LjUwMSw1OC40MzcgTDM5LjMxMyw1MiBaIE0yMC4xODgsNjIuODc1IEwxOS4zMTMsNjMuNDM4IEwyNi42MjYsNjMuNjI2IEwzNC41MDEsNTEuMTI2IEwyOC44NzYsNTAuNjg4IEwyMC4xODgsNjIuODc1IFoiIGlkPSJTaGFwZSIgc2tldGNoOnR5cGU9Ik1TU2hhcGVHcm91cCI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"); } .auth0-lock-social-button[data-provider^=thirtysevensignals] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgaWQ9ImJhc2VjYW1wLWljb24iPgo8ZyBpZD0iRnJhbWUgMSI+CjxnIGlkPSJHcm91cCAyMSI+CjxwYXRoIGlkPSJWZWN0b3IiIGQ9Ik0xOS4wNzIyIDE0Ljk0ODlDMTguNTgzNyAxNC45NDg5IDE4LjIwMzcgMTQuNTY4OSAxOC4xNDk1IDE0LjA4MDRDMTcuODIzOCA5LjQxMjczIDE1LjI3MjkgMi44NDUzNyAxMC41NTA5IDIuODQ1MzdDNi42NDMwMiAyLjg0NTM3IDMuNzEyMTMgNS41NTkxNiAxLjgxMjQ4IDEwLjkzMjVDMS42NDk2NiAxMS40MjA5IDEuMTA2OSAxMS42OTIzIDAuNjE4NDE4IDExLjQ3NTJDMC4xMjk5MzcgMTEuMzEyNCAtMC4xNDE0NDEgMTAuNzY5NiAwLjA3NTY2MTMgMTAuMzM1NEMyLjI0NjY5IDQuMTQ3OTkgNS43NzQ2MSAxIDEwLjU1MDkgMUMxNi43OTI2IDEgMTkuNjY5MiA4LjkyNDI1IDE5Ljk5NDggMTMuOTcxOUMyMC4wNDkxIDE0LjQ2MDQgMTkuNjY5MiAxNC45NDg5IDE5LjEyNjQgMTQuOTQ4OUgxOS4wNzIyWiIgZmlsbD0iI2ZmZmZmZiIvPgo8cGF0aCBpZD0iVmVjdG9yXzIiIGQ9Ik0xMC4zMzQgMTguMzY4MkM3LjE4NTk2IDE4LjM2ODIgNC4xNDY1MyAxNy4wMTEzIDIuMDI5NzcgMTQuNjIzMkMxLjc1ODM5IDE0LjQwNjEgMS43MDQxMiAxNC4wMjYyIDEuODEyNjcgMTMuNzAwNUMyLjQwOTcgMTIuMTI2NSAzLjk4MzcgOC40OTAwNSA1Ljk5MTkgOC40MzU3N0M3LjAyMzE0IDguNDM1NzcgNy43ODMgOS4yNDk5MSA4LjM4MDAzIDkuOTAxMjJDOC41NDI4NiAxMC4xMTgzIDguODE0MjQgMTAuMzg5NyA5LjAzMTM0IDEwLjU1MjVDOS41MTk4MiAxMC4wNjQgMTAuNDQyNSA4LjU0NDMyIDExLjE0ODEgNi45NzAzM0MxMS4zNjUyIDYuNDgxODUgMTEuOTA4IDYuMzE5MDIgMTIuMzk2NCA2LjUzNjEyQzEyLjg4NDkgNi43NTMyMiAxMy4wNDc3IDcuMjk1OTggMTIuODMwNiA3Ljc4NDQ2QzEwLjY1OTYgMTIuNTA2NCA5LjUxOTgyIDEyLjUwNjQgOS4wODU2MSAxMi41MDY0QzguMjE3MiAxMi41MDY0IDcuNjIwMTcgMTEuODU1MSA3LjAyMzE0IDExLjIwMzhDNi43NTE3NiAxMC45MzI1IDYuMjA5IDEwLjMzNTQgNS45OTE5IDEwLjMzNTRDNS41MDM0MiAxMC4zODk3IDQuNDcyMTggMTIuMDcyMiAzLjc2NjYgMTMuODYzM0M1LjU1NzY5IDE1LjY1NDQgOC4wMDAxIDE2LjYzMTQgMTAuNDk2OCAxNi41NzcxQzEyLjY2NzggMTYuNTc3MSAxNi41MjE0IDE2LjE5NzIgMTguMDk1NCAxMy44NjMzQzE3LjY2MTIgOS4xOTU2MyAxNS4xMTAyIDIuODk5NjUgMTAuNDk2OCAyLjg5OTY1QzEwLjAwODMgMi44OTk2NSA5LjU3NDEgMi40NjU0NCA5LjU3NDEgMS45NzY5NkM5LjU3NDEgMS40ODg0OCAxMC4wMDgzIDEgMTAuNTUxMSAxQzE2Ljc5MjggMSAxOS42Njk0IDguOTI0MjUgMTkuOTk1IDEzLjk3MTlDMTkuOTk1IDE0LjEzNDcgMTkuOTQwOCAxNC4zNTE4IDE5Ljg4NjUgMTQuNTE0NkMxOC40MjEgMTcuMDExMyAxNS4xMTAyIDE4LjQyMjUgMTAuNTUxMSAxOC40MjI1QzEwLjQ5NjggMTguMzY4MiAxMC4zODgyIDE4LjM2ODIgMTAuMzM0IDE4LjM2ODJaIiBmaWxsPSIjZmZmZmZmIi8+CjwvZz4KPC9nPgo8L2c+Cjwvc3ZnPgo="); } .auth0-lock-social-button[data-provider^=twitter] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9Ijc5cHgiIGhlaWdodD0iNjVweCIgdmlld0JveD0iMCAwIDc5IDY1IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+dHdpdHRlcjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHNrZXRjaDp0eXBlPSJNU1BhZ2UiPgogICAgICAgIDxnIGlkPSJ0d2l0dGVyIiBza2V0Y2g6dHlwZT0iTVNMYXllckdyb3VwIiBmaWxsPSIjRkZGRkZGIj4KICAgICAgICAgICAgPHBhdGggZD0iTTAsNTcuNDM4IEM3LjYyNSw2Mi4yNTEgMTUuODc1LDY0LjYyNiAyNC43NSw2NC42MjYgQzMwLjUsNjQuNjI2IDM1LjkzOCw2My43NTEgNDAuOTM4LDYxLjkzOCBDNDUuOTM4LDYwLjEyNSA1MC4yNTEsNTcuNjg4IDUzLjgxMyw1NC42MjUgQzU3LjQzOCw1MS41IDYwLjUwMSw0OCA2My4wNjMsNDQuMDYyIEM2NS42MjUsNDAuMTI0IDY3LjU2MywzNS45OTkgNjguODEzLDMxLjYyNCBDNzAuMDYzLDI3LjMxMSA3MC43NTEsMjIuOTk5IDcwLjc1MSwxOC42ODYgTDcwLjc1MSwxNi41NjEgQzc0LjAwMSwxNC4xODYgNzYuNjg5LDExLjM3MyA3OC43NTEsOC4xODYgQzc1LjY4OCw5LjQ5OSA3Mi42MjYsMTAuMzc0IDY5LjUwMSwxMC43NDkgQzczLjAwMSw4LjY4NiA3NS4zNzYsNS42ODYgNzYuNTY0LDEuODExIEM3My40MzksMy42ODYgNzAuMDAxLDQuOTk5IDY2LjMxNCw1Ljc0OSBDNjMuMTI2LDIuMzc0IDU5LjE4OSwwLjYyNCA1NC41MDEsMC42MjQgQzUwLjA2MywwLjYyNCA0Ni4yNTEsMi4yNDkgNDMuMDYzLDUuMzc0IEMzOS45MzgsOC41NjIgMzguMzEzLDEyLjMxMiAzOC4zMTMsMTYuNzQ5IEMzOC4zMTMsMTcuODEyIDM4LjUwMSwxOS4wNjIgMzguODEzLDIwLjQ5OSBDMzIuMTg4LDIwLjEyNCAyNiwxOC40OTkgMjAuMTg4LDE1LjQ5OSBDMTQuNDM4LDEyLjU2MSA5LjUsOC41NjEgNS41LDMuNTYxIEM0LDYuMTI0IDMuMjUsOC44MTEgMy4yNSwxMS42ODYgQzMuMjUsMTQuNDk5IDMuOTM4LDE3LjA2MSA1LjE4OCwxOS40MzYgQzYuNTAxLDIxLjgxMSA4LjI1MSwyMy42ODYgMTAuNTAxLDI1LjE4NiBDNy44NzYsMjUuMTIzIDUuMzc2LDI0LjQzNiAzLjEyNiwyMy4xODYgTDMuMTI2LDIzLjM3NCBDMy4xMjYsMjcuMjQ5IDQuMzc2LDMwLjY4NyA2LjgxNCwzMy42MjQgQzkuMjUyLDM2LjYyNCAxMi4zNzcsMzguNDM3IDE2LjEyNywzOS4xODcgQzE0Ljc1MiwzOS41NjIgMTMuMzE0LDM5Ljc1IDExLjgxNCwzOS43NSBDMTAuNjg5LDM5Ljc1IDkuNjg5LDM5LjY4NyA4LjgxNCwzOS41IEM5Ljg3Nyw0Mi43NSAxMS43NTIsNDUuMzc1IDE0LjUwMiw0Ny41IEMxNy4zMTUsNDkuNTYzIDIwLjQ0LDUwLjYyNSAyMy45NCw1MC42ODggQzE4LjA2NSw1NS4zMTMgMTEuMzc3LDU3LjYyNiAzLjgxNSw1Ny42MjYgQzIuNTY1LDU3LjYyNiAxLjI1Miw1Ny41NjMgMC4wMDIsNTcuNDM4IEwwLDU3LjQzOCBaIiBpZD0iU2hhcGUiIHNrZXRjaDp0eXBlPSJNU1NoYXBlR3JvdXAiPjwvcGF0aD4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg=="); } .auth0-lock-social-button[data-provider^=vkontakte] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9Ijc5cHgiIGhlaWdodD0iNDZweCIgdmlld0JveD0iMCAwIDc5IDQ2IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+dms8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz48L2RlZnM+CiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiBza2V0Y2g6dHlwZT0iTVNQYWdlIj4KICAgICAgICA8ZyBpZD0idmsiIHNrZXRjaDp0eXBlPSJNU0xheWVyR3JvdXAiIGZpbGw9IiNGRkZGRkYiPgogICAgICAgICAgICA8cGF0aCBkPSJNMC40MzcsMy44MTMgQzAuNDM3LDQuMzc2IDAuNSw0LjkzOCAwLjU2Miw1LjUwMSBDMC42ODcsNi4xMjYgMC44NzUsNi42ODkgMS4xMjUsNy4zMTQgQzEuMzEzLDcuOTM5IDEuNTYzLDguNDM5IDEuNjg4LDguODE0IEMxLjg3Niw5LjE4OSAyLjEyNiw5Ljc1MiAyLjUwMSwxMC40MzkgQzIuODE0LDExLjE4OSAzLjA2NCwxMS42MjcgMy4xODksMTEuODc3IEM3LjEyNywxOS45NCAxMS4zNzcsMjYuODE1IDE1LjgxNCwzMi41MDIgQzE3LjY4OSwzNC45NCAxOS4zNzcsMzYuODc3IDIwLjkzOSwzOC40NCBDMjIuNTY0LDM5Ljk0IDI0LjY4OSw0MS4zNzggMjcuMzc3LDQyLjc1MyBDMzAuMTI3LDQ0LjEyOCAzMy4xMjcsNDQuOTQxIDM2LjQ0LDQ1LjMxNiBDMzguMDY1LDQ1LjUwNCAzOS41MDMsNDUuNTY2IDQwLjY5LDQ1LjU2NiBDNDMuNTAzLDQ1LjU2NiA0NS4xOSw0NS4wNjYgNDUuNzUzLDQ0LjAwMyBDNDYuMDY2LDQzLjQ0IDQ2LjI1Myw0Mi4zNzggNDYuMzc4LDQwLjk0IEM0Ni40NDEsMzkuNDQgNDYuNjI4LDM4LjE5IDQ2Ljk0MSwzNy4xMjcgQzQ3LjI1NCwzNi4wNjQgNDcuODc5LDM1LjQzOSA0OC44NzksMzUuMjUyIEM0OS40NDIsMzUuMTg5IDUwLjAwNCwzNS4zMTUgNTAuNjI5LDM1LjYyNyBDNTEuMTkyLDM2LjAwMiA1MS42OTIsMzYuMzE1IDUyLjA2NywzNi43NTIgQzUyLjQ0MiwzNy4xMjcgNTIuOTQyLDM3LjYyNyA1My41MDUsMzguMzc3IEM1NC4wNjgsMzkuMDY1IDU0LjM4LDM5LjUwMiA1NC41NjgsMzkuNjkgQzU3LjY5Myw0My4xOSA2MC42MzEsNDUuMTkgNjMuNDQzLDQ1LjY5IEw2My44ODEsNDUuNjkgQzY0LjY5NCw0NS41MDIgNjUuNjMxLDQ1LjM3NyA2Ni43NTYsNDUuMzc3IEM2Ny40NDQsNDUuMzc3IDY4LjI1Niw0NS40NCA2OS4xMzEsNDUuNTAyIEM3MC4wNjksNDUuNjI3IDcwLjk0NCw0NS42OSA3MS44ODEsNDUuNjkgQzczLjAwNiw0NS42OSA3NC4xMzEsNDUuNjI3IDc1LjI1Niw0NS40NCBDNzcuNDQ0LDQ1LjA2NSA3OC41MDYsNDQuMTkgNzguNTA2LDQyLjgxNSBDNzguNTA2LDQxLjgxNSA3Ny42MzEsNDAuMjUyIDc1Ljk0MywzOC4wMDIgQzc0LjE5MywzNS44MTQgNzEuODE4LDMzLjMxNCA2OC43NTUsMzAuNTAyIEM2OC42OTIsMzAuNDM5IDY4LjQ0MiwzMC4xODkgNjguMDA1LDI5LjgxNCBDNjcuNTY4LDI5LjQzOSA2Ny4zMTcsMjkuMTI2IDY3LjEzLDI5LjAwMSBDNjcuMDA1LDI4LjgxMyA2Ni44MTcsMjguNTYzIDY2LjUwNSwyOC4xODggQzY2LjI1NSwyNy44NzUgNjYuMDA1LDI3LjU2MyA2NS44OCwyNy4yNSBDNjUuNzU1LDI2LjkzNyA2NS42OTIsMjYuNjI1IDY1LjY5MiwyNi4zMTIgQzY1LjY5MiwyNS43NDkgNjUuNzU1LDI1LjE4NyA2Ni4wMDUsMjQuNjI0IEM2Ni4yNTUsMjMuOTk5IDY2LjUwNSwyMy40OTkgNjYuNzU1LDIzLjE4NiBDNjcuMDA1LDIyLjgxMSA2Ny4zOCwyMi4zMTEgNjcuODgsMjEuNjIzIEM2OC4zOCwyMC45MzUgNjguNjkzLDIwLjU2IDY4Ljc1NSwyMC40MzUgQzY5LjE5MywxOS45MzUgNjkuOTQzLDE4LjkzNSA3MS4xMywxNy40OTcgQzcyLjMxOCwxNS45OTcgNzMuMzE4LDE0LjgwOSA3NC4wNjgsMTMuNzQ3IEM3NC44MTgsMTIuNzQ3IDc1LjU2OCwxMS42ODQgNzYuMjU2LDEwLjQzNCBDNzcuNzU2LDcuOTM0IDc4LjUwNiw2LjA1OSA3OC41MDYsNC44NzEgQzc4LjUwNiw0LjU1OCA3OC40NDMsNC4yNDYgNzguMzE4LDMuOTk2IEM3OC4xMywzLjY4MyA3Ny44MTgsMy4zNzEgNzcuNDQzLDMuMTgzIEM3Ny4wMDUsMi45OTUgNzYuNDQzLDIuODcgNzUuODE4LDIuODA4IEM3NS4xMywyLjc0NSA3NC41MDUsMi43NDUgNzMuODgsMi43NDUgQzczLjMxNywyLjgwOCA3Mi42MywyLjgwOCA3MS44MTcsMi44NyBDNzEuMDA0LDIuOTMyIDcwLjQ0MiwyLjkzMyA3MC4wNjcsMi45MzMgQzY5LjQ0MiwyLjkzMyA2OC40NDIsMi44NyA2Ny4wNjcsMi44MDggQzY1Ljk0MiwyLjc0NSA2NC45NDIsMi42ODMgNjQuMTI5LDIuNjgzIEw2My41MDQsMi42ODMgQzYyLjU2NiwyLjY4MyA2MS43NTQsMi44MDggNjEuMTI5LDMuMTIxIEM2MC40NDEsMy45OTYgNjAuMTI5LDQuMzA5IDYwLjEyOSwzLjk5NiBDNjAuMDY2LDMuNjgzIDU5LjgxNiw0LjEyMSA1OS4zMTYsNS4yNDYgQzU4Ljg3OCw2LjM3MSA1OC42MjgsNi45MzQgNTguNjI4LDYuOTM0IEw1OC4wMDMsOC4zNzIgQzU2LjAwMywxMi42ODUgNTQuMDAzLDE2LjE4NSA1Mi4wMDMsMTguODEgQzUxLjk0LDE4Ljg3MyA1MS43NTMsMTkuMTIzIDUxLjMxNSwxOS42ODUgQzUwLjk0LDIwLjI0OCA1MC42OSwyMC42MjMgNTAuNTY1LDIwLjc0OCBMNDkuODE1LDIxLjQ5OCBDNDkuNTAyLDIxLjgxMSA0OS4xOSwyMi4wNjEgNDguODE1LDIyLjE4NiBDNDguNTAyLDIyLjMxMSA0OC4xOSwyMi40MzYgNDcuODE1LDIyLjQzNiBDNDYuNjksMjEuNzQ4IDQ2LjA2NSwyMC40MzYgNDUuODc3LDE4LjU2MSBDNDUuNzUyLDE3LjY4NiA0NS43NTIsMTYuODczIDQ1Ljc1MiwxNi4xMjMgQzQ1Ljc1MiwxNS4xMjMgNDUuODE1LDE0LjEyMyA0NS45NCwxMy4xODUgQzQ1Ljk0LDEyLjc0NyA0Ni4wMDMsMTEuNjIyIDQ2LjE5LDkuODcyIEM0Ni4zMTUsOC40OTcgNDYuMzc4LDcuMzcyIDQ2LjM3OCw2LjQ5NyBDNDYuMzE1LDYuMTg0IDQ2LjMxNSw1LjkzNCA0Ni4zMTUsNS42MjIgQzQ2LjI1Miw0LjYyMiA0Ni4wMDIsMy42ODQgNDUuNjI3LDIuOTM0IEM0NS45NCwyLjc0NiA0NS42MjcsMi40MzQgNDQuODE0LDIuMDU5IEM0NC4wMDEsMS42MjEgNDMuNTY0LDEuNDM0IDQzLjU2NCwxLjQzNCBMNDIuMTI2LDEuMTIxIEM0Mi4xMjYsMC45OTYgNDEuNTYzLDAuOTMzIDQwLjQzOCwwLjkzMyBDMzkuMzEzLDAuODcgMzguNzUsMC44NyAzOC43NSwwLjg3IEwzNS4zNzUsMC44NyBDMzIuNzUsMC44NyAzMC42ODcsMS4wNTggMjkuMTg3LDEuNDMzIEMyNy42ODcsMS44NzEgMjYuNjI0LDIuNjIxIDI1Ljk5OSwzLjgwOCBDMjYuMzc0LDQuMDU4IDI2Ljg3NCw0LjI0NiAyNy40OTksNC40OTYgQzI4LjEyNCw0Ljc0NiAyOC42ODcsNC45OTYgMjkuMDYyLDUuMjQ2IEMyOS41LDUuNTU5IDI5LjgxMiw1LjkzNCAzMC4wNjIsNi4zNzEgQzMwLjY4Nyw3LjU1OSAzMSw5Ljc0NiAzMSwxMi45MzQgQzMxLDEzLjYyMiAzMSwxNC4zNzIgMzAuOTM3LDE1LjE4NCBDMzAuODEyLDE5LjkzNCAzMC4xODcsMjIuNDM0IDI4LjkzNywyMi42MjIgQzI4LjY4NywyMi42ODUgMjguNDM3LDIyLjY4NSAyOC4xODcsMjIuNjIyIEMyNy45MzcsMjIuNjIyIDI3LjY4NywyMi40OTcgMjcuNDM3LDIyLjMwOSBDMjcuMjQ5LDIyLjEyMSAyNi45OTksMjEuOTM0IDI2LjgxMiwyMS43NDYgQzI2LjU2MiwyMS41NTggMjYuMzc0LDIxLjMwOCAyNi4xMjQsMjEuMDU4IEMyNS44NzQsMjAuNzQ1IDI1LjY4NiwyMC40OTUgMjUuNTYxLDIwLjMwOCBDMjUuMzczLDIwLjEyIDI1LjE4NiwxOS44NyAyNC45OTgsMTkuNDk1IEMyNC44MSwxOS4xODIgMjQuNjIzLDE4LjkzMiAyNC41NiwxOC44MDcgQzIyLjE4NSwxNS4zNjkgMjAuMTg1LDExLjg2OSAxOC41Niw4LjM2OSBDMTguNDM1LDguMTgxIDE4LjE4NSw3LjY4MSAxNy44NzIsNi45OTQgQzE3LjYyMiw2LjMwNiAxNy4zNzIsNS43NDQgMTcuMTg0LDUuMzY5IEMxNi45MzQsNC45OTQgMTYuNzQ2LDQuNTU2IDE2LjQzNCw0LjExOSBDMTYuMTIxLDMuNzQ0IDE1Ljg3MSwzLjQzMSAxNS41NTksMy4zMDYgQzE1LjA1OSwzLjA1NiAxNC4zNzEsMi44NjggMTMuNTU5LDIuODA2IEMxMy4xMjEsMi44MDYgMTIuNjIxLDIuODA2IDEyLjA1OSwyLjc0MyBDMTEuNDk2LDIuNzQzIDEwLjg3MSwyLjc0MyAxMC4xODQsMi44MDYgQzguODcxLDIuODY5IDguMDU5LDIuOTMxIDcuODA5LDIuOTMxIEM3LjM3MSwyLjkzMSA2LjY4NCwyLjkzMSA1Ljc0NiwyLjg2OCBDNS4xMjEsMi44MDUgNC42MjEsMi44MDUgNC4xODMsMi44MDUgTDMuNjIsMi44MDUgQzMuMTIsMi44MDUgMi42MiwyLjg2OCAxLjk5NSwzLjA1NSBDMS4zNywzLjI0MiAwLjg3LDMuNDkzIDAuNDMyLDMuODA1IEwwLjQzNywzLjgxMyBaIiBpZD0iU2hhcGUiIHNrZXRjaDp0eXBlPSJNU1NoYXBlR3JvdXAiPjwvcGF0aD4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg=="); } .auth0-lock-social-button[data-provider^=windowslive] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjY0cHgiIGhlaWdodD0iNjRweCIgdmlld0JveD0iMCAwIDY0IDY0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+d2luZG93czwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHNrZXRjaDp0eXBlPSJNU1BhZ2UiPgogICAgICAgIDxnIGlkPSJ3aW5kb3dzIiBza2V0Y2g6dHlwZT0iTVNMYXllckdyb3VwIiBmaWxsPSIjRkZGRkZGIj4KICAgICAgICAgICAgPGcgaWQ9Ikdyb3VwIiBza2V0Y2g6dHlwZT0iTVNTaGFwZUdyb3VwIj4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0wLjA0NSwwLjA0NSBMMjguNzQ3LDAuMDQ1IEwyOC43NDcsMjguNzQ3IEwwLjA0NSwyOC43NDcgTDAuMDQ1LDAuMDQ1IEwwLjA0NSwwLjA0NSBaIiBpZD0iU2hhcGUiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0zNC40MywwLjA0NSBMNjMuMTMyLDAuMDQ1IEw2My4xMzIsMjguNzQ3IEwzNC40MywyOC43NDcgTDM0LjQzLDAuMDQ1IEwzNC40MywwLjA0NSBaIiBpZD0iU2hhcGUiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0yOC43NDgsMzUuMjU0IEwyOC43NDgsNjMuOTU2IEwwLjA0Niw2My45NTYgTDAuMDQ2LDM1LjI1NCBMMjguNzQ4LDM1LjI1NCBMMjguNzQ4LDM1LjI1NCBaIiBpZD0iU2hhcGUiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0zNC40MywzNS4yNTQgTDYzLjEzMiwzNS4yNTQgTDYzLjEzMiw2My45NTYgTDM0LjQzLDYzLjk1NiBMMzQuNDMsMzUuMjU0IEwzNC40MywzNS4yNTQgWiIgaWQ9IlNoYXBlIj48L3BhdGg+CiAgICAgICAgICAgIDwvZz4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPgo="); } .auth0-lock-social-button[data-provider^=windows] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjY0cHgiIGhlaWdodD0iNjRweCIgdmlld0JveD0iMCAwIDY0IDY0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+d2luZG93czwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHNrZXRjaDp0eXBlPSJNU1BhZ2UiPgogICAgICAgIDxnIGlkPSJ3aW5kb3dzIiBza2V0Y2g6dHlwZT0iTVNMYXllckdyb3VwIiBmaWxsPSIjRkZGRkZGIj4KICAgICAgICAgICAgPGcgaWQ9Ikdyb3VwIiBza2V0Y2g6dHlwZT0iTVNTaGFwZUdyb3VwIj4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0wLjA0NSwwLjA0NSBMMjguNzQ3LDAuMDQ1IEwyOC43NDcsMjguNzQ3IEwwLjA0NSwyOC43NDcgTDAuMDQ1LDAuMDQ1IEwwLjA0NSwwLjA0NSBaIiBpZD0iU2hhcGUiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0zNC40MywwLjA0NSBMNjMuMTMyLDAuMDQ1IEw2My4xMzIsMjguNzQ3IEwzNC40MywyOC43NDcgTDM0LjQzLDAuMDQ1IEwzNC40MywwLjA0NSBaIiBpZD0iU2hhcGUiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0yOC43NDgsMzUuMjU0IEwyOC43NDgsNjMuOTU2IEwwLjA0Niw2My45NTYgTDAuMDQ2LDM1LjI1NCBMMjguNzQ4LDM1LjI1NCBMMjguNzQ4LDM1LjI1NCBaIiBpZD0iU2hhcGUiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0zNC40MywzNS4yNTQgTDYzLjEzMiwzNS4yNTQgTDYzLjEzMiw2My45NTYgTDM0LjQzLDYzLjk1NiBMMzQuNDMsMzUuMjU0IEwzNC40MywzNS4yNTQgWiIgaWQ9IlNoYXBlIj48L3BhdGg+CiAgICAgICAgICAgIDwvZz4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg=="); } .auth0-lock-social-button[data-provider^=wordpress] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjY0cHgiIGhlaWdodD0iNjVweCIgdmlld0JveD0iMCAwIDY0IDY1IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+d29yZHByZXNzPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc2tldGNoOnR5cGU9Ik1TUGFnZSI+CiAgICAgICAgPGcgaWQ9IndvcmRwcmVzcyIgc2tldGNoOnR5cGU9Ik1TTGF5ZXJHcm91cCIgZmlsbD0iI0ZGRkZGRiI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik03Ljk5MzYwNTc4ZS0xNSwzMi44MTMgQzcuOTkzNjA1NzhlLTE1LDM4LjYyNiAxLjQzOCw0NC4wMDEgNC4zMTMsNDguODc2IEM3LjEyNiw1My44MTQgMTEuMDAxLDU3LjY4OSAxNS45MzgsNjAuNTAxIEMyMC44MTMsNjMuMzc2IDI2LjE4OCw2NC44MTQgMzIuMDAxLDY0LjgxNCBDMzcuODE0LDY0LjgxNCA0My4xODksNjMuMzc2IDQ4LjA2NCw2MC41MDEgQzUzLjAwMiw1Ny42ODggNTYuODc3LDUzLjgxMyA1OS42ODksNDguODc2IEM2Mi41NjQsNDQuMDAxIDY0LjAwMiwzOC42MjYgNjQuMDAyLDMyLjgxMyBDNjQuMDAyLDI3IDYyLjU2NCwyMS42MjUgNTkuNjg5LDE2Ljc1IEM1Ni44NzYsMTEuODEyIDUzLjAwMSw3LjkzNyA0OC4wNjQsNS4xMjUgQzQzLjE4OSwyLjI1IDM3LjgxNCwwLjgxMiAzMi4wMDEsMC44MTIgQzI2LjE4OCwwLjgxMiAyMC44MTMsMi4yNSAxNS45MzgsNS4xMjUgQzExLDcuOTM4IDcuMTI1LDExLjgxMyA0LjMxMywxNi43NSBDMS40MzgsMjEuNjI1IDAsMjcgMCwzMi44MTMgTDcuOTkzNjA1NzhlLTE1LDMyLjgxMyBaIE0yLjUsMzIuODEzIEMyLjUsMjguNTYzIDMuMzc1LDI0LjU2MyA1LjA2MywyMC43NSBMMTkuMTI2LDU5LjM3NSBDMTQuMTI2LDU3IDEwLjEyNiw1My4zNzUgNy4wNjMsNDguNjI1IEM0LDQzLjgxMiAyLjUsMzguNTYyIDIuNSwzMi44MTIgTDIuNSwzMi44MTMgWiBNNy4zMTMsMTYuNjI1IEMxMC4wMDEsMTIuNSAxMy41MDEsOS4zMTIgMTcuODc2LDYuODc1IEMyMi4xODksNC41IDI2LjkzOSwzLjMxMiAzMi4wMDEsMy4zMTIgQzM5Ljc1MSwzLjMxMiA0Ni4zNzYsNS44NzUgNTEuOTM5LDExLjA2MiBDNTEuOTM5LDExLjA2MiA1MS44NzYsMTEuMDYyIDUxLjc1MSwxMC45OTkgTDUxLjU2MywxMC45OTkgQzUwLjE4OCwxMC45OTkgNDksMTEuNDk5IDQ4LjA2MywxMi41NjIgQzQ3LjA2MywxMy42MjUgNDYuNTYzLDE0LjgxMiA0Ni41NjMsMTYuMjUgQzQ2LjU2MywxNi42ODggNDYuNjI2LDE3LjEyNSA0Ni43NTEsMTcuNTYzIEM0Ni44MTQsMTguMDAxIDQ3LjAwMSwxOC41MDEgNDcuMjUxLDE5LjA2MyBDNDcuNTAxLDE5LjY4OCA0Ny42ODksMjAuMDYzIDQ3LjgxNCwyMC4zMTMgQzQ3LjkzOSwyMC41NjMgNDguMjUyLDIxLjA2MyA0OC42ODksMjEuODEzIEM0OS4xMjYsMjIuNTYzIDQ5LjM3NywyMy4wMDEgNDkuNTAyLDIzLjEyNiBDNTEuMTI3LDI1Ljg3NiA1MS45NCwyOC42MjYgNTEuOTQsMzEuMzE0IEM1MS45NCwzMi42ODkgNTEuMTksMzUuODc3IDQ5LjY5LDQwLjg3NyBMNDYuNzUyLDUwLjc1MiBMMzYuMTI3LDE5LjAwMiBMMzkuNDQsMTguNjg5IEMzOS45NCwxOC42MjYgNDAuMjUzLDE4LjM3NiA0MC40NCwxNy45MzkgQzQwLjYyOCwxNy41NjQgNDAuNTY1LDE3LjEyNiA0MC4zNzcsMTYuNzUxIEM0MC4xMjcsMTYuMzc2IDM5Ljc1MiwxNi4xODggMzkuMjUyLDE2LjI1MSBDMzYuMDY0LDE2LjUwMSAzMy40MzksMTYuNjI2IDMxLjM3NywxNi42MjYgTDIzLjYyNywxNi4yNTEgQzIzLjEyNywxNi4xODggMjIuNzUyLDE2LjM3NiAyMi41MDIsMTYuNzUxIEMyMi4yNTIsMTcuMTI2IDIyLjI1MiwxNy41NjQgMjIuMzc3LDE3LjkzOSBDMjIuNTY1LDE4LjM3NyAyMi45NCwxOC42MjcgMjMuNDQsMTguNjg5IEMyNC40NCwxOC43NTIgMjUuNTAzLDE4Ljg3NyAyNi41MDMsMTkuMDAyIEwzMS4xMjgsMzEuNjI3IEwyNC42MjgsNTAuOTQgTDEzLjg3OCwxOS4wMDIgTDE3LjI1MywxOC42ODkgQzE3LjgxNiwxOC42MjYgMTguMTI4LDE4LjM3NiAxOC4zMTYsMTcuOTM5IEMxOC41MDQsMTcuNTY0IDE4LjQ0MSwxNy4xMjYgMTguMTkxLDE2Ljc1MSBDMTguMDAzLDE2LjM3NiAxNy42MjgsMTYuMTg4IDE3LjA2NiwxNi4yNTEgQzEzLjg3OCwxNi41MDEgMTEuMjUzLDE2LjYyNiA5LjE5MSwxNi42MjYgTDcuMzE2LDE2LjYyNiBMNy4zMTMsMTYuNjI1IFogTTIzLjY4OCw2MS4xODggTDMyLjUwMSwzNS4zNzUgTDQxLjYyNiw2MC4yNSBMNDEuODE0LDYwLjYyNSBDMzguNjg5LDYxLjc1IDM1LjQzOSw2Mi4zMTMgMzIuMDAxLDYyLjMxMyBDMjkuMTI2LDYyLjMxMyAyNi4zMTMsNjEuOTM4IDIzLjY4OCw2MS4xODggTDIzLjY4OCw2MS4xODggWiBNNDYuODc1LDU4LjM3NSBMNTUuODc1LDMyLjI1IEM1Ny4zNzUsMjcuODc1IDU4LjEyNSwyNC4zNzUgNTguMTI1LDIxLjY4NyBDNTguMTI1LDIwLjU2MiA1OC4wNjIsMTkuNTYyIDU3LjkzNywxOC42ODcgQzYwLjMxMiwyMyA2MS41LDI3LjY4NyA2MS41LDMyLjgxMiBDNjEuNSwzOC4xMjUgNjAuMTg3LDQzLjA2MiA1Ny41NjIsNDcuNjI1IEM1NC44NzQsNTIuMTg4IDUxLjMxMiw1NS43NSA0Ni44NzQsNTguMzc1IEw0Ni44NzUsNTguMzc1IFoiIGlkPSJTaGFwZSIgc2tldGNoOnR5cGU9Ik1TU2hhcGVHcm91cCI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"); } .auth0-lock-social-button[data-provider^=yahoo] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9Ijg4cHgiIGhlaWdodD0iNTJweCIgdmlld0JveD0iMCAwIDg4IDUyIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+eWFob288L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz48L2RlZnM+CiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiBza2V0Y2g6dHlwZT0iTVNQYWdlIj4KICAgICAgICA8ZyBpZD0ieWFob28iIHNrZXRjaDp0eXBlPSJNU0xheWVyR3JvdXAiIGZpbGw9IiNGRkZGRkYiPgogICAgICAgICAgICA8cGF0aCBkPSJNMCw3LjY4OCBMMCw3LjE4OCBDMC4wNjMsNi45MzggMC4zMTMsNi43NSAwLjYyNSw2Ljc1IEwzMi4xMjUsNi43NSBDMzIuMTg4LDYuNzUgMzIuMzEzLDYuNzUgMzIuMzc1LDYuODc1IEMzMi41LDYuOTM4IDMyLjUsNy4wNjMgMzIuNSw3LjE4OCBMMzIuNSw4LjA2MyBDMzIuNSw4LjMxMyAzMi40MzcsOC41MDEgMzIuMzc1LDguNjI2IEMzMi4yNSw4LjgxNCAzMi4xMjUsOC45MzkgMzIuMDYyLDguOTM5IEMzMS45OTksOS4wMDIgMzEuOTM3LDkuMDAyIDMxLjg3NCw5LjAwMiBMMjcuNDk5LDEwLjM3NyBDMjcuMTI0LDEwLjU2NSAyNi42ODYsMTAuNjkgMjYuMTI0LDEwLjYyNyBMMjMuNDk5LDEwLjYyNyBMMzguMDYyLDI5LjI1MiBMNTEuMzEyLDE2Ljc1MiBMNDMuOTM3LDE2Ljc1MiBMNDIuODEyLDE2LjMxNCBMNDEuMzc0LDE0Ljg3NiBMNDEuMTg2LDE0LjYyNiBDNDEuMDYxLDE0LjQzOCA0MC45OTgsMTQuMjUxIDQwLjg3MywxNC4wMDEgQzQwLjc0OCwxMy42ODggNDAuNzQ4LDEzLjQzOCA0MC43NDgsMTMuMTg4IEw0MS4xODYsMTIuODEzIEw2OS4yNDksMTIuODEzIEM2OS4zMTIsMTIuODEzIDY5LjM3NCwxMi44MTMgNjkuNDM3LDEyLjg3NiBDNjkuNSwxMi45MzkgNjkuNTYyLDEzLjA2NCA2OS42MjUsMTMuMTg5IEw2OS42MjUsMTQuMDY0IEM2OS42MjUsMTQuNTY0IDY5LjUsMTQuOTM5IDY5LjI1LDE1LjI1MiBMNjguMTg3LDE2LjQ0IEM2Ny43NDksMTYuNzUzIDY3LjM3NCwxNi44NzggNjYuOTk5LDE2Ljg3OCBMNTguNDk5LDE2Ljg3OCBDNDcuNjg2LDI3LjA2NiA0Mi4wNjEsMzIuMzc4IDQxLjYyNCwzMi44MTYgTDQxLjQzNiwzMy4wMDQgQzQxLjI0OCwzMy4xOTIgNDEuMTg2LDMzLjMxNyA0MS4wNjEsMzMuNTA0IEM0MC45MzYsMzMuNjI5IDQwLjkzNiwzMy44MTcgNDAuOTM2LDMzLjk0MiBMNDAuOTM2LDQ2Ljg4IEM0MC45MzYsNDcuNTA1IDQxLjEyNCw0Ny44MTggNDEuNTYxLDQ3LjgxOCBMNTAuODc0LDQ3LjgxOCBDNTAuOTM3LDQ3LjgxOCA1MS4wNjIsNDcuODgxIDUxLjE4Nyw0Ny45NDMgQzUxLjI1LDQ4LjAwNiA1MS4zMTIsNDguMTMxIDUxLjMxMiw0OC4yNTYgTDUxLjMxMiw1MS45NDQgTDE4LjMxMiw1MS45NDQgTDE4LjMxMiw0OC4zODEgQzE4LjMxMiw0OC4wMDYgMTguNSw0Ny44MTggMTguOTM3LDQ3LjgxOCBDMjAuMjUsNDcuNjkzIDIzLjI1LDQ3LjYzIDI4LjA2Miw0Ny42MyBMMjguMjUsNDcuNjMgQzI4LjM3NSw0Ny41NjcgMjguNSw0Ny41MDUgMjguNTYzLDQ3LjMxNyBDMjguNjg4LDQ3LjEyOSAyOC43NTEsNDYuODc5IDI4Ljc1MSw0Ni41NjcgTDI4Ljc1MSwzNC4yNTQgQzI4Ljc1MSwzMy42OTEgMjguNTAxLDMzLjE5MSAyOC4wNjMsMzIuNjI5IEw5LjY4OCwxMC42MjkgTDIuNTYzLDEwLjYyOSBMMS4zNzUsMTAuMDA0IEwxLjE4Nyw5Ljg3OSBMMC44NzQsOS41NjYgQzAuNjg2LDkuMzc4IDAuNTYxLDkuMTkxIDAuMzc0LDguODc4IEwwLDcuNjg4IFogTTc2LjE4OCwwLjY4OCBMNzguODEzLDM3LjI1MSBMODIuNjg4LDM3LjQzOSBMODguMDAxLDEuMTg5IEw3Ni4xODgsMC42ODggWiBNNzcsNDkuNTYzIEw4NC4wNjMsNDkuODEzIEw4NC4zMTMsNDIuNzUgTDc3LjI1LDQyLjUgTDc3LDQ5LjU2MyBaIiBpZD0iU2hhcGUiIHNrZXRjaDp0eXBlPSJNU1NoYXBlR3JvdXAiPjwvcGF0aD4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg=="); } .auth0-lock-social-button[data-provider^=yammer] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjYycHgiIGhlaWdodD0iNTNweCIgdmlld0JveD0iMCAwIDYyIDUzIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+eWFtbWVyPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc2tldGNoOnR5cGU9Ik1TUGFnZSI+CiAgICAgICAgPGcgaWQ9InlhbW1lciIgc2tldGNoOnR5cGU9Ik1TTGF5ZXJHcm91cCIgZmlsbD0iI0ZGRkZGRiI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0wLjUsMy41IEMwLjM3NSw0LjI1IDAuNSw0LjkzOCAwLjc1LDUuNjI1IEM1LjEyNSwxNi4zMTMgOS41NjMsMjcgMTQsMzcuNzUgQzE0LjEyNSwzOC4wNjMgMTQuMzEzLDM4LjM3NSAxNC4zNzUsMzguNzUgQzE0LjA2MiwzOS41IDEzLjYyNSw0MC4yNSAxMy4zNzUsNDEuMDYzIEMxMi43NSw0Mi42MjYgMTIsNDQuMjUxIDEwLjYyNSw0NS4zNzYgQzkuNDM3LDQ2LjM3NiA3LjgxMiw0Ni43NTEgNi4yNSw0Ni42ODkgQzUuNDM3LDQ2LjY4OSA0LjU2Miw0Ni40MzkgMy43NSw0Ni42ODkgQzIuNjg3LDQ3LjAwMiAxLjg3NSw0Ny45MzkgMS42ODcsNDkuMDAyIEMxLjQzNyw1MC41MDIgMi41LDUyLjA2NSA0LDUyLjMxNSBDNi40MzgsNTIuNjI4IDksNTIuNjI4IDExLjM3NSw1MS44NzcgQzEzLjE4OCw1MS4zMTQgMTQuODEzLDUwLjEyNyAxNiw0OC42MjcgQzE3LjYyNSw0Ni41NjQgMTguNjg4LDQ0LjA2NCAxOS42MjUsNDEuNjg5IEMyNC41LDI5LjU2NCAyOS4zMTMsMTcuNDM5IDM0LjI1LDUuMzc2IEMzNC43NSwzLjgxMyAzMy44NzUsMS45MzggMzIuMzc1LDEuNDM4IEMzMC44NzUsMC44MTMgMjksMS41NjMgMjguMzEyLDMuMDAxIEMyNC45OTksMTIuMDAxIDIxLjQ5OSwyMS4wMDEgMTguMDYyLDI5LjkzOSBDMTguMDYyLDMwLjEyNyAxNy45MzcsMzAuMjUyIDE3LjgxMiwzMC4zNzcgTDYuOTM3LDIuODE0IEM2LjM3NCwxLjU2NCA1LjA2MiwwLjc1MSAzLjc0OSwwLjgxNCBDMi4xODYsMC44MTQgMC43NDksMi4wMDIgMC40OTksMy41MDIgTDAuNSwzLjUgWiBNNTAuNTYzLDcuMjUgQzQ5LjEyNSw4IDQ3Ljg3NSw5IDQ2LjUsOS44NzUgQzQ0LjE4NywxMS41IDQxLjkzNywxMy4xMjUgMzkuNzUsMTQuOTM4IEMzOC41LDE1LjkzOCAzNy4yNSwxNi45MzggMzYuMTg3LDE4LjE4OCBDMzUuOTk5LDE4LjUwMSAzNS42ODcsMTguODEzIDM1LjY4NywxOS4yNTEgQzM1LjY4NywxOS40MzkgMzYsMTkuNTAxIDM2LjE4NywxOS41NjQgQzM3LDE5LjY4OSAzNy44NzUsMTkuNDM5IDM4LjY4NywxOS4yNTEgQzQwLjUsMTguNjg4IDQyLjE4NywxOC4wMDEgNDMuOTM3LDE3LjMxMyBDNDcuMTI1LDE1LjkzOCA1MC4yNSwxNC4zNzUgNTMuMjUsMTIuNzUgQzU0LjUsMTEuOTM3IDU0Ljg3NSwxMC4xODcgNTQuMjUsOC44NzUgQzUzLjYyNSw3LjU2MyA1MS45MzcsNi44MTIgNTAuNTYyLDcuMjUgTDUwLjU2Myw3LjI1IFogTTU2LjM3NSwyNC4yNSBDNTIuODc1LDI0LjU2MyA0OS40MzcsMjUgNDYsMjUuNjI1IEM0NC41LDI1Ljg3NSA0MywyNi4xODggNDEuNTYyLDI2LjY4OCBDNDEuMDYyLDI2Ljg3NiA0MC40OTksMjcuMDAxIDQwLjE4NywyNy41MDEgQzQwLjM3NSwyNy43NTEgNDAuNTYyLDI4LjAwMSA0MC44MTIsMjguMTI2IEM0MS41LDI4LjUwMSA0Mi4xODcsMjguNjg5IDQyLjkzNywyOC44NzYgQzQ0LjgxMiwyOS4zMTQgNDYuNzUsMjkuNTY0IDQ4LjY4NywyOS43NTEgQzUyLDMwLjA2NCA1NS4yNSwzMC4xMjYgNTguNSwzMC4xODkgQzYwLDMwLjI1MiA2MS4zNzUsMjkuMDAxIDYxLjUsMjcuNTAxIEM2MS43NSwyNi4wMDEgNjAuNjg3LDI0LjM3NiA1OS4xMjUsMjQuMDYzIEM1OC4xODcsMjQgNTcuMzEyLDI0LjE4OCA1Ni4zNzUsMjQuMjUxIEw1Ni4zNzUsMjQuMjUgWiBNMzUuOTM4LDM1LjA2MyBDMzUuNjI1LDM1LjE4OCAzNS42MjUsMzUuNjI2IDM1LjgxMywzNS44MTMgQzM2LjEyNiwzNi40MzggMzYuNjI2LDM2Ljg3NiAzNy4xMjYsMzcuMzc2IEMzOS4wMDEsMzkuMTg5IDQxLjA2NCw0MC43NTEgNDMuMTI2LDQyLjMxNCBDNDUuMzc2LDQzLjkzOSA0Ny42ODksNDUuNTY0IDUwLjA2NCw0Ny4wNjQgQzUwLjc1Miw0Ny41NjQgNTEuNjg5LDQ3LjU2NCA1Mi41MDIsNDcuMjUyIEM1My42MjcsNDYuODc3IDU0LjUwMiw0NS43NTIgNTQuNTY1LDQ0LjUwMiBDNTQuNjI4LDQzLjM3NyA1NC4wMDIsNDIuMTI3IDUyLjk0LDQxLjYyNyBDNDkuMzE1LDM5Ljc1MiA0NS42MjcsMzcuOTM5IDQxLjgxNSwzNi40MzkgQzQwLjM3NywzNS44NzYgMzguODc3LDM1LjMxNCAzNy4zMTUsMzUuMDY0IEMzNi44MTUsMzUuMDAxIDM2LjM3NywzNC45MzkgMzUuOTQsMzUuMDY0IEwzNS45MzgsMzUuMDYzIFoiIGlkPSJTaGFwZSIgc2tldGNoOnR5cGU9Ik1TU2hhcGVHcm91cCI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"); } .auth0-lock-social-button[data-provider^=yandex] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjI4cHgiIGhlaWdodD0iNjBweCIgdmlld0JveD0iMCAwIDI4IDYwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+eWFuZGV4PC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc2tldGNoOnR5cGU9Ik1TUGFnZSI+CiAgICAgICAgPGcgaWQ9InlhbmRleCIgc2tldGNoOnR5cGU9Ik1TTGF5ZXJHcm91cCIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTEuMDAwMDAwLCAwLjAwMDAwMCkiIGZpbGw9IiNGRkZGRkYiPgogICAgICAgICAgICA8cGF0aCBkPSJNMjcuNSwwLjYyNSBDMjgsMC42MjUgMjguMzEzLDAuODc1IDI4LjMxMywxLjQzOCBMMjguMzEzLDU4Ljc1MSBDMjguMzEzLDU5LjEyNiAyOC4xMjUsNTkuMzc2IDI3LjY4OCw1OS4zNzYgTDIzLDU5LjM3NiBDMjIuNjg3LDU5LjM3NiAyMi40MzcsNTkuMDYzIDIyLjQzNyw1OC44MTMgTDIyLjQzNywzNy42MjUgTDE4LjYyNCwzNy42MjUgTDguMDYxLDU4LjgxMyBDNy45MzYsNTkuMTg4IDcuNjIzLDU5LjM3NiA3LjE4Niw1OS4zNzYgTDEuNzQ4LDU5LjM3NiBDMS4xMjMsNTkuMzc2IDAuNzQ4LDU4LjgxMyAxLjEyMyw1OC4xMjYgTDEyLjgxMSwzNi41MDEgQzYuNTYxLDMzLjY4OCAzLjA2MSwyOC4wMDEgMy4wNjEsMjAuMjUxIEMzLjA2MSw3LjMxMyAxMC4yNDksMC42MjYgMTguODExLDAuNjI2IEwyNy40OTksMC42MjYgTDI3LjUsMC42MjUgWiBNMjIuNDM4LDMyLjU2MyBMMjIuNDM4LDUuNjg4IEwxOC41NjMsNS42ODggQzEzLjkzOCw1LjY4OCA5LjM3NSw5LjYyNiA5LjM3NSwxOS40MzggQzkuMzc1LDI4LjgxMyAxNC4yNSwzMi41NjMgMTkuMjUsMzIuNTYzIEwyMi40MzgsMzIuNTYzIEwyMi40MzgsMzIuNTYzIFoiIGlkPSJTaGFwZSIgc2tldGNoOnR5cGU9Ik1TU2hhcGVHcm91cCI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"); background-size: 30%; } .auth0-lock-social-button[data-provider^=weibo] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjgwcHgiIGhlaWdodD0iNjRweCIgdmlld0JveD0iMCAwIDgwIDY0IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+d2VpYnU8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz48L2RlZnM+CiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiBza2V0Y2g6dHlwZT0iTVNQYWdlIj4KICAgICAgICA8ZyBpZD0id2VpYnUiIHNrZXRjaDp0eXBlPSJNU0xheWVyR3JvdXAiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xLjAwMDAwMCwgMC4wMDAwMDApIiBmaWxsPSIjRkZGRkZGIj4KICAgICAgICAgICAgPHBhdGggZD0iTTEsNDMgQzEsNDcuMTg4IDIuNjI1LDUwLjkzOCA1LjkzOCw1NC4xODggQzkuMTg4LDU3LjQzOCAxMy4zMTMsNTkuODc2IDE4LjMxMyw2MS41NjMgQzIzLjMxMyw2My4xODggMjguNTYzLDY0LjAwMSAzNC4xMjYsNjQuMDAxIEMzOS4zMTQsNjQuMDAxIDQ0LjE4OSw2My4zMTMgNDguNzUxLDYxLjg3NiBDNTMuMzc2LDYwLjUwMSA1Ny4xODksNTguNjg4IDYwLjE4OSw1Ni41MDEgQzYzLjE4OSw1NC4zMTQgNjUuNTY0LDUxLjkzOCA2Ny4zMTQsNDkuMzEzIEM2OS4wNjQsNDYuNjg4IDY5LjkzOSw0NC4xMjUgNjkuOTM5LDQxLjYyNSBDNjkuOTM5LDM4Ljg3NSA2OS4wMDEsMzYuNTYyIDY3LjEyNiwzNC43NSBDNjUuMjUxLDMyLjkzOCA2My4wMDEsMzEuNjI1IDYwLjMxMywzMC44MTIgQzU5Ljg3NSwzMC42ODcgNTkuNTYzLDMwLjU2MiA1OS4zNzUsMzAuNDM3IEM1OS4yNSwzMC4zNzQgNTkuMDYyLDMwLjE4NyA1OC44NzUsMjkuODc0IEM1OC42ODcsMjkuNjI0IDU4Ljc1LDI5LjI0OSA1OS4wNjMsMjguODExIEM1OS43NTEsMjcuMTIzIDYwLjA2MywyNS41NjEgNjAuMDYzLDI0LjI0OCBDNjAuMDYzLDIyLjk5OCA1OS43NSwyMS44NzMgNTkuMTI1LDIwLjkzNSBDNTcuNzUsMTkuMTIyIDU1LjUsMTguMjQ3IDUyLjMxMiwxOC4yNDcgQzQ5LjE4NywxOC4yNDcgNDUuNTYyLDE5LjEyMiA0MS40MzcsMjAuODEgTDQwLjgxMiwyMS4wNiBDNDAuNDM3LDIxLjE4NSA0MC4wNjIsMjEuMTg1IDM5LjgxMiwyMC45OTcgQzM5LjQ5OSwyMC44NzIgMzkuNDM3LDIwLjQ5NyAzOS41NjIsMTkuOTM0IEM0MC4xMjUsMTguMTg0IDQwLjM3NSwxNi42MjEgNDAuMzc1LDE1LjMwOSBDNDAuMzc1LDEzLjMwOSAzOS44MTIsMTEuODA5IDM4LjY4NywxMC42ODQgQzM3LjU2Miw5LjU1OSAzNS45OTksOC45MzQgMzQuMDYyLDguOTM0IEMzMi4zMTIsOC45MzQgMzAuMjQ5LDkuNDM0IDI3Ljg3NCwxMC40MzQgQzIyLjgxMSwxMi4zNzIgMTcuNzQ5LDE1Ljg3MiAxMi43NDksMjAuODA5IEM0LjkzNiwyOC43NDcgMC45OTksMzYuMTIyIDAuOTk5LDQyLjk5NyBMMSw0MyBaIE05LDQ2LjA2MyBDOC45MzcsNDUuNjg4IDguOTM3LDQ1LjMxMyA4LjkzNyw0NC45MzggQzguOTM3LDQyLjU2MyA5Ljc1LDQwLjE4OCAxMS4zNzUsMzcuOTM4IEMxMy4yNSwzNS4zNzUgMTUuOTM4LDMzLjI1IDE5LjQzOCwzMS41IEMyMi45MzgsMjkuNzUgMjYuODEzLDI4LjYyNSAzMS4xMjYsMjguMjUgQzMyLjQzOSwyOC4xMjUgMzMuNjg5LDI4LjA2MiAzNC45MzksMjguMDYyIEMzOS45MzksMjguMDYyIDQ0LjM3NywyOS4wNjIgNDguMzc3LDMxLjE4NyBDNTMuMjUyLDMzLjc1IDU1Ljk0LDM3LjEyNSA1Ni4zNzcsNDEuNDM3IEM1Ni4zNzcsNDEuODEyIDU2LjQ0LDQyLjE4NyA1Ni40NCw0Mi41NjIgQzU2LjQ0LDQ2LjM3NSA1NC40NCw0OS45MzcgNTAuNTY1LDUzLjEyNSBDNDYuMTksNTYuNjI1IDQwLjc1Miw1OC42ODggMzQuMTksNTkuMzEzIEMzMi44NzcsNTkuNDM4IDMxLjYyNyw1OS41MDEgMzAuMzc3LDU5LjUwMSBDMjUuMzc3LDU5LjUwMSAyMC45MzksNTguNTAxIDE3LjAwMiw1Ni4zNzYgQzEyLjA2NCw1My44MTMgOS40MzksNTAuMzc2IDkuMDAyLDQ2LjA2MyBMOSw0Ni4wNjMgWiBNMTkuMjUsNTAuMDYzIEMyMC40MzgsNTIuODEzIDIyLjU2Myw1NC42MjYgMjUuNjg4LDU1LjYyNiBDMjcuMTI2LDU2LjA2NCAyOC41NjMsNTYuMzE0IDMwLjAwMSw1Ni4zMTQgQzMxLjg3Niw1Ni4zMTQgMzMuNzUxLDU1LjkzOSAzNS42MjYsNTUuMTI2IEMzOC45MzksNTMuNjg4IDQxLjI1MSw1MS41MDEgNDIuNjI2LDQ4LjQzOCBDNDMuMjUxLDQ3LjA2MyA0My41NjQsNDUuNjg4IDQzLjU2NCw0NC4zMTMgQzQzLjU2NCw0Mi44MTMgNDMuMTg5LDQxLjQzOCA0Mi41MDEsNDAuMDYzIEM0MS4wNjMsMzcuNDM4IDM4Ljc1MSwzNS42ODggMzUuNTAxLDM0LjgxMyBDMzQuMzc2LDM0LjUgMzMuMTg4LDM0LjM3NSAzMi4wNjMsMzQuMzc1IEMzMC4wNjMsMzQuMzc1IDI4LjEyNSwzNC44MTMgMjYuMTg4LDM1LjYyNSBDMjMuMTI1LDM3IDIwLjg3NSwzOS4wNjMgMTkuNTYzLDQxLjgxMyBDMTguODEzLDQzLjMxMyAxOC40MzgsNDQuODEzIDE4LjQzOCw0Ni4yNTEgQzE4LjQzOCw0Ny41NjQgMTguNjg4LDQ4LjgxNCAxOS4yNTEsNTAuMDY0IEwxOS4yNSw1MC4wNjMgWiBNMjIuODEzLDQ4LjgxMyBDMjIuNzUsNDguNTYzIDIyLjY4OCw0OC4zMTMgMjIuNjg4LDQ4IEMyMi42ODgsNDcuMjUgMjIuOTM4LDQ2LjU2MiAyMy4zNzYsNDUuODc1IEMyNC4wMDEsNDQuOTM3IDI0Ljg3Niw0NC4yNSAyNi4wMDEsNDMuODc1IEMyNi41NjQsNDMuNjg3IDI3LjEyNiw0My41NjIgMjcuNjI2LDQzLjU2MiBDMjguMTg5LDQzLjU2MiAyOC43NTEsNDMuNjg3IDI5LjMxNCw0My45MzcgQzMwLjMxNCw0NC4zMTIgMzAuOTM5LDQ1LjA2MiAzMS4xODksNDYuMDYyIEMzMS4zMTQsNDYuNDM3IDMxLjM3Nyw0Ni43NSAzMS4zNzcsNDcuMDYyIEMzMS4zNzcsNDcuNzUgMzEuMTg5LDQ4LjQzNyAzMC43NTIsNDkuMDYyIEMzMC4xMjcsNTAuMTI1IDI5LjE4OSw1MC44MTIgMjguMDAyLDUxLjE4NyBDMjcuNTAyLDUxLjM3NSAyNy4wMDIsNTEuNDM3IDI2LjUwMiw1MS40MzcgQzI1Ljg3Nyw1MS40MzcgMjUuMzE0LDUxLjMxMiAyNC43NTIsNTEuMDYyIEMyMy43NTIsNTAuNjI0IDIzLjA2NCw0OS44NzQgMjIuODE0LDQ4LjgxMiBMMjIuODEzLDQ4LjgxMyBaIE0zMS44NzUsNDMuNzUgTDMxLjg3NSw0My4zNzUgQzMxLjg3NSw0My4xMjUgMzEuOTM4LDQyLjg3NSAzMi4wNjMsNDIuNjI1IEMzMi4yNTEsNDIuMjUgMzIuNTYzLDQyIDMzLjA2Myw0MS44MTIgQzMzLjUwMSw0MS42ODcgMzMuODc2LDQxLjY4NyAzNC4yNTEsNDEuODEyIEMzNC42ODksNDEuOTM3IDM0LjkzOSw0Mi4yNSAzNS4wNjQsNDIuNjI1IEMzNS4xODksNDMgMzUuMTI3LDQzLjM3NSAzNC45MzksNDMuNzUgQzM0LjY4OSw0NC4xODggMzQuMzc2LDQ0LjQzOCAzMy44NzYsNDQuNjI1IEMzMy42ODgsNDQuNjg4IDMzLjUwMSw0NC43NSAzMy4zMTMsNDQuNzUgQzMzLjEyNSw0NC43NSAzMi44NzUsNDQuNjg3IDMyLjY4OCw0NC42MjUgQzMyLjI1LDQ0LjQzNyAzMiw0NC4xODcgMzEuODc1LDQzLjc1IEwzMS44NzUsNDMuNzUgWiBNNTIuMzc1LDQuMDYzIEM1Mi41NjMsNC44NzYgNTMsNS41MDEgNTMuNjg4LDUuOTM4IEM1NC4xODgsNi4zMTMgNTQuNzUxLDYuNDM4IDU1LjMxMyw2LjQzOCBDNTUuNTYzLDYuNDM4IDU1Ljc1MSw2LjQzOCA1Ni4wMDEsNi4zNzUgQzU3LjA2NCw2LjE4NyA1OC4wNjQsNi4wNjIgNTkuMTI2LDYuMDYyIEM2MC42MjYsNi4wNjIgNjIuMTI2LDYuMzEyIDYzLjU2NCw2Ljc1IEM2Ni4xMjcsNy41NjMgNjguMzE0LDguOTM4IDcwLjEyNywxMC45MzggQzcxLjk0LDEyLjkzOCA3My4xMjcsMTUuMjUxIDczLjY5LDE3LjkzOCBDNzMuODc4LDE5LjAwMSA3My45NCwyMC4wMDEgNzMuOTQsMjEuMDAxIEM3My45NCwyMi41NjQgNzMuNzUyLDI0LjAwMSA3My4yNTIsMjUuNTAxIEw3My4yNTIsMjUuNTY0IEM3My4xODksMjUuODE0IDczLjEyNywyNi4xODkgNzMuMTI3LDI2LjUwMiBDNzMuMTI3LDI2Ljk0IDczLjI1MiwyNy4zNzcgNzMuNDQsMjcuODc3IEM3My44MTUsMjguNTY1IDc0LjM3OCwyOS4wNjUgNzUuMTksMjkuMzE1IEM3NS41MDMsMjkuMzc4IDc1LjgxNSwyOS40NCA3Ni4xMjgsMjkuNDQgQzc2LjYyOCwyOS40NCA3Ny4wNjYsMjkuMzE1IDc3LjU2NiwyOS4xMjcgQzc4LjI1NCwyOC43NTIgNzguNzU0LDI4LjE4OSA3OS4wMDQsMjcuMzc3IEw3OS4wMDQsMjcuMzE0IEM3OS42OTIsMjUuMzE0IDgwLjA2NywyMy4yNTEgODAuMDY3LDIxLjA2NCBDODAuMDY3LDE5LjYyNiA3OS44NzksMTguMTg5IDc5LjU2NywxNi42ODkgQzc4LjgxNywxMy4wMDEgNzcuMTkyLDkuNzUxIDc0LjYyOSw2LjkzOSBDNzIuMDY2LDQuMTI3IDY5LjAwNCwyLjEyNiA2NS40NDEsMC45MzkgQzYzLjM3OCwwLjMxNCA2MS4yNTMsMC4wMDEgNTkuMDY2LDAuMDAxIEM1Ny42MjgsMC4wMDEgNTYuMTI4LDAuMTI2IDU0LjY5MSwwLjQzOSBDNTMuODc4LDAuNjg5IDUzLjI1MywxLjEyNyA1Mi44MTYsMS44MTQgQzUyLjUwMywyLjMxNCA1Mi4zMTYsMi44MTQgNTIuMzE2LDMuMzc3IEM1Mi4zMTYsMy42MjcgNTIuMzc5LDMuODE1IDUyLjM3OSw0LjA2NSBMNTIuMzc1LDQuMDYzIFogTTU0LjkzOCwxNC4wNjMgQzU1LjEyNiwxNC43NTEgNTUuNTAxLDE1LjMxMyA1Ni4xMjYsMTUuNjg4IEM1Ni41MDEsMTYuMDAxIDU3LjAwMSwxNi4xMjYgNTcuNDM5LDE2LjEyNiBDNTcuNjI3LDE2LjEyNiA1Ny44MTQsMTYuMTI2IDU4LjAwMiwxNi4wNjMgQzU4LjQ0LDE2IDU4Ljg3NywxNS45MzggNTkuMzE1LDE1LjkzOCBDNjAuNjksMTUuOTM4IDYxLjgxNSwxNi41MDEgNjIuNzUzLDE3LjYyNiBDNjMuNjI4LDE4LjU2NCA2NC4xMjgsMTkuNjI2IDY0LjEyOCwyMC44MTQgQzY0LjEyOCwyMS4zMTQgNjQuMDAzLDIxLjg3NyA2My44NzgsMjIuNDM5IEM2My43NTMsMjIuNzUyIDYzLjc1MywyMy4wMDIgNjMuNzUzLDIzLjMxNCBDNjMuNzUzLDIzLjY4OSA2My44MTYsMjQuMDY0IDY0LjAwMywyNC40MzkgQzY0LjMxNiwyNS4wNjQgNjQuODE2LDI1LjUwMiA2NS41MDMsMjUuNzUyIEM2NS43NTMsMjUuODE1IDY2LjA2NiwyNS44NzcgNjYuMzc4LDI1Ljg3NyBDNjYuNzUzLDI1Ljg3NyA2Ny4xMjgsMjUuNzUyIDY3LjUwMywyNS41NjQgQzY4LjEyOCwyNS4yNTEgNjguNTY2LDI0Ljc1MSA2OC43NTMsMjQuMDY0IEM2OS4xMjgsMjMuMDY0IDY5LjMxNiwyMi4wMDEgNjkuMzE2LDIxLjAwMSBDNjkuMzE2LDIwLjMxMyA2OS4yNTMsMTkuNjI2IDY5LjEyOCwxOC44NzYgQzY4LjY5LDE3LjA2MyA2Ny44NzgsMTUuNTAxIDY2LjY5LDE0LjA2MyBDNjQuNjI3LDExLjgxMyA2Mi4xOSwxMC42ODggNTkuMzE1LDEwLjY4OCBDNTguNTY1LDEwLjY4OCA1Ny43NTIsMTAuNzUxIDU2Ljk0LDEwLjkzOCBDNTYuMTksMTEuMTI2IDU1LjYyNywxMS41MDEgNTUuMjUyLDEyLjEyNiBDNTUuMDAyLDEyLjU2NCA1NC44NzcsMTMuMDAxIDU0Ljg3NywxMy40MzkgQzU0Ljg3NywxMy42ODkgNTQuOTQsMTMuODc3IDU0Ljk0LDE0LjA2NCBMNTQuOTM4LDE0LjA2MyBaIiBpZD0iU2hhcGUiIHNrZXRjaDp0eXBlPSJNU1NoYXBlR3JvdXAiPjwvcGF0aD4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg=="); } .auth0-lock-social-button[data-provider^=evernote] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjU0cHgiIGhlaWdodD0iNjVweCIgdmlld0JveD0iMCAwIDU0IDY1IiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHhtbG5zOnNrZXRjaD0iaHR0cDovL3d3dy5ib2hlbWlhbmNvZGluZy5jb20vc2tldGNoL25zIj4KICAgIDwhLS0gR2VuZXJhdG9yOiBTa2V0Y2ggMy40ICgxNTU4OCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+ZXZlcm5vdGU8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz48L2RlZnM+CiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiBza2V0Y2g6dHlwZT0iTVNQYWdlIj4KICAgICAgICA8ZyBpZD0iZXZlcm5vdGUiIHNrZXRjaDp0eXBlPSJNU0xheWVyR3JvdXAiIGZpbGw9IiNGRkZGRkYiPgogICAgICAgICAgICA8cGF0aCBkPSJNNy41NDk1MTY1N2UtMTUsMjAuMzc1IEM3LjU0OTUxNjU3ZS0xNSwyMS4xODggMC4wNjMsMjIuMjUgMC4yNSwyMy42ODggQzAuNSwyNS4zNzYgMSwyOC4xODggMS43NSwzMi4xODggQzIuNTYzLDM2LjE4OCAzLjMxMywzOC45MzggNC4wNjMsNDAuNDM4IEM0LjU2Myw0MS42ODggNS4zNzYsNDIuNTAxIDYuMzc2LDQzLjAwMSBDOS40MzksNDQuMzE0IDEzLjYyNiw0NS4zMTQgMTkuMDY0LDQ2LjAwMSBDMjAuMzc3LDQ2LjMxNCAyMS41MDIsNDYuNTAxIDIyLjUwMiw0Ni41MDEgTDIyLjk0LDQ2LjUwMSBDMjQuMDAzLDQ2LjQzOCAyNC44MTUsNDUuOTM4IDI1LjI1Myw0NC44NzYgTDI1LjgxNiw0My4zMTMgQzI2LjU2Niw0MS4wNjMgMjYuOTQxLDM4LjUgMjYuOTQxLDM1LjYyNSBDMjYuOTQxLDM1LjU2MiAyNy4wMDQsMzUuNSAyNy4xMjksMzUuNSBDMjcuMTkyLDM1LjUgMjcuMjU0LDM1LjU2MyAyNy4yNTQsMzUuNjI1IEMyNy4yNTQsMzkuODc1IDI4LjM3OSw0Mi4zNzUgMzAuNjI5LDQzLjI1IEMzMi4wMDQsNDMuNjg4IDM0LjUwNCw0NC4xMjUgMzguMjU0LDQ0LjUgQzM5Ljg3OSw0NC43NSA0MS4xMjksNDUuNDM4IDQxLjg3OSw0Ni41NjMgQzQyLjY5Miw0Ny42ODggNDMuMDY3LDQ5Ljg3NiA0My4wNjcsNTMuMTI2IEM0My4wNjcsNTUuMjUxIDQyLjc1NCw1Ni41NjQgNDIuMDY3LDU3LjE4OSBDNDEuMzc5LDU3Ljc1MiAzOS44MTcsNTguMDAyIDM3LjM3OSw1OC4wMDIgTDM1LjMxNiw1OC4wMDIgQzM1LjAwMyw1OC4wMDIgMzQuNTAzLDU4LjAwMiAzMy44NzgsNTcuODc3IEMzMy4yNTMsNTcuODE0IDMyLjg3OCw1Ny42ODkgMzIuNzUzLDU3LjQzOSBDMzIuNTY1LDU3LjI1MSAzMi40NCw1Ni45MzkgMzIuMjUzLDU2LjU2NCBDMzIuMDY2LDU2LjE4OSAzMi4wMDMsNTUuNjg5IDMyLjAwMyw1NS4wNjQgQzMyLjEyOCw1NC44MTQgMzIuMTI4LDU0LjU2NCAzMi4wNjYsNTQuMzc2IEMzMi4wMDMsNTQuMTI2IDMyLjA2Niw1My45MzggMzIuMzE2LDUzLjc1MSBDMzIuNTY2LDUzLjYyNiAzMi42OTEsNTMuNTAxIDMyLjY5MSw1My4zNzYgQzMyLjYyOCw1My4zMTMgMzIuODE2LDUzLjE4OCAzMy4xOTEsNTMuMTI2IEMzMy41NjYsNTMuMDY0IDMzLjc1NCw1My4wMDEgMzMuNzU0LDUzLjAwMSBDMzMuNzU0LDUyLjkzOCAzMy45NDIsNTIuODc2IDM0LjM3OSw1Mi44NzYgTDM2LjMxNyw1Mi44NzYgQzM2LjU2Nyw1Mi44NzYgMzYuNjkyLDUyLjgxMyAzNi43NTUsNTIuNjg4IEMzNi43NTUsNTIuNTYzIDM2Ljc1NSw1Mi4zMTMgMzYuNjkyLDUxLjkzOCBDMzYuNTY3LDUxLjUgMzYuNTY3LDUxLjEyNSAzNi41NjcsNTAuNzUgQzM2LjU2Nyw1MC41IDM2LjU2Nyw1MC4xODcgMzYuNjMsNDkuODc1IEMzNi42OTMsNDkuNjI1IDM2Ljc1NSw0OS4zNzUgMzYuODE4LDQ5LjE4NyBDMzYuODgxLDQ4Ljk5OSAzNi45NDMsNDguODc0IDM3LjAwNiw0OC42ODcgQzM3LjA2OSw0OC41NjIgMzcuMDA2LDQ4LjQzNyAzNi45NDMsNDguMzc0IEMzNi44OCw0OC4zMTEgMzYuNzU1LDQ4LjMxMSAzNi42Myw0OC4zMTEgTDM0LjgxNyw0OC4zMTEgQzMzLjc1NCw0OC4zMTEgMzIuODc5LDQ4LjMxMSAzMi4yNTQsNDguMzc0IEMzMS4yNTQsNDguNDM3IDMwLjMxNiw0OC43NDkgMjkuMjU0LDQ5LjE4NyBDMjguMjU0LDQ5LjY4NyAyNy41NjYsNTAuNDM3IDI3LjE5MSw1MS42MjUgQzI2Ljc1Myw1Mi43NSAyNi41NjYsNTQuMjUgMjYuNTY2LDU2LjE4OCBDMjYuNTY2LDU5LjYyNiAyNy4zNzksNjEuODc2IDI4Ljk0MSw2My4wMDEgQzMwLjU2Niw2NC4wNjQgMzMuNjkxLDY0LjYyNiAzOC4yNTQsNjQuNjI2IEMzOS45NDIsNjQuNjI2IDQxLjE5Miw2NC41NjMgNDIuMDA0LDY0LjUwMSBDNDIuODc5LDY0LjQzOCA0My43NTQsNjQuMjUxIDQ0Ljc1NCw2NC4wMDEgQzQ1LjY5Miw2My42ODggNDYuNTA0LDYzLjE4OCA0Ny4wNjcsNjIuNTAxIEM0Ny42Myw2MS44MTQgNDguMjU1LDYwLjkzOCA0OC44MTcsNTkuODEzIEM0OS40NDIsNTguNjg4IDUwLjAwNSw1Ny4xODggNTAuNjMsNTUuMzc1IEM1MS43NTUsNTEuODc1IDUyLjY5Myw0Ni41IDUzLjM4LDM5LjEyNSBDNTMuNTA1LDM4IDUzLjU2OCwzNi41IDUzLjU2OCwzNC42MjUgQzUzLjU2OCwzMi4xMjUgNTMuNDQzLDI5IDUzLjI1NSwyNS4xODcgQzUyLjk0MiwxOC41NjIgNTIuNTA1LDE0LjEyNCA1Mi4xMywxMS43NDkgQzUxLjYzLDkuNDM2IDUwLjUwNSw3Ljk5OSA0OC42OTIsNy40MzYgQzQ3LjMxNyw2LjkzNiA0NC41NjcsNi40MzYgNDAuNDQyLDUuOTM2IEMzOC45NDIsNS43NDggMzcuMDA0LDUuNjIzIDM0Ljc1NCw1LjYyMyBDMzMuODE2LDUuNjIzIDMyLjgxNiw1LjYyMyAzMS42OTEsNS42ODYgQzMxLjM3OCwzLjY4NiAzMC40NDEsMi4zNzMgMjguODE2LDEuNjg2IEMyNy4xMjgsMS4wNjEgMjUuMDY2LDAuNjg2IDIyLjUwMywwLjYyMyBMMjEuMzE1LDAuNjIzIEMxOS41MDIsMC42MjMgMTguMzc3LDAuNzQ4IDE3Ljk0LDAuOTk4IEMxNi40NCwxLjQzNiAxNS4zNzcsMi4wNjEgMTQuNzUyLDIuOTk4IEMxNC4xODksMy44MTEgMTMuOTM5LDQuNzQ4IDEzLjkzOSw1LjgxMSBMMTMuOTM5LDkuNTYxIEMxNC4wMDIsMTAuNTYxIDE0LjAwMiwxMS40OTkgMTQuMDAyLDEyLjM3NCBDMTQuMDAyLDEzLjA2MiAxMy44MTQsMTMuNTYyIDEzLjMxNCwxNC4wNjIgQzEyLjgxNCwxNC41IDEyLjMxNCwxNC43NSAxMS42MjYsMTQuNzUgTDUuNjI2LDE0Ljc1IEM0LjM3NiwxNC43NSAzLjM3NiwxNC45MzggMi42MjYsMTUuMzEzIEMxLjg3NiwxNS42MjYgMS4zNzYsMTYuMDYzIDAuOTM4LDE2LjY4OCBDMC4zMTMsMTcuNDM4IDAsMTguNjg4IDAsMjAuMzc2IEw3LjU0OTUxNjU3ZS0xNSwyMC4zNzUgWiBNMC4zNzUsMTIuNzUgQzAuNTYzLDEyLjY4NyAwLjc1LDEyLjU2MiAwLjkzOCwxMi40MzcgQzIuMDAxLDExLjk5OSAzLjMxMywxMS43NDkgNC43NTEsMTEuNzQ5IEwxMC42ODksMTEuNzQ5IEMxMS4xMjcsMTEuNzQ5IDExLjMxNCwxMS41NjEgMTEuMzE0LDExLjEyNCBDMTEuMzE0LDcuNjg2IDExLjI1MSw1LjQzNiAxMS4yNTEsNC40OTkgQzExLjI1MSwzLjMxMSAxMS41MDEsMi4zMTEgMTEuOTM5LDEuNDM2IEwxMi4xODksMS4wNjEgQzEyLjEyNiwxLjA2MSAxMi4xMjYsMS4wNjEgMTIuMTI2LDEuMTI0IEwwLjM3NiwxMi42MjQgTDAuMzc2LDEyLjc0OSBMMC4zNzUsMTIuNzUgWiBNMzYuNzUsMzEuMzEzIEMzNi45MzgsMzAgMzcuMzEzLDI4LjkzOCAzNy45MzgsMjggQzM4LjU2MywyNy4xODcgMzkuNTAxLDI2Ljc1IDQwLjc1MSwyNi43NSBMNDAuOTM5LDI2Ljc1IEM0My41NjQsMjYuODEzIDQ0Ljg3NywyOC42ODggNDQuODc3LDMyLjMxMyBDNDMuMzE0LDMxLjU2MyA0MS42MjcsMzEuMTg4IDM5LjY4OSwzMS4xMjUgQzM4LjYyNiwzMS4xMjUgMzcuNjI2LDMxLjE4OCAzNi43NTEsMzEuMzEzIEwzNi43NSwzMS4zMTMgWiIgaWQ9IlNoYXBlIiBza2V0Y2g6dHlwZT0iTVNTaGFwZUdyb3VwIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4="); } @charset "UTF-8"; /* Animate.css - http://daneden.me/animate Licensed under the MIT license - http://opensource.org/licenses/MIT Copyright (c) 2015 Daniel Eden */ .animated { animation-duration: 1s; animation-fill-mode: both; } .fadeIn { animation-name: fadeIn; } .fadeInDown { animation-name: fadeInDown; } .fadeInDownBig { animation-name: fadeInDownBig; } .fadeInUp { animation-name: fadeInUp; } .fadeOut { animation-name: fadeOut; } .fadeOutDownBig { animation-name: fadeOutDownBig; } @keyframes fadeIn { 0% { opacity: 0; } 100% { opacity: 1; } } @keyframes fadeInDown { 0% { opacity: 0; transform: translate3d(0, -100%, 0); } 100% { opacity: 1; transform: none; } } @keyframes fadeInDownBig { 0% { opacity: 0; transform: translate3d(0, -2000px, 0); } 100% { opacity: 1; transform: none; } } @keyframes fadeInUp { 0% { opacity: 0; transform: translate3d(0, 100%, 0); } 100% { opacity: 1; transform: none; } } @keyframes fadeOut { 0% { opacity: 1; } 100% { opacity: 0; } } @keyframes fadeOutDownBig { 0% { opacity: 1; } 100% { opacity: 0; transform: translate3d(0, 2000px, 0); } } .slide-enter { transform: translate3d(100%, 0, 0); } .slide-enter.slide-enter-active { transform: translate3d(0, 0, 0); transition: transform 0.3s ease-out; } .slide-exit { transform: translate3d(0, 0, 0); } .slide-exit.slide-exit-active { transform: translate3d(100%, 0, 0); transition: transform 0.3s ease-in; } .vslide-enter { transform: translate3d(0, 100%, 0); } .vslide-enter.vslide-enter-active { transform: translate3d(0, 0, 0); transition: transform 0.35s; } .reverse-vslide-enter { opacity: 0; transform: translate3d(0, -100%, 0); } .reverse-vslide-enter.reverse-vslide-enter-active { opacity: 1; transform: translate3d(0, 0, 0); transition: transform 0.35s; } .vslide-exit { transform: translate3d(0, 0, 0); } .vslide-exit.vslide-exit-active { transform: translate3d(0, 100%, 0); transition: transform 0.35s; } .horizontal-fade-enter { position: relative; top: 0; left: 0; z-index: 1; transform: translate3d(100%, 0, 0); } .horizontal-fade-enter.horizontal-fade-enter-active { transform: none; transition: transform 0.5s; } .horizontal-fade-exit { opacity: 1; position: absolute; width: 100%; top: 0; left: 0; } .horizontal-fade-exit.horizontal-fade-exit-active { opacity: 0; transform: translate3d(-100%, 0, 0); transition: transform 0.5s, opacity 1s linear; } .reverse-horizontal-fade-enter { position: relative; top: 0; left: 0; z-index: 1; transform: translate3d(-100%, 0, 0); } .reverse-horizontal-fade-enter.reverse-horizontal-fade-enter-active { transform: none; transition: transform 0.5s; } .reverse-horizontal-fade-exit { opacity: 1; position: absolute; width: 100%; top: 0; left: 0; } .reverse-horizontal-fade-exit.reverse-horizontal-fade-exit-active { opacity: 0; transform: translate3d(100%, 0, 0); transition: transform 0.5s, opacity 1s linear; } .fade-enter { position: relative; top: 0; left: 0; z-index: 1; } .fade-exit { opacity: 1; position: absolute; width: 100%; top: 0; left: 0; opacity: 1; } .fade-exit.fade-exit-active { opacity: 0; transition: opacity 0.5s linear; } @keyframes stroke { 100% { stroke-dashoffset: 0; } } @keyframes scale { 0%, 100% { transform: none; } 50% { transform: scale3d(1.1, 1.1, 1); } } @keyframes fill { 100% { box-shadow: inset 0px 0px 0px 30px #7ac142; } } @keyframes rotate { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } @media screen and (max-width: 480px) { html.auth0-lock-html body > * { display: none; } html.auth0-lock-html body .auth0-lock-container { background: #fff; display: block !important; } } .auth0-lock.auth0-lock, .auth0-lock.auth0-lock * { box-sizing: initial; } .auth0-lock.auth0-lock svg { background-color: transparent; } .auth0-lock.auth0-lock .auth0-global-message { color: #fff; text-align: center; padding: 10px; line-height: 1.8; font-size: 11px; font-weight: 600; text-transform: uppercase; } .auth0-lock.auth0-lock .auth0-global-message.auth0-global-message-error { background: #ff3e00; } .auth0-lock.auth0-lock .auth0-global-message.auth0-global-message-success { background: #7ed321; } .auth0-lock.auth0-lock .auth0-global-message.auth0-global-message-info { background: #44c7f4; } .auth0-lock.auth0-lock .auth0-global-message.global-message-enter { height: 0; paddingTop: 0; paddingBottom: 0; } .auth0-lock.auth0-lock .auth0-global-message.global-message-enter.global-message-enter-active { transition: all 0.2s; height: auto; paddingTop: 10px; paddingBottom: 10px; } .auth0-lock.auth0-lock .auth0-global-message.global-message-exit { transition: all 0.2s; height: 0; paddingTop: 0; paddingBottom: 0; } .auth0-lock.auth0-lock .auth0-global-message span { animation-delay: 0.2s; } .auth0-lock.auth0-lock { font-family: "Avenir Next", Avenir, -apple-system, BlinkMacSystemFont, Roboto, Helvetica, sans-serif; text-rendering: optimizeLegibility; pointer-events: none; position: fixed; bottom: 0; left: 0; width: 100%; height: 100%; right: 0; z-index: 1000000; } .auth0-lock.auth0-lock a { text-decoration: none; } .auth0-lock.auth0-lock a:active, .auth0-lock.auth0-lock a:focus { outline: none; } .auth0-lock.auth0-lock input:focus, .auth0-lock.auth0-lock button:focus { outline: none; } .auth0-lock.auth0-lock .auth0-lock-overlay { background: radial-gradient(#40404b, #111118) rgba(34,34,40,0.94); position: fixed; top: 0; bottom: 0; right: 0; left: 0; z-index: -1; opacity: 0; transition: opacity 0.2s ease-in 0.4s; } .auth0-lock.auth0-lock .auth0-lock-center { box-sizing: border-box; } @media (min-width: 481px) { .auth0-lock.auth0-lock .auth0-lock-center { padding: 40px; height: 100%; display: -ms-flexbox; display: flex; } } .auth0-lock.auth0-lock .auth0-lock-widget { width: 300px; opacity: 0; transform: translateY(100%) scale(0.8); transition-timing-function: cubic-bezier(0.3, 0, 0, 1.4); margin: auto; border-radius: 5px; } @media (min-width: 481px) { .auth0-lock.auth0-lock .auth0-lock-widget { transition: transform 0.4s, opacity 0.3s; } } .auth0-lock.auth0-lock .auth0-lock-widget-container { position: relative; } .auth0-lock.auth0-lock .auth0-lock-cred-pane { background: #fff; border-radius: 6px; position: relative; display: -ms-flexbox; display: flex; -ms-flex-direction: column; flex-direction: column; height: 100%; min-height: 100%; } .auth0-lock.auth0-lock .auth0-lock-cred-pane.horizontal-fade-exit .auth0-lock-content, .auth0-lock.auth0-lock .auth0-lock-cred-pane.horizontal-fade-exit .auth0-lock-terms { opacity: 0.3; pointer-events: none; } .auth0-lock.auth0-lock .auth0-lock-cred-pane.auth0-lock-moving { overflow: hidden; } .auth0-lock.auth0-lock .auth0-lock-cred-pane-internal-wrapper { display: -ms-flexbox; display: flex; -ms-flex-direction: column; flex-direction: column; height: 100vh; height: calc(var(--vh, 1vh) * 100); max-height: auto; } @media (min-width: 481px) { .auth0-lock.auth0-lock .auth0-lock-cred-pane-internal-wrapper { min-height: auto; height: auto; } } .auth0-lock.auth0-lock .auth0-lock-header { text-align: center; padding: 11px; color: #333; position: relative; background: #fff; border-radius: 5px 5px 0 0; overflow: hidden; box-sizing: border-box; display: -ms-flexbox; display: flex; -ms-flex-direction: column; flex-direction: column; -ms-flex-pack: center; justify-content: center; -ms-flex-negative: 0; flex-shrink: 0; -ms-flex-positive: 0; flex-grow: 0; -ms-flex-preferred-size: auto; flex-basis: auto; } .auth0-lock.auth0-lock .auth0-lock-content-wrapper { -ms-flex-positive: 1; flex-grow: 1; -ms-flex-negative: 1; flex-shrink: 1; -ms-flex-preferred-size: auto; flex-basis: auto; -webkit-overflow-scrolling: touch; overflow-x: auto; } @media (min-width: 481px) { .auth0-lock.auth0-lock .auth0-lock-content-wrapper { overflow-x: inherit; } } .auth0-lock.auth0-lock .auth0-lock-close-button, .auth0-lock.auth0-lock .auth0-lock-back-button { box-sizing: content-box !important; background: #fff; border-radius: 100px; height: 10px; width: 10px; padding: 0; position: absolute; top: 14px; right: 14px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); color: #333; z-index: 100; border: 6px solid #fff; cursor: pointer; line-height: 0; } .auth0-lock.auth0-lock .auth0-lock-close-button:focus, .auth0-lock.auth0-lock .auth0-lock-back-button:focus { outline: none; box-shadow: 0 3px 3px rgba(0,0,0,0.3); } .auth0-lock.auth0-lock .auth0-lock-close-button svg, .auth0-lock.auth0-lock .auth0-lock-back-button svg { box-sizing: content-box; } .auth0-lock.auth0-lock .auth0-lock-close-button polygon, .auth0-lock.auth0-lock .auth0-lock-back-button polygon { fill: #373737; } .auth0-lock.auth0-lock .auth0-lock-back-button { left: 14px; } .auth0-lock.auth0-lock .auth0-lock-header-avatar { height: 80px; width: 80px; display: block; border-radius: 100px; margin: -16px auto 0; position: absolute; left: 0; right: 0; z-index: 1000; box-shadow: 0 1px 2px rgba(0,0,0,0.4); animation: fadeIn 0.75s both; } @media (min-width: 768px) { .auth0-lock.auth0-lock .auth0-lock-header-avatar { animation: fadeInDown 0.75s both; } } .auth0-lock.auth0-lock .auth0-lock-header-bg { position: absolute; height: 100%; width: 100%; overflow: hidden; top: 0; left: 0; pointer-events: none; } @media (min-width: 481px) { .auth0-lock.auth0-lock .auth0-lock-header-bg { background: rgba(241,241,241,0.8); } } .auth0-lock.auth0-lock .auth0-lock-header-bg .auth0-lock-header-bg-blur { display: none; height: 100%; width: 100%; border-top-left-radius: 5px; border-top-right-radius: 5px; -ms-filter: blur(40px) grayscale(1); filter: blur(40px) grayscale(1); -webkit-backdrop-filter: blur(0); background-color: #fff; background-position: center; background-repeat: no-repeat; background-size: 300px; opacity: 0; transition: 0s ease 0s; } .auth0-lock.auth0-lock .auth0-lock-header-bg .auth0-lock-header-bg-blur.auth0-lock-no-grayscale { -ms-filter: blur(30px); filter: blur(30px); -webkit-backdrop-filter: blur(0); background-position: center; background-size: 800px; } @media (min-width: 481px) { .auth0-lock.auth0-lock .auth0-lock-header-bg.auth0-lock-blur-support .auth0-lock-header-bg-blur { display: block; } } .auth0-lock.auth0-lock .auth0-lock-header-bg .auth0-lock-header-bg-solid { height: 100%; opacity: 0.08; } .auth0-lock.auth0-lock .auth0-lock-header-welcome { font-size: 18px; position: relative; } .auth0-lock.auth0-lock .auth0-lock-header-logo { width: auto; height: 58px; display: inline-block; margin: 0 0 11px; vertical-align: middle; } .auth0-lock.auth0-lock .auth0-lock-header-logo.centered { margin-top: 20px; } .auth0-lock.auth0-lock .auth0-lock-firstname { font-size: 18px; margin-top: 64px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; padding: 0 10px; } .auth0-lock.auth0-lock .auth0-lock-name { font-size: 22px; padding: 0 10px; line-height: 30px; } .auth0-lock.auth0-lock .auth0-lock-content { box-sizing: border-box; } .auth0-lock.auth0-lock .auth0-lock-form { padding: 20px; } .auth0-lock.auth0-lock .auth0-lock-form h2 { font-size: 22px; font-weight: normal; text-align: center; margin: 0 0 15px; color: #000; } .auth0-lock.auth0-lock .auth0-lock-form p { font-size: 13px; line-height: 1.8; text-align: center; margin-top: 0; margin-bottom: 15px; color: rgba(0,0,0,0.54); } .auth0-lock.auth0-lock .auth0-lock-form .auth0-lock-alternative { margin-top: 20px; margin-bottom: 0; } .auth0-lock.auth0-lock .auth0-lock-form .auth0-lock-alternative .auth0-lock-alternative-link { font-size: 13px; color: rgba(0,0,0,0.87); cursor: pointer; margin-bottom: 0; } .auth0-lock.auth0-lock .auth0-lock-form .auth0-lock-alternative .auth0-lock-alternative-link:focus { text-decoration: underline; } .auth0-lock.auth0-lock .auth0-lock-input-block { position: relative; margin-bottom: 15px; } @media (min-width: 481px) { .auth0-lock.auth0-lock .auth0-lock-input-block { margin-bottom: 10px; } } .auth0-lock.auth0-lock .auth0-lock-input-block:last-child { margin-bottom: 0; } .auth0-lock.auth0-lock .auth0-lock-captcha { position: relative; height: 72px; margin-bottom: 10px; background: #fff; border: 1px solid #eee; border-radius: 3px; margin-top: 24px; } .auth0-lock.auth0-lock .auth0-lock-captcha .auth0-lock-captcha-image { position: absolute; width: 120px; height: 40px; left: 16px; top: 16px; background-size: contain; } .auth0-lock.auth0-lock .auth0-lock-captcha .auth0-lock-captcha-refresh { position: absolute; width: 40px; height: 40px; right: 16px; top: 16px; border: 1px solid #eee; border-radius: 3px; padding: 0; } .auth0-lock.auth0-lock .auth0-lock-captcha .auth0-lock-captcha-refresh svg, .auth0-lock.auth0-lock .auth0-lock-captcha .auth0-lock-captcha-refresh .test-titi { position: absolute; top: 12.5px; left: 12.5px; width: 15px; height: 15px; margin: 0; padding: 0; background-color: transparent; } .auth0-lock.auth0-lock .auth0-lock-captcha .auth0-lock-captcha-refresh svg path, .auth0-lock.auth0-lock .auth0-lock-captcha .auth0-lock-captcha-refresh .test-titi path { fill: #888; } .auth0-lock.auth0-lock .auth0-lock-input-block.auth0-lock-input-captcha svg.auth0-lock-icon { width: 20px; height: 20px; top: 10px; left: 9.5px; } .auth0-lock.auth0-lock .auth0-lock-input-wrap { border-radius: 3px; border: 1px solid #f1f1f1; position: relative; background: #f1f1f1; transition: border-color 0.8s; } .auth0-lock.auth0-lock .auth0-lock-input-wrap.auth0-lock-input-wrap-with-icon { padding-left: 40px; } .auth0-lock.auth0-lock .auth0-lock-input-wrap .auth0-lock-icon-arrow { position: absolute; top: 14px; width: 12px; height: 14px; right: 14px; pointer-events: none; } .auth0-lock.auth0-lock .auth0-lock-input-wrap .auth0-lock-icon, .auth0-lock.auth0-lock .auth0-lock-input-wrap .auth0-lock-custom-icon { position: absolute; font-size: 12px; top: 13px; left: 14px; } .auth0-lock.auth0-lock .auth0-lock-input-wrap .auth0-lock-icon path, .auth0-lock.auth0-lock .auth0-lock-input-wrap .auth0-lock-custom-icon path { fill: #888; } .auth0-lock.auth0-lock .auth0-lock-input-wrap .auth0-lock-icon.auth0-lock-icon-mobile, .auth0-lock.auth0-lock .auth0-lock-input-wrap .auth0-lock-custom-icon.auth0-lock-icon-mobile { width: 9px; height: 14px; top: 14px; left: 16px; } .auth0-lock.auth0-lock .auth0-lock-input-wrap .auth0-lock-icon.auth0-lock-icon-box, .auth0-lock.auth0-lock .auth0-lock-input-wrap .auth0-lock-custom-icon.auth0-lock-icon-box { width: 12px; height: 14px; top: auto; bottom: 14px; left: 14px; } .auth0-lock.auth0-lock .auth0-lock-input-wrap.auth0-lock-focused { border-color: #a0a0a0; } .auth0-lock.auth0-lock .auth0-lock-input-wrap .auth0-lock-input { border: 0; padding: 0 14px; right: 0; height: 40px; font-size: 13px; width: 100%; border-radius: 0 2px 2px 0; box-sizing: border-box; position: relative; color: rgba(0,0,0,0.87); } .auth0-lock.auth0-lock .auth0-lock-input-wrap .auth0-lock-input.animated { animation-duration: 0.5s; } .auth0-lock.auth0-lock .auth0-lock-input-wrap .auth0-lock-input.auth0-lock-input-location { background-color: #f9f9f9; text-align: left; } .auth0-lock.auth0-lock .auth0-lock-input-wrap .auth0-lock-input.auth0-lock-input-location.auth0-lock-input-with-placeholder { color: rgba(0,0,0,0.54); } .auth0-lock.auth0-lock .auth0-lock-error .auth0-lock-input-wrap { border-color: #f00; transition: 0.3s ease-in-out; } .auth0-lock.auth0-lock .auth0-lock-input-checkbox { text-align: left; display: block; font-size: 12px; color: rgba(0,0,0,0.54); line-height: 22px; position: relative; } .auth0-lock.auth0-lock .auth0-lock-input-checkbox label input { float: left; margin-top: 5px; } .auth0-lock.auth0-lock .auth0-lock-input-checkbox span { display: block; margin-left: 20px; } .auth0-lock.auth0-lock .auth-lock-social-buttons-pane, .auth0-lock.auth0-lock .auth0-lock-last-login-pane { position: relative; } .auth0-lock.auth0-lock .auth-lock-social-buttons-pane .auth0-loading-container, .auth0-lock.auth0-lock .auth0-lock-last-login-pane .auth0-loading-container { animation: fadeIn 0.75s ease-in-out !important; position: absolute; width: 54px; height: 54px; top: 50%; left: 50%; transform: translate(-50%, -50%); } .auth0-lock.auth0-lock .auth-lock-social-buttons-pane .auth0-loading-container .auth0-loading, .auth0-lock.auth0-lock .auth0-lock-last-login-pane .auth0-loading-container .auth0-loading { width: 50px; height: 50px; border-radius: 50%; top: 0; left: 0; opacity: 1; } .auth0-lock.auth0-lock .auth0-lock-social-buttons-container { text-align: center; } .auth0-lock.auth0-lock .auth0-lock-social-button { border: 0; padding: 0; display: inline-block; box-sizing: border-box; overflow: hidden; border-radius: 3px; margin: 4px; position: relative; width: 40px; height: 40px; transition: background-color 0.2s ease-in-out; cursor: pointer; -webkit-appearance: none !important; -moz-appearance: none !important; appearance: none !important; } .auth0-lock.auth0-lock .auth0-lock-social-button[data-provider^=google] .auth0-lock-social-button-text { color: #333 !important; } .auth0-lock.auth0-lock .auth0-lock-social-button[data-provider^=google] .auth0-lock-social-button-icon { height: 36px; width: 36px; } .auth0-lock.auth0-lock .auth0-lock-social-button[data-provider^=google]:hover:not([disabled]) .auth0-lock-social-button-icon, .auth0-lock.auth0-lock .auth0-lock-social-button[data-provider^=google]:focus:not([disabled]) .auth0-lock-social-button-icon, .auth0-lock.auth0-lock .auth0-lock-social-button[data-provider^=google]:hover:not([disabled]) .auth0-lock-social-button-text, .auth0-lock.auth0-lock .auth0-lock-social-button[data-provider^=google]:focus:not([disabled]) .auth0-lock-social-button-text { background-color: #f0f0f0 !important; } .auth0-lock.auth0-lock .auth0-lock-social-button[data-provider^=google].auth0-lock-social-big-button { background-color: #fff; border: 1px solid #dee0e2; } .auth0-lock.auth0-lock .auth0-lock-social-button[data-provider^=google].auth0-lock-social-big-button .auth0-lock-social-button-icon { width: 38px; } .auth0-lock.auth0-lock .auth0-lock-social-button .auth0-lock-social-button-icon { box-sizing: content-box; width: 40px; height: 40px; position: absolute; top: 0; left: 0; transition: background-color 0.3s, border 0.2s ease-in-out; -webkit-transition: background-color 0.3s, border 0.2s ease-in-out; } .auth0-lock.auth0-lock .auth0-lock-social-button .auth0-lock-social-button-text { display: none; } .auth0-lock.auth0-lock .auth0-lock-social-button.auth0-lock-social-big-button { display: block; margin: 10px 0 0; width: 100%; } .auth0-lock.auth0-lock .auth0-lock-social-button.auth0-lock-social-big-button:first-child { margin-top: 0; } .auth0-lock.auth0-lock .auth0-lock-social-button.auth0-lock-social-big-button[data-provider=""], .auth0-lock.auth0-lock .auth0-lock-social-button.auth0-lock-social-big-button[data-provider="auth0"] { background-color: #c0c0c0; } .auth0-lock.auth0-lock .auth0-lock-social-button.auth0-lock-social-big-button[data-provider=""] .auth0-lock-social-button-icon, .auth0-lock.auth0-lock .auth0-lock-social-button.auth0-lock-social-big-button[data-provider="auth0"] .auth0-lock-social-button-icon { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB3aWR0aD0iNTNweCIgaGVpZ2h0PSI2NXB4IiB2aWV3Qm94PSIwIDAgNTMgNjUiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+ICAgICAgICA8dGl0bGU+U2hhcGU8L3RpdGxlPiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4gICAgPGRlZnM+PC9kZWZzPiAgICA8ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4gICAgICAgIDxnIGlkPSI2NHB4IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMTE1My4wMDAwMDAsIC02MDMzLjAwMDAwMCkiIGZpbGw9IiNGRkZGRkYiPiAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMTYxLjEyNSw2MDk4IEMxMTU2LjYzNzk3LDYwOTggMTE1Myw2MDk0LjM2MTg2IDExNTMsNjA4OS44NzU2MyBMMTE1Myw2MDY1LjQ5OTQ5IEMxMTUzLDYwNjEuMDEyMjUgMTE1Ni42Mzc5Nyw2MDU3LjM3MzEgMTE2MS4xMjUsNjA1Ny4zNzMxIEwxMTYxLjEyNSw2MDUxLjI4MjExIEMxMTYxLjEyNSw2MDQxLjE4NjMyIDExNjkuMzA5OTIsNjAzMyAxMTc5LjQwNjI1LDYwMzMgQzExODkuNTAyNTgsNjAzMyAxMTk3LjY4NzUsNjA0MS4xODYzMiAxMTk3LjY4NzUsNjA1MS4yODIxMSBMMTE5Ny42ODc1LDYwNTcuMzc0MTEgQzEyMDIuMTc0NTMsNjA1Ny4zNzQxMSAxMjA1LjgxMjUsNjA2MS4wMTIyNSAxMjA1LjgxMjUsNjA2NS40OTk0OSBMMTIwNS44MTI1LDYwODkuODc1NjMgQzEyMDUuODEyNSw2MDk0LjM2MTg2IDEyMDIuMTc0NTMsNjA5OCAxMTk3LjY4NzUsNjA5OCBMMTE2MS4xMjUsNjA5OCBaIE0xMTkzLjYyNjAyLDYwNTEuMjgyMTEgQzExOTMuNjI2MDIsNjA0My40Mjk5NCAxMTg3LjI1OTA2LDYwMzcuMDYyNjkgMTE3OS40MDcyNyw2MDM3LjA2MjY5IEMxMTcxLjU1NTQ3LDYwMzcuMDYyNjkgMTE2NS4xODg1Miw2MDQzLjQyOTk0IDExNjUuMTg4NTIsNjA1MS4yODIxMSBMMTE2NS4xODg1Miw2MDU3LjM3MzEgTDExOTMuNjI2MDIsNjA1Ny4zNzMxIEwxMTkzLjYyNjAyLDYwNTEuMjgyMTEgTDExOTMuNjI2MDIsNjA1MS4yODIxMSBaIE0xMjAxLjc1LDYwNjUuNDk5NDkgQzEyMDEuNzUsNjA2My4yNTQ4NiAxMTk5LjkzMTAyLDYwNjEuNDM1NzkgMTE5Ny42ODc1LDYwNjEuNDM1NzkgTDExNjEuMTI1LDYwNjEuNDM1NzkgQzExNTguODgxNDgsNjA2MS40MzU3OSAxMTU3LjA2MjUsNjA2My4yNTQ4NiAxMTU3LjA2MjUsNjA2NS40OTk0OSBMMTE1Ny4wNjI1LDYwODkuODc1NjMgQzExNTcuMDYyNSw2MDkyLjExNjIxIDExNTguODgxNDgsNjA5My45MzUyOCAxMTYxLjEyNSw2MDkzLjkzNTI4IEwxMTk3LjY4NzUsNjA5My45MzUyOCBDMTE5OS45MzEwMiw2MDkzLjkzNTI4IDEyMDEuNzUsNjA5Mi4xMTYyMSAxMjAxLjc1LDYwODkuODc1NjMgTDEyMDEuNzUsNjA2NS40OTk0OSBMMTIwMS43NSw2MDY1LjQ5OTQ5IFogTTExNzcuMzc1LDYwODMuNzgwNTggTDExNzcuMzc1LDYwNzEuNTkyNTEgQzExNzcuMzc1LDYwNzAuNDcxMjEgMTE3OC4yODM5OCw2MDY5LjU2MTE3IDExNzkuNDA2MjUsNjA2OS41NjExNyBDMTE4MC41Mjg1Miw2MDY5LjU2MTE3IDExODEuNDM3NSw2MDcwLjQ3MTIxIDExODEuNDM3NSw2MDcxLjU5MjUxIEwxMTgxLjQzNzUsNjA4My43ODA1OCBDMTE4MS40Mzc1LDYwODQuOTAwODcgMTE4MC41Mjg1Miw2MDg1LjgxMDkxIDExNzkuNDA2MjUsNjA4NS44MTA5MSBDMTE3OC4yODUsNjA4NS44MTA5MSAxMTc3LjM3NSw2MDg0LjkwMDg3IDExNzcuMzc1LDYwODMuNzgwNTggWiIgaWQ9IlNoYXBlIj48L3BhdGg+ICAgICAgICA8L2c+ICAgIDwvZz48L3N2Zz4="); background-size: 38%; } .auth0-lock.auth0-lock .auth0-lock-social-button.auth0-lock-social-big-button .auth0-lock-social-button-text { box-sizing: border-box; display: block; overflow: hidden; width: 100%; padding-left: 50px; padding-right: 15px; line-height: 40px; text-align: left; text-overflow: ellipsis; font-size: 14px; font-weight: 500; color: #fff; white-space: nowrap; transition: background 0.3s; -webkit-transition: background 0.3s; } @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { .auth0-lock.auth0-lock .auth0-lock-social-button.auth0-lock-social-big-button .auth0-lock-social-button-text { font-weight: 600; } } .auth0-lock.auth0-lock .auth0-lock-social-button.auth0-lock-social-big-button:hover:not([disabled]) .auth0-lock-social-button-text, .auth0-lock.auth0-lock .auth0-lock-social-button.auth0-lock-social-big-button:focus:not([disabled]) .auth0-lock-social-button-text { background-color: rgba(0,0,0,0.3); } .auth0-lock.auth0-lock .auth0-lock-social-button[disabled] { background-color: #9b9b9b !important; } .auth0-lock.auth0-lock .auth0-lock-terms { background: #eee; text-align: center; display: block; font-size: 12px; color: rgba(0,0,0,0.54); line-height: 22px; padding: 10px; position: relative; } .auth0-lock.auth0-lock .auth0-lock-terms a { color: rgba(0,0,0,0.87); } .auth0-lock.auth0-lock .auth0-lock-submit { border: 0; padding: 14px; display: block; box-sizing: border-box; width: 100%; overflow: hidden; border-radius: 0 0 5px 5px; transition: 0.2s ease-in-out; color: #fff; letter-spacing: 1px; font-size: 14px; text-transform: uppercase; -ms-flex-negative: 0; flex-shrink: 0; -ms-flex-positive: 0; flex-grow: 0; -ms-flex-preferred-size: auto; flex-basis: auto; /*submit button animation*/ } .auth0-lock.auth0-lock .auth0-lock-submit span { display: inline-block; transition: 0.2s ease-in-out; } .auth0-lock.auth0-lock .auth0-lock-submit span svg { vertical-align: middle; display: inline; } .auth0-lock.auth0-lock .auth0-lock-submit span svg.icon-text { margin: -4px 0 0 5px; } .auth0-lock.auth0-lock .auth0-lock-submit .auth0-label-submit { height: 42px; line-height: 42px; } @media (min-width: 481px) { .auth0-lock.auth0-lock .auth0-lock-submit:hover:not([disabled]) span { transform: scale(1.05); } } .auth0-lock.auth0-lock .auth0-lock-submit:focus { box-shadow: inset 0 0 100px 20px rgba(0,0,0,0.2); } .auth0-lock.auth0-lock .auth0-lock-submit[disabled] { background-color: #9b9b9b !important; } .auth0-lock.auth0-lock .auth0-lock-submit[disabled] span svg circle, .auth0-lock.auth0-lock .auth0-lock-submit[disabled] span svg path { stroke: rgba(255,255,255,0.6); transition: 0.2s ease-in-out; } .auth0-lock.auth0-lock .auth0-lock-submit[disabled] span svg path { fill: rgba(255,255,255,0.6); } .auth0-lock.auth0-lock .auth0-lock-submit.vslide-enter { opacity: 0; } .auth0-lock.auth0-lock .auth0-lock-submit.vslide-enter.vslide-enter-active { opacity: 1; transition-duration: 0.5s; } .auth0-lock.auth0-lock .auth0-lock-submit-container { -ms-flex-negative: 0; flex-shrink: 0; } .auth0-lock.auth0-lock .auth0-loading-container { position: relative; display: none; } .auth0-lock.auth0-lock .auth0-loading-container .auth0-loading { position: absolute; top: 4px; left: 44%; width: 30px; height: 30px; border-width: 2px; border-style: solid; border-color: rgba(0,0,0,0.4) rgba(0,0,0,0.4) rgba(0,0,0,0.2) rgba(0,0,0,0.2); opacity: 0.9; border-radius: 20px; animation: rotate 1s linear infinite; } .auth0-lock.auth0-lock.auth0-lock-mode-loading .auth0-lock-content, .auth0-lock.auth0-lock.auth0-lock-mode-loading .auth0-lock-terms { opacity: 0.3; pointer-events: none; } .auth0-lock.auth0-lock.auth0-lock-mode-loading .auth0-lock-submit { background-color: #eee !important; transition: background 0.5s ease; cursor: initial; pointer-events: none; } .auth0-lock.auth0-lock.auth0-lock-mode-loading .auth0-lock-submit span { animation: fadeOutDownBig 1s both; } .auth0-lock.auth0-lock.auth0-lock-mode-loading .auth0-loading-container { animation: fadeInDownBig 1s both; display: block; } .auth0-lock.auth0-lock.auth0-lock-mode-loading .auth0-lock-back-button { opacity: 0; visibility: hidden; transition: 0.25s; } .auth0-lock.auth0-lock.auth0-lock-auxiliary .auth0-lock-header-avatar { animation: fadeOut 0.3s both; } .auth0-lock.auth0-lock.auth0-lock-auxiliary .auth0-lock-content, .auth0-lock.auth0-lock.auth0-lock-auxiliary .auth0-lock-terms, .auth0-lock.auth0-lock.auth0-lock-auxiliary .auth0-lock-submit { opacity: 0.3; pointer-events: none; } .auth0-lock.auth0-lock.auth0-lock-auxiliary .auth0-lock-back-button { opacity: 0; visibility: hidden; transition: 0.25s; } .auth0-lock.auth0-lock .auth0-lock-select-country { background-color: #fff; position: absolute; padding: 0; font-size: 14px; color: #666; bottom: 0; top: 0; right: 0; left: 0; border-radius: 5px; overflow: hidden; z-index: 200; } .auth0-lock.auth0-lock .auth0-lock-select-country .auth0-lock-back-button { opacity: 1; visibility: visible; top: 19px; } .auth0-lock.auth0-lock .auth0-lock-select-country .auth0-lock-search { background-color: #e3e5e9; padding: 10px; } .auth0-lock.auth0-lock .auth0-lock-select-country .auth0-lock-input-wrap { margin: 0; border: none; margin-left: 40px; overflow: hidden; } .auth0-lock.auth0-lock .auth0-lock-select-country .auth0-lock-icon { width: 16px; height: 16px; top: 12px; left: 9px; z-index: 1; } .auth0-lock.auth0-lock .auth0-lock-select-country .auth0-lock-input-search { border: none; } .auth0-lock.auth0-lock .auth0-lock-select-country .auth0-lock-list-code { position: relative; height: calc(100% - 60px); overflow-y: scroll; } .auth0-lock.auth0-lock .auth0-lock-select-country .auth0-lock-list-code ul { margin: 0; padding: 0; } .auth0-lock.auth0-lock .auth0-lock-select-country .auth0-lock-list-code li { list-style: none; text-align: left; border-bottom: 1px solid #eee; cursor: pointer; color: #000; font-size: 14px; padding: 15px 20px; margin: 0; text-overflow: ellipsis; width: 100%; white-space: nowrap; overflow: hidden; box-sizing: border-box; } @media (min-width: 481px) { .auth0-lock.auth0-lock .auth0-lock-select-country .auth0-lock-list-code li { padding: 10px 20px; } } .auth0-lock.auth0-lock .auth0-lock-select-country .auth0-lock-list-code li.auth0-lock-list-code-highlighted { background-color: #2eb5ff; color: #fff; } .auth0-lock.auth0-lock .auth0-lock-confirmation { background-color: #fff; position: absolute; text-align: center; line-height: 2; font-size: 14px; color: #666; width: 100%; height: 100%; top: 0; left: 0; z-index: 200; border-radius: 5px; } .auth0-lock.auth0-lock .auth0-lock-confirmation .auth0-lock-confirmation-content { width: 100%; top: 50%; left: 50%; transform: translate(-50%, -50%); position: absolute; } .auth0-lock.auth0-lock .auth0-lock-confirmation p { padding: 0 14px; margin-bottom: 6px; } .auth0-lock.auth0-lock .auth0-lock-confirmation a { display: block; font-weight: 500; color: #09c; } .auth0-lock.auth0-lock .auth0-lock-confirmation a svg { width: 15px; height: 16px; margin-bottom: -4px; margin-left: 0px; display: inline-block; transition: transform 1s ease; transform: rotate(120deg); } .auth0-lock.auth0-lock .auth0-lock-confirmation a svg path { fill: #09c; } .auth0-lock.auth0-lock .auth0-lock-confirmation a:hover svg { transform: rotate(490deg); } .auth0-lock.auth0-lock .auth0-lock-confirmation .auth0-lock-sent-label { color: #008000; animation: fadeIn 1s both; font-weight: 600; } .auth0-lock.auth0-lock .auth0-lock-confirmation .auth0-lock-sent-failed-label { color: #f00; animation: fadeIn 1s both; font-weight: 600; } .auth0-lock.auth0-lock .auth0-lock-confirmation .checkmark__circle { stroke-dasharray: 166; stroke-dashoffset: 166; stroke-width: 2; stroke-miterlimit: 10; stroke: #7ac142; fill: none; animation: stroke 0.6s 0.4s cubic-bezier(0.65, 0, 0.45, 1) forwards; } .auth0-lock.auth0-lock .auth0-lock-confirmation .checkmark { width: 56px; height: 56px; border-radius: 50%; display: block; stroke-width: 2; stroke: #fff; stroke-miterlimit: 10; margin: 0 auto; box-shadow: inset 0px 0px 0px #7ac142; animation: fill 0.4s ease-in-out 0.7s forwards, scale 0.3s ease-in-out 1.1s both; } .auth0-lock.auth0-lock .auth0-lock-confirmation .checkmark__check { transform-origin: 50% 50%; } .auth0-lock.auth0-lock .auth0-lock-confirmation .auth0-lock-back-button { opacity: 1; visibility: visible; } .auth0-lock.auth0-lock .auth0-lock-forgot-link { font-size: 12px; display: block; text-align: center; margin: 30px 0 0 0; color: #5c666f; } .auth0-lock.auth0-lock .auth0-lock-badge-bottom { position: absolute; bottom: 15px; left: 15px; z-index: -1; text-align: center; padding: 6px 10px; border-radius: 3px; background: rgba(255,255,255,0.1); } .auth0-lock.auth0-lock .auth0-lock-badge-bottom .auth0-lock-badge { display: inline-block; color: rgba(255,255,255,0.7); font-size: 14px; } .auth0-lock.auth0-lock .auth0-lock-badge-bottom .auth0-lock-badge svg { vertical-align: middle; margin: 0 4px; } .auth0-lock.auth0-lock .auth0-lock-badge-bottom .auth0-lock-badge:hover svg g#LogoBadge { fill: #eb5424; fill-opacity: 1; } .auth0-lock.auth0-lock.auth0-lock-opened { opacity: 1; pointer-events: auto; } @media (min-width: 481px) { .auth0-lock.auth0-lock.auth0-lock-opened .auth0-lock-center { overflow-y: auto; } } @media screen and (max-width: 480px) { .auth0-lock.auth0-lock.auth0-lock-opened { position: absolute; } } .auth0-lock.auth0-lock.auth0-lock-opened .auth0-lock-overlay { opacity: 0.9; transition: opacity 0.3s ease-in 0s; } @media screen and (max-width: 480px) { .auth0-lock.auth0-lock.auth0-lock-opened .auth0-lock-overlay { display: none; } } @media screen and (max-width: 480px) { .auth0-lock.auth0-lock.auth0-lock-opened .auth0-lock-header { border-radius: 0; } } .auth0-lock.auth0-lock.auth0-lock-opened .auth0-lock-header-bg .auth0-lock-header-bg-blur { opacity: 0.4; transition: 1s ease 1s; } @media screen and (max-width: 480px) { .auth0-lock.auth0-lock.auth0-lock-opened .auth0-lock-header-avatar { width: 70px; height: 70px; margin: 10px auto 0; } } @media screen and (max-width: 480px) { .auth0-lock.auth0-lock.auth0-lock-opened .auth0-lock-firstname { margin-top: 72px; } } .auth0-lock.auth0-lock.auth0-lock-opened .auth0-lock-widget { opacity: 1; transform: translateY(0%) scale(1); } @media (min-width: 481px) { .auth0-lock.auth0-lock.auth0-lock-opened .auth0-lock-widget { transition: transform 0.6s, opacity 0.6s; transition-delay: 0.5s; box-shadow: 0 0 40px 4px #111118; } } @media screen and (max-width: 480px) { .auth0-lock.auth0-lock.auth0-lock-opened .auth0-lock-widget { width: 100%; height: 100%; position: absolute; top: 0; bottom: 0; border-radius: 0; } } @media screen and (max-width: 480px) { .auth0-lock.auth0-lock.auth0-lock-opened .auth0-lock-widget-container { height: 100vh; height: calc(var(--vh, 1vh) * 100); } } @media screen and (max-width: 480px) { .auth0-lock.auth0-lock.auth0-lock-opened .auth0-lock-cred-pane { border-radius: 0; } } @media screen and (max-width: 480px) { .auth0-lock.auth0-lock.auth0-lock-opened .auth0-lock-body-content { background: #fff; display: table; width: 100%; } } @media screen and (max-width: 480px) { .auth0-lock.auth0-lock.auth0-lock-opened .auth0-lock-content { width: 100%; vertical-align: middle; } } @media screen and (max-width: 480px) { .auth0-lock.auth0-lock.auth0-lock-opened .auth0-lock-content .auth0-lock-form p { font-size: 14px; } } @media screen and (max-width: 480px) { .auth0-lock.auth0-lock.auth0-lock-opened .auth0-lock-terms { position: absolute; width: 100%; left: 0; box-sizing: border-box; } } @media screen and (max-width: 480px) { .auth0-lock.auth0-lock.auth0-lock-opened .auth0-lock-sign-up-terms-agreement label input { top: 2px; } } @media screen and (max-width: 480px) { .auth0-lock.auth0-lock.auth0-lock-opened .auth0-lock-submit { border-radius: 0; } } @media screen and (max-width: 480px) { .auth0-lock.auth0-lock.auth0-lock-opened .auth0-lock-badge-bottom { display: none; } } @media screen and (max-width: 480px) { .auth0-lock.auth0-lock.auth0-lock-opened .auth0-lock-confirmation { border-radius: 0; } } @media screen and (max-width: 480px) { .auth0-lock.auth0-lock.auth0-lock-opened.auth0-lock-with-terms .auth0-lock-body-content { margin-bottom: 42px; } } .auth0-lock.auth0-lock.auth0-lock-opened-in-frame { opacity: 1; pointer-events: auto; position: relative; width: auto; margin-left: auto; margin-right: auto; } .auth0-lock.auth0-lock.auth0-lock-opened-in-frame .auth0-lock-header-bg .auth0-lock-header-bg-blur { opacity: 0.4; transition: 1s ease 1s; } .auth0-lock.auth0-lock.auth0-lock-opened-in-frame .auth0-lock-header-bg .auth0-lock-header-bg-blur.auth0-lock-no-grayscale { opacity: 0.5; } .auth0-lock.auth0-lock.auth0-lock-opened-in-frame .auth0-lock-widget { opacity: 1; transform: translateY(0%) scale(1); transition: transform 0.6s, opacity 0.6s; transition-delay: 0.5s; margin: auto; } .auth0-lock.auth0-lock.auth0-lock-opened-in-frame .global-error { position: absolute; display: none; } .auth0-lock .auth0-lock-form div.auth0-lock-pane-separator { padding-top: 15px; } #social-container.lock-container .auth0-lock-mode-loading .auth0-lock-content { opacity: 1; } #social-container.lock-container .auth0-lock-mode-loading .auth0-lock-content .auth0-lock-social-buttons-container { opacity: 0.3; } .auth0-lock.auth0-lock .auth0-lock-tabs-container { margin-left: -20px; margin-right: -20px; margin-top: -20px; margin-bottom: 20px; } .auth0-lock.auth0-lock .auth0-lock-tabs { background: #fff; padding: 0; margin: 0; font-size: 13px; letter-spacing: 0.7px; box-shadow: 0 1px 0 0 rgba(92,102,111,0.2); display: -ms-flexbox; display: flex; -ms-flex-direction: row; flex-direction: row; -ms-flex-wrap: wrap; flex-wrap: wrap; -ms-flex-pack: center; justify-content: center; -ms-flex-line-pack: center; align-content: center; -ms-flex-align: stretch; align-items: stretch; } .auth0-lock.auth0-lock .auth0-lock-tabs:after { content: ""; display: table; clear: both; } .auth0-lock.auth0-lock .auth0-lock-tabs li { width: 50%; display: block; list-style: none; float: left; padding: 0; margin: 0; text-align: center; cursor: pointer; } .auth0-lock.auth0-lock .auth0-lock-tabs li a, .auth0-lock.auth0-lock .auth0-lock-tabs li span { padding: 11px 10px; display: block; text-decoration: none; color: rgba(92,102,111,0.6); font-weight: 500; } .auth0-lock.auth0-lock .auth0-lock-tabs li a:focus { color: rgba(92,102,111,0.9); } .auth0-lock.auth0-lock .auth0-lock-tabs li.auth0-lock-tabs-current { box-shadow: 0 1px 0 0 #5c666f; cursor: default; } .auth0-lock.auth0-lock .auth0-lock-tabs li.auth0-lock-tabs-current span { color: #5c666f; } .auth0-lock-password-strength { width: 100%; bottom: 41px; left: 0; display: block; text-align: left; padding-top: 0; animation-duration: 0.3s; transition: height 0.3s ease; } @media (min-width: 481px) { .auth0-lock-password-strength { position: absolute; background: #1f242e; box-shadow: 0 0 20px 0 rgba(0,0,0,0.5); transition: none; width: 100%; border-radius: 3px; z-index: 1000; } .auth0-lock-password-strength:after { top: 100%; left: 21px; border: solid transparent; content: " "; height: 0; width: 0; position: absolute; pointer-events: none; border-top-color: #1f242e; border-width: 9px; margin-left: -9px; } } .auth0-lock-password-strength.fadeOut { opacity: 0; transition: 0.3s 0.3s ease; visibility: hidden; } .auth0-lock-password-strength.fadeIn ul { animation: fadeIn 0.3s 0.1s both; } .auth0-lock-password-strength li, .auth0-lock-password-strength ul { margin: 0; padding: 0; list-style: none; color: #dd4b39; } .auth0-lock-password-strength > ul { padding: 15px; padding-top: 0; } @media (min-width: 481px) { .auth0-lock-password-strength > ul { padding-top: 12px; } } .auth0-lock-password-strength li span { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB3aWR0aD0iMTJweCIgaGVpZ2h0PSIxMnB4IiB2aWV3Qm94PSIwIDAgMTIgMTIiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+ICAgICAgICA8dGl0bGU+RXJyb3I8L3RpdGxlPiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4gICAgPGRlZnM+PC9kZWZzPiAgICA8ZyBpZD0iUGFzc3dvcmQtUG9saWN5IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4gICAgICAgIDxnIGlkPSJBcnRib2FyZC0xIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtMjAwLjAwMDAwMCwgLTE0OC4wMDAwMDApIj4gICAgICAgICAgICA8ZyBpZD0iR3JvdXAtMiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTUwLjAwMDAwMCwgNzUuMDAwMDAwKSI+ICAgICAgICAgICAgICAgIDxnIGlkPSJHcm91cC1Db3B5IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgzNS4wMDAwMDAsIDM2LjAwMDAwMCkiPiAgICAgICAgICAgICAgICAgICAgPGcgaWQ9IkVycm9yIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxNS4wMDAwMDAsIDM3LjAwMDAwMCkiPiAgICAgICAgICAgICAgICAgICAgICAgIDxlbGxpcHNlIGlkPSJPdmFsLTkwIiBmaWxsPSIjQkU0NTI3IiBjeD0iNiIgY3k9IjYiIHJ4PSI2IiByeT0iNiI+PC9lbGxpcHNlPiAgICAgICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik05LDMuNjA0Mjg1NzEgTDguMzk1NzE0MjksMyBMNiw1LjM5NTcxNDI5IEwzLjYwNDI4NTcxLDMgTDMsMy42MDQyODU3MSBMNS4zOTU3MTQyOSw2IEwzLDguMzk1NzE0MjkgTDMuNjA0Mjg1NzEsOSBMNiw2LjYwNDI4NTcxIEw4LjM5NTcxNDI5LDkgTDksOC4zOTU3MTQyOSBMNi42MDQyODU3MSw2IEw5LDMuNjA0Mjg1NzEgWiIgaWQ9IlNoYXBlIiBmaWxsPSIjRkZGRkZGIj48L3BhdGg+ICAgICAgICAgICAgICAgICAgICA8L2c+ICAgICAgICAgICAgICAgIDwvZz4gICAgICAgICAgICA8L2c+ICAgICAgICA8L2c+ICAgIDwvZz48L3N2Zz4="); background-position: left center; background-repeat: no-repeat; padding-left: 20px; } .auth0-lock-password-strength ul li ul { margin-left: 20px; } .auth0-lock-password-strength ul li ul li { color: #000; } @media (min-width: 481px) { .auth0-lock-password-strength ul li ul li { color: #fff; } } .auth0-lock-password-strength ul li ul li span { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB3aWR0aD0iMTNweCIgaGVpZ2h0PSIxMnB4IiB2aWV3Qm94PSIwIDAgMTMgMTIiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+ICAgICAgICA8dGl0bGU+T3ZhbCAxPC90aXRsZT4gICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+ICAgIDxkZWZzPjwvZGVmcz4gICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+ICAgICAgICA8ZyBpZD0iSXBob25lLTYtLS1OYXRpdmUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC00NC4wMDAwMDAsIC0yMTQuMDAwMDAwKSIgZmlsbD0iI0QwRDJEMyI+ICAgICAgICAgICAgPHBhdGggZD0iTTUwLjExNDk3MzMsMjI2IEM1My40Mjg2ODE4LDIyNiA1Ni4xMTQ5NzMzLDIyMy4zMTM3MDggNTYuMTE0OTczMywyMjAgQzU2LjExNDk3MzMsMjE2LjY4NjI5MiA1My40Mjg2ODE4LDIxNCA1MC4xMTQ5NzMzLDIxNCBDNDYuODAxMjY0OCwyMTQgNDQuMTE0OTczMywyMTYuNjg2MjkyIDQ0LjExNDk3MzMsMjIwIEM0NC4xMTQ5NzMzLDIyMy4zMTM3MDggNDYuODAxMjY0OCwyMjYgNTAuMTE0OTczMywyMjYgWiIgaWQ9Ik92YWwtMSI+PC9wYXRoPiAgICAgICAgPC9nPiAgICA8L2c+PC9zdmc+"); } .auth0-lock-password-strength li { line-height: 1.5; margin-top: 5px; font-size: 13px; transition: color 0.3s ease-in; position: relative; } .auth0-lock-password-strength li.auth0-lock-checked { color: #7ed321; } .auth0-lock-password-strength li.auth0-lock-checked > span { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+PHN2ZyB3aWR0aD0iMTNweCIgaGVpZ2h0PSIxMnB4IiB2aWV3Qm94PSIwIDAgMTMgMTIiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+ICAgICAgICA8dGl0bGU+R3JvdXAgNDwvdGl0bGU+ICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPiAgICA8ZGVmcz48L2RlZnM+ICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPiAgICAgICAgPGcgaWQ9IklwaG9uZS02LS0tTmF0aXZlIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgtNDQuMDAwMDAwLCAtMjQwLjAwMDAwMCkiPiAgICAgICAgICAgIDxnIGlkPSJHcm91cC00IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg0NC4xMTQ5NzMsIDI0MC4wMDAwMDApIj4gICAgICAgICAgICAgICAgPGVsbGlwc2UgaWQ9Ik92YWwtOTAiIGZpbGw9IiM4MEQxMzUiIGN4PSI2IiBjeT0iNiIgcng9IjYiIHJ5PSI2Ij48L2VsbGlwc2U+ICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik00LjU0MjM1MzYxLDcuNzMzNzgwNzYgTDIuNjQ1ODIxNDksNS44NjgwMDg5NSBMMiw2LjQ5ODg4MTQzIEw0LjU0MjM1MzYxLDkgTDEwLDMuNjMwODcyNDggTDkuMzU4NzI2NTUsMyBMNC41NDIzNTM2MSw3LjczMzc4MDc2IFoiIGlkPSJTaGFwZSIgZmlsbD0iI0ZGRkZGRiI+PC9wYXRoPiAgICAgICAgICAgIDwvZz4gICAgICAgIDwvZz4gICAgPC9nPjwvc3ZnPg=="); } .auth0-lock-error-msg { color: #f00; font-size: 12px; margin-top: 5px; white-space: nowrap; } .auth0-lock .auth0-loading-screen { min-height: 42px; box-sizing: border-box; } @media screen and (max-width: 480px) { .auth0-lock .auth0-loading-screen { position: absolute; top: calc(50vh - 100%); left: calc(50vw - 15px); padding: 0; } } .auth0-lock .auth0-loading-screen .auth0-loading-container { display: block; } .auth0-lock .auth0-sso-notice-container { background: rgba(0,0,0,0.03); color: rgba(0,0,0,0.54); padding: 10px 0; margin: -20px -20px 20px; text-align: center; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; } .auth0-lock .auth0-sso-notice-container .auth0-lock-icon { width: 12px; height: 14px; position: relative; top: 2px; right: 2px; } .auth0-lock .auth0-lock-last-login-pane .auth0-lock-social-button.auth0-lock-social-big-button { margin-top: 0; } .auth0-lock .auth0-lock-last-login-pane .auth0-lock-social-button[data-provider="auth0"] .auth0-lock-social-button-text { text-transform: none; font-size: 12px; font-weight: normal; } .auth0-lock .auth0-lock-sign-up-terms-agreement label input { margin-right: 5px; position: relative; } .auth0-lock-input-show-password { position: relative; } .auth0-lock-input-show-password .auth0-lock-show-password { position: absolute; top: 14px; right: 12px; width: 20px; height: 14px; } .auth0-lock-input-show-password .auth0-lock-show-password input[type=checkbox] { display: none; } .auth0-lock-input-show-password .auth0-lock-show-password input[type=checkbox] + label { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHdpZHRoPSIyMHB4IiBoZWlnaHQ9IjE0cHgiIHZpZXdCb3g9IjAgMCAyMCAxNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4gICAgICAgIDx0aXRsZT5zaG93X3Bhc3N3b3JkX2luYWN0aXZlPC90aXRsZT4gICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+ICAgIDxkZWZzPjwvZGVmcz4gICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+ICAgICAgICA8ZyBpZD0ic2hvd19wYXNzd29yZF9pbmFjdGl2ZSIgZmlsbC1ydWxlPSJub256ZXJvIiBmaWxsPSIjQ0NDQ0NDIj4gICAgICAgICAgICA8cGF0aCBkPSJNMjAsNy4xNDY0NjA3MSBDMjAsNy4zMjQ1NTU5MyAxOS44OTM4NzQ5LDcuNTA0OTY0MDcgMTkuNzg5NzkwNiw3LjYyMjkyMzI5IEMxOS41Nzk1ODExLDcuOTIxMjkwNjQgMTkuMzY5MzcxNiw4LjE1OTUyMTkzIDE5LjEwNjA5OTYsOC40NTc4ODkyMSBDMTcuODQyODAyMSw5Ljg4OTU4OTkzIDE2LjQyMDMxNjksMTEuMTQzMTk1NCAxNC44NDA2ODQ3LDEyLjA5ODQzMzUgQzEzLjg0MDY1OTIsMTIuNjk1MTY4MSAxMi43ODc1NzExLDEzLjE3Mzk0MzcgMTEuNjgxNDIwNCwxMy40MTIxNzUgQzEwLjQ2OTE0NDYsMTMuNjUwNDA2MyA5LjI1ODkwOTY0LDEzLjY1MDQwNjMgOC4wNDY2MzM4NiwxMy4zNTIwMzg5IEM1LjkzODQxNjgxLDEyLjgxNTQ0MDMgNC4wNDI0NTAwNCwxMS41NjE4MzQ5IDIuMzU2NjkyNzcsMTAuMDA5ODYyMSBDMS41NjY4NzY3MSw5LjI5Mjg1NTI5IDAuODMwMTIzMjE0LDguNTE4MDI1MjkgMC4xOTc0NTQwMTYsNy42MjI5MjMyOSBDLTAuMDY1ODE4MDA1Myw3LjI2NDQxOTg2IC0wLjA2NTgxODAwNTMsNi43ODc5NTczIDAuMTk3NDU0MDE2LDYuNDI5NDUzODcgQzAuNDA3NjYzNDU5LDYuMTMxMDg2NTUgMC42MTc4NzI5MDYsNS44OTI4NTUyNiAwLjg4MTE0NDkyOSw1LjU5NDQ4NzkgQzIuMTQ0NDQyNDYsNC4xNjI3ODcyMSAzLjU2NjkyNzczLDIuOTA5MTgxNzcgNS4xNDY1NTk4NSwxLjk1Mzk0MzY4IEM2LjE0NjU4NTM2LDEuMzU3MjA4OTkgNy4xOTk2NzM0MywwLjg3ODQzMzQ3MSA4LjMwNTgyNDE0LDAuNjQwMjAyMTgxIEM5LjUxODEsMC40MDE5NzA4ODkgMTAuNzI4MzM0OSwwLjQwMTk3MDg4OSAxMS45NDA2MTA3LDAuNzAwMzM4MjM2IEMxNC4wNDY3ODY5LDEuMjM2OTM2ODggMTUuOTQyNzUzNiwyLjQ5MDU0MjMxIDE3LjYyODUxMDksNC4wNDI1MTUxMSBDMTguNDE4MzI3LDQuNzU5NTIxOTEgMTkuMTU1MDgwNSw1LjUzNDM1MTgzIDE5Ljc4Nzc0OTYsNi40Mjk0NTM4NyBDMTkuODkzODc0OSw2LjU0OTcyNjAxIDE5Ljk5Nzk1OTEsNi43Mjc4MjEyMyAxOS45OTc5NTkxLDYuOTA1OTE2NDUgQzIwLDcuMDI2MTg4NTkgMjAsNy4wMjYxODg1OSAyMCw3LjA4NjMyNDYyIEMyMCw3LjE0NjQ2MDcxIDIwLDcuMTQ2NDYwNzEgMjAsNy4xNDY0NjA3MSBaIE05Ljk5MTk0NjA3LDIuMjkyOTUyNDIgQzcuNDk4OTQzMTQsMi4yOTI5NTI0MiA1LjQ1MjAwNDM4LDQuMzM5ODkxMiA1LjQ1MjAwNDM4LDYuODMyODk0MTMgQzUuNDUyMDA0MzgsOS4zMjU4OTcgNy40OTg5NDMxNCwxMS4zNzI4MzU5IDkuOTkxOTQ2MDcsMTEuMzcyODM1OSBDMTIuNDg0OTQ5LDExLjM3MjgzNTkgMTQuNTMxODg3Nyw5LjMyNTg5NyAxNC41MzE4ODc3LDYuODMyODk0MTMgQzE0LjUzMTg4NzcsNC4zMzk4OTEyIDEyLjQ4NDk0OSwyLjI5Mjk1MjQyIDkuOTkxOTQ2MDcsMi4yOTI5NTI0MiBaIE05Ljk5MTk0NjA3LDkuMTM3NTU4NzkgQzguNzEzMjI4ODYsOS4xMzc1NTg3OSA3LjY4OTc1OTQzLDguMTE0MDg5NDMgNy42ODk3NTk0Myw2LjgzNTM3MjI0IEM3LjY4OTc1OTQzLDUuNTU2NjU1MDcgOC43MTMyMjg4Niw0LjUzMzE4NTY2IDkuOTkxOTQ2MDcsNC41MzMxODU2NiBDMTEuMjcwNjYzMyw0LjUzMzE4NTY2IDEyLjI5NDEzMjYsNS41NTY2NTUwNyAxMi4yOTQxMzI2LDYuODM1MzcyMjQgQzEyLjI5NDEzMjYsOC4xMTQwODk0MyAxMS4yNzA2NjMzLDkuMTM3NTU4NzkgOS45OTE5NDYwNyw5LjEzNzU1ODc5IFoiIGlkPSJTaGFwZSI+PC9wYXRoPiAgICAgICAgPC9nPiAgICA8L2c+PC9zdmc+"); width: 20px; height: 14px; display: inline-block; cursor: pointer; vertical-align: top; } .auth0-lock-input-show-password .auth0-lock-show-password input[type=checkbox]:checked + label { background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c3ZnIHdpZHRoPSIyMHB4IiBoZWlnaHQ9IjE0cHgiIHZpZXdCb3g9IjAgMCAyMCAxNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4gICAgICAgIDx0aXRsZT5zaG93X3Bhc3N3b3JkX2FjdGl2ZTwvdGl0bGU+ICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPiAgICA8ZGVmcz48L2RlZnM+ICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPiAgICAgICAgPGcgaWQ9InNob3dfcGFzc3dvcmRfYWN0aXZlIiBmaWxsLXJ1bGU9Im5vbnplcm8iIGZpbGw9IiMyMEI0RkYiPiAgICAgICAgICAgIDxwYXRoIGQ9Ik0yMCw3LjE0NjQ2MDcxIEMyMCw3LjMyNDU1NTkzIDE5Ljg5Mzg3NDksNy41MDQ5NjQwNyAxOS43ODk3OTA2LDcuNjIyOTIzMjkgQzE5LjU3OTU4MTEsNy45MjEyOTA2NCAxOS4zNjkzNzE2LDguMTU5NTIxOTMgMTkuMTA2MDk5Niw4LjQ1Nzg4OTIxIEMxNy44NDI4MDIxLDkuODg5NTg5OTMgMTYuNDIwMzE2OSwxMS4xNDMxOTU0IDE0Ljg0MDY4NDcsMTIuMDk4NDMzNSBDMTMuODQwNjU5MiwxMi42OTUxNjgxIDEyLjc4NzU3MTEsMTMuMTczOTQzNyAxMS42ODE0MjA0LDEzLjQxMjE3NSBDMTAuNDY5MTQ0NiwxMy42NTA0MDYzIDkuMjU4OTA5NjQsMTMuNjUwNDA2MyA4LjA0NjYzMzg2LDEzLjM1MjAzODkgQzUuOTM4NDE2ODEsMTIuODE1NDQwMyA0LjA0MjQ1MDA0LDExLjU2MTgzNDkgMi4zNTY2OTI3NywxMC4wMDk4NjIxIEMxLjU2Njg3NjcxLDkuMjkyODU1MjkgMC44MzAxMjMyMTQsOC41MTgwMjUyOSAwLjE5NzQ1NDAxNiw3LjYyMjkyMzI5IEMtMC4wNjU4MTgwMDUzLDcuMjY0NDE5ODYgLTAuMDY1ODE4MDA1Myw2Ljc4Nzk1NzMgMC4xOTc0NTQwMTYsNi40Mjk0NTM4NyBDMC40MDc2NjM0NTksNi4xMzEwODY1NSAwLjYxNzg3MjkwNiw1Ljg5Mjg1NTI2IDAuODgxMTQ0OTI5LDUuNTk0NDg3OSBDMi4xNDQ0NDI0Niw0LjE2Mjc4NzIxIDMuNTY2OTI3NzMsMi45MDkxODE3NyA1LjE0NjU1OTg1LDEuOTUzOTQzNjggQzYuMTQ2NTg1MzYsMS4zNTcyMDg5OSA3LjE5OTY3MzQzLDAuODc4NDMzNDcxIDguMzA1ODI0MTQsMC42NDAyMDIxODEgQzkuNTE4MSwwLjQwMTk3MDg4OSAxMC43MjgzMzQ5LDAuNDAxOTcwODg5IDExLjk0MDYxMDcsMC43MDAzMzgyMzYgQzE0LjA0Njc4NjksMS4yMzY5MzY4OCAxNS45NDI3NTM2LDIuNDkwNTQyMzEgMTcuNjI4NTEwOSw0LjA0MjUxNTExIEMxOC40MTgzMjcsNC43NTk1MjE5MSAxOS4xNTUwODA1LDUuNTM0MzUxODMgMTkuNzg3NzQ5Niw2LjQyOTQ1Mzg3IEMxOS44OTM4NzQ5LDYuNTQ5NzI2MDEgMTkuOTk3OTU5MSw2LjcyNzgyMTIzIDE5Ljk5Nzk1OTEsNi45MDU5MTY0NSBDMjAsNy4wMjYxODg1OSAyMCw3LjAyNjE4ODU5IDIwLDcuMDg2MzI0NjIgQzIwLDcuMTQ2NDYwNzEgMjAsNy4xNDY0NjA3MSAyMCw3LjE0NjQ2MDcxIFogTTkuOTkxOTQ2MDcsMi4yOTI5NTI0MiBDNy40OTg5NDMxNCwyLjI5Mjk1MjQyIDUuNDUyMDA0MzgsNC4zMzk4OTEyIDUuNDUyMDA0MzgsNi44MzI4OTQxMyBDNS40NTIwMDQzOCw5LjMyNTg5NyA3LjQ5ODk0MzE0LDExLjM3MjgzNTkgOS45OTE5NDYwNywxMS4zNzI4MzU5IEMxMi40ODQ5NDksMTEuMzcyODM1OSAxNC41MzE4ODc3LDkuMzI1ODk3IDE0LjUzMTg4NzcsNi44MzI4OTQxMyBDMTQuNTMxODg3Nyw0LjMzOTg5MTIgMTIuNDg0OTQ5LDIuMjkyOTUyNDIgOS45OTE5NDYwNywyLjI5Mjk1MjQyIFogTTkuOTkxOTQ2MDcsOS4xMzc1NTg3OSBDOC43MTMyMjg4Niw5LjEzNzU1ODc5IDcuNjg5NzU5NDMsOC4xMTQwODk0MyA3LjY4OTc1OTQzLDYuODM1MzcyMjQgQzcuNjg5NzU5NDMsNS41NTY2NTUwNyA4LjcxMzIyODg2LDQuNTMzMTg1NjYgOS45OTE5NDYwNyw0LjUzMzE4NTY2IEMxMS4yNzA2NjMzLDQuNTMzMTg1NjYgMTIuMjk0MTMyNiw1LjU1NjY1NTA3IDEyLjI5NDEzMjYsNi44MzUzNzIyNCBDMTIuMjk0MTMyNiw4LjExNDA4OTQzIDExLjI3MDY2MzMsOS4xMzc1NTg3OSA5Ljk5MTk0NjA3LDkuMTM3NTU4NzkgWiIgaWQ9IlNoYXBlIj48L3BhdGg+ICAgICAgICA8L2c+ICAgIDwvZz48L3N2Zz4="); } .auth0-lock-recaptcha-block { border-radius: 4px; height: 65px; } .auth0-lock-recaptcha-block.auth0-lock-recaptcha-block-error { border: 1px solid #f00; } .auth0-lock-recaptcha-block .auth0-lock-recaptchav2 { transform: scale(0.855); transform-origin: 0px 0px; position: relative; } input[type="button"] { cursor: pointer; } .auth0-lock-hidden { display: none; } _:-ms-fullscreen, :root .auth0-lock.auth0-lock .auth0-lock-content-wrapper { -ms-flex-preferred-size: auto !important; flex-basis: auto !important; max-height: 70vh; } ',m=function(t){function e(i,a){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},u=arguments[3];if(r(this,e),"string"!=typeof i)throw new Error("A `clientID` string must be provided as first argument.");if("string"!=typeof a)throw new Error("A `domain` string must be provided as second argument.");if("object"!=(void 0===s?"undefined":y(s)))throw new Error("When provided, the third argument must be an `options` object.");var p=o(this,t.call(this));p.validEvents=["show","hide","unrecoverable_error","authenticated","authorization_error","hash_parsed","signin ready","signup ready","socialOrPhoneNumber ready","socialOrEmail ready","vcode ready","forgot_password ready","forgot_password submit","signin submit","signup submit","signup success","signup error","socialOrPhoneNumber submit","socialOrEmail submit","vcode submit","federated login","ssodata fetched","sso login"],p.id=h.a(),p.engine=u;var N=p.runHook.bind(p),m=p.emit.bind(p),D=p.on.bind(p);n.i(f.a)(p.id);var j=n.i(d.a)(p.id,i,a,s,N,m,D);return p.on("newListener",function(t){-1===p.validEvents.indexOf(t)&&M.emitUnrecoverableErrorEvent(j,'Invalid event "'+t+'".')}),M.auth.autoParseHash(j)&&!e.hasScheduledAuthCallback&&(e.hasScheduledAuthCallback=!0,setTimeout(d.b,0)),n.i(c.a)("render",p.id,function(t){var e=function(e,n){var r=e[n](t);return r?function(){for(var e=arguments.length,n=Array(e),o=0;o<e;o++)n[o]=arguments[o];return r.apply(void 0,[M.id(t)].concat(n))}:r},r=M.ui.avatar(t)&&"ok"===t.getIn(["avatar","transient","syncStatus"])||null;if(M.rendering(t)){var o=p.engine.render(t),i=r?g.str(t,"welcome",t.getIn(["avatar","transient","displayName"])):o.getTitle(t),a=o.isSubmitDisabled(t),s={group:function(e){return g.group(t,e)},html:function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return g.html.apply(g,[t,e].concat(r))},str:function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return g.str.apply(g,[t,e].concat(r))}},u={avatar:r&&t.getIn(["avatar","transient","url"]),auxiliaryPane:o.renderAuxiliaryPane(t),autofocus:M.ui.autofocus(t),backHandler:e(o,"backHandler"),badgeLink:"https://auth0.com/?utm_source=lock&utm_campaign=badge&utm_medium=widget",closeHandler:M.ui.closable(t)?function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return d.c.apply(void 0,[M.id(t)].concat(n))}:void 0,contentComponent:o.render(),contentProps:{i18n:s,model:t},disableSubmitButton:a,error:M.globalError(t),info:M.globalInfo(t),isMobile:M.ui.mobile(t),isModal:M.ui.appendContainer(t),isSubmitting:M.submitting(t),language:M.ui.language(t),logo:M.ui.logo(t),primaryColor:M.ui.primaryColor(t),screenName:o.name,showBadge:!0===M.showBadge(t),success:M.globalSuccess(t),submitButtonLabel:M.ui.labeledSubmitButton(t)?o.submitButtonLabel(t):null,submitHandler:e(o,"submitHandler"),tabs:o.renderTabs(t),terms:o.renderTerms(t,s.html("signUpTerms")),title:function(t){return M.ui.hideMainScreenTitle(t)&&o.isFirstScreen(t)?null:i}(t),classNames:"loading"===o.name?"fade":"horizontal-fade",scrollGlobalMessagesIntoView:M.ui.scrollGlobalMessagesIntoView(t),suppressSubmitOverlay:M.suppressSubmitOverlay(t)||!1};n.i(l.a)(M.ui.containerID(t),u),p.oldScreenName&&p.oldScreenName==o.name||("main.login"===o.name?M.emitEvent(t,"signin ready"):"main.signUp"===o.name?M.emitEvent(t,"signup ready"):"forgotPassword"===o.name?M.emitEvent(t,"forgot_password ready"):"socialOrEmail"===o.name?M.emitEvent(t,"socialOrEmail ready"):"socialOrPhoneNumber"===o.name?M.emitEvent(t,"socialOrPhoneNumber ready"):"vcode"===o.name&&M.emitEvent(t,"vcode ready")),p.oldScreenName=o.name}else n.i(l.b)(M.ui.containerID(t))}),p}return i(e,t),e.prototype.resumeAuth=function(t,e){n.i(d.d)(t,e)},e.prototype.show=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n.i(d.e)(this.id,t)},e.prototype.hide=function(){n.i(d.c)(this.id,!0)},e.prototype.destroy=function(){n.i(d.f)(this.id)},e.prototype.getProfile=function(t,e){return this.getUserInfo(t,e)},e.prototype.getUserInfo=function(t,e){return p.a.getUserInfo(this.id,t,e)},e.prototype.checkSession=function(t,e){return p.a.checkSession(this.id,t,e)},e.prototype.logout=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};p.a.logout(this.id,t)},e.prototype.update=function(t){return n.i(d.g)(this.id,t)},e.prototype.setModel=function(t){return this.update(function(){return t})},e.prototype.runHook=function(t,e){for(var n,r=M.hooks(e).toJS(),o=arguments.length,i=Array(o>2?o-2:0),a=2;a<o;a++)i[a-2]=arguments[a];return-1!==M.validPublicHooks.indexOf(t)?"function"==typeof r[t]?(r[t].apply(r,i),e):("function"==typeof i[1]&&i[1](),e):"function"!=typeof this.engine[t]?e:(n=this.engine)[t].apply(n,[e].concat(i))},e}(u.EventEmitter);e.c=m},function(t,e,n){"use strict";function r(t){return["free","dev"].indexOf(w(t,["tenant","subscription"]))>-1}function o(t,e){return t.getIn(["client","strategies"],n.i(M.List)()).find(i(e))||n.i(M.Map)()}function i(t){return function(e){return e.get("name")===t}}function a(t){return"auth0"===t?"database":"email"===t||"sms"===t?"passwordless":N.a[t]?"social":m.a[t]?"enterprise":-1!==["oauth1","oauth2"].indexOf(t)?"social":"unknown"}function s(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(null==t.username)return null;var e=D({},L,t),n=L.username.min,r=L.username.max;return e.username.min=parseInt(e.username.min,10)||n,e.username.max=parseInt(e.username.max,10)||r,e.username.min>e.username.max&&(e.username.min=n,e.username.max=r),e}function u(t,e){return I(t,c(e))}function c(t){return new h.a.fromJS({id:t.id,tenant:{name:t.tenant,subscription:t.subscription},connections:l(t)})}function l(t){for(var e=v.toJS(),n=0;n<(t.strategies||[]).length;n++)!function(){var r,o=t.strategies[n],i=a(o.name),s=o.connections.map(function(t){return p(i,o.name,t)});(r=e[i]).push.apply(r,s)}();return e}function p(t,e,n){var r={name:n.name,strategy:e,type:t,displayName:n.display_name};if("database"===t&&(r.passwordPolicy=f.a[n.passwordPolicy||"none"],n.password_complexity_options&&n.password_complexity_options.min_length&&(r.passwordPolicy.length.minLength=n.password_complexity_options.min_length),r.allowSignup="boolean"!=typeof n.showSignup||n.showSignup,r.allowForgot="boolean"!=typeof n.showForgot||n.showForgot,r.requireUsername="boolean"==typeof n.requires_username&&n.requires_username,r.validation=s(n.validation)),"enterprise"===t){var o=n.domain_aliases||[];n.domain&&o.unshift(n.domain),r.domains=o}return r}function d(t){return w(t,"connections",v)}e.b=r,e.c=u,e.a=d;var M=n(11),h=n.n(M),g=n(100),f=n.n(g),y=n(20),N=n(47),m=n(16),D=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},j=n.i(y.a)(["client"]),I=j.initNS,w=j.get,L={username:{min:1,max:15}},v=h.a.fromJS({database:[],enterprise:[],passwordless:[],social:[],unknown:[]})},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=n(14),p=(n(1),function(t){function e(){return r(this,e),o(this,t.call(this,"error"))}return i(e,t),e.prototype.render=function(){return d},e}(l.a));e.a=p;var d=function(t){var e=t.i18n;return c.a.createElement("div",{className:"auth0-lock-error-pane"},c.a.createElement("p",null,e.html("unrecoverableError")))};d.propTypes={i18n:s.a.object.isRequired}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=n(14),p=n(17),d=n(1),M=function(t){function e(){return r(this,e),o(this,t.call(this,"loading"))}return i(e,t),e.prototype.render=function(){return h},e}(l.a);e.a=M;var h=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.componentDidMount=function(){var t=this.props.model;n.i(p.l)(d.id(t)),setTimeout(function(){return n.i(p.m)(d.id(t))},500)},e.prototype.render=function(){return c.a.createElement("div",{className:"auth0-loading-screen"},c.a.createElement("div",{className:"auth0-loading-container"},c.a.createElement("div",{className:"auth0-loading"})))},e}(c.a.Component);h.propTypes={model:s.a.object.isRequired}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){return g.a[t]?t:"google-apps"===t?t:~["adfs","office365","waad"].indexOf(t)?"windows":"auth0"}var s=n(0),u=n.n(s),c=n(14),l=n(73),p=n(53),d=n(49),M=n(1),h=n(19),g=n(47),f=function(t){var e=t.i18n,r=t.model,o=e.html("lastLoginInstructions")||null,i=o&&u.a.createElement("p",null,o),s=n.i(g.b)(r),c=n.i(d.a)(r).get("name"),h=s.get(c),f=h&&h.get("primaryColor"),y=h&&h.get("foregroundColor"),N=h&&h.get("icon"),m=function(){window.location.host===M.domain(r)?n.i(p.a)(M.id(r),n.i(d.a)(r),n.i(d.b)(r)):n.i(p.b)(M.id(r),n.i(d.a)(r),n.i(d.b)(r))},D=n.i(d.b)(r)||g.a[c]||c;return u.a.createElement(l.a,{alternativeLabel:e.str("notYourAccountAction"),alternativeClickHandler:function(){return n.i(p.c)(M.id(r))},buttonLabel:D,buttonClickHandler:m,header:i,strategy:a(n.i(d.a)(r).get("strategy")||c),buttonIcon:N,primaryColor:f,foregroundColor:y})},y=function(t){function e(){return r(this,e),o(this,t.call(this,"lastLogin"))}return i(e,t),e.prototype.renderAuxiliaryPane=function(t){return n.i(h.a)(t)},e.prototype.render=function(){return f},e}(c.a);e.a=y},function(t,e,n){"use strict";function r(t){return!!t}function o(t,e,o){return t=n.i(a.e)(t,"captcha",e,r),o&&(t=n.i(a.n)(t,"captcha",!0)),t}function i(t,e){return o(t,"",e)}e.b=o,e.a=i;var a=n(4)},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(0),s=n.n(a),u=n(2),c=n.n(u),l=n(205),p=n(1),d=n(8),M=n(110),h=n(4),g=n(186),f=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.render=function(){function t(t){n.i(d.b)(d.c,"lock",a,M.b,t.target.value)}var e=this.props,r=e.i18n,o=e.lock,i=e.onReload,a=p.id(o),u=p.captcha(o),c=n.i(h.c)(o,"captcha"),f=!n.i(h.k)(o,"captcha"),y=u.get("provider");if(n.i(g.a)(y)){var N=function(t){n.i(d.b)(d.c,"lock",a,M.b,t)},m=function(){N()};return s.a.createElement(g.b,{provider:y,sitekey:u.get("siteKey"),onChange:N,onExpired:m,hl:p.ui.language(o),isValid:f,value:c})}var D="code"===u.get("type")?r.str("captchaCodeInputPlaceholder"):r.str("captchaMathInputPlaceholder");return s.a.createElement(l.a,{lockId:a,image:u.get("image"),placeholder:D,isValid:f,onChange:t,onReload:i,value:c,invalidHint:r.str("blankErrorHint")||r.str("blankCaptchaErrorHint")})},e}(s.a.Component);e.a=f,f.propTypes={i18n:c.a.object.isRequired,lock:c.a.object.isRequired,error:c.a.bool,onReload:c.a.func.isRequired},f.defaultProps={error:!1}},function(t,e,n){"use strict";(function(t){function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}n.d(e,"a",function(){return I});var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=n(200),p=n(54),d=n(1),M=n(4),h=n(8),g=c.a.createElement("svg",{focusable:"false",width:"58px",height:"21px",viewBox:"0 0 462 168"},c.a.createElement("g",{id:"Page-1",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},c.a.createElement("g",{id:"logo-grey-horizontal"},c.a.createElement("g",{id:"Group"},c.a.createElement("g",{id:"LogoText",transform:"translate(188.000000, 41.500000)",fill:"#D0D2D3"},c.a.createElement("path",{d:"M246.517,0.11 C238.439,0.11 231.607,3.916 226.759,11.115 C221.94,18.271 219.393,28.26 219.393,40 C219.393,51.74 221.94,61.729 226.759,68.884 C231.607,76.084 238.439,79.889 246.517,79.889 C254.595,79.889 261.427,76.084 266.275,68.884 C271.093,61.729 273.64,51.74 273.64,40 C273.64,28.26 271.093,18.271 266.275,11.115 C261.427,3.916 254.595,0.11 246.517,0.11 L246.517,0.11 Z M246.517,70.005 C242.655,70.005 239.604,67.82 237.187,63.324 C234.268,57.893 232.66,49.61 232.66,40 C232.66,30.39 234.268,22.106 237.187,16.676 C239.604,12.18 242.655,9.994 246.517,9.994 C250.378,9.994 253.43,12.18 255.847,16.676 C258.766,22.106 260.373,30.389 260.373,40 C260.373,49.611 258.766,57.895 255.847,63.324 C253.43,67.82 250.378,70.005 246.517,70.005 L246.517,70.005 Z M71.45,29.172 L71.45,63.484 C71.45,72.53 78.81,79.889 87.856,79.889 C95.746,79.889 101.707,75.975 103.902,74.291 C104.024,74.197 104.184,74.169 104.331,74.216 C104.478,74.263 104.592,74.379 104.637,74.527 L105.961,78.86 L115.737,78.86 L115.737,29.172 L103.175,29.172 L103.175,66.326 C103.175,66.501 103.076,66.662 102.921,66.743 C100.559,67.961 95.899,70.006 91.231,70.006 C87.252,70.006 84.012,66.768 84.012,62.787 L84.012,29.172 L71.45,29.172 L71.45,29.172 Z M197.237,78.859 L209.8,78.859 L209.8,44.547 C209.8,35.501 202.44,28.141 193.394,28.141 C186.735,28.141 181.393,31.004 178.802,32.71 C178.657,32.805 178.473,32.813 178.322,32.731 C178.171,32.649 178.075,32.491 178.075,32.318 L178.075,1.141 L165.513,1.141 L165.513,78.859 L178.075,78.859 L178.075,41.704 C178.075,41.529 178.174,41.368 178.33,41.288 C180.691,40.069 185.352,38.025 190.019,38.025 C191.947,38.025 193.76,38.776 195.123,40.139 C196.486,41.502 197.236,43.316 197.236,45.243 L197.236,78.859 L197.237,78.859 Z M124.792,39.055 L132.438,39.055 C132.697,39.055 132.907,39.265 132.907,39.524 L132.907,66.858 C132.907,74.043 138.753,79.888 145.938,79.888 C148.543,79.888 151.113,79.512 153.585,78.77 L153.585,69.796 C152.143,69.923 150.485,70.005 149.313,70.005 C147.193,70.005 145.469,68.28 145.469,66.161 L145.469,39.523 C145.469,39.264 145.679,39.054 145.938,39.054 L153.585,39.054 L153.585,29.171 L145.938,29.171 C145.679,29.171 145.469,28.961 145.469,28.702 L145.469,12.295 L132.907,12.295 L132.907,28.702 C132.907,28.961 132.697,29.171 132.438,29.171 L124.792,29.171 L124.792,39.055 L124.792,39.055 Z M51.361,78.859 L64.429,78.859 L44.555,9.55 C42.962,3.992 37.811,0.11 32.029,0.11 C26.247,0.11 21.096,3.992 19.502,9.55 L-0.372,78.859 L12.697,78.859 L18.449,58.798 C18.507,58.597 18.691,58.459 18.9,58.459 L45.158,58.459 C45.367,58.459 45.552,58.597 45.609,58.798 L51.361,78.859 L51.361,78.859 Z M42.056,48.576 L22.004,48.576 C21.857,48.576 21.718,48.507 21.629,48.388 C21.541,48.272 21.513,48.119 21.553,47.978 L31.579,13.012 C31.637,12.811 31.821,12.673 32.03,12.673 C32.239,12.673 32.423,12.811 32.48,13.012 L42.507,47.978 C42.547,48.12 42.519,48.272 42.43,48.388 C42.342,48.507 42.203,48.576 42.056,48.576 L42.056,48.576 Z",id:"Shape"})),c.a.createElement("g",{id:"LogoBadge",fillOpacity:"0.4",fill:"#FFFFFF"},c.a.createElement("path",{d:"M119.555,135.861 L102.705,83.997 L146.813,51.952 L92.291,51.952 L75.44,0.09 L75.435,0.076 L129.965,0.076 L146.82,51.947 L146.821,51.946 L146.835,51.938 C156.623,82.03 146.542,116.256 119.555,135.861 L119.555,135.861 Z M31.321,135.861 L31.307,135.871 L75.426,167.924 L119.555,135.862 L75.44,103.808 L31.321,135.861 L31.321,135.861 Z M4.052,51.939 L4.052,51.939 C-6.252,83.66 5.709,117.272 31.312,135.867 L31.316,135.851 L48.168,83.99 L4.07,51.951 L58.579,51.951 L75.431,0.089 L75.435,0.075 L20.902,0.075 L4.052,51.939 L4.052,51.939 Z",id:"Shape"})))))),f=function(t){var e=t.link;return c.a.createElement("span",{className:"auth0-lock-badge-bottom"},c.a.createElement("a",{href:e,target:"_blank",className:"auth0-lock-badge",rel:"noopener noreferrer"},"Protected with ",g))},y=function(t){var e=t.imageUrl;return c.a.createElement("img",{src:e,className:"auth0-lock-header-avatar"})};y.propTypes={imageUrl:s.a.string.isRequired};var N=function(){function e(n){i(this,e),this.handler=function(t){27==t.keyCode&&"INPUT"!=t.target.tagName.toUpperCase()&&n()},t.document.addEventListener("keydown",this.handler,!1)}return e.prototype.release=function(){t.document.removeEventListener("keydown",this.handler)},e}(),m=t.navigator&&!!t.navigator.userAgent.match(/iPhone/i),D=function(t){function e(n){i(this,e);var o=r(this,t.call(this,n));return o.state={isOpen:!1},o}return o(e,t),e.prototype.checkConnectionResolver=function(t){var e=this.props.contentProps,r=e.model,o=d.connectionResolver(r);if(!o)return t();var i=r.get("client").toJS(),a=i.connections,s=i.id,u={connections:a,id:s};o(M.c(r,"username")||M.c(r,"email"),u,function(e){n.i(h.b)(h.c,"lock",d.id(r),function(t){return d.setResolvedConnection(t,e)}),t()})},e.prototype.componentDidMount=function(){var t=this;this.props.isModal&&setTimeout(function(){return t.setState({isOpen:!0})},17),this.props.closeHandler&&(this.escKeydown=new N(this.handleEsc.bind(this)))},e.prototype.componentWillUnmount=function(){this.escKeydown&&this.escKeydown.release()},e.prototype.handleSubmit=function(t){var e=this;t.preventDefault(),this.props.isSubmitting||this.checkConnectionResolver(function(){var t=e.props.submitHandler;t&&(setTimeout(function(){e.props.isSubmitting||e.refs.chrome.focusError()},17),t())})},e.prototype.handleClose=function(){var t=this.props,e=t.closeHandler;t.isSubmitting||e()},e.prototype.handleEsc=function(){var t=this.props,e=(t.closeHandler,t.escHandler);e?e():this.handleClose()},e.prototype.hide=function(){this.setState({isOpen:!1})},e.prototype.render=function(){var t=this.props,e=t.autofocus,n=t.avatar,r=t.auxiliaryPane,o=t.backHandler,i=t.badgeLink,a=t.closeHandler,s=t.contentComponent,u=t.contentProps,d=t.disableSubmitButton,M=(t.disallowClose,t.error),h=t.info,g=t.isMobile,N=t.isModal,D=t.isSubmitting,j=t.logo,I=t.primaryColor,w=t.screenName,L=t.showBadge,v=t.submitButtonLabel,z=t.submitHandler,b=t.success,C=t.tabs,T=t.terms,E=t.title,x=t.classNames,k=t.scrollGlobalMessagesIntoView,O=t.suppressSubmitOverlay,S=L?c.a.createElement(f,{link:i}):null,A=N?c.a.createElement("div",{className:"auth0-lock-overlay"},S):null,U="auth0-lock";return N&&this.state.isOpen&&(U+=" auth0-lock-opened"),N||(U+=" auth0-lock-opened-in-frame"),g&&(U+=" auth0-lock-mobile"),D&&!O&&(U+=" auth0-lock-mode-loading"),r&&(U+=" auth0-lock-auxiliary"),z||(U+=" auth0-lock-no-submit"),T&&(U+=" auth0-lock-with-terms"),m&&(U+=" auth0-lock-iphone"),C&&(U+=" auth0-lock-with-tabs"),c.a.createElement("div",{className:U,lang:this.props.language},A,c.a.createElement("div",{className:"auth0-lock-center"},c.a.createElement("form",{className:"auth0-lock-widget",method:"post",noValidate:!0,onSubmit:this.handleSubmit.bind(this)},n&&c.a.createElement(y,{imageUrl:n}),a&&c.a.createElement(p.b,{onClick:this.handleClose.bind(this)}),c.a.createElement("div",{className:"auth0-lock-widget-container"},c.a.createElement(l.a,{autofocus:e,avatar:n,auxiliaryPane:r,backHandler:o,contentComponent:s,contentProps:u,disableSubmitButton:d,error:M,info:h,isSubmitting:D,logo:j,screenName:w,primaryColor:I,ref:"chrome",showSubmitButton:!!z,submitButtonLabel:v,success:b,tabs:C,terms:T,title:E,classNames:x,scrollGlobalMessagesIntoView:k})))))},e}(c.a.Component);e.b=D,D.propTypes={autofocus:s.a.bool.isRequired,avatar:s.a.string,auxiliaryPane:s.a.element,backHandler:s.a.func,badgeLink:s.a.string.isRequired,closeHandler:s.a.func,contentComponent:s.a.func.isRequired,contentProps:s.a.object.isRequired,disableSubmitButton:s.a.bool.isRequired,error:s.a.node,info:s.a.node,isMobile:s.a.bool.isRequired,isModal:s.a.bool.isRequired,isSubmitting:s.a.bool.isRequired,language:s.a.string,logo:s.a.string.isRequired,primaryColor:s.a.string.isRequired,screenName:s.a.string.isRequired,showBadge:s.a.bool.isRequired,submitButtonLabel:s.a.string,success:s.a.node,tabs:s.a.bool,terms:s.a.element,title:s.a.string,classNames:s.a.string.isRequired,scrollGlobalMessagesIntoView:s.a.bool,suppressSubmitOverlay:s.a.bool};var j=t.window&&t.window.location&&"file:"===t.window.location.protocol,I=D.defaultProps={autofocus:!1,badgeLink:"https://auth0.com/",contentProps:{},disableSubmitButton:!1,isMobile:!1,isSubmitting:!1,language:"en",logo:(j?"https:":"")+"//cdn.auth0.com/styleguide/components/1.0.8/media/logos/img/badge.png",primaryColor:"#ea5323",showBadge:!0,scrollGlobalMessagesIntoView:!0}}).call(e,n(15))},function(t,e,n){"use strict";var r=n(2),o=n.n(r),i=n(0),a=n.n(i),s=function(t){var e=t.label,n=t.onClick,r=t.strategy,o=t.icon,i=t.primaryColor,s=t.foregroundColor,u=i?{backgroundColor:i}:{},c=s?{color:s}:{},l=o?{backgroundImage:"url('"+o+"')"}:{};return a.a.createElement("a",{className:"auth0-lock-social-button auth0-lock-social-big-button","data-provider":r,onClick:n,style:u,type:"button"},a.a.createElement("div",{className:"auth0-lock-social-button-icon",style:l}),a.a.createElement("div",{className:"auth0-lock-social-button-text",style:c},e))};s.propTypes={disabled:o.a.bool.isRequired,label:o.a.string.isRequired,onClick:o.a.func.isRequired,strategy:o.a.string.isRequired,icon:o.a.string,primaryColor:o.a.string,foregroundColor:o.a.string},s.defaultProps={disabled:!1},e.a=s},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(0),s=n.n(a),u=n(24),c=function(){return s.a.createElement("svg",{"aria-hidden":"true",focusable:"false",width:"5px",height:"10px",viewBox:"0 0 5 10",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",className:"auth0-lock-icon-arrow"},s.a.createElement("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},s.a.createElement("g",{id:"Lock",transform:"translate(-396.000000, -3521.000000)",fill:"#000000",opacity:"0.539999962"},s.a.createElement("g",{id:"SMS",transform:"translate(153.000000, 3207.000000)"},s.a.createElement("g",{transform:"translate(35.000000, 299.000000)"},s.a.createElement("g",{transform:"translate(210.000000, 20.000000) rotate(-90.000000) translate(-210.000000, -20.000000) translate(198.000000, 8.000000)"},s.a.createElement("path",{id:"Shape",d:"M7,10 L12,15 L17,10 L7,10 Z"})))))))},l=function(t){function e(n){r(this,e);var i=o(this,t.call(this,n));return i.state={},i}return i(e,t),e.prototype.render=function(){var t=this.props,e=t.lockId,n=t.iconUrl,r=t.isValid,o=t.label,i=t.ariaLabel,a=t.name,l=t.onClick,p=t.placeholder,d=this.props.icon,M=this.state.focused,h=o||p;h.length>23&&(h=h.substr(0,20)+"..."),!d&&"string"==typeof n&&n&&(d=s.a.createElement("img",{className:"auth0-lock-custom-icon",alt:i||a,src:n}));var g="auth0-lock-input auth0-lock-input-location";return o||(g+=" auth0-lock-input-with-placeholder"),s.a.createElement(u.a,{focused:M,isValid:r,name:"location",icon:d},s.a.createElement("input",{id:e+"-"+a,type:"button",name:a,className:g,value:h,onFocus:this.handleFocus.bind(this),onBlur:this.handleBlur.bind(this),onKeyDown:this.handleKeyDown.bind(this),onClick:l,"aria-label":i||a,"aria-invalid":!r}),s.a.createElement("span",null,s.a.createElement(c,null)))},e.prototype.handleFocus=function(){this.setState({focused:!0})},e.prototype.handleBlur=function(){this.setState({focused:!1})},e.prototype.handleKeyDown=function(t){return"Tab"!==t.key&&t.preventDefault(),"ArrowDown"===t.key?this.props.onClick():t.keyCode>=65&&t.keyCode<=90?this.props.onClick(String.fromCharCode(t.keyCode).toLowerCase()):void 0},e}(s.a.Component);e.a=l},function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var s=n(0),u=n.n(s),c=n(24),l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},p=function(t){function e(n){o(this,e);var r=i(this,t.call(this,n));return r.state={},r}return a(e,t),e.prototype.hasFocus=function(){return this.state.focused},e.prototype.render=function(){var t=this.props,e=t.lockId,n=t.iconUrl,o=t.invalidHint,i=t.isValid,a=t.name,s=t.ariaLabel,p=(t.onChange,t.value),d=r(t,["lockId","iconUrl","invalidHint","isValid","name","ariaLabel","onChange","value"]),M=this.props.icon,h=this.state.focused;return!M&&"string"==typeof n&&n&&(M=u.a.createElement("img",{className:"auth0-lock-custom-icon",alt:s||a,src:n})),u.a.createElement(c.a,{focused:h,invalidHint:o,isValid:i,name:a,icon:M},u.a.createElement("input",l({id:e+"-"+a,ref:"input",type:"text",name:a,className:"auth0-lock-input",autoComplete:"off",autoCapitalize:"off",onChange:this.handleOnChange.bind(this),onFocus:this.handleFocus.bind(this),onBlur:this.handleBlur.bind(this),value:p,"aria-label":s||a,"aria-invalid":!i,"aria-describedby":!i&&o?"auth0-lock-error-msg-"+a:void 0},d)))},e.prototype.handleOnChange=function(t){this.props.onChange&&this.props.onChange(t)},e.prototype.handleFocus=function(){this.setState({focused:!0})},e.prototype.handleBlur=function(){this.setState({focused:!1})},e}(u.a.Component);e.a=p},function(t,e,n){"use strict";function r(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=document.createElement("img");return n.addEventListener("load",function(){e(null,n)}),n.addEventListener("error",function(t){e(t)}),n.src=t,n}e.a=r},function(t,e,n){"use strict";function r(t,e){return e.toLowerCase().indexOf(t.toLowerCase())>-1}function o(t,e){return-1!==t.indexOf(e,t.length-e.length)}e.b=r,e.a=o},function(t,e,n){!function(e,n){t.exports=n()}(0,function(){"use strict";function t(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function e(t){return function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return f(t,e,r)}}function n(t,e){u&&u(t,null);for(var n=e.length;n--;){var r=e[n];if("string"==typeof r){var o=j(r);o!==r&&(c(e)||(e[n]=o),r=o)}t[r]=!0}return t}function r(t){var e=h(null),n=void 0;for(n in t)f(s,t,[n])&&(e[n]=t[n]);return e}function o(t,n){function r(t){return console.warn("fallback value for",t),null}for(;null!==t;){var o=p(t,n);if(o){if(o.get)return e(o.get);if("function"==typeof o.value)return e(o.value)}t=l(t)}return r}function i(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function a(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:V(),e=function(t){return a(t)};if(e.version="2.2.8",e.removed=[],!t||!t.document||9!==t.document.nodeType)return e.isSupported=!1,e;var s=t.document,u=t.document,c=t.DocumentFragment,l=t.HTMLTemplateElement,p=t.Node,M=t.Element,h=t.NodeFilter,g=t.NamedNodeMap,f=void 0===g?t.NamedNodeMap||t.MozNamedAttrMap:g,y=t.Text,J=t.Comment,q=t.DOMParser,X=t.trustedTypes,K=M.prototype,$=o(K,"cloneNode"),tt=o(K,"nextSibling"),et=o(K,"childNodes"),nt=o(K,"parentNode");if("function"==typeof l){var rt=u.createElement("template");rt.content&&rt.content.ownerDocument&&(u=rt.content.ownerDocument)}var ot=F(X,s),it=ot&&Ut?ot.createHTML(""):"",at=u,st=at.implementation,ut=at.createNodeIterator,ct=at.createDocumentFragment,lt=s.importNode,pt={};try{pt=r(u).documentMode?u.documentMode:{}}catch(t){}var dt={};e.isSupported="function"==typeof nt&&st&&void 0!==st.createHTMLDocument&&9!==pt;var Mt=Q,ht=P,gt=B,ft=R,yt=Z,Nt=H,mt=G,Dt=null,jt=n({},[].concat(i(C),i(T),i(E),i(k),i(S))),It=null,wt=n({},[].concat(i(A),i(U),i(_),i(Y))),Lt=null,vt=null,zt=!0,bt=!0,Ct=!1,Tt=!1,Et=!1,xt=!1,kt=!1,Ot=!1,St=!1,At=!0,Ut=!1,_t=!0,Yt=!0,Qt=!1,Pt={},Bt=n({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Rt=null,Gt=n({},["audio","video","img","source","image","track"]),Zt=null,Ht=n({},["alt","class","for","id","label","name","pattern","placeholder","summary","title","value","style","xmlns"]),Wt="http://www.w3.org/1998/Math/MathML",Vt="http://www.w3.org/2000/svg",Ft="http://www.w3.org/1999/xhtml",Jt=Ft,qt=null,Xt=u.createElement("form"),Kt=function(t){qt&&qt===t||(t&&"object"===(void 0===t?"undefined":W(t))||(t={}),t=r(t),Dt="ALLOWED_TAGS"in t?n({},t.ALLOWED_TAGS):jt,It="ALLOWED_ATTR"in t?n({},t.ALLOWED_ATTR):wt,Zt="ADD_URI_SAFE_ATTR"in t?n(r(Ht),t.ADD_URI_SAFE_ATTR):Ht,Rt="ADD_DATA_URI_TAGS"in t?n(r(Gt),t.ADD_DATA_URI_TAGS):Gt,Lt="FORBID_TAGS"in t?n({},t.FORBID_TAGS):{},vt="FORBID_ATTR"in t?n({},t.FORBID_ATTR):{},Pt="USE_PROFILES"in t&&t.USE_PROFILES,zt=!1!==t.ALLOW_ARIA_ATTR,bt=!1!==t.ALLOW_DATA_ATTR,Ct=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Tt=t.SAFE_FOR_TEMPLATES||!1,Et=t.WHOLE_DOCUMENT||!1,Ot=t.RETURN_DOM||!1,St=t.RETURN_DOM_FRAGMENT||!1,At=!1!==t.RETURN_DOM_IMPORT,Ut=t.RETURN_TRUSTED_TYPE||!1,kt=t.FORCE_BODY||!1,_t=!1!==t.SANITIZE_DOM,Yt=!1!==t.KEEP_CONTENT,Qt=t.IN_PLACE||!1,mt=t.ALLOWED_URI_REGEXP||mt,Jt=t.NAMESPACE||Jt,Tt&&(bt=!1),St&&(Ot=!0),Pt&&(Dt=n({},[].concat(i(S))),It=[],!0===Pt.html&&(n(Dt,C),n(It,A)),!0===Pt.svg&&(n(Dt,T),n(It,U),n(It,Y)),!0===Pt.svgFilters&&(n(Dt,E),n(It,U),n(It,Y)),!0===Pt.mathMl&&(n(Dt,k),n(It,_),n(It,Y))),t.ADD_TAGS&&(Dt===jt&&(Dt=r(Dt)),n(Dt,t.ADD_TAGS)),t.ADD_ATTR&&(It===wt&&(It=r(It)),n(It,t.ADD_ATTR)),t.ADD_URI_SAFE_ATTR&&n(Zt,t.ADD_URI_SAFE_ATTR),Yt&&(Dt["#text"]=!0),Et&&n(Dt,["html","head","body"]),Dt.table&&(n(Dt,["tbody"]),delete Lt.tbody),d&&d(t),qt=t)},$t=n({},["mi","mo","mn","ms","mtext"]),te=n({},["foreignobject","desc","title","annotation-xml"]),ee=n({},T);n(ee,E),n(ee,x);var ne=n({},k);n(ne,O);var re=function(t){var e=nt(t);e&&e.tagName||(e={namespaceURI:Ft,tagName:"template"});var r=j(t.tagName),o=j(e.tagName);if(t.namespaceURI===Vt)return e.namespaceURI===Ft?"svg"===r:e.namespaceURI===Wt?"svg"===r&&("annotation-xml"===o||$t[o]):Boolean(ee[r]);if(t.namespaceURI===Wt)return e.namespaceURI===Ft?"math"===r:e.namespaceURI===Vt?"math"===r&&te[o]:Boolean(ne[r]);if(t.namespaceURI===Ft){if(e.namespaceURI===Vt&&!te[o])return!1;if(e.namespaceURI===Wt&&!$t[o])return!1;var i=n({},["title","style","font","a","script"]);return!ne[r]&&(i[r]||!ee[r])}return!1},oe=function(t){D(e.removed,{element:t});try{t.parentNode.removeChild(t)}catch(e){try{t.outerHTML=it}catch(e){t.remove()}}},ie=function(t,n){try{D(e.removed,{attribute:n.getAttributeNode(t),from:n})}catch(t){D(e.removed,{attribute:null,from:n})}if(n.removeAttribute(t),"is"===t&&!It[t])if(Ot||St)try{oe(n)}catch(t){}else try{n.setAttribute(t,"")}catch(t){}},ae=function(t){var e=void 0,n=void 0;if(kt)t="<remove></remove>"+t;else{var r=I(t,/^[\r\n\t ]+/);n=r&&r[0]}var o=ot?ot.createHTML(t):t;if(Jt===Ft)try{e=(new q).parseFromString(o,"text/html")}catch(t){}e&&e.documentElement||(e=st.createDocument(Jt,"template",null),e.documentElement.innerHTML=o);var i=e.body||e.documentElement;return t&&n&&i.insertBefore(u.createTextNode(n),i.childNodes[0]||null),Et?e.documentElement:i},se=function(t){return ut.call(t.ownerDocument||t,t,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT,function(){return h.FILTER_ACCEPT},!1)},ue=function(t){return!(t instanceof y||t instanceof J)&&!("string"==typeof t.nodeName&&"string"==typeof t.textContent&&"function"==typeof t.removeChild&&t.attributes instanceof f&&"function"==typeof t.removeAttribute&&"function"==typeof t.setAttribute&&"string"==typeof t.namespaceURI&&"function"==typeof t.insertBefore)},ce=function(t){return"object"===(void 0===p?"undefined":W(p))?t instanceof p:t&&"object"===(void 0===t?"undefined":W(t))&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},le=function(t,n,r){dt[t]&&N(dt[t],function(t){t.call(e,n,r,qt)})},pe=function(t){var n=void 0;if(le("beforeSanitizeElements",t,null),ue(t))return oe(t),!0;if(I(t.nodeName,/[\u0080-\uFFFF]/))return oe(t),!0;var r=j(t.nodeName);if(le("uponSanitizeElement",t,{tagName:r,allowedTags:Dt}),!ce(t.firstElementChild)&&(!ce(t.content)||!ce(t.content.firstElementChild))&&z(/<[\/\w]/g,t.innerHTML)&&z(/<[\/\w]/g,t.textContent))return oe(t),!0;if(!Dt[r]||Lt[r]){if(Yt&&!Bt[r]){var o=nt(t)||t.parentNode,i=et(t)||t.childNodes;if(i&&o)for(var a=i.length,s=a-1;s>=0;--s)o.insertBefore($(i[s],!0),tt(t))}return oe(t),!0}return t instanceof M&&!re(t)?(oe(t),!0):"noscript"!==r&&"noembed"!==r||!z(/<\/no(script|embed)/i,t.innerHTML)?(Tt&&3===t.nodeType&&(n=t.textContent,n=w(n,Mt," "),n=w(n,ht," "),t.textContent!==n&&(D(e.removed,{element:t.cloneNode()}),t.textContent=n)),le("afterSanitizeElements",t,null),!1):(oe(t),!0)},de=function(t,e,n){if(_t&&("id"===e||"name"===e)&&(n in u||n in Xt))return!1;if(bt&&z(gt,e));else if(zt&&z(ft,e));else{if(!It[e]||vt[e])return!1;if(Zt[e]);else if(z(mt,w(n,Nt,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==L(n,"data:")||!Rt[t]){if(Ct&&!z(yt,w(n,Nt,"")));else if(n)return!1}else;}return!0},Me=function(t){var n=void 0,r=void 0,o=void 0,i=void 0;le("beforeSanitizeAttributes",t,null);var a=t.attributes;if(a){var s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:It};for(i=a.length;i--;){n=a[i];var u=n,c=u.name,l=u.namespaceURI;if(r=v(n.value),o=j(c),s.attrName=o,s.attrValue=r,s.keepAttr=!0,s.forceKeepAttr=void 0,le("uponSanitizeAttribute",t,s),r=s.attrValue,!s.forceKeepAttr&&(ie(c,t),s.keepAttr))if(z(/\/>/i,r))ie(c,t);else{Tt&&(r=w(r,Mt," "),r=w(r,ht," "));var p=t.nodeName.toLowerCase();if(de(p,o,r))try{l?t.setAttributeNS(l,c,r):t.setAttribute(c,r),m(e.removed)}catch(t){}}}le("afterSanitizeAttributes",t,null)}},he=function t(e){var n=void 0,r=se(e);for(le("beforeSanitizeShadowDOM",e,null);n=r.nextNode();)le("uponSanitizeShadowNode",n,null),pe(n)||(n.content instanceof c&&t(n.content),Me(n));le("afterSanitizeShadowDOM",e,null)};return e.sanitize=function(n,r){var o=void 0,i=void 0,a=void 0,u=void 0,l=void 0;if(n||(n="\x3c!--\x3e"),"string"!=typeof n&&!ce(n)){if("function"!=typeof n.toString)throw b("toString is not a function");if("string"!=typeof(n=n.toString()))throw b("dirty is not a string, aborting")}if(!e.isSupported){if("object"===W(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof n)return t.toStaticHTML(n);if(ce(n))return t.toStaticHTML(n.outerHTML)}return n}if(xt||Kt(r),e.removed=[],"string"==typeof n&&(Qt=!1),Qt);else if(n instanceof p)o=ae("\x3c!----\x3e"),i=o.ownerDocument.importNode(n,!0),1===i.nodeType&&"BODY"===i.nodeName?o=i:"HTML"===i.nodeName?o=i:o.appendChild(i);else{if(!Ot&&!Tt&&!Et&&-1===n.indexOf("<"))return ot&&Ut?ot.createHTML(n):n;if(!(o=ae(n)))return Ot?null:it}o&&kt&&oe(o.firstChild);for(var d=se(Qt?n:o);a=d.nextNode();)3===a.nodeType&&a===u||pe(a)||(a.content instanceof c&&he(a.content),Me(a),u=a);if(u=null,Qt)return n;if(Ot){if(St)for(l=ct.call(o.ownerDocument);o.firstChild;)l.appendChild(o.firstChild);else l=o;return At&&(l=lt.call(s,l,!0)),l}var M=Et?o.outerHTML:o.innerHTML;return Tt&&(M=w(M,Mt," "),M=w(M,ht," ")),ot&&Ut?ot.createHTML(M):M},e.setConfig=function(t){Kt(t),xt=!0},e.clearConfig=function(){qt=null,xt=!1},e.isValidAttribute=function(t,e,n){qt||Kt({});var r=j(t),o=j(e);return de(r,o,n)},e.addHook=function(t,e){"function"==typeof e&&(dt[t]=dt[t]||[],D(dt[t],e))},e.removeHook=function(t){dt[t]&&m(dt[t])},e.removeHooks=function(t){dt[t]&&(dt[t]=[])},e.removeAllHooks=function(){dt={}},e}var s=Object.hasOwnProperty,u=Object.setPrototypeOf,c=Object.isFrozen,l=Object.getPrototypeOf,p=Object.getOwnPropertyDescriptor,d=Object.freeze,M=Object.seal,h=Object.create,g="undefined"!=typeof Reflect&&Reflect,f=g.apply,y=g.construct;f||(f=function(t,e,n){return t.apply(e,n)}),d||(d=function(t){return t}),M||(M=function(t){return t}),y||(y=function(e,n){return new(Function.prototype.bind.apply(e,[null].concat(t(n))))});var N=e(Array.prototype.forEach),m=e(Array.prototype.pop),D=e(Array.prototype.push),j=e(String.prototype.toLowerCase),I=e(String.prototype.match),w=e(String.prototype.replace),L=e(String.prototype.indexOf),v=e(String.prototype.trim),z=e(RegExp.prototype.test),b=function(t){return function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return y(t,n)}}(TypeError),C=d(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),T=d(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),E=d(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),x=d(["animate","color-profile","cursor","discard","fedropshadow","feimage","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),k=d(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),O=d(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),S=d(["#text"]),A=d(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),U=d(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),_=d(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Y=d(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Q=M(/\{\{[\s\S]*|[\s\S]*\}\}/gm),P=M(/<%[\s\S]*|[\s\S]*%>/gm),B=M(/^data-[\-\w.\u00B7-\uFFFF]/),R=M(/^aria-[\-\w]+$/),G=M(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Z=M(/^(?:\w+script|data):/i),H=M(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},V=function(){return"undefined"==typeof window?null:window},F=function(t,e){if("object"!==(void 0===t?"undefined":W(t))||"function"!=typeof t.createPolicy)return null;var n=null;e.currentScript&&e.currentScript.hasAttribute("data-tt-policy-suffix")&&(n=e.currentScript.getAttribute("data-tt-policy-suffix"));var r="dompurify"+(n?"#"+n:"");try{return t.createPolicy(r,{createHTML:function(t){return t}})}catch(t){return console.warn("TrustedTypes policy "+r+" could not be created."),null}};return a()})},function(t,e,n){"use strict";var r=n(21),o={listen:function(t,e,n){return t.addEventListener?(t.addEventListener(e,n,!1),{remove:function(){t.removeEventListener(e,n,!1)}}):t.attachEvent?(t.attachEvent("on"+e,n),{remove:function(){t.detachEvent("on"+e,n)}}):void 0},capture:function(t,e,n){return t.addEventListener?(t.addEventListener(e,n,!0),{remove:function(){t.removeEventListener(e,n,!0)}}):{remove:r}},registerDefault:function(){}};t.exports=o},function(t,e,n){"use strict";function r(t){try{t.focus()}catch(t){}}t.exports=r},function(t,e,n){"use strict";function r(t){if(void 0===(t=t||("undefined"!=typeof document?document:void 0)))return null;try{return t.activeElement||t.body}catch(e){return t.body}}t.exports=r},function(t,e,n){"use strict";var r=n(252);t.exports=function(t){return r(t,!1)}},function(t,e,n){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,e,n){"use strict";var r=String.prototype.replace,o=/%20/g,i=n(80),a={RFC1738:"RFC1738",RFC3986:"RFC3986"};t.exports=i.assign({default:a.RFC3986,formatters:{RFC1738:function(t){return r.call(t,o,"+")},RFC3986:function(t){return String(t)}}},a)},function(t,e,n){"use strict";function r(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}var o={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},i=["Webkit","ms","Moz","O"];Object.keys(o).forEach(function(t){i.forEach(function(e){o[r(e,t)]=o[t]})});var a={background:{backgroundAttachment:!0,backgroundColor:!0,backgroundImage:!0,backgroundPositionX:!0,backgroundPositionY:!0,backgroundRepeat:!0},backgroundPosition:{backgroundPositionX:!0,backgroundPositionY:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0},outline:{outlineWidth:!0,outlineStyle:!0,outlineColor:!0}},s={isUnitlessNumber:o,shorthandPropertyExpansions:a};t.exports=s},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=n(5),i=n(31),a=(n(3),function(){function t(e){r(this,t),this._callbacks=null,this._contexts=null,this._arg=e}return t.prototype.enqueue=function(t,e){this._callbacks=this._callbacks||[],this._callbacks.push(t),this._contexts=this._contexts||[],this._contexts.push(e)},t.prototype.notifyAll=function(){var t=this._callbacks,e=this._contexts,n=this._arg;if(t&&e){t.length!==e.length&&o("24"),this._callbacks=null,this._contexts=null;for(var r=0;r<t.length;r++)t[r].call(e[r],n);t.length=0,e.length=0}},t.prototype.checkpoint=function(){return this._callbacks?this._callbacks.length:0},t.prototype.rollback=function(t){this._callbacks&&this._contexts&&(this._callbacks.length=t,this._contexts.length=t)},t.prototype.reset=function(){this._callbacks=null,this._contexts=null},t.prototype.destructor=function(){this.reset()},t}());t.exports=i.addPoolingTo(a)},function(t,e,n){"use strict";function r(t){return!!c.hasOwnProperty(t)||!u.hasOwnProperty(t)&&(s.test(t)?(c[t]=!0,!0):(u[t]=!0,!1))}function o(t,e){return null==e||t.hasBooleanValue&&!e||t.hasNumericValue&&isNaN(e)||t.hasPositiveNumericValue&&e<1||t.hasOverloadedBooleanValue&&!1===e}var i=n(36),a=(n(9),n(18),n(317)),s=(n(6),new RegExp("^["+i.ATTRIBUTE_NAME_START_CHAR+"]["+i.ATTRIBUTE_NAME_CHAR+"]*$")),u={},c={},l={createMarkupForID:function(t){return i.ID_ATTRIBUTE_NAME+"="+a(t)},setAttributeForID:function(t,e){t.setAttribute(i.ID_ATTRIBUTE_NAME,e)},createMarkupForRoot:function(){return i.ROOT_ATTRIBUTE_NAME+'=""'},setAttributeForRoot:function(t){t.setAttribute(i.ROOT_ATTRIBUTE_NAME,"")},createMarkupForProperty:function(t,e){var n=i.properties.hasOwnProperty(t)?i.properties[t]:null;if(n){if(o(n,e))return"";var r=n.attributeName;return n.hasBooleanValue||n.hasOverloadedBooleanValue&&!0===e?r+'=""':r+"="+a(e)}return i.isCustomAttribute(t)?null==e?"":t+"="+a(e):null},createMarkupForCustomAttribute:function(t,e){return r(t)&&null!=e?t+"="+a(e):""},setValueForProperty:function(t,e,n){var r=i.properties.hasOwnProperty(e)?i.properties[e]:null;if(r){var a=r.mutationMethod;if(a)a(t,n);else{if(o(r,n))return void this.deleteValueForProperty(t,e);if(r.mustUseProperty)t[r.propertyName]=n;else{var s=r.attributeName,u=r.attributeNamespace;u?t.setAttributeNS(u,s,""+n):r.hasBooleanValue||r.hasOverloadedBooleanValue&&!0===n?t.setAttribute(s,""):t.setAttribute(s,""+n)}}}else if(i.isCustomAttribute(e))return void l.setValueForAttribute(t,e,n)},setValueForAttribute:function(t,e,n){if(r(e)){null==n?t.removeAttribute(e):t.setAttribute(e,""+n)}},deleteValueForAttribute:function(t,e){t.removeAttribute(e)},deleteValueForProperty:function(t,e){var n=i.properties.hasOwnProperty(e)?i.properties[e]:null;if(n){var r=n.mutationMethod;if(r)r(t,void 0);else if(n.mustUseProperty){var o=n.propertyName;n.hasBooleanValue?t[o]=!1:t[o]=""}else t.removeAttribute(n.attributeName)}else i.isCustomAttribute(e)&&t.removeAttribute(e)}};t.exports=l},function(t,e,n){"use strict";var r={hasCachedChildNodes:1};t.exports=r},function(t,e,n){"use strict";function r(){if(this._rootNodeID&&this._wrapperState.pendingUpdate){this._wrapperState.pendingUpdate=!1;var t=this._currentElement.props,e=s.getValue(t);null!=e&&o(this,Boolean(t.multiple),e)}}function o(t,e,n){var r,o,i=u.getNodeFromInstance(t).options;if(e){for(r={},o=0;o<n.length;o++)r[""+n[o]]=!0;for(o=0;o<i.length;o++){var a=r.hasOwnProperty(i[o].value);i[o].selected!==a&&(i[o].selected=a)}}else{for(r=""+n,o=0;o<i.length;o++)if(i[o].value===r)return void(i[o].selected=!0);i.length&&(i[0].selected=!0)}}function i(t){var e=this._currentElement.props,n=s.executeOnChange(e,t);return this._rootNodeID&&(this._wrapperState.pendingUpdate=!0),c.asap(r,this),n}var a=n(7),s=n(86),u=n(9),c=n(22),l=(n(6),!1),p={getHostProps:function(t,e){return a({},e,{onChange:t._wrapperState.onChange,value:void 0})},mountWrapper:function(t,e){var n=s.getValue(e);t._wrapperState={pendingUpdate:!1,initialValue:null!=n?n:e.defaultValue,listeners:null,onChange:i.bind(t),wasMultiple:Boolean(e.multiple)},void 0===e.value||void 0===e.defaultValue||l||(l=!0)},getSelectValueContext:function(t){return t._wrapperState.initialValue},postUpdateWrapper:function(t){var e=t._currentElement.props;t._wrapperState.initialValue=void 0;var n=t._wrapperState.wasMultiple;t._wrapperState.wasMultiple=Boolean(e.multiple);var r=s.getValue(e);null!=r?(t._wrapperState.pendingUpdate=!1,o(t,Boolean(e.multiple),r)):n!==Boolean(e.multiple)&&(null!=e.defaultValue?o(t,Boolean(e.multiple),e.defaultValue):o(t,Boolean(e.multiple),e.multiple?[]:""))}};t.exports=p},function(t,e,n){"use strict";var r,o={injectEmptyComponentFactory:function(t){r=t}},i={create:function(t){return r(t)}};i.injection=o,t.exports=i},function(t,e,n){"use strict";var r={logTopLevelRenders:!1};t.exports=r},function(t,e,n){"use strict";function r(t){return s||a("111",t.type),new s(t)}function o(t){return new u(t)}function i(t){return t instanceof u}var a=n(5),s=(n(3),null),u=null,c={injectGenericComponentClass:function(t){s=t},injectTextComponentClass:function(t){u=t}},l={createInternalComponent:r,createInstanceForText:o,isTextComponent:i,injection:c};t.exports=l},function(t,e,n){"use strict";function r(t){return i(document.documentElement,t)}var o=n(277),i=n(231),a=n(120),s=n(121),u={hasSelectionCapabilities:function(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&("input"===e&&"text"===t.type||"textarea"===e||"true"===t.contentEditable)},getSelectionInformation:function(){var t=s();return{focusedElem:t,selectionRange:u.hasSelectionCapabilities(t)?u.getSelection(t):null}},restoreSelection:function(t){var e=s(),n=t.focusedElem,o=t.selectionRange;e!==n&&r(n)&&(u.hasSelectionCapabilities(n)&&u.setSelection(n,o),a(n))},getSelection:function(t){var e;if("selectionStart"in t)e={start:t.selectionStart,end:t.selectionEnd};else if(document.selection&&t.nodeName&&"input"===t.nodeName.toLowerCase()){var n=document.selection.createRange();n.parentElement()===t&&(e={start:-n.moveStart("character",-t.value.length),end:-n.moveEnd("character",-t.value.length)})}else e=o.getOffsets(t);return e||{start:0,end:0}},setSelection:function(t,e){var n=e.start,r=e.end;if(void 0===r&&(r=n),"selectionStart"in t)t.selectionStart=n,t.selectionEnd=Math.min(r,t.value.length);else if(document.selection&&t.nodeName&&"input"===t.nodeName.toLowerCase()){var i=t.createTextRange();i.collapse(!0),i.moveStart("character",n),i.moveEnd("character",r-n),i.select()}else o.setOffsets(t,e)}};t.exports=u},function(t,e,n){"use strict";function r(t,e){for(var n=Math.min(t.length,e.length),r=0;r<n;r++)if(t.charAt(r)!==e.charAt(r))return r;return t.length===e.length?-1:n}function o(t){return t?t.nodeType===S?t.documentElement:t.firstChild:null}function i(t){return t.getAttribute&&t.getAttribute(x)||""}function a(t,e,n,r,o){var i;if(j.logTopLevelRenders){var a=t._currentElement.props.child,s=a.type;i="React mount: "+("string"==typeof s?s:s.displayName||s.name),console.time(i)}var u=L.mountComponent(t,n,null,m(t,e),o,0);i&&console.timeEnd(i),t._renderedComponent._topLevelWrapper=t,Q._mountImageIntoNode(u,e,t,r,n)}function s(t,e,n,r){var o=z.ReactReconcileTransaction.getPooled(!n&&D.useCreateElement);o.perform(a,null,t,e,o,n,r),z.ReactReconcileTransaction.release(o)}function u(t,e,n){for(L.unmountComponent(t,n),e.nodeType===S&&(e=e.documentElement);e.lastChild;)e.removeChild(e.lastChild)}function c(t){var e=o(t);if(e){var n=N.getInstanceFromNode(e);return!(!n||!n._hostParent)}}function l(t){return!(!t||t.nodeType!==O&&t.nodeType!==S&&t.nodeType!==A)}function p(t){var e=o(t),n=e&&N.getInstanceFromNode(e);return n&&!n._hostParent?n:null}function d(t){var e=p(t);return e?e._hostContainerInfo._topLevelWrapper:null}var M=n(5),h=n(35),g=n(36),f=n(38),y=n(58),N=(n(26),n(9)),m=n(271),D=n(273),j=n(131),I=n(44),w=(n(18),n(287)),L=n(37),v=n(89),z=n(22),b=n(75),C=n(142),T=(n(3),n(62)),E=n(95),x=(n(6),g.ID_ATTRIBUTE_NAME),k=g.ROOT_ATTRIBUTE_NAME,O=1,S=9,A=11,U={},_=1,Y=function(){this.rootID=_++};Y.prototype.isReactComponent={},Y.prototype.render=function(){return this.props.child},Y.isReactTopLevelWrapper=!0;var Q={TopLevelWrapper:Y,_instancesByReactRootID:U,scrollMonitor:function(t,e){e()},_updateRootComponent:function(t,e,n,r,o){return Q.scrollMonitor(r,function(){v.enqueueElementInternal(t,e,n),o&&v.enqueueCallbackInternal(t,o)}),t},_renderNewRootComponent:function(t,e,n,r){l(e)||M("37"),y.ensureScrollValueMonitoring();var o=C(t,!1);z.batchedUpdates(s,o,e,n,r);var i=o._instance.rootID;return U[i]=o,o},renderSubtreeIntoContainer:function(t,e,n,r){return null!=t&&I.has(t)||M("38"),Q._renderSubtreeIntoContainer(t,e,n,r)},_renderSubtreeIntoContainer:function(t,e,n,r){v.validateCallback(r,"ReactDOM.render"),f.isValidElement(e)||M("39","string"==typeof e?" Instead of passing a string like 'div', pass React.createElement('div') or <div />.":"function"==typeof e?" Instead of passing a class like Foo, pass React.createElement(Foo) or <Foo />.":null!=e&&void 0!==e.props?" This may be caused by unintentionally loading two independent copies of React.":"");var a,s=f.createElement(Y,{child:e});if(t){var u=I.get(t);a=u._processChildContext(u._context)}else a=b;var l=d(n);if(l){var p=l._currentElement,h=p.props.child;if(E(h,e)){var g=l._renderedComponent.getPublicInstance(),y=r&&function(){r.call(g)};return Q._updateRootComponent(l,s,a,n,y),g}Q.unmountComponentAtNode(n)}var N=o(n),m=N&&!!i(N),D=c(n),j=m&&!l&&!D,w=Q._renderNewRootComponent(s,n,j,a)._renderedComponent.getPublicInstance();return r&&r.call(w),w},render:function(t,e,n){return Q._renderSubtreeIntoContainer(null,t,e,n)},unmountComponentAtNode:function(t){l(t)||M("40");var e=d(t);if(!e){c(t),1===t.nodeType&&t.hasAttribute(k);return!1}return delete U[e._instance.rootID],z.batchedUpdates(u,e,t,!1),!0},_mountImageIntoNode:function(t,e,n,i,a){if(l(e)||M("41"),i){var s=o(e);if(w.canReuseMarkup(t,s))return void N.precacheNode(n,s);var u=s.getAttribute(w.CHECKSUM_ATTR_NAME);s.removeAttribute(w.CHECKSUM_ATTR_NAME);var c=s.outerHTML;s.setAttribute(w.CHECKSUM_ATTR_NAME,u);var p=t,d=r(p,c),g=" (client) "+p.substring(d-20,d+20)+"\n (server) "+c.substring(d-20,d+20);e.nodeType===S&&M("42",g)}if(e.nodeType===S&&M("43"),a.useCreateElement){for(;e.lastChild;)e.removeChild(e.lastChild);h.insertTreeBefore(e,t,null)}else T(e,t),N.precacheNode(n,e.firstChild)}};t.exports=Q},function(t,e,n){"use strict";var r=n(5),o=n(38),i=(n(3),{HOST:0,COMPOSITE:1,EMPTY:2,getType:function(t){return null===t||!1===t?i.EMPTY:o.isValidElement(t)?"function"==typeof t.type?i.COMPOSITE:i.HOST:void r("26",t)}});t.exports=i},function(t,e,n){"use strict";var r={currentScrollLeft:0,currentScrollTop:0,refreshScrollValues:function(t){r.currentScrollLeft=t.x,r.currentScrollTop=t.y}};t.exports=r},function(t,e,n){"use strict";function r(t,e){return null==e&&o("30"),null==t?e:Array.isArray(t)?Array.isArray(e)?(t.push.apply(t,e),t):(t.push(e),t):Array.isArray(e)?[t].concat(e):[t,e]}var o=n(5);n(3);t.exports=r},function(t,e,n){"use strict";function r(t,e,n){Array.isArray(t)?t.forEach(e,n):t&&e.call(n,t)}t.exports=r},function(t,e,n){"use strict";function r(t){for(var e;(e=t._renderedNodeType)===o.COMPOSITE;)t=t._renderedComponent;return e===o.HOST?t._renderedComponent:e===o.EMPTY?null:void 0}var o=n(135);t.exports=r},function(t,e,n){"use strict";function r(){return!i&&o.canUseDOM&&(i="textContent"in document.documentElement?"textContent":"innerText"),i}var o=n(13),i=null;t.exports=r},function(t,e,n){"use strict";function r(t){var e=t.type,n=t.nodeName;return n&&"input"===n.toLowerCase()&&("checkbox"===e||"radio"===e)}function o(t){return t._wrapperState.valueTracker}function i(t,e){t._wrapperState.valueTracker=e}function a(t){t._wrapperState.valueTracker=null}function s(t){var e;return t&&(e=r(t)?""+t.checked:t.value),e}var u=n(9),c={_getTrackerFromNode:function(t){return o(u.getInstanceFromNode(t))},track:function(t){if(!o(t)){var e=u.getNodeFromInstance(t),n=r(e)?"checked":"value",s=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),c=""+e[n];e.hasOwnProperty(n)||"function"!=typeof s.get||"function"!=typeof s.set||(Object.defineProperty(e,n,{enumerable:s.enumerable,configurable:!0,get:function(){return s.get.call(this)},set:function(t){c=""+t,s.set.call(this,t)}}),i(t,{getValue:function(){return c},setValue:function(t){c=""+t},stopTracking:function(){a(t),delete e[n]}}))}},updateValueIfChanged:function(t){if(!t)return!1;var e=o(t);if(!e)return c.track(t),!0;var n=e.getValue(),r=s(u.getNodeFromInstance(t));return r!==n&&(e.setValue(r),!0)},stopTracking:function(t){var e=o(t);e&&e.stopTracking()}};t.exports=c},function(t,e,n){"use strict";function r(t){if(t){var e=t.getName();if(e)return" Check the render method of `"+e+"`."}return""}function o(t){return"function"==typeof t&&void 0!==t.prototype&&"function"==typeof t.prototype.mountComponent&&"function"==typeof t.prototype.receiveComponent}function i(t,e){var n;if(null===t||!1===t)n=c.create(i);else if("object"==typeof t){var s=t,u=s.type;if("function"!=typeof u&&"string"!=typeof u){var d="";d+=r(s._owner),a("130",null==u?u:typeof u,d)}"string"==typeof s.type?n=l.createInternalComponent(s):o(s.type)?(n=new s.type(s),n.getHostNode||(n.getHostNode=n.getNativeNode)):n=new p(s)}else"string"==typeof t||"number"==typeof t?n=l.createInstanceForText(t):a("131",typeof t);return n._mountIndex=0,n._mountImage=null,n}var a=n(5),s=n(7),u=n(268),c=n(130),l=n(132),p=(n(333),n(3),n(6),function(t){this.construct(t)});s(p.prototype,u,{_instantiateReactComponent:i}),t.exports=i},function(t,e,n){"use strict";function r(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return"input"===e?!!o[t.type]:"textarea"===e}var o={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};t.exports=r},function(t,e,n){"use strict";var r=n(13),o=n(61),i=n(62),a=function(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&3===n.nodeType)return void(n.nodeValue=e)}t.textContent=e};r.canUseDOM&&("textContent"in document.documentElement||(a=function(t,e){if(3===t.nodeType)return void(t.nodeValue=e);i(t,o(e))})),t.exports=a},function(t,e,n){"use strict";function r(t,e){return t&&"object"==typeof t&&null!=t.key?c.escape(t.key):e.toString(36)}function o(t,e,n,i){var d=typeof t;if("undefined"!==d&&"boolean"!==d||(t=null),null===t||"string"===d||"number"===d||"object"===d&&t.$$typeof===s)return n(i,t,""===e?l+r(t,0):e),1;var M,h,g=0,f=""===e?l:e+p;if(Array.isArray(t))for(var y=0;y<t.length;y++)M=t[y],h=f+r(M,y),g+=o(M,h,n,i);else{var N=u(t);if(N){var m,D=N.call(t);if(N!==t.entries)for(var j=0;!(m=D.next()).done;)M=m.value,h=f+r(M,j++),g+=o(M,h,n,i);else for(;!(m=D.next()).done;){var I=m.value;I&&(M=I[1],h=f+c.escape(I[0])+p+r(M,0),g+=o(M,h,n,i))}}else if("object"===d){var w="",L=String(t);a("31","[object Object]"===L?"object with keys {"+Object.keys(t).join(", ")+"}":L,w)}}return g}function i(t,e,n){return null==t?0:o(t,"",e,n)}var a=n(5),s=(n(26),n(283)),u=n(314),c=(n(3),n(85)),l=(n(6),"."),p=":";t.exports=i},function(t,e,n){"use strict";function r(){var t=this.constructor.getDerivedStateFromProps(this.props,this.state);null!==t&&void 0!==t&&this.setState(t)}function o(t){function e(e){var n=this.constructor.getDerivedStateFromProps(t,e);return null!==n&&void 0!==n?n:null}this.setState(e.bind(this))}function i(t,e){try{var n=this.props,r=this.state;this.props=t,this.state=e,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,r)}finally{this.props=n,this.state=r}}function a(t){var e=t.prototype;if(!e||!e.isReactComponent)throw new Error("Can only polyfill class components");if("function"!=typeof t.getDerivedStateFromProps&&"function"!=typeof e.getSnapshotBeforeUpdate)return t;var n=null,a=null,s=null;if("function"==typeof e.componentWillMount?n="componentWillMount":"function"==typeof e.UNSAFE_componentWillMount&&(n="UNSAFE_componentWillMount"),"function"==typeof e.componentWillReceiveProps?a="componentWillReceiveProps":"function"==typeof e.UNSAFE_componentWillReceiveProps&&(a="UNSAFE_componentWillReceiveProps"),"function"==typeof e.componentWillUpdate?s="componentWillUpdate":"function"==typeof e.UNSAFE_componentWillUpdate&&(s="UNSAFE_componentWillUpdate"),null!==n||null!==a||null!==s){var u=t.displayName||t.name,c="function"==typeof t.getDerivedStateFromProps?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n"+u+" uses "+c+" but also contains the following legacy lifecycles:"+(null!==n?"\n "+n:"")+(null!==a?"\n "+a:"")+(null!==s?"\n "+s:"")+"\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://fb.me/react-async-component-lifecycle-hooks")}if("function"==typeof t.getDerivedStateFromProps&&(e.componentWillMount=r,e.componentWillReceiveProps=o),"function"==typeof e.getSnapshotBeforeUpdate){if("function"!=typeof e.componentDidUpdate)throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");e.componentWillUpdate=i;var l=e.componentDidUpdate;e.componentDidUpdate=function(t,e,n){var r=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:n;l.call(this,t,e,r)}}return t}Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"polyfill",function(){return a}),r.__suppressDeprecationWarning=!0,o.__suppressDeprecationWarning=!0,i.__suppressDeprecationWarning=!0},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}function i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}function a(){}e.__esModule=!0,e.default=e.EXITING=e.ENTERED=e.ENTERING=e.EXITED=e.UNMOUNTED=void 0;var s=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}return e.default=t,e}(n(2)),u=r(n(0)),c=r(n(30)),l=n(146),p=(n(149),"unmounted");e.UNMOUNTED=p;var d="exited";e.EXITED=d;var M="entering";e.ENTERING=M;var h="entered";e.ENTERED=h;e.EXITING="exiting";var g=function(t){function e(e,n){var r;r=t.call(this,e,n)||this;var o,i=n.transitionGroup,a=i&&!i.isMounting?e.enter:e.appear;return r.appearStatus=null,e.in?a?(o=d,r.appearStatus=M):o=h:o=e.unmountOnExit||e.mountOnEnter?p:d,r.state={status:o},r.nextCallback=null,r}i(e,t);var n=e.prototype;return n.getChildContext=function(){return{transitionGroup:null}},e.getDerivedStateFromProps=function(t,e){return t.in&&e.status===p?{status:d}:null},n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(t){var e=null;if(t!==this.props){var n=this.state.status;this.props.in?n!==M&&n!==h&&(e=M):n!==M&&n!==h||(e="exiting")}this.updateStatus(!1,e)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var t,e,n,r=this.props.timeout;return t=e=n=r,null!=r&&"number"!=typeof r&&(t=r.exit,e=r.enter,n=void 0!==r.appear?r.appear:e),{exit:t,enter:e,appear:n}},n.updateStatus=function(t,e){if(void 0===t&&(t=!1),null!==e){this.cancelNextCallback();var n=c.default.findDOMNode(this);e===M?this.performEnter(n,t):this.performExit(n)}else this.props.unmountOnExit&&this.state.status===d&&this.setState({status:p})},n.performEnter=function(t,e){var n=this,r=this.props.enter,o=this.context.transitionGroup?this.context.transitionGroup.isMounting:e,i=this.getTimeouts(),a=o?i.appear:i.enter;if(!e&&!r)return void this.safeSetState({status:h},function(){n.props.onEntered(t)});this.props.onEnter(t,o),this.safeSetState({status:M},function(){n.props.onEntering(t,o),n.onTransitionEnd(t,a,function(){n.safeSetState({status:h},function(){n.props.onEntered(t,o)})})})},n.performExit=function(t){var e=this,n=this.props.exit,r=this.getTimeouts();if(!n)return void this.safeSetState({status:d},function(){e.props.onExited(t)});this.props.onExit(t),this.safeSetState({status:"exiting"},function(){e.props.onExiting(t),e.onTransitionEnd(t,r.exit,function(){e.safeSetState({status:d},function(){e.props.onExited(t)})})})},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(t,e){e=this.setNextCallback(e),this.setState(t,e)},n.setNextCallback=function(t){var e=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,e.nextCallback=null,t(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(t,e,n){this.setNextCallback(n);var r=null==e&&!this.props.addEndListener;if(!t||r)return void setTimeout(this.nextCallback,0);this.props.addEndListener&&this.props.addEndListener(t,this.nextCallback),null!=e&&setTimeout(this.nextCallback,e)},n.render=function(){var t=this.state.status;if(t===p)return null;var e=this.props,n=e.children,r=o(e,["children"]);if(delete r.in,delete r.mountOnEnter,delete r.unmountOnExit,delete r.appear,delete r.enter,delete r.exit,delete r.timeout,delete r.addEndListener,delete r.onEnter,delete r.onEntering,delete r.onEntered,delete r.onExit,delete r.onExiting,delete r.onExited,"function"==typeof n)return n(t,r);var i=u.default.Children.only(n);return u.default.cloneElement(i,r)},e}(u.default.Component);g.contextTypes={transitionGroup:s.object},g.childContextTypes={transitionGroup:function(){}},g.propTypes={},g.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:a,onEntering:a,onEntered:a,onExit:a,onExiting:a,onExited:a},g.UNMOUNTED=0,g.EXITED=1,g.ENTERING=2,g.ENTERED=3,g.EXITING=4;var f=(0,l.polyfill)(g);e.default=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}function i(){return i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},i.apply(this,arguments)}function a(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}function s(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}e.__esModule=!0,e.default=void 0;var u=r(n(2)),c=r(n(0)),l=n(146),p=n(324),d=Object.values||function(t){return Object.keys(t).map(function(e){return t[e]})},M={component:"div",childFactory:function(t){return t}},h=function(t){function e(e,n){var r;r=t.call(this,e,n)||this;var o=r.handleExited.bind(s(s(r)));return r.state={handleExited:o,firstRender:!0},r}a(e,t);var n=e.prototype;return n.getChildContext=function(){return{transitionGroup:{isMounting:!this.appeared}}},n.componentDidMount=function(){this.appeared=!0,this.mounted=!0},n.componentWillUnmount=function(){this.mounted=!1},e.getDerivedStateFromProps=function(t,e){var n=e.children,r=e.handleExited;return{children:e.firstRender?(0,p.getInitialChildMapping)(t,r):(0,p.getNextChildMapping)(t,n,r),firstRender:!1}},n.handleExited=function(t,e){var n=(0,p.getChildMapping)(this.props.children);t.key in n||(t.props.onExited&&t.props.onExited(e),this.mounted&&this.setState(function(e){var n=i({},e.children);return delete n[t.key],{children:n}}))},n.render=function(){var t=this.props,e=t.component,n=t.childFactory,r=o(t,["component","childFactory"]),i=d(this.state.children).map(n);return delete r.appear,delete r.enter,delete r.exit,null===e?i:c.default.createElement(e,r,i)},e}(c.default.Component);h.childContextTypes={transitionGroup:u.default.object.isRequired},h.propTypes={},h.defaultProps=M;var g=(0,l.polyfill)(h);e.default=g,t.exports=e.default},function(t,e,n){"use strict";e.__esModule=!0,e.classNamesShape=e.timeoutsShape=void 0;!function(t){t&&t.__esModule}(n(2));e.timeoutsShape=null;e.classNamesShape=null},function(t,e,n){"use strict";function r(t,e,n){this.props=t,this.context=e,this.refs=c,this.updater=n||u}function o(t,e,n){this.props=t,this.context=e,this.refs=c,this.updater=n||u}function i(){}var a=n(46),s=n(7),u=n(153),c=(n(154),n(75));n(3),n(334);r.prototype.isReactComponent={},r.prototype.setState=function(t,e){"object"!=typeof t&&"function"!=typeof t&&null!=t&&a("85"),this.updater.enqueueSetState(this,t),e&&this.updater.enqueueCallback(this,e,"setState")},r.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this),t&&this.updater.enqueueCallback(this,t,"forceUpdate")};i.prototype=r.prototype,o.prototype=new i,o.prototype.constructor=o,s(o.prototype,r.prototype),o.prototype.isPureReactComponent=!0,t.exports={Component:r,PureComponent:o}},function(t,e,n){"use strict";function r(t){var e=Function.prototype.toString,n=Object.prototype.hasOwnProperty,r=RegExp("^"+e.call(n).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");try{var o=e.call(t);return r.test(o)}catch(t){return!1}}function o(t){var e=c(t);if(e){var n=e.childIDs;l(t),n.forEach(o)}}function i(t,e,n){return"\n in "+(t||"Unknown")+(e?" (at "+e.fileName.replace(/^.*[\\\/]/,"")+":"+e.lineNumber+")":n?" (created by "+n+")":"")}function a(t){return null==t?"#empty":"string"==typeof t||"number"==typeof t?"#text":"string"==typeof t.type?t.type:t.type.displayName||t.type.name||"Unknown"}function s(t){var e,n=v.getDisplayName(t),r=v.getElement(t),o=v.getOwnerID(t);return o&&(e=v.getDisplayName(o)),i(n,r&&r._source,e)}var u,c,l,p,d,M,h,g=n(46),f=n(26),y=(n(3),n(6),"function"==typeof Array.from&&"function"==typeof Map&&r(Map)&&null!=Map.prototype&&"function"==typeof Map.prototype.keys&&r(Map.prototype.keys)&&"function"==typeof Set&&r(Set)&&null!=Set.prototype&&"function"==typeof Set.prototype.keys&&r(Set.prototype.keys));if(y){var N=new Map,m=new Set;u=function(t,e){N.set(t,e)},c=function(t){return N.get(t)},l=function(t){N.delete(t)},p=function(){return Array.from(N.keys())},d=function(t){m.add(t)},M=function(t){m.delete(t)},h=function(){return Array.from(m.keys())}}else{var D={},j={},I=function(t){return"."+t},w=function(t){return parseInt(t.substr(1),10)};u=function(t,e){var n=I(t);D[n]=e},c=function(t){var e=I(t);return D[e]},l=function(t){var e=I(t);delete D[e]},p=function(){return Object.keys(D).map(w)},d=function(t){var e=I(t);j[e]=!0},M=function(t){var e=I(t);delete j[e]},h=function(){return Object.keys(j).map(w)}}var L=[],v={onSetChildren:function(t,e){var n=c(t);n||g("144"),n.childIDs=e;for(var r=0;r<e.length;r++){var o=e[r],i=c(o);i||g("140"),null==i.childIDs&&"object"==typeof i.element&&null!=i.element&&g("141"),i.isMounted||g("71"),null==i.parentID&&(i.parentID=t),i.parentID!==t&&g("142",o,i.parentID,t)}},onBeforeMountComponent:function(t,e,n){u(t,{element:e,parentID:n,text:null,childIDs:[],isMounted:!1,updateCount:0})},onBeforeUpdateComponent:function(t,e){var n=c(t);n&&n.isMounted&&(n.element=e)},onMountComponent:function(t){var e=c(t);e||g("144"),e.isMounted=!0,0===e.parentID&&d(t)},onUpdateComponent:function(t){var e=c(t);e&&e.isMounted&&e.updateCount++},onUnmountComponent:function(t){var e=c(t);if(e){e.isMounted=!1;0===e.parentID&&M(t)}L.push(t)},purgeUnmountedComponents:function(){if(!v._preventPurging){for(var t=0;t<L.length;t++){o(L[t])}L.length=0}},isMounted:function(t){var e=c(t);return!!e&&e.isMounted},getCurrentStackAddendum:function(t){var e="";if(t){var n=a(t),r=t._owner;e+=i(n,t._source,r&&r.getName())}var o=f.current,s=o&&o._debugID;return e+=v.getStackAddendumByID(s)},getStackAddendumByID:function(t){for(var e="";t;)e+=s(t),t=v.getParentID(t);return e},getChildIDs:function(t){var e=c(t);return e?e.childIDs:[]},getDisplayName:function(t){var e=v.getElement(t);return e?a(e):null},getElement:function(t){var e=c(t);return e?e.element:null},getOwnerID:function(t){var e=v.getElement(t);return e&&e._owner?e._owner._debugID:null},getParentID:function(t){var e=c(t);return e?e.parentID:null},getSource:function(t){var e=c(t),n=e?e.element:null;return null!=n?n._source:null},getText:function(t){var e=v.getElement(t);return"string"==typeof e?e:"number"==typeof e?""+e:null},getUpdateCount:function(t){var e=c(t);return e?e.updateCount:0},getRootIDs:h,getRegisteredIDs:p,pushNonStandardWarningStack:function(t,e){if("function"==typeof console.reactStack){var n=[],r=f.current,o=r&&r._debugID;try{for(t&&n.push({name:o?v.getDisplayName(o):null,fileName:e?e.fileName:null,lineNumber:e?e.lineNumber:null});o;){var i=v.getElement(o),a=v.getParentID(o),s=v.getOwnerID(o),u=s?v.getDisplayName(s):null,c=i&&i._source;n.push({name:u,fileName:c?c.fileName:null,lineNumber:c?c.lineNumber:null}),o=a}}catch(t){}console.reactStack(n)}},popNonStandardWarningStack:function(){"function"==typeof console.reactStackEnd&&console.reactStackEnd()}};t.exports=v},function(t,e,n){"use strict";var r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;t.exports=r},function(t,e,n){"use strict";var r=(n(6),{isMounted:function(t){return!1},enqueueCallback:function(t,e){},enqueueForceUpdate:function(t){},enqueueReplaceState:function(t,e){},enqueueSetState:function(t,e){}});t.exports=r},function(t,e,n){"use strict";var r=!1;t.exports=r},function(t,e,n){var r,o;!function(i,a,s){void 0!==t&&t.exports?t.exports=s():(r=s,void 0!==(o="function"==typeof r?r.call(e,n,e,t):r)&&(t.exports=o))}(0,0,function(){function t(t,e){return t=t.replace(/:\//g,"://"),t=t.replace(/([^:\s])\/+/g,"$1/"),t=t.replace(/\/(\?|&|#[^!])/g,"$1"),t=t.replace(/(\?.+)\?/g,"$1&")}return function(){var e=arguments,n={};return"object"==typeof arguments[0]&&(e=arguments[0],n=arguments[1]||{}),t([].slice.call(e,0).join("/"),n)}})},function(t,e,n){"use strict";function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;for(var n in e)void 0===t[n]&&(t[n]=e[n]);return t}Object.defineProperty(e,"__esModule",{value:!0}),e.default=r,t.exports=e.default,t.exports.default=e.default},function(t,e){function n(t){return t&&t.__esModule?t:{default:t}}t.exports=n,t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,n){(function(e){!function(e,n){t.exports=n()}(0,function(){"use strict";function t(t,e,n,r){if(n="array"===n?"object":n,t&&typeof t[e]!==n)throw new Error(r)}function n(t,e,n){if(typeof t!==e)throw new Error(n)}function r(t,e,n){if(-1===e.indexOf(t))throw new Error(n)}function o(t){if(null==t)throw new TypeError("Cannot convert first argument to object");for(var e=Object(t),n=1;n<arguments.length;n++){var r=arguments[n];if(null!=r)for(var o=Object.keys(Object(r)),i=0,a=o.length;i<a;i++){var s=o[i],u=Object.getOwnPropertyDescriptor(r,s);void 0!==u&&u.enumerable&&(e[s]=r[s])}}return e}function i(t,e){return e.reduce(function(e,n){return t[n]&&(e[n]=t[n]),e},{})}function a(t){var e=[];for(var n in t)e.push(t[n]);return e}function s(){var t=a(arguments);return t.unshift({}),y.get().apply(void 0,t)}function u(t){var e=t.match(/^(https?:|file:|chrome-extension:)\/\/(([^:\/?#]*)(?::([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/);return e&&{href:t,protocol:e[1],host:e[2],hostname:e[3],port:e[4],pathname:e[5],search:e[6],hash:e[7]}}function c(t,e){var n=s(t);return t[e]&&(n[e]=t[e].trim()),n}function l(){return window}function p(t){this.webAuth=t,this._current_popup=null,this.options=null}function d(t){this.webAuth=t}function M(){this.webAuth=null,this.version=h,this.extensibilityPoints=["popup.authorize","popup.getPopupHandler"]}var h="9.16.2",g=Object.prototype.toString,f={check:function(e,o,i){if(o.optional&&!e||n(e,o.type,o.message),"object"===o.type&&i)for(var a=Object.keys(i),s=0;s<a.length;s++){var u=a[s];i[u].optional&&!e[u]||i[u].condition&&!i[u].condition(e)||(t(e,u,i[u].type,i[u].message),i[u].values&&r(e[u],i[u].values,i[u].value_message))}},attribute:t,variable:n,value:r,isArray:function(t){return this.supportsIsArray()?Array.isArray(t):"[object Array]"===g.call(t)},supportsIsArray:function(){return null!=Array.isArray}},y={get:function(){return Object.assign?Object.assign:o},objectAssignPolyfill:o},N={toSnakeCase:function t(e,n){return"object"!=typeof e||f.isArray(e)||null===e?e:(n=n||[],Object.keys(e).reduce(function(r,o){return r[-1===n.indexOf(o)?function(t){for(var e,n="",r=0,o=!0,i=!0;r<t.length;)e=t.charCodeAt(r),!i&&e>=65&&e<=90||!o&&e>=48&&e<=57?(n+="_",n+=t[r].toLowerCase()):n+=t[r].toLowerCase(),o=e>=48&&e<=57,i=e>=65&&e<=90,r++;return n}(o):o]=t(e[o]),r},{}))},toCamelCase:function t(e,n,r){return"object"!=typeof e||f.isArray(e)||null===e?e:(n=n||[],r=r||{},Object.keys(e).reduce(function(o,i){var a,s=-1===n.indexOf(i)?(a=i.split("_")).reduce(function(t,e){return t+e.charAt(0).toUpperCase()+e.slice(1)},a.shift()):i;return o[s]=t(e[s]||e[i],[],r),r.keepOriginal&&(o[i]=t(e[i],[],r)),o},{}))},blacklist:function(t,e){return Object.keys(t).reduce(function(n,r){return-1===e.indexOf(r)&&(n[r]=t[r]),n},{})},merge:function(t,e){return{base:e?i(t,e):t,with:function(t,e){return t=e?i(t,e):t,s(this.base,t)}}},pick:i,getKeysNotIn:function(t,e){var n=[];for(var r in t)-1===e.indexOf(r)&&n.push(r);return n},extend:s,getOriginFromUrl:function(t){if(t){var e=u(t);if(!e)return null;var n=e.protocol+"//"+e.hostname;return e.port&&(n+=":"+e.port),n}},getLocationFromUrl:u,trimUserDetails:function(t){return function(t,e){return e.reduce(c,t)}(t,["username","email","phoneNumber"])},updatePropertyOn:function t(e,n,r){"string"==typeof n&&(n=n.split("."));var o=n[0];e.hasOwnProperty(o)&&(1===n.length?e[o]=r:t(e[o],n.slice(1),r))}},m={redirect:function(t){l().location=t},getDocument:function(){return l().document},getWindow:l,getOrigin:function(){var t=l().location,e=t.origin;return e||(e=N.getOriginFromUrl(t.href)),e}},D="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},j=function(t,e){return function(t){var e,n;e=D,n=function(){function t(t){var e=[];if(0===t.length)return"";if("string"!=typeof t[0])throw new TypeError("Url must be a string. Received "+t[0]);if(t[0].match(/^[^\/:]+:\/*$/)&&t.length>1){var n=t.shift();t[0]=n+t[0]}t[0].match(/^file:\/\/\//)?t[0]=t[0].replace(/^([^\/:]+):\/*/,"$1:///"):t[0]=t[0].replace(/^([^\/:]+):\/*/,"$1://");for(var r=0;r<t.length;r++){var o=t[r];if("string"!=typeof o)throw new TypeError("Url must be a string. Received "+o);""!==o&&(r>0&&(o=o.replace(/^[\/]+/,"")),o=r<t.length-1?o.replace(/[\/]+$/,""):o.replace(/[\/]+$/,"/"),e.push(o))}var i=e.join("/"),a=(i=i.replace(/\/(\?|&|#[^!])/g,"$1")).split("?");return i=a.shift()+(a.length>0?"?":"")+a.join("&")}return function(){return t("object"==typeof arguments[0]?arguments[0]:[].slice.call(arguments))}},t.exports?t.exports=n():e.urljoin=n()}(e={exports:{}},e.exports),e.exports}(),I=Object.prototype.hasOwnProperty,w=Array.isArray,L=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),v=function(t,e){for(var n=e&&e.plainObjects?Object.create(null):{},r=0;r<t.length;++r)void 0!==t[r]&&(n[r]=t[r]);return n},z={arrayToObject:v,assign:function(t,e){return Object.keys(e).reduce(function(t,n){return t[n]=e[n],t},t)},combine:function(t,e){return[].concat(t,e)},compact:function(t){for(var e=[{obj:{o:t},prop:"o"}],n=[],r=0;r<e.length;++r)for(var o=e[r],i=o.obj[o.prop],a=Object.keys(i),s=0;s<a.length;++s){var u=a[s],c=i[u];"object"==typeof c&&null!==c&&-1===n.indexOf(c)&&(e.push({obj:i,prop:u}),n.push(c))}return function(t){for(;t.length>1;){var e=t.pop(),n=e.obj[e.prop];if(w(n)){for(var r=[],o=0;o<n.length;++o)void 0!==n[o]&&r.push(n[o]);e.obj[e.prop]=r}}}(e),t},decode:function(t,e,n){var r=t.replace(/\+/g," ");if("iso-8859-1"===n)return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch(t){return r}},encode:function(t,e,n){if(0===t.length)return t;var r=t;if("symbol"==typeof t?r=Symbol.prototype.toString.call(t):"string"!=typeof t&&(r=String(t)),"iso-8859-1"===n)return escape(r).replace(/%u[0-9a-f]{4}/gi,function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"});for(var o="",i=0;i<r.length;++i){var a=r.charCodeAt(i);45===a||46===a||95===a||126===a||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122?o+=r.charAt(i):a<128?o+=L[a]:a<2048?o+=L[192|a>>6]+L[128|63&a]:a<55296||a>=57344?o+=L[224|a>>12]+L[128|a>>6&63]+L[128|63&a]:(i+=1,a=65536+((1023&a)<<10|1023&r.charCodeAt(i)),o+=L[240|a>>18]+L[128|a>>12&63]+L[128|a>>6&63]+L[128|63&a])}return o},isBuffer:function(t){return!(!t||"object"!=typeof t||!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t)))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(w(t)){for(var n=[],r=0;r<t.length;r+=1)n.push(e(t[r]));return n}return e(t)},merge:function t(e,n,r){if(!n)return e;if("object"!=typeof n){if(w(e))e.push(n);else{if(!e||"object"!=typeof e)return[e,n];(r&&(r.plainObjects||r.allowPrototypes)||!I.call(Object.prototype,n))&&(e[n]=!0)}return e}if(!e||"object"!=typeof e)return[e].concat(n);var o=e;return w(e)&&!w(n)&&(o=v(e,r)),w(e)&&w(n)?(n.forEach(function(n,o){if(I.call(e,o)){var i=e[o];i&&"object"==typeof i&&n&&"object"==typeof n?e[o]=t(i,n,r):e.push(n)}else e[o]=n}),e):Object.keys(n).reduce(function(e,o){var i=n[o];return I.call(e,o)?e[o]=t(e[o],i,r):e[o]=i,e},o)}},b=String.prototype.replace,C=/%20/g,T={RFC1738:"RFC1738",RFC3986:"RFC3986"},E=z.assign({default:T.RFC3986,formatters:{RFC1738:function(t){return b.call(t,C,"+")},RFC3986:function(t){return String(t)}}},T),x=Object.prototype.hasOwnProperty,k={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},O=Array.isArray,S=Array.prototype.push,A=function(t,e){S.apply(t,O(e)?e:[e])},U=Date.prototype.toISOString,_=E.default,Y={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:z.encode,encodeValuesOnly:!1,format:_,formatter:E.formatters[_],indices:!1,serializeDate:function(t){return U.call(t)},skipNulls:!1,strictNullHandling:!1},Q=function t(e,n,r,o,i,a,s,u,c,l,p,d,M){var h,g=e;if("function"==typeof s?g=s(n,g):g instanceof Date?g=l(g):"comma"===r&&O(g)&&(g=z.maybeMap(g,function(t){return t instanceof Date?l(t):t}).join(",")),null===g){if(o)return a&&!d?a(n,Y.encoder,M,"key"):n;g=""}if("string"==typeof(h=g)||"number"==typeof h||"boolean"==typeof h||"symbol"==typeof h||"bigint"==typeof h||z.isBuffer(g))return a?[p(d?n:a(n,Y.encoder,M,"key"))+"="+p(a(g,Y.encoder,M,"value"))]:[p(n)+"="+p(String(g))];var f,y=[];if(void 0===g)return y;if(O(s))f=s;else{var N=Object.keys(g);f=u?N.sort(u):N}for(var m=0;m<f.length;++m){var D=f[m],j=g[D];if(!i||null!==j){var I=O(g)?"function"==typeof r?r(n,D):n:n+(c?"."+D:"["+D+"]");A(y,t(j,I,r,o,i,a,s,u,c,l,p,d,M))}}return y},P=(Object.prototype.hasOwnProperty,Array.isArray,function(t,e){var n,r=t,o=function(t){if(!t)return Y;if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=t.charset||Y.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=E.default;if(void 0!==t.format){if(!x.call(E.formatters,t.format))throw new TypeError("Unknown format option provided.");n=t.format}var r=E.formatters[n],o=Y.filter;return("function"==typeof t.filter||O(t.filter))&&(o=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:Y.addQueryPrefix,allowDots:void 0===t.allowDots?Y.allowDots:!!t.allowDots,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:Y.charsetSentinel,delimiter:void 0===t.delimiter?Y.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:Y.encode,encoder:"function"==typeof t.encoder?t.encoder:Y.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:Y.encodeValuesOnly,filter:o,formatter:r,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:Y.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:Y.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:Y.strictNullHandling}}(e);"function"==typeof o.filter?r=(0,o.filter)("",r):O(o.filter)&&(n=o.filter);var i,a=[];if("object"!=typeof r||null===r)return"";i=e&&e.arrayFormat in k?e.arrayFormat:e&&"indices"in e?e.indices?"indices":"repeat":"indices";var s=k[i];n||(n=Object.keys(r)),o.sort&&n.sort(o.sort);for(var u=0;u<n.length;++u){var c=n[u];o.skipNulls&&null===r[c]||A(a,Q(r[c],c,s,o.strictNullHandling,o.skipNulls,o.encode?o.encoder:null,o.filter,o.sort,o.allowDots,o.serializeDate,o.formatter,o.encodeValuesOnly,o.charset))}var l=a.join(o.delimiter),p=!0===o.addQueryPrefix?"?":"";return o.charsetSentinel&&("iso-8859-1"===o.charset?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),l.length>0?p+l:""});return p.prototype.preload=function(t){var e=this,n=m.getWindow(),r=t.url||"about:blank",o=t.popupOptions||{};o.location="yes",delete o.width,delete o.height;var i=P(o,{encode:!1,delimiter:","});return this._current_popup&&!this._current_popup.closed||(this._current_popup=n.open(r,"_blank",i),this._current_popup.kill=function(t){e._current_popup.success=t,this.close(),e._current_popup=null}),this._current_popup},p.prototype.load=function(t,e,n,r){var o=this;this.url=t,this.options=n,this._current_popup?this._current_popup.location.href=t:(n.url=t,this.preload(n)),this.transientErrorHandler=function(t){o.errorHandler(t,r)},this.transientStartHandler=function(t){o.startHandler(t,r)},this.transientExitHandler=function(){o.exitHandler(r)},this._current_popup.addEventListener("loaderror",this.transientErrorHandler),this._current_popup.addEventListener("loadstart",this.transientStartHandler),this._current_popup.addEventListener("exit",this.transientExitHandler)},p.prototype.errorHandler=function(t,e){this._current_popup&&(this._current_popup.kill(!0),e({error:"window_error",errorDescription:t.message}))},p.prototype.unhook=function(){this._current_popup.removeEventListener("loaderror",this.transientErrorHandler),this._current_popup.removeEventListener("loadstart",this.transientStartHandler),this._current_popup.removeEventListener("exit",this.transientExitHandler)},p.prototype.exitHandler=function(t){this._current_popup&&(this.unhook(),this._current_popup.success||t({error:"window_closed",errorDescription:"Browser window closed"}))},p.prototype.startHandler=function(t,e){var n=this;if(this._current_popup){var r=j("https:",this.webAuth.baseOptions.domain,"/mobile");if(!t.url||0===t.url.indexOf(r+"#")){var o=t.url.split("#");if(1!==o.length){var i={hash:o.pop()};this.options.nonce&&(i.nonce=this.options.nonce),this.webAuth.parseHash(i,function(t,r){(t||r)&&(n._current_popup.kill(!0),e(t,r))})}}}},d.prototype.processParams=function(t){return t.redirectUri=j("https://"+t.domain,"mobile"),delete t.owp,t},d.prototype.getPopupHandler=function(){return new p(this.webAuth)},M.prototype.setWebAuth=function(t){this.webAuth=t},M.prototype.supports=function(t){var e=m.getWindow();return(!!e.cordova||!!e.electron)&&this.extensibilityPoints.indexOf(t)>-1},M.prototype.init=function(){return new d(this.webAuth)},M})}).call(e,n(15))},function(t,e,n){"use strict";function r(t){return"string"==typeof t?c()(t.toLowerCase()):""}function o(t,e){if(t=r(t),!n.i(p.e)(t))return e({});var o="https://secure.gravatar.com/"+d(t)+".json";l.a.get(o,function(t,n){!t&&n&&n.entry&&n.entry[0]?e(null,n.entry[0].displayName):e({})})}function i(t,e){if(t=r(t),!n.i(p.e)(t))return e({});e(null,"https://secure.gravatar.com/avatar/"+d(t)+"?d=404&s=160")}Object.defineProperty(e,"__esModule",{value:!0}),e.displayName=o,e.url=i;var a=n(221),s=n.n(a),u=n(32),c=n.n(u),l=n(219),p=n(23),d=s.a.md5||s.a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){var e=n(97),r=n(98);"function"==typeof t.window.define&&t.window.define.amd?(t.window.define("auth0Lock",function(){return e.a}),t.window.define("auth0LockPasswordless",function(){return r.a})):t.window&&(t.window.Auth0Lock=e.a,t.window.Auth0LockPasswordless=r.a)}.call(e,n(15))},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=n(51),p=n(70),d=n(68),M=n(27),h=n(10),g=n(1),f=n(111),y=function(t){function e(){var i,a,s;r(this,e);for(var u=arguments.length,c=Array(u),l=0;l<u;l++)c[l]=arguments[l];return i=a=o(this,t.call.apply(t,[this].concat(c))),a.handleDontRememberPasswordClick=function(t){t.preventDefault(),n.i(M.k)(g.id(a.props.lock))},s=i,o(a,s)}return i(e,t),e.prototype.render=function(){var t=this.props,e=t.emailInputPlaceholder,r=t.forgotPasswordAction,o=t.i18n,i=t.instructions,a=t.lock,s=t.passwordInputPlaceholder,u=t.showForgotPasswordLink,y=t.showPassword,N=t.usernameInputPlaceholder,m=t.usernameStyle,D=i||null,j=D&&c.a.createElement("p",null,D),I=g.connectionResolver(a),w="email"===m&&void 0===I?c.a.createElement(l.a,{i18n:o,lock:a,forceInvalidVisibility:!y,placeholder:e,strictValidation:!1}):c.a.createElement(p.a,{i18n:o,lock:a,placeholder:N,usernameStyle:m,validateFormat:!1,strictValidation:!1}),L=g.captcha(a)&&g.captcha(a).get("required")?c.a.createElement(f.a,{i18n:o,lock:a,onReload:function(){return n.i(M.e)(g.id(a),!1)}}):null,v=u&&n.i(h.i)(a,"forgotPassword")?c.a.createElement("p",{className:"auth0-lock-alternative"},c.a.createElement("a",{className:"auth0-lock-alternative-link",href:n.i(h.B)(a,"#"),onClick:n.i(h.B)(a)?void 0:this.handleDontRememberPasswordClick},r)):null;return c.a.createElement("div",null,j,w,c.a.createElement(d.a,{i18n:o,lock:a,placeholder:s,hidden:!y}),L,v)},e}(c.a.Component);e.a=y,y.propTypes={emailInputPlaceholder:s.a.string.isRequired,forgotPasswordAction:s.a.string.isRequired,i18n:s.a.object.isRequired,instructions:s.a.any,lock:s.a.object.isRequired,passwordInputPlaceholder:s.a.string.isRequired,showForgotPasswordLink:s.a.bool.isRequired,showPassword:s.a.bool.isRequired,usernameInputPlaceholder:s.a.string.isRequired,usernameStyle:s.a.oneOf(["any","email","username"])}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=n(188),p=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.render=function(){var t=this.props,e=t.mfaInputPlaceholder,n=t.i18n,r=t.instructions,o=t.lock,i=t.title,a=r||null,s=a&&c.a.createElement("p",null,a),u=c.a.createElement(l.a,{i18n:n,lock:o,placeholder:e}),p=i&&c.a.createElement("h2",null,i);return c.a.createElement("div",null,p,s,u)},e}(c.a.Component);e.a=p,p.propTypes={mfaInputPlaceholder:s.a.string.isRequired,title:s.a.string.isRequired,i18n:s.a.object.isRequired,instructions:s.a.any,lock:s.a.object.isRequired}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.closeHandler=d.c,e.key="auxiliarypane",e.lock=t,t.get("passwordResetted")?l.a.createElement(g,e):null}e.a=a;var s=n(2),u=n.n(s),c=n(0),l=n.n(c),p=n(55),d=n(17),M=n(1),h=n(12),g=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.handleClose=function(){var t=this.props,e=t.closeHandler,n=t.lock;e(M.id(n))},e.prototype.render=function(){var t=this.props.lock,e=M.ui.closable(t)?this.handleClose.bind(this):void 0;return l.a.createElement(p.a,{lock:t,closeHandler:e},l.a.createElement("p",null,h.html(this.props.lock,["success","forgotPassword"])))},e}(l.a.Component);g.propTypes={closeHandler:u.a.func.isRequired,lock:u.a.object.isRequired}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(0),s=n.n(a),u=n(14),c=n(165),l=n(10),p=n(27),d=n(163),M=n(10),h=n(16),g=n(12),f=n(1),y=n(8),N=function(t){var e=t.i18n,n=t.model,r=e.html("forgotPasswordInstructions")||null,o=r&&s.a.createElement("p",null,r);return s.a.createElement(c.a,{emailInputPlaceholder:e.str("emailInputPlaceholder"),header:o,i18n:e,lock:n})},m=function(t){function e(){return r(this,e),o(this,t.call(this,"forgotPassword"))}return i(e,t),e.prototype.backHandler=function(t){return n.i(l.i)(t,"login")?p.i:void 0},e.prototype.submitButtonLabel=function(t){return g.str(t,["forgotPasswordSubmitLabel"])},e.prototype.getScreenTitle=function(t){return g.str(t,"forgotPasswordTitle")},e.prototype.isSubmitDisabled=function(t){var e=n.i(h.b)(t,n.i(M.a)(t,{emailFirst:!0}));return e?setTimeout(function(){n.i(y.b)(y.c,"lock",f.id(t),f.setGlobalError,g.str(t,["error","forgotPassword","enterprise_email"]))},50):n.i(y.b)(y.c,"lock",f.id(t),f.clearGlobalError),e},e.prototype.submitHandler=function(){return p.j},e.prototype.renderAuxiliaryPane=function(t){return n.i(d.a)(t)},e.prototype.render=function(){return N},e}(u.a);e.a=m},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=n(51),p=(n(1),function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.render=function(){var t=this.props,e=t.emailInputPlaceholder,n=t.header,r=t.i18n,o=t.lock;return c.a.createElement("div",null,n,c.a.createElement(l.a,{i18n:r,lock:o,placeholder:e,strictValidation:!1}))},e}(c.a.Component));p.propTypes={emailInputPlaceholder:s.a.string.isRequired,lock:s.a.object.isRequired},e.a=p},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.closeHandler=d.c,e.key="auxiliarypane",e.lock=t,t.get("signedUp")&&!n.i(h.q)(t)?l.a.createElement(f,e):null}e.a=a;var s=n(2),u=n.n(s),c=n(0),l=n.n(c),p=n(55),d=n(17),M=n(1),h=n(10),g=n(12),f=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.handleClose=function(){var t=this.props,e=t.closeHandler,n=t.lock;e(M.id(n))},e.prototype.render=function(){var t=this.props.lock,e=M.ui.closable(t)?this.handleClose.bind(this):void 0;return l.a.createElement(p.a,{lock:t,closeHandler:e},l.a.createElement("p",null,g.html(t,["success","signUp"])))},e}(l.a.Component);f.propTypes={closeHandler:u.a.func.isRequired,lock:u.a.object.isRequired}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=n(70),p=n(68),d=(n(1),function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.render=function(){var t=this.props,e=t.header,n=t.i18n,r=t.model,o=t.passwordInputPlaceholder,i=t.usernameInputPlaceholder;return c.a.createElement("div",null,e,c.a.createElement(l.a,{i18n:n,lock:r,placeholder:i,validateFormat:!1,strictValidation:!1}),c.a.createElement(p.a,{i18n:n,lock:r,placeholder:o}))},e}(c.a.Component));e.a=d,d.propTypes={header:s.a.string,i18n:s.a.object.isRequired,model:s.a.object.isRequired,passwordInputPlaceholder:s.a.string.isRequired,usernameInputPlaceholder:s.a.string.isRequired}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(0),s=n.n(a),u=n(14),c=n(19),l=n(167),p=n(65),d=n(16),M=n(12),h=function(t){var e,r=t.i18n,o=t.model,i=n.i(d.p)(o);e=null!==i?r.str("enterpriseActiveLoginInstructions",i):r.str("enterpriseLoginIntructions"),e=e||null;var a=e&&s.a.createElement("p",null,e);return s.a.createElement(l.a,{header:a,i18n:r,model:o,passwordInputPlaceholder:r.str("passwordInputPlaceholder"),usernameInputPlaceholder:r.str("usernameInputPlaceholder")})},g=function(t){function e(){return r(this,e),o(this,t.call(this,"hrd"))}return i(e,t),e.prototype.backHandler=function(t){return n.i(d.q)(t)?null:p.c},e.prototype.submitButtonLabel=function(t){return M.str(t,["loginSubmitLabel"])},e.prototype.submitHandler=function(t){return p.b},e.prototype.renderAuxiliaryPane=function(t){return n.i(c.a)(t)},e.prototype.render=function(){return h},e}(u.a);e.a=g},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(0),s=n.n(a),u=n(14),c=n(73),l=n(53),p=n(19),d=n(1),M=n(16),h=function(t){var e=t.i18n,r=t.model,o=e.html("windowsAuthInstructions")||null,i=o&&s.a.createElement("p",null,o);return s.a.createElement(c.a,{alternativeLabel:e.str("notYourAccountAction"),alternativeClickHandler:function(){return n.i(l.c)(d.id(r))},buttonLabel:e.str("windowsAuthLabel"),buttonClickHandler:function(t){return n.i(l.a)(d.id(r),n.i(M.r)(r))},header:i,strategy:"windows"})},g=function(t){function e(){return r(this,e),o(this,t.call(this,"kerberos"))}return i(e,t),e.prototype.renderAuxiliaryPane=function(t){return n.i(p.a)(t)},e.prototype.render=function(){return h},e}(u.a);e.a=g},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){return"google-apps"===t?t:~["adfs","office365","waad"].indexOf(t)?"windows":"auth0"}var s=n(0),u=n.n(s),c=n(14),l=n(73),p=n(53),d=n(19),M=n(1),h=n(16),g=n(47),f=function(t){var e=t.i18n,r=t.model,o=e.html("enterpriseLoginIntructions")||null,i=o&&u.a.createElement("p",null,o),s=n.i(g.b)(r),c=n.i(h.h)(r),d=c.getIn(["name"]),f=c.getIn(["domains",0]),y=c.getIn(["displayName"])||null,N=M.ui.preferConnectionDisplayName(r),m=s.get(c.get("name")),D=m&&m.get("displayName")||N&&y&&e.str("loginAtLabel",y)||f&&e.str("loginAtLabel",f)||e.str("loginAtLabel",d),j=m&&m.get("primaryColor"),I=m&&m.get("foregroundColor"),w=m&&m.get("icon");return u.a.createElement(l.a,{buttonLabel:D,buttonClickHandler:function(t){return n.i(p.a)(M.id(r),n.i(h.h)(r))},header:i,buttonIcon:w,primaryColor:j,foregroundColor:I,strategy:a(n.i(h.h)(r).get("strategy"))})},y=function(t){function e(){return r(this,e),o(this,t.call(this,"enterpriseQuickAuth"))}return i(e,t),e.prototype.renderAuxiliaryPane=function(t){return n.i(d.a)(t)},e.prototype.render=function(){return f},e}(c.a);e.a=y},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(0),s=n.n(a),u=n(14),c=n(196),l=n(34),p=n(33),d=n(19),M=n(4),h=n(40),g=function(t){var e=t.i18n,r=t.model,o=n.i(l.b)(r)?e.str("passwordlessEmailCodeInstructions",n.i(M.c)(r,"email")):e.str("passwordlessSMSCodeInstructions",n.i(h.e)(r));return s.a.createElement(c.a,{instructions:o,lock:r,placeholder:e.str("codeInputPlaceholder"),resendLabel:e.str("resendCodeAction"),onRestart:p.c})},f=function(t){function e(){return r(this,e),o(this,t.call(this,"vcode"))}return i(e,t),e.prototype.backHandler=function(){return p.c},e.prototype.submitHandler=function(){return p.d},e.prototype.renderAuxiliaryPane=function(t){return n.i(d.a)(t)},e.prototype.render=function(){return g},e}(u.a);e.a=f},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.key="auxiliarypane",e.lock=t,h.d(t)?u.a.createElement(m,e):null}e.a=a;var s=n(0),u=n.n(s),c=n(55),l=n(17),p=n(1),d=n(4),M=n(33),h=n(34),g=n(12),f=u.a.createElement("svg",{focusable:"false",height:"32px",style:{enableBackground:"new 0 0 32 32"},version:"1.1",viewBox:"0 0 32 32",width:"32px",xmlSpace:"preserve",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"}," ",u.a.createElement("path",{d:"M27.877,19.662c0.385-1.23,0.607-2.531,0.607-3.884c0-7.222-5.83-13.101-13.029-13.194v4.238 c4.863,0.093,8.793,4.071,8.793,8.956c0,0.678-0.088,1.332-0.232,1.966l-3.963-1.966l2.76,8.199l8.197-2.762L27.877,19.662z"}),u.a.createElement("path",{d:"M7.752,16.222c0-0.678,0.088-1.332,0.232-1.967l3.963,1.967l-2.76-8.199L0.99,10.785l3.133,1.553 c-0.384,1.23-0.607,2.531-0.607,3.885c0,7.223,5.83,13.1,13.03,13.194v-4.238C11.682,25.086,7.752,21.107,7.752,16.222z"})),y=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.render=function(){var t=this.props,e=t.label,n=t.onClick;return u.a.createElement("a",{className:"auth0-lock-resend-link",href:"#",onClick:n},e," ",u.a.createElement("span",null,f))},e}(u.a.Component),N=function(t){function e(){var i,a,s;r(this,e);for(var u=arguments.length,c=Array(u),l=0;l<u;l++)c[l]=arguments[l];return i=a=o(this,t.call.apply(t,[this].concat(c))),a.handleClick=function(t){t.preventDefault(),n.i(M.f)(p.id(a.props.lock))},s=i,o(a,s)}return i(e,t),e.prototype.render=function(){var t=this.props,e=t.labels,n=t.lock,r=h.o(n)&&u.a.createElement(y,{onClick:this.handleClick,label:h.p(n)?e.retry:e.resend}),o=h.q(n)&&u.a.createElement("a",{className:"auth0-lock-resend-link"},e.resending),i=h.r(n)&&u.a.createElement("span",{className:"auth0-lock-sent-label"},e.sent),a=h.p(n)&&u.a.createElement("span",{className:"auth0-lock-sent-failed-label"},e.failed);return u.a.createElement("span",null,r,o,i,a)},e}(u.a.Component),m=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.render=function(){var t=this,e=this.props.lock,n=p.ui.closable(e)?this.handleClose:void 0,r={failed:g.str(e,"failedLabel"),resend:g.str(e,"resendLabel"),resending:g.str(e,"resendingLabel"),retry:g.str(e,"retryLabel"),sent:g.str(e,"sentLabel")};return u.a.createElement(c.a,{lock:e,backHandler:function(){return t.handleBack()},closeHandler:function(){return n()}},u.a.createElement("p",null,g.html(e,["success","magicLink"],d.g(e))),u.a.createElement(N,{labels:r,lock:e}))},e.prototype.handleBack=function(){n.i(M.c)(p.id(this.props.lock))},e.prototype.handleClose=function(){n.i(l.c)(p.id(this.props.lock))},e}(u.a.Component)},function(t,e,n){"use strict";function r(t,e,r){n.i(s.a)({method:"setClient",url:a()(e,"client",t+".js?t"+ +new Date),check:function(e){return e&&e.id===t},cb:r})}function o(t,e){return t=n.i(c.c)(t,e),t=u.filterConnections(t),t=u.runHook(t,"didReceiveClientSettings")}e.a=r,e.b=o;var i=n(155),a=n.n(i),s=n(74),u=n(1),c=n(106)},function(t,e,n){"use strict";function r(t){return t=c.useTenantInfo(t)?n.i(p.d)(t,"client",{syncFn:function(t,e){return n.i(s.a)(c.tenantBaseUrl(t),e)},successFn:function(t,e){return n.i(s.b)(t,c.clientID(t),e)}}):n.i(p.d)(t,"client",{syncFn:function(t,e){return n.i(a.a)(c.clientID(t),c.clientBaseUrl(t),e)},successFn:a.b}),t=n.i(p.d)(t,"sso",{conditionFn:function(t){return c.auth.sso(t)&&c.ui.rememberLastLogin(t)},waitFn:function(t){return n.i(p.b)(t,"client")},syncFn:function(t,e){n.i(u.a)(c.id(t),n.i(l.c)(t),function(){for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];c.emitEvent(t,"ssodata fetched",r),e.apply(void 0,r)})},successFn:function(t,e){return t.mergeIn(["sso"],i.a.fromJS(e))},errorFn:function(t,e){if("consent_required"===e.error)c.warn(t,e.error_description);else{var n=location.protocol+"//"+location.hostname;location.port&&(n+=":"+location.port);var r="https://manage.auth0.com/#/applications/"+c.clientID(t)+"/settings";c.warn(t,'There was an error fetching the SSO data. This is expected - and not a problem - if the tenant has Seamless SSO enabled. If the tenant doesn\'t have Seamless SSO enabled, this could simply mean that there was a problem with the network. But, if a "Origin" error has been logged before this warning, please add "'+n+'" to the "Allowed Web Origins" list in the Auth0 dashboard: '+r)}}}),t=n.i(p.d)(t,"captcha",{syncFn:function(t,e){d.a.getChallenge(t.get("id"),function(t,n){e(null,n)})},successFn:M.setCaptcha})}e.a=r;var o=n(11),i=n.n(o),a=n(173),s=n(176),u=n(175),c=n(1),l=n(16),p=n(29),d=n(28),M=n(1)},function(t,e,n){"use strict";function r(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];a.get.apply(a,[t].concat(n))}e.a=r;var o=n(28),i=n(215),a=new i.a(function(){return o.a.getSSOData.apply(o.a,arguments)})},function(t,e,n){"use strict";function r(t,e){n.i(i.a)({method:"setTenant",url:t+"?t"+ +new Date,check:function(){return!0},cb:e})}function o(t,e,r){return t=n.i(s.c)(t,e,r),t=a.filterConnections(t),t=a.runHook(t,"didReceiveClientSettings")}e.a=r,e.b=o;var i=n(74),a=n(1),s=n(66)},function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t,e){if(!t)return t;if("User closed the popup window"===t.status)return{code:"lock.popup_closed",error:"lock.popup_closed",description:"Popup window closed."};if("unauthorized"===t.code)return t.description&&"access_denied"!==t.description?"user is blocked"===t.description?{code:"blocked_user",error:"blocked_user",description:t.description}:{code:"rule_error",error:"rule_error",description:t.description}:{code:"lock.unauthorized",error:"lock.unauthorized",description:t.description||"Permissions were not granted."};if(window.location.host!==e&&("access_denied"===t.error||"access_denied"===t.code))return{code:"invalid_user_password",error:"invalid_user_password",description:t.description};if("invalid_captcha"===t.code){var n;return n={code:"invalid_captcha"},n.code="invalid_captcha",n.description=t.description,n}var r={error:t.code?t.code:t.statusCode||t.error,description:t.description||t.code};return void 0===r.error&&void 0===r.description?t:r}function i(t,e,n){return t?function(t){return n(o(t,e))}:function(t,r){return n(o(t,e),r)}}function a(t){t.popup;return r(t,["popup"])}function s(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.__tenant,n=t.__token_issuer,r=t.__jwks_uri;return e||n||r?{__tenant:e,__token_issuer:n,__jwks_uri:r}:null}function u(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=r(t,[]);return["username","email","phoneNumber","mfa_code"].forEach(function(t){"string"==typeof e[t]&&(e[t]=e[t].trim())}),e}function c(){return"11.30.1"}e.f=o,e.c=i,e.e=a,e.a=s,e.d=u,e.b=c},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=n(99),i=n(253),a=n.n(i),s=n(158),u=n.n(s),c=n(177),l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},p=function(){function t(e,i,a,s){r(this,t),this.lockID=e,this.client=null,this.authOpt=null,this.domain=a,this.isUniversalLogin=window.location.host===a,this._enableIdPInitiatedLogin=!(!s._enableIdPInitiatedLogin&&!s._enableImpersonation);var l=this.getTelemetryInfo(s._telemetryInfo),p=s.state;s.params&&s.params.state&&(p=s.params.state);var d=s.nonce;s.params&&s.params.nonce&&(d=s.params.nonce);var M=s.params&&s.params.scope;this.client=new o.a.WebAuth({clientID:i,domain:a,audience:s.audience,redirectUri:s.redirectUrl,responseMode:s.responseMode,responseType:s.responseType,leeway:s.leeway||60,plugins:s.plugins||[new u.a],overrides:n.i(c.a)(s.overrides),_sendTelemetry:!1!==s._sendTelemetry,_telemetryInfo:l,state:p,nonce:d,scope:M}),this.authOpt={popup:!s.redirect,popupOptions:s.popupOptions,nonce:d,state:p,scope:M},this.isUniversalLogin&&void 0!==s.sso&&(this.authOpt.sso=s.sso)}return t.prototype.getTelemetryInfo=function(t){var e=void 0,r=a.a.parse(window.location.search.substr(1)),i=r.auth0Client,s=i&&JSON.parse(atob(i));if(this.isUniversalLogin&&s){var u;e=l({},s,{env:l({},s.env,(u={},u["lock.js-ulp"]=n.i(c.b)(),u["auth0.js-ulp"]=o.a.version.raw,u))})}if(this.isUniversalLogin&&!s){var p;e={name:"lock.js-ulp",version:n.i(c.b)(),env:(p={},p["auth0.js-ulp"]=o.a.version.raw,p)}}if(!this.isUniversalLogin&&t){var d;e=l({},t,{env:l({},t.env,(d={},d["lock.js"]=n.i(c.b)(),d["auth0.js"]=o.a.version.raw,d))})}if(!e){var M;e={name:"lock.js",version:n.i(c.b)(),env:(M={},M["auth0.js"]=o.a.version.raw,M)}}return e},t.prototype.logIn=function(t,e,r){var o=n.i(c.c)(!1,this.domain,r),i=n.i(c.d)(n.i(c.e)(l({},t,this.authOpt,e)));t.login_hint&&(i.login_hint=t.login_hint),t.username||t.email?this.authOpt.popup?this.client.popup.loginWithCredentials(i,o):(i.realm=t.connection,this.client.login(i,o)):this.authOpt.popup?this.client.popup.authorize(l({},i,{owp:!0}),o):this.client.authorize(i,o)},t.prototype.logout=function(t){this.client.logout(t)},t.prototype.signUp=function(t,e){delete t.autoLogin,this.client.signup(n.i(c.d)(t),function(t,n){return e(t,n)})},t.prototype.resetPassword=function(t,e){this.client.changePassword(n.i(c.d)(t),e)},t.prototype.passwordlessStart=function(t,e){this.client.passwordlessStart(n.i(c.d)(t),function(t){return e(n.i(c.f)(t))})},t.prototype.passwordlessVerify=function(t,e){var r=l({},t,{popup:this.authOpt.popup});this.client.passwordlessLogin(r,function(t,r){return e(n.i(c.f)(t),r)})},t.prototype.parseHash=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments[1];return this.client.parseHash({__enableIdPInitiatedLogin:this._enableIdPInitiatedLogin,hash:t,nonce:this.authOpt.nonce,state:this.authOpt.state},e)},t.prototype.getUserInfo=function(t,e){return this.client.client.userInfo(t,e)},t.prototype.getProfile=function(t,e){this.getUserInfo(t,e)},t.prototype.getSSOData=function(){var t;return(t=this.client.client).getSSOData.apply(t,arguments)},t.prototype.getChallenge=function(){var t;return(t=this.client.client).getChallenge.apply(t,arguments)},t.prototype.getUserCountry=function(t){return this.client.client.getUserCountry(t)},t.prototype.checkSession=function(t,e){return this.client.checkSession(t,e)},t}();e.a=p},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){return!n.i(j.b)(t)&&(y.hasSomeConnections(t,"database")?n.i(M.i)(t,"signUp"):y.hasSomeConnections(t,"social")&&n.i(M.c)(t,"signUp")?n.i(M.i)(t,"signUp"):void 0)}var s=n(0),u=n.n(s),c=n(14),l=n(52),p=n(161),d=n(48),M=n(10),h=n(27),g=n(19),f=n(103),y=n(1),N=n(65),m=n(16),D=n(104),j=n(50),I=n(12),w=function(t){var e=t.i18n,r=t.model,o=n.i(j.b)(r),i=n.i(j.c)(r,"social"),s=a(r)&&u.a.createElement(f.a,{key:"loginsignup",lock:r,loginLabel:e.str("loginLabel"),signUpLink:n.i(M.z)(r),signUpLabel:e.str("signUpLabel")}),c=y.hasSomeConnections(r,"social")&&u.a.createElement(l.a,{instructions:e.html("socialLoginInstructions"),labelFn:e.str,lock:r,showLoading:i,signUp:!1}),h=!o&&(y.hasSomeConnections(r,"database")||!!n.i(m.j)(r)),g=h&&y.hasSomeConnections(r,"database"),N=c?"databaseEnterpriseAlternativeLoginInstructions":"databaseEnterpriseLoginInstructions",I="any"===n.i(M.A)(r)||y.countConnections(r,"enterprise")>1?"usernameOrEmailInputPlaceholder":"usernameInputPlaceholder",w=n.i(M.A)(r),L=(o||y.hasSomeConnections(r,"database")||y.hasSomeConnections(r,"enterprise"))&&u.a.createElement(p.a,{emailInputPlaceholder:e.str("emailInputPlaceholder"),forgotPasswordAction:e.str("forgotPasswordAction"),i18n:e,instructions:e.html(N),lock:r,passwordInputPlaceholder:e.str("passwordInputPlaceholder"),showForgotPasswordLink:g,showPassword:h,usernameInputPlaceholder:e.str(I),usernameStyle:w}),v=o&&u.a.createElement(D.a,null,e.str("ssoEnabled")),z=c&&L&&u.a.createElement(d.a,null);return u.a.createElement("div",null,v,s,u.a.createElement("div",null,c,z,L))},L=function(t){function e(){return r(this,e),o(this,t.call(this,"main.login"))}return i(e,t),e.prototype.renderAuxiliaryPane=function(t){return n.i(g.a)(t)},e.prototype.renderTabs=function(t){return a(t)},e.prototype.submitButtonLabel=function(t){return I.str(t,["loginSubmitLabel"])},e.prototype.isSubmitDisabled=function(t){return!y.hasSomeConnections(t,"database")&&!n.i(m.j)(t)&&!n.i(j.b)(t)},e.prototype.submitHandler=function(t){return n.i(j.c)(t,"social")?null:n.i(m.k)(t,n.i(M.a)(t))?function(e){return n.i(N.a)(e,n.i(M.a)(t))}:n.i(j.b)(t)||!n.i(M.r)(t)||!n.i(M.e)(t)&&n.i(m.e)(t)?N.b:h.a},e.prototype.render=function(){return w},e}(c.a);e.a=L},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(0),s=n.n(a),u=n(14),c=n(162),l=n(12),p=n(27),d=n(10),M=n(19),h=function(t){var e=t.i18n,n=t.model;return s.a.createElement(c.a,{mfaInputPlaceholder:e.str("mfaInputPlaceholder"),i18n:e,instructions:e.str("mfaLoginInstructions"),lock:n,title:e.str("mfaLoginTitle")})},g=function(t){function e(){return r(this,e),o(this,t.call(this,"mfa.mfaCode"))}return i(e,t),e.prototype.renderAuxiliaryPane=function(t){return n.i(M.a)(t)},e.prototype.submitButtonLabel=function(t){return l.str(t,["mfaSubmitLabel"])},e.prototype.submitHandler=function(t){return function(t){return n.i(p.a)(t,!0)}},e.prototype.render=function(){return h},e.prototype.backHandler=function(t){return n.i(d.i)(t,"login")?p.b:void 0},e}(u.a);e.a=g},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(0),s=n.n(a),u=n(51),c=n(68),l=n(70),p=n(187),d=n(10),M=n(111),h=n(1),g=n(27),f=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.render=function(){var t=this.props,e=t.emailInputPlaceholder,r=t.instructions,o=t.i18n,i=t.model,a=t.onlyEmail,f=t.passwordInputPlaceholder,y=t.passwordStrengthMessages,N=t.usernameInputPlaceholder,m=r||null,D=m&&s.a.createElement("p",null,m),j=a||!n.i(d.n)(i)||n.i(d.o)(i)?null:s.a.createElement(l.a,{i18n:o,lock:i,placeholder:N,validateFormat:!0,strictValidation:n.i(d.x)(i)}),I=!a&&n.i(d.p)(i).map(function(t){return s.a.createElement(p.a,{iconUrl:t.get("icon"),key:t.get("name"),model:i,name:t.get("name"),ariaLabel:t.get("ariaLabel"),options:t.get("options"),placeholder:t.get("placeholder"),placeholderHTML:t.get("placeholderHTML"),type:t.get("type"),validator:t.get("validator"),value:t.get("value")})}),w=h.captcha(i)&&h.captcha(i).get("required")?s.a.createElement(M.a,{i18n:o,lock:i,onReload:function(){return n.i(g.e)(h.id(i),!1)}}):null,L=!a&&s.a.createElement(c.a,{i18n:o,lock:i,placeholder:f,policy:n.i(d.y)(i),strengthMessages:y});return s.a.createElement("div",null,D,s.a.createElement(u.a,{i18n:o,lock:i,placeholder:e,strictValidation:n.i(d.x)(i)}),j,L,w,I)},e}(s.a.Component);e.a=f},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(0),s=n.n(a),u=n(14),c=n(10),l=n(27),p=n(50),d=n(19),M=n(166),h=n(4),g=n(65),f=n(16),y=n(1),N=n(12),m=n(181),D=n(48),j=n(64),I=n(52),w=n(103),L=n(104),v=function(t){var e=t.i18n,r=t.model,o=n.i(p.b)(r,{emailFirst:!0})&&n.i(c.i)(r,"login"),i=o&&s.a.createElement(L.a,null,e.str("ssoEnabled")),a=!o&&n.i(c.i)(r,"login")&&s.a.createElement(w.a,{key:"loginsignup",lock:r,loginLabel:e.str("loginLabel"),signUpLabel:e.str("signUpLabel")}),u=y.hasSomeConnections(r,"social")&&s.a.createElement(I.a,{instructions:e.html("socialSignUpInstructions"),labelFn:e.str,lock:r,signUp:!0}),l=u?"databaseAlternativeSignUpInstructions":"databaseSignUpInstructions",d=(y.hasSomeConnections(r,"database")||y.hasSomeConnections(r,"enterprise"))&&s.a.createElement(m.a,{emailInputPlaceholder:e.str("emailInputPlaceholder"),i18n:e,instructions:e.html(l),model:r,onlyEmail:o,passwordInputPlaceholder:e.str("passwordInputPlaceholder"),passwordStrengthMessages:e.group("passwordStrength"),usernameInputPlaceholder:e.str("usernameInputPlaceholder")}),M=u&&d&&s.a.createElement(D.a,null);return s.a.createElement("div",null,i,a,s.a.createElement("div",null,u,M,d))},z=function(t){function e(){return r(this,e),o(this,t.call(this,"main.signUp"))}return i(e,t),e.prototype.submitButtonLabel=function(t){return N.str(t,["signUpSubmitLabel"])},e.prototype.submitHandler=function(t){if(n.i(p.c)(t,"social"))return null;var e=n.i(c.a)(t,{emailFirst:!0});return n.i(f.k)(t,e)?function(t){return n.i(g.a)(t,e)}:n.i(p.b)(t,{emailFirst:!0})?g.b:l.c},e.prototype.isSubmitDisabled=function(t){return!n.i(c.u)(t)},e.prototype.renderAuxiliaryPane=function(t){return n.i(d.a)(t)||n.i(M.a)(t)||n.i(h.l)(t)},e.prototype.renderTabs=function(){return!0},e.prototype.getScreenTitle=function(t){return N.str(t,"signUpTitle")||N.str(t,"signupTitle")},e.prototype.renderTerms=function(t,e){var r=n.i(c.v)(t)?function(){return n.i(l.d)(y.id(t))}:void 0;return e&&n.i(c.w)(t)?s.a.createElement(j.a,{showCheckbox:n.i(c.v)(t),checkHandler:r,checked:n.i(c.u)(t)},e):null},e.prototype.render=function(){return v},e}(u.a);e.a=z},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=(n(8),n(107)),i=n(108),a=n(184),s=n(185),u=n(171),c=n(109),l=n(34),p=n(29),d=n(1),M=n(71),h=n(49),g=n(23),f=n(40),y=function(t){var e=d.prefill(t).toJS(),r=e.email,o=e.phoneNumber;return"string"==typeof r&&(t=n.i(g.d)(t,r)),"string"==typeof o&&(t=n.i(f.a)(t,o)),t},N=function(){function t(){r(this,t)}return t.prototype.didInitialize=function(t,e){return t=n.i(l.a)(t,e)},t.prototype.didReceiveClientSettings=function(t){var e=d.hasSomeConnections(t,"social"),n=d.hasSomeConnections(t,"passwordless");if(!e&&!n){var r=new Error("At least one email, sms or social connection needs to be available.");r.code="no_connection",t=d.stop(t,r)}return t=y(t)},t.prototype.render=function(t){if(d.hasStopped(t))return new o.a;if(!n.i(p.c)(t)||t.get("isLoadingPanePinned"))return new i.a;if(!n.i(M.a)(t)&&d.ui.rememberLastLogin(t)){var e=h.a(t);h.b(t);if(e&&n.i(p.b)(t,"sso")&&d.hasConnection(t,e.get("name"))&&["passwordless","social"].indexOf(d.findConnection(t,e.get("name")).get("type"))>=0){var r=d.findConnection(t,e.get("name")),g=r.get("type");if("passwordless"===g||"social"===g)return new c.a}}return n.i(l.b)(t)?n.i(l.c)(t)||!n.i(l.d)(t)?new a.a:new u.a:n.i(l.d)(t)?new u.a:new s.a},t}();e.a=new N},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(0),s=n.n(a),u=n(14),c=n(51),l=n(52),p=n(48),d=n(34),M=n(33),h=n(172),g=n(19),f=n(1),y=n(64),N=function(t){var e=t.i18n,n=t.model,r=f.hasSomeConnections(n,"social")?s.a.createElement(l.a,{instructions:e.html("socialLoginInstructions"),labelFn:e.str,lock:n,signUp:!0}):null,o=f.hasSomeConnections(n,"passwordless","email")?s.a.createElement(c.a,{i18n:e,lock:n,placeholder:e.str("emailInputPlaceholder"),strictValidation:!1}):null,i=r?"passwordlessEmailAlternativeInstructions":"passwordlessEmailInstructions",a=e.html(i)||null,u=o&&a&&s.a.createElement("p",null,a),d=r&&o?s.a.createElement(p.a,null):null;return s.a.createElement("div",null,r,d,u,o)},m=function(t){function e(){return r(this,e),o(this,t.call(this,"socialOrEmail"))}return i(e,t),e.prototype.submitHandler=function(t){return f.hasSomeConnections(t,"passwordless","email")?M.e:null},e.prototype.renderAuxiliaryPane=function(t){return n.i(h.a)(t)||n.i(g.a)(t)},e.prototype.render=function(){return N},e.prototype.isSubmitDisabled=function(t){return!n.i(d.e)(t)},e.prototype.renderTerms=function(t,e){var r=n.i(d.f)(t)?function(){return n.i(M.b)(f.id(t))}:void 0;return e&&n.i(d.g)(t)?s.a.createElement(y.a,{showCheckbox:n.i(d.f)(t),checkHandler:r,checked:n.i(d.e)(t)},e):null},e}(u.a);e.a=m},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(0),s=n.n(a),u=n(14),c=n(33),l=n(193),p=n(52),d=n(19),M=n(48),h=n(1),g=n(4),f=n(34),y=n(64),N=function(t){var e=t.i18n,n=t.model,r=h.hasSomeConnections(n,"social")?s.a.createElement(p.a,{instructions:e.html("socialLoginInstructions"),labelFn:e.str,lock:n,signUp:!0}):null,o=r?"passwordlessSMSAlternativeInstructions":"passwordlessSMSInstructions",i=h.hasSomeConnections(n,"passwordless","sms")?s.a.createElement(l.a,{instructions:e.html(o),lock:n,placeholder:e.str("phoneNumberInputPlaceholder"),invalidHint:e.str("phoneNumberInputInvalidHint")}):null,a=r&&i?s.a.createElement(M.a,null):null;return s.a.createElement("div",null,r,a,i)},m=function(t){function e(){return r(this,e),o(this,t.call(this,"socialOrPhoneNumber"))}return i(e,t),e.prototype.submitHandler=function(t){return h.hasSomeConnections(t,"passwordless","sms")?c.a:null},e.prototype.renderAuxiliaryPane=function(t){return n.i(d.a)(t)||n.i(g.l)(t)},e.prototype.render=function(){return N},e.prototype.isSubmitDisabled=function(t){return!n.i(f.e)(t)},e.prototype.renderTerms=function(t,e){var r=n.i(f.f)(t)?function(){return n.i(c.b)(h.id(t))}:void 0;return e&&n.i(f.g)(t)?s.a.createElement(y.a,{showCheckbox:n.i(f.f)(t),checkHandler:r,checked:n.i(f.e)(t)},e):null},e}(u.a);e.a=m},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}n.d(e,"a",function(){return d}),n.d(e,"b",function(){return g});var a=n(216),s=n(0),u=n.n(s),c=n(2),l=n.n(c),p=function(){},d=function(t){return"recaptcha_enterprise"===t||"recaptcha_v2"===t},M=function(t){switch(t){case"recaptcha_v2":return window.grecaptcha;case"recaptcha_enterprise":return window.grecaptcha.enterprise}},h=function(t,e,n){switch(t){case"recaptcha_v2":return"https://www.recaptcha.net/recaptcha/api.js?hl="+e+"&onload="+n;case"recaptcha_enterprise":return"https://www.recaptcha.net/recaptcha/enterprise.js?render=explicit&hl="+e+"&onload="+n}},g=function(t){function e(i){r(this,e);var s=o(this,t.call(this,i));return s.state={},s.ref=n.i(a.a)(),s.changeHandler=function(t){s.setState({value:t},function(){s.props.onChange(t)})},s.expiredHandler=function(){s.setState({value:""},function(){s.props.onChange(""),s.props.onExpired()})},s.erroredHandler=function(){s.setState({value:""},function(){s.props.onChange(""),s.props.onErrored()})},s}return i(e,t),e.loadScript=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.body,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:p,r="recatpchaCallback_"+Math.floor(1000001*Math.random()),o=h(t.provider,t.hl,r),i=document.createElement("script");window[r]=function(){delete window[r],n(null,i)},i.src=o,i.async=!0,e.appendChild(i)},e.prototype.componentWillUnmount=function(){this.scriptNode&&document.body.removeChild(this.scriptNode)},e.prototype.componentDidMount=function(){var t=this;e.loadScript(this.props,document.body,function(e,n){t.scriptNode=n;var r=M(t.props.provider);t.widgetId=r.render(t.ref.current,{callback:t.changeHandler,"expired-callback":t.expiredHandler,"error-callback":t.erroredHandler,sitekey:t.props.sitekey})})},e.prototype.reset=function(){M(this.props.provider).reset(this.widgetId)},e.prototype.render=function(){var t=setInterval(function(){var e=Array.from(document.querySelectorAll('iframe[src*="recaptcha"]')),n=e.map(function(t){return t.parentNode.parentNode}).filter(function(t){return t&&t.parentNode===document.body&&"block"!==t.style.display});0!==n.length&&(n.forEach(function(t){t.style.display="block"}),clearInterval(t))},300);return u.a.createElement("div",{className:this.props.isValid?"auth0-lock-recaptcha-block":"auth0-lock-recaptcha-block auth0-lock-recaptcha-block-error"},u.a.createElement("div",{className:"auth0-lock-recaptchav2",ref:this.ref}))},e.getDerivedStateFromProps=function(t,e){return t.value!==e.value?{value:t.value}:null},e.prototype.componentDidUpdate=function(t,e){t.value!==this.props.value&&""===this.props.value&&this.reset()},e}(u.a.Component);g.displayName="ReCAPTCHA",g.propTypes={provider:l.a.string.isRequired,sitekey:l.a.string.isRequired,onChange:l.a.func,onExpired:l.a.func,onErrored:l.a.func,hl:l.a.string,value:l.a.string,isValid:l.a.bool},g.defaultProps={onChange:p,onExpired:p,onErrored:p}},function(t,e,n){"use strict";var r=n(0),o=n.n(r),i=n(67),a=n(4),s=n(115),u=n(114),c=n(206),l=n(1),p=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},d=function(t){var e=t.iconUrl,r=t.model,d=t.name,M=t.ariaLabel,h=t.placeholder,g=t.placeholderHTML,f=t.type,y=t.validator,N=t.value,m={iconUrl:e,isValid:!n.i(a.k)(r,d),name:d,ariaLabel:M,placeholder:h};switch(f){case"select":return o.a.createElement(u.a,p({},m,{lockId:l.id(r),label:n.i(a.o)(r,d),onClick:function(){return n.i(i.c)(l.id(r),d,e)}}));case"checkbox":return o.a.createElement(c.a,p({lockId:l.id(r),onChange:function(t){return n.i(i.d)(l.id(r),d,""+t.target.checked,y)},checked:n.i(a.c)(r,d),placeholderHTML:g},m));case"hidden":return o.a.createElement("input",{id:l.id(r),type:"hidden",value:N,name:d});default:return o.a.createElement(s.a,p({lockId:l.id(r),invalidHint:n.i(a.p)(r,d),onChange:function(t){return n.i(i.d)(l.id(r),d,t.target.value,y)},value:n.i(a.c)(r,d)},m))}};e.a=d},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=n(208),p=n(4),d=n(8),M=n(1),h=n(189),g=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.handleChange=function(t){var e=this.props.lock;n.i(d.b)(d.c,"lock",M.id(e),h.a,t.target.value)},e.prototype.render=function(){var t=this.props,e=t.i18n,r=t.lock,o=t.placeholder;return c.a.createElement(l.a,{lockId:M.id(r),value:p.c(r,"mfa_code"),invalidHint:e.str("mfaCodeErrorHint",n.i(h.b)().length),isValid:!p.k(r,"mfa_code"),onChange:this.handleChange.bind(this),placeholder:o})},e}(c.a.Component);e.a=g,g.propTypes={i18n:s.a.object.isRequired,lock:s.a.object.isRequired,placeholder:s.a.string.isRequired}},function(t,e,n){"use strict";function r(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.mfa_code,n=u()(t);if(n.length<e.length)return!1;if(n.length>e.length)return!1;var r=l.exec(n);return r&&r[0]}function o(t,e){return n.i(a.e)(t,"mfa_code",e,r)}function i(t){return c.mfa_code}e.a=o,e.b=i;var a=n(4),s=(n(23),n(10),n(32)),u=n.n(s),c={mfa_code:{length:6}},l=/^[0-9]+$/},function(t,e,n){"use strict";var r=n(0),o=n.n(r),i=n(213),a=n(67);e.a=function(t){var e=t.icon,r=t.iconUrl,s=t.model,u=t.name,c=t.items;return o.a.createElement(i.a,{model:s,icon:e,iconUrl:r,items:c,onSelect:function(t){return n.i(a.a)(s.get("id"),u,t)},onCancel:function(){return n.i(a.b)(s.get("id"))}})}},function(t,e,n){"use strict";function r(t,e){return!!t&&(!e||new s.a(e.toJS()).check(t))}function o(t,e,o){return n.i(u.e)(t,"password",e,r,o)}function i(t,e){return n.i(u.e)(t,"showPassword",e,function(){return!0})}e.a=o,e.b=i;var a=n(78),s=n.n(a),u=n(4)},function(t,e,n){"use strict";e.a=[["Afghanistan","AF","+93"],["Albania","AL","+355"],["Algeria","DZ","+213"],["American Samoa","AS","+1684"],["Andorra","AD","+376"],["Angola","AO","+244"],["Anguilla","AI","+1264"],["Antarctica","AQ","+672"],["Antigua and Barbuda","AG","+1268"],["Argentina","AR","+54 9"],["Armenia","AM","+374"],["Aruba","AW","+297"],["Australia","AU","+61"],["Austria","AT","+43"],["Azerbaijan","AZ","+994"],["Bahamas","BS","+1242"],["Bahrain","BH","+973"],["Bangladesh","BD","+880"],["Barbados","BB","+1246"],["Belarus","BY","+375"],["Belgium","BE","+32"],["Belize","BZ","+501"],["Benin","BJ","+229"],["Bermuda","BM","+1441"],["Bhutan","BT","+975"],["Bolivia, Plurinational State of","BO","+591"],["Bonaire, Sint Eustatius and Saba","BQ","+599"],["Bosnia and Herzegovina","BA","+387"],["Botswana","BW","+267"],["Bouvet Island","BV","+47"],["Brazil","BR","+55"],["British Indian Ocean Territory","IO","+246"],["Brunei Darussalam","BN","+673"],["Bulgaria","BG","+359"],["Burkina Faso","BF","+226"],["Burundi","BI","+257"],["Cambodia","KH","+855"],["Cameroon","CM","+237"],["Canada","CA","+1"],["Cape Verde","CV","+238"],["Cayman Islands","KY","+1345"],["Central African Republic","CF","+236"],["Chad","TD","+235"],["Chile","CL","+56"],["China","CN","+86"],["Christmas Island","CX","+61"],["Cocos (Keeling) Islands","CC","+61"],["Colombia","CO","+57"],["Comoros","KM","+269"],["Congo","CG","+242"],["Congo, the Democratic Republic of the","CD","+243"],["Cook Islands","CK","+682"],["Costa Rica","CR","+506"],["Croatia","HR","+385"],["Cuba","CU","+53"],["Curaçao","CW","+599"],["Cyprus","CY","+357"],["Czech Republic","CZ","+420"],["Côte d'Ivoire","CI","+225"],["Denmark","DK","+45"],["Djibouti","DJ","+253"],["Dominica","DM","+1767"],["Dominican Republic","DO","+1809"],["Dominican Republic","DO","+1829"],["Dominican Republic","DO","+1849"],["Ecuador","EC","+593"],["Egypt","EG","+20"],["El Salvador","SV","+503"],["Equatorial Guinea","GQ","+240"],["Eritrea","ER","+291"],["Estonia","EE","+372"],["Ethiopia","ET","+251"],["Falkland Islands (Malvinas)","FK","+500"],["Faroe Islands","FO","+298"],["Fiji","FJ","+679"],["Finland","FI","+358"],["France","FR","+33"],["French Guiana","GF","+594"],["French Polynesia","PF","+689"],["French Southern Territories","TF","+262"],["Gabon","GA","+241"],["Gambia","GM","+220"],["Georgia","GE","+995"],["Germany","DE","+49"],["Ghana","GH","+233"],["Gibraltar","GI","+350"],["Greece","GR","+30"],["Greenland","GL","+299"],["Grenada","GD","+1473"],["Guadeloupe","GP","+590"],["Guam","GU","+1671"],["Guatemala","GT","+502"],["Guernsey","GG","+44"],["Guinea","GN","+224"],["Guinea-Bissau","GW","+245"],["Guyana","GY","+592"],["Haiti","HT","+509"],["Heard Island and McDonald Mcdonald Islands","HM","+672"],["Holy See (Vatican City State)","VA","+3906"],["Honduras","HN","+504"],["Hong Kong","HK","+852"],["Hungary","HU","+36"],["Iceland","IS","+354"],["India","IN","+91"],["Indonesia","ID","+62"],["Iran, Islamic Republic of","IR","+98"],["Iraq","IQ","+964"],["Ireland","IE","+353"],["Isle of Man","IM","+44"],["Israel","IL","+972"],["Italy","IT","+39"],["Jamaica","JM","+1876"],["Japan","JP","+81"],["Jersey","JE","+44"],["Jordan","JO","+962"],["Kazakhstan","KZ","+7"],["Kenya","KE","+254"],["Kiribati","KI","+686"],["Korea, Democratic People's Republic of","KP","+850"],["Korea, Republic of","KR","+82"],["Kuwait","KW","+965"],["Kyrgyzstan","KG","+996"],["Lao People's Democratic Republic","LA","+856"],["Latvia","LV","+371"],["Lebanon","LB","+961"],["Lesotho","LS","+266"],["Liberia","LR","+231"],["Libya","LY","+218"],["Liechtenstein","LI","+423"],["Lithuania","LT","+370"],["Luxembourg","LU","+352"],["Macao","MO","+853"],["Macedonia, the Former Yugoslav Republic of","MK","+389"],["Madagascar","MG","+261"],["Malawi","MW","+265"],["Malaysia","MY","+60"],["Maldives","MV","+960"],["Mali","ML","+223"],["Malta","MT","+356"],["Marshall Islands","MH","+692"],["Martinique","MQ","+596"],["Mauritania","MR","+222"],["Mauritius","MU","+230"],["Mayotte","YT","+262"],["Mexico","MX","+52"],["Micronesia, Federated States of","FM","+691"],["Moldova, Republic of","MD","+373"],["Monaco","MC","+377"],["Mongolia","MN","+976"],["Montenegro","ME","+382"],["Montserrat","MS","+1664"],["Morocco","MA","+212"],["Mozambique","MZ","+258"],["Myanmar","MM","+95"],["Namibia","NA","+264"],["Nauru","NR","+674"],["Nepal","NP","+977"],["Netherlands","NL","+31"],["New Caledonia","NC","+687"],["New Zealand","NZ","+64"],["Nicaragua","NI","+505"],["Niger","NE","+227"],["Nigeria","NG","+234"],["Niue","NU","+683"],["Norfolk Island","NF","+672"],["Northern Mariana Islands","MP","+1670"],["Norway","NO","+47"],["Oman","OM","+968"],["Pakistan","PK","+92"],["Palau","PW","+680"],["Palestine, State of","PS","+970"],["Panama","PA","+507"],["Papua New Guinea","PG","+675"],["Paraguay","PY","+595"],["Peru","PE","+51"],["Philippines","PH","+63"],["Pitcairn","PN","+870"],["Poland","PL","+48"],["Portugal","PT","+351"],["Puerto Rico","PR","+1"],["Qatar","QA","+974"],["Romania","RO","+40"],["Russian Federation","RU","+7"],["Rwanda","RW","+250"],["Réunion","RE","+262"],["Saint Barthélemy","BL","+590"],["Saint Helena, Ascension and Tristan da Cunha","SH","+290"],["Saint Kitts and Nevis","KN","+1869"],["Saint Lucia","LC","+1758"],["Saint Martin (French part)","MF","+590"],["Saint Pierre and Miquelon","PM","+508"],["Saint Vincent and the Grenadines","VC","+1784"],["Samoa","WS","+685"],["San Marino","SM","+378"],["Sao Tome and Principe","ST","+239"],["Saudi Arabia","SA","+966"],["Senegal","SN","+221"],["Serbia","RS","+381"],["Seychelles","SC","+248"],["Sierra Leone","SL","+232"],["Singapore","SG","+65"],["Sint Maarten (Dutch part)","SX","+1721"],["Slovakia","SK","+421"],["Slovenia","SI","+386"],["Solomon Islands","SB","+677"],["Somalia","SO","+252"],["South Africa","ZA","+27"],["South Georgia and the South Sandwich Islands","GS","+500"],["South Sudan","SS","+211"],["Spain","ES","+34"],["Sri Lanka","LK","+94"],["Sudan","SD","+249"],["Suriname","SR","+597"],["Svalbard and Jan Mayen","SJ","+47"],["Swaziland","SZ","+268"],["Sweden","SE","+46"],["Switzerland","CH","+41"],["Syrian Arab Republic","SY","+963"],["Taiwan, Province of China","TW","+886"],["Tajikistan","TJ","+992"],["Tanzania, United Republic of","TZ","+255"],["Thailand","TH","+66"],["Timor-Leste","TL","+670"],["Togo","TG","+228"],["Tokelau","TK","+690"],["Tonga","TO","+676"],["Trinidad and Tobago","TT","+1868"],["Tunisia","TN","+216"],["Turkey","TR","+90"],["Turkmenistan","TM","+993"],["Turks and Caicos Islands","TC","+1649"],["Tuvalu","TV","+688"],["Uganda","UG","+256"],["Ukraine","UA","+380"],["United Arab Emirates","AE","+971"],["United Kingdom","GB","+44"],["United States","US","+1"],["Uruguay","UY","+598"],["Uzbekistan","UZ","+998"],["Vanuatu","VU","+678"],["Venezuela, Bolivarian Republic of","VE","+58"],["Viet Nam","VN","+84"],["Virgin Islands, British","VG","+1284"],["Virgin Islands, U.S.","VI","+1340"],["Wallis and Futuna","WF","+681"],["Western Sahara","EH","+212"],["Yemen","YE","+967"],["Zambia","ZM","+260"],["Zimbabwe","ZW","+263"],["Åland Islands","AX","+358"]]},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=n(210),p=n(114),d=n(67),M=n(4),h=n(1),g=n(8),f=n(40),y=c.a.createElement("svg",{focusable:"false",width:"14px",height:"14px",viewBox:"0 0 14 14",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",className:"auth0-lock-icon auth0-lock-icon-box auth0-lock-icon-location"},c.a.createElement("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},c.a.createElement("g",{id:"Lock",transform:"translate(-201.000000, -3519.000000)",fill:"#919191"},c.a.createElement("g",{id:"SMS",transform:"translate(153.000000, 3207.000000)"},c.a.createElement("g",{transform:"translate(35.000000, 299.000000)"},c.a.createElement("path",{id:"Fill-349-Copy",d:"M22.4023125,22.8 C22.543625,21.9425 22.625,20.9975 22.625,20 L26.125,20 C26.125,21.316875 25.69275,22.52 24.9853125,23.5175 C24.3255625,23.2025 23.4383125,22.953125 22.4023125,22.8 L22.4023125,22.8 Z M21.372875,25.954375 C21.72725,25.3725 22.0234375,24.5675 22.2404375,23.6225 C22.8975625,23.696875 23.483375,23.80625 23.9624375,23.9375 L24.67075,23.9375 C23.829875,24.92625 22.6849375,25.6525 21.372875,25.954375 L21.372875,25.954375 Z M20,26.125 C19.412875,26.125 18.896625,25.105625 18.579,23.5525 C19.034,23.521875 19.503875,23.5 20,23.5 C20.4956875,23.5 20.966,23.521875 21.421,23.5525 C21.1029375,25.105625 20.5866875,26.125 20,26.125 L20,26.125 Z M15.3288125,23.9375 L16.0375625,23.9375 C16.5161875,23.80625 17.1024375,23.696875 17.759125,23.6225 C17.976125,24.5675 18.2723125,25.3725 18.6266875,25.954375 C17.3150625,25.6525 16.170125,24.92625 15.3288125,23.9375 L15.3288125,23.9375 Z M15.0146875,23.5175 C14.3068125,22.52 13.875,21.316875 13.875,20 L17.375,20 C17.375,20.9975 17.4559375,21.9425 17.59725,22.8 C16.56125,22.953125 15.6744375,23.2025 15.0146875,23.5175 L15.0146875,23.5175 Z M15.030875,16.45625 C15.6796875,16.78 16.5634375,17.03375 17.60075,17.195625 C17.501,17.799375 17.428375,18.4425 17.3964375,19.125 L13.951125,19.125 C14.0933125,18.13625 14.477,17.230625 15.030875,16.45625 L15.030875,16.45625 Z M18.6266875,14.04125 C18.27275,14.623125 17.977,15.42375 17.760875,16.373125 C17.1265,16.294375 16.558625,16.189375 16.0944375,16.0625 L15.34325,16.0625 C16.180625,15.069375 17.3168125,14.343125 18.6266875,14.04125 L18.6266875,14.04125 Z M20,13.875 C20.585375,13.875 21.0959375,14.894375 21.4118125,16.443125 C20.959875,16.478125 20.492625,16.5 20,16.5 C19.5069375,16.5 19.0396875,16.478125 18.58775,16.443125 C18.903625,14.894375 19.4141875,13.875 20,13.875 L20,13.875 Z M18.2749375,19.125 C18.3020625,18.473125 18.362,17.865 18.441625,17.29625 C18.9408125,17.344375 19.4596875,17.375 20,17.375 C20.5403125,17.375 21.0591875,17.344375 21.5579375,17.29625 C21.638,17.865 21.6979375,18.473125 21.724625,19.125 L18.2749375,19.125 L18.2749375,19.125 Z M21.75,20 C21.75,20.97125 21.6786875,21.88125 21.5631875,22.699375 C21.06225,22.65125 20.5420625,22.625 20,22.625 C19.4579375,22.625 18.9373125,22.65125 18.436375,22.699375 C18.320875,21.88125 18.25,20.97125 18.25,20 L21.75,20 L21.75,20 Z M24.6563125,16.0625 L23.905125,16.0625 C23.441375,16.189375 22.8730625,16.294375 22.2386875,16.373125 C22.0225625,15.42375 21.7268125,14.623125 21.372875,14.04125 C22.68275,14.343125 23.8189375,15.069375 24.6563125,16.0625 L24.6563125,16.0625 Z M24.9686875,16.45625 C25.5225625,17.230625 25.90625,18.13625 26.048875,19.125 L22.603125,19.125 C22.5711875,18.4425 22.499,17.799375 22.39925,17.195625 C23.4365625,17.03375 24.3203125,16.78 24.9686875,16.45625 L24.9686875,16.45625 Z M20,13 C16.1338125,13 13,16.1325 13,20 C13,23.863125 16.1338125,27 20,27 C23.86575,27 27,23.863125 27,20 C27,16.1325 23.86575,13 20,13 L20,13 Z"})))))),N=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.handlePhoneNumberChange=function(t){n.i(g.b)(g.c,"lock",h.id(this.props.lock),f.a,t.target.value)},e.prototype.render=function(){var t=this.props,e=t.instructions,r=t.lock,o=t.placeholder,i=t.invalidHint,a=e||null,s=a&&c.a.createElement("p",null,a);return c.a.createElement("div",null,s,c.a.createElement(p.a,{icon:y,isValid:!M.k(r,"location"),name:"location",placeholder:"",label:n.i(f.d)(r),onClick:function(){return n.i(d.c)(h.id(r),"location","",c.a.createElement(y,null))}}),c.a.createElement(l.a,{value:M.r(r),isValid:!M.k(r,"phoneNumber"),invalidHint:i,onChange:this.handlePhoneNumberChange.bind(this),placeholder:o,disabled:h.submitting(r)}))},e}(c.a.Component);e.a=N,N.propTypes={instructions:s.a.element,lock:s.a.object.isRequired,placeholder:s.a.string.isRequired,invalidHint:s.a.string}},function(t,e,n){"use strict";function r(t,e,n){var r=void 0;try{r=e.toJS()}catch(t){r=e}o.emitEvent(t,"federated login",{name:r.name,strategy:r.strategy,action:n?"signup":"signin"})}e.a=r;var o=n(1)},function(t,e,n){"use strict";function r(t,e){return n.i(o.e)(t,"vcode",e.replace(/[\s-]+/g,""))}e.a=r;var o=n(4)},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=n(212),p=n(1),d=n(4),M=n(56),h=n(8),g=n(195),f=function(t){function e(){var i,a,s;r(this,e);for(var u=arguments.length,c=Array(u),l=0;l<u;l++)c[l]=arguments[l];return i=a=o(this,t.call.apply(t,[this].concat(c))),a.handleVcodeChange=function(t){t.preventDefault(),n.i(h.b)(h.c,"lock",p.id(a.props.lock),g.a,t.target.value)},a.handleResendClick=function(t){t.preventDefault();var e=a.props,n=e.lock;(0,e.onRestart)(p.id(n))},s=i,o(a,s)}return i(e,t),e.prototype.render=function(){var t=this.props,e=t.instructions,r=t.lock,o=t.placeholder,i=t.resendLabel,a=e||null,s=a&&c.a.createElement("p",null,a);return c.a.createElement("div",null,s,c.a.createElement(l.a,{lockId:p.id(r),value:d.s(r),isValid:!d.k(r,"vcode")&&!p.globalError(r),onChange:this.handleVcodeChange,autoFocus:!n.i(M.a)(),placeholder:o,disabled:p.submitting(r)}),c.a.createElement("p",{className:"auth0-lock-alternative"},c.a.createElement("a",{className:"auth0-lock-alternative-link",href:"#",onClick:this.handleResendClick},i)))},e}(c.a.Component);e.a=f,f.propTypes={instructions:s.a.string,lock:s.a.object.isRequired,placeholder:s.a.string.isRequired,resendLabel:s.a.string.isRequired,onRestart:s.a.func.isRequired}},function(t,e,n){"use strict";e.__esModule=!0,e.default={error:{forgotPassword:{too_many_requests:"You have reached the limit on password change attempts. Please wait before trying again.","lock.fallback":"We're sorry, something went wrong when requesting the password change.",enterprise_email:"Your email's domain is part of an Enterprise identity provider. To reset your password, please see your security administrator."},login:{blocked_user:"The user is blocked.",invalid_user_password:"Wrong credentials.",invalid_captcha:"Solve the challenge question to verify you are not a robot.",invalid_recaptcha:"Select the checkbox to verify you are not a robot.","lock.fallback":"We're sorry, something went wrong when attempting to log in.","lock.invalid_code":"Wrong code.","lock.invalid_email_password":"Wrong email or password.","lock.invalid_username_password":"Wrong username or password.","lock.network":"We could not reach the server. Please check your connection and try again.","lock.popup_closed":"Popup window closed. Try again.","lock.unauthorized":"Permissions were not granted. Try again.","lock.mfa_registration_required":"Multifactor authentication is required but your device is not enrolled. Please enroll it before moving on.","lock.mfa_invalid_code":"Wrong code. Please try again.",password_change_required:"You need to update your password because this is the first time you are logging in, or because your password has expired.",password_leaked:"We have detected a potential security issue with this account. To protect your account, we have blocked this login. An email was sent with instruction on how to unblock your account.",too_many_attempts:"Your account has been blocked after multiple consecutive login attempts.",too_many_requests:"We're sorry. There are too many requests right now. Please reload the page and try again. If this persists, please try again later.",session_missing:"Couldn't complete your authentication request. Please try again after closing all open dialogs","hrd.not_matching_email":"Please use your corporate email to login."},passwordless:{"bad.email":"The email is invalid","bad.phone_number":"The phone number is invalid","lock.fallback":"We're sorry, something went wrong"},signUp:{invalid_password:"Password is invalid.","lock.fallback":"We're sorry, something went wrong when attempting to sign up.",password_dictionary_error:"Password is too common.",password_no_user_info_error:"Password is based on user information.",password_strength_error:"Password is too weak.",user_exists:"The user already exists.",username_exists:"The username already exists.",social_signup_needs_terms_acception:"Please agree to the Terms of Service below to continue."}},success:{logIn:"Thanks for logging in.",forgotPassword:"We've just sent you an email to reset your password.",magicLink:"We sent you a link to log in<br />to %s.",signUp:"Thanks for signing up."},blankErrorHint:"",blankPasswordErrorHint:"Password can't be blank",blankEmailErrorHint:"Email can't be blank",blankUsernameErrorHint:"Username can't be blank",blankCaptchaErrorHint:"Can't be blank",codeInputPlaceholder:"your code",databaseEnterpriseLoginInstructions:"",databaseEnterpriseAlternativeLoginInstructions:"or",databaseSignUpInstructions:"",databaseAlternativeSignUpInstructions:"or",emailInputPlaceholder:"yours@example.com",captchaCodeInputPlaceholder:"Enter the code shown above",captchaMathInputPlaceholder:"Solve the formula shown above",enterpriseLoginIntructions:"Login with your corporate credentials.",enterpriseActiveLoginInstructions:"Please enter your corporate credentials at %s.",failedLabel:"Failed!",forgotPasswordTitle:"Reset your password",forgotPasswordAction:"Don't remember your password?",forgotPasswordInstructions:"Please enter your email address. We will send you an email to reset your password.",forgotPasswordSubmitLabel:"Send email",invalidErrorHint:"",invalidPasswordErrorHint:"Password is invalid",invalidEmailErrorHint:"Email is invalid",invalidUsernameErrorHint:"Username is invalid",lastLoginInstructions:"Last time you logged in with",loginAtLabel:"Log in at %s",loginLabel:"Log In",loginSubmitLabel:"Log In",loginWithLabel:"Sign in with %s",notYourAccountAction:"Not your account?",passwordInputPlaceholder:"your password",passwordStrength:{containsAtLeast:"Contain at least %d of the following %d types of characters:",identicalChars:'No more than %d identical characters in a row (e.g., "%s" not allowed)',nonEmpty:"Non-empty password required",numbers:"Numbers (i.e. 0-9)",lengthAtLeast:"At least %d characters in length",lowerCase:"Lower case letters (a-z)",shouldContain:"Should contain:",specialCharacters:"Special characters (e.g. !@#$%^&*)",upperCase:"Upper case letters (A-Z)"},passwordlessEmailAlternativeInstructions:"Otherwise, enter your email to sign in<br/>or create an account",passwordlessEmailCodeInstructions:"An email with the code has been sent to %s.",passwordlessEmailInstructions:"Enter your email to sign in<br/>or create an account",passwordlessSMSAlternativeInstructions:"Otherwise, enter your phone to sign in<br/>or create an account",passwordlessSMSCodeInstructions:"An SMS with the code has been sent to %s.",passwordlessSMSInstructions:"Enter your phone to sign in<br/>or create an account",phoneNumberInputPlaceholder:"your phone number",resendCodeAction:"Did not get the code?",resendLabel:"Resend",resendingLabel:"Resending...",retryLabel:"Retry",sentLabel:"Sent!",showPassword:"Show password",signUpTitle:"Sign Up",signUpLabel:"Sign Up",signUpSubmitLabel:"Sign Up",signUpTerms:"By signing up, you agree to our terms of service and privacy policy.",signUpWithLabel:"Sign up with %s",socialLoginInstructions:"",socialSignUpInstructions:"",ssoEnabled:"Single Sign-On enabled",submitLabel:"Submit",unrecoverableError:"Something went wrong.<br />Please contact technical support.",usernameFormatErrorHint:'Use %d-%d letters, numbers and the following characters: "_", ".", "+", "-"',usernameInputPlaceholder:"your username",usernameOrEmailInputPlaceholder:"username/email",title:"Auth0",welcome:"Welcome %s!",windowsAuthInstructions:"You are connected from your corporate network…",windowsAuthLabel:"Windows Authentication",mfaInputPlaceholder:"Code",mfaLoginTitle:"2-Step Verification",mfaLoginInstructions:"Please enter the verification code generated by your mobile application.",mfaSubmitLabel:"Log In",mfaCodeErrorHint:"Use %d numbers"}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(105),s=n(50),u=function(t){function e(i,u,c){r(this,e);var l=o(this,t.call(this,i,u,c,s.d));return n.i(a.a)(),n.i(a.b)(),window.addEventListener("resize",function(){n.i(a.b)()}),l}return i(e,t),e}(a.c);e.a=u,u.version="11.30.1"},function(t,e,n){"use strict";(function(t){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}n.d(e,"a",function(){return h}),n.d(e,"b",function(){return g});var o=n(0),i=n.n(o),a=n(30),s=n.n(a),u=n(101),c=n.n(u),l=n(112),p=function(){function e(){r(this,e)}return e.prototype.ensure=function(e,n){var r=t.document.getElementById(e);if(!r&&n&&(r=t.document.createElement("div"),r.id=e,r.className="auth0-lock-container",t.document.body.appendChild(r)),!r)throw new Error("Can't find element with id "+e);return r},e}(),d=function(){function e(){r(this,e),this.containerManager=new p,this.modals={}}return e.prototype.render=function(e,n){var r=n.isModal,o=this.containerManager.ensure(e,r);r&&!this.modals[e]&&c.a.addClass(t.document.getElementsByTagName("html")[0],"auth0-lock-html");var a=s.a.render(i.a.createElement(l.b,n),o);return r&&(this.modals[e]=a),a},e.prototype.remove=function(t){var e=this;this.modals[t]?(this.modals[t].hide(),setTimeout(function(){return e.unmount(t)},1e3)):this.unmount(t)},e.prototype.unmount=function(e){try{var n=this.containerManager.ensure(e);n&&s.a.unmountComponentAtNode(n)}catch(t){}this.modals[e]&&(delete this.modals[e],c.a.removeClass(t.document.getElementsByTagName("html")[0],"auth0-lock-html"))},e}(),M=new d,h=function(){return M.render.apply(M,arguments)},g=function(){return M.remove.apply(M,arguments)}}).call(e,n(15))},function(t,e,n){"use strict";(function(t){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=n(30),p=n.n(l),d=n(118),M=(n.n(d),n(323)),h=(n.n(M),n(204)),g=n(202),f=n(1),y=n(203),N=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},m=function(){return c.a.createElement("svg",{"aria-hidden":"true",focusable:"false",width:"43px",height:"42px",viewBox:"0 0 43 42",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},c.a.createElement("g",{id:"Page-1",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},c.a.createElement("g",{id:"Lock",transform:"translate(-280.000000, -3592.000000)"},c.a.createElement("g",{id:"SMS",transform:"translate(153.000000, 3207.000000)"},c.a.createElement("g",{id:"Group"},c.a.createElement("g",{id:"Login",transform:"translate(0.000000, 369.000000)"},c.a.createElement("g",{id:"Btn"},c.a.createElement("g",{id:"Oval-302-+-Shape",transform:"translate(128.000000, 17.000000)"},c.a.createElement("circle",{id:"Oval-302",stroke:"#FFFFFF",strokeWidth:"2",cx:"20.5",cy:"20",r:"20"}),c.a.createElement("path",{d:"M17.8,15.4 L19.2,14 L25.2,20 L19.2,26 L17.8,24.6 L22.4,20 L17.8,15.4 Z",id:"Shape",fill:"#FFFFFF"})))))))))},D=function(){return c.a.createElement("svg",{"aria-hidden":"true",focusable:"false",className:"icon-text",width:"8px",height:"12px",viewBox:"0 0 8 12",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},c.a.createElement("g",{id:"Symbols",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},c.a.createElement("g",{id:"Web/Submit/Active",transform:"translate(-148.000000, -32.000000)",fill:"#FFFFFF"},c.a.createElement("polygon",{id:"Shape",points:"148 33.4 149.4 32 155.4 38 149.4 44 148 42.6 152.6 38"}))))},j=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.handleSubmit=function(){var t=this.props,e=t.label,n=t.screenName,r=t.contentProps,o=r.model;"main.signUp"===n?f.emitEvent(o,"signup submit"):"main.login"===n?f.emitEvent(o,"signin submit"):"forgotPassword"===n?f.emitEvent(o,"forgot_password submit"):"socialOrEmail"===n?f.emitEvent(o,"socialOrEmail submit"):"socialOrPhoneNumber"===n&&f.emitEvent(o,"socialOrPhoneNumber submit"),this.props.onSubmit&&this.props.onSubmit(e,n)},e.prototype.focus=function(){p.a.findDOMNode(this).focus()},e.prototype.render=function(){var t=this.props,e=t.color,n=t.disabled,r=t.label,o=t.display,i=r?c.a.createElement("span",{className:"auth0-label-submit"},r,c.a.createElement(D,null)):c.a.createElement(m,null);return c.a.createElement("button",{className:"auth0-lock-submit",disabled:n,style:{backgroundColor:e,display:o},onClick:this.handleSubmit.bind(this),name:"submit",type:"submit","aria-label":r||"Submit"},c.a.createElement("div",{className:"auth0-loading-container"},c.a.createElement("div",{className:"auth0-loading"})),i)},e}(c.a.Component);j.propTypes={color:s.a.string.isRequired,disabled:s.a.bool,display:s.a.string,label:s.a.string,screenName:s.a.string,onSubmit:s.a.func,contentProps:s.a.object};var I=function(e){function a(t){r(this,a);var n=o(this,e.call(this,t));return n.state={moving:!1,reverse:!1,headerHeight:0},n}return i(a,e),a.prototype.componentWillReceiveProps=function(e){var n=this,r=this.props,o=r.auxiliaryPane,i=r.showSubmitButton,a=this.state.delayingShowSubmitButton;i||!e.showSubmitButton||a||this.setState({delayingShowSubmitButton:!0}),!o&&e.auxiliaryPane&&(this.auxiliaryPaneTriggerInput=t.document.activeElement,this.setState({moving:!0})),o&&!e.auxiliaryPane&&setTimeout(function(){return n.setState({moving:!1})},400)},a.prototype.componentDidUpdate=function(t){var e=this,n=this.props,r=n.autofocus,o=n.auxiliaryPane,i=(n.error,n.screenName);if(r){if(o&&!t.auxiliaryPane){var a=this.findAutofocusInput(this.refs.auxiliary);return void(a&&setTimeout(function(){return a.focus()},350))}if(!o&&t.auxiliaryPane)return void(this.auxiliaryPaneTriggerInput&&setTimeout(function(){return e.auxiliaryPaneTriggerInput.focus()},350));if(i!==t.screenName){var s=this.findAutofocusInput();s&&(this.mainScreenName(t.screenName)!==this.mainScreenName()?this.inputToFocus=s:setTimeout(function(){return s.focus()},17))}}},a.prototype.onWillSlide=function(){this.setState({moving:!0}),this.sliding=!0},a.prototype.onDidSlide=function(){this.sliding=!1,this.setState({reverse:!1})},a.prototype.onDidAppear=function(){this.setState({moving:!1}),this.state.delayingShowSubmitButton&&this.setState({delayingShowSubmitButton:!1}),this.inputToFocus&&(this.inputToFocus.focus(),delete this.inputToFocus)},a.prototype.mainScreenName=function(t){return(t||this.props.screenName||"").split(".")[0]},a.prototype.findAutofocusInput=function(t){return p.a.findDOMNode(t||this.refs.screen).querySelector("input")},a.prototype.focusError=function(){var t=p.a.findDOMNode(this.refs.screen),e=t.querySelector(".auth0-lock-error input");e&&e.focus()},a.prototype.render=function(){function t(t){return"string"==typeof t?c.a.createElement("span",{dangerouslySetInnerHTML:{__html:n.i(d.sanitize)(t)}}):t}var e=this,r=this.props,o=r.avatar,i=r.auxiliaryPane,a=r.backHandler,s=r.contentComponent,u=r.contentProps,l=r.disableSubmitButton,p=r.error,f=r.info,m=(r.isSubmitting,r.logo),D=r.primaryColor,I=r.screenName,w=r.showSubmitButton,L=r.submitButtonLabel,v=r.success,z=r.terms,b=r.title,C=r.classNames,T=r.scrollGlobalMessagesIntoView,E=this.state,x=E.delayingShowSubmitButton,k=E.moving,O=E.reverse,S=void 0,A=void 0;o?(S=o,A=b):(S=m,A="");var U=w&&!x,_=p?c.a.createElement(g.a,{key:"global-error",message:t(p),type:"error",scrollIntoView:T}):null,Y=v?c.a.createElement(g.a,{key:"global-success",message:t(v),type:"success",scrollIntoView:T}):null,Q=f?c.a.createElement(g.a,{key:"global-info",message:t(f),type:"info",scrollIntoView:T}):null,P=s,B="auth0-lock-cred-pane";return B+=k||x?" auth0-lock-moving":" auth0-lock-quiet",c.a.createElement("div",{className:B},c.a.createElement("div",{className:"auth0-lock-cred-pane-internal-wrapper"},c.a.createElement("div",{className:"auth0-lock-content-wrapper"},c.a.createElement(y.a,{title:b,name:A,backHandler:a&&this.handleBack.bind(this),backgroundUrl:S,backgroundColor:D,logoUrl:m}),c.a.createElement("div",{className:"auth0-lock-content-body-wrapper",style:{marginTop:this.state.headerHeight}},c.a.createElement(M.TransitionGroup,null,c.a.createElement(M.CSSTransition,{classNames:"global-message",timeout:250},c.a.createElement("div",null,Y,_,Q))),c.a.createElement("div",{style:{position:"relative"},ref:"screen"},c.a.createElement(h.a,{delay:550,onDidAppear:this.onDidAppear.bind(this),onDidSlide:this.onDidSlide.bind(this),onWillSlide:this.onWillSlide.bind(this),transitionName:C,reverse:O},c.a.createElement("div",{key:this.mainScreenName(),className:"auth0-lock-view-content"},c.a.createElement("div",{style:{position:"relative"}},c.a.createElement("div",{className:"auth0-lock-body-content"},c.a.createElement("div",{className:"auth0-lock-content"},c.a.createElement("div",{className:"auth0-lock-form"},c.a.createElement(P,N({focusSubmit:this.focusSubmit.bind(this)},u)))),z&&c.a.createElement("small",{className:"auth0-lock-terms"},z)))))))),c.a.createElement(j,{color:D,disabled:l,screenName:I,contentProps:u,label:L,ref:function(t){return e.submitButton=t},display:U?"block":"none"}),i&&c.a.createElement(M.TransitionGroup,null,c.a.createElement(M.CSSTransition,{ref:"auxiliary",classNames:"slide",timeout:350},i))))},a.prototype.focusSubmit=function(){this.submitButton.focus()},a.prototype.handleBack=function(){if(!this.sliding){var t=this.props.backHandler;this.setState({reverse:!0}),t()}},a}(c.a.Component);e.a=I,I.propTypes={autofocus:s.a.bool.isRequired,avatar:s.a.string,auxiliaryPane:s.a.element,backHandler:s.a.func,contentComponent:s.a.func.isRequired,contentProps:s.a.object.isRequired,disableSubmitButton:s.a.bool.isRequired,error:s.a.node,info:s.a.node,isSubmitting:s.a.bool.isRequired,logo:s.a.string.isRequired,primaryColor:s.a.string.isRequired,screenName:s.a.string.isRequired,showSubmitButton:s.a.bool.isRequired,submitButtonLabel:s.a.string,success:s.a.node,terms:s.a.element,title:s.a.string,classNames:s.a.string.isRequired,scrollGlobalMessagesIntoView:s.a.bool},I.defaultProps={autofocus:!1,disableSubmitButton:!1,showSubmitButton:!0,scrollGlobalMessagesIntoView:!0}}).call(e,n(15))},function(t,e,n){"use strict";var r=n(2),o=n.n(r),i=n(0),a=n.n(i),s=n(54),u=n(1),c=function(t){var e=t.lock,n=t.backHandler,r=t.children,o=t.closeHandler,i=t.svg;return a.a.createElement("div",{className:"auth0-lock-confirmation"},o&&a.a.createElement(s.b,{lockId:u.id(e),onClick:o}),n&&a.a.createElement(s.a,{lockId:u.id(e),onClick:n}),a.a.createElement("div",{className:"auth0-lock-confirmation-content"},a.a.createElement("span",null,i),r))};c.propTypes={backHandler:o.a.func,closeHandler:o.a.func,children:o.a.oneOfType([o.a.element.isRequired,o.a.arrayOf(o.a.element).isRequired]),svg:o.a.element.isRequired},e.a=c},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.componentDidMount=function(){this.messageNode&&"function"==typeof this.messageNode.scrollIntoView&&this.props.scrollIntoView&&(this.messageNode.getBoundingClientRect().top<0&&this.messageNode.scrollIntoView(!0))},e.prototype.render=function(){var t=this,e=this.props,n=e.message,r=e.type,o="auth0-global-message auth0-global-message-"+r;return c.a.createElement("div",{className:o,ref:function(e){t.messageNode=e}},c.a.createElement("span",{className:"animated fadeInUp"},n))},e}(c.a.Component);e.a=l,l.propTypes={message:s.a.node.isRequired,type:s.a.oneOf(["error","success","info"]).isRequired,scrollIntoView:s.a.bool},l.defaultProps={scrollIntoView:!0}},function(t,e,n){"use strict";(function(t){function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=n(30),p=n.n(l),d=n(54),M=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.getDOMNode=function(){return p.a.findDOMNode(this)},e.prototype.render=function(){var t=this.props,e=t.backHandler,n=t.backgroundColor,r=t.backgroundUrl,o=t.logoUrl,i=t.name,a=t.title;return c.a.createElement("div",{className:"auth0-lock-header"},e&&c.a.createElement(d.a,{onClick:e}),c.a.createElement(y,{imageUrl:r,backgroundColor:n,grayScale:!!i}),c.a.createElement(h,{title:a,name:i,imageUrl:i?void 0:o}))},e}(c.a.Component);e.a=M,M.propTypes={backgroundUrl:s.a.string,logoUrl:s.a.string,name:s.a.string};var h=function(t){function e(){var n,i,a;r(this,e);for(var s=arguments.length,u=Array(s),c=0;c<s;c++)u[c]=arguments[c];return n=i=o(this,t.call.apply(t,[this].concat(u))),i.onImageLoad=function(){return document.querySelector(".auth0-lock").style.fontSize="1rem"},a=n,o(i,a)}return i(e,t),e.prototype.render=function(){var t=this.props,e=t.name,n=t.imageUrl,r=t.title,o=r?"auth0-lock-header-logo":"auth0-lock-header-logo centered",i=c.a.createElement("img",{alt:"",className:o,src:n,onLoad:this.onImageLoad}),a=r?c.a.createElement(g,{title:r,name:e}):null;return c.a.createElement("div",{className:"auth0-lock-header-welcome"},n&&i,a)},e}(c.a.Component);h.propTypes={imageUrl:s.a.string,name:s.a.string};var g=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.render=function(){var t=this.props,e=t.name,n=t.title,r=void 0,o=void 0;return e?(r="auth0-lock-firstname",o=e):(r="auth0-lock-name",o=n),c.a.createElement("div",{className:r,title:o},o)},e}(c.a.Component);g.propTypes={name:s.a.string};var f=function(){var e=t.navigator&&!!t.navigator.userAgent.match(/Edge/i);if(void 0===t.document||e)return!1;var n=t.document.createElement("div");return n.style.cssText="filter: blur(2px); -webkit-filter: blur(2px)",!!n.style.length&&(void 0===t.document.documentMode||t.document.documentMode>9)}(),y=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.render=function(){var t=this.props,e=t.backgroundColor,n=t.imageUrl,r=t.grayScale,o={className:"auth0-lock-header-bg"};f&&(o.className+=" auth0-lock-blur-support");var i={className:"auth0-lock-header-bg-blur",style:{backgroundImage:"url('"+n+"')"}};r&&(i.className+=" auth0-lock-no-grayscale");var a={className:"auth0-lock-header-bg-solid",style:{backgroundColor:e}};return c.a.createElement("div",o,c.a.createElement("div",i),c.a.createElement("div",a))},e}(c.a.Component);y.propTypes={backgorundColor:s.a.string,grayScale:s.a.bool,imageUrl:s.a.string}}).call(e,n(15))},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=n(30),p=n.n(l),d=n(101),M=n.n(d),h=function(t){function e(n){r(this,e);var i=o(this,t.call(this,n));return i.state={children:{current:n.children}},i}return i(e,t),e.prototype.componentWillReceiveProps=function(t){this.state.children.current.key!=t.children.key?(this.setState({children:{current:t.children,prev:this.state.children.current},transitionName:this.props.transitionName}),this.animate=!0):this.timeout||this.setState({children:{current:t.children},transitionName:t.transitionName})},e.prototype.componentDidUpdate=function(){var t=this;if(this.animate){this.animate=!1;var e=this.state.transitionName,n=this.state.children,r=n.current,o=n.prev,i=this.props.reverse,a=this.refs[r.key],s=this.refs[o.key],u=function(t,e,n){var r=p.a.findDOMNode(t),o=e+"-active";M.a.addClass(r,e),setTimeout(function(){return M.a.addClass(r,o)},17),n&&setTimeout(function(){M.a.removeClass(r,e),M.a.removeClass(r,o)},n)},c=function(n){a.componentWillSlideIn(n);var r=i?"reverse-":"";u(a,""+r+e+"-enter",t.props.delay),u(s,""+r+e+"-exit"),t.timeout=setTimeout(function(){var e;t.setState({children:{current:t.state.children.current},transitionName:t.props.transitionName}),a.componentDidSlideIn((e=t.props).onDidAppear.bind(e)),t.props.onDidSlide(),t.timeout=null},t.props.delay)};this.props.onWillSlide(),s.componentWillSlideOut(c)}},e.prototype.componentWillUnmount=function(){this.timeout&&clearTimeout(this.timeout)},e.prototype.render=function(){var t=this.state.children,e=t.current,n=t.prev,r=n?[e,n]:[e],o=r.map(function(t){return c.a.cloneElement(c.a.createElement(g,{},t),{ref:t.key,key:t.key})});return c.a.createElement(this.props.component,{},o)},e}(c.a.Component);e.a=h,h.propTypes={children:s.a.node.isRequired,component:s.a.string,delay:s.a.number.isRequired,onDidAppear:s.a.func.isRequired,onDidSlide:s.a.func.isRequired,onWillSlide:s.a.func.isRequired,reverse:s.a.bool.isRequired,transitionName:s.a.string.isRequired},h.defaultProps={component:"span",onDidAppear:function(){},onDidSlide:function(){},onWillSlide:function(){},reverse:!1};var g=function(t){function e(n){r(this,e);var i=o(this,t.call(this,n));return i.state={height:"",originalHeight:"",show:!0},i}return i(e,t),e.prototype.componentWillSlideIn=function(t){this.setState({height:t.height,originalHeight:parseInt(window.getComputedStyle(this.node,null).height,10),show:!1})},e.prototype.componentDidSlideIn=function(t){var e=this,n=this.state,r=n.height,o=n.originalHeight;if(r===o)this.setState({show:!0,height:""}),t();else{this.cb=t;var i=0,a=r,s=o,u=Math.abs(a-s)/10,c=a<s?1:-1,l=u*c;this.t=setInterval(function(){i<9?(e.setState({height:a,animating:!0}),a+=l,i++):(clearInterval(e.t),delete e.t,e.setState({height:"",show:!0}),e.cb())},17)}},e.prototype.componentWillSlideOut=function(t){var e=window.getComputedStyle(this.node,null).height;t({height:parseInt(e,10),reverse:this.reverse})},e.prototype.componentWillUnmount=function(){this.t&&(clearInterval(this.t),this.cb())},e.prototype.render=function(){var t=this,e=this.props.children,n=this.state,r=n.height,o=n.show;return c.a.createElement("div",{ref:function(e){return t.node=e},style:r?{height:r+"px"}:{}},c.a.createElement("div",{style:{visibility:o?"inherit":"hidden"}},e))},e}(c.a.Component);g.propTypes={children:s.a.node.isRequired}},function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var s=n(0),u=n.n(s),c=n(24),l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},p=u.a.createElement("svg",{className:"auth0-lock-icon auth0-lock-icon-box",width:"21",height:"20",viewBox:"0 0 21 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},u.a.createElement("g",{id:"icon/key"},u.a.createElement("path",{id:"Shape",fillRule:"evenodd",clipRule:"evenodd",d:"M16.3884 11.0145C14.4508 12.9522 11.3948 13.0447 9.32094 11.3401L7.20872 13.2642L9.60904 15.6697L8.83354 16.4466L6.39631 14.0048L4.88251 15.3832L7.39496 17.89L6.61586 18.6666L3.5 15.5587L3.53914 15.5198C3.47446 15.3363 3.51554 15.1287 3.67514 14.983L8.54211 10.5496C6.89425 8.47691 7.005 5.46384 8.92209 3.54636C10.9841 1.48455 14.3267 1.48455 16.3884 3.54636C18.4501 5.60846 18.4501 8.95239 16.3884 11.0145ZM15.6048 4.33856C13.98 2.71309 11.3454 2.71309 9.72062 4.33856C8.0958 5.9632 8.0958 8.59793 9.72062 10.2226C11.3454 11.8478 13.98 11.8478 15.6048 10.2226C17.2297 8.59793 17.2297 5.96292 15.6048 4.33856Z",fill:"#888888"}))),d=function(){return u.a.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},u.a.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.5496 8.77262C17.007 5.01122 13.8021 2.11002 9.88989 2.11002C6.79596 2.11002 4.14611 3.93257 2.896 6.55065H7.11154C7.41852 6.55065 7.66749 6.79935 7.66749 7.10579C7.66749 7.41251 7.41879 7.66205 7.11154 7.66205H2.47938H1.30282C1.30781 7.64318 1.3092 7.62291 1.3142 7.60404C1.23426 7.56296 1.16987 7.50217 1.11824 7.42889C1.10325 7.40918 1.09048 7.39086 1.07827 7.36977C1.04746 7.3112 1.02998 7.24791 1.02193 7.17935C1.01776 7.15326 1 7.133 1 7.10552C1 7.08997 1.00722 7.0772 1.00888 7.06166V1.5582C1.00888 1.25176 1.25757 1.0025 1.56427 1.0025C1.87125 1.0025 2.11994 1.25148 2.11994 1.5582V5.61994C3.6293 2.87224 6.53311 1 9.88989 1C14.4182 1 18.1481 4.39195 18.6951 8.77235H17.5496V8.77262ZM9.88989 17.655C12.9841 17.655 15.6337 15.833 16.8841 13.2152H12.6685C12.3615 13.2152 12.1128 12.967 12.1128 12.6595C12.1128 12.3525 12.3615 12.1043 12.6685 12.1043H17.3004C17.3004 12.1041 17.3007 12.1035 17.3007 12.1032H18.4775C18.4725 12.1221 18.4709 12.1424 18.4659 12.161C18.5461 12.2021 18.6105 12.2631 18.6621 12.3367C18.6774 12.3564 18.6893 12.3744 18.7018 12.3955C18.7326 12.4541 18.7504 12.5174 18.7584 12.5859C18.7626 12.612 18.7803 12.632 18.7803 12.6598C18.7803 12.675 18.7728 12.6881 18.7717 12.7031V18.2076C18.7717 18.5144 18.523 18.7628 18.2161 18.7628C17.9091 18.7628 17.6604 18.5144 17.6604 18.2076V14.1451C16.151 16.8928 13.2469 18.765 9.89017 18.765C5.36209 18.765 1.63255 15.3739 1.08493 10.9935H2.23041C2.77331 14.7549 5.97799 17.655 9.88989 17.655Z",fill:"black"}),u.a.createElement("mask",{id:"mask0","mask-type":"alpha",maskUnits:"userSpaceOnUse",x:"1",y:"1",width:"18",height:"18"},u.a.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.5496 8.77262C17.007 5.01122 13.8021 2.11002 9.88989 2.11002C6.79596 2.11002 4.14611 3.93257 2.896 6.55065H7.11154C7.41852 6.55065 7.66749 6.79935 7.66749 7.10579C7.66749 7.41251 7.41879 7.66205 7.11154 7.66205H2.47938H1.30282C1.30781 7.64318 1.3092 7.62291 1.3142 7.60404C1.23426 7.56296 1.16987 7.50217 1.11824 7.42889C1.10325 7.40918 1.09048 7.39086 1.07827 7.36977C1.04746 7.3112 1.02998 7.24791 1.02193 7.17935C1.01776 7.15326 1 7.133 1 7.10552C1 7.08997 1.00722 7.0772 1.00888 7.06166V1.5582C1.00888 1.25176 1.25757 1.0025 1.56427 1.0025C1.87125 1.0025 2.11994 1.25148 2.11994 1.5582V5.61994C3.6293 2.87224 6.53311 1 9.88989 1C14.4182 1 18.1481 4.39195 18.6951 8.77235H17.5496V8.77262ZM9.88989 17.655C12.9841 17.655 15.6337 15.833 16.8841 13.2152H12.6685C12.3615 13.2152 12.1128 12.967 12.1128 12.6595C12.1128 12.3525 12.3615 12.1043 12.6685 12.1043H17.3004C17.3004 12.1041 17.3007 12.1035 17.3007 12.1032H18.4775C18.4725 12.1221 18.4709 12.1424 18.4659 12.161C18.5461 12.2021 18.6105 12.2631 18.6621 12.3367C18.6774 12.3564 18.6893 12.3744 18.7018 12.3955C18.7326 12.4541 18.7504 12.5174 18.7584 12.5859C18.7626 12.612 18.7803 12.632 18.7803 12.6598C18.7803 12.675 18.7728 12.6881 18.7717 12.7031V18.2076C18.7717 18.5144 18.523 18.7628 18.2161 18.7628C17.9091 18.7628 17.6604 18.5144 17.6604 18.2076V14.1451C16.151 16.8928 13.2469 18.765 9.89017 18.765C5.36209 18.765 1.63255 15.3739 1.08493 10.9935H2.23041C2.77331 14.7549 5.97799 17.655 9.88989 17.655Z",fill:"white"})),u.a.createElement("g",{mask:"url(#mask0)"}))},M=function(t){function e(n){o(this,e);var r=i(this,t.call(this,n));return r.state={},r}return a(e,t),e.prototype.shouldComponentUpdate=function(t,e){var n=this.props,r=n.isValid,o=n.value,i=n.image,a=n.placeholder,s=this.state.focused;return r!=t.isValid||o!=t.value||s!=e.focused||i!=e.image||a!=e.placeholder},e.prototype.render=function(){var t=this.props,e=t.lockId,n=t.image,o=t.value,i=t.placeholder,a=(t.onReload,t.invalidHint),s=t.isValid,M=r(t,["lockId","image","value","placeholder","onReload","invalidHint","isValid"]),h=this.state.focused;return u.a.createElement("div",null,u.a.createElement("div",{className:"auth0-lock-captcha"},u.a.createElement("div",{className:"auth0-lock-captcha-image",style:{backgroundImage:"url("+n+")"}}),u.a.createElement("button",{type:"button",onClick:this.handleReload.bind(this),className:"auth0-lock-captcha-refresh"},u.a.createElement(d,null))),u.a.createElement(c.a,{focused:h,invalidHint:"",isValid:s,name:"captcha",icon:p},u.a.createElement("input",l({id:e+"-captcha",ref:"input",type:"text",inputMode:"text",name:"captcha",className:"auth0-lock-input",placeholder:i,autoComplete:"off",autoCapitalize:"off",onChange:this.handleOnChange.bind(this),onFocus:this.handleFocus.bind(this),onBlur:this.handleBlur.bind(this),"aria-label":"Email","aria-invalid":!s,"aria-describedby":!s&&a?"auth0-lock-error-msg-email":void 0,value:o},M))))},e.prototype.handleOnChange=function(t){this.props.onChange&&this.props.onChange(t)},e.prototype.handleReload=function(t){this.props.onReload&&(t.preventDefault(),this.props.onReload(t))},e.prototype.handleFocus=function(){this.setState({focused:!0})},e.prototype.handleBlur=function(){this.setState({focused:!1})},e}(u.a.Component);e.a=M},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(0),s=n.n(a),u=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.render=function(){var t=this.props,e=t.lockId,n=t.name,r=t.ariaLabel,o=t.placeholder,i=t.checked,a=t.placeholderHTML;return s.a.createElement("div",{className:"auth0-lock-input-checkbox"},s.a.createElement("label",null,s.a.createElement("input",{id:e+"-"+n,type:"checkbox",checked:"true"===i,onChange:this.handleOnChange.bind(this),name:n,"aria-label":r||n}),a?s.a.createElement("span",{dangerouslySetInnerHTML:{__html:a}}):s.a.createElement("span",null,o)))},e.prototype.handleOnChange=function(t){this.props.onChange&&this.props.onChange(t)},e}(s.a.Component);e.a=u},function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var s=n(0),u=n.n(s),c=n(24),l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},p=u.a.createElement("svg",{"aria-hidden":"true",focusable:"false",width:"14px",height:"13px",viewBox:"0 0 32 26",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",className:"auth0-lock-icon auth0-lock-icon-box"},u.a.createElement("g",{id:"Page-1",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},u.a.createElement("g",{id:"32px",transform:"translate(-2155.000000, -2317.000000)",fill:"#373A39"},u.a.createElement("g",{id:"Group-856",transform:"translate(1.000000, 1.000000)"},u.a.createElement("path",{id:"Fill-419",d:"M2184,2339 C2184,2339.55 2183.55,2340 2183,2340 L2157,2340 C2156.45,2340 2156,2339.55 2156,2339 L2156,2319 C2156,2318.45 2156.45,2318 2157,2318 L2183,2318 C2183.55,2318 2184,2318.45 2184,2319 L2184,2339 L2184,2339 Z M2184,2316 L2156,2316 C2154.89,2316 2154,2316.89 2154,2318 L2154,2340 C2154,2341.1 2154.89,2342 2156,2342 L2184,2342 C2185.1,2342 2186,2341.1 2186,2340 L2186,2318 C2186,2316.89 2185.1,2316 2184,2316 L2184,2316 Z M2176,2322 L2180,2322 L2180,2326 L2176,2326 L2176,2322 Z M2174,2328 L2182,2328 L2182,2320 L2174,2320 L2174,2328 Z M2158,2332 L2172,2332 L2172,2330 L2158,2330 L2158,2332 Z M2158,2336 L2172,2336 L2172,2334 L2158,2334 L2158,2336 Z"}))))),d=function(t){function e(n){o(this,e);var r=i(this,t.call(this,n));return r.state={},r}return a(e,t),e.prototype.shouldComponentUpdate=function(t,e){var n=this.props,r=n.invalidHint,o=n.isValid,i=n.value,a=n.disabled,s=(n.onChange,this.state.focused);return r!=t.invalidHint||o!=t.isValid||i!=t.value||s!=e.focused||a!=t.disabled},e.prototype.render=function(){var t=this.props,e=t.lockId,n=t.invalidHint,o=t.isValid,i=t.autoComplete,a=r(t,["lockId","invalidHint","isValid","autoComplete"]),s=this.state.focused;return u.a.createElement(c.a,{focused:s,invalidHint:n,isValid:o,name:"email",icon:p},u.a.createElement("input",l({id:e+"-email",ref:"input",type:"email",inputMode:"email",name:"email",className:"auth0-lock-input",placeholder:"yours@example.com",autoComplete:i?"on":"off",autoCapitalize:"off",onChange:this.handleOnChange.bind(this),onFocus:this.handleFocus.bind(this),onBlur:this.handleBlur.bind(this),"aria-label":"Email","aria-invalid":!o,"aria-describedby":!o&&n?"auth0-lock-error-msg-email":void 0},a)))},e.prototype.handleOnChange=function(t){this.props.onChange&&this.props.onChange(t)},e.prototype.handleFocus=function(){this.setState({focused:!0})},e.prototype.handleBlur=function(){this.setState({focused:!1})},e}(u.a.Component);e.a=d},function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var s=n(2),u=n.n(s),c=n(0),l=n.n(c),p=n(24),d=n(72),M=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},h=function(t){function e(n){o(this,e);var r=i(this,t.call(this,n));return r.state={},r}return a(e,t),e.prototype.focus=function(){this.refs.input&&this.refs.input.focus()},e.prototype.hasFocus=function(){return this.state.focused},e.prototype.render=function(){var t=this.props,e=t.lockId,n=t.invalidHint,o=t.isValid,i=(t.onChange,t.value),a=r(t,["lockId","invalidHint","isValid","onChange","value"]),s=this.state.focused;return l.a.createElement(p.a,{focused:s,invalidHint:n,isValid:o,name:"mfa_code",icon:d.a},l.a.createElement("input",M({id:e+"-mfa_code",ref:"input",type:"text",name:"mfa_code",className:"auth0-lock-input",autoComplete:"off",autoCapitalize:"off",onChange:this.handleOnChange.bind(this),onFocus:this.handleFocus.bind(this),onBlur:this.handleBlur.bind(this),value:i,"aria-label":"Multi factor authentication code","aria-invalid":!o,"aria-describedby":!o&&n?"auth0-lock-error-msg-mfa_code":void 0},a)))},e.prototype.handleOnChange=function(t){this.props.onChange&&this.props.onChange(t)},e.prototype.handleFocus=function(){this.setState({focused:!0})},e.prototype.handleBlur=function(){this.setState({focused:!1})},e}(l.a.Component);h.propTypes={invalidHint:u.a.string.isRequired,isValid:u.a.bool.isRequired,onChange:u.a.func,placeholder:u.a.string,value:u.a.string.isRequired},e.a=h},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=n(78),p=n.n(l),d=n(77),M=n.n(d),h=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},g=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.render=function(){var t=this.props,e=t.password,n=t.policy,r=t.messages,o=new p.a(n.toJS()).missing(e),i="auth0-lock-password-strength animated "+(o.verified?"fadeOut":"fadeIn");return function t(e){e&&e.forEach(function(e){r[e.code]&&(e.message=r[e.code]),e.message=M.a.format.apply(M.a,[e.message].concat(e.format||[])),e.items&&t(e.items)})}(o.rules),c.a.createElement("div",{className:i},c.a.createElement(f,{items:o.rules}))},e}(c.a.Component);e.a=g,g.propTypes={messages:s.a.object.isRequired,password:s.a.string.isRequired,policy:s.a.object.isRequired},g.defaultProps={messages:{}};var f=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.render=function(){var t=this.props.items;return t&&t.length?c.a.createElement("ul",null,t.map(function(t,e){return c.a.createElement(y,h({},t,{key:e}))})):null},e}(c.a.Component);f.propTypes={items:s.a.arrayOf(s.a.object)};var y=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.render=function(){var t=this.props,e=t.items,n=t.message,r=t.verified,o=r?"auth0-lock-checked":"";return c.a.createElement("li",{className:o},c.a.createElement("span",null,n),c.a.createElement(f,{items:e}))},e}(c.a.Component);y.propTypes={items:s.a.array,message:s.a.string.isRequired,verified:s.a.bool.isRequired}},function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var s=n(0),u=n.n(s),c=n(24),l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},p=u.a.createElement("svg",{"aria-hidden":"true",focusable:"false",width:"9px",height:"14px",viewBox:"0 0 9 14",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",className:"auth0-lock-icon auth0-lock-icon-mobile"},u.a.createElement("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},u.a.createElement("g",{id:"Lock",transform:"translate(-204.000000, -3459.000000)",fill:"#888888"},u.a.createElement("g",{id:"SMS",transform:"translate(153.000000, 3207.000000)"},u.a.createElement("g",{transform:"translate(35.000000, 239.000000)"},u.a.createElement("path",{d:"M24.1,15.625 L16.9,15.625 L16.9,14.75 C16.9,14.264375 17.30275,13.875 17.8,13.875 L23.2,13.875 C23.6968,13.875 24.1,14.264375 24.1,14.75 L24.1,15.625 L24.1,15.625 Z M16.9,16.5 L24.1,16.5 L24.1,21.75 L16.9,21.75 L16.9,16.5 Z M24.1,25.25 C24.1,25.73125 23.6968,26.125 23.2,26.125 L17.8,26.125 C17.30275,26.125 16.9,25.73125 16.9,25.25 L16.9,22.625 L24.1,22.625 L24.1,25.25 L24.1,25.25 Z M23.2,13 L17.8,13 C16.80595,13 16,13.783125 16,14.75 L16,25.25 C16,26.216875 16.80595,27 17.8,27 L23.2,27 C24.19405,27 25,26.216875 25,25.25 L25,14.75 C25,13.783125 24.19405,13 23.2,13 L23.2,13 Z M20.5,25.25 C20.9968,25.25 21.4,24.85625 21.4,24.375 C21.4,23.889375 20.9968,23.5 20.5,23.5 C20.00275,23.5 19.6,23.889375 19.6,24.375 C19.6,24.85625 20.00275,25.25 20.5,25.25 L20.5,25.25 Z"})))))),d=function(t){function e(n){o(this,e);var r=i(this,t.call(this,n));return r.state={},r}return a(e,t),e.prototype.render=function(){var t=this.props,e=t.isValid,n=t.invalidHint,o=r(t,["isValid","invalidHint"]),i=this.state.focused;return u.a.createElement(c.a,{focused:i,isValid:e,invalidHint:n,name:"phone-number",icon:p},u.a.createElement("input",l({ref:"input",type:"tel",name:"phoneNumber",className:"auth0-lock-input auth0-lock-input-number",autoComplete:"off",onFocus:this.handleFocus.bind(this),onBlur:this.handleBlur.bind(this),"aria-label":"Telephone number","aria-invalid":!e,"aria-describedby":!e&&n?"auth0-lock-error-msg-phone-number":void 0},o)))},e.prototype.focus=function(){this.refs.input&&(this.refs.input.focus(),this.handleFocus())},e.prototype.handleFocus=function(){this.setState({focused:!0})},e.prototype.handleBlur=function(){this.setState({focused:!1})},e}(u.a.Component);e.a=d},function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var s=n(0),u=n.n(s),c=n(24),l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},p=u.a.createElement("svg",{"aria-hidden":"true",focusable:"false",width:"13px",height:"14px",viewBox:"0 0 15 16",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",className:"auth0-lock-icon auth0-lock-icon-box"},u.a.createElement("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},u.a.createElement("g",{transform:"translate(-11.000000, -1471.000000)",fill:"#888888"},u.a.createElement("path",{d:"M25.552,1486.998 L11.449,1486.998 C10.667,1485.799 10.984,1483.399 11.766,1482.6 C12.139,1482.219 14.931,1481.5 16.267,1481.172 C14.856,1480.076 13.995,1478.042 13.995,1476.103 C13.995,1473.284 14.813,1470.999 18.498,1470.999 C22.182,1470.999 23,1473.284 23,1476.103 C23,1478.037 22.145,1480.065 20.74,1481.163 C22.046,1481.489 24.88,1482.228 25.241,1482.601 C26.019,1483.399 26.328,1485.799 25.552,1486.998 L25.552,1486.998 Z M24.6,1483.443 C24.087,1483.169 21.881,1482.548 20,1482.097 L20,1480.513 C21.254,1479.659 21.997,1477.806 21.997,1476.12 C21.997,1473.841 21.414,1471.993 18.499,1471.993 C15.583,1471.993 15,1473.841 15,1476.12 C15,1477.807 15.744,1479.662 17,1480.515 L17,1482.112 C15.109,1482.556 12.914,1483.166 12.409,1483.442 C12.082,1483.854 11.797,1485.173 12,1486 L25,1486 C25.201,1485.174 24.922,1483.858 24.6,1483.443 L24.6,1483.443 Z"})))),d=function(t){function e(n){o(this,e);var r=i(this,t.call(this,n));return r.state={},r}return a(e,t),e.prototype.shouldComponentUpdate=function(t,e){var n=this.props,r=n.invalidHint,o=n.isValid,i=n.value,a=n.disabled,s=(n.onChange,this.state.focused);return r!=t.invalidHint||o!=t.isValid||i!=t.value||s!=e.focused||a!=t.disabled},e.prototype.render=function(){var t=this.props,e=t.invalidHint,n=t.isValid,o=(t.onChange,t.autoComplete),i=r(t,["invalidHint","isValid","onChange","autoComplete"]),a=this.state.focused;return u.a.createElement(c.a,{focused:a,invalidHint:e,isValid:n,name:"username",icon:p},u.a.createElement("input",l({ref:"input",type:"text",name:"username",className:"auth0-lock-input",placeholder:"username",autoComplete:o?"on":"off",autoCapitalize:"off",spellCheck:"off",autoCorrect:"off",onChange:this.handleOnChange.bind(this),onFocus:this.handleFocus.bind(this),onBlur:this.handleBlur.bind(this),"aria-label":"User name","aria-invalid":!n,"aria-describedby":!n&&e?"auth0-lock-error-msg-username":void 0},i)))},e.prototype.handleOnChange=function(t){this.props.onChange&&this.props.onChange(t)},e.prototype.handleFocus=function(){this.setState({focused:!0})},e.prototype.handleBlur=function(){this.setState({focused:!1})},e}(u.a.Component);e.a=d},function(t,e,n){"use strict";function r(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var s=n(0),u=n.n(s),c=n(24),l=n(56),p=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},d=u.a.createElement("svg",{"aria-hidden":"true",focusable:"false",width:"12px",height:"14px",viewBox:"0 0 12 14",version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",className:"auth0-lock-icon auth0-lock-icon-box"},u.a.createElement("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},u.a.createElement("g",{transform:"translate(-964.000000, -3509.000000)",fill:"#888888"},u.a.createElement("g",{transform:"translate(915.000000, 3207.000000)"},u.a.createElement("g",{transform:"translate(35.000000, 289.000000)"},u.a.createElement("path",{id:"Fill-42",d:"M25.0523108,22.8115806 L20.455448,26.0692401 L20.455448,20.6336024 L25.0523108,17.6924012 L25.0523108,22.8115806 L25.0523108,22.8115806 Z M20.1658456,19.763342 C20.1060864,19.786611 20.050924,19.8145338 19.9957617,19.8471103 C19.9451962,19.8191876 19.8946307,19.786611 19.8394683,19.7679958 L14.9392126,16.7616414 L19.986568,13.8949009 L25.0523108,16.7616414 L25.043117,16.7662952 L20.1658456,19.763342 L20.1658456,19.763342 Z M19.5360754,20.6336024 L19.5360754,26.0692401 L14.9392126,22.8115806 L14.9392126,17.6924012 L19.5360754,20.6336024 L19.5360754,20.6336024 Z M25.9716833,17.6924012 C25.9716833,17.5574411 25.9395053,17.4317885 25.8889398,17.3154435 C26.0728143,16.9664085 26.0314425,16.5242976 25.7418402,16.2311082 L20.4002856,13.2340614 C19.7980966,12.9408721 20.2393954,12.9036417 19.5590597,13.2340614 L14.2634738,16.2311082 C13.9692745,16.5242976 13.9279028,16.9571009 14.1071804,17.3107897 C14.0520181,17.4271347 14.01984,17.5527873 14.01984,17.6924012 L14.01984,22.8115806 C14.01984,23.3234985 14.4335577,23.7423404 14.9392126,23.7423404 L19.5360754,27 C19.7061593,27 19.8578558,26.9395006 19.9957617,26.8557322 C20.1336676,26.9395006 20.285364,27 20.455448,27 L25.511997,23.7423404 C26.017652,23.7423404 25.9716833,23.3234985 25.9716833,22.8115806 L25.9716833,17.6924012 L25.9716833,17.6924012 Z"})))))),M=function(t){function e(n){o(this,e);var r=i(this,t.call(this,n));return r.state={},r}return a(e,t),e.prototype.componentDidMount=function(){var t=this;n.i(l.a)()||setTimeout(function(){return t.refs.input&&t.refs.input.focus()},1200)},e.prototype.render=function(){var t=this.props,e=t.lockId,n=t.isValid,o=r(t,["lockId","isValid"]),i=this.state.focused;return u.a.createElement(c.a,{focused:i,isValid:n,name:"vcode",icon:d},u.a.createElement("input",p({id:e+"-vcode",ref:"input",type:"tel",name:"vcode",className:"auth0-lock-input auth0-lock-input-code",autoComplete:"off",autoCapitalize:"off",onFocus:this.handleFocus.bind(this),onBlur:this.handleBlur.bind(this),"aria-label":"vcode","aria-invalid":!n},o)))},e.prototype.handleFocus=function(){this.setState({focused:!0})},e.prototype.handleBlur=function(){this.setState({focused:!1})},e}(u.a.Component);e.a=M},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var a=n(2),s=n.n(a),u=n(0),c=n.n(u),l=n(30),p=n.n(l),d=n(54),M=n(115),h=(n(56),n(117)),g=n(1),f=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},y=function(t,e){return t.skipWhile(function(t){return t!==e}).get(1,t.get(0))},N=function(t){function e(n){r(this,e);var i=o(this,t.call(this,n));return i.state={filteredItems:n.items,highlighted:n.defaultItem},i}return i(e,t),e.prototype.filter=function(t){var e=this.props.items.filter(function(e){return h.b(t,e.get("label"))});return{filteredItems:e,highlighted:1===e.size&&e.get(0)||e.includes(this.state.highlighted)&&this.state.highlighted||null}},e.prototype.select=function(t){this.props.onSelect(t)},e.prototype.handleChange=function(t){this.setState(this.filter(t.target.value))},e.prototype.handleKeyDown=function(t){var e=this.state,n=e.filteredItems,r=e.highlighted;switch(t.key){case"ArrowDown":t.preventDefault(),this.setState({highlighted:y(n,r)});break;case"ArrowUp":t.preventDefault(),this.setState({highlighted:y(n.reverse(),r)});break;case"Enter":t.preventDefault(),r&&this.select(r);break;case"Escape":t.preventDefault(),this.props.onCancel()}},e.prototype.render=function(){var t=this,e=this.props,n=e.icon,r=e.iconUrl,o=e.onCancel,i=e.model;return c.a.createElement("div",{className:"auth0-lock-select-country"},c.a.createElement("div",{className:"auth0-lock-search"},c.a.createElement(d.a,{lockId:g.id(i),onClick:o}),c.a.createElement(M.a,{lockId:g.id(i),name:"search",icon:n,iconUrl:r,isValid:!0,onChange:this.handleChange.bind(this),onKeyDown:this.handleKeyDown.bind(this)})),c.a.createElement(m,{highlighted:this.state.highlighted,items:this.state.filteredItems,onClick:this.select.bind(this),onMouseMove:function(e){return t.setState({highlighted:e})}}))},e}(c.a.Component);e.a=N;var m=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.componentDidUpdate=function(){var t=this,e=this.refs.highlighted;if(e){var n=p.a.findDOMNode(this),r=p.a.findDOMNode(e),o=r.offsetTop-n.scrollTop,i=0;o+r.offsetHeight>n.clientHeight?i=o+r.offsetHeight-n.clientHeight:o<0&&(i=o),i&&(this.preventHighlight=!0,n.scrollTop+=i,this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){return t.preventHighlight=!1},100))}},e.prototype.mouseMoveHandler=function(t){!this.preventHighlight&&this.props.onMouseMove(t)},e.prototype.mouseLeaveHandler=function(){},e.prototype.render=function(){var t=this,e=this.props.items.map(function(e){var n=e===t.props.highlighted,r={highlighted:n,label:e.get("label"),onClick:function(){return t.props.onClick(e)},onMouseMove:function(){return t.mouseMoveHandler(e)}};return n&&(r.ref="highlighted"),c.a.createElement(D,f({key:e.get("label")},r))});return c.a.createElement("div",{className:"auth0-lock-list-code",onMouseLeave:this.mouseLeaveHandler.bind(this)},c.a.createElement("ul",null,e))},e}(c.a.Component),D=function(t){function e(){return r(this,e),o(this,t.apply(this,arguments))}return i(e,t),e.prototype.shouldComponentUpdate=function(t){return this.props.highlighted!=t.highlighted},e.prototype.render=function(){var t=this.props,e=t.highlighted,n=t.label,r=t.onClick,o=t.onMouseMove,i=e?"auth0-lock-list-code-highlighted":"";return c.a.createElement("li",{className:i,onClick:r,onMouseMove:o},n)},e}(c.a.Component);D.propTypes={highlighted:s.a.bool.isRequired,label:s.a.string.isRequired,onClick:s.a.func.isRequired,onMouseMove:s.a.func.isRequired}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t){return new i(t)}e.a=o;var i=function(){function t(e){r(this,t),this.state=e,this.watches={}}return t.prototype.reset=function(t){return this._change(t)},t.prototype.swap=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return this._change(t.apply(void 0,[this.state].concat(n)))},t.prototype.deref=function(){return this.state},t.prototype.addWatch=function(t,e){return this.watches[t]=e,this},t.prototype.removeWatch=function(t){return delete this.watches[t],this},t.prototype._change=function(t){var e=this.state,n=this.watches;return this.state=t,Object.keys(n).forEach(function(r){return n[r](r,e,t)}),this.state},t}()},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=function(){function t(e){r(this,t),this.cache={},this.cbs={},this.fetchFn=e}return t.prototype.get=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=e.pop(),o=JSON.stringify(e);if(this.cache[o])return r(null,this.cache[o]);this.registerCallback(o,r)>1||this.fetch(o,e)},t.prototype.fetch=function(t,e){var n=this;this.fetchFn.apply(this,e.concat([function(e,r){e||(n.cache[t]=r),n.execCallbacks(t,e,r)}]))},t.prototype.registerCallback=function(t,e){return this.cbs[t]=this.cbs[t]||[],this.cbs[t].push(e),this.cbs[t].length},t.prototype.execCallbacks=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];this.cbs[t]&&this.cbs[t].forEach(function(t){return t.apply(void 0,n)}),delete this.cbs[t]},t}();e.a=o},function(t,e,n){"use strict";function r(){return function t(e){t.current=e}}e.a=r},function(t,e,n){"use strict";function r(t,e){var n=void 0;return function(){function r(){clearTimeout(n),t.apply(void 0,i)}for(var o=arguments.length,i=Array(o),a=0;a<o;a++)i[a]=arguments[a];clearTimeout(n),n=setTimeout(r,e)}}e.a=r},function(t,e,n){"use strict";function r(){return o++}e.a=r;var o=1},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=n(241),i=n.n(o),a=function(){function t(){r(this,t)}return t.prototype.get=function(){return i.a.apply(void 0,arguments)},t}();e.a=new a},function(t,e,n){"use strict";function r(t){var e=t.match(/^(https?:|chrome-extension:)\/\/(([^:\/?#]*)(?::([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/);return e&&{href:t,protocol:e[1],host:e[2],hostname:e[3],port:e[4],pathname:e[5],search:e[6],hash:e[7]}}function o(t){if(t){var e=r(t);if(!e)return null;var n=e.protocol+"//"+e.hostname;return e.port&&(n+=":"+e.port),n}}e.b=r,e.a=o},function(t,e,n){var r;!function(o){"use strict";function i(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function a(t,e){return t<<e|t>>>32-e}function s(t,e,n,r,o,s){return i(a(i(i(e,t),i(r,s)),o),n)}function u(t,e,n,r,o,i,a){return s(e&n|~e&r,t,e,o,i,a)}function c(t,e,n,r,o,i,a){return s(e&r|n&~r,t,e,o,i,a)}function l(t,e,n,r,o,i,a){return s(e^n^r,t,e,o,i,a)}function p(t,e,n,r,o,i,a){return s(n^(e|~r),t,e,o,i,a)}function d(t,e){t[e>>5]|=128<<e%32,t[14+(e+64>>>9<<4)]=e;var n,r,o,a,s,d=1732584193,M=-271733879,h=-1732584194,g=271733878;for(n=0;n<t.length;n+=16)r=d,o=M,a=h,s=g,d=u(d,M,h,g,t[n],7,-680876936),g=u(g,d,M,h,t[n+1],12,-389564586),h=u(h,g,d,M,t[n+2],17,606105819),M=u(M,h,g,d,t[n+3],22,-1044525330),d=u(d,M,h,g,t[n+4],7,-176418897),g=u(g,d,M,h,t[n+5],12,1200080426),h=u(h,g,d,M,t[n+6],17,-1473231341),M=u(M,h,g,d,t[n+7],22,-45705983),d=u(d,M,h,g,t[n+8],7,1770035416),g=u(g,d,M,h,t[n+9],12,-1958414417),h=u(h,g,d,M,t[n+10],17,-42063),M=u(M,h,g,d,t[n+11],22,-1990404162),d=u(d,M,h,g,t[n+12],7,1804603682),g=u(g,d,M,h,t[n+13],12,-40341101),h=u(h,g,d,M,t[n+14],17,-1502002290),M=u(M,h,g,d,t[n+15],22,1236535329),d=c(d,M,h,g,t[n+1],5,-165796510),g=c(g,d,M,h,t[n+6],9,-1069501632),h=c(h,g,d,M,t[n+11],14,643717713),M=c(M,h,g,d,t[n],20,-373897302),d=c(d,M,h,g,t[n+5],5,-701558691),g=c(g,d,M,h,t[n+10],9,38016083),h=c(h,g,d,M,t[n+15],14,-660478335),M=c(M,h,g,d,t[n+4],20,-405537848),d=c(d,M,h,g,t[n+9],5,568446438),g=c(g,d,M,h,t[n+14],9,-1019803690),h=c(h,g,d,M,t[n+3],14,-187363961),M=c(M,h,g,d,t[n+8],20,1163531501),d=c(d,M,h,g,t[n+13],5,-1444681467),g=c(g,d,M,h,t[n+2],9,-51403784),h=c(h,g,d,M,t[n+7],14,1735328473),M=c(M,h,g,d,t[n+12],20,-1926607734),d=l(d,M,h,g,t[n+5],4,-378558),g=l(g,d,M,h,t[n+8],11,-2022574463),h=l(h,g,d,M,t[n+11],16,1839030562),M=l(M,h,g,d,t[n+14],23,-35309556),d=l(d,M,h,g,t[n+1],4,-1530992060),g=l(g,d,M,h,t[n+4],11,1272893353),h=l(h,g,d,M,t[n+7],16,-155497632),M=l(M,h,g,d,t[n+10],23,-1094730640),d=l(d,M,h,g,t[n+13],4,681279174),g=l(g,d,M,h,t[n],11,-358537222),h=l(h,g,d,M,t[n+3],16,-722521979),M=l(M,h,g,d,t[n+6],23,76029189),d=l(d,M,h,g,t[n+9],4,-640364487),g=l(g,d,M,h,t[n+12],11,-421815835),h=l(h,g,d,M,t[n+15],16,530742520),M=l(M,h,g,d,t[n+2],23,-995338651),d=p(d,M,h,g,t[n],6,-198630844),g=p(g,d,M,h,t[n+7],10,1126891415),h=p(h,g,d,M,t[n+14],15,-1416354905),M=p(M,h,g,d,t[n+5],21,-57434055),d=p(d,M,h,g,t[n+12],6,1700485571),g=p(g,d,M,h,t[n+3],10,-1894986606),h=p(h,g,d,M,t[n+10],15,-1051523),M=p(M,h,g,d,t[n+1],21,-2054922799),d=p(d,M,h,g,t[n+8],6,1873313359),g=p(g,d,M,h,t[n+15],10,-30611744),h=p(h,g,d,M,t[n+6],15,-1560198380),M=p(M,h,g,d,t[n+13],21,1309151649),d=p(d,M,h,g,t[n+4],6,-145523070),g=p(g,d,M,h,t[n+11],10,-1120210379),h=p(h,g,d,M,t[n+2],15,718787259),M=p(M,h,g,d,t[n+9],21,-343485551),d=i(d,r),M=i(M,o),h=i(h,a),g=i(g,s);return[d,M,h,g]}function M(t){var e,n="",r=32*t.length;for(e=0;e<r;e+=8)n+=String.fromCharCode(t[e>>5]>>>e%32&255);return n}function h(t){var e,n=[];for(n[(t.length>>2)-1]=void 0,e=0;e<n.length;e+=1)n[e]=0;var r=8*t.length;for(e=0;e<r;e+=8)n[e>>5]|=(255&t.charCodeAt(e/8))<<e%32;return n}function g(t){return M(d(h(t),8*t.length))}function f(t,e){var n,r,o=h(t),i=[],a=[];for(i[15]=a[15]=void 0,o.length>16&&(o=d(o,8*t.length)),n=0;n<16;n+=1)i[n]=909522486^o[n],a[n]=1549556828^o[n];return r=d(i.concat(h(e)),512+8*e.length),M(d(a.concat(r),640))}function y(t){var e,n,r="0123456789abcdef",o="";for(n=0;n<t.length;n+=1)e=t.charCodeAt(n),o+=r.charAt(e>>>4&15)+r.charAt(15&e);return o}function N(t){return unescape(encodeURIComponent(t))}function m(t){return g(N(t))}function D(t){return y(m(t))}function j(t,e){return f(N(t),N(e))}function I(t,e){return y(j(t,e))}function w(t,e,n){return e?n?j(e,t):I(e,t):n?m(t):D(t)}void 0!==(r=function(){return w}.call(e,n,e,t))&&(t.exports=r)}()},function(t,e,n){"use strict";function r(t,e,n,r,o,i,a,s){if(u(e),!t){var c;if(void 0===e)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,o,i,a,s],p=0;c=new Error(e.replace(/%s/g,function(){return l[p++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}}function o(t){return t}function i(t,e,n){function i(t,e){var n=N.hasOwnProperty(e)?N[e]:null;w.hasOwnProperty(e)&&r("OVERRIDE_BASE"===n,"ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.",e),t&&r("DEFINE_MANY"===n||"DEFINE_MANY_MERGED"===n,"ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",e)}function u(t,n){if(n){r("function"!=typeof n,"ReactClass: You're attempting to use a component class or function as a mixin. Instead, just use a regular object."),r(!e(n),"ReactClass: You're attempting to use a component as a mixin. Instead, just use a regular object.");var o=t.prototype,a=o.__reactAutoBindPairs;n.hasOwnProperty(c)&&D.mixins(t,n.mixins);for(var s in n)if(n.hasOwnProperty(s)&&s!==c){var u=n[s],l=o.hasOwnProperty(s);if(i(l,s),D.hasOwnProperty(s))D[s](t,u);else{var p=N.hasOwnProperty(s),h="function"==typeof u,g=h&&!p&&!l&&!1!==n.autobind;if(g)a.push(s,u),o[s]=u;else if(l){var f=N[s];r(p&&("DEFINE_MANY_MERGED"===f||"DEFINE_MANY"===f),"ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.",f,s),"DEFINE_MANY_MERGED"===f?o[s]=d(o[s],u):"DEFINE_MANY"===f&&(o[s]=M(o[s],u))}else o[s]=u}}}else;}function l(t,e){if(e)for(var n in e){var o=e[n];if(e.hasOwnProperty(n)){var i=n in D;r(!i,'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.',n);var a=n in t;if(a){var s=m.hasOwnProperty(n)?m[n]:null;return r("DEFINE_MANY_MERGED"===s,"ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",n),void(t[n]=d(t[n],o))}t[n]=o}}}function p(t,e){r(t&&e&&"object"==typeof t&&"object"==typeof e,"mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.");for(var n in e)e.hasOwnProperty(n)&&(r(void 0===t[n],"mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.",n),t[n]=e[n]);return t}function d(t,e){return function(){var n=t.apply(this,arguments),r=e.apply(this,arguments);if(null==n)return r;if(null==r)return n;var o={};return p(o,n),p(o,r),o}}function M(t,e){return function(){t.apply(this,arguments),e.apply(this,arguments)}}function h(t,e){var n=e.bind(t);return n}function g(t){for(var e=t.__reactAutoBindPairs,n=0;n<e.length;n+=2){var r=e[n],o=e[n+1];t[r]=h(t,o)}}function f(t){var e=o(function(t,o,i){this.__reactAutoBindPairs.length&&g(this),this.props=t,this.context=o,this.refs=s,this.updater=i||n,this.state=null;var a=this.getInitialState?this.getInitialState():null;r("object"==typeof a&&!Array.isArray(a),"%s.getInitialState(): must return an object or null",e.displayName||"ReactCompositeComponent"),this.state=a});e.prototype=new L,e.prototype.constructor=e,e.prototype.__reactAutoBindPairs=[],y.forEach(u.bind(null,e)),u(e,j),u(e,t),u(e,I),e.getDefaultProps&&(e.defaultProps=e.getDefaultProps()),r(e.prototype.render,"createClass(...): Class specification must implement a `render` method.");for(var i in N)e.prototype[i]||(e.prototype[i]=null);return e}var y=[],N={mixins:"DEFINE_MANY",statics:"DEFINE_MANY",propTypes:"DEFINE_MANY",contextTypes:"DEFINE_MANY",childContextTypes:"DEFINE_MANY",getDefaultProps:"DEFINE_MANY_MERGED",getInitialState:"DEFINE_MANY_MERGED",getChildContext:"DEFINE_MANY_MERGED",render:"DEFINE_ONCE",componentWillMount:"DEFINE_MANY",componentDidMount:"DEFINE_MANY",componentWillReceiveProps:"DEFINE_MANY",shouldComponentUpdate:"DEFINE_ONCE",componentWillUpdate:"DEFINE_MANY",componentDidUpdate:"DEFINE_MANY",componentWillUnmount:"DEFINE_MANY",UNSAFE_componentWillMount:"DEFINE_MANY",UNSAFE_componentWillReceiveProps:"DEFINE_MANY",UNSAFE_componentWillUpdate:"DEFINE_MANY",updateComponent:"OVERRIDE_BASE"},m={getDerivedStateFromProps:"DEFINE_MANY_MERGED"},D={displayName:function(t,e){t.displayName=e},mixins:function(t,e){if(e)for(var n=0;n<e.length;n++)u(t,e[n])},childContextTypes:function(t,e){t.childContextTypes=a({},t.childContextTypes,e)},contextTypes:function(t,e){t.contextTypes=a({},t.contextTypes,e)},getDefaultProps:function(t,e){t.getDefaultProps?t.getDefaultProps=d(t.getDefaultProps,e):t.getDefaultProps=e},propTypes:function(t,e){t.propTypes=a({},t.propTypes,e)},statics:function(t,e){l(t,e)},autobind:function(){}},j={componentDidMount:function(){this.__isMounted=!0}},I={componentWillUnmount:function(){this.__isMounted=!1}},w={replaceState:function(t,e){this.updater.enqueueReplaceState(this,t,e)},isMounted:function(){return!!this.__isMounted}},L=function(){};return a(L.prototype,t.prototype,w),f}var a=n(7),s={},u=function(t){},c="mixins";t.exports=i},function(t,e){function n(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"days":case"day":case"d":return n*c;case"hours":case"hour":case"hrs":case"hr":case"h":return n*u;case"minutes":case"minute":case"mins":case"min":case"m":return n*s;case"seconds":case"second":case"secs":case"sec":case"s":return n*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function r(t){return t>=c?Math.round(t/c)+"d":t>=u?Math.round(t/u)+"h":t>=s?Math.round(t/s)+"m":t>=a?Math.round(t/a)+"s":t+"ms"}function o(t){return i(t,c,"day")||i(t,u,"hour")||i(t,s,"minute")||i(t,a,"second")||t+" ms"}function i(t,e,n){if(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+n:Math.ceil(t/e)+" "+n+"s"}var a=1e3,s=60*a,u=60*s,c=24*u,l=365.25*c;t.exports=function(t,e){e=e||{};var i=typeof t;if("string"===i&&t.length>0)return n(t);if("number"===i&&!1===isNaN(t))return e.long?o(t):r(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,n){(function(r){function o(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type)||("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function i(t){var n=this.useColors;if(t[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+t[0]+(n?"%c ":" ")+"+"+e.humanize(this.diff),n){var r="color: "+this.color;t.splice(1,0,r,"color: inherit");var o=0,i=0;t[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(o++,"%c"===t&&(i=o))}),t.splice(i,0,r)}}function a(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function s(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}}function u(){var t;try{t=e.storage.debug}catch(t){}return!t&&void 0!==r&&"env"in r&&(t=n.i({NODE_ENV:"production"}).DEBUG),t}e=t.exports=n(225),e.log=a,e.formatArgs=i,e.save=s,e.load=u,e.useColors=o,e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},e.enable(u())}).call(e,n(41))},function(t,e,n){function r(t){var n,r=0;for(n in t)r=(r<<5)-r+t.charCodeAt(n),r|=0;return e.colors[Math.abs(r)%e.colors.length]}function o(t){function n(){if(n.enabled){var t=n,r=+new Date,o=r-(c||r);t.diff=o,t.prev=c,t.curr=r,c=r;for(var i=new Array(arguments.length),a=0;a<i.length;a++)i[a]=arguments[a];i[0]=e.coerce(i[0]),"string"!=typeof i[0]&&i.unshift("%O");var s=0;i[0]=i[0].replace(/%([a-zA-Z%])/g,function(n,r){if("%%"===n)return n;s++;var o=e.formatters[r];if("function"==typeof o){var a=i[s];n=o.call(t,a),i.splice(s,1),s--}return n}),e.formatArgs.call(t,i);(n.log||e.log||console.log.bind(console)).apply(t,i)}}return n.namespace=t,n.enabled=e.enabled(t),n.useColors=e.useColors(),n.color=r(t),"function"==typeof e.init&&e.init(n),n}function i(t){e.save(t),e.names=[],e.skips=[];for(var n=("string"==typeof t?t:"").split(/[\s,]+/),r=n.length,o=0;o<r;o++)n[o]&&(t=n[o].replace(/\*/g,".*?"),"-"===t[0]?e.skips.push(new RegExp("^"+t.substr(1)+"$")):e.names.push(new RegExp("^"+t+"$")))}function a(){e.enable("")}function s(t){var n,r;for(n=0,r=e.skips.length;n<r;n++)if(e.skips[n].test(t))return!1;for(n=0,r=e.names.length;n<r;n++)if(e.names[n].test(t))return!0;return!1}function u(t){return t instanceof Error?t.stack||t.message:t}e=t.exports=o.debug=o.default=o,e.coerce=u,e.disable=a,e.enable=i,e.enabled=s,e.humanize=n(223),e.names=[],e.skips=[],e.formatters={};var c},function(t,e,n){"use strict";function r(t,e){t.classList?t.classList.add(e):(0,i.default)(t,e)||("string"==typeof t.className?t.className=t.className+" "+e:t.setAttribute("class",(t.className&&t.className.baseVal||"")+" "+e))}var o=n(157);e.__esModule=!0,e.default=r;var i=o(n(227));t.exports=e.default},function(t,e,n){"use strict";function r(t,e){return t.classList?!!e&&t.classList.contains(e):-1!==(" "+(t.className.baseVal||t.className)+" ").indexOf(" "+e+" ")}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e,n){"use strict";function r(t,e){return t.replace(new RegExp("(^|\\s)"+e+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}t.exports=function(t,e){t.classList?t.classList.remove(e):"string"==typeof t.className?t.className=r(t.className,e):t.setAttribute("class",r(t.className&&t.className.baseVal||"",e))}},function(t,e,n){"use strict";function r(t){return t.replace(o,function(t,e){return e.toUpperCase()})}var o=/-(.)/g;t.exports=r},function(t,e,n){"use strict";function r(t){return o(t.replace(i,"ms-"))}var o=n(229),i=/^-ms-/;t.exports=r},function(t,e,n){"use strict";function r(t,e){return!(!t||!e)&&(t===e||!o(t)&&(o(e)?r(t,e.parentNode):"contains"in t?t.contains(e):!!t.compareDocumentPosition&&!!(16&t.compareDocumentPosition(e))))}var o=n(239);t.exports=r},function(t,e,n){"use strict";function r(t){var e=t.length;if((Array.isArray(t)||"object"!=typeof t&&"function"!=typeof t)&&a(!1),"number"!=typeof e&&a(!1),0===e||e-1 in t||a(!1),"function"==typeof t.callee&&a(!1),t.hasOwnProperty)try{return Array.prototype.slice.call(t)}catch(t){}for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}function o(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"length"in t&&!("setInterval"in t)&&"number"!=typeof t.nodeType&&(Array.isArray(t)||"callee"in t||"item"in t)}function i(t){return o(t)?Array.isArray(t)?t.slice():r(t):[t]}var a=n(3);t.exports=i},function(t,e,n){"use strict";function r(t){var e=t.match(l);return e&&e[1].toLowerCase()}function o(t,e){var n=c;c||u(!1);var o=r(t),i=o&&s(o);if(i){n.innerHTML=i[1]+t+i[2];for(var l=i[0];l--;)n=n.lastChild}else n.innerHTML=t;var p=n.getElementsByTagName("script");p.length&&(e||u(!1),a(p).forEach(e));for(var d=Array.from(n.childNodes);n.lastChild;)n.removeChild(n.lastChild);return d}var i=n(13),a=n(232),s=n(234),u=n(3),c=i.canUseDOM?document.createElement("div"):null,l=/^\s*<(\w+)/;t.exports=o},function(t,e,n){"use strict";function r(t){return a||i(!1),d.hasOwnProperty(t)||(t="*"),s.hasOwnProperty(t)||(a.innerHTML="*"===t?"<link />":"<"+t+"></"+t+">",s[t]=!a.firstChild),s[t]?d[t]:null}var o=n(13),i=n(3),a=o.canUseDOM?document.createElement("div"):null,s={},u=[1,'<select multiple="true">',"</select>"],c=[1,"<table>","</table>"],l=[3,"<table><tbody><tr>","</tr></tbody></table>"],p=[1,'<svg xmlns="http://www.w3.org/2000/svg">',"</svg>"],d={"*":[1,"?<div>","</div>"],area:[1,"<map>","</map>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],legend:[1,"<fieldset>","</fieldset>"],param:[1,"<object>","</object>"],tr:[2,"<table><tbody>","</tbody></table>"],optgroup:u,option:u,caption:c,colgroup:c,tbody:c,tfoot:c,thead:c,td:l,th:l};["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"].forEach(function(t){d[t]=p,s[t]=!0}),t.exports=r},function(t,e,n){"use strict";function r(t){return t.Window&&t instanceof t.Window?{x:t.pageXOffset||t.document.documentElement.scrollLeft,y:t.pageYOffset||t.document.documentElement.scrollTop}:{x:t.scrollLeft,y:t.scrollTop}}t.exports=r},function(t,e,n){"use strict";function r(t){return t.replace(o,"-$1").toLowerCase()}var o=/([A-Z])/g;t.exports=r},function(t,e,n){"use strict";function r(t){return o(t).replace(i,"-ms-")}var o=n(236),i=/^ms-/;t.exports=r},function(t,e,n){"use strict";function r(t){var e=t?t.ownerDocument||t:document,n=e.defaultView||window;return!(!t||!("function"==typeof n.Node?t instanceof n.Node:"object"==typeof t&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName))}t.exports=r},function(t,e,n){"use strict";function r(t){return o(t)&&3==t.nodeType}var o=n(238);t.exports=r},function(t,e,n){"use strict";function r(t){var e={};return function(n){return e.hasOwnProperty(n)||(e[n]=t.call(this,n)),e[n]}}t.exports=r},function(t,e,n){function r(){}function o(t,e,n){function o(){u.parentNode&&u.parentNode.removeChild(u),window[p]=r,c&&clearTimeout(c)}function s(){window[p]&&o()}"function"==typeof e&&(n=e,e={}),e||(e={});var u,c,l=e.prefix||"__jp",p=e.name||l+a++,d=e.param||"callback",M=null!=e.timeout?e.timeout:6e4,h=encodeURIComponent,g=document.getElementsByTagName("script")[0]||document.head;return M&&(c=setTimeout(function(){o(),n&&n(new Error("Timeout"))},M)),window[p]=function(t){i("jsonp got",t),o(),n&&n(null,t)},t+=(~t.indexOf("?")?"&":"?")+d+"="+h(p),t=t.replace("?&","?"),i('jsonp req "%s"',t),u=document.createElement("script"),u.src=t,g.parentNode.insertBefore(u,g),s}var i=n(224)("jsonp");t.exports=o;var a=0},function(t,e,n){"use strict";function r(t){console&&console.warn&&console.warn(t)}function o(){o.init.call(this)}function i(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function a(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function s(t,e,n,o){var s,u,c;if(i(n),u=t._events,void 0===u?(u=t._events=Object.create(null),t._eventsCount=0):(void 0!==u.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),u=t._events),c=u[e]),void 0===c)c=u[e]=n,++t._eventsCount;else if("function"==typeof c?c=u[e]=o?[n,c]:[c,n]:o?c.unshift(n):c.push(n),(s=a(t))>0&&c.length>s&&!c.warned){c.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=c.length,r(l)}return t}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function c(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},o=u.bind(r);return o.listener=n,r.wrapFn=o,o}function l(t,e,n){var r=t._events;if(void 0===r)return[];var o=r[e];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?h(o):d(o,o.length)}function p(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function d(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function M(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function h(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}function g(t,e){return new Promise(function(n,r){function o(n){t.removeListener(e,i),r(n)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",o),n([].slice.call(arguments))}y(t,e,i,{once:!0}),"error"!==e&&f(t,o,{once:!0})})}function f(t,e,n){"function"==typeof t.on&&y(t,"error",e,n)}function y(t,e,n,r){if("function"==typeof t.on)r.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,function o(i){r.once&&t.removeEventListener(e,o),n(i)})}}var N,m="object"==typeof Reflect?Reflect:null,D=m&&"function"==typeof m.apply?m.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};N=m&&"function"==typeof m.ownKeys?m.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var j=Number.isNaN||function(t){return t!==t};t.exports=o,t.exports.once=g,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var I=10;Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return I},set:function(t){if("number"!=typeof t||t<0||j(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");I=t}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||j(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},o.prototype.getMaxListeners=function(){return a(this)},o.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r="error"===t,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var i;if(e.length>0&&(i=e[0]),i instanceof Error)throw i;var a=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw a.context=i,a}var s=o[t];if(void 0===s)return!1;if("function"==typeof s)D(s,this,e);else for(var u=s.length,c=d(s,u),n=0;n<u;++n)D(c[n],this,e);return!0},o.prototype.addListener=function(t,e){return s(this,t,e,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(t,e){return s(this,t,e,!0)},o.prototype.once=function(t,e){return i(e),this.on(t,c(this,t,e)),this},o.prototype.prependOnceListener=function(t,e){return i(e),this.prependListener(t,c(this,t,e)),this},o.prototype.removeListener=function(t,e){var n,r,o,a,s;if(i(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(o=-1,a=n.length-1;a>=0;a--)if(n[a]===e||n[a].listener===e){s=n[a].listener,o=a;break}if(o<0)return this;0===o?n.shift():M(n,o),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,s||e)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var o,i=Object.keys(n);for(r=0;r<i.length;++r)"removeListener"!==(o=i[r])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},o.prototype.listeners=function(t){return l(this,t,!0)},o.prototype.rawListeners=function(t){return l(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},o.prototype.listenerCount=p,o.prototype.eventNames=function(){return this._eventsCount>0?N(this._events):[]}},function(t,e){"function"==typeof Object.create?t.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},function(t,e){t.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},function(t,e,n){var r=n(79).charsets,o=r.upperCase,i=r.lowerCase,a=r.numbers,s=r.specialCharacters,u=n(78),c=new u({length:{minLength:1}}),l=new u({length:{minLength:6}}),p=new u({length:{minLength:8},contains:{expressions:[i,o,a]}}),d=new u({length:{minLength:8},containsAtLeast:{atLeast:3,expressions:[i,o,a,s]}}),M=new u({length:{minLength:10},containsAtLeast:{atLeast:3,expressions:[i,o,a,s]},identicalChars:{max:2}}),h={none:c,low:l,fair:p,good:d,excellent:M};t.exports=function(t){var e=h[t]||h.none;return{check:function(t){return e.check(t)},assert:function(t){return e.assert(t)},missing:function(t){return e.missing(t)},missingAsMarkdown:function(t){return e.missingAsMarkdown(t)},explain:function(){return e.explain()},toString:function(){return e.toString()}}},t.exports.PasswordPolicy=u,t.exports.charsets=r},function(t,e){function n(t){var e=Error.call(this,t);return e.name="PasswordPolicyError",e}t.exports=n},function(t,e,n){var r=n(57),o=n(79);t.exports={validate:function(t){if(!r.isObject(t))throw new Error("options should be an object");if(!r.isNumber(t.atLeast)||r.isNaN(t.atLeast)||t.atLeast<1)throw new Error("atLeast should be a valid, non-NaN number, greater than 0");if(!r.isArray(t.expressions)||r.isEmpty(t.expressions))throw new Error("expressions should be an non-empty array");if(t.expressions.length<t.atLeast)throw new Error("expressions length should be greater than atLeast");if(!t.expressions.every(function(t){return r.isFunction(t.explain)&&r.isFunction(t.test)}))throw new Error("containsAtLeast expressions are invalid: An explain and a test function should be provided");return!0},explain:function(t){return{message:"Contain at least %d of the following %d types of characters:",code:"containsAtLeast",format:[t.atLeast,t.expressions.length],items:t.expressions.map(function(t){return t.explain()})}},missing:function(t,e){var n=t.expressions&&t.expressions.map(function(t){var n=t.explain();return n.verified=t.test(e),n}),r=n.reduce(function(t,e){return t+!!e.verified},0),o=r>=t.atLeast;return{message:"Contain at least %d of the following %d types of characters:",code:"containsAtLeast",format:[t.atLeast,t.expressions.length],items:n,verified:o}},assert:function(t,e){return!!e&&t.expressions.filter(function(t){return t.test(e)}).length>=t.atLeast},charsets:o.charsets}},function(t,e,n){function r(t,e){if(!e)return!1;var n,r={c:null,count:0};for(n=0;n<e.length;n++)if(r.c!==e[n]?(r.c=e[n],r.count=1):r.count++,r.count>t.max)return!1;return!0}function o(t,e){var n=new Array(t.max+2).join("a"),r={message:'No more than %d identical characters in a row (e.g., "%s" not allowed)',code:"identicalChars",format:[t.max,n]};return void 0!==e&&(r.verified=e),r}var i=n(57);t.exports={validate:function(t){if(!i.isObject(t))throw new Error("options should be an object");if(!i.isNumber(t.max)||i.isNaN(t.max)||t.max<1)throw new Error("max should be a number greater than 1");return!0},explain:o,missing:function(t,e){return o(t,r(t,e))},assert:r}},function(t,e,n){function r(t,e){return!!e&&t.minLength<=e.length}function o(t){return 1===t.minLength?{message:"Non-empty password required",code:"nonEmpty"}:{message:"At least %d characters in length",format:[t.minLength],code:"lengthAtLeast"}}var i=n(57);t.exports={validate:function(t){if(!i.isObject(t))throw new Error("options should be an object");if(!i.isNumber(t.minLength)||i.isNaN(t.minLength))throw new Error("length expects minLength to be a non-zero number");return!0},explain:o,missing:function(t,e){var n=o(t);return n.verified=!!r(t,e),n},assert:r}},function(t,e,n){"use strict";function r(t,e,n,r,o){}r.resetWarningCache=function(){},t.exports=r},function(t,e,n){"use strict";function r(){}function o(){}var i=n(123);o.resetWarningCache=r,t.exports=function(){function t(t,e,n,r,o,a){if(a!==i){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function e(){return t}t.isRequired=t;var n={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:o,resetWarningCache:r};return n.PropTypes=n,n}},function(t,e,n){"use strict";function r(){return null}var o=n(320),i=n(7),a=n(123),s=n(250),u=Function.call.bind(Object.prototype.hasOwnProperty),c=function(){};t.exports=function(t,e){function n(t){var e=t&&(b&&t[b]||t[C]);if("function"==typeof e)return e}function l(t,e){return t===e?0!==t||1/t==1/e:t!==t&&e!==e}function p(t){this.message=t,this.stack=""}function d(t){function n(n,r,o,i,s,u,c){if(i=i||T,u=u||o,c!==a){if(e){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}return null==r[o]?n?new p(null===r[o]?"The "+s+" `"+u+"` is marked as required in `"+i+"`, but its value is `null`.":"The "+s+" `"+u+"` is marked as required in `"+i+"`, but its value is `undefined`."):null:t(r,o,i,s,u)}var r=n.bind(null,!1);return r.isRequired=n.bind(null,!0),r}function M(t){function e(e,n,r,o,i,a){var s=e[n];if(w(s)!==t)return new p("Invalid "+o+" `"+i+"` of type `"+L(s)+"` supplied to `"+r+"`, expected `"+t+"`.");return null}return d(e)}function h(t){function e(e,n,r,o,i){if("function"!=typeof t)return new p("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=e[n];if(!Array.isArray(s)){return new p("Invalid "+o+" `"+i+"` of type `"+w(s)+"` supplied to `"+r+"`, expected an array.")}for(var u=0;u<s.length;u++){var c=t(s,u,r,o,i+"["+u+"]",a);if(c instanceof Error)return c}return null}return d(e)}function g(t){function e(e,n,r,o,i){if(!(e[n]instanceof t)){var a=t.name||T;return new p("Invalid "+o+" `"+i+"` of type `"+z(e[n])+"` supplied to `"+r+"`, expected instance of `"+a+"`.")}return null}return d(e)}function f(t){function e(e,n,r,o,i){for(var a=e[n],s=0;s<t.length;s++)if(l(a,t[s]))return null;var u=JSON.stringify(t,function(t,e){return"symbol"===L(e)?String(e):e});return new p("Invalid "+o+" `"+i+"` of value `"+String(a)+"` supplied to `"+r+"`, expected one of "+u+".")}return Array.isArray(t)?d(e):r}function y(t){function e(e,n,r,o,i){if("function"!=typeof t)return new p("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var s=e[n],c=w(s);if("object"!==c)return new p("Invalid "+o+" `"+i+"` of type `"+c+"` supplied to `"+r+"`, expected an object.");for(var l in s)if(u(s,l)){var d=t(s,l,r,o,i+"."+l,a);if(d instanceof Error)return d}return null}return d(e)}function N(t){function e(e,n,r,o,i){for(var s=0;s<t.length;s++){if(null==(0,t[s])(e,n,r,o,i,a))return null}return new p("Invalid "+o+" `"+i+"` supplied to `"+r+"`.")}if(!Array.isArray(t))return r;for(var n=0;n<t.length;n++){var o=t[n];if("function"!=typeof o)return c("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+v(o)+" at index "+n+"."),r}return d(e)}function m(t){function e(e,n,r,o,i){var s=e[n],u=w(s);if("object"!==u)return new p("Invalid "+o+" `"+i+"` of type `"+u+"` supplied to `"+r+"`, expected `object`.");for(var c in t){var l=t[c];if(l){var d=l(s,c,r,o,i+"."+c,a);if(d)return d}}return null}return d(e)}function D(t){function e(e,n,r,o,s){var u=e[n],c=w(u);if("object"!==c)return new p("Invalid "+o+" `"+s+"` of type `"+c+"` supplied to `"+r+"`, expected `object`.");var l=i({},e[n],t);for(var d in l){var M=t[d];if(!M)return new p("Invalid "+o+" `"+s+"` key `"+d+"` supplied to `"+r+"`.\nBad object: "+JSON.stringify(e[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(t),null," "));var h=M(u,d,r,o,s+"."+d,a);if(h)return h}return null}return d(e)}function j(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(j);if(null===e||t(e))return!0;var r=n(e);if(!r)return!1;var o,i=r.call(e);if(r!==e.entries){for(;!(o=i.next()).done;)if(!j(o.value))return!1}else for(;!(o=i.next()).done;){var a=o.value;if(a&&!j(a[1]))return!1}return!0;default:return!1}}function I(t,e){return"symbol"===t||!!e&&("Symbol"===e["@@toStringTag"]||"function"==typeof Symbol&&e instanceof Symbol)}function w(t){var e=typeof t;return Array.isArray(t)?"array":t instanceof RegExp?"object":I(e,t)?"symbol":e}function L(t){if(void 0===t||null===t)return""+t;var e=w(t);if("object"===e){if(t instanceof Date)return"date";if(t instanceof RegExp)return"regexp"}return e}function v(t){var e=L(t);switch(e){case"array":case"object":return"an "+e;case"boolean":case"date":case"regexp":return"a "+e;default:return e}}function z(t){return t.constructor&&t.constructor.name?t.constructor.name:T}var b="function"==typeof Symbol&&Symbol.iterator,C="@@iterator",T="<<anonymous>>",E={array:M("array"),bool:M("boolean"),func:M("function"),number:M("number"),object:M("object"),string:M("string"),symbol:M("symbol"),any:function(){return d(r)}(),arrayOf:h,element:function(){function e(e,n,r,o,i){var a=e[n];if(!t(a)){return new p("Invalid "+o+" `"+i+"` of type `"+w(a)+"` supplied to `"+r+"`, expected a single ReactElement.")}return null}return d(e)}(),elementType:function(){function t(t,e,n,r,i){var a=t[e];if(!o.isValidElementType(a)){return new p("Invalid "+r+" `"+i+"` of type `"+w(a)+"` supplied to `"+n+"`, expected a single ReactElement type.")}return null}return d(t)}(),instanceOf:g,node:function(){function t(t,e,n,r,o){return j(t[e])?null:new p("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")}return d(t)}(),objectOf:y,oneOf:f,oneOfType:N,shape:m,exact:D};return p.prototype=Error.prototype,E.checkPropTypes=s,E.resetWarningCache=s.resetWarningCache,E.PropTypes=E,E}},function(t,e,n){"use strict";var r=n(255),o=n(254),i=n(124);t.exports={formats:i,parse:o,stringify:r}},function(t,e,n){"use strict";var r=n(80),o=Object.prototype.hasOwnProperty,i=Array.isArray,a={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:r.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},s=function(t){return t.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},u=function(t,e){return t&&"string"==typeof t&&e.comma&&t.indexOf(",")>-1?t.split(","):t},c=function(t,e){var n,c={},l=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,p=e.parameterLimit===1/0?void 0:e.parameterLimit,d=l.split(e.delimiter,p),M=-1,h=e.charset;if(e.charsetSentinel)for(n=0;n<d.length;++n)0===d[n].indexOf("utf8=")&&("utf8=%E2%9C%93"===d[n]?h="utf-8":"utf8=%26%2310003%3B"===d[n]&&(h="iso-8859-1"),M=n,n=d.length);for(n=0;n<d.length;++n)if(n!==M){var g,f,y=d[n],N=y.indexOf("]="),m=-1===N?y.indexOf("="):N+1;-1===m?(g=e.decoder(y,a.decoder,h,"key"),f=e.strictNullHandling?null:""):(g=e.decoder(y.slice(0,m),a.decoder,h,"key"),f=r.maybeMap(u(y.slice(m+1),e),function(t){return e.decoder(t,a.decoder,h,"value")})),f&&e.interpretNumericEntities&&"iso-8859-1"===h&&(f=s(f)),y.indexOf("[]=")>-1&&(f=i(f)?[f]:f),o.call(c,g)?c[g]=r.combine(c[g],f):c[g]=f}return c},l=function(t,e,n,r){for(var o=r?e:u(e,n),i=t.length-1;i>=0;--i){var a,s=t[i];if("[]"===s&&n.parseArrays)a=[].concat(o);else{a=n.plainObjects?Object.create(null):{};var c="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,l=parseInt(c,10);n.parseArrays||""!==c?!isNaN(l)&&s!==c&&String(l)===c&&l>=0&&n.parseArrays&&l<=n.arrayLimit?(a=[],a[l]=o):a[c]=o:a={0:o}}o=a}return o},p=function(t,e,n,r){if(t){var i=n.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,a=/(\[[^[\]]*])/,s=/(\[[^[\]]*])/g,u=n.depth>0&&a.exec(i),c=u?i.slice(0,u.index):i,p=[];if(c){if(!n.plainObjects&&o.call(Object.prototype,c)&&!n.allowPrototypes)return;p.push(c)}for(var d=0;n.depth>0&&null!==(u=s.exec(i))&&d<n.depth;){if(d+=1,!n.plainObjects&&o.call(Object.prototype,u[1].slice(1,-1))&&!n.allowPrototypes)return;p.push(u[1])}return u&&p.push("["+i.slice(u.index)+"]"),l(p,e,n,r)}},d=function(t){if(!t)return a;if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=void 0===t.charset?a.charset:t.charset;return{allowDots:void 0===t.allowDots?a.allowDots:!!t.allowDots,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:a.allowPrototypes,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:a.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:a.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:a.comma,decoder:"function"==typeof t.decoder?t.decoder:a.decoder,delimiter:"string"==typeof t.delimiter||r.isRegExp(t.delimiter)?t.delimiter:a.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:a.depth,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:a.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:a.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:a.plainObjects,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:a.strictNullHandling}};t.exports=function(t,e){var n=d(e);if(""===t||null===t||void 0===t)return n.plainObjects?Object.create(null):{};for(var o="string"==typeof t?c(t,n):t,i=n.plainObjects?Object.create(null):{},a=Object.keys(o),s=0;s<a.length;++s){var u=a[s],l=p(u,o[u],n,"string"==typeof t);i=r.merge(i,l,n)}return r.compact(i)}},function(t,e,n){"use strict";var r=n(80),o=n(124),i=Object.prototype.hasOwnProperty,a={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},s=Array.isArray,u=Array.prototype.push,c=function(t,e){u.apply(t,s(e)?e:[e])},l=Date.prototype.toISOString,p=o.default,d={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:r.encode,encodeValuesOnly:!1,format:p,formatter:o.formatters[p],indices:!1,serializeDate:function(t){return l.call(t)},skipNulls:!1,strictNullHandling:!1},M=function(t){return"string"==typeof t||"number"==typeof t||"boolean"==typeof t||"symbol"==typeof t||"bigint"==typeof t},h=function t(e,n,o,i,a,u,l,p,h,g,f,y,N){var m=e;if("function"==typeof l?m=l(n,m):m instanceof Date?m=g(m):"comma"===o&&s(m)&&(m=r.maybeMap(m,function(t){return t instanceof Date?g(t):t}).join(",")),null===m){if(i)return u&&!y?u(n,d.encoder,N,"key"):n;m=""}if(M(m)||r.isBuffer(m)){if(u){return[f(y?n:u(n,d.encoder,N,"key"))+"="+f(u(m,d.encoder,N,"value"))]}return[f(n)+"="+f(String(m))]}var D=[];if(void 0===m)return D;var j;if(s(l))j=l;else{var I=Object.keys(m);j=p?I.sort(p):I}for(var w=0;w<j.length;++w){var L=j[w],v=m[L];if(!a||null!==v){var z=s(m)?"function"==typeof o?o(n,L):n:n+(h?"."+L:"["+L+"]");c(D,t(v,z,o,i,a,u,l,p,h,g,f,y,N))}}return D},g=function(t){if(!t)return d;if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=t.charset||d.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=o.default;if(void 0!==t.format){if(!i.call(o.formatters,t.format))throw new TypeError("Unknown format option provided.");n=t.format}var r=o.formatters[n],a=d.filter;return("function"==typeof t.filter||s(t.filter))&&(a=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:d.addQueryPrefix,allowDots:void 0===t.allowDots?d.allowDots:!!t.allowDots,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:d.charsetSentinel,delimiter:void 0===t.delimiter?d.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:d.encode,encoder:"function"==typeof t.encoder?t.encoder:d.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:d.encodeValuesOnly,filter:a,formatter:r,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:d.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:d.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:d.strictNullHandling}};t.exports=function(t,e){var n,r,o=t,i=g(e);"function"==typeof i.filter?(r=i.filter,o=r("",o)):s(i.filter)&&(r=i.filter,n=r);var u=[];if("object"!=typeof o||null===o)return"";var l;l=e&&e.arrayFormat in a?e.arrayFormat:e&&"indices"in e?e.indices?"indices":"repeat":"indices";var p=a[l];n||(n=Object.keys(o)),i.sort&&n.sort(i.sort);for(var d=0;d<n.length;++d){var M=n[d];i.skipNulls&&null===o[M]||c(u,h(o[M],M,p,i.strictNullHandling,i.skipNulls,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.formatter,i.encodeValuesOnly,i.charset))}var f=u.join(i.delimiter),y=!0===i.addQueryPrefix?"?":"";return i.charsetSentinel&&("iso-8859-1"===i.charset?y+="utf8=%26%2310003%3B&":y+="utf8=%E2%9C%93&"),f.length>0?y+f:""}},function(t,e,n){"use strict";var r={Properties:{"aria-current":0,"aria-details":0,"aria-disabled":0,"aria-hidden":0,"aria-invalid":0,"aria-keyshortcuts":0,"aria-label":0,"aria-roledescription":0,"aria-autocomplete":0,"aria-checked":0,"aria-expanded":0,"aria-haspopup":0,"aria-level":0,"aria-modal":0,"aria-multiline":0,"aria-multiselectable":0,"aria-orientation":0,"aria-placeholder":0,"aria-pressed":0,"aria-readonly":0,"aria-required":0,"aria-selected":0,"aria-sort":0,"aria-valuemax":0,"aria-valuemin":0,"aria-valuenow":0,"aria-valuetext":0,"aria-atomic":0,"aria-busy":0,"aria-live":0,"aria-relevant":0,"aria-dropeffect":0,"aria-grabbed":0,"aria-activedescendant":0,"aria-colcount":0,"aria-colindex":0,"aria-colspan":0,"aria-controls":0,"aria-describedby":0,"aria-errormessage":0,"aria-flowto":0,"aria-labelledby":0,"aria-owns":0,"aria-posinset":0,"aria-rowcount":0,"aria-rowindex":0,"aria-rowspan":0,"aria-setsize":0},DOMAttributeNames:{},DOMPropertyNames:{}};t.exports=r},function(t,e,n){"use strict";var r=n(9),o=n(120),i={focusDOMComponent:function(){o(r.getNodeFromInstance(this))}};t.exports=i},function(t,e,n){"use strict";function r(t){return(t.ctrlKey||t.altKey||t.metaKey)&&!(t.ctrlKey&&t.altKey)}function o(t){switch(t){case"topCompositionStart":return v.compositionStart;case"topCompositionEnd":return v.compositionEnd;case"topCompositionUpdate":return v.compositionUpdate}}function i(t,e){return"topKeyDown"===t&&e.keyCode===N}function a(t,e){switch(t){case"topKeyUp":return-1!==y.indexOf(e.keyCode);case"topKeyDown":return e.keyCode!==N;case"topKeyPress":case"topMouseDown":case"topBlur":return!0;default:return!1}}function s(t){var e=t.detail;return"object"==typeof e&&"data"in e?e.data:null}function u(t,e,n,r){var u,c;if(m?u=o(t):b?a(t,n)&&(u=v.compositionEnd):i(t,n)&&(u=v.compositionStart),!u)return null;I&&(b||u!==v.compositionStart?u===v.compositionEnd&&b&&(c=b.getData()):b=h.getPooled(r));var l=g.getPooled(u,e,n,r);if(c)l.data=c;else{var p=s(n);null!==p&&(l.data=p)}return d.accumulateTwoPhaseDispatches(l),l}function c(t,e){switch(t){case"topCompositionEnd":return s(e);case"topKeyPress":return e.which!==w?null:(z=!0,L);case"topTextInput":var n=e.data;return n===L&&z?null:n;default:return null}}function l(t,e){if(b){if("topCompositionEnd"===t||!m&&a(t,e)){var n=b.getData();return h.release(b),b=null,n}return null}switch(t){case"topPaste":return null;case"topKeyPress":return e.which&&!r(e)?String.fromCharCode(e.which):null;case"topCompositionEnd":return I?null:e.data;default:return null}}function p(t,e,n,r){var o;if(!(o=j?c(t,n):l(t,n)))return null;var i=f.getPooled(v.beforeInput,e,n,r);return i.data=o,d.accumulateTwoPhaseDispatches(i),i}var d=n(43),M=n(13),h=n(264),g=n(301),f=n(304),y=[9,13,27,32],N=229,m=M.canUseDOM&&"CompositionEvent"in window,D=null;M.canUseDOM&&"documentMode"in document&&(D=document.documentMode);var j=M.canUseDOM&&"TextEvent"in window&&!D&&!function(){var t=window.opera;return"object"==typeof t&&"function"==typeof t.version&&parseInt(t.version(),10)<=12}(),I=M.canUseDOM&&(!m||D&&D>8&&D<=11),w=32,L=String.fromCharCode(w),v={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["topCompositionEnd","topKeyPress","topTextInput","topPaste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:["topBlur","topCompositionEnd","topKeyDown","topKeyPress","topKeyUp","topMouseDown"]},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:["topBlur","topCompositionStart","topKeyDown","topKeyPress","topKeyUp","topMouseDown"]},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:["topBlur","topCompositionUpdate","topKeyDown","topKeyPress","topKeyUp","topMouseDown"]}},z=!1,b=null,C={eventTypes:v,extractEvents:function(t,e,n,r){return[u(t,e,n,r),p(t,e,n,r)]}};t.exports=C},function(t,e,n){"use strict";var r=n(125),o=n(13),i=(n(18),n(230),n(310)),a=n(237),s=n(240),u=(n(6),s(function(t){return a(t)})),c=!1,l="cssFloat";if(o.canUseDOM){var p=document.createElement("div").style;try{p.font=""}catch(t){c=!0}void 0===document.documentElement.style.cssFloat&&(l="styleFloat")}var d={createMarkupForStyles:function(t,e){var n="";for(var r in t)if(t.hasOwnProperty(r)){var o=0===r.indexOf("--"),a=t[r];null!=a&&(n+=u(r)+":",n+=i(r,a,e,o)+";")}return n||null},setValueForStyles:function(t,e,n){var o=t.style;for(var a in e)if(e.hasOwnProperty(a)){var s=0===a.indexOf("--"),u=i(a,e[a],n,s);if("float"!==a&&"cssFloat"!==a||(a=l),s)o.setProperty(a,u);else if(u)o[a]=u;else{var p=c&&r.shorthandPropertyExpansions[a];if(p)for(var d in p)o[d]="";else o[a]=""}}}};t.exports=d},function(t,e,n){"use strict";function r(t,e,n){var r=z.getPooled(x.change,t,e,n);return r.type="change",I.accumulateTwoPhaseDispatches(r),r}function o(t){var e=t.nodeName&&t.nodeName.toLowerCase();return"select"===e||"input"===e&&"file"===t.type}function i(t){var e=r(O,t,C(t));v.batchedUpdates(a,e)}function a(t){j.enqueueEvents(t),j.processEventQueue(!1)}function s(t,e){k=t,O=e,k.attachEvent("onchange",i)}function u(){k&&(k.detachEvent("onchange",i),k=null,O=null)}function c(t,e){var n=b.updateValueIfChanged(t),r=!0===e.simulated&&U._allowSimulatedPassThrough;if(n||r)return t}function l(t,e){if("topChange"===t)return e}function p(t,e,n){"topFocus"===t?(u(),s(e,n)):"topBlur"===t&&u()}function d(t,e){k=t,O=e,k.attachEvent("onpropertychange",h)}function M(){k&&(k.detachEvent("onpropertychange",h),k=null,O=null)}function h(t){"value"===t.propertyName&&c(O,t)&&i(t)}function g(t,e,n){"topFocus"===t?(M(),d(e,n)):"topBlur"===t&&M()}function f(t,e,n){if("topSelectionChange"===t||"topKeyUp"===t||"topKeyDown"===t)return c(O,n)}function y(t){var e=t.nodeName;return e&&"input"===e.toLowerCase()&&("checkbox"===t.type||"radio"===t.type)}function N(t,e,n){if("topClick"===t)return c(e,n)}function m(t,e,n){if("topInput"===t||"topChange"===t)return c(e,n)}function D(t,e){if(null!=t){var n=t._wrapperState||e._wrapperState;if(n&&n.controlled&&"number"===e.type){var r=""+e.value;e.getAttribute("value")!==r&&e.setAttribute("value",r)}}}var j=n(42),I=n(43),w=n(13),L=n(9),v=n(22),z=n(25),b=n(141),C=n(93),T=n(94),E=n(143),x={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:["topBlur","topChange","topClick","topFocus","topInput","topKeyDown","topKeyUp","topSelectionChange"]}},k=null,O=null,S=!1;w.canUseDOM&&(S=T("change")&&(!document.documentMode||document.documentMode>8));var A=!1;w.canUseDOM&&(A=T("input")&&(!document.documentMode||document.documentMode>9));var U={eventTypes:x,_allowSimulatedPassThrough:!0,_isInputEventSupported:A,extractEvents:function(t,e,n,i){var a,s,u=e?L.getNodeFromInstance(e):window;if(o(u)?S?a=l:s=p:E(u)?A?a=m:(a=f,s=g):y(u)&&(a=N),a){var c=a(t,e,n);if(c){return r(c,n,i)}}s&&s(t,u,e),"topBlur"===t&&D(e,u)}};t.exports=U},function(t,e,n){"use strict";var r=n(5),o=n(35),i=n(13),a=n(233),s=n(21),u=(n(3),{dangerouslyReplaceNodeWithMarkup:function(t,e){if(i.canUseDOM||r("56"),e||r("57"),"HTML"===t.nodeName&&r("58"),"string"==typeof e){var n=a(e,s)[0];t.parentNode.replaceChild(n,t)}else o.replaceChildWithTree(t,e)}});t.exports=u},function(t,e,n){"use strict";var r=["ResponderEventPlugin","SimpleEventPlugin","TapEventPlugin","EnterLeaveEventPlugin","ChangeEventPlugin","SelectEventPlugin","BeforeInputEventPlugin"];t.exports=r},function(t,e,n){"use strict";var r=n(43),o=n(9),i=n(59),a={mouseEnter:{registrationName:"onMouseEnter",dependencies:["topMouseOut","topMouseOver"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["topMouseOut","topMouseOver"]}},s={eventTypes:a,extractEvents:function(t,e,n,s){if("topMouseOver"===t&&(n.relatedTarget||n.fromElement))return null;if("topMouseOut"!==t&&"topMouseOver"!==t)return null;var u;if(s.window===s)u=s;else{var c=s.ownerDocument;u=c?c.defaultView||c.parentWindow:window}var l,p;if("topMouseOut"===t){l=e;var d=n.relatedTarget||n.toElement;p=d?o.getClosestInstanceFromNode(d):null}else l=null,p=e;if(l===p)return null;var M=null==l?u:o.getNodeFromInstance(l),h=null==p?u:o.getNodeFromInstance(p),g=i.getPooled(a.mouseLeave,l,n,s);g.type="mouseleave",g.target=M,g.relatedTarget=h;var f=i.getPooled(a.mouseEnter,p,n,s);return f.type="mouseenter",f.target=h,f.relatedTarget=M,r.accumulateEnterLeaveDispatches(g,f,l,p),[g,f]}};t.exports=s},function(t,e,n){"use strict";function r(t){this._root=t,this._startText=this.getText(),this._fallbackText=null}var o=n(7),i=n(31),a=n(140);o(r.prototype,{destructor:function(){this._root=null,this._startText=null,this._fallbackText=null},getText:function(){return"value"in this._root?this._root.value:this._root[a()]},getData:function(){if(this._fallbackText)return this._fallbackText;var t,e,n=this._startText,r=n.length,o=this.getText(),i=o.length;for(t=0;t<r&&n[t]===o[t];t++);var a=r-t;for(e=1;e<=a&&n[r-e]===o[i-e];e++);var s=e>1?1-e:void 0;return this._fallbackText=o.slice(t,s),this._fallbackText}}),i.addPoolingTo(r),t.exports=r},function(t,e,n){"use strict";var r=n(36),o=r.injection.MUST_USE_PROPERTY,i=r.injection.HAS_BOOLEAN_VALUE,a=r.injection.HAS_NUMERIC_VALUE,s=r.injection.HAS_POSITIVE_NUMERIC_VALUE,u=r.injection.HAS_OVERLOADED_BOOLEAN_VALUE,c={isCustomAttribute:RegExp.prototype.test.bind(new RegExp("^(data|aria)-["+r.ATTRIBUTE_NAME_CHAR+"]*$")),Properties:{accept:0,acceptCharset:0,accessKey:0,action:0,allowFullScreen:i,allowTransparency:0,alt:0,as:0,async:i,autoComplete:0,autoPlay:i,capture:i,cellPadding:0,cellSpacing:0,charSet:0,challenge:0,checked:o|i,cite:0,classID:0,className:0,cols:s,colSpan:0,content:0,contentEditable:0,contextMenu:0,controls:i,controlsList:0,coords:0,crossOrigin:0,data:0,dateTime:0,default:i,defer:i,dir:0,disabled:i,download:u,draggable:0,encType:0,form:0,formAction:0,formEncType:0,formMethod:0,formNoValidate:i,formTarget:0,frameBorder:0,headers:0,height:0,hidden:i,high:0,href:0,hrefLang:0,htmlFor:0,httpEquiv:0,icon:0,id:0,inputMode:0,integrity:0,is:0,keyParams:0,keyType:0,kind:0,label:0,lang:0,list:0,loop:i,low:0,manifest:0,marginHeight:0,marginWidth:0,max:0,maxLength:0,media:0,mediaGroup:0,method:0,min:0,minLength:0,multiple:o|i,muted:o|i,name:0,nonce:0,noValidate:i,open:i,optimum:0,pattern:0,placeholder:0,playsInline:i,poster:0,preload:0,profile:0,radioGroup:0,readOnly:i,referrerPolicy:0,rel:0,required:i,reversed:i,role:0,rows:s,rowSpan:a,sandbox:0,scope:0,scoped:i,scrolling:0,seamless:i,selected:o|i,shape:0,size:s,sizes:0,span:s,spellCheck:0,src:0,srcDoc:0,srcLang:0,srcSet:0,start:a,step:0,style:0,summary:0,tabIndex:0,target:0,title:0,type:0,useMap:0,value:0,width:0,wmode:0,wrap:0,about:0,datatype:0,inlist:0,prefix:0,property:0,resource:0,typeof:0,vocab:0,autoCapitalize:0,autoCorrect:0,autoSave:0,color:0,itemProp:0,itemScope:i,itemType:0,itemID:0,itemRef:0,results:0,security:0,unselectable:0},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMPropertyNames:{},DOMMutationMethods:{value:function(t,e){if(null==e)return t.removeAttribute("value");"number"!==t.type||!1===t.hasAttribute("value")?t.setAttribute("value",""+e):t.validity&&!t.validity.badInput&&t.ownerDocument.activeElement!==t&&t.setAttribute("value",""+e)}}};t.exports=c},function(t,e,n){"use strict";(function(e){function r(t,e,n,r){var o=void 0===t[n];null!=e&&o&&(t[n]=i(e,!0))}var o=n(37),i=n(142),a=(n(85),n(95)),s=n(145);n(6);void 0!==e&&n.i({NODE_ENV:"production"});var u={instantiateChildren:function(t,e,n,o){if(null==t)return null;var i={};return s(t,r,i),i},updateChildren:function(t,e,n,r,s,u,c,l,p){if(e||t){var d,M;for(d in e)if(e.hasOwnProperty(d)){M=t&&t[d];var h=M&&M._currentElement,g=e[d];if(null!=M&&a(h,g))o.receiveComponent(M,g,s,l),e[d]=M;else{M&&(r[d]=o.getHostNode(M),o.unmountComponent(M,!1));var f=i(g,!0);e[d]=f;var y=o.mountComponent(f,s,u,c,l,p);n.push(y)}}for(d in t)!t.hasOwnProperty(d)||e&&e.hasOwnProperty(d)||(M=t[d],r[d]=o.getHostNode(M),o.unmountComponent(M,!1))}},unmountChildren:function(t,e){for(var n in t)if(t.hasOwnProperty(n)){var r=t[n];o.unmountComponent(r,e)}}};t.exports=u}).call(e,n(41))},function(t,e,n){"use strict";var r=n(81),o=n(274),i={processChildrenUpdates:o.dangerouslyProcessChildrenUpdates,replaceNodeWithMarkup:r.dangerouslyReplaceNodeWithMarkup};t.exports=i},function(t,e,n){"use strict";function r(t){}function o(t){return!(!t.prototype||!t.prototype.isReactComponent)}function i(t){return!(!t.prototype||!t.prototype.isPureReactComponent)}var a=n(5),s=n(7),u=n(38),c=n(87),l=n(26),p=n(88),d=n(44),M=(n(18),n(135)),h=n(37),g=n(75),f=(n(3),n(76)),y=n(95),N=(n(6),{ImpureClass:0,PureClass:1,StatelessFunctional:2});r.prototype.render=function(){var t=d.get(this)._currentElement.type,e=t(this.props,this.context,this.updater);return e};var m=1,D={construct:function(t){this._currentElement=t,this._rootNodeID=0,this._compositeType=null,this._instance=null,this._hostParent=null,this._hostContainerInfo=null,this._updateBatchNumber=null,this._pendingElement=null,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._renderedNodeType=null,this._renderedComponent=null,this._context=null,this._mountOrder=0,this._topLevelWrapper=null,this._pendingCallbacks=null,this._calledComponentWillUnmount=!1},mountComponent:function(t,e,n,s){this._context=s,this._mountOrder=m++,this._hostParent=e,this._hostContainerInfo=n;var c,l=this._currentElement.props,p=this._processContext(s),M=this._currentElement.type,h=t.getUpdateQueue(),f=o(M),y=this._constructComponent(f,l,p,h);f||null!=y&&null!=y.render?i(M)?this._compositeType=N.PureClass:this._compositeType=N.ImpureClass:(c=y,null===y||!1===y||u.isValidElement(y)||a("105",M.displayName||M.name||"Component"),y=new r(M),this._compositeType=N.StatelessFunctional);y.props=l,y.context=p,y.refs=g,y.updater=h,this._instance=y,d.set(y,this);var D=y.state;void 0===D&&(y.state=D=null),("object"!=typeof D||Array.isArray(D))&&a("106",this.getName()||"ReactCompositeComponent"),this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1;var j;return j=y.unstable_handleError?this.performInitialMountWithErrorHandling(c,e,n,t,s):this.performInitialMount(c,e,n,t,s),y.componentDidMount&&t.getReactMountReady().enqueue(y.componentDidMount,y),j},_constructComponent:function(t,e,n,r){return this._constructComponentWithoutOwner(t,e,n,r)},_constructComponentWithoutOwner:function(t,e,n,r){var o=this._currentElement.type;return t?new o(e,n,r):o(e,n,r)},performInitialMountWithErrorHandling:function(t,e,n,r,o){var i,a=r.checkpoint();try{i=this.performInitialMount(t,e,n,r,o)}catch(s){r.rollback(a),this._instance.unstable_handleError(s),this._pendingStateQueue&&(this._instance.state=this._processPendingState(this._instance.props,this._instance.context)),a=r.checkpoint(),this._renderedComponent.unmountComponent(!0),r.rollback(a),i=this.performInitialMount(t,e,n,r,o)}return i},performInitialMount:function(t,e,n,r,o){var i=this._instance,a=0;i.componentWillMount&&(i.componentWillMount(),this._pendingStateQueue&&(i.state=this._processPendingState(i.props,i.context))),void 0===t&&(t=this._renderValidatedComponent());var s=M.getType(t);this._renderedNodeType=s;var u=this._instantiateReactComponent(t,s!==M.EMPTY);this._renderedComponent=u;var c=h.mountComponent(u,r,e,n,this._processChildContext(o),a);return c},getHostNode:function(){return h.getHostNode(this._renderedComponent)},unmountComponent:function(t){if(this._renderedComponent){var e=this._instance;if(e.componentWillUnmount&&!e._calledComponentWillUnmount)if(e._calledComponentWillUnmount=!0,t){var n=this.getName()+".componentWillUnmount()";p.invokeGuardedCallback(n,e.componentWillUnmount.bind(e))}else e.componentWillUnmount();this._renderedComponent&&(h.unmountComponent(this._renderedComponent,t),this._renderedNodeType=null,this._renderedComponent=null,this._instance=null),this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._pendingCallbacks=null,this._pendingElement=null,this._context=null,this._rootNodeID=0,this._topLevelWrapper=null,d.remove(e)}},_maskContext:function(t){var e=this._currentElement.type,n=e.contextTypes;if(!n)return g;var r={};for(var o in n)r[o]=t[o];return r},_processContext:function(t){var e=this._maskContext(t);return e},_processChildContext:function(t){var e,n=this._currentElement.type,r=this._instance;if(r.getChildContext&&(e=r.getChildContext()),e){"object"!=typeof n.childContextTypes&&a("107",this.getName()||"ReactCompositeComponent");for(var o in e)o in n.childContextTypes||a("108",this.getName()||"ReactCompositeComponent",o);return s({},t,e)}return t},_checkContextTypes:function(t,e,n){},receiveComponent:function(t,e,n){var r=this._currentElement,o=this._context;this._pendingElement=null,this.updateComponent(e,r,t,o,n)},performUpdateIfNecessary:function(t){null!=this._pendingElement?h.receiveComponent(this,this._pendingElement,t,this._context):null!==this._pendingStateQueue||this._pendingForceUpdate?this.updateComponent(t,this._currentElement,this._currentElement,this._context,this._context):this._updateBatchNumber=null},updateComponent:function(t,e,n,r,o){var i=this._instance;null==i&&a("136",this.getName()||"ReactCompositeComponent");var s,u=!1;this._context===o?s=i.context:(s=this._processContext(o),u=!0);var c=e.props,l=n.props;e!==n&&(u=!0),u&&i.componentWillReceiveProps&&i.componentWillReceiveProps(l,s);var p=this._processPendingState(l,s),d=!0;this._pendingForceUpdate||(i.shouldComponentUpdate?d=i.shouldComponentUpdate(l,p,s):this._compositeType===N.PureClass&&(d=!f(c,l)||!f(i.state,p))),this._updateBatchNumber=null,d?(this._pendingForceUpdate=!1,this._performComponentUpdate(n,l,p,s,t,o)):(this._currentElement=n,this._context=o,i.props=l,i.state=p,i.context=s)},_processPendingState:function(t,e){var n=this._instance,r=this._pendingStateQueue,o=this._pendingReplaceState;if(this._pendingReplaceState=!1,this._pendingStateQueue=null,!r)return n.state;if(o&&1===r.length)return r[0];for(var i=s({},o?r[0]:n.state),a=o?1:0;a<r.length;a++){var u=r[a];s(i,"function"==typeof u?u.call(n,i,t,e):u)}return i},_performComponentUpdate:function(t,e,n,r,o,i){var a,s,u,c=this._instance,l=Boolean(c.componentDidUpdate);l&&(a=c.props,s=c.state,u=c.context),c.componentWillUpdate&&c.componentWillUpdate(e,n,r),this._currentElement=t,this._context=i,c.props=e,c.state=n,c.context=r,this._updateRenderedComponent(o,i),l&&o.getReactMountReady().enqueue(c.componentDidUpdate.bind(c,a,s,u),c)},_updateRenderedComponent:function(t,e){var n=this._renderedComponent,r=n._currentElement,o=this._renderValidatedComponent(),i=0;if(y(r,o))h.receiveComponent(n,o,t,this._processChildContext(e));else{var a=h.getHostNode(n);h.unmountComponent(n,!1);var s=M.getType(o);this._renderedNodeType=s;var u=this._instantiateReactComponent(o,s!==M.EMPTY);this._renderedComponent=u;var c=h.mountComponent(u,t,this._hostParent,this._hostContainerInfo,this._processChildContext(e),i);this._replaceNodeWithMarkup(a,c,n)}},_replaceNodeWithMarkup:function(t,e,n){c.replaceNodeWithMarkup(t,e,n)},_renderValidatedComponentWithoutOwnerOrContext:function(){var t=this._instance;return t.render()},_renderValidatedComponent:function(){var t;if(this._compositeType!==N.StatelessFunctional){l.current=this;try{t=this._renderValidatedComponentWithoutOwnerOrContext()}finally{l.current=null}}else t=this._renderValidatedComponentWithoutOwnerOrContext();return null===t||!1===t||u.isValidElement(t)||a("109",this.getName()||"ReactCompositeComponent"),t},attachRef:function(t,e){var n=this.getPublicInstance();null==n&&a("110");var r=e.getPublicInstance();(n.refs===g?n.refs={}:n.refs)[t]=r},detachRef:function(t){delete this.getPublicInstance().refs[t]},getName:function(){var t=this._currentElement.type,e=this._instance&&this._instance.constructor;return t.displayName||e&&e.displayName||t.name||e&&e.name||null},getPublicInstance:function(){var t=this._instance;return this._compositeType===N.StatelessFunctional?null:t},_instantiateReactComponent:null};t.exports=D},function(t,e,n){"use strict";var r=n(9),o=n(282),i=n(134),a=n(37),s=n(22),u=n(295),c=n(311),l=n(139),p=n(318);n(6);o.inject();var d={findDOMNode:c,render:i.render,unmountComponentAtNode:i.unmountComponentAtNode,version:u,unstable_batchedUpdates:s.batchedUpdates,unstable_renderSubtreeIntoContainer:p};"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ComponentTree:{getClosestInstanceFromNode:r.getClosestInstanceFromNode,getNodeFromInstance:function(t){return t._renderedComponent&&(t=l(t)),t?r.getNodeFromInstance(t):null}},Mount:i,Reconciler:a});t.exports=d},function(t,e,n){"use strict";function r(t){if(t){var e=t._currentElement._owner||null;if(e){var n=e.getName();if(n)return" This DOM node was rendered by `"+n+"`."}}return""}function o(t,e){e&&(J[t._tag]&&(null!=e.children||null!=e.dangerouslySetInnerHTML)&&f("137",t._tag,t._currentElement._owner?" Check the render method of "+t._currentElement._owner.getName()+".":""),null!=e.dangerouslySetInnerHTML&&(null!=e.children&&f("60"),"object"==typeof e.dangerouslySetInnerHTML&&G in e.dangerouslySetInnerHTML||f("61")),null!=e.style&&"object"!=typeof e.style&&f("62",r(t)))}function i(t,e,n,r){if(!(r instanceof S)){var o=t._hostContainerInfo,i=o._node&&o._node.nodeType===H,s=i?o._node:o._ownerDocument;P(e,s),r.getReactMountReady().enqueue(a,{inst:t,registrationName:e,listener:n})}}function a(){var t=this;L.putListener(t.inst,t.registrationName,t.listener)}function s(){var t=this;T.postMountWrapper(t)}function u(){var t=this;k.postMountWrapper(t)}function c(){var t=this;E.postMountWrapper(t)}function l(){U.track(this)}function p(){var t=this;t._rootNodeID||f("63");var e=Q(t);switch(e||f("64"),t._tag){case"iframe":case"object":t._wrapperState.listeners=[z.trapBubbledEvent("topLoad","load",e)];break;case"video":case"audio":t._wrapperState.listeners=[];for(var n in W)W.hasOwnProperty(n)&&t._wrapperState.listeners.push(z.trapBubbledEvent(n,W[n],e));break;case"source":t._wrapperState.listeners=[z.trapBubbledEvent("topError","error",e)];break;case"img":t._wrapperState.listeners=[z.trapBubbledEvent("topError","error",e),z.trapBubbledEvent("topLoad","load",e)];break;case"form":t._wrapperState.listeners=[z.trapBubbledEvent("topReset","reset",e),z.trapBubbledEvent("topSubmit","submit",e)];break;case"input":case"select":case"textarea":t._wrapperState.listeners=[z.trapBubbledEvent("topInvalid","invalid",e)]}}function d(){x.postUpdateWrapper(this)}function M(t){K.call(X,t)||(q.test(t)||f("65",t),X[t]=!0)}function h(t,e){return t.indexOf("-")>=0||null!=e.is}function g(t){var e=t.type;M(e),this._currentElement=t,this._tag=e.toLowerCase(),this._namespaceURI=null,this._renderedChildren=null,this._previousStyle=null,this._previousStyleCopy=null,this._hostNode=null,this._hostParent=null,this._rootNodeID=0,this._domID=0,this._hostContainerInfo=null,this._wrapperState=null,this._topLevelWrapper=null,this._flags=0}var f=n(5),y=n(7),N=n(257),m=n(259),D=n(35),j=n(82),I=n(36),w=n(127),L=n(42),v=n(83),z=n(58),b=n(128),C=n(9),T=n(275),E=n(276),x=n(129),k=n(279),O=(n(18),n(288)),S=n(293),A=(n(21),n(61)),U=(n(3),n(94),n(76),n(141)),_=(n(96),n(6),b),Y=L.deleteListener,Q=C.getNodeFromInstance,P=z.listenTo,B=v.registrationNameModules,R={string:!0,number:!0},G="__html",Z={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null},H=11,W={topAbort:"abort",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topSeeked:"seeked",topSeeking:"seeking",topStalled:"stalled",topSuspend:"suspend",topTimeUpdate:"timeupdate",topVolumeChange:"volumechange",topWaiting:"waiting"},V={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},F={listing:!0,pre:!0,textarea:!0},J=y({menuitem:!0},V),q=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,X={},K={}.hasOwnProperty,$=1;g.displayName="ReactDOMComponent",g.Mixin={mountComponent:function(t,e,n,r){this._rootNodeID=$++,this._domID=n._idCounter++,this._hostParent=e,this._hostContainerInfo=n;var i=this._currentElement.props;switch(this._tag){case"audio":case"form":case"iframe":case"img":case"link":case"object":case"source":case"video":this._wrapperState={listeners:null},t.getReactMountReady().enqueue(p,this);break;case"input":T.mountWrapper(this,i,e),i=T.getHostProps(this,i),t.getReactMountReady().enqueue(l,this),t.getReactMountReady().enqueue(p,this);break;case"option":E.mountWrapper(this,i,e),i=E.getHostProps(this,i);break;case"select":x.mountWrapper(this,i,e),i=x.getHostProps(this,i),t.getReactMountReady().enqueue(p,this);break;case"textarea":k.mountWrapper(this,i,e),i=k.getHostProps(this,i),t.getReactMountReady().enqueue(l,this),t.getReactMountReady().enqueue(p,this)}o(this,i);var a,d;null!=e?(a=e._namespaceURI,d=e._tag):n._tag&&(a=n._namespaceURI,d=n._tag),(null==a||a===j.svg&&"foreignobject"===d)&&(a=j.html),a===j.html&&("svg"===this._tag?a=j.svg:"math"===this._tag&&(a=j.mathml)),this._namespaceURI=a;var M;if(t.useCreateElement){var h,g=n._ownerDocument;if(a===j.html)if("script"===this._tag){var f=g.createElement("div"),y=this._currentElement.type;f.innerHTML="<"+y+"></"+y+">",h=f.removeChild(f.firstChild)}else h=i.is?g.createElement(this._currentElement.type,i.is):g.createElement(this._currentElement.type);else h=g.createElementNS(a,this._currentElement.type);C.precacheNode(this,h),this._flags|=_.hasCachedChildNodes,this._hostParent||w.setAttributeForRoot(h),this._updateDOMProperties(null,i,t);var m=D(h);this._createInitialChildren(t,i,r,m),M=m}else{var I=this._createOpenTagMarkupAndPutListeners(t,i),L=this._createContentMarkup(t,i,r);M=!L&&V[this._tag]?I+"/>":I+">"+L+"</"+this._currentElement.type+">"}switch(this._tag){case"input":t.getReactMountReady().enqueue(s,this),i.autoFocus&&t.getReactMountReady().enqueue(N.focusDOMComponent,this);break;case"textarea":t.getReactMountReady().enqueue(u,this),i.autoFocus&&t.getReactMountReady().enqueue(N.focusDOMComponent,this);break;case"select":case"button":i.autoFocus&&t.getReactMountReady().enqueue(N.focusDOMComponent,this);break;case"option":t.getReactMountReady().enqueue(c,this)}return M},_createOpenTagMarkupAndPutListeners:function(t,e){var n="<"+this._currentElement.type;for(var r in e)if(e.hasOwnProperty(r)){var o=e[r];if(null!=o)if(B.hasOwnProperty(r))o&&i(this,r,o,t);else{"style"===r&&(o&&(o=this._previousStyleCopy=y({},e.style)),o=m.createMarkupForStyles(o,this));var a=null;null!=this._tag&&h(this._tag,e)?Z.hasOwnProperty(r)||(a=w.createMarkupForCustomAttribute(r,o)):a=w.createMarkupForProperty(r,o),a&&(n+=" "+a)}}return t.renderToStaticMarkup?n:(this._hostParent||(n+=" "+w.createMarkupForRoot()),n+=" "+w.createMarkupForID(this._domID))},_createContentMarkup:function(t,e,n){var r="",o=e.dangerouslySetInnerHTML;if(null!=o)null!=o.__html&&(r=o.__html);else{var i=R[typeof e.children]?e.children:null,a=null!=i?null:e.children;if(null!=i)r=A(i);else if(null!=a){var s=this.mountChildren(a,t,n);r=s.join("")}}return F[this._tag]&&"\n"===r.charAt(0)?"\n"+r:r},_createInitialChildren:function(t,e,n,r){var o=e.dangerouslySetInnerHTML;if(null!=o)null!=o.__html&&D.queueHTML(r,o.__html);else{var i=R[typeof e.children]?e.children:null,a=null!=i?null:e.children;if(null!=i)""!==i&&D.queueText(r,i);else if(null!=a)for(var s=this.mountChildren(a,t,n),u=0;u<s.length;u++)D.queueChild(r,s[u])}},receiveComponent:function(t,e,n){var r=this._currentElement;this._currentElement=t,this.updateComponent(e,r,t,n)},updateComponent:function(t,e,n,r){var i=e.props,a=this._currentElement.props;switch(this._tag){case"input":i=T.getHostProps(this,i),a=T.getHostProps(this,a);break;case"option":i=E.getHostProps(this,i),a=E.getHostProps(this,a);break;case"select":i=x.getHostProps(this,i),a=x.getHostProps(this,a);break;case"textarea":i=k.getHostProps(this,i),a=k.getHostProps(this,a)}switch(o(this,a),this._updateDOMProperties(i,a,t),this._updateDOMChildren(i,a,t,r),this._tag){case"input":T.updateWrapper(this),U.updateValueIfChanged(this);break;case"textarea":k.updateWrapper(this);break;case"select":t.getReactMountReady().enqueue(d,this)}},_updateDOMProperties:function(t,e,n){var r,o,a;for(r in t)if(!e.hasOwnProperty(r)&&t.hasOwnProperty(r)&&null!=t[r])if("style"===r){var s=this._previousStyleCopy;for(o in s)s.hasOwnProperty(o)&&(a=a||{},a[o]="");this._previousStyleCopy=null}else B.hasOwnProperty(r)?t[r]&&Y(this,r):h(this._tag,t)?Z.hasOwnProperty(r)||w.deleteValueForAttribute(Q(this),r):(I.properties[r]||I.isCustomAttribute(r))&&w.deleteValueForProperty(Q(this),r);for(r in e){var u=e[r],c="style"===r?this._previousStyleCopy:null!=t?t[r]:void 0;if(e.hasOwnProperty(r)&&u!==c&&(null!=u||null!=c))if("style"===r)if(u?u=this._previousStyleCopy=y({},u):this._previousStyleCopy=null,c){for(o in c)!c.hasOwnProperty(o)||u&&u.hasOwnProperty(o)||(a=a||{},a[o]="");for(o in u)u.hasOwnProperty(o)&&c[o]!==u[o]&&(a=a||{},a[o]=u[o])}else a=u;else if(B.hasOwnProperty(r))u?i(this,r,u,n):c&&Y(this,r);else if(h(this._tag,e))Z.hasOwnProperty(r)||w.setValueForAttribute(Q(this),r,u);else if(I.properties[r]||I.isCustomAttribute(r)){var l=Q(this);null!=u?w.setValueForProperty(l,r,u):w.deleteValueForProperty(l,r)}}a&&m.setValueForStyles(Q(this),a,this)},_updateDOMChildren:function(t,e,n,r){var o=R[typeof t.children]?t.children:null,i=R[typeof e.children]?e.children:null,a=t.dangerouslySetInnerHTML&&t.dangerouslySetInnerHTML.__html,s=e.dangerouslySetInnerHTML&&e.dangerouslySetInnerHTML.__html,u=null!=o?null:t.children,c=null!=i?null:e.children,l=null!=o||null!=a,p=null!=i||null!=s;null!=u&&null==c?this.updateChildren(null,n,r):l&&!p&&this.updateTextContent(""),null!=i?o!==i&&this.updateTextContent(""+i):null!=s?a!==s&&this.updateMarkup(""+s):null!=c&&this.updateChildren(c,n,r)},getHostNode:function(){return Q(this)},unmountComponent:function(t){switch(this._tag){case"audio":case"form":case"iframe":case"img":case"link":case"object":case"source":case"video":var e=this._wrapperState.listeners;if(e)for(var n=0;n<e.length;n++)e[n].remove();break;case"input":case"textarea":U.stopTracking(this);break;case"html":case"head":case"body":f("66",this._tag)}this.unmountChildren(t),C.uncacheNode(this),L.deleteAllListeners(this),this._rootNodeID=0,this._domID=0,this._wrapperState=null},getPublicInstance:function(){return Q(this)}},y(g.prototype,g.Mixin,O.Mixin),t.exports=g},function(t,e,n){"use strict";function r(t,e){var n={_topLevelWrapper:t,_idCounter:1,_ownerDocument:e?e.nodeType===o?e:e.ownerDocument:null,_node:e,_tag:e?e.nodeName.toLowerCase():null,_namespaceURI:e?e.namespaceURI:null};return n}var o=(n(96),9);t.exports=r},function(t,e,n){"use strict";var r=n(7),o=n(35),i=n(9),a=function(t){this._currentElement=null,this._hostNode=null,this._hostParent=null,this._hostContainerInfo=null,this._domID=0};r(a.prototype,{mountComponent:function(t,e,n,r){var a=n._idCounter++;this._domID=a,this._hostParent=e,this._hostContainerInfo=n;var s=" react-empty: "+this._domID+" ";if(t.useCreateElement){var u=n._ownerDocument,c=u.createComment(s);return i.precacheNode(this,c),o(c)}return t.renderToStaticMarkup?"":"\x3c!--"+s+"--\x3e"},receiveComponent:function(){},getHostNode:function(){return i.getNodeFromInstance(this)},unmountComponent:function(){i.uncacheNode(this)}}),t.exports=a},function(t,e,n){"use strict";var r={useCreateElement:!0,useFiber:!1};t.exports=r},function(t,e,n){"use strict";var r=n(81),o=n(9),i={dangerouslyProcessChildrenUpdates:function(t,e){var n=o.getNodeFromInstance(t);r.processUpdates(n,e)}};t.exports=i},function(t,e,n){"use strict";function r(){this._rootNodeID&&d.updateWrapper(this)}function o(t){return"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}function i(t){var e=this._currentElement.props,n=c.executeOnChange(e,t);p.asap(r,this);var o=e.name;if("radio"===e.type&&null!=o){for(var i=l.getNodeFromInstance(this),s=i;s.parentNode;)s=s.parentNode;for(var u=s.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),d=0;d<u.length;d++){var M=u[d];if(M!==i&&M.form===i.form){var h=l.getInstanceFromNode(M);h||a("90"),p.asap(r,h)}}}return n}var a=n(5),s=n(7),u=n(127),c=n(86),l=n(9),p=n(22),d=(n(3),n(6),{getHostProps:function(t,e){var n=c.getValue(e),r=c.getChecked(e);return s({type:void 0,step:void 0,min:void 0,max:void 0},e,{defaultChecked:void 0,defaultValue:void 0,value:null!=n?n:t._wrapperState.initialValue,checked:null!=r?r:t._wrapperState.initialChecked,onChange:t._wrapperState.onChange})},mountWrapper:function(t,e){var n=e.defaultValue;t._wrapperState={initialChecked:null!=e.checked?e.checked:e.defaultChecked,initialValue:null!=e.value?e.value:n,listeners:null,onChange:i.bind(t),controlled:o(e)}},updateWrapper:function(t){var e=t._currentElement.props,n=e.checked;null!=n&&u.setValueForProperty(l.getNodeFromInstance(t),"checked",n||!1);var r=l.getNodeFromInstance(t),o=c.getValue(e);if(null!=o)if(0===o&&""===r.value)r.value="0";else if("number"===e.type){var i=parseFloat(r.value,10)||0;(o!=i||o==i&&r.value!=o)&&(r.value=""+o)}else r.value!==""+o&&(r.value=""+o);else null==e.value&&null!=e.defaultValue&&r.defaultValue!==""+e.defaultValue&&(r.defaultValue=""+e.defaultValue),null==e.checked&&null!=e.defaultChecked&&(r.defaultChecked=!!e.defaultChecked)},postMountWrapper:function(t){var e=t._currentElement.props,n=l.getNodeFromInstance(t);switch(e.type){case"submit":case"reset":break;case"color":case"date":case"datetime":case"datetime-local":case"month":case"time":case"week":n.value="",n.value=n.defaultValue;break;default:n.value=n.value}var r=n.name;""!==r&&(n.name=""),n.defaultChecked=!n.defaultChecked,n.defaultChecked=!n.defaultChecked,""!==r&&(n.name=r)}});t.exports=d},function(t,e,n){"use strict";function r(t){var e="";return i.Children.forEach(t,function(t){null!=t&&("string"==typeof t||"number"==typeof t?e+=t:u||(u=!0))}),e}var o=n(7),i=n(38),a=n(9),s=n(129),u=(n(6),!1),c={mountWrapper:function(t,e,n){var o=null;if(null!=n){var i=n;"optgroup"===i._tag&&(i=i._hostParent),null!=i&&"select"===i._tag&&(o=s.getSelectValueContext(i))}var a=null;if(null!=o){var u;if(u=null!=e.value?e.value+"":r(e.children),a=!1,Array.isArray(o)){for(var c=0;c<o.length;c++)if(""+o[c]===u){a=!0;break}}else a=""+o===u}t._wrapperState={selected:a}},postMountWrapper:function(t){var e=t._currentElement.props;if(null!=e.value){a.getNodeFromInstance(t).setAttribute("value",e.value)}},getHostProps:function(t,e){var n=o({selected:void 0,children:void 0},e);null!=t._wrapperState.selected&&(n.selected=t._wrapperState.selected);var i=r(e.children);return i&&(n.children=i),n}};t.exports=c},function(t,e,n){"use strict";function r(t,e,n,r){return t===n&&e===r}function o(t){var e=document.selection,n=e.createRange(),r=n.text.length,o=n.duplicate();o.moveToElementText(t),o.setEndPoint("EndToStart",n);var i=o.text.length;return{start:i,end:i+r}}function i(t){var e=window.getSelection&&window.getSelection();if(!e||0===e.rangeCount)return null;var n=e.anchorNode,o=e.anchorOffset,i=e.focusNode,a=e.focusOffset,s=e.getRangeAt(0);try{s.startContainer.nodeType,s.endContainer.nodeType}catch(t){return null}var u=r(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset),c=u?0:s.toString().length,l=s.cloneRange();l.selectNodeContents(t),l.setEnd(s.startContainer,s.startOffset);var p=r(l.startContainer,l.startOffset,l.endContainer,l.endOffset),d=p?0:l.toString().length,M=d+c,h=document.createRange();h.setStart(n,o),h.setEnd(i,a);var g=h.collapsed;return{start:g?M:d,end:g?d:M}}function a(t,e){var n,r,o=document.selection.createRange().duplicate();void 0===e.end?(n=e.start,r=n):e.start>e.end?(n=e.end,r=e.start):(n=e.start,r=e.end),o.moveToElementText(t),o.moveStart("character",n),o.setEndPoint("EndToStart",o),o.moveEnd("character",r-n),o.select()}function s(t,e){if(window.getSelection){var n=window.getSelection(),r=t[l()].length,o=Math.min(e.start,r),i=void 0===e.end?o:Math.min(e.end,r);if(!n.extend&&o>i){var a=i;i=o,o=a}var s=c(t,o),u=c(t,i);if(s&&u){var p=document.createRange();p.setStart(s.node,s.offset),n.removeAllRanges(),o>i?(n.addRange(p),n.extend(u.node,u.offset)):(p.setEnd(u.node,u.offset),n.addRange(p))}}}var u=n(13),c=n(315),l=n(140),p=u.canUseDOM&&"selection"in document&&!("getSelection"in window),d={getOffsets:p?o:i,setOffsets:p?a:s};t.exports=d},function(t,e,n){"use strict";var r=n(5),o=n(7),i=n(81),a=n(35),s=n(9),u=n(61),c=(n(3),n(96),function(t){this._currentElement=t,this._stringText=""+t,this._hostNode=null,this._hostParent=null,this._domID=0,this._mountIndex=0,this._closingComment=null,this._commentNodes=null});o(c.prototype,{mountComponent:function(t,e,n,r){var o=n._idCounter++,i=" react-text: "+o+" ";if(this._domID=o,this._hostParent=e,t.useCreateElement){var c=n._ownerDocument,l=c.createComment(i),p=c.createComment(" /react-text "),d=a(c.createDocumentFragment());return a.queueChild(d,a(l)),this._stringText&&a.queueChild(d,a(c.createTextNode(this._stringText))),a.queueChild(d,a(p)),s.precacheNode(this,l),this._closingComment=p,d}var M=u(this._stringText);return t.renderToStaticMarkup?M:"\x3c!--"+i+"--\x3e"+M+"\x3c!-- /react-text --\x3e"},receiveComponent:function(t,e){if(t!==this._currentElement){this._currentElement=t;var n=""+t;if(n!==this._stringText){this._stringText=n;var r=this.getHostNode();i.replaceDelimitedText(r[0],r[1],n)}}},getHostNode:function(){var t=this._commentNodes;if(t)return t;if(!this._closingComment)for(var e=s.getNodeFromInstance(this),n=e.nextSibling;;){if(null==n&&r("67",this._domID),8===n.nodeType&&" /react-text "===n.nodeValue){this._closingComment=n;break}n=n.nextSibling}return t=[this._hostNode,this._closingComment],this._commentNodes=t,t},unmountComponent:function(){this._closingComment=null,this._commentNodes=null,s.uncacheNode(this)}}),t.exports=c},function(t,e,n){"use strict";function r(){this._rootNodeID&&l.updateWrapper(this)}function o(t){var e=this._currentElement.props,n=s.executeOnChange(e,t);return c.asap(r,this),n}var i=n(5),a=n(7),s=n(86),u=n(9),c=n(22),l=(n(3),n(6),{getHostProps:function(t,e){return null!=e.dangerouslySetInnerHTML&&i("91"),a({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue,onChange:t._wrapperState.onChange})},mountWrapper:function(t,e){var n=s.getValue(e),r=n;if(null==n){var a=e.defaultValue,u=e.children;null!=u&&(null!=a&&i("92"),Array.isArray(u)&&(u.length<=1||i("93"),u=u[0]),a=""+u),null==a&&(a=""),r=a}t._wrapperState={initialValue:""+r,listeners:null,onChange:o.bind(t)}},updateWrapper:function(t){var e=t._currentElement.props,n=u.getNodeFromInstance(t),r=s.getValue(e);if(null!=r){var o=""+r;o!==n.value&&(n.value=o),null==e.defaultValue&&(n.defaultValue=o)}null!=e.defaultValue&&(n.defaultValue=e.defaultValue)},postMountWrapper:function(t){var e=u.getNodeFromInstance(t),n=e.textContent;n===t._wrapperState.initialValue&&(e.value=n)}});t.exports=l},function(t,e,n){"use strict";function r(t,e){"_hostNode"in t||u("33"),"_hostNode"in e||u("33");for(var n=0,r=t;r;r=r._hostParent)n++;for(var o=0,i=e;i;i=i._hostParent)o++;for(;n-o>0;)t=t._hostParent,n--;for(;o-n>0;)e=e._hostParent,o--;for(var a=n;a--;){if(t===e)return t;t=t._hostParent,e=e._hostParent}return null}function o(t,e){"_hostNode"in t||u("35"),"_hostNode"in e||u("35");for(;e;){if(e===t)return!0;e=e._hostParent}return!1}function i(t){return"_hostNode"in t||u("36"),t._hostParent}function a(t,e,n){for(var r=[];t;)r.push(t),t=t._hostParent;var o;for(o=r.length;o-- >0;)e(r[o],"captured",n);for(o=0;o<r.length;o++)e(r[o],"bubbled",n)}function s(t,e,n,o,i){for(var a=t&&e?r(t,e):null,s=[];t&&t!==a;)s.push(t),t=t._hostParent;for(var u=[];e&&e!==a;)u.push(e),e=e._hostParent;var c;for(c=0;c<s.length;c++)n(s[c],"bubbled",o);for(c=u.length;c-- >0;)n(u[c],"captured",i)}var u=n(5);n(3);t.exports={isAncestor:o,getLowestCommonAncestor:r,getParentInstance:i,traverseTwoPhase:a,traverseEnterLeave:s}},function(t,e,n){"use strict";function r(){this.reinitializeTransaction()}var o=n(7),i=n(22),a=n(60),s=n(21),u={initialize:s,close:function(){d.isBatchingUpdates=!1}},c={initialize:s,close:i.flushBatchedUpdates.bind(i)},l=[c,u];o(r.prototype,a,{getTransactionWrappers:function(){return l}});var p=new r,d={isBatchingUpdates:!1,batchedUpdates:function(t,e,n,r,o,i){var a=d.isBatchingUpdates;return d.isBatchingUpdates=!0,a?t(e,n,r,o,i):p.perform(t,null,e,n,r,o,i)}};t.exports=d},function(t,e,n){"use strict";function r(){w||(w=!0,N.EventEmitter.injectReactEventListener(y),N.EventPluginHub.injectEventPluginOrder(s),N.EventPluginUtils.injectComponentTree(d),N.EventPluginUtils.injectTreeTraversal(h),N.EventPluginHub.injectEventPluginsByName({SimpleEventPlugin:I,EnterLeaveEventPlugin:u,ChangeEventPlugin:a,SelectEventPlugin:j,BeforeInputEventPlugin:i}),N.HostComponent.injectGenericComponentClass(p),N.HostComponent.injectTextComponentClass(g),N.DOMProperty.injectDOMPropertyConfig(o),N.DOMProperty.injectDOMPropertyConfig(c),N.DOMProperty.injectDOMPropertyConfig(D),N.EmptyComponent.injectEmptyComponentFactory(function(t){return new M(t)}),N.Updates.injectReconcileTransaction(m),N.Updates.injectBatchingStrategy(f),N.Component.injectEnvironment(l))}var o=n(256),i=n(258),a=n(260),s=n(262),u=n(263),c=n(265),l=n(267),p=n(270),d=n(9),M=n(272),h=n(280),g=n(278),f=n(281),y=n(285),N=n(286),m=n(291),D=n(296),j=n(297),I=n(298),w=!1;t.exports={inject:r}},function(t,e,n){"use strict";var r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;t.exports=r},function(t,e,n){"use strict";function r(t){o.enqueueEvents(t),o.processEventQueue(!1)}var o=n(42),i={handleTopLevel:function(t,e,n,i){r(o.extractEvents(t,e,n,i))}};t.exports=i},function(t,e,n){"use strict";function r(t){for(;t._hostParent;)t=t._hostParent;var e=p.getNodeFromInstance(t),n=e.parentNode;return p.getClosestInstanceFromNode(n)}function o(t,e){this.topLevelType=t,this.nativeEvent=e,this.ancestors=[]}function i(t){var e=M(t.nativeEvent),n=p.getClosestInstanceFromNode(e),o=n;do{t.ancestors.push(o),o=o&&r(o)}while(o);for(var i=0;i<t.ancestors.length;i++)n=t.ancestors[i],g._handleTopLevel(t.topLevelType,n,t.nativeEvent,M(t.nativeEvent))}function a(t){t(h(window))}var s=n(7),u=n(119),c=n(13),l=n(31),p=n(9),d=n(22),M=n(93),h=n(235);s(o.prototype,{destructor:function(){this.topLevelType=null,this.nativeEvent=null,this.ancestors.length=0}}),l.addPoolingTo(o,l.twoArgumentPooler);var g={_enabled:!0,_handleTopLevel:null,WINDOW_HANDLE:c.canUseDOM?window:null,setHandleTopLevel:function(t){g._handleTopLevel=t},setEnabled:function(t){g._enabled=!!t},isEnabled:function(){return g._enabled},trapBubbledEvent:function(t,e,n){return n?u.listen(n,e,g.dispatchEvent.bind(null,t)):null},trapCapturedEvent:function(t,e,n){return n?u.capture(n,e,g.dispatchEvent.bind(null,t)):null},monitorScrollValue:function(t){var e=a.bind(null,t);u.listen(window,"scroll",e)},dispatchEvent:function(t,e){if(g._enabled){var n=o.getPooled(t,e);try{d.batchedUpdates(i,n)}finally{o.release(n)}}}};t.exports=g},function(t,e,n){"use strict";var r=n(36),o=n(42),i=n(84),a=n(87),s=n(130),u=n(58),c=n(132),l=n(22),p={Component:a.injection,DOMProperty:r.injection,EmptyComponent:s.injection,EventPluginHub:o.injection,EventPluginUtils:i.injection,EventEmitter:u.injection,HostComponent:c.injection,Updates:l.injection};t.exports=p},function(t,e,n){"use strict";var r=n(309),o=/\/?>/,i=/^<\!\-\-/,a={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(t){var e=r(t);return i.test(t)?t:t.replace(o," "+a.CHECKSUM_ATTR_NAME+'="'+e+'"$&')},canReuseMarkup:function(t,e){var n=e.getAttribute(a.CHECKSUM_ATTR_NAME);return n=n&&parseInt(n,10),r(t)===n}};t.exports=a},function(t,e,n){"use strict";function r(t,e,n){return{type:"INSERT_MARKUP",content:t,fromIndex:null,fromNode:null,toIndex:n,afterNode:e}}function o(t,e,n){return{type:"MOVE_EXISTING",content:null,fromIndex:t._mountIndex,fromNode:d.getHostNode(t),toIndex:n,afterNode:e}}function i(t,e){return{type:"REMOVE_NODE",content:null,fromIndex:t._mountIndex,fromNode:e,toIndex:null,afterNode:null}}function a(t){return{type:"SET_MARKUP",content:t,fromIndex:null,fromNode:null,toIndex:null,afterNode:null}}function s(t){return{type:"TEXT_CONTENT",content:t,fromIndex:null,fromNode:null,toIndex:null,afterNode:null}}function u(t,e){return e&&(t=t||[],t.push(e)),t}function c(t,e){p.processChildrenUpdates(t,e)}var l=n(5),p=n(87),d=(n(44),n(18),n(26),n(37)),M=n(266),h=(n(21),n(312)),g=(n(3),{Mixin:{_reconcilerInstantiateChildren:function(t,e,n){return M.instantiateChildren(t,e,n)},_reconcilerUpdateChildren:function(t,e,n,r,o,i){var a,s=0;return a=h(e,s),M.updateChildren(t,a,n,r,o,this,this._hostContainerInfo,i,s),a},mountChildren:function(t,e,n){var r=this._reconcilerInstantiateChildren(t,e,n);this._renderedChildren=r;var o=[],i=0;for(var a in r)if(r.hasOwnProperty(a)){var s=r[a],u=0,c=d.mountComponent(s,e,this,this._hostContainerInfo,n,u);s._mountIndex=i++,o.push(c)}return o},updateTextContent:function(t){var e=this._renderedChildren;M.unmountChildren(e,!1);for(var n in e)e.hasOwnProperty(n)&&l("118");c(this,[s(t)])},updateMarkup:function(t){var e=this._renderedChildren;M.unmountChildren(e,!1);for(var n in e)e.hasOwnProperty(n)&&l("118");c(this,[a(t)])},updateChildren:function(t,e,n){this._updateChildren(t,e,n)},_updateChildren:function(t,e,n){var r=this._renderedChildren,o={},i=[],a=this._reconcilerUpdateChildren(r,t,i,o,e,n);if(a||r){var s,l=null,p=0,M=0,h=0,g=null;for(s in a)if(a.hasOwnProperty(s)){var f=r&&r[s],y=a[s];f===y?(l=u(l,this.moveChild(f,g,p,M)),M=Math.max(f._mountIndex,M),f._mountIndex=p):(f&&(M=Math.max(f._mountIndex,M)),l=u(l,this._mountChildAtIndex(y,i[h],g,p,e,n)),h++),p++,g=d.getHostNode(y)}for(s in o)o.hasOwnProperty(s)&&(l=u(l,this._unmountChild(r[s],o[s])));l&&c(this,l),this._renderedChildren=a}},unmountChildren:function(t){var e=this._renderedChildren;M.unmountChildren(e,t),this._renderedChildren=null},moveChild:function(t,e,n,r){if(t._mountIndex<r)return o(t,e,n)},createChild:function(t,e,n){return r(n,e,t._mountIndex)},removeChild:function(t,e){return i(t,e)},_mountChildAtIndex:function(t,e,n,r,o,i){return t._mountIndex=r,this.createChild(t,n,e)},_unmountChild:function(t,e){var n=this.removeChild(t,e);return t._mountIndex=null,n}}});t.exports=g},function(t,e,n){"use strict";function r(t){return!(!t||"function"!=typeof t.attachRef||"function"!=typeof t.detachRef)}var o=n(5),i=(n(3),{addComponentAsRefTo:function(t,e,n){r(n)||o("119"),n.attachRef(e,t)},removeComponentAsRefFrom:function(t,e,n){r(n)||o("120");var i=n.getPublicInstance();i&&i.refs[e]===t.getPublicInstance()&&n.detachRef(e)}});t.exports=i},function(t,e,n){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,e,n){"use strict";function r(t){this.reinitializeTransaction(),this.renderToStaticMarkup=!1,this.reactMountReady=i.getPooled(null),this.useCreateElement=t}var o=n(7),i=n(126),a=n(31),s=n(58),u=n(133),c=(n(18),n(60)),l=n(89),p={initialize:u.getSelectionInformation,close:u.restoreSelection},d={initialize:function(){var t=s.isEnabled();return s.setEnabled(!1),t},close:function(t){s.setEnabled(t)}},M={initialize:function(){this.reactMountReady.reset()},close:function(){this.reactMountReady.notifyAll()}},h=[p,d,M],g={getTransactionWrappers:function(){return h},getReactMountReady:function(){return this.reactMountReady},getUpdateQueue:function(){return l},checkpoint:function(){return this.reactMountReady.checkpoint()},rollback:function(t){this.reactMountReady.rollback(t)},destructor:function(){i.release(this.reactMountReady),this.reactMountReady=null}};o(r.prototype,c,g),a.addPoolingTo(r),t.exports=r},function(t,e,n){"use strict";function r(t,e,n){"function"==typeof t?t(e.getPublicInstance()):i.addComponentAsRefTo(e,t,n)}function o(t,e,n){"function"==typeof t?t(null):i.removeComponentAsRefFrom(e,t,n)}var i=n(289),a={};a.attachRefs=function(t,e){if(null!==e&&"object"==typeof e){var n=e.ref;null!=n&&r(n,t,e._owner)}},a.shouldUpdateRefs=function(t,e){var n=null,r=null;null!==t&&"object"==typeof t&&(n=t.ref,r=t._owner);var o=null,i=null;return null!==e&&"object"==typeof e&&(o=e.ref,i=e._owner),n!==o||"string"==typeof o&&i!==r},a.detachRefs=function(t,e){if(null!==e&&"object"==typeof e){var n=e.ref;null!=n&&o(n,t,e._owner)}},t.exports=a},function(t,e,n){"use strict";function r(t){this.reinitializeTransaction(),this.renderToStaticMarkup=t,this.useCreateElement=!1,this.updateQueue=new s(this)}var o=n(7),i=n(31),a=n(60),s=(n(18),n(294)),u=[],c={enqueue:function(){}},l={getTransactionWrappers:function(){return u},getReactMountReady:function(){return c},getUpdateQueue:function(){return this.updateQueue},destructor:function(){},checkpoint:function(){},rollback:function(){}};o(r.prototype,a,l),i.addPoolingTo(r),t.exports=r},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=n(89),i=(n(6),function(){function t(e){r(this,t),this.transaction=e}return t.prototype.isMounted=function(t){return!1},t.prototype.enqueueCallback=function(t,e,n){this.transaction.isInTransaction()&&o.enqueueCallback(t,e,n)},t.prototype.enqueueForceUpdate=function(t){this.transaction.isInTransaction()&&o.enqueueForceUpdate(t)},t.prototype.enqueueReplaceState=function(t,e){this.transaction.isInTransaction()&&o.enqueueReplaceState(t,e)},t.prototype.enqueueSetState=function(t,e){this.transaction.isInTransaction()&&o.enqueueSetState(t,e)},t}());t.exports=i},function(t,e,n){"use strict";t.exports="15.6.2"},function(t,e,n){"use strict";var r={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},o={accentHeight:"accent-height",accumulate:0,additive:0,alignmentBaseline:"alignment-baseline",allowReorder:"allowReorder",alphabetic:0,amplitude:0,arabicForm:"arabic-form",ascent:0,attributeName:"attributeName",attributeType:"attributeType",autoReverse:"autoReverse",azimuth:0,baseFrequency:"baseFrequency",baseProfile:"baseProfile",baselineShift:"baseline-shift",bbox:0,begin:0,bias:0,by:0,calcMode:"calcMode",capHeight:"cap-height",clip:0,clipPath:"clip-path",clipRule:"clip-rule",clipPathUnits:"clipPathUnits",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",contentScriptType:"contentScriptType",contentStyleType:"contentStyleType",cursor:0,cx:0,cy:0,d:0,decelerate:0,descent:0,diffuseConstant:"diffuseConstant",direction:0,display:0,divisor:0,dominantBaseline:"dominant-baseline",dur:0,dx:0,dy:0,edgeMode:"edgeMode",elevation:0,enableBackground:"enable-background",end:0,exponent:0,externalResourcesRequired:"externalResourcesRequired",fill:0,fillOpacity:"fill-opacity",fillRule:"fill-rule",filter:0,filterRes:"filterRes",filterUnits:"filterUnits",floodColor:"flood-color",floodOpacity:"flood-opacity",focusable:0,fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",glyphRef:"glyphRef",gradientTransform:"gradientTransform",gradientUnits:"gradientUnits",hanging:0,horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",ideographic:0,imageRendering:"image-rendering",in:0,in2:0,intercept:0,k:0,k1:0,k2:0,k3:0,k4:0,kernelMatrix:"kernelMatrix",kernelUnitLength:"kernelUnitLength",kerning:0,keyPoints:"keyPoints",keySplines:"keySplines",keyTimes:"keyTimes",lengthAdjust:"lengthAdjust",letterSpacing:"letter-spacing",lightingColor:"lighting-color",limitingConeAngle:"limitingConeAngle",local:0,markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",markerHeight:"markerHeight",markerUnits:"markerUnits",markerWidth:"markerWidth",mask:0,maskContentUnits:"maskContentUnits",maskUnits:"maskUnits",mathematical:0,mode:0,numOctaves:"numOctaves",offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pathLength:"pathLength",patternContentUnits:"patternContentUnits",patternTransform:"patternTransform",patternUnits:"patternUnits",pointerEvents:"pointer-events",points:0,pointsAtX:"pointsAtX",pointsAtY:"pointsAtY",pointsAtZ:"pointsAtZ",preserveAlpha:"preserveAlpha",preserveAspectRatio:"preserveAspectRatio",primitiveUnits:"primitiveUnits",r:0,radius:0,refX:"refX",refY:"refY",renderingIntent:"rendering-intent",repeatCount:"repeatCount",repeatDur:"repeatDur",requiredExtensions:"requiredExtensions",requiredFeatures:"requiredFeatures",restart:0,result:0,rotate:0,rx:0,ry:0,scale:0,seed:0,shapeRendering:"shape-rendering",slope:0,spacing:0,specularConstant:"specularConstant",specularExponent:"specularExponent",speed:0,spreadMethod:"spreadMethod",startOffset:"startOffset",stdDeviation:"stdDeviation",stemh:0,stemv:0,stitchTiles:"stitchTiles",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",string:0,stroke:0,strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeMiterlimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",surfaceScale:"surfaceScale",systemLanguage:"systemLanguage",tableValues:"tableValues",targetX:"targetX",targetY:"targetY",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",textLength:"textLength",to:0,transform:0,u1:0,u2:0,underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicode:0,unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",values:0,vectorEffect:"vector-effect",version:0,vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",viewBox:"viewBox",viewTarget:"viewTarget",visibility:0,widths:0,wordSpacing:"word-spacing",writingMode:"writing-mode",x:0,xHeight:"x-height",x1:0,x2:0,xChannelSelector:"xChannelSelector",xlinkActuate:"xlink:actuate",xlinkArcrole:"xlink:arcrole",xlinkHref:"xlink:href",xlinkRole:"xlink:role",xlinkShow:"xlink:show",xlinkTitle:"xlink:title",xlinkType:"xlink:type",xmlBase:"xml:base",xmlns:0,xmlnsXlink:"xmlns:xlink",xmlLang:"xml:lang",xmlSpace:"xml:space",y:0,y1:0,y2:0,yChannelSelector:"yChannelSelector",z:0,zoomAndPan:"zoomAndPan"},i={Properties:{},DOMAttributeNamespaces:{xlinkActuate:r.xlink,xlinkArcrole:r.xlink,xlinkHref:r.xlink,xlinkRole:r.xlink,xlinkShow:r.xlink,xlinkTitle:r.xlink,xlinkType:r.xlink,xmlBase:r.xml,xmlLang:r.xml,xmlSpace:r.xml},DOMAttributeNames:{}};Object.keys(o).forEach(function(t){i.Properties[t]=0,o[t]&&(i.DOMAttributeNames[t]=o[t])}),t.exports=i},function(t,e,n){"use strict";function r(t){if("selectionStart"in t&&u.hasSelectionCapabilities(t))return{start:t.selectionStart,end:t.selectionEnd};if(window.getSelection){var e=window.getSelection();return{anchorNode:e.anchorNode,anchorOffset:e.anchorOffset,focusNode:e.focusNode,focusOffset:e.focusOffset}}if(document.selection){var n=document.selection.createRange();return{parentElement:n.parentElement(),text:n.text,top:n.boundingTop,left:n.boundingLeft}}}function o(t,e){if(N||null==g||g!==l())return null;var n=r(g);if(!y||!d(y,n)){y=n;var o=c.getPooled(h.select,f,t,e);return o.type="select",o.target=g,i.accumulateTwoPhaseDispatches(o),o}return null}var i=n(43),a=n(13),s=n(9),u=n(133),c=n(25),l=n(121),p=n(143),d=n(76),M=a.canUseDOM&&"documentMode"in document&&document.documentMode<=11,h={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:["topBlur","topContextMenu","topFocus","topKeyDown","topKeyUp","topMouseDown","topMouseUp","topSelectionChange"]}},g=null,f=null,y=null,N=!1,m=!1,D={eventTypes:h,extractEvents:function(t,e,n,r){if(!m)return null;var i=e?s.getNodeFromInstance(e):window;switch(t){case"topFocus":(p(i)||"true"===i.contentEditable)&&(g=i,f=e,y=null);break;case"topBlur":g=null,f=null,y=null;break;case"topMouseDown":N=!0;break;case"topContextMenu":case"topMouseUp":return N=!1,o(n,r);case"topSelectionChange":if(M)break;case"topKeyDown":case"topKeyUp":return o(n,r)}return null},didPutListener:function(t,e,n){"onSelect"===e&&(m=!0)}};t.exports=D},function(t,e,n){"use strict";function r(t){return"."+t._rootNodeID}function o(t){return"button"===t||"input"===t||"select"===t||"textarea"===t}var i=n(5),a=n(119),s=n(43),u=n(9),c=n(299),l=n(300),p=n(25),d=n(303),M=n(305),h=n(59),g=n(302),f=n(306),y=n(307),N=n(45),m=n(308),D=n(21),j=n(91),I=(n(3),{}),w={};["abort","animationEnd","animationIteration","animationStart","blur","canPlay","canPlayThrough","click","contextMenu","copy","cut","doubleClick","drag","dragEnd","dragEnter","dragExit","dragLeave","dragOver","dragStart","drop","durationChange","emptied","encrypted","ended","error","focus","input","invalid","keyDown","keyPress","keyUp","load","loadedData","loadedMetadata","loadStart","mouseDown","mouseMove","mouseOut","mouseOver","mouseUp","paste","pause","play","playing","progress","rateChange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeUpdate","touchCancel","touchEnd","touchMove","touchStart","transitionEnd","volumeChange","waiting","wheel"].forEach(function(t){var e=t[0].toUpperCase()+t.slice(1),n="on"+e,r="top"+e,o={phasedRegistrationNames:{bubbled:n,captured:n+"Capture"},dependencies:[r]};I[t]=o,w[r]=o});var L={},v={eventTypes:I,extractEvents:function(t,e,n,r){var o=w[t];if(!o)return null;var a;switch(t){case"topAbort":case"topCanPlay":case"topCanPlayThrough":case"topDurationChange":case"topEmptied":case"topEncrypted":case"topEnded":case"topError":case"topInput":case"topInvalid":case"topLoad":case"topLoadedData":case"topLoadedMetadata":case"topLoadStart":case"topPause":case"topPlay":case"topPlaying":case"topProgress":case"topRateChange":case"topReset":case"topSeeked":case"topSeeking":case"topStalled":case"topSubmit":case"topSuspend":case"topTimeUpdate":case"topVolumeChange":case"topWaiting":a=p;break;case"topKeyPress":if(0===j(n))return null;case"topKeyDown":case"topKeyUp":a=M;break;case"topBlur":case"topFocus":a=d;break;case"topClick":if(2===n.button)return null;case"topDoubleClick":case"topMouseDown":case"topMouseMove":case"topMouseUp":case"topMouseOut":case"topMouseOver":case"topContextMenu":a=h;break;case"topDrag":case"topDragEnd":case"topDragEnter":case"topDragExit":case"topDragLeave":case"topDragOver":case"topDragStart":case"topDrop":a=g;break;case"topTouchCancel":case"topTouchEnd":case"topTouchMove":case"topTouchStart":a=f;break;case"topAnimationEnd":case"topAnimationIteration":case"topAnimationStart":a=c;break;case"topTransitionEnd":a=y;break;case"topScroll":a=N;break;case"topWheel":a=m;break;case"topCopy":case"topCut":case"topPaste":a=l}a||i("86",t);var u=a.getPooled(o,e,n,r);return s.accumulateTwoPhaseDispatches(u),u},didPutListener:function(t,e,n){if("onClick"===e&&!o(t._tag)){var i=r(t),s=u.getNodeFromInstance(t);L[i]||(L[i]=a.listen(s,"click",D))}},willDeleteListener:function(t,e){if("onClick"===e&&!o(t._tag)){var n=r(t);L[n].remove(),delete L[n]}}};t.exports=v},function(t,e,n){"use strict";function r(t,e,n,r){return o.call(this,t,e,n,r)}var o=n(25),i={animationName:null,elapsedTime:null,pseudoElement:null};o.augmentClass(r,i),t.exports=r},function(t,e,n){"use strict";function r(t,e,n,r){return o.call(this,t,e,n,r)}var o=n(25),i={clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}};o.augmentClass(r,i),t.exports=r},function(t,e,n){"use strict";function r(t,e,n,r){return o.call(this,t,e,n,r)}var o=n(25),i={data:null};o.augmentClass(r,i),t.exports=r},function(t,e,n){"use strict";function r(t,e,n,r){return o.call(this,t,e,n,r)}var o=n(59),i={dataTransfer:null};o.augmentClass(r,i),t.exports=r},function(t,e,n){"use strict";function r(t,e,n,r){return o.call(this,t,e,n,r)}var o=n(45),i={relatedTarget:null};o.augmentClass(r,i),t.exports=r},function(t,e,n){"use strict";function r(t,e,n,r){return o.call(this,t,e,n,r)}var o=n(25),i={data:null};o.augmentClass(r,i),t.exports=r},function(t,e,n){"use strict";function r(t,e,n,r){return o.call(this,t,e,n,r)}var o=n(45),i=n(91),a=n(313),s=n(92),u={key:a,location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:s,charCode:function(t){return"keypress"===t.type?i(t):0},keyCode:function(t){return"keydown"===t.type||"keyup"===t.type?t.keyCode:0},which:function(t){return"keypress"===t.type?i(t):"keydown"===t.type||"keyup"===t.type?t.keyCode:0}};o.augmentClass(r,u),t.exports=r},function(t,e,n){"use strict";function r(t,e,n,r){return o.call(this,t,e,n,r)}var o=n(45),i=n(92),a={touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:i};o.augmentClass(r,a),t.exports=r},function(t,e,n){"use strict";function r(t,e,n,r){return o.call(this,t,e,n,r)}var o=n(25),i={propertyName:null,elapsedTime:null,pseudoElement:null};o.augmentClass(r,i),t.exports=r},function(t,e,n){"use strict";function r(t,e,n,r){return o.call(this,t,e,n,r)}var o=n(59),i={deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:null,deltaMode:null};o.augmentClass(r,i),t.exports=r},function(t,e,n){"use strict";function r(t){for(var e=1,n=0,r=0,i=t.length,a=-4&i;r<a;){for(var s=Math.min(r+4096,a);r<s;r+=4)n+=(e+=t.charCodeAt(r))+(e+=t.charCodeAt(r+1))+(e+=t.charCodeAt(r+2))+(e+=t.charCodeAt(r+3));e%=o,n%=o}for(;r<i;r++)n+=e+=t.charCodeAt(r);return e%=o,n%=o,e|n<<16}var o=65521;t.exports=r},function(t,e,n){"use strict";function r(t,e,n,r){if(null==e||"boolean"==typeof e||""===e)return"";var o=isNaN(e);if(r||o||0===e||i.hasOwnProperty(t)&&i[t])return""+e;if("string"==typeof e){e=e.trim()}return e+"px"}var o=n(125),i=(n(6),o.isUnitlessNumber);t.exports=r},function(t,e,n){"use strict";function r(t){if(null==t)return null;if(1===t.nodeType)return t;var e=a.get(t);if(e)return e=s(e),e?i.getNodeFromInstance(e):null;"function"==typeof t.render?o("44"):o("45",Object.keys(t))}var o=n(5),i=(n(26),n(9)),a=n(44),s=n(139);n(3),n(6);t.exports=r},function(t,e,n){"use strict";(function(e){function r(t,e,n,r){if(t&&"object"==typeof t){var o=t,i=void 0===o[n];i&&null!=e&&(o[n]=e)}}function o(t,e){if(null==t)return t;var n={};return i(t,r,n),n}var i=(n(85),n(145));n(6);void 0!==e&&n.i({NODE_ENV:"production"}),t.exports=o}).call(e,n(41))},function(t,e,n){"use strict";function r(t){if(t.key){var e=i[t.key]||t.key;if("Unidentified"!==e)return e}if("keypress"===t.type){var n=o(t);return 13===n?"Enter":String.fromCharCode(n)}return"keydown"===t.type||"keyup"===t.type?a[t.keyCode]||"Unidentified":""}var o=n(91),i={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},a={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};t.exports=r},function(t,e,n){"use strict";function r(t){var e=t&&(o&&t[o]||t[i]);if("function"==typeof e)return e}var o="function"==typeof Symbol&&Symbol.iterator,i="@@iterator";t.exports=r},function(t,e,n){"use strict";function r(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function o(t){for(;t;){if(t.nextSibling)return t.nextSibling;t=t.parentNode}}function i(t,e){for(var n=r(t),i=0,a=0;n;){if(3===n.nodeType){if(a=i+n.textContent.length,i<=e&&a>=e)return{node:n,offset:e-i};i=a}n=r(o(n))}}t.exports=i},function(t,e,n){"use strict";function r(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n["ms"+t]="MS"+e,n["O"+t]="o"+e.toLowerCase(),n}function o(t){if(s[t])return s[t];if(!a[t])return t;var e=a[t];for(var n in e)if(e.hasOwnProperty(n)&&n in u)return s[t]=e[n];return""}var i=n(13),a={animationend:r("Animation","AnimationEnd"),animationiteration:r("Animation","AnimationIteration"),animationstart:r("Animation","AnimationStart"),transitionend:r("Transition","TransitionEnd")},s={},u={};i.canUseDOM&&(u=document.createElement("div").style,"AnimationEvent"in window||(delete a.animationend.animation,delete a.animationiteration.animation,delete a.animationstart.animation),"TransitionEvent"in window||delete a.transitionend.transition),t.exports=o},function(t,e,n){"use strict";function r(t){return'"'+o(t)+'"'}var o=n(61);t.exports=r},function(t,e,n){"use strict";var r=n(134);t.exports=r.renderSubtreeIntoContainer},function(t,e,n){"use strict";function r(t){if("object"==typeof t&&null!==t){var e=t.$$typeof;switch(e){case a:switch(t=t.type){case M:case h:case u:case l:case c:case f:return t;default:switch(t=t&&t.$$typeof){case d:case g:case m:case N:case p:return t;default:return e}}case s:return e}}}function o(t){return r(t)===h}var i="function"==typeof Symbol&&Symbol.for,a=i?Symbol.for("react.element"):60103,s=i?Symbol.for("react.portal"):60106,u=i?Symbol.for("react.fragment"):60107,c=i?Symbol.for("react.strict_mode"):60108,l=i?Symbol.for("react.profiler"):60114,p=i?Symbol.for("react.provider"):60109,d=i?Symbol.for("react.context"):60110,M=i?Symbol.for("react.async_mode"):60111,h=i?Symbol.for("react.concurrent_mode"):60111,g=i?Symbol.for("react.forward_ref"):60112,f=i?Symbol.for("react.suspense"):60113,y=i?Symbol.for("react.suspense_list"):60120,N=i?Symbol.for("react.memo"):60115,m=i?Symbol.for("react.lazy"):60116,D=i?Symbol.for("react.block"):60121,j=i?Symbol.for("react.fundamental"):60117,I=i?Symbol.for("react.responder"):60118,w=i?Symbol.for("react.scope"):60119;e.AsyncMode=M,e.ConcurrentMode=h,e.ContextConsumer=d,e.ContextProvider=p,e.Element=a,e.ForwardRef=g,e.Fragment=u,e.Lazy=m,e.Memo=N,e.Portal=s,e.Profiler=l,e.StrictMode=c,e.Suspense=f,e.isAsyncMode=function(t){return o(t)||r(t)===M},e.isConcurrentMode=o,e.isContextConsumer=function(t){return r(t)===d},e.isContextProvider=function(t){return r(t)===p},e.isElement=function(t){return"object"==typeof t&&null!==t&&t.$$typeof===a},e.isForwardRef=function(t){return r(t)===g},e.isFragment=function(t){return r(t)===u},e.isLazy=function(t){return r(t)===m},e.isMemo=function(t){return r(t)===N},e.isPortal=function(t){return r(t)===s},e.isProfiler=function(t){return r(t)===l},e.isStrictMode=function(t){return r(t)===c},e.isSuspense=function(t){return r(t)===f},e.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===u||t===h||t===l||t===c||t===f||t===y||"object"==typeof t&&null!==t&&(t.$$typeof===m||t.$$typeof===N||t.$$typeof===p||t.$$typeof===d||t.$$typeof===g||t.$$typeof===j||t.$$typeof===I||t.$$typeof===w||t.$$typeof===D)},e.typeOf=r},function(t,e,n){"use strict";t.exports=n(319)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(){return o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},o.apply(this,arguments)}function i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}e.__esModule=!0,e.default=void 0;var a=(function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,n):{};r.get||r.set?Object.defineProperty(e,n,r):e[n]=t[n]}e.default=t}(n(2)),r(n(226))),s=r(n(228)),u=r(n(0)),c=r(n(147)),l=(n(149),function(t,e){return t&&e&&e.split(" ").forEach(function(e){return(0,a.default)(t,e)})}),p=function(t,e){return t&&e&&e.split(" ").forEach(function(e){return(0,s.default)(t,e)})},d=function(t){function e(){for(var e,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e=t.call.apply(t,[this].concat(r))||this,e.onEnter=function(t,n){var r=e.getClassNames(n?"appear":"enter"),o=r.className;e.removeClasses(t,"exit"),l(t,o),e.props.onEnter&&e.props.onEnter(t,n)},e.onEntering=function(t,n){var r=e.getClassNames(n?"appear":"enter"),o=r.activeClassName;e.reflowAndAddClass(t,o),e.props.onEntering&&e.props.onEntering(t,n)},e.onEntered=function(t,n){var r=e.getClassNames("appear").doneClassName,o=e.getClassNames("enter").doneClassName,i=n?r+" "+o:o;e.removeClasses(t,n?"appear":"enter"),l(t,i),e.props.onEntered&&e.props.onEntered(t,n)},e.onExit=function(t){var n=e.getClassNames("exit"),r=n.className;e.removeClasses(t,"appear"),e.removeClasses(t,"enter"),l(t,r),e.props.onExit&&e.props.onExit(t)},e.onExiting=function(t){var n=e.getClassNames("exit"),r=n.activeClassName;e.reflowAndAddClass(t,r),e.props.onExiting&&e.props.onExiting(t)},e.onExited=function(t){var n=e.getClassNames("exit"),r=n.doneClassName;e.removeClasses(t,"exit"),l(t,r),e.props.onExited&&e.props.onExited(t)},e.getClassNames=function(t){var n=e.props.classNames,r="string"==typeof n,o=r&&n?n+"-":"",i=r?o+t:n[t];return{className:i,activeClassName:r?i+"-active":n[t+"Active"],doneClassName:r?i+"-done":n[t+"Done"]}},e}i(e,t);var n=e.prototype;return n.removeClasses=function(t,e){var n=this.getClassNames(e),r=n.className,o=n.activeClassName,i=n.doneClassName;r&&p(t,r),o&&p(t,o),i&&p(t,i)},n.reflowAndAddClass=function(t,e){e&&(t&&t.scrollTop,l(t,e))},n.render=function(){var t=o({},this.props);return delete t.classNames,u.default.createElement(c.default,o({},t,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},e}(u.default.Component);d.defaultProps={classNames:""},d.propTypes={};var M=d;e.default=M,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(null==t)return{};var n,r,o={},i=Object.keys(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)>=0||(o[n]=t[n]);return o}function i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}e.__esModule=!0,e.default=void 0;var a=(r(n(2)),r(n(0))),s=n(30),u=r(n(148)),c=function(t){function e(){for(var e,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e=t.call.apply(t,[this].concat(r))||this,e.handleEnter=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.handleLifecycle("onEnter",0,n)},e.handleEntering=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.handleLifecycle("onEntering",0,n)},e.handleEntered=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.handleLifecycle("onEntered",0,n)},e.handleExit=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.handleLifecycle("onExit",1,n)},e.handleExiting=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.handleLifecycle("onExiting",1,n)},e.handleExited=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.handleLifecycle("onExited",1,n)},e}i(e,t);var n=e.prototype;return n.handleLifecycle=function(t,e,n){var r,o=this.props.children,i=a.default.Children.toArray(o)[e];i.props[t]&&(r=i.props)[t].apply(r,n),this.props[t]&&this.props[t]((0,s.findDOMNode)(this))},n.render=function(){var t=this.props,e=t.children,n=t.in,r=o(t,["children","in"]),i=a.default.Children.toArray(e),s=i[0],c=i[1];return delete r.onEnter,delete r.onEntering,delete r.onEntered,delete r.onExit,delete r.onExiting,delete r.onExited,a.default.createElement(u.default,r,n?a.default.cloneElement(s,{key:"first",onEnter:this.handleEnter,onEntering:this.handleEntering,onEntered:this.handleEntered}):a.default.cloneElement(c,{key:"second",onEnter:this.handleExit,onEntering:this.handleExiting,onEntered:this.handleExited}))},e}(a.default.Component);c.propTypes={};var l=c;e.default=l,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}var o=r(n(321)),i=r(n(322)),a=r(n(148)),s=r(n(147));t.exports={Transition:s.default,TransitionGroup:a.default,ReplaceTransition:i.default,CSSTransition:o.default}},function(t,e,n){"use strict";function r(t,e){var n=function(t){return e&&(0,u.isValidElement)(t)?e(t):t},r=Object.create(null);return t&&u.Children.map(t,function(t){return t}).forEach(function(t){r[t.key]=n(t)}),r}function o(t,e){function n(n){return n in e?e[n]:t[n]}t=t||{},e=e||{};var r=Object.create(null),o=[];for(var i in t)i in e?o.length&&(r[i]=o,o=[]):o.push(i);var a,s={};for(var u in e){if(r[u])for(a=0;a<r[u].length;a++){var c=r[u][a];s[r[u][a]]=n(c)}s[u]=n(u)}for(a=0;a<o.length;a++)s[o[a]]=n(o[a]);return s}function i(t,e,n){return null!=n[e]?n[e]:t.props[e]}function a(t,e){return r(t.children,function(n){return(0,u.cloneElement)(n,{onExited:e.bind(null,n),in:!0,appear:i(n,"appear",t),enter:i(n,"enter",t),exit:i(n,"exit",t)})})}function s(t,e,n){var a=r(t.children),s=o(e,a);return Object.keys(s).forEach(function(r){var o=s[r];if((0,u.isValidElement)(o)){var c=r in e,l=r in a,p=e[r],d=(0,u.isValidElement)(p)&&!p.props.in;!l||c&&!d?l||!c||d?l&&c&&(0,u.isValidElement)(p)&&(s[r]=(0,u.cloneElement)(o,{onExited:n.bind(null,o),in:p.props.in,exit:i(o,"exit",t),enter:i(o,"enter",t)})):s[r]=(0,u.cloneElement)(o,{in:!1}):s[r]=(0,u.cloneElement)(o,{onExited:n.bind(null,o),in:!0,exit:i(o,"exit",t),enter:i(o,"enter",t)})}}),s}e.__esModule=!0,e.getChildMapping=r,e.mergeChildMappings=o,e.getInitialChildMapping=a,e.getNextChildMapping=s;var u=n(0)},function(t,e,n){"use strict";function r(t){var e={"=":"=0",":":"=2"};return"$"+(""+t).replace(/[=:]/g,function(t){return e[t]})}function o(t){var e=/(=0|=2)/g,n={"=0":"=","=2":":"};return(""+("."===t[0]&&"$"===t[1]?t.substring(2):t.substring(1))).replace(e,function(t){return n[t]})}var i={escape:r,unescape:o};t.exports=i},function(t,e,n){"use strict";var r=n(46),o=(n(3),function(t){var e=this;if(e.instancePool.length){var n=e.instancePool.pop();return e.call(n,t),n}return new e(t)}),i=function(t,e){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,t,e),r}return new n(t,e)},a=function(t,e,n){var r=this;if(r.instancePool.length){var o=r.instancePool.pop();return r.call(o,t,e,n),o}return new r(t,e,n)},s=function(t,e,n,r){var o=this;if(o.instancePool.length){var i=o.instancePool.pop();return o.call(i,t,e,n,r),i}return new o(t,e,n,r)},u=function(t){var e=this;t instanceof e||r("25"),t.destructor(),e.instancePool.length<e.poolSize&&e.instancePool.push(t)},c=o,l=function(t,e){var n=t;return n.instancePool=[],n.getPooled=e||c,n.poolSize||(n.poolSize=10),n.release=u,n},p={addPoolingTo:l,oneArgumentPooler:o,twoArgumentPooler:i,threeArgumentPooler:a,fourArgumentPooler:s};t.exports=p},function(t,e,n){"use strict";function r(t){return(""+t).replace(D,"$&/")}function o(t,e){this.func=t,this.context=e,this.count=0}function i(t,e,n){var r=t.func,o=t.context;r.call(o,e,t.count++)}function a(t,e,n){if(null==t)return t;var r=o.getPooled(e,n);y(t,i,r),o.release(r)}function s(t,e,n,r){this.result=t,this.keyPrefix=e,this.func=n,this.context=r,this.count=0}function u(t,e,n){var o=t.result,i=t.keyPrefix,a=t.func,s=t.context,u=a.call(s,e,t.count++);Array.isArray(u)?c(u,o,n,f.thatReturnsArgument):null!=u&&(g.isValidElement(u)&&(u=g.cloneAndReplaceKey(u,i+(!u.key||e&&e.key===u.key?"":r(u.key)+"/")+n)),o.push(u))}function c(t,e,n,o,i){var a="";null!=n&&(a=r(n)+"/");var c=s.getPooled(e,a,o,i);y(t,u,c),s.release(c)}function l(t,e,n){if(null==t)return t;var r=[];return c(t,r,null,e,n),r}function p(t,e,n){return null}function d(t,e){return y(t,p,null)}function M(t){var e=[];return c(t,e,null,f.thatReturnsArgument),e}var h=n(326),g=n(39),f=n(21),y=n(336),N=h.twoArgumentPooler,m=h.fourArgumentPooler,D=/\/+/g;o.prototype.destructor=function(){this.func=null,this.context=null,this.count=0},h.addPoolingTo(o,N),s.prototype.destructor=function(){this.result=null,this.keyPrefix=null,this.func=null,this.context=null,this.count=0},h.addPoolingTo(s,m);var j={forEach:a,map:l,mapIntoWithKeyPrefixInternal:c,count:d,toArray:M};t.exports=j},function(t,e,n){"use strict";var r=n(39),o=r.createFactory,i={a:o("a"),abbr:o("abbr"),address:o("address"),area:o("area"),article:o("article"),aside:o("aside"),audio:o("audio"),b:o("b"),base:o("base"),bdi:o("bdi"),bdo:o("bdo"),big:o("big"),blockquote:o("blockquote"),body:o("body"),br:o("br"),button:o("button"),canvas:o("canvas"),caption:o("caption"),cite:o("cite"),code:o("code"),col:o("col"),colgroup:o("colgroup"),data:o("data"),datalist:o("datalist"),dd:o("dd"),del:o("del"),details:o("details"),dfn:o("dfn"),dialog:o("dialog"),div:o("div"),dl:o("dl"),dt:o("dt"),em:o("em"),embed:o("embed"),fieldset:o("fieldset"),figcaption:o("figcaption"),figure:o("figure"),footer:o("footer"),form:o("form"),h1:o("h1"),h2:o("h2"),h3:o("h3"),h4:o("h4"),h5:o("h5"),h6:o("h6"),head:o("head"),header:o("header"),hgroup:o("hgroup"),hr:o("hr"),html:o("html"),i:o("i"),iframe:o("iframe"),img:o("img"),input:o("input"),ins:o("ins"),kbd:o("kbd"),keygen:o("keygen"),label:o("label"),legend:o("legend"),li:o("li"),link:o("link"),main:o("main"),map:o("map"),mark:o("mark"),menu:o("menu"),menuitem:o("menuitem"),meta:o("meta"),meter:o("meter"),nav:o("nav"),noscript:o("noscript"),object:o("object"),ol:o("ol"),optgroup:o("optgroup"),option:o("option"),output:o("output"),p:o("p"),param:o("param"),picture:o("picture"),pre:o("pre"),progress:o("progress"),q:o("q"),rp:o("rp"),rt:o("rt"),ruby:o("ruby"),s:o("s"),samp:o("samp"),script:o("script"),section:o("section"),select:o("select"),small:o("small"),source:o("source"),span:o("span"),strong:o("strong"),style:o("style"),sub:o("sub"),summary:o("summary"),sup:o("sup"),table:o("table"),tbody:o("tbody"),td:o("td"),textarea:o("textarea"),tfoot:o("tfoot"),th:o("th"),thead:o("thead"),time:o("time"),title:o("title"),tr:o("tr"),track:o("track"),u:o("u"),ul:o("ul"),var:o("var"),video:o("video"),wbr:o("wbr"),circle:o("circle"),clipPath:o("clipPath"),defs:o("defs"),ellipse:o("ellipse"),g:o("g"),image:o("image"),line:o("line"),linearGradient:o("linearGradient"),mask:o("mask"),path:o("path"),pattern:o("pattern"),polygon:o("polygon"),polyline:o("polyline"),radialGradient:o("radialGradient"),rect:o("rect"),stop:o("stop"),svg:o("svg"),text:o("text"),tspan:o("tspan")};t.exports=i},function(t,e,n){"use strict";var r=n(39),o=r.isValidElement,i=n(122);t.exports=i(o)},function(t,e,n){"use strict";t.exports="15.6.2"},function(t,e,n){"use strict";var r=n(150),o=r.Component,i=n(39),a=i.isValidElement,s=n(153),u=n(222);t.exports=u(o,a,s)},function(t,e,n){"use strict";function r(t){var e=t&&(o&&t[o]||t[i]);if("function"==typeof e)return e}var o="function"==typeof Symbol&&Symbol.iterator,i="@@iterator";t.exports=r},function(t,e,n){"use strict";function r(){return o++}var o=1;t.exports=r},function(t,e,n){"use strict";var r=function(){};t.exports=r},function(t,e,n){"use strict";function r(t){return i.isValidElement(t)||o("143"),t}var o=n(46),i=n(39);n(3);t.exports=r},function(t,e,n){"use strict";function r(t,e){return t&&"object"==typeof t&&null!=t.key?c.escape(t.key):e.toString(36)}function o(t,e,n,i){var d=typeof t;if("undefined"!==d&&"boolean"!==d||(t=null),null===t||"string"===d||"number"===d||"object"===d&&t.$$typeof===s)return n(i,t,""===e?l+r(t,0):e),1;var M,h,g=0,f=""===e?l:e+p;if(Array.isArray(t))for(var y=0;y<t.length;y++)M=t[y],h=f+r(M,y),g+=o(M,h,n,i);else{var N=u(t);if(N){var m,D=N.call(t);if(N!==t.entries)for(var j=0;!(m=D.next()).done;)M=m.value,h=f+r(M,j++),g+=o(M,h,n,i);else for(;!(m=D.next()).done;){var I=m.value;I&&(M=I[1],h=f+c.escape(I[0])+p+r(M,0),g+=o(M,h,n,i))}}else if("object"===d){var w="",L=String(t);a("31","[object Object]"===L?"object with keys {"+Object.keys(t).join(", ")+"}":L,w)}}return g}function i(t,e,n){return null==t?0:o(t,"",e,n)}var a=n(46),s=(n(26),n(152)),u=n(332),c=(n(3),n(325)),l=(n(6),"."),p=":";t.exports=i},function(t,e,n){"use strict";function r(t){"@babel/helpers - typeof";return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){(0,i.default)(t);var n,o;"object"===r(e)?(n=e.min||0,o=e.max):(n=arguments[1],o=arguments[2]);var a=encodeURI(t).split(/%..|./).length-1;return a>=n&&(void 0===o||a<=o)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=o;var i=function(t){return t&&t.__esModule?t:{default:t}}(n(63));t.exports=e.default,t.exports.default=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){var e=t.replace(/^"(.+)"$/,"$1");if(!e.trim())return!1;if(/[\.";<>]/.test(e)){if(e===t)return!1;if(e.split('"').length!==e.split('\\"').length)return!1}return!0}function i(t,e){if((0,a.default)(t),e=(0,s.default)(e,p),e.require_display_name||e.allow_display_name){var n=t.match(d);if(n){var r=n[1];if(t=t.replace(r,"").replace(/(^<|>$)/g,""),r.endsWith(" ")&&(r=r.substr(0,r.length-1)),!o(r))return!1}else if(e.require_display_name)return!1}if(!e.ignore_max_length&&t.length>N)return!1;var i=t.split("@"),m=i.pop(),D=i.join("@"),j=m.toLowerCase();if(e.domain_specific_validation&&("gmail.com"===j||"googlemail.com"===j)){D=D.toLowerCase();var I=D.split("+")[0];if(!(0,u.default)(I.replace(".",""),{min:6,max:30}))return!1;for(var w=I.split("."),L=0;L<w.length;L++)if(!h.test(w[L]))return!1}if(!(!1!==e.ignore_max_length||(0,u.default)(D,{max:64})&&(0,u.default)(m,{max:254})))return!1;if(!(0,c.default)(m,{require_tld:e.require_tld})){if(!e.allow_ip_domain)return!1;if(!(0,l.default)(m)){if(!m.startsWith("[")||!m.endsWith("]"))return!1;var v=m.substr(1,m.length-2);if(0===v.length||!(0,l.default)(v))return!1}}if('"'===D[0])return D=D.slice(1,D.length-1),e.allow_utf8_local_part?y.test(D):g.test(D);for(var z=e.allow_utf8_local_part?f:M,b=D.split("."),C=0;C<b.length;C++)if(!z.test(b[C]))return!1;return!e.blacklisted_chars||-1===D.search(new RegExp("[".concat(e.blacklisted_chars,"]+"),"g"))}Object.defineProperty(e,"__esModule",{value:!0}),e.default=i;var a=r(n(63)),s=r(n(156)),u=r(n(337)),c=r(n(339)),l=r(n(340)),p={allow_display_name:!1,require_display_name:!1,allow_utf8_local_part:!0,require_tld:!0,blacklisted_chars:"",ignore_max_length:!1},d=/^([^\x00-\x1F\x7F-\x9F\cX]+)</i,M=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i,h=/^[a-z\d]+$/,g=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i,f=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i,y=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i,N=254;t.exports=e.default,t.exports.default=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){(0,i.default)(t),e=(0,a.default)(e,s),e.allow_trailing_dot&&"."===t[t.length-1]&&(t=t.substring(0,t.length-1));var n=t.split("."),r=n[n.length-1];if(e.require_tld){if(n.length<2)return!1;if(!/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(r))return!1;if(/[\s\u2002-\u200B\u202F\u205F\u3000\uFEFF\uDB40\uDC20\u00A9\uFFFD]/.test(r))return!1}return!(!e.allow_numeric_tld&&/^\d+$/.test(r))&&n.every(function(t){return!(t.length>63)&&(!!/^[a-z_\u00a1-\uffff0-9-]+$/i.test(t)&&(!/[\uff01-\uff5e]/.test(t)&&(!/^-|-$/.test(t)&&!(!e.allow_underscores&&/_/.test(t)))))})}Object.defineProperty(e,"__esModule",{value:!0}),e.default=o;var i=r(n(63)),a=r(n(156)),s={require_tld:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_numeric_tld:!1};t.exports=e.default,t.exports.default=e.default},function(t,e,n){"use strict";function r(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if((0,o.default)(t),!(e=String(e)))return r(t,4)||r(t,6);if("4"===e){if(!s.test(t))return!1;return t.split(".").sort(function(t,e){return t-e})[3]<=255}return"6"===e&&!!c.test(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var o=function(t){return t&&t.__esModule?t:{default:t}}(n(63)),i="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",a="(".concat(i,"[.]){3}").concat(i),s=new RegExp("^".concat(a,"$")),u="(?:[0-9a-fA-F]{1,4})",c=new RegExp("^("+"(?:".concat(u,":){7}(?:").concat(u,"|:)|")+"(?:".concat(u,":){6}(?:").concat(a,"|:").concat(u,"|:)|")+"(?:".concat(u,":){5}(?::").concat(a,"|(:").concat(u,"){1,2}|:)|")+"(?:".concat(u,":){4}(?:(:").concat(u,"){0,1}:").concat(a,"|(:").concat(u,"){1,3}|:)|")+"(?:".concat(u,":){3}(?:(:").concat(u,"){0,2}:").concat(a,"|(:").concat(u,"){1,4}|:)|")+"(?:".concat(u,":){2}(?:(:").concat(u,"){0,3}:").concat(a,"|(:").concat(u,"){1,5}|:)|")+"(?:".concat(u,":){1}(?:(:").concat(u,"){0,4}:").concat(a,"|(:").concat(u,"){1,6}|:)|")+"(?::((?::".concat(u,"){0,5}:").concat(a,"|(?::").concat(u,"){1,7}|:))")+")(%[0-9a-zA-Z-.:]{1,})?$");t.exports=e.default,t.exports.default=e.default}]);
//# sourceMappingURL=lock.min.js.map
|
import { FETCH_WEATHER } from '../actions';
export default function(state = [], action) {
switch (action.type) {
case FETCH_WEATHER :
return [action.payload.data, ...state];
}
return state;
}
|
// This code contains NVIDIA Confidential Information and is disclosed to you
// under a form of NVIDIA software license agreement provided separately to you.
//
// Notice
// NVIDIA Corporation and its licensors retain all intellectual property and
// proprietary rights in and to this software and related documentation and
// any modifications thereto. Any use, reproduction, disclosure, or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA Corporation is strictly prohibited.
//
// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
//
// Information and code furnished is believed to be accurate and reliable.
// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
// information or for any infringement of patents or other rights of third parties that may
// result from its use. No license is granted by implication or otherwise under any patent
// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
// This code supersedes and replaces all information previously supplied.
// NVIDIA Corporation products are not authorized for use as critical
// components in life support devices or systems without express written approval of
// NVIDIA Corporation.
//
// Copyright (c) 2008-2018 NVIDIA Corporation. All rights reserved.
#ifndef GL_INCLUDES_H
#define GL_INCLUDES_H
#if defined(RENDERER_WINDOWS)
#if defined(RENDERER_ENABLE_OPENGL)
#include <windows/WindowsGLIncludes.h>
#endif
#elif defined(RENDERER_PS3)
#include <ps3/PS3GLIncludes.h>
#elif defined(RENDERER_MACOSX)
#include <osx/OSXGLIncludes.h>
#elif defined(RENDERER_XBOX360)
#include <xbox360/Xbox360GLIncludes.h>
#elif defined(RENDERER_PS4)
#include <ps4/PS4GLIncludes.h>
#elif defined(RENDERER_LINUX)
#include <linux/LinuxGLIncludes.h>
#elif defined(RENDERER_ANDROID)
#include <android/AndroidGLIncludes.h>
#elif defined(RENDERER_IOS)
#else
#error Undefined platform.
#endif
#endif
|
from django.db import models
from django.utils import timezone
class Post(models.Model):
name = models.CharField(max_length=250)
topic = models.CharField(max_length=250)
details = models.TextField()
date_of_publish = models.DateTimeField(default=timezone.now)
class details(models.Model):
author = models.CharField(max_length=250)
options = (
('M' , 'Male'),
('F','Female'),
('O','Others'),
)
class personal_details(models.Model):
status = models.CharField(max_length=10,choices=options)
date_of_birth = models.DateTimeField(default=timezone.now)
# Create your models here.
|
var path = require('path')
var webpack = require('webpack')
var BrowserSyncPlugin = require('browser-sync-webpack-plugin')
var pixi = path.join(__dirname, '/node_modules/pixi.js/dist/pixi.js')
var definePlugin = new webpack.DefinePlugin({
__DEV__: JSON.stringify(JSON.parse(process.env.BUILD_DEV || 'true'))
})
module.exports = {
entry: {
app: [
'babel-polyfill',
path.resolve(__dirname, 'lib/client.js')
],
vendor: ['pixi']
},
devtool: 'cheap-source-map',
output: {
pathinfo: true,
path: path.resolve(__dirname, 'public'),
publicPath: './public/',
filename: 'bundle.js'
},
watch: true,
plugins: [
definePlugin,
new webpack.optimize.CommonsChunkPlugin({ name: 'vendor'/* chunkName= */, filename: 'vendor.bundle.js'/* filename= */}),
new BrowserSyncPlugin({
host: process.env.IP || 'localhost',
port: process.env.PORT || 3000,
server: {
baseDir: ['./', './public']
}
})
],
module: {
rules: [
{ test: /\.js$/, use: ['babel-loader'], include: path.join(__dirname, 'src') },
{ test: /pixi\.js/, use: ['expose-loader?pixi'] }
]
},
node: {
fs: 'empty',
net: 'empty',
tls: 'empty'
},
resolve: {
alias: {
'pixi': pixi
}
}
}
|
from brownie import chain
from brownie.test import strategy
WEEK = 7 * 86400
class StateMachine:
"""
Validate gauge weights and gauge weight sum.
Strategies
----------
st_type : Decimal
Gauge type, multiplied by `len(self.gauges)` to choose a value
st_gauge_weight : int
Gauge weight
st_type_wiehgt : int
Type weight
"""
st_type = strategy("decimal", min_value=0, max_value="0.99999999")
st_gauge_weight = strategy("uint", min_value=10 ** 17, max_value=10 ** 19)
st_type_weight = strategy("uint", min_value=10 ** 17, max_value=10 ** 19)
def __init__(self, LiquidityGaugeV3_1, accounts, gauge_controller, mock_lp_token, minter, reward_policy_maker):
self.LiquidityGaugeV3_1 = LiquidityGaugeV3_1
self.accounts = accounts
self.lp_token = mock_lp_token
self.minter = minter
self.controller = gauge_controller
self.reward_policy_maker = reward_policy_maker
def setup(self):
self.type_weights = []
self.gauges = []
def initialize_add_type(self, st_type_weight):
"""
Add a new gauge type.
This is also included as an intialize to increase the number of types early in the test.
"""
self.rule_add_type(st_type_weight)
def rule_add_type(self, st_type_weight):
"""
Add a new gauge type.
"""
self.controller.add_type(b"Type!", st_type_weight, {"from": self.accounts[0]})
self.type_weights.append(st_type_weight)
def rule_add_gauge(self, st_type, st_gauge_weight):
"""
Add a new gauge.
If no types have been added, this rule has not effect.
"""
if not self.type_weights:
return
gauge_type = int(st_type * (len(self.type_weights)))
gauge = self.LiquidityGaugeV3_1.deploy(
self.lp_token, self.minter, self.accounts[0], self.reward_policy_maker, {"from": self.accounts[0]}
)
self.controller.add_gauge(gauge, gauge_type, st_gauge_weight, {"from": self.accounts[0]})
self.gauges.append({"contract": gauge, "type": gauge_type, "weight": st_gauge_weight})
def _gauge_weight(self, idx):
return sum(i["weight"] for i in self.gauges if i["type"] == idx)
def invariant_gauge_weight_sums(self):
"""
Validate the gauge weight sums per type.
"""
for idx in range(len(self.type_weights)):
gauge_weight_sum = self._gauge_weight(idx)
assert self.controller.get_weights_sum_per_type(idx) == gauge_weight_sum
def invariant_total_type_weight(self):
"""
Validate the total weight.
"""
total_weight = sum(
self._gauge_weight(idx) * weight for idx, weight in enumerate(self.type_weights)
)
assert self.controller.get_total_weight() == total_weight
def invariant_relative_gauge_weight(self):
"""
Validate the relative gauge weights.
"""
chain.sleep(WEEK)
total_weight = sum(
self._gauge_weight(idx) * weight for idx, weight in enumerate(self.type_weights)
)
for gauge, weight, idx in [(i["contract"], i["weight"], i["type"]) for i in self.gauges]:
self.controller.checkpoint_gauge(gauge)
expected = 10 ** 18 * self.type_weights[idx] * weight // total_weight
assert self.controller.gauge_relative_weight(gauge) == expected
def test_gauge(state_machine, LiquidityGaugeV3_1, accounts, gauge_controller, mock_lp_token, minter, reward_policy_maker):
state_machine(StateMachine, LiquidityGaugeV3_1, accounts, gauge_controller, mock_lp_token, minter, reward_policy_maker)
|
#include "types.h"
#include "x86.h"
#include "defs.h"
#include "date.h"
#include "param.h"
#include "memlayout.h"
#include "mmu.h"
#include "proc.h"
int
sys_fork(void)
{
return fork();
}
int
sys_exit(void)
{
exit();
return 0; // not reached
}
int
sys_wait(void)
{
return wait();
}
int
sys_kill(void)
{
int pid;
if(argint(0, &pid) < 0)
return -1;
return kill(pid);
}
int
sys_getpid(void)
{
return myproc()->pid;
}
int
sys_sbrk(void)
{
int addr;
int n;
if(argint(0, &n) < 0)
return -1;
addr = myproc()->sz;
if(growproc(n) < 0)
return -1;
return addr;
}
int
sys_sleep(void)
{
int n;
uint ticks0;
if(argint(0, &n) < 0)
return -1;
acquire(&tickslock);
ticks0 = ticks;
while(ticks - ticks0 < n){
if(myproc()->killed){
release(&tickslock);
return -1;
}
sleep(&ticks, &tickslock);
}
release(&tickslock);
return 0;
}
// return how many clock tick interrupts have occurred
// since start.
int
sys_uptime(void)
{
uint xticks;
acquire(&tickslock);
xticks = ticks;
release(&tickslock);
return xticks;
}
int
sys_cps(void)
{
return cps ();
}
|
(function(e){const i=e["el"]=e["el"]||{};i.dictionary=Object.assign(i.dictionary||{},{"%0 of %1":"",Aquamarine:"",Black:"","Block quote":"Περιοχή παράθεσης",Blue:"",Bold:"Έντονη","Bulleted List":"Λίστα κουκκίδων","Bulleted list styles toolbar":"",Cancel:"Ακύρωση","Centered image":"","Change image text alternative":"Αλλαγή εναλλακτικού κείμενου","Choose heading":"Επιλέξτε κεφαλίδα",Circle:"",Code:"",Decimal:"","Decimal with leading zero":"","Dim grey":"",Disc:"",Downloadable:"","Dropdown toolbar":"","Edit block":"","Edit link":"","Editor toolbar":"","Enter image caption":"Λεζάντα","Full size image":"Εικόνα πλήρης μεγέθους",Green:"",Grey:"",Heading:"Κεφαλίδα","Heading 1":"Κεφαλίδα 1","Heading 2":"Κεφαλίδα 2","Heading 3":"Κεφαλίδα 3","Heading 4":"","Heading 5":"","Heading 6":"","Image resize list":"","Image toolbar":"","image widget":"",Insert:"","Insert image":"Εισαγωγή εικόνας","Insert image via URL":"",Italic:"Πλάγια","Left aligned image":"","Light blue":"","Light green":"","Light grey":"",Link:"Σύνδεσμος","Link image":"","Link URL":"Διεύθυνση συνδέσμου","Lower-latin":"","Lower–roman":"",Next:"","Numbered List":"Αριθμημένη λίστα","Numbered list styles toolbar":"","Open in a new tab":"","Open link in new tab":"",Orange:"",Original:"",Paragraph:"Παράγραφος",Previous:"",Purple:"",Red:"",Redo:"Επανάληψη","Remove color":"","Resize image":"","Resize image to %0":"","Resize image to the original size":"","Restore default":"","Rich Text Editor":"Επεξεργαστής Πλούσιου Κειμένου","Rich Text Editor, %0":"Επεξεργαστής Πλούσιου Κειμένου, 0%","Right aligned image":"",Save:"Αποθήκευση","Show more items":"","Side image":"",Square:"","Text alternative":"Εναλλακτικό κείμενο","This link has no URL":"","To-do List":"","Toggle the circle list style":"","Toggle the decimal list style":"","Toggle the decimal with leading zero list style":"","Toggle the disc list style":"","Toggle the lower–latin list style":"","Toggle the lower–roman list style":"","Toggle the square list style":"","Toggle the upper–latin list style":"","Toggle the upper–roman list style":"",Turquoise:"",Undo:"Αναίρεση",Unlink:"Αφαίρεση συνδέσμου",Update:"","Update image URL":"","Upload failed":"","Upper-latin":"","Upper-roman":"",White:"",Yellow:""});i.getPluralForm=function(e){return e!=1}})(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
|
/*
$ termux-download [-d description] [-t title] url-to-download
Download a resource using the system download manager.
-d description description for the download request notification
-t title title for the download request notification
- Usage:
api.download()
.url('...')
.title('cool')
.description('Download me')
.run()
*/
const BaseClass = require('../BaseClass')
class Download extends BaseClass {
constructor () {
super()
this.cmd = 'termux-download'
}
getArgs () {
return this.setArgs({
_: [this._url],
description: this._description,
title: this._title
}, {
aliases: {
description: 'd',
title: 't'
}
})
}
url (str) {
this._url = str
return this
}
title (str) {
this._title = str
return this
}
description (str) {
this._description = str
return this
}
validateCmd () {
if (!this._url) return false
else return true
}
}
module.exports = Download
|
import {Services} from '#service';
import {createCustomEvent} from '#utils/event-helper';
import {whenContentIniLoadMeasure} from '../ini-load';
/**
* Registers ini-load listener that will fire custom 'amp-ini-load' event
* on window (accessible if creative is friendly to ad tag) and postMessage to
* window parent.
* @param {!../service/ampdoc-impl.AmpDoc} ampdoc
*/
export function registerIniLoadListener(ampdoc) {
const {win} = ampdoc;
const root = ampdoc.getRootNode();
whenContentIniLoadMeasure(
ampdoc,
win,
Services.viewportForDoc(ampdoc).getLayoutRect(
root.documentElement || root.body || root
)
).then(() => {
win.dispatchEvent(
createCustomEvent(win, 'amp-ini-load', /* detail */ null, {bubbles: true})
);
if (win.parent) {
win.parent./*OK*/ postMessage('amp-ini-load', '*');
}
});
}
/**
* Function to get the amp4ads-identifier from the meta tag on the document
* @param {!Window} win
* @return {?string}
*/
export function getA4AId(win) {
const a4aIdMetaTag = win.document.head.querySelector(
'meta[name="amp4ads-id"]'
);
if (a4aIdMetaTag) {
return a4aIdMetaTag.getAttribute('content');
}
return null;
}
|
/*- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (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.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is INRIA.
-
- The Initial Developer of the Original Code is INRIA.
- Portions created by the Initial Developer are Copyright (C) 2010-2011
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Fabien Cazenave <fabien@cazenave.cc>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK *****/
// hide location bar, requires Gecko 2+ (Firefox 4+)
// https://developer.mozilla.org/en/Hiding_browser_chrome
try {
var prevFunc = XULBrowserWindow.hideChromeForLocation;
XULBrowserWindow.hideChromeForLocation = function(aLocation) {
return (/^chrome:\/\/timesheets\//i.test(aLocation)) || prevFunc.apply(XULBrowserWindow, [aLocation]);
}
} catch(e) {}
// open chrome://timesheets/content/ in a new tab, or reuse existing tab
// https://developer.mozilla.org/en/Code_snippets/Tabbed_browser#Reusing_tabs
function openAndReuseOneTabPerURL(url) {
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var browserEnumerator = wm.getEnumerator("navigator:browser");
// Check each browser instance for our URL
var found = false;
while (!found && browserEnumerator.hasMoreElements()) {
var browserWin = browserEnumerator.getNext();
var tabbrowser = browserWin.gBrowser;
// Check each tab of this browser instance
var numTabs = tabbrowser.browsers.length;
for (var index = 0; index < numTabs; index++) {
var currentBrowser = tabbrowser.getBrowserAtIndex(index);
if (url == currentBrowser.currentURI.spec) {
// The URL is already opened. Select this tab.
tabbrowser.selectedTab = tabbrowser.tabContainer.childNodes[index];
// Focus *this* browser-window
browserWin.focus();
found = true;
break;
}
}
}
// Our URL isn't open. Open it now.
if (!found) {
var recentWindow = wm.getMostRecentWindow("navigator:browser");
if (recentWindow) {
// Use an existing browser window
recentWindow.delayedOpenTab(url, null, null, null, null);
}
else {
// No browser windows are open, so open a new one.
window.open(url);
}
}
}
function openTimesheetComposer() {
openAndReuseOneTabPerURL("chrome://timesheets/content/timesheets.xul");
}
|
'use strict'
const uuid = require('uuid-base62')
const fixtures = {
getImage () {
let id = uuid.uuid()
return {
description: 'an #awesome picture with #tags #platzi',
tags: [ 'awesome', 'tags', 'platzi' ],
url: `https://platzigram.test/${uuid.v4()}.jpg`,
likes: 0,
liked: false,
userId: uuid.uuid(),
publicId: uuid.encode(id),
id: id,
createdAt: new Date().toString()
}
},
getImages (n) {
let images = []
while (n-- > 0) {
images.push(this.getImage())
}
return images
},
getUser () {
return {
id: uuid.uuid(),
name: 'A random user',
username: 'platzigram',
createdAt: new Date().toString()
}
}
}
module.exports = fixtures
|
"""The /data controller. Please refer to doc/api for more information."""
import json
import logging
from typing import Tuple, Union
from uuid import UUID
from flask import Blueprint, session, request, jsonify, Response
from fractalis import celery, redis
from fractalis.authorization import authorized
from fractalis.data.etlhandler import ETLHandler
from fractalis.schema import CreateDataSchema
from fractalis.sync import remove_data
from fractalis.validator import validate_json, validate_schema
data_blueprint = Blueprint('data_blueprint', __name__)
logger = logging.getLogger(__name__)
@data_blueprint.route('', methods=['POST'])
@validate_json
@validate_schema(CreateDataSchema)
@authorized
def create_data_task() -> Tuple[Response, int]:
"""Submit new ETL tasks based on the payload of the request body.
See doc/api/ for more information.
:return: Empty response. Everything important is stored in the session.
"""
logger.debug("Received POST request on /data.")
wait = request.args.get('wait') == '1'
payload = request.get_json(force=True)
try:
etl_handler = ETLHandler.factory(service_name=payload['service'],
auth=payload['auth'])
except Exception as e:
return jsonify({'error': str(e)}), 400
task_ids = etl_handler.handle(descriptors=payload['descriptors'],
data_tasks=session['data_tasks'],
use_existing=False,
wait=wait)
session['data_tasks'] += task_ids
session['data_tasks'] = list(set(session['data_tasks']))
logger.debug("Tasks successfully submitted. Sending response.")
return jsonify(''), 201
def get_data_state_for_task_id(task_id: str, wait: bool) -> Union[dict, None]:
"""Return data state associated with task id.
:param task_id: The id associated with the ETL task.
:param wait: If true and ETL is still running wait for it.
:return: Data state that has been stored in Redis.
"""
async_result = celery.AsyncResult(task_id)
if wait and async_result.state == 'SUBMITTED':
logger.debug("'wait' was set. Waiting for tasks to finish ...")
async_result.get(propagate=False)
value = redis.get('data:{}'.format(task_id))
if not value:
return None
data_state = json.loads(value)
# add additional information to data_state
result = async_result.result
if isinstance(result, Exception): # Exception -> str
result = "{}: {}".format(type(result).__name__, str(result))
data_state['etl_message'] = result
data_state['etl_state'] = async_result.state
return data_state
@data_blueprint.route('', methods=['GET'])
def get_all_data() -> Tuple[Response, int]:
"""Get information for all tasks that have been submitted in the lifetime
of the current session.
See doc/api/ for more information.
:return: Information associated with each submitted task
"""
logger.debug("Received GET request on /data.")
wait = request.args.get('wait') == '1'
data_states = []
existing_data_tasks = []
for task_id in session['data_tasks']:
data_state = get_data_state_for_task_id(task_id, wait)
if data_state is None:
warning = "Data state with task_id '{}' expired.".format(task_id)
logger.warning(warning)
continue
# remove internal information from response
del data_state['file_path']
del data_state['meta']
# add additional information to response
data_states.append(data_state)
existing_data_tasks.append(task_id)
session['data_tasks'] = existing_data_tasks
logger.debug("Data states collected. Sending response.")
return jsonify({'data_states': data_states}), 200
@data_blueprint.route('/<uuid:task_id>', methods=['DELETE'])
@authorized
def delete_data(task_id: UUID) -> Tuple[Response, int]:
"""Remove all traces of the data associated with the given task id.
:param task_id: The id associated with the data
See doc/api/ for more information.
:return: Empty response.
"""
logger.debug("Received DELETE request on /data/task_id.")
wait = request.args.get('wait') == '1'
task_id = str(task_id)
if task_id not in session['data_tasks']:
error = "Task ID '{}' not found in session. " \
"Refusing access.".format(task_id)
logger.warning(error)
return jsonify({'error': error}), 403
session['data_tasks'].remove(task_id)
# possibly dangerous: http://stackoverflow.com/a/29627549
celery.control.revoke(task_id, terminate=True, signal='SIGUSR1', wait=wait)
remove_data(task_id=task_id)
logger.debug("Successfully removed data from session. Sending response.")
return jsonify(''), 200
@data_blueprint.route('', methods=['DELETE'])
@authorized
def delete_all_data() -> Tuple[Response, int]:
"""Remove all traces of all data associated with this session.
:return: Empty response.
"""
logger.debug("Received DELETE request on /data.")
wait = request.args.get('wait') == '1'
for task_id in session['data_tasks']:
remove_data(task_id=task_id)
# possibly dangerous: http://stackoverflow.com/a/29627549
celery.control.revoke(task_id, terminate=True,
signal='SIGUSR1', wait=wait)
session['data_tasks'] = []
logger.debug("Successfully removed all data from session. "
"Sending response.")
return jsonify(''), 200
@data_blueprint.route('/meta/<uuid:task_id>', methods=['GET'])
@authorized
def get_meta_information(task_id: UUID) -> Tuple[Response, int]:
"""Get meta information for given task id.
:return: meta information object stored in redis.
"""
logger.debug("Received GET request on /data/meta/task_id.")
wait = request.args.get('wait') == '1'
task_id = str(task_id)
if task_id not in session['data_tasks']:
error = "Task ID '{}' not found in session. " \
"Refusing access.".format(task_id)
logger.warning(error)
return jsonify({'error': error}), 403
data_state = get_data_state_for_task_id(task_id, wait)
if data_state is None:
error = "Could not find redis entry for this task id '{}'. " \
"The entry probably expired.".format(task_id)
logger.error(error)
return jsonify({'error': error}), 404
logger.debug("Successfully gather meta information. Sending response.")
return jsonify({'meta': data_state['meta']}), 200
|
"""Endless Fake
Usage:
endless-fake-patch [--disable-random] <game-dir>
endless-fake-patch (-h | --help)
Options:
--disable-random Always output the same level.
-h --help Show this screen.
--version Show version.
"""
import os
import re
from docopt import docopt
from .. import version
def patch_files(game_dir):
game_html = os.path.join(game_dir, "game.html")
game_min_js = os.path.join(game_dir, "game.min.js")
print("Patching game.html")
with open(game_html, "r") as stream:
data = stream.read()
with open(game_html, "w") as stream:
stream.write(re.sub(r"//cdn\.gameplayer\.io/api/js/", "", data))
print("Patching game.min.js")
with open(game_min_js, "r") as stream:
data = stream.read()
with open(game_min_js, "w") as stream:
data = re.sub(r"this\.preserveDrawingBuffer=d\.preserveDrawingBuffer",
"this.preserveDrawingBuffer:1", data)
data = re.sub(r"getContext\(\"webgl\"\)",
"getContext(\"webgl\",{preserveDrawingBuffer:true})", data)
data = re.sub(r"getContext\(\"experimental-webgl\"\)",
"getContext(\"experimental-webgl\",{preserveDrawingBuffer:true})", data)
stream.write(data)
def main():
args = docopt(__doc__, version=version, options_first=True)
output_dir = args["<game-dir>"]
patch_files(output_dir)
if __name__ == "__main__":
main()
|
import Vue from 'vue'
import Router from 'vue-router'
import Home from '../pages/Home.vue'
import Categories from '../pages/Categories.vue'
import CategoryJokes from '../pages/CategoryJokes.vue'
import Search from '../pages/Search.vue'
import SearchDetail from '../pages/SearchDetail.vue'
import About from '../pages/About.vue'
Vue.use(Router)
var router = new Router({
routes: [
{
path: '/',
name: 'Home',
component: Home
},
{
path: '/categories',
name: 'Categories',
component: Categories
},
{
path: '/category/jokes',
name: 'CategoryJokes',
component: CategoryJokes
},
{
path: '/search',
name: 'Search',
component: Search
},
{
path: '/search/detail',
name: 'SearchDetail',
component: SearchDetail
},
{
path: '/about',
name: 'About',
component: About
}
]
})
export default router
|
import styled from "styled-components"
const iconColorsMap = {
facebook: "#4968ad",
twitter: "#49a1eb",
instagram: "black",
linkedIn: "#3077b0",
youtube: "#eb3223",
}
export const StyledSocialFollow = styled.div`
p {
margin-top: 0;
}
`
export const SocialFollowIcon = styled.a`
display: inline-block;
margin: 0 1rem;
transition: transform 250ms;
font-size: 1.4rem;
color: ${props => iconColorsMap[props.type]} !important;
&:hover {
-webkit-transform: translateY(-2px);
-ms-transform: translateY(-2px);
transform: translateY(-2px);
}
`
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#if defined(GB_MEASURE_MEMORY_FOR_THIS)
#undef GB_MEASURE_MEMORY_FOR_THIS
#endif
#ifdef __cplusplus
#include <cstdlib>
#else
#include <stdlib.h>
#endif
#include "azure_c_shared_utility/optimize_size.h"
#include "azure_c_shared_utility/gballoc.h"
#include "testrunnerswitcher.h"
#include "azure_c_shared_utility/lock.h"
#ifndef SIZE_MAX
#define SIZE_MAX ((size_t)~(size_t)0)
#endif
static TEST_MUTEX_HANDLE g_testByTest;
static void* TEST_ALLOC_PTR1 = (void*)0x4242;
static void* TEST_ALLOC_PTR2 = (void*)0x4243;
static void* TEST_REALLOC_PTR = (void*)0x4245;
#define OVERHEAD_SIZE 4096
static const LOCK_HANDLE TEST_LOCK_HANDLE = (LOCK_HANDLE)0x4244;
#define ENABLE_MOCKS
#include "umock_c/umock_c.h"
#include "umock_c/umock_c_prod.h"
IMPLEMENT_UMOCK_C_ENUM_TYPE(LOCK_RESULT, LOCK_RESULT_VALUES);
#ifdef __cplusplus
extern "C" {
#endif
MOCKABLE_FUNCTION(, void*, mock_malloc, size_t, size);
MOCKABLE_FUNCTION(, void*, mock_calloc, size_t, nmemb, size_t, size);
MOCKABLE_FUNCTION(, void*, mock_realloc, void*, ptr, size_t, size);
MOCKABLE_FUNCTION(, void, mock_free, void*, ptr);
MOCKABLE_FUNCTION(, LOCK_HANDLE, Lock_Init);
MOCKABLE_FUNCTION(, LOCK_RESULT, Lock_Deinit, LOCK_HANDLE, handle);
MOCKABLE_FUNCTION(, LOCK_RESULT, Lock, LOCK_HANDLE, handle);
MOCKABLE_FUNCTION(, LOCK_RESULT, Unlock, LOCK_HANDLE, handle);
#ifdef __cplusplus
}
#endif
MU_DEFINE_ENUM_STRINGS(UMOCK_C_ERROR_CODE, UMOCK_C_ERROR_CODE_VALUES)
static void on_umock_c_error(UMOCK_C_ERROR_CODE error_code)
{
ASSERT_FAIL("umock_c reported error :%s", MU_ENUM_TO_STRING(UMOCK_C_ERROR_CODE, error_code));
}
BEGIN_TEST_SUITE(GBAlloc_UnitTests)
TEST_SUITE_INITIALIZE(TestClassInitialize)
{
int result;
g_testByTest = TEST_MUTEX_CREATE();
ASSERT_IS_NOT_NULL(g_testByTest);
result = umock_c_init(on_umock_c_error);
ASSERT_ARE_EQUAL(int, 0, result);
REGISTER_UMOCK_ALIAS_TYPE(LOCK_HANDLE, void*);
REGISTER_TYPE(LOCK_RESULT, LOCK_RESULT);
REGISTER_GLOBAL_MOCK_RETURN(mock_malloc, TEST_ALLOC_PTR1);
REGISTER_GLOBAL_MOCK_RETURN(mock_realloc, TEST_ALLOC_PTR1);
REGISTER_GLOBAL_MOCK_RETURN(mock_calloc, TEST_ALLOC_PTR1);
REGISTER_GLOBAL_MOCK_RETURN(Lock_Init, TEST_LOCK_HANDLE);
REGISTER_GLOBAL_MOCK_RETURN(Lock, LOCK_OK);
REGISTER_GLOBAL_MOCK_RETURN(Unlock, LOCK_OK);
}
TEST_SUITE_CLEANUP(TestClassCleanup)
{
umock_c_deinit();
TEST_MUTEX_DESTROY(g_testByTest);
}
TEST_FUNCTION_INITIALIZE(TestMethodInitialize)
{
if (TEST_MUTEX_ACQUIRE(g_testByTest))
{
ASSERT_FAIL("our mutex is ABANDONED. Failure in test framework");
}
umock_c_reset_all_calls();
}
TEST_FUNCTION_CLEANUP(TestMethodCleanup)
{
gballoc_deinit();
TEST_MUTEX_RELEASE(g_testByTest);
}
/* gballoc_init */
/* Tests_SRS_GBALLOC_01_002: [Upon initialization the total memory used and maximum total memory used tracked by the module shall be set to 0.] */
TEST_FUNCTION(gballoc_init_resets_memory_used)
{
//arrange
void* allocation;
gballoc_init();
allocation = malloc(OVERHEAD_SIZE);
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
gballoc_free(gballoc_malloc(1));
gballoc_deinit();
// act
gballoc_init();
// assert
ASSERT_ARE_EQUAL(size_t, 0, gballoc_getMaximumMemoryUsed());
ASSERT_ARE_EQUAL(size_t, 0, gballoc_getCurrentMemoryUsed());
///cleanup
free(allocation);
}
/* Tests_SRS_GBALLOC_01_024: [gballoc_init shall initialize the gballoc module and return 0 upon success.] */
/* Tests_SRS_GBALLOC_01_026: [gballoc_Init shall create a lock handle that will be used to make the other gballoc APIs thread-safe.] */
TEST_FUNCTION(when_gballoc_init_calls_lock_init_and_it_succeeds_then_gballoc_init_succeeds)
{
// arrange
int result;
STRICT_EXPECTED_CALL(Lock_Init());
// act
result = gballoc_init();
// assert
ASSERT_ARE_EQUAL(int, 0, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
}
/* Tests_SRS_GBALLOC_01_027: [If the Lock creation fails, gballoc_init shall return a non-zero value.] */
TEST_FUNCTION(when_lock_init_fails_gballoc_init_fails)
{
// arrange
int result;
STRICT_EXPECTED_CALL(Lock_Init())
.SetReturn((LOCK_HANDLE)NULL);
// act
result = gballoc_init();
// assert
ASSERT_ARE_NOT_EQUAL(int, 0, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
}
/* Tests_SRS_GBALLOC_01_025: [Init after Init shall fail and return a non-zero value.] */
TEST_FUNCTION(gballoc_init_after_gballoc_init_fails)
{
// arrange
int result;
STRICT_EXPECTED_CALL(Lock_Init());
gballoc_init();
//act
result = gballoc_init();
// assert
ASSERT_ARE_NOT_EQUAL(int, 0, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
}
/* gballoc_deinit */
/* Tests_SRS_GBALLOC_01_028: [gballoc_deinit shall free all resources allocated by gballoc_init.] */
TEST_FUNCTION(gballoc_deinit_frees_the_lock_when_the_module_was_initialized)
{
// arrange
gballoc_init();
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock_Deinit(TEST_LOCK_HANDLE));
// act
gballoc_deinit();
// assert
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
}
/* Tests_SRS_GBALLOC_01_029: [if gballoc is not initialized gballoc_deinit shall do nothing.] */
TEST_FUNCTION(gballoc_deinit_after_gballoc_deinit_doesnot_free_lock)
{
//arrange
// act
gballoc_deinit();
// assert
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
}
/* gballoc_malloc */
/* Tests_SRS_GBALLOC_01_048: [If acquiring the lock fails, gballoc_malloc shall return NULL.] */
TEST_FUNCTION(when_acquiring_the_lock_fails_gballoc_malloc_fails)
{
// arrange
void* result;
gballoc_init();
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE))
.SetReturn(LOCK_ERROR);
// act
result = gballoc_malloc(1);
// assert
ASSERT_IS_NULL(result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
}
/* Tests_SRS_GBALLOC_01_003: [gballoc_malloc shall call the C99 malloc function and return its result.] */
/* Tests_SRS_GBALLOC_01_004: [If the underlying malloc call is successful, gballoc_malloc shall increment the total memory used with the amount indicated by size.] */
/* Tests_SRS_GBALLOC_01_030: [gballoc_malloc shall ensure thread safety by using the lock created by gballoc_Init.] */
TEST_FUNCTION(gballoc_malloc_with_0_Size_Calls_Underlying_malloc)
{
// arrange
void* result;
void* allocation;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
/* This is the call to the underlying malloc with the size we want to allocate */
STRICT_EXPECTED_CALL(mock_malloc(0));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_malloc(0);
// assert
ASSERT_ARE_EQUAL(void_ptr, TEST_ALLOC_PTR1, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_ARE_EQUAL(size_t, 0, gballoc_getMaximumMemoryUsed());
// cleanup
gballoc_free(result);
free(allocation);
}
/* Tests_SRS_GBALLOC_01_003: [gballoc_malloc shall call the C99 malloc function and return its result.] */
/* Tests_SRS_GBALLOC_01_004: [If the underlying malloc call is successful, gballoc_malloc shall increment the total memory used with the amount indicated by size.] */
TEST_FUNCTION(gballoc_malloc_with_1_Size_Calls_Underlying_malloc_And_Increases_Max_Used)
{
// arrange
void* result;
void* allocation;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
/* This is the call to the underlying malloc with the size we want to allocate */
STRICT_EXPECTED_CALL(mock_malloc(1));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_malloc(1);
// assert
ASSERT_ARE_EQUAL(void_ptr, TEST_ALLOC_PTR1, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_ARE_EQUAL(size_t, 1, gballoc_getMaximumMemoryUsed());
// cleanup
gballoc_free(result);
free(allocation);
}
/* Tests_SRS_GBALLOC_01_012: [When the underlying malloc call fails, gballoc_malloc shall return NULL and size should not be counted towards total memory used.] */
TEST_FUNCTION(When_malloc_Fails_Then_gballoc_malloc_fails_too)
{
// arrange
void* result;
void* allocation;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
/* This is the call to the underlying malloc with the size we want to allocate */
STRICT_EXPECTED_CALL(mock_malloc(1))
.SetReturn((void*)NULL);
STRICT_EXPECTED_CALL(mock_free(allocation));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_malloc(1);
// assert
ASSERT_IS_NULL(result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_ARE_EQUAL(size_t, 0, gballoc_getMaximumMemoryUsed());
// cleanup
free(allocation);
}
/* Tests_SRS_GBALLOC_01_013: [When gballoc_malloc fails allocating memory for its internal use, gballoc_malloc shall return NULL.] */
TEST_FUNCTION(When_allocating_memory_for_tracking_information_fails_Then_gballoc_malloc_fails_too)
{
// arrange
void* result;
gballoc_init();
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
EXPECTED_CALL(mock_malloc(0))
.SetReturn((void*)NULL);
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_malloc(1);
// assert
ASSERT_IS_NULL(result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_ARE_EQUAL(size_t, 0, gballoc_getMaximumMemoryUsed());
}
/* Tests_SRS_GBALLOC_01_039: [If gballoc was not initialized gballoc_malloc shall simply call malloc without any memory tracking being performed.] */
TEST_FUNCTION(gballoc_malloc_after_deinit_calls_crt_malloc)
{
// arrange
void* result;
STRICT_EXPECTED_CALL(mock_malloc(1));
//act
result = gballoc_malloc(1);
//assert
ASSERT_IS_NOT_NULL(result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
}
/* gballoc_calloc */
/* Tests_SRS_GBALLOC_01_046: [If acquiring the lock fails, gballoc_calloc shall return NULL.] */
TEST_FUNCTION(when_acquiring_the_lock_fails_gballoc_calloc_fails)
{
// arrange
void* result;
gballoc_init();
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE))
.SetReturn(LOCK_ERROR);
// act
result = gballoc_calloc(1,1);
// assert
ASSERT_IS_NULL(result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
}
/* Tests_SRS_GBALLOC_01_020: [gballoc_calloc shall call the C99 calloc function and return its result.] */
/* Tests_SRS_GBALLOC_01_021: [If the underlying calloc call is successful, gballoc_calloc shall increment the total memory used with nmemb*size.] */
/* Tests_SRS_GBALLOC_01_031: [gballoc_calloc shall ensure thread safety by using the lock created by gballoc_Init] */
TEST_FUNCTION(gballoc_calloc_with_0_Size_And_ItemCount_Calls_Underlying_calloc)
{
// arrange
void* result;
void* allocation;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
/* This is the call to the underlying malloc with the size we want to allocate */
STRICT_EXPECTED_CALL(mock_calloc(0, 0));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_calloc(0, 0);
// assert
ASSERT_ARE_EQUAL(void_ptr, TEST_ALLOC_PTR1, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_ARE_EQUAL(size_t, 0, gballoc_getMaximumMemoryUsed());
// cleanup
gballoc_free(result);
free(allocation);
}
/* Tests_SRS_GBALLOC_01_020: [gballoc_calloc shall call the C99 calloc function and return its result.] */
/* Tests_SRS_GBALLOC_01_021: [If the underlying calloc call is successful, gballoc_calloc shall increment the total memory used with nmemb*size.] */
TEST_FUNCTION(gballoc_calloc_with_1_Item_Of_1_Size_Calls_Underlying_malloc_And_Increases_Max_Used)
{
// arrange
void* result;
void* allocation;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
/* This is the call to the underlying malloc with the size we want to allocate */
STRICT_EXPECTED_CALL(mock_calloc(1, 1));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_calloc(1, 1);
// assert
ASSERT_ARE_EQUAL(void_ptr, TEST_ALLOC_PTR1, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_ARE_EQUAL(size_t, 1, gballoc_getMaximumMemoryUsed());
// cleanup
gballoc_free(result);
free(allocation);
}
/* Tests_SRS_GBALLOC_01_020: [gballoc_calloc shall call the C99 calloc function and return its result.] */
/* Tests_SRS_GBALLOC_01_021: [If the underlying calloc call is successful, gballoc_calloc shall increment the total memory used with nmemb*size.] */
TEST_FUNCTION(gballoc_calloc_with_1_Item_Of_0_Size_Calls_Underlying_malloc_And_Does_Not_Increase_Max_Used)
{
// arrange
void* result;
void* allocation;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
/* This is the call to the underlying malloc with the size we want to allocate */
STRICT_EXPECTED_CALL(mock_calloc(1, 0));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_calloc(1, 0);
// assert
ASSERT_ARE_EQUAL(void_ptr, TEST_ALLOC_PTR1, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_ARE_EQUAL(size_t, 0, gballoc_getMaximumMemoryUsed());
// cleanup
gballoc_free(result);
free(allocation);
}
/* Tests_SRS_GBALLOC_01_020: [gballoc_calloc shall call the C99 calloc function and return its result.] */
/* Tests_SRS_GBALLOC_01_021: [If the underlying calloc call is successful, gballoc_calloc shall increment the total memory used with nmemb*size.] */
TEST_FUNCTION(gballoc_calloc_with_0_Items_Of_1_Size_Calls_Underlying_malloc_And_Does_Not_Increase_Max_Used)
{
// arrange
void* result;
void* allocation;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
/* This is the call to the underlying malloc with the size we want to allocate */
STRICT_EXPECTED_CALL(mock_calloc(0, 1));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_calloc(0, 1);
// assert
ASSERT_ARE_EQUAL(void_ptr, TEST_ALLOC_PTR1, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_ARE_EQUAL(size_t, 0, gballoc_getMaximumMemoryUsed());
// cleanup
gballoc_free(result);
free(allocation);
}
/* Tests_SRS_GBALLOC_01_020: [gballoc_calloc shall call the C99 calloc function and return its result.] */
/* Tests_SRS_GBALLOC_01_021: [If the underlying calloc call is successful, gballoc_calloc shall increment the total memory used with nmemb*size.] */
TEST_FUNCTION(gballoc_calloc_with_42_Items_Of_2_Size_Calls_Underlying_malloc_And_Increases_Max_Size)
{
// arrange
void* result;
void* allocation;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
/* This is the call to the underlying malloc with the size we want to allocate */
STRICT_EXPECTED_CALL(mock_calloc(42, 2));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_calloc(42, 2);
// assert
ASSERT_ARE_EQUAL(void_ptr, TEST_ALLOC_PTR1, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_ARE_EQUAL(size_t, 84, gballoc_getMaximumMemoryUsed());
// cleanup
gballoc_free(result);
free(allocation);
}
/* Tests_SRS_GBALLOC_01_022: [When the underlying calloc call fails, gballoc_calloc shall return NULL and size should not be counted towards total memory used.] */
TEST_FUNCTION(When_calloc_Fails_Then_gballoc_calloc_fails_too)
{
// arrange
void* result;
void* allocation;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
/* This is the call to the underlying malloc with the size we want to allocate */
STRICT_EXPECTED_CALL(mock_calloc(1, 1))
.SetReturn((void*)NULL);
STRICT_EXPECTED_CALL(mock_free(allocation));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_calloc(1, 1);
// assert
ASSERT_IS_NULL(result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_ARE_EQUAL(size_t, 0, gballoc_getMaximumMemoryUsed());
// cleanup
free(allocation);
}
/* Tests_SRS_GBALLOC_01_023: [When gballoc_calloc fails allocating memory for its internal use, gballoc_calloc shall return NULL.] */
TEST_FUNCTION(When_allocating_memory_for_tracking_information_fails_Then_gballoc_calloc_fails_too)
{
// arrange
void* result;
gballoc_init();
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
EXPECTED_CALL(mock_malloc(0))
.SetReturn((void*)NULL);
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_calloc(1, 1);
// assert
ASSERT_IS_NULL(result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_ARE_EQUAL(size_t, 0, gballoc_getMaximumMemoryUsed());
}
/* Tests_SRS_GBALLOC_01_040: [If gballoc was not initialized gballoc_calloc shall simply call calloc without any memory tracking being performed.] */
TEST_FUNCTION(gballoc_calloc_after_deinit_calls_crt_calloc)
{
// arrange
void* result;
STRICT_EXPECTED_CALL(mock_calloc(1, 1));
// act
result = gballoc_calloc(1, 1);
// assert
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_IS_NOT_NULL(result);
}
/* gballoc_realloc */
/* Tests_SRS_GBALLOC_01_047: [If acquiring the lock fails, gballoc_realloc shall return NULL.]*/
TEST_FUNCTION(when_acquiring_the_lock_fails_gballoc_realloc_fails)
{
// arrange
void* result;
gballoc_init();
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE))
.SetReturn(LOCK_ERROR);
// act
result = gballoc_realloc(NULL, 1);
// assert
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_IS_NULL(result);
}
/* Tests_SRS_GBALLOC_01_041: [If gballoc was not initialized gballoc_realloc shall shall simply call realloc without any memory tracking being performed.] */
TEST_FUNCTION(gballoc_realloc_after_deinit_fails)
{
// arrange
void* result;
STRICT_EXPECTED_CALL(mock_realloc(NULL, 1));
// act
result = gballoc_realloc(NULL, 1);
// assert
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_IS_NOT_NULL(result);
}
/* Tests_SRS_GBALLOC_01_005: [gballoc_realloc shall call the C99 realloc function and return its result.] */
/* Tests_SRS_GBALLOC_01_017: [When ptr is NULL, gballoc_realloc shall call the underlying realloc with ptr being NULL and the realloc result shall be tracked by gballoc.] */
/* Tests_SRS_GBALLOC_01_032: [gballoc_realloc shall ensure thread safety by using the lock created by gballoc_Init.] */
TEST_FUNCTION(gballoc_realloc_with_NULL_Arg_And_0_Size_Calls_Underlying_realloc)
{
// arrange
void* result;
void* allocation;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
/* This is the call to the underlying malloc with the size we want to allocate */
STRICT_EXPECTED_CALL(mock_realloc(NULL, 0));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_realloc(NULL, 0);
// assert
ASSERT_ARE_EQUAL(void_ptr, TEST_ALLOC_PTR1, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_ARE_EQUAL(size_t, 0, gballoc_getMaximumMemoryUsed());
// cleanup
gballoc_free(result);
free(allocation);
}
/* Tests_SRS_GBALLOC_01_005: [gballoc_realloc shall call the C99 realloc function and return its result.] */
/* Tests_SRS_GBALLOC_01_017: [When ptr is NULL, gballoc_realloc shall call the underlying realloc with ptr being NULL and the realloc result shall be tracked by gballoc.] */
TEST_FUNCTION(gballoc_realloc_with_NULL_Arg_And_1_Size_Calls_Underlying_realloc)
{
// arrange
void* result;
void* allocation;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
/* This is the call to the underlying malloc with the size we want to allocate */
STRICT_EXPECTED_CALL(mock_realloc(NULL, 1));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_realloc(NULL, 1);
// assert
ASSERT_ARE_EQUAL(void_ptr, TEST_ALLOC_PTR1, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_ARE_EQUAL(size_t, 1, gballoc_getMaximumMemoryUsed());
// cleanup
gballoc_free(result);
free(allocation);
}
/* Tests_SRS_GBALLOC_01_005: [gballoc_realloc shall call the C99 realloc function and return its result.] */
/* Tests_SRS_GBALLOC_01_006: [If the underlying realloc call is successful, gballoc_realloc shall look up the size associated with the pointer ptr and decrease the total memory used with that size.] */
TEST_FUNCTION(gballoc_realloc_with_Previous_1_Byte_Block_Ptr_And_2_Size_Calls_Underlying_realloc_And_Increases_Max_Used_Memory)
{
// arrange
void* result;
void* allocation;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
/* This is the call to the underlying malloc with the size we want to allocate */
STRICT_EXPECTED_CALL(mock_realloc(NULL, 1));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(mock_realloc(TEST_ALLOC_PTR1, 2))
.SetReturn(TEST_ALLOC_PTR2);
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
result = gballoc_realloc(NULL, 1);
// act
result = gballoc_realloc(result, 2);
// assert
ASSERT_ARE_EQUAL(void_ptr, TEST_ALLOC_PTR2, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_ARE_EQUAL(size_t, 2, gballoc_getMaximumMemoryUsed());
// cleanup
gballoc_free(result);
free(allocation);
}
/* Tests_SRS_GBALLOC_01_014: [When the underlying realloc call fails, gballoc_realloc shall return NULL and no change should be made to the counted total memory usage.] */
TEST_FUNCTION(When_realloc_fails_then_gballoc_realloc_Fails_Too_And_No_Change_Is_Made_To_Memory_Counters)
{
// arrange
void* result;
void* allocation;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
/* This is the call to the underlying malloc with the size we want to allocate */
STRICT_EXPECTED_CALL(mock_realloc(NULL, 1));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(mock_realloc(TEST_ALLOC_PTR1, 2))
.SetReturn((void*)NULL);
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
result = gballoc_realloc(NULL, 1);
// act
result = gballoc_realloc(result, 2);
// assert
ASSERT_IS_NULL(result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_ARE_EQUAL(size_t, 1, gballoc_getMaximumMemoryUsed());
// cleanup
gballoc_free(TEST_ALLOC_PTR1);
free(allocation);
}
/* Tests_SRS_GBALLOC_01_015: [When allocating memory used for tracking by gballoc_realloc fails, gballoc_realloc shall return NULL and no change should be made to the counted total memory usage.] */
TEST_FUNCTION(When_Allocating_Memory_For_tracking_fails_gballoc_realloc_fails)
{
// arrange
void* result;
gballoc_init();
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
EXPECTED_CALL(mock_malloc(0))
.SetReturn((void*)NULL);
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_realloc(NULL, 1);
// assert
ASSERT_IS_NULL(result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_ARE_EQUAL(size_t, 0, gballoc_getMaximumMemoryUsed());
}
/* Tests_SRS_GBALLOC_01_016: [When the ptr pointer cannot be found in the pointers tracked by gballoc, gballoc_realloc shall return NULL and the underlying realloc shall not be called.] */
TEST_FUNCTION(When_The_Pointer_Is_Not_Tracked_gballoc_realloc_Returns_NULL)
{
// arrange
void* result1;
void* result2;
void* allocation;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
/* This is the call to the underlying malloc with the size we want to allocate */
STRICT_EXPECTED_CALL(mock_realloc(NULL, 1));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
result1 = gballoc_realloc(NULL, 1);
// act
result2 = gballoc_realloc(TEST_REALLOC_PTR, 2);
// assert
ASSERT_IS_NULL(result2);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_ARE_EQUAL(size_t, 1, gballoc_getMaximumMemoryUsed());
// cleanup
gballoc_free(result1);
free(allocation);
}
/* Tests_SRS_GBALLOC_01_014: [When the underlying realloc call fails, gballoc_realloc shall return NULL and no change should be made to the counted total memory usage.] */
TEST_FUNCTION(When_ptr_is_null_and_the_underlying_realloc_fails_then_the_memory_used_for_tracking_is_freed)
{
// arrange
void* result;
void* allocation;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
/* This is the call to the underlying malloc with the size we want to allocate */
STRICT_EXPECTED_CALL(mock_realloc(NULL, 1))
.SetReturn((void*)NULL);
STRICT_EXPECTED_CALL(mock_free(allocation));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_realloc(NULL, 1);
// assert
ASSERT_IS_NULL(result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_ARE_EQUAL(size_t, 0, gballoc_getMaximumMemoryUsed());
// cleanup
free(allocation);
}
/* gballoc_free */
/* Tests_SRS_GBALLOC_01_042: [If gballoc was not initialized gballoc_free shall shall simply call free.] */
TEST_FUNCTION(gballoc_free_after_deinit_calls_crt_free)
{
// arrange
STRICT_EXPECTED_CALL(mock_free((void*)0x4242));
// act
gballoc_free((void*)0x4242);
// assert
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
}
/* Tests_SRS_GBALLOC_01_049: [If acquiring the lock fails, gballoc_free shall do nothing.] */
TEST_FUNCTION(when_acquiring_the_lock_fails_then_gballoc_free_does_nothing)
{
// arrange
void* block;
void* allocation;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
/* This is the call to the underlying malloc with the size we want to allocate */
STRICT_EXPECTED_CALL(mock_realloc(NULL, 1));
block = gballoc_realloc(NULL, 1);
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE))
.SetReturn(LOCK_ERROR);
// act
gballoc_free(block);
// assert
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
// cleanup
gballoc_free(block);
free(allocation);
}
/* Tests_SRS_GBALLOC_01_008: [gballoc_free shall call the C99 free function.] */
/* Tests_SRS_GBALLOC_01_009: [gballoc_free shall also look up the size associated with the ptr pointer and decrease the total memory used with the associated size amount.] */
/* Tests_SRS_GBALLOC_01_010: [gballoc_getMaximumMemoryUsed shall return the maximum amount of total memory used recorded since the module initialization.] */
/* Tests_SRS_GBALLOC_01_011: [The maximum total memory used shall be the maximum of the total memory used at any point.] */
/* Tests_SRS_GBALLOC_01_033: [gballoc_free shall ensure thread safety by using the lock created by gballoc_Init.] */
TEST_FUNCTION(gballoc_free_calls_the_underlying_free)
{
// arrange
void* block;
void* allocation;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
/* This is the call to the underlying malloc with the size we want to allocate */
STRICT_EXPECTED_CALL(mock_realloc(NULL, 1));
block = gballoc_realloc(NULL, 1);
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(mock_free(TEST_ALLOC_PTR1));
STRICT_EXPECTED_CALL(mock_free(allocation));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
gballoc_free(block);
// assert
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_ARE_EQUAL(size_t, 1, gballoc_getMaximumMemoryUsed());
// cleanup
free(allocation);
}
/* Tests_SRS_GBALLOC_01_008: [gballoc_free shall call the C99 free function.] */
/* Tests_SRS_GBALLOC_01_009: [gballoc_free shall also look up the size associated with the ptr pointer and decrease the total memory used with the associated size amount.] */
/* Tests_SRS_GBALLOC_01_010: [gballoc_getMaximumMemoryUsed shall return the maximum amount of total memory used recorded since the module initialization.] */
/* Tests_SRS_GBALLOC_01_010: [gballoc_getMaximumMemoryUsed shall return the maximum amount of total memory used recorded since the module initialization.] */
/* Tests_SRS_GBALLOC_01_011: [The maximum total memory used shall be the maximum of the total memory used at any point.] */
TEST_FUNCTION(gballoc_malloc_free_2_times_with_1_byte_yields_1_byte_as_max)
{
// arrange
void* block;
void* allocation;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
STRICT_EXPECTED_CALL(mock_realloc(NULL, 1));
block = gballoc_realloc(NULL, 1);
gballoc_free(block);
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
block = gballoc_realloc(NULL, 1);
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(mock_free(TEST_ALLOC_PTR1));
STRICT_EXPECTED_CALL(mock_free(allocation));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
gballoc_free(block);
// assert
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_ARE_EQUAL(size_t, 1, gballoc_getMaximumMemoryUsed());
// cleanup
free(allocation);
}
/* Tests_SRS_GBALLOC_01_019:[When the ptr pointer cannot be found in the pointers tracked by gballoc, gballoc_free shall not free any memory.] */
TEST_FUNCTION(gballoc_free_with_an_untracked_pointer_does_not_alter_total_memory_used)
{
// arrange
void* allocation;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
/* don't quite like this, but I'm unsure I want to invest more in this memory counting */
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
gballoc_realloc(NULL, 1);
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
gballoc_free(TEST_REALLOC_PTR);
// assert
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
gballoc_realloc(TEST_ALLOC_PTR1, 2);
ASSERT_ARE_EQUAL(size_t, 2, gballoc_getMaximumMemoryUsed());
// cleanup
gballoc_free(TEST_ALLOC_PTR1);
free(allocation);
}
/* gballoc_getMaximumMemoryUsed */
/* Tests_SRS_GBALLOC_01_034: [gballoc_getMaximumMemoryUsed shall ensure thread safety by using the lock created by gballoc_Init.] */
TEST_FUNCTION(when_gballoc_getMaximumMemoryUsed_called_It_Shall_Lock_And_Unlock)
{
// arrange
gballoc_init();
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
(void)gballoc_getMaximumMemoryUsed();
// assert
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
}
/* Tests_SRS_GBALLOC_01_050: [If the lock cannot be acquired, gballoc_getMaximumMemoryUsed shall return SIZE_MAX.] */
TEST_FUNCTION(when_acquiring_the_lock_fails_then_gballoc_getMaximumMemoryUsed_fails)
{
// arrange
size_t result;
gballoc_init();
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE))
.SetReturn(LOCK_ERROR);
// act
result = gballoc_getMaximumMemoryUsed();
// assert
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
ASSERT_ARE_EQUAL(size_t, SIZE_MAX, result);
}
/* Tests_SRS_GBALLOC_01_038: [If gballoc was not initialized gballoc_getMaximumMemoryUsed shall return MAX_INT_SIZE.] */
TEST_FUNCTION(gballoc_getMaximumMemoryUsed_after_deinit_fails)
{
// arrange
// act
size_t result = gballoc_getMaximumMemoryUsed();
// assert
ASSERT_ARE_EQUAL(size_t, SIZE_MAX, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
}
/* gballoc_getCurrentMemoryUsed */
/*Tests_SRS_GBALLOC_02_001: [gballoc_getCurrentMemoryUsed shall return the currently used memory size.] */
TEST_FUNCTION(gballoc_getCurrentMemoryUsed_after_1_byte_malloc_returns_1)
{
// arrange
void* allocation;
void* toBeFreed;
size_t result;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
STRICT_EXPECTED_CALL(mock_malloc(1));
toBeFreed = gballoc_malloc(1);
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_getCurrentMemoryUsed();
// assert
ASSERT_ARE_EQUAL(size_t, 1, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
///cleanup
gballoc_free(toBeFreed);
free(allocation);
umock_c_reset_all_calls(); //this is just for mathematics, not for functionality
}
/*Tests_SRS_GBALLOC_02_001: [gballoc_getCurrentMemoryUsed shall return the currently used memory size.] */
TEST_FUNCTION(gballoc_getCurrentMemoryUsed_after_2x3_byte_calloc_returns_6)
{
// arrange
void* allocation;
void* toBeFreed;
size_t result;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
toBeFreed = gballoc_calloc(2, 3);
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_getCurrentMemoryUsed();
// assert
ASSERT_ARE_EQUAL(size_t, 6, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
///cleanup
gballoc_free(toBeFreed);
free(allocation);
umock_c_reset_all_calls(); //this is just for mathematics, not for functionality
}
/*Tests_SRS_GBALLOC_02_001: [gballoc_getCurrentMemoryUsed shall return the currently used memory size.] */
TEST_FUNCTION(gballoc_getCurrentMemoryUsed_after_1_byte_malloc_and_3_bytes_realloc_returns_3)
{
// arrange
void* allocation;
void* toBeFreed;
size_t result;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
STRICT_EXPECTED_CALL(mock_malloc(1));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
toBeFreed = gballoc_malloc(1);
toBeFreed = gballoc_realloc(toBeFreed, 3);
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_getCurrentMemoryUsed();
// assert
ASSERT_ARE_EQUAL(size_t, 3, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
///cleanup
gballoc_free(toBeFreed);
free(allocation);
umock_c_reset_all_calls(); //this is just for mathematics, not for functionality
}
/*Tests_SRS_GBALLOC_02_001: [gballoc_getCurrentMemoryUsed shall return the currently used memory size.] */
TEST_FUNCTION(gballoc_getCurrentMemoryUsed_after_1_byte_malloc_and_free_returns_0)
{
// arrange
void* allocation;
void* toBeFreed;
size_t result;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
STRICT_EXPECTED_CALL(mock_malloc(1));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
toBeFreed = gballoc_malloc(1);
gballoc_free(toBeFreed);
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_getCurrentMemoryUsed();
// assert
ASSERT_ARE_EQUAL(size_t, 0, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
///cleanup
free(allocation);
umock_c_reset_all_calls(); //this is just for mathematics, not for functionality
}
/*Tests_SRS_GBALLOC_02_001: [gballoc_getCurrentMemoryUsed shall return the currently used memory size.] */
TEST_FUNCTION(gballoc_getCurrentMemoryUsed_after_2x3_byte_calloc_and_free_returns_0)
{
// arrange
void* allocation;
void* toBeFreed;
size_t result;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
toBeFreed = gballoc_calloc(2, 3);
gballoc_free(toBeFreed);
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_getCurrentMemoryUsed();
// assert
ASSERT_ARE_EQUAL(size_t, 0, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
///cleanup
free(allocation);
umock_c_reset_all_calls(); //this is just for mathematics, not for functionality
}
/*Tests_SRS_GBALLOC_02_001: [gballoc_getCurrentMemoryUsed shall return the currently used memory size.] */
TEST_FUNCTION(gballoc_getCurrentMemoryUsed_after_realloc_and_free_returns_0)
{
// arrange
void* allocation;
void* toBeFreed;
size_t result;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
STRICT_EXPECTED_CALL(mock_malloc(1));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
toBeFreed = gballoc_malloc(1);
toBeFreed = gballoc_realloc(toBeFreed, 3);
gballoc_free(toBeFreed);
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_getCurrentMemoryUsed();
// assert
ASSERT_ARE_EQUAL(size_t, 0, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
///cleanup
free(allocation);
umock_c_reset_all_calls(); //this is just for mathematics, not for functionality
}
/*Tests_SRS_GBALLOC_02_001: [gballoc_getCurrentMemoryUsed shall return the currently used memory size.] */
TEST_FUNCTION(gballoc_getCurrentMemoryUsed_after_1_byte_malloc_and_1_byte_malloc_returns_2)
{
// arrange
void* allocation1;
void* allocation2;
void* toBeFreed1;
void* toBeFreed2;
size_t result;
gballoc_init();
umock_c_reset_all_calls();
allocation1 = malloc(OVERHEAD_SIZE);
allocation2 = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation1);
STRICT_EXPECTED_CALL(mock_malloc(1));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation2);
STRICT_EXPECTED_CALL(mock_malloc(1));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
toBeFreed1 = gballoc_malloc(1);
toBeFreed2 = gballoc_malloc(1);
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_getCurrentMemoryUsed();
// assert
ASSERT_ARE_EQUAL(size_t, 2, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
///cleanup
gballoc_free(toBeFreed1);
gballoc_free(toBeFreed2);
free(allocation1);
free(allocation2);
umock_c_reset_all_calls(); //this is just for mathematics, not for functionality
}
/*Tests_SRS_GBALLOC_02_001: [gballoc_getCurrentMemoryUsed shall return the currently used memory size.] */
TEST_FUNCTION(gballoc_getCurrentMemoryUsed_after_1_byte_malloc_and_1_byte_malloc_and_3_realloc_returns_4)
{
// arrange
void* allocation1;
void* allocation2;
void* toBeFreed1;
void* toBeFreed2;
size_t result;
gballoc_init();
umock_c_reset_all_calls();
allocation1 = malloc(OVERHEAD_SIZE);
allocation2 = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation1);
STRICT_EXPECTED_CALL(mock_malloc(1));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation2);
STRICT_EXPECTED_CALL(mock_malloc(1));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
toBeFreed1 = gballoc_malloc(1);
toBeFreed2 = gballoc_malloc(1);
toBeFreed2 = gballoc_realloc(toBeFreed2, 3);
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_getCurrentMemoryUsed();
// assert
ASSERT_ARE_EQUAL(size_t, 4, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
///cleanup
gballoc_free(toBeFreed1);
gballoc_free(toBeFreed2);
free(allocation1);
free(allocation2);
umock_c_reset_all_calls(); //this is just for mathematics, not for functionality
}
/*Tests_SRS_GBALLOC_02_001: [gballoc_getCurrentMemoryUsed shall return the currently used memory size.] */
TEST_FUNCTION(gballoc_getCurrentMemoryUsed_after_1_byte_malloc_and_6_byte_calloc_returns_7)
{
// arrange
void* allocation1;
void* allocation2;
void* toBeFreed1;
void* toBeFreed2;
size_t result;
gballoc_init();
umock_c_reset_all_calls();
allocation1 = malloc(OVERHEAD_SIZE);
allocation2 = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation1);
STRICT_EXPECTED_CALL(mock_malloc(1));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation2);
STRICT_EXPECTED_CALL(mock_calloc(2, 3));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
toBeFreed1 = gballoc_malloc(1);
toBeFreed2 = gballoc_calloc(2, 3);
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_getCurrentMemoryUsed();
// assert
ASSERT_ARE_EQUAL(size_t, 7, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
///cleanup
gballoc_free(toBeFreed1);
gballoc_free(toBeFreed2);
free(allocation1);
free(allocation2);
umock_c_reset_all_calls(); //this is just for mathematics, not for functionality
}
/*Tests_SRS_GBALLOC_02_001: [gballoc_getCurrentMemoryUsed shall return the currently used memory size.] */
TEST_FUNCTION(gballoc_getCurrentMemoryUsed_after_1_byte_malloc_and_6_byte_calloc_and_free_returns_6)
{
// arrange
void* allocation1;
void* allocation2;
void* toBeFreed1;
void* toBeFreed2;
size_t result;
gballoc_init();
umock_c_reset_all_calls();
allocation1 = malloc(OVERHEAD_SIZE);
allocation2 = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation1);
STRICT_EXPECTED_CALL(mock_malloc(1))
.SetReturn((char*)allocation1 + OVERHEAD_SIZE / 2); /*somewhere in the middle of allocation*/
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation2);
STRICT_EXPECTED_CALL(mock_calloc(2, 3))
.SetReturn((char*)allocation2 + OVERHEAD_SIZE / 2);
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
toBeFreed1 = gballoc_malloc(1);
toBeFreed2 = gballoc_calloc(2, 3);
gballoc_free(toBeFreed1);
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_getCurrentMemoryUsed();
// assert
ASSERT_ARE_EQUAL(size_t, 6, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
///cleanup
gballoc_free(toBeFreed2);
free(allocation1);
free(allocation2);
umock_c_reset_all_calls(); //this is just for mathematics, not for functionality
}
/*Tests_SRS_GBALLOC_02_001: [gballoc_getCurrentMemoryUsed shall return the currently used memory size.] */
TEST_FUNCTION(gballoc_getCurrentMemoryUsed_after_1_byte_malloc_and_1_byte_malloc_and_3_realloc_and_free_returns_3)
{
// arrange
void* allocation1;
void* allocation2;
void* toBeFreed1;
void* toBeFreed2;
size_t result;
gballoc_init();
umock_c_reset_all_calls();
allocation1 = malloc(OVERHEAD_SIZE);
allocation2 = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation1);
STRICT_EXPECTED_CALL(mock_malloc(1))
.SetReturn((char*)allocation1 + OVERHEAD_SIZE / 2); /*somewhere in the middle of allocation*/
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation2);
STRICT_EXPECTED_CALL(mock_realloc(IGNORED_PTR_ARG, 3))
.IgnoreArgument(1)
.SetReturn((char*)allocation2 + OVERHEAD_SIZE / 2); /*somewhere in the middle of allocation*/
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
toBeFreed1 = gballoc_malloc(1);
toBeFreed2 = gballoc_malloc(1);
toBeFreed2 = gballoc_realloc(toBeFreed2, 3);
gballoc_free(toBeFreed1);
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_getCurrentMemoryUsed();
// assert
ASSERT_ARE_EQUAL(size_t, 3, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
///cleanup
gballoc_free(toBeFreed2);
free(allocation1);
free(allocation2);
umock_c_reset_all_calls(); //this is just for mathematics, not for functionality
}
/* Tests_SRS_GBALLOC_01_036: [gballoc_getCurrentMemoryUsed shall ensure thread safety by using the lock created by gballoc_Init.] */
TEST_FUNCTION(gballoc_getCurrentMemoryUsed_locks_and_unlocks)
{
// assert
size_t result;
gballoc_init();
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_getCurrentMemoryUsed();
// assert
ASSERT_ARE_EQUAL(size_t, 0, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
}
/* Tests_SRS_GBALLOC_01_044: [If gballoc was not initialized gballoc_getCurrentMemoryUsed shall return SIZE_MAX.] */
TEST_FUNCTION(gballoc_getCurrentMemoryUsed_after_deinit_fails)
{
// arrange
// act
size_t result = gballoc_getCurrentMemoryUsed();
// assert
ASSERT_ARE_EQUAL(size_t, SIZE_MAX, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
}
/* Tests_SRS_GBALLOC_01_051: [If the lock cannot be acquired, gballoc_getCurrentMemoryUsed shall return SIZE_MAX.] */
TEST_FUNCTION(when_acquiring_the_lock_fails_gballoc_getCurrentMemoryUsed_fails)
{
// arrange
size_t result;
gballoc_init();
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE))
.SetReturn(LOCK_ERROR);
// act
result = gballoc_getCurrentMemoryUsed();
// assert
ASSERT_ARE_EQUAL(size_t, SIZE_MAX, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
}
/* Tests_SRS_GBALLOC_07_001: [ If gballoc was not initialized gballoc_getAllocationCount shall return SIZE_MAX. ] */
TEST_FUNCTION(gballoc_getAllocationCount_without_init_fail)
{
// arrange
size_t result;
// act
result = gballoc_getAllocationCount();
// assert
ASSERT_ARE_EQUAL(size_t, 0, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
}
/* Tests_SRS_GBALLOC_07_003: [ If the lock cannot be acquired, gballoc_getAllocationCount shall return SIZE_MAX. ] */
TEST_FUNCTION(gballoc_getAllocationCount_lock_fail)
{
// arrange
size_t result;
gballoc_init();
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE))
.SetReturn(LOCK_ERROR);
// act
result = gballoc_getAllocationCount();
// assert
ASSERT_ARE_EQUAL(size_t, 0, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
}
/* Tests_SRS_GBALLOC_07_004: [ gballoc_getAllocationCount shall return the currently number of allocations. ] */
/* Tests_SRS_GBALLOC_07_002: [ gballoc_getAllocationCount shall ensure thread safety by using the lock created by gballoc_Init ] */
TEST_FUNCTION(gballoc_getAllocationCount_success)
{
// arrange
void* allocation;
void* toBeFreed;
size_t result;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
STRICT_EXPECTED_CALL(mock_malloc(1));
toBeFreed = gballoc_malloc(1);
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
result = gballoc_getAllocationCount();
// assert
ASSERT_ARE_EQUAL(size_t, 1, result);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
// Cleanup
gballoc_free(toBeFreed);
free(allocation);
}
TEST_FUNCTION(gballoc_resetMetrics_without_init_fail)
{
// arrange
// act
gballoc_resetMetrics();
// assert
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
}
/* Tests_SRS_GBALLOC_07_003: [ If the lock cannot be acquired, gballoc_getAllocationCount shall return SIZE_MAX. ] */
TEST_FUNCTION(gballoc_resetMetrics_lock_fail)
{
// arrange
gballoc_init();
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE))
.SetReturn(LOCK_ERROR);
// act
gballoc_resetMetrics();
// assert
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
}
/* Tests_SRS_GBALLOC_07_004: [ gballoc_getAllocationCount shall return the currently number of allocations. ] */
/* Tests_SRS_GBALLOC_07_002: [ gballoc_getAllocationCount shall ensure thread safety by using the lock created by gballoc_Init ] */
TEST_FUNCTION(gballoc_resetMetrics_success)
{
// arrange
void* allocation;
void* toBeFreed;
size_t mem_used;
size_t alloc_count;
gballoc_init();
umock_c_reset_all_calls();
allocation = malloc(OVERHEAD_SIZE);
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
EXPECTED_CALL(mock_malloc(0))
.SetReturn(allocation);
STRICT_EXPECTED_CALL(mock_malloc(1));
toBeFreed = gballoc_malloc(1);
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
alloc_count = gballoc_getAllocationCount();
ASSERT_ARE_EQUAL(size_t, 1, alloc_count);
umock_c_reset_all_calls();
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Lock(TEST_LOCK_HANDLE));
STRICT_EXPECTED_CALL(Unlock(TEST_LOCK_HANDLE));
// act
gballoc_resetMetrics();
mem_used = gballoc_getCurrentMemoryUsed();
alloc_count = gballoc_getAllocationCount();
// assert
ASSERT_ARE_EQUAL(size_t, 0, mem_used);
ASSERT_ARE_EQUAL(size_t, 0, alloc_count);
ASSERT_ARE_EQUAL(char_ptr, umock_c_get_expected_calls(), umock_c_get_actual_calls());
// Cleanup
gballoc_free(toBeFreed);
free(allocation);
}
END_TEST_SUITE(GBAlloc_UnitTests)
|
#!/usr/bin/env node
const fs = require('fs-extra');
const path = require('path');
const yargs = require('yargs');
const yaml = require('js-yaml');
const chalk = require('chalk');
const Profile = require('./lib/profile');
const Loader = require('./lib/inspect/checks/loader');
const Reporter = require('./lib/inspect/report');
const Connector = require('infra.connectors');
async function verify(env_address, criteria_path, connector) {
let reporter = new Reporter();
let context = { bakerPath: env_address };
let loader = new Loader();
let groups = await loader.loadChecks(criteria_path);
console.log();
console.log(chalk.underline('Checks'));
for (let group of groups) {
console.log(chalk`\n\t{bold ${group.description}\n}`);
for (let check of group.checks) {
let instance = new check.module(connector, reporter);
console.log(chalk`\t{white ${check.name} check}`);
let results = await instance.check(context, check.args);
if (check.args && check.args.comment) {
console.log(chalk`\t\t{italic.gray ${check.args.comment}}`);
}
instance.report(results);
}
}
reporter.summary();
}
async function main(env_address, criteria_path, connector) {
await verify(env_address, criteria_path, connector);
}
async function selectConnectorFromInventory(connectorType, connectorInfo, argv) {
// TODO: is this always needed?
let env_address = connectorInfo.target || connectorInfo.instance || connectorInfo.name || 'local';
let criteria_path = connectorInfo.criteria_path || argv.criteria_path;
if (!criteria_path) {
criteria_path = path.join(process.cwd(), 'test', 'opunit.yml');
if (!fs.existsSync(criteria_path)) {
console.error(chalk.red(`${connectorType}: criteria file (opunit.yml) was not provided, nor was default path found in test/opunit.yml`));
console.error(chalk.red('Skipping...'));
process.exit(1);
}
}
let connector = null;
let opts = {};
let optsCheck = {inCWD: false};
let name = null;
if (connectorType === 'baker' && await fs.exists(path.join(connectorInfo.target, 'baker.yml'))) {
name = connectorInfo.target;
} else if (connectorType === 'vagrant') {
let checkVagrantRunning = await Connector.getConnector('vagrant', connectorInfo.name, {inCWD: false});
let getStatus = await checkVagrantRunning.getStatus();
if(await getStatus.status === 'running'){
name = connectorInfo.name;
opts['inCWD'] = false;
}
} else if (connectorType === 'docker') {
let checkDockerRunning = await Connector.getConnector('docker', connectorInfo.name, opts);
let getStatus = await checkDockerRunning.containerExists();
if(getStatus){
name = connectorInfo.name;
}
} else if (connectorType === 'ssh' && connectorInfo.target.match(/[@:]+/)) {
name = connectorInfo.target;
opts['privateKey'] = connectorInfo.private_key;
} else if (connectorType === 'local' || connectorType === 'localhost') {
name = argv.env_address;
}
if(name !== null) {
connector = Connector.getConnector(connectorType, name, opts);
}
if (!connector) {
console.error(chalk.red(' => No running environment could be found with the given parameters:'), connectorType, connectorInfo);
console.error(chalk.red(' => Skipping...'));
return [null, null, null];
}
try {
// TODO: refactoring
//let context = { bakerPath: connectorInfo.target };
await connector.ready();
} catch (error) {
console.error(chalk.red(` => ${error}`));
console.error(chalk.red(' => Skipping...'));
return [null, null, null];
}
return [connector, env_address, criteria_path];
}
async function selectConnector(argv) {
const cwd = process.cwd();
let connector = null;
let name = null;
let opts = {};
let optsCheck = {inCWD: false};
let connectorTypeLocal;
if (argv.env_address === 'local' || argv.env_address === 'localhost') {
connectorTypeLocal = 'local';
name = argv.env_address;
} else if (!argv.env_address && await fs.exists(path.join(cwd, 'baker.yml'))) {
connectorTypeLocal = 'baker';
name = cwd;
} else if (!argv.env_address && await fs.exists(path.join(cwd, 'Vagrantfile'))) {
connectorTypeLocal = 'vagrant';
name = path.join(cwd, 'Vagrantfile');
opts['inCWD'] = true;
} else if (argv.env_address && await fs.exists(path.resolve(argv.env_address))) {
connectorTypeLocal = 'baker';
name = path.resolve(argv.env_address);
} else if (argv.env_address && argv.env_address.match(/[@:]+/)) {
connectorTypeLocal = 'ssh';
name = argv.env_address;
opts['privateKey'] = argv.ssh_key;
} else if (argv.env_address) {
let checkVagrantRunning = await Connector.getConnector('vagrant', argv.env_address, {inCWD: false});
let getStatus = await checkVagrantRunning.getStatus();
if(await getStatus.status === 'running'){
connectorTypeLocal = 'vagrant';
opts['inCWD'] = false;
name = argv.env_address;
}
else{
let checkDockerRunning = await (Connector.getConnector('docker', argv.env_address, opts));
let containerExists = await checkDockerRunning.containerExists();
if(containerExists){
connectorTypeLocal = 'docker';
name = (argv.env_address || argv.container);
}
}
}
if(name != null){
connector = Connector.getConnector(connectorTypeLocal, name, opts);
}
if (!connector) {
console.error(chalk.red(' => No running environment could be found with the given name'));
process.exit(1);
}
try {
//let context = { bakerPath: argv.env_address || process.cwd() };
await connector.ready();
} catch (error) {
console.error(chalk.red(` => ${error}`));
process.exit(1);
}
return connector;
}
// Register run command
yargs.command('profile <address>', 'Run check against specified profile ', (yargs) => { }, async (argv) => {
let profile = new Profile();
let repo = argv.address.split(':')[0];
let yml = argv.address.split(':')[1];
// let file = await profile.get('CSC-DevOps/profile', '326.yml')
let file = await profile.get(repo, yml);
await verify('local', file, Connector.getConnector('local', '', {}));
});
yargs.command('verify [env_address]', 'Verify an instance', (yargs) => {
yargs.positional('criteria_path', {
describe: 'path to the opunit.yml file, default is cwd/test/opunit.yml',
type: 'string',
alias: 'c',
});
yargs.positional('ssh_key', {
describe: 'required when using ssh connector. give path to private ssh key',
type: 'string',
});
yargs.positional('container', {
describe: 'required when using docker connector. give name or id of your container',
type: 'string',
alias: 't',
});
yargs.positional('inventory', {
describe: 'path to inventory file',
type: 'string',
alias: 'i',
});
}, async (argv) => {
if (argv.inventory) {
let inventory = yaml.safeLoad(await fs.readFile(argv.inventory, 'utf8'));
for (let group of inventory) {
let connectorType = Object.keys(group)[0];
for (let connectorInfo of group[connectorType]) {
console.log('\n===================================');
console.log(`Connector: ${connectorType}`);
console.log(`Info: ${JSON.stringify(connectorInfo)}`);
console.log('===================================');
let [connector, env_address, criteria_path] = await selectConnectorFromInventory(connectorType, connectorInfo, argv);
if (connector && env_address && criteria_path) {
await main(env_address, criteria_path, connector);
}
}
}
} else {
let connector = await selectConnector(argv);
let env_address = argv.env_address || process.cwd();
let { criteria_path } = argv;
// Default to baker_path
if (!criteria_path) {
// TODO: this needs cleanup, trying to get it to work...
criteria_path = path.join(process.cwd(), 'test', 'opunit.yml');
if (!fs.existsSync(criteria_path)) {
console.error(chalk.red('Checks file was not provided, nor was default path found in test/opunit.yml'));
process.exit(1);
}
}
await main(env_address, criteria_path, connector, { ssh_key: argv.ssh_key, container: argv.container });
}
});
// Turn on help and access argv
yargs.help().argv;
|
//
// PresentGradientViewController.h
// TTKitDemo
//
// Created by apple on 2018/1/16.
// Copyright © 2018年 shang. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface PresentGradientViewController : UIViewController
@end
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _dec, _dec2, _class, _class2, _temp;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
var _macOs = require('../../TextInput/macOs');
var _macOs2 = _interopRequireDefault(_macOs);
var _hidden = require('../../style/hidden');
var _hidden2 = _interopRequireDefault(_hidden);
var _margin = require('../../style/margin');
var _margin2 = _interopRequireDefault(_margin);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Pin = (_dec = (0, _hidden2.default)(), _dec2 = (0, _margin2.default)(), _dec(_class = _dec2(_class = (_temp = _class2 = function (_Component) {
_inherits(Pin, _Component);
function Pin(props) {
var _ref;
_classCallCheck(this, Pin);
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var _this = _possibleConstructorReturn(this, (_ref = Pin.__proto__ || Object.getPrototypeOf(Pin)).call.apply(_ref, [this, props].concat(args)));
_this.handleBlur = function (e, index) {
if (e && index === _this.state.current) {
e.preventDefault();
e.stopPropagation();
}
if (_this.state.current !== null) {
_this.selectInput(_this.state.current);
}
};
_this.selectInput = function (index) {
if (_this.refs[index]) {
var el = _reactDom2.default.findDOMNode(_this.refs[index]).getElementsByTagName('INPUT')[0];
el.focus();
}
};
_this.setValue = function (index, value) {
if (_this.refs[index]) {
var el = _reactDom2.default.findDOMNode(_this.refs[index]).getElementsByTagName('INPUT')[0];
el.value = value;
var pin = [].concat(_toConsumableArray(_this.state.pin.slice(0, index)), [value], _toConsumableArray(_this.state.pin.slice(index + 1)));
_this.setState({ pin: pin });
if (_this.props.onChange) _this.props.onChange(pin.join(''));
}
};
_this.handleChange = function (e, index) {
if (e.target.value) {
var nextIndex = index === _this.props.length - 1 ? index : index + 1;
var pin = [].concat(_toConsumableArray(_this.state.pin.slice(0, index)), [e.target.value], _toConsumableArray(_this.state.pin.slice(index + 1)));
_this.setState({ current: nextIndex, pin: pin });
setTimeout(function () {
return _this.selectInput(nextIndex);
});
if (_this.props.onChange) _this.props.onChange(pin.join(''));
}
};
_this.handleKeyDown = function (e) {
if (e.keyCode === 8) {
if (e.target.value) {
_this.setValue(_this.state.current, '');
} else {
var nextIndex = _this.state.current - 1;
_this.setState({ current: nextIndex });
setTimeout(function () {
_this.selectInput(nextIndex);
_this.setValue(nextIndex, '');
});
}
}
};
_this.handleKeyPress = function (e) {
if (e.charCode >= 48 && e.charCode <= 57) {
return true;
}
e.preventDefault();
e.stopPropagation();
};
var lenght = parseInt(props.length);
_this.state = {
current: 0,
pin: new Array(lenght)
};
return _this;
}
_createClass(Pin, [{
key: 'componentDidMount',
value: function componentDidMount() {
this.handleBlur();
}
}, {
key: 'render',
value: function render() {
var _this2 = this;
var _props = this.props,
length = _props.length,
reveal = _props.reveal,
style = _props.style,
props = _objectWithoutProperties(_props, ['length', 'reveal', 'style']);
delete props.onChange;
var children = [];
var _loop = function _loop(i, len) {
children.push(_react2.default.createElement(_macOs2.default, _extends({
ref: i,
key: i,
rounded: true,
type: reveal ? 'tel' : 'password',
width: '36px',
maxLength: '1',
marginRight: '8px',
onChange: function onChange(e) {
return _this2.handleChange(e, i);
},
onBlur: function onBlur(e) {
return _this2.handleBlur(e, i);
},
onKeyDown: _this2.handleKeyDown,
onKeyPress: _this2.handleKeyPress,
style: {
fontSize: '32px',
lineHeight: '32px',
textAlign: 'center',
paddingTop: '3px',
paddingBottom: '4px',
color: '#464646'
}
}, (0, _margin.removeMarginProps)(props))));
};
for (var i = 0, len = parseInt(length); i < len; ++i) {
_loop(i, len);
}
return _react2.default.createElement(
'div',
{ style: _extends({ display: 'flex' }, style) },
children
);
}
}]);
return Pin;
}(_react.Component), _class2.propTypes = _extends({}, _hidden.hiddenPropTypes, _margin.marginPropTypes, {
reveal: _propTypes2.default.bool,
length: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]).isRequired,
onChange: _propTypes2.default.func
}), _temp)) || _class) || _class);
exports.default = Pin;
|
import math
import torch
import torch.optim as optim
import torch.nn.functional as F
from CIRNO.CIRNONetwork import CIRNONetwork
from CIRNO.ReplayMemory import ReplayMemory, Transition
#
# Deep Q Network:
# Environment change -> expectation
#
# Goal: Train a policyNetwork that have
# most Discounted Cumulative Reward
#
# discount parameter -> makes sum converge
#
# Q function : State * Action -> expects
# returns NextState
#
# Goal: make neural network to approximate Q function
# -> Q function will get action, state and will give
# approximate results.
#
# -> We can now use this function to have maximum
# award because Q function can expect next state
#
class DeepQNetwork():
def __init__(self, screenWidth, screenHeight, batchSize, gamma, epsilonStart, epsilonEnd, epsilonDecay, targetUpdate, actions):
# hyperparameters
self.batchSize = batchSize
self.gamma = gamma
self.epsilonStart = epsilonStart
self.epsilonEnd = epsilonEnd
self.epsilonDecay = epsilonDecay
self.targetUpdate = targetUpdate
# save actions
self.actions = actions
# screen configuration
self.screenWidth = screenWidth
self.screenHeight = screenHeight
# device setup
self.device = torch.device(
"cuda" if torch.cuda.is_available() else "cpu"
)
# policy network setup
self.policyNetwork = CIRNONetwork(screenWidth, screenHeight, actions)
# target network setup
self.targetNetwork = CIRNONetwork(screenWidth, screenHeight, actions)
self.targetNetwork.load_state_dict(self.policyNetwork.state_dict())
self.targetNetwork.eval()
# optimizer
self.optimizer = optim.RMSprop(self.policyNetwork.parameters())
# replay memory
self.memory = ReplayMemory(10000)
# current steps
self.currentStep = 0
# epsilonThreshold saver
self.epsilonThreshold = 0
# episodeDuration
self.episodeDuration = []
def selectAction(self, state):
sample = random.random()
self.epsilonThreshold = self.epsilonEnd + \
(self.epsilonStart - self.epsilonEnd) * \
math.exp(-1. * self.currentStep / self.epsilonDecay)
self.currentStep += 1
if sample > epsilonThreshold:
with torch.no_grad():
return self.policyNetwork(state).max(1)[1].view(1,1)
else:
return torch.tensor([random.randrange(self.actions)], device=self.device, dtype=torch.long)
def train(self):
if len(self.memory) < self.batchSize:
return
# sample memory then, save to transitions -> batch
transitions = self.memory.sample(self.batchSize)
batch = Transition(*zip(*transitions))
# calculate nonFinalMask
# get tensor where s is none -> next_state
nonFinalMask = torch.tensor(
tuple(
map(
lambda s: s is not None, batch.next_state
)
),
device=self.device,
dtype=torch.uint8
)
# next_state when that next_state is not none
nonFinalNextStates = torch.cat(
[s for s in batch.next_state if s is not None]
)
stateBatch = torch.cat(batch.state)
actionBatch = torch.cat(batch.action)
rewardBatch = torch.cat(batch.reward)
# policy Network's Q expectation Results.
stateActionValues = self.policyNetwork(stateBatch).gather(1, actionBatch)
# next State Actions are calculated by prev targetNetwork.
nextStateValues = torch.zeros(self.batchSize, device=self.device)
# get the best one.
nextStateValues[nonFinalMask] = self.targetNetwork(nonFinalNextStates).max(1)[0].detach()
expectedQValues = (nextStateValues * self.gamma) + rewardBatch
loss = F.smooth_l1_loss(stateActionValues,
expectedQValues.unsqueeze(1))
self.optimizer.zero_grad()
loss.backward()
for parameter in self.policyNetwork.parameters():
parameter.grad.data.clamp_(-1,1)
self.optimizer.step()
|
'use strict';
/* Environment Vars
..............................*/
require('dotenv').load();
/* Packages
..............................*/
const async = require('async');
const express = require('express');
const session = require('express-session');
const cookie = require('cookie-parser');
const parser = require('body-parser');
const uuid = require('uuid');
const vhx = require('vhx')(process.env.VHX_API_KEY);
const template = require('../views/templates');
const app = express();
/* Express App
..............................*/
app.set('port', process.env.PORT);
app.set('view engine', 'hbs');
app.use(express.static('public'));
app.use(parser.json());
app.use(parser.urlencoded({ extended: true }));
/* Express App - Session
..............................*/
app.use(cookie());
app.use(session({
resave: false,
saveUninitialized: false,
genid: function() {
return uuid.v4();
},
secret: process.env.SESSION_SECRET
}));
/* Routes
..................................... */
app.get('/', function(req, res) {
/* VHX > List Collections
.....................................
A call to vhx.collections to get back our collections.
http://dev.vhx.tv/docs/api/?node#collection-list
..................................... */
vhx.collections.all({}, function(err, collections) {
collections._embedded.collections.map(function(item) {
item.items = new Array(item.items_count);
});
/* DEMO > Complete Callback
Render the collection data received back from the VHX API
call into the view using handlebars (see templates.js).
..................................... */
template(req, res, {
layout: 'layout',
yield: 'home/home',
data: {
collections: collections._embedded.collections
}
});
});
});
/* VHX > List Collection Items
.....................................
A call to vhx.collections.items to get back each collection's items
http://dev.vhx.tv/docs/api/?node#collection-items-list
This endpoint is called client-side for each collection row. A the
partial with the rows items is returned as json.
..................................... */
app.get('/items.json', function(req, res) {
vhx.collections.items({
collection: req.query.id
}, function(err, items) {
template(req, res, {
partial: 'home/items',
data: {
items: items._embedded.items
}
});
});
});
app.post('/join', function(req, res) {
let redirect = req.body.redirect ? req.body.redirect : '/';
// maybe prevent some spam (field should be empty)
if (req.body.important.length > 0) {
res.redirect('/');
return;
}
/* DEMO > Payment and Account Authorization
.....................................
For the sake of this demo site, no actual payment information is
is collected or authorized. For payments, we recommend using Stripe's
payment api (http://stripe.com). We also mock login the user by
creating a session with the customer vhx href. You'd save this href in
your DB, along with any other user account info (i.e. username/password).
For user account authorization we recommend http://passportjs.org/.
..................................... */
if (req.body.customer) {
/* VHX > Create Customer
.....................................
On post of the join form we can create a VHX Customer, associating
the customer with our product, which gives the customer access to
that project by enabling us to make authorization calls (see below)
on line 165 in the /watch route
http://http://dev.vhx.tv/docs/api/?javascript#customer-create
..................................... */
vhx.customers.create({
name: req.body.customer.name,
email: req.body.customer.email,
product: 'https://api.vhx.tv/products/14444'
}, function(err, customer) {
req.session.customer_href = 'https://api.vhx.tv/customers/' + customer.id;
res.redirect(redirect);
});
}
});
app.post('/login', function(req, res) {
// maybe prevent some spam (field should be empty)
if (req.body.important.length > 0) {
res.redirect('/');
return;
}
/* DEMO > User Account Authorization
.....................................
For the sake of this demo site, no actual user authorization
is implemented. You can authorize your users however you want.
We recommend http://passportjs.org/.
On POST to this route (/login), we mock login the user
by creating a session with the customer vhx href. The customer href
would be something you store in your own DB on account creation.
..................................... */
req.session.customer_href = 'https://api.vhx.tv/customers/2041092';
req.session.customer_email = req.body.customer.email;
let url = req.query.redirect ? req.query.redirect : '/';
res.redirect(url);
});
app.get('/logout', function(req, res) {
req.session.destroy(function() {
res.redirect('/');
});
});
app.get('/watch/:video_id', function(req, res) {
if (!req.params.video_id) {
res.send('Not Found');
return;
}
if (!req.session.customer_href) {
template(req, res, {
layout: 'layout',
yield: 'watch/unauthorized'
});
return;
}
/* VHX > Authorize Customer
.....................................
a call to vhx.collections to get back our collection items
http://dev.vhx.tv/docs/api/?javascript#authorizations-create
..................................... */
vhx.authorizations.create({
customer: req.session.customer_href,
video: 'https://api.vhx.tv/videos/' + req.params.video_id
}, function(err, authorization) {
if (err) {
template(req, res, {
layout: 'layout',
yield: 'watch/unauthorized'
});
} else {
template(req, res, {
layout: 'layout',
yield: 'watch/player',
data: {
authorization: authorization
}
});
}
});
});
app.listen(process.env.PORT, function () {
console.log("Web server listening on port " + process.env.PORT);
});
|
#!/usr/bin/env python
from optparse import OptionParser
import sys
import os
from subprocess import call, Popen, PIPE
import re
f_log = "log.txt"
def main():
parser = OptionParser(usage="usage: %prog [options]")
parser.add_option("-d",
action="store_true", dest="offline",
help="offline mode")
parser.add_option("-o", "--output",
action="store", dest="output", default=f_log,
help="output file")
(opt, argv) = parser.parse_args()
adb = "adb"
log = "logcat"
pkg = "org.umd.logging"
opts = []
if opt.offline: opts.append("-d")
opts.extend([pkg + ":I", "*:S"])
if not opt.offline: call([adb, log, "-c"])
a = Popen([adb, log] + opts, stdout=PIPE).stdout
f = open(f_log, 'w')
indent = -2
while True:
try:
line = a.readline()
if len(line) == 0: break # EOF
line = line.rstrip("\r\n")
if not pkg in line: continue
msg = ''.join(re.split("(>|<)", line)[1:])
if msg[0] == '>':
indent += 2
print "%*s%s" % (indent, "", msg)
f.write("%*s%s\n" % (indent, "", msg))
elif msg[0] == '<':
print "%*s%s" % (indent, "", msg)
f.write("%*s%s\n" % (indent, "", msg))
indent -= 2
except KeyboardInterrupt: break
f.close()
if __name__ == "__main__":
sys.exit(main())
|
from decimal import Decimal
from gtin import GTIN, GCPNotFoundError
from gtin.gcp import prefixes_lengths
def test_check_digit():
assert GTIN(raw=890123456789).check_digit == '0'
assert GTIN(raw=10101).check_digit == '1'
assert GTIN(raw=567898901234).check_digit == '2'
assert GTIN(raw=82957399425).check_digit == '3'
assert GTIN(raw=5936663101).check_digit == '4'
assert GTIN(raw=15059928976).check_digit == '5'
assert GTIN(raw=901234567890).check_digit == '6'
assert GTIN(raw=36013101).check_digit == '7'
assert GTIN(raw=123456789012).check_digit == '8'
assert GTIN(raw=208957399425).check_digit == '9'
def test_str():
# 14-digit
assert str(GTIN(raw='0123456789012')) == '01234567890128' # str - implicit length
assert str(GTIN(raw='0123456789012', length=14)) == '01234567890128' # str - explicit length
assert str(GTIN(raw=123456789012)) == '01234567890128' # int - implicit length
assert str(GTIN(raw=123456789012, length=14)) == '01234567890128' # int - explicit length
assert str(GTIN(raw=123456789012.0)) == '01234567890128' # float - implicit length
assert str(GTIN(raw=123456789012.0, length=14)) == '01234567890128' # float - explicit length
assert str(GTIN(raw=Decimal(123456789012))) == '01234567890128' # Decimal - implicit length
assert str(GTIN(raw=Decimal(123456789012), length=14)) == '01234567890128' # Decimal - explicit length
assert str(GTIN(GTIN('01234567890128'))) == '01234567890128' # GTIN
# 12-digit
assert str(GTIN(raw='01234567890')) == '012345678905' # str - implicit length
assert str(GTIN(raw='01234567890', length=12)) == '012345678905' # str - explicit length
assert str(GTIN(raw=1234567890, length=12)) == '012345678905' # int
assert str(GTIN(raw=1234567890.0, length=12)) == '012345678905' # float
assert str(GTIN(raw=Decimal(1234567890), length=12)) == '012345678905' # Decimal
assert str(GTIN(GTIN('01234567890128'))) == '01234567890128'
assert str(GTIN(GTIN('01234567890128'), length=12)) == '01234567890128'
# 8-digit
assert str(GTIN(raw='0123456')) == '01234565' # str - implicit length
assert str(GTIN(raw='0123456', length=8)) == '01234565' # str - explicit length
assert str(GTIN(raw=123456, length=8)) == '01234565' # int
assert str(GTIN(raw=123456.0, length=8)) == '01234565' # float
assert str(GTIN(raw=Decimal(123456), length=8)) == '01234565' # Decimal
assert str(GTIN(GTIN('01234565'))) == '01234565'
assert str(GTIN(GTIN('01234565'), length=8)) == '01234565'
def test_gcp():
gcp_prefixes_lengths = prefixes_lengths(local=True)
# GS1 US
assert gcp_prefixes_lengths['03321'] == 6
assert GTIN('00332100000001').gcp == '033210'
assert gcp_prefixes_lengths['081'] == 9
# Restricted distribution
assert gcp_prefixes_lengths['02'] == 0
assert GTIN('02345678901289').gcp == ''
assert gcp_prefixes_lengths['2'] == 0
assert GTIN('00234567890129').gcp == ''
# Exception handling
gcp_not_found_error = None
try:
g = GTIN('01345678901280').gcp
except Exception as e:
gcp_not_found_error = e
assert isinstance(gcp_not_found_error, GCPNotFoundError)
if __name__ == '__main__':
test_check_digit()
test_str()
test_gcp()
|
/*!
* # Semantic UI 1.11.2 - Popup
* http://github.com/semantic-org/semantic-ui/
*
*
* Copyright 2014 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
!function(e,t,o,n){"use strict";e.fn.popup=function(i){var r,s=e(this),a=e(o),p=s.selector||"",l="ontouchstart"in o.documentElement,u=(new Date).getTime(),c=[],d=arguments[0],f="string"==typeof d,g=[].slice.call(arguments,1);return s.each(function(){var o,s,h,m,b,v=e.isPlainObject(i)?e.extend(!0,{},e.fn.popup.settings,i):e.extend({},e.fn.popup.settings),y=v.selector,w=v.className,P=v.error,T=v.metadata,C=v.namespace,x="."+v.namespace,k="module-"+C,S=e(this),O=e(v.context),E=v.target?e(v.target):S,j=e(t),A=e("body"),R=0,F=!1,D=this,H=S.data(k);b={initialize:function(){b.debug("Initializing",S),b.createID(),b.bind.events(),!b.exists()&&v.preserve&&b.create(),b.instantiate()},instantiate:function(){b.verbose("Storing instance",b),H=b,S.data(k,H)},refresh:function(){v.popup?o=e(v.popup).eq(0):v.inline&&(o=E.next(y.popup).eq(0)),v.popup?(o.addClass(w.loading),s=b.get.offsetParent(),o.removeClass(w.loading),v.movePopup&&b.has.popup()&&b.get.offsetParent(o)[0]!==s[0]&&(b.debug("Moving popup to the same offset parent as activating element"),o.detach().appendTo(s))):s=v.inline?b.get.offsetParent(E):b.has.popup()?b.get.offsetParent(o):A,s.is("html")&&(b.debug("Setting page as offset parent"),s=A)},reposition:function(){b.refresh(),b.set.position()},destroy:function(){b.debug("Destroying previous module"),o&&!v.preserve&&b.removePopup(),clearTimeout(b.hideTimer),clearTimeout(b.showTimer),j.off(h),S.off(x).removeData(k)},event:{start:function(){var t=e.isPlainObject(v.delay)?v.delay.show:v.delay;clearTimeout(b.hideTimer),b.showTimer=setTimeout(function(){!b.is.hidden()||b.is.active()&&b.is.dropdown()||b.show()},t)},end:function(){var t=e.isPlainObject(v.delay)?v.delay.hide:v.delay;clearTimeout(b.showTimer),b.hideTimer=setTimeout(function(){b.is.visible()&&b.hide()},t)},resize:function(){b.is.visible()&&b.set.position()}},create:function(){var t=S.data(T.html)||v.html,n=S.data(T.variation)||v.variation,i=S.data(T.title)||v.title,r=S.data(T.content)||S.attr("title")||v.content;t||r||i?(b.debug("Creating pop-up html"),t||(t=v.templates.popup({title:i,content:r})),o=e("<div/>").addClass(w.popup).addClass(n).data(T.activator,S).html(t),n&&o.addClass(n),v.inline?(b.verbose("Inserting popup element inline",o),o.insertAfter(S)):(b.verbose("Appending popup element to body",o),o.appendTo(O)),b.refresh(),v.hoverable&&b.bind.popup(),v.onCreate.call(o,D)):0!==E.next(y.popup).length?(b.verbose("Pre-existing popup found"),v.inline=!0,v.popup=E.next(y.popup).data(T.activator,S),b.refresh(),v.hoverable&&b.bind.popup()):v.popup?(v.popup.data(T.activator,S),b.verbose("Used popup specified in settings"),b.refresh(),v.hoverable&&b.bind.popup()):b.debug("No content specified skipping display",D)},createID:function(){m=(Math.random().toString(16)+"000000000").substr(2,8),h="."+m,b.verbose("Creating unique id for element",m)},toggle:function(){b.debug("Toggling pop-up"),b.is.hidden()?(b.debug("Popup is hidden, showing pop-up"),b.unbind.close(),b.show()):(b.debug("Popup is visible, hiding pop-up"),b.hide())},show:function(t){t=e.isFunction(t)?t:function(){},b.debug("Showing pop-up",v.transition),b.exists()?v.preserve||v.popup||b.refresh():b.create(),o&&b.set.position()&&(b.save.conditions(),v.exclusive&&b.hideAll(),b.animate.show(t))},hide:function(t){t=e.isFunction(t)?t:function(){},b.remove.visible(),b.unbind.close(),b.is.visible()&&(b.restore.conditions(),b.animate.hide(t))},hideAll:function(){e(y.popup).filter("."+w.visible).each(function(){e(this).data(T.activator).popup("hide")})},hideGracefully:function(t){t&&0===e(t.target).closest(y.popup).length?(b.debug("Click occurred outside popup hiding popup"),b.hide()):b.debug("Click was inside popup, keeping popup open")},exists:function(){return o?v.inline||v.popup?b.has.popup():o.closest(O).length>=1?!0:!1:!1},removePopup:function(){b.debug("Removing popup",o),b.has.popup()&&!v.popup&&(o.remove(),o=n),v.onRemove.call(o,D)},save:{conditions:function(){b.cache={title:S.attr("title")},b.cache.title&&S.removeAttr("title"),b.verbose("Saving original attributes",b.cache.title)}},restore:{conditions:function(){return b.cache&&b.cache.title&&(S.attr("title",b.cache.title),b.verbose("Restoring original attributes",b.cache.title)),!0}},animate:{show:function(t){t=e.isFunction(t)?t:function(){},v.transition&&e.fn.transition!==n&&S.transition("is supported")?(b.set.visible(),o.transition({animation:v.transition+" in",queue:!1,debug:v.debug,verbose:v.verbose,duration:v.duration,onComplete:function(){b.bind.close(),t.call(o,D),v.onVisible.call(o,D)}})):(b.set.visible(),o.stop().fadeIn(v.duration,v.easing,function(){b.bind.close(),t.call(o,D),v.onVisible.call(o,D)})),v.onShow.call(o,D)},hide:function(t){t=e.isFunction(t)?t:function(){},b.debug("Hiding pop-up"),v.transition&&e.fn.transition!==n&&S.transition("is supported")?o.transition({animation:v.transition+" out",queue:!1,duration:v.duration,debug:v.debug,verbose:v.verbose,onComplete:function(){b.reset(),t.call(o,D),v.onHidden.call(o,D)}}):o.stop().fadeOut(v.duration,v.easing,function(){b.reset(),t.call(o,D),v.onHidden.call(o,D)}),v.onHide.call(o,D)}},get:{id:function(){return m},startEvent:function(){return"hover"==v.on?l?"touchstart mouseenter":"mouseenter":"focus"==v.on?"focus":!1},scrollEvent:function(){return l?"touchmove scroll":"scroll"},endEvent:function(){return"hover"==v.on?"mouseleave":"focus"==v.on?"blur":!1},offsetParent:function(t){var o=t!==n?t[0]:S[0],i=o.parentNode,r=e(i);if(i)for(var s="none"===r.css("transform"),a="static"===r.css("position"),p=r.is("html");i&&!p&&a&&s;)i=i.parentNode,r=e(i),s="none"===r.css("transform"),a="static"===r.css("position"),p=r.is("html");return r&&r.length>0?r:e()},offstagePosition:function(n){var i={top:e(t).scrollTop(),bottom:e(t).scrollTop()+e(t).height(),left:0,right:e(t).width()},r={width:o.width(),height:o.height(),offset:o.offset()},s={},a=[];return n=n||!1,r.offset&&n&&(b.verbose("Checking if outside viewable area",r.offset),s={top:r.offset.top<i.top,bottom:r.offset.top+r.height>i.bottom,right:r.offset.left+r.width>i.right,left:r.offset.left<i.left}),e.each(s,function(e,t){t&&a.push(e)}),a.length>0?a.join(" "):!1},positions:function(){return{"top left":!1,"top center":!1,"top right":!1,"bottom left":!1,"bottom center":!1,"bottom right":!1,"left center":!1,"right center":!1}},nextPosition:function(e){var t=e.split(" "),o=t[0],n=t[1],i={top:"bottom",bottom:"top",left:"right",right:"left"},r={left:"center",center:"right",right:"left"},s={"top left":"top center","top center":"top right","top right":"right center","right center":"bottom right","bottom right":"bottom center","bottom center":"bottom left","bottom left":"left center","left center":"top left"},a="top"==o||"bottom"==o,p=!1,l=!1,u=!1;return F||(b.verbose("All available positions available"),F=b.get.positions()),b.debug("Recording last position tried",e),F[e]=!0,"opposite"===v.prefer&&(u=[i[o],n],u=u.join(" "),p=F[u]===!0,b.debug("Trying opposite strategy",u)),"adjacent"===v.prefer&&a&&(u=[o,r[n]],u=u.join(" "),l=F[u]===!0,b.debug("Trying adjacent strategy",u)),(l||p)&&(b.debug("Using backup position",u),u=s[e]),u}},set:{position:function(i,r){var a,p,l,u=(e(t).width(),e(t).height(),E.outerWidth()),c=E.outerHeight(),d=o.outerWidth(),f=o.outerHeight(),g=s.outerWidth(),h=s.outerHeight(),m=v.distanceAway,y=E[0],C=v.inline?parseInt(t.getComputedStyle(y).getPropertyValue("margin-top"),10):0,x=v.inline?parseInt(t.getComputedStyle(y).getPropertyValue(b.is.rtl()?"margin-right":"margin-left"),10):0,k=v.inline||v.popup?E.position():E.offset();switch(i=i||S.data(T.position)||v.position,r=r||S.data(T.offset)||v.offset,R==v.maxSearchDepth&&v.lastResort&&(b.debug("Using last resort position to display",v.lastResort),i=v.lastResort),v.inline&&(b.debug("Adding targets margin to calculation"),"left center"==i||"right center"==i?(r+=C,m+=-x):"top left"==i||"top center"==i||"top right"==i?(r+=x,m-=C):(r+=x,m+=C)),b.debug("Calculating popup positioning",i),a=i,b.is.rtl()&&(a=a.replace(/left|right/g,function(e){return"left"==e?"right":"left"}),b.debug("RTL: Popup positioning updated",a)),a){case"top left":p={top:"auto",bottom:h-k.top+m,left:k.left+r,right:"auto"};break;case"top center":p={bottom:h-k.top+m,left:k.left+u/2-d/2+r,top:"auto",right:"auto"};break;case"top right":p={bottom:h-k.top+m,right:g-k.left-u-r,top:"auto",left:"auto"};break;case"left center":p={top:k.top+c/2-f/2+r,right:g-k.left+m,left:"auto",bottom:"auto"};break;case"right center":p={top:k.top+c/2-f/2+r,left:k.left+u+m,bottom:"auto",right:"auto"};break;case"bottom left":p={top:k.top+c+m,left:k.left+r,bottom:"auto",right:"auto"};break;case"bottom center":p={top:k.top+c+m,left:k.left+u/2-d/2+r,bottom:"auto",right:"auto"};break;case"bottom right":p={top:k.top+c+m,right:g-k.left-u-r,left:"auto",bottom:"auto"}}if(p===n&&b.error(P.invalidPosition,i),b.debug("Calculated popup positioning values",p),o.css(p).removeClass(w.position).addClass(i).addClass(w.loading),l=b.get.offstagePosition(i)){if(b.debug("Popup cant fit into viewport",l),R<v.maxSearchDepth)return R++,i=b.get.nextPosition(i),b.debug("Trying new position",i),o?b.set.position(i):!1;if(!v.lastResort)return b.debug("Popup could not find a position in view",o),b.error(P.cannotPlace,D),b.remove.attempts(),b.remove.loading(),b.reset(),!1}return b.debug("Position is on stage",i),b.remove.attempts(),b.set.fluidWidth(),b.remove.loading(),!0},fluidWidth:function(){v.setFluidWidth&&o.hasClass(w.fluid)&&o.css("width",s.width())},visible:function(){S.addClass(w.visible)}},remove:{loading:function(){o.removeClass(w.loading)},visible:function(){S.removeClass(w.visible)},attempts:function(){b.verbose("Resetting all searched positions"),R=0,F=!1}},bind:{events:function(){b.debug("Binding popup events to module"),"click"==v.on?S.on("click"+x,b.toggle):b.get.startEvent()&&S.on(b.get.startEvent()+x,b.event.start).on(b.get.endEvent()+x,b.event.end),v.target&&b.debug("Target set to element",E),j.on("resize"+h,b.event.resize)},popup:function(){b.verbose("Allowing hover events on popup to prevent closing"),o&&b.has.popup()&&o.on("mouseenter"+x,b.event.start).on("mouseleave"+x,b.event.end)},close:function(){(v.hideOnScroll===!0||"auto"==v.hideOnScroll&&"click"!=v.on)&&(a.one(b.get.scrollEvent()+h,b.hideGracefully),O.one(b.get.scrollEvent()+h,b.hideGracefully)),"click"==v.on&&v.closable&&(b.verbose("Binding popup close event to document"),a.on("click"+h,function(e){b.verbose("Pop-up clickaway intent detected"),b.hideGracefully.call(D,e)}))}},unbind:{close:function(){(v.hideOnScroll===!0||"auto"==v.hideOnScroll&&"click"!=v.on)&&(a.off("scroll"+h,b.hide),O.off("scroll"+h,b.hide)),"click"==v.on&&v.closable&&(b.verbose("Removing close event from document"),a.off("click"+h))}},has:{popup:function(){return o&&o.length>0}},is:{active:function(){return S.hasClass(w.active)},animating:function(){return o&&o.is(":animated")||o.hasClass(w.animating)},visible:function(){return o&&o.is(":visible")},dropdown:function(){return S.hasClass(w.dropdown)},hidden:function(){return!b.is.visible()},rtl:function(){return"rtl"==S.css("direction")}},reset:function(){b.remove.visible(),v.preserve?e.fn.transition!==n&&o.transition("remove transition"):b.removePopup()},setting:function(t,o){if(e.isPlainObject(t))e.extend(!0,v,t);else{if(o===n)return v[t];v[t]=o}},internal:function(t,o){if(e.isPlainObject(t))e.extend(!0,b,t);else{if(o===n)return b[t];b[t]=o}},debug:function(){v.debug&&(v.performance?b.performance.log(arguments):(b.debug=Function.prototype.bind.call(console.info,console,v.name+":"),b.debug.apply(console,arguments)))},verbose:function(){v.verbose&&v.debug&&(v.performance?b.performance.log(arguments):(b.verbose=Function.prototype.bind.call(console.info,console,v.name+":"),b.verbose.apply(console,arguments)))},error:function(){b.error=Function.prototype.bind.call(console.error,console,v.name+":"),b.error.apply(console,arguments)},performance:{log:function(e){var t,o,n;v.performance&&(t=(new Date).getTime(),n=u||t,o=t-n,u=t,c.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:D,"Execution Time":o})),clearTimeout(b.performance.timer),b.performance.timer=setTimeout(b.performance.display,100)},display:function(){var t=v.name+":",o=0;u=!1,clearTimeout(b.performance.timer),e.each(c,function(e,t){o+=t["Execution Time"]}),t+=" "+o+"ms",p&&(t+=" '"+p+"'"),(console.group!==n||console.table!==n)&&c.length>0&&(console.groupCollapsed(t),console.table?console.table(c):e.each(c,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),c=[]}},invoke:function(t,o,i){var s,a,p,l=H;return o=o||g,i=D||i,"string"==typeof t&&l!==n&&(t=t.split(/[\. ]/),s=t.length-1,e.each(t,function(o,i){var r=o!=s?i+t[o+1].charAt(0).toUpperCase()+t[o+1].slice(1):t;if(e.isPlainObject(l[r])&&o!=s)l=l[r];else{if(l[r]!==n)return a=l[r],!1;if(!e.isPlainObject(l[i])||o==s)return l[i]!==n?(a=l[i],!1):!1;l=l[i]}})),e.isFunction(a)?p=a.apply(i,o):a!==n&&(p=a),e.isArray(r)?r.push(p):r!==n?r=[r,p]:p!==n&&(r=p),a}},f?(H===n&&b.initialize(),b.invoke(d)):(H!==n&&H.invoke("destroy"),b.initialize())}),r!==n?r:this},e.fn.popup.settings={name:"Popup",debug:!1,verbose:!0,performance:!0,namespace:"popup",onCreate:function(){},onRemove:function(){},onShow:function(){},onVisible:function(){},onHide:function(){},onHidden:function(){},variation:"",content:!1,html:!1,title:!1,on:"hover",closable:!0,hideOnScroll:"auto",exclusive:!0,context:"body",position:"top left",prefer:"opposite",lastResort:!1,delay:{show:30,hide:0},setFluidWidth:!0,movePopup:!0,target:!1,popup:!1,inline:!1,preserve:!1,hoverable:!1,duration:200,easing:"easeOutQuint",transition:"scale",distanceAway:0,offset:0,maxSearchDepth:20,error:{invalidPosition:"The position you specified is not a valid position",cannotPlace:"No visible position could be found for the popup",method:"The method you called is not defined."},metadata:{activator:"activator",content:"content",html:"html",offset:"offset",position:"position",title:"title",variation:"variation"},className:{active:"active",animating:"animating",dropdown:"dropdown",fluid:"fluid",loading:"loading",popup:"ui popup",position:"top left center bottom right",visible:"visible"},selector:{popup:".ui.popup"},templates:{escape:function(e){var t=/[&<>"'`]/g,o=/[&<>"'`]/,n={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},i=function(e){return n[e]};return o.test(e)?e.replace(t,i):e},popup:function(t){var o="",i=e.fn.popup.settings.templates.escape;return typeof t!==n&&(typeof t.title!==n&&t.title&&(t.title=i(t.title),o+='<div class="header">'+t.title+"</div>"),typeof t.content!==n&&t.content&&(t.content=i(t.content),o+='<div class="content">'+t.content+"</div>")),o}}},e.extend(e.easing,{easeOutQuad:function(e,t,o,n,i){return-n*(t/=i)*(t-2)+o}})}(jQuery,window,document);
|
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DEPS = [
'builder_name_schema',
]
def RunSteps(api):
names = [
'Build-Debian9-Clang-x64-Release-Android',
'Upload-Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-Shard_12-Coverage',
]
for name in names:
d = api.builder_name_schema.DictForBuilderName(name)
got = api.builder_name_schema.MakeBuilderName(**d)
assert got == name
# Failures.
try:
api.builder_name_schema.MakeBuilderName(role='nope')
except ValueError:
pass
try:
api.builder_name_schema.MakeBuilderName(compiler='Build', os='ab')
except ValueError:
pass
try:
api.builder_name_schema.MakeBuilderName(role='Build', bogus='BOGUS')
except ValueError:
pass
try:
api.builder_name_schema.MakeBuilderName(
role='Build',
os='Debian9',
compiler='Clang',
target_arch='x64',
configuration='Release',
extra_config='A%sB' % api.builder_name_schema.BUILDER_NAME_SEP)
except ValueError:
pass
try:
api.builder_name_schema.DictForBuilderName('Build-')
except ValueError:
pass
try:
api.builder_name_schema.DictForBuilderName(
'Build-Debian9-Clang-x64-Release-Android-Bogus')
except ValueError:
pass
try:
api.builder_name_schema.DictForBuilderName(
'Bogus-Debian9-Clang-x64-Release-Android')
except ValueError:
pass
try:
api.builder_name_schema.MakeBuilderName(role='Upload')
except ValueError:
pass
try:
m = {
'role': 'Upload',
'sub-role-1': 'fake',
}
api.builder_name_schema.MakeBuilderName(**m)
except ValueError:
pass
try:
api.builder_name_schema.MakeBuilderName(
role='Build',
os='Debian9',
compiler='Clang',
target_arch='x64',
configuration='Release',
extra_config='Android',
extra_extra_config='Bogus',
)
except ValueError:
pass
def GenTests(api):
yield api.test('test')
|
#!/usr/bin/env python3
# Copyright (c) 2020 The Fujicoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Test addrv2 relay
"""
import time
from test_framework.messages import (
CAddress,
msg_addrv2,
NODE_NETWORK,
NODE_WITNESS,
)
from test_framework.p2p import P2PInterface
from test_framework.test_framework import FujicoinTestFramework
from test_framework.util import assert_equal
I2P_ADDR = "c4gfnttsuwqomiygupdqqqyy5y5emnk5c73hrfvatri67prd7vyq.b32.i2p"
ADDRS = []
for i in range(10):
addr = CAddress()
addr.time = int(time.time()) + i
addr.nServices = NODE_NETWORK | NODE_WITNESS
# Add one I2P address at an arbitrary position.
if i == 5:
addr.net = addr.NET_I2P
addr.ip = I2P_ADDR
else:
addr.ip = f"123.123.123.{i % 256}"
addr.port = 8333 + i
ADDRS.append(addr)
class AddrReceiver(P2PInterface):
addrv2_received_and_checked = False
def __init__(self):
super().__init__(support_addrv2 = True)
def on_addrv2(self, message):
expected_set = set((addr.ip, addr.port) for addr in ADDRS)
received_set = set((addr.ip, addr.port) for addr in message.addrs)
if expected_set == received_set:
self.addrv2_received_and_checked = True
def wait_for_addrv2(self):
self.wait_until(lambda: "addrv2" in self.last_message)
class AddrTest(FujicoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 1
self.extra_args = [["-whitelist=addr@127.0.0.1"]]
def run_test(self):
self.log.info('Create connection that sends addrv2 messages')
addr_source = self.nodes[0].add_p2p_connection(P2PInterface())
msg = msg_addrv2()
self.log.info('Send too-large addrv2 message')
msg.addrs = ADDRS * 101
with self.nodes[0].assert_debug_log(['addrv2 message size = 1010']):
addr_source.send_and_ping(msg)
self.log.info('Check that addrv2 message content is relayed and added to addrman')
addr_receiver = self.nodes[0].add_p2p_connection(AddrReceiver())
msg.addrs = ADDRS
with self.nodes[0].assert_debug_log([
# The I2P address is not added to node's own addrman because it has no
# I2P reachability (thus 10 - 1 = 9).
'Added 9 addresses from 127.0.0.1: 0 tried',
'received: addrv2 (159 bytes) peer=0',
'sending addrv2 (159 bytes) peer=1',
]):
addr_source.send_and_ping(msg)
self.nodes[0].setmocktime(int(time.time()) + 30 * 60)
addr_receiver.wait_for_addrv2()
assert addr_receiver.addrv2_received_and_checked
assert_equal(len(self.nodes[0].getnodeaddresses(count=0, network="i2p")), 0)
if __name__ == '__main__':
AddrTest().main()
|
/*!
* Sizzle CSS Selector Engine v1.10.16
* http://sizzlejs.com/
*
* Copyright 2013 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2014-01-13
*/
(function( window ) {
var i,
support,
Expr,
getText,
isXML,
compile,
outermostContext,
sortInput,
hasDuplicate,
// Local document vars
setDocument,
document,
docElem,
documentIsHTML,
rbuggyQSA,
rbuggyMatches,
matches,
contains,
// Instance-specific data
expando = "sizzle" + -(new Date()),
preferredDoc = window.document,
dirruns = 0,
done = 0,
classCache = createCache(),
tokenCache = createCache(),
compilerCache = createCache(),
sortOrder = function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
}
return 0;
},
// General-purpose constants
strundefined = typeof undefined,
MAX_NEGATIVE = 1 << 31,
// Instance methods
hasOwn = ({}).hasOwnProperty,
arr = [],
pop = arr.pop,
push_native = arr.push,
push = arr.push,
slice = arr.slice,
// Use a stripped-down indexOf if we can't use a native one
indexOf = arr.indexOf || function( elem ) {
var i = 0,
len = this.length;
for ( ; i < len; i++ ) {
if ( this[i] === elem ) {
return i;
}
}
return -1;
},
booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
// Regular expressions
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",
// http://www.w3.org/TR/css3-syntax/#characters
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
// Loosely modeled on CSS identifier characters
// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
identifier = characterEncoding.replace( "w", "w#" ),
// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
"*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
// Prefer arguments quoted,
// then not containing pseudos/brackets,
// then attribute selectors/non-parenthetical expressions,
// then anything else
// These preferences are here to reduce the number of selectors
// needing tokenize in the PSEUDO preFilter
pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
rpseudo = new RegExp( pseudos ),
ridentifier = new RegExp( "^" + identifier + "$" ),
matchExpr = {
"ID": new RegExp( "^#(" + characterEncoding + ")" ),
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
"ATTR": new RegExp( "^" + attributes ),
"PSEUDO": new RegExp( "^" + pseudos ),
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
"bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
// For use in libraries implementing .is()
// We use this for POS matching in `select`
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
},
rinputs = /^(?:input|select|textarea|button)$/i,
rheader = /^h\d$/i,
rnative = /^[^{]+\{\s*\[native \w/,
// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
rsibling = /[+~]/,
rescape = /'|\\/g,
// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
funescape = function( _, escaped, escapedWhitespace ) {
var high = "0x" + escaped - 0x10000;
// NaN means non-codepoint
// Support: Firefox
// Workaround erroneous numeric interpretation of +"0x"
return high !== high || escapedWhitespace ?
escaped :
high < 0 ?
// BMP codepoint
String.fromCharCode( high + 0x10000 ) :
// Supplemental Plane codepoint (surrogate pair)
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
};
// Optimize for push.apply( _, NodeList )
try {
push.apply(
(arr = slice.call( preferredDoc.childNodes )),
preferredDoc.childNodes
);
// Support: Android<4.0
// Detect silently failing push.apply
arr[ preferredDoc.childNodes.length ].nodeType;
} catch ( e ) {
push = { apply: arr.length ?
// Leverage slice if possible
function( target, els ) {
push_native.apply( target, slice.call(els) );
} :
// Support: IE<9
// Otherwise append directly
function( target, els ) {
var j = target.length,
i = 0;
// Can't trust NodeList.length
while ( (target[j++] = els[i++]) ) {}
target.length = j - 1;
}
};
}
function Sizzle( selector, context, results, seed ) {
var match, elem, m, nodeType,
// QSA vars
i, groups, old, nid, newContext, newSelector;
if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
setDocument( context );
}
context = context || document;
results = results || [];
if ( !selector || typeof selector !== "string" ) {
return results;
}
if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
return [];
}
if ( documentIsHTML && !seed ) {
// Shortcuts
if ( (match = rquickExpr.exec( selector )) ) {
// Speed-up: Sizzle("#ID")
if ( (m = match[1]) ) {
if ( nodeType === 9 ) {
elem = context.getElementById( m );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document (jQuery #6963)
if ( elem && elem.parentNode ) {
// Handle the case where IE, Opera, and Webkit return items
// by name instead of ID
if ( elem.id === m ) {
results.push( elem );
return results;
}
} else {
return results;
}
} else {
// Context is not a document
if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
contains( context, elem ) && elem.id === m ) {
results.push( elem );
return results;
}
}
// Speed-up: Sizzle("TAG")
} else if ( match[2] ) {
push.apply( results, context.getElementsByTagName( selector ) );
return results;
// Speed-up: Sizzle(".CLASS")
} else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
push.apply( results, context.getElementsByClassName( m ) );
return results;
}
}
// QSA path
if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
nid = old = expando;
newContext = context;
newSelector = nodeType === 9 && selector;
// qSA works strangely on Element-rooted queries
// We can work around this by specifying an extra ID on the root
// and working up from there (Thanks to Andrew Dupont for the technique)
// IE 8 doesn't work on object elements
if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
groups = tokenize( selector );
if ( (old = context.getAttribute("id")) ) {
nid = old.replace( rescape, "\\$&" );
} else {
context.setAttribute( "id", nid );
}
nid = "[id='" + nid + "'] ";
i = groups.length;
while ( i-- ) {
groups[i] = nid + toSelector( groups[i] );
}
newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;
newSelector = groups.join(",");
}
if ( newSelector ) {
try {
push.apply( results,
newContext.querySelectorAll( newSelector )
);
return results;
} catch(qsaError) {
} finally {
if ( !old ) {
context.removeAttribute("id");
}
}
}
}
}
// All others
return select( selector.replace( rtrim, "$1" ), context, results, seed );
}
/**
* Create key-value caches of limited size
* @returns {Function(string, Object)} Returns the Object data after storing it on itself with
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
* deleting the oldest entry
*/
function createCache() {
var keys = [];
function cache( key, value ) {
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
if ( keys.push( key + " " ) > Expr.cacheLength ) {
// Only keep the most recent entries
delete cache[ keys.shift() ];
}
return (cache[ key + " " ] = value);
}
return cache;
}
/**
* Mark a function for special use by Sizzle
* @param {Function} fn The function to mark
*/
function markFunction( fn ) {
fn[ expando ] = true;
return fn;
}
/**
* Support testing using an element
* @param {Function} fn Passed the created div and expects a boolean result
*/
function assert( fn ) {
var div = document.createElement("div");
try {
return !!fn( div );
} catch (e) {
return false;
} finally {
// Remove from its parent by default
if ( div.parentNode ) {
div.parentNode.removeChild( div );
}
// release memory in IE
div = null;
}
}
/**
* Adds the same handler for all of the specified attrs
* @param {String} attrs Pipe-separated list of attributes
* @param {Function} handler The method that will be applied
*/
function addHandle( attrs, handler ) {
var arr = attrs.split("|"),
i = attrs.length;
while ( i-- ) {
Expr.attrHandle[ arr[i] ] = handler;
}
}
/**
* Checks document order of two siblings
* @param {Element} a
* @param {Element} b
* @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
*/
function siblingCheck( a, b ) {
var cur = b && a,
diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
( ~b.sourceIndex || MAX_NEGATIVE ) -
( ~a.sourceIndex || MAX_NEGATIVE );
// Use IE sourceIndex if available on both nodes
if ( diff ) {
return diff;
}
// Check if b follows a
if ( cur ) {
while ( (cur = cur.nextSibling) ) {
if ( cur === b ) {
return -1;
}
}
}
return a ? 1 : -1;
}
/**
* Returns a function to use in pseudos for input types
* @param {String} type
*/
function createInputPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === type;
};
}
/**
* Returns a function to use in pseudos for buttons
* @param {String} type
*/
function createButtonPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && elem.type === type;
};
}
/**
* Returns a function to use in pseudos for positionals
* @param {Function} fn
*/
function createPositionalPseudo( fn ) {
return markFunction(function( argument ) {
argument = +argument;
return markFunction(function( seed, matches ) {
var j,
matchIndexes = fn( [], seed.length, argument ),
i = matchIndexes.length;
// Match elements found at the specified indexes
while ( i-- ) {
if ( seed[ (j = matchIndexes[i]) ] ) {
seed[j] = !(matches[j] = seed[j]);
}
}
});
});
}
/**
* Checks a node for validity as a Sizzle context
* @param {Element|Object=} context
* @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
*/
function testContext( context ) {
return context && typeof context.getElementsByTagName !== strundefined && context;
}
// Expose support vars for convenience
support = Sizzle.support = {};
/**
* Detects XML nodes
* @param {Element|Object} elem An element or a document
* @returns {Boolean} True iff elem is a non-HTML XML node
*/
isXML = Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = elem && (elem.ownerDocument || elem).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
/**
* Sets document-related variables once based on the current document
* @param {Element|Object} [doc] An element or document object to use to set the document
* @returns {Object} Returns the current document
*/
setDocument = Sizzle.setDocument = function( node ) {
var hasCompare,
doc = node ? node.ownerDocument || node : preferredDoc,
parent = doc.defaultView;
// If no document and documentElement is available, return
if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
return document;
}
// Set our document
document = doc;
docElem = doc.documentElement;
// Support tests
documentIsHTML = !isXML( doc );
// Support: IE>8
// If iframe document is assigned to "document" variable and if iframe has been reloaded,
// IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
// IE6-8 do not support the defaultView property so parent will be undefined
if ( parent && parent !== parent.top ) {
// IE11 does not have attachEvent, so all must suffer
if ( parent.addEventListener ) {
parent.addEventListener( "unload", function() {
setDocument();
}, false );
} else if ( parent.attachEvent ) {
parent.attachEvent( "onunload", function() {
setDocument();
});
}
}
/* Attributes
---------------------------------------------------------------------- */
// Support: IE<8
// Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
support.attributes = assert(function( div ) {
div.className = "i";
return !div.getAttribute("className");
});
/* getElement(s)By*
---------------------------------------------------------------------- */
// Check if getElementsByTagName("*") returns only elements
support.getElementsByTagName = assert(function( div ) {
div.appendChild( doc.createComment("") );
return !div.getElementsByTagName("*").length;
});
// Check if getElementsByClassName can be trusted
support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) {
div.innerHTML = "<div class='a'></div><div class='a i'></div>";
// Support: Safari<4
// Catch class over-caching
div.firstChild.className = "i";
// Support: Opera<10
// Catch gEBCN failure to find non-leading classes
return div.getElementsByClassName("i").length === 2;
});
// Support: IE<10
// Check if getElementById returns elements by name
// The broken getElementById methods don't pick up programatically-set names,
// so use a roundabout getElementsByName test
support.getById = assert(function( div ) {
docElem.appendChild( div ).id = expando;
return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
});
// ID find and filter
if ( support.getById ) {
Expr.find["ID"] = function( id, context ) {
if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
var m = context.getElementById( id );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
}
};
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
return elem.getAttribute("id") === attrId;
};
};
} else {
// Support: IE6/7
// getElementById is not reliable as a find shortcut
delete Expr.find["ID"];
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
return node && node.value === attrId;
};
};
}
// Tag
Expr.find["TAG"] = support.getElementsByTagName ?
function( tag, context ) {
if ( typeof context.getElementsByTagName !== strundefined ) {
return context.getElementsByTagName( tag );
}
} :
function( tag, context ) {
var elem,
tmp = [],
i = 0,
results = context.getElementsByTagName( tag );
// Filter out possible comments
if ( tag === "*" ) {
while ( (elem = results[i++]) ) {
if ( elem.nodeType === 1 ) {
tmp.push( elem );
}
}
return tmp;
}
return results;
};
// Class
Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {
return context.getElementsByClassName( className );
}
};
/* QSA/matchesSelector
---------------------------------------------------------------------- */
// QSA and matchesSelector support
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
rbuggyMatches = [];
// qSa(:focus) reports false when true (Chrome 21)
// We allow this because of a bug in IE8/9 that throws an error
// whenever `document.activeElement` is accessed on an iframe
// So, we allow :focus to pass through QSA all the time to avoid the IE error
// See http://bugs.jquery.com/ticket/13378
rbuggyQSA = [];
if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
// Build QSA regex
// Regex strategy adopted from Diego Perini
assert(function( div ) {
// Select is set to empty string on purpose
// This is to test IE's treatment of not explicitly
// setting a boolean content attribute,
// since its presence should be enough
// http://bugs.jquery.com/ticket/12359
div.innerHTML = "<select t=''><option selected=''></option></select>";
// Support: IE8, Opera 10-12
// Nothing should be selected when empty strings follow ^= or $= or *=
if ( div.querySelectorAll("[t^='']").length ) {
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
}
// Support: IE8
// Boolean attributes and "value" are not treated correctly
if ( !div.querySelectorAll("[selected]").length ) {
rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
}
// Webkit/Opera - :checked should return selected option elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
// IE8 throws error here and will not see later tests
if ( !div.querySelectorAll(":checked").length ) {
rbuggyQSA.push(":checked");
}
});
assert(function( div ) {
// Support: Windows 8 Native Apps
// The type and name attributes are restricted during .innerHTML assignment
var input = doc.createElement("input");
input.setAttribute( "type", "hidden" );
div.appendChild( input ).setAttribute( "name", "D" );
// Support: IE8
// Enforce case-sensitivity of name attribute
if ( div.querySelectorAll("[name=d]").length ) {
rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
}
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// IE8 throws error here and will not see later tests
if ( !div.querySelectorAll(":enabled").length ) {
rbuggyQSA.push( ":enabled", ":disabled" );
}
// Opera 10-11 does not throw on post-comma invalid pseudos
div.querySelectorAll("*,:x");
rbuggyQSA.push(",.*:");
});
}
if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector ||
docElem.mozMatchesSelector ||
docElem.oMatchesSelector ||
docElem.msMatchesSelector) )) ) {
assert(function( div ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9)
support.disconnectedMatch = matches.call( div, "div" );
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( div, "[s!='']:x" );
rbuggyMatches.push( "!=", pseudos );
});
}
rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
/* Contains
---------------------------------------------------------------------- */
hasCompare = rnative.test( docElem.compareDocumentPosition );
// Element contains another
// Purposefully does not implement inclusive descendent
// As in, an element does not contain itself
contains = hasCompare || rnative.test( docElem.contains ) ?
function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
return a === bup || !!( bup && bup.nodeType === 1 && (
adown.contains ?
adown.contains( bup ) :
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
));
} :
function( a, b ) {
if ( b ) {
while ( (b = b.parentNode) ) {
if ( b === a ) {
return true;
}
}
}
return false;
};
/* Sorting
---------------------------------------------------------------------- */
// Document order sorting
sortOrder = hasCompare ?
function( a, b ) {
// Flag for duplicate removal
if ( a === b ) {
hasDuplicate = true;
return 0;
}
// Sort on method existence if only one input has compareDocumentPosition
var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
if ( compare ) {
return compare;
}
// Calculate position if both inputs belong to the same document
compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
a.compareDocumentPosition( b ) :
// Otherwise we know they are disconnected
1;
// Disconnected nodes
if ( compare & 1 ||
(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
// Choose the first element that is related to our preferred document
if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
return -1;
}
if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
return 1;
}
// Maintain original order
return sortInput ?
( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
0;
}
return compare & 4 ? -1 : 1;
} :
function( a, b ) {
// Exit early if the nodes are identical
if ( a === b ) {
hasDuplicate = true;
return 0;
}
var cur,
i = 0,
aup = a.parentNode,
bup = b.parentNode,
ap = [ a ],
bp = [ b ];
// Parentless nodes are either documents or disconnected
if ( !aup || !bup ) {
return a === doc ? -1 :
b === doc ? 1 :
aup ? -1 :
bup ? 1 :
sortInput ?
( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
0;
// If the nodes are siblings, we can do a quick check
} else if ( aup === bup ) {
return siblingCheck( a, b );
}
// Otherwise we need full lists of their ancestors for comparison
cur = a;
while ( (cur = cur.parentNode) ) {
ap.unshift( cur );
}
cur = b;
while ( (cur = cur.parentNode) ) {
bp.unshift( cur );
}
// Walk down the tree looking for a discrepancy
while ( ap[i] === bp[i] ) {
i++;
}
return i ?
// Do a sibling check if the nodes have a common ancestor
siblingCheck( ap[i], bp[i] ) :
// Otherwise nodes in our document sort first
ap[i] === preferredDoc ? -1 :
bp[i] === preferredDoc ? 1 :
0;
};
return doc;
};
Sizzle.matches = function( expr, elements ) {
return Sizzle( expr, null, null, elements );
};
Sizzle.matchesSelector = function( elem, expr ) {
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
// Make sure that attribute selectors are quoted
expr = expr.replace( rattributeQuotes, "='$1']" );
if ( support.matchesSelector && documentIsHTML &&
( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
try {
var ret = matches.call( elem, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || support.disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9
elem.document && elem.document.nodeType !== 11 ) {
return ret;
}
} catch(e) {}
}
return Sizzle( expr, document, null, [elem] ).length > 0;
};
Sizzle.contains = function( context, elem ) {
// Set document vars if needed
if ( ( context.ownerDocument || context ) !== document ) {
setDocument( context );
}
return contains( context, elem );
};
Sizzle.attr = function( elem, name ) {
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
var fn = Expr.attrHandle[ name.toLowerCase() ],
// Don't get fooled by Object.prototype properties (jQuery #13807)
val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
fn( elem, name, !documentIsHTML ) :
undefined;
return val !== undefined ?
val :
support.attributes || !documentIsHTML ?
elem.getAttribute( name ) :
(val = elem.getAttributeNode(name)) && val.specified ?
val.value :
null;
};
Sizzle.error = function( msg ) {
throw new Error( "Syntax error, unrecognized expression: " + msg );
};
/**
* Document sorting and removing duplicates
* @param {ArrayLike} results
*/
Sizzle.uniqueSort = function( results ) {
var elem,
duplicates = [],
j = 0,
i = 0;
// Unless we *know* we can detect duplicates, assume their presence
hasDuplicate = !support.detectDuplicates;
sortInput = !support.sortStable && results.slice( 0 );
results.sort( sortOrder );
if ( hasDuplicate ) {
while ( (elem = results[i++]) ) {
if ( elem === results[ i ] ) {
j = duplicates.push( i );
}
}
while ( j-- ) {
results.splice( duplicates[ j ], 1 );
}
}
// Clear input after sorting to release objects
// See https://github.com/jquery/sizzle/pull/225
sortInput = null;
return results;
};
/**
* Utility function for retrieving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
getText = Sizzle.getText = function( elem ) {
var node,
ret = "",
i = 0,
nodeType = elem.nodeType;
if ( !nodeType ) {
// If no nodeType, this is expected to be an array
while ( (node = elem[i++]) ) {
// Do not traverse comment nodes
ret += getText( node );
}
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
// Use textContent for elements
// innerText usage removed for consistency of new lines (jQuery #11153)
if ( typeof elem.textContent === "string" ) {
return elem.textContent;
} else {
// Traverse its children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
ret += getText( elem );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
// Do not include comment or processing instruction nodes
return ret;
};
Expr = Sizzle.selectors = {
// Can be adjusted by the user
cacheLength: 50,
createPseudo: markFunction,
match: matchExpr,
attrHandle: {},
find: {},
relative: {
">": { dir: "parentNode", first: true },
" ": { dir: "parentNode" },
"+": { dir: "previousSibling", first: true },
"~": { dir: "previousSibling" }
},
preFilter: {
"ATTR": function( match ) {
match[1] = match[1].replace( runescape, funescape );
// Move the given value to match[3] whether quoted or unquoted
match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
if ( match[2] === "~=" ) {
match[3] = " " + match[3] + " ";
}
return match.slice( 0, 4 );
},
"CHILD": function( match ) {
/* matches from matchExpr["CHILD"]
1 type (only|nth|...)
2 what (child|of-type)
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
4 xn-component of xn+y argument ([+-]?\d*n|)
5 sign of xn-component
6 x of xn-component
7 sign of y-component
8 y of y-component
*/
match[1] = match[1].toLowerCase();
if ( match[1].slice( 0, 3 ) === "nth" ) {
// nth-* requires argument
if ( !match[3] ) {
Sizzle.error( match[0] );
}
// numeric x and y parameters for Expr.filter.CHILD
// remember that false/true cast respectively to 0/1
match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
// other types prohibit arguments
} else if ( match[3] ) {
Sizzle.error( match[0] );
}
return match;
},
"PSEUDO": function( match ) {
var excess,
unquoted = !match[5] && match[2];
if ( matchExpr["CHILD"].test( match[0] ) ) {
return null;
}
// Accept quoted arguments as-is
if ( match[3] && match[4] !== undefined ) {
match[2] = match[4];
// Strip excess characters from unquoted arguments
} else if ( unquoted && rpseudo.test( unquoted ) &&
// Get excess from tokenize (recursively)
(excess = tokenize( unquoted, true )) &&
// advance to the next closing parenthesis
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
// excess is a negative index
match[0] = match[0].slice( 0, excess );
match[2] = unquoted.slice( 0, excess );
}
// Return only captures needed by the pseudo filter method (type and argument)
return match.slice( 0, 3 );
}
},
filter: {
"TAG": function( nodeNameSelector ) {
var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
return nodeNameSelector === "*" ?
function() { return true; } :
function( elem ) {
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
};
},
"CLASS": function( className ) {
var pattern = classCache[ className + " " ];
return pattern ||
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
classCache( className, function( elem ) {
return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );
});
},
"ATTR": function( name, operator, check ) {
return function( elem ) {
var result = Sizzle.attr( elem, name );
if ( result == null ) {
return operator === "!=";
}
if ( !operator ) {
return true;
}
result += "";
return operator === "=" ? result === check :
operator === "!=" ? result !== check :
operator === "^=" ? check && result.indexOf( check ) === 0 :
operator === "*=" ? check && result.indexOf( check ) > -1 :
operator === "$=" ? check && result.slice( -check.length ) === check :
operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
false;
};
},
"CHILD": function( type, what, argument, first, last ) {
var simple = type.slice( 0, 3 ) !== "nth",
forward = type.slice( -4 ) !== "last",
ofType = what === "of-type";
return first === 1 && last === 0 ?
// Shortcut for :nth-*(n)
function( elem ) {
return !!elem.parentNode;
} :
function( elem, context, xml ) {
var cache, outerCache, node, diff, nodeIndex, start,
dir = simple !== forward ? "nextSibling" : "previousSibling",
parent = elem.parentNode,
name = ofType && elem.nodeName.toLowerCase(),
useCache = !xml && !ofType;
if ( parent ) {
// :(first|last|only)-(child|of-type)
if ( simple ) {
while ( dir ) {
node = elem;
while ( (node = node[ dir ]) ) {
if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
return false;
}
}
// Reverse direction for :only-* (if we haven't yet done so)
start = dir = type === "only" && !start && "nextSibling";
}
return true;
}
start = [ forward ? parent.firstChild : parent.lastChild ];
// non-xml :nth-child(...) stores cache data on `parent`
if ( forward && useCache ) {
// Seek `elem` from a previously-cached index
outerCache = parent[ expando ] || (parent[ expando ] = {});
cache = outerCache[ type ] || [];
nodeIndex = cache[0] === dirruns && cache[1];
diff = cache[0] === dirruns && cache[2];
node = nodeIndex && parent.childNodes[ nodeIndex ];
while ( (node = ++nodeIndex && node && node[ dir ] ||
// Fallback to seeking `elem` from the start
(diff = nodeIndex = 0) || start.pop()) ) {
// When found, cache indexes on `parent` and break
if ( node.nodeType === 1 && ++diff && node === elem ) {
outerCache[ type ] = [ dirruns, nodeIndex, diff ];
break;
}
}
// Use previously-cached element index if available
} else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
diff = cache[1];
// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
} else {
// Use the same loop as above to seek `elem` from the start
while ( (node = ++nodeIndex && node && node[ dir ] ||
(diff = nodeIndex = 0) || start.pop()) ) {
if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
// Cache the index of each encountered element
if ( useCache ) {
(node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
}
if ( node === elem ) {
break;
}
}
}
}
// Incorporate the offset, then check against cycle size
diff -= last;
return diff === first || ( diff % first === 0 && diff / first >= 0 );
}
};
},
"PSEUDO": function( pseudo, argument ) {
// pseudo-class names are case-insensitive
// http://www.w3.org/TR/selectors/#pseudo-classes
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
// Remember that setFilters inherits from pseudos
var args,
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
Sizzle.error( "unsupported pseudo: " + pseudo );
// The user may use createPseudo to indicate that
// arguments are needed to create the filter function
// just as Sizzle does
if ( fn[ expando ] ) {
return fn( argument );
}
// But maintain support for old signatures
if ( fn.length > 1 ) {
args = [ pseudo, pseudo, "", argument ];
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
markFunction(function( seed, matches ) {
var idx,
matched = fn( seed, argument ),
i = matched.length;
while ( i-- ) {
idx = indexOf.call( seed, matched[i] );
seed[ idx ] = !( matches[ idx ] = matched[i] );
}
}) :
function( elem ) {
return fn( elem, 0, args );
};
}
return fn;
}
},
pseudos: {
// Potentially complex pseudos
"not": markFunction(function( selector ) {
// Trim the selector passed to compile
// to avoid treating leading and trailing
// spaces as combinators
var input = [],
results = [],
matcher = compile( selector.replace( rtrim, "$1" ) );
return matcher[ expando ] ?
markFunction(function( seed, matches, context, xml ) {
var elem,
unmatched = matcher( seed, null, xml, [] ),
i = seed.length;
// Match elements unmatched by `matcher`
while ( i-- ) {
if ( (elem = unmatched[i]) ) {
seed[i] = !(matches[i] = elem);
}
}
}) :
function( elem, context, xml ) {
input[0] = elem;
matcher( input, null, xml, results );
return !results.pop();
};
}),
"has": markFunction(function( selector ) {
return function( elem ) {
return Sizzle( selector, elem ).length > 0;
};
}),
"contains": markFunction(function( text ) {
return function( elem ) {
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
};
}),
// "Whether an element is represented by a :lang() selector
// is based solely on the element's language value
// being equal to the identifier C,
// or beginning with the identifier C immediately followed by "-".
// The matching of C against the element's language value is performed case-insensitively.
// The identifier C does not have to be a valid language name."
// http://www.w3.org/TR/selectors/#lang-pseudo
"lang": markFunction( function( lang ) {
// lang value must be a valid identifier
if ( !ridentifier.test(lang || "") ) {
Sizzle.error( "unsupported lang: " + lang );
}
lang = lang.replace( runescape, funescape ).toLowerCase();
return function( elem ) {
var elemLang;
do {
if ( (elemLang = documentIsHTML ?
elem.lang :
elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
elemLang = elemLang.toLowerCase();
return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
}
} while ( (elem = elem.parentNode) && elem.nodeType === 1 );
return false;
};
}),
// Miscellaneous
"target": function( elem ) {
var hash = window.location && window.location.hash;
return hash && hash.slice( 1 ) === elem.id;
},
"root": function( elem ) {
return elem === docElem;
},
"focus": function( elem ) {
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
},
// Boolean properties
"enabled": function( elem ) {
return elem.disabled === false;
},
"disabled": function( elem ) {
return elem.disabled === true;
},
"checked": function( elem ) {
// In CSS3, :checked should return both checked and selected elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
var nodeName = elem.nodeName.toLowerCase();
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
},
"selected": function( elem ) {
// Accessing this property makes selected-by-default
// options in Safari work properly
if ( elem.parentNode ) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
// Contents
"empty": function( elem ) {
// http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
// but not by others (comment: 8; processing instruction: 7; etc.)
// nodeType < 6 works because attributes (2) do not appear as children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
if ( elem.nodeType < 6 ) {
return false;
}
}
return true;
},
"parent": function( elem ) {
return !Expr.pseudos["empty"]( elem );
},
// Element/input types
"header": function( elem ) {
return rheader.test( elem.nodeName );
},
"input": function( elem ) {
return rinputs.test( elem.nodeName );
},
"button": function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === "button" || name === "button";
},
"text": function( elem ) {
var attr;
return elem.nodeName.toLowerCase() === "input" &&
elem.type === "text" &&
// Support: IE<8
// New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
},
// Position-in-collection
"first": createPositionalPseudo(function() {
return [ 0 ];
}),
"last": createPositionalPseudo(function( matchIndexes, length ) {
return [ length - 1 ];
}),
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
return [ argument < 0 ? argument + length : argument ];
}),
"even": createPositionalPseudo(function( matchIndexes, length ) {
var i = 0;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"odd": createPositionalPseudo(function( matchIndexes, length ) {
var i = 1;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; --i >= 0; ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; ++i < length; ) {
matchIndexes.push( i );
}
return matchIndexes;
})
}
};
Expr.pseudos["nth"] = Expr.pseudos["eq"];
// Add button/input type pseudos
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
Expr.pseudos[ i ] = createInputPseudo( i );
}
for ( i in { submit: true, reset: true } ) {
Expr.pseudos[ i ] = createButtonPseudo( i );
}
// Easy API for creating new setFilters
function setFilters() {}
setFilters.prototype = Expr.filters = Expr.pseudos;
Expr.setFilters = new setFilters();
function tokenize( selector, parseOnly ) {
var matched, match, tokens, type,
soFar, groups, preFilters,
cached = tokenCache[ selector + " " ];
if ( cached ) {
return parseOnly ? 0 : cached.slice( 0 );
}
soFar = selector;
groups = [];
preFilters = Expr.preFilter;
while ( soFar ) {
// Comma and first run
if ( !matched || (match = rcomma.exec( soFar )) ) {
if ( match ) {
// Don't consume trailing commas as valid
soFar = soFar.slice( match[0].length ) || soFar;
}
groups.push( (tokens = []) );
}
matched = false;
// Combinators
if ( (match = rcombinators.exec( soFar )) ) {
matched = match.shift();
tokens.push({
value: matched,
// Cast descendant combinators to space
type: match[0].replace( rtrim, " " )
});
soFar = soFar.slice( matched.length );
}
// Filters
for ( type in Expr.filter ) {
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
(match = preFilters[ type ]( match ))) ) {
matched = match.shift();
tokens.push({
value: matched,
type: type,
matches: match
});
soFar = soFar.slice( matched.length );
}
}
if ( !matched ) {
break;
}
}
// Return the length of the invalid excess
// if we're just parsing
// Otherwise, throw an error or return tokens
return parseOnly ?
soFar.length :
soFar ?
Sizzle.error( selector ) :
// Cache the tokens
tokenCache( selector, groups ).slice( 0 );
}
function toSelector( tokens ) {
var i = 0,
len = tokens.length,
selector = "";
for ( ; i < len; i++ ) {
selector += tokens[i].value;
}
return selector;
}
function addCombinator( matcher, combinator, base ) {
var dir = combinator.dir,
checkNonElements = base && dir === "parentNode",
doneName = done++;
return combinator.first ?
// Check against closest ancestor/preceding element
function( elem, context, xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
return matcher( elem, context, xml );
}
}
} :
// Check against all ancestor/preceding elements
function( elem, context, xml ) {
var oldCache, outerCache,
newCache = [ dirruns, doneName ];
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
if ( xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
if ( matcher( elem, context, xml ) ) {
return true;
}
}
}
} else {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
outerCache = elem[ expando ] || (elem[ expando ] = {});
if ( (oldCache = outerCache[ dir ]) &&
oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
// Assign to newCache so results back-propagate to previous elements
return (newCache[ 2 ] = oldCache[ 2 ]);
} else {
// Reuse newcache so results back-propagate to previous elements
outerCache[ dir ] = newCache;
// A match means we're done; a fail means we have to keep checking
if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
return true;
}
}
}
}
}
};
}
function elementMatcher( matchers ) {
return matchers.length > 1 ?
function( elem, context, xml ) {
var i = matchers.length;
while ( i-- ) {
if ( !matchers[i]( elem, context, xml ) ) {
return false;
}
}
return true;
} :
matchers[0];
}
function condense( unmatched, map, filter, context, xml ) {
var elem,
newUnmatched = [],
i = 0,
len = unmatched.length,
mapped = map != null;
for ( ; i < len; i++ ) {
if ( (elem = unmatched[i]) ) {
if ( !filter || filter( elem, context, xml ) ) {
newUnmatched.push( elem );
if ( mapped ) {
map.push( i );
}
}
}
}
return newUnmatched;
}
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
if ( postFilter && !postFilter[ expando ] ) {
postFilter = setMatcher( postFilter );
}
if ( postFinder && !postFinder[ expando ] ) {
postFinder = setMatcher( postFinder, postSelector );
}
return markFunction(function( seed, results, context, xml ) {
var temp, i, elem,
preMap = [],
postMap = [],
preexisting = results.length,
// Get initial elements from seed or context
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
// Prefilter to get matcher input, preserving a map for seed-results synchronization
matcherIn = preFilter && ( seed || !selector ) ?
condense( elems, preMap, preFilter, context, xml ) :
elems,
matcherOut = matcher ?
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
// ...intermediate processing is necessary
[] :
// ...otherwise use results directly
results :
matcherIn;
// Find primary matches
if ( matcher ) {
matcher( matcherIn, matcherOut, context, xml );
}
// Apply postFilter
if ( postFilter ) {
temp = condense( matcherOut, postMap );
postFilter( temp, [], context, xml );
// Un-match failing elements by moving them back to matcherIn
i = temp.length;
while ( i-- ) {
if ( (elem = temp[i]) ) {
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
}
}
}
if ( seed ) {
if ( postFinder || preFilter ) {
if ( postFinder ) {
// Get the final matcherOut by condensing this intermediate into postFinder contexts
temp = [];
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) ) {
// Restore matcherIn since elem is not yet a final match
temp.push( (matcherIn[i] = elem) );
}
}
postFinder( null, (matcherOut = []), temp, xml );
}
// Move matched elements from seed to results to keep them synchronized
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) &&
(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
seed[temp] = !(results[temp] = elem);
}
}
}
// Add elements to results, through postFinder if defined
} else {
matcherOut = condense(
matcherOut === results ?
matcherOut.splice( preexisting, matcherOut.length ) :
matcherOut
);
if ( postFinder ) {
postFinder( null, results, matcherOut, xml );
} else {
push.apply( results, matcherOut );
}
}
});
}
function matcherFromTokens( tokens ) {
var checkContext, matcher, j,
len = tokens.length,
leadingRelative = Expr.relative[ tokens[0].type ],
implicitRelative = leadingRelative || Expr.relative[" "],
i = leadingRelative ? 1 : 0,
// The foundational matcher ensures that elements are reachable from top-level context(s)
matchContext = addCombinator( function( elem ) {
return elem === checkContext;
}, implicitRelative, true ),
matchAnyContext = addCombinator( function( elem ) {
return indexOf.call( checkContext, elem ) > -1;
}, implicitRelative, true ),
matchers = [ function( elem, context, xml ) {
return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
(checkContext = context).nodeType ?
matchContext( elem, context, xml ) :
matchAnyContext( elem, context, xml ) );
} ];
for ( ; i < len; i++ ) {
if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
} else {
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
// Return special upon seeing a positional matcher
if ( matcher[ expando ] ) {
// Find the next relative operator (if any) for proper handling
j = ++i;
for ( ; j < len; j++ ) {
if ( Expr.relative[ tokens[j].type ] ) {
break;
}
}
return setMatcher(
i > 1 && elementMatcher( matchers ),
i > 1 && toSelector(
// If the preceding token was a descendant combinator, insert an implicit any-element `*`
tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
).replace( rtrim, "$1" ),
matcher,
i < j && matcherFromTokens( tokens.slice( i, j ) ),
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
j < len && toSelector( tokens )
);
}
matchers.push( matcher );
}
}
return elementMatcher( matchers );
}
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
var bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function( seed, context, xml, results, outermost ) {
var elem, j, matcher,
matchedCount = 0,
i = "0",
unmatched = seed && [],
setMatched = [],
contextBackup = outermostContext,
// We must always have either seed elements or outermost context
elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
// Use integer dirruns iff this is the outermost matcher
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
len = elems.length;
if ( outermost ) {
outermostContext = context !== document && context;
}
// Add elements passing elementMatchers directly to results
// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
// Support: IE<9, Safari
// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
if ( byElement && elem ) {
j = 0;
while ( (matcher = elementMatchers[j++]) ) {
if ( matcher( elem, context, xml ) ) {
results.push( elem );
break;
}
}
if ( outermost ) {
dirruns = dirrunsUnique;
}
}
// Track unmatched elements for set filters
if ( bySet ) {
// They will have gone through all possible matchers
if ( (elem = !matcher && elem) ) {
matchedCount--;
}
// Lengthen the array for every element, matched or not
if ( seed ) {
unmatched.push( elem );
}
}
}
// Apply set filters to unmatched elements
matchedCount += i;
if ( bySet && i !== matchedCount ) {
j = 0;
while ( (matcher = setMatchers[j++]) ) {
matcher( unmatched, setMatched, context, xml );
}
if ( seed ) {
// Reintegrate element matches to eliminate the need for sorting
if ( matchedCount > 0 ) {
while ( i-- ) {
if ( !(unmatched[i] || setMatched[i]) ) {
setMatched[i] = pop.call( results );
}
}
}
// Discard index placeholder values to get only actual matches
setMatched = condense( setMatched );
}
// Add matches to results
push.apply( results, setMatched );
// Seedless set matches succeeding multiple successful matchers stipulate sorting
if ( outermost && !seed && setMatched.length > 0 &&
( matchedCount + setMatchers.length ) > 1 ) {
Sizzle.uniqueSort( results );
}
}
// Override manipulation of globals by nested matchers
if ( outermost ) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
};
return bySet ?
markFunction( superMatcher ) :
superMatcher;
}
compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
var i,
setMatchers = [],
elementMatchers = [],
cached = compilerCache[ selector + " " ];
if ( !cached ) {
// Generate a function of recursive functions that can be used to check each element
if ( !group ) {
group = tokenize( selector );
}
i = group.length;
while ( i-- ) {
cached = matcherFromTokens( group[i] );
if ( cached[ expando ] ) {
setMatchers.push( cached );
} else {
elementMatchers.push( cached );
}
}
// Cache the compiled function
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
}
return cached;
};
function multipleContexts( selector, contexts, results ) {
var i = 0,
len = contexts.length;
for ( ; i < len; i++ ) {
Sizzle( selector, contexts[i], results );
}
return results;
}
function select( selector, context, results, seed ) {
var i, tokens, token, type, find,
match = tokenize( selector );
if ( !seed ) {
// Try to minimize operations if there is only one group
if ( match.length === 1 ) {
// Take a shortcut and set the context if the root selector is an ID
tokens = match[0] = match[0].slice( 0 );
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
support.getById && context.nodeType === 9 && documentIsHTML &&
Expr.relative[ tokens[1].type ] ) {
context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
if ( !context ) {
return results;
}
selector = selector.slice( tokens.shift().value.length );
}
// Fetch a seed set for right-to-left matching
i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
while ( i-- ) {
token = tokens[i];
// Abort if we hit a combinator
if ( Expr.relative[ (type = token.type) ] ) {
break;
}
if ( (find = Expr.find[ type ]) ) {
// Search, expanding context for leading sibling combinators
if ( (seed = find(
token.matches[0].replace( runescape, funescape ),
rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
)) ) {
// If seed is empty or no tokens remain, we can return early
tokens.splice( i, 1 );
selector = seed.length && toSelector( tokens );
if ( !selector ) {
push.apply( results, seed );
return results;
}
break;
}
}
}
}
}
// Compile and execute a filtering function
// Provide `match` to avoid retokenization if we modified the selector above
compile( selector, match )(
seed,
context,
!documentIsHTML,
results,
rsibling.test( selector ) && testContext( context.parentNode ) || context
);
return results;
}
// One-time assignments
// Sort stability
support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
// Support: Chrome<14
// Always assume duplicates if they aren't passed to the comparison function
support.detectDuplicates = !!hasDuplicate;
// Initialize against the default document
setDocument();
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
// Detached nodes confoundingly follow *each other*
support.sortDetached = assert(function( div1 ) {
// Should return 1, but returns 4 (following)
return div1.compareDocumentPosition( document.createElement("div") ) & 1;
});
// Support: IE<8
// Prevent attribute/property "interpolation"
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !assert(function( div ) {
div.innerHTML = "<a href='#'></a>";
return div.firstChild.getAttribute("href") === "#" ;
}) ) {
addHandle( "type|href|height|width", function( elem, name, isXML ) {
if ( !isXML ) {
return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
}
});
}
// Support: IE<9
// Use defaultValue in place of getAttribute("value")
if ( !support.attributes || !assert(function( div ) {
div.innerHTML = "<input/>";
div.firstChild.setAttribute( "value", "" );
return div.firstChild.getAttribute( "value" ) === "";
}) ) {
addHandle( "value", function( elem, name, isXML ) {
if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
return elem.defaultValue;
}
});
}
// Support: IE<9
// Use getAttributeNode to fetch booleans when getAttribute lies
if ( !assert(function( div ) {
return div.getAttribute("disabled") == null;
}) ) {
addHandle( booleans, function( elem, name, isXML ) {
var val;
if ( !isXML ) {
return elem[ name ] === true ? name.toLowerCase() :
(val = elem.getAttributeNode( name )) && val.specified ?
val.value :
null;
}
});
}
// EXPOSE
if ( typeof define === "function" && define.amd ) {
define(function() { return Sizzle; });
// Sizzle requires that there be a global window in Common-JS like environments
} else if ( typeof module !== "undefined" && module.exports ) {
module.exports = Sizzle;
} else {
window.Sizzle = Sizzle;
}
// EXPOSE
})( window );
|
/*
* Copyright (c) 2012, Intel Corporation.
*
* This program is licensed under the terms and conditions of the
* Apache License, version 2.0. The full text of the Apache License is at
* http://www.apache.org/licenses/LICENSE-2.0
*
*/
Card = function() {
this.cardId = "";
this.cardFrontId = "";
this.cardGraphics = "";
this.cardType = -1;
this.found = false;
}
Game = {};
var normalCardImages = [
"images/noglow_balloon.png",
"images/noglow_butterflies.png",
"images/noglow_crown.png",
"images/noglow_cup.png",
"images/noglow_elephant.png",
"images/noglow_guitar.png",
"images/noglow_horn.png",
"images/noglow_lion.png",
"images/noglow_moon.png",
"images/noglow_sun.png",
"images/noglow_zebra.png",
"images/noglow_blank.png"
];
var glowingCardImages = [
"images/card_flip_balloon.png",
"images/card_flip_butterflies.png",
"images/card_flip_crown.png",
"images/card_flip_cup.png",
"images/card_flip_elephant.png",
"images/card_flip_guitar.png",
"images/card_flip_horn.png",
"images/card_flip_lion.png",
"images/card_flip_moon.png",
"images/card_flip_sun.png",
"images/card_flip_zebra.png",
"images/card_flip_blank.png"
];
var stariconsList = [
"images/purple_star.png",
"images/green_star.png",
"images/red_star.png"
];
var audioItems = [
"flipcard_sound1",
"flipcard_sound2",
"startGame_sound",
"finaleIntro_sound",
"winLevel_sound",
"victory_sound"
];
var audioSrc = [
"audio/FlipCard.wav",
"audio/FlipCard.wav",
"audio/StartPage.wav",
"audio/TheFinale.wav",
"audio/WinLevel.wav",
"audio/YouWin.wav"
];
var SOUND_FLIPCARD1 = 0;
var SOUND_FLIPCARD2 = 1;
var SOUND_STARTGAME = 2;
var SOUND_FINALEINTRO = 3;
var SOUND_LEVEL_WON = 4;
var SOUND_VICTORY = 5;
var LOCKED_LEVELCARD_STYLE = "setLevel_lockedLevel";
var SHOWCARD_STYLE = "flip_to_visible";
var GAMES_PER_LEVEL = 3;
var LOCAL_STORAGE_KEY = "memorygame_locked_levels";
(function () {
var cardsArray = new Array();
var levelSelectionUserChoice = -1;
var ignoreInputs = false;
var firstFlippedCard = undefined;
var clickedCardElement = undefined;
var levelNumber = -1;
var passedGames = 0;
var lastPlayedFlipSound = SOUND_FLIPCARD2;
var levelLockingStatus = [ false, true, true, true ];
// Set memberfunctions.
Game.flipCallback = flipCallback;
Game.flipDelayCallback = flipDelayCallback;
Game.gotoNextGame = gotoNextGame;
Game.levelSelectionAnimCallback = levelSelectionAnimCallback;
Game.introViewSkipCallback = introViewSkipCallback;
/**
* Create sound element base on their ID
*/
function createSoundElement(soundId) {
var audioElement = document.createElement('audio');
audioElement.setAttribute("id", audioItems[soundId]);
audioElement.setAttribute("src", audioSrc[soundId]);
if (soundId == SOUND_STARTGAME) {
audioElement.setAttribute("preload", "auto");
audioElement.setAttribute("autoplay", "autoplay");
} else {
audioElement.setAttribute("preload", "none");
}
document.body.appendChild(audioElement);
}
/**
* Plays sounds base on their ID
*/
function playSound(soundId) {
var audioElement = document.getElementById(audioItems[soundId]);
audioElement.pause();
audioElement.play();
}
/**
* This function prepares the graphical elements of Victory-screen.
*/
function prepareVictoryScreen() {
// Draw the curved YOU WIN text.
var drawer = new CurvedTextDrawer(document.getElementById("curvedText"));
var centerPos = drawer.getCanvasCenterPos();
centerPos.mY = -625;
drawer.useFont = '70px Romantiques';
drawer.drawSectorArc("YOU WIN", centerPos.mX, centerPos.mY, 780, 180, 270, 'ccw', true, 'center');
$("#homebutton_backtomain").hide();
}
/**
* Reads the level lock status from local storage and sets the card element styles
* accordingly.
*/
function prepareSelectLevelScreen() {
console.log("--> prepareSelectLevelScreen()");
var lockedLevels = localStorage.getItem(LOCAL_STORAGE_KEY);
for (var i=1; i < levelLockingStatus.length; ++i) {
if (lockedLevels != undefined && lockedLevels != null && lockedLevels.length > i) {
console.log(" read data: " + lockedLevels);
if (lockedLevels[i] == '0') {
levelLockingStatus[i] = false;
} else {
levelLockingStatus[i] = true;
}
} else {
levelLockingStatus[i] = true;
}
var cardElement = $("#selLevel_levelCard"+(i+1));
cardElement.removeClass(LOCKED_LEVELCARD_STYLE);
if (levelLockingStatus[i]) {
cardElement.addClass(LOCKED_LEVELCARD_STYLE);
}
}
console.log("<-- prepareSelectLevelScreen()");
}
/**
* Saves the level lock status to local storage.
*/
function saveStatus() {
console.log("--> saveStatus()");
var lockedLevelsStr = '0';
for (var i = 1; i < levelLockingStatus.length; ++i) {
if (levelLockingStatus[i]) {
console.log(" level: " + i + ", lock: locked");
lockedLevelsStr += '1';
} else {
console.log(" level: " + i + ", lock: unlocked");
lockedLevelsStr += '0';
}
}
console.log(" data: " + lockedLevelsStr);
localStorage.setItem(LOCAL_STORAGE_KEY, lockedLevelsStr);
console.log("<-- saveStatus()");
}
/**
* Returns the card object of the card whose DIV element has given ID.
* @param cardDivName Name of the cards div element.
* @return The matching Card object or undefined if card was not found.
*/
function getCardObject(cardDivName) {
for (var i=0; i < cardsArray.length; ++i) {
var card = cardsArray[i];
if (card.cardId == cardDivName) {
return card;
}
}
return undefined;
}
/**
* Marks the cards as found ones and changes the graphics.
* @param card1 First one of the found cards.
* @param card2 Second one of the found cards.
*/
function matchFound(card1, card2) {
card1.found = true;
card2.found = true;
// Change the graphics to glowing ones.
var gfxIndex = card1.cardType;
$(card1.cardId).children(".back").css("visibility", "hidden");
$(card2.cardId).children(".back").css("visibility", "hidden");
$(card1.cardFrontId).css("background", "url("+glowingCardImages[gfxIndex]+")");
$(card2.cardFrontId).css("background", "url("+glowingCardImages[gfxIndex]+")");
}
/**
* Checks the states of the cards and tells if all the pairs have been found.
* @return true if all the pairs have been found.
*/
function allPairsFound() {
for (var i=0; i < cardsArray.length; ++i) {
var card = cardsArray[i];
if (card.found == false) {
return false;
}
}
return true;
}
/**
* A callback function that gets called when card rotation animation ends. This
* function checks if two rotated cards are pairs.
*/
function flipCallback() {
console.log("--> Game.flipCallback()");
if (firstFlippedCard == undefined) {
// This is the first card being turned.
firstFlippedCard = clickedCardElement;
clickedCardElement = undefined;
ignoreInputs = false;
} else {
// This is the second card being turned. Check if they are equal.
var cardObj1 = getCardObject("#" + firstFlippedCard.attr("id"));
var cardObj2 = getCardObject("#" + clickedCardElement.attr("id"));
if (cardObj1.cardType == cardObj2.cardType) {
matchFound(cardObj1, cardObj2);
if (allPairsFound()) {
gotoNextGame();
}
ignoreInputs = false;
firstFlippedCard = undefined;
clickedCardElement = undefined;
} else {
console.log(" no match");
window.setTimeout("Game.flipDelayCallback()", 300);
}
}
console.log("<-- Game.flipCallback()");
}
/**
* Callbackfunction that rotates the two latest cards upside down again.
*/
function flipDelayCallback() {
ignoreInputs = false;
firstFlippedCard.removeClass(SHOWCARD_STYLE);
clickedCardElement.removeClass(SHOWCARD_STYLE);
firstFlippedCard = undefined;
clickedCardElement = undefined;
}
/**
* Shuffles the cards in the beginning of the game.
* @param cardsArray Array that contains the card objects.
*/
function shuffleLevel(cardsArray) {
console.log("--> shuffleLevel1()");
// Make an array that contains 2 copies of card type ids.
var typeIndexArray = new Array();
for (var i=0; i < cardsArray.length; ++i) {
typeIndexArray.push( (Math.floor(i / 2)) % normalCardImages.length );
}
for (var i=0; i < typeIndexArray.length; ++i) {
var swapWithIndex = Math.floor(Math.random() * 11);
var tmpValue = typeIndexArray[swapWithIndex];
typeIndexArray[swapWithIndex] = typeIndexArray[i];
typeIndexArray[i] = tmpValue;
}
var elemIndex = 0;
for (var i=0; i < cardsArray.length; ++i) {
var gfxIndex = typeIndexArray.pop();
var card = cardsArray[i];
card.cardType = gfxIndex;
console.log("elementId: " + card.cardFrontId + ", graphics: " + normalCardImages[gfxIndex]);
$(card.cardFrontId).css("background", "url("+normalCardImages[gfxIndex]+")");
$(card.cardId).removeClass(SHOWCARD_STYLE);
}
console.log("<-- shuffleLevel1()");
}
/**
* This should be called when game has been played through. It does the actions that are
* needed to handle game and level progress and also showing victory screen.
*/
function gotoNextGame() {
console.log("--> gotoNextGame()");
if (levelNumber == 4) {
levelLockingStatus[0] = false;
levelLockingStatus[1] = false;
levelLockingStatus[2] = false;
levelLockingStatus[3] = false;
saveStatus();
// Currently finished level was 4. It means that player has finished the game.
prepareVictoryScreen();
createSoundElement(SOUND_VICTORY);
playSound(SOUND_VICTORY);
$("#level4").hide();
$("#victory").show();
return;
}
passedGames++;
var levelOfNextGame = levelNumber;
if (passedGames >= GAMES_PER_LEVEL) {
// Move to next level.
passedGames = 0;
levelOfNextGame++;
// Next level unlocked.
levelLockingStatus[levelNumber] = false;
if (levelOfNextGame != 4) {
playSound(SOUND_LEVEL_WON);
}
}
if (levelOfNextGame == 4) {
// Show intro view before entring the final level.
levelLockingStatus[3] = false;
createSoundElement(SOUND_FINALEINTRO);
playSound(SOUND_FINALEINTRO);
$("#homebutton_backtomain").hide();
$("#handitem").hide();
$("#level3").hide();
$("#finaleIntro").show();
} else {
startGame(levelOfNextGame, false);
}
saveStatus();
console.log("<-- gotoNextGame()");
}
/**
* A callback function that gets called when level selection animation has ended.
*/
function levelSelectionAnimCallback() {
console.log("--> levelSelectionAnimCallback()");
$("#selLevel_page").hide();
$("#selLevel_levelCard1").removeClass("selLevel_selectedCard selLevel_anim1 selLevel_anim2 selLevel_anim3 selLevel_anim4");
$("#selLevel_levelCard2").removeClass("selLevel_selectedCard selLevel_anim1 selLevel_anim2 selLevel_anim3 selLevel_anim4");
$("#selLevel_levelCard3").removeClass("selLevel_selectedCard selLevel_anim1 selLevel_anim2 selLevel_anim3 selLevel_anim4");
$("#selLevel_levelCard4").removeClass("selLevel_selectedCard selLevel_anim1 selLevel_anim2 selLevel_anim3 selLevel_anim4");
startGame(levelSelectionUserChoice, true);
playSound(SOUND_LEVEL_WON);
console.log("<-- levelSelectionAnimCallback()");
}
/**
* Initializes the structures to start new game.
* @param levelNum The level that will be started.
* @param resteState Pass true to reset the game counts to 0.
*/
function startGame(levelNum, resetState) {
console.log("--> startGame()");
if (resetState) {
passGames = 0;
}
// Figure out the amount of cards needed in this level.
var cardBgGraphics = "url(images/card_purple.png)"
cardsArray = new Array();
levelNumber = levelNum;
var numOfCards = 12;
if (levelNum == 2) {
numOfCards = 18;
cardBgGraphics = "url(images/card_green.png)"
} else if (levelNum == 3) {
numOfCards = 24;
cardBgGraphics = "url(images/card_red.png)"
} else if (levelNum == 4) {
numOfCards = 24;
cardBgGraphics = "url(images/card_teal.png)"
}
// Create card objects.
for (var i=0; i < numOfCards; ++i) {
var card = new Card();
card.cardFrontId = "#level"+levelNum+"_card_"+(i+1)+"_front";
card.cardId = "#" + $(card.cardFrontId).parent().attr("id");
cardsArray.push(card);
// Manually set toggle the card backgrounds between invisible
// background and real card background. We can't use plain css
// because the backface-visibility during rotation does not
// work in linux Chrome as it should.
$(card.cardId).children(".back").css("visibility", "visible");
}
setTimeout(function() {shuffleLevel(cardsArray);}, 300);
$(".card").removeClass(SHOWCARD_STYLE);
firstFlippedCard = undefined;
clickedCardElement = undefined;
// Update the hand that holds the game count note.
var starIconName = stariconsList[levelNum-1];
for (var gameIndex = 0; gameIndex < 3; ++gameIndex) {
var starImgElement = $("#handleitem_star"+(gameIndex+1));
starImgElement.removeClass("unplayedGameStar");
if (gameIndex <= passedGames) {
starImgElement.attr("src", starIconName);
} else {
starImgElement.addClass("unplayedGameStar");
starImgElement.attr("src", "images/star.png");
}
}
if (levelNum != 4) {
$("#handitem").css("display", "block");
} else {
// The hand image is not shown in final level.
$("#handitem").hide();
}
// Control the level elements visibility.
for (var i=1; i < 5; ++i) {
if (i == levelNum) {
$("#level"+i).show();
} else {
$("#level"+i).hide();
}
}
if (passedGames == 0) {
$("#handitem_gamenum_title").text("GAME 1");
} else if (passedGames == 1) {
$("#handitem_gamenum_title").text("GAME 2");
} else if (passedGames == 2) {
$("#handitem_gamenum_title").text("GAME 3");
}
$("#homebutton_backtomain").show();
console.log("<-- startGame()");
}
function introViewSkipCallback() {
prepareSelectLevelScreen();
if ($("#main_page").is(":visible")) {
$("#main_page").hide();
$("#selLevel_page").show();
}
license_init("license", "pagebg");
help_init("main_help", "help_");
createSoundElement(SOUND_FLIPCARD1);
createSoundElement(SOUND_FLIPCARD2);
createSoundElement(SOUND_LEVEL_WON);
}
// Initialize game once everything has been loaded.
$(document).ready(function () {
console.log("--> document.ready()");
createSoundElement(SOUND_STARTGAME);
// Add the event handler functions.
$("#main_page").click(function () {
// Hide mainview and show level selection.
introViewSkipCallback();
});
$("#selLevel_levelCard1").click(function () {
// Start game.
levelSelectionUserChoice = 1;
playSound(SOUND_FLIPCARD2);
$("#selLevel_levelCard1").addClass("selLevel_selectedCard");
$("#selLevel_levelCard2").addClass("selLevel_anim1");
$("#selLevel_levelCard3").addClass("selLevel_anim1");
$("#selLevel_levelCard4").addClass("selLevel_anim1");
window.setTimeout("Game.levelSelectionAnimCallback()", 1000);
});
$("#selLevel_levelCard2").click(function() {
if ($(this).hasClass(LOCKED_LEVELCARD_STYLE) == false) {
playSound(SOUND_FLIPCARD2);
levelSelectionUserChoice = 2;
$("#selLevel_levelCard2").addClass("selLevel_selectedCard");
$("#selLevel_levelCard1").addClass("selLevel_anim2");
$("#selLevel_levelCard3").addClass("selLevel_anim2");
$("#selLevel_levelCard4").addClass("selLevel_anim2");
window.setTimeout("Game.levelSelectionAnimCallback()", 1000);
}
});
$("#selLevel_levelCard3").click(function() {
if ($(this).hasClass(LOCKED_LEVELCARD_STYLE) == false) {
playSound(SOUND_FLIPCARD2);
levelSelectionUserChoice = 3;
$("#selLevel_levelCard3").addClass("selLevel_selectedCard");
$("#selLevel_levelCard1").addClass("selLevel_anim3");
$("#selLevel_levelCard2").addClass("selLevel_anim3");
$("#selLevel_levelCard4").addClass("selLevel_anim3");
window.setTimeout("Game.levelSelectionAnimCallback()", 1000);
}
});
$("#selLevel_levelCard4").click(function() {
if ($(this).hasClass(LOCKED_LEVELCARD_STYLE) == false) {
playSound(SOUND_FLIPCARD2);
levelSelectionUserChoice = 4;
$("#selLevel_levelCard4").addClass("selLevel_selectedCard");
$("#selLevel_levelCard1").addClass("selLevel_anim4");
$("#selLevel_levelCard2").addClass("selLevel_anim4");
$("#selLevel_levelCard3").addClass("selLevel_anim4");
window.setTimeout("Game.levelSelectionAnimCallback()", 1000);
}
});
$(".card").click(function() {
console.log("--> card.click()");
if (!ignoreInputs && !($(this).hasClass(SHOWCARD_STYLE))) {
// We have to use 2 different audio items for flip sound because
// audio API doesn't replay the sound if it is already playing.
if (lastPlayedFlipSound == SOUND_FLIPCARD1) {
lastPlayedFlipSound = SOUND_FLIPCARD2;
} else {
lastPlayedFlipSound = SOUND_FLIPCARD1;
}
createSoundElement(SOUND_FLIPCARD1);
playSound(lastPlayedFlipSound);
clickedCardElement = $(this);
ignoreInputs = true;
console.log(" card id: " + $(this).attr("id"));
$(this).addClass(SHOWCARD_STYLE);
window.setTimeout("Game.flipCallback()", 350);
}
console.log("<-- card.click()");
});
$("#finaleIntro").click( function() {
// Start playing final level.
$("#finaleIntro").hide();
startGame(4, false);
});
$("#victory_playagain_box").click(function() {
console.log("--> victory_playagain_box.click()");
prepareSelectLevelScreen();
$("#victory").hide();
$("#selLevel_page").show();
console.log("<-- victory_playagain_box.click()");
});
$("#homebutton_backtomain").click(function() {
console.log("--> homebutton.click()");
// Hide current levels and show mainpage.
$("#level1").hide();
$("#level2").hide();
$("#level3").hide();
$("#level4").hide();
$("#handitem").hide();
$("#main_page").show();
$(this).hide();
console.log("<-- homebutton.click()");
});
$("#selLevel_resetLocked").click(function() {
localStorage.setItem(LOCAL_STORAGE_KEY, '0000');
prepareSelectLevelScreen();
});
});
// Skip the welcome screen after a while.
window.setTimeout("Game.introViewSkipCallback()", 3500);
})();
|
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: target_info.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from object_store_sdk.model.cmdb import cluster_info_pb2 as object__store__sdk_dot_model_dot_cmdb_dot_cluster__info__pb2
from object_store_sdk.model.easy_flow import version_info_pb2 as object__store__sdk_dot_model_dot_easy__flow_dot_version__info__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='target_info.proto',
package='easy_flow',
syntax='proto3',
serialized_options=_b('ZCgo.easyops.local/contracts/protorepo-models/easyops/model/easy_flow'),
serialized_pb=_b('\n\x11target_info.proto\x12\teasy_flow\x1a.object_store_sdk/model/cmdb/cluster_info.proto\x1a\x33object_store_sdk/model/easy_flow/version_info.proto\"\x9b\x04\n\nTargetInfo\x12\x10\n\x08targetId\x18\x01 \x01(\t\x12\x12\n\ntargetName\x18\x02 \x01(\t\x12\x12\n\ninstanceId\x18\x03 \x01(\t\x12\"\n\x07\x63luster\x18\x04 \x01(\x0b\x32\x11.cmdb.ClusterInfo\x12\x38\n\x0cinstanceInfo\x18\x05 \x03(\x0b\x32\".easy_flow.TargetInfo.InstanceInfo\x12:\n\roperationInfo\x18\x06 \x03(\x0b\x32#.easy_flow.TargetInfo.OperationInfo\x1a\x8b\x01\n\x0cInstanceInfo\x12\x13\n\x0bversionName\x18\x01 \x01(\t\x12+\n\x0bversionInfo\x18\x02 \x01(\x0b\x32\x16.easy_flow.VersionInfo\x12\x11\n\tpackageId\x18\x03 \x01(\t\x12\x13\n\x0binstallPath\x18\x04 \x01(\t\x12\x11\n\tversionId\x18\x05 \x01(\t\x1a\xaa\x01\n\rOperationInfo\x12\x11\n\toperation\x18\x01 \x01(\t\x12-\n\rversionToInfo\x18\x02 \x01(\x0b\x32\x16.easy_flow.VersionInfo\x12/\n\x0fversionFromInfo\x18\x03 \x01(\x0b\x32\x16.easy_flow.VersionInfo\x12\x13\n\x0binstallPath\x18\x04 \x01(\t\x12\x11\n\tpackageId\x18\x05 \x01(\tBEZCgo.easyops.local/contracts/protorepo-models/easyops/model/easy_flowb\x06proto3')
,
dependencies=[object__store__sdk_dot_model_dot_cmdb_dot_cluster__info__pb2.DESCRIPTOR,object__store__sdk_dot_model_dot_easy__flow_dot_version__info__pb2.DESCRIPTOR,])
_TARGETINFO_INSTANCEINFO = _descriptor.Descriptor(
name='InstanceInfo',
full_name='easy_flow.TargetInfo.InstanceInfo',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='versionName', full_name='easy_flow.TargetInfo.InstanceInfo.versionName', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='versionInfo', full_name='easy_flow.TargetInfo.InstanceInfo.versionInfo', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='packageId', full_name='easy_flow.TargetInfo.InstanceInfo.packageId', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='installPath', full_name='easy_flow.TargetInfo.InstanceInfo.installPath', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='versionId', full_name='easy_flow.TargetInfo.InstanceInfo.versionId', index=4,
number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=361,
serialized_end=500,
)
_TARGETINFO_OPERATIONINFO = _descriptor.Descriptor(
name='OperationInfo',
full_name='easy_flow.TargetInfo.OperationInfo',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='operation', full_name='easy_flow.TargetInfo.OperationInfo.operation', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='versionToInfo', full_name='easy_flow.TargetInfo.OperationInfo.versionToInfo', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='versionFromInfo', full_name='easy_flow.TargetInfo.OperationInfo.versionFromInfo', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='installPath', full_name='easy_flow.TargetInfo.OperationInfo.installPath', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='packageId', full_name='easy_flow.TargetInfo.OperationInfo.packageId', index=4,
number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=503,
serialized_end=673,
)
_TARGETINFO = _descriptor.Descriptor(
name='TargetInfo',
full_name='easy_flow.TargetInfo',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='targetId', full_name='easy_flow.TargetInfo.targetId', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='targetName', full_name='easy_flow.TargetInfo.targetName', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='instanceId', full_name='easy_flow.TargetInfo.instanceId', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='cluster', full_name='easy_flow.TargetInfo.cluster', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='instanceInfo', full_name='easy_flow.TargetInfo.instanceInfo', index=4,
number=5, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='operationInfo', full_name='easy_flow.TargetInfo.operationInfo', index=5,
number=6, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[_TARGETINFO_INSTANCEINFO, _TARGETINFO_OPERATIONINFO, ],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=134,
serialized_end=673,
)
_TARGETINFO_INSTANCEINFO.fields_by_name['versionInfo'].message_type = object__store__sdk_dot_model_dot_easy__flow_dot_version__info__pb2._VERSIONINFO
_TARGETINFO_INSTANCEINFO.containing_type = _TARGETINFO
_TARGETINFO_OPERATIONINFO.fields_by_name['versionToInfo'].message_type = object__store__sdk_dot_model_dot_easy__flow_dot_version__info__pb2._VERSIONINFO
_TARGETINFO_OPERATIONINFO.fields_by_name['versionFromInfo'].message_type = object__store__sdk_dot_model_dot_easy__flow_dot_version__info__pb2._VERSIONINFO
_TARGETINFO_OPERATIONINFO.containing_type = _TARGETINFO
_TARGETINFO.fields_by_name['cluster'].message_type = object__store__sdk_dot_model_dot_cmdb_dot_cluster__info__pb2._CLUSTERINFO
_TARGETINFO.fields_by_name['instanceInfo'].message_type = _TARGETINFO_INSTANCEINFO
_TARGETINFO.fields_by_name['operationInfo'].message_type = _TARGETINFO_OPERATIONINFO
DESCRIPTOR.message_types_by_name['TargetInfo'] = _TARGETINFO
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
TargetInfo = _reflection.GeneratedProtocolMessageType('TargetInfo', (_message.Message,), {
'InstanceInfo' : _reflection.GeneratedProtocolMessageType('InstanceInfo', (_message.Message,), {
'DESCRIPTOR' : _TARGETINFO_INSTANCEINFO,
'__module__' : 'target_info_pb2'
# @@protoc_insertion_point(class_scope:easy_flow.TargetInfo.InstanceInfo)
})
,
'OperationInfo' : _reflection.GeneratedProtocolMessageType('OperationInfo', (_message.Message,), {
'DESCRIPTOR' : _TARGETINFO_OPERATIONINFO,
'__module__' : 'target_info_pb2'
# @@protoc_insertion_point(class_scope:easy_flow.TargetInfo.OperationInfo)
})
,
'DESCRIPTOR' : _TARGETINFO,
'__module__' : 'target_info_pb2'
# @@protoc_insertion_point(class_scope:easy_flow.TargetInfo)
})
_sym_db.RegisterMessage(TargetInfo)
_sym_db.RegisterMessage(TargetInfo.InstanceInfo)
_sym_db.RegisterMessage(TargetInfo.OperationInfo)
DESCRIPTOR._options = None
# @@protoc_insertion_point(module_scope)
|
"""
Configuration file for the Sphinx documentation builder.
This file only contains a selection of the most common options. For a full
list see the documentation:
https://www.sphinx-doc.org/en/master/usage/configuration.html
"""
import os
import sys
from unittest.mock import MagicMock
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
on_rtd = os.environ.get('READTHEDOCS') == 'True'
if on_rtd:
sys.path.insert(0, os.path.abspath('..'))
else:
sys.path.insert(0, os.path.abspath('../..'))
class Mock(MagicMock):
@classmethod
def __getattr__(cls, name):
return MagicMock()
# mock the C extension
MOCK_MODULES = ['flowkit._utils_c']
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
# -- Project information -----------------------------------------------------
project = 'FlowKit'
copyright = '2020, Scott White'
author = 'Scott White'
# -- General configuration ---------------------------------------------------
master_doc = 'index'
autodoc_member_order = 'bysource'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'autoclasstoc',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary'
]
autodoc_default_options = {
'members': True,
'private-members': False,
'inherited-members': True,
'undoc-members': True,
'exclude-members': '__weakref__'
}
autoclasstoc_sections = [
'public-methods'
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
html_theme_options = {
'logo': 'flowkit.png',
'github_user': 'whitews',
'github_repo': 'flowkit',
'github_banner': True
}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# These paths are either relative to html_static_path
# or fully qualified paths (eg. https://...)
html_css_files = [
'css/custom.css',
]
|