text
stringlengths
2
1.05M
function openwin( url , name , width , height , left , top ){ window.open( url , name ,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+width+",height="+height+",left="+left+",top="+top ); } function openwinscroll( url , name , width , height , left , top ){ window.open( url , name ,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+width+",height="+height+",left="+left+",top="+top ); } String.prototype.Trim = function(){ return this.replace(/(^\s*)|(\s*$)/g, ""); } String.prototype.LTrim = function(){ return this.replace(/(^\s*)/g, ""); } String.prototype.RTrim = function(){ return this.replace(/(\s*$)/g, ""); } function strlength(str){ return str.replace(/[^\x00-\xff]/gi,'xx').length; } function JumpOutSend(URLStr,rsmid){ var f1 = document.Form1; var oldTarget = f1.target; var oldReSumeID = f1.ReSumeID.value; var oldAction = f1.action; f1.target = JumpOutSend; f1.ReSumeID.value=rsmid; f1.action = URLStr; f1.submit(); f1.action = oldAction; f1.ReSumeID.value = oldReSumeID; f1.target = oldTarget; } function j2gb(url) { if(url != '') { location.href = "ht" + "tp://www.51job.com/" + url; return false; } if(location.hostname == "big5.51job.com") { location.href = "ht" + "tp://www.51job.com/" + url; return false; } else { location.href = "ht" + "tp://big5.51job.com" + url; return false; } } function chkUserEmail( str,language ) { var language = (arguments[1]!='')?arguments[1]:'CN'; if( str.Trim() == '' ){ if(language == 'EN') { window.alert( "Please enter your email address!" ); } else { window.alert( "请输入您的E-mail地址 !" ); } return false; } return chkUserEmailFormat( str,language ); } function chkUserEmailFormat( str,language ) { var language = (arguments[1]!='')?arguments[1]:'CN'; if( str.Trim().length > 100 ){ if(language == 'EN') { window.alert( "Your email address should not have more than 100 characters!" ); } else { window.alert( "email地址长度不能超过100位!" ); } return false; } str = str.toLowerCase().Trim() if( isEmail(str) ){ return true; }else{ if(language == 'EN') { window.alert( "Please use correct email address!" ); } else { window.alert ( "Email书写不正确!" ); } return false; } } function chkUserName( str,language ) { var language = (arguments[1]!='')?arguments[1]:'CN'; if( str.Trim() == '' ){ if(language == 'EN') { window.alert( "Please enter your member ID!" ); } else { window.alert( "请输入用户名!" ); } return false; } if( str.Trim().length < 4 ){ if(language == 'EN') { window.alert( "Your member ID should have more than 3 characters!" ); } else { window.alert( "您的用户名需大于3位 !" ); } return false; } if( str.Trim().length > 50 ){ if(language == 'EN') { window.alert( "Your member ID should not have more than 50 characters!" ); } else { window.alert( "您的用户名不能超过50位 !" ); } return false; } return chkUserNameFormat( str,language ); } function chkUserNameFormat( str,language ) { var language = (arguments[1]!='')?arguments[1]:'CN'; str=str.Trim() var regu = "^([0-9a-zA-Z]+[_0-9a-zA-Z@.-]*)$" var re = new RegExp(regu); if( str.search( re ) != -1 ){ var sReg = /^(1[3456789]{1,1}[0-9]{9,9})$/; if(sReg.test(str)) { if(language == 'EN') { window.alert( "Please use correct member ID!" ); } else { window.alert( "用户名不能为手机号" ); } return false; } else { return true; } }else{ if(language == 'EN') { window.alert( "Please use correct member ID!" ); } else { window.alert( "用户名须以字母或数字开头,至少4位" ); } return false; } } function chkNum( value , minvalue , maxvalue ){ if( isNaN( value ) ){ return false; }else{ if( typeof( minvalue ) == 'number' ){ if( value < minvalue ) { return false; } } if( typeof( maxvalue ) == 'number' ){ if( value > maxvalue ){ return false; } } return true; } } var ZLayer; function creatZLayer( divcontent ){//支持多个层 if (divcontent=='') divcontent='<div></div>'; var zlParam3 = { content: divcontent , divProps: { style : { zIndex : 1007 } } , dragNode: 'drag3' , closeNode: 'close3', openType: 2 , //居中定位 filterParam: {} ,//滤镜层设置 createIfr:false } ZLayer = new ExtZzLayer( zlParam3 ); } function creatZLayerOnce( divcontent ){//单一层 if (typeof(ZLayer)!='object'){ creatZLayer( divcontent ); } } function OpenZLayer(){ ZLayer.open(); } function CloseZLayer(){ ZLayer.close(); } function SetZLayerContent(divcontent){ ZLayer.setContent(divcontent); } function RemoveZLayerContent(divcontent){ ZLayer.removeContent(); } function GetZLayerContent(divcontent){ contentType=0;//获取层内容,当type为1时,返回DOM对象索引数组(即层的childNodes属性) ,否则返回层内容的HTML字符串 return ZLayer.getContent(contentType); } function SetZLayerCloseNode(CloseNode){ ZLayer.setCloseNode(CloseNode); } function SetZLayerDragNode(dragNode){ ZLayer.setDragNode( dragNode ); } function SetLanguageFlag(flag){//设置语言标记,中文为 CN 英文为EN LANGUAGE_FLAG=flag; } //判断是否是Email function isEmail(str) { var regu = "^(([0-9a-zA-Z]+)|([0-9a-zA-Z]+[_.0-9a-zA-Z-]*))@([a-zA-Z0-9-]+[.])+([a-zA-Z]{2}|net|com|gov|mil|org|edu|int|name|asia)$"; var re = new RegExp( regu ); if( str.search( re ) == -1 ) { return false; } else { return true; } } // 判断是否含有大写字母 function hasCapital(str) { var result = str.match(/^.*[A-Z]+.*$/); if(result==null) return false; return true; } // 判断是否含有小写字母 function hasLowercase(str) { var result = str.match(/^.*[a-z]+.*$/); if(result==null) return false; return true; } // 判断是否含有数字 function hasNumber(str) { var result = str.match(/^.*[0-9]+.*$/); if(result==null) return false; return true; } // 判断是否含有其他字符 function hasOther(str) { var result = str.match(/^.*[^0-9A-Za-z]+.*$/); if(result==null) return false; return true; } function j2gb(url) { if(url != '') { location.href = "ht" + "tp://www.51job.com/" + url; return false; } if(location.hostname == "big5.51job.com") { location.href = "ht" + "tp://www.51job.com/" + url; return false; } else { location.href = "ht" + "tp://big5.51job.com" + url; return false; } } function gotoehire(isenglish) { var urllast; var iscnc=0; if(isenglish==0) { urllast ="MainLogin.aspx"; }else { urllast="MainLoginEN.aspx"; } if(location.hostname == "big5.51job.com") { url=document.URL; tmpHPage = url.split( "/" ); oldhostName = tmpHPage[5].split( "." ); domainname=oldhostName[0]; if(domainname=="cnc" || domainname=="cn" || domainname=="bj1") { iscnc=1; } } if(location.hostname == "cnc.51job.com" || location.hostname == "cn.51job.com" || location.hostname == "bj1.51job.com" || iscnc==1) { location.href = "ht" + "tp://eh.51job.com/" + urllast; return false; }else{ location.href = "ht" + "tp://ehire.51job.com/" + urllast; return false; } } function Jtrim(str) { var i = 0; var len = str.length; if ( str == "" ) return( str ); j = len -1; flagbegin = true; flagend = true; while (( flagbegin == true) && (i< len)) { if ( str.charAt(i) == " " ) { i=i+1; flagbegin=true; } else { flagbegin=false; } } while ((flagend== true) && (j>=0)) { if (str.charAt(j)==" ") { j=j-1; flagend=true; } else { flagend=false; } } if ( i > j ) return (""); trimstr = str.substring(i,j+1); return trimstr; } function isValidDate( year, month, day ) { year = parseInt(year,10); month = parseInt(month,10); day = parseInt(day,10); if (( month==4) || (month==6) || (month==9) || (month==11) ) { if (( day < 1) || (day > 30) ) { return (false); } } else { if ( month!=2 ) { if ( (day < 1) || (day > 31 )) { return (false); } } else { // month == 2 if ( ( year % 100 ) != 0 && (year % 4 == 0) || ( year % 100 ) == 0 && ( year % 400) == 0 ) { if ( (day < 1) || day > 29 ) { return (false); } } else { if ( (day < 1) || day > 28 ) { return (false); } } } } return (true); } function isValidDate_e( year, month, day ) { year = parseInt(year,10); month = parseInt(month,10); day = parseInt(day,10); if (( month==4) || (month==6) || (month==9) || (month==11) ) { if (( day < 1) || (day > 30) ) { return (false); } } else { if ( month!=2 ) { if ( (day < 1) || (day > 31 )) { return (false); } } else { // month == 2 if ( ( year % 100 ) != 0 && (year % 4 == 0) || ( year % 100 ) == 0 && ( year % 400) == 0 ) { if ( day > 29 ) { return (false); } } else { if ( day > 28 ) { return (false); } } } } return (true); } function DateCompare(YearFrom, MonthFrom, YearTo, MonthTo) { YearFrom = parseInt(YearFrom,10); MonthFrom = parseInt(MonthFrom,10); YearTo = parseInt(YearTo,10); MonthTo = parseInt(MonthTo,10); if (YearFrom > YearTo) { return false;} else { if (YearFrom == YearTo) { if (MonthFrom > MonthTo) return false; } } return true; } function isInt(obj){ if (obj==""){ return false; } slen=obj.length; for (i=0; i<slen; i++) { cc = obj.charAt(i); if (cc <"0" || cc >"9") { return false; } } return true; } function MM_openBrWindow(theURL,winName,features) { window.open(theURL,winName,features); } function InvestCallPage(htmlurl){ var newwin1=window.open(htmlurl,"investwin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=430,height=300"); } function chkInvestOK(){ var f1 = document.fInvestigate; var issub = false; for(i=0;i<f1.SelVal.length;i++){ if( f1.SelVal[i].checked ){ issub = true; } } if( true == issub ){ InvestCallPage(''); return true; } else{ window.alert("请选择您的答案"); return false; } } function hotKeyWordSlip(ul, delay, speed, lineHeight) { //停留时间,相对速度(越小越快),每次滚动多少,最好和Li的Line-height一致。 var slideBox = (typeof ul == "string") ? document.getElementById(ul) : ul; var delay = delay || 1000; var speed = speed || 20; var lineHeight = lineHeight || 20; var tid = null, pause = false; var start = function() { tid = setInterval(slide, speed); }; var slide = function() { if (pause) { return; } slideBox.scrollTop += 2; if (slideBox.scrollTop % lineHeight == 0) { clearInterval(tid); slideBox.appendChild(slideBox.getElementsByTagName("li")[0]); slideBox.scrollTop = 0; setTimeout(start, delay); } }; slideBox.onmouseover = function() { pause = true; }; slideBox.onmouseout = function() { pause = false; }; setTimeout(start, delay); } function EncodeUrl( city , address ,searchdomain, lonlat) { src=searchdomain+'/jobsearch/tranToMap.php?city=' + encodeURIComponent( city ) + '&address=' + encodeURIComponent( address ) + '&lonlat=' + lonlat; window.open(src , 'ShowMap' , 'width=800,height=480,top=50, left=50,resizable=yes' ); } function getlength(str){ return str.replace(/[^\x00-\xff]/g,"**").length; } function codehtml(str) { var s = ""; if (str.length == 0) return ""; for (var i=0; i<str.length; i++) { switch (str.substr(i,1)) { case "<" : s += "&lt;"; break; case ">" : s += "&gt;"; break; case "&" : s += "&amp;"; break; case " " : s += "&nbsp;"; break; case "\'" : s += "&#39;"; break; case "\"" : s += "&quot;"; break; case "\n" : s += "<br>"; break; default : s += str.substr(i,1); break; } } return s; } function copyToClipboard(txt) { if (window.clipboardData) { window.clipboardData.clearData(); window.clipboardData.setData("text", txt); } else if (navigator.userAgent.indexOf("Opera") != -1) { window.location = txt; } else if (window.netscape) { try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); } catch(e) { alert("被浏览器拒绝!\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'"); return; } var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard); if (!clip) return; var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable); if (!trans) return; trans.addDataFlavor('text/unicode'); var str = new Object(); var len = new Object(); var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString); var copytext = txt; str.data = copytext; trans.setTransferData("text/unicode", str, copytext.length * 2); var clipid = Components.interfaces.nsIClipboard; if (!clip) return false; clip.setData(trans, null, clipid.kGlobalClipboard); alert("复制成功") } } function floatingLayer(iPageWidth, sElementId) { iLeft = parseInt(screen.width - iPageWidth)/2 + parseInt(iPageWidth) - 5; $('#' + sElementId).css({"left":iLeft}); $('#' + sElementId).show(); } function cutStr(sText, iLength, sDot) { if ('' == sDot) { sDot = '...'; } if (sText.length > iLength) { sFormatText = sText.substr(0, iLength) + sDot; } else { sFormatText = sText; } return sFormatText; }
const passport = require('passport') module.exports = app => { app.get('/auth/bitbucket', passport.authenticate('bitbucket')) app.get( '/auth/bitbucket/callback', passport.authenticate('bitbucket', { failureRedirect: '/' }), function(req, res) { res.redirect('/') } ) app.get( '/auth/google', passport.authenticate('google', { scope: ['profile', 'email'], }) ) app.get( '/auth/google/callback', passport.authenticate('google', { failureRedirect: '/' }), (req, res) => { res.redirect('/') } ) app.get('/auth/github', passport.authenticate('github')) app.get( '/auth/github/callback', passport.authenticate('github', { failureRedirect: '/login' }), function(req, res) { // Successful authentication, redirect home. res.redirect('/') } ) }
import uuid from 'uuid/v1'; import { takeRight, filter } from 'lodash'; import { LOCATION_CHANGE } from 'connected-react-router'; import { ENQUEUE, DEQUEUE } from '../actions/toastsActions'; import { MAX_TOASTS } from '../values/toasts'; const initialState = []; function enqueue(state, payload) { return takeRight([...state, { ...payload, id: uuid() }], MAX_TOASTS); } function dequeue(state, payload) { return filter(state, (toast) => toast.id !== payload.id); } export default function toastsReducer(state = initialState, action = {}) { switch (action.type) { case ENQUEUE: return enqueue(state, action.payload); case DEQUEUE: return dequeue(state, action.payload); case LOCATION_CHANGE: return initialState; default: return state; } }
/** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); var setReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' ); var setReadWriteAccessor = require( '@stdlib/utils/define-nonenumerable-read-write-accessor' ); var constantFunction = require( '@stdlib/utils/constant-function' ); var noop = require( '@stdlib/utils/noop' ); var copy = require( '@stdlib/utils/copy' ); var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isPrimitive; var isObject = require( '@stdlib/assert/is-plain-object' ); var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var MAX_VALUE = require( '@stdlib/constants/float64/max' ); var rinvgamma = require( './../../../base/invgamma' ).factory; var iteratorSymbol = require( '@stdlib/symbol/iterator' ); // MAIN // /** * Returns an iterator for generating pseudorandom numbers drawn from an inverse gamma distribution. * * @param {PositiveNumber} alpha - shape parameter * @param {PositiveNumber} beta - scale parameter * @param {Options} [options] - function options * @param {PRNG} [options.prng] - pseudorandom number generator which generates uniformly distributed pseudorandom numbers * @param {PRNGSeedMT19937} [options.seed] - pseudorandom number generator seed * @param {PRNGStateMT19937} [options.state] - pseudorandom number generator state * @param {boolean} [options.copy=true] - boolean indicating whether to copy a provided pseudorandom number generator state * @param {NonNegativeInteger} [options.iter] - number of iterations * @throws {TypeError} `alpha` must be a positive number * @throws {TypeError} `beta` must be a positive number * @throws {TypeError} options argument must be an object * @throws {TypeError} must provide valid options * @throws {Error} must provide a valid state * @returns {Iterator} iterator * * @example * var iter = iterator( 2.0, 2.0 ); * * var r = iter.next().value; * // returns <number> * * r = iter.next().value; * // returns <number> * * r = iter.next().value; * // returns <number> * * // ... */ function iterator( alpha, beta, options ) { var opts; var iter; var rand; var FLG; var i; if ( !isPositiveNumber( alpha ) ) { throw new TypeError( 'invalid argument. First argument must be a positive number. Value: `'+alpha+'`.' ); } if ( !isPositiveNumber( beta ) ) { throw new TypeError( 'invalid argument. Second argument must be a positive number. Value: `'+beta+'`.' ); } if ( arguments.length > 2 ) { if ( !isObject( options ) ) { throw new TypeError( 'invalid argument. Options argument must be an object. Value: `'+options+'`.' ); } opts = copy( options, 1 ); if ( hasOwnProp( opts, 'iter' ) ) { if ( !isNonNegativeInteger( opts.iter ) ) { throw new TypeError( 'invalid option. `iter` option must be a nonnegative integer. Option: `'+opts.iter+'`.' ); } } else { opts.iter = MAX_VALUE; } rand = rinvgamma( alpha, beta, opts ); if ( opts.prng === void 0 && opts.copy !== false ) { opts.state = rand.state; // cache a copy of the PRNG state } } else { rand = rinvgamma( alpha, beta ); opts = { 'iter': MAX_VALUE, 'state': rand.state // cache a copy of the PRNG state }; } i = 0; // Create an iterator protocol-compliant object: iter = {}; setReadOnly( iter, 'next', next ); setReadOnly( iter, 'return', end ); if ( opts && opts.prng ) { setReadOnly( iter, 'seed', null ); setReadOnly( iter, 'seedLength', null ); setReadWriteAccessor( iter, 'state', constantFunction( null ), noop ); setReadOnly( iter, 'stateLength', null ); setReadOnly( iter, 'byteLength', null ); } else { setReadOnlyAccessor( iter, 'seed', getSeed ); setReadOnlyAccessor( iter, 'seedLength', getSeedLength ); setReadWriteAccessor( iter, 'state', getState, setState ); setReadOnlyAccessor( iter, 'stateLength', getStateLength ); setReadOnlyAccessor( iter, 'byteLength', getStateSize ); } setReadOnly( iter, 'PRNG', rand.PRNG ); // If an environment supports `Symbol.iterator`, make the iterator iterable: if ( iteratorSymbol ) { setReadOnly( iter, iteratorSymbol, factory ); } return iter; /** * Returns an iterator protocol-compliant object containing the next iterated value. * * @private * @returns {Object} iterator protocol-compliant object */ function next() { i += 1; if ( FLG || i > opts.iter ) { return { 'done': true }; } return { 'value': rand(), 'done': false }; } /** * Finishes an iterator. * * @private * @param {*} [value] - value to return * @returns {Object} iterator protocol-compliant object */ function end( value ) { FLG = true; if ( arguments.length ) { return { 'value': value, 'done': true }; } return { 'done': true }; } /** * Returns a new iterator. * * @private * @returns {Iterator} iterator */ function factory() { return iterator( alpha, beta, opts ); } /** * Returns the PRNG seed. * * @private * @returns {PRNGSeedMT19937} seed */ function getSeed() { return rand.PRNG.seed; } /** * Returns the PRNG seed length. * * @private * @returns {PositiveInteger} seed length */ function getSeedLength() { return rand.PRNG.seedLength; } /** * Returns the PRNG state length. * * @private * @returns {PositiveInteger} state length */ function getStateLength() { return rand.PRNG.stateLength; } /** * Returns the PRNG state size (in bytes). * * @private * @returns {PositiveInteger} state size (in bytes) */ function getStateSize() { return rand.PRNG.byteLength; } /** * Returns the current pseudorandom number generator state. * * @private * @returns {PRNGStateMT19937} current state */ function getState() { return rand.PRNG.state; } /** * Sets the pseudorandom number generator state. * * @private * @param {PRNGStateMT19937} s - generator state * @throws {Error} must provide a valid state */ function setState( s ) { rand.PRNG.state = s; } } // EXPORTS // module.exports = iterator;
/*jshint esversion: 6, node: true*/ 'use strict'; // DEPENDENCIES const chalk = require('chalk'); const fs = require('fs'); const JSONStream = require('JSONStream'); const es = require('event-stream'); const PrettyError = require('pretty-error'); const pe = new PrettyError(); const models = require('../models'); const AudioAnalysis = models.AudioAnalysis; // CONSTANTS const Promise = require('bluebird'); const include_keys = [ 'duration', 'loudness', 'tempo', 'tempo_confidence', 'time_signature', 'time_signature_confidence', 'key', 'key_confidence', 'mode', 'mode_confidence', ]; module.exports = (data_file) => { if (!fs.existsSync(data_file)) throw new Error(`[${data_file}] Data file not found.`); console.log(`[${chalk.yellow(data_file)}] Starting seed with audio analysis data file...`); return { up: (queryInterface, Sequelize) => { return new Promise((resolve, reject) => { let count = 0; const chain = fs.createReadStream(data_file) .pipe(JSONStream.parse([{ emitKey: true }])) .pipe(es.through(async function write({ key: trackId, value: { track: full_analysis }}) { if (!this.paused) this.pause(); const analysis = Object.assign(Object.keys(full_analysis).reduce((a, key) => { if (include_keys.includes(key)) { a[key] = full_analysis[key]; return a; } return a; }, {}), { trackId, createdAt: new Date(), updatedAt: new Date(), }); this.pause(); await AudioAnalysis.bulkCreate([analysis], { ignoreDuplicates: true}) .catch(err => { console.error(chalk.red(err.parent.detail)); return Promise.resolve(); }) .then(() => { count = count + 1; console.log(`Loaded analysis: ${trackId}`); }); if (this.paused) this.resume(); }, function end() { this.emit('end'); })); chain.on('error', (err) => console.error(pe.render(err))); chain.on('end', () => { console.log(`${chalk.green('JSON Stream complete.')} Loaded analysis for tracks: ${chalk.green(count)}`); resolve(); }); }); }, down: (queryInterface, Sequelize) => { /* Add reverting commands here. Return a promise to correctly handle asynchronicity. Example: return queryInterface.bulkDelete('Person', null, {}); */ return queryInterface.bulkDelete('AudioAnalyses', null, {}) .then(() => console.log('Removed audio analyses.')); } }; };
const Star = ({ starId, selected }) => { return ( <button star-id={starId} className='text-yellow-400 sm:text-base'> <svg xmlns='http://www.w3.org/2000/svg' className='w-6 h-6' fill={selected ? 'currentColor' : 'none'} viewBox='0 0 24 24' stroke='currentColor' star-id={starId} > <path star-id={starId} strokeLinecap='round' strokeLinejoin='round' strokeWidth={2} d='M11.049 2.927c.3-.921 1.603-.921 1.902 0l1.519 4.674a1 1 0 00.95.69h4.915c.969 0 1.371 1.24.588 1.81l-3.976 2.888a1 1 0 00-.363 1.118l1.518 4.674c.3.922-.755 1.688-1.538 1.118l-3.976-2.888a1 1 0 00-1.176 0l-3.976 2.888c-.783.57-1.838-.197-1.538-1.118l1.518-4.674a1 1 0 00-.363-1.118l-3.976-2.888c-.784-.57-.38-1.81.588-1.81h4.914a1 1 0 00.951-.69l1.519-4.674z' /> </svg> </button> ) } export default Star
/* * pagefire * https://github.com/bart/pagefire * * Copyright (c) 2014 andrej bartko * Licensed under the MIT license. */ 'use strict'; /** * paginateFire needs url to endless list * will store the current page * and be queried for next or previous * * optional arguments: * pageSize - default 10 for testing normally this is handled on server side so pagesize can be signifficatnly * larger than the client side part. * TODO implement different size for server and client part. * order - 0 from last to first - in classic scneariu the newwest element is at th ebottom of the list * 1 from first to last - if elements are orgasnized by priority (date, score etc.); * * currently there is not way of getting the overal number of records or pages for that reason * */ var util = require('util'); var RSVP = require('rsvp'), Promise = RSVP.Promise; var Emitter = require('events').EventEmitter; /** * makes the paginator instance * @constructor * * @param {Firebase} Firebase reference to location containing the endless list * @param {int} page size */ var PageFire = module.exports = function(){ Emitter.call(this); var args = Array.prototype.slice.call(arguments);//.shift(); this._pageSize = !!args[1] ? args[1] : 5; this._ref = args[0]; this._page = null; this._currentPage = 0; this._last = null; this._first = null; this._newest = null; this._oldest = null; this._onFirst = false; this._onLast = false; }; util.inherits(PageFire, Emitter); /* * sets newest item in the list * and emits the event 'ready' * and returns itself */ /** * set the paginator page to newest element on top * * @returns {this} */ PageFire.prototype.setNewest = function(){ var self = this; // gettting the last element in the list to initialize paginator self._ref .endAt() .limit(1) .once('child_added',function(result){ self._newest = result.name(); // TODO - maybe get calling object and than call on it the result somehow this.emit("ready", this); // TODO // here to drop the PageFire instance into some navigator. }.bind(this)); return this; }; /** * set the page on paginator to first * * @returns {this} */ PageFire.prototype.first = function(){ var self = this; return new Promise(function(resolve, reject){ self._ref .limit(this._pageSize) .endAt() .once('value', function(result){ if(result){ var res = result.val(); var keys = Object.keys(res); self._last = keys[0]; self._first = keys[keys.length-1]; self._page = res; self._onFirst = true; resolve(res); } else { reject("something went wrong"); } }); }); }; /** * returns the next page of set size as promise * as we need a pointer which is the last key of the item in the previous list * so this needs to be the first key of the next list * for this reason we always will have one item in previous and next list * which is not necessarily bad idea, at least it gives a context * * @returns {Promise} promise to array of items in the page */ PageFire.prototype.next = function(){ var self = this; return new Promise(function(resolve, reject){ var args = []; if(self._last) { args.push(null); args.push(self._last); } // TODO possible solution - curry endAt /* self._ref .limit(self._pageSize) //.endAt(null) .endAt.apply(self._ref) */ var part = self._ref.limit(self._pageSize); part = part.endAt.apply(part, args); part .once('value', function(result){ // TODO ammend the logic because we always get at least one result even if // at the end(beginning) of the page if(result){ var res = result.val(); var keys = Object.keys(res); self._last = keys[0]; self._first = keys[keys.length-1]; self._page = res; self._onFirst = false; resolve(res); } else { reject("some error with firebase"); } }); }); }; /** * sets paginator to previous page and returns the page as promise * TODO * the counter here might be way off as the list might change during iteration * we need a solid method to recognize whether (newest == first) * * @returns {Promise} the array of items in the page */ PageFire.prototype.previous = function(){ var self = this; return new Promise(function(resolve,reject){ self._ref .limit(self._pageSize) .startAt(null, self._first) .once('value', function(result){ if(result){ var res = result.val(); var keys = Object.keys(res); self._last = keys[0]; self._first = keys[keys.length-1]; // need to fill the rest of the page with the reminder from previous page // we have it already loaded :) if(keys.length < self._pageSize){ var diff = self._pageSize - keys.length; for(diff; diff >= 0; diff--){ res.push(self._page.pop()); self._onFirst = true; } } self._page = res; resolve(res); } else { reject("something went wrong"); } }); }); }; /** * attempt to look at the oldest item in the list */ PageFire.prototype.last = function(){ var self = this; return new Promise(function(resolve, reject){ self._ref .limit(self._pageSize) .startAt() .once('value', function(ss){ if (ss){ var res = ss.val(), keys = Object.keys(res); self._oldest = keys[0]; self._last = keys[0]; self._first = keys[keys.length - 1]; self._page = res; resolve(res); } else { reject("something went wrong"); } }); }); }; PageFire.prototype.onFirstPage = function(){ return this._onFirst; }; PageFire.prototype.onLastPage = function(){ // the last page always has less number of elements // as the last element is the first element of the next page return this._page.length < this._pageSize; };
'use strict'; /** * Controller for Promotiondetailinfo **/ promotiondetailinfoModule.controller('PromotiondetailinfoCtrl', ['Promotiondetailinfo', 'Dishinfo', 'Dishspecificationinfo', '$scope', '$routeParams', '$http', '$location', '$cookies', 'MessageHandler', 'restURL', function(Promotiondetailinfo, Dishinfo, Dishspecificationinfo, $scope, $routeParams, $http, $location, $cookies, MessageHandler, restURL) { 'Dishinfo', 'Dishspecificationinfo', // edition mode $scope.mode = null; // list of promotiondetailinfos $scope.promotiondetailinfos = []; // promotiondetailinfo to edit $scope.promotiondetailinfo = null; // referencies entities $scope.items = {}; // dishinfos $scope.items.dishinfos = []; // dishspecificationinfos $scope.items.dishspecificationinfos = []; /** * Load all referencies entities */ $scope.loadAllReferencies = function() { Dishinfo.getAllAsListItems().then( function(success) { $scope.items.dishinfos = success.data; }, MessageHandler.manageError); Dishspecificationinfo.getAllAsListItems().then( function(success) { $scope.items.dishspecificationinfos = success.data; }, MessageHandler.manageError); }; /** * Refresh promotiondetailinfos list */ $scope.refreshPromotiondetailinfoList = function() { try { $scope.promotiondetailinfos = []; Promotiondetailinfo.getAll().then( function(success) { $scope.promotiondetailinfos = success.data; }, MessageHandler.manageError); } catch(ex) { MessageHandler.manageException(ex); } } /** * Refresh promotiondetailinfo */ $scope.refreshPromotiondetailinfo = function(uid, dishid, specificationid) { try { $scope.promotiondetailinfo = null; Promotiondetailinfo.get(uid, dishid, specificationid).then( function(success) { $scope.promotiondetailinfo = success.data; }, MessageHandler.manageError); } catch(ex) { MessageHandler.manageException(ex); } } /** * Go to the promotiondetailinfos list page */ $scope.goToPromotiondetailinfoList = function() { $scope.refreshPromotiondetailinfoList(); $location.path('/promotiondetailinfo'); } /** * Go to the promotiondetailinfo edit page */ $scope.goToPromotiondetailinfo = function(uid, dishid, specificationid) { $scope.refreshPromotiondetailinfo(uid, dishid, specificationid); $location.path('/promotiondetailinfo/'+uid+'/'+dishid+'/'+specificationid); } // Actions /** * Save promotiondetailinfo */ $scope.save = function() { try { MessageHandler.cleanMessage(); var save; if( $scope.mode === 'create' ) { save = Promotiondetailinfo.create; } else { save = Promotiondetailinfo.update; } save($scope.promotiondetailinfo).then( function(success) { MessageHandler.addSuccess('save ok'); $scope.promotiondetailinfo = success.data; }, MessageHandler.manageError); } catch(ex) { MessageHandler.manageException(ex); } }; /** * Delete promotiondetailinfo */ $scope.delete = function(uid, dishid, specificationid) { try { MessageHandler.cleanMessage(); Promotiondetailinfo.delete(uid, dishid, specificationid).then( function(success) { $scope.goToPromotiondetailinfoList(); }, MessageHandler.manageError); } catch(ex) { MessageHandler.manageException(ex); } }; // Main MessageHandler.cleanMessage(); if( $location.path().endsWith('/new') ) { // Creation page $scope.promotiondetailinfo = {}; $scope.mode = 'create'; $scope.loadAllReferencies(); $scope.bookorderitem = null; } else if( $routeParams.uid != null && $routeParams.dishid != null && $routeParams.specificationid != null ) { // Edit page $scope.loadAllReferencies(); $scope.refreshPromotiondetailinfo($routeParams.uid, $routeParams.dishid, $routeParams.specificationid); } else { // List page $scope.refreshPromotiondetailinfoList(); } }]);
var path = require("path"); var webpack = require("webpack"); var express = require("express"); var devMiddleware = require("webpack-dev-middleware"); var hotMiddleware = require("webpack-hot-middleware"); var ProgressPlugin = require("webpack/lib/ProgressPlugin"); var config = require("./webpack.config.js")({prod: false}); var app = express(); var compiler = webpack(config); compiler.apply(new ProgressPlugin(function (percentage, msg) { process.stdout.write((percentage * 100).toFixed(2) + '% ' + msg + ' \033[0G'); })); app.use(devMiddleware(compiler, { publicPath: config.output.publicPath, historyApiFallback: true })); app.use(hotMiddleware(compiler)); app.use(function(request, response, next) { response.header("Access-Control-Allow-Origin", 'http://localhost:8080/'); response.header("Access-Control-Allow-Headers", "Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With"); response.header("Access-Control-Allow-Methods", "GET,HEAD,POST,PUT,DELETE,OPTIONS"); response.header("Access-Control-Allow-Credentials", "true"); next(); }); app.get("*", function (req, res) { res.sendFile(path.join(__dirname, "app/assets/index-dev.html")); }); app.listen(8080, function (err) { if (err) { return console.error(err); } console.log("Listening at http://localhost:8080/"); }); // new WebpackDevServer(compiler, { // publicPath: config.output.publicPath, // hot: true, // historyApiFallback: true, // quiet: false, // stats: {colors: true}, // port: 8080 // }).listen(8080, '0.0.0.0', function (err, result) { // if (err) { // console.log(err); // } // console.log('Listening at 0.0.0.0:8080'); // });
/* Highcharts JS v8.2.2 (2020-10-22) Highcharts cylinder module (c) 2010-2019 Kacper Madej License: www.highcharts.com/license */ (function(c){"object"===typeof module&&module.exports?(c["default"]=c,module.exports=c):"function"===typeof define&&define.amd?define("highcharts/modules/cylinder",["highcharts","highcharts/highcharts-3d"],function(f){c(f);c.Highcharts=f;return c}):c("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(c){function f(c,g,f,k){c.hasOwnProperty(g)||(c[g]=k.apply(null,f))}c=c?c._modules:{};f(c,"Series/CylinderSeries.js",[c["Core/Color/Color.js"],c["Core/Globals.js"],c["Extensions/Math3D.js"], c["Core/Series/Series.js"],c["Core/Utilities.js"]],function(c,g,f,k,l){var m=c.parse,t=g.charts,u=g.deg2rad;c=g.Renderer.prototype;var v=f.perspective;f=l.merge;var w=l.pick,x=c.cuboidPath,n=function(a){return!a.some(function(a){return"C"===a[0]})};k.seriesType("cylinder","column",{},{},{shapeType:"cylinder",hasNewShapeType:g.seriesTypes.column.prototype.pointClass.prototype.hasNewShapeType});g=f(c.elements3d.cuboid,{parts:["top","bottom","front","back"],pathType:"cylinder",fillSetter:function(a){this.singleSetterForParts("fill", null,{front:a,back:a,top:m(a).brighten(.1).get(),bottom:m(a).brighten(-.1).get()});this.color=this.fill=a;return this}});c.elements3d.cylinder=g;c.cylinder=function(a){return this.element3d("cylinder",a)};c.cylinderPath=function(a){var b=t[this.chartIndex],d=x.call(this,a),e=!d.isTop,c=!d.isFront,f=this.getCylinderEnd(b,a);a=this.getCylinderEnd(b,a,!0);return{front:this.getCylinderFront(f,a),back:this.getCylinderBack(f,a),top:f,bottom:a,zIndexes:{top:e?3:0,bottom:e?0:3,front:c?2:1,back:c?1:2,group:d.zIndexes.group}}}; c.getCylinderFront=function(a,b){a=a.slice(0,3);if(n(b)){var d=b[0];"M"===d[0]&&(a.push(b[2]),a.push(b[1]),a.push(["L",d[1],d[2]]))}else{d=b[0];var e=b[1];b=b[2];"M"===d[0]&&"C"===e[0]&&"C"===b[0]&&(a.push(["L",b[5],b[6]]),a.push(["C",b[3],b[4],b[1],b[2],e[5],e[6]]),a.push(["C",e[3],e[4],e[1],e[2],d[1],d[2]]))}a.push(["Z"]);return a};c.getCylinderBack=function(a,b){var d=[];if(n(a)){var e=a[0],c=a[2];"M"===e[0]&&"L"===c[0]&&(d.push(["M",c[1],c[2]]),d.push(a[3]),d.push(["L",e[1],e[2]]))}else"C"=== a[2][0]&&d.push(["M",a[2][5],a[2][6]]),d.push(a[3],a[4]);n(b)?(e=b[0],"M"===e[0]&&(d.push(["L",e[1],e[2]]),d.push(b[3]),d.push(b[2]))):(a=b[2],e=b[3],b=b[4],"C"===a[0]&&"C"===e[0]&&"C"===b[0]&&(d.push(["L",b[5],b[6]]),d.push(["C",b[3],b[4],b[1],b[2],e[5],e[6]]),d.push(["C",e[3],e[4],e[1],e[2],a[5],a[6]])));d.push(["Z"]);return d};c.getCylinderEnd=function(a,b,d){var c=w(b.depth,b.width),f=Math.min(b.width,c)/2,g=u*(a.options.chart.options3d.beta-90+(b.alphaCorrection||0));d=b.y+(d?b.height:0);var h= .5519*f,k=b.width/2+b.x,n=c/2+b.z,p=[{x:0,y:d,z:f},{x:h,y:d,z:f},{x:f,y:d,z:h},{x:f,y:d,z:0},{x:f,y:d,z:-h},{x:h,y:d,z:-f},{x:0,y:d,z:-f},{x:-h,y:d,z:-f},{x:-f,y:d,z:-h},{x:-f,y:d,z:0},{x:-f,y:d,z:h},{x:-h,y:d,z:f},{x:0,y:d,z:f}],l=Math.cos(g),m=Math.sin(g),q,r;p.forEach(function(a,b){q=a.x;r=a.z;p[b].x=q*l-r*m+k;p[b].z=r*l+q*m+n});a=v(p,a,!0);return 2.5>Math.abs(a[3].y-a[9].y)&&2.5>Math.abs(a[0].y-a[6].y)?this.toLinePath([a[0],a[3],a[6],a[9]],!0):this.getCurvedPath(a)};c.getCurvedPath=function(a){var b= [["M",a[0].x,a[0].y]],c=a.length-2,e;for(e=1;e<c;e+=3)b.push(["C",a[e].x,a[e].y,a[e+1].x,a[e+1].y,a[e+2].x,a[e+2].y]);return b}});f(c,"masters/modules/cylinder.src.js",[],function(){})}); //# sourceMappingURL=cylinder.js.map
import Vue from 'vue' import Vuex from 'vuex' import axios from 'axios' Vue.use(Vuex) const store = new Vuex.Store({ state: { user: '', team: '', errorLog: '', tasks: '', taskStatus: '' }, mutations: { login(state, user) { state.user = user }, auth_error(state, error) { state.errorLog = error }, getTeam(state, team) { state.team = team }, getLoggedUser(state, user) { state.user = user }, updateUser(state, user) { state.user = user }, deleteUser(state) { state.user = '' }, resetValidation(state) { state.errorLog = '' }, getTaskList(state, tasks) { state.tasks = tasks; }, updateTask(state, status) { state.taskStatus = status }, addTask(state, task) { state.tasks.push(task) } }, actions: { login({ commit }, user) { axios.post('api/login', user.user).then(response => { commit('login', response.data) this.$router.push({ path: "/" }); }).catch((error) => { commit('auth_error', error.response.data.errors.email[0]) }) }, getTeam({ commit }) { axios.get('/api/index ').then(response => { commit('getTeam', response.data) }) .catch(error => { console.log(error); }) }, getLoggedUser({ commit }) { axios.get('/api/user').then(response => { commit('getLoggedUser', response.data) }) .catch(error => { console.log(error); }) }, updateUser({ commit }, user) { axios.put('/api/update/' + user.user.id, user.user).then(response => { commit('updateUser', user.user) }) .catch(error => { console.log(error); }) }, deleteUser({ commit }, user) { axios.get('/api/delete/' + user.user.id).then(response => { commit('deleteUser', user.user) }) .catch(error => { console.log(error); }) }, getTaskList({ commit }) { axios.get('api/tasks').then(response => { commit('getTaskList', response.data) }, (error) => { console.log(error); }) }, updateTask({ commit }, taskID) { axios.put('/api/tasks/' + taskID.taskID, taskID.status).then(response => { commit('updateTask', taskID.status) }) .catch(error => { console.log(error); }) }, addTask({ commit }, task) { axios.post('/api/tasks', task.task).then(response => { commit('addTask', task.task) }).catch((error) => { console.log(error) }) } }, getters: { } }) export default store;
/* ======================================================================== * Bootstrap: transition.js v3.3.1 * http://getbootstrap.com/javascript/#transitions * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) // ============================================================ function transitionEnd() { var el = document.createElement('bootstrap') var transEndEventNames = { WebkitTransition : 'webkitTransitionEnd', MozTransition : 'transitionend', OTransition : 'oTransitionEnd otransitionend', transition : 'transitionend' } for (var name in transEndEventNames) { if (el.style[name] !== undefined) { return { end: transEndEventNames[name] } } } return false // explicit for ie8 ( ._.) } // http://blog.alexmaccaw.com/css-transitions $.fn.emulateTransitionEnd = function (duration) { var called = false var $el = this $(this).one('bsTransitionEnd', function () { called = true }) var callback = function () { if (!called) $($el).trigger($.support.transition.end) } setTimeout(callback, duration) return this } $(function () { $.support.transition = transitionEnd() if (!$.support.transition) return $.event.special.bsTransitionEnd = { bindType: $.support.transition.end, delegateType: $.support.transition.end, handle: function (e) { if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) } } }) }(jQuery); ;/* ======================================================================== * Bootstrap: alert.js v3.3.1 * http://getbootstrap.com/javascript/#alerts * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // ALERT CLASS DEFINITION // ====================== var dismiss = '[data-dismiss="alert"]' var Alert = function (el) { $(el).on('click', dismiss, this.close) } Alert.VERSION = '3.3.1' Alert.TRANSITION_DURATION = 150 Alert.prototype.close = function (e) { var $this = $(this) var selector = $this.attr('data-target') if (!selector) { selector = $this.attr('href') selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 } var $parent = $(selector) if (e) e.preventDefault() if (!$parent.length) { $parent = $this.closest('.alert') } $parent.trigger(e = $.Event('close.bs.alert')) if (e.isDefaultPrevented()) return $parent.removeClass('in') function removeElement() { // detach from parent, fire event then clean up data $parent.detach().trigger('closed.bs.alert').remove() } $.support.transition && $parent.hasClass('fade') ? $parent .one('bsTransitionEnd', removeElement) .emulateTransitionEnd(Alert.TRANSITION_DURATION) : removeElement() } // ALERT PLUGIN DEFINITION // ======================= function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.alert') if (!data) $this.data('bs.alert', (data = new Alert(this))) if (typeof option == 'string') data[option].call($this) }) } var old = $.fn.alert $.fn.alert = Plugin $.fn.alert.Constructor = Alert // ALERT NO CONFLICT // ================= $.fn.alert.noConflict = function () { $.fn.alert = old return this } // ALERT DATA-API // ============== $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) }(jQuery); ;/* ======================================================================== * Bootstrap: button.js v3.3.1 * http://getbootstrap.com/javascript/#buttons * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // BUTTON PUBLIC CLASS DEFINITION // ============================== var Button = function (element, options) { this.$element = $(element) this.options = $.extend({}, Button.DEFAULTS, options) this.isLoading = false } Button.VERSION = '3.3.1' Button.DEFAULTS = { loadingText: 'loading...' } Button.prototype.setState = function (state) { var d = 'disabled' var $el = this.$element var val = $el.is('input') ? 'val' : 'html' var data = $el.data() state = state + 'Text' if (data.resetText == null) $el.data('resetText', $el[val]()) // push to event loop to allow forms to submit setTimeout($.proxy(function () { $el[val](data[state] == null ? this.options[state] : data[state]) if (state == 'loadingText') { this.isLoading = true $el.addClass(d).attr(d, d) } else if (this.isLoading) { this.isLoading = false $el.removeClass(d).removeAttr(d) } }, this), 0) } Button.prototype.toggle = function () { var changed = true var $parent = this.$element.closest('[data-toggle="buttons"]') if ($parent.length) { var $input = this.$element.find('input') if ($input.prop('type') == 'radio') { if ($input.prop('checked') && this.$element.hasClass('active')) changed = false else $parent.find('.active').removeClass('active') } if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change') } else { this.$element.attr('aria-pressed', !this.$element.hasClass('active')) } if (changed) this.$element.toggleClass('active') } // BUTTON PLUGIN DEFINITION // ======================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.button') var options = typeof option == 'object' && option if (!data) $this.data('bs.button', (data = new Button(this, options))) if (option == 'toggle') data.toggle() else if (option) data.setState(option) }) } var old = $.fn.button $.fn.button = Plugin $.fn.button.Constructor = Button // BUTTON NO CONFLICT // ================== $.fn.button.noConflict = function () { $.fn.button = old return this } // BUTTON DATA-API // =============== $(document) .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) { var $btn = $(e.target) if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') Plugin.call($btn, 'toggle') e.preventDefault() }) .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type)) }) }(jQuery); ;/* ======================================================================== * Bootstrap: carousel.js v3.3.1 * http://getbootstrap.com/javascript/#carousel * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // CAROUSEL CLASS DEFINITION // ========================= var Carousel = function (element, options) { this.$element = $(element) this.$indicators = this.$element.find('.carousel-indicators') this.options = options this.paused = this.sliding = this.interval = this.$active = this.$items = null this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this)) this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element .on('mouseenter.bs.carousel', $.proxy(this.pause, this)) .on('mouseleave.bs.carousel', $.proxy(this.cycle, this)) } Carousel.VERSION = '3.3.1' Carousel.TRANSITION_DURATION = 600 Carousel.DEFAULTS = { interval: 5000, pause: 'hover', wrap: true, keyboard: true } Carousel.prototype.keydown = function (e) { if (/input|textarea/i.test(e.target.tagName)) return switch (e.which) { case 37: this.prev(); break case 39: this.next(); break default: return } e.preventDefault() } Carousel.prototype.cycle = function (e) { e || (this.paused = false) this.interval && clearInterval(this.interval) this.options.interval && !this.paused && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) return this } Carousel.prototype.getItemIndex = function (item) { this.$items = item.parent().children('.item') return this.$items.index(item || this.$active) } Carousel.prototype.getItemForDirection = function (direction, active) { var delta = direction == 'prev' ? -1 : 1 var activeIndex = this.getItemIndex(active) var itemIndex = (activeIndex + delta) % this.$items.length return this.$items.eq(itemIndex) } Carousel.prototype.to = function (pos) { var that = this var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active')) if (pos > (this.$items.length - 1) || pos < 0) return if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid" if (activeIndex == pos) return this.pause().cycle() return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos)) } Carousel.prototype.pause = function (e) { e || (this.paused = true) if (this.$element.find('.next, .prev').length && $.support.transition) { this.$element.trigger($.support.transition.end) this.cycle(true) } this.interval = clearInterval(this.interval) return this } Carousel.prototype.next = function () { if (this.sliding) return return this.slide('next') } Carousel.prototype.prev = function () { if (this.sliding) return return this.slide('prev') } Carousel.prototype.slide = function (type, next) { var $active = this.$element.find('.item.active') var $next = next || this.getItemForDirection(type, $active) var isCycling = this.interval var direction = type == 'next' ? 'left' : 'right' var fallback = type == 'next' ? 'first' : 'last' var that = this if (!$next.length) { if (!this.options.wrap) return $next = this.$element.find('.item')[fallback]() } if ($next.hasClass('active')) return (this.sliding = false) var relatedTarget = $next[0] var slideEvent = $.Event('slide.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) this.$element.trigger(slideEvent) if (slideEvent.isDefaultPrevented()) return this.sliding = true isCycling && this.pause() if (this.$indicators.length) { this.$indicators.find('.active').removeClass('active') var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)]) $nextIndicator && $nextIndicator.addClass('active') } var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid" if ($.support.transition && this.$element.hasClass('slide')) { $next.addClass(type) $next[0].offsetWidth // force reflow $active.addClass(direction) $next.addClass(direction) $active .one('bsTransitionEnd', function () { $next.removeClass([type, direction].join(' ')).addClass('active') $active.removeClass(['active', direction].join(' ')) that.sliding = false setTimeout(function () { that.$element.trigger(slidEvent) }, 0) }) .emulateTransitionEnd(Carousel.TRANSITION_DURATION) } else { $active.removeClass('active') $next.addClass('active') this.sliding = false this.$element.trigger(slidEvent) } isCycling && this.cycle() return this } // CAROUSEL PLUGIN DEFINITION // ========================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.carousel') var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option) var action = typeof option == 'string' ? option : options.slide if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))) if (typeof option == 'number') data.to(option) else if (action) data[action]() else if (options.interval) data.pause().cycle() }) } var old = $.fn.carousel $.fn.carousel = Plugin $.fn.carousel.Constructor = Carousel // CAROUSEL NO CONFLICT // ==================== $.fn.carousel.noConflict = function () { $.fn.carousel = old return this } // CAROUSEL DATA-API // ================= var clickHandler = function (e) { var href var $this = $(this) var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7 if (!$target.hasClass('carousel')) return var options = $.extend({}, $target.data(), $this.data()) var slideIndex = $this.attr('data-slide-to') if (slideIndex) options.interval = false Plugin.call($target, options) if (slideIndex) { $target.data('bs.carousel').to(slideIndex) } e.preventDefault() } $(document) .on('click.bs.carousel.data-api', '[data-slide]', clickHandler) .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler) $(window).on('load', function () { $('[data-ride="carousel"]').each(function () { var $carousel = $(this) Plugin.call($carousel, $carousel.data()) }) }) }(jQuery); ;/* ======================================================================== * Bootstrap: collapse.js v3.3.1 * http://getbootstrap.com/javascript/#collapse * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // COLLAPSE PUBLIC CLASS DEFINITION // ================================ var Collapse = function (element, options) { this.$element = $(element) this.options = $.extend({}, Collapse.DEFAULTS, options) this.$trigger = $(this.options.trigger).filter('[href="#' + element.id + '"], [data-target="#' + element.id + '"]') this.transitioning = null if (this.options.parent) { this.$parent = this.getParent() } else { this.addAriaAndCollapsedClass(this.$element, this.$trigger) } if (this.options.toggle) this.toggle() } Collapse.VERSION = '3.3.1' Collapse.TRANSITION_DURATION = 350 Collapse.DEFAULTS = { toggle: true, trigger: '[data-toggle="collapse"]' } Collapse.prototype.dimension = function () { var hasWidth = this.$element.hasClass('width') return hasWidth ? 'width' : 'height' } Collapse.prototype.show = function () { if (this.transitioning || this.$element.hasClass('in')) return var activesData var actives = this.$parent && this.$parent.find('> .panel').children('.in, .collapsing') if (actives && actives.length) { activesData = actives.data('bs.collapse') if (activesData && activesData.transitioning) return } var startEvent = $.Event('show.bs.collapse') this.$element.trigger(startEvent) if (startEvent.isDefaultPrevented()) return if (actives && actives.length) { Plugin.call(actives, 'hide') activesData || actives.data('bs.collapse', null) } var dimension = this.dimension() this.$element .removeClass('collapse') .addClass('collapsing')[dimension](0) .attr('aria-expanded', true) this.$trigger .removeClass('collapsed') .attr('aria-expanded', true) this.transitioning = 1 var complete = function () { this.$element .removeClass('collapsing') .addClass('collapse in')[dimension]('') this.transitioning = 0 this.$element .trigger('shown.bs.collapse') } if (!$.support.transition) return complete.call(this) var scrollSize = $.camelCase(['scroll', dimension].join('-')) this.$element .one('bsTransitionEnd', $.proxy(complete, this)) .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize]) } Collapse.prototype.hide = function () { if (this.transitioning || !this.$element.hasClass('in')) return var startEvent = $.Event('hide.bs.collapse') this.$element.trigger(startEvent) if (startEvent.isDefaultPrevented()) return var dimension = this.dimension() this.$element[dimension](this.$element[dimension]())[0].offsetHeight this.$element .addClass('collapsing') .removeClass('collapse in') .attr('aria-expanded', false) this.$trigger .addClass('collapsed') .attr('aria-expanded', false) this.transitioning = 1 var complete = function () { this.transitioning = 0 this.$element .removeClass('collapsing') .addClass('collapse') .trigger('hidden.bs.collapse') } if (!$.support.transition) return complete.call(this) this.$element [dimension](0) .one('bsTransitionEnd', $.proxy(complete, this)) .emulateTransitionEnd(Collapse.TRANSITION_DURATION) } Collapse.prototype.toggle = function () { this[this.$element.hasClass('in') ? 'hide' : 'show']() } Collapse.prototype.getParent = function () { return $(this.options.parent) .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]') .each($.proxy(function (i, element) { var $element = $(element) this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element) }, this)) .end() } Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) { var isOpen = $element.hasClass('in') $element.attr('aria-expanded', isOpen) $trigger .toggleClass('collapsed', !isOpen) .attr('aria-expanded', isOpen) } function getTargetFromTrigger($trigger) { var href var target = $trigger.attr('data-target') || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 return $(target) } // COLLAPSE PLUGIN DEFINITION // ========================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.collapse') var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) if (!data && options.toggle && option == 'show') options.toggle = false if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) if (typeof option == 'string') data[option]() }) } var old = $.fn.collapse $.fn.collapse = Plugin $.fn.collapse.Constructor = Collapse // COLLAPSE NO CONFLICT // ==================== $.fn.collapse.noConflict = function () { $.fn.collapse = old return this } // COLLAPSE DATA-API // ================= $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) { var $this = $(this) if (!$this.attr('data-target')) e.preventDefault() var $target = getTargetFromTrigger($this) var data = $target.data('bs.collapse') var option = data ? 'toggle' : $.extend({}, $this.data(), { trigger: this }) Plugin.call($target, option) }) }(jQuery); ;/* ======================================================================== * Bootstrap: dropdown.js v3.3.1 * http://getbootstrap.com/javascript/#dropdowns * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // DROPDOWN CLASS DEFINITION // ========================= var backdrop = '.dropdown-backdrop' var toggle = '[data-toggle="dropdown"]' var Dropdown = function (element) { $(element).on('click.bs.dropdown', this.toggle) } Dropdown.VERSION = '3.3.1' Dropdown.prototype.toggle = function (e) { var $this = $(this) if ($this.is('.disabled, :disabled')) return var $parent = getParent($this) var isActive = $parent.hasClass('open') clearMenus() if (!isActive) { if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { // if mobile we use a backdrop because click events don't delegate $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus) } var relatedTarget = { relatedTarget: this } $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget)) if (e.isDefaultPrevented()) return $this .trigger('focus') .attr('aria-expanded', 'true') $parent .toggleClass('open') .trigger('shown.bs.dropdown', relatedTarget) } return false } Dropdown.prototype.keydown = function (e) { if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return var $this = $(this) e.preventDefault() e.stopPropagation() if ($this.is('.disabled, :disabled')) return var $parent = getParent($this) var isActive = $parent.hasClass('open') if ((!isActive && e.which != 27) || (isActive && e.which == 27)) { if (e.which == 27) $parent.find(toggle).trigger('focus') return $this.trigger('click') } var desc = ' li:not(.divider):visible a' var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc) if (!$items.length) return var index = $items.index(e.target) if (e.which == 38 && index > 0) index-- // up if (e.which == 40 && index < $items.length - 1) index++ // down if (!~index) index = 0 $items.eq(index).trigger('focus') } function clearMenus(e) { if (e && e.which === 3) return $(backdrop).remove() $(toggle).each(function () { var $this = $(this) var $parent = getParent($this) var relatedTarget = { relatedTarget: this } if (!$parent.hasClass('open')) return $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget)) if (e.isDefaultPrevented()) return $this.attr('aria-expanded', 'false') $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget) }) } function getParent($this) { var selector = $this.attr('data-target') if (!selector) { selector = $this.attr('href') selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 } var $parent = selector && $(selector) return $parent && $parent.length ? $parent : $this.parent() } // DROPDOWN PLUGIN DEFINITION // ========================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.dropdown') if (!data) $this.data('bs.dropdown', (data = new Dropdown(this))) if (typeof option == 'string') data[option].call($this) }) } var old = $.fn.dropdown $.fn.dropdown = Plugin $.fn.dropdown.Constructor = Dropdown // DROPDOWN NO CONFLICT // ==================== $.fn.dropdown.noConflict = function () { $.fn.dropdown = old return this } // APPLY TO STANDARD DROPDOWN ELEMENTS // =================================== $(document) .on('click.bs.dropdown.data-api', clearMenus) .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown) .on('keydown.bs.dropdown.data-api', '[role="menu"]', Dropdown.prototype.keydown) .on('keydown.bs.dropdown.data-api', '[role="listbox"]', Dropdown.prototype.keydown) }(jQuery); ;/* ======================================================================== * Bootstrap: modal.js v3.3.1 * http://getbootstrap.com/javascript/#modals * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // MODAL CLASS DEFINITION // ====================== var Modal = function (element, options) { this.options = options this.$body = $(document.body) this.$element = $(element) this.$backdrop = this.isShown = null this.scrollbarWidth = 0 if (this.options.remote) { this.$element .find('.modal-content') .load(this.options.remote, $.proxy(function () { this.$element.trigger('loaded.bs.modal') }, this)) } } Modal.VERSION = '3.3.1' Modal.TRANSITION_DURATION = 300 Modal.BACKDROP_TRANSITION_DURATION = 150 Modal.DEFAULTS = { backdrop: true, keyboard: true, show: true } Modal.prototype.toggle = function (_relatedTarget) { return this.isShown ? this.hide() : this.show(_relatedTarget) } Modal.prototype.show = function (_relatedTarget) { var that = this var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget }) this.$element.trigger(e) if (this.isShown || e.isDefaultPrevented()) return this.isShown = true this.checkScrollbar() this.setScrollbar() this.$body.addClass('modal-open') this.escape() this.resize() this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) this.backdrop(function () { var transition = $.support.transition && that.$element.hasClass('fade') if (!that.$element.parent().length) { that.$element.appendTo(that.$body) // don't move modals dom position } that.$element .show() .scrollTop(0) if (that.options.backdrop) that.adjustBackdrop() that.adjustDialog() if (transition) { that.$element[0].offsetWidth // force reflow } that.$element .addClass('in') .attr('aria-hidden', false) that.enforceFocus() var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }) transition ? that.$element.find('.modal-dialog') // wait for modal to slide in .one('bsTransitionEnd', function () { that.$element.trigger('focus').trigger(e) }) .emulateTransitionEnd(Modal.TRANSITION_DURATION) : that.$element.trigger('focus').trigger(e) }) } Modal.prototype.hide = function (e) { if (e) e.preventDefault() e = $.Event('hide.bs.modal') this.$element.trigger(e) if (!this.isShown || e.isDefaultPrevented()) return this.isShown = false this.escape() this.resize() $(document).off('focusin.bs.modal') this.$element .removeClass('in') .attr('aria-hidden', true) .off('click.dismiss.bs.modal') $.support.transition && this.$element.hasClass('fade') ? this.$element .one('bsTransitionEnd', $.proxy(this.hideModal, this)) .emulateTransitionEnd(Modal.TRANSITION_DURATION) : this.hideModal() } Modal.prototype.enforceFocus = function () { $(document) .off('focusin.bs.modal') // guard against infinite focus loop .on('focusin.bs.modal', $.proxy(function (e) { if (this.$element[0] !== e.target && !this.$element.has(e.target).length) { this.$element.trigger('focus') } }, this)) } Modal.prototype.escape = function () { if (this.isShown && this.options.keyboard) { this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) { e.which == 27 && this.hide() }, this)) } else if (!this.isShown) { this.$element.off('keydown.dismiss.bs.modal') } } Modal.prototype.resize = function () { if (this.isShown) { $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this)) } else { $(window).off('resize.bs.modal') } } Modal.prototype.hideModal = function () { var that = this this.$element.hide() this.backdrop(function () { that.$body.removeClass('modal-open') that.resetAdjustments() that.resetScrollbar() that.$element.trigger('hidden.bs.modal') }) } Modal.prototype.removeBackdrop = function () { this.$backdrop && this.$backdrop.remove() this.$backdrop = null } Modal.prototype.backdrop = function (callback) { var that = this var animate = this.$element.hasClass('fade') ? 'fade' : '' if (this.isShown && this.options.backdrop) { var doAnimate = $.support.transition && animate this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') .prependTo(this.$element) .on('click.dismiss.bs.modal', $.proxy(function (e) { if (e.target !== e.currentTarget) return this.options.backdrop == 'static' ? this.$element[0].focus.call(this.$element[0]) : this.hide.call(this) }, this)) if (doAnimate) this.$backdrop[0].offsetWidth // force reflow this.$backdrop.addClass('in') if (!callback) return doAnimate ? this.$backdrop .one('bsTransitionEnd', callback) .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : callback() } else if (!this.isShown && this.$backdrop) { this.$backdrop.removeClass('in') var callbackRemove = function () { that.removeBackdrop() callback && callback() } $.support.transition && this.$element.hasClass('fade') ? this.$backdrop .one('bsTransitionEnd', callbackRemove) .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : callbackRemove() } else if (callback) { callback() } } // these following methods are used to handle overflowing modals Modal.prototype.handleUpdate = function () { if (this.options.backdrop) this.adjustBackdrop() this.adjustDialog() } Modal.prototype.adjustBackdrop = function () { this.$backdrop .css('height', 0) .css('height', this.$element[0].scrollHeight) } Modal.prototype.adjustDialog = function () { var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight this.$element.css({ paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '', paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : '' }) } Modal.prototype.resetAdjustments = function () { this.$element.css({ paddingLeft: '', paddingRight: '' }) } Modal.prototype.checkScrollbar = function () { this.bodyIsOverflowing = document.body.scrollHeight > document.documentElement.clientHeight this.scrollbarWidth = this.measureScrollbar() } Modal.prototype.setScrollbar = function () { var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth) } Modal.prototype.resetScrollbar = function () { this.$body.css('padding-right', '') } Modal.prototype.measureScrollbar = function () { // thx walsh var scrollDiv = document.createElement('div') scrollDiv.className = 'modal-scrollbar-measure' this.$body.append(scrollDiv) var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth this.$body[0].removeChild(scrollDiv) return scrollbarWidth } // MODAL PLUGIN DEFINITION // ======================= function Plugin(option, _relatedTarget) { return this.each(function () { var $this = $(this) var data = $this.data('bs.modal') var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option) if (!data) $this.data('bs.modal', (data = new Modal(this, options))) if (typeof option == 'string') data[option](_relatedTarget) else if (options.show) data.show(_relatedTarget) }) } var old = $.fn.modal $.fn.modal = Plugin $.fn.modal.Constructor = Modal // MODAL NO CONFLICT // ================= $.fn.modal.noConflict = function () { $.fn.modal = old return this } // MODAL DATA-API // ============== $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) { var $this = $(this) var href = $this.attr('href') var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7 var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) if ($this.is('a')) e.preventDefault() $target.one('show.bs.modal', function (showEvent) { if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown $target.one('hidden.bs.modal', function () { $this.is(':visible') && $this.trigger('focus') }) }) Plugin.call($target, option, this) }) }(jQuery); ;/* ======================================================================== * Bootstrap: tooltip.js v3.3.1 * http://getbootstrap.com/javascript/#tooltip * Inspired by the original jQuery.tipsy by Jason Frame * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // TOOLTIP PUBLIC CLASS DEFINITION // =============================== var Tooltip = function (element, options) { this.type = this.options = this.enabled = this.timeout = this.hoverState = this.$element = null this.init('tooltip', element, options) } Tooltip.VERSION = '3.3.1' Tooltip.TRANSITION_DURATION = 150 Tooltip.DEFAULTS = { animation: true, placement: 'top', selector: false, template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>', trigger: 'hover focus', title: '', delay: 0, html: false, container: false, viewport: { selector: 'body', padding: 0 } } Tooltip.prototype.init = function (type, element, options) { this.enabled = true this.type = type this.$element = $(element) this.options = this.getOptions(options) this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport) var triggers = this.options.trigger.split(' ') for (var i = triggers.length; i--;) { var trigger = triggers[i] if (trigger == 'click') { this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) } else if (trigger != 'manual') { var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin' var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout' this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) } } this.options.selector ? (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : this.fixTitle() } Tooltip.prototype.getDefaults = function () { return Tooltip.DEFAULTS } Tooltip.prototype.getOptions = function (options) { options = $.extend({}, this.getDefaults(), this.$element.data(), options) if (options.delay && typeof options.delay == 'number') { options.delay = { show: options.delay, hide: options.delay } } return options } Tooltip.prototype.getDelegateOptions = function () { var options = {} var defaults = this.getDefaults() this._options && $.each(this._options, function (key, value) { if (defaults[key] != value) options[key] = value }) return options } Tooltip.prototype.enter = function (obj) { var self = obj instanceof this.constructor ? obj : $(obj.currentTarget).data('bs.' + this.type) if (self && self.$tip && self.$tip.is(':visible')) { self.hoverState = 'in' return } if (!self) { self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) $(obj.currentTarget).data('bs.' + this.type, self) } clearTimeout(self.timeout) self.hoverState = 'in' if (!self.options.delay || !self.options.delay.show) return self.show() self.timeout = setTimeout(function () { if (self.hoverState == 'in') self.show() }, self.options.delay.show) } Tooltip.prototype.leave = function (obj) { var self = obj instanceof this.constructor ? obj : $(obj.currentTarget).data('bs.' + this.type) if (!self) { self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) $(obj.currentTarget).data('bs.' + this.type, self) } clearTimeout(self.timeout) self.hoverState = 'out' if (!self.options.delay || !self.options.delay.hide) return self.hide() self.timeout = setTimeout(function () { if (self.hoverState == 'out') self.hide() }, self.options.delay.hide) } Tooltip.prototype.show = function () { var e = $.Event('show.bs.' + this.type) if (this.hasContent() && this.enabled) { this.$element.trigger(e) var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]) if (e.isDefaultPrevented() || !inDom) return var that = this var $tip = this.tip() var tipId = this.getUID(this.type) this.setContent() $tip.attr('id', tipId) this.$element.attr('aria-describedby', tipId) if (this.options.animation) $tip.addClass('fade') var placement = typeof this.options.placement == 'function' ? this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement var autoToken = /\s?auto?\s?/i var autoPlace = autoToken.test(placement) if (autoPlace) placement = placement.replace(autoToken, '') || 'top' $tip .detach() .css({ top: 0, left: 0, display: 'block' }) .addClass(placement) .data('bs.' + this.type, this) this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) var pos = this.getPosition() var actualWidth = $tip[0].offsetWidth var actualHeight = $tip[0].offsetHeight if (autoPlace) { var orgPlacement = placement var $container = this.options.container ? $(this.options.container) : this.$element.parent() var containerDim = this.getPosition($container) placement = placement == 'bottom' && pos.bottom + actualHeight > containerDim.bottom ? 'top' : placement == 'top' && pos.top - actualHeight < containerDim.top ? 'bottom' : placement == 'right' && pos.right + actualWidth > containerDim.width ? 'left' : placement == 'left' && pos.left - actualWidth < containerDim.left ? 'right' : placement $tip .removeClass(orgPlacement) .addClass(placement) } var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) this.applyPlacement(calculatedOffset, placement) var complete = function () { var prevHoverState = that.hoverState that.$element.trigger('shown.bs.' + that.type) that.hoverState = null if (prevHoverState == 'out') that.leave(that) } $.support.transition && this.$tip.hasClass('fade') ? $tip .one('bsTransitionEnd', complete) .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : complete() } } Tooltip.prototype.applyPlacement = function (offset, placement) { var $tip = this.tip() var width = $tip[0].offsetWidth var height = $tip[0].offsetHeight // manually read margins because getBoundingClientRect includes difference var marginTop = parseInt($tip.css('margin-top'), 10) var marginLeft = parseInt($tip.css('margin-left'), 10) // we must check for NaN for ie 8/9 if (isNaN(marginTop)) marginTop = 0 if (isNaN(marginLeft)) marginLeft = 0 offset.top = offset.top + marginTop offset.left = offset.left + marginLeft // $.fn.offset doesn't round pixel values // so we use setOffset directly with our own function B-0 $.offset.setOffset($tip[0], $.extend({ using: function (props) { $tip.css({ top: Math.round(props.top), left: Math.round(props.left) }) } }, offset), 0) $tip.addClass('in') // check to see if placing tip in new offset caused the tip to resize itself var actualWidth = $tip[0].offsetWidth var actualHeight = $tip[0].offsetHeight if (placement == 'top' && actualHeight != height) { offset.top = offset.top + height - actualHeight } var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight) if (delta.left) offset.left += delta.left else offset.top += delta.top var isVertical = /top|bottom/.test(placement) var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight' $tip.offset(offset) this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical) } Tooltip.prototype.replaceArrow = function (delta, dimension, isHorizontal) { this.arrow() .css(isHorizontal ? 'left' : 'top', 50 * (1 - delta / dimension) + '%') .css(isHorizontal ? 'top' : 'left', '') } Tooltip.prototype.setContent = function () { var $tip = this.tip() var title = this.getTitle() $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) $tip.removeClass('fade in top bottom left right') } Tooltip.prototype.hide = function (callback) { var that = this var $tip = this.tip() var e = $.Event('hide.bs.' + this.type) function complete() { if (that.hoverState != 'in') $tip.detach() that.$element .removeAttr('aria-describedby') .trigger('hidden.bs.' + that.type) callback && callback() } this.$element.trigger(e) if (e.isDefaultPrevented()) return $tip.removeClass('in') $.support.transition && this.$tip.hasClass('fade') ? $tip .one('bsTransitionEnd', complete) .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : complete() this.hoverState = null return this } Tooltip.prototype.fixTitle = function () { var $e = this.$element if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') { $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') } } Tooltip.prototype.hasContent = function () { return this.getTitle() } Tooltip.prototype.getPosition = function ($element) { $element = $element || this.$element var el = $element[0] var isBody = el.tagName == 'BODY' var elRect = el.getBoundingClientRect() if (elRect.width == null) { // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093 elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top }) } var elOffset = isBody ? { top: 0, left: 0 } : $element.offset() var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() } var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null return $.extend({}, elRect, scroll, outerDims, elOffset) } Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } } Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) { var delta = { top: 0, left: 0 } if (!this.$viewport) return delta var viewportPadding = this.options.viewport && this.options.viewport.padding || 0 var viewportDimensions = this.getPosition(this.$viewport) if (/right|left/.test(placement)) { var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight if (topEdgeOffset < viewportDimensions.top) { // top overflow delta.top = viewportDimensions.top - topEdgeOffset } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset } } else { var leftEdgeOffset = pos.left - viewportPadding var rightEdgeOffset = pos.left + viewportPadding + actualWidth if (leftEdgeOffset < viewportDimensions.left) { // left overflow delta.left = viewportDimensions.left - leftEdgeOffset } else if (rightEdgeOffset > viewportDimensions.width) { // right overflow delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset } } return delta } Tooltip.prototype.getTitle = function () { var title var $e = this.$element var o = this.options title = $e.attr('data-original-title') || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) return title } Tooltip.prototype.getUID = function (prefix) { do prefix += ~~(Math.random() * 1000000) while (document.getElementById(prefix)) return prefix } Tooltip.prototype.tip = function () { return (this.$tip = this.$tip || $(this.options.template)) } Tooltip.prototype.arrow = function () { return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')) } Tooltip.prototype.enable = function () { this.enabled = true } Tooltip.prototype.disable = function () { this.enabled = false } Tooltip.prototype.toggleEnabled = function () { this.enabled = !this.enabled } Tooltip.prototype.toggle = function (e) { var self = this if (e) { self = $(e.currentTarget).data('bs.' + this.type) if (!self) { self = new this.constructor(e.currentTarget, this.getDelegateOptions()) $(e.currentTarget).data('bs.' + this.type, self) } } self.tip().hasClass('in') ? self.leave(self) : self.enter(self) } Tooltip.prototype.destroy = function () { var that = this clearTimeout(this.timeout) this.hide(function () { that.$element.off('.' + that.type).removeData('bs.' + that.type) }) } // TOOLTIP PLUGIN DEFINITION // ========================= function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.tooltip') var options = typeof option == 'object' && option var selector = options && options.selector if (!data && option == 'destroy') return if (selector) { if (!data) $this.data('bs.tooltip', (data = {})) if (!data[selector]) data[selector] = new Tooltip(this, options) } else { if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) } if (typeof option == 'string') data[option]() }) } var old = $.fn.tooltip $.fn.tooltip = Plugin $.fn.tooltip.Constructor = Tooltip // TOOLTIP NO CONFLICT // =================== $.fn.tooltip.noConflict = function () { $.fn.tooltip = old return this } }(jQuery); ;/* ======================================================================== * Bootstrap: popover.js v3.3.1 * http://getbootstrap.com/javascript/#popovers * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // POPOVER PUBLIC CLASS DEFINITION // =============================== var Popover = function (element, options) { this.init('popover', element, options) } if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') Popover.VERSION = '3.3.1' Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, { placement: 'right', trigger: 'click', content: '', template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' }) // NOTE: POPOVER EXTENDS tooltip.js // ================================ Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype) Popover.prototype.constructor = Popover Popover.prototype.getDefaults = function () { return Popover.DEFAULTS } Popover.prototype.setContent = function () { var $tip = this.tip() var title = this.getTitle() var content = this.getContent() $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text' ](content) $tip.removeClass('fade top bottom left right in') // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do // this manually by checking the contents. if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide() } Popover.prototype.hasContent = function () { return this.getTitle() || this.getContent() } Popover.prototype.getContent = function () { var $e = this.$element var o = this.options return $e.attr('data-content') || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content) } Popover.prototype.arrow = function () { return (this.$arrow = this.$arrow || this.tip().find('.arrow')) } Popover.prototype.tip = function () { if (!this.$tip) this.$tip = $(this.options.template) return this.$tip } // POPOVER PLUGIN DEFINITION // ========================= function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.popover') var options = typeof option == 'object' && option var selector = options && options.selector if (!data && option == 'destroy') return if (selector) { if (!data) $this.data('bs.popover', (data = {})) if (!data[selector]) data[selector] = new Popover(this, options) } else { if (!data) $this.data('bs.popover', (data = new Popover(this, options))) } if (typeof option == 'string') data[option]() }) } var old = $.fn.popover $.fn.popover = Plugin $.fn.popover.Constructor = Popover // POPOVER NO CONFLICT // =================== $.fn.popover.noConflict = function () { $.fn.popover = old return this } }(jQuery); ;/* ======================================================================== * Bootstrap: scrollspy.js v3.3.1 * http://getbootstrap.com/javascript/#scrollspy * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // SCROLLSPY CLASS DEFINITION // ========================== function ScrollSpy(element, options) { var process = $.proxy(this.process, this) this.$body = $('body') this.$scrollElement = $(element).is('body') ? $(window) : $(element) this.options = $.extend({}, ScrollSpy.DEFAULTS, options) this.selector = (this.options.target || '') + ' .nav li > a' this.offsets = [] this.targets = [] this.activeTarget = null this.scrollHeight = 0 this.$scrollElement.on('scroll.bs.scrollspy', process) this.refresh() this.process() } ScrollSpy.VERSION = '3.3.1' ScrollSpy.DEFAULTS = { offset: 10 } ScrollSpy.prototype.getScrollHeight = function () { return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) } ScrollSpy.prototype.refresh = function () { var offsetMethod = 'offset' var offsetBase = 0 if (!$.isWindow(this.$scrollElement[0])) { offsetMethod = 'position' offsetBase = this.$scrollElement.scrollTop() } this.offsets = [] this.targets = [] this.scrollHeight = this.getScrollHeight() var self = this this.$body .find(this.selector) .map(function () { var $el = $(this) var href = $el.data('target') || $el.attr('href') var $href = /^#./.test(href) && $(href) return ($href && $href.length && $href.is(':visible') && [[$href[offsetMethod]().top + offsetBase, href]]) || null }) .sort(function (a, b) { return a[0] - b[0] }) .each(function () { self.offsets.push(this[0]) self.targets.push(this[1]) }) } ScrollSpy.prototype.process = function () { var scrollTop = this.$scrollElement.scrollTop() + this.options.offset var scrollHeight = this.getScrollHeight() var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height() var offsets = this.offsets var targets = this.targets var activeTarget = this.activeTarget var i if (this.scrollHeight != scrollHeight) { this.refresh() } if (scrollTop >= maxScroll) { return activeTarget != (i = targets[targets.length - 1]) && this.activate(i) } if (activeTarget && scrollTop < offsets[0]) { this.activeTarget = null return this.clear() } for (i = offsets.length; i--;) { activeTarget != targets[i] && scrollTop >= offsets[i] && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) && this.activate(targets[i]) } } ScrollSpy.prototype.activate = function (target) { this.activeTarget = target this.clear() var selector = this.selector + '[data-target="' + target + '"],' + this.selector + '[href="' + target + '"]' var active = $(selector) .parents('li') .addClass('active') if (active.parent('.dropdown-menu').length) { active = active .closest('li.dropdown') .addClass('active') } active.trigger('activate.bs.scrollspy') } ScrollSpy.prototype.clear = function () { $(this.selector) .parentsUntil(this.options.target, '.active') .removeClass('active') } // SCROLLSPY PLUGIN DEFINITION // =========================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.scrollspy') var options = typeof option == 'object' && option if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options))) if (typeof option == 'string') data[option]() }) } var old = $.fn.scrollspy $.fn.scrollspy = Plugin $.fn.scrollspy.Constructor = ScrollSpy // SCROLLSPY NO CONFLICT // ===================== $.fn.scrollspy.noConflict = function () { $.fn.scrollspy = old return this } // SCROLLSPY DATA-API // ================== $(window).on('load.bs.scrollspy.data-api', function () { $('[data-spy="scroll"]').each(function () { var $spy = $(this) Plugin.call($spy, $spy.data()) }) }) }(jQuery); ;/* ======================================================================== * Bootstrap: tab.js v3.3.1 * http://getbootstrap.com/javascript/#tabs * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // TAB CLASS DEFINITION // ==================== var Tab = function (element) { this.element = $(element) } Tab.VERSION = '3.3.1' Tab.TRANSITION_DURATION = 150 Tab.prototype.show = function () { var $this = this.element var $ul = $this.closest('ul:not(.dropdown-menu)') var selector = $this.data('target') if (!selector) { selector = $this.attr('href') selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 } if ($this.parent('li').hasClass('active')) return var $previous = $ul.find('.active:last a') var hideEvent = $.Event('hide.bs.tab', { relatedTarget: $this[0] }) var showEvent = $.Event('show.bs.tab', { relatedTarget: $previous[0] }) $previous.trigger(hideEvent) $this.trigger(showEvent) if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return var $target = $(selector) this.activate($this.closest('li'), $ul) this.activate($target, $target.parent(), function () { $previous.trigger({ type: 'hidden.bs.tab', relatedTarget: $this[0] }) $this.trigger({ type: 'shown.bs.tab', relatedTarget: $previous[0] }) }) } Tab.prototype.activate = function (element, container, callback) { var $active = container.find('> .active') var transition = callback && $.support.transition && (($active.length && $active.hasClass('fade')) || !!container.find('> .fade').length) function next() { $active .removeClass('active') .find('> .dropdown-menu > .active') .removeClass('active') .end() .find('[data-toggle="tab"]') .attr('aria-expanded', false) element .addClass('active') .find('[data-toggle="tab"]') .attr('aria-expanded', true) if (transition) { element[0].offsetWidth // reflow for transition element.addClass('in') } else { element.removeClass('fade') } if (element.parent('.dropdown-menu')) { element .closest('li.dropdown') .addClass('active') .end() .find('[data-toggle="tab"]') .attr('aria-expanded', true) } callback && callback() } $active.length && transition ? $active .one('bsTransitionEnd', next) .emulateTransitionEnd(Tab.TRANSITION_DURATION) : next() $active.removeClass('in') } // TAB PLUGIN DEFINITION // ===================== function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.tab') if (!data) $this.data('bs.tab', (data = new Tab(this))) if (typeof option == 'string') data[option]() }) } var old = $.fn.tab $.fn.tab = Plugin $.fn.tab.Constructor = Tab // TAB NO CONFLICT // =============== $.fn.tab.noConflict = function () { $.fn.tab = old return this } // TAB DATA-API // ============ var clickHandler = function (e) { e.preventDefault() Plugin.call($(this), 'show') } $(document) .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler) .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler) }(jQuery); ;/* ======================================================================== * Bootstrap: affix.js v3.3.1 * http://getbootstrap.com/javascript/#affix * ======================================================================== * Copyright 2011-2014 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * ======================================================================== */ +function ($) { 'use strict'; // AFFIX CLASS DEFINITION // ====================== var Affix = function (element, options) { this.options = $.extend({}, Affix.DEFAULTS, options) this.$target = $(this.options.target) .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)) this.$element = $(element) this.affixed = this.unpin = this.pinnedOffset = null this.checkPosition() } Affix.VERSION = '3.3.1' Affix.RESET = 'affix affix-top affix-bottom' Affix.DEFAULTS = { offset: 0, target: window } Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) { var scrollTop = this.$target.scrollTop() var position = this.$element.offset() var targetHeight = this.$target.height() if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false if (this.affixed == 'bottom') { if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom' return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom' } var initializing = this.affixed == null var colliderTop = initializing ? scrollTop : position.top var colliderHeight = initializing ? targetHeight : height if (offsetTop != null && colliderTop <= offsetTop) return 'top' if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom' return false } Affix.prototype.getPinnedOffset = function () { if (this.pinnedOffset) return this.pinnedOffset this.$element.removeClass(Affix.RESET).addClass('affix') var scrollTop = this.$target.scrollTop() var position = this.$element.offset() return (this.pinnedOffset = position.top - scrollTop) } Affix.prototype.checkPositionWithEventLoop = function () { setTimeout($.proxy(this.checkPosition, this), 1) } Affix.prototype.checkPosition = function () { if (!this.$element.is(':visible')) return var height = this.$element.height() var offset = this.options.offset var offsetTop = offset.top var offsetBottom = offset.bottom var scrollHeight = $('body').height() if (typeof offset != 'object') offsetBottom = offsetTop = offset if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element) if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element) var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom) if (this.affixed != affix) { if (this.unpin != null) this.$element.css('top', '') var affixType = 'affix' + (affix ? '-' + affix : '') var e = $.Event(affixType + '.bs.affix') this.$element.trigger(e) if (e.isDefaultPrevented()) return this.affixed = affix this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null this.$element .removeClass(Affix.RESET) .addClass(affixType) .trigger(affixType.replace('affix', 'affixed') + '.bs.affix') } if (affix == 'bottom') { this.$element.offset({ top: scrollHeight - height - offsetBottom }) } } // AFFIX PLUGIN DEFINITION // ======================= function Plugin(option) { return this.each(function () { var $this = $(this) var data = $this.data('bs.affix') var options = typeof option == 'object' && option if (!data) $this.data('bs.affix', (data = new Affix(this, options))) if (typeof option == 'string') data[option]() }) } var old = $.fn.affix $.fn.affix = Plugin $.fn.affix.Constructor = Affix // AFFIX NO CONFLICT // ================= $.fn.affix.noConflict = function () { $.fn.affix = old return this } // AFFIX DATA-API // ============== $(window).on('load', function () { $('[data-spy="affix"]').each(function () { var $spy = $(this) var data = $spy.data() data.offset = data.offset || {} if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom if (data.offsetTop != null) data.offset.top = data.offsetTop Plugin.call($spy, data) }) }) }(jQuery); ;/* ======================================================================== * DOM-based Routing * Based on http://goo.gl/EUTi53 by Paul Irish * * Only fires on body classes that match. If a body class contains a dash, * replace the dash with an underscore when adding it to the object below. * * .noConflict() * The routing is enclosed within an anonymous function so that you can * always reference jQuery with $, even when in .noConflict() mode. * * Google CDN, Latest jQuery * To use the default WordPress version of jQuery, go to lib/config.php and * remove or comment out: add_theme_support('jquery-cdn'); * ======================================================================== */ (function($) { // Use this variable to set up the common and page specific functions. If you // rename this variable, you will also need to rename the namespace below. var Roots = { // All pages common: { init: function() { // JavaScript to be fired on all pages } }, // Home page home: { init: function() { // JavaScript to be fired on the home page } }, // About us page, note the change from about-us to about_us. about_us: { init: function() { // JavaScript to be fired on the about us page } } }; // The routing fires all common scripts, followed by the page specific scripts. // Add additional events for more control over timing e.g. a finalize event var UTIL = { fire: function(func, funcname, args) { var namespace = Roots; funcname = (funcname === undefined) ? 'init' : funcname; if (func !== '' && namespace[func] && typeof namespace[func][funcname] === 'function') { namespace[func][funcname](args); } }, loadEvents: function() { UTIL.fire('common'); $.each(document.body.className.replace(/-/g, '_').split(/\s+/),function(i,classnm) { UTIL.fire(classnm); }); } }; $(document).ready(UTIL.loadEvents); })(jQuery); // Fully reference jQuery after this point.
import axios from 'src/utils/axios'; import { handleResponse } from '../helpers/handleResponse'; import { handleError } from '../helpers/handleError'; export const subCategoryService = { findAll, findAllByCategory, findById, }; function findAll() { return axios.get('/subcategories/') .catch(handleError) .then(handleResponse); } function findAllByCategory(categoryId) { return axios.get(`/subcategories/?categoryId=${categoryId}`) .catch(handleError) .then(handleResponse); } function findById(id) { return axios.get(`/subcategories/${id}`) .catch(handleError) .then(handleResponse); }
//Dependencies import React, { useState, useEffect, useContext } from "react"; import { Link } from "react-router-dom"; import MDEditor from "@uiw/react-md-editor"; import api from "../../../apis/pagesApi"; import { AuthContext } from "../../../contexts/authContext"; //Styled Components import { Container, Fix, Button, Title, Tag, TagQueue, FixHTML, } from "./NoteStyles/page"; function Page(props) { useContext(AuthContext); //State para armazenar e fazer o render do conteúdo const [file, setFile] = useState({ _id: "", title: "", text: "", tags: [""], }); //Buscando o path(Caminho) da url para retirar o Id const { id } = props.match.params; useEffect(() => { async function Text() { try { const response = await api.get(`/pages/${id}`); setFile({ ...response.data }); } catch (err) { console.error(err); } } Text(); }, [id]); return ( <> <FixHTML></FixHTML> <Container> <Fix> <header> <Title>{file.title}</Title> <Tag> {file.tags.map((file, i) => { return <TagQueue key={i}>{file}</TagQueue>; })} </Tag> </header> <MDEditor.Markdown source={file.text} /> <Link to={`/pages/edit/${id}`} // onClick={OpenSearch} style={{ width: "100%", display: "flex", justifyContent: "center" }} > <Button>Edit Note</Button> </Link> </Fix> </Container> </> ); } export default Page;
module.exports="3.1.0";
var micromarkdown={useajax:!1,regexobject:{headline:/^(\#{1,6})([^\#\n]+)$/m,code:/\s\`\`\`\n?([^`]+)\`\`\`/g,hr:/^(?:([\*\-_] ?)+)\1\1$/gm,lists:/^((\s*((\*|\-)|\d(\.|\))) [^\n]+)\n)+/gm,bolditalic:/(?:([\*_~]{1,3}))([^\*_~\n]+[^\*_~\s])\1/g,links:/!?\[([^\]<>]+)\]\(([^ \)<>]+)( "[^\(\)\"]+")?\)/g,reflinks:/\[([^\]]+)\]\[([^\]]+)\]/g,smlinks:/\@([a-z0-9]{3,})\@(t|gh|fb|gp|adn)/gi,mail:/<(([a-z0-9_\-\.])+\@([a-z0-9_\-\.])+\.([a-z]{2,7}))>/gim,tables:/\n(([^|\n]+ *\| *)+([^|\n]+\n))((:?\-+:?\|)+(:?\-+:?)*\n)((([^|\n]+ *\| *)+([^|\n]+)\n)+)/g,include:/[\[<]include (\S+) from (https?:\/\/[a-z0-9\.\-]+\.[a-z]{2,9}[a-z0-9\.\-\?\&\/]+)[\]>]/gi,url:/<([a-zA-Z0-9@:%_\+.~#?&\/\/=]{2,256}\.[a-z]{2,4}\b(\/[\-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)?)>/g},parse:function(e,t){"use strict";var r,n,l,o,c,a,i,s,m,d,g,u=0,p=[],h=0,f=0,b=0;for(e="\n"+e+"\n",!0!==t&&(micromarkdown.regexobject.lists=/^((\s*(\*|\d\.) [^\n]+)\n)+/gm);null!==(g=micromarkdown.regexobject.code.exec(e));)e=e.replace(g[0],"<code>\n"+g[1].replace(/\n/gm,"<br/>")+"</code>\n");for(;null!==(g=micromarkdown.regexobject.headline.exec(e));)m=g[1].length,e=e.replace(g[0],"<h"+m+">"+g[2]+"</h"+m+">\n");for(;null!==(g=micromarkdown.regexobject.lists.exec(e));){for(h=0,d="*"===g[0].trim().substr(0,1)||"-"===g[0].trim().substr(0,1)?"<ul>":"<ol>",a=g[0].split("\n"),i=[],n=0,c=!1,f=0;f<a.length;f++)if(null!==(r=/^((\s*)((\*|\-)|\d(\.|\))) ([^\n]+))/.exec(a[f]))){for(void 0===r[2]||0===r[2].length?u=0:(!1===c&&(c=r[2].replace(/\t/," ").length),u=Math.round(r[2].replace(/\t/," ").length/c));n>u;)d+=i.pop(),n--,h--;for(;n<u;)"*"===r[0].trim().substr(0,1)||"-"===r[0].trim().substr(0,1)?(d+="<ul>",i.push("</ul>")):(d+="<ol>",i.push("</ol>")),n++,h++;d+="<li>"+r[6]+"</li>\n"}for(;h>0;)d+="</ul>",h--;"*"===g[0].trim().substr(0,1)||"-"===g[0].trim().substr(0,1)?d+="</ul>":d+="</ol>",e=e.replace(g[0],d+"\n")}for(;null!==(g=micromarkdown.regexobject.tables.exec(e));){for(d="<table><tr>",a=g[1].split("|"),o=g[4].split("|"),f=0;f<a.length;f++)o.length<=f?o.push(0):":"===o[f].trimRight().slice(-1)&&!0!==t?":"===o[f][0]?o[f]=3:o[f]=2:!0!==t&&":"===o[f][0]?o[f]=1:o[f]=0;for(l=["<th>",'<th align="left">','<th align="right">','<th align="center">'],f=0;f<a.length;f++)d+=l[o[f]]+a[f].trim()+"</th>";for(d+="</tr>",l=["<td>",'<td align="left">','<td align="right">','<td align="center">'],i=g[7].split("\n"),f=0;f<i.length;f++)if(0!==(s=i[f].split("|"))[0].length){for(;o.length<s.length;)o.push(0);for(d+="<tr>",b=0;b<s.length;b++)d+=l[o[b]]+s[b].trim()+"</td>";d+="</tr>\n"}d+="</table>",e=e.replace(g[0],d)}for(f=0;f<3;f++)for(;null!==(g=micromarkdown.regexobject.bolditalic.exec(e));)if(d=[],"~~"===g[1])e=e.replace(g[0],"<del>"+g[2]+"</del>");else if("__"===g[1])e=e.replace(g[0],"<u>"+g[2]+"</u>");else{switch(g[1].length){case 1:d=["<i>","</i>"];break;case 2:d=["<b>","</b>"];break;case 3:d=["<i><b>","</b></i>"]}e=e.replace(g[0],d[0]+g[2]+d[1])}for(;null!==(g=micromarkdown.regexobject.links.exec(e));)e="!"===g[0].substr(0,1)?e.replace(g[0],'<img src="assets/img/sdc_leak_image.jpg" onclick="confirmConversationShowImage(this)" data-src="'+g[2]+'" alt="'+g[1]+'" title="'+g[1]+'" />\n'):e.replace(g[0],"<a "+micromarkdown.mmdCSSclass(g[2],t)+'onclick="return confirmConversationOpenLink()" target="_blank" href="'+g[2]+'">'+g[1]+"</a>\n");for(;null!==(g=micromarkdown.regexobject.mail.exec(e));)e=e.replace(g[0],'<a href="mailto:'+g[1]+'">'+g[1]+"</a>");for(;null!==(g=micromarkdown.regexobject.url.exec(e));)-1===(d=g[1]).indexOf("://")&&(d="http://"+d),e=e.replace(g[0],"<a "+micromarkdown.mmdCSSclass(d,t)+'href="'+d+'">'+d.replace(/(https:\/\/|http:\/\/|mailto:|ftp:\/\/)/gim,"")+"</a>");for(;null!==(g=micromarkdown.regexobject.reflinks.exec(e));)null!==(a=(i=new RegExp("\\["+g[2]+"\\]: ?([^ \n]+)","gi")).exec(e))&&(e=e.replace(g[0],"<a "+micromarkdown.mmdCSSclass(a[1],t)+'href="'+a[1]+'">'+g[1]+"</a>"),p.push(a[0]));for(f=0;f<p.length;f++)e=e.replace(p[f],"");for(;null!==(g=micromarkdown.regexobject.smlinks.exec(e));){switch(g[2]){case"t":d="https://twitter.com/"+g[1];break;case"gh":d="https://github.com/"+g[1];break;case"fb":d="https://www.facebook.com/"+g[1];break;case"gp":d="https://plus.google.com/+"+g[1];break;case"adn":d="https://alpha.app.net/"+g[1]}e=e.replace(g[0],"<a "+micromarkdown.mmdCSSclass(d,t)+'href="'+d+'">'+g[1]+"</a>")}for(;null!==(g=micromarkdown.regexobject.hr.exec(e));)e=e.replace(g[0],"\n<hr/>\n");if(!1!==micromarkdown.useajax&&!0!==t)for(;null!==(g=micromarkdown.regexobject.include.exec(e));)if(a=g[2].replace(/[\.\:\/]+/gm,""),i="",document.getElementById(a)?i=document.getElementById(a).innerHTML.trim():micromarkdown.ajax(g[2]),"csv"===g[1]&&""!==i){for((s={";":[],"\t":[],",":[],"|":[]})[0]=[";","\t",",","|"],i=i.split("\n"),b=0;b<s[0].length;b++)for(f=0;f<i.length;f++)f>0&&!1!==s[s[0][b]]&&(s[s[0][b]][f]===s[s[0][b]][f-1]&&1!==s[s[0][b]][f]||(s[s[0][b]]=!1));if(!1!==s[";"]||!1!==s["\t"]||!1!==s[","]||!1!==s["|"]){for(!1!==s[";"]?s=";":s["\t"]?s="\t":s[","]?s=",":s["|"]&&(s="|"),d="<table>",f=0;f<i.length;f++){for(a=i[f].split(s),d+="<tr>",b=0;b<a.length;b++)d+="<td>"+micromarkdown.htmlEncode(a[b])+"</td>";d+="</tr>"}d+="</table>",e=e.replace(g[0],d)}else e=e.replace(g[0],"<code>"+i.join("\n")+"</code>")}else e=e.replace(g[0],"");return e},ajax:function(e){"use strict";var t;if(document.getElementById(e.replace(/[\.\:\/]+/gm,"")))return!1;if(window.ActiveXObject)try{t=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return t=null,e}else t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===t.readyState){var r=document.createElement("code");r.innerHTML=t.responseText,r.id=e.replace(/[\.\:\/]+/gm,""),r.style.display="none",document.getElementsByTagName("body")[0].appendChild(r),micromarkdown.useajax()}},t.open("GET",e,!0),t.setRequestHeader("Content-type","application/x-www-form-urlencoded"),t.send()},countingChars:function(e,t){"use strict";return"object"==typeof(e=e.split(t))?e.length-1:0},htmlEncode:function(e){"use strict";var t=document.createElement("div");return t.appendChild(document.createTextNode(e)),e=t.innerHTML,t=void 0,e},mmdCSSclass:function(e,t){"use strict";var r;return-1!==e.indexOf("/")&&!0!==t?(r=e.split("/"),'class="mmd_'+(r=0===r[1].length?r[2].split("."):r[0].split("."))[r.length-2].replace(/[^\w\d]/g,"")+r[r.length-1]+'" '):""}};!function(e,t){"use strict";"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():e.returnExports=t()}(this,function(){"use strict";return micromarkdown});
import Mock from 'mockjs' // const random = Mock.Random // 装配计划编制 const planData = function() { // const deliver = random.date() // const datePlan = '2020-06-30' return Mock.mock({ 'model|3': [{ type: 'AG' + '@integer(6, 9)' + '00', 'batches|+1': 2001, time: '@date', deliverTime: function() { if (this.batches === 2001) { return '2020-' + '03-20' } else if (this.batches === 2002) { return '2020-' + '04-20' } else { return '2020-' + '05-20' } }, 'state|1': ['已下达', '已生成'] }], planPreData1: [ { standerd: '31', startTime: '2020-03-01', endTime: '2020-04-01', timeOut: '是', planStartTime: '2020-03-01', planEndTime: '2020-04-01', state: '已生成', AONum: '62', show: true }, { standerd: '41', startTime: '2020-04-02', endTime: '2020-05-02', timeOut: '是', planStartTime: '2020-04-02', planEndTime: '2020-05-02', state: '已生成', AONum: '99', show: true }, { standerd: '51', startTime: '2020-04-03', endTime: '2020-05-03', timeOut: '否', planStartTime: '2020-04-03', planEndTime: '2020-05-03', state: '已生成', AONum: '120', show: true }, { standerd: '52', startTime: '2020-05-04', endTime: '2020-06-04', timeOut: '否', planStartTime: '2020-05-04', planEndTime: '2020-06-04', state: '已生成', AONum: '150', show: true }, { standerd: '53', startTime: '2020-06-05', endTime: '2020-07-05', timeOut: '是', planStartTime: '2020-06-05', planEndTime: '2020-07-05', state: '已生成', AONum: '200', show: true }, { standerd: '54', startTime: '2020-07-06', endTime: '2020-08-06', timeOut: '否', planStartTime: '2020-07-06', planEndTime: '2020-08-06', state: '已生成', AONum: '300', show: true } ], planPreData2: [ { standerd: '31', startTime: '2020-03-02', endTime: '2020-04-02', timeOut: '是', planStartTime: '2020-03-02', planEndTime: '2020-04-02', state: '已生成', AONum: '63', show: true }, { standerd: '41', startTime: '2020-04-03', endTime: '2020-05-03', timeOut: '否', planStartTime: '2020-04-03', planEndTime: '2020-05-03', state: '已生成', AONum: '100', show: true }, { standerd: '51', startTime: '2020-05-04', endTime: '2020-06-04', timeOut: '否', planStartTime: '2020-05-04', planEndTime: '2020-06-04', state: '已生成', AONum: '121', show: true }, { standerd: '52', startTime: '2020-06-05', endTime: '2020-07-05', timeOut: '否', planStartTime: '2020-06-05', planEndTime: '2020-07-05', state: '已生成', AONum: '151', show: true }, { standerd: '53', startTime: '2020-07-06', endTime: '2020-08-06', timeOut: '是', planStartTime: '2020-07-06', planEndTime: '2020-08-06', state: '已生成', AONum: '201', show: true }, { standerd: '54', startTime: '2020-08-07', endTime: '2020-09-07', timeOut: '否', planStartTime: '2020-08-07', planEndTime: '2020-09-07', state: '已生成', AONum: '299', show: true } ], planPreData3: [ { standerd: '31', startTime: '2020-03-03', endTime: '2020-04-03', timeOut: '是', planStartTime: '2020-03-03', planEndTime: '2020-04-03', state: '已生成', AONum: '64', show: true }, { standerd: '41', startTime: '2020-04-04', endTime: '2020-05-04', timeOut: '否', planStartTime: '2020-04-04', planEndTime: '2020-05-04', state: '已生成', AONum: '101', show: true }, { standerd: '51', startTime: '2020-05-05', endTime: '2020-06-05', timeOut: '否', planStartTime: '2020-05-05', planEndTime: '2020-06-05', state: '已生成', AONum: '122', show: true }, { standerd: '52', startTime: '2020-06-06', endTime: '2020-07-06', timeOut: '否', planStartTime: '2020-06-06', planEndTime: '2020-07-06', state: '已生成', AONum: '153', show: true }, { standerd: '53', startTime: '2020-07-07', endTime: '2020-08-07', timeOut: '否', planStartTime: '2020-07-07', planEndTime: '2020-08-07', state: '已生成', AONum: '203', show: true }, { standerd: '54', startTime: '2020-08-08', endTime: '2020-09-08', timeOut: '否', planStartTime: '2020-08-08', planEndTime: '2020-09-08', state: '已生成', AONum: '297', show: true } ] // 'standing|6': [{ // 'stand|+1': 51, // time: '@date', // ptime: '@date', // 'timeConnect|+1': 1, // 'timeAfterConnet|+1': 7, // 'datConnect|+1': '@integer(10, 25)', // planStart: function() { // if (this.sort === 51) { // return '2020-' + '03-01' // } else if (this.sort === 52) { // return '2020-' + '04-01' // } else { // return '2020-' + '05-01' // } // }, // planEnd: function() { // if (this.sort === 51) { // return '2020-' + '04-01' // } else if (this.sort === 52) { // return '2020-' + '04-01' // } else { // return '2020-' + '05-01' // } // }, // 'state|1': ['已下达', '已生成'] // }] }) } export default [ { url: '/cmm/mating/plan', type: 'get', response: config => { const data = planData return { status: 200, data: { items: data } } } } ]
require('../spec_helper') const cp = require('child_process') const fse = require('fs-extra') const os = require('os') const path = require('path') const _ = require('lodash') const { it, after, before, beforeEach, describe } = require('mocha') const { expect } = require('chai') const debug = require('debug')('test:proxy-performance') const DebuggingProxy = require('@cypress/debugging-proxy') const HarCapturer = require('chrome-har-capturer') const performance = require('../support/helpers/performance') const Promise = require('bluebird') const sanitizeFilename = require('sanitize-filename') process.env.CYPRESS_ENV = 'development' const CA = require('@packages/https-proxy').CA const Config = require('../../lib/config') const Server = require('../../lib/server') const { _getArgs } = require('../../lib/browsers/chrome') const CHROME_PATH = 'google-chrome' const URLS_UNDER_TEST = [ 'https://test-page-speed.cypress.io/index1000.html', 'http://test-page-speed.cypress.io/index1000.html', ] const start = (new Date()) / 1000 const PROXY_PORT = process.env.PROXY_PORT || 45678 const HTTPS_PROXY_PORT = process.env.HTTPS_PROXY_PORT || 45681 const CDP_PORT = 45679 /** port range starts here, not the actual port */ const CY_PROXY_PORT = 45680 const TEST_CASES = [ // these first 4 cases don't involve Cypress, don't need to run every time // { // name: 'Chrome w/o HTTP/2', // disableHttp2: true, // }, // { // name: 'Chrome', // }, // { // name: 'With proxy', // upstreamProxy: true, // }, // { // name: 'With HTTPS proxy', // httpsUpstreamProxy: true, // }, // baseline test that all other tests are compared to { name: 'Chrome w/ proxy w/o HTTP/2 (baseline)', disableHttp2: true, upstreamProxy: true, }, { name: 'With Cypress proxy, Intercepted', cyProxy: true, cyIntercept: true, }, { name: 'With Cypress proxy, Not Intercepted', cyProxy: true, }, { name: 'With Cypress proxy w/o HTTP/2, Not Intercepted', cyProxy: true, disableHttp2: true, }, { name: 'With Cypress proxy and upstream, Intercepted', cyProxy: true, upstreamProxy: true, cyIntercept: true, }, { name: 'With Cypress proxy and HTTPS upstream, Intercepted', cyProxy: true, httpsUpstreamProxy: true, cyIntercept: true, }, { name: 'With Cypress proxy and upstream, Not Intercepted', cyProxy: true, upstreamProxy: true, }, { name: 'With Cypress proxy and HTTPS upstream, Not Intercepted', cyProxy: true, httpsUpstreamProxy: true, }, ].map((v) => { // fill in all the fields so the keys are in the correct order for readability return _.defaults(v, { disableHttp2: false, upstreamProxy: false, httpsUpstreamProxy: false, cyProxy: false, cyIntercept: false, }) }) const average = (arr) => { return _.sum(arr) / arr.length } const percentile = (sortedArr, p) => { const i = Math.floor(p / 100 * sortedArr.length - 1) return Math.round(sortedArr[i]) } const getResultsFromHar = (har) => { // HAR 1.2 Spec: http://www.softwareishard.com/blog/har-12-spec/ const { entries } = har.log const results = {} const first = entries[0] const last = entries[entries.length - 1] const elapsed = Number(new Date(last.startedDateTime)) + last.time - Number(new Date(first.startedDateTime)) results['Total'] = Math.round(elapsed) let mins = {} let maxes = {} const timings = { 'receive': [], 'wait': [], 'send': [], 'total': [], } entries.forEach((entry) => { const blockedTime = _.get(entry.timings, 'blocked', -1) === -1 ? 0 : entry.timings.blocked const totalTime = entry.time - blockedTime timings.total.push(totalTime) Object.keys(entry.timings).forEach((timingKey) => { if (entry.timings[timingKey] === -1 || !entry.timings[timingKey]) return const ms = Math.round(entry.timings[timingKey]) if (timings[timingKey]) timings[timingKey].push(ms) }) }) for (const key in timings) { const arr = timings[key] arr.sort((a, b) => { return a - b }) mins[key] = Math.round(arr[0]) maxes[key] = Math.round(arr[arr.length - 1]) _.merge(results, { [`Avg ${_.upperFirst(key)}`]: Math.round(average(arr)), }) } results['Min'] = mins.total ;[1, 5, 25, 50, 75, 95, 99, 99.7].forEach((p) => { results[`${p}% <=`] = percentile(timings.total, p) }) results['Max'] = maxes.total return results } const runBrowserTest = (urlUnderTest, testCase) => { const cdpPort = CDP_PORT + Math.round(Math.random() * 10000) const browser = { isHeadless: true, } const options = {} const args = _getArgs(browser, options, cdpPort).concat([ // additionally... '--disable-background-networking', '--no-sandbox', // allows us to run as root, for CI `--user-data-dir=${fse.mkdtempSync(path.join(os.tmpdir(), 'cy-perf-'))}`, ]) if (testCase.disableHttp2) { args.push('--disable-http2') } if (testCase.cyProxy) { args.push(`--proxy-server=http://localhost:${CY_PROXY_PORT}`) } if (testCase.upstreamProxy && !testCase.cyProxy) { args.push(`--proxy-server=http://localhost:${PROXY_PORT}`) } else if (testCase.httpsUpstreamProxy && !testCase.cyProxy) { args.push(`--proxy-server=https://localhost:${HTTPS_PROXY_PORT}`) } if (testCase.upstreamProxy && testCase.cyProxy) { process.env.HTTP_PROXY = process.env.HTTPS_PROXY = `http://localhost:${PROXY_PORT}` } else if (testCase.httpsUpstreamProxy && testCase.cyProxy) { process.env.HTTP_PROXY = process.env.HTTPS_PROXY = `https://localhost:${HTTPS_PROXY_PORT}` } else { delete process.env.HTTPS_PROXY delete process.env.HTTP_PROXY } if (testCase.cyIntercept) { cyServer._onDomainSet(urlUnderTest) } else { cyServer._onDomainSet('<root>') } let cmd = CHROME_PATH debug('Launching Chrome: ', cmd, args.join(' ')) const proc = cp.spawn(cmd, args, { stdio: 'ignore', }) const storeHar = Promise.method((name, har) => { const artifacts = process.env.CIRCLE_ARTIFACTS if (artifacts) { return fse.ensureDir(artifacts) .then(() => { const pathToFile = path.join(artifacts, sanitizeFilename(`${name}.har`)) debug('saving har to path:', pathToFile) return fse.writeJson(pathToFile, har) }) } }) const runHar = () => { // wait for Chrome to open, then start capturing return Promise.delay(500).then(() => { debug('Trying to connect to Chrome...') const harCapturer = HarCapturer.run([ urlUnderTest, ], { port: cdpPort, // disable SSL verification on older Chrome versions, copied from the HAR CLI // https://github.com/cyrus-and/chrome-har-capturer/blob/587550508bddc23b7f4b4328c158322be4749298/bin/cli.js#L60 preHook: (_, cdp) => { const { Security } = cdp return Security.enable().then(() => { return Security.setOverrideCertificateErrors({ override: true }) }) .then(() => { return Security.certificateError(({ eventId }) => { debug('EVENT ID', eventId) return Security.handleCertificateError({ eventId, action: 'continue' }) }) }) }, // wait til all data is done before finishing // https://github.com/cyrus-and/chrome-har-capturer/issues/59 postHook: (_, cdp) => { let timeout return new Promise((resolve) => { cdp.on('event', (message) => { if (message.method === 'Network.dataReceived') { // reset timer clearTimeout(timeout) timeout = setTimeout(resolve, 1000) } }) }) }, }) return new Promise((resolve, reject) => { harCapturer.on('fail', (_, err) => { return reject(err) }) harCapturer.on('har', resolve) }) .then((har) => { proc.kill(9) debug('Received HAR from Chrome') const results = getResultsFromHar(har) _.merge(testCase, results) return storeHar(testCase.name, har) .return(results) }) .catch({ code: 'ECONNREFUSED' }, (err) => { // sometimes chrome takes surprisingly long, just reconn debug('Chrome connection failed: ', err) return runHar() }) }) } return runHar() } let cyServer describe('Proxy Performance', function () { this.timeout(60 * 1000) this.retries(3) beforeEach(function () { process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0' nock.enableNetConnect() }) before(function () { return CA.create() .then((ca) => { return ca.generateServerCertificateKeys('localhost') }) .spread((cert, key) => { return Promise.join( new DebuggingProxy().start(PROXY_PORT), new DebuggingProxy({ https: { cert, key }, }).start(HTTPS_PROXY_PORT), Config.set({ projectRoot: '/tmp/a', }).then((config) => { config.port = CY_PROXY_PORT // turn off morgan config.morgan = false cyServer = Server() return cyServer.open(config) }) ) }) }) URLS_UNDER_TEST.map((urlUnderTest) => { const testCases = _.cloneDeep(TEST_CASES) describe(urlUnderTest, function () { let baseline before(function () { // run baseline test return runBrowserTest(urlUnderTest, testCases[0]) .then((runtime) => { debug('baseline runtime is: ', runtime) baseline = runtime }) }) // slice(1) since first test is used as baseline above testCases.slice(1).map((testCase) => { it(`${testCase.name} loads 1000 images, with 75% loading no more than 2x as slow as the slowest baseline request`, function () { debug('Current test: ', testCase.name) return runBrowserTest(urlUnderTest, testCase) .then((results) => { expect(results['75% <=']).to.be.lessThan(baseline['Max'] * 2) }) }) }) after(() => { debug(`Done in ${Math.round((new Date() / 1000) - start)}s`) process.stdout.write('Note: All times are in milliseconds.\n') // eslint-disable-next-line no-console console.table(testCases) return Promise.map(testCases, (testCase) => { testCase['URL'] = urlUnderTest return performance.track('Proxy Performance', testCase) }) }) }) }) })
// selects or copies the targeted item // https://codepen.io/shaikmaqsood/pen/XmydxJ/ function copyToClipboard(target) { var $temp = $("<input>"); $("body").append($temp); var text = ($(target).text() || $(target).val()); $temp.val(text).select(); document.execCommand("copy"); $temp.remove(); } function select(target) { $(target).select(); } $(document).ready(function() { $('._target-copy').on('click', function() { var target = $(this).attr('data-target'); copyToClipboard(target); }) $('._target-select').on('click', function() { var target = $(this).attr('data-target'); select(target); }) });
/*! @license * Shaka Player * Copyright 2016 Google LLC * SPDX-License-Identifier: Apache-2.0 */ goog.provide('shaka.Player'); goog.require('goog.asserts'); goog.require('shaka.Deprecate'); goog.require('shaka.log'); goog.require('shaka.media.AdaptationSetCriteria'); goog.require('shaka.media.BufferingObserver'); goog.require('shaka.media.DrmEngine'); goog.require('shaka.media.ExampleBasedCriteria'); goog.require('shaka.media.ManifestParser'); goog.require('shaka.media.MediaSourceEngine'); goog.require('shaka.media.MediaSourcePlayhead'); goog.require('shaka.media.MetaSegmentIndex'); goog.require('shaka.media.ClosedCaptionParser'); goog.require('shaka.media.PlayRateController'); goog.require('shaka.media.Playhead'); goog.require('shaka.media.PlayheadObserverManager'); goog.require('shaka.media.PreferenceBasedCriteria'); goog.require('shaka.media.RegionObserver'); goog.require('shaka.media.RegionTimeline'); goog.require('shaka.media.SegmentIndex'); goog.require('shaka.media.SrcEqualsPlayhead'); goog.require('shaka.media.StreamingEngine'); goog.require('shaka.media.TimeRangesUtils'); goog.require('shaka.net.NetworkingEngine'); goog.require('shaka.routing.Walker'); goog.require('shaka.text.SimpleTextDisplayer'); goog.require('shaka.text.TextEngine'); goog.require('shaka.text.UITextDisplayer'); goog.require('shaka.text.WebVttGenerator'); goog.require('shaka.util.AbortableOperation'); goog.require('shaka.util.BufferUtils'); goog.require('shaka.util.ConfigUtils'); goog.require('shaka.util.Error'); goog.require('shaka.util.EventManager'); goog.require('shaka.util.FakeEvent'); goog.require('shaka.util.FakeEventTarget'); goog.require('shaka.util.Functional'); goog.require('shaka.util.IDestroyable'); goog.require('shaka.util.LanguageUtils'); goog.require('shaka.util.ManifestParserUtils'); goog.require('shaka.util.MediaReadyState'); goog.require('shaka.util.MimeUtils'); goog.require('shaka.util.ObjectUtils'); goog.require('shaka.util.Platform'); goog.require('shaka.util.PlayerConfiguration'); goog.require('shaka.util.PublicPromise'); goog.require('shaka.util.Stats'); goog.require('shaka.util.StreamUtils'); goog.require('shaka.util.Timer'); goog.requireType('shaka.media.IClosedCaptionParser'); goog.requireType('shaka.media.PresentationTimeline'); goog.requireType('shaka.routing.Node'); goog.requireType('shaka.routing.Payload'); /** * @event shaka.Player.ErrorEvent * @description Fired when a playback error occurs. * @property {string} type * 'error' * @property {!shaka.util.Error} detail * An object which contains details on the error. The error's * <code>category</code> and <code>code</code> properties will identify the * specific error that occurred. In an uncompiled build, you can also use the * <code>message</code> and <code>stack</code> properties to debug. * @exportDoc */ /** * @event shaka.Player.StateChangeEvent * @description Fired when the player changes load states. * @property {string} type * 'onstatechange' * @property {string} state * The name of the state that the player just entered. * @exportDoc */ /** * @event shaka.Player.StateIdleEvent * @description Fired when the player has stopped changing states and will * remain idle until a new state change request (e.g. <code>load</code>, * <code>attach</code>, etc.) is made. * @property {string} type * 'onstateidle' * @property {string} state * The name of the state that the player stopped in. * @exportDoc */ /** * @event shaka.Player.EmsgEvent * @description Fired when a non-typical emsg is found in a segment. * @property {string} type * 'emsg' * @property {shaka.extern.EmsgInfo} detail * An object which contains the content of the emsg box. * @exportDoc */ /** * @event shaka.Player.DrmSessionUpdateEvent * @description Fired when the CDM has accepted the license response. * @property {string} type * 'drmsessionupdate' * @exportDoc */ /** * @event shaka.Player.TimelineRegionAddedEvent * @description Fired when a media timeline region is added. * @property {string} type * 'timelineregionadded' * @property {shaka.extern.TimelineRegionInfo} detail * An object which contains a description of the region. * @exportDoc */ /** * @event shaka.Player.TimelineRegionEnterEvent * @description Fired when the playhead enters a timeline region. * @property {string} type * 'timelineregionenter' * @property {shaka.extern.TimelineRegionInfo} detail * An object which contains a description of the region. * @exportDoc */ /** * @event shaka.Player.TimelineRegionExitEvent * @description Fired when the playhead exits a timeline region. * @property {string} type * 'timelineregionexit' * @property {shaka.extern.TimelineRegionInfo} detail * An object which contains a description of the region. * @exportDoc */ /** * @event shaka.Player.BufferingEvent * @description Fired when the player's buffering state changes. * @property {string} type * 'buffering' * @property {boolean} buffering * True when the Player enters the buffering state. * False when the Player leaves the buffering state. * @exportDoc */ /** * @event shaka.Player.LoadingEvent * @description Fired when the player begins loading. The start of loading is * defined as when the user has communicated intent to load content (i.e. * <code>Player.load</code> has been called). * @property {string} type * 'loading' * @exportDoc */ /** * @event shaka.Player.LoadedEvent * @description Fired when the player ends the load. * @property {string} type * 'loaded' * @exportDoc */ /** * @event shaka.Player.UnloadingEvent * @description Fired when the player unloads or fails to load. * Used by the Cast receiver to determine idle state. * @property {string} type * 'unloading' * @exportDoc */ /** * @event shaka.Player.TextTrackVisibilityEvent * @description Fired when text track visibility changes. * @property {string} type * 'texttrackvisibility' * @exportDoc */ /** * @event shaka.Player.TracksChangedEvent * @description Fired when the list of tracks changes. For example, this will * happen when new tracks are added/removed or when track restrictions change. * @property {string} type * 'trackschanged' * @exportDoc */ /** * @event shaka.Player.AdaptationEvent * @description Fired when an automatic adaptation causes the active tracks * to change. Does not fire when the application calls * <code>selectVariantTrack()</code>, <code>selectTextTrack()</code>, * <code>selectAudioLanguage()</code>, or <code>selectTextLanguage()</code>. * @property {string} type * 'adaptation' * @exportDoc */ /** * @event shaka.Player.VariantChangedEvent * @description Fired when a call from the application caused a variant change. * Can be triggered by calls to <code>selectVariantTrack()</code> or * <code>selectAudioLanguage()</code>. Does not fire when an automatic * adaptation causes a variant change. * @property {string} type * 'variantchanged' * @exportDoc */ /** * @event shaka.Player.TextChangedEvent * @description Fired when a call from the application caused a text stream * change. Can be triggered by calls to <code>selectTextTrack()</code> or * <code>selectTextLanguage()</code>. * @property {string} type * 'textchanged' * @exportDoc */ /** * @event shaka.Player.ExpirationUpdatedEvent * @description Fired when there is a change in the expiration times of an * EME session. * @property {string} type * 'expirationupdated' * @exportDoc */ /** * @event shaka.Player.LargeGapEvent * @description Fired when the playhead enters a large gap. If the * <code>streaming.jumpLargeGaps</code> configuration is set, the default * action of this event is to jump the gap; this can be prevented by calling * <code>preventDefault()</code> on the event object. * @property {string} type * 'largegap' * @property {number} currentTime * The current time of the playhead. * @property {number} gapSize * The size of the gap, in seconds. * @exportDoc */ /** * @event shaka.Player.ManifestParsedEvent * @description Fired after the manifest has been parsed, but before anything * else happens. The manifest may contain streams that will be filtered out, * at this stage of the loading process. * @property {string} type * 'manifestparsed' * @exportDoc */ /** * @event shaka.Player.MetadataEvent * @description Triggers after metadata associated with the stream is found. * Usually they are metadata of type ID3. * @property {string} type * 'metadata' * @property {number} startTime * The time that describes the beginning of the range of the metadata to * which the cue applies. * @property {?number} endTime * The time that describes the end of the range of the metadata to which * the cue applies. * @property {string} metadataType * Type of metadata. Eg: org.id3 or org.mp4ra * @property {shaka.extern.ID3Metadata} payload * The metadata itself * @exportDoc */ /** * @event shaka.Player.StreamingEvent * @description Fired after the manifest has been parsed and track information * is available, but before streams have been chosen and before any segments * have been fetched. You may use this event to configure the player based on * information found in the manifest. * @property {string} type * 'streaming' * @exportDoc */ /** * @event shaka.Player.AbrStatusChangedEvent * @description Fired when the state of abr has been changed. * (Enabled or disabled). * @property {string} type * 'abrstatuschanged' * @property {boolean} newStatus * The new status of the application. True for 'is enabled' and * false otherwise. * @exportDoc */ /** * @event shaka.Player.RateChangeEvent * @description Fired when the video's playback rate changes. * This allows the PlayRateController to update it's internal rate field, * before the UI updates playback button with the newest playback rate. * @property {string} type * 'ratechange' * @exportDoc */ /** * @event shaka.Player.SessionDataEvent * @description Fired when the manifest parser find info about session data. * Specification: https://tools.ietf.org/html/rfc8216#section-4.3.4.4 * @property {string} type * 'sessiondata' * @property {string} id * The id of the session data. * @property {string} uri * The uri with the session data info. * @property {string} language * The language of the session data. * @property {string} value * The value of the session data. * @exportDoc */ /** * @summary The main player object for Shaka Player. * * @implements {shaka.util.IDestroyable} * @export */ shaka.Player = class extends shaka.util.FakeEventTarget { /** * @param {HTMLMediaElement=} mediaElement * When provided, the player will attach to <code>mediaElement</code>, * similar to calling <code>attach</code>. When not provided, the player * will remain detached. * @param {function(shaka.Player)=} dependencyInjector Optional callback * which is called to inject mocks into the Player. Used for testing. */ constructor(mediaElement, dependencyInjector) { super(); /** @private {shaka.Player.LoadMode} */ this.loadMode_ = shaka.Player.LoadMode.NOT_LOADED; /** @private {HTMLMediaElement} */ this.video_ = null; /** @private {HTMLElement} */ this.videoContainer_ = null; /** * Since we may not always have a text displayer created (e.g. before |load| * is called), we need to track what text visibility SHOULD be so that we * can ensure that when we create the text displayer. When we create our * text displayer, we will use this to show (or not show) text as per the * user's requests. * * @private {boolean} */ this.isTextVisible_ = false; /** @private {shaka.util.EventManager} */ this.eventManager_ = new shaka.util.EventManager(); /** @private {shaka.net.NetworkingEngine} */ this.networkingEngine_ = null; /** @private {shaka.media.DrmEngine} */ this.drmEngine_ = null; /** @private {shaka.media.MediaSourceEngine} */ this.mediaSourceEngine_ = null; /** @private {shaka.media.Playhead} */ this.playhead_ = null; /** * The playhead observers are used to monitor the position of the playhead * and some other source of data (e.g. buffered content), and raise events. * * @private {shaka.media.PlayheadObserverManager} */ this.playheadObservers_ = null; /** * This is our control over the playback rate of the media element. This * provides the missing functionality that we need to provide trick play, * for example a negative playback rate. * * @private {shaka.media.PlayRateController} */ this.playRateController_ = null; // We use the buffering observer and timer to track when we move from having // enough buffered content to not enough. They only exist when content has // been loaded and are not re-used between loads. /** @private {shaka.util.Timer} */ this.bufferPoller_ = null; /** @private {shaka.media.BufferingObserver} */ this.bufferObserver_ = null; /** @private {shaka.media.RegionTimeline} */ this.regionTimeline_ = null; /** @private {shaka.media.StreamingEngine} */ this.streamingEngine_ = null; /** @private {shaka.extern.ManifestParser} */ this.parser_ = null; /** @private {?shaka.extern.ManifestParser.Factory} */ this.parserFactory_ = null; /** @private {?shaka.extern.Manifest} */ this.manifest_ = null; /** @private {?string} */ this.assetUri_ = null; /** @private {shaka.extern.AbrManager} */ this.abrManager_ = null; /** * The factory that was used to create the abrManager_ instance. * @private {?shaka.extern.AbrManager.Factory} */ this.abrManagerFactory_ = null; /** * Contains an ID for use with creating streams. The manifest parser should * start with small IDs, so this starts with a large one. * @private {number} */ this.nextExternalStreamId_ = 1e9; /** @private {?shaka.extern.PlayerConfiguration} */ this.config_ = this.defaultConfig_(); /** * The TextDisplayerFactory that was last used to make a text displayer. * Stored so that we can tell if a new type of text displayer is desired. * @private {?shaka.extern.TextDisplayer.Factory} */ this.lastTextFactory_; /** @private {{width: number, height: number}} */ this.maxHwRes_ = {width: Infinity, height: Infinity}; /** @private {shaka.util.Stats} */ this.stats_ = null; /** @private {!shaka.media.AdaptationSetCriteria} */ this.currentAdaptationSetCriteria_ = new shaka.media.PreferenceBasedCriteria( this.config_.preferredAudioLanguage, this.config_.preferredVariantRole, this.config_.preferredAudioChannelCount); /** @private {string} */ this.currentTextLanguage_ = this.config_.preferredTextLanguage; /** @private {string} */ this.currentTextRole_ = this.config_.preferredTextRole; /** @private {boolean} */ this.currentTextForced_ = this.config_.preferForcedSubs; /** @private {!Array.<function():(!Promise|undefined)>} */ this.cleanupOnUnload_ = []; if (dependencyInjector) { dependencyInjector(this); } this.networkingEngine_ = this.createNetworkingEngine(); this.networkingEngine_.setForceHTTPS(this.config_.streaming.forceHTTPS); /** @private {shaka.extern.IAdManager} */ this.adManager_ = null; if (shaka.Player.adManagerFactory_) { this.adManager_ = shaka.util.Functional.callFactory(shaka.Player.adManagerFactory_); } // If the browser comes back online after being offline, then try to play // again. this.eventManager_.listen(window, 'online', () => { this.retryStreaming(); }); /** @private {shaka.routing.Node} */ this.detachNode_ = {name: 'detach'}; /** @private {shaka.routing.Node} */ this.attachNode_ = {name: 'attach'}; /** @private {shaka.routing.Node} */ this.unloadNode_ = {name: 'unload'}; /** @private {shaka.routing.Node} */ this.parserNode_ = {name: 'manifest-parser'}; /** @private {shaka.routing.Node} */ this.manifestNode_ = {name: 'manifest'}; /** @private {shaka.routing.Node} */ this.mediaSourceNode_ = {name: 'media-source'}; /** @private {shaka.routing.Node} */ this.drmNode_ = {name: 'drm-engine'}; /** @private {shaka.routing.Node} */ this.loadNode_ = {name: 'load'}; /** @private {shaka.routing.Node} */ this.srcEqualsDrmNode_ = {name: 'src-equals-drm-engine'}; /** @private {shaka.routing.Node} */ this.srcEqualsNode_ = {name: 'src-equals'}; const AbortableOperation = shaka.util.AbortableOperation; const actions = new Map(); actions.set(this.attachNode_, (has, wants) => { return AbortableOperation.notAbortable(this.onAttach_(has, wants)); }); actions.set(this.detachNode_, (has, wants) => { return AbortableOperation.notAbortable(this.onDetach_(has, wants)); }); actions.set(this.unloadNode_, (has, wants) => { return AbortableOperation.notAbortable(this.onUnload_(has, wants)); }); actions.set(this.mediaSourceNode_, (has, wants) => { const p = this.onInitializeMediaSourceEngine_(has, wants); return AbortableOperation.notAbortable(p); }); actions.set(this.parserNode_, (has, wants) => { const p = this.onInitializeParser_(has, wants); return AbortableOperation.notAbortable(p); }); actions.set(this.manifestNode_, (has, wants) => { // This action is actually abortable, so unlike the other callbacks, this // one will return an abortable operation. return this.onParseManifest_(has, wants); }); actions.set(this.drmNode_, (has, wants) => { const p = this.onInitializeDrm_(has, wants); return AbortableOperation.notAbortable(p); }); actions.set(this.loadNode_, (has, wants) => { return AbortableOperation.notAbortable(this.onLoad_(has, wants)); }); actions.set(this.srcEqualsDrmNode_, (has, wants) => { const p = this.onInitializeSrcEqualsDrm_(has, wants); return AbortableOperation.notAbortable(p); }); actions.set(this.srcEqualsNode_, (has, wants) => { return this.onSrcEquals_(has, wants); }); /** @private {shaka.routing.Walker.Implementation} */ const walkerImplementation = { getNext: (at, has, goingTo, wants) => { return this.getNextStep_(at, has, goingTo, wants); }, enterNode: (node, has, wants) => { this.dispatchEvent(this.makeEvent_( /* name= */ shaka.Player.EventName.OnStateChange, /* data= */ {'state': node.name})); const action = actions.get(node); return action(has, wants); }, handleError: async (has, error) => { shaka.log.warning('The walker saw an error:'); if (error instanceof shaka.util.Error) { shaka.log.warning('Error Code:', error.code); } else { shaka.log.warning('Error Message:', error.message); shaka.log.warning('Error Stack:', error.stack); } // Regardless of what state we were in, if there is an error, we unload. // This ensures that any initialized system will be torn-down and we // will go back to a safe foundation. We assume that the media element // is always safe to use after an error. await this.onUnload_(has, shaka.Player.createEmptyPayload_()); // There are only two nodes that come before we start loading content, // attach and detach. If we have a media element, it means we were // attached to the element, and we can safely return to the attach state // (we assume that the video element is always re-usable). We favor // returning to the attach node since it means that the app won't need // to re-attach if it saw an error. return has.mediaElement ? this.attachNode_ : this.detachNode_; }, onIdle: (node) => { this.dispatchEvent(this.makeEvent_( /* name= */ shaka.Player.EventName.OnStateIdle, /* data= */ {'state': node.name})); }, }; /** @private {shaka.routing.Walker} */ this.walker_ = new shaka.routing.Walker( this.detachNode_, shaka.Player.createEmptyPayload_(), walkerImplementation); // Even though |attach| will start in later interpreter cycles, it should be // the LAST thing we do in the constructor because conceptually it relies on // player having been initialized. if (mediaElement) { this.attach(mediaElement, /* initializeMediaSource= */ true); } } /** * @param {!shaka.Player.EventName} name * @param {Object=} data * @return {!shaka.util.FakeEvent} * @private */ makeEvent_(name, data) { return new shaka.util.FakeEvent(name, data); } /** * After destruction, a Player object cannot be used again. * * @override * @export */ async destroy() { // Make sure we only execute the destroy logic once. if (this.loadMode_ == shaka.Player.LoadMode.DESTROYED) { return; } // Mark as "dead". This should stop external-facing calls from changing our // internal state any more. This will stop calls to |attach|, |detach|, etc. // from interrupting our final move to the detached state. this.loadMode_ = shaka.Player.LoadMode.DESTROYED; // Because we have set |loadMode_| to |DESTROYED| we can't call |detach|. We // must talk to |this.walker_| directly. const events = this.walker_.startNewRoute((currentPayload) => { return { node: this.detachNode_, payload: shaka.Player.createEmptyPayload_(), interruptible: false, }; }); // Wait until the detach has finished so that we don't interrupt it by // calling |destroy| on |this.walker_|. To avoid failing here, we always // resolve the promise. await new Promise((resolve) => { events.onStart = () => { shaka.log.info('Preparing to destroy walker...'); }; events.onEnd = () => { resolve(); }; events.onCancel = () => { goog.asserts.assert(false, 'Our final detach call should never be cancelled.'); resolve(); }; events.onError = () => { goog.asserts.assert(false, 'Our final detach call should never see an error'); resolve(); }; events.onSkip = () => { goog.asserts.assert(false, 'Our final detach call should never be skipped'); resolve(); }; }); await this.walker_.destroy(); // Tear-down the event manager to ensure messages stop moving around. if (this.eventManager_) { this.eventManager_.release(); this.eventManager_ = null; } this.abrManagerFactory_ = null; this.abrManager_ = null; this.config_ = null; this.stats_ = null; this.videoContainer_ = null; if (this.networkingEngine_) { await this.networkingEngine_.destroy(); this.networkingEngine_ = null; } } /** * Registers a plugin callback that will be called with * <code>support()</code>. The callback will return the value that will be * stored in the return value from <code>support()</code>. * * @param {string} name * @param {function():*} callback * @export */ static registerSupportPlugin(name, callback) { shaka.Player.supportPlugins_[name] = callback; } /** * Set a factory to create an ad manager during player construction time. * This method needs to be called bafore instantiating the Player class. * * @param {!shaka.extern.IAdManager.Factory} factory * @export */ static setAdManagerFactory(factory) { shaka.Player.adManagerFactory_ = factory; } /** * Return whether the browser provides basic support. If this returns false, * Shaka Player cannot be used at all. In this case, do not construct a * Player instance and do not use the library. * * @return {boolean} * @export */ static isBrowserSupported() { if (!window.Promise) { shaka.log.alwaysWarn('A Promise implementation or polyfill is required'); } if (!window.TextDecoder || !window.TextEncoder) { shaka.log.alwaysWarn( 'A TextDecoder/TextEncoder implementation or polyfill is required'); } // Basic features needed for the library to be usable. const basicSupport = !!window.Promise && !!window.Uint8Array && !!window.TextDecoder && !!window.TextEncoder && // eslint-disable-next-line no-restricted-syntax !!Array.prototype.forEach; if (!basicSupport) { return false; } // We do not support IE if (shaka.util.Platform.isIE()) { return false; } // We do not support iOS 9, 10, or 11, nor those same versions of desktop // Safari. const safariVersion = shaka.util.Platform.safariVersion(); if (safariVersion && safariVersion < 12) { return false; } // DRM support is not strictly necessary, but the APIs at least need to be // there. Our no-op DRM polyfill should handle that. // TODO(#1017): Consider making even DrmEngine optional. const drmSupport = shaka.media.DrmEngine.isBrowserSupported(); if (!drmSupport) { return false; } // If we have MediaSource (MSE) support, we should be able to use Shaka. if (shaka.util.Platform.supportsMediaSource()) { return true; } // If we don't have MSE, we _may_ be able to use Shaka. Look for native HLS // support, and call this platform usable if we have it. return shaka.util.Platform.supportsMediaType('application/x-mpegurl'); } /** * Probes the browser to determine what features are supported. This makes a * number of requests to EME/MSE/etc which may result in user prompts. This * should only be used for diagnostics. * * <p> * NOTE: This may show a request to the user for permission. * * @see https://bit.ly/2ywccmH * @param {boolean=} promptsOkay * @return {!Promise.<shaka.extern.SupportType>} * @export */ static async probeSupport(promptsOkay=true) { goog.asserts.assert(shaka.Player.isBrowserSupported(), 'Must have basic support'); let drm = {}; if (promptsOkay) { drm = await shaka.media.DrmEngine.probeSupport(); } const manifest = shaka.media.ManifestParser.probeSupport(); const media = shaka.media.MediaSourceEngine.probeSupport(); const ret = { manifest: manifest, media: media, drm: drm, }; const plugins = shaka.Player.supportPlugins_; for (const name in plugins) { ret[name] = plugins[name](); } return ret; } /** * Tell the player to use <code>mediaElement</code> for all <code>load</code> * requests until <code>detach</code> or <code>destroy</code> are called. * * <p> * Calling <code>attach</code> with <code>initializedMediaSource=true</code> * will tell the player to take the initial load step and initialize media * source. * * <p> * Calls to <code>attach</code> will interrupt any in-progress calls to * <code>load</code> but cannot interrupt calls to <code>attach</code>, * <code>detach</code>, or <code>unload</code>. * * @param {!HTMLMediaElement} mediaElement * @param {boolean=} initializeMediaSource * @return {!Promise} * @export */ attach(mediaElement, initializeMediaSource = true) { // Do not allow the player to be used after |destroy| is called. if (this.loadMode_ == shaka.Player.LoadMode.DESTROYED) { return Promise.reject(this.createAbortLoadError_()); } const payload = shaka.Player.createEmptyPayload_(); payload.mediaElement = mediaElement; // If the platform does not support media source, we will never want to // initialize media source. if (!shaka.util.Platform.supportsMediaSource()) { initializeMediaSource = false; } const destination = initializeMediaSource ? this.mediaSourceNode_ : this.attachNode_; // Do not allow this route to be interrupted because calls after this attach // call will depend on the media element being attached. const events = this.walker_.startNewRoute((currentPayload) => { return { node: destination, payload: payload, interruptible: false, }; }); // List to the events that can occur with our request. events.onStart = () => shaka.log.info('Starting attach...'); return this.wrapWalkerListenersWithPromise_(events); } /** * Tell the player to stop using its current media element. If the player is: * <ul> * <li>detached, this will do nothing, * <li>attached, this will release the media element, * <li>loading, this will abort loading, unload, and release the media * element, * <li>playing content, this will stop playback, unload, and release the * media element. * </ul> * * <p> * Calls to <code>detach</code> will interrupt any in-progress calls to * <code>load</code> but cannot interrupt calls to <code>attach</code>, * <code>detach</code>, or <code>unload</code>. * * @return {!Promise} * @export */ detach() { // Do not allow the player to be used after |destroy| is called. if (this.loadMode_ == shaka.Player.LoadMode.DESTROYED) { return Promise.reject(this.createAbortLoadError_()); } // Tell the walker to go "detached", but do not allow it to be interrupted. // If it could be interrupted it means that our media element could fall out // of sync. const events = this.walker_.startNewRoute((currentPayload) => { return { node: this.detachNode_, payload: shaka.Player.createEmptyPayload_(), interruptible: false, }; }); events.onStart = () => shaka.log.info('Starting detach...'); return this.wrapWalkerListenersWithPromise_(events); } /** * Tell the player to either return to: * <ul> * <li>detached (when it does not have a media element), * <li>attached (when it has a media element and * <code>initializedMediaSource=false</code>) * <li>media source initialized (when it has a media element and * <code>initializedMediaSource=true</code>) * </ul> * * <p> * Calls to <code>unload</code> will interrupt any in-progress calls to * <code>load</code> but cannot interrupt calls to <code>attach</code>, * <code>detach</code>, or <code>unload</code>. * * @param {boolean=} initializeMediaSource * @return {!Promise} * @export */ unload(initializeMediaSource = true) { // Do not allow the player to be used after |destroy| is called. if (this.loadMode_ == shaka.Player.LoadMode.DESTROYED) { return Promise.reject(this.createAbortLoadError_()); } // If the platform does not support media source, we will never want to // initialize media source. if (!shaka.util.Platform.supportsMediaSource()) { initializeMediaSource = false; } // Since we are going either to attached or detached (through unloaded), we // can't allow it to be interrupted or else we could lose track of what // media element we are suppose to use. // // Using the current payload, we can determine which node we want to go to. // If we have a media element, we want to go back to attached. If we have no // media element, we want to go back to detached. const payload = shaka.Player.createEmptyPayload_(); const events = this.walker_.startNewRoute((currentPayload) => { // When someone calls |unload| we can either be before attached or // detached (there is nothing stopping someone from calling |detach| when // we are already detached). // // If we are attached to the correct element, we can tear down the // previous playback components and go to the attached media source node // depending on whether or not the caller wants to pre-init media source. // // If we don't have a media element, we assume that we are already at the // detached node - but only the walker knows that. To ensure we are // actually there, we tell the walker to go to detach. While this is // technically unnecessary, it ensures that we are in the state we want // to be in and ready for the next request. let destination = null; if (currentPayload.mediaElement && initializeMediaSource) { destination = this.mediaSourceNode_; } else if (currentPayload.mediaElement) { destination = this.attachNode_; } else { destination = this.detachNode_; } goog.asserts.assert(destination, 'We should have picked a destination.'); // Copy over the media element because we want to keep using the same // element - the other values don't matter. payload.mediaElement = currentPayload.mediaElement; return { node: destination, payload: payload, interruptible: false, }; }); events.onStart = () => shaka.log.info('Starting unload...'); return this.wrapWalkerListenersWithPromise_(events); } /** * Tell the player to load the content at <code>assetUri</code> and start * playback at <code>startTime</code>. Before calling <code>load</code>, * a call to <code>attach</code> must have succeeded. * * <p> * Calls to <code>load</code> will interrupt any in-progress calls to * <code>load</code> but cannot interrupt calls to <code>attach</code>, * <code>detach</code>, or <code>unload</code>. * * @param {string} assetUri * @param {?number=} startTime * When <code>startTime</code> is <code>null</code> or * <code>undefined</code>, playback will start at the default start time (0 * for VOD and liveEdge for LIVE). * @param {string=} mimeType * @return {!Promise} * @export */ load(assetUri, startTime, mimeType) { // Do not allow the player to be used after |destroy| is called. if (this.loadMode_ == shaka.Player.LoadMode.DESTROYED) { return Promise.reject(this.createAbortLoadError_()); } // We dispatch the loading event when someone calls |load| because we want // to surface the user intent. this.dispatchEvent(this.makeEvent_(shaka.Player.EventName.Loading)); // Right away we know what the asset uri and start-of-load time are. We will // fill-in the rest of the information later. const payload = shaka.Player.createEmptyPayload_(); payload.uri = assetUri; payload.startTimeOfLoad = Date.now() / 1000; if (mimeType) { payload.mimeType = mimeType; } // Because we allow |startTime| to be optional, it means that it will be // |undefined| when not provided. This means that we need to re-map // |undefined| to |null| while preserving |0| as a meaningful value. if (startTime !== undefined) { payload.startTime = startTime; } // TODO: Refactor to determine whether it's a manifest or not, and whether // or not we can play it. Then we could return a better error than // UNABLE_TO_GUESS_MANIFEST_TYPE for WebM in Safari. const useSrcEquals = this.shouldUseSrcEquals_(payload); const destination = useSrcEquals ? this.srcEqualsNode_ : this.loadNode_; // Allow this request to be interrupted, this will allow other requests to // cancel a load and quickly start a new load. const events = this.walker_.startNewRoute((currentPayload) => { if (currentPayload.mediaElement == null) { // Because we return null, this "new route" will not be used. return null; } // Keep using whatever media element we have right now. payload.mediaElement = currentPayload.mediaElement; return { node: destination, payload: payload, interruptible: true, }; }); // Stats are for a single playback/load session. Stats must be initialized // before we allow calls to |updateStateHistory|. this.stats_ = new shaka.util.Stats(); // Load's request is a little different, so we can't use our normal // listeners-to-promise method. It is the only request where we may skip the // request, so we need to set the on skip callback to reject with a specific // error. events.onStart = () => shaka.log.info('Starting load of ' + assetUri + '...'); return new Promise((resolve, reject) => { events.onSkip = () => reject(new shaka.util.Error( shaka.util.Error.Severity.CRITICAL, shaka.util.Error.Category.PLAYER, shaka.util.Error.Code.NO_VIDEO_ELEMENT)); events.onEnd = () => { resolve(); // We dispatch the loaded event when the load promise is resolved this.dispatchEvent(this.makeEvent_(shaka.Player.EventName.Loaded)); }; events.onCancel = () => reject(this.createAbortLoadError_()); events.onError = (e) => reject(e); }); } /** * Check if src= should be used to load the asset at |uri|. Assume that media * source is the default option, and that src= is for special cases. * * @param {shaka.routing.Payload} payload * @return {boolean} * |true| if the content should be loaded with src=, |false| if the content * should be loaded with MediaSource. * @private */ shouldUseSrcEquals_(payload) { const Platform = shaka.util.Platform; // If we are using a platform that does not support media source, we will // fall back to src= to handle all playback. if (!Platform.supportsMediaSource()) { return true; } // The most accurate way to tell the player how to load the content is via // MIME type. We can fall back to features of the URI if needed. let mimeType = payload.mimeType; const uri = payload.uri || ''; // If we don't have a MIME type, try to guess based on the file extension. // TODO: Too generic to belong to ManifestParser now. Refactor. if (!mimeType) { // Try using the uri extension. const extension = shaka.media.ManifestParser.getExtension(uri); mimeType = { 'mp4': 'video/mp4', 'm4v': 'video/mp4', 'm4a': 'audio/mp4', 'webm': 'video/webm', 'weba': 'audio/webm', 'mkv': 'video/webm', // Chromium browsers supports it. 'ts': 'video/mp2t', 'ogv': 'video/ogg', 'ogg': 'audio/ogg', 'mpg': 'video/mpeg', 'mpeg': 'video/mpeg', 'm3u8': 'application/x-mpegurl', 'mp3': 'audio/mpeg', 'aac': 'audio/aac', 'flac': 'audio/flac', 'wav': 'audio/wav', }[extension]; } // TODO: The load graph system has a design limitation that requires routing // destination to be chosen synchronously. This means we can only make the // right choice about src= consistently if we have a well-known file // extension or API-provided MIME type. Detection of MIME type from a HEAD // request (as is done for manifest types) can't be done yet. if (mimeType) { // If we have a MIME type, check if the browser can play it natively. // This will cover both single files and native HLS. const mediaElement = payload.mediaElement || Platform.anyMediaElement(); const canPlayNatively = mediaElement.canPlayType(mimeType) != ''; // If we can't play natively, then src= isn't an option. if (!canPlayNatively) { return false; } const canPlayMediaSource = shaka.media.ManifestParser.isSupported(uri, mimeType); // If MediaSource isn't an option, the native option is our only chance. if (!canPlayMediaSource) { return true; } // If we land here, both are feasible. goog.asserts.assert(canPlayNatively && canPlayMediaSource, 'Both native and MSE playback should be possible!'); // We would prefer MediaSource in some cases, and src= in others. For // example, Android has native HLS, but we'd prefer our own MediaSource // version there. // Native HLS can be preferred on any platform via this flag: if (this.config_.streaming.preferNativeHls) { return true; } // For Safari, we have an older flag which only applies to this one // browser: if (Platform.isApple()) { return this.config_.streaming.useNativeHlsOnSafari; } // In all other cases, we prefer MediaSource. return false; } // Unless there are good reasons to use src= (single-file playback or native // HLS), we prefer MediaSource. So the final return value for choosing src= // is false. return false; } /** * This should only be called by the load graph when it is time to attach to * a media element. The only times this may be called are when we are being * asked to re-attach to the current media element, or attach to a new media * element while not attached to a media element. * * This method assumes that it is safe for it to execute, the load-graph is * responsible for ensuring all assumptions are true. * * Attaching to a media element is defined as: * - Registering error listeners to the media element. * - Caching the video element for use outside of the load graph. * * @param {shaka.routing.Payload} has * @param {shaka.routing.Payload} wants * @return {!Promise} * @private */ onAttach_(has, wants) { // If we don't have a media element yet, it means we are entering // "attach" from another node. // // If we have a media element, it should match |wants.mediaElement| // because it means we are going from "attach" to "attach". // // These constraints should be maintained and guaranteed by the routing // logic in |getNextStep_|. goog.asserts.assert( has.mediaElement == null || has.mediaElement == wants.mediaElement, 'The routing logic failed. MediaElement requirement failed.'); if (has.mediaElement == null) { has.mediaElement = wants.mediaElement; const onError = (error) => this.onVideoError_(error); this.eventManager_.listen(has.mediaElement, 'error', onError); } this.video_ = has.mediaElement; return Promise.resolve(); } /** * This should only be called by the load graph when it is time to detach from * a media element. The only times this may be called are when we are being * asked to detach from the current media element, or detach when we are * already detached. * * This method assumes that it is safe for it to execute, the load-graph is * responsible for ensuring all assumptions are true. * * Detaching from a media element is defined as: * - Removing error listeners from the media element. * - Dropping the cached reference to the video element. * * @param {shaka.routing.Payload} has * @param {shaka.routing.Payload} wants * @return {!Promise} * @private */ onDetach_(has, wants) { // If we are going from "detached" to "detached" we wouldn't have // a media element to detach from. if (has.mediaElement) { this.eventManager_.unlisten(has.mediaElement, 'error'); has.mediaElement = null; } // Clear our cached copy of the media element. this.video_ = null; return Promise.resolve(); } /** * This should only be called by the load graph when it is time to unload all * currently initialized playback components. Unlike the other load actions, * this action is built to be more general. We need to do this because we * don't know what state the player will be in before unloading (including * after an error occurred in the middle of a transition). * * This method assumes that any component could be |null| and should be safe * to call from any point in the load graph. * * @param {shaka.routing.Payload} has * @param {shaka.routing.Payload} wants * @return {!Promise} * @private */ async onUnload_(has, wants) { // Set the load mode to unload right away so that all the public methods // will stop using the internal components. We need to make sure that we // are not overriding the destroyed state because we will unload when we are // destroying the player. if (this.loadMode_ != shaka.Player.LoadMode.DESTROYED) { this.loadMode_ = shaka.Player.LoadMode.NOT_LOADED; } // Run any general cleanup tasks now. This should be here at the top, right // after setting loadMode_, so that internal components still exist as they // did when the cleanup tasks were registered in the array. const cleanupTasks = this.cleanupOnUnload_.map((cb) => cb()); this.cleanupOnUnload_ = []; await Promise.all(cleanupTasks); // Dispatch the unloading event. this.dispatchEvent(this.makeEvent_(shaka.Player.EventName.Unloading)); // Remove everything that has to do with loading content from our payload // since we are releasing everything that depended on it. has.mimeType = null; has.startTime = null; has.uri = null; // In most cases we should have a media element. The one exception would // be if there was an error and we, by chance, did not have a media element. if (has.mediaElement) { this.eventManager_.unlisten(has.mediaElement, 'loadedmetadata'); this.eventManager_.unlisten(has.mediaElement, 'playing'); this.eventManager_.unlisten(has.mediaElement, 'pause'); this.eventManager_.unlisten(has.mediaElement, 'ended'); this.eventManager_.unlisten(has.mediaElement, 'ratechange'); } // Some observers use some playback components, shutting down the observers // first ensures that they don't try to use the playback components // mid-destroy. if (this.playheadObservers_) { this.playheadObservers_.release(); this.playheadObservers_ = null; } if (this.bufferPoller_) { this.bufferPoller_.stop(); this.bufferPoller_ = null; } // Stop the parser early. Since it is at the start of the pipeline, it // should be start early to avoid is pushing new data downstream. if (this.parser_) { await this.parser_.stop(); this.parser_ = null; this.parserFactory_ = null; } // Abr Manager will tell streaming engine what to do, so we need to stop // it before we destroy streaming engine. Unlike with the other components, // we do not release the instance, we will reuse it in later loads. if (this.abrManager_) { await this.abrManager_.stop(); } // Streaming engine will push new data to media source engine, so we need // to shut it down before destroy media source engine. if (this.streamingEngine_) { await this.streamingEngine_.destroy(); this.streamingEngine_ = null; } if (this.playRateController_) { this.playRateController_.release(); this.playRateController_ = null; } // Playhead is used by StreamingEngine, so we can't destroy this until after // StreamingEngine has stopped. if (this.playhead_) { this.playhead_.release(); this.playhead_ = null; } // Media source engine holds onto the media element, and in order to detach // the media keys (with drm engine), we need to break the connection between // media source engine and the media element. if (this.mediaSourceEngine_) { await this.mediaSourceEngine_.destroy(); this.mediaSourceEngine_ = null; } if (this.adManager_) { this.adManager_.onAssetUnload(); } // In order to unload a media element, we need to remove the src attribute // and then load again. When we destroy media source engine, this will be // done for us, but for src=, we need to do it here. // // DrmEngine requires this to be done before we destroy DrmEngine itself. if (has.mediaElement && has.mediaElement.src) { // TODO: Investigate this more. Only reproduces on Firefox 69. // Introduce a delay before detaching the video source. We are seeing // spurious Promise rejections involving an AbortError in our tests // otherwise. await new Promise( (resolve) => new shaka.util.Timer(resolve).tickAfter(0.1)); has.mediaElement.removeAttribute('src'); has.mediaElement.load(); // Remove all track nodes while (has.mediaElement.lastChild) { has.mediaElement.removeChild(has.mediaElement.firstChild); } } if (this.drmEngine_) { await this.drmEngine_.destroy(); this.drmEngine_ = null; } this.assetUri_ = null; this.bufferObserver_ = null; if (this.manifest_) { for (const variant of this.manifest_.variants) { for (const stream of [variant.audio, variant.video]) { if (stream && stream.segmentIndex) { stream.segmentIndex.release(); } } } for (const stream of this.manifest_.textStreams) { if (stream.segmentIndex) { stream.segmentIndex.release(); } } } this.manifest_ = null; this.stats_ = new shaka.util.Stats(); // Replace with a clean stats object. this.lastTextFactory_ = null; // Make sure that the app knows of the new buffering state. this.updateBufferState_(); } /** * This should only be called by the load graph when it is time to initialize * media source engine. The only time this may be called is when we are * attached to the same media element as in the request. * * This method assumes that it is safe for it to execute. The load-graph is * responsible for ensuring all assumptions are true. * * @param {shaka.routing.Payload} has * @param {shaka.routing.Payload} wants * * @return {!Promise} * @private */ async onInitializeMediaSourceEngine_(has, wants) { goog.asserts.assert( shaka.util.Platform.supportsMediaSource(), 'We should not be initializing media source on a platform that does ' + 'not support media source.'); goog.asserts.assert( has.mediaElement, 'We should have a media element when initializing media source.'); goog.asserts.assert( has.mediaElement == wants.mediaElement, '|has| and |wants| should have the same media element when ' + 'initializing media source.'); goog.asserts.assert( this.mediaSourceEngine_ == null, 'We should not have a media source engine yet.'); const closedCaptionsParser = new shaka.media.ClosedCaptionParser(); // When changing text visibility we need to update both the text displayer // and streaming engine because we don't always stream text. To ensure that // text displayer and streaming engine are always in sync, wait until they // are both initialized before setting the initial value. const textDisplayerFactory = this.config_.textDisplayFactory; const textDisplayer = shaka.util.Functional.callFactory(textDisplayerFactory); this.lastTextFactory_ = textDisplayerFactory; const mediaSourceEngine = this.createMediaSourceEngine( has.mediaElement, closedCaptionsParser, textDisplayer, (metadata, offset, endTime) => { this.processTimedMetadataMediaSrc_(metadata, offset, endTime); }); // Wait for media source engine to finish opening. This promise should // NEVER be rejected as per the media source engine implementation. await mediaSourceEngine.open(); // Wait until it is ready to actually store the reference. this.mediaSourceEngine_ = mediaSourceEngine; } /** * Create the parser for the asset located at |wants.uri|. This should only be * called as part of the load graph. * * This method assumes that it is safe for it to execute, the load-graph is * responsible for ensuring all assumptions are true. * * @param {shaka.routing.Payload} has * @param {shaka.routing.Payload} wants * @return {!Promise} * @private */ async onInitializeParser_(has, wants) { goog.asserts.assert( has.mediaElement, 'We should have a media element when initializing the parser.'); goog.asserts.assert( has.mediaElement == wants.mediaElement, '|has| and |wants| should have the same media element when ' + 'initializing the parser.'); goog.asserts.assert( this.networkingEngine_, 'Need networking engine when initializing the parser.'); goog.asserts.assert( this.config_, 'Need player config when initializing the parser.'); // We are going to "lock-in" the mime type and uri since they are // what we are going to use to create our parser and parse the manifest. has.mimeType = wants.mimeType; has.uri = wants.uri; goog.asserts.assert( has.uri, 'We should have an asset uri when initializing the parsing.'); // Store references to things we asserted so that we don't need to reassert // them again later. const assetUri = has.uri; const networkingEngine = this.networkingEngine_; // Save the uri so that it can be used outside of the load-graph. this.assetUri_ = assetUri; // Create the parser that we will use to parse the manifest. this.parserFactory_ = await shaka.media.ManifestParser.getFactory( assetUri, networkingEngine, this.config_.manifest.retryParameters, has.mimeType); goog.asserts.assert(this.parserFactory_, 'Must have manifest parser'); this.parser_ = shaka.util.Functional.callFactory(this.parserFactory_); const manifestConfig = shaka.util.ObjectUtils.cloneObject(this.config_.manifest); // Don't read video segments if the player is attached to an audio element if (wants.mediaElement && wants.mediaElement.nodeName === 'AUDIO') { manifestConfig.disableVideo = true; } this.parser_.configure(manifestConfig); } /** * Parse the manifest at |has.uri| using the parser that should have already * been created. This should only be called as part of the load graph. * * This method assumes that it is safe for it to execute, the load-graph is * responsible for ensuring all assumptions are true. * * @param {shaka.routing.Payload} has * @param {shaka.routing.Payload} wants * @return {!shaka.util.AbortableOperation} * @private */ onParseManifest_(has, wants) { goog.asserts.assert( has.mimeType == wants.mimeType, '|has| and |wants| should have the same mime type when parsing.'); goog.asserts.assert( has.uri == wants.uri, '|has| and |wants| should have the same uri when parsing.'); goog.asserts.assert( has.uri, '|has| should have a valid uri when parsing.'); goog.asserts.assert( has.uri == this.assetUri_, '|has.uri| should match the cached asset uri.'); goog.asserts.assert( this.networkingEngine_, 'Need networking engine to parse manifest.'); goog.asserts.assert( this.config_, 'Need player config to parse manifest.'); goog.asserts.assert( this.parser_, '|this.parser_| should have been set in an earlier step.'); // Store references to things we asserted so that we don't need to reassert // them again later. const assetUri = has.uri; const networkingEngine = this.networkingEngine_; // This will be needed by the parser once it starts parsing, so we will // initialize it now even through it appears a little out-of-place. this.regionTimeline_ = new shaka.media.RegionTimeline(() => this.seekRange()); this.regionTimeline_.setListeners(/* onRegionAdded= */ (region) => { this.onRegionEvent_(shaka.Player.EventName.TimelineRegionAdded, region); if (this.adManager_) { this.adManager_.onDashTimedMetadata(region); } }); // TODO (#1391): Once filterManifest_ is async, remove this eslint disable. /* eslint-disable require-await */ const playerInterface = { networkingEngine: networkingEngine, filter: async (manifest) => this.filterManifest_(manifest), makeTextStreamsForClosedCaptions: (manifest) => { return this.makeTextStreamsForClosedCaptions_(manifest); }, // Called when the parser finds a timeline region. This can be called // before we start playback or during playback (live/in-progress // manifest). onTimelineRegionAdded: (region) => this.regionTimeline_.addRegion(region), onEvent: (event) => this.dispatchEvent(event), onError: (error) => this.onError_(error), isLowLatencyMode: () => this.isLowLatencyMode_(), isAutoLowLatencyMode: () => this.isAutoLowLatencyMode_(), enableLowLatencyMode: () => { this.configure('streaming.lowLatencyMode', true); }, }; /* eslint-enable require-await */ const startTime = Date.now() / 1000; return new shaka.util.AbortableOperation(/* promise= */ (async () => { this.manifest_ = await this.parser_.start(assetUri, playerInterface); // This event is fired after the manifest is parsed, but before any // filtering takes place. const event = this.makeEvent_(shaka.Player.EventName.ManifestParsed); this.dispatchEvent(event); // We require all manifests to have at least one variant. if (this.manifest_.variants.length == 0) { throw new shaka.util.Error( shaka.util.Error.Severity.CRITICAL, shaka.util.Error.Category.MANIFEST, shaka.util.Error.Code.NO_VARIANTS); } // Make sure that all variants are either: audio-only, video-only, or // audio-video. shaka.Player.filterForAVVariants_(this.manifest_); const now = Date.now() / 1000; const delta = now - startTime; this.stats_.setManifestTime(delta); })(), /* onAbort= */ () => { shaka.log.info('Aborting parser step...'); return this.parser_.stop(); }); } /** * This should only be called by the load graph when it is time to initialize * drmEngine. The only time this may be called is when we are attached a * media element and have parsed a manifest. * * The load-graph is responsible for ensuring all assumptions made by this * method are valid before executing it. * * @param {shaka.routing.Payload} has * @param {shaka.routing.Payload} wants * @return {!Promise} * @private */ async onInitializeDrm_(has, wants) { goog.asserts.assert( has.mimeType == wants.mimeType, 'The load graph should have ensured the mime types matched.'); goog.asserts.assert( has.uri == wants.uri, 'The load graph should have ensured the uris matched'); goog.asserts.assert( this.networkingEngine_, '|onInitializeDrm_| should never be called after |destroy|'); goog.asserts.assert( this.config_, '|onInitializeDrm_| should never be called after |destroy|'); goog.asserts.assert( this.manifest_, '|this.manifest_| should have been set in an earlier step.'); goog.asserts.assert( has.mediaElement, 'We should have a media element when initializing the DRM Engine.'); const startTime = Date.now() / 1000; let firstEvent = true; this.drmEngine_ = this.createDrmEngine({ netEngine: this.networkingEngine_, onError: (e) => { this.onError_(e); }, onKeyStatus: (map) => { this.onKeyStatus_(map); }, onExpirationUpdated: (id, expiration) => { this.onExpirationUpdated_(id, expiration); }, onEvent: (e) => { this.dispatchEvent(e); if (e.type == shaka.Player.EventName.DrmSessionUpdate && firstEvent) { firstEvent = false; const now = Date.now() / 1000; const delta = now - startTime; this.stats_.setDrmTime(delta); } }, }); // TODO: remove once MediaCap implementation is complete. if (!this.config_.useMediaCapabilities) { shaka.util.StreamUtils.filterManifestByMediaSource(this.manifest_); } this.drmEngine_.configure(this.config_.drm); await this.drmEngine_.initForPlayback( this.manifest_.variants, this.manifest_.offlineSessionIds, this.config_.useMediaCapabilities); await this.drmEngine_.attach(has.mediaElement); // Now that we have drm information, filter the manifest (again) so that we // can ensure we only use variants with the selected key system. await this.filterManifest_(this.manifest_); } /** * This should only be called by the load graph when it is time to load all * playback components needed for playback. The only times this may be called * is when we are attached to the same media element as in the request. * * This method assumes that it is safe for it to execute, the load-graph is * responsible for ensuring all assumptions are true. * * Loading is defined as: * - Attaching all playback-related listeners to the media element * - Initializing playback and observers * - Initializing ABR Manager * - Initializing Streaming Engine * - Starting playback at |wants.startTime| * * @param {shaka.routing.Payload} has * @param {shaka.routing.Payload} wants * @private */ async onLoad_(has, wants) { goog.asserts.assert( has.mimeType == wants.mimeType, '|has| and |wants| should have the same mime type when loading.'); goog.asserts.assert( has.uri == wants.uri, '|has| and |wants| should have the same uri when loading.'); goog.asserts.assert( has.mediaElement, 'We should have a media element when loading.'); goog.asserts.assert( !isNaN(wants.startTimeOfLoad), '|wants| should tell us when the load was originally requested'); // Since we are about to start playback, we will lock in the start time as // something we are now depending on. has.startTime = wants.startTime; // Store a reference to values in |has| after asserting so that closure will // know that they will still be non-null between calls to await. const mediaElement = has.mediaElement; const assetUri = has.uri; // Save the uri so that it can be used outside of the load-graph. this.assetUri_ = assetUri; this.playRateController_ = new shaka.media.PlayRateController({ getRate: () => has.mediaElement.playbackRate, getDefaultRate: () => has.mediaElement.defaultPlaybackRate, setRate: (rate) => { has.mediaElement.playbackRate = rate; }, movePlayhead: (delta) => { has.mediaElement.currentTime += delta; }, }); const updateStateHistory = () => this.updateStateHistory_(); const onRateChange = () => this.onRateChange_(); this.eventManager_.listen(mediaElement, 'playing', updateStateHistory); this.eventManager_.listen(mediaElement, 'pause', updateStateHistory); this.eventManager_.listen(mediaElement, 'ended', updateStateHistory); this.eventManager_.listen(mediaElement, 'ratechange', onRateChange); const abrFactory = this.config_.abrFactory; if (!this.abrManager_ || this.abrManagerFactory_ != abrFactory) { this.abrManagerFactory_ = abrFactory; this.abrManager_ = shaka.util.Functional.callFactory(abrFactory); if (typeof this.abrManager_.playbackRateChanged != 'function') { shaka.Deprecate.deprecateFeature(4, 'AbrManager', 'Please use an AbrManager with playbackRateChanged function.'); this.abrManager_.playbackRateChanged = (rate) => {}; } this.abrManager_.configure(this.config_.abr); } // Copy preferred languages from the config again, in case the config was // changed between construction and playback. this.currentAdaptationSetCriteria_ = new shaka.media.PreferenceBasedCriteria( this.config_.preferredAudioLanguage, this.config_.preferredVariantRole, this.config_.preferredAudioChannelCount); this.currentTextLanguage_ = this.config_.preferredTextLanguage; shaka.Player.applyPlayRange_(this.manifest_.presentationTimeline, this.config_.playRangeStart, this.config_.playRangeEnd); this.abrManager_.init((variant, clearBuffer, safeMargin) => { return this.switch_(variant, clearBuffer, safeMargin); }); this.playhead_ = this.createPlayhead(has.startTime); this.playheadObservers_ = this.createPlayheadObserversForMSE_(); // We need to start the buffer management code near the end because it will // set the initial buffering state and that depends on other components // being initialized. const rebufferThreshold = Math.max( this.manifest_.minBufferTime, this.config_.streaming.rebufferingGoal); this.startBufferManagement_(rebufferThreshold); // If the content is multi-codec and the browser can play more than one of // them, choose codecs now before we initialize streaming. shaka.util.StreamUtils.chooseCodecsAndFilterManifest( this.manifest_, this.config_.preferredAudioChannelCount); this.streamingEngine_ = this.createStreamingEngine(); this.streamingEngine_.configure(this.config_.streaming); // Set the load mode to "loaded with media source" as late as possible so // that public methods won't try to access internal components until // they're all initialized. We MUST switch to loaded before calling // "streaming" so that they can access internal information. this.loadMode_ = shaka.Player.LoadMode.MEDIA_SOURCE; // The event must be fired after we filter by restrictions but before the // active stream is picked to allow those listening for the "streaming" // event to make changes before streaming starts. this.dispatchEvent(this.makeEvent_(shaka.Player.EventName.Streaming)); // Pick the initial streams to play. const initialVariant = this.chooseVariant_(); goog.asserts.assert(initialVariant, 'Must choose an initial variant!'); this.addVariantToSwitchHistory_( initialVariant, /* fromAdaptation= */ true); this.streamingEngine_.switchVariant( initialVariant, /* clearBuffer= */ false, /* safeMargin= */ 0); // Decide if text should be shown automatically. const initialTextStream = this.chooseTextStream_(); if (initialTextStream) { this.addTextStreamToSwitchHistory_( initialTextStream, /* fromAdaptation= */ true); } this.setInitialTextState_(initialVariant, initialTextStream); // Don't initialize with a text stream unless we should be streaming text. if (initialTextStream && this.shouldStreamText_()) { this.streamingEngine_.switchTextStream(initialTextStream); } // Now that we have initial streams, we may adjust the start time to align // to a segment boundary. if (this.config_.streaming.startAtSegmentBoundary) { const startTime = this.playhead_.getTime(); const adjustedTime = await this.adjustStartTime_(initialVariant, startTime); this.playhead_.setStartTime(adjustedTime); } // Start streaming content. This will start the flow of content down to // media source. await this.streamingEngine_.start(); if (this.config_.abr.enabled) { this.abrManager_.enable(); this.onAbrStatusChanged_(); } // Re-filter the manifest after streams have been chosen. this.filterManifestByCurrentVariant_(); // Dispatch a 'trackschanged' event now that all initial filtering is done. this.onTracksChanged_(); // Since the first streams just became active, send an adaptation event. this.onAdaptation_(); // Now that we've filtered out variants that aren't compatible with the // active one, update abr manager with filtered variants. // NOTE: This may be unnecessary. We've already chosen one codec in // chooseCodecsAndFilterManifest_ before we started streaming. But it // doesn't hurt, and this will all change when we start using // MediaCapabilities and codec switching. // TODO(#1391): Re-evaluate with MediaCapabilities and codec switching. this.updateAbrManagerVariants_(); const hasPrimary = this.manifest_.variants.some((v) => v.primary); if (!this.config_.preferredAudioLanguage && !hasPrimary) { shaka.log.warning('No preferred audio language set. We have chosen an ' + 'arbitrary language initially'); } // Wait for the 'loadedmetadata' event to measure load() latency. this.eventManager_.listenOnce(mediaElement, 'loadedmetadata', () => { const now = Date.now() / 1000; const delta = now - wants.startTimeOfLoad; this.stats_.setLoadLatency(delta); }); } /** * This should only be called by the load graph when it is time to initialize * drmEngine for src= playbacks. * * The load-graph is responsible for ensuring all assumptions made by this * method are valid before executing it. * * @param {shaka.routing.Payload} has * @param {shaka.routing.Payload} wants * @return {!Promise} * @private */ async onInitializeSrcEqualsDrm_(has, wants) { const ContentType = shaka.util.ManifestParserUtils.ContentType; goog.asserts.assert( this.networkingEngine_, '|onInitializeSrcEqualsDrm_| should never be called after |destroy|'); goog.asserts.assert( this.config_, '|onInitializeSrcEqualsDrm_| should never be called after |destroy|'); const startTime = Date.now() / 1000; let firstEvent = true; this.drmEngine_ = this.createDrmEngine({ netEngine: this.networkingEngine_, onError: (e) => { this.onError_(e); }, onKeyStatus: (map) => { this.onKeyStatus_(map); }, onExpirationUpdated: (id, expiration) => { this.onExpirationUpdated_(id, expiration); }, onEvent: (e) => { this.dispatchEvent(e); if (e.type == shaka.Player.EventName.DrmSessionUpdate && firstEvent) { firstEvent = false; const now = Date.now() / 1000; const delta = now - startTime; this.stats_.setDrmTime(delta); } }, }); this.drmEngine_.configure(this.config_.drm); // TODO: Instead of feeding DrmEngine with Variants, we should refactor // DrmEngine so that it takes a minimal config derived from Variants. In // cases like this one or in removal of stored content, the details are // largely unimportant. We should have a saner way to initialize DrmEngine. // That would also insulate DrmEngine from manifest changes in the future. // For now, that is time-consuming and this synthetic Variant is easy, so // I'm putting it off. Since this is only expected to be used for native // HLS in Safari, this should be safe. -JCP /** @type {shaka.extern.Variant} */ const variant = { id: 0, language: 'und', primary: false, audio: null, video: { id: 0, originalId: null, createSegmentIndex: () => Promise.resolve(), segmentIndex: null, mimeType: 'video/mp4', codecs: '', encrypted: true, drmInfos: [], // Filled in by DrmEngine config. keyIds: new Set(), language: 'und', label: null, type: ContentType.VIDEO, primary: false, trickModeVideo: null, emsgSchemeIdUris: null, roles: [], forced: false, channelsCount: null, audioSamplingRate: null, spatialAudio: false, closedCaptions: null, }, bandwidth: 100, allowedByApplication: true, allowedByKeySystem: true, decodingInfos: [], }; await this.drmEngine_.initForPlayback( [variant], /* offlineSessionIds= */ []); await this.drmEngine_.attach(has.mediaElement); } /** * This should only be called by the load graph when it is time to set-up the * media element to play content using src=. The only times this may be called * is when we are attached to the same media element as in the request. * * This method assumes that it is safe for it to execute, the load-graph is * responsible for ensuring all assumptions are true. * * @param {shaka.routing.Payload} has * @param {shaka.routing.Payload} wants * @return {!shaka.util.AbortableOperation} * * @private */ onSrcEquals_(has, wants) { goog.asserts.assert( has.mediaElement, 'We should have a media element when loading.'); goog.asserts.assert( wants.uri, '|has| should have a valid uri when loading.'); goog.asserts.assert( !isNaN(wants.startTimeOfLoad), '|wants| should tell us when the load was originally requested'); goog.asserts.assert( this.video_ == has.mediaElement, 'The video element should match our media element'); // Lock-in the values that we are using so that the routing logic knows what // we have. has.uri = wants.uri; has.startTime = wants.startTime; // Save the uri so that it can be used outside of the load-graph. this.assetUri_ = has.uri; this.playhead_ = new shaka.media.SrcEqualsPlayhead(has.mediaElement); if (has.startTime != null) { this.playhead_.setStartTime(has.startTime); } this.playRateController_ = new shaka.media.PlayRateController({ getRate: () => has.mediaElement.playbackRate, getDefaultRate: () => has.mediaElement.defaultPlaybackRate, setRate: (rate) => { has.mediaElement.playbackRate = rate; }, movePlayhead: (delta) => { has.mediaElement.currentTime += delta; }, }); // We need to start the buffer management code near the end because it will // set the initial buffering state and that depends on other components // being initialized. const rebufferThreshold = this.config_.streaming.rebufferingGoal; this.startBufferManagement_(rebufferThreshold); // Add all media element listeners. const updateStateHistory = () => this.updateStateHistory_(); const onRateChange = () => this.onRateChange_(); this.eventManager_.listen(has.mediaElement, 'playing', updateStateHistory); this.eventManager_.listen(has.mediaElement, 'pause', updateStateHistory); this.eventManager_.listen(has.mediaElement, 'ended', updateStateHistory); this.eventManager_.listen(has.mediaElement, 'ratechange', onRateChange); // Wait for the 'loadedmetadata' event to measure load() latency, but only // if preload is set in a way that would result in this event firing // automatically. See https://github.com/google/shaka-player/issues/2483 if (this.video_.preload != 'none') { this.eventManager_.listenOnce(this.video_, 'loadedmetadata', () => { const now = Date.now() / 1000; const delta = now - wants.startTimeOfLoad; this.stats_.setLoadLatency(delta); }); } // The audio tracks are only available on Safari at the moment, but this // drives the tracks API for Safari's native HLS. So when they change, // fire the corresponding Shaka Player event. if (this.video_.audioTracks) { this.eventManager_.listen( this.video_.audioTracks, 'addtrack', () => this.onTracksChanged_()); this.eventManager_.listen( this.video_.audioTracks, 'removetrack', () => this.onTracksChanged_()); this.eventManager_.listen( this.video_.audioTracks, 'change', () => this.onTracksChanged_()); } if (this.video_.textTracks) { this.eventManager_.listen(this.video_.textTracks, 'addtrack', (e) => { this.onTracksChanged_(); this.processTimedMetadataSrcEqls_(/** @type {!TrackEvent} */(e)); }); this.eventManager_.listen( this.video_.textTracks, 'removetrack', () => this.onTracksChanged_()); this.eventManager_.listen( this.video_.textTracks, 'change', () => this.onTracksChanged_()); } // By setting |src| we are done "loading" with src=. We don't need to set // the current time because |playhead| will do that for us. has.mediaElement.src = has.uri; // Tizen 3 / WebOS won't load anything unless you call load() explicitly, // no matter the value of the preload attribute. This is harmful on some // other platforms by triggering unbounded loading of media data, but is // necessary here. if (shaka.util.Platform.isTizen() || shaka.util.Platform.isWebOS()) { has.mediaElement.load(); } // Set the load mode last so that we know that all our components are // initialized. this.loadMode_ = shaka.Player.LoadMode.SRC_EQUALS; // The event doesn't mean as much for src= playback, since we don't control // streaming. But we should fire it in this path anyway since some // applications may be expecting it as a life-cycle event. this.dispatchEvent(this.makeEvent_(shaka.Player.EventName.Streaming)); // The "load" Promise is resolved when we have loaded the metadata. If we // wait for the full data, that won't happen on Safari until the play button // is hit. const fullyLoaded = new shaka.util.PublicPromise(); shaka.util.MediaReadyState.waitForReadyState(this.video_, HTMLMediaElement.HAVE_METADATA, this.eventManager_, () => { fullyLoaded.resolve(); }); // This flag is used below in the language preference setup to check if this // load was canceled before the necessary events fire. let unloaded = false; this.cleanupOnUnload_.push(() => { unloaded = true; }); // We can't switch to preferred languages, though, until the data is loaded. shaka.util.MediaReadyState.waitForReadyState(this.video_, HTMLMediaElement.HAVE_CURRENT_DATA, this.eventManager_, async () => { // If we have moved on to another piece of content while waiting for // the above event, we should not change tracks here. if (unloaded) { return; } this.setupPreferredAudioOnSrc_(); // Applying the text preference too soon can result in it being // reverted. Wait for native HLS to pick something first. const textTracks = this.getFilteredTextTracks_(); if (!textTracks.find((t) => t.mode != 'disabled')) { await new Promise((resolve) => { this.eventManager_.listenOnce( this.video_.textTracks, 'change', resolve); // We expect the event to fire because it does on Safari. // But in case it doesn't on some other platform or future // version, move on in 1 second no matter what. This keeps the // language settings from being completely ignored if something // goes wrong. new shaka.util.Timer(resolve).tickAfter(1); }); } // If we have moved on to another piece of content while waiting for // the above event/timer, we should not change tracks here. if (unloaded) { return; } this.setupPreferredTextOnSrc_(); }); if (this.video_.error) { // Already failed! fullyLoaded.reject(this.videoErrorToShakaError_()); } else if (this.video_.preload == 'none') { shaka.log.alwaysWarn( 'With <video preload="none">, the browser will not load anything ' + 'until play() is called. We are unable to measure load latency in ' + 'a meaningful way, and we cannot provide track info yet. Please do ' + 'not use preload="none" with Shaka Player.'); // We can't wait for an event load loadedmetadata, since that will be // blocked until a user interaction. So resolve the Promise now. fullyLoaded.resolve(); } this.eventManager_.listenOnce(this.video_, 'error', () => { fullyLoaded.reject(this.videoErrorToShakaError_()); }); return new shaka.util.AbortableOperation(fullyLoaded, /* onAbort= */ () => { const abortedError = new shaka.util.Error( shaka.util.Error.Severity.CRITICAL, shaka.util.Error.Category.PLAYER, shaka.util.Error.Code.OPERATION_ABORTED); fullyLoaded.reject(abortedError); return Promise.resolve(); // Abort complete. }); } /** * This method setup the preferred audio using src=.. * * @private */ setupPreferredAudioOnSrc_() { const preferredAudioLanguage = this.config_.preferredAudioLanguage; // If the user has not selected a preference, the browser preference is // left. if (preferredAudioLanguage == '') { return; } this.selectAudioLanguage(preferredAudioLanguage); const preferredVariantRole = this.config_.preferredVariantRole; // If the user has not selected a role preference, the previous match is // selected. if (preferredVariantRole == '') { return; } this.selectAudioLanguage(preferredAudioLanguage, preferredVariantRole); } /** * This method setup the preferred text using src=. * * @private */ setupPreferredTextOnSrc_() { const preferredTextLanguage = this.config_.preferredTextLanguage; const preferForcedSubs = this.config_.preferForcedSubs; // If the user has not selected a preference, the browser preference is // left. if (preferredTextLanguage == '') { return; } this.selectTextLanguage(preferredTextLanguage, '', preferForcedSubs); const preferredTextRole = this.config_.preferredTextRole; // If the user has not selected a role preference, the previous match is // selected. if (preferredTextRole == '') { return; } this.selectTextLanguage(preferredTextLanguage, preferredTextRole, preferForcedSubs); } /** * We're looking for metadata tracks to process id3 tags. One of the uses is * for ad info on LIVE streams * * @param {!TrackEvent} event * @private */ processTimedMetadataSrcEqls_(event) { const track = event.track; goog.asserts.assert(track instanceof TextTrack, 'Wrong track type!'); if (track.kind != 'metadata') { return; } // Hidden mode is required for the cuechange event to launch correctly track.mode = 'hidden'; this.eventManager_.listen(track, 'cuechange', () => { if (!track.activeCues) { return; } for (const cue of track.activeCues) { this.dispatchMetadataEvent_(cue.startTime, cue.endTime, cue.type, cue.value); if (this.adManager_) { this.adManager_.onCueMetadataChange(cue.value); } } }); // In Safari the initial assignment does not always work, so we schedule // this process to be repeated several times to ensure that it has been put // in the correct mode. new shaka.util.Timer(() => { const textTracks = this.getMetadataTracks_(); for (const textTrack of textTracks) { textTrack.mode = 'hidden'; } }).tickNow().tickAfter(/* seconds= */ 0.5); } /** * @param {!Array.<shaka.extern.ID3Metadata>} metadata * @param {number} offset * @param {?number} segmentEndTime * @private */ processTimedMetadataMediaSrc_(metadata, offset, segmentEndTime) { for (const sample of metadata) { if (sample['data'] && sample['cueTime'] && sample['frames']) { const start = sample['cueTime'] + offset; const end = segmentEndTime; const metadataType = 'ID3'; for (const frame of sample['frames']) { const payload = frame; this.dispatchMetadataEvent_(start, end, metadataType, payload); } if (this.adManager_) { this.adManager_.onHlsTimedMetadata(sample, start); } } } } /** * Construct and fire a Player.Metadata event * * @param {number} startTime * @param {?number} endTime * @param {string} metadataType * @param {shaka.extern.ID3Metadata} payload * @private */ dispatchMetadataEvent_(startTime, endTime, metadataType, payload) { goog.asserts.assert(!endTime || startTime <= endTime, 'Metadata start time should be less or equal to the end time!'); const eventName = shaka.Player.EventName.Metadata; const data = { startTime: startTime, endTime: endTime, metadataType: metadataType, payload: payload, }; this.dispatchEvent(this.makeEvent_(eventName, data)); } /** * Take a series of variants and ensure that they only contain one type of * variant. The different options are: * 1. Audio-Video * 2. Audio-Only * 3. Video-Only * * A manifest can only contain a single type because once we initialize media * source to expect specific streams, it must always have content for those * streams. If we were to start with audio+video and switch to an audio-only * variant, media source would block waiting for video content. * * @param {shaka.extern.Manifest} manifest * @private */ static filterForAVVariants_(manifest) { const isAVVariant = (variant) => { // Audio-video variants may include both streams separately or may be // single multiplexed streams with multiple codecs. return (variant.video && variant.audio) || (variant.video && variant.video.codecs.includes(',')); }; if (manifest.variants.some(isAVVariant)) { shaka.log.debug('Found variant with audio and video content, ' + 'so filtering out audio-only content.'); manifest.variants = manifest.variants.filter(isAVVariant); } } /** * Create a new DrmEngine instance. This may be replaced by tests to create * fake instances. Configuration and initialization will be handled after * |createDrmEngine|. * * @param {shaka.media.DrmEngine.PlayerInterface} playerInterface * @return {!shaka.media.DrmEngine} */ createDrmEngine(playerInterface) { const updateExpirationTime = this.config_.drm.updateExpirationTime; return new shaka.media.DrmEngine(playerInterface, updateExpirationTime); } /** * Creates a new instance of NetworkingEngine. This can be replaced by tests * to create fake instances instead. * * @return {!shaka.net.NetworkingEngine} */ createNetworkingEngine() { /** @type {function(number, number)} */ const onProgressUpdated_ = (deltaTimeMs, bytesDownloaded) => { // In some situations, such as during offline storage, the abr manager // might not yet exist. Therefore, we need to check if abr manager has // been initialized before using it. if (this.abrManager_) { this.abrManager_.segmentDownloaded(deltaTimeMs, bytesDownloaded); } }; return new shaka.net.NetworkingEngine(onProgressUpdated_); } /** * Creates a new instance of Playhead. This can be replaced by tests to * create fake instances instead. * * @param {?number} startTime * @return {!shaka.media.Playhead} */ createPlayhead(startTime) { goog.asserts.assert(this.manifest_, 'Must have manifest'); goog.asserts.assert(this.video_, 'Must have video'); return new shaka.media.MediaSourcePlayhead( this.video_, this.manifest_, this.config_.streaming, startTime, () => this.onSeek_(), (event) => this.dispatchEvent(event)); } /** * Create the observers for MSE playback. These observers are responsible for * notifying the app and player of specific events during MSE playback. * * @return {!shaka.media.PlayheadObserverManager} * @private */ createPlayheadObserversForMSE_() { goog.asserts.assert(this.manifest_, 'Must have manifest'); goog.asserts.assert(this.regionTimeline_, 'Must have region timeline'); goog.asserts.assert(this.video_, 'Must have video element'); // Create the region observer. This will allow us to notify the app when we // move in and out of timeline regions. const regionObserver = new shaka.media.RegionObserver(this.regionTimeline_); const onEnterRegion = (region, seeking) => { this.onRegionEvent_(shaka.Player.EventName.TimelineRegionEnter, region); }; const onExitRegion = (region, seeking) => { this.onRegionEvent_(shaka.Player.EventName.TimelineRegionExit, region); }; const onSkipRegion = (region, seeking) => { // If we are seeking, we don't want to surface the enter/exit events since // they didn't play through them. if (!seeking) { this.onRegionEvent_(shaka.Player.EventName.TimelineRegionEnter, region); this.onRegionEvent_(shaka.Player.EventName.TimelineRegionExit, region); } }; regionObserver.setListeners(onEnterRegion, onExitRegion, onSkipRegion); // Now that we have all our observers, create a manager for them. const manager = new shaka.media.PlayheadObserverManager(this.video_); manager.manage(regionObserver); return manager; } /** * Initialize and start the buffering system (observer and timer) so that we * can monitor our buffer lead during playback. * * @param {number} rebufferingGoal * @private */ startBufferManagement_(rebufferingGoal) { goog.asserts.assert( !this.bufferObserver_, 'No buffering observer should exist before initialization.'); goog.asserts.assert( !this.bufferPoller_, 'No buffer timer should exist before initialization.'); // Give dummy values, will be updated below. this.bufferObserver_ = new shaka.media.BufferingObserver(1, 2); // Force us back to a buffering state. This ensure everything is starting in // the same state. this.bufferObserver_.setState(shaka.media.BufferingObserver.State.STARVING); this.updateBufferingSettings_(rebufferingGoal); this.updateBufferState_(); // TODO: We should take some time to look into the effects of our // quarter-second refresh practice. We often use a quarter-second // but we have no documentation about why. this.bufferPoller_ = new shaka.util.Timer(() => { this.pollBufferState_(); }).tickEvery(/* seconds= */ 0.25); } /** * Updates the buffering thresholds based on the new rebuffering goal. * * @param {number} rebufferingGoal * @private */ updateBufferingSettings_(rebufferingGoal) { // The threshold to transition back to satisfied when starving. const starvingThreshold = rebufferingGoal; // The threshold to transition into starving when satisfied. // We use a "typical" threshold, unless the rebufferingGoal is unusually // low. // Then we force the value down to half the rebufferingGoal, since // starvingThreshold must be strictly larger than satisfiedThreshold for the // logic in BufferingObserver to work correctly. const satisfiedThreshold = Math.min( shaka.Player.TYPICAL_BUFFERING_THRESHOLD_, rebufferingGoal / 2); this.bufferObserver_.setThresholds(starvingThreshold, satisfiedThreshold); } /** * This method is called periodically to check what the buffering observer * says so that we can update the rest of the buffering behaviours. * * @private */ pollBufferState_() { goog.asserts.assert( this.video_, 'Need a media element to update the buffering observer'); goog.asserts.assert( this.bufferObserver_, 'Need a buffering observer to update'); let bufferedToEnd; switch (this.loadMode_) { case shaka.Player.LoadMode.SRC_EQUALS: bufferedToEnd = this.isBufferedToEndSrc_(); break; case shaka.Player.LoadMode.MEDIA_SOURCE: bufferedToEnd = this.isBufferedToEndMS_(); break; default: bufferedToEnd = false; break; } const bufferLead = shaka.media.TimeRangesUtils.bufferedAheadOf( this.video_.buffered, this.video_.currentTime); const stateChanged = this.bufferObserver_.update(bufferLead, bufferedToEnd); // If the state changed, we need to surface the event. if (stateChanged) { this.updateBufferState_(); } } /** * Create a new media source engine. This will ONLY be replaced by tests as a * way to inject fake media source engine instances. * * @param {!HTMLMediaElement} mediaElement * @param {!shaka.media.IClosedCaptionParser} closedCaptionsParser * @param {!shaka.extern.TextDisplayer} textDisplayer * @param {!function(!Array.<shaka.extern.ID3Metadata>, number, ?number)} * onMetadata * * @return {!shaka.media.MediaSourceEngine} */ createMediaSourceEngine(mediaElement, closedCaptionsParser, textDisplayer, onMetadata) { return new shaka.media.MediaSourceEngine( mediaElement, closedCaptionsParser, textDisplayer, onMetadata); } /** * Creates a new instance of StreamingEngine. This can be replaced by tests * to create fake instances instead. * * @return {!shaka.media.StreamingEngine} */ createStreamingEngine() { goog.asserts.assert( this.playhead_ && this.abrManager_ && this.mediaSourceEngine_ && this.manifest_, 'Must not be destroyed'); /** @type {shaka.media.StreamingEngine.PlayerInterface} */ const playerInterface = { getPresentationTime: () => this.playhead_.getTime(), getBandwidthEstimate: () => this.abrManager_.getBandwidthEstimate(), mediaSourceEngine: this.mediaSourceEngine_, netEngine: this.networkingEngine_, onError: (error) => this.onError_(error), onEvent: (event) => this.dispatchEvent(event), onManifestUpdate: () => this.onManifestUpdate_(), onSegmentAppended: () => this.onSegmentAppended_(), }; return new shaka.media.StreamingEngine(this.manifest_, playerInterface); } /** * Changes configuration settings on the Player. This checks the names of * keys and the types of values to avoid coding errors. If there are errors, * this logs them to the console and returns false. Correct fields are still * applied even if there are other errors. You can pass an explicit * <code>undefined</code> value to restore the default value. This has two * modes of operation: * * <p> * First, this can be passed a single "plain" object. This object should * follow the {@link shaka.extern.PlayerConfiguration} object. Not all fields * need to be set; unset fields retain their old values. * * <p> * Second, this can be passed two arguments. The first is the name of the key * to set. This should be a '.' separated path to the key. For example, * <code>'streaming.alwaysStreamText'</code>. The second argument is the * value to set. * * @param {string|!Object} config This should either be a field name or an * object. * @param {*=} value In the second mode, this is the value to set. * @return {boolean} True if the passed config object was valid, false if * there were invalid entries. * @export */ configure(config, value) { goog.asserts.assert(this.config_, 'Config must not be null!'); goog.asserts.assert(typeof(config) == 'object' || arguments.length == 2, 'String configs should have values!'); // ('fieldName', value) format if (arguments.length == 2 && typeof(config) == 'string') { config = shaka.util.ConfigUtils.convertToConfigObject(config, value); } goog.asserts.assert(typeof(config) == 'object', 'Should be an object!'); // Deprecate 'manifest.dash.defaultPresentationDelay' configuration. if (config['manifest'] && config['manifest']['dash'] && 'defaultPresentationDelay' in config['manifest']['dash']) { shaka.Deprecate.deprecateFeature(4, 'manifest.dash.defaultPresentationDelay configuration', 'Please Use manifest.defaultPresentationDelay instead.'); config['manifest']['defaultPresentationDelay'] = config['manifest']['dash']['defaultPresentationDelay']; delete config['manifest']['dash']['defaultPresentationDelay']; } // If lowLatencyMode is enabled, and inaccurateManifestTolerance and // rebufferingGoal are not specified, set inaccurateManifestTolerance to 0 // and rebufferingGoal to 0.01 by default for low latency streaming. if (config['streaming'] && config['streaming']['lowLatencyMode']) { if (config['streaming']['inaccurateManifestTolerance'] == undefined) { config['streaming']['inaccurateManifestTolerance'] = 0; } if (config['streaming']['rebufferingGoal'] == undefined) { config['streaming']['rebufferingGoal'] = 0.01; } } const ret = shaka.util.PlayerConfiguration.mergeConfigObjects( this.config_, config, this.defaultConfig_()); this.applyConfig_(); return ret; } /** * Apply config changes. * @private */ applyConfig_() { if (this.parser_) { const manifestConfig = shaka.util.ObjectUtils.cloneObject(this.config_.manifest); // Don't read video segments if the player is attached to an audio element if (this.video_ && this.video_.nodeName === 'AUDIO') { manifestConfig.disableVideo = true; } this.parser_.configure(manifestConfig); } if (this.drmEngine_) { this.drmEngine_.configure(this.config_.drm); } if (this.streamingEngine_) { this.streamingEngine_.configure(this.config_.streaming); // Need to apply the restrictions. try { // this.filterManifestWithRestrictions_() may throw. this.filterManifestWithRestrictions_(this.manifest_); } catch (error) { this.onError_(error); } if (this.abrManager_) { // Update AbrManager variants to match these new settings. this.updateAbrManagerVariants_(); } // If the streams we are playing are restricted, we need to switch. const activeVariant = this.streamingEngine_.getCurrentVariant(); if (activeVariant) { if (!activeVariant.allowedByApplication || !activeVariant.allowedByKeySystem) { shaka.log.debug('Choosing new variant after changing configuration'); this.chooseVariantAndSwitch_(); } } } if (this.networkingEngine_) { this.networkingEngine_.setForceHTTPS(this.config_.streaming.forceHTTPS); } if (this.mediaSourceEngine_) { const textDisplayerFactory = this.config_.textDisplayFactory; if (this.lastTextFactory_ != textDisplayerFactory) { const displayer = shaka.util.Functional.callFactory(textDisplayerFactory); this.mediaSourceEngine_.setTextDisplayer(displayer); this.lastTextFactory_ = textDisplayerFactory; if (this.streamingEngine_) { // Reload the text stream, so the cues will load again. this.streamingEngine_.reloadTextStream(); } } } if (this.abrManager_) { this.abrManager_.configure(this.config_.abr); // Simply enable/disable ABR with each call, since multiple calls to these // methods have no effect. if (this.config_.abr.enabled) { this.abrManager_.enable(); } else { this.abrManager_.disable(); } this.onAbrStatusChanged_(); } if (this.bufferObserver_) { let rebufferThreshold = this.config_.streaming.rebufferingGoal; if (this.manifest_) { rebufferThreshold = Math.max(rebufferThreshold, this.manifest_.minBufferTime); } this.updateBufferingSettings_(rebufferThreshold); } if (this.manifest_) { shaka.Player.applyPlayRange_(this.manifest_.presentationTimeline, this.config_.playRangeStart, this.config_.playRangeEnd); } } /** * Return a copy of the current configuration. Modifications of the returned * value will not affect the Player's active configuration. You must call * <code>player.configure()</code> to make changes. * * @return {shaka.extern.PlayerConfiguration} * @export */ getConfiguration() { goog.asserts.assert(this.config_, 'Config must not be null!'); const ret = this.defaultConfig_(); shaka.util.PlayerConfiguration.mergeConfigObjects( ret, this.config_, this.defaultConfig_()); return ret; } /** * Return a reference to the current configuration. Modifications to the * returned value will affect the Player's active configuration. This method * is not exported as sharing configuration with external objects is not * supported. * * @return {shaka.extern.PlayerConfiguration} */ getSharedConfiguration() { goog.asserts.assert( this.config_, 'Cannot call getSharedConfiguration after call destroy!'); return this.config_; } /** * Reset configuration to default. * @export */ resetConfiguration() { goog.asserts.assert(this.config_, 'Cannot be destroyed'); // Remove the old keys so we remove open-ended dictionaries like drm.servers // but keeps the same object reference. for (const key in this.config_) { delete this.config_[key]; } shaka.util.PlayerConfiguration.mergeConfigObjects( this.config_, this.defaultConfig_(), this.defaultConfig_()); this.applyConfig_(); } /** * Get the current load mode. * * @return {shaka.Player.LoadMode} * @export */ getLoadMode() { return this.loadMode_; } /** * Get the media element that the player is currently using to play loaded * content. If the player has not loaded content, this will return * <code>null</code>. * * @return {HTMLMediaElement} * @export */ getMediaElement() { return this.video_; } /** * @return {shaka.net.NetworkingEngine} A reference to the Player's networking * engine. Applications may use this to make requests through Shaka's * networking plugins. * @export */ getNetworkingEngine() { return this.networkingEngine_; } /** * Get the uri to the asset that the player has loaded. If the player has not * loaded content, this will return <code>null</code>. * * @return {?string} * @export */ getAssetUri() { return this.assetUri_; } /** * Returns a shaka.ads.AdManager instance, responsible for Dynamic * Ad Insertion functionality. * * @return {shaka.extern.IAdManager} * @export */ getAdManager() { // NOTE: this clause is redundant, but it keeps the compiler from // inlining this function. Inlining leads to setting the adManager // not taking effect in the compiled build. // Closure has a @noinline flag, but apparently not all cases are // supported by it, and ours isn't. // If they expand support, we might be able to get rid of this // clause. if (!this.adManager_) { return null; } return this.adManager_; } /** * Get if the player is playing live content. If the player has not loaded * content, this will return <code>false</code>. * * @return {boolean} * @export */ isLive() { if (this.manifest_) { return this.manifest_.presentationTimeline.isLive(); } // For native HLS, the duration for live streams seems to be Infinity. if (this.video_ && this.video_.src) { return this.video_.duration == Infinity; } return false; } /** * Get if the player is playing in-progress content. If the player has not * loaded content, this will return <code>false</code>. * * @return {boolean} * @export */ isInProgress() { return this.manifest_ ? this.manifest_.presentationTimeline.isInProgress() : false; } /** * Check if the manifest contains only audio-only content. If the player has * not loaded content, this will return <code>false</code>. * * <p> * The player does not support content that contain more than one type of * variants (i.e. mixing audio-only, video-only, audio-video). Content will be * filtered to only contain one type of variant. * * @return {boolean} * @export */ isAudioOnly() { if (this.manifest_) { const variants = this.manifest_.variants; if (!variants.length) { return false; } // Note that if there are some audio-only variants and some audio-video // variants, the audio-only variants are removed during filtering. // Therefore if the first variant has no video, that's sufficient to say // it is audio-only content. return !variants[0].video; } else if (this.video_ && this.video_.src) { // If we have video track info, use that. It will be the least // error-prone way with native HLS. In contrast, videoHeight might be // unset until the first frame is loaded. Since isAudioOnly is queried // by the UI on the 'trackschanged' event, the videoTracks info should be // up-to-date. if (this.video_.videoTracks) { return this.video_.videoTracks.length == 0; } // We cast to the more specific HTMLVideoElement to access videoHeight. // This might be an audio element, though, in which case videoHeight will // be undefined at runtime. For audio elements, this will always return // true. const video = /** @type {HTMLVideoElement} */(this.video_); return video.videoHeight == 0; } else { return false; } } /** * Return the value of lowLatencyMode configuration. * @return {boolean} * @private */ isLowLatencyMode_() { return this.config_.streaming.lowLatencyMode; } /** * Return the value of autoLowLatencyMode configuration. * @return {boolean} * @private */ isAutoLowLatencyMode_() { return this.config_.streaming.autoLowLatencyMode; } /** * Get the range of time (in seconds) that seeking is allowed. If the player * has not loaded content, this will return a range from 0 to 0. * * @return {{start: number, end: number}} * @export */ seekRange() { if (this.manifest_) { const timeline = this.manifest_.presentationTimeline; return { 'start': timeline.getSeekRangeStart(), 'end': timeline.getSeekRangeEnd(), }; } // If we have loaded content with src=, we ask the video element for its // seekable range. This covers both plain mp4s and native HLS playbacks. if (this.video_ && this.video_.src) { const seekable = this.video_.seekable; if (seekable.length) { return { 'start': seekable.start(0), 'end': seekable.end(seekable.length - 1), }; } } return {'start': 0, 'end': 0}; } /** * Get the key system currently used by EME. If EME is not being used, this * will return an empty string. If the player has not loaded content, this * will return an empty string. * * @return {string} * @export */ keySystem() { return shaka.media.DrmEngine.keySystem(this.drmInfo()); } /** * Get the drm info used to initialize EME. If EME is not being used, this * will return <code>null</code>. If the player is idle or has not initialized * EME yet, this will return <code>null</code>. * * @return {?shaka.extern.DrmInfo} * @export */ drmInfo() { return this.drmEngine_ ? this.drmEngine_.getDrmInfo() : null; } /** * Get the next known expiration time for any EME session. If the session * never expires, this will return <code>Infinity</code>. If there are no EME * sessions, this will return <code>Infinity</code>. If the player has not * loaded content, this will return <code>Infinity</code>. * * @return {number} * @export */ getExpiration() { return this.drmEngine_ ? this.drmEngine_.getExpiration() : Infinity; } /** * Gets a map of EME key ID to the current key status. * * @return {!Object<string, string>} * @export */ getKeyStatuses() { return this.drmEngine_ ? this.drmEngine_.getKeyStatuses() : {}; } /** * Check if the player is currently in a buffering state (has too little * content to play smoothly). If the player has not loaded content, this will * return <code>false</code>. * * @return {boolean} * @export */ isBuffering() { const State = shaka.media.BufferingObserver.State; return this.bufferObserver_ ? this.bufferObserver_.getState() == State.STARVING : false; } /** * Get the playback rate of what is playing right now. If we are using trick * play, this will return the trick play rate. * If no content is playing, this will return 0. * If content is buffering, this will return the expected playback rate once * the video starts playing. * * <p> * If the player has not loaded content, this will return a playback rate of * 0. * * @return {number} * @export */ getPlaybackRate() { if (!this.video_) { return 0; } return this.playRateController_ ? this.playRateController_.getRealRate() : 1; } /** * Enable trick play to skip through content without playing by repeatedly * seeking. For example, a rate of 2.5 would result in 2.5 seconds of content * being skipped every second. A negative rate will result in moving * backwards. * * <p> * If the player has not loaded content or is still loading content this will * be a no-op. Wait until <code>load</code> has completed before calling. * * <p> * Trick play will be canceled automatically if the playhead hits the * beginning or end of the seekable range for the content. * * @param {number} rate * @export */ trickPlay(rate) { // A playbackRate of 0 is used internally when we are in a buffering state, // and doesn't make sense for trick play. If you set a rate of 0 for trick // play, we will reject it and issue a warning. If it happens during a // test, we will fail the test through this assertion. goog.asserts.assert(rate != 0, 'Should never set a trick play rate of 0!'); if (rate == 0) { shaka.log.alwaysWarn('A trick play rate of 0 is unsupported!'); return; } if (this.video_.paused) { // Our fast forward is implemented with playbackRate and needs the video // to be playing (to not be paused) to take immediate effect. // If the video is paused, "unpause" it. this.video_.play(); } this.playRateController_.set(rate); if (this.loadMode_ == shaka.Player.LoadMode.MEDIA_SOURCE) { this.abrManager_.playbackRateChanged(rate); this.streamingEngine_.setTrickPlay(Math.abs(rate) > 1); } } /** * Cancel trick-play. If the player has not loaded content or is still loading * content this will be a no-op. * * @export */ cancelTrickPlay() { const defaultPlaybackRate = this.playRateController_.getDefaultRate(); if (this.loadMode_ == shaka.Player.LoadMode.SRC_EQUALS) { this.playRateController_.set(defaultPlaybackRate); } if (this.loadMode_ == shaka.Player.LoadMode.MEDIA_SOURCE) { this.playRateController_.set(defaultPlaybackRate); this.abrManager_.playbackRateChanged(defaultPlaybackRate); this.streamingEngine_.setTrickPlay(false); } } /** * Return a list of variant tracks that can be switched to. * * <p> * If the player has not loaded content, this will return an empty list. * * @return {!Array.<shaka.extern.Track>} * @export */ getVariantTracks() { if (this.manifest_) { const currentVariant = this.streamingEngine_ ? this.streamingEngine_.getCurrentVariant() : null; const tracks = []; // Convert each variant to a track. for (const variant of this.manifest_.variants) { if (!shaka.util.StreamUtils.isPlayable(variant)) { continue; } const track = shaka.util.StreamUtils.variantToTrack(variant); track.active = variant == currentVariant; tracks.push(track); } return tracks; } else if (this.video_ && this.video_.audioTracks) { // Safari's native HLS always shows a single element in videoTracks. // You can't use that API to change resolutions. But we can use // audioTracks to generate a variant list that is usable for changing // languages. const audioTracks = Array.from(this.video_.audioTracks); return audioTracks.map((audio) => shaka.util.StreamUtils.html5AudioTrackToTrack(audio)); } else { return []; } } /** * Return a list of text tracks that can be switched to. * * <p> * If the player has not loaded content, this will return an empty list. * * @return {!Array.<shaka.extern.Track>} * @export */ getTextTracks() { if (this.manifest_) { const currentTextStream = this.streamingEngine_ ? this.streamingEngine_.getCurrentTextStream() : null; const tracks = []; // Convert all selectable text streams to tracks. for (const text of this.manifest_.textStreams) { const track = shaka.util.StreamUtils.textStreamToTrack(text); track.active = text == currentTextStream; tracks.push(track); } return tracks; } else if (this.video_ && this.video_.src && this.video_.textTracks) { const textTracks = this.getFilteredTextTracks_(); const StreamUtils = shaka.util.StreamUtils; return textTracks.map((text) => StreamUtils.html5TextTrackToTrack(text)); } else { return []; } } /** * Return a list of image tracks that can be switched to. * * If the player has not loaded content, this will return an empty list. * * @return {!Array.<shaka.extern.Track>} * @export */ getImageTracks() { if (this.manifest_) { const imageStreams = this.manifest_.imageStreams; const StreamUtils = shaka.util.StreamUtils; return imageStreams.map((image) => StreamUtils.imageStreamToTrack(image)); } else { return []; } } /** * Return a Thumbnail object from a image track Id and time. * * If the player has not loaded content, this will return a null. * * @param {number} trackId * @param {number} time * @return {!Promise.<?shaka.extern.Thumbnail>} * @export */ async getThumbnails(trackId, time) { if (this.manifest_) { const imageStream = this.manifest_.imageStreams.find( (stream) => stream.id == trackId); if (!imageStream) { return null; } if (!imageStream.segmentIndex) { await imageStream.createSegmentIndex(); } const referencePosition = imageStream.segmentIndex.find(time); if (referencePosition == null) { return null; } const reference = imageStream.segmentIndex.get(referencePosition); // This expression is used to detect one or more numbers (0-9) followed // by an x and after one or more numbers (0-9) const match = /(\d+)x(\d+)/.exec(imageStream.tilesLayout); if (!match) { shaka.log.warning('Tiles layout does not contain a valid format ' + ' (columns x rows)'); return null; } const fullImageWidth = imageStream.width || 0; const fullImageHeight = imageStream.height || 0; const columns = parseInt(match[1], 10); const rows = parseInt(match[2], 10); const width = fullImageWidth / columns; const height = fullImageHeight / rows; let positionX = 0; let positionY = 0; const totalImages = columns * rows; // If the number of images in the segment is greater than 1, we have to // find the correct image. For that we will return to the app the // coordinates of the position of the correct image. // Image search is always from left to right and top to bottom. // Note: The time between images within the segment is always // equidistant. // // Eg: Total images 5, tileLayout 5x1, segmentTime 5, thumbnailTime 2 // positionX = 0.4 * fullImageWidth // positionY = 0 if (totalImages > 1) { const thumbnailTime = time - reference.startTime; const segmentTime = reference.endTime - reference.startTime; const thumbnailPosition = Math.floor(thumbnailTime * totalImages / segmentTime); positionX = (thumbnailPosition % columns) / columns * fullImageWidth; positionY = (thumbnailPosition % rows) / rows * fullImageHeight; } return { height: height, positionX: positionX, positionY: positionY, uris: reference.getUris(), width: width, }; } return null; } /** * Select a specific text track. <code>track</code> should come from a call to * <code>getTextTracks</code>. If the track is not found, this will be a * no-op. If the player has not loaded content, this will be a no-op. * * <p> * Note that <code>AdaptationEvents</code> are not fired for manual track * selections. * * @param {shaka.extern.Track} track * @export */ selectTextTrack(track) { if (this.manifest_ && this.streamingEngine_) { const stream = this.manifest_.textStreams.find( (stream) => stream.id == track.id); if (!stream) { shaka.log.error('No stream with id', track.id); return; } if (stream == this.streamingEngine_.getCurrentTextStream()) { shaka.log.debug('Text track already selected.'); return; } // Add entries to the history. this.addTextStreamToSwitchHistory_(stream, /* fromAdaptation= */ false); this.streamingEngine_.switchTextStream(stream); this.onTextChanged_(); // Workaround for https://github.com/google/shaka-player/issues/1299 // When track is selected, back-propagate the language to // currentTextLanguage_. this.currentTextLanguage_ = stream.language; } else if (this.video_ && this.video_.src && this.video_.textTracks) { const textTracks = this.getFilteredTextTracks_(); for (const textTrack of textTracks) { if (shaka.util.StreamUtils.html5TrackId(textTrack) == track.id) { // Leave the track in 'hidden' if it's selected but not showing. textTrack.mode = this.isTextVisible_ ? 'showing' : 'hidden'; } else { // Safari allows multiple text tracks to have mode == 'showing', so be // explicit in resetting the others. textTrack.mode = 'disabled'; } } this.onTextChanged_(); } } /** * Select a specific variant track to play. <code>track</code> should come * from a call to <code>getVariantTracks</code>. If <code>track</code> cannot * be found, this will be a no-op. If the player has not loaded content, this * will be a no-op. * * <p> * Changing variants will take effect once the currently buffered content has * been played. To force the change to happen sooner, use * <code>clearBuffer</code> with <code>safeMargin</code>. Setting * <code>clearBuffer</code> to <code>true</code> will clear all buffered * content after <code>safeMargin</code>, allowing the new variant to start * playing sooner. * * <p> * Note that <code>AdaptationEvents</code> are not fired for manual track * selections. * * @param {shaka.extern.Track} track * @param {boolean=} clearBuffer * @param {number=} safeMargin Optional amount of buffer (in seconds) to * retain when clearing the buffer. Useful for switching variant quickly * without causing a buffering event. Defaults to 0 if not provided. Ignored * if clearBuffer is false. Can cause hiccups on some browsers if chosen too * small, e.g. The amount of two segments is a fair minimum to consider as * safeMargin value. * @export */ selectVariantTrack(track, clearBuffer = false, safeMargin = 0) { if (this.manifest_ && this.streamingEngine_) { if (this.config_.abr.enabled) { shaka.log.alwaysWarn('Changing tracks while abr manager is enabled ' + 'will likely result in the selected track ' + 'being overriden. Consider disabling abr before ' + 'calling selectVariantTrack().'); } const variant = this.manifest_.variants.find( (variant) => variant.id == track.id); if (!variant) { shaka.log.error('No variant with id', track.id); return; } // Double check that the track is allowed to be played. The track list // should only contain playable variants, but if restrictions change and // |selectVariantTrack| is called before the track list is updated, we // could get a now-restricted variant. if (!shaka.util.StreamUtils.isPlayable(variant)) { shaka.log.error('Unable to switch to restricted track', track.id); return; } if (variant == this.streamingEngine_.getCurrentVariant()) { shaka.log.debug('Variant already selected.'); return; } // Add entries to the history. this.addVariantToSwitchHistory_(variant, /* fromAdaptation= */ false); this.streamingEngine_.switchVariant(variant, clearBuffer, safeMargin); // Dispatch a 'variantchanged' event this.onVariantChanged_(); // Workaround for https://github.com/google/shaka-player/issues/1299 // When track is selected, back-propagate the language to // currentAudioLanguage_. this.currentAdaptationSetCriteria_ = new shaka.media.ExampleBasedCriteria( variant); // Update AbrManager variants to match these new settings. this.updateAbrManagerVariants_(); } else if (this.video_ && this.video_.audioTracks) { // Safari's native HLS won't let you choose an explicit variant, though // you can choose audio languages this way. const audioTracks = Array.from(this.video_.audioTracks); for (const audioTrack of audioTracks) { if (shaka.util.StreamUtils.html5TrackId(audioTrack) == track.id) { // This will reset the "enabled" of other tracks to false. audioTrack.enabled = true; } } this.onVariantChanged_(); } } /** * Return a list of audio language-role combinations available. If the * player has not loaded any content, this will return an empty list. * * @return {!Array.<shaka.extern.LanguageRole>} * @export */ getAudioLanguagesAndRoles() { return shaka.Player.getLanguageAndRolesFrom_(this.getVariantTracks()); } /** * Return a list of text language-role combinations available. If the player * has not loaded any content, this will be return an empty list. * * @return {!Array.<shaka.extern.LanguageRole>} * @export */ getTextLanguagesAndRoles() { return shaka.Player.getLanguageAndRolesFrom_(this.getTextTracks()); } /** * Return a list of audio languages available. If the player has not loaded * any content, this will return an empty list. * * @return {!Array.<string>} * @export */ getAudioLanguages() { return Array.from(shaka.Player.getLanguagesFrom_(this.getVariantTracks())); } /** * Return a list of text languages available. If the player has not loaded * any content, this will return an empty list. * * @return {!Array.<string>} * @export */ getTextLanguages() { return Array.from(shaka.Player.getLanguagesFrom_(this.getTextTracks())); } /** * Sets the current audio language and current variant role to the selected * language and role, and chooses a new variant if need be. If the player has * not loaded any content, this will be a no-op. * * @param {string} language * @param {string=} role * @export */ selectAudioLanguage(language, role) { const LanguageUtils = shaka.util.LanguageUtils; if (this.manifest_ && this.playhead_) { this.currentAdaptationSetCriteria_ = new shaka.media.PreferenceBasedCriteria(language, role || '', /* channelCount= */ 0, /* label= */ ''); if (!this.config_.abr.enabled) { const diff = (a, b) => { if (!a.video && !b.video) { return 0; } else if (!a.video || !b.video) { return Infinity; } else { return Math.abs((a.video.height || 0) - (b.video.height || 0)) + Math.abs((a.video.width || 0) - (b.video.width || 0)); } }; // Find the variant whose size is closest to the active variant. This // ensures we stay at about the same resolution when just changing the // language/role. const active = this.streamingEngine_.getCurrentVariant(); const set = this.currentAdaptationSetCriteria_.create(this.manifest_.variants); let bestVariant = null; for (const curVariant of set.values()) { if (!bestVariant || diff(bestVariant, active) > diff(curVariant, active)) { bestVariant = curVariant; } } if (bestVariant) { const track = shaka.util.StreamUtils.variantToTrack(bestVariant); this.selectVariantTrack(track, /* clearBuffer= */ true); return; } } // If we haven't switched yet, just use ABR to find a new track. this.chooseVariantAndSwitch_(); } else if (this.video_ && this.video_.audioTracks) { const audioTracks = Array.from(this.video_.audioTracks); const selectedLanguage = LanguageUtils.normalize(language); let languageMatch = null; let languageAndRoleMatch = null; for (const audioTrack of audioTracks) { const track = shaka.util.StreamUtils.html5AudioTrackToTrack(audioTrack); if (LanguageUtils.normalize(track.language) == selectedLanguage) { languageMatch = audioTrack; if (role) { if (track.roles.includes(role)) { languageAndRoleMatch = audioTrack; } } else { // no role if (track.roles.length == 0) { languageAndRoleMatch = audioTrack; } } } } // This will reset the "enabled" of other tracks to false. if (languageAndRoleMatch) { languageAndRoleMatch.enabled = true; this.onVariantChanged_(); } else if (languageMatch) { languageMatch.enabled = true; this.onVariantChanged_(); } } } /** * Sets the current text language and current text role to the selected * language and role, and chooses a new variant if need be. If the player has * not loaded any content, this will be a no-op. * * @param {string} language * @param {string=} role * @param {boolean=} forced * @export */ selectTextLanguage(language, role, forced = false) { const LanguageUtils = shaka.util.LanguageUtils; if (this.manifest_ && this.playhead_) { this.currentTextLanguage_ = language; this.currentTextRole_ = role || ''; this.currentTextForced_ = forced; const chosenText = this.chooseTextStream_(); if (chosenText) { if (chosenText == this.streamingEngine_.getCurrentTextStream()) { shaka.log.debug('Text track already selected.'); return; } this.addTextStreamToSwitchHistory_( chosenText, /* fromAdaptation= */ false); if (this.shouldStreamText_()) { this.streamingEngine_.switchTextStream(chosenText); this.onTextChanged_(); } } } else { const selectedLanguage = LanguageUtils.normalize(language); const track = this.getTextTracks().find((t) => { return LanguageUtils.normalize(t.language) == selectedLanguage && (!role || t.roles.includes(role)) && t.forced == forced; }); if (track) { this.selectTextTrack(track); } } } /** * Select variant tracks that have a given label. This assumes the * label uniquely identifies an audio stream, so all the variants * are expected to have the same variant.audio. * * @param {string} label * @export */ selectVariantsByLabel(label) { if (this.manifest_ && this.playhead_) { let firstVariantWithLabel = null; for (const variant of this.manifest_.variants) { if (variant.audio.label == label) { firstVariantWithLabel = variant; break; } } if (firstVariantWithLabel == null) { shaka.log.warning('No variants were found with label: ' + label + '. Ignoring the request to switch.'); return; } // Label is a unique identifier of a variant's audio stream. // Because of that we assume that all the variants with the same // label have the same language. this.currentAdaptationSetCriteria_ = new shaka.media.PreferenceBasedCriteria( firstVariantWithLabel.language, '', 0, label); this.chooseVariantAndSwitch_(); } } /** * Check if the text displayer is enabled. * * @return {boolean} * @export */ isTextTrackVisible() { const expected = this.isTextVisible_; if (this.mediaSourceEngine_) { // Make sure our values are still in-sync. const actual = this.mediaSourceEngine_.getTextDisplayer().isTextVisible(); goog.asserts.assert( actual == expected, 'text visibility has fallen out of sync'); // Always return the actual value so that the app has the most accurate // information (in the case that the values come out of sync in prod). return actual; } else if (this.video_ && this.video_.src && this.video_.textTracks) { const textTracks = this.getFilteredTextTracks_(); return textTracks.some((t) => t.mode == 'showing'); } return expected; } /** * Ignore the TextTracks with the 'metadata' or 'chapters' kind, or the one * generated by the SimpleTextDisplayer. * * @return {!Array.<TextTrack>} * @private */ getFilteredTextTracks_() { goog.asserts.assert(this.video_.textTracks, 'TextTracks should be valid.'); return Array.from(this.video_.textTracks) .filter((t) => t.kind != 'metadata' && t.kind != 'chapters' && t.label != shaka.Player.TextTrackLabel); } /** * Get the TextTracks with the 'metadata' kind. * * @return {!Array.<TextTrack>} * @private */ getMetadataTracks_() { goog.asserts.assert(this.video_.textTracks, 'TextTracks should be valid.'); return Array.from(this.video_.textTracks) .filter((t) => t.kind == 'metadata'); } /** * Enable or disable the text displayer. If the player is in an unloaded * state, the request will be applied next time content is loaded. * * @param {boolean} isVisible * @export */ setTextTrackVisibility(isVisible) { const oldVisibilty = this.isTextVisible_; // Convert to boolean in case apps pass 0/1 instead false/true. const newVisibility = !!isVisible; if (oldVisibilty == newVisibility) { return; } this.isTextVisible_ = newVisibility; // Hold of on setting the text visibility until we have all the components // we need. This ensures that they stay in-sync. if (this.loadMode_ == shaka.Player.LoadMode.MEDIA_SOURCE) { this.mediaSourceEngine_.getTextDisplayer() .setTextVisibility(newVisibility); // When the user wants to see captions, we stream captions. When the user // doesn't want to see captions, we don't stream captions. This is to // avoid bandwidth consumption by an unused resource. The app developer // can override this and configure us to always stream captions. if (!this.config_.streaming.alwaysStreamText) { if (newVisibility) { if (this.streamingEngine_.getCurrentTextStream()) { // We already have a selected text stream. } else { // Find the text stream that best matches the user's preferences. const streams = shaka.util.StreamUtils.filterStreamsByLanguageAndRole( this.manifest_.textStreams, this.currentTextLanguage_, this.currentTextRole_, this.currentTextForced_); // It is possible that there are no streams to play. if (streams.length > 0) { this.streamingEngine_.switchTextStream(streams[0]); this.onTextChanged_(); } } } else { this.streamingEngine_.unloadTextStream(); } } } else if (this.video_ && this.video_.src && this.video_.textTracks) { const textTracks = this.getFilteredTextTracks_(); // Find the active track by looking for one which is not disabled. This // is the only way to identify the track which is currently displayed. // Set it to 'showing' or 'hidden' based on newVisibility. for (const textTrack of textTracks) { if (textTrack.mode != 'disabled') { textTrack.mode = newVisibility ? 'showing' : 'hidden'; } } } // We need to fire the event after we have updated everything so that // everything will be in a stable state when the app responds to the // event. this.onTextTrackVisibility_(); } /** * Get the current playhead position as a date. This should only be called * when the player has loaded a live stream. If the player has not loaded a * live stream, this will return <code>null</code>. * * @return {Date} * @export */ getPlayheadTimeAsDate() { if (!this.isLive()) { shaka.log.warning('getPlayheadTimeAsDate is for live streams!'); return null; } const walkerPayload = this.walker_.getCurrentPayload(); let presentationTime = 0; if (this.playhead_) { presentationTime = this.playhead_.getTime(); } else if (walkerPayload) { if (walkerPayload.startTime == null) { // A live stream with no requested start time and no playhead yet. We // would start at the live edge, but we don't have that yet, so return // the current date & time. return new Date(); } else { // A specific start time has been requested. This is what Playhead will // use once it is created. presentationTime = walkerPayload.startTime; } } if (this.manifest_) { const timeline = this.manifest_.presentationTimeline; const startTime = timeline.getPresentationStartTime(); return new Date(/* ms= */ (startTime + presentationTime) * 1000); } else if (this.video_ && this.video_.getStartDate) { // Apple's native HLS gives us getStartDate(), which is only available if // EXT-X-PROGRAM-DATETIME is in the playlist. const startDate = this.video_.getStartDate(); if (isNaN(startDate.getTime())) { shaka.log.warning( 'EXT-X-PROGRAM-DATETIME required to get playhead time as Date!'); return null; } return new Date(startDate.getTime() + (presentationTime * 1000)); } else { shaka.log.warning('No way to get playhead time as Date!'); return null; } } /** * Get the presentation start time as a date. This should only be called when * the player has loaded a live stream. If the player has not loaded a live * stream, this will return <code>null</code>. * * @return {Date} * @export */ getPresentationStartTimeAsDate() { if (!this.isLive()) { shaka.log.warning('getPresentationStartTimeAsDate is for live streams!'); return null; } if (this.manifest_) { const timeline = this.manifest_.presentationTimeline; const startTime = timeline.getPresentationStartTime(); goog.asserts.assert(startTime != null, 'Presentation start time should not be null!'); return new Date(/* ms= */ startTime * 1000); } else if (this.video_ && this.video_.getStartDate) { // Apple's native HLS gives us getStartDate(), which is only available if // EXT-X-PROGRAM-DATETIME is in the playlist. const startDate = this.video_.getStartDate(); if (isNaN(startDate.getTime())) { shaka.log.warning( 'EXT-X-PROGRAM-DATETIME required to get presentation start time ' + 'as Date!'); return null; } return startDate; } else { shaka.log.warning('No way to get presentation start time as Date!'); return null; } } /** * Get information about what the player has buffered. If the player has not * loaded content or is currently loading content, the buffered content will * be empty. * * @return {shaka.extern.BufferedInfo} * @export */ getBufferedInfo() { if (this.loadMode_ == shaka.Player.LoadMode.MEDIA_SOURCE) { return this.mediaSourceEngine_.getBufferedInfo(); } const info = { total: [], audio: [], video: [], text: [], }; if (this.loadMode_ == shaka.Player.LoadMode.SRC_EQUALS) { const TimeRangesUtils = shaka.media.TimeRangesUtils; info.total = TimeRangesUtils.getBufferedInfo(this.video_.buffered); } return info; } /** * Get statistics for the current playback session. If the player is not * playing content, this will return an empty stats object. * * @return {shaka.extern.Stats} * @export */ getStats() { // If the Player is not in a fully-loaded state, then return an empty stats // blob so that this call will never fail. const loaded = this.loadMode_ == shaka.Player.LoadMode.MEDIA_SOURCE || this.loadMode_ == shaka.Player.LoadMode.SRC_EQUALS; if (!loaded) { return shaka.util.Stats.getEmptyBlob(); } this.updateStateHistory_(); goog.asserts.assert(this.video_, 'If we have stats, we should have video_'); const element = /** @type {!HTMLVideoElement} */ (this.video_); const completionRatio = element.currentTime / element.duration; if (!isNaN(completionRatio)) { this.stats_.setCompletionPercent(Math.round(100 * completionRatio)); } if (element.getVideoPlaybackQuality) { const info = element.getVideoPlaybackQuality(); this.stats_.setDroppedFrames( Number(info.droppedVideoFrames), Number(info.totalVideoFrames)); this.stats_.setCorruptedFrames(Number(info.corruptedVideoFrames)); } const licenseSeconds = this.drmEngine_ ? this.drmEngine_.getLicenseTime() : NaN; this.stats_.setLicenseTime(licenseSeconds); if (this.loadMode_ == shaka.Player.LoadMode.MEDIA_SOURCE) { // Event through we are loaded, it is still possible that we don't have a // variant yet because we set the load mode before we select the first // variant to stream. const variant = this.streamingEngine_.getCurrentVariant(); if (variant) { const rate = this.playRateController_ ? this.playRateController_.getRealRate() : 1; const variantBandwidth = rate * variant.bandwidth; // TODO: Should include text bandwidth if it enabled. const currentStreamBandwidth = variantBandwidth; this.stats_.setCurrentStreamBandwidth(currentStreamBandwidth); } if (variant && variant.video) { this.stats_.setResolution( /* width= */ variant.video.width || NaN, /* height= */ variant.video.height || NaN); } if (this.isLive()) { const now = this.getPresentationStartTimeAsDate().valueOf() + this.seekRange().end * 1000; const latency = (Date.now() - now) / 1000; this.stats_.setLiveLatency(latency); } if (this.manifest_ && this.manifest_.presentationTimeline) { const maxSegmentDuration = this.manifest_.presentationTimeline.getMaxSegmentDuration(); this.stats_.setMaxSegmentDuration(maxSegmentDuration); } const estimate = this.abrManager_.getBandwidthEstimate(); this.stats_.setBandwidthEstimate(estimate); } return this.stats_.getBlob(); } /** * Adds the given text track to the loaded manifest. <code>load()</code> must * resolve before calling. The presentation must have a duration. * * This returns the created track, which can immediately be selected by the * application. The track will not be automatically selected. * * @param {string} uri * @param {string} language * @param {string} kind * @param {string=} mimeType * @param {string=} codec * @param {string=} label * @param {boolean=} forced * @return {shaka.extern.Track} * @export */ addTextTrack(uri, language, kind, mimeType, codec, label, forced = false) { shaka.Deprecate.deprecateFeature(4, 'addTextTrack', 'Please use an addTextTrackAsync.'); if (this.loadMode_ != shaka.Player.LoadMode.MEDIA_SOURCE && this.loadMode_ != shaka.Player.LoadMode.SRC_EQUALS) { shaka.log.error( 'Must call load() and wait for it to resolve before adding text ' + 'tracks.'); throw new shaka.util.Error( shaka.util.Error.Severity.RECOVERABLE, shaka.util.Error.Category.PLAYER, shaka.util.Error.Code.CONTENT_NOT_LOADED); } if (!mimeType) { // Try using the uri extension. const extension = shaka.media.ManifestParser.getExtension(uri); mimeType = { 'sbv': 'text/x-subviewer', 'srt': 'text/srt', 'vtt': 'text/vtt', 'webvtt': 'text/vtt', 'ttml': 'application/ttml+xml', 'lrc': 'application/x-subtitle-lrc', 'ssa': 'text/x-ssa', 'ass': 'text/x-ssa', }[extension]; if (!mimeType) { shaka.log.error( 'The mimeType has not been provided and it could not be deduced ' + 'from its extension.'); throw new shaka.util.Error( shaka.util.Error.Severity.RECOVERABLE, shaka.util.Error.Category.TEXT, shaka.util.Error.Code.TEXT_COULD_NOT_GUESS_MIME_TYPE, extension); } } if (this.loadMode_ == shaka.Player.LoadMode.SRC_EQUALS) { if (mimeType != 'text/vtt') { shaka.log.error('Only WebVTT is supported when using src='); throw new shaka.util.Error( shaka.util.Error.Severity.RECOVERABLE, shaka.util.Error.Category.TEXT, shaka.util.Error.Code.TEXT_ONLY_WEBVTT_SRC_EQUALS, mimeType); } if (forced) { // See: https://github.com/whatwg/html/issues/4472 kind = 'forced'; } const trackElement = document.createElement('track'); trackElement.setAttribute('src', uri); trackElement.setAttribute('label', label || ''); trackElement.setAttribute('kind', kind); trackElement.setAttribute('srclang', language); // Because we're pulling in the text track file via Javascript, the // same-origin policy applies. If you'd like to have a player served // from one domain, but the text track served from another, you'll // need to enable CORS in order to do so. In addition to enabling CORS // on the server serving the text tracks, you will need to add the // crossorigin attribute to the video element itself. if (!this.video_.getAttribute('crossorigin')) { this.video_.setAttribute('crossorigin', 'anonymous'); } this.video_.appendChild(trackElement); const textTracks = this.getTextTracks(); const srcTrack = textTracks.find((t) => { return t.language == language && t.label == (label || '') && t.kind == kind; }); if (srcTrack) { this.onTracksChanged_(); return srcTrack; } // This should not happen, but there are browser implementations that may // not support the Track element. shaka.log.error('Cannot add this text when loaded with src='); throw new shaka.util.Error( shaka.util.Error.Severity.RECOVERABLE, shaka.util.Error.Category.TEXT, shaka.util.Error.Code.CANNOT_ADD_EXTERNAL_TEXT_TO_SRC_EQUALS); } const ContentType = shaka.util.ManifestParserUtils.ContentType; const duration = this.manifest_.presentationTimeline.getDuration(); if (duration == Infinity) { throw new shaka.util.Error( shaka.util.Error.Severity.RECOVERABLE, shaka.util.Error.Category.MANIFEST, shaka.util.Error.Code.CANNOT_ADD_EXTERNAL_TEXT_TO_LIVE_STREAM); } /** @type {shaka.extern.Stream} */ const stream = { id: this.nextExternalStreamId_++, originalId: null, createSegmentIndex: () => Promise.resolve(), segmentIndex: shaka.media.SegmentIndex.forSingleSegment( /* startTime= */ 0, /* duration= */ duration, /* uris= */ [uri]), mimeType: mimeType || '', codecs: codec || '', kind: kind, encrypted: false, drmInfos: [], keyIds: new Set(), language: language, label: label || null, type: ContentType.TEXT, primary: false, trickModeVideo: null, emsgSchemeIdUris: null, roles: [], forced: !!forced, channelsCount: null, audioSamplingRate: null, spatialAudio: false, closedCaptions: null, }; const fullMimeType = shaka.util.MimeUtils.getFullType( stream.mimeType, stream.codecs); const supported = shaka.text.TextEngine.isTypeSupported(fullMimeType); if (!supported) { throw new shaka.util.Error( shaka.util.Error.Severity.CRITICAL, shaka.util.Error.Category.TEXT, shaka.util.Error.Code.MISSING_TEXT_PLUGIN, mimeType); } this.manifest_.textStreams.push(stream); this.onTracksChanged_(); return shaka.util.StreamUtils.textStreamToTrack(stream); } /** * Adds the given text track to the loaded manifest. <code>load()</code> must * resolve before calling. The presentation must have a duration. * * This returns the created track, which can immediately be selected by the * application. The track will not be automatically selected. * * @param {string} uri * @param {string} language * @param {string} kind * @param {string=} mimeType * @param {string=} codec * @param {string=} label * @param {boolean=} forced * @return {!Promise.<shaka.extern.Track>} * @export */ async addTextTrackAsync(uri, language, kind, mimeType, codec, label, forced = false) { if (this.loadMode_ != shaka.Player.LoadMode.MEDIA_SOURCE && this.loadMode_ != shaka.Player.LoadMode.SRC_EQUALS) { shaka.log.error( 'Must call load() and wait for it to resolve before adding text ' + 'tracks.'); throw new shaka.util.Error( shaka.util.Error.Severity.RECOVERABLE, shaka.util.Error.Category.PLAYER, shaka.util.Error.Code.CONTENT_NOT_LOADED); } if (!mimeType) { // Try using the uri extension. const extension = shaka.media.ManifestParser.getExtension(uri); mimeType = { 'sbv': 'text/x-subviewer', 'srt': 'text/srt', 'vtt': 'text/vtt', 'webvtt': 'text/vtt', 'ttml': 'application/ttml+xml', 'lrc': 'application/x-subtitle-lrc', 'ssa': 'text/x-ssa', 'ass': 'text/x-ssa', }[extension]; if (!mimeType) { try { goog.asserts.assert( this.networkingEngine_, 'Need networking engine.'); // eslint-disable-next-line require-atomic-updates mimeType = await shaka.media.ManifestParser.getMimeType(uri, this.networkingEngine_, this.config_.streaming.retryParameters); } catch (error) {} } if (!mimeType) { shaka.log.error( 'The mimeType has not been provided and it could not be deduced ' + 'from its extension.'); throw new shaka.util.Error( shaka.util.Error.Severity.RECOVERABLE, shaka.util.Error.Category.TEXT, shaka.util.Error.Code.TEXT_COULD_NOT_GUESS_MIME_TYPE, extension); } } if (this.loadMode_ == shaka.Player.LoadMode.SRC_EQUALS) { if (mimeType != 'text/vtt') { goog.asserts.assert( this.networkingEngine_, 'Need networking engine.'); const data = await this.getTextData_(uri, this.networkingEngine_, this.config_.streaming.retryParameters); const vvtText = this.convertToWebVTT_(data, mimeType); const blob = new Blob([vvtText], {type: 'text/vtt'}); uri = URL.createObjectURL(blob); mimeType = 'text/vtt'; } if (forced) { // See: https://github.com/whatwg/html/issues/4472 kind = 'forced'; } const trackElement = document.createElement('track'); trackElement.setAttribute('src', uri); trackElement.setAttribute('label', label || ''); trackElement.setAttribute('kind', kind); trackElement.setAttribute('srclang', language); // Because we're pulling in the text track file via Javascript, the // same-origin policy applies. If you'd like to have a player served // from one domain, but the text track served from another, you'll // need to enable CORS in order to do so. In addition to enabling CORS // on the server serving the text tracks, you will need to add the // crossorigin attribute to the video element itself. if (!this.video_.getAttribute('crossorigin')) { this.video_.setAttribute('crossorigin', 'anonymous'); } this.video_.appendChild(trackElement); const textTracks = this.getTextTracks(); const srcTrack = textTracks.find((t) => { return t.language == language && t.label == (label || '') && t.kind == kind; }); if (srcTrack) { this.onTracksChanged_(); return srcTrack; } // This should not happen, but there are browser implementations that may // not support the Track element. shaka.log.error('Cannot add this text when loaded with src='); throw new shaka.util.Error( shaka.util.Error.Severity.RECOVERABLE, shaka.util.Error.Category.TEXT, shaka.util.Error.Code.CANNOT_ADD_EXTERNAL_TEXT_TO_SRC_EQUALS); } const ContentType = shaka.util.ManifestParserUtils.ContentType; const duration = this.manifest_.presentationTimeline.getDuration(); if (duration == Infinity) { throw new shaka.util.Error( shaka.util.Error.Severity.RECOVERABLE, shaka.util.Error.Category.MANIFEST, shaka.util.Error.Code.CANNOT_ADD_EXTERNAL_TEXT_TO_LIVE_STREAM); } /** @type {shaka.extern.Stream} */ const stream = { id: this.nextExternalStreamId_++, originalId: null, createSegmentIndex: () => Promise.resolve(), segmentIndex: shaka.media.SegmentIndex.forSingleSegment( /* startTime= */ 0, /* duration= */ duration, /* uris= */ [uri]), mimeType: mimeType || '', codecs: codec || '', kind: kind, encrypted: false, drmInfos: [], keyIds: new Set(), language: language, label: label || null, type: ContentType.TEXT, primary: false, trickModeVideo: null, emsgSchemeIdUris: null, roles: [], forced: !!forced, channelsCount: null, audioSamplingRate: null, spatialAudio: false, closedCaptions: null, }; const fullMimeType = shaka.util.MimeUtils.getFullType( stream.mimeType, stream.codecs); const supported = shaka.text.TextEngine.isTypeSupported(fullMimeType); if (!supported) { throw new shaka.util.Error( shaka.util.Error.Severity.CRITICAL, shaka.util.Error.Category.TEXT, shaka.util.Error.Code.MISSING_TEXT_PLUGIN, mimeType); } this.manifest_.textStreams.push(stream); this.onTracksChanged_(); return shaka.util.StreamUtils.textStreamToTrack(stream); } /** * @param {string} uri * @param {!shaka.net.NetworkingEngine} netEngine * @param {shaka.extern.RetryParameters} retryParams * @return {!Promise.<BufferSource>} * @private */ async getTextData_(uri, netEngine, retryParams) { const type = shaka.net.NetworkingEngine.RequestType.SEGMENT; const request = shaka.net.NetworkingEngine.makeRequest([uri], retryParams); request.method = 'GET'; const response = await netEngine.request(type, request).promise; return response.data; } /** * Converts an input string to a WebVTT format string. * * @param {BufferSource} buffer * @param {string} mimeType * @return {string} * @private */ convertToWebVTT_(buffer, mimeType) { const factory = shaka.text.TextEngine.findParser(mimeType); if (factory) { const obj = factory(); const time = { periodStart: 0, segmentStart: 0, segmentEnd: this.video_.duration, }; const data = shaka.util.BufferUtils.toUint8(buffer); const cues = obj.parseMedia(data, time); return shaka.text.WebVttGenerator.convert(cues); } throw new shaka.util.Error( shaka.util.Error.Severity.CRITICAL, shaka.util.Error.Category.TEXT, shaka.util.Error.Code.MISSING_TEXT_PLUGIN, mimeType); } /** * Set the maximum resolution that the platform's hardware can handle. * This will be called automatically by <code>shaka.cast.CastReceiver</code> * to enforce limitations of the Chromecast hardware. * * @param {number} width * @param {number} height * @export */ setMaxHardwareResolution(width, height) { this.maxHwRes_.width = width; this.maxHwRes_.height = height; } /** * Retry streaming after a streaming failure has occurred. When the player has * not loaded content or is loading content, this will be a no-op and will * return <code>false</code>. * * <p> * If the player has loaded content, and streaming has not seen an error, this * will return <code>false</code>. * * <p> * If the player has loaded content, and streaming seen an error, but the * could not resume streaming, this will return <code>false</code>. * * @return {boolean} * @export */ retryStreaming() { return this.loadMode_ == shaka.Player.LoadMode.MEDIA_SOURCE ? this.streamingEngine_.retry() : false; } /** * Get the manifest that the player has loaded. If the player has not loaded * any content, this will return <code>null</code>. * * NOTE: This structure is NOT covered by semantic versioning compatibility * guarantees. It may change at any time! * * This is marked as deprecated to warn Closure Compiler users at compile-time * to avoid using this method. * * @return {?shaka.extern.Manifest} * @export * @deprecated */ getManifest() { shaka.log.alwaysWarn( 'Shaka Player\'s internal Manifest structure is NOT covered by ' + 'semantic versioning compatibility guarantees. It may change at any ' + 'time! Please consider filing a feature request for whatever you ' + 'use getManifest() for.'); return this.manifest_; } /** * Get the type of manifest parser that the player is using. If the player has * not loaded any content, this will return <code>null</code>. * * @return {?shaka.extern.ManifestParser.Factory} * @export */ getManifestParserFactory() { return this.parserFactory_; } /** * @param {shaka.extern.Variant} variant * @param {boolean} fromAdaptation * @private */ addVariantToSwitchHistory_(variant, fromAdaptation) { const switchHistory = this.stats_.getSwitchHistory(); switchHistory.updateCurrentVariant(variant, fromAdaptation); } /** * @param {shaka.extern.Stream} textStream * @param {boolean} fromAdaptation * @private */ addTextStreamToSwitchHistory_(textStream, fromAdaptation) { const switchHistory = this.stats_.getSwitchHistory(); switchHistory.updateCurrentText(textStream, fromAdaptation); } /** * @return {shaka.extern.PlayerConfiguration} * @private */ defaultConfig_() { const config = shaka.util.PlayerConfiguration.createDefault(); config.streaming.failureCallback = (error) => { this.defaultStreamingFailureCallback_(error); }; // Because this.video_ may not be set when the config is built, the default // TextDisplay factory must capture a reference to "this". config.textDisplayFactory = () => { if (this.videoContainer_) { return new shaka.text.UITextDisplayer( this.video_, this.videoContainer_); } else { return new shaka.text.SimpleTextDisplayer(this.video_); } }; return config; } /** * Set the videoContainer to construct UITextDisplayer. * @param {HTMLElement} videoContainer * @export */ setVideoContainer(videoContainer) { this.videoContainer_ = videoContainer; } /** * @param {!shaka.util.Error} error * @private */ defaultStreamingFailureCallback_(error) { const retryErrorCodes = [ shaka.util.Error.Code.BAD_HTTP_STATUS, shaka.util.Error.Code.HTTP_ERROR, shaka.util.Error.Code.TIMEOUT, ]; if (this.isLive() && retryErrorCodes.includes(error.code)) { error.severity = shaka.util.Error.Severity.RECOVERABLE; shaka.log.warning('Live streaming error. Retrying automatically...'); this.retryStreaming(); } } /** * For CEA closed captions embedded in the video streams, create dummy text * stream. This can be safely called again on existing manifests, for * manifest updates. * @param {!shaka.extern.Manifest} manifest * @private */ makeTextStreamsForClosedCaptions_(manifest) { const ContentType = shaka.util.ManifestParserUtils.ContentType; const TextStreamKind = shaka.util.ManifestParserUtils.TextStreamKind; const CEA608_MIME = shaka.util.MimeUtils.CEA608_CLOSED_CAPTION_MIMETYPE; const CEA708_MIME = shaka.util.MimeUtils.CEA708_CLOSED_CAPTION_MIMETYPE; // A set, to make sure we don't create two text streams for the same video. const closedCaptionsSet = new Set(); for (const textStream of manifest.textStreams) { if (textStream.mimeType == CEA608_MIME || textStream.mimeType == CEA708_MIME) { // This function might be called on a manifest update, so don't make a // new text stream for closed caption streams we have seen before. closedCaptionsSet.add(textStream.originalId); } } for (const variant of manifest.variants) { const video = variant.video; if (video && video.closedCaptions) { for (const id of video.closedCaptions.keys()) { if (!closedCaptionsSet.has(id)) { const mimeType = id.startsWith('CC') ? CEA608_MIME : CEA708_MIME; // Add an empty segmentIndex, for the benefit of the period combiner // in our builtin DASH parser. const segmentIndex = new shaka.media.MetaSegmentIndex(); const textStream = { id: this.nextExternalStreamId_++, // A globally unique ID. originalId: id, // The CC ID string, like 'CC1', 'CC3', etc. createSegmentIndex: () => Promise.resolve(), segmentIndex, mimeType, codecs: '', kind: TextStreamKind.CLOSED_CAPTION, encrypted: false, drmInfos: [], keyIds: new Set(), language: video.closedCaptions.get(id), label: null, type: ContentType.TEXT, primary: false, trickModeVideo: null, emsgSchemeIdUris: null, roles: video.roles, forced: false, channelsCount: null, audioSamplingRate: null, spatialAudio: false, closedCaptions: null, }; manifest.textStreams.push(textStream); closedCaptionsSet.add(id); } } } } } /** * Filters a manifest, removing unplayable streams/variants. * * @param {?shaka.extern.Manifest} manifest * @private */ async filterManifest_(manifest) { await this.filterManifestWithStreamUtils_(manifest); this.filterManifestWithRestrictions_(manifest); } /** * Filters a manifest, removing unplayable streams/variants. * * @param {?shaka.extern.Manifest} manifest * @private */ async filterManifestWithStreamUtils_(manifest) { goog.asserts.assert(manifest, 'Manifest should exist!'); goog.asserts.assert(this.video_, 'Must not be destroyed'); /** @type {?shaka.extern.Variant} */ const currentVariant = this.streamingEngine_ ? this.streamingEngine_.getCurrentVariant() : null; await shaka.util.StreamUtils.filterManifest( this.drmEngine_, currentVariant, manifest, this.config_.useMediaCapabilities); this.checkPlayableVariants_(manifest); } /** * Apply the restrictions configuration to the manifest, and check if there's * a variant that meets the restrictions. * * @param {?shaka.extern.Manifest} manifest * @private */ filterManifestWithRestrictions_(manifest) { // Return if |destroy| is called. if (this.loadMode_ == shaka.Player.LoadMode.DESTROYED) { return; } const tracksChanged = shaka.util.StreamUtils.applyRestrictions( manifest.variants, this.config_.restrictions, this.maxHwRes_); if (tracksChanged && this.streamingEngine_) { this.onTracksChanged_(); } // We may need to create new sessions for any new init data. const curDrmInfo = this.drmEngine_ ? this.drmEngine_.getDrmInfo() : null; // DrmEngine.newInitData() requires mediaKeys to be available. if (curDrmInfo && this.drmEngine_.getMediaKeys()) { for (const variant of manifest.variants) { const videoDrmInfos = variant.video ? variant.video.drmInfos : []; const audioDrmInfos = variant.audio ? variant.audio.drmInfos : []; const drmInfos = videoDrmInfos.concat(audioDrmInfos); for (const drmInfo of drmInfos) { // Ignore any data for different key systems. if (drmInfo.keySystem == curDrmInfo.keySystem) { for (const initData of (drmInfo.initData || [])) { this.drmEngine_.newInitData( initData.initDataType, initData.initData); } } } } } this.checkRestrictedVariants_(manifest); } /** * @private */ filterManifestByCurrentVariant_() { goog.asserts.assert(this.manifest_, 'Manifest should be valid'); goog.asserts.assert(this.streamingEngine_, 'StreamingEngine should be valid'); const currentVariant = this.streamingEngine_ ? this.streamingEngine_.getCurrentVariant() : null; shaka.util.StreamUtils.filterManifestByCurrentVariant(currentVariant, this.manifest_); this.checkPlayableVariants_(this.manifest_); } /** * @param {shaka.extern.Variant} initialVariant * @param {number} time * @return {!Promise.<number>} * @private */ async adjustStartTime_(initialVariant, time) { /** @type {?shaka.extern.Stream} */ const activeAudio = initialVariant.audio; /** @type {?shaka.extern.Stream} */ const activeVideo = initialVariant.video; /** * @param {?shaka.extern.Stream} stream * @param {number} time * @return {!Promise.<?number>} */ const getAdjustedTime = async (stream, time) => { if (!stream) { return null; } await stream.createSegmentIndex(); const ref = stream.segmentIndex[Symbol.iterator]().seek(time); if (!ref) { return null; } const refTime = ref.startTime; goog.asserts.assert(refTime <= time, 'Segment should start before target time!'); return refTime; }; const audioStartTime = await getAdjustedTime(activeAudio, time); const videoStartTime = await getAdjustedTime(activeVideo, time); // If we have both video and audio times, pick the larger one. If we picked // the smaller one, that one will download an entire segment to buffer the // difference. if (videoStartTime != null && audioStartTime != null) { return Math.max(videoStartTime, audioStartTime); } else if (videoStartTime != null) { return videoStartTime; } else if (audioStartTime != null) { return audioStartTime; } else { return time; } } /** * Update the buffering state to be either "we are buffering" or "we are not * buffering", firing events to the app as needed. * * @private */ updateBufferState_() { const isBuffering = this.isBuffering(); shaka.log.v2('Player changing buffering state to', isBuffering); // Make sure we have all the components we need before we consider ourselves // as being loaded. // TODO: Make the check for "loaded" simpler. const loaded = this.stats_ && this.bufferObserver_ && this.playhead_; if (loaded) { this.playRateController_.setBuffering(isBuffering); this.updateStateHistory_(); } // Surface the buffering event so that the app knows if/when we are // buffering. const eventName = shaka.Player.EventName.Buffering; this.dispatchEvent(this.makeEvent_(eventName, {'buffering': isBuffering})); } /** * A callback for when the playback rate changes. We need to watch the * playback rate so that if the playback rate on the media element changes * (that was not caused by our play rate controller) we can notify the * controller so that it can stay in-sync with the change. * * @private */ onRateChange_() { /** @type {number} */ const newRate = this.video_.playbackRate; // On Edge, when someone seeks using the native controls, it will set the // playback rate to zero until they finish seeking, after which it will // return the playback rate. // // If the playback rate changes while seeking, Edge will cache the playback // rate and use it after seeking. // // https://github.com/google/shaka-player/issues/951 if (newRate == 0) { return; } if (this.playRateController_) { // The playback rate has changed. This could be us or someone else. // If this was us, setting the rate again will be a no-op. this.playRateController_.set(newRate); } const event = this.makeEvent_(shaka.Player.EventName.RateChange); this.dispatchEvent(event); } /** * Try updating the state history. If the player has not finished * initializing, this will be a no-op. * * @private */ updateStateHistory_() { // If we have not finish initializing, this will be a no-op. if (!this.stats_) { return; } if (!this.bufferObserver_) { return; } const State = shaka.media.BufferingObserver.State; const history = this.stats_.getStateHistory(); if (this.bufferObserver_.getState() == State.STARVING) { history.update('buffering'); } else if (this.video_.paused) { history.update('paused'); } else if (this.video_.ended) { history.update('ended'); } else { history.update('playing'); } } /** * Callback from Playhead. * * @private */ onSeek_() { if (this.playheadObservers_) { this.playheadObservers_.notifyOfSeek(); } if (this.streamingEngine_) { this.streamingEngine_.seeked(); } if (this.bufferObserver_) { // If we seek into an unbuffered range, we should fire a 'buffering' event // immediately. If StreamingEngine can buffer fast enough, we may not // update our buffering tracking otherwise. this.pollBufferState_(); } } /** * Update AbrManager with variants while taking into account restrictions, * preferences, and ABR. * * On error, this dispatches an error event and returns false. * * @return {boolean} True if successful. * @private */ updateAbrManagerVariants_() { try { goog.asserts.assert(this.manifest_, 'Manifest should exist by now!'); this.checkRestrictedVariants_(this.manifest_); } catch (e) { this.onError_(e); return false; } const playableVariants = this.manifest_.variants.filter((variant) => { return shaka.util.StreamUtils.isPlayable(variant); }); // Update the abr manager with newly filtered variants. const adaptationSet = this.currentAdaptationSetCriteria_.create( playableVariants); this.abrManager_.setVariants(Array.from(adaptationSet.values())); return true; } /** * Chooses a variant from all possible variants while taking into account * restrictions, preferences, and ABR. * * On error, this dispatches an error event and returns null. * * @return {?shaka.extern.Variant} * @private */ chooseVariant_() { if (this.updateAbrManagerVariants_()) { return this.abrManager_.chooseVariant(); } else { return null; } } /** * Choose a text stream from all possible text streams while taking into * account user preference. * * @return {?shaka.extern.Stream} * @private */ chooseTextStream_() { const subset = shaka.util.StreamUtils.filterStreamsByLanguageAndRole( this.manifest_.textStreams, this.currentTextLanguage_, this.currentTextRole_, this.currentTextForced_); return subset[0] || null; } /** * Chooses a new Variant. If the new variant differs from the old one, it * adds the new one to the switch history and switches to it. * * Called after a config change, a key status event, or an explicit language * change. * * @private */ chooseVariantAndSwitch_() { goog.asserts.assert(this.config_, 'Must not be destroyed'); // Because we're running this after a config change (manual language // change) or a key status event, it is always okay to clear the buffer // here. const chosenVariant = this.chooseVariant_(); if (chosenVariant) { if (chosenVariant == this.streamingEngine_.getCurrentVariant()) { shaka.log.debug('Variant already selected.'); return; } this.addVariantToSwitchHistory_( chosenVariant, /* fromAdaptation= */ true); this.streamingEngine_.switchVariant( chosenVariant, /* clearBuffers= */ true, /* safeMargin= */ 0); // Dispatch a 'variantchanged' event this.onVariantChanged_(); } // Send an adaptation event so that the UI can show the new // language/tracks. this.onAdaptation_(); } /** * Decide during startup if text should be streamed/shown. * @private */ setInitialTextState_(initialVariant, initialTextStream) { // Check if we should show text (based on difference between audio and text // languages). if (initialTextStream) { if (initialVariant.audio && this.shouldInitiallyShowText_( initialVariant.audio, initialTextStream)) { this.isTextVisible_ = true; } if (this.isTextVisible_) { // If the cached value says to show text, then update the text displayer // since it defaults to not shown. this.mediaSourceEngine_.getTextDisplayer().setTextVisibility(true); goog.asserts.assert(this.shouldStreamText_(), 'Should be streaming text'); } this.onTextTrackVisibility_(); } else { this.isTextVisible_ = false; } } /** * Check if we should show text on screen automatically. * * The text should automatically be shown if the text is language-compatible * with the user's text language preference, but not compatible with the * audio. * * For example: * preferred | chosen | chosen | * text | text | audio | show * ----------------------------------- * en-CA | en | jp | true * en | en-US | fr | true * fr-CA | en-US | jp | false * en-CA | en-US | en-US | false * * @param {shaka.extern.Stream} audioStream * @param {shaka.extern.Stream} textStream * @return {boolean} * @private */ shouldInitiallyShowText_(audioStream, textStream) { const LanguageUtils = shaka.util.LanguageUtils; /** @type {string} */ const preferredTextLocale = LanguageUtils.normalize(this.config_.preferredTextLanguage); /** @type {string} */ const audioLocale = LanguageUtils.normalize(audioStream.language); /** @type {string} */ const textLocale = LanguageUtils.normalize(textStream.language); return ( LanguageUtils.areLanguageCompatible(textLocale, preferredTextLocale) && !LanguageUtils.areLanguageCompatible(audioLocale, textLocale)); } /** * Callback from StreamingEngine. * * @private */ onManifestUpdate_() { if (this.parser_ && this.parser_.update) { this.parser_.update(); } } /** * Callback from StreamingEngine. * * @private */ onSegmentAppended_() { // When we append a segment to media source (via streaming engine) we are // changing what data we have buffered, so notify the playhead of the // change. if (this.playhead_) { this.playhead_.notifyOfBufferingChange(); } this.pollBufferState_(); } /** * Callback from AbrManager. * * @param {shaka.extern.Variant} variant * @param {boolean=} clearBuffer * @param {number=} safeMargin Optional amount of buffer (in seconds) to * retain when clearing the buffer. * Defaults to 0 if not provided. Ignored if clearBuffer is false. * @private */ switch_(variant, clearBuffer = false, safeMargin = 0) { shaka.log.debug('switch_'); goog.asserts.assert(this.config_.abr.enabled, 'AbrManager should not call switch while disabled!'); goog.asserts.assert(this.manifest_, 'We need a manifest to switch ' + 'variants.'); if (!this.streamingEngine_) { // There's no way to change it. return; } if (variant == this.streamingEngine_.getCurrentVariant()) { // This isn't a change. return; } this.addVariantToSwitchHistory_(variant, /* fromAdaptation= */ true); this.streamingEngine_.switchVariant(variant, clearBuffer, safeMargin); this.onAdaptation_(); } /** * Dispatches an 'adaptation' event. * @private */ onAdaptation_() { // Delay the 'adaptation' event so that StreamingEngine has time to absorb // the changes before the user tries to query it. const event = this.makeEvent_(shaka.Player.EventName.Adaptation); this.delayDispatchEvent_(event); } /** * Dispatches a 'trackschanged' event. * @private */ onTracksChanged_() { // Delay the 'trackschanged' event so StreamingEngine has time to absorb the // changes before the user tries to query it. const event = this.makeEvent_(shaka.Player.EventName.TracksChanged); this.delayDispatchEvent_(event); } /** * Dispatches a 'variantchanged' event. * @private */ onVariantChanged_() { // Delay the 'variantchanged' event so StreamingEngine has time to absorb // the changes before the user tries to query it. const event = this.makeEvent_(shaka.Player.EventName.VariantChanged); this.delayDispatchEvent_(event); } /** * Dispatches a 'textchanged' event. * @private */ onTextChanged_() { // Delay the 'textchanged' event so StreamingEngine time to absorb the // changes before the user tries to query it. const event = this.makeEvent_(shaka.Player.EventName.TextChanged); this.delayDispatchEvent_(event); } /** @private */ onTextTrackVisibility_() { const event = this.makeEvent_(shaka.Player.EventName.TextTrackVisibility); this.delayDispatchEvent_(event); } /** @private */ onAbrStatusChanged_() { const event = this.makeEvent_(shaka.Player.EventName.AbrStatusChanged, { newStatus: this.config_.abr.enabled, }); this.delayDispatchEvent_(event); } /** * @param {!shaka.util.Error} error * @private */ onError_(error) { goog.asserts.assert(error instanceof shaka.util.Error, 'Wrong error type!'); // Errors dispatched after |destroy| is called are not meaningful and should // be safe to ignore. if (this.loadMode_ == shaka.Player.LoadMode.DESTROYED) { return; } const eventName = shaka.Player.EventName.Error; const event = this.makeEvent_(eventName, {'detail': error}); this.dispatchEvent(event); if (event.defaultPrevented) { error.handled = true; } } /** * When we fire region events, we need to copy the information out of the * region to break the connection with the player's internal data. We do the * copy here because this is the transition point between the player and the * app. * * @param {!shaka.Player.EventName} eventName * @param {shaka.extern.TimelineRegionInfo} region * * @private */ onRegionEvent_(eventName, region) { // Always make a copy to avoid exposing our internal data to the app. const clone = { schemeIdUri: region.schemeIdUri, value: region.value, startTime: region.startTime, endTime: region.endTime, id: region.id, eventElement: region.eventElement, }; this.dispatchEvent(this.makeEvent_(eventName, {detail: clone})); } /** * Turn the media element's error object into a Shaka Player error object. * * @return {shaka.util.Error} * @private */ videoErrorToShakaError_() { goog.asserts.assert(this.video_.error, 'Video error expected, but missing!'); if (!this.video_.error) { return null; } const code = this.video_.error.code; if (code == 1 /* MEDIA_ERR_ABORTED */) { // Ignore this error code, which should only occur when navigating away or // deliberately stopping playback of HTTP content. return null; } // Extra error information from MS Edge: let extended = this.video_.error.msExtendedCode; if (extended) { // Convert to unsigned: if (extended < 0) { extended += Math.pow(2, 32); } // Format as hex: extended = extended.toString(16); } // Extra error information from Chrome: const message = this.video_.error.message; return new shaka.util.Error( shaka.util.Error.Severity.CRITICAL, shaka.util.Error.Category.MEDIA, shaka.util.Error.Code.VIDEO_ERROR, code, extended, message); } /** * @param {!Event} event * @private */ onVideoError_(event) { const error = this.videoErrorToShakaError_(); if (!error) { return; } this.onError_(error); } /** * @param {!Object.<string, string>} keyStatusMap A map of hex key IDs to * statuses. * @private */ onKeyStatus_(keyStatusMap) { if (!this.streamingEngine_) { // We can't use this info to manage restrictions in src= mode, so ignore // it. return; } const keyIds = Object.keys(keyStatusMap); if (keyIds.length == 0) { shaka.log.warning( 'Got a key status event without any key statuses, so we don\'t ' + 'know the real key statuses. If we don\'t have all the keys, ' + 'you\'ll need to set restrictions so we don\'t select those tracks.'); } // If EME is using a synthetic key ID, the only key ID is '00' (a single 0 // byte). In this case, it is only used to report global success/failure. // See note about old platforms in: https://bit.ly/2tpez5Z const isGlobalStatus = keyIds.length == 1 && keyIds[0] == '00'; if (isGlobalStatus) { shaka.log.warning( 'Got a synthetic key status event, so we don\'t know the real key ' + 'statuses. If we don\'t have all the keys, you\'ll need to set ' + 'restrictions so we don\'t select those tracks.'); } const restrictedStatuses = shaka.Player.restrictedStatuses_; let tracksChanged = false; // Only filter tracks for keys if we have some key statuses to look at. if (keyIds.length) { for (const variant of this.manifest_.variants) { const streams = shaka.util.StreamUtils.getVariantStreams(variant); for (const stream of streams) { const originalAllowed = variant.allowedByKeySystem; // Only update if we have key IDs for the stream. If the keys aren't // all present, then the track should be restricted. if (stream.keyIds.size) { variant.allowedByKeySystem = true; for (const keyId of stream.keyIds) { const keyStatus = keyStatusMap[isGlobalStatus ? '00' : keyId]; variant.allowedByKeySystem = variant.allowedByKeySystem && !!keyStatus && !restrictedStatuses.includes(keyStatus); } } if (originalAllowed != variant.allowedByKeySystem) { tracksChanged = true; } } // for (const stream of streams) } // for (const variant of this.manifest_.variants) } // if (keyIds.size) if (tracksChanged) { this.updateAbrManagerVariants_(); } const currentVariant = this.streamingEngine_.getCurrentVariant(); if (currentVariant && !currentVariant.allowedByKeySystem) { shaka.log.debug('Choosing new streams after key status changed'); this.chooseVariantAndSwitch_(); } if (tracksChanged) { this.onTracksChanged_(); } } /** * Callback from DrmEngine * @param {string} keyId * @param {number} expiration * @private */ onExpirationUpdated_(keyId, expiration) { if (this.parser_ && this.parser_.onExpirationUpdated) { this.parser_.onExpirationUpdated(keyId, expiration); } const event = this.makeEvent_(shaka.Player.EventName.ExpirationUpdated); this.dispatchEvent(event); } /** * @return {boolean} true if we should stream text right now. * @private */ shouldStreamText_() { return this.config_.streaming.alwaysStreamText || this.isTextTrackVisible(); } /** * Applies playRangeStart and playRangeEnd to the given timeline. This will * only affect non-live content. * * @param {shaka.media.PresentationTimeline} timeline * @param {number} playRangeStart * @param {number} playRangeEnd * * @private */ static applyPlayRange_(timeline, playRangeStart, playRangeEnd) { if (playRangeStart > 0) { if (timeline.isLive()) { shaka.log.warning( '|playRangeStart| has been configured for live content. ' + 'Ignoring the setting.'); } else { timeline.setUserSeekStart(playRangeStart); } } // If the playback has been configured to end before the end of the // presentation, update the duration unless it's live content. const fullDuration = timeline.getDuration(); if (playRangeEnd < fullDuration) { if (timeline.isLive()) { shaka.log.warning( '|playRangeEnd| has been configured for live content. ' + 'Ignoring the setting.'); } else { timeline.setDuration(playRangeEnd); } } } /** * Checks if the variants are all restricted, and throw an appropriate * exception if so. * * @param {shaka.extern.Manifest} manifest * * @private */ checkRestrictedVariants_(manifest) { const restrictedStatuses = shaka.Player.restrictedStatuses_; const keyStatusMap = this.drmEngine_ ? this.drmEngine_.getKeyStatuses() : {}; const keyIds = Object.keys(keyStatusMap); const isGlobalStatus = keyIds.length && keyIds[0] == '00'; let hasPlayable = false; let hasAppRestrictions = false; /** @type {!Set.<string>} */ const missingKeys = new Set(); /** @type {!Set.<string>} */ const badKeyStatuses = new Set(); for (const variant of manifest.variants) { // TODO: Combine with onKeyStatus_. const streams = []; if (variant.audio) { streams.push(variant.audio); } if (variant.video) { streams.push(variant.video); } for (const stream of streams) { if (stream.keyIds.size) { for (const keyId of stream.keyIds) { const keyStatus = keyStatusMap[isGlobalStatus ? '00' : keyId]; if (!keyStatus) { missingKeys.add(keyId); } else if (restrictedStatuses.includes(keyStatus)) { badKeyStatuses.add(keyStatus); } } } // if (stream.keyIds.size) } if (!variant.allowedByApplication) { hasAppRestrictions = true; } else if (variant.allowedByKeySystem) { hasPlayable = true; } } if (!hasPlayable) { /** @type {shaka.extern.RestrictionInfo} */ const data = { hasAppRestrictions, missingKeys: Array.from(missingKeys), restrictedKeyStatuses: Array.from(badKeyStatuses), }; throw new shaka.util.Error( shaka.util.Error.Severity.CRITICAL, shaka.util.Error.Category.MANIFEST, shaka.util.Error.Code.RESTRICTIONS_CANNOT_BE_MET, data); } } /** * Confirm some variants are playable. Otherwise, throw an exception. * @param {!shaka.extern.Manifest} manifest * @private */ checkPlayableVariants_(manifest) { const valid = manifest.variants.some(shaka.util.StreamUtils.isPlayable); // If none of the variants are playable, throw // CONTENT_UNSUPPORTED_BY_BROWSER. if (!valid) { throw new shaka.util.Error( shaka.util.Error.Severity.CRITICAL, shaka.util.Error.Category.MANIFEST, shaka.util.Error.Code.CONTENT_UNSUPPORTED_BY_BROWSER); } } /** * Fire an event, but wait a little bit so that the immediate execution can * complete before the event is handled. * * @param {!shaka.util.FakeEvent} event * @private */ async delayDispatchEvent_(event) { // Wait until the next interpreter cycle. await Promise.resolve(); // Only dispatch the event if we are still alive. if (this.loadMode_ != shaka.Player.LoadMode.DESTROYED) { this.dispatchEvent(event); } } /** * Get the normalized languages for a group of tracks. * * @param {!Array.<?shaka.extern.Track>} tracks * @return {!Set.<string>} * @private */ static getLanguagesFrom_(tracks) { const languages = new Set(); for (const track of tracks) { if (track.language) { languages.add(shaka.util.LanguageUtils.normalize(track.language)); } else { languages.add('und'); } } return languages; } /** * Get all permutations of normalized languages and role for a group of * tracks. * * @param {!Array.<?shaka.extern.Track>} tracks * @return {!Array.<shaka.extern.LanguageRole>} * @private */ static getLanguageAndRolesFrom_(tracks) { /** @type {!Map.<string, !Set>} */ const languageToRoles = new Map(); /** @type {!Map.<string, !Map.<string, string>>} */ const languageRoleToLabel = new Map(); for (const track of tracks) { let language = 'und'; let roles = []; if (track.language) { language = shaka.util.LanguageUtils.normalize(track.language); } if (track.type == 'variant') { roles = track.audioRoles; } else { roles = track.roles; } if (!roles || !roles.length) { // We must have an empty role so that we will still get a language-role // entry from our Map. roles = ['']; } if (!languageToRoles.has(language)) { languageToRoles.set(language, new Set()); } for (const role of roles) { languageToRoles.get(language).add(role); if (track.label) { if (!languageRoleToLabel.has(language)) { languageRoleToLabel.set(language, new Map()); } languageRoleToLabel.get(language).set(role, track.label); } } } // Flatten our map to an array of language-role pairs. const pairings = []; languageToRoles.forEach((roles, language) => { for (const role of roles) { let label = null; if (languageRoleToLabel.has(language) && languageRoleToLabel.get(language).has(role)) { label = languageRoleToLabel.get(language).get(role); } pairings.push({language, role, label}); } }); return pairings; } /** * Assuming the player is playing content with media source, check if the * player has buffered enough content to make it to the end of the * presentation. * * @return {boolean} * @private */ isBufferedToEndMS_() { goog.asserts.assert( this.video_, 'We need a video element to get buffering information'); goog.asserts.assert( this.mediaSourceEngine_, 'We need a media source engine to get buffering information'); goog.asserts.assert( this.manifest_, 'We need a manifest to get buffering information'); // This is a strong guarantee that we are buffered to the end, because it // means the playhead is already at that end. if (this.video_.ended) { return true; } // This means that MediaSource has buffered the final segment in all // SourceBuffers and is no longer accepting additional segments. if (this.mediaSourceEngine_.ended()) { return true; } // Live streams are "buffered to the end" when they have buffered to the // live edge or beyond (into the region covered by the presentation delay). if (this.manifest_.presentationTimeline.isLive()) { const liveEdge = this.manifest_.presentationTimeline.getSegmentAvailabilityEnd(); const bufferEnd = shaka.media.TimeRangesUtils.bufferEnd(this.video_.buffered); if (bufferEnd != null && bufferEnd >= liveEdge) { return true; } } return false; } /** * Assuming the player is playing content with src=, check if the player has * buffered enough content to make it to the end of the presentation. * * @return {boolean} * @private */ isBufferedToEndSrc_() { goog.asserts.assert( this.video_, 'We need a video element to get buffering information'); // This is a strong guarantee that we are buffered to the end, because it // means the playhead is already at that end. if (this.video_.ended) { return true; } // If we have buffered to the duration of the content, it means we will have // enough content to buffer to the end of the presentation. const bufferEnd = shaka.media.TimeRangesUtils.bufferEnd(this.video_.buffered); // Because Safari's native HLS reports slightly inaccurate values for // bufferEnd here, we use a fudge factor. Without this, we can end up in a // buffering state at the end of the stream. See issue #2117. // TODO: Try to remove the fudge here once we no longer manage buffering // state above the browser with playbackRate=0. const fudge = 1; // 1000 ms return bufferEnd != null && bufferEnd >= this.video_.duration - fudge; } /** * Create an error for when we purposely interrupt a load operation. * * @return {!shaka.util.Error} * @private */ createAbortLoadError_() { return new shaka.util.Error( shaka.util.Error.Severity.CRITICAL, shaka.util.Error.Category.PLAYER, shaka.util.Error.Code.LOAD_INTERRUPTED); } /** * Key * ---------------------- * D : Detach Node * A : Attach Node * MS : Media Source Node * P : Manifest Parser Node * M : Manifest Node * DRM : Drm Engine Node * L : Load Node * U : Unloading Node * SRC : Src Equals Node * * Graph Topology * ---------------------- * * [SRC]-----+ * ^ | * | v * [D]<-->[A]<-----[U] * | ^ * v | * [MS]------+ * | | * v | * [P]-------+ * | | * v | * [M]-------+ * | | * v | * [DRM]-----+ * | | * v | * [L]-------+ * * @param {!shaka.routing.Node} currentlyAt * @param {shaka.routing.Payload} currentlyWith * @param {!shaka.routing.Node} wantsToBeAt * @param {shaka.routing.Payload} wantsToHave * @return {?shaka.routing.Node} * @private */ getNextStep_(currentlyAt, currentlyWith, wantsToBeAt, wantsToHave) { let next = null; // Detach is very simple, either stay in detach (because |detach| was called // while in detached) or go somewhere that requires us to attach to an // element. if (currentlyAt == this.detachNode_) { next = wantsToBeAt == this.detachNode_ ? this.detachNode_ : this.attachNode_; } if (currentlyAt == this.attachNode_) { next = this.getNextAfterAttach_(wantsToBeAt, currentlyWith, wantsToHave); } if (currentlyAt == this.mediaSourceNode_) { next = this.getNextAfterMediaSource_( wantsToBeAt, currentlyWith, wantsToHave); } if (currentlyAt == this.parserNode_) { next = this.getNextMatchingAllDependencies_( /* destination= */ this.loadNode_, /* next= */ this.manifestNode_, /* reset= */ this.unloadNode_, /* goingTo= */ wantsToBeAt, /* has= */ currentlyWith, /* wants= */ wantsToHave); } if (currentlyAt == this.manifestNode_) { next = this.getNextMatchingAllDependencies_( /* destination= */ this.loadNode_, /* next= */ this.drmNode_, /* reset= */ this.unloadNode_, /* goingTo= */ wantsToBeAt, /* has= */ currentlyWith, /* wants= */ wantsToHave); } // For DRM, we have two options "load" or "unload". If all our constraints // are met, we can go to "load". If anything is off, we must go back to // "unload" to reset. if (currentlyAt == this.drmNode_) { next = this.getNextMatchingAllDependencies_( /* destination= */ this.loadNode_, /* next= */ this.loadNode_, /* reset= */ this.unloadNode_, /* goingTo= */ wantsToBeAt, /* has= */ currentlyWith, /* wants= */ wantsToHave); } // For DRM w/ src= playback, we only care about destination and media // element. if (currentlyAt == this.srcEqualsDrmNode_) { if (wantsToBeAt == this.srcEqualsNode_ && currentlyWith.mediaElement == wantsToHave.mediaElement) { next = this.srcEqualsNode_; } else { next = this.unloadNode_; } } // After we load content, always go through unload because we can't safely // use components after we have started playback. if (currentlyAt == this.loadNode_ || currentlyAt == this.srcEqualsNode_) { next = this.unloadNode_; } if (currentlyAt == this.unloadNode_) { next = this.getNextAfterUnload_(wantsToBeAt, currentlyWith, wantsToHave); } goog.asserts.assert(next, 'Missing next step!'); return next; } /** * @param {!shaka.routing.Node} goingTo * @param {shaka.routing.Payload} has * @param {shaka.routing.Payload} wants * @return {?shaka.routing.Node} * @private */ getNextAfterAttach_(goingTo, has, wants) { // Attach and detach are the only two nodes that we can directly go // back-and-forth between. if (goingTo == this.detachNode_) { return this.detachNode_; } // If we are going anywhere other than detach, then we need the media // element to match, if they don't match, we need to go through detach // first. if (has.mediaElement != wants.mediaElement) { return this.detachNode_; } // If we are already in attached, and someone calls |attach| again (to the // same video element), we can handle the redundant request by re-entering // our current state. if (goingTo == this.attachNode_) { return this.attachNode_; } // The next step from attached to loaded is through media source. if (goingTo == this.mediaSourceNode_ || goingTo == this.loadNode_) { return this.mediaSourceNode_; } // If we are going to src=, then we should set up DRM first. This will // support cases like FairPlay HLS on Safari. if (goingTo == this.srcEqualsNode_) { return this.srcEqualsDrmNode_; } // We are missing a rule, the null will get caught by a common check in // the routing system. return null; } /** * @param {!shaka.routing.Node} goingTo * @param {shaka.routing.Payload} has * @param {shaka.routing.Payload} wants * @return {?shaka.routing.Node} * @private */ getNextAfterMediaSource_(goingTo, has, wants) { // We can only go to parse manifest or unload. If we want to go to load and // we have the right media element, we can go to parse manifest. If we // don't, no matter where we want to go, we must go through unload. if (goingTo == this.loadNode_ && has.mediaElement == wants.mediaElement) { return this.parserNode_; } // Right now the unload node is responsible for tearing down all playback // components (including media source). So since we have created media // source, we need to unload since our dependencies are not compatible. // // TODO: We are structured this way to maintain a historic structure. Going // forward, there is no reason to restrict ourselves to this. Going // forward we should explore breaking apart |onUnload| and develop // more meaningful terminology around tearing down playback resources. return this.unloadNode_; } /** * After unload there are only two options, attached or detached. This choice * is based on whether or not we have a media element. If we have a media * element, then we go to attach. If we don't have a media element, we go to * detach. * * @param {!shaka.routing.Node} goingTo * @param {shaka.routing.Payload} has * @param {shaka.routing.Payload} wants * @return {?shaka.routing.Node} * @private */ getNextAfterUnload_(goingTo, has, wants) { // If we don't want a media element, detach. // If we have the wrong media element, detach. // Otherwise it means we want to attach to a media element and it is safe to // do so. return !wants.mediaElement || has.mediaElement != wants.mediaElement ? this.detachNode_ : this.attachNode_; } /** * A general method used to handle routing when we can either than one step * toward our destination (while all our dependencies match) or go to a node * that will reset us so we can try again. * * @param {!shaka.routing.Node} destinationNode * What |goingTo| must be for us to step toward |nextNode|. Otherwise we * will go to |resetNode|. * @param {!shaka.routing.Node} nextNode * The node we will go to next if |goingTo == destinationNode| and all * dependencies match. * @param {!shaka.routing.Node} resetNode * The node we will go to next if |goingTo != destinationNode| or any * dependency does not match. * @param {!shaka.routing.Node} goingTo * The node that the walker is trying to go to. * @param {shaka.routing.Payload} has * The payload that the walker currently has. * @param {shaka.routing.Payload} wants * The payload that the walker wants to have when iy gets to |goingTo|. * @return {shaka.routing.Node} * @private */ getNextMatchingAllDependencies_(destinationNode, nextNode, resetNode, goingTo, has, wants) { if (goingTo == destinationNode && has.mediaElement == wants.mediaElement && has.uri == wants.uri && has.mimeType == wants.mimeType) { return nextNode; } return resetNode; } /** * @return {shaka.routing.Payload} * @private */ static createEmptyPayload_() { return { mediaElement: null, mimeType: null, startTime: null, startTimeOfLoad: NaN, uri: null, }; } /** * Using a promise, wrap the listeners returned by |Walker.startNewRoute|. * This will work for most usages in |Player| but should not be used for * special cases. * * This will connect |onCancel|, |onEnd|, |onError|, and |onSkip| with * |resolve| and |reject| but will leave |onStart| unset. * * @param {shaka.routing.Walker.Listeners} listeners * @return {!Promise} * @private */ wrapWalkerListenersWithPromise_(listeners) { return new Promise((resolve, reject) => { listeners.onCancel = () => reject(this.createAbortLoadError_()); listeners.onEnd = () => resolve(); listeners.onError = (e) => reject(e); listeners.onSkip = () => reject(this.createAbortLoadError_()); }); } }; /** * An internal enum that contains the string values of all of the player events. * This exists primarily to act as an implicit list of events, for tests. * * @enum {string} */ shaka.Player.EventName = { AbrStatusChanged: 'abrstatuschanged', Adaptation: 'adaptation', Buffering: 'buffering', DrmSessionUpdate: 'drmsessionupdate', Emsg: 'emsg', Error: 'error', ExpirationUpdated: 'expirationupdated', LargeGap: 'largegap', Loaded: 'loaded', Loading: 'loading', ManifestParsed: 'manifestparsed', Metadata: 'metadata', OnStateChange: 'onstatechange', OnStateIdle: 'onstateidle', RateChange: 'ratechange', SessionDataEvent: 'sessiondata', Streaming: 'streaming', TextChanged: 'textchanged', TextTrackVisibility: 'texttrackvisibility', TimelineRegionAdded: 'timelineregionadded', TimelineRegionEnter: 'timelineregionenter', TimelineRegionExit: 'timelineregionexit', TracksChanged: 'trackschanged', Unloading: 'unloading', VariantChanged: 'variantchanged', }; /** * In order to know what method of loading the player used for some content, we * have this enum. It lets us know if content has not been loaded, loaded with * media source, or loaded with src equals. * * This enum has a low resolution, because it is only meant to express the * outer limits of the various states that the player is in. For example, when * someone calls a public method on player, it should not matter if they have * initialized drm engine, it should only matter if they finished loading * content. * * @enum {number} * @export */ shaka.Player.LoadMode = { 'DESTROYED': 0, 'NOT_LOADED': 1, 'MEDIA_SOURCE': 2, 'SRC_EQUALS': 3, }; /** * The typical buffering threshold. When we have less than this buffered (in * seconds), we enter a buffering state. This specific value is based on manual * testing and evaluation across a variety of platforms. * * To make the buffering logic work in all cases, this "typical" threshold will * be overridden if the rebufferingGoal configuration is too low. * * @const {number} * @private */ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5; /** * @define {string} A version number taken from git at compile time. * @export */ shaka.Player.version = 'v3.1.0-pre-uncompiled'; // Initialize the deprecation system using the version string we just set // on the player. shaka.Deprecate.init(shaka.Player.version); /** * These are the EME key statuses that represent restricted playback. * 'usable', 'released', 'output-downscaled', 'status-pending' are statuses * of the usable keys. 'expired' status is being handled separately in * DrmEngine. * * @const {!Array.<string>} * @private */ shaka.Player.restrictedStatuses_ = ['output-restricted', 'internal-error']; /** @private {!Object.<string, function():*>} */ shaka.Player.supportPlugins_ = {}; /** @private {?shaka.extern.IAdManager.Factory} */ shaka.Player.adManagerFactory_ = null; /** * @const {string} */ shaka.Player.TextTrackLabel = 'Shaka Player TextTrack';
'use strict'; angular.module('jenkins', []). constant('STAPLER_CONTENT_TYPE', 'application/x-stapler-method-invocation;charset=UTF-8'). provider('proxy', function() { this.bindings = {}; this.configureProxiesUsing = function(bindings) { this.bindings = bindings; }; this.$get = ['proxyFrom', function(proxyFrom) { var proxies = {}; angular.forEach(this.bindings, function(binding, name) { proxies[name] = proxyFrom(binding); }); return proxies; }]; }). factory('stringified', function() { return function (object) { var stringified = angular.toJson(object); stringified = stringified.replace(/^"/, ''); stringified = stringified.replace(/"$/, ''); stringified = stringified.replace(/\\"/g, '"'); return stringified; }; }). factory('proxyFrom', ['$http', 'stringified', 'STAPLER_CONTENT_TYPE', function($http, stringified, STAPLER_CONTENT_TYPE) { return function(binding) { var url = binding.url + '/', proxy = {}; angular.forEach(binding.methods, function(method) { proxy[method] = function() { var parameters = Array.prototype.slice.apply(arguments); return $http({ url: url + method, method: 'POST', data: stringified(parameters), headers: { 'Content-Type': STAPLER_CONTENT_TYPE, 'Crumb': binding.crumb, // Crumb header is needed to get past Stapler '.crumb': binding.crumb // .crumb header is needed to support CSRF protection (#46) } }); } }); return proxy; } }]). factory('responseCodeStandardsIntroducer', ['$q', 'STAPLER_CONTENT_TYPE', function($q, STAPLER_CONTENT_TYPE) { function isAStapler(response) { return (response.config.headers && response.config.headers['Content-Type'] === STAPLER_CONTENT_TYPE); } return { 'response': function(response) { if (isAStapler(response) && response.data.stackTrace) { // this is required to patch the incorrect behaviour of Stapler // see https://issues.jenkins-ci.org/browse/JENKINS-21132 var augmentedResponse = angular.copy(response); augmentedResponse.status = 500; return $q.reject(augmentedResponse); } return response; } }; }]). config(function ($httpProvider) { $httpProvider.interceptors.push('responseCodeStandardsIntroducer'); });
import * as actions from './index'; describe('todo actions', () => { it('addTodo should create ADD_TODO action', () => { expect(actions.addTodo('Use Redux')).toEqual({ type: 'ADD_TODO', id: 1, text: 'Use Redux', }); }); it('removeTodo should create REMOVE_TODO action', () => { expect(actions.removeTodo(1)).toEqual({ type: 'REMOVE_TODO', id: 1, }); }); });
export {sendMsgToFCL, close, approve, decline} from "./send-msg-to-fcl.js" export {onMessageFromFCL} from "./on-message-from-fcl.js" export {encodeMessageFromSignable} from "@onflow/sdk" export {CompositeSignature} from "./CompositeSignature.js"
/** * @fileoverview * @enhanceable * @suppress {messageConventions} JS Compiler reports an error if a variable or * field starts with 'MSG_' and isn't a translatable message. * @public */ // GENERATED CODE -- DO NOT EDIT! var jspb = require('google-protobuf'); var goog = jspb; var global = Function('return this')(); var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js'); var validator_pb = require('./validator_pb.js'); goog.exportSymbol('proto.services.AddContactRequest', null, global); goog.exportSymbol('proto.services.AddContactResponse', null, global); goog.exportSymbol('proto.services.AddDiscussionRequest', null, global); goog.exportSymbol('proto.services.AddDiscussionResponse', null, global); goog.exportSymbol('proto.services.Chain', null, global); goog.exportSymbol('proto.services.ConnectNodeRequest', null, global); goog.exportSymbol('proto.services.ConnectNodeResponse', null, global); goog.exportSymbol('proto.services.ContactInfo', null, global); goog.exportSymbol('proto.services.CreateInvoiceRequest', null, global); goog.exportSymbol('proto.services.CreateInvoiceResponse', null, global); goog.exportSymbol('proto.services.DiscussionInfo', null, global); goog.exportSymbol('proto.services.DiscussionOptions', null, global); goog.exportSymbol('proto.services.EstimateMessageRequest', null, global); goog.exportSymbol('proto.services.EstimateMessageResponse', null, global); goog.exportSymbol('proto.services.GetContactsRequest', null, global); goog.exportSymbol('proto.services.GetContactsResponse', null, global); goog.exportSymbol('proto.services.GetDiscussionHistoryByIDRequest', null, global); goog.exportSymbol('proto.services.GetDiscussionHistoryResponse', null, global); goog.exportSymbol('proto.services.GetDiscussionStatisticsRequest', null, global); goog.exportSymbol('proto.services.GetDiscussionStatisticsResponse', null, global); goog.exportSymbol('proto.services.GetDiscussionsRequest', null, global); goog.exportSymbol('proto.services.GetDiscussionsResponse', null, global); goog.exportSymbol('proto.services.GetNodesRequest', null, global); goog.exportSymbol('proto.services.HopHint', null, global); goog.exportSymbol('proto.services.Invoice', null, global); goog.exportSymbol('proto.services.InvoiceHTLC', null, global); goog.exportSymbol('proto.services.InvoiceHTLCState', null, global); goog.exportSymbol('proto.services.InvoiceState', null, global); goog.exportSymbol('proto.services.KeySetPageOptions', null, global); goog.exportSymbol('proto.services.LookupInvoiceRequest', null, global); goog.exportSymbol('proto.services.LookupInvoiceResponse', null, global); goog.exportSymbol('proto.services.Message', null, global); goog.exportSymbol('proto.services.MessageOptions', null, global); goog.exportSymbol('proto.services.NodeInfo', null, global); goog.exportSymbol('proto.services.NodeInfoResponse', null, global); goog.exportSymbol('proto.services.OpenChannelRequest', null, global); goog.exportSymbol('proto.services.OpenChannelResponse', null, global); goog.exportSymbol('proto.services.PaymentHop', null, global); goog.exportSymbol('proto.services.PaymentRoute', null, global); goog.exportSymbol('proto.services.RemoveContactByAddressRequest', null, global); goog.exportSymbol('proto.services.RemoveContactByIDRequest', null, global); goog.exportSymbol('proto.services.RemoveContactResponse', null, global); goog.exportSymbol('proto.services.RemoveDiscussionRequest', null, global); goog.exportSymbol('proto.services.RemoveDiscussionResponse', null, global); goog.exportSymbol('proto.services.RouteHint', null, global); goog.exportSymbol('proto.services.SearchNodeByAddressRequest', null, global); goog.exportSymbol('proto.services.SearchNodeByAliasRequest', null, global); goog.exportSymbol('proto.services.SelfBalanceRequest', null, global); goog.exportSymbol('proto.services.SelfBalanceResponse', null, global); goog.exportSymbol('proto.services.SelfInfoRequest', null, global); goog.exportSymbol('proto.services.SelfInfoResponse', null, global); goog.exportSymbol('proto.services.SendMessageRequest', null, global); goog.exportSymbol('proto.services.SendMessageResponse', null, global); goog.exportSymbol('proto.services.SubscribeMessageRequest', null, global); goog.exportSymbol('proto.services.SubscribeMessageResponse', null, global); goog.exportSymbol('proto.services.UpdateDiscussionLastReadRequest', null, global); goog.exportSymbol('proto.services.UpdateDiscussionResponse', null, global); goog.exportSymbol('proto.services.Version', null, global); goog.exportSymbol('proto.services.VersionRequest', null, global); /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.KeySetPageOptions = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.KeySetPageOptions, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.KeySetPageOptions.displayName = 'proto.services.KeySetPageOptions'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.KeySetPageOptions.prototype.toObject = function(opt_includeInstance) { return proto.services.KeySetPageOptions.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.KeySetPageOptions} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.KeySetPageOptions.toObject = function(includeInstance, msg) { var f, obj = { lastId: jspb.Message.getFieldWithDefault(msg, 1, 0), pageSize: jspb.Message.getFieldWithDefault(msg, 2, 0), reverse: jspb.Message.getFieldWithDefault(msg, 3, false) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.KeySetPageOptions} */ proto.services.KeySetPageOptions.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.KeySetPageOptions; return proto.services.KeySetPageOptions.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.KeySetPageOptions} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.KeySetPageOptions} */ proto.services.KeySetPageOptions.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readUint64()); msg.setLastId(value); break; case 2: var value = /** @type {number} */ (reader.readInt64()); msg.setPageSize(value); break; case 3: var value = /** @type {boolean} */ (reader.readBool()); msg.setReverse(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.KeySetPageOptions.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.KeySetPageOptions.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.KeySetPageOptions} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.KeySetPageOptions.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getLastId(); if (f !== 0) { writer.writeUint64( 1, f ); } f = message.getPageSize(); if (f !== 0) { writer.writeInt64( 2, f ); } f = message.getReverse(); if (f) { writer.writeBool( 3, f ); } }; /** * optional uint64 last_id = 1; * @return {number} */ proto.services.KeySetPageOptions.prototype.getLastId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.services.KeySetPageOptions.prototype.setLastId = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * optional int64 page_size = 2; * @return {number} */ proto.services.KeySetPageOptions.prototype.getPageSize = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** @param {number} value */ proto.services.KeySetPageOptions.prototype.setPageSize = function(value) { jspb.Message.setProto3IntField(this, 2, value); }; /** * optional bool reverse = 3; * Note that Boolean fields may be set to 0/1 when serialized from a Java server. * You should avoid comparisons like {@code val === true/false} in those cases. * @return {boolean} */ proto.services.KeySetPageOptions.prototype.getReverse = function() { return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 3, false)); }; /** @param {boolean} value */ proto.services.KeySetPageOptions.prototype.setReverse = function(value) { jspb.Message.setProto3BooleanField(this, 3, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.VersionRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.VersionRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.VersionRequest.displayName = 'proto.services.VersionRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.VersionRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.VersionRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.VersionRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.VersionRequest.toObject = function(includeInstance, msg) { var f, obj = { }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.VersionRequest} */ proto.services.VersionRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.VersionRequest; return proto.services.VersionRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.VersionRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.VersionRequest} */ proto.services.VersionRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.VersionRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.VersionRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.VersionRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.VersionRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.Version = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.Version, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.Version.displayName = 'proto.services.Version'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.Version.prototype.toObject = function(opt_includeInstance) { return proto.services.Version.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.Version} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.Version.toObject = function(includeInstance, msg) { var f, obj = { version: jspb.Message.getFieldWithDefault(msg, 1, ""), commit: jspb.Message.getFieldWithDefault(msg, 2, ""), commitHash: jspb.Message.getFieldWithDefault(msg, 3, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.Version} */ proto.services.Version.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.Version; return proto.services.Version.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.Version} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.Version} */ proto.services.Version.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setVersion(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.setCommit(value); break; case 3: var value = /** @type {string} */ (reader.readString()); msg.setCommitHash(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.Version.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.Version.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.Version} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.Version.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getVersion(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getCommit(); if (f.length > 0) { writer.writeString( 2, f ); } f = message.getCommitHash(); if (f.length > 0) { writer.writeString( 3, f ); } }; /** * optional string version = 1; * @return {string} */ proto.services.Version.prototype.getVersion = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ proto.services.Version.prototype.setVersion = function(value) { jspb.Message.setProto3StringField(this, 1, value); }; /** * optional string commit = 2; * @return {string} */ proto.services.Version.prototype.getCommit = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** @param {string} value */ proto.services.Version.prototype.setCommit = function(value) { jspb.Message.setProto3StringField(this, 2, value); }; /** * optional string commit_hash = 3; * @return {string} */ proto.services.Version.prototype.getCommitHash = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** @param {string} value */ proto.services.Version.prototype.setCommitHash = function(value) { jspb.Message.setProto3StringField(this, 3, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.NodeInfo = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.NodeInfo, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.NodeInfo.displayName = 'proto.services.NodeInfo'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.NodeInfo.prototype.toObject = function(opt_includeInstance) { return proto.services.NodeInfo.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.NodeInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.NodeInfo.toObject = function(includeInstance, msg) { var f, obj = { alias: jspb.Message.getFieldWithDefault(msg, 1, ""), address: jspb.Message.getFieldWithDefault(msg, 2, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.NodeInfo} */ proto.services.NodeInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.NodeInfo; return proto.services.NodeInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.NodeInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.NodeInfo} */ proto.services.NodeInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setAlias(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.setAddress(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.NodeInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.NodeInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.NodeInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.NodeInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getAlias(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getAddress(); if (f.length > 0) { writer.writeString( 2, f ); } }; /** * optional string alias = 1; * @return {string} */ proto.services.NodeInfo.prototype.getAlias = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ proto.services.NodeInfo.prototype.setAlias = function(value) { jspb.Message.setProto3StringField(this, 1, value); }; /** * optional string address = 2; * @return {string} */ proto.services.NodeInfo.prototype.getAddress = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** @param {string} value */ proto.services.NodeInfo.prototype.setAddress = function(value) { jspb.Message.setProto3StringField(this, 2, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.SelfInfoRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.SelfInfoRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.SelfInfoRequest.displayName = 'proto.services.SelfInfoRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.SelfInfoRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.SelfInfoRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.SelfInfoRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.SelfInfoRequest.toObject = function(includeInstance, msg) { var f, obj = { }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.SelfInfoRequest} */ proto.services.SelfInfoRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.SelfInfoRequest; return proto.services.SelfInfoRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.SelfInfoRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.SelfInfoRequest} */ proto.services.SelfInfoRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.SelfInfoRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.SelfInfoRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.SelfInfoRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.SelfInfoRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.Chain = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.Chain, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.Chain.displayName = 'proto.services.Chain'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.Chain.prototype.toObject = function(opt_includeInstance) { return proto.services.Chain.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.Chain} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.Chain.toObject = function(includeInstance, msg) { var f, obj = { chain: jspb.Message.getFieldWithDefault(msg, 1, ""), network: jspb.Message.getFieldWithDefault(msg, 2, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.Chain} */ proto.services.Chain.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.Chain; return proto.services.Chain.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.Chain} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.Chain} */ proto.services.Chain.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setChain(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.setNetwork(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.Chain.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.Chain.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.Chain} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.Chain.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getChain(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getNetwork(); if (f.length > 0) { writer.writeString( 2, f ); } }; /** * optional string chain = 1; * @return {string} */ proto.services.Chain.prototype.getChain = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ proto.services.Chain.prototype.setChain = function(value) { jspb.Message.setProto3StringField(this, 1, value); }; /** * optional string network = 2; * @return {string} */ proto.services.Chain.prototype.getNetwork = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** @param {string} value */ proto.services.Chain.prototype.setNetwork = function(value) { jspb.Message.setProto3StringField(this, 2, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.SelfInfoResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.services.SelfInfoResponse.repeatedFields_, null); }; goog.inherits(proto.services.SelfInfoResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.SelfInfoResponse.displayName = 'proto.services.SelfInfoResponse'; } /** * List of repeated fields within this message type. * @private {!Array<number>} * @const */ proto.services.SelfInfoResponse.repeatedFields_ = [2]; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.SelfInfoResponse.prototype.toObject = function(opt_includeInstance) { return proto.services.SelfInfoResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.SelfInfoResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.SelfInfoResponse.toObject = function(includeInstance, msg) { var f, obj = { info: (f = msg.getInfo()) && proto.services.NodeInfo.toObject(includeInstance, f), chainsList: jspb.Message.toObjectList(msg.getChainsList(), proto.services.Chain.toObject, includeInstance) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.SelfInfoResponse} */ proto.services.SelfInfoResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.SelfInfoResponse; return proto.services.SelfInfoResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.SelfInfoResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.SelfInfoResponse} */ proto.services.SelfInfoResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.services.NodeInfo; reader.readMessage(value,proto.services.NodeInfo.deserializeBinaryFromReader); msg.setInfo(value); break; case 2: var value = new proto.services.Chain; reader.readMessage(value,proto.services.Chain.deserializeBinaryFromReader); msg.addChains(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.SelfInfoResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.SelfInfoResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.SelfInfoResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.SelfInfoResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getInfo(); if (f != null) { writer.writeMessage( 1, f, proto.services.NodeInfo.serializeBinaryToWriter ); } f = message.getChainsList(); if (f.length > 0) { writer.writeRepeatedMessage( 2, f, proto.services.Chain.serializeBinaryToWriter ); } }; /** * optional NodeInfo info = 1; * @return {?proto.services.NodeInfo} */ proto.services.SelfInfoResponse.prototype.getInfo = function() { return /** @type{?proto.services.NodeInfo} */ ( jspb.Message.getWrapperField(this, proto.services.NodeInfo, 1)); }; /** @param {?proto.services.NodeInfo|undefined} value */ proto.services.SelfInfoResponse.prototype.setInfo = function(value) { jspb.Message.setWrapperField(this, 1, value); }; proto.services.SelfInfoResponse.prototype.clearInfo = function() { this.setInfo(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.SelfInfoResponse.prototype.hasInfo = function() { return jspb.Message.getField(this, 1) != null; }; /** * repeated Chain chains = 2; * @return {!Array<!proto.services.Chain>} */ proto.services.SelfInfoResponse.prototype.getChainsList = function() { return /** @type{!Array<!proto.services.Chain>} */ ( jspb.Message.getRepeatedWrapperField(this, proto.services.Chain, 2)); }; /** @param {!Array<!proto.services.Chain>} value */ proto.services.SelfInfoResponse.prototype.setChainsList = function(value) { jspb.Message.setRepeatedWrapperField(this, 2, value); }; /** * @param {!proto.services.Chain=} opt_value * @param {number=} opt_index * @return {!proto.services.Chain} */ proto.services.SelfInfoResponse.prototype.addChains = function(opt_value, opt_index) { return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.services.Chain, opt_index); }; proto.services.SelfInfoResponse.prototype.clearChainsList = function() { this.setChainsList([]); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.SelfBalanceRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.SelfBalanceRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.SelfBalanceRequest.displayName = 'proto.services.SelfBalanceRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.SelfBalanceRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.SelfBalanceRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.SelfBalanceRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.SelfBalanceRequest.toObject = function(includeInstance, msg) { var f, obj = { }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.SelfBalanceRequest} */ proto.services.SelfBalanceRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.SelfBalanceRequest; return proto.services.SelfBalanceRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.SelfBalanceRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.SelfBalanceRequest} */ proto.services.SelfBalanceRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.SelfBalanceRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.SelfBalanceRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.SelfBalanceRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.SelfBalanceRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.SelfBalanceResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.SelfBalanceResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.SelfBalanceResponse.displayName = 'proto.services.SelfBalanceResponse'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.SelfBalanceResponse.prototype.toObject = function(opt_includeInstance) { return proto.services.SelfBalanceResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.SelfBalanceResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.SelfBalanceResponse.toObject = function(includeInstance, msg) { var f, obj = { walletConfirmedSat: jspb.Message.getFieldWithDefault(msg, 1, 0), walletUnconfirmedSat: jspb.Message.getFieldWithDefault(msg, 2, 0), channelLocalMsat: jspb.Message.getFieldWithDefault(msg, 3, 0), channelRemoteMsat: jspb.Message.getFieldWithDefault(msg, 4, 0), pendingOpenLocalMsat: jspb.Message.getFieldWithDefault(msg, 5, 0), pendingOpenRemoteMsat: jspb.Message.getFieldWithDefault(msg, 6, 0), unsettledLocalMsat: jspb.Message.getFieldWithDefault(msg, 7, 0), unsettledRemoteMsat: jspb.Message.getFieldWithDefault(msg, 8, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.SelfBalanceResponse} */ proto.services.SelfBalanceResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.SelfBalanceResponse; return proto.services.SelfBalanceResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.SelfBalanceResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.SelfBalanceResponse} */ proto.services.SelfBalanceResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readInt64()); msg.setWalletConfirmedSat(value); break; case 2: var value = /** @type {number} */ (reader.readInt64()); msg.setWalletUnconfirmedSat(value); break; case 3: var value = /** @type {number} */ (reader.readUint64()); msg.setChannelLocalMsat(value); break; case 4: var value = /** @type {number} */ (reader.readUint64()); msg.setChannelRemoteMsat(value); break; case 5: var value = /** @type {number} */ (reader.readUint64()); msg.setPendingOpenLocalMsat(value); break; case 6: var value = /** @type {number} */ (reader.readUint64()); msg.setPendingOpenRemoteMsat(value); break; case 7: var value = /** @type {number} */ (reader.readUint64()); msg.setUnsettledLocalMsat(value); break; case 8: var value = /** @type {number} */ (reader.readUint64()); msg.setUnsettledRemoteMsat(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.SelfBalanceResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.SelfBalanceResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.SelfBalanceResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.SelfBalanceResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getWalletConfirmedSat(); if (f !== 0) { writer.writeInt64( 1, f ); } f = message.getWalletUnconfirmedSat(); if (f !== 0) { writer.writeInt64( 2, f ); } f = message.getChannelLocalMsat(); if (f !== 0) { writer.writeUint64( 3, f ); } f = message.getChannelRemoteMsat(); if (f !== 0) { writer.writeUint64( 4, f ); } f = message.getPendingOpenLocalMsat(); if (f !== 0) { writer.writeUint64( 5, f ); } f = message.getPendingOpenRemoteMsat(); if (f !== 0) { writer.writeUint64( 6, f ); } f = message.getUnsettledLocalMsat(); if (f !== 0) { writer.writeUint64( 7, f ); } f = message.getUnsettledRemoteMsat(); if (f !== 0) { writer.writeUint64( 8, f ); } }; /** * optional int64 wallet_confirmed_sat = 1; * @return {number} */ proto.services.SelfBalanceResponse.prototype.getWalletConfirmedSat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.services.SelfBalanceResponse.prototype.setWalletConfirmedSat = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * optional int64 wallet_unconfirmed_sat = 2; * @return {number} */ proto.services.SelfBalanceResponse.prototype.getWalletUnconfirmedSat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** @param {number} value */ proto.services.SelfBalanceResponse.prototype.setWalletUnconfirmedSat = function(value) { jspb.Message.setProto3IntField(this, 2, value); }; /** * optional uint64 channel_local_msat = 3; * @return {number} */ proto.services.SelfBalanceResponse.prototype.getChannelLocalMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** @param {number} value */ proto.services.SelfBalanceResponse.prototype.setChannelLocalMsat = function(value) { jspb.Message.setProto3IntField(this, 3, value); }; /** * optional uint64 channel_remote_msat = 4; * @return {number} */ proto.services.SelfBalanceResponse.prototype.getChannelRemoteMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); }; /** @param {number} value */ proto.services.SelfBalanceResponse.prototype.setChannelRemoteMsat = function(value) { jspb.Message.setProto3IntField(this, 4, value); }; /** * optional uint64 pending_open_local_msat = 5; * @return {number} */ proto.services.SelfBalanceResponse.prototype.getPendingOpenLocalMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); }; /** @param {number} value */ proto.services.SelfBalanceResponse.prototype.setPendingOpenLocalMsat = function(value) { jspb.Message.setProto3IntField(this, 5, value); }; /** * optional uint64 pending_open_remote_msat = 6; * @return {number} */ proto.services.SelfBalanceResponse.prototype.getPendingOpenRemoteMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); }; /** @param {number} value */ proto.services.SelfBalanceResponse.prototype.setPendingOpenRemoteMsat = function(value) { jspb.Message.setProto3IntField(this, 6, value); }; /** * optional uint64 unsettled_local_msat = 7; * @return {number} */ proto.services.SelfBalanceResponse.prototype.getUnsettledLocalMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); }; /** @param {number} value */ proto.services.SelfBalanceResponse.prototype.setUnsettledLocalMsat = function(value) { jspb.Message.setProto3IntField(this, 7, value); }; /** * optional uint64 unsettled_remote_msat = 8; * @return {number} */ proto.services.SelfBalanceResponse.prototype.getUnsettledRemoteMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 8, 0)); }; /** @param {number} value */ proto.services.SelfBalanceResponse.prototype.setUnsettledRemoteMsat = function(value) { jspb.Message.setProto3IntField(this, 8, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.GetNodesRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.GetNodesRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.GetNodesRequest.displayName = 'proto.services.GetNodesRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.GetNodesRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.GetNodesRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.GetNodesRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.GetNodesRequest.toObject = function(includeInstance, msg) { var f, obj = { }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.GetNodesRequest} */ proto.services.GetNodesRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.GetNodesRequest; return proto.services.GetNodesRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.GetNodesRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.GetNodesRequest} */ proto.services.GetNodesRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.GetNodesRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.GetNodesRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.GetNodesRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.GetNodesRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.SearchNodeByAddressRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.SearchNodeByAddressRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.SearchNodeByAddressRequest.displayName = 'proto.services.SearchNodeByAddressRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.SearchNodeByAddressRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.SearchNodeByAddressRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.SearchNodeByAddressRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.SearchNodeByAddressRequest.toObject = function(includeInstance, msg) { var f, obj = { address: jspb.Message.getFieldWithDefault(msg, 1, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.SearchNodeByAddressRequest} */ proto.services.SearchNodeByAddressRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.SearchNodeByAddressRequest; return proto.services.SearchNodeByAddressRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.SearchNodeByAddressRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.SearchNodeByAddressRequest} */ proto.services.SearchNodeByAddressRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setAddress(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.SearchNodeByAddressRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.SearchNodeByAddressRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.SearchNodeByAddressRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.SearchNodeByAddressRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getAddress(); if (f.length > 0) { writer.writeString( 1, f ); } }; /** * optional string address = 1; * @return {string} */ proto.services.SearchNodeByAddressRequest.prototype.getAddress = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ proto.services.SearchNodeByAddressRequest.prototype.setAddress = function(value) { jspb.Message.setProto3StringField(this, 1, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.SearchNodeByAliasRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.SearchNodeByAliasRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.SearchNodeByAliasRequest.displayName = 'proto.services.SearchNodeByAliasRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.SearchNodeByAliasRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.SearchNodeByAliasRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.SearchNodeByAliasRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.SearchNodeByAliasRequest.toObject = function(includeInstance, msg) { var f, obj = { alias: jspb.Message.getFieldWithDefault(msg, 1, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.SearchNodeByAliasRequest} */ proto.services.SearchNodeByAliasRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.SearchNodeByAliasRequest; return proto.services.SearchNodeByAliasRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.SearchNodeByAliasRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.SearchNodeByAliasRequest} */ proto.services.SearchNodeByAliasRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setAlias(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.SearchNodeByAliasRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.SearchNodeByAliasRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.SearchNodeByAliasRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.SearchNodeByAliasRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getAlias(); if (f.length > 0) { writer.writeString( 1, f ); } }; /** * optional string alias = 1; * @return {string} */ proto.services.SearchNodeByAliasRequest.prototype.getAlias = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ proto.services.SearchNodeByAliasRequest.prototype.setAlias = function(value) { jspb.Message.setProto3StringField(this, 1, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.NodeInfoResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.services.NodeInfoResponse.repeatedFields_, null); }; goog.inherits(proto.services.NodeInfoResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.NodeInfoResponse.displayName = 'proto.services.NodeInfoResponse'; } /** * List of repeated fields within this message type. * @private {!Array<number>} * @const */ proto.services.NodeInfoResponse.repeatedFields_ = [1]; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.NodeInfoResponse.prototype.toObject = function(opt_includeInstance) { return proto.services.NodeInfoResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.NodeInfoResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.NodeInfoResponse.toObject = function(includeInstance, msg) { var f, obj = { nodesList: jspb.Message.toObjectList(msg.getNodesList(), proto.services.NodeInfo.toObject, includeInstance) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.NodeInfoResponse} */ proto.services.NodeInfoResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.NodeInfoResponse; return proto.services.NodeInfoResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.NodeInfoResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.NodeInfoResponse} */ proto.services.NodeInfoResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.services.NodeInfo; reader.readMessage(value,proto.services.NodeInfo.deserializeBinaryFromReader); msg.addNodes(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.NodeInfoResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.NodeInfoResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.NodeInfoResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.NodeInfoResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getNodesList(); if (f.length > 0) { writer.writeRepeatedMessage( 1, f, proto.services.NodeInfo.serializeBinaryToWriter ); } }; /** * repeated NodeInfo nodes = 1; * @return {!Array<!proto.services.NodeInfo>} */ proto.services.NodeInfoResponse.prototype.getNodesList = function() { return /** @type{!Array<!proto.services.NodeInfo>} */ ( jspb.Message.getRepeatedWrapperField(this, proto.services.NodeInfo, 1)); }; /** @param {!Array<!proto.services.NodeInfo>} value */ proto.services.NodeInfoResponse.prototype.setNodesList = function(value) { jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** * @param {!proto.services.NodeInfo=} opt_value * @param {number=} opt_index * @return {!proto.services.NodeInfo} */ proto.services.NodeInfoResponse.prototype.addNodes = function(opt_value, opt_index) { return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.services.NodeInfo, opt_index); }; proto.services.NodeInfoResponse.prototype.clearNodesList = function() { this.setNodesList([]); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.ConnectNodeRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.ConnectNodeRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.ConnectNodeRequest.displayName = 'proto.services.ConnectNodeRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.ConnectNodeRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.ConnectNodeRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.ConnectNodeRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.ConnectNodeRequest.toObject = function(includeInstance, msg) { var f, obj = { address: jspb.Message.getFieldWithDefault(msg, 1, ""), hostport: jspb.Message.getFieldWithDefault(msg, 2, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.ConnectNodeRequest} */ proto.services.ConnectNodeRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.ConnectNodeRequest; return proto.services.ConnectNodeRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.ConnectNodeRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.ConnectNodeRequest} */ proto.services.ConnectNodeRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setAddress(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.setHostport(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.ConnectNodeRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.ConnectNodeRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.ConnectNodeRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.ConnectNodeRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getAddress(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getHostport(); if (f.length > 0) { writer.writeString( 2, f ); } }; /** * optional string address = 1; * @return {string} */ proto.services.ConnectNodeRequest.prototype.getAddress = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ proto.services.ConnectNodeRequest.prototype.setAddress = function(value) { jspb.Message.setProto3StringField(this, 1, value); }; /** * optional string hostport = 2; * @return {string} */ proto.services.ConnectNodeRequest.prototype.getHostport = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** @param {string} value */ proto.services.ConnectNodeRequest.prototype.setHostport = function(value) { jspb.Message.setProto3StringField(this, 2, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.ConnectNodeResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.ConnectNodeResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.ConnectNodeResponse.displayName = 'proto.services.ConnectNodeResponse'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.ConnectNodeResponse.prototype.toObject = function(opt_includeInstance) { return proto.services.ConnectNodeResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.ConnectNodeResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.ConnectNodeResponse.toObject = function(includeInstance, msg) { var f, obj = { }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.ConnectNodeResponse} */ proto.services.ConnectNodeResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.ConnectNodeResponse; return proto.services.ConnectNodeResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.ConnectNodeResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.ConnectNodeResponse} */ proto.services.ConnectNodeResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.ConnectNodeResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.ConnectNodeResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.ConnectNodeResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.ConnectNodeResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.OpenChannelRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.OpenChannelRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.OpenChannelRequest.displayName = 'proto.services.OpenChannelRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.OpenChannelRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.OpenChannelRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.OpenChannelRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.OpenChannelRequest.toObject = function(includeInstance, msg) { var f, obj = { address: jspb.Message.getFieldWithDefault(msg, 1, ""), amtMsat: jspb.Message.getFieldWithDefault(msg, 2, 0), pushAmtMsat: jspb.Message.getFieldWithDefault(msg, 3, 0), minInputConfs: jspb.Message.getFieldWithDefault(msg, 4, 0), targetConfirmationBlock: jspb.Message.getFieldWithDefault(msg, 5, 0), satPerVbyte: jspb.Message.getFieldWithDefault(msg, 6, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.OpenChannelRequest} */ proto.services.OpenChannelRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.OpenChannelRequest; return proto.services.OpenChannelRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.OpenChannelRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.OpenChannelRequest} */ proto.services.OpenChannelRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setAddress(value); break; case 2: var value = /** @type {number} */ (reader.readUint64()); msg.setAmtMsat(value); break; case 3: var value = /** @type {number} */ (reader.readUint64()); msg.setPushAmtMsat(value); break; case 4: var value = /** @type {number} */ (reader.readInt32()); msg.setMinInputConfs(value); break; case 5: var value = /** @type {number} */ (reader.readUint32()); msg.setTargetConfirmationBlock(value); break; case 6: var value = /** @type {number} */ (reader.readUint64()); msg.setSatPerVbyte(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.OpenChannelRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.OpenChannelRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.OpenChannelRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.OpenChannelRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getAddress(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getAmtMsat(); if (f !== 0) { writer.writeUint64( 2, f ); } f = message.getPushAmtMsat(); if (f !== 0) { writer.writeUint64( 3, f ); } f = message.getMinInputConfs(); if (f !== 0) { writer.writeInt32( 4, f ); } f = message.getTargetConfirmationBlock(); if (f !== 0) { writer.writeUint32( 5, f ); } f = message.getSatPerVbyte(); if (f !== 0) { writer.writeUint64( 6, f ); } }; /** * optional string address = 1; * @return {string} */ proto.services.OpenChannelRequest.prototype.getAddress = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ proto.services.OpenChannelRequest.prototype.setAddress = function(value) { jspb.Message.setProto3StringField(this, 1, value); }; /** * optional uint64 amt_msat = 2; * @return {number} */ proto.services.OpenChannelRequest.prototype.getAmtMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** @param {number} value */ proto.services.OpenChannelRequest.prototype.setAmtMsat = function(value) { jspb.Message.setProto3IntField(this, 2, value); }; /** * optional uint64 push_amt_msat = 3; * @return {number} */ proto.services.OpenChannelRequest.prototype.getPushAmtMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** @param {number} value */ proto.services.OpenChannelRequest.prototype.setPushAmtMsat = function(value) { jspb.Message.setProto3IntField(this, 3, value); }; /** * optional int32 min_input_confs = 4; * @return {number} */ proto.services.OpenChannelRequest.prototype.getMinInputConfs = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); }; /** @param {number} value */ proto.services.OpenChannelRequest.prototype.setMinInputConfs = function(value) { jspb.Message.setProto3IntField(this, 4, value); }; /** * optional uint32 target_confirmation_block = 5; * @return {number} */ proto.services.OpenChannelRequest.prototype.getTargetConfirmationBlock = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); }; /** @param {number} value */ proto.services.OpenChannelRequest.prototype.setTargetConfirmationBlock = function(value) { jspb.Message.setProto3IntField(this, 5, value); }; /** * optional uint64 sat_per_vbyte = 6; * @return {number} */ proto.services.OpenChannelRequest.prototype.getSatPerVbyte = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); }; /** @param {number} value */ proto.services.OpenChannelRequest.prototype.setSatPerVbyte = function(value) { jspb.Message.setProto3IntField(this, 6, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.OpenChannelResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.OpenChannelResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.OpenChannelResponse.displayName = 'proto.services.OpenChannelResponse'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.OpenChannelResponse.prototype.toObject = function(opt_includeInstance) { return proto.services.OpenChannelResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.OpenChannelResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.OpenChannelResponse.toObject = function(includeInstance, msg) { var f, obj = { fundingTxid: jspb.Message.getFieldWithDefault(msg, 1, ""), outputIndex: jspb.Message.getFieldWithDefault(msg, 2, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.OpenChannelResponse} */ proto.services.OpenChannelResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.OpenChannelResponse; return proto.services.OpenChannelResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.OpenChannelResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.OpenChannelResponse} */ proto.services.OpenChannelResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setFundingTxid(value); break; case 2: var value = /** @type {number} */ (reader.readUint32()); msg.setOutputIndex(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.OpenChannelResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.OpenChannelResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.OpenChannelResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.OpenChannelResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getFundingTxid(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getOutputIndex(); if (f !== 0) { writer.writeUint32( 2, f ); } }; /** * optional string funding_txid = 1; * @return {string} */ proto.services.OpenChannelResponse.prototype.getFundingTxid = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ proto.services.OpenChannelResponse.prototype.setFundingTxid = function(value) { jspb.Message.setProto3StringField(this, 1, value); }; /** * optional uint32 output_index = 2; * @return {number} */ proto.services.OpenChannelResponse.prototype.getOutputIndex = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** @param {number} value */ proto.services.OpenChannelResponse.prototype.setOutputIndex = function(value) { jspb.Message.setProto3IntField(this, 2, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.ContactInfo = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.ContactInfo, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.ContactInfo.displayName = 'proto.services.ContactInfo'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.ContactInfo.prototype.toObject = function(opt_includeInstance) { return proto.services.ContactInfo.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.ContactInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.ContactInfo.toObject = function(includeInstance, msg) { var f, obj = { node: (f = msg.getNode()) && proto.services.NodeInfo.toObject(includeInstance, f), id: jspb.Message.getFieldWithDefault(msg, 2, 0), displayName: jspb.Message.getFieldWithDefault(msg, 3, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.ContactInfo} */ proto.services.ContactInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.ContactInfo; return proto.services.ContactInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.ContactInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.ContactInfo} */ proto.services.ContactInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.services.NodeInfo; reader.readMessage(value,proto.services.NodeInfo.deserializeBinaryFromReader); msg.setNode(value); break; case 2: var value = /** @type {number} */ (reader.readUint64()); msg.setId(value); break; case 3: var value = /** @type {string} */ (reader.readString()); msg.setDisplayName(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.ContactInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.ContactInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.ContactInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.ContactInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getNode(); if (f != null) { writer.writeMessage( 1, f, proto.services.NodeInfo.serializeBinaryToWriter ); } f = message.getId(); if (f !== 0) { writer.writeUint64( 2, f ); } f = message.getDisplayName(); if (f.length > 0) { writer.writeString( 3, f ); } }; /** * optional NodeInfo node = 1; * @return {?proto.services.NodeInfo} */ proto.services.ContactInfo.prototype.getNode = function() { return /** @type{?proto.services.NodeInfo} */ ( jspb.Message.getWrapperField(this, proto.services.NodeInfo, 1)); }; /** @param {?proto.services.NodeInfo|undefined} value */ proto.services.ContactInfo.prototype.setNode = function(value) { jspb.Message.setWrapperField(this, 1, value); }; proto.services.ContactInfo.prototype.clearNode = function() { this.setNode(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.ContactInfo.prototype.hasNode = function() { return jspb.Message.getField(this, 1) != null; }; /** * optional uint64 id = 2; * @return {number} */ proto.services.ContactInfo.prototype.getId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** @param {number} value */ proto.services.ContactInfo.prototype.setId = function(value) { jspb.Message.setProto3IntField(this, 2, value); }; /** * optional string display_name = 3; * @return {string} */ proto.services.ContactInfo.prototype.getDisplayName = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** @param {string} value */ proto.services.ContactInfo.prototype.setDisplayName = function(value) { jspb.Message.setProto3StringField(this, 3, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.GetContactsRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.GetContactsRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.GetContactsRequest.displayName = 'proto.services.GetContactsRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.GetContactsRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.GetContactsRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.GetContactsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.GetContactsRequest.toObject = function(includeInstance, msg) { var f, obj = { }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.GetContactsRequest} */ proto.services.GetContactsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.GetContactsRequest; return proto.services.GetContactsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.GetContactsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.GetContactsRequest} */ proto.services.GetContactsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.GetContactsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.GetContactsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.GetContactsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.GetContactsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.GetContactsResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.services.GetContactsResponse.repeatedFields_, null); }; goog.inherits(proto.services.GetContactsResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.GetContactsResponse.displayName = 'proto.services.GetContactsResponse'; } /** * List of repeated fields within this message type. * @private {!Array<number>} * @const */ proto.services.GetContactsResponse.repeatedFields_ = [1]; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.GetContactsResponse.prototype.toObject = function(opt_includeInstance) { return proto.services.GetContactsResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.GetContactsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.GetContactsResponse.toObject = function(includeInstance, msg) { var f, obj = { contactsList: jspb.Message.toObjectList(msg.getContactsList(), proto.services.ContactInfo.toObject, includeInstance) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.GetContactsResponse} */ proto.services.GetContactsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.GetContactsResponse; return proto.services.GetContactsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.GetContactsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.GetContactsResponse} */ proto.services.GetContactsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.services.ContactInfo; reader.readMessage(value,proto.services.ContactInfo.deserializeBinaryFromReader); msg.addContacts(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.GetContactsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.GetContactsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.GetContactsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.GetContactsResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getContactsList(); if (f.length > 0) { writer.writeRepeatedMessage( 1, f, proto.services.ContactInfo.serializeBinaryToWriter ); } }; /** * repeated ContactInfo contacts = 1; * @return {!Array<!proto.services.ContactInfo>} */ proto.services.GetContactsResponse.prototype.getContactsList = function() { return /** @type{!Array<!proto.services.ContactInfo>} */ ( jspb.Message.getRepeatedWrapperField(this, proto.services.ContactInfo, 1)); }; /** @param {!Array<!proto.services.ContactInfo>} value */ proto.services.GetContactsResponse.prototype.setContactsList = function(value) { jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** * @param {!proto.services.ContactInfo=} opt_value * @param {number=} opt_index * @return {!proto.services.ContactInfo} */ proto.services.GetContactsResponse.prototype.addContacts = function(opt_value, opt_index) { return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.services.ContactInfo, opt_index); }; proto.services.GetContactsResponse.prototype.clearContactsList = function() { this.setContactsList([]); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.AddContactRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.AddContactRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.AddContactRequest.displayName = 'proto.services.AddContactRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.AddContactRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.AddContactRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.AddContactRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.AddContactRequest.toObject = function(includeInstance, msg) { var f, obj = { contact: (f = msg.getContact()) && proto.services.ContactInfo.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.AddContactRequest} */ proto.services.AddContactRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.AddContactRequest; return proto.services.AddContactRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.AddContactRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.AddContactRequest} */ proto.services.AddContactRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.services.ContactInfo; reader.readMessage(value,proto.services.ContactInfo.deserializeBinaryFromReader); msg.setContact(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.AddContactRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.AddContactRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.AddContactRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.AddContactRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getContact(); if (f != null) { writer.writeMessage( 1, f, proto.services.ContactInfo.serializeBinaryToWriter ); } }; /** * optional ContactInfo contact = 1; * @return {?proto.services.ContactInfo} */ proto.services.AddContactRequest.prototype.getContact = function() { return /** @type{?proto.services.ContactInfo} */ ( jspb.Message.getWrapperField(this, proto.services.ContactInfo, 1)); }; /** @param {?proto.services.ContactInfo|undefined} value */ proto.services.AddContactRequest.prototype.setContact = function(value) { jspb.Message.setWrapperField(this, 1, value); }; proto.services.AddContactRequest.prototype.clearContact = function() { this.setContact(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.AddContactRequest.prototype.hasContact = function() { return jspb.Message.getField(this, 1) != null; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.AddContactResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.AddContactResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.AddContactResponse.displayName = 'proto.services.AddContactResponse'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.AddContactResponse.prototype.toObject = function(opt_includeInstance) { return proto.services.AddContactResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.AddContactResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.AddContactResponse.toObject = function(includeInstance, msg) { var f, obj = { contact: (f = msg.getContact()) && proto.services.ContactInfo.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.AddContactResponse} */ proto.services.AddContactResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.AddContactResponse; return proto.services.AddContactResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.AddContactResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.AddContactResponse} */ proto.services.AddContactResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.services.ContactInfo; reader.readMessage(value,proto.services.ContactInfo.deserializeBinaryFromReader); msg.setContact(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.AddContactResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.AddContactResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.AddContactResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.AddContactResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getContact(); if (f != null) { writer.writeMessage( 1, f, proto.services.ContactInfo.serializeBinaryToWriter ); } }; /** * optional ContactInfo contact = 1; * @return {?proto.services.ContactInfo} */ proto.services.AddContactResponse.prototype.getContact = function() { return /** @type{?proto.services.ContactInfo} */ ( jspb.Message.getWrapperField(this, proto.services.ContactInfo, 1)); }; /** @param {?proto.services.ContactInfo|undefined} value */ proto.services.AddContactResponse.prototype.setContact = function(value) { jspb.Message.setWrapperField(this, 1, value); }; proto.services.AddContactResponse.prototype.clearContact = function() { this.setContact(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.AddContactResponse.prototype.hasContact = function() { return jspb.Message.getField(this, 1) != null; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.RemoveContactByIDRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.RemoveContactByIDRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.RemoveContactByIDRequest.displayName = 'proto.services.RemoveContactByIDRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.RemoveContactByIDRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.RemoveContactByIDRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.RemoveContactByIDRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.RemoveContactByIDRequest.toObject = function(includeInstance, msg) { var f, obj = { id: jspb.Message.getFieldWithDefault(msg, 1, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.RemoveContactByIDRequest} */ proto.services.RemoveContactByIDRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.RemoveContactByIDRequest; return proto.services.RemoveContactByIDRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.RemoveContactByIDRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.RemoveContactByIDRequest} */ proto.services.RemoveContactByIDRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readUint64()); msg.setId(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.RemoveContactByIDRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.RemoveContactByIDRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.RemoveContactByIDRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.RemoveContactByIDRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getId(); if (f !== 0) { writer.writeUint64( 1, f ); } }; /** * optional uint64 id = 1; * @return {number} */ proto.services.RemoveContactByIDRequest.prototype.getId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.services.RemoveContactByIDRequest.prototype.setId = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.RemoveContactByAddressRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.RemoveContactByAddressRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.RemoveContactByAddressRequest.displayName = 'proto.services.RemoveContactByAddressRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.RemoveContactByAddressRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.RemoveContactByAddressRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.RemoveContactByAddressRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.RemoveContactByAddressRequest.toObject = function(includeInstance, msg) { var f, obj = { address: jspb.Message.getFieldWithDefault(msg, 1, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.RemoveContactByAddressRequest} */ proto.services.RemoveContactByAddressRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.RemoveContactByAddressRequest; return proto.services.RemoveContactByAddressRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.RemoveContactByAddressRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.RemoveContactByAddressRequest} */ proto.services.RemoveContactByAddressRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setAddress(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.RemoveContactByAddressRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.RemoveContactByAddressRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.RemoveContactByAddressRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.RemoveContactByAddressRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getAddress(); if (f.length > 0) { writer.writeString( 1, f ); } }; /** * optional string address = 1; * @return {string} */ proto.services.RemoveContactByAddressRequest.prototype.getAddress = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ proto.services.RemoveContactByAddressRequest.prototype.setAddress = function(value) { jspb.Message.setProto3StringField(this, 1, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.RemoveContactResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.RemoveContactResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.RemoveContactResponse.displayName = 'proto.services.RemoveContactResponse'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.RemoveContactResponse.prototype.toObject = function(opt_includeInstance) { return proto.services.RemoveContactResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.RemoveContactResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.RemoveContactResponse.toObject = function(includeInstance, msg) { var f, obj = { }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.RemoveContactResponse} */ proto.services.RemoveContactResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.RemoveContactResponse; return proto.services.RemoveContactResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.RemoveContactResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.RemoveContactResponse} */ proto.services.RemoveContactResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.RemoveContactResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.RemoveContactResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.RemoveContactResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.RemoveContactResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.Message = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.services.Message.repeatedFields_, null); }; goog.inherits(proto.services.Message, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.Message.displayName = 'proto.services.Message'; } /** * List of repeated fields within this message type. * @private {!Array<number>} * @const */ proto.services.Message.repeatedFields_ = [10]; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.Message.prototype.toObject = function(opt_includeInstance) { return proto.services.Message.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.Message} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.Message.toObject = function(includeInstance, msg) { var f, obj = { id: jspb.Message.getFieldWithDefault(msg, 1, 0), discussionId: jspb.Message.getFieldWithDefault(msg, 2, 0), sender: jspb.Message.getFieldWithDefault(msg, 3, ""), receiver: jspb.Message.getFieldWithDefault(msg, 4, ""), senderVerified: jspb.Message.getFieldWithDefault(msg, 11, false), payload: jspb.Message.getFieldWithDefault(msg, 5, ""), amtMsat: jspb.Message.getFieldWithDefault(msg, 6, 0), totalFeesMsat: jspb.Message.getFieldWithDefault(msg, 7, 0), sentTimestamp: (f = msg.getSentTimestamp()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), receivedTimestamp: (f = msg.getReceivedTimestamp()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), paymentRoutesList: jspb.Message.toObjectList(msg.getPaymentRoutesList(), proto.services.PaymentRoute.toObject, includeInstance), preimage: jspb.Message.getFieldWithDefault(msg, 12, ""), payReq: jspb.Message.getFieldWithDefault(msg, 13, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.Message} */ proto.services.Message.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.Message; return proto.services.Message.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.Message} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.Message} */ proto.services.Message.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readUint64()); msg.setId(value); break; case 2: var value = /** @type {number} */ (reader.readUint64()); msg.setDiscussionId(value); break; case 3: var value = /** @type {string} */ (reader.readString()); msg.setSender(value); break; case 4: var value = /** @type {string} */ (reader.readString()); msg.setReceiver(value); break; case 11: var value = /** @type {boolean} */ (reader.readBool()); msg.setSenderVerified(value); break; case 5: var value = /** @type {string} */ (reader.readString()); msg.setPayload(value); break; case 6: var value = /** @type {number} */ (reader.readInt64()); msg.setAmtMsat(value); break; case 7: var value = /** @type {number} */ (reader.readInt64()); msg.setTotalFeesMsat(value); break; case 8: var value = new google_protobuf_timestamp_pb.Timestamp; reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); msg.setSentTimestamp(value); break; case 9: var value = new google_protobuf_timestamp_pb.Timestamp; reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); msg.setReceivedTimestamp(value); break; case 10: var value = new proto.services.PaymentRoute; reader.readMessage(value,proto.services.PaymentRoute.deserializeBinaryFromReader); msg.addPaymentRoutes(value); break; case 12: var value = /** @type {string} */ (reader.readString()); msg.setPreimage(value); break; case 13: var value = /** @type {string} */ (reader.readString()); msg.setPayReq(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.Message.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.Message.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.Message} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.Message.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getId(); if (f !== 0) { writer.writeUint64( 1, f ); } f = message.getDiscussionId(); if (f !== 0) { writer.writeUint64( 2, f ); } f = message.getSender(); if (f.length > 0) { writer.writeString( 3, f ); } f = message.getReceiver(); if (f.length > 0) { writer.writeString( 4, f ); } f = message.getSenderVerified(); if (f) { writer.writeBool( 11, f ); } f = message.getPayload(); if (f.length > 0) { writer.writeString( 5, f ); } f = message.getAmtMsat(); if (f !== 0) { writer.writeInt64( 6, f ); } f = message.getTotalFeesMsat(); if (f !== 0) { writer.writeInt64( 7, f ); } f = message.getSentTimestamp(); if (f != null) { writer.writeMessage( 8, f, google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter ); } f = message.getReceivedTimestamp(); if (f != null) { writer.writeMessage( 9, f, google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter ); } f = message.getPaymentRoutesList(); if (f.length > 0) { writer.writeRepeatedMessage( 10, f, proto.services.PaymentRoute.serializeBinaryToWriter ); } f = message.getPreimage(); if (f.length > 0) { writer.writeString( 12, f ); } f = message.getPayReq(); if (f.length > 0) { writer.writeString( 13, f ); } }; /** * optional uint64 id = 1; * @return {number} */ proto.services.Message.prototype.getId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.services.Message.prototype.setId = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * optional uint64 discussion_id = 2; * @return {number} */ proto.services.Message.prototype.getDiscussionId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** @param {number} value */ proto.services.Message.prototype.setDiscussionId = function(value) { jspb.Message.setProto3IntField(this, 2, value); }; /** * optional string sender = 3; * @return {string} */ proto.services.Message.prototype.getSender = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** @param {string} value */ proto.services.Message.prototype.setSender = function(value) { jspb.Message.setProto3StringField(this, 3, value); }; /** * optional string receiver = 4; * @return {string} */ proto.services.Message.prototype.getReceiver = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; /** @param {string} value */ proto.services.Message.prototype.setReceiver = function(value) { jspb.Message.setProto3StringField(this, 4, value); }; /** * optional bool sender_verified = 11; * Note that Boolean fields may be set to 0/1 when serialized from a Java server. * You should avoid comparisons like {@code val === true/false} in those cases. * @return {boolean} */ proto.services.Message.prototype.getSenderVerified = function() { return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 11, false)); }; /** @param {boolean} value */ proto.services.Message.prototype.setSenderVerified = function(value) { jspb.Message.setProto3BooleanField(this, 11, value); }; /** * optional string payload = 5; * @return {string} */ proto.services.Message.prototype.getPayload = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); }; /** @param {string} value */ proto.services.Message.prototype.setPayload = function(value) { jspb.Message.setProto3StringField(this, 5, value); }; /** * optional int64 amt_msat = 6; * @return {number} */ proto.services.Message.prototype.getAmtMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); }; /** @param {number} value */ proto.services.Message.prototype.setAmtMsat = function(value) { jspb.Message.setProto3IntField(this, 6, value); }; /** * optional int64 total_fees_msat = 7; * @return {number} */ proto.services.Message.prototype.getTotalFeesMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 7, 0)); }; /** @param {number} value */ proto.services.Message.prototype.setTotalFeesMsat = function(value) { jspb.Message.setProto3IntField(this, 7, value); }; /** * optional google.protobuf.Timestamp sent_timestamp = 8; * @return {?proto.google.protobuf.Timestamp} */ proto.services.Message.prototype.getSentTimestamp = function() { return /** @type{?proto.google.protobuf.Timestamp} */ ( jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 8)); }; /** @param {?proto.google.protobuf.Timestamp|undefined} value */ proto.services.Message.prototype.setSentTimestamp = function(value) { jspb.Message.setWrapperField(this, 8, value); }; proto.services.Message.prototype.clearSentTimestamp = function() { this.setSentTimestamp(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.Message.prototype.hasSentTimestamp = function() { return jspb.Message.getField(this, 8) != null; }; /** * optional google.protobuf.Timestamp received_timestamp = 9; * @return {?proto.google.protobuf.Timestamp} */ proto.services.Message.prototype.getReceivedTimestamp = function() { return /** @type{?proto.google.protobuf.Timestamp} */ ( jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 9)); }; /** @param {?proto.google.protobuf.Timestamp|undefined} value */ proto.services.Message.prototype.setReceivedTimestamp = function(value) { jspb.Message.setWrapperField(this, 9, value); }; proto.services.Message.prototype.clearReceivedTimestamp = function() { this.setReceivedTimestamp(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.Message.prototype.hasReceivedTimestamp = function() { return jspb.Message.getField(this, 9) != null; }; /** * repeated PaymentRoute payment_routes = 10; * @return {!Array<!proto.services.PaymentRoute>} */ proto.services.Message.prototype.getPaymentRoutesList = function() { return /** @type{!Array<!proto.services.PaymentRoute>} */ ( jspb.Message.getRepeatedWrapperField(this, proto.services.PaymentRoute, 10)); }; /** @param {!Array<!proto.services.PaymentRoute>} value */ proto.services.Message.prototype.setPaymentRoutesList = function(value) { jspb.Message.setRepeatedWrapperField(this, 10, value); }; /** * @param {!proto.services.PaymentRoute=} opt_value * @param {number=} opt_index * @return {!proto.services.PaymentRoute} */ proto.services.Message.prototype.addPaymentRoutes = function(opt_value, opt_index) { return jspb.Message.addToRepeatedWrapperField(this, 10, opt_value, proto.services.PaymentRoute, opt_index); }; proto.services.Message.prototype.clearPaymentRoutesList = function() { this.setPaymentRoutesList([]); }; /** * optional string preimage = 12; * @return {string} */ proto.services.Message.prototype.getPreimage = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 12, "")); }; /** @param {string} value */ proto.services.Message.prototype.setPreimage = function(value) { jspb.Message.setProto3StringField(this, 12, value); }; /** * optional string pay_req = 13; * @return {string} */ proto.services.Message.prototype.getPayReq = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 13, "")); }; /** @param {string} value */ proto.services.Message.prototype.setPayReq = function(value) { jspb.Message.setProto3StringField(this, 13, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.PaymentRoute = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.services.PaymentRoute.repeatedFields_, null); }; goog.inherits(proto.services.PaymentRoute, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.PaymentRoute.displayName = 'proto.services.PaymentRoute'; } /** * List of repeated fields within this message type. * @private {!Array<number>} * @const */ proto.services.PaymentRoute.repeatedFields_ = [1]; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.PaymentRoute.prototype.toObject = function(opt_includeInstance) { return proto.services.PaymentRoute.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.PaymentRoute} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.PaymentRoute.toObject = function(includeInstance, msg) { var f, obj = { hopsList: jspb.Message.toObjectList(msg.getHopsList(), proto.services.PaymentHop.toObject, includeInstance), totalTimelock: jspb.Message.getFieldWithDefault(msg, 2, 0), routeAmtMsat: jspb.Message.getFieldWithDefault(msg, 3, 0), routeFeesMsat: jspb.Message.getFieldWithDefault(msg, 4, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.PaymentRoute} */ proto.services.PaymentRoute.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.PaymentRoute; return proto.services.PaymentRoute.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.PaymentRoute} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.PaymentRoute} */ proto.services.PaymentRoute.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.services.PaymentHop; reader.readMessage(value,proto.services.PaymentHop.deserializeBinaryFromReader); msg.addHops(value); break; case 2: var value = /** @type {number} */ (reader.readUint32()); msg.setTotalTimelock(value); break; case 3: var value = /** @type {number} */ (reader.readInt64()); msg.setRouteAmtMsat(value); break; case 4: var value = /** @type {number} */ (reader.readInt64()); msg.setRouteFeesMsat(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.PaymentRoute.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.PaymentRoute.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.PaymentRoute} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.PaymentRoute.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getHopsList(); if (f.length > 0) { writer.writeRepeatedMessage( 1, f, proto.services.PaymentHop.serializeBinaryToWriter ); } f = message.getTotalTimelock(); if (f !== 0) { writer.writeUint32( 2, f ); } f = message.getRouteAmtMsat(); if (f !== 0) { writer.writeInt64( 3, f ); } f = message.getRouteFeesMsat(); if (f !== 0) { writer.writeInt64( 4, f ); } }; /** * repeated PaymentHop hops = 1; * @return {!Array<!proto.services.PaymentHop>} */ proto.services.PaymentRoute.prototype.getHopsList = function() { return /** @type{!Array<!proto.services.PaymentHop>} */ ( jspb.Message.getRepeatedWrapperField(this, proto.services.PaymentHop, 1)); }; /** @param {!Array<!proto.services.PaymentHop>} value */ proto.services.PaymentRoute.prototype.setHopsList = function(value) { jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** * @param {!proto.services.PaymentHop=} opt_value * @param {number=} opt_index * @return {!proto.services.PaymentHop} */ proto.services.PaymentRoute.prototype.addHops = function(opt_value, opt_index) { return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.services.PaymentHop, opt_index); }; proto.services.PaymentRoute.prototype.clearHopsList = function() { this.setHopsList([]); }; /** * optional uint32 total_timelock = 2; * @return {number} */ proto.services.PaymentRoute.prototype.getTotalTimelock = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** @param {number} value */ proto.services.PaymentRoute.prototype.setTotalTimelock = function(value) { jspb.Message.setProto3IntField(this, 2, value); }; /** * optional int64 route_amt_msat = 3; * @return {number} */ proto.services.PaymentRoute.prototype.getRouteAmtMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** @param {number} value */ proto.services.PaymentRoute.prototype.setRouteAmtMsat = function(value) { jspb.Message.setProto3IntField(this, 3, value); }; /** * optional int64 route_fees_msat = 4; * @return {number} */ proto.services.PaymentRoute.prototype.getRouteFeesMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); }; /** @param {number} value */ proto.services.PaymentRoute.prototype.setRouteFeesMsat = function(value) { jspb.Message.setProto3IntField(this, 4, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.PaymentHop = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.PaymentHop, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.PaymentHop.displayName = 'proto.services.PaymentHop'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.PaymentHop.prototype.toObject = function(opt_includeInstance) { return proto.services.PaymentHop.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.PaymentHop} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.PaymentHop.toObject = function(includeInstance, msg) { var f, obj = { chanId: jspb.Message.getFieldWithDefault(msg, 1, 0), hopAddress: jspb.Message.getFieldWithDefault(msg, 2, ""), amtToForwardMsat: jspb.Message.getFieldWithDefault(msg, 3, 0), feeMsat: jspb.Message.getFieldWithDefault(msg, 4, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.PaymentHop} */ proto.services.PaymentHop.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.PaymentHop; return proto.services.PaymentHop.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.PaymentHop} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.PaymentHop} */ proto.services.PaymentHop.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readUint64()); msg.setChanId(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.setHopAddress(value); break; case 3: var value = /** @type {number} */ (reader.readInt64()); msg.setAmtToForwardMsat(value); break; case 4: var value = /** @type {number} */ (reader.readInt64()); msg.setFeeMsat(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.PaymentHop.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.PaymentHop.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.PaymentHop} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.PaymentHop.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getChanId(); if (f !== 0) { writer.writeUint64( 1, f ); } f = message.getHopAddress(); if (f.length > 0) { writer.writeString( 2, f ); } f = message.getAmtToForwardMsat(); if (f !== 0) { writer.writeInt64( 3, f ); } f = message.getFeeMsat(); if (f !== 0) { writer.writeInt64( 4, f ); } }; /** * optional uint64 chan_id = 1; * @return {number} */ proto.services.PaymentHop.prototype.getChanId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.services.PaymentHop.prototype.setChanId = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * optional string hop_address = 2; * @return {string} */ proto.services.PaymentHop.prototype.getHopAddress = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** @param {string} value */ proto.services.PaymentHop.prototype.setHopAddress = function(value) { jspb.Message.setProto3StringField(this, 2, value); }; /** * optional int64 amt_to_forward_msat = 3; * @return {number} */ proto.services.PaymentHop.prototype.getAmtToForwardMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** @param {number} value */ proto.services.PaymentHop.prototype.setAmtToForwardMsat = function(value) { jspb.Message.setProto3IntField(this, 3, value); }; /** * optional int64 fee_msat = 4; * @return {number} */ proto.services.PaymentHop.prototype.getFeeMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); }; /** @param {number} value */ proto.services.PaymentHop.prototype.setFeeMsat = function(value) { jspb.Message.setProto3IntField(this, 4, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.MessageOptions = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.MessageOptions, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.MessageOptions.displayName = 'proto.services.MessageOptions'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.MessageOptions.prototype.toObject = function(opt_includeInstance) { return proto.services.MessageOptions.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.MessageOptions} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.MessageOptions.toObject = function(includeInstance, msg) { var f, obj = { feeLimitMsat: jspb.Message.getFieldWithDefault(msg, 1, 0), anonymous: jspb.Message.getFieldWithDefault(msg, 2, false) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.MessageOptions} */ proto.services.MessageOptions.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.MessageOptions; return proto.services.MessageOptions.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.MessageOptions} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.MessageOptions} */ proto.services.MessageOptions.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readInt64()); msg.setFeeLimitMsat(value); break; case 2: var value = /** @type {boolean} */ (reader.readBool()); msg.setAnonymous(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.MessageOptions.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.MessageOptions.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.MessageOptions} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.MessageOptions.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getFeeLimitMsat(); if (f !== 0) { writer.writeInt64( 1, f ); } f = message.getAnonymous(); if (f) { writer.writeBool( 2, f ); } }; /** * optional int64 fee_limit_msat = 1; * @return {number} */ proto.services.MessageOptions.prototype.getFeeLimitMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.services.MessageOptions.prototype.setFeeLimitMsat = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * optional bool anonymous = 2; * Note that Boolean fields may be set to 0/1 when serialized from a Java server. * You should avoid comparisons like {@code val === true/false} in those cases. * @return {boolean} */ proto.services.MessageOptions.prototype.getAnonymous = function() { return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 2, false)); }; /** @param {boolean} value */ proto.services.MessageOptions.prototype.setAnonymous = function(value) { jspb.Message.setProto3BooleanField(this, 2, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.EstimateMessageRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.EstimateMessageRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.EstimateMessageRequest.displayName = 'proto.services.EstimateMessageRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.EstimateMessageRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.EstimateMessageRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.EstimateMessageRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.EstimateMessageRequest.toObject = function(includeInstance, msg) { var f, obj = { discussionId: jspb.Message.getFieldWithDefault(msg, 1, 0), payload: jspb.Message.getFieldWithDefault(msg, 2, ""), amtMsat: jspb.Message.getFieldWithDefault(msg, 3, 0), options: (f = msg.getOptions()) && proto.services.MessageOptions.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.EstimateMessageRequest} */ proto.services.EstimateMessageRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.EstimateMessageRequest; return proto.services.EstimateMessageRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.EstimateMessageRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.EstimateMessageRequest} */ proto.services.EstimateMessageRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readUint64()); msg.setDiscussionId(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.setPayload(value); break; case 3: var value = /** @type {number} */ (reader.readInt64()); msg.setAmtMsat(value); break; case 4: var value = new proto.services.MessageOptions; reader.readMessage(value,proto.services.MessageOptions.deserializeBinaryFromReader); msg.setOptions(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.EstimateMessageRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.EstimateMessageRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.EstimateMessageRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.EstimateMessageRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getDiscussionId(); if (f !== 0) { writer.writeUint64( 1, f ); } f = message.getPayload(); if (f.length > 0) { writer.writeString( 2, f ); } f = message.getAmtMsat(); if (f !== 0) { writer.writeInt64( 3, f ); } f = message.getOptions(); if (f != null) { writer.writeMessage( 4, f, proto.services.MessageOptions.serializeBinaryToWriter ); } }; /** * optional uint64 discussion_id = 1; * @return {number} */ proto.services.EstimateMessageRequest.prototype.getDiscussionId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.services.EstimateMessageRequest.prototype.setDiscussionId = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * optional string payload = 2; * @return {string} */ proto.services.EstimateMessageRequest.prototype.getPayload = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** @param {string} value */ proto.services.EstimateMessageRequest.prototype.setPayload = function(value) { jspb.Message.setProto3StringField(this, 2, value); }; /** * optional int64 amt_msat = 3; * @return {number} */ proto.services.EstimateMessageRequest.prototype.getAmtMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** @param {number} value */ proto.services.EstimateMessageRequest.prototype.setAmtMsat = function(value) { jspb.Message.setProto3IntField(this, 3, value); }; /** * optional MessageOptions options = 4; * @return {?proto.services.MessageOptions} */ proto.services.EstimateMessageRequest.prototype.getOptions = function() { return /** @type{?proto.services.MessageOptions} */ ( jspb.Message.getWrapperField(this, proto.services.MessageOptions, 4)); }; /** @param {?proto.services.MessageOptions|undefined} value */ proto.services.EstimateMessageRequest.prototype.setOptions = function(value) { jspb.Message.setWrapperField(this, 4, value); }; proto.services.EstimateMessageRequest.prototype.clearOptions = function() { this.setOptions(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.EstimateMessageRequest.prototype.hasOptions = function() { return jspb.Message.getField(this, 4) != null; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.EstimateMessageResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.EstimateMessageResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.EstimateMessageResponse.displayName = 'proto.services.EstimateMessageResponse'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.EstimateMessageResponse.prototype.toObject = function(opt_includeInstance) { return proto.services.EstimateMessageResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.EstimateMessageResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.EstimateMessageResponse.toObject = function(includeInstance, msg) { var f, obj = { successProb: +jspb.Message.getFieldWithDefault(msg, 1, 0.0), message: (f = msg.getMessage()) && proto.services.Message.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.EstimateMessageResponse} */ proto.services.EstimateMessageResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.EstimateMessageResponse; return proto.services.EstimateMessageResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.EstimateMessageResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.EstimateMessageResponse} */ proto.services.EstimateMessageResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readDouble()); msg.setSuccessProb(value); break; case 2: var value = new proto.services.Message; reader.readMessage(value,proto.services.Message.deserializeBinaryFromReader); msg.setMessage(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.EstimateMessageResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.EstimateMessageResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.EstimateMessageResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.EstimateMessageResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getSuccessProb(); if (f !== 0.0) { writer.writeDouble( 1, f ); } f = message.getMessage(); if (f != null) { writer.writeMessage( 2, f, proto.services.Message.serializeBinaryToWriter ); } }; /** * optional double success_prob = 1; * @return {number} */ proto.services.EstimateMessageResponse.prototype.getSuccessProb = function() { return /** @type {number} */ (+jspb.Message.getFieldWithDefault(this, 1, 0.0)); }; /** @param {number} value */ proto.services.EstimateMessageResponse.prototype.setSuccessProb = function(value) { jspb.Message.setProto3FloatField(this, 1, value); }; /** * optional Message message = 2; * @return {?proto.services.Message} */ proto.services.EstimateMessageResponse.prototype.getMessage = function() { return /** @type{?proto.services.Message} */ ( jspb.Message.getWrapperField(this, proto.services.Message, 2)); }; /** @param {?proto.services.Message|undefined} value */ proto.services.EstimateMessageResponse.prototype.setMessage = function(value) { jspb.Message.setWrapperField(this, 2, value); }; proto.services.EstimateMessageResponse.prototype.clearMessage = function() { this.setMessage(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.EstimateMessageResponse.prototype.hasMessage = function() { return jspb.Message.getField(this, 2) != null; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.SendMessageRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.SendMessageRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.SendMessageRequest.displayName = 'proto.services.SendMessageRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.SendMessageRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.SendMessageRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.SendMessageRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.SendMessageRequest.toObject = function(includeInstance, msg) { var f, obj = { discussionId: jspb.Message.getFieldWithDefault(msg, 1, 0), payload: jspb.Message.getFieldWithDefault(msg, 2, ""), amtMsat: jspb.Message.getFieldWithDefault(msg, 3, 0), payReq: jspb.Message.getFieldWithDefault(msg, 5, ""), options: (f = msg.getOptions()) && proto.services.MessageOptions.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.SendMessageRequest} */ proto.services.SendMessageRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.SendMessageRequest; return proto.services.SendMessageRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.SendMessageRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.SendMessageRequest} */ proto.services.SendMessageRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readUint64()); msg.setDiscussionId(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.setPayload(value); break; case 3: var value = /** @type {number} */ (reader.readInt64()); msg.setAmtMsat(value); break; case 5: var value = /** @type {string} */ (reader.readString()); msg.setPayReq(value); break; case 4: var value = new proto.services.MessageOptions; reader.readMessage(value,proto.services.MessageOptions.deserializeBinaryFromReader); msg.setOptions(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.SendMessageRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.SendMessageRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.SendMessageRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.SendMessageRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getDiscussionId(); if (f !== 0) { writer.writeUint64( 1, f ); } f = message.getPayload(); if (f.length > 0) { writer.writeString( 2, f ); } f = message.getAmtMsat(); if (f !== 0) { writer.writeInt64( 3, f ); } f = message.getPayReq(); if (f.length > 0) { writer.writeString( 5, f ); } f = message.getOptions(); if (f != null) { writer.writeMessage( 4, f, proto.services.MessageOptions.serializeBinaryToWriter ); } }; /** * optional uint64 discussion_id = 1; * @return {number} */ proto.services.SendMessageRequest.prototype.getDiscussionId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.services.SendMessageRequest.prototype.setDiscussionId = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * optional string payload = 2; * @return {string} */ proto.services.SendMessageRequest.prototype.getPayload = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** @param {string} value */ proto.services.SendMessageRequest.prototype.setPayload = function(value) { jspb.Message.setProto3StringField(this, 2, value); }; /** * optional int64 amt_msat = 3; * @return {number} */ proto.services.SendMessageRequest.prototype.getAmtMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** @param {number} value */ proto.services.SendMessageRequest.prototype.setAmtMsat = function(value) { jspb.Message.setProto3IntField(this, 3, value); }; /** * optional string pay_req = 5; * @return {string} */ proto.services.SendMessageRequest.prototype.getPayReq = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); }; /** @param {string} value */ proto.services.SendMessageRequest.prototype.setPayReq = function(value) { jspb.Message.setProto3StringField(this, 5, value); }; /** * optional MessageOptions options = 4; * @return {?proto.services.MessageOptions} */ proto.services.SendMessageRequest.prototype.getOptions = function() { return /** @type{?proto.services.MessageOptions} */ ( jspb.Message.getWrapperField(this, proto.services.MessageOptions, 4)); }; /** @param {?proto.services.MessageOptions|undefined} value */ proto.services.SendMessageRequest.prototype.setOptions = function(value) { jspb.Message.setWrapperField(this, 4, value); }; proto.services.SendMessageRequest.prototype.clearOptions = function() { this.setOptions(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.SendMessageRequest.prototype.hasOptions = function() { return jspb.Message.getField(this, 4) != null; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.SendMessageResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.SendMessageResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.SendMessageResponse.displayName = 'proto.services.SendMessageResponse'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.SendMessageResponse.prototype.toObject = function(opt_includeInstance) { return proto.services.SendMessageResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.SendMessageResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.SendMessageResponse.toObject = function(includeInstance, msg) { var f, obj = { sentMessage: (f = msg.getSentMessage()) && proto.services.Message.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.SendMessageResponse} */ proto.services.SendMessageResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.SendMessageResponse; return proto.services.SendMessageResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.SendMessageResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.SendMessageResponse} */ proto.services.SendMessageResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.services.Message; reader.readMessage(value,proto.services.Message.deserializeBinaryFromReader); msg.setSentMessage(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.SendMessageResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.SendMessageResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.SendMessageResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.SendMessageResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getSentMessage(); if (f != null) { writer.writeMessage( 1, f, proto.services.Message.serializeBinaryToWriter ); } }; /** * optional Message sent_message = 1; * @return {?proto.services.Message} */ proto.services.SendMessageResponse.prototype.getSentMessage = function() { return /** @type{?proto.services.Message} */ ( jspb.Message.getWrapperField(this, proto.services.Message, 1)); }; /** @param {?proto.services.Message|undefined} value */ proto.services.SendMessageResponse.prototype.setSentMessage = function(value) { jspb.Message.setWrapperField(this, 1, value); }; proto.services.SendMessageResponse.prototype.clearSentMessage = function() { this.setSentMessage(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.SendMessageResponse.prototype.hasSentMessage = function() { return jspb.Message.getField(this, 1) != null; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.SubscribeMessageRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.SubscribeMessageRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.SubscribeMessageRequest.displayName = 'proto.services.SubscribeMessageRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.SubscribeMessageRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.SubscribeMessageRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.SubscribeMessageRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.SubscribeMessageRequest.toObject = function(includeInstance, msg) { var f, obj = { }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.SubscribeMessageRequest} */ proto.services.SubscribeMessageRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.SubscribeMessageRequest; return proto.services.SubscribeMessageRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.SubscribeMessageRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.SubscribeMessageRequest} */ proto.services.SubscribeMessageRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.SubscribeMessageRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.SubscribeMessageRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.SubscribeMessageRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.SubscribeMessageRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.SubscribeMessageResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.SubscribeMessageResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.SubscribeMessageResponse.displayName = 'proto.services.SubscribeMessageResponse'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.SubscribeMessageResponse.prototype.toObject = function(opt_includeInstance) { return proto.services.SubscribeMessageResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.SubscribeMessageResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.SubscribeMessageResponse.toObject = function(includeInstance, msg) { var f, obj = { receivedMessage: (f = msg.getReceivedMessage()) && proto.services.Message.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.SubscribeMessageResponse} */ proto.services.SubscribeMessageResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.SubscribeMessageResponse; return proto.services.SubscribeMessageResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.SubscribeMessageResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.SubscribeMessageResponse} */ proto.services.SubscribeMessageResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.services.Message; reader.readMessage(value,proto.services.Message.deserializeBinaryFromReader); msg.setReceivedMessage(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.SubscribeMessageResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.SubscribeMessageResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.SubscribeMessageResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.SubscribeMessageResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getReceivedMessage(); if (f != null) { writer.writeMessage( 1, f, proto.services.Message.serializeBinaryToWriter ); } }; /** * optional Message received_message = 1; * @return {?proto.services.Message} */ proto.services.SubscribeMessageResponse.prototype.getReceivedMessage = function() { return /** @type{?proto.services.Message} */ ( jspb.Message.getWrapperField(this, proto.services.Message, 1)); }; /** @param {?proto.services.Message|undefined} value */ proto.services.SubscribeMessageResponse.prototype.setReceivedMessage = function(value) { jspb.Message.setWrapperField(this, 1, value); }; proto.services.SubscribeMessageResponse.prototype.clearReceivedMessage = function() { this.setReceivedMessage(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.SubscribeMessageResponse.prototype.hasReceivedMessage = function() { return jspb.Message.getField(this, 1) != null; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.DiscussionInfo = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.services.DiscussionInfo.repeatedFields_, null); }; goog.inherits(proto.services.DiscussionInfo, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.DiscussionInfo.displayName = 'proto.services.DiscussionInfo'; } /** * List of repeated fields within this message type. * @private {!Array<number>} * @const */ proto.services.DiscussionInfo.repeatedFields_ = [2]; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.DiscussionInfo.prototype.toObject = function(opt_includeInstance) { return proto.services.DiscussionInfo.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.DiscussionInfo} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.DiscussionInfo.toObject = function(includeInstance, msg) { var f, obj = { id: jspb.Message.getFieldWithDefault(msg, 1, 0), participantsList: jspb.Message.getRepeatedField(msg, 2), options: (f = msg.getOptions()) && proto.services.DiscussionOptions.toObject(includeInstance, f), lastReadMsgId: jspb.Message.getFieldWithDefault(msg, 4, 0), lastMsgId: jspb.Message.getFieldWithDefault(msg, 5, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.DiscussionInfo} */ proto.services.DiscussionInfo.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.DiscussionInfo; return proto.services.DiscussionInfo.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.DiscussionInfo} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.DiscussionInfo} */ proto.services.DiscussionInfo.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readUint64()); msg.setId(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.addParticipants(value); break; case 3: var value = new proto.services.DiscussionOptions; reader.readMessage(value,proto.services.DiscussionOptions.deserializeBinaryFromReader); msg.setOptions(value); break; case 4: var value = /** @type {number} */ (reader.readUint64()); msg.setLastReadMsgId(value); break; case 5: var value = /** @type {number} */ (reader.readUint64()); msg.setLastMsgId(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.DiscussionInfo.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.DiscussionInfo.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.DiscussionInfo} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.DiscussionInfo.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getId(); if (f !== 0) { writer.writeUint64( 1, f ); } f = message.getParticipantsList(); if (f.length > 0) { writer.writeRepeatedString( 2, f ); } f = message.getOptions(); if (f != null) { writer.writeMessage( 3, f, proto.services.DiscussionOptions.serializeBinaryToWriter ); } f = message.getLastReadMsgId(); if (f !== 0) { writer.writeUint64( 4, f ); } f = message.getLastMsgId(); if (f !== 0) { writer.writeUint64( 5, f ); } }; /** * optional uint64 id = 1; * @return {number} */ proto.services.DiscussionInfo.prototype.getId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.services.DiscussionInfo.prototype.setId = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * repeated string participants = 2; * @return {!Array<string>} */ proto.services.DiscussionInfo.prototype.getParticipantsList = function() { return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 2)); }; /** @param {!Array<string>} value */ proto.services.DiscussionInfo.prototype.setParticipantsList = function(value) { jspb.Message.setField(this, 2, value || []); }; /** * @param {!string} value * @param {number=} opt_index */ proto.services.DiscussionInfo.prototype.addParticipants = function(value, opt_index) { jspb.Message.addToRepeatedField(this, 2, value, opt_index); }; proto.services.DiscussionInfo.prototype.clearParticipantsList = function() { this.setParticipantsList([]); }; /** * optional DiscussionOptions options = 3; * @return {?proto.services.DiscussionOptions} */ proto.services.DiscussionInfo.prototype.getOptions = function() { return /** @type{?proto.services.DiscussionOptions} */ ( jspb.Message.getWrapperField(this, proto.services.DiscussionOptions, 3)); }; /** @param {?proto.services.DiscussionOptions|undefined} value */ proto.services.DiscussionInfo.prototype.setOptions = function(value) { jspb.Message.setWrapperField(this, 3, value); }; proto.services.DiscussionInfo.prototype.clearOptions = function() { this.setOptions(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.DiscussionInfo.prototype.hasOptions = function() { return jspb.Message.getField(this, 3) != null; }; /** * optional uint64 last_read_msg_id = 4; * @return {number} */ proto.services.DiscussionInfo.prototype.getLastReadMsgId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); }; /** @param {number} value */ proto.services.DiscussionInfo.prototype.setLastReadMsgId = function(value) { jspb.Message.setProto3IntField(this, 4, value); }; /** * optional uint64 last_msg_id = 5; * @return {number} */ proto.services.DiscussionInfo.prototype.getLastMsgId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); }; /** @param {number} value */ proto.services.DiscussionInfo.prototype.setLastMsgId = function(value) { jspb.Message.setProto3IntField(this, 5, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.DiscussionOptions = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.DiscussionOptions, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.DiscussionOptions.displayName = 'proto.services.DiscussionOptions'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.DiscussionOptions.prototype.toObject = function(opt_includeInstance) { return proto.services.DiscussionOptions.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.DiscussionOptions} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.DiscussionOptions.toObject = function(includeInstance, msg) { var f, obj = { feeLimitMsat: jspb.Message.getFieldWithDefault(msg, 1, 0), anonymous: jspb.Message.getFieldWithDefault(msg, 2, false) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.DiscussionOptions} */ proto.services.DiscussionOptions.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.DiscussionOptions; return proto.services.DiscussionOptions.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.DiscussionOptions} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.DiscussionOptions} */ proto.services.DiscussionOptions.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readInt64()); msg.setFeeLimitMsat(value); break; case 2: var value = /** @type {boolean} */ (reader.readBool()); msg.setAnonymous(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.DiscussionOptions.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.DiscussionOptions.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.DiscussionOptions} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.DiscussionOptions.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getFeeLimitMsat(); if (f !== 0) { writer.writeInt64( 1, f ); } f = message.getAnonymous(); if (f) { writer.writeBool( 2, f ); } }; /** * optional int64 fee_limit_msat = 1; * @return {number} */ proto.services.DiscussionOptions.prototype.getFeeLimitMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.services.DiscussionOptions.prototype.setFeeLimitMsat = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * optional bool anonymous = 2; * Note that Boolean fields may be set to 0/1 when serialized from a Java server. * You should avoid comparisons like {@code val === true/false} in those cases. * @return {boolean} */ proto.services.DiscussionOptions.prototype.getAnonymous = function() { return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 2, false)); }; /** @param {boolean} value */ proto.services.DiscussionOptions.prototype.setAnonymous = function(value) { jspb.Message.setProto3BooleanField(this, 2, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.GetDiscussionsRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.GetDiscussionsRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.GetDiscussionsRequest.displayName = 'proto.services.GetDiscussionsRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.GetDiscussionsRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.GetDiscussionsRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.GetDiscussionsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.GetDiscussionsRequest.toObject = function(includeInstance, msg) { var f, obj = { }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.GetDiscussionsRequest} */ proto.services.GetDiscussionsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.GetDiscussionsRequest; return proto.services.GetDiscussionsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.GetDiscussionsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.GetDiscussionsRequest} */ proto.services.GetDiscussionsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.GetDiscussionsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.GetDiscussionsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.GetDiscussionsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.GetDiscussionsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.GetDiscussionsResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.GetDiscussionsResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.GetDiscussionsResponse.displayName = 'proto.services.GetDiscussionsResponse'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.GetDiscussionsResponse.prototype.toObject = function(opt_includeInstance) { return proto.services.GetDiscussionsResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.GetDiscussionsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.GetDiscussionsResponse.toObject = function(includeInstance, msg) { var f, obj = { discussion: (f = msg.getDiscussion()) && proto.services.DiscussionInfo.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.GetDiscussionsResponse} */ proto.services.GetDiscussionsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.GetDiscussionsResponse; return proto.services.GetDiscussionsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.GetDiscussionsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.GetDiscussionsResponse} */ proto.services.GetDiscussionsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.services.DiscussionInfo; reader.readMessage(value,proto.services.DiscussionInfo.deserializeBinaryFromReader); msg.setDiscussion(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.GetDiscussionsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.GetDiscussionsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.GetDiscussionsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.GetDiscussionsResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getDiscussion(); if (f != null) { writer.writeMessage( 1, f, proto.services.DiscussionInfo.serializeBinaryToWriter ); } }; /** * optional DiscussionInfo discussion = 1; * @return {?proto.services.DiscussionInfo} */ proto.services.GetDiscussionsResponse.prototype.getDiscussion = function() { return /** @type{?proto.services.DiscussionInfo} */ ( jspb.Message.getWrapperField(this, proto.services.DiscussionInfo, 1)); }; /** @param {?proto.services.DiscussionInfo|undefined} value */ proto.services.GetDiscussionsResponse.prototype.setDiscussion = function(value) { jspb.Message.setWrapperField(this, 1, value); }; proto.services.GetDiscussionsResponse.prototype.clearDiscussion = function() { this.setDiscussion(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.GetDiscussionsResponse.prototype.hasDiscussion = function() { return jspb.Message.getField(this, 1) != null; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.GetDiscussionHistoryByIDRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.GetDiscussionHistoryByIDRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.GetDiscussionHistoryByIDRequest.displayName = 'proto.services.GetDiscussionHistoryByIDRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.GetDiscussionHistoryByIDRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.GetDiscussionHistoryByIDRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.GetDiscussionHistoryByIDRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.GetDiscussionHistoryByIDRequest.toObject = function(includeInstance, msg) { var f, obj = { id: jspb.Message.getFieldWithDefault(msg, 1, 0), pageOptions: (f = msg.getPageOptions()) && proto.services.KeySetPageOptions.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.GetDiscussionHistoryByIDRequest} */ proto.services.GetDiscussionHistoryByIDRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.GetDiscussionHistoryByIDRequest; return proto.services.GetDiscussionHistoryByIDRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.GetDiscussionHistoryByIDRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.GetDiscussionHistoryByIDRequest} */ proto.services.GetDiscussionHistoryByIDRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readUint64()); msg.setId(value); break; case 2: var value = new proto.services.KeySetPageOptions; reader.readMessage(value,proto.services.KeySetPageOptions.deserializeBinaryFromReader); msg.setPageOptions(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.GetDiscussionHistoryByIDRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.GetDiscussionHistoryByIDRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.GetDiscussionHistoryByIDRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.GetDiscussionHistoryByIDRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getId(); if (f !== 0) { writer.writeUint64( 1, f ); } f = message.getPageOptions(); if (f != null) { writer.writeMessage( 2, f, proto.services.KeySetPageOptions.serializeBinaryToWriter ); } }; /** * optional uint64 id = 1; * @return {number} */ proto.services.GetDiscussionHistoryByIDRequest.prototype.getId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.services.GetDiscussionHistoryByIDRequest.prototype.setId = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * optional KeySetPageOptions page_options = 2; * @return {?proto.services.KeySetPageOptions} */ proto.services.GetDiscussionHistoryByIDRequest.prototype.getPageOptions = function() { return /** @type{?proto.services.KeySetPageOptions} */ ( jspb.Message.getWrapperField(this, proto.services.KeySetPageOptions, 2)); }; /** @param {?proto.services.KeySetPageOptions|undefined} value */ proto.services.GetDiscussionHistoryByIDRequest.prototype.setPageOptions = function(value) { jspb.Message.setWrapperField(this, 2, value); }; proto.services.GetDiscussionHistoryByIDRequest.prototype.clearPageOptions = function() { this.setPageOptions(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.GetDiscussionHistoryByIDRequest.prototype.hasPageOptions = function() { return jspb.Message.getField(this, 2) != null; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.GetDiscussionHistoryResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.GetDiscussionHistoryResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.GetDiscussionHistoryResponse.displayName = 'proto.services.GetDiscussionHistoryResponse'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.GetDiscussionHistoryResponse.prototype.toObject = function(opt_includeInstance) { return proto.services.GetDiscussionHistoryResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.GetDiscussionHistoryResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.GetDiscussionHistoryResponse.toObject = function(includeInstance, msg) { var f, obj = { message: (f = msg.getMessage()) && proto.services.Message.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.GetDiscussionHistoryResponse} */ proto.services.GetDiscussionHistoryResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.GetDiscussionHistoryResponse; return proto.services.GetDiscussionHistoryResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.GetDiscussionHistoryResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.GetDiscussionHistoryResponse} */ proto.services.GetDiscussionHistoryResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.services.Message; reader.readMessage(value,proto.services.Message.deserializeBinaryFromReader); msg.setMessage(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.GetDiscussionHistoryResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.GetDiscussionHistoryResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.GetDiscussionHistoryResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.GetDiscussionHistoryResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getMessage(); if (f != null) { writer.writeMessage( 1, f, proto.services.Message.serializeBinaryToWriter ); } }; /** * optional Message message = 1; * @return {?proto.services.Message} */ proto.services.GetDiscussionHistoryResponse.prototype.getMessage = function() { return /** @type{?proto.services.Message} */ ( jspb.Message.getWrapperField(this, proto.services.Message, 1)); }; /** @param {?proto.services.Message|undefined} value */ proto.services.GetDiscussionHistoryResponse.prototype.setMessage = function(value) { jspb.Message.setWrapperField(this, 1, value); }; proto.services.GetDiscussionHistoryResponse.prototype.clearMessage = function() { this.setMessage(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.GetDiscussionHistoryResponse.prototype.hasMessage = function() { return jspb.Message.getField(this, 1) != null; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.GetDiscussionStatisticsRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.GetDiscussionStatisticsRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.GetDiscussionStatisticsRequest.displayName = 'proto.services.GetDiscussionStatisticsRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.GetDiscussionStatisticsRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.GetDiscussionStatisticsRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.GetDiscussionStatisticsRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.GetDiscussionStatisticsRequest.toObject = function(includeInstance, msg) { var f, obj = { id: jspb.Message.getFieldWithDefault(msg, 1, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.GetDiscussionStatisticsRequest} */ proto.services.GetDiscussionStatisticsRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.GetDiscussionStatisticsRequest; return proto.services.GetDiscussionStatisticsRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.GetDiscussionStatisticsRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.GetDiscussionStatisticsRequest} */ proto.services.GetDiscussionStatisticsRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readUint64()); msg.setId(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.GetDiscussionStatisticsRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.GetDiscussionStatisticsRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.GetDiscussionStatisticsRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.GetDiscussionStatisticsRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getId(); if (f !== 0) { writer.writeUint64( 1, f ); } }; /** * optional uint64 id = 1; * @return {number} */ proto.services.GetDiscussionStatisticsRequest.prototype.getId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.services.GetDiscussionStatisticsRequest.prototype.setId = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.GetDiscussionStatisticsResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.GetDiscussionStatisticsResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.GetDiscussionStatisticsResponse.displayName = 'proto.services.GetDiscussionStatisticsResponse'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.GetDiscussionStatisticsResponse.prototype.toObject = function(opt_includeInstance) { return proto.services.GetDiscussionStatisticsResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.GetDiscussionStatisticsResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.GetDiscussionStatisticsResponse.toObject = function(includeInstance, msg) { var f, obj = { amtMsatSent: jspb.Message.getFieldWithDefault(msg, 1, 0), amtMsatReceived: jspb.Message.getFieldWithDefault(msg, 2, 0), amtMsatFees: jspb.Message.getFieldWithDefault(msg, 3, 0), messagesSent: jspb.Message.getFieldWithDefault(msg, 4, 0), messagesReceived: jspb.Message.getFieldWithDefault(msg, 5, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.GetDiscussionStatisticsResponse} */ proto.services.GetDiscussionStatisticsResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.GetDiscussionStatisticsResponse; return proto.services.GetDiscussionStatisticsResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.GetDiscussionStatisticsResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.GetDiscussionStatisticsResponse} */ proto.services.GetDiscussionStatisticsResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readUint64()); msg.setAmtMsatSent(value); break; case 2: var value = /** @type {number} */ (reader.readUint64()); msg.setAmtMsatReceived(value); break; case 3: var value = /** @type {number} */ (reader.readUint64()); msg.setAmtMsatFees(value); break; case 4: var value = /** @type {number} */ (reader.readUint64()); msg.setMessagesSent(value); break; case 5: var value = /** @type {number} */ (reader.readUint64()); msg.setMessagesReceived(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.GetDiscussionStatisticsResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.GetDiscussionStatisticsResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.GetDiscussionStatisticsResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.GetDiscussionStatisticsResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getAmtMsatSent(); if (f !== 0) { writer.writeUint64( 1, f ); } f = message.getAmtMsatReceived(); if (f !== 0) { writer.writeUint64( 2, f ); } f = message.getAmtMsatFees(); if (f !== 0) { writer.writeUint64( 3, f ); } f = message.getMessagesSent(); if (f !== 0) { writer.writeUint64( 4, f ); } f = message.getMessagesReceived(); if (f !== 0) { writer.writeUint64( 5, f ); } }; /** * optional uint64 amt_msat_sent = 1; * @return {number} */ proto.services.GetDiscussionStatisticsResponse.prototype.getAmtMsatSent = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.services.GetDiscussionStatisticsResponse.prototype.setAmtMsatSent = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * optional uint64 amt_msat_received = 2; * @return {number} */ proto.services.GetDiscussionStatisticsResponse.prototype.getAmtMsatReceived = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** @param {number} value */ proto.services.GetDiscussionStatisticsResponse.prototype.setAmtMsatReceived = function(value) { jspb.Message.setProto3IntField(this, 2, value); }; /** * optional uint64 amt_msat_fees = 3; * @return {number} */ proto.services.GetDiscussionStatisticsResponse.prototype.getAmtMsatFees = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** @param {number} value */ proto.services.GetDiscussionStatisticsResponse.prototype.setAmtMsatFees = function(value) { jspb.Message.setProto3IntField(this, 3, value); }; /** * optional uint64 messages_sent = 4; * @return {number} */ proto.services.GetDiscussionStatisticsResponse.prototype.getMessagesSent = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); }; /** @param {number} value */ proto.services.GetDiscussionStatisticsResponse.prototype.setMessagesSent = function(value) { jspb.Message.setProto3IntField(this, 4, value); }; /** * optional uint64 messages_received = 5; * @return {number} */ proto.services.GetDiscussionStatisticsResponse.prototype.getMessagesReceived = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); }; /** @param {number} value */ proto.services.GetDiscussionStatisticsResponse.prototype.setMessagesReceived = function(value) { jspb.Message.setProto3IntField(this, 5, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.AddDiscussionRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.AddDiscussionRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.AddDiscussionRequest.displayName = 'proto.services.AddDiscussionRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.AddDiscussionRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.AddDiscussionRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.AddDiscussionRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.AddDiscussionRequest.toObject = function(includeInstance, msg) { var f, obj = { discussion: (f = msg.getDiscussion()) && proto.services.DiscussionInfo.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.AddDiscussionRequest} */ proto.services.AddDiscussionRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.AddDiscussionRequest; return proto.services.AddDiscussionRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.AddDiscussionRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.AddDiscussionRequest} */ proto.services.AddDiscussionRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.services.DiscussionInfo; reader.readMessage(value,proto.services.DiscussionInfo.deserializeBinaryFromReader); msg.setDiscussion(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.AddDiscussionRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.AddDiscussionRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.AddDiscussionRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.AddDiscussionRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getDiscussion(); if (f != null) { writer.writeMessage( 1, f, proto.services.DiscussionInfo.serializeBinaryToWriter ); } }; /** * optional DiscussionInfo discussion = 1; * @return {?proto.services.DiscussionInfo} */ proto.services.AddDiscussionRequest.prototype.getDiscussion = function() { return /** @type{?proto.services.DiscussionInfo} */ ( jspb.Message.getWrapperField(this, proto.services.DiscussionInfo, 1)); }; /** @param {?proto.services.DiscussionInfo|undefined} value */ proto.services.AddDiscussionRequest.prototype.setDiscussion = function(value) { jspb.Message.setWrapperField(this, 1, value); }; proto.services.AddDiscussionRequest.prototype.clearDiscussion = function() { this.setDiscussion(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.AddDiscussionRequest.prototype.hasDiscussion = function() { return jspb.Message.getField(this, 1) != null; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.AddDiscussionResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.AddDiscussionResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.AddDiscussionResponse.displayName = 'proto.services.AddDiscussionResponse'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.AddDiscussionResponse.prototype.toObject = function(opt_includeInstance) { return proto.services.AddDiscussionResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.AddDiscussionResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.AddDiscussionResponse.toObject = function(includeInstance, msg) { var f, obj = { discussion: (f = msg.getDiscussion()) && proto.services.DiscussionInfo.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.AddDiscussionResponse} */ proto.services.AddDiscussionResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.AddDiscussionResponse; return proto.services.AddDiscussionResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.AddDiscussionResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.AddDiscussionResponse} */ proto.services.AddDiscussionResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.services.DiscussionInfo; reader.readMessage(value,proto.services.DiscussionInfo.deserializeBinaryFromReader); msg.setDiscussion(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.AddDiscussionResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.AddDiscussionResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.AddDiscussionResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.AddDiscussionResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getDiscussion(); if (f != null) { writer.writeMessage( 1, f, proto.services.DiscussionInfo.serializeBinaryToWriter ); } }; /** * optional DiscussionInfo discussion = 1; * @return {?proto.services.DiscussionInfo} */ proto.services.AddDiscussionResponse.prototype.getDiscussion = function() { return /** @type{?proto.services.DiscussionInfo} */ ( jspb.Message.getWrapperField(this, proto.services.DiscussionInfo, 1)); }; /** @param {?proto.services.DiscussionInfo|undefined} value */ proto.services.AddDiscussionResponse.prototype.setDiscussion = function(value) { jspb.Message.setWrapperField(this, 1, value); }; proto.services.AddDiscussionResponse.prototype.clearDiscussion = function() { this.setDiscussion(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.AddDiscussionResponse.prototype.hasDiscussion = function() { return jspb.Message.getField(this, 1) != null; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.UpdateDiscussionLastReadRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.UpdateDiscussionLastReadRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.UpdateDiscussionLastReadRequest.displayName = 'proto.services.UpdateDiscussionLastReadRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.UpdateDiscussionLastReadRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.UpdateDiscussionLastReadRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.UpdateDiscussionLastReadRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.UpdateDiscussionLastReadRequest.toObject = function(includeInstance, msg) { var f, obj = { discussionId: jspb.Message.getFieldWithDefault(msg, 1, 0), lastReadMsgId: jspb.Message.getFieldWithDefault(msg, 2, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.UpdateDiscussionLastReadRequest} */ proto.services.UpdateDiscussionLastReadRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.UpdateDiscussionLastReadRequest; return proto.services.UpdateDiscussionLastReadRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.UpdateDiscussionLastReadRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.UpdateDiscussionLastReadRequest} */ proto.services.UpdateDiscussionLastReadRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readUint64()); msg.setDiscussionId(value); break; case 2: var value = /** @type {number} */ (reader.readUint64()); msg.setLastReadMsgId(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.UpdateDiscussionLastReadRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.UpdateDiscussionLastReadRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.UpdateDiscussionLastReadRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.UpdateDiscussionLastReadRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getDiscussionId(); if (f !== 0) { writer.writeUint64( 1, f ); } f = message.getLastReadMsgId(); if (f !== 0) { writer.writeUint64( 2, f ); } }; /** * optional uint64 discussion_id = 1; * @return {number} */ proto.services.UpdateDiscussionLastReadRequest.prototype.getDiscussionId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.services.UpdateDiscussionLastReadRequest.prototype.setDiscussionId = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * optional uint64 last_read_msg_id = 2; * @return {number} */ proto.services.UpdateDiscussionLastReadRequest.prototype.getLastReadMsgId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** @param {number} value */ proto.services.UpdateDiscussionLastReadRequest.prototype.setLastReadMsgId = function(value) { jspb.Message.setProto3IntField(this, 2, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.UpdateDiscussionResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.UpdateDiscussionResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.UpdateDiscussionResponse.displayName = 'proto.services.UpdateDiscussionResponse'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.UpdateDiscussionResponse.prototype.toObject = function(opt_includeInstance) { return proto.services.UpdateDiscussionResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.UpdateDiscussionResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.UpdateDiscussionResponse.toObject = function(includeInstance, msg) { var f, obj = { }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.UpdateDiscussionResponse} */ proto.services.UpdateDiscussionResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.UpdateDiscussionResponse; return proto.services.UpdateDiscussionResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.UpdateDiscussionResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.UpdateDiscussionResponse} */ proto.services.UpdateDiscussionResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.UpdateDiscussionResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.UpdateDiscussionResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.UpdateDiscussionResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.UpdateDiscussionResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.RemoveDiscussionRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.RemoveDiscussionRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.RemoveDiscussionRequest.displayName = 'proto.services.RemoveDiscussionRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.RemoveDiscussionRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.RemoveDiscussionRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.RemoveDiscussionRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.RemoveDiscussionRequest.toObject = function(includeInstance, msg) { var f, obj = { id: jspb.Message.getFieldWithDefault(msg, 1, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.RemoveDiscussionRequest} */ proto.services.RemoveDiscussionRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.RemoveDiscussionRequest; return proto.services.RemoveDiscussionRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.RemoveDiscussionRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.RemoveDiscussionRequest} */ proto.services.RemoveDiscussionRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readUint64()); msg.setId(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.RemoveDiscussionRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.RemoveDiscussionRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.RemoveDiscussionRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.RemoveDiscussionRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getId(); if (f !== 0) { writer.writeUint64( 1, f ); } }; /** * optional uint64 id = 1; * @return {number} */ proto.services.RemoveDiscussionRequest.prototype.getId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.services.RemoveDiscussionRequest.prototype.setId = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.RemoveDiscussionResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.RemoveDiscussionResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.RemoveDiscussionResponse.displayName = 'proto.services.RemoveDiscussionResponse'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.RemoveDiscussionResponse.prototype.toObject = function(opt_includeInstance) { return proto.services.RemoveDiscussionResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.RemoveDiscussionResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.RemoveDiscussionResponse.toObject = function(includeInstance, msg) { var f, obj = { }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.RemoveDiscussionResponse} */ proto.services.RemoveDiscussionResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.RemoveDiscussionResponse; return proto.services.RemoveDiscussionResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.RemoveDiscussionResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.RemoveDiscussionResponse} */ proto.services.RemoveDiscussionResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.RemoveDiscussionResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.RemoveDiscussionResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.RemoveDiscussionResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.RemoveDiscussionResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.CreateInvoiceRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.CreateInvoiceRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.CreateInvoiceRequest.displayName = 'proto.services.CreateInvoiceRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.CreateInvoiceRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.CreateInvoiceRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.CreateInvoiceRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.CreateInvoiceRequest.toObject = function(includeInstance, msg) { var f, obj = { memo: jspb.Message.getFieldWithDefault(msg, 1, ""), amtMsat: jspb.Message.getFieldWithDefault(msg, 2, 0), expiry: jspb.Message.getFieldWithDefault(msg, 3, 0), pb_private: jspb.Message.getFieldWithDefault(msg, 4, false) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.CreateInvoiceRequest} */ proto.services.CreateInvoiceRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.CreateInvoiceRequest; return proto.services.CreateInvoiceRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.CreateInvoiceRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.CreateInvoiceRequest} */ proto.services.CreateInvoiceRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setMemo(value); break; case 2: var value = /** @type {number} */ (reader.readUint64()); msg.setAmtMsat(value); break; case 3: var value = /** @type {number} */ (reader.readInt64()); msg.setExpiry(value); break; case 4: var value = /** @type {boolean} */ (reader.readBool()); msg.setPrivate(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.CreateInvoiceRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.CreateInvoiceRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.CreateInvoiceRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.CreateInvoiceRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getMemo(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getAmtMsat(); if (f !== 0) { writer.writeUint64( 2, f ); } f = message.getExpiry(); if (f !== 0) { writer.writeInt64( 3, f ); } f = message.getPrivate(); if (f) { writer.writeBool( 4, f ); } }; /** * optional string memo = 1; * @return {string} */ proto.services.CreateInvoiceRequest.prototype.getMemo = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ proto.services.CreateInvoiceRequest.prototype.setMemo = function(value) { jspb.Message.setProto3StringField(this, 1, value); }; /** * optional uint64 amt_msat = 2; * @return {number} */ proto.services.CreateInvoiceRequest.prototype.getAmtMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** @param {number} value */ proto.services.CreateInvoiceRequest.prototype.setAmtMsat = function(value) { jspb.Message.setProto3IntField(this, 2, value); }; /** * optional int64 expiry = 3; * @return {number} */ proto.services.CreateInvoiceRequest.prototype.getExpiry = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** @param {number} value */ proto.services.CreateInvoiceRequest.prototype.setExpiry = function(value) { jspb.Message.setProto3IntField(this, 3, value); }; /** * optional bool private = 4; * Note that Boolean fields may be set to 0/1 when serialized from a Java server. * You should avoid comparisons like {@code val === true/false} in those cases. * @return {boolean} */ proto.services.CreateInvoiceRequest.prototype.getPrivate = function() { return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 4, false)); }; /** @param {boolean} value */ proto.services.CreateInvoiceRequest.prototype.setPrivate = function(value) { jspb.Message.setProto3BooleanField(this, 4, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.CreateInvoiceResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.CreateInvoiceResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.CreateInvoiceResponse.displayName = 'proto.services.CreateInvoiceResponse'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.CreateInvoiceResponse.prototype.toObject = function(opt_includeInstance) { return proto.services.CreateInvoiceResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.CreateInvoiceResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.CreateInvoiceResponse.toObject = function(includeInstance, msg) { var f, obj = { invoice: (f = msg.getInvoice()) && proto.services.Invoice.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.CreateInvoiceResponse} */ proto.services.CreateInvoiceResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.CreateInvoiceResponse; return proto.services.CreateInvoiceResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.CreateInvoiceResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.CreateInvoiceResponse} */ proto.services.CreateInvoiceResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.services.Invoice; reader.readMessage(value,proto.services.Invoice.deserializeBinaryFromReader); msg.setInvoice(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.CreateInvoiceResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.CreateInvoiceResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.CreateInvoiceResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.CreateInvoiceResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getInvoice(); if (f != null) { writer.writeMessage( 1, f, proto.services.Invoice.serializeBinaryToWriter ); } }; /** * optional Invoice invoice = 1; * @return {?proto.services.Invoice} */ proto.services.CreateInvoiceResponse.prototype.getInvoice = function() { return /** @type{?proto.services.Invoice} */ ( jspb.Message.getWrapperField(this, proto.services.Invoice, 1)); }; /** @param {?proto.services.Invoice|undefined} value */ proto.services.CreateInvoiceResponse.prototype.setInvoice = function(value) { jspb.Message.setWrapperField(this, 1, value); }; proto.services.CreateInvoiceResponse.prototype.clearInvoice = function() { this.setInvoice(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.CreateInvoiceResponse.prototype.hasInvoice = function() { return jspb.Message.getField(this, 1) != null; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.LookupInvoiceRequest = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.LookupInvoiceRequest, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.LookupInvoiceRequest.displayName = 'proto.services.LookupInvoiceRequest'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.LookupInvoiceRequest.prototype.toObject = function(opt_includeInstance) { return proto.services.LookupInvoiceRequest.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.LookupInvoiceRequest} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.LookupInvoiceRequest.toObject = function(includeInstance, msg) { var f, obj = { payReq: jspb.Message.getFieldWithDefault(msg, 1, "") }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.LookupInvoiceRequest} */ proto.services.LookupInvoiceRequest.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.LookupInvoiceRequest; return proto.services.LookupInvoiceRequest.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.LookupInvoiceRequest} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.LookupInvoiceRequest} */ proto.services.LookupInvoiceRequest.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setPayReq(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.LookupInvoiceRequest.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.LookupInvoiceRequest.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.LookupInvoiceRequest} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.LookupInvoiceRequest.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getPayReq(); if (f.length > 0) { writer.writeString( 1, f ); } }; /** * optional string pay_req = 1; * @return {string} */ proto.services.LookupInvoiceRequest.prototype.getPayReq = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ proto.services.LookupInvoiceRequest.prototype.setPayReq = function(value) { jspb.Message.setProto3StringField(this, 1, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.LookupInvoiceResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.LookupInvoiceResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.LookupInvoiceResponse.displayName = 'proto.services.LookupInvoiceResponse'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.LookupInvoiceResponse.prototype.toObject = function(opt_includeInstance) { return proto.services.LookupInvoiceResponse.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.LookupInvoiceResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.LookupInvoiceResponse.toObject = function(includeInstance, msg) { var f, obj = { invoice: (f = msg.getInvoice()) && proto.services.Invoice.toObject(includeInstance, f) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.LookupInvoiceResponse} */ proto.services.LookupInvoiceResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.LookupInvoiceResponse; return proto.services.LookupInvoiceResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.LookupInvoiceResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.LookupInvoiceResponse} */ proto.services.LookupInvoiceResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.services.Invoice; reader.readMessage(value,proto.services.Invoice.deserializeBinaryFromReader); msg.setInvoice(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.LookupInvoiceResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.LookupInvoiceResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.LookupInvoiceResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.LookupInvoiceResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getInvoice(); if (f != null) { writer.writeMessage( 1, f, proto.services.Invoice.serializeBinaryToWriter ); } }; /** * optional Invoice invoice = 1; * @return {?proto.services.Invoice} */ proto.services.LookupInvoiceResponse.prototype.getInvoice = function() { return /** @type{?proto.services.Invoice} */ ( jspb.Message.getWrapperField(this, proto.services.Invoice, 1)); }; /** @param {?proto.services.Invoice|undefined} value */ proto.services.LookupInvoiceResponse.prototype.setInvoice = function(value) { jspb.Message.setWrapperField(this, 1, value); }; proto.services.LookupInvoiceResponse.prototype.clearInvoice = function() { this.setInvoice(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.LookupInvoiceResponse.prototype.hasInvoice = function() { return jspb.Message.getField(this, 1) != null; }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.Invoice = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.services.Invoice.repeatedFields_, null); }; goog.inherits(proto.services.Invoice, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.Invoice.displayName = 'proto.services.Invoice'; } /** * List of repeated fields within this message type. * @private {!Array<number>} * @const */ proto.services.Invoice.repeatedFields_ = [11,15]; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.Invoice.prototype.toObject = function(opt_includeInstance) { return proto.services.Invoice.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.Invoice} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.Invoice.toObject = function(includeInstance, msg) { var f, obj = { memo: jspb.Message.getFieldWithDefault(msg, 1, ""), hash: jspb.Message.getFieldWithDefault(msg, 2, ""), preimage: jspb.Message.getFieldWithDefault(msg, 3, ""), paymentRequest: jspb.Message.getFieldWithDefault(msg, 4, ""), valueMsat: jspb.Message.getFieldWithDefault(msg, 5, 0), amtPaidMsat: jspb.Message.getFieldWithDefault(msg, 6, 0), createdTimestamp: (f = msg.getCreatedTimestamp()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), settledTimestamp: (f = msg.getSettledTimestamp()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), expiry: jspb.Message.getFieldWithDefault(msg, 9, 0), pb_private: jspb.Message.getFieldWithDefault(msg, 10, false), routeHintsList: jspb.Message.toObjectList(msg.getRouteHintsList(), proto.services.RouteHint.toObject, includeInstance), state: jspb.Message.getFieldWithDefault(msg, 12, 0), addIndex: jspb.Message.getFieldWithDefault(msg, 13, 0), settleIndex: jspb.Message.getFieldWithDefault(msg, 14, 0), invoiceHtlcsList: jspb.Message.toObjectList(msg.getInvoiceHtlcsList(), proto.services.InvoiceHTLC.toObject, includeInstance) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.Invoice} */ proto.services.Invoice.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.Invoice; return proto.services.Invoice.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.Invoice} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.Invoice} */ proto.services.Invoice.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setMemo(value); break; case 2: var value = /** @type {string} */ (reader.readString()); msg.setHash(value); break; case 3: var value = /** @type {string} */ (reader.readString()); msg.setPreimage(value); break; case 4: var value = /** @type {string} */ (reader.readString()); msg.setPaymentRequest(value); break; case 5: var value = /** @type {number} */ (reader.readUint64()); msg.setValueMsat(value); break; case 6: var value = /** @type {number} */ (reader.readUint64()); msg.setAmtPaidMsat(value); break; case 7: var value = new google_protobuf_timestamp_pb.Timestamp; reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); msg.setCreatedTimestamp(value); break; case 8: var value = new google_protobuf_timestamp_pb.Timestamp; reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); msg.setSettledTimestamp(value); break; case 9: var value = /** @type {number} */ (reader.readInt64()); msg.setExpiry(value); break; case 10: var value = /** @type {boolean} */ (reader.readBool()); msg.setPrivate(value); break; case 11: var value = new proto.services.RouteHint; reader.readMessage(value,proto.services.RouteHint.deserializeBinaryFromReader); msg.addRouteHints(value); break; case 12: var value = /** @type {!proto.services.InvoiceState} */ (reader.readEnum()); msg.setState(value); break; case 13: var value = /** @type {number} */ (reader.readUint64()); msg.setAddIndex(value); break; case 14: var value = /** @type {number} */ (reader.readUint64()); msg.setSettleIndex(value); break; case 15: var value = new proto.services.InvoiceHTLC; reader.readMessage(value,proto.services.InvoiceHTLC.deserializeBinaryFromReader); msg.addInvoiceHtlcs(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.Invoice.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.Invoice.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.Invoice} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.Invoice.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getMemo(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getHash(); if (f.length > 0) { writer.writeString( 2, f ); } f = message.getPreimage(); if (f.length > 0) { writer.writeString( 3, f ); } f = message.getPaymentRequest(); if (f.length > 0) { writer.writeString( 4, f ); } f = message.getValueMsat(); if (f !== 0) { writer.writeUint64( 5, f ); } f = message.getAmtPaidMsat(); if (f !== 0) { writer.writeUint64( 6, f ); } f = message.getCreatedTimestamp(); if (f != null) { writer.writeMessage( 7, f, google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter ); } f = message.getSettledTimestamp(); if (f != null) { writer.writeMessage( 8, f, google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter ); } f = message.getExpiry(); if (f !== 0) { writer.writeInt64( 9, f ); } f = message.getPrivate(); if (f) { writer.writeBool( 10, f ); } f = message.getRouteHintsList(); if (f.length > 0) { writer.writeRepeatedMessage( 11, f, proto.services.RouteHint.serializeBinaryToWriter ); } f = message.getState(); if (f !== 0.0) { writer.writeEnum( 12, f ); } f = message.getAddIndex(); if (f !== 0) { writer.writeUint64( 13, f ); } f = message.getSettleIndex(); if (f !== 0) { writer.writeUint64( 14, f ); } f = message.getInvoiceHtlcsList(); if (f.length > 0) { writer.writeRepeatedMessage( 15, f, proto.services.InvoiceHTLC.serializeBinaryToWriter ); } }; /** * optional string memo = 1; * @return {string} */ proto.services.Invoice.prototype.getMemo = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ proto.services.Invoice.prototype.setMemo = function(value) { jspb.Message.setProto3StringField(this, 1, value); }; /** * optional string hash = 2; * @return {string} */ proto.services.Invoice.prototype.getHash = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** @param {string} value */ proto.services.Invoice.prototype.setHash = function(value) { jspb.Message.setProto3StringField(this, 2, value); }; /** * optional string preimage = 3; * @return {string} */ proto.services.Invoice.prototype.getPreimage = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; /** @param {string} value */ proto.services.Invoice.prototype.setPreimage = function(value) { jspb.Message.setProto3StringField(this, 3, value); }; /** * optional string payment_request = 4; * @return {string} */ proto.services.Invoice.prototype.getPaymentRequest = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; /** @param {string} value */ proto.services.Invoice.prototype.setPaymentRequest = function(value) { jspb.Message.setProto3StringField(this, 4, value); }; /** * optional uint64 value_msat = 5; * @return {number} */ proto.services.Invoice.prototype.getValueMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); }; /** @param {number} value */ proto.services.Invoice.prototype.setValueMsat = function(value) { jspb.Message.setProto3IntField(this, 5, value); }; /** * optional uint64 amt_paid_msat = 6; * @return {number} */ proto.services.Invoice.prototype.getAmtPaidMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); }; /** @param {number} value */ proto.services.Invoice.prototype.setAmtPaidMsat = function(value) { jspb.Message.setProto3IntField(this, 6, value); }; /** * optional google.protobuf.Timestamp created_timestamp = 7; * @return {?proto.google.protobuf.Timestamp} */ proto.services.Invoice.prototype.getCreatedTimestamp = function() { return /** @type{?proto.google.protobuf.Timestamp} */ ( jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 7)); }; /** @param {?proto.google.protobuf.Timestamp|undefined} value */ proto.services.Invoice.prototype.setCreatedTimestamp = function(value) { jspb.Message.setWrapperField(this, 7, value); }; proto.services.Invoice.prototype.clearCreatedTimestamp = function() { this.setCreatedTimestamp(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.Invoice.prototype.hasCreatedTimestamp = function() { return jspb.Message.getField(this, 7) != null; }; /** * optional google.protobuf.Timestamp settled_timestamp = 8; * @return {?proto.google.protobuf.Timestamp} */ proto.services.Invoice.prototype.getSettledTimestamp = function() { return /** @type{?proto.google.protobuf.Timestamp} */ ( jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 8)); }; /** @param {?proto.google.protobuf.Timestamp|undefined} value */ proto.services.Invoice.prototype.setSettledTimestamp = function(value) { jspb.Message.setWrapperField(this, 8, value); }; proto.services.Invoice.prototype.clearSettledTimestamp = function() { this.setSettledTimestamp(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.Invoice.prototype.hasSettledTimestamp = function() { return jspb.Message.getField(this, 8) != null; }; /** * optional int64 expiry = 9; * @return {number} */ proto.services.Invoice.prototype.getExpiry = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 9, 0)); }; /** @param {number} value */ proto.services.Invoice.prototype.setExpiry = function(value) { jspb.Message.setProto3IntField(this, 9, value); }; /** * optional bool private = 10; * Note that Boolean fields may be set to 0/1 when serialized from a Java server. * You should avoid comparisons like {@code val === true/false} in those cases. * @return {boolean} */ proto.services.Invoice.prototype.getPrivate = function() { return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 10, false)); }; /** @param {boolean} value */ proto.services.Invoice.prototype.setPrivate = function(value) { jspb.Message.setProto3BooleanField(this, 10, value); }; /** * repeated RouteHint route_hints = 11; * @return {!Array<!proto.services.RouteHint>} */ proto.services.Invoice.prototype.getRouteHintsList = function() { return /** @type{!Array<!proto.services.RouteHint>} */ ( jspb.Message.getRepeatedWrapperField(this, proto.services.RouteHint, 11)); }; /** @param {!Array<!proto.services.RouteHint>} value */ proto.services.Invoice.prototype.setRouteHintsList = function(value) { jspb.Message.setRepeatedWrapperField(this, 11, value); }; /** * @param {!proto.services.RouteHint=} opt_value * @param {number=} opt_index * @return {!proto.services.RouteHint} */ proto.services.Invoice.prototype.addRouteHints = function(opt_value, opt_index) { return jspb.Message.addToRepeatedWrapperField(this, 11, opt_value, proto.services.RouteHint, opt_index); }; proto.services.Invoice.prototype.clearRouteHintsList = function() { this.setRouteHintsList([]); }; /** * optional InvoiceState state = 12; * @return {!proto.services.InvoiceState} */ proto.services.Invoice.prototype.getState = function() { return /** @type {!proto.services.InvoiceState} */ (jspb.Message.getFieldWithDefault(this, 12, 0)); }; /** @param {!proto.services.InvoiceState} value */ proto.services.Invoice.prototype.setState = function(value) { jspb.Message.setProto3EnumField(this, 12, value); }; /** * optional uint64 add_index = 13; * @return {number} */ proto.services.Invoice.prototype.getAddIndex = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 13, 0)); }; /** @param {number} value */ proto.services.Invoice.prototype.setAddIndex = function(value) { jspb.Message.setProto3IntField(this, 13, value); }; /** * optional uint64 settle_index = 14; * @return {number} */ proto.services.Invoice.prototype.getSettleIndex = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 14, 0)); }; /** @param {number} value */ proto.services.Invoice.prototype.setSettleIndex = function(value) { jspb.Message.setProto3IntField(this, 14, value); }; /** * repeated InvoiceHTLC invoice_htlcs = 15; * @return {!Array<!proto.services.InvoiceHTLC>} */ proto.services.Invoice.prototype.getInvoiceHtlcsList = function() { return /** @type{!Array<!proto.services.InvoiceHTLC>} */ ( jspb.Message.getRepeatedWrapperField(this, proto.services.InvoiceHTLC, 15)); }; /** @param {!Array<!proto.services.InvoiceHTLC>} value */ proto.services.Invoice.prototype.setInvoiceHtlcsList = function(value) { jspb.Message.setRepeatedWrapperField(this, 15, value); }; /** * @param {!proto.services.InvoiceHTLC=} opt_value * @param {number=} opt_index * @return {!proto.services.InvoiceHTLC} */ proto.services.Invoice.prototype.addInvoiceHtlcs = function(opt_value, opt_index) { return jspb.Message.addToRepeatedWrapperField(this, 15, opt_value, proto.services.InvoiceHTLC, opt_index); }; proto.services.Invoice.prototype.clearInvoiceHtlcsList = function() { this.setInvoiceHtlcsList([]); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.RouteHint = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, proto.services.RouteHint.repeatedFields_, null); }; goog.inherits(proto.services.RouteHint, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.RouteHint.displayName = 'proto.services.RouteHint'; } /** * List of repeated fields within this message type. * @private {!Array<number>} * @const */ proto.services.RouteHint.repeatedFields_ = [1]; if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.RouteHint.prototype.toObject = function(opt_includeInstance) { return proto.services.RouteHint.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.RouteHint} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.RouteHint.toObject = function(includeInstance, msg) { var f, obj = { hopHintsList: jspb.Message.toObjectList(msg.getHopHintsList(), proto.services.HopHint.toObject, includeInstance) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.RouteHint} */ proto.services.RouteHint.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.RouteHint; return proto.services.RouteHint.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.RouteHint} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.RouteHint} */ proto.services.RouteHint.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = new proto.services.HopHint; reader.readMessage(value,proto.services.HopHint.deserializeBinaryFromReader); msg.addHopHints(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.RouteHint.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.RouteHint.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.RouteHint} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.RouteHint.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getHopHintsList(); if (f.length > 0) { writer.writeRepeatedMessage( 1, f, proto.services.HopHint.serializeBinaryToWriter ); } }; /** * repeated HopHint hop_hints = 1; * @return {!Array<!proto.services.HopHint>} */ proto.services.RouteHint.prototype.getHopHintsList = function() { return /** @type{!Array<!proto.services.HopHint>} */ ( jspb.Message.getRepeatedWrapperField(this, proto.services.HopHint, 1)); }; /** @param {!Array<!proto.services.HopHint>} value */ proto.services.RouteHint.prototype.setHopHintsList = function(value) { jspb.Message.setRepeatedWrapperField(this, 1, value); }; /** * @param {!proto.services.HopHint=} opt_value * @param {number=} opt_index * @return {!proto.services.HopHint} */ proto.services.RouteHint.prototype.addHopHints = function(opt_value, opt_index) { return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.services.HopHint, opt_index); }; proto.services.RouteHint.prototype.clearHopHintsList = function() { this.setHopHintsList([]); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.HopHint = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.HopHint, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.HopHint.displayName = 'proto.services.HopHint'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.HopHint.prototype.toObject = function(opt_includeInstance) { return proto.services.HopHint.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.HopHint} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.HopHint.toObject = function(includeInstance, msg) { var f, obj = { pubkey: jspb.Message.getFieldWithDefault(msg, 1, ""), chanId: jspb.Message.getFieldWithDefault(msg, 2, 0), feeBaseMsat: jspb.Message.getFieldWithDefault(msg, 3, 0), feeRate: jspb.Message.getFieldWithDefault(msg, 4, 0), cltvExpiryDelta: jspb.Message.getFieldWithDefault(msg, 5, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.HopHint} */ proto.services.HopHint.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.HopHint; return proto.services.HopHint.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.HopHint} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.HopHint} */ proto.services.HopHint.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {string} */ (reader.readString()); msg.setPubkey(value); break; case 2: var value = /** @type {number} */ (reader.readUint64()); msg.setChanId(value); break; case 3: var value = /** @type {number} */ (reader.readUint32()); msg.setFeeBaseMsat(value); break; case 4: var value = /** @type {number} */ (reader.readUint32()); msg.setFeeRate(value); break; case 5: var value = /** @type {number} */ (reader.readUint32()); msg.setCltvExpiryDelta(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.HopHint.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.HopHint.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.HopHint} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.HopHint.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getPubkey(); if (f.length > 0) { writer.writeString( 1, f ); } f = message.getChanId(); if (f !== 0) { writer.writeUint64( 2, f ); } f = message.getFeeBaseMsat(); if (f !== 0) { writer.writeUint32( 3, f ); } f = message.getFeeRate(); if (f !== 0) { writer.writeUint32( 4, f ); } f = message.getCltvExpiryDelta(); if (f !== 0) { writer.writeUint32( 5, f ); } }; /** * optional string pubkey = 1; * @return {string} */ proto.services.HopHint.prototype.getPubkey = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ proto.services.HopHint.prototype.setPubkey = function(value) { jspb.Message.setProto3StringField(this, 1, value); }; /** * optional uint64 chan_id = 2; * @return {number} */ proto.services.HopHint.prototype.getChanId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** @param {number} value */ proto.services.HopHint.prototype.setChanId = function(value) { jspb.Message.setProto3IntField(this, 2, value); }; /** * optional uint32 fee_base_msat = 3; * @return {number} */ proto.services.HopHint.prototype.getFeeBaseMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** @param {number} value */ proto.services.HopHint.prototype.setFeeBaseMsat = function(value) { jspb.Message.setProto3IntField(this, 3, value); }; /** * optional uint32 fee_rate = 4; * @return {number} */ proto.services.HopHint.prototype.getFeeRate = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0)); }; /** @param {number} value */ proto.services.HopHint.prototype.setFeeRate = function(value) { jspb.Message.setProto3IntField(this, 4, value); }; /** * optional uint32 cltv_expiry_delta = 5; * @return {number} */ proto.services.HopHint.prototype.getCltvExpiryDelta = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 5, 0)); }; /** @param {number} value */ proto.services.HopHint.prototype.setCltvExpiryDelta = function(value) { jspb.Message.setProto3IntField(this, 5, value); }; /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a * server response, or constructed directly in Javascript. The array is used * in place and becomes part of the constructed object. It is not cloned. * If no data is provided, the constructed object will be empty, but still * valid. * @extends {jspb.Message} * @constructor */ proto.services.InvoiceHTLC = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; goog.inherits(proto.services.InvoiceHTLC, jspb.Message); if (goog.DEBUG && !COMPILED) { proto.services.InvoiceHTLC.displayName = 'proto.services.InvoiceHTLC'; } if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto suitable for use in Soy templates. * Field names that are reserved in JavaScript and will be renamed to pb_name. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * For the list of reserved names please see: * com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * @param {boolean=} opt_includeInstance Whether to include the JSPB instance * for transitional soy proto support: http://goto/soy-param-migration * @return {!Object} */ proto.services.InvoiceHTLC.prototype.toObject = function(opt_includeInstance) { return proto.services.InvoiceHTLC.toObject(opt_includeInstance, this); }; /** * Static version of the {@see toObject} method. * @param {boolean|undefined} includeInstance Whether to include the JSPB * instance for transitional soy proto support: * http://goto/soy-param-migration * @param {!proto.services.InvoiceHTLC} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.InvoiceHTLC.toObject = function(includeInstance, msg) { var f, obj = { chanId: jspb.Message.getFieldWithDefault(msg, 1, 0), amtMsat: jspb.Message.getFieldWithDefault(msg, 2, 0), state: jspb.Message.getFieldWithDefault(msg, 3, 0), acceptTimestamp: (f = msg.getAcceptTimestamp()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), resolveTimestamp: (f = msg.getResolveTimestamp()) && google_protobuf_timestamp_pb.Timestamp.toObject(includeInstance, f), expiryHeight: jspb.Message.getFieldWithDefault(msg, 6, 0) }; if (includeInstance) { obj.$jspbMessageInstance = msg; } return obj; }; } /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.services.InvoiceHTLC} */ proto.services.InvoiceHTLC.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); var msg = new proto.services.InvoiceHTLC; return proto.services.InvoiceHTLC.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. * @param {!proto.services.InvoiceHTLC} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.services.InvoiceHTLC} */ proto.services.InvoiceHTLC.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; } var field = reader.getFieldNumber(); switch (field) { case 1: var value = /** @type {number} */ (reader.readUint64()); msg.setChanId(value); break; case 2: var value = /** @type {number} */ (reader.readUint64()); msg.setAmtMsat(value); break; case 3: var value = /** @type {!proto.services.InvoiceHTLCState} */ (reader.readEnum()); msg.setState(value); break; case 4: var value = new google_protobuf_timestamp_pb.Timestamp; reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); msg.setAcceptTimestamp(value); break; case 5: var value = new google_protobuf_timestamp_pb.Timestamp; reader.readMessage(value,google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); msg.setResolveTimestamp(value); break; case 6: var value = /** @type {number} */ (reader.readInt32()); msg.setExpiryHeight(value); break; default: reader.skipField(); break; } } return msg; }; /** * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ proto.services.InvoiceHTLC.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); proto.services.InvoiceHTLC.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. * @param {!proto.services.InvoiceHTLC} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ proto.services.InvoiceHTLC.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getChanId(); if (f !== 0) { writer.writeUint64( 1, f ); } f = message.getAmtMsat(); if (f !== 0) { writer.writeUint64( 2, f ); } f = message.getState(); if (f !== 0.0) { writer.writeEnum( 3, f ); } f = message.getAcceptTimestamp(); if (f != null) { writer.writeMessage( 4, f, google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter ); } f = message.getResolveTimestamp(); if (f != null) { writer.writeMessage( 5, f, google_protobuf_timestamp_pb.Timestamp.serializeBinaryToWriter ); } f = message.getExpiryHeight(); if (f !== 0) { writer.writeInt32( 6, f ); } }; /** * optional uint64 chan_id = 1; * @return {number} */ proto.services.InvoiceHTLC.prototype.getChanId = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; /** @param {number} value */ proto.services.InvoiceHTLC.prototype.setChanId = function(value) { jspb.Message.setProto3IntField(this, 1, value); }; /** * optional uint64 amt_msat = 2; * @return {number} */ proto.services.InvoiceHTLC.prototype.getAmtMsat = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; /** @param {number} value */ proto.services.InvoiceHTLC.prototype.setAmtMsat = function(value) { jspb.Message.setProto3IntField(this, 2, value); }; /** * optional InvoiceHTLCState state = 3; * @return {!proto.services.InvoiceHTLCState} */ proto.services.InvoiceHTLC.prototype.getState = function() { return /** @type {!proto.services.InvoiceHTLCState} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; /** @param {!proto.services.InvoiceHTLCState} value */ proto.services.InvoiceHTLC.prototype.setState = function(value) { jspb.Message.setProto3EnumField(this, 3, value); }; /** * optional google.protobuf.Timestamp accept_timestamp = 4; * @return {?proto.google.protobuf.Timestamp} */ proto.services.InvoiceHTLC.prototype.getAcceptTimestamp = function() { return /** @type{?proto.google.protobuf.Timestamp} */ ( jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 4)); }; /** @param {?proto.google.protobuf.Timestamp|undefined} value */ proto.services.InvoiceHTLC.prototype.setAcceptTimestamp = function(value) { jspb.Message.setWrapperField(this, 4, value); }; proto.services.InvoiceHTLC.prototype.clearAcceptTimestamp = function() { this.setAcceptTimestamp(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.InvoiceHTLC.prototype.hasAcceptTimestamp = function() { return jspb.Message.getField(this, 4) != null; }; /** * optional google.protobuf.Timestamp resolve_timestamp = 5; * @return {?proto.google.protobuf.Timestamp} */ proto.services.InvoiceHTLC.prototype.getResolveTimestamp = function() { return /** @type{?proto.google.protobuf.Timestamp} */ ( jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 5)); }; /** @param {?proto.google.protobuf.Timestamp|undefined} value */ proto.services.InvoiceHTLC.prototype.setResolveTimestamp = function(value) { jspb.Message.setWrapperField(this, 5, value); }; proto.services.InvoiceHTLC.prototype.clearResolveTimestamp = function() { this.setResolveTimestamp(undefined); }; /** * Returns whether this field is set. * @return {!boolean} */ proto.services.InvoiceHTLC.prototype.hasResolveTimestamp = function() { return jspb.Message.getField(this, 5) != null; }; /** * optional int32 expiry_height = 6; * @return {number} */ proto.services.InvoiceHTLC.prototype.getExpiryHeight = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); }; /** @param {number} value */ proto.services.InvoiceHTLC.prototype.setExpiryHeight = function(value) { jspb.Message.setProto3IntField(this, 6, value); }; /** * @enum {number} */ proto.services.InvoiceState = { INVOICE_OPEN: 0, INVOICE_ACCEPTED: 1, INVOICE_SETTLED: 2, INVOICE_CANCELLED: 3 }; /** * @enum {number} */ proto.services.InvoiceHTLCState = { INVOICE_HTLC_ACCEPTED: 0, INVOICE_HTLC_SETTLED: 1, INVOICE_HTLC_CANCELLED: 2 }; goog.object.extend(exports, proto.services);
require("../../common/manifest.js") require("../../common/vendor.js") global.webpackJsonpMpvue([1],{ /***/ 167: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_vue__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__index__ = __webpack_require__(168); var app = new __WEBPACK_IMPORTED_MODULE_0_vue___default.a(__WEBPACK_IMPORTED_MODULE_1__index__["a" /* default */]); app.$mount(); /***/ }), /***/ 168: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_mpvue_loader_lib_selector_type_script_index_0_index_vue__ = __webpack_require__(170); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_mpvue_loader_lib_template_compiler_index_id_data_v_2a65465a_hasScoped_true_transformToRequire_video_src_source_src_img_src_image_xlink_href_fileExt_template_wxml_script_js_style_wxss_platform_wx_node_modules_mpvue_loader_lib_selector_type_template_index_0_index_vue__ = __webpack_require__(175); var disposed = false function injectStyle (ssrContext) { if (disposed) return __webpack_require__(169) } var normalizeComponent = __webpack_require__(0) /* script */ /* template */ /* styles */ var __vue_styles__ = injectStyle /* scopeId */ var __vue_scopeId__ = "data-v-2a65465a" /* moduleIdentifier (server only) */ var __vue_module_identifier__ = null var Component = normalizeComponent( __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_mpvue_loader_lib_selector_type_script_index_0_index_vue__["a" /* default */], __WEBPACK_IMPORTED_MODULE_1__node_modules_mpvue_loader_lib_template_compiler_index_id_data_v_2a65465a_hasScoped_true_transformToRequire_video_src_source_src_img_src_image_xlink_href_fileExt_template_wxml_script_js_style_wxss_platform_wx_node_modules_mpvue_loader_lib_selector_type_template_index_0_index_vue__["a" /* default */], __vue_styles__, __vue_scopeId__, __vue_module_identifier__ ) Component.options.__file = "src\\pages\\study\\index.vue" if (Component.esModule && Object.keys(Component.esModule).some(function (key) {return key !== "default" && key.substr(0, 2) !== "__"})) {console.error("named exports are not supported in *.vue files.")} if (Component.options.functional) {console.error("[vue-loader] index.vue: functional components are not supported with templates, they should use render functions.")} /* hot reload */ if (false) {(function () { var hotAPI = require("vue-hot-reload-api") hotAPI.install(require("vue"), false) if (!hotAPI.compatible) return module.hot.accept() if (!module.hot.data) { hotAPI.createRecord("data-v-2a65465a", Component.options) } else { hotAPI.reload("data-v-2a65465a", Component.options) } module.hot.dispose(function (data) { disposed = true }) })()} /* harmony default export */ __webpack_exports__["a"] = (Component.exports); /***/ }), /***/ 169: /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /***/ 170: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator__ = __webpack_require__(5); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_asyncToGenerator__ = __webpack_require__(6); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_asyncToGenerator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_asyncToGenerator__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__components_DzhMpCircle__ = __webpack_require__(171); // // // // // // // // // // // // // // // // // // /* harmony default export */ __webpack_exports__["a"] = ({ components: { DzhMpCircle: __WEBPACK_IMPORTED_MODULE_2__components_DzhMpCircle__["a" /* default */] }, data: function data() { return { isEmpty: false, //是否为空【是否有学习记录】 studyProgresses: [] }; }, onShow: function onShow() { // 获取学习进度数据 this.getStudyProgressData(); }, methods: { getStudyProgressData: function getStudyProgressData() { var _this = this; return __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_asyncToGenerator___default()( /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee() { var res; return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee$(_context) { while (1) { switch (_context.prev = _context.next) { case 0: _context.next = 2; return _this.$axios.get('study/progress'); case 2: res = _context.sent; _this.isEmpty = res.data.message.length === 0; _this.studyProgresses = res.data.message; case 5: case 'end': return _context.stop(); } } }, _callee, _this); }))(); } } }); /***/ }), /***/ 171: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_mpvue_loader_lib_selector_type_script_index_0_DzhMpCircle_vue__ = __webpack_require__(173); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_mpvue_loader_lib_template_compiler_index_id_data_v_fe2fe66c_hasScoped_true_transformToRequire_video_src_source_src_img_src_image_xlink_href_fileExt_template_wxml_script_js_style_wxss_platform_wx_node_modules_mpvue_loader_lib_selector_type_template_index_0_DzhMpCircle_vue__ = __webpack_require__(174); var disposed = false function injectStyle (ssrContext) { if (disposed) return __webpack_require__(172) } var normalizeComponent = __webpack_require__(0) /* script */ /* template */ /* styles */ var __vue_styles__ = injectStyle /* scopeId */ var __vue_scopeId__ = "data-v-fe2fe66c" /* moduleIdentifier (server only) */ var __vue_module_identifier__ = null var Component = normalizeComponent( __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_mpvue_loader_lib_selector_type_script_index_0_DzhMpCircle_vue__["a" /* default */], __WEBPACK_IMPORTED_MODULE_1__node_modules_mpvue_loader_lib_template_compiler_index_id_data_v_fe2fe66c_hasScoped_true_transformToRequire_video_src_source_src_img_src_image_xlink_href_fileExt_template_wxml_script_js_style_wxss_platform_wx_node_modules_mpvue_loader_lib_selector_type_template_index_0_DzhMpCircle_vue__["a" /* default */], __vue_styles__, __vue_scopeId__, __vue_module_identifier__ ) Component.options.__file = "src\\components\\DzhMpCircle.vue" if (Component.esModule && Object.keys(Component.esModule).some(function (key) {return key !== "default" && key.substr(0, 2) !== "__"})) {console.error("named exports are not supported in *.vue files.")} if (Component.options.functional) {console.error("[vue-loader] DzhMpCircle.vue: functional components are not supported with templates, they should use render functions.")} /* hot reload */ if (false) {(function () { var hotAPI = require("vue-hot-reload-api") hotAPI.install(require("vue"), false) if (!hotAPI.compatible) return module.hot.accept() if (!module.hot.data) { hotAPI.createRecord("data-v-fe2fe66c", Component.options) } else { hotAPI.reload("data-v-fe2fe66c", Component.options) } module.hot.dispose(function (data) { disposed = true }) })()} /* harmony default export */ __webpack_exports__["a"] = (Component.exports); /***/ }), /***/ 172: /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /***/ 173: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // // // // // // // /* harmony default export */ __webpack_exports__["a"] = ({ props: { canvasId: { type: Number }, width: { type: Number, default: 100 }, height: { type: Number, default: 100 }, backgroundColor: { type: String, default: '#f3f3f3' }, foregroundColor: { type: String, default: '#B4D66E' }, lineWidth: { type: Number, default: 5 }, progress: { type: Number, default: 100 } }, updated: function updated() { this.drawProgress(); }, onReady: function onReady() { this.drawProgress(); }, methods: { // 绘制进度 drawProgress: function drawProgress() { if (this.progress <= 30) { this.foregroundColor = '#ff0000'; } else if (this.progress > 30 && this.progress < 50) { this.foregroundColor = '#FF783B'; } else { this.foregroundColor = '#B4D66E'; } // 背景色 var backgroundCtx = wx.createCanvasContext('backgroundCanvas' + this.canvasId); // 前景色 var foregroundCtx = wx.createCanvasContext('foregroundCanvas' + this.canvasId); // 绘制背景色 backgroundCtx.setStrokeStyle(this.backgroundColor); backgroundCtx.setLineWidth(this.lineWidth); // 绘制圆 backgroundCtx.arc(this.width / 2 + this.lineWidth / 2, this.height / 2 + this.lineWidth / 2, this.width / 2 - this.lineWidth, 0, 2 * Math.PI, true); backgroundCtx.stroke(); // 绘制前景色 foregroundCtx.setStrokeStyle(this.foregroundColor); foregroundCtx.setLineWidth(this.lineWidth); foregroundCtx.setLineCap('round'); foregroundCtx.arc(this.width / 2 + this.lineWidth / 2, this.height / 2 + this.lineWidth / 2, this.width / 2 - this.lineWidth, -0.5 * Math.PI, this.progress / 100 * 2 * Math.PI - 0.5 * Math.PI, false); foregroundCtx.stroke(); // 绘制文字 foregroundCtx.setFillStyle(this.foregroundColor); foregroundCtx.setFontSize(12); if (this.progress >= 99) { foregroundCtx.fillText(parseInt(this.progress) + '%', this.width / 2 - 13, this.height / 2 + 6); } else { foregroundCtx.fillText(parseInt(this.progress) + '%', this.width / 2 - 10, this.height / 2 + 6); } // 绘制 backgroundCtx.draw(); foregroundCtx.draw(); } } }); /***/ }), /***/ 174: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h; return _c('div', { staticClass: "mp-circle-container" }, [_c('canvas', { staticClass: "mp-circle", style: ({ width: _vm.width + 'px', height: _vm.height + 'px' }), attrs: { "canvas-id": 'backgroundCanvas' + _vm.canvasId } }), _vm._v(" "), _c('canvas', { staticClass: "mp-circle", style: ({ width: _vm.width + 'px', height: _vm.height + 'px' }), attrs: { "canvas-id": 'foregroundCanvas' + _vm.canvasId } })]) } var staticRenderFns = [] render._withStripped = true var esExports = { render: render, staticRenderFns: staticRenderFns } /* harmony default export */ __webpack_exports__["a"] = (esExports); if (false) { module.hot.accept() if (module.hot.data) { require("vue-hot-reload-api").rerender("data-v-fe2fe66c", esExports) } } /***/ }), /***/ 175: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h; return _c('div', { staticClass: "study-container" }, [_vm._l((_vm.studyProgresses), function(item, index) { return _c('div', { key: item.sid, staticClass: "study-item" }, [_c('img', { attrs: { "src": item.icon, "alt": "" } }), _vm._v(" "), _c('div', { staticClass: "meta" }, [_c('p', { staticClass: "title" }, [_vm._v(_vm._s(item.title))]), _vm._v(" "), _c('p', { staticClass: "progress" }, [_vm._v("已学习" + _vm._s(item.study_hour) + "课时/" + _vm._s(item.total_hour || 0) + "课时")])], 1), _vm._v(" "), _c('div', { staticClass: "circle" }, [_c('dzh-mp-circle', { attrs: { "canvasId": item.sid, "progress": item.study_progress, "width": 55, "height": 55, "mpcomid": '0_' + index } })], 1)]) }), _vm._v(" "), (_vm.isEmpty) ? _c('div', [_c('p', { staticClass: "no-study-tip" }, [_vm._v("您还没有任何学习记录哦,赶快去学习吧~")])], 1) : _vm._e()], 2) } var staticRenderFns = [] render._withStripped = true var esExports = { render: render, staticRenderFns: staticRenderFns } /* harmony default export */ __webpack_exports__["a"] = (esExports); if (false) { module.hot.accept() if (module.hot.data) { require("vue-hot-reload-api").rerender("data-v-2a65465a", esExports) } } /***/ }) },[167]);
const path = require("path") const handlebars = require("express-handlebars") const pathService = require("./../services/path.service") class KeystoneConfigurator { constructor(keystone) { this._keystone = keystone; } init(options) { const appRoot = pathService.resolveRootDir() const coreRoot = pathService.resolvePreviousDir(__dirname) const libRoot = pathService.resolvePreviousDir(coreRoot) // Initialise Keystone with your project's configuration. // See http://keystonejs.com/guide/config for available options // and documentation. if(options.init) { this._keystone.init(options.init) } else { this._keystone.init({ name: "Collect.IO", brand: "Collect.IO", sass: path.join(libRoot, "public"), static: path.join(libRoot, "public"), updates: options.updatePath ?? path.join(appRoot, "updates"), views: path.join(coreRoot, "templates/views"), "view engine": ".hbs", "wysiwyg skin": "lightgray", "custom engine": handlebars.create({ layoutsDir: path.join(coreRoot, "templates/views/layouts"), partialsDir: path.join(coreRoot, "templates/views/partials"), defaultLayout: "default", helpers: new require(path.join(coreRoot, "templates/views/helpers"))(), extname: ".hbs", }).engine, emails: path.join(coreRoot, "templates/emails"), "auto update": options.autoUpdate ?? false, session: true, auth: true, "user model": "Admin", }); } // optional, will prefix all built-in tags with 'keystone_' // keystone.set('cloudinary prefix', 'collectio'); if(process.env.CLOUDINARY_API_SECRET) { this._keystone.set("cloudinary config", { cloud_name: process.env.CLOUDINARY_NAME, api_key: process.env.API_KEY, api_secret: process.env.CLOUDINARY_API_SECRET, }); // optional, will prefix each image public_id with [{prefix}]/{list.path}/{field.path}/ //keystone.set('cloudinary folders', true); // optional, will force cloudinary to serve images over https this._keystone.set("cloudinary secure", true); } this._keystone.set("signin logo", "/images/collectio.logo.png"); this._keystone.set("mongo options", { useMongoClient: true }); // Load your project's Models this._keystone.import("models") if(options.modelPath) { this._keystone.import(options.modelPath) } if(options.adminPort) { this._keystone.set("port", options.adminPort) } // Setup common locals for your templates. The following are required for the // bundled templates and layouts. Any runtime locals (that should be set uniquely // for each request) should be added to ./routes/middleware.js this._keystone.set("locals", { _: require("lodash"), env: this._keystone.get("env"), utils: this._keystone.utils, editable: this._keystone.content.editable, }); // Load your project's Routes this._keystone.set("routes", path.join(libRoot, "routes")); // Configure the navigation bar in Keystone's Admin UI //keystone.set('nav', { // posts: ['posts', 'post-categories'], // galleries: 'galleries', // enquiries: 'enquiries', // 'cio-admins': 'cio-admins', //}); if(options.nav) { this._keystone.set("nav", options.nav) } else { this._keystone.set("nav", { account: ["admins", "clients", "roles"], }) } // Start Keystone to connect to your database and initialise the web server // if (!process.env.MAILGUN_API_KEY || !process.env.MAILGUN_DOMAIN) { // console.log('----------------------------------------' + // '\nWARNING: MISSING MAILGUN CREDENTIALS' + // '\n----------------------------------------' + // '\nYou have opted into email sending but have not provided' + // '\nmailgun credentials. Attempts to send will fail.' + // '\n\nCreate a mailgun account and add the credentials to the .env file to' + // '\nset up your mailgun integration'); // } } } module.exports = keystone => new KeystoneConfigurator(keystone)
import React, { useState } from 'react' import BaseProvider from './BaseProvider' import FilterTable from '../components/FilterTable'; const TwitterPage = () => { const [data, setData] = useState(); return ( <BaseProvider pageTitle='Twitter mentions' connectionName='twitter' endpoint='twitter' setData={setData}> <TweetTable data={data} setData={setData}/> </BaseProvider> ) } const TweetTable = ({data, setData}) => { const urlFormatter = (cell, row) => { const tweetId = `https://twitter.com/i/web/status/${row.id_str}`; return <a href={tweetId} target="_">{cell}</a> } const typeFormatter = (cell, row, rowIndex, formatExtraData) => { return ( <i className={ formatExtraData[cell] } /> ) } const columns = [{ dataField: 'date', text: 'Date', sort: true, headerStyle: (column, colIndex) => { return { width: '200px' }; } }, { dataField: 'type', text: 'Type', sort: true, headerStyle: (column, colIndex) => { return { width: '80px' }; }, align: 'center', formatter: typeFormatter, formatExtraData: { positive: 'fa fa-thumbs-up fa-2x text-success', neutral: 'fa fa-minus fa-2x text-warning', negative: 'fa fa-thumbs-down fa-2x text-danger' } }, { dataField: 'user', text: 'User', sort: true, headerStyle: (column, colIndex) => { return { width: '120px' }; } }, { dataField: 'name', text: 'Name', sort: true, headerStyle: (column, colIndex) => { return { width: '100px' }; } }, { dataField: 'text', text: 'Text', formatter: urlFormatter }]; const tweets = data && data.map && data.map(item => { return { id_str: item.id_str, date: new Date(item.created_at).toLocaleString(), user: item.user.screen_name, name: item.user.name, type: item.__sentiment, text: item.text } }); return ( tweets ? <FilterTable data={data} setData={setData} dataRows={tweets} columns={columns} keyField="id_str" path="twitter/mentions" maxHeight="calc(100vh - 220px)" /> : <div/> ) } export default TwitterPage
import React, { Component } from 'react'; import TabNav from './tabnav'; import NewsletterGrid from "./newsletter/newsletterGrid"; import RequestsGrid from "./requests/requestsGrid"; class Dashboard extends Component { constructor(props) { super(props); this.state = { tabs: [ { title: 'Newsletter', active: true, component: <NewsletterGrid history={this.props.history}/> }, { title: 'Requests', active: false, component: <RequestsGrid history={this.props.history}/> }, ] } } handleTabChange = (title) => { const tabs = this.state.tabs; tabs.map(tab => { if(tab.title == title) { tab.active = true } else { tab.active = false } }) this.setState({ tabs }); } render() { return ( <div className='dashboard'> <TabNav handleClick={(title) => this.handleTabChange(title)} tabs={this.state.tabs}/> </div> ) } } export default Dashboard;
import React, {useState, useEffect} from 'react'; import API from '../api-services'; //import {TokenContext} from "../index"; import {useCookies} from "react-cookie"; //It's always advisable to do authentication on server side and skip //doing it on javascript side //Auth should get username/password, create user and get back the autnetication //token to work with it //context is fine but it's in application memory but this is not persistant //Ideally it should be stored outside of memory via cookies and retrieved from cookies function Auth() { const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); const [isLoginView, setIsLoginView] = useState(true); //For sharing global data context is the way to do it //For less nesting props based transfer is fine //useCookies is also implemented as a hook //const {token, setToken} = useContext(TokenContext); const [token, setToken] = useCookies(['mr-token']); useEffect(() => { console.log("auth useEffect " + token); // if token is available then go to movies // react/node tutorial used link to go to specific location if (token['mr-token']) window.location.href = '/movies'; }, [token]) //For the user a token is generated and sent back //This is the code that we added for auth generation //We can story the token in local-storage and cookies //and next time use the token to authenticate const loginClicked = () => { console.log(`auth loginClicked ${username} ${password}`) API.loginUser({username, password}) //.then(resp => setToken(resp.token)) //.then(resp => console.log(resp.token)) .then(resp => setToken('mr-token', resp.token)) .catch(error => console.log(error)) } const registerClicked = () => { console.log(`auth registerClicked ${username} ${password}`) API.registerUser({username, password}) .then(() => loginClicked()) .catch(error => console.log(error)) } const isDisabled = username.length === 0 || password.length === 0; return ( <div className="App"> <header className="App-header"> {isLoginView ? <h1>Login</h1> : <h1>Register</h1>} </header> <div class="login-container"> <label htmlFor={"username"}>Username</label><br/> <input id="username" type="text" placeholder="username" value={username} onChange={evt => setUsername(evt.target.value)} /><br/> <label htmlFor={"password"}>Password</label><br/> <input id={"password"} type={"password"} placeholder={"password"} value={password} onChange={evt => setPassword(evt.target.value)} > </input><br/> {isLoginView ? <button onClick={loginClicked} disabled={isDisabled}>Login</button>: <button onClick={registerClicked} disabled={isDisabled}>Register</button> } {isLoginView ? <p onClick={() => setIsLoginView(false)}>You don't have an account ? Register here! </p> : <p onClick={() => setIsLoginView(true)}>You already have an account ? Login here </p> } </div> </div> ) } export default Auth;
/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ import { withHandlers } from 'recompose'; import { set } from 'object-path-immutable'; import { get } from 'lodash'; import { templateFromReactComponent } from '../../../lib/template_from_react_component'; import { SimpleTemplate } from './simple_template'; import { ExtendedTemplate } from './extended_template'; const wrap = Component => // TODO: this should be in a helper withHandlers({ getArgValue: ({ argValue }) => (name, alt) => { const args = get(argValue, 'chain.0.arguments', {}); return get(args, [name, 0], alt); }, setArgValue: ({ argValue, onValueChange }) => (name, val) => { const newValue = set(argValue, ['chain', 0, 'arguments', name, 0], val); onValueChange(newValue); }, })(Component); export const containerStyle = () => ({ name: 'containerStyle', displayName: 'Container Style', help: 'Tweak the appearance of the element container', default: '{containerStyle}', simpleTemplate: templateFromReactComponent(wrap(SimpleTemplate)), template: templateFromReactComponent(wrap(ExtendedTemplate)), });
// When false nothing will be logged. // Configuration goes here. require('./config.js'); if (!configuration.DEBUG) { console.log = function() {}; } const Discord = require("discord.js"); const fs = require('fs'); let net; let netOptions = {}; if (configuration.tlsEnabled) { net = require('tls'); netOptions = { key: fs.readFileSync(configuration.tlsOptions.keyPath), cert: fs.readFileSync(configuration.tlsOptions.certPath) } } else { net = require('net'); } let request; if (configuration.handleCode) { request = require('request'); } // // Let's ready some variables and stuff we will use later on. // // Object which will contain channel information. let ircDetails = { DMserver: { lastPRIVMSG: [] } }; // Since we want a seperate connection for each discord server we will need to store our sockets. let ircClients = []; // Simply used to give each new socket a unique number. let ircClientCount = 0; // This is used to make sure that if discord reconnects not everything is wiped. let discordFirstConnection = true; // Max line lenght for irc messages. const maxLineLength = 510; // // Generic functions // // Function that parses irc messages. // Shamelessly stolen from node-irc https://github.com/aredridel/node-ircd function parseMessage(line) { let message = {}; let m = /(:[^ ]+ )?([A-Z0-9]+)(?: (.*))?/i.exec(line); if (!m) { message['error'] = 'Unable to parse message'; } else { let i; if (m[3] && (i = m[3].indexOf(':')) !== -1) { let rest = m[3].slice(i + 1); message.params = m[3].slice(0, i - 1).split(' '); message.params.push(rest); } else { if (m[3]) { message.params = m[3].split(' '); } else { message.params = []; } } if (m[2]) { message.command = m[2].toUpperCase(); } if (m[1]) { message.sender = m[1]; } } return message; } // Returns a number based on the discord server that increases per call. // Used to make fairly sure nicknames on irc end up being unique after being scrubbed. // Make nicknames work for irc. function ircNickname(discordDisplayName, botuser, discriminator) { const replaceRegex = /[^a-zA-Z0-9_\\[\]\{\}\^`\|]/g; const shortenRegex = /_{1,}/g; if (replaceRegex.test(discordDisplayName)) { let newDisplayname = `${discordDisplayName.replace(replaceRegex, '_')}${discriminator}`; newDisplayname = newDisplayname.replace(shortenRegex, '_'); return botuser ? `${newDisplayname}[BOT]` : newDisplayname; } else { return botuser ? `${discordDisplayName}[BOT]` : discordDisplayName; } } // Parses discord lines to make them work better on irc. function parseDiscordLine(line, discordID) { // Discord markdown parsing the lazy way. Probably fails in a bunch of different ways but at least it is easy. line = line.replace(/\*\*(.*?)\*\*/g, '\x02$1\x0F'); line = line.replace(/\*(.*?)\*/g, '\x1D$1\x0F'); line = line.replace(/^_(.*?)\_/g, '\x01ACTION $1\x01'); line = line.replace(/__(.*?)__/g, '\x1F$1\x0F'); // With the above regex we might end up with to many end characters. This replaces the, line = line.replace(/\x0F{2,}/g, '\x0F'); // Now let's replace mentions with names we can recognize. const mentionUserRegex = /(<@!?\d{1,}?>)/g; const mentionUserFound = line.match(mentionUserRegex); if (mentionUserFound) { mentionUserFound.forEach(function(mention) { const userID = mention.replace(/<@!?(\d{1,}?)>/, '$1'); const memberObject = discordClient.guilds.get(discordID).members.get(userID); const displayName = memberObject.displayName; const isBot = memberObject.user.bot; const discriminator = memberObject.user.discriminator; const userName = ircNickname(displayName, isBot, discriminator); const replaceRegex = new RegExp(mention, 'g'); if (userName) { line = line.replace(replaceRegex, `@${userName}`); } }); } // Now let's do this again and replace mentions with roles we can recognize. const mentionRoleRegex = /(<@&\d{1,}?>)/g; const mentionRoleFound = line.match(mentionRoleRegex); if (mentionRoleFound) { mentionRoleFound.forEach(function(mention) { const roleID = mention.replace(/<@&(\d{1,}?)>/, '$1'); const roleObject = discordClient.guilds.get(discordID).roles.get(roleID); const replaceRegex = new RegExp(mention, 'g'); if (roleObject) { const name = roleObject.name; line = line.replace(replaceRegex, `@${name}`); } }); } // Channels are also a thing!. const mentionChannelRegex = /(<#\d{1,}?>)/g; const mentionChannelFound = line.match(mentionChannelRegex); if (mentionChannelFound) { mentionChannelFound.forEach(function(mention) { const channelID = mention.replace(/<#(\d{1,}?)>/, '$1'); const channelObject = discordClient.guilds.get(discordID).channels.get(channelID); const replaceRegex = new RegExp(mention, 'g'); if (channelObject) { const name = channelObject.name; line = line.replace(replaceRegex, `@${name}`); } }); } return line; } // Parse irc lines to make them work better on discord. function parseIRCLine(line, discordID, channel) { line = line.replace(/\001ACTION(.*?)\001/g, '_$1_'); const mentionDiscordRegex = /(@.{1,}?\s)/g; let mentionDiscordFound = line.match(mentionDiscordRegex); const mentionIrcRegex = /(^.{1,}?:)/g; let mentionIrcFound = line.match(mentionIrcRegex); let mentionFound; if (mentionDiscordFound && mentionIrcFound) { mentionFound = mentionDiscordFound.concat(mentionIrcFound); } else if (mentionDiscordFound) { mentionFound = mentionDiscordFound; } else { mentionFound = mentionIrcFound; } if (mentionFound) { mentionFound.forEach(function(mention) { const regexDiscordMention = /@(.{1,}?)\s/; const regexIrcMention = /^(.{1,}?):/; let userNickname; if (regexDiscordMention.mention) { userNickname = mention.replace(regexDiscordMention, '$1'); } else { userNickname = mention.replace(regexIrcMention, '$1'); } if (ircDetails[discordID].channels[channel].members.hasOwnProperty(userNickname)) { const userID = ircDetails[discordID].channels[channel].members[userNickname].id; const replaceRegex = new RegExp(mention, 'g'); line = line.replace(replaceRegex, `<@!${userID}> `); } }); } return line; } // // Discord related functionality. // // Create our discord client. let discordClient = new Discord.Client({ fetchAllMembers: true, sync: true }); // Log into discord using the token defined in config.js discordClient.login(configuration.discordToken); // // Various events used for debugging. // // Will log discord debug information. discordClient.on('debug', function(info) { console.log('debug', info); }); // When debugging we probably want to know about errors as well. discordClient.on('error', function(info) { console.log('error', info); sendGeneralNotice('Discord error.'); }); // Emitted when the Client tries to reconnect after being disconnected. discordClient.on('reconnecting', function() { console.log('reconnecting'); sendGeneralNotice('Reconnecting to Discord.'); }); // Emitted whenever the client websocket is disconnected. discordClient.on('disconnect', function(event) { console.log('disconnected', event); sendGeneralNotice('Discord has been disconnected.'); }); // Emitted for general warnings. discordClient.on('warn', function(info) { console.log('warn', info); }); // Discord is ready. discordClient.on('ready', function() { // This is probably not needed, but since sometimes things are weird with discord. discordClient.guilds.array().forEach(function(guild) { guild.fetchMembers(); guild.sync(); }); console.log(`Logged in as ${discordClient.user.username}!`); // Lets grab some basic information we will need eventually. // But only do so if this is the first time connecting. if (discordFirstConnection) { discordFirstConnection = false; discordClient.guilds.array().forEach(function(guild) { const guildID = guild.id; if (!ircDetails.hasOwnProperty(guildID)) { ircDetails[guildID] = { lastPRIVMSG: [], channels: {}, members: {} }; } guild.members.array().forEach(function(member) { const ircDisplayName = ircNickname(member.displayName, member.user.bot, member.user.discriminator); ircDetails[guildID].members[ircDisplayName] = member.id; }); }); discordClient.channels.array().forEach(function(channel) { // Of course only for channels. if (channel.type === 'text') { const guildID = channel.guild.id, channelName = channel.name, channelID = channel.id, channelTopic = channel.topic || 'No topic'; ircDetails[guildID].channels[channelName] = { id: channelID, joined: [], topic: channelTopic }; } }); // Now that is done we can start the irc server side of things. ircServer.listen(configuration.ircServer.listenPort); } else { sendGeneralNotice('Discord connection has been restored.'); } }); // // Acting on events // // There are multiple events that indicate a users is no longer on the server. // We abuse the irc QUIT: message for this even if people are banned. function guildMemberNoMore(guildID, ircDisplayName, noMoreReason) { let found = false; // First we go over the channels. for (let channel in ircDetails[guildID].channels) { if (ircDetails[guildID].channels.hasOwnProperty(channel) && ircDetails[guildID].channels[channel].joined.length > 0) { let channelMembers = ircDetails[guildID].channels[channel].members; // Within the channels we go over the members. if (channelMembers.hasOwnProperty(ircDisplayName)) { if (!found) { let memberDetails = ircDetails[guildID].channels[channel].members[ircDisplayName]; console.log(`User ${ircDisplayName} quit ${noMoreReason}`); ircDetails[guildID].channels[channel].joined.forEach(function(socketID) { sendToIRC(guildID, `:${ircDisplayName}!${memberDetails.id}@whatever QUIT :${noMoreReason}\r\n`, socketID); }); found = true; } delete ircDetails[guildID].channels[channel].members[ircDisplayName]; } } } if (noMoreReason !== 'User gone offline') { delete ircDetails[guildID].members[ircDisplayName]; } } function guildMemberCheckChannels(guildID, ircDisplayName, guildMember) { // First we go over the channels. for (let channel in ircDetails[guildID].channels) { if (ircDetails[guildID].channels.hasOwnProperty(channel) && ircDetails[guildID].channels[channel].joined.length > 0) { let isInDiscordChannel = false; let isCurrentlyInIRC = false; let channelDetails = ircDetails[guildID].channels[channel]; let channelMembers = channelDetails.members; let channelID = channelDetails.id; //Let's check the discord channel. let discordMemberArray = discordClient.guilds.get(guildID).channels.get(channelID).members.array(); discordMemberArray.forEach(function(discordMember) { if (guildMember.displayName === discordMember.displayName && (guildMember.presence.status !== 'offline' || configuration.showOfflineUsers)) { isInDiscordChannel = true; } }); // Within the channels we go over the members. if (channelMembers.hasOwnProperty(ircDisplayName)) { // User found for channel. isCurrentlyInIRC = true; } // If the user is in the discord channel but not irc we will add the user. if (!isCurrentlyInIRC && isInDiscordChannel) { ircDetails[guildID].channels[channel].members[ircDisplayName] = { discordName: guildMember.displayName, discordState: guildMember.presence.status, ircNick: ircDisplayName, id: guildMember.id }; console.log(`User ${ircDisplayName} joined ${channel}`); ircDetails[guildID].channels[channel].joined.forEach(function(socketID) { sendToIRC(guildID, `:${ircDisplayName}!${guildMember.id}@whatever JOIN #${channel}\r\n`, socketID); const socketDetails = getSocketDetails(socketID); if (guildMember.presence === 'idle' && socketDetails.awayNotify) { console.log(`User ${ircDisplayName} is away: Idle`); sendToIRC(guildID, `:${ircDisplayName}!${guildMember.id}@whatever AWAY :Idle\r\n`, socketID); } if (guildMember.presence === 'dnd' && socketDetails.awayNotify) { console.log(`User ${ircDisplayName} is away: Do not disturb`); sendToIRC(guildID, `:${ircDisplayName}!${guildMember.id}@whatever AWAY :Do not disturb\r\n`, socketID); } // Unlikely to happen, but just to be sure. if (guildMember.presence === 'offline' && configuration.showOfflineUsers && socketDetails.awayNotify) { console.log(`User ${ircDisplayName} is offline`); sendToIRC(guildID, `:${ircDisplayName}!${guildMember.id}@whatever AWAY :Offline\r\n`, socketID); } }); } // If the user is currently in irc but not in the discord channel they have left the channel. if (isCurrentlyInIRC && !isInDiscordChannel) { ircDetails[guildID].channels[channel].joined.forEach(function(socketID) { console.log(`User ${ircDisplayName} left ${channel}`); sendToIRC(guildID, `:${ircDisplayName}!${guildMember.id}@whatever PART #${channel}\r\n`, socketID); delete ircDetails[guildID].channels[channel].members[ircDisplayName]; }); } } } } function guildMemberNickChange(guildID, oldIrcDisplayName, newIrcDisplayName, newDiscordDisplayName) { // First we go over the channels. let foundInChannels = false; let memberId; ircDetails[guildID].members[newIrcDisplayName] = ircDetails[guildID].members[oldIrcDisplayName]; delete ircDetails[guildID].members[oldIrcDisplayName]; for (let channel in ircDetails[guildID].channels) { if (ircDetails[guildID].channels.hasOwnProperty(channel) && ircDetails[guildID].channels[channel].joined.length > 0) { let channelDetails = ircDetails[guildID].channels[channel]; let channelMembers = channelDetails.members; // Within the channels we go over the members. if (channelMembers.hasOwnProperty(oldIrcDisplayName)) { let tempMember = channelMembers[oldIrcDisplayName]; tempMember.displayName = newDiscordDisplayName; tempMember.ircNick = newIrcDisplayName; memberId = tempMember.id; delete ircDetails[guildID].channels[channel].members[oldIrcDisplayName]; ircDetails[guildID].channels[channel].members[oldIrcDisplayName] = tempMember; foundInChannels = true; } } } if (foundInChannels) { console.log(`Changing nickname ${oldIrcDisplayName} into ${newIrcDisplayName}`); sendToIRC(guildID, `:${oldIrcDisplayName}!${memberId}@whatever NICK ${newIrcDisplayName}\r\n`); } } discordClient.on('guildMemberRemove', function(GuildMember) { if (ircClients.length > 0) { console.log('guildMemberRemove'); const guildID = GuildMember.guild.id; const isBot = GuildMember.user.bot; const discriminator = GuildMember.user.discriminator; const ircDisplayName = ircNickname(GuildMember.displayName, isBot, discriminator); guildMemberNoMore(guildID, ircDisplayName, 'User removed'); } }); discordClient.on('presenceUpdate', function(oldMember, newMember) { if (ircClients.length > 0) { const guildID = newMember.guild.id; const isBot = newMember.user.bot; const discriminator = newMember.user.discriminator; const ircDisplayName = ircNickname(newMember.displayName, isBot, discriminator); const oldPresenceState = oldMember.presence.status; const newPresenceState = newMember.presence.status; if (oldPresenceState === 'offline' && !configuration.showOfflineUsers) { guildMemberCheckChannels(guildID, ircDisplayName, newMember); } else if (newPresenceState === 'offline' && !configuration.showOfflineUsers) { guildMemberNoMore(guildID, ircDisplayName, 'User gone offline'); } else if (configuration.showOfflineUsers) { ircClients.forEach(function(socket) { if (socket.awayNotify) { // Technically we could just do socket.writeline for these. But for consistency we go through the sendToIRC function. if (newPresenceState === 'offline' && configuration.showOfflineUsers) { sendToIRC(guildID, `:${ircDisplayName}!${newMember.id}@whatever AWAY :Offline\r\n`, socket.ircid); } else if (newPresenceState === 'dnd') { sendToIRC(guildID, `:${ircDisplayName}!${newMember.id}@whatever AWAY :Do not disturb\r\n`, socket.ircid); } else if (newPresenceState === 'idle') { sendToIRC(guildID, `:${ircDisplayName}!${newMember.id}@whatever AWAY :Idle\r\n`, socket.ircid); } else if (oldPresenceState !== 'offline' && newPresenceState === 'online') { sendToIRC(guildID, `:${ircDisplayName}!${newMember.id}@whatever AWAY\r\n`, socket.ircid); } } }); } } }); discordClient.on('guildMemberUpdate', function(oldMember, newMember) { if (ircClients.length > 0) { console.log('guildMemberUpdate'); const guildID = newMember.guild.id; const oldIsBot = oldMember.user.bot; const newIsBot = newMember.user.bot; const discriminator = newMember.user.discriminator; const oldIrcDisplayName = ircNickname(oldMember.displayName, oldIsBot, discriminator); const newIrcDisplayName = ircNickname(newMember.displayName, newIsBot, discriminator); const newDiscordDisplayName = newMember.displayName; if (oldIrcDisplayName !== newIrcDisplayName) { if (newMember.id === discordClient.user.id) { sendToIRC(newMember.guild.id, `:${oldIrcDisplayName}!${discordClient.user.id}@whatever NICK ${newIrcDisplayName}\r\n`); } else { guildMemberNickChange(guildID, oldIrcDisplayName, newIrcDisplayName, newDiscordDisplayName); } } else { guildMemberCheckChannels(guildID, newIrcDisplayName, newMember); } } }); discordClient.on('guildMemberAdd', function(GuildMember) { if (ircClients.length > 0) { console.log('guildMemberAdd'); const guildID = GuildMember.guild.id; const isBot = GuildMember.user.bot; const discriminator = GuildMember.user.discriminator; const ircDisplayName = ircNickname(GuildMember.displayName, isBot, discriminator); guildMemberCheckChannels(guildID, ircDisplayName, GuildMember); } }); discordClient.on('channelCreate', function(newChannel) { if (newChannel.type === 'text') { const discordServerId = newChannel.guild.id; ircDetails[discordServerId].channels[newChannel.name] = { id: newChannel.id, members: {}, topic: newChannel.topic || 'No topic', joined: [] }; } }); discordClient.on('channelDelete', function(deletedChannel) { if (deletedChannel.type === 'text') { const discordServerId = deletedChannel.guild.id; if (ircDetails[discordServerId].channels[deletedChannel.name].joined.length > 0) { const PartAlertMessage = `:discordIRCd!notReallyA@User PRIVMSG #${deletedChannel.name} :#${deletedChannel.name} has been deleted \r\n`; sendToIRC(discordServerId, PartAlertMessage); const joinedSockets = ircDetails[discordServerId].channels[deletedChannel.name].joined; joinedSockets.forEach(function(socketID) { // First we inform the user in the old channelContent partCommand(deletedChannel.name, discordServerId, socketID); }); } // Finally remove the channel from the list. delete ircDetails[discordServerId].channels[deletedChannel.name]; } }); discordClient.on('channelUpdate', function(oldChannel, newChannel) { const discordServerId = oldChannel.guild.id; console.log('channel updated'); if (oldChannel.type === 'text') { if (oldChannel.name !== newChannel.name) { console.log(`channel name changed from #${oldChannel.name} to #${newChannel.name}`); ircDetails[discordServerId].channels[newChannel.name] = { id: newChannel.id, members: {}, topic: newChannel.topic || 'No topic', joined: [] }; if (ircDetails[discordServerId].channels[oldChannel.name].joined.length > 0) { const PartAlertMessage = `:discordIRCd!notReallyA@User PRIVMSG #${oldChannel.name} :#${oldChannel.name} has been renamed to #${newChannel.name} \r\n`; sendToIRC(discordServerId, PartAlertMessage); const joinedSockets = ircDetails[discordServerId].channels[oldChannel.name].joined; joinedSockets.forEach(function(socketID) { // First we inform the user in the old channelContent partCommand(oldChannel.name, discordServerId, socketID); joinCommand(newChannel.name, discordServerId, socketID); }); } // Delete the old one. delete ircDetails[discordServerId].channels[oldChannel.name]; } } // Simple topic change. if (oldChannel.topic !== newChannel.topic) { const topic = newChannel.topic || 'No topic'; ircClients.forEach(function(socket) { if (socket.discordid === discordServerId && ircDetails[discordServerId].channels[newChannel.name].joined.indexOf(socket.ircid) > -1) { const topicMSG = `:noboyknows!orCares@whatever TOPIC #${newChannel.name} :${topic}\r\n`; sendToIRC(discordServerId, topicMSG, socket.ircid); } }); } }); // Processing received messages discordClient.on('message', function(msg) { if (ircClients.length > 0 && msg.channel.type === 'text') { const discordServerId = msg.guild.id; // Webhooks don't have a member. let authorDisplayName; if (msg.member) { authorDisplayName = msg.member.displayName; } else { authorDisplayName = msg.author.username; } const isBot = msg.author.bot; const discriminator = msg.author.discriminator; const authorIrcName = ircNickname(authorDisplayName, isBot, discriminator); const channelName = msg.channel.name; // Doesn't really matter socket we pick this from as long as it is connected to the discord server. let ownNickname = getSocketDetails(ircDetails[discordServerId].channels[channelName].joined[0]).nickname; let messageContent = msg.content; if (configuration.handleCode) { const codeRegex = /```(.*?)\r?\n([\s\S]*?)```/; const replaceRegex = /```.*?\r?\n[\s\S]*?```/; if (codeRegex.test(messageContent)) { const codeDetails = messageContent.match(codeRegex); // In the future I want to include the url in the message. But since the call to gist is async that doesn't fit the current structure. messageContent = messageContent.replace(replaceRegex, ''); let extension; let language; if (codeDetails[1]) { language = codeDetails[1].toLowerCase(); switch (language) { case 'javascript': extension = 'js'; break; case 'html': extension = 'html'; break; case 'css': extension = 'css'; break; case 'xml': extension = 'xml'; break; case 'python': extension = 'py'; break; case 'c#': extension = 'cs'; break; case 'c++': extension = 'cc'; break; case 'php': extension = 'php'; break; default: extension = 'txt'; break; } } else { extension = 'txt'; language = 'unknown'; } const gistFileName = `${authorIrcName}_code.${extension}`; let postBody = { description: `Code block on ${msg.guild.name} in channel ${channelName} from ${authorIrcName}`, public: false, files: { } }; postBody.files[gistFileName] = { 'content': codeDetails[2] }; let gistOptions = { url: 'https://api.github.com/gists', headers: { 'Authorization': `token ${configuration.githubToken}`, 'User-Agent': 'discordIRCd' }, method: 'POST', json: postBody }; request(gistOptions, function(error, response, body) { if (error) { console.log('Gist error:', error); } if (!error && response.statusCode === 201) { console.log(body.html_url); const gistMessage = `:${authorIrcName}!${msg.author.id}@whatever PRIVMSG #${channelName} :${body.html_url}\r\n`; ircDetails[discordServerId].channels[channelName].joined.forEach(function(socketID) { sendToIRC(discordServerId, gistMessage, socketID); }); } if (!error && response.statusCode !== 201) { console.log('Something went wrong on the gist side of things:', response.statusCode); } }); } } let memberMentioned = false; let memberDirectlyMentioned = false; const ownGuildMember = discordClient.guilds.get(discordServerId).members.get(discordClient.user.id); if (msg.mentions.roles.array().length > 0) { ownGuildMember.roles.array().forEach(function(role) { if (msg.isMentioned(role)) { memberMentioned = true; } }); } if (msg.mentions.everyone) { memberMentioned = true; } // Only add it if the nickname is known. If it is undefined the client is not in the channel and will be notified through PM anyway. if (memberMentioned && ownNickname) { messageContent = `${ownNickname}: ${messageContent}`; } if (msg.mentions.users.array().length > 0) { if (msg.isMentioned(ownGuildMember)) { memberDirectlyMentioned = true; } } // Only act on text channels and if the user has joined them in irc or if the user is mentioned in some capacity. if (ircDetails[discordServerId].channels[channelName].joined.length > 0 || memberMentioned || memberDirectlyMentioned) { // IRC does not handle newlines. So we split the message up per line and send them seperatly. const messageArray = messageContent.split(/\r?\n/); const attachmentArray = msg.attachments.array(); if (attachmentArray.length > 0) { attachmentArray.forEach(function(attachment) { const filename = attachment.filename; const url = attachment.url; const attachmentLine = `${filename}: ${url}`; messageArray.push(attachmentLine); }); } messageArray.forEach(function(line) { const messageTemplate = `:${authorIrcName}!${msg.author.id}@whatever PRIVMSG #${channelName} :`; const messageTemplateLength = messageTemplate.length; const remainingLength = maxLineLength - messageTemplateLength; const matchRegex = new RegExp(`[\\s\\S]{1,${remainingLength}}`, 'g'); const linesArray = line.match(matchRegex) || []; linesArray.forEach(function(sendLine) { // Trying to prevent messages from irc echoing back and showing twice. if (ircDetails[discordServerId].lastPRIVMSG.indexOf(sendLine) < 0) { const lineToSend = parseDiscordLine(sendLine, discordServerId); const message = `${messageTemplate}${lineToSend}\r\n`; ircDetails[discordServerId].channels[channelName].joined.forEach(function(socketID) { sendToIRC(discordServerId, message, socketID); }); // Let's make people aware they are mentioned in channels they are not in. if (memberMentioned || memberDirectlyMentioned) { ircClients.forEach(function(socket) { if (socket.discordid === discordServerId && ircDetails[discordServerId].channels[channelName].joined.indexOf(socket.ircid) === -1) { const message = `:discordIRCd!notReallyA@User PRIVMSG discordIRCd :#${channelName}: ${lineToSend}\r\n`; sendToIRC(discordServerId, message, socket.ircid); } }); } } }); }); } } if (ircClients.length > 0 && msg.channel.type === 'dm') { const discordServerId = 'DMserver'; const authorDisplayName = msg.author.username; const authorIsBot = msg.author.bot; const authorDiscriminator = msg.author.discriminator; const authorIrcName = ircNickname(authorDisplayName, authorIsBot, authorDiscriminator); const recipientIsBot = msg.channel.recipient.bot; const recipientDiscriminator = msg.channel.recipient.discriminator; const recipient = ircNickname(msg.channel.recipient.username, recipientIsBot, recipientDiscriminator); let ownNickname; ircClients.forEach(function(socket) { if (socket.discordid === discordServerId) { ownNickname = socket.nickname; } }); let messageTemplate; if (authorIrcName === ownNickname) { messageTemplate = `:${authorIrcName}!${msg.author.id}@whatever PRIVMSG ${recipient} :`; } else { messageTemplate = `:${authorIrcName}!${msg.author.id}@whatever PRIVMSG ${ownNickname} :`; } // IRC does not handle newlines. So we split the message up per line and send them seperatly. const messageArray = msg.content.split(/\r?\n/); messageArray.forEach(function(line) { const messageTemplateLength = messageTemplate.length; const remainingLength = maxLineLength - messageTemplateLength; const matchRegex = new RegExp(`[\\s\\S]{1,${remainingLength}}`, 'g'); const linesArray = line.match(matchRegex) || []; linesArray.forEach(function(sendLine) { // Trying to prevent messages from irc echoing back and showing twice. if (ircDetails[discordServerId].lastPRIVMSG.indexOf(sendLine) < 0) { const lineToSend = parseDiscordLine(sendLine, discordServerId); const message = `${messageTemplate}${lineToSend}\r\n`; sendToIRC(discordServerId, message); } }); }); const attachmentArray = msg.attachments.array(); if (attachmentArray.length > 0) { attachmentArray.forEach(function(attachment) { const filename = attachment.filename; const url = attachment.url; const attachmentLine = `${filename}: ${url}`; const message = `${messageTemplate}${attachmentLine}\r\n`; sendToIRC(discordServerId, message); }); } } }); // Join command given, let's join the channel. function joinCommand(channel, discordID, socketID) { let members = ''; let memberListLines = []; const nickname = ircDetails[discordID].ircDisplayName; const memberlistTemplate = `:${configuration.ircServer.hostname} 353 ${nickname} @ #${channel} :`; const memberlistTemplateLength = memberlistTemplate.length; if (ircDetails[discordID].channels.hasOwnProperty(channel)) { const channelProperties = ircDetails[discordID].channels[channel]; const channelContent = discordClient.channels.get(channelProperties.id); ircDetails[discordID].channels[channel].joined.push(socketID); ircDetails[discordID].channels[channel]['members'] = {}; const channelTopic = channelProperties.topic; channelContent.members.array().forEach(function(member) { const isBot = member.user.bot; const discriminator = member.user.discriminator; const displayMember = ircNickname(member.displayName, isBot, discriminator); if (member.presence.status === 'online' || member.presence.status === 'idle' || member.presence.status === 'dnd' || (member.presence.status === 'offline' && configuration.showOfflineUsers)) { ircDetails[discordID].channels[channel].members[displayMember] = { discordName: member.displayName, discordState: member.presence.status, ircNick: displayMember, id: member.id }; const membersPlusDisplayMember = `${members} ${displayMember}`; const newLineLenght = membersPlusDisplayMember.length; const combinedLineLength = newLineLenght + memberlistTemplateLength; if (combinedLineLength < maxLineLength) { members = `${members} ${displayMember}`; } else { memberListLines.push(members); members = displayMember; } } }); memberListLines.push(members); const joinMSG = `:${nickname} JOIN #${channel}\r\n`; console.log(joinMSG); sendToIRC(discordID, joinMSG, socketID); // Setting the topic. const topicMSG = `:${configuration.ircServer.hostname} 332 ${nickname} #${channel} :${channelTopic}\r\n`; console.log(topicMSG); sendToIRC(discordID, topicMSG, socketID); const todayDate = new Date(); const seconds = todayDate.getTime() / 1000; const topicMSG2 = `:${configuration.ircServer.hostname} 333 ${nickname} #${channel} noboyknows!orCares@whatever ${seconds}\r\n`; sendToIRC(discordID, topicMSG2, socketID); memberListLines.forEach(function(line) { const memberListMSG = `${memberlistTemplate}${line}\r\n`; console.log(memberListMSG); sendToIRC(discordID, memberListMSG, socketID); }); const endListMSG = `:${configuration.ircServer.hostname} 366 ${nickname} #${channel} :End of /NAMES list.\r\n`; console.log(endListMSG); sendToIRC(discordID, endListMSG, socketID); const socketDetails = getSocketDetails(socketID); if (socketDetails.awayNotify) { for (let key in ircDetails[discordID].channels[channel].members) { if (ircDetails[discordID].channels[channel].members.hasOwnProperty(key)) { let member = ircDetails[discordID].channels[channel].members[key]; let nickname = member.ircNick; switch (member.discordState) { case 'idle': sendToIRC(discordID, `:${nickname}!${member.id}@whatever AWAY :Idle\r\n`, socketID); break; case 'dnd': sendToIRC(discordID, `:${nickname}!${member.id}@whatever AWAY :Do not disturb\r\n`, socketID); break; case 'offline': if (configuration.showOfflineUsers) { sendToIRC(discordID, `:${nickname}!${member.id}@whatever AWAY :Offline\r\n`, socketID); } break; } } } } } else { sendToIRC(discordID, `:${configuration.ircServer.hostname} 473 ${nickname} #${channel} :Cannot join channel\r\n`, socketID); } } // List command, let's give back a list of channels. function listCommand(discordID, ircID) { if (discordID === 'DMserver') return; const nickname = ircDetails[discordID].ircDisplayName; const channels = discordClient.guilds.get(discordID).channels.array(); let listResponse = [`:${configuration.ircServer.hostname} 321 ${nickname} Channel :Users Name\r\n`]; channels.forEach(function(channel) { if (channel.type === 'text') { const channelname = channel.name, memberCount = channel.members.array().length, channeltopic = channel.topic; const channelDetails = `:${configuration.ircServer.hostname} 322 ${nickname} #${channelname} ${memberCount} :${channeltopic}\r\n`; listResponse.push(channelDetails); } }); const endlist = `:${configuration.ircServer.hostname} 323 ${nickname} :End of channel list.\r\n`; listResponse.push(endlist); listResponse.forEach(function(line) { sendToIRC(discordID, line, ircID); }); } // Part command given, let's part the channel. function partCommand(channel, discordID, ircID) { const nickname = ircDetails[discordID].ircDisplayName; if (ircDetails[discordID].channels.hasOwnProperty(channel)) { // Let's clear the channel const socketIndex = ircDetails[discordID].channels[channel].joined.indexOf(ircID); if (socketIndex > -1) { ircDetails[discordID].channels[channel].joined.splice(socketIndex, 1); } // If no other sockets are connected we clear the channel. if (ircDetails[discordID].channels[channel].joined.length === 0) { ircDetails[discordID].channels[channel].members = {}; } sendToIRC(discordID, `:${nickname}!${discordClient.user.id}@whatever PART #${channel}\r\n`, ircID); } } function getDiscordUserFromIRC(recipient, discordID) { let returnmember; if (discordID === 'DMserver') { discordClient.users.array().forEach(function(user) { const isBot = user.bot; const discriminator = user.discriminator; const displayMember = ircNickname(user.username, isBot, discriminator); if (displayMember === recipient) { returnmember = user; } }); } else { discordClient.guilds.get(discordID).members.array().forEach(function(member) { const isBot = member.user.bot; const discriminator = member.user.discriminator; const displayMember = ircNickname(member.displayName, isBot, discriminator); if (displayMember === recipient) { returnmember = member; } }); } return returnmember; } // // Irc Related functionality. // let ircServer = net.createServer(netOptions, function(socket) { console.log('new socket'); socket.setEncoding('utf8'); ircClientCount++; socket.ircid = ircClientCount; socket.discordid = ''; socket.nickname = ''; socket.user = ''; socket.pongcount = 1; socket.isCAPBlocked = false; socket.authenticated = false; socket.connectArray = []; socket.awayNotify = false; socket.on('error', function(error) { console.log('Socket error: ', error); socket.end(); }); socket.on('data', function(data) { console.log('data:', data); // Data can be multiple lines. Here we put each line in an array. let dataArray = data.match(/.+/g); dataArray.forEach(function(line) { let parsedLine = parseMessage(line); // Dealing with IRC v3.1 capability negotiation. // http://ircv3.net/specs/core/capability-negotiation-3.1.html // v3.2 is also available but does not seem to add anything we need. if (parsedLine.command === 'CAP') { const capSubCommand = parsedLine.params[0]; let nickname; if (socket.nickname) { nickname = socket.nickname; } else { nickname = '*'; } switch (capSubCommand) { case 'LS': socket.isCAPBlocked = true; socket.write(`:${configuration.ircServer.hostname} CAP ${nickname} LS :away-notify\r\n`); break; case 'LIST': if (socket.awayNotify) { socket.write(`:${configuration.ircServer.hostname} CAP ${nickname} LIST :away-notify\r\n`); } else { socket.write(`:${configuration.ircServer.hostname} CAP ${nickname} LIST :\r\n`); } break; case 'REQ': const requestedCapabilities = parsedLine.params[1]; if (requestedCapabilities === 'away-notify') { socket.write(`:${configuration.ircServer.hostname} CAP ${nickname} ACK :away-notify\r\n`); socket.awayNotify = true; } else if (requestedCapabilities === '-away-notify') { socket.write(`:${configuration.ircServer.hostname} CAP ${nickname} ACK :-away-notify\r\n`); socket.awayNotify = false; } else { socket.write(`:${configuration.ircServer.hostname} CAP ${nickname} NAK :${requestedCapabilities}\r\n`); } socket.write(`:${configuration.ircServer.hostname} CAP ${nickname} ACK :${parsedLine.params[0]}\r\n`); break; case 'ACK': // Not expecting this from a client at this point. However we'll leave it in here for future use. break; case 'END': socket.isCAPBlocked = false; // Now we check if the user was already authenticated and the whole welcome thing has been send. if (socket.connectArray.length > 0) { socket.connectArray.forEach(function(line) { socket.write(line); }); // And empty it. socket.connectArray = []; } break; default: // We have no idea what we are dealing with. Inform the client. socket.write(`:${configuration.ircServer.hostname} 410 * ${capSubCommand} :Invalid CAP command\r\n`); break; } } if (!socket.authenticated) { switch (parsedLine.command) { case 'PASS': socket.discordid = parsedLine.params[0]; break; case 'NICK': socket.nickname = parsedLine.params[0]; break; case 'USER': // So different irc clients use different formats for user it seems. // TODO: figure out how to properly parse this. let username = parsedLine.params[0]; let usernameAlternative = parsedLine.params[3]; socket.user = username; let nickname = socket.nickname; // We are abusing some irc functionality here to add a tiny bit of security. // The username the ircclient gives must match with that in the configuration. // If the username is correct and the discordId can be found we are in bussiness. if (username === configuration.ircServer.username || usernameAlternative === configuration.ircServer.username) { // Now we are connected let's change the nickname first to whatever it is on discord. if (socket.discordid === 'DMserver') { const newuser = discordClient.user.username; const discriminator = discordClient.user.discriminator; const newNickname = ircNickname(newuser, false, discriminator); ircDetails[socket.discordid]['discordDisplayName'] = newuser; ircDetails[socket.discordid]['ircDisplayName'] = newNickname; socket.user = newuser; socket.nickname = newNickname; socket.authenticated = true; const connectArray = [ `:${nickname}!${discordClient.user.id}@whatever NICK ${newNickname}\r\n`, `:${configuration.ircServer.hostname} 001 ${newNickname} :Welcome to the fake Internet Relay Chat Network ${newNickname}\r\n`, `:${configuration.ircServer.hostname} 003 ${newNickname} :This server was created specifically for you\r\n` ]; connectArray.forEach(function(line) { socket.write(line); }); } else if (discordClient.guilds.get(socket.discordid)) { // I am fairly certain there must be a simpler way to find out... but I haven't found it yet. discordClient.guilds.get(socket.discordid).fetchMember(discordClient.user.id).then(function(guildMember) { const newuser = guildMember.displayName; const discriminator = discordClient.user.discriminator; const newNickname = ircNickname(newuser, false, discriminator); ircDetails[socket.discordid]['discordDisplayName'] = newuser; ircDetails[socket.discordid]['ircDisplayName'] = newNickname; socket.user = newuser; socket.nickname = newNickname; socket.authenticated = true; //console.log(`:${configuration.ircServer.hostname} NOTICE Auth :*** Looking up your hostname...\r\n`); const connectArray = [ `:${nickname}!${discordClient.user.id}@whatever NICK ${newNickname}\r\n`, `:${configuration.ircServer.hostname} 001 ${newNickname} :Welcome to the fake Internet Relay Chat Network ${newNickname}\r\n`, `:${configuration.ircServer.hostname} 003 ${newNickname} :This server was created specifically for you\r\n` ]; // If we are waiting on CAP negotiation we write the connection array to the socket and this will be processed once proper CAP END is received. if (socket.isCAPBlocked) { socket.connectArray = connectArray; } else { connectArray.forEach(function(line) { socket.write(line); }); } }); } else { // Things are not working out, let's end this. console.log(`${nickname}: Failed to connect to ${socket.discordid}`) socket.write(`:${configuration.ircServer.hostname} 464 ${nickname} :Failed to connect to ${socket.discordid}\r\n`); socket.end(); } } else { // Things are not working out, let's end this. console.log(`${nickname}: Invalid login, expected ${configuration.ircServer.username}, got ${username} (${usernameAlternative})`); socket.write(`:${configuration.ircServer.hostname} 464 ${nickname} :Invalid login. Make sure your username matches the username set in the config.\r\n`); socket.end(); } break; } } if (socket.authenticated && !socket.isCAPBlocked) { switch (parsedLine.command) { case 'JOIN': const joinChannels = parsedLine.params[0].split(','); joinChannels.forEach(function(channel) { joinCommand(channel.substring(1), socket.discordid, socket.ircid); }); break; case 'PART': const partChannels = parsedLine.params[0].split(','); partChannels.forEach(function(channel) { partCommand(channel.substring(1), socket.discordid, socket.ircid); }); break; case 'PRIVMSG': const recipient = parsedLine.params[0]; if (recipient.startsWith('#')) { const channelName = recipient.substring(1); const sendLine = parseIRCLine(parsedLine.params[1], socket.discordid, channelName); if (ircDetails[socket.discordid].lastPRIVMSG.length > 3) { ircDetails[socket.discordid].lastPRIVMSG.shift(); } ircDetails[socket.discordid].lastPRIVMSG.push(sendLine.trim()); discordClient.channels.get(ircDetails[socket.discordid].channels[channelName].id).sendMessage(sendLine); } else if (recipient !== 'discordIRCd') { const recipientUser = getDiscordUserFromIRC(recipient, socket.discordid); const sendLine = parsedLine.params[1]; recipientUser.sendMessage(sendLine); ircDetails[socket.discordid].lastPRIVMSG.push(sendLine.trim()); if (ircDetails[socket.discordid].lastPRIVMSG.length > 3) { ircDetails[socket.discordid].lastPRIVMSG.shift(); } if (socket.discordid !== 'DMserver') { const messageTemplate = `:${socket.nickname}!${discordClient.user.id}@whatever PRIVMSG ${recipient} :PM Send: Note that replies will not arrive here but on the PM server\r\n`; socket.write(messageTemplate); } if (ircDetails[socket.discordid].lastPRIVMSG.length > 3) { ircDetails[socket.discordid].lastPRIVMSG.shift(); } } break; case 'QUIT': for (let channel in ircDetails[socket.discordid].channels) { if (ircDetails[socket.discordid].channels.hasOwnProperty(channel) && ircDetails[socket.discordid].channels[channel].joined.indexOf(socket.ircid) > 0) { const socketIndex = ircDetails[socket.discordid].channels[channel].joined.indexOf(socket.ircid); if (socketIndex > -1) { ircDetails[socket.discordid].channels[channel].joined.splice(socketIndex, 1); } } } socket.end(); break; case 'PING': socket.write(`:${configuration.ircServer.hostname} PONG ${configuration.ircServer.hostname} :${socket.pongcount}\r\n`); socket.pongcount = socket.pongcount + 1; break; case 'LIST': listCommand(socket.discordid, socket.ircid); break; case 'WHOIS': const whoisUser = parsedLine.params[0].trim(); const userID = ircDetails[socket.discordid].members[whoisUser]; break; } } }); }); ircClients.push(socket); // When a client is ended we remove it from the list of clients. socket.on('end', function() { ircClients.splice(ircClients.indexOf(socket), 1); }); }); // Function for sending messages to the connect irc clients function sendToIRC(discordServerId, line, ircid = 0) { ircClients.forEach(function(socket) { if (socket.discordid === discordServerId && socket.authenticated && !socket.isCAPBlocked && (ircid === 0 || ircid === socket.ircid)) { socket.write(line); } }); } function getSocketDetails(socketID) { let socketDetails = {}; ircClients.forEach(function(socket) { if (socket.ircid === socketID) { socketDetails = { ircid: socket.ircid, discordid: socket.discordid, nickname: socket.nickname, user: socket.user, isCAPBlocked: socket.isCAPBlocked, authenticated: socket.authenticated, awayNotify: socket.awayNotify }; } }); return socketDetails; } // Sending notices to all connected clients. function sendGeneralNotice(noticeText) { ircClients.forEach(function(socket) { const notice = `:${configuration.ircServer.hostname} NOTICE ${socket.nickname} :${noticeText}\r\n`; socket.write(notice); }); } // We want to be able to kill the process without having to deal with leftover connections. process.on('SIGINT', function() { console.log('\nGracefully shutting down from SIGINT (Ctrl-C)'); sendGeneralNotice('IRC server has been shut down through SIGINT'); ircClients.forEach(function(socket) { socket.end(); }); discordClient.destroy(); ircServer.close(); process.exit(); });
let Table = require('table').table; let SpotifyGetter = require('./spotify-getters'); let Sync = require('deasync'); let opn = require('opn'); let lyric = require('lyric-get'); const SLEEP_TIME = 100; /** * Auxiliar method used to * synchronize the spotify promise. * * @param fn */ let synchronizePromise = fn => { let iterator = fn(); let loop = result => { !result.done && result.value.then(res => loop(iterator.next(res))); }; loop(iterator.next()); }; /** * Auxiliary method used to retrieve * data in a synchronous way from * a promise. * * @param promise Spotify promise. * @returns {*} the data retrieved. */ function retrieveDataSyncFrom(promise) { let data; synchronizePromise(function* () { data = yield promise; }); while(data === undefined) { Sync.sleep(SLEEP_TIME); } return data; } /** * Function used to give a good formatting * for the duration of the songs. * * @param millis milliseconds of the duration * of the song. * * @returns {string} that represents the time */ function convertTime(millis) { let minutes = Math.floor(millis / 60000); let seconds = ((millis % 60000) / 1000).toFixed(0); return minutes + ":" + (seconds < 10 ? '0' : '') + seconds; } /** * Auxiliary function used to log a table * with the given data. * * @param data */ function logTableData(data) { let table = [Object.getOwnPropertyNames(data)]; for (let i = 0; i < data.name.length; i += 1) { let elem = []; for (let field in data) { elem.push(data[field][i]); } table.push(elem); } let output = Table(table); console.log(output); } /** * This sync function returns an object with the specified * album information. * * @param albumName name of the album we want to search * @param artistName (optional) name of the artist of the album * * @returns {{name: Array, type: Array, artists: Array, release_date: Array}} * object with 4 properties, first is an array of names of albums, * types of this albums (single, album, recopilation...) * and finally the release date of the album. */ function getAlbumInfo(albumName, artistName) { if (albumName === undefined) { throw new SyntaxError('you must specify artist name.'); } let data = retrieveDataSyncFrom(SpotifyGetter.getAlbumInfo(albumName, artistName)); // Albums is an array of simplified album objects. let albums = data.body.albums.items; let simplifiedData = {name:[], type:[], artists:[], release_date:[]}; albums.forEach(function(album) { simplifiedData.name.push(album.name); simplifiedData.type.push(album.album_type); let artists = []; album.artists.forEach(function(artist) { artists.push(artist.name); }); simplifiedData.artists.push(artists); simplifiedData.release_date.push(album.release_date); }); return simplifiedData; } /** * Function that logs the album info * in a table. * * @param albumName name of the album we want. * @param artistName name of the artist of the album. */ function logAlbumInfo(albumName, artistName) { let data = getAlbumInfo(albumName, artistName); logTableData(data); } /** * Method that returns the tracks of an * album. * * @param albumName name of the album * @param artistName name of the artist of the album * * @returns {{track_number: Array, name: Array, artists: Array, duration: Array, popularity: Array}} * an array of the track number, an array with the names, an array with the duration, * an array with the popularity. */ function getAlbumTracks(albumName, artistName) { if (albumName === undefined || artistName === undefined) { throw new SyntaxError('you must specify album and artist name.'); } let data = retrieveDataSyncFrom( SpotifyGetter.getAlbumTracks(albumName, artistName)); let simplifiedData = {track_number:[], name:[], artists:[], duration:[], popularity:[]}; data.forEach(function(track) { simplifiedData.track_number.push(track.track_number); simplifiedData.name.push(track.name); let artists = []; track.artists.forEach(function(artist) { artists.push(artist.name); }); simplifiedData.artists.push(artists); simplifiedData.duration.push(convertTime(track.duration_ms)); simplifiedData.popularity.push(track.popularity + '%'); }); return simplifiedData; } /** * Method that logs the album tracks in * a table. * * @param albumName name of the album. * @param artistName name of the artist. */ function logAlbumTracks(albumName, artistName) { let data = getAlbumTracks(albumName, artistName); logTableData(data); } /** * Method that gets all the albums of the specified * artist. * * @param artistName name of the artist that we are searching. * @returns {{name: Array, type: Array, artists: Array, release_date: Array}} */ function getArtistAlbums(artistName) { if (artistName === undefined) { throw new SyntaxError('you must specify an artist name.'); } let albums = retrieveDataSyncFrom( SpotifyGetter.getArtistAlbums(artistName)); let simplifiedData = {name:[], type:[], artists:[], release_date:[]}; albums.forEach(function(album) { simplifiedData.name.push(album.name); simplifiedData.type.push(album.album_type); let artists = []; album.artists.forEach(function(artist) { artists.push(artist.name); }); simplifiedData.artists.push(artists); simplifiedData.release_date.push(album.release_date); }); return simplifiedData; } /** * Method that logs the artists albums in * a table. * * @param artistName */ function logArtistAlbums(artistName) { let data = getArtistAlbums(artistName); logTableData(data); } /** * Returns the artist top ten tracks ordered * by popularity in spain. * * @param artistName the artist we are searching * @returns {{name: Array, album: Array, artists: Array, duration: Array, popularity: Array}} */ function getArtistTopTracks(artistName) { let tracks = retrieveDataSyncFrom( SpotifyGetter.getArtistTopTracks(artistName)); let simplifiedData = {name:[], album:[], artists:[], duration:[], popularity:[]}; tracks.forEach(function(track) { simplifiedData.name.push(track.name); simplifiedData.album.push(track.album.name); let artists = []; track.artists.forEach(function(artist) { artists.push(artist.name); }); simplifiedData.artists.push(artists); simplifiedData.duration.push(convertTime(track.duration_ms)); simplifiedData.popularity.push(track.popularity + '%'); }); return simplifiedData; } /** * Logs the artist top ten tracks in * a table. * * @param artistName */ function logArtistTopTracks(artistName) { let data = getArtistTopTracks(artistName); logTableData(data); } /** * This method opens a browser with the specified * song * * @param trackName * @param artistName * @param albumName */ function playTrackPreview(trackName, artistName, albumName) { if (trackName === undefined) { throw new SyntaxError('track name should not be undefined'); } let url = retrieveDataSyncFrom( SpotifyGetter.getTrackPreviewURL(trackName, artistName, albumName)); if (url !== "") { opn(url); } else { console.log("can't reproduce current song."); } } /** * This method retrieve the lyrics of the current * song. * * @param trackName * @param artistName * @returns {*} */ function getLyrics(trackName, artistName) { if (trackName === undefined) { throw new SyntaxError('track name cant be undefined'); } if (artistName === undefined) { throw new SyntaxError('artist name cant be undefined'); } let lyrics; lyric.get(artistName, trackName, function(err, res){ if(err){ lyrics = 'lyric not found'; } else{ lyrics = res; } }); while(lyrics === undefined) { Sync.sleep(SLEEP_TIME); } return lyrics; } module.exports = {getAlbumInfo, logAlbumInfo, getAlbumTracks, logAlbumTracks, getArtistAlbums, logArtistAlbums, getArtistTopTracks, logArtistTopTracks, playTrackPreview, getLyrics};
var dir_ae3fad8e5a54a0227e1025074a3c0bce = [ [ "aitesconnector", "dir_fac261de60c27fb410950cc33f005ed7.html", "dir_fac261de60c27fb410950cc33f005ed7" ], [ "aitesmanager", "dir_16743d03958091cb360a5393a9cf9a0b.html", "dir_16743d03958091cb360a5393a9cf9a0b" ], [ "analyzer", "dir_8222f3cf4f5ab87038ce7afebccb0e33.html", "dir_8222f3cf4f5ab87038ce7afebccb0e33" ], [ "communicate", "dir_278c2cf891ddfc6424f0bcd774c2e22a.html", "dir_278c2cf891ddfc6424f0bcd774c2e22a" ], [ "dbcomponent", "dir_d72728175a58a6ed0944870cce992638.html", "dir_d72728175a58a6ed0944870cce992638" ], [ "executor", "dir_6fc7cdd41a7cb1875e3425c6c6406a64.html", "dir_6fc7cdd41a7cb1875e3425c6c6406a64" ], [ "framework", "dir_70d32ac7d46f4ef329cc3649eba60578.html", "dir_70d32ac7d46f4ef329cc3649eba60578" ], [ "globalknowledge", "dir_85bc630ff7452436d7b92cfe99d7c581.html", "dir_85bc630ff7452436d7b92cfe99d7c581" ], [ "log", "dir_657b386ebbf965ce85725fa3ce2de1c7.html", "dir_657b386ebbf965ce85725fa3ce2de1c7" ], [ "monitor", "dir_de62921a693303e1f2fcd00a75b2926a.html", "dir_de62921a693303e1f2fcd00a75b2926a" ], [ "orchestration", "dir_a60605f089b6653c5c39567223fedd94.html", "dir_a60605f089b6653c5c39567223fedd94" ], [ "planner", "dir_9fb6339305dd24f960f12d4ac14e669e.html", "dir_9fb6339305dd24f960f12d4ac14e669e" ], [ "rule", "dir_13e10a7b2508dac160eea2b55bb3eacc.html", "dir_13e10a7b2508dac160eea2b55bb3eacc" ], [ "ruleset", "dir_5b32b15b320c5b9f290e5128c93df251.html", "dir_5b32b15b320c5b9f290e5128c93df251" ], [ "smartmodule", "dir_d16a104f3d3142cbebb192c01f9dad79.html", "dir_d16a104f3d3142cbebb192c01f9dad79" ], [ "test", "dir_6f01eae12e223492f958f0518b248298.html", "dir_6f01eae12e223492f958f0518b248298" ] ];
/** * @license Apache-2.0 * * Copyright (c) 2018 The Stdlib Authors. * * 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. */ 'use strict'; // MODULES // var bench = require( '@stdlib/bench' ); var pow = require( '@stdlib/math-base-special-pow' ); var isUint32Array = require( '@stdlib/assert-is-uint32array' ); var pkg = require( './../package.json' ).name; var Uint32Array = require( './../lib' ); // FUNCTIONS // /** * Creates a benchmark function. * * @private * @param {PositiveInteger} len - array length * @returns {Function} benchmark function */ function createBenchmark( len ) { var arr = new Uint32Array( len ); return benchmark; /** * Benchmark function. * * @private * @param {Benchmark} b - benchmark instance */ function benchmark( b ) { var out; var i; b.tic(); for ( i = 0; i < b.iterations; i++ ) { arr[ 0 ] = i; out = arr.slice(); if ( typeof out !== 'object' ) { b.fail( 'should return an object' ); } } b.toc(); if ( !isUint32Array( out ) ) { b.fail( 'should return a Uint32Array' ); } b.pass( 'benchmark finished' ); b.end(); } } // MAIN // /** * Main execution sequence. * * @private */ function main() { var len; var min; var max; var f; var i; min = 1; // 10^min max = 6; // 10^max for ( i = min; i <= max; i++ ) { len = pow( 10, i ); f = createBenchmark( len ); bench( pkg+':slice:len='+len, f ); } } main();
flarum.core=function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=135)}([function(t,e,n){"use strict";function i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}n.d(e,"a",(function(){return i}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var i=n(2),r=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e=null),this.data=t,this.freshness=new Date,this.exists=!1,this.store=e}var e=t.prototype;return e.id=function(){return this.data.id},e.attribute=function(t){return this.data.attributes[t]},e.pushData=function(e){for(var n in e)if("object"==typeof e[n])for(var i in this.data[n]=this.data[n]||{},e[n])e[n][i]instanceof t&&(e[n][i]={data:t.getIdentifier(e[n][i])}),this.data[n][i]=e[n][i];else this.data[n]=e[n];this.freshness=new Date},e.pushAttributes=function(t){this.pushData({attributes:t})},e.save=function(e,n){var r=this;void 0===n&&(n={});var o={type:this.data.type,id:this.data.id,attributes:e};if(e.relationships){for(var s in o.relationships={},e.relationships){var a=e.relationships[s];o.relationships[s]={data:a instanceof Array?a.map(t.getIdentifier):t.getIdentifier(a)}}delete e.relationships}var c=this.copyData();this.pushData(o);var u={data:o};return n.meta&&(u.meta=n.meta),app.request(Object(i.a)({method:this.exists?"PATCH":"POST",url:app.forum.attribute("apiUrl")+this.apiEndpoint(),body:u},n)).then((function(t){return r.store.data[t.data.type]=r.store.data[t.data.type]||{},r.store.data[t.data.type][t.data.id]=r,r.store.pushPayload(t)}),(function(t){throw r.pushData(c),m.redraw(),t}))},e.delete=function(t,e){var n=this;return void 0===e&&(e={}),this.exists?app.request(Object(i.a)({method:"DELETE",url:app.forum.attribute("apiUrl")+this.apiEndpoint(),body:t},e)).then((function(){n.exists=!1,n.store.remove(n)})):Promise.resolve()},e.apiEndpoint=function(){return"/"+this.data.type+(this.exists?"/"+this.data.id:"")},e.copyData=function(){return JSON.parse(JSON.stringify(this.data))},t.attribute=function(t,e){return function(){var n=this.data.attributes&&this.data.attributes[t];return e?e(n):n}},t.hasOne=function(t){return function(){if(this.data.relationships){var e=this.data.relationships[t];if(e)return app.store.getById(e.data.type,e.data.id)}return!1}},t.hasMany=function(t){return function(){if(this.data.relationships){var e=this.data.relationships[t];if(e)return e.data.map((function(t){return app.store.getById(t.type,t.id)}))}return!1}},t.transformDate=function(t){return t?new Date(t):null},t.getIdentifier=function(t){return{type:t.data.type,id:t.data.id}},t}()},function(t,e,n){"use strict";function i(){return(i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}n.d(e,"a",(function(){return i}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var i=n(2),r=n(5),o=function(){function t(){Object(r.a)(this,"element",void 0),Object(r.a)(this,"attrs",void 0)}var e=t.prototype;return e.oninit=function(t){this.setAttrs(t.attrs)},e.oncreate=function(t){this.element=t.dom},e.onbeforeupdate=function(t){this.setAttrs(t.attrs)},e.$=function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){var e=$(this.element);return t?e.find(t):e})),t.component=function(t,e){void 0===t&&(t={}),void 0===e&&(e=null);var n=Object(i.a)({},t);return m(this,n,e)},e.setAttrs=function(t){if(void 0===t&&(t={}),this.constructor.initAttrs(t),t){if("children"in t)throw new Error("["+this.constructor.name+'] The "children" attribute of attrs should never be used. Either pass children in as the vnode children or rename the attribute');if("tag"in t)throw new Error("["+this.constructor.name+'] You cannot use the "tag" attribute name with Mithril 2.')}this.attrs=t},t.initAttrs=function(t){},t}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return d}));var i=n(2),r=n(0),o=n(3),s=n(7),a=n(16),c=n(10),u=n(9),l=n(18),d=function(t){function e(){return t.apply(this,arguments)||this}Object(r.a)(e,t);var n=e.prototype;return n.view=function(t){var e=Object(i.a)({},this.attrs);e.type=e.type||"button",e.title&&!t.children&&(e["aria-label"]=e.title),"object"==typeof e.title&&(e.title=Object(u.a)(e.title)),!e.title&&t.children&&(e.title=Object(u.a)(t.children));var n=Object(c.a)(e,"icon"),r=Object(c.a)(e,"loading");return(e.disabled||r)&&delete e.onclick,e.className=Object(a.a)([e.className,n&&"hasIcon",(e.disabled||r)&&"disabled",r&&"loading"]),m("button",e,this.getButtonContent(t.children))},n.getButtonContent=function(t){var e=this.attrs.icon;return[e&&!0!==e?Object(s.a)(e,{className:"Button-icon"}):"",t?m("span",{className:"Button-label"},t):"",this.attrs.loading?m(l.a,{size:"tiny",className:"LoadingIndicator--inline"}):""]},e}(o.a)},function(t,e,n){"use strict";function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}n.d(e,"a",(function(){return i}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var i=n(5),r=function(t,e){Object(i.a)(this,"content",void 0),Object(i.a)(this,"priority",void 0),Object(i.a)(this,"key",void 0),this.content=t,this.priority=e},o=function(){function t(){Object(i.a)(this,"items",{})}var e=t.prototype;return e.isEmpty=function(){for(var t in this.items)if(this.items.hasOwnProperty(t))return!1;return!0},e.has=function(t){return!!this.items[t]},e.get=function(t){return this.items[t].content},e.add=function(t,e,n){return void 0===n&&(n=0),this.items[t]=new r(e,n),this},e.replace=function(t,e,n){return void 0===e&&(e=null),void 0===n&&(n=null),this.items[t]&&(null!==e&&(this.items[t].content=e),null!==n&&(this.items[t].priority=n)),this},e.remove=function(t){return delete this.items[t],this},e.merge=function(t){for(var e in t.items)t.items.hasOwnProperty(e)&&t.items[e]instanceof r&&(this.items[e]=t.items[e]);return this},e.toArray=function(){var t=[];for(var e in this.items)this.items.hasOwnProperty(e)&&this.items[e]instanceof r&&(this.items[e].content=Object(this.items[e].content),this.items[e].content.itemName=e,t.push(this.items[e]),this.items[e].key=t.length);return t.sort((function(t,e){return t.priority===e.priority?t.key-e.key:t.priority>e.priority?-1:1})).map((function(t){return t.content}))},t}()},function(t,e,n){"use strict";function i(t,e){return void 0===e&&(e={}),e.className="icon "+t+" "+(e.className||""),m("i",e)}n.d(e,"a",(function(){return i}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var i=n(25),r=n(16);function o(t){return t.tag===i.a}function s(t){return t instanceof Array||(t=[t]),function(t){var e,n=[];return t.filter(Boolean).forEach((function(i,r){(!o(i)||e&&!o(e)&&r!==t.length-1)&&(e=i,n.push(i))})),n}(t).map((function(t){var e=t.tag&&t.tag.isListItem,n=t.tag&&t.tag.isActive&&t.tag.isActive(t.attrs),i=t.attrs&&t.attrs.itemClassName||t.itemClassName;return e&&(t.attrs=t.attrs||{},t.attrs.key=t.attrs.key||t.itemName,t.key=t.attrs.key),e?t:m("li",{className:Object(r.a)([i,t.itemName&&"item-"+t.itemName,n&&"active"]),key:t.attrs&&t.attrs.key||t.itemName},t)}))}},function(t,e,n){"use strict";function i(t){return t instanceof Array?t.map((function(t){return i(t)})).join(""):"object"==typeof t&&null!==t?t.children?i(t.children):t.text:t}n.d(e,"a",(function(){return i}))},function(t,e,n){"use strict";function i(t,e){var n=t[e];return delete t[e],n}n.d(e,"a",(function(){return i}))},function(t,e,n){"use strict";var i=n(100),r=n.n(i);e.a=r.a},function(t,e,n){"use strict";var i=n(2),r=n(0),o=n(1),s=function(t){function e(){return t.apply(this,arguments)||this}return Object(r.a)(e,t),e}(o.a);Object(i.a)(s.prototype,{nameSingular:o.a.attribute("nameSingular"),namePlural:o.a.attribute("namePlural"),color:o.a.attribute("color"),icon:o.a.attribute("icon"),isHidden:o.a.attribute("isHidden")}),s.ADMINISTRATOR_ID="1",s.GUEST_ID="2",s.MEMBER_ID="3",e.a=s},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var i=n(0),r=n(3),o=n(10),s=function(t){function e(){return t.apply(this,arguments)||this}return Object(i.a)(e,t),e.prototype.view=function(t){var e=t.attrs,n=e.options,i=void 0===n?{}:n,r=function(t,e){if(null==t)return{};var n,i,r={},o=Object.keys(t);for(i=0;i<o.length;i++)n=o[i],e.indexOf(n)>=0||(r[n]=t[n]);return r}(e,["options"]);r.href=r.href||"";var s=t.children||{tag:"#",children:t.text};return r.external?m("a",r,s):(r.href===m.route.get()&&("replace"in i||(i.replace=!0)),Object(o.a)(r,"force")&&("state"in i||(i.state={}),"key"in i.state||(i.state.key=Date.now())),r.options=i,m(m.route.Link,r,s))},e}(r.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return u}));var i=n(22),r=n(0),o=n(5),s=n(3),a=n(23),c=n(4),u=function(t){function e(){for(var e,n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return e=t.call.apply(t,[this].concat(r))||this,Object(o.a)(Object(i.a)(e),"alertAttrs",null),e}Object(r.a)(e,t);var n=e.prototype;return n.oncreate=function(e){var n=this;t.prototype.oncreate.call(this,e),this.attrs.animateShow((function(){return n.onready()}))},n.onbeforeremove=function(){if(!this.attrs.state.modal)return this.attrs.animateHide(),new Promise((function(t){return setTimeout(t,300)}))},n.view=function(){return this.alertAttrs&&(this.alertAttrs.dismissible=!1),m("div",{className:"Modal modal-dialog "+this.className()},m("div",{className:"Modal-content"},this.constructor.isDismissible?m("div",{className:"Modal-close App-backControl"},c.a.component({icon:"fas fa-times",onclick:this.hide.bind(this),className:"Button Button--icon Button--link"})):"",m("form",{onsubmit:this.onsubmit.bind(this)},m("div",{className:"Modal-header"},m("h3",{className:"App-titleControl App-titleControl--text"},this.title())),this.alertAttrs?m("div",{className:"Modal-alert"},a.a.component(this.alertAttrs)):"",this.content())))},n.className=function(){},n.title=function(){},n.content=function(){},n.onsubmit=function(){},n.onready=function(){this.$("form").find("input, select, textarea").first().focus().select()},n.hide=function(){this.attrs.state.close()},n.loaded=function(){this.loading=!1,m.redraw()},n.onerror=function(t){this.alertAttrs=t.alert,m.redraw(),422===t.status&&t.response.errors?this.$("form [name="+t.response.errors[0].source.pointer.replace("/data/attributes/","")+"]").select():this.onready()},e}(s.a);Object(o.a)(u,"isDismissible",!0)},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var i=n(0),r=n(4),o=n(13),s=function(t){function e(){return t.apply(this,arguments)||this}return Object(i.a)(e,t),e.initAttrs=function(e){t.initAttrs.call(this,e),e.active=this.isActive(e),void 0===e.force&&(e.force=!0)},e.prototype.view=function(e){var n=t.prototype.view.call(this,e);return n.tag=o.a,n.attrs.active=String(n.attrs.active),n},e.isActive=function(t){return void 0!==t.active?t.active:m.route.get()===t.href},e}(r.a)},function(t,e,n){"use strict";function i(t){var e;if(t instanceof Array)e=t.filter((function(t){return t}));else for(var n in e=[],t)t[n]&&e.push(n);return e.join(" ")}n.d(e,"a",(function(){return i}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return a}));var i=n(0),r=n(3),o=n(7),s=n(8),a=function(t){function e(){return t.apply(this,arguments)||this}Object(i.a)(e,t),e.initAttrs=function(t){t.className=t.className||"",t.buttonClassName=t.buttonClassName||"",t.menuClassName=t.menuClassName||"",t.label=t.label||"",t.caretIcon=void 0!==t.caretIcon?t.caretIcon:"fas fa-caret-down"};var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.showing=!1},n.view=function(t){var e=t.children?Object(s.a)(t.children):[];return m("div",{className:"ButtonGroup Dropdown dropdown "+this.attrs.className+" itemCount"+e.length+(this.showing?" open":"")},this.getButton(t.children),this.getMenu(e))},n.oncreate=function(e){var n=this;t.prototype.oncreate.call(this,e),this.$().on("shown.bs.dropdown",(function(){n.showing=!0,n.attrs.onshow&&n.attrs.onshow(),m.redraw();var t=n.$(".Dropdown-menu"),e=t.hasClass("Dropdown-menu--right");t.removeClass("Dropdown-menu--top Dropdown-menu--right"),t.toggleClass("Dropdown-menu--top",t.offset().top+t.height()>$(window).scrollTop()+$(window).height()),t.offset().top<0&&t.removeClass("Dropdown-menu--top"),t.toggleClass("Dropdown-menu--right",e||t.offset().left+t.width()>$(window).scrollLeft()+$(window).width())})),this.$().on("hidden.bs.dropdown",(function(){n.showing=!1,n.attrs.onhide&&n.attrs.onhide(),m.redraw()}))},n.getButton=function(t){return m("button",{className:"Dropdown-toggle "+this.attrs.buttonClassName,"data-toggle":"dropdown",onclick:this.attrs.onclick},this.getButtonContent(t))},n.getButtonContent=function(t){return[this.attrs.icon?Object(o.a)(this.attrs.icon,{className:"Button-icon"}):"",m("span",{className:"Button-label"},this.attrs.label),this.attrs.caretIcon?Object(o.a)(this.attrs.caretIcon,{className:"Button-caret"}):""]},n.getMenu=function(t){return m("ul",{className:"Dropdown-menu dropdown-menu "+this.attrs.menuClassName},t)},e}(r.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return v}));var i=n(2),r=n(0),o=n(3),s=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},a={lines:12,length:7,width:5,radius:10,scale:1,corners:1,color:"#000",fadeColor:"transparent",opacity:.25,rotate:0,direction:1,speed:1,trail:100,fps:20,zIndex:2e9,className:"spinner",top:"50%",left:"50%",shadow:"none",position:"absolute"},c=function(){function t(t){void 0===t&&(t={}),this.opts=s({},a,t)}return t.prototype.spin=function(t){var e,n,i,r=this;this.stop(),this.el=document.createElement("div"),this.el.className=this.opts.className,this.el.setAttribute("role","progressbar"),d(this.el,{position:this.opts.position,width:0,zIndex:this.opts.zIndex,left:this.opts.left,top:this.opts.top,transform:"scale("+this.opts.scale+")"}),t&&t.insertBefore(this.el,t.firstChild||null),"undefined"!=typeof requestAnimationFrame?(e=requestAnimationFrame,n=function(){return performance.now()}):(e=function(t){return setTimeout(t,1e3/r.opts.fps)},n=function(){return Date.now()});var o=0,s=function(){var t,a,c=n();if(void 0===i&&(i=c-1),o+=(t=c-i,a=r.opts.speed,t/1e3*a),i=c,o>1&&(o-=Math.floor(o)),r.el.childNodes.length===r.opts.lines)for(var l=0;l<r.opts.lines;l++){var d=u(l,o,r.opts);r.el.childNodes[l].childNodes[0].style.opacity=d.toString()}r.animateId=r.el?e(s):void 0};return function(t,e){var n=Math.round(e.corners*e.width*500)/1e3+"px",i="none";!0===e.shadow?i="0 2px 4px #000":"string"==typeof e.shadow&&(i=e.shadow);for(var r=function(t){for(var e=/^\s*([a-zA-Z]+\s+)?(-?\d+(\.\d+)?)([a-zA-Z]*)\s+(-?\d+(\.\d+)?)([a-zA-Z]*)(.*)$/,n=[],i=0,r=t.split(",");i<r.length;i++){var o=r[i].match(e);if(null!==o){var s=+o[2],a=+o[5],c=o[4],u=o[7];0!==s||c||(c=u),0!==a||u||(u=c),c===u&&n.push({prefix:o[1]||"",x:s,y:a,xUnits:c,yUnits:u,end:o[8]})}}return n}(i),o=0;o<e.lines;o++){var s=~~(360/e.lines*o+e.rotate),a=d(document.createElement("div"),{position:"absolute",top:-e.width/2+"px",width:e.length+e.width+"px",height:e.width+"px",background:p(e.fadeColor,o),borderRadius:n,transformOrigin:"left",transform:"rotate("+s+"deg) translateX("+e.radius+"px)"}),c=d(document.createElement("div"),{width:"100%",height:"100%",background:p(e.color,o),borderRadius:n,boxShadow:h(r,s),opacity:e.opacity});a.appendChild(c),t.appendChild(a)}}(this.el,this.opts),s(),this},t.prototype.stop=function(){return this.el&&("undefined"!=typeof requestAnimationFrame?cancelAnimationFrame(this.animateId):clearTimeout(this.animateId),this.el.parentNode&&this.el.parentNode.removeChild(this.el),this.el=void 0),this},t}();function u(t,e,n){var i=e-(t+1)/n.lines*n.direction;(i<0||i>1)&&(i+=n.direction);var r=1-i/(n.trail/100);return r<0?n.opacity:r*(1-n.opacity)+n.opacity}function l(t,e){if(void 0!==t.style[e])return e;var n="ms"+e.charAt(0).toUpperCase()+e.slice(1);return void 0!==t.style[n]?n:""}function d(t,e){for(var n in e)t.style[l(t,n)||n]=e[n];return t}function p(t,e){return"string"==typeof t?t:t[e%t.length]}function h(t,e){for(var n=[],i=0,r=t;i<r.length;i++){var o=r[i],s=f(o.x,o.y,e);n.push(o.prefix+s[0]+o.xUnits+" "+s[1]+o.yUnits+o.end)}return n.join(", ")}function f(t,e,n){var i=n*Math.PI/180,r=Math.sin(i),o=Math.cos(i);return[Math.round(1e3*(t*o+e*r))/1e3,Math.round(1e3*(-t*r+e*o))/1e3]}var v=function(t){function e(){return t.apply(this,arguments)||this}Object(r.a)(e,t);var n=e.prototype;return n.view=function(){var t=Object(i.a)({},this.attrs);return t.className="LoadingIndicator "+(t.className||""),delete t.size,m("div",t,m.trust("&nbsp;"))},n.oncreate=function(e){t.prototype.oncreate.call(this,e);var n={zIndex:"auto",color:this.$().css("color")};switch(this.attrs.size){case"large":Object(i.a)(n,{lines:10,length:8,width:4,radius:8});break;case"tiny":Object(i.a)(n,{lines:8,length:2,width:2,radius:3});break;default:Object(i.a)(n,{lines:8,length:4,width:3,radius:5})}new c(n).spin(this.element)},e}(o.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var i=n(2);function r(t,e){void 0===e&&(e={}),e.className="Avatar "+(e.className||"");var n="",r="undefined"===e.title||e.title;if(r||delete e.title,t){var o=t.displayName()||"?",s=t.avatarUrl();if(r&&(e.title=e.title||o),s)return m("img",Object(i.a)({},e,{src:s,alt:""}));n=o.charAt(0).toUpperCase(),e.style={background:t.color()}}return m("span",e,n)}},function(t,e,n){"use strict";function i(t){var e=t&&t.displayName()||app.translator.trans("core.lib.username.deleted_text");return m("span",{className:"username"},e)}n.d(e,"a",(function(){return i}))},function(t,e,n){"use strict";function i(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var i,r=e.slice(0,-1),o=e.slice(-1)[0],s={};return function(){var t=this,e=!1;return r.forEach((function(n){var i="function"==typeof t[n]?t[n]():t[n];s[n]!==i&&(e=!0,s[n]=i)})),e&&(i=o.apply(this,r.map((function(t){return s[t]})))),i}}n.d(e,"a",(function(){return i}))},function(t,e,n){"use strict";function i(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}n.d(e,"a",(function(){return i}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return u}));var i=n(2),r=n(0),o=n(3),s=n(4),a=n(8),c=n(10),u=function(t){function e(){return t.apply(this,arguments)||this}return Object(r.a)(e,t),e.prototype.view=function(t){var e=Object(i.a)({},this.attrs),n=Object(c.a)(e,"type");e.className="Alert Alert--"+n+" "+(e.className||"");var r=Object(c.a)(e,"content")||t.children,o=Object(c.a)(e,"controls")||[],u=Object(c.a)(e,"dismissible"),l=Object(c.a)(e,"ondismiss"),d=[];return(u||void 0===u)&&d.push(m(s.a,{icon:"fas fa-times",className:"Button Button--link Button--icon Alert-dismiss",onclick:l})),m("div",e,m("span",{className:"Alert-body"},r),m("ul",{className:"Alert-controls"},Object(a.a)(o.concat(d))))},e}(o.a)},function(t,e,n){"use strict";var i=n(78).a.Symbol;e.a=i},function(t,e,n){"use strict";var i=n(0),r=function(t){function e(){return t.apply(this,arguments)||this}return Object(i.a)(e,t),e.prototype.view=function(){return m("li",{className:"Dropdown-separator"})},e}(n(3).a);r.isListItem=!0,e.a=r},function(t,e,n){t.exports=function(){"use strict";var t="millisecond",e="second",n="minute",i="hour",r="day",o="week",s="month",a="quarter",c="year",u="date",l=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,d=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,p={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},h=function(t,e,n){var i=String(t);return!i||i.length>=e?t:""+Array(e+1-i.length).join(n)+t},f={s:h,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),i=Math.floor(n/60),r=n%60;return(e<=0?"+":"-")+h(i,2,"0")+":"+h(r,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var i=12*(n.year()-e.year())+(n.month()-e.month()),r=e.clone().add(i,s),o=n-r<0,a=e.clone().add(i+(o?-1:1),s);return+(-(i+(n-r)/(o?r-a:a-r))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(l){return{M:s,y:c,w:o,d:r,D:u,h:i,m:n,s:e,ms:t,Q:a}[l]||String(l||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},m="en",v={};v[m]=p;var g=function(t){return t instanceof x},b=function(t,e,n){var i;if(!t)return m;if("string"==typeof t)v[t]&&(i=t),e&&(v[t]=e,i=t);else{var r=t.name;v[r]=t,i=r}return!n&&i&&(m=i),i||!n&&m},y=function(t,e){if(g(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new x(n)},w=f;w.l=b,w.i=g,w.w=function(t,e){return y(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var x=function(){function p(t){this.$L=b(t.locale,null,!0),this.parse(t)}var h=p.prototype;return h.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(w.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var i=e.match(l);if(i){var r=i[2]-1||0,o=(i[7]||"0").substring(0,3);return n?new Date(Date.UTC(i[1],r,i[3]||1,i[4]||0,i[5]||0,i[6]||0,o)):new Date(i[1],r,i[3]||1,i[4]||0,i[5]||0,i[6]||0,o)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},h.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},h.$utils=function(){return w},h.isValid=function(){return!("Invalid Date"===this.$d.toString())},h.isSame=function(t,e){var n=y(t);return this.startOf(e)<=n&&n<=this.endOf(e)},h.isAfter=function(t,e){return y(t)<this.startOf(e)},h.isBefore=function(t,e){return this.endOf(e)<y(t)},h.$g=function(t,e,n){return w.u(t)?this[e]:this.set(n,t)},h.unix=function(){return Math.floor(this.valueOf()/1e3)},h.valueOf=function(){return this.$d.getTime()},h.startOf=function(t,a){var l=this,d=!!w.u(a)||a,p=w.p(t),h=function(t,e){var n=w.w(l.$u?Date.UTC(l.$y,e,t):new Date(l.$y,e,t),l);return d?n:n.endOf(r)},f=function(t,e){return w.w(l.toDate()[t].apply(l.toDate("s"),(d?[0,0,0,0]:[23,59,59,999]).slice(e)),l)},m=this.$W,v=this.$M,g=this.$D,b="set"+(this.$u?"UTC":"");switch(p){case c:return d?h(1,0):h(31,11);case s:return d?h(1,v):h(0,v+1);case o:var y=this.$locale().weekStart||0,x=(m<y?m+7:m)-y;return h(d?g-x:g+(6-x),v);case r:case u:return f(b+"Hours",0);case i:return f(b+"Minutes",1);case n:return f(b+"Seconds",2);case e:return f(b+"Milliseconds",3);default:return this.clone()}},h.endOf=function(t){return this.startOf(t,!1)},h.$set=function(o,a){var l,d=w.p(o),p="set"+(this.$u?"UTC":""),h=(l={},l[r]=p+"Date",l[u]=p+"Date",l[s]=p+"Month",l[c]=p+"FullYear",l[i]=p+"Hours",l[n]=p+"Minutes",l[e]=p+"Seconds",l[t]=p+"Milliseconds",l)[d],f=d===r?this.$D+(a-this.$W):a;if(d===s||d===c){var m=this.clone().set(u,1);m.$d[h](f),m.init(),this.$d=m.set(u,Math.min(this.$D,m.daysInMonth())).$d}else h&&this.$d[h](f);return this.init(),this},h.set=function(t,e){return this.clone().$set(t,e)},h.get=function(t){return this[w.p(t)]()},h.add=function(t,a){var u,l=this;t=Number(t);var d=w.p(a),p=function(e){var n=y(l);return w.w(n.date(n.date()+Math.round(e*t)),l)};if(d===s)return this.set(s,this.$M+t);if(d===c)return this.set(c,this.$y+t);if(d===r)return p(1);if(d===o)return p(7);var h=(u={},u[n]=6e4,u[i]=36e5,u[e]=1e3,u)[d]||1,f=this.$d.getTime()+t*h;return w.w(f,this)},h.subtract=function(t,e){return this.add(-1*t,e)},h.format=function(t){var e=this;if(!this.isValid())return"Invalid Date";var n=t||"YYYY-MM-DDTHH:mm:ssZ",i=w.z(this),r=this.$locale(),o=this.$H,s=this.$m,a=this.$M,c=r.weekdays,u=r.months,l=function(t,i,r,o){return t&&(t[i]||t(e,n))||r[i].substr(0,o)},p=function(t){return w.s(o%12||12,t,"0")},h=r.meridiem||function(t,e,n){var i=t<12?"AM":"PM";return n?i.toLowerCase():i},f={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:w.s(a+1,2,"0"),MMM:l(r.monthsShort,a,u,3),MMMM:l(u,a),D:this.$D,DD:w.s(this.$D,2,"0"),d:String(this.$W),dd:l(r.weekdaysMin,this.$W,c,2),ddd:l(r.weekdaysShort,this.$W,c,3),dddd:c[this.$W],H:String(o),HH:w.s(o,2,"0"),h:p(1),hh:p(2),a:h(o,s,!0),A:h(o,s,!1),m:String(s),mm:w.s(s,2,"0"),s:String(this.$s),ss:w.s(this.$s,2,"0"),SSS:w.s(this.$ms,3,"0"),Z:i};return n.replace(d,(function(t,e){return e||f[t]||i.replace(":","")}))},h.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},h.diff=function(t,u,l){var d,p=w.p(u),h=y(t),f=6e4*(h.utcOffset()-this.utcOffset()),m=this-h,v=w.m(this,h);return v=(d={},d[c]=v/12,d[s]=v,d[a]=v/3,d[o]=(m-f)/6048e5,d[r]=(m-f)/864e5,d[i]=m/36e5,d[n]=m/6e4,d[e]=m/1e3,d)[p]||m,l?v:w.a(v)},h.daysInMonth=function(){return this.endOf(s).$D},h.$locale=function(){return v[this.$L]},h.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),i=b(t,e,!0);return i&&(n.$L=i),n},h.clone=function(){return w.w(this.$d,this)},h.toDate=function(){return new Date(this.valueOf())},h.toJSON=function(){return this.isValid()?this.toISOString():null},h.toISOString=function(){return this.$d.toISOString()},h.toString=function(){return this.$d.toUTCString()},p}(),N=x.prototype;return y.prototype=N,[["$ms",t],["$s",e],["$m",n],["$H",i],["$W",r],["$M",s],["$y",c],["$D",u]].forEach((function(t){N[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),y.extend=function(t,e){return t.$i||(t(e,x,y),t.$i=!0),y},y.locale=b,y.isDayjs=g,y.unix=function(t){return y(1e3*t)},y.en=v[m],y.Ls=v,y.p={},y}()},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var i=n(26),r=n.n(i);n(76);function o(t){var e=r()(t),n=r()();e.isAfter(n)&&(e=n);return e.diff(r()())<-2592e6?e.year()===r()().year()?e.format("D MMM"):e.format("ll"):e.fromNow()}},function(t,e,n){"use strict";n.d(e,"a",(function(){return c}));var i=n(2),r=n(0),o=n(3),s=n(7),a=n(10),c=function(t){function e(){return t.apply(this,arguments)||this}Object(r.a)(e,t);var n=e.prototype;return n.view=function(){var t=Object(i.a)({},this.attrs),e=Object(a.a)(t,"type"),n=Object(a.a)(t,"icon");return t.className="Badge "+(e?"Badge--"+e:"")+" "+(t.className||""),t.title=Object(a.a)(t,"label")||"",m("span",t,n?Object(s.a)(n,{className:"Badge-icon"}):m.trust("&nbsp;"))},n.oncreate=function(e){t.prototype.oncreate.call(this,e),this.attrs.label&&this.$().tooltip()},e}(o.a)},function(t,e,n){"use strict";function i(t,e,n,i,r,o){return{tag:t,key:e,attrs:n,children:i,text:r,dom:o,domSize:void 0,state:void 0,events:void 0,instance:void 0}}i.normalize=function(t){return Array.isArray(t)?i("[",void 0,void 0,i.normalizeChildren(t),void 0,void 0):null==t||"boolean"==typeof t?null:"object"==typeof t?t:i("#",void 0,void 0,String(t),void 0,void 0)},i.normalizeChildren=function(t){var e=[];if(t.length){for(var n=null!=t[0]&&null!=t[0].key,r=1;r<t.length;r++)if((null!=t[r]&&null!=t[r].key)!==n)throw new TypeError("Vnodes must either always have keys or never have keys!");for(r=0;r<t.length;r++)e[r]=i.normalize(t[r])}return e},t.exports=i},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var i=n(0),r=n(3),o=n(48),s=function(t){function e(){return t.apply(this,arguments)||this}Object(i.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),app.previous=app.current,app.current=new o.a(this.constructor,{routeName:this.attrs.routeName}),app.drawer.hide(),app.modal.close(),this.bodyClass="",this.scrollTopOnCreate=!0,this.useBrowserScrollRestoration=!0},n.oncreate=function(e){t.prototype.oncreate.call(this,e),this.bodyClass&&$("#app").addClass(this.bodyClass),this.scrollTopOnCreate&&$(window).scrollTop(0),"scrollRestoration"in history&&(history.scrollRestoration=this.useBrowserScrollRestoration?"auto":"manual")},n.onremove=function(){this.bodyClass&&$("#app").removeClass(this.bodyClass)},e}(r.a)},function(t,e,n){"use strict";function i(t,e,n){return void 0===n&&(n=0),(n>0?"...":"")+t.substring(n,n+e)+(t.length>n+e?"...":"")}function r(t){return t.toLowerCase().replace(/[^a-z0-9]/gi,"-").replace(/-+/g,"-").replace(/-$|^-/g,"")}function o(t){var e=t.replace(/(<\/p>|<br>)/g,"$1 &nbsp;").replace(/<img\b[^>]*>/gi," "),n=$("<div/>").html(e);return n.find(o.removeSelectors.join(",")).remove(),n.text().replace(/\s+/g," ").trim()}function s(t){return t.substr(0,1).toUpperCase()+t.substr(1)}n.r(e),n.d(e,"truncate",(function(){return i})),n.d(e,"slug",(function(){return r})),n.d(e,"getPlainContent",(function(){return o})),n.d(e,"ucfirst",(function(){return s})),o.removeSelectors=["blockquote","script"]},function(t,e,n){"use strict";n.d(e,"a",(function(){return a}));var i=n(0),r=n(17),o=n(7);function s(t){var e=t.tag;return("string"!=typeof e||"a"===e||"button"===e)&&("initAttrs"in e&&e.initAttrs(t.attrs),"isActive"in e?e.isActive(t.attrs):t.attrs.active)}var a=function(t){function e(){return t.apply(this,arguments)||this}return Object(i.a)(e,t),e.initAttrs=function(e){e.caretIcon=void 0!==e.caretIcon?e.caretIcon:"fas fa-sort",t.initAttrs.call(this,e),e.className+=" Dropdown--select"},e.prototype.getButtonContent=function(t){var e=t.find(s),n=e&&e.children||this.attrs.defaultLabel;return n instanceof Array&&(n=n[0]),[m("span",{className:"Button-label"},n),Object(o.a)(this.attrs.caretIcon,{className:"Button-caret"})]},e}(r.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var i=n(0),r=function(t){function e(){return t.apply(this,arguments)||this}return Object(i.a)(e,t),e.initAttrs=function(e){t.initAttrs.call(this,e),e.group&&(e.icon=e.group.icon(),e.style={backgroundColor:e.group.color()},e.label=void 0===e.label?e.group.nameSingular():e.label,e.type="group--"+e.group.id(),delete e.group)},e}(n(29).a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var i=n(32);function r(t,e,n){if(!e&&!n)return t;var r=e instanceof RegExp?e:new RegExp(e,"gi"),o=t,s=0;return n&&(e&&(s=Math.max(0,t.search(r)-n/2)),o=Object(i.truncate)(o,n,s)),o=$("<div/>").text(o).html(),e&&(o=o.replace(r,"<mark>$&</mark>")),m.trust(o)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var i=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)},r=function(){function t(t){this.callback=t,this.ticking=!1}var e=t.prototype;return e.loop=function(){var t=this;this.ticking||(i((function(){t.update(),t.ticking=!1})),this.ticking=!0)},e.update=function(){this.callback(window.pageYOffset)},e.start=function(){this.active||window.addEventListener("scroll",this.active=this.loop.bind(this),{passive:!0})},e.stop=function(){window.removeEventListener("scroll",this.active),this.active=null},t}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var i=n(0),r=function(t){function e(){return t.apply(this,arguments)||this}return Object(i.a)(e,t),e.initAttrs=function(e){t.initAttrs.call(this,e),e.className=(e.className||"")+" Checkbox--switch"},e.prototype.getDisplay=function(){return this.attrs.loading?t.prototype.getDisplay.call(this):""},e}(n(47).a)},function(t,e,n){"use strict";e.a=function(t,e){return function(){e(this.getAttribute(t)||this[t])}}},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var i=n(2),r=n(5),o=function(){function t(t,e){Object(r.a)(this,"component",void 0),Object(r.a)(this,"routeName",void 0),this.component=t,this.routeName=e}var e=t.prototype;return e.makeKey=function(){return this.routeName+JSON.stringify(m.route.param())},e.makeAttrs=function(t){return Object(i.a)({},t.attrs,{routeName:this.routeName})},e.onmatch=function(t,e,n){return this.component},e.render=function(t){return[Object(i.a)({},t,{attrs:this.makeAttrs(t),key:this.makeKey()})]},t}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var i=n(5),r=n(99),o=n.n(r),s=function(){function t(t,e){Object(i.a)(this,"el",void 0),this.el=document.createElement("textarea"),this.build(t,e)}var e=t.prototype;return e.build=function(t,e){var n=this;this.el.className=e.classNames.join(" "),this.el.disabled=e.disabled,this.el.placeholder=e.placeholder,this.el.value=e.value;var i=function(t){e.inputListeners.forEach((function(t){t()})),t.redraw=!1};this.el.oninput=function(t){e.oninput(n.el.value),i(t)},this.el.onclick=i,this.el.onkeyup=i,this.el.addEventListener("keydown",(function(t){(t.metaKey||t.ctrlKey)&&"Enter"===t.key&&e.onsubmit()})),t.append(this.el)},e.setValue=function(t){$(this.el).val(t).trigger("input"),this.el.dispatchEvent(new CustomEvent("input",{bubbles:!0,cancelable:!0}))},e.moveCursorTo=function(t){this.setSelectionRange(t,t)},e.getSelectionRange=function(){return[this.el.selectionStart,this.el.selectionEnd]},e.getLastNChars=function(t){return this.el.value.slice(Math.max(0,this.el.selectionStart-t),this.el.selectionStart)},e.insertAtCursor=function(t){this.insertAt(this.el.selectionStart,t)},e.insertAt=function(t,e){this.insertBetween(t,t,e)},e.insertBetween=function(t,e,n){var i=this.el.value,r=i.slice(0,t),o=i.slice(e);this.setValue(""+r+n+o),this.moveCursorTo(t+n.length)},e.replaceBeforeCursor=function(t,e){this.insertBetween(t,this.el.selectionStart,e)},e.setSelectionRange=function(t,e){this.el.setSelectionRange(t,e),this.focus()},e.getCaretCoordinates=function(t){var e=o()(this.el,t);return{top:e.top-this.el.scrollTop,left:e.left}},e.disabled=function(t){this.el.disabled=t},e.focus=function(){this.el.focus()},e.destroy=function(){this.el.remove()},t}()},function(t,e,n){"use strict";n.r(e),n.d(e,"extend",(function(){return r})),n.d(e,"override",(function(){return o}));var i=n(2);function r(t,e,n){var r=t[e];t[e]=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var o=r?r.apply(this,e):void 0;return n.apply(this,[o].concat(e)),o},Object(i.a)(t[e],r)}function o(t,e,n){var r=t[e];t[e]=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return n.apply(this,[r.bind(this)].concat(e))},Object(i.a)(t[e],r)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var i=n(0),r=n(3),o=n(8),s=function(t){function e(){return t.apply(this,arguments)||this}return Object(i.a)(e,t),e.prototype.view=function(t){return m("fieldset",{className:this.attrs.className},m("legend",null,this.attrs.label),m("ul",null,Object(o.a)(t.children)))},e}(r.a)},function(t,e,n){"use strict";function i(t,e){return t&&(t===e||t.prototype instanceof e)}n.d(e,"a",(function(){return i}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var i=n(26),r=n.n(i),o=n(28);function s(t){var e=r()(t),n=e.format(),i=e.format("LLLL"),s=Object(o.a)(t);return m("time",{pubdate:!0,datetime:n,title:i,"data-humantime":!0},s)}},function(t,e,n){"use strict";e.a=function(t){return null!=t&&"object"==typeof t}},function(t,e,n){"use strict";n.d(e,"a",(function(){return u}));var i=n(2),r=n(0),o=n(1),s=n(21),a=n(6),c=n(29),u=function(t){function e(){return t.apply(this,arguments)||this}return Object(r.a)(e,t),e}(o.a);Object(i.a)(u.prototype,{title:o.a.attribute("title"),slug:o.a.attribute("slug"),createdAt:o.a.attribute("createdAt",o.a.transformDate),user:o.a.hasOne("user"),firstPost:o.a.hasOne("firstPost"),lastPostedAt:o.a.attribute("lastPostedAt",o.a.transformDate),lastPostedUser:o.a.hasOne("lastPostedUser"),lastPost:o.a.hasOne("lastPost"),lastPostNumber:o.a.attribute("lastPostNumber"),commentCount:o.a.attribute("commentCount"),replyCount:Object(s.a)("commentCount",(function(t){return Math.max(0,t-1)})),posts:o.a.hasMany("posts"),mostRelevantPost:o.a.hasOne("mostRelevantPost"),lastReadAt:o.a.attribute("lastReadAt",o.a.transformDate),lastReadPostNumber:o.a.attribute("lastReadPostNumber"),isUnread:Object(s.a)("unreadCount",(function(t){return!!t})),isRead:Object(s.a)("unreadCount",(function(t){return app.session.user&&!t})),hiddenAt:o.a.attribute("hiddenAt",o.a.transformDate),hiddenUser:o.a.hasOne("hiddenUser"),isHidden:Object(s.a)("hiddenAt",(function(t){return!!t})),canReply:o.a.attribute("canReply"),canRename:o.a.attribute("canRename"),canHide:o.a.attribute("canHide"),canDelete:o.a.attribute("canDelete"),removePost:function(t){var e=this.data.relationships,n=e&&e.posts;n&&n.data.some((function(e,i){if(t===e.id)return n.data.splice(i,1),!0}))},unreadCount:function(){var t=app.session.user;if(t&&t.markedAllAsReadAt()<this.lastPostedAt()){var e=Math.max(0,this.lastPostNumber()-(this.lastReadPostNumber()||0));return Math.min(e,this.commentCount())}return 0},badges:function(){var t=new a.a;return this.isHidden()&&t.add("hidden",m(c.a,{type:"hidden",icon:"fas fa-trash",label:app.translator.trans("core.lib.badge.hidden_tooltip")})),t},postIds:function(){var t=this.data.relationships.posts;return t?t.data.map((function(t){return t.id})):[]}})},function(t,e,n){"use strict";n.d(e,"a",(function(){return u}));var i=n(0),r=n(3),o=n(18),s=n(7),a=n(16),c=n(38),u=function(t){function e(){return t.apply(this,arguments)||this}Object(i.a)(e,t);var n=e.prototype;return n.view=function(t){"0"===this.attrs.state&&(this.attrs.state=!1);var e=Object(a.a)(["Checkbox",this.attrs.state?"on":"off",this.attrs.className,this.attrs.loading&&"loading",this.attrs.disabled&&"disabled"]);return m("label",{className:e},m("input",{type:"checkbox",checked:this.attrs.state,disabled:this.attrs.disabled,onchange:Object(c.a)("checked",this.onchange.bind(this))}),m("div",{className:"Checkbox-display"},this.getDisplay()),t.children)},n.getDisplay=function(){return this.attrs.loading?m(o.a,{size:"tiny"}):Object(s.a)(this.attrs.state?"fas fa-check":"fas fa-times")},n.onchange=function(t){this.attrs.onchange&&this.attrs.onchange(t,this)},e}(r.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var i=n(43),r=function(){function t(t,e){void 0===e&&(e={}),this.type=t,this.data=e}var e=t.prototype;return e.matches=function(t,e){var n=this;return void 0===e&&(e={}),!!Object(i.a)(this.type,t)&&Object.keys(e).every((function(t){return n.data[t]===e[t]}))},e.get=function(t){return this.data[t]},e.set=function(t,e){this.data[t]=e},t}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var i=n(5),r=function(t,e,n,r){Object(i.a)(this,"status",void 0),Object(i.a)(this,"options",void 0),Object(i.a)(this,"xhr",void 0),Object(i.a)(this,"responseText",void 0),Object(i.a)(this,"response",void 0),Object(i.a)(this,"alert",void 0),this.status=t,this.responseText=e,this.options=n,this.xhr=r;try{this.response=JSON.parse(e)}catch(t){this.response=null}this.alert=null}},function(t,e,n){"use strict";n.d(e,"a",(function(){return a}));var i=n(0),r=n(3),o=n(4),s=n(15),a=function(t){function e(){return t.apply(this,arguments)||this}Object(i.a)(e,t);var n=e.prototype;return n.view=function(){var t=app,e=t.history,n=t.pane;return m("div",{className:"Navigation ButtonGroup "+(this.attrs.className||""),onmouseenter:n&&n.show.bind(n),onmouseleave:n&&n.onmouseleave.bind(n)},e.canGoBack()?[this.getBackButton(),this.getPaneButton()]:this.getDrawerButton())},n.getBackButton=function(){var t=app.history,e=t.getPrevious()||{};return s.a.component({className:"Button Navigation-back Button--icon",href:t.backUrl(),icon:"fas fa-chevron-left",title:e.title,onclick:function(e){e.shiftKey||e.ctrlKey||e.metaKey||2===e.which||(e.preventDefault(),t.back())}})},n.getPaneButton=function(){var t=app.pane;return t&&t.active?o.a.component({className:"Button Button--icon Navigation-pin"+(t.pinned?" active":""),onclick:t.togglePinned.bind(t),icon:"fas fa-thumbtack"}):""},n.getDrawerButton=function(){if(!this.attrs.drawer)return"";var t=app.drawer,e=app.session.user;return o.a.component({className:"Button Button--icon Navigation-drawer"+(e&&e.newNotificationCount()?" new":""),onclick:function(e){e.stopPropagation(),t.show()},icon:"fas fa-bars"})},e}(r.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var i=n(2);function r(t,e,n){void 0===e&&(e=null),void 0===n&&(n={});var r=Object(i.a)({},n);r.state=r.state||{},r.state.key=Date.now(),m.route.set(t,e,r)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var i=function(){function t(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];this.callbacks=e,this.data={},this.needsRebuild()}var e=t.prototype;return e.needsRebuild=function(){var t=this,e=!1;return this.callbacks.forEach((function(n,i){var r=n();r!==t.data[i]&&(t.data[i]=r,e=!0)})),e},e.check=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];this.callbacks=this.callbacks.concat(e),this.needsRebuild()},e.invalidate=function(){this.data={}},t}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return u}));var i=n(0),r=n(3),o=n(6),s=n(8),a=n(4),c=n(40),u=function(t){function e(){return t.apply(this,arguments)||this}Object(i.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.value=this.attrs.value||"",this.disabled=!!this.attrs.disabled},n.view=function(){return m("div",{className:"TextEditor"},m("div",{className:"TextEditor-editorContainer"}),m("ul",{className:"TextEditor-controls Composer-footer"},Object(s.a)(this.controlItems().toArray()),m("li",{className:"TextEditor-toolbar"},this.toolbarItems().toArray())))},n.oncreate=function(e){t.prototype.oncreate.call(this,e),this.attrs.composer.editor=this.buildEditor(this.$(".TextEditor-editorContainer")[0])},n.onupdate=function(){var t=!!this.attrs.disabled;this.disabled!==t&&(this.disabled=t,this.attrs.composer.editor.disabled(t))},n.buildEditorParams=function(){var t=this;return{classNames:["FormControl","Composer-flexible","TextEditor-editor"],disabled:this.disabled,placeholder:this.attrs.placeholder||"",value:this.value,oninput:this.oninput.bind(this),inputListeners:[],onsubmit:function(){t.onsubmit(),m.redraw()}}},n.buildEditor=function(t){return new c.a(t,this.buildEditorParams())},n.controlItems=function(){var t=new o.a;return t.add("submit",a.a.component({icon:"fas fa-paper-plane",className:"Button Button--primary",itemClassName:"App-primaryControl",onclick:this.onsubmit.bind(this)},this.attrs.submitLabel)),this.attrs.preview&&t.add("preview",a.a.component({icon:"far fa-eye",className:"Button Button--icon",onclick:this.attrs.preview,title:app.translator.trans("core.forum.composer.preview_tooltip"),oncreate:function(t){return $(t.dom).tooltip()}})),t},n.toolbarItems=function(){return new o.a},n.oninput=function(t){this.value=t,this.attrs.onchange(this.value)},n.onsubmit=function(){this.attrs.onsubmit(this.value)},e}(r.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var i=n(0),r=function(t){function e(){return t.apply(this,arguments)||this}return Object(i.a)(e,t),e.prototype.view=function(){return m("div",{className:"Placeholder"},m("p",null,this.attrs.text))},e}(n(3).a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var i=n(2),r=n(0),o=function(t){function e(){return t.apply(this,arguments)||this}Object(r.a)(e,t);var n=e.prototype;return n.view=function(){var t=this.attrs.state.modal;return m("div",{className:"ModalManager modal fade"},t?t.componentClass.component(Object(i.a)({},t.attrs,{animateShow:this.animateShow.bind(this),animateHide:this.animateHide.bind(this),state:this.attrs.state})):"")},n.oncreate=function(e){t.prototype.oncreate.call(this,e),this.$().on("hidden.bs.modal",this.attrs.state.close.bind(this.attrs.state))},n.animateShow=function(t){var e=!!this.attrs.state.modal.componentClass.isDismissible;this.$().hasClass("in")?t():this.$().one("shown.bs.modal",t).modal({backdrop:e||"static",keyboard:e}).modal("show")},n.animateHide=function(){this.$().modal("hide")},e}(n(3).a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var i=n(2),r=n(0),o=n(3),s=(n(23),function(t){function e(){return t.apply(this,arguments)||this}Object(r.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.state=this.attrs.state},n.view=function(){var t=this;return m("div",{className:"AlertManager"},Object.entries(this.state.getActiveAlerts()).map((function(e){var n=e[0],r=e[1];return m("div",{className:"AlertManager-alert"},m(r.componentClass,Object(i.a)({},r.attrs,{ondismiss:t.state.dismiss.bind(t.state,n)}),r.children))})))},e}(o.a))},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var i=n(0),r=function(t){function e(){return t.apply(this,arguments)||this}Object(i.a)(e,t);var n=e.prototype;return n.className=function(){return"RequestErrorModal Modal--large"},n.title=function(){return this.attrs.error.xhr?this.attrs.error.xhr.status+" "+this.attrs.error.xhr.statusText:""},n.content=function(){var t,e=this.attrs,n=e.error,i=e.formattedError;if(i)t=i.join("\n\n");else try{var r=n.response||JSON.parse(n.responseText);t=JSON.stringify(r,null,2)}catch(e){t=n.responseText}return m("div",{className:"Modal-body"},m("pre",null,this.attrs.error.options.method," ",this.attrs.error.options.url,m("br",null),m("br",null),t))},e}(n(14).a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var i=n(2),r=n(20),o=n(10),s=function(){function t(){this.translations={},this.locale=null}var e=t.prototype;return e.addTranslations=function(t){Object(i.a)(this.translations,t)},e.trans=function(t,e){var n=this.translations[t];return n?this.apply(n,e||{}):t},e.transChoice=function(t,e,n){var i=this.translations[t];return i?(e=parseInt(e,10),i=this.pluralize(i,e),this.apply(i,n||{})):t},e.apply=function(t,e){if("user"in e){var n=Object(o.a)(e,"user");e.username||(e.username=Object(r.a)(n))}t=t.split(new RegExp("({[a-z0-9_]+}|</?[a-z0-9_]+>)","gi"));var i=[],s=[i];return t.forEach((function(t){var n=t.match(new RegExp("{([a-z0-9_]+)}|<(/?)([a-z0-9_]+)>","i"));if(n){if(n[1])s[0].push(e[n[1]]);else if(n[3])if(n[2]){var i,r=s[0].splice(0,s[0].length);(i=s[0]).push.apply(i,m.fragment(r).children),s.shift()}else{var o=e[n[3]]||{tag:n[3],children:[]};s[0].push(o),s.unshift(o.children||o)}}else s[0].push(t)})),i.filter((function(t){return t}))},e.pluralize=function(t,e){var n=this,i=new RegExp(/^\w+\: +(.+)$/),r=new RegExp(/^\s*((\{\s*(\-?\d+[\s*,\s*\-?\d+]*)\s*\})|([\[\]])\s*(-Inf|\-?\d+)\s*,\s*(\+?Inf|\-?\d+)\s*([\[\]]))\s?(.+?)$/),o=new RegExp(/^\s*(\{\s*(\-?\d+[\s*,\s*\-?\d+]*)\s*\})|([\[\]])\s*(-Inf|\-?\d+)\s*,\s*(\+?Inf|\-?\d+)\s*([\[\]])/),s=[],a=[];return t.split("|").forEach((function(t){if(r.test(t)){var e=t.match(r);a[e[0]]=e[e.length-1]}else if(i.test(t)){var n=t.match(i);s.push(n[1])}else s.push(t)})),a.forEach((function(t,i){if(o.test(i)){var r=i.match(o);if(r[1]){var s=r[2].split(",");for(var c in s)if(e==s[c])return a[i]}else{var u=n.convertNumber(r[4]),l=n.convertNumber(r[5]);if(("["===r[3]?e>=u:e>u)&&("]"===r[6]?e<=l:e<l))return a[i]}}})),s[this.pluralPosition(e,this.locale)]||s[0]||void 0},e.convertNumber=function(t){return"-Inf"===t?Number.NEGATIVE_INFINITY:"+Inf"===t||"Inf"===t?Number.POSITIVE_INFINITY:parseInt(t,10)},e.pluralPosition=function(t,e){switch("pt_BR"===e&&(e="xbr"),e.length>3&&(e=e.split("_")[0]),e){case"bo":case"dz":case"id":case"ja":case"jv":case"ka":case"km":case"kn":case"ko":case"ms":case"th":case"vi":case"zh":return 0;case"af":case"az":case"bn":case"bg":case"ca":case"da":case"de":case"el":case"en":case"eo":case"es":case"et":case"eu":case"fa":case"fi":case"fo":case"fur":case"fy":case"gl":case"gu":case"ha":case"he":case"hu":case"is":case"it":case"ku":case"lb":case"ml":case"mn":case"mr":case"nah":case"nb":case"ne":case"nl":case"nn":case"no":case"om":case"or":case"pa":case"pap":case"ps":case"pt":case"so":case"sq":case"sv":case"sw":case"ta":case"te":case"tk":case"tr":case"ur":case"zu":return 1==t?0:1;case"am":case"bh":case"fil":case"fr":case"gun":case"hi":case"ln":case"mg":case"nso":case"xbr":case"ti":case"wa":return 0===t||1==t?0:1;case"be":case"bs":case"hr":case"ru":case"sr":case"uk":return t%10==1&&t%100!=11?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2;case"cs":case"sk":return 1==t?0:t>=2&&t<=4?1:2;case"ga":return 1==t?0:2==t?1:2;case"lt":return t%10==1&&t%100!=11?0:t%10>=2&&(t%100<10||t%100>=20)?1:2;case"sl":return t%100==1?0:t%100==2?1:t%100==3||t%100==4?2:3;case"mk":return t%10==1?0:1;case"mt":return 1==t?0:0===t||t%100>1&&t%100<11?1:t%100>10&&t%100<20?2:3;case"lv":return 0===t?0:t%10==1&&t%100!=11?1:2;case"pl":return 1==t?0:t%10>=2&&t%10<=4&&(t%100<12||t%100>14)?1:2;case"cy":return 1==t?0:2==t?1:8==t||11==t?2:3;case"ro":return 1==t?0:0===t||t%100>0&&t%100<20?1:2;case"ar":return 0===t?0:1==t?1:2==t?2:t>=3&&t<=10?3:t>=11&&t<=99?4:5;default:return 0}},t}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var i=n(2),r=function(){function t(t){this.data={},this.models=t}var e=t.prototype;return e.pushPayload=function(t){t.included&&t.included.map(this.pushObject.bind(this));var e=t.data instanceof Array?t.data.map(this.pushObject.bind(this)):this.pushObject(t.data);return e.payload=t,e},e.pushObject=function(t){if(!this.models[t.type])return null;var e=this.data[t.type]=this.data[t.type]||{};return e[t.id]?e[t.id].pushData(t):e[t.id]=this.createRecord(t.type,t),e[t.id].exists=!0,e[t.id]},e.find=function(t,e,n,r){void 0===n&&(n={}),void 0===r&&(r={});var o=n,s=app.forum.attribute("apiUrl")+"/"+t;return e instanceof Array?s+="?filter[id]="+e.join(","):"object"==typeof e?o=e:e&&(s+="/"+e),app.request(Object(i.a)({method:"GET",url:s,params:o},r)).then(this.pushPayload.bind(this))},e.getById=function(t,e){return this.data[t]&&this.data[t][e]},e.getBy=function(t,e,n){return this.all(t).filter((function(t){return t[e]()===n}))[0]},e.all=function(t){var e=this.data[t];return e?Object.keys(e).map((function(t){return e[t]})):[]},e.remove=function(t){delete this.data[t.data.type][t.id()]},e.createRecord=function(t,e){return void 0===e&&(e={}),e.type=e.type||t,new this.models[t](e,this)},t}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var i=n(2),r=function(){function t(t,e){this.user=t,this.csrfToken=e}var e=t.prototype;return e.login=function(t,e){return void 0===e&&(e={}),app.request(Object(i.a)({method:"POST",url:app.forum.attribute("baseUrl")+"/login",body:t},e))},e.logout=function(){window.location=app.forum.attribute("baseUrl")+"/logout?token="+this.csrfToken},t}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var i=function(){function t(){var t=this;$("#content").click((function(e){t.isOpen()&&(e.preventDefault(),t.hide())}))}var e=t.prototype;return e.isOpen=function(){return $("#app").hasClass("drawerOpen")},e.hide=function(){$("#app").removeClass("drawerOpen"),this.$backdrop&&this.$backdrop.remove()},e.show=function(){var t=this;$("#app").addClass("drawerOpen"),this.$backdrop=$("<div/>").addClass("drawer-backdrop fade").appendTo("body").click((function(){return t.hide()})),setTimeout((function(){return t.$backdrop.addClass("in")}))},t}()},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var i=n(39);function r(t,e){void 0===e&&(e="");var n={};for(var r in t){var o=t[r];if("resolver"in o)n[e+o.path]=o.resolver;else{if(!("component"in o))throw new Error("Either a resolver or a component must be provided for the route ["+r+"]");var s="resolverClass"in o?o.resolverClass:i.a;n[e+o.path]=new s(o.component,r)}}return n}},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var i=n(28);function r(){$("[data-humantime]").each((function(){var t=$(this),e=Object(i.a)(t.attr("datetime"));t.html(e)}))}function o(){setInterval(r,1e4)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var i=n(0),r=function(t){function e(){return t.apply(this,arguments)||this}return Object(i.a)(e,t),e.prototype.apiEndpoint=function(){return"/"},e}(n(1).a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return l}));var i=n(2),r=n(0),o=n(1),s=n(66),a=n(6),c=n(21),u=n(34),l=function(t){function e(){return t.apply(this,arguments)||this}return Object(r.a)(e,t),e}(o.a);Object(i.a)(l.prototype,{username:o.a.attribute("username"),slug:o.a.attribute("slug"),displayName:o.a.attribute("displayName"),email:o.a.attribute("email"),isEmailConfirmed:o.a.attribute("isEmailConfirmed"),password:o.a.attribute("password"),avatarUrl:o.a.attribute("avatarUrl"),preferences:o.a.attribute("preferences"),groups:o.a.hasMany("groups"),joinTime:o.a.attribute("joinTime",o.a.transformDate),lastSeenAt:o.a.attribute("lastSeenAt",o.a.transformDate),markedAllAsReadAt:o.a.attribute("markedAllAsReadAt",o.a.transformDate),unreadNotificationCount:o.a.attribute("unreadNotificationCount"),newNotificationCount:o.a.attribute("newNotificationCount"),discussionCount:o.a.attribute("discussionCount"),commentCount:o.a.attribute("commentCount"),canEdit:o.a.attribute("canEdit"),canEditCredentials:o.a.attribute("canEditCredentials"),canEditGroups:o.a.attribute("canEditGroups"),canDelete:o.a.attribute("canDelete"),avatarColor:null,color:Object(c.a)("username","avatarUrl","avatarColor",(function(t,e,n){return n?"rgb("+n.join(", ")+")":e?(this.calculateAvatarColor(),""):"#"+Object(s.a)(t)})),isOnline:function(){return dayjs().subtract(5,"minutes").isBefore(this.lastSeenAt())},badges:function(){var t=new a.a,e=this.groups();return e&&e.forEach((function(e){t.add("group"+e.id(),u.a.component({group:e}))})),t},calculateAvatarColor:function(){var t=new Image,e=this;t.onload=function(){var t=new ColorThief;e.avatarColor=t.getColor(this),e.freshness=new Date,m.redraw()},t.crossOrigin="anonymous",t.src=this.avatarUrl()},savePreferences:function(t){var e=this.preferences();return Object(i.a)(e,t),this.save({preferences:e})}})},function(t,e,n){"use strict";function i(t){for(var e=0,n=0;n<t.length;n++)e+=t.charCodeAt(n);var i=function(t,e,n){var i,r,o,s=Math.floor(6*t),a=6*t-s,c=n*(1-e),u=n*(1-a*e),l=n*(1-(1-a)*e);switch(s%6){case 0:i=n,r=l,o=c;break;case 1:i=u,r=n,o=c;break;case 2:i=c,r=n,o=l;break;case 3:i=c,r=u,o=n;break;case 4:i=l,r=c,o=n;break;case 5:i=n,r=c,o=u}return{r:Math.floor(255*i),g:Math.floor(255*r),b:Math.floor(255*o)}}(e%360/360,.3,.9);return""+i.r.toString(16)+i.g.toString(16)+i.b.toString(16)}n.d(e,"a",(function(){return i}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return c}));var i=n(2),r=n(0),o=n(1),s=n(21),a=n(32),c=function(t){function e(){return t.apply(this,arguments)||this}return Object(r.a)(e,t),e}(o.a);Object(i.a)(c.prototype,{number:o.a.attribute("number"),discussion:o.a.hasOne("discussion"),createdAt:o.a.attribute("createdAt",o.a.transformDate),user:o.a.hasOne("user"),contentType:o.a.attribute("contentType"),content:o.a.attribute("content"),contentHtml:o.a.attribute("contentHtml"),contentPlain:Object(s.a)("contentHtml",a.getPlainContent),editedAt:o.a.attribute("editedAt",o.a.transformDate),editedUser:o.a.hasOne("editedUser"),isEdited:Object(s.a)("editedAt",(function(t){return!!t})),hiddenAt:o.a.attribute("hiddenAt",o.a.transformDate),hiddenUser:o.a.hasOne("hiddenUser"),isHidden:Object(s.a)("hiddenAt",(function(t){return!!t})),canEdit:o.a.attribute("canEdit"),canHide:o.a.attribute("canHide"),canDelete:o.a.attribute("canDelete")})},function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var i=n(2),r=n(0),o=n(1),s=function(t){function e(){return t.apply(this,arguments)||this}return Object(r.a)(e,t),e}(o.a);Object(i.a)(s.prototype,{contentType:o.a.attribute("contentType"),content:o.a.attribute("content"),createdAt:o.a.attribute("createdAt",o.a.transformDate),isRead:o.a.attribute("isRead"),user:o.a.hasOne("user"),fromUser:o.a.hasOne("fromUser"),subject:o.a.hasOne("subject")})},function(t,e,n){"use strict";e.a=function(t,e){var n=new RegExp("(\\w+\\/)?("+e+"|common)\\/");return new Proxy(t,{get:function(t,e){return t[e]||t[e.replace(n,"$1")]}})}},function(t,e,n){"use strict";n.d(e,"a",(function(){return G}));var i=n(2),r=n(5),o=n(6),s=n(4),a=n(55),c=n(56),u=n(57),l=n(58),d=n(59),p=n(60),h=n(10),f=n(61),v=n(62),g=n(49),b=n(36),y=n(63),w=n(41),x=n(64),N=n(65),C=n(46),O=n(67),T=n(12),k=n(68);var j=function(t,e){for(var n=-1,i=e.length,r=t.length;++n<i;)t[r+n]=e[n];return t},S=n(24),A=n(87),E=n(45);var P=function(t){return Object(E.a)(t)&&"[object Arguments]"==Object(A.a)(t)},D=Object.prototype,_=D.hasOwnProperty,I=D.propertyIsEnumerable,M=P(function(){return arguments}())?P:function(t){return Object(E.a)(t)&&_.call(t,"callee")&&!I.call(t,"callee")},L=n(79),R=S.a?S.a.isConcatSpreadable:void 0;var B=function(t){return Object(L.a)(t)||M(t)||!!(R&&t&&t[R])};var H=function t(e,n,i,r,o){var s=-1,a=e.length;for(i||(i=B),o||(o=[]);++s<a;){var c=e[s];n>0&&i(c)?n>1?t(c,n-1,i,r,o):j(o,c):r||(o[o.length]=c)}return o};var U=function(t){return(null==t?0:t.length)?H(t,1/0):[]},F=n(48),q=n(14),z=function(){function t(){this.modal=null}var e=t.prototype;return e.show=function(t,e){if(!(t.prototype instanceof q.a))throw console.error("The ModalManager can only show Modals"),new Error("The ModalManager can only show Modals");if(t.init)throw console.error("The componentClass parameter must be a modal class, not a modal instance. Whichever extension triggered this modal should be updated to comply with beta 14."),new Error("The componentClass parameter must be a modal class, not a modal instance. Whichever extension triggered this modal should be updated to comply with beta 14.");clearTimeout(this.closeTimeout),this.modal={componentClass:t,attrs:e},m.redraw.sync()},e.close=function(){var t=this;this.modal&&(this.closeTimeout=setTimeout((function(){t.modal=null,m.redraw()})))},t}(),W=n(23),V=function(){function t(){Object(r.a)(this,"activeAlerts",{}),Object(r.a)(this,"alertId",0)}var e=t.prototype;return e.getActiveAlerts=function(){return this.activeAlerts},e.show=function(t,e,n){var i,r=W.a,o={};if(1==arguments.length?i=t:2==arguments.length?(o=t,i=e):3==arguments.length&&(r=t,o=e,i=n),o===W.a||o instanceof W.a)throw console.error("The AlertManager can only show Alerts. Whichever extension triggered this alert should be updated to comply with beta 14."),new Error("The AlertManager can only show Alerts. Whichever extension triggered this alert should be updated to comply with beta 14.");return this.activeAlerts[++this.alertId]={children:i,attrs:o,componentClass:r},m.redraw(),this.alertId},e.dismiss=function(t){t&&t in this.activeAlerts&&(delete this.activeAlerts[t],m.redraw())},e.clear=function(){this.activeAlerts={},m.redraw()},t}();function Y(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return K(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return K(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}function K(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}var G=function(){function t(){Object(r.a)(this,"forum",null),Object(r.a)(this,"routes",{}),Object(r.a)(this,"initializers",new o.a),Object(r.a)(this,"session",null),Object(r.a)(this,"translator",new l.a),Object(r.a)(this,"store",new d.a({forums:x.a,users:N.a,discussions:C.a,posts:O.a,groups:T.a,notifications:k.a})),Object(r.a)(this,"cache",{}),Object(r.a)(this,"booted",!1),Object(r.a)(this,"requestErrorAlert",null),Object(r.a)(this,"current",new F.a(null)),Object(r.a)(this,"previous",new F.a(null)),Object(r.a)(this,"modal",new z),Object(r.a)(this,"alerts",new V),Object(r.a)(this,"data",void 0),Object(r.a)(this,"title",""),Object(r.a)(this,"titleCount",0)}var e=t.prototype;return e.load=function(t){this.data=t,this.translator.locale=t.locale},e.boot=function(){var t=this;this.initializers.toArray().forEach((function(e){return e(t)})),this.store.pushPayload({data:this.data.resources}),this.forum=this.store.getById("forums",1),this.session=new p.a(this.store.getById("users",this.data.session.userId),this.data.session.csrfToken),this.mount()},e.bootExtensions=function(t){var e=this;Object.keys(t).forEach((function(n){for(var i,r=t[n],o=Y(U(r.extend));!(i=o()).done;){i.value.extend(e,{name:n,exports:r})}}))},e.mount=function(t){var e=this;void 0===t&&(t=""),m.mount(document.getElementById("modal"),{view:function(){return a.a.component({state:e.modal})}}),m.mount(document.getElementById("alerts"),{view:function(){return c.a.component({state:e.alerts})}}),this.drawer=new f.a,m.route(document.getElementById("content"),t+"/",Object(v.a)(this.routes,t));var n=new b.a((function(t){var e=$("#app"),n=e.offset().top;e.toggleClass("affix",t>=n).toggleClass("scrolled",t>n),$(".App-header").toggleClass("navbar-fixed-top",t>=n)}));n.start(),n.update(),$((function(){$("body").addClass("ontouchstart"in window?"touch":"no-touch")})),Object(y.a)()},e.preloadedApiDocument=function(){if(this.data.apiDocument){var t=this.store.pushPayload(this.data.apiDocument);return this.data.apiDocument=null,t}return null},e.screen=function(){return getComputedStyle(document.documentElement).getPropertyValue("--flarum-screen")},e.setTitle=function(t){this.title=t,this.updateTitle()},e.setTitleCount=function(t){this.titleCount=t,this.updateTitle()},e.updateTitle=function(){var t=this.titleCount?"("+this.titleCount+") ":"",e=this.title&&m.route.get()!==this.forum.attribute("basePath")+"/"?this.title+" - ":"",n=this.forum.attribute("title");document.title=t+e+n},e.request=function(t){var e=this,n=Object(i.a)({},t);if(n.background=n.background||!0,Object(w.extend)(n,"config",(function(t,n){return n.setRequestHeader("X-CSRF-Token",e.session.csrfToken)})),"GET"!==n.method&&"POST"!==n.method){var r=n.method;Object(w.extend)(n,"config",(function(t,e){return e.setRequestHeader("X-HTTP-Method-Override",r)})),n.method="POST"}n.deserialize=n.deserialize||function(t){return t},n.errorHandler=n.errorHandler||function(t){throw t};var o=n.extract;return n.extract=function(t){var e;e=o?o(t.responseText):t.responseText||null;var i=t.status;if(i<200||i>299)throw new g.a(i,e,n,t);if(t.getResponseHeader){var r=t.getResponseHeader("X-CSRF-Token");r&&(app.session.csrfToken=r)}try{return JSON.parse(e)}catch(i){throw new g.a(500,e,n,t)}},this.requestErrorAlert&&this.alerts.dismiss(this.requestErrorAlert),m.request(n).then((function(t){return t}),(function(t){var i;switch(t.status){case 422:i=t.response.errors.map((function(t){return[t.detail,m("br",null)]})).reduce((function(t,e){return t.concat(e)}),[]).slice(0,-1);break;case 401:case 403:i=app.translator.trans("core.lib.error.permission_denied_message");break;case 404:case 410:i=app.translator.trans("core.lib.error.not_found_message");break;case 429:i=app.translator.trans("core.lib.error.rate_limit_exceeded_message");break;default:i=app.translator.trans("core.lib.error.generic_message")}var r=app.forum.attribute("debug"),o=t.response&&t.response.errors,a=Array.isArray(o)&&o[0]&&o[0].detail&&o.map((function(t){return decodeURI(t.detail)}));t.alert={type:"error",content:i,controls:r&&[m(s.a,{className:"Button Button--link",onclick:e.showDebug.bind(e,t,a)},"Debug")]};try{n.errorHandler(t)}catch(t){if(r&&t.xhr){var c,u=t.options,l=u.method,d=u.url,p=t.xhr.status,h=void 0===p?"":p;console.group(l+" "+d+" "+h),(c=console).error.apply(c,a||[t]),console.groupEnd()}e.requestErrorAlert=e.alerts.show(t.alert,t.alert.content)}return Promise.reject(t)}))},e.showDebug=function(t,e){this.alerts.dismiss(this.requestErrorAlert),this.modal.show(u.a,{error:t,formattedError:e})},e.route=function(t,e){void 0===e&&(e={});var n=this.routes[t];if(!n)throw new Error("Route '"+t+"' does not exist");var i=n.path.replace(/:([^\/]+)/g,(function(t,n){return Object(h.a)(e,n)}));for(var r in e)e.hasOwnProperty(r)&&!e[r]&&delete e[r];var o=m.buildQueryString(e);return(""===m.route.prefix?this.forum.attribute("basePath"):"")+i+(o?"?"+o:"")},t}()},function(t,e,n){"use strict";function i(t,e){var n="select"===t.tag?t.attrs.multi?"multi":"select":t.attrs.type;return t.attrs.onchange="multi"===n?function(){e([].slice.call(this.selectedOptions,(function(t){return t.value})))}:"select"===n?function(t){e(this.selectedOptions[0].value)}:"checkbox"===n?function(t){e(this.checked)}:t.attrs.oninput=function(t){e(this.value)},"select"===t.tag?t.children.forEach((function(t){t.attrs.value!==e()&&t.children[0]!==e()||(t.attrs.selected=!0)})):"checkbox"===n?t.attrs.checked=e():"radio"===n?t.attrs.checked=e()===t.attrs.value:t.attrs.value=e(),t.attrs.bidi=null,t}n.d(e,"a",(function(){return o})),i.view=function(t,e,n){return i(e,e.attrs.bidi)};var r=i;function o(t){var e=t.m,n=function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];var s=e.apply(this,arguments);return s.attrs||(s.attrs={}),s.attrs.bidi&&r(s,s.attrs.bidi),s};Object.keys(e).forEach((function(t){return n[t]=e[t]})),t.m=n}},function(t,e,n){"use strict";function i(t){return t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}n.d(e,"a",(function(){return i}))},function(t,e,n){"use strict";var i=n(93);t.exports=n(116)(i,requestAnimationFrame,console)},function(t,e,n){"use strict";var i=n(94),r=n(95);t.exports=function(t,e){if(/:([^\/\.-]+)(\.{3})?:/.test(t))throw new SyntaxError("Template parameter names *must* be separated");if(null==e)return t;var n=t.indexOf("?"),o=t.indexOf("#"),s=o<0?t.length:o,a=n<0?s:n,c=t.slice(0,a),u={};r(u,e);var l=c.replace(/:([^\/\.-]+)(\.{3})?/g,(function(t,n,i){return delete u[n],null==e[n]?t:i?e[n]:encodeURIComponent(String(e[n]))})),d=l.indexOf("?"),p=l.indexOf("#"),h=p<0?l.length:p,f=d<0?h:d,m=l.slice(0,f);n>=0&&(m+=t.slice(n,s)),d>=0&&(m+=(n<0?"?":"&")+l.slice(d,h));var v=i(u);return v&&(m+=(n<0&&d<0?"?":"&")+v),o>=0&&(m+=t.slice(o)),p>=0&&(m+=(o<0?"":"&")+l.slice(p)),m}},function(t,e,n){"use strict";var i=n(96);t.exports=function(t){var e=t.indexOf("?"),n=t.indexOf("#"),r=n<0?t.length:n,o=e<0?r:e,s=t.slice(0,o).replace(/\/{2,}/g,"/");return s?("/"!==s[0]&&(s="/"+s),s.length>1&&"/"===s[s.length-1]&&(s=s.slice(0,-1))):s="/",{path:s,params:e<0?{}:i(t.slice(e+1,r))}}},function(t,e,n){t.exports=function(){"use strict";return function(t,e,n){t=t||{};var i=e.prototype,r={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function o(t,e,n,r){return i.fromToBase(t,e,n,r)}n.en.relativeTime=r,i.fromToBase=function(e,i,o,s,a){for(var c,u,l,d=o.$locale().relativeTime||r,p=t.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],h=p.length,f=0;f<h;f+=1){var m=p[f];m.d&&(c=s?n(e).diff(o,m.d,!0):o.diff(e,m.d,!0));var v=(t.rounding||Math.round)(Math.abs(c));if(l=c>0,v<=m.r||!m.r){v<=1&&f>0&&(m=p[f-1]);var g=d[m.l];a&&(v=a(""+v)),u="string"==typeof g?g.replace("%d",v):g(v,i,m.l,l);break}}if(i)return u;var b=l?d.future:d.past;return"function"==typeof b?b(u):b.replace("%s",u)},i.to=function(t,e){return o(t,e,this,!0)},i.from=function(t,e){return o(t,e,this)};var s=function(t){return t.$u?n.utc():n()};i.toNow=function(t){return this.to(s(this),t)},i.fromNow=function(t){return this.from(s(this),t)}}}()},function(t,e,n){"use strict";function i(t){return t>=1e6?Math.floor(t/1e6)+app.translator.trans("core.lib.number_suffix.mega_text"):t>=1e3?(t/1e3).toFixed(1)+app.translator.trans("core.lib.number_suffix.kilo_text"):t.toString()}n.d(e,"a",(function(){return i}))},function(t,e,n){"use strict";var i=n(101),r="object"==typeof self&&self&&self.Object===Object&&self,o=i.a||r||Function("return this")();e.a=o},function(t,e,n){"use strict";var i=Array.isArray;e.a=i},function(t,e,n){"use strict";n.d(e,"a",(function(){return c}));var i=n(2),r=n(0),o=n(17),s=n(4),a=n(7),c=function(t){function e(){return t.apply(this,arguments)||this}Object(r.a)(e,t),e.initAttrs=function(e){t.initAttrs.call(this,e),e.className+=" Dropdown--split",e.menuClassName+=" Dropdown-menu--right"};var n=e.prototype;return n.getButton=function(t){var e=this.getFirstChild(t),n=Object(i.a)({},e.attrs);return n.className=(n.className||"")+" SplitDropdown-button Button "+this.attrs.buttonClassName,[s.a.component(n,e.children),m("button",{className:"Dropdown-toggle Button Button--icon "+this.attrs.buttonClassName,"data-toggle":"dropdown"},Object(a.a)(this.attrs.icon,{className:"Button-icon"}),Object(a.a)("fas fa-caret-down",{className:"Button-caret"}))]},n.getFirstChild=function(t){for(var e=t;e instanceof Array;)e=e[0];return e},e}(o.a)},function(t,e,n){"use strict";function i(t,e){var n=$(window),i=$(t).offset().top-n.scrollTop();e(),n.scrollTop($(t).offset().top-i)}n.d(e,"a",(function(){return i}))},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var i=n(7);function r(t){if(t.lastSeenAt()&&t.isOnline())return m("span",{className:"UserOnline"},Object(i.a)("fas fa-circle"))}},function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var i=n(26),r=n.n(i);function o(t){var e=r()(t),n=e.format(),i=e.format("LLLL");return m("time",{pubdate:!0,datetime:n},i)}},function(t,e,n){"use strict";n.d(e,"a",(function(){return a}));var i=n(0),r=n(3),o=n(7),s=n(38),a=function(t){function e(){return t.apply(this,arguments)||this}return Object(i.a)(e,t),e.prototype.view=function(){var t=this.attrs,e=t.options,n=t.onchange,i=t.value,r=t.disabled;return m("span",{className:"Select"},m("select",{className:"Select-input FormControl",onchange:n?Object(s.a)("value",n.bind(this)):void 0,value:i,disabled:r},Object.keys(e).map((function(t){return m("option",{value:t},e[t])}))),Object(o.a)("fas fa-sort",{className:"Select-caret"}))},e}(r.a)},function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var i=n(0),r=function(t){function e(){return t.apply(this,arguments)||this}return Object(i.a)(e,t),e.initAttrs=function(e){t.initAttrs.call(this,e),e.className=e.className||"Button Button--icon Button--link"},e.prototype.oncreate=function(e){t.prototype.oncreate.call(this,e),this.$().tooltip()},e}(n(4).a)},function(t,e,n){"use strict";function i(t){if(2===t.length)return app.translator.trans("core.lib.series.two_text",{first:t[0],second:t[1]});if(t.length>=3){var e=t.slice(1,t.length-1).reduce((function(t,e){return t.concat([e,app.translator.trans("core.lib.series.glue_text")])}),[]).slice(0,-1);return app.translator.trans("core.lib.series.three_text",{first:t[0],second:e,third:t[t.length-1]})}return t}n.d(e,"a",(function(){return i}))},function(t,e,n){"use strict";var i=n(24),r=Object.prototype,o=r.hasOwnProperty,s=r.toString,a=i.a?i.a.toStringTag:void 0;var c=function(t){var e=o.call(t,a),n=t[a];try{t[a]=void 0;var i=!0}catch(t){}var r=s.call(t);return i&&(e?t[a]=n:delete t[a]),r},u=Object.prototype.toString;var l=function(t){return u.call(t)},d=i.a?i.a.toStringTag:void 0;e.a=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":d&&d in Object(t)?c(t):l(t)}},function(t,e,n){"use strict";var i=n(30),r=n(89),o=/(?:(^|#|\.)([^#\.\[\]]+))|(\[(.+?)(?:\s*=\s*("|'|)((?:\\["'\]]|.)*?)\5)?\])/g,s={},a={}.hasOwnProperty;function c(t){for(var e in t)if(a.call(t,e))return!1;return!0}function u(t){for(var e,n="div",i=[],r={};e=o.exec(t);){var a=e[1],c=e[2];if(""===a&&""!==c)n=c;else if("#"===a)r.id=c;else if("."===a)i.push(c);else if("["===e[3][0]){var u=e[6];u&&(u=u.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")),"class"===e[4]?i.push(u):r[e[4]]=""===u?u:u||!0}}return i.length>0&&(r.className=i.join(" ")),s[t]={tag:n,attrs:r}}function l(t,e){var n=e.attrs,r=i.normalizeChildren(e.children),o=a.call(n,"class"),s=o?n.class:n.className;if(e.tag=t.tag,e.attrs=null,e.children=void 0,!c(t.attrs)&&!c(n)){var u={};for(var l in n)a.call(n,l)&&(u[l]=n[l]);n=u}for(var l in t.attrs)a.call(t.attrs,l)&&"className"!==l&&!a.call(n,l)&&(n[l]=t.attrs[l]);for(var l in null==s&&null==t.attrs.className||(n.className=null!=s?null!=t.attrs.className?String(t.attrs.className)+" "+String(s):s:null!=t.attrs.className?t.attrs.className:null),o&&(n.class=null),n)if(a.call(n,l)&&"key"!==l){e.attrs=n;break}return Array.isArray(r)&&1===r.length&&null!=r[0]&&"#"===r[0].tag?e.text=r[0].children:e.children=r,e}t.exports=function(t){if(null==t||"string"!=typeof t&&"function"!=typeof t&&"function"!=typeof t.view)throw Error("The selector must be either a string or a component.");var e=r.apply(1,arguments);return"string"==typeof t&&(e.children=i.normalizeChildren(e.children),"["!==t)?l(s[t]||u(t),e):(e.tag=t,e)}},function(t,e,n){"use strict";var i=n(30);t.exports=function(){var t,e=arguments[this],n=this+1;if(null==e?e={}:("object"!=typeof e||null!=e.tag||Array.isArray(e))&&(e={},n=this),arguments.length===n+1)t=arguments[n],Array.isArray(t)||(t=[t]);else for(t=[];n<arguments.length;)t.push(arguments[n++]);return i("",e.key,e,t)}},function(t,e,n){"use strict";(function(e){var i=n(91);"undefined"!=typeof window?(void 0===window.Promise?window.Promise=i:window.Promise.prototype.finally||(window.Promise.prototype.finally=i.prototype.finally),t.exports=window.Promise):void 0!==e?(void 0===e.Promise?e.Promise=i:e.Promise.prototype.finally||(e.Promise.prototype.finally=i.prototype.finally),t.exports=e.Promise):t.exports=i}).call(this,n(27))},function(t,e,n){"use strict";(function(e){var n=function(t){if(!(this instanceof n))throw new Error("Promise must be called with `new`");if("function"!=typeof t)throw new TypeError("executor must be a function");var i=this,r=[],o=[],s=l(r,!0),a=l(o,!1),c=i._instance={resolvers:r,rejectors:o},u="function"==typeof e?e:setTimeout;function l(t,e){return function n(s){var l;try{if(!e||null==s||"object"!=typeof s&&"function"!=typeof s||"function"!=typeof(l=s.then))u((function(){e||0!==t.length||console.error("Possible unhandled promise rejection:",s);for(var i=0;i<t.length;i++)t[i](s);r.length=0,o.length=0,c.state=e,c.retry=function(){n(s)}}));else{if(s===i)throw new TypeError("Promise can't be resolved w/ itself");d(l.bind(s))}}catch(t){a(t)}}}function d(t){var e=0;function n(t){return function(n){e++>0||t(n)}}var i=n(a);try{t(n(s),i)}catch(t){i(t)}}d(t)};n.prototype.then=function(t,e){var i,r,o=this._instance;function s(t,e,n,s){e.push((function(e){if("function"!=typeof t)n(e);else try{i(t(e))}catch(t){r&&r(t)}})),"function"==typeof o.retry&&s===o.state&&o.retry()}var a=new n((function(t,e){i=t,r=e}));return s(t,o.resolvers,i,!0),s(e,o.rejectors,r,!1),a},n.prototype.catch=function(t){return this.then(null,t)},n.prototype.finally=function(t){return this.then((function(e){return n.resolve(t()).then((function(){return e}))}),(function(e){return n.resolve(t()).then((function(){return n.reject(e)}))}))},n.resolve=function(t){return t instanceof n?t:new n((function(e){e(t)}))},n.reject=function(t){return new n((function(e,n){n(t)}))},n.all=function(t){return new n((function(e,n){var i=t.length,r=0,o=[];if(0===t.length)e([]);else for(var s=0;s<t.length;s++)!function(s){function a(t){r++,o[s]=t,r===i&&e(o)}null==t[s]||"object"!=typeof t[s]&&"function"!=typeof t[s]||"function"!=typeof t[s].then?a(t[s]):t[s].then(a,n)}(s)}))},n.race=function(t){return new n((function(e,n){for(var i=0;i<t.length;i++)t[i].then(e,n)}))},t.exports=n}).call(this,n(92).setImmediate)},function(t,e,n){(function(t){var i=void 0!==t&&t||"undefined"!=typeof self&&self||window,r=Function.prototype.apply;function o(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new o(r.call(setTimeout,i,arguments),clearTimeout)},e.setInterval=function(){return new o(r.call(setInterval,i,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(i,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n(113),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(27))},function(t,e,n){"use strict";t.exports=n(115)(window)},function(t,e,n){"use strict";t.exports=function(t){if("[object Object]"!==Object.prototype.toString.call(t))return"";var e=[];for(var n in t)i(n,t[n]);return e.join("&");function i(t,n){if(Array.isArray(n))for(var r=0;r<n.length;r++)i(t+"["+r+"]",n[r]);else if("[object Object]"===Object.prototype.toString.call(n))for(var r in n)i(t+"["+r+"]",n[r]);else e.push(encodeURIComponent(t)+(null!=n&&""!==n?"="+encodeURIComponent(n):""))}}},function(t,e,n){"use strict";t.exports=Object.assign||function(t,e){e&&Object.keys(e).forEach((function(n){t[n]=e[n]}))}},function(t,e,n){"use strict";t.exports=function(t){if(""===t||null==t)return{};"?"===t.charAt(0)&&(t=t.slice(1));for(var e=t.split("&"),n={},i={},r=0;r<e.length;r++){var o=e[r].split("="),s=decodeURIComponent(o[0]),a=2===o.length?decodeURIComponent(o[1]):"";"true"===a?a=!0:"false"===a&&(a=!1);var c=s.split(/\]\[?|\[/),u=i;s.indexOf("[")>-1&&c.pop();for(var l=0;l<c.length;l++){var d=c[l],p=c[l+1],h=""==p||!isNaN(parseInt(p,10));if(""===d)null==n[s=c.slice(0,l).join()]&&(n[s]=Array.isArray(u)?u.length:0),d=n[s]++;else if("__proto__"===d)break;if(l===c.length-1)u[d]=a;else{var f=Object.getOwnPropertyDescriptor(u,d);null!=f&&(f=f.value),null==f&&(u[d]=f=h?[]:{}),u=f}}}return i}},function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var i={};n.r(i),n.d(i,"Model",(function(){return l})),n.d(i,"PostTypes",(function(){return p})),n.d(i,"Routes",(function(){return h}));n(104),n(107),n(121),n(122),n(123),n(124),n(125),n(126),n(127);var r=n(76),o=n.n(r),s=n(98),a=n.n(s),c=n(71),u=n(5),l=function(){function t(t,e){void 0===e&&(e=null),Object(u.a)(this,"type",void 0),Object(u.a)(this,"attributes",[]),Object(u.a)(this,"hasOnes",[]),Object(u.a)(this,"hasManys",[]),this.type=t,this.model=e}var e=t.prototype;return e.attribute=function(t){return this.attributes.push(t),this},e.hasOne=function(t){return this.hasOnes.push(t),this},e.hasMany=function(t){return this.hasManys.push(t),this},e.extend=function(t,e){this.model&&(t.store.models[this.type]=this.model);var n=t.store.models[this.type];this.attributes.forEach((function(t){return n.prototype[t]=n.attribute(t)})),this.hasOnes.forEach((function(t){return n.prototype[t]=n.hasOne(t)})),this.hasManys.forEach((function(t){return n.prototype[t]=n.hasMany(t)}))},t}(),d=n(2),p=function(){function t(){Object(u.a)(this,"postComponents",{})}var e=t.prototype;return e.add=function(t,e){return this.postComponents[t]=e,this},e.extend=function(t,e){Object(d.a)(t.postComponents,this.postComponents)},t}(),h=function(){function t(){Object(u.a)(this,"routes",{})}var e=t.prototype;return e.add=function(t,e,n){return this.routes[t]={path:e,component:n},this},e.extend=function(t,e){Object(d.a)(t.routes,this.routes)},t}();dayjs.extend(o.a),dayjs.extend(a.a),Object(c.a)(window)},function(t,e,n){t.exports=function(){"use strict";var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(e,n,i){var r=n.prototype,o=r.format;i.en.formats=t,r.format=function(e){void 0===e&&(e="YYYY-MM-DDTHH:mm:ssZ");var n=this.$locale().formats,i=function(e,n){return e.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(e,i,r){var o=r&&r.toUpperCase();return i||n[r]||t[r]||n[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(t,e,n){return e||n.slice(1)}))}))}(e,void 0===n?{}:n);return o.call(this,i)}}}()},function(t,e,n){!function(){var e=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"],n="undefined"!=typeof window,i=n&&null!=window.mozInnerScreenX;function r(t,r,o){if(!n)throw new Error("textarea-caret-position#getCaretCoordinates should only be called in a browser");var s=o&&o.debug||!1;if(s){var a=document.querySelector("#input-textarea-caret-position-mirror-div");a&&a.parentNode.removeChild(a)}var c=document.createElement("div");c.id="input-textarea-caret-position-mirror-div",document.body.appendChild(c);var u=c.style,l=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,d="INPUT"===t.nodeName;u.whiteSpace="pre-wrap",d||(u.wordWrap="break-word"),u.position="absolute",s||(u.visibility="hidden"),e.forEach((function(t){d&&"lineHeight"===t?u.lineHeight=l.height:u[t]=l[t]})),i?t.scrollHeight>parseInt(l.height)&&(u.overflowY="scroll"):u.overflow="hidden",c.textContent=t.value.substring(0,r),d&&(c.textContent=c.textContent.replace(/\s/g," "));var p=document.createElement("span");p.textContent=t.value.substring(r)||".",c.appendChild(p);var h={top:p.offsetTop+parseInt(l.borderTopWidth),left:p.offsetLeft+parseInt(l.borderLeftWidth),height:parseInt(l.lineHeight)};return s?p.style.backgroundColor="#aaa":document.body.removeChild(c),h}void 0!==t.exports?t.exports=r:n&&(window.getCaretCoordinates=r)}()},function(t,e,n){"use strict";t.exports=n(128)},function(t,e,n){"use strict";(function(t){var n="object"==typeof t&&t&&t.Object===Object&&t;e.a=n}).call(this,n(27))},function(t,e,n){"use strict";var i=n(41),r=n(60),o=n(59),s=n(40),a={handlers:null,getHandlers:function(t){return this.handlers=this.handlers||{},this.handlers[t]=this.handlers[t]||[],this.handlers[t]},trigger:function(t){for(var e=this,n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];this.getHandlers(t).forEach((function(t){return t.apply(e,i)}))},on:function(t,e){this.getHandlers(t).push(e)},one:function(t,e){this.getHandlers(t).push((function n(){e.apply(this,arguments),this.off(t,n)}))},off:function(t,e){var n=this.getHandlers(t),i=n.indexOf(e);-1!==i&&n.splice(i,1)}},c=n(63),u=n(6),l=n(2),d=n(0);var p=n(28),h=n(21),f=n(61),m=n(81),v=n(49),g=n(77),b=n(32),y=n(11),w=n(52),x=n(51),N=n(10),C=n(36),O=n(66),T=n(43),k=n(71),j=n(69),S=n(16),A=n(9),E=n(72),P=n(62),D=n(38),_=n(68),I=n(65),M=n(67),L=n(46),R=n(12),B=n(64),H=n(3),U=n(58),F=n(56),q=n(31),z=n(37),W=n(29),V=n(18),Y=n(54),K=n(25),G=n(17),X=n(80),J=n(57),Q=n(42),Z=n(84),tt=n(50),et=n(23),nt=n(13),it=n(15),rt=n(47),ot=n(33),st=n(55),at=n(4),ct=n(14),ut=n(34),lt=n(53),dt=n(85),pt=n(1),ht=n(70),ft=n(83),mt=n(19),vt=n(7),gt=n(44),bt=n(86),yt=n(35),wt=n(20),xt=n(82),Nt=n(8),Ct=n(5),Ot=function(){function t(){Object(Ct.a)(this,"element",void 0)}var e=t.prototype;return e.$=function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){var e=$(this.element);return t?e.find(t):e})),e.render=function(){var t=this,e=this.view();e.attrs=e.attrs||{};var n=e.attrs.oncreate;return e.attrs.oncreate=function(e){t.element=e.dom,n&&n.apply(t,[e])},e},t}(),Tt=n(39);e.a={extend:i,Session:r.a,Store:o.a,"utils/BasicEditorDriver":s.a,"utils/evented":a,"utils/liveHumanTimes":c.a,"utils/ItemList":u.a,"utils/mixin":function(t){for(var e=function(t){function e(){return t.apply(this,arguments)||this}return Object(d.a)(e,t),e}(t),n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return i.forEach((function(t){Object(l.a)(e.prototype,t)})),e},"utils/humanTime":p.a,"utils/computed":h.a,"utils/Drawer":f.a,"utils/anchorScroll":m.a,"utils/RequestError":v.a,"utils/abbreviateNumber":g.a,"utils/string":b,"utils/SubtreeRetainer":w.a,"utils/extract":N.a,"utils/ScrollListener":C.a,"utils/stringToColor":O.a,"utils/Stream":y.a,"utils/subclassOf":T.a,"utils/setRouteWithForcedRefresh":x.a,"utils/patchMithril":k.a,"utils/proxifyCompat":j.a,"utils/classList":S.a,"utils/extractText":A.a,"utils/formatNumber":E.a,"utils/mapRoutes":P.a,"utils/withAttr":D.a,"models/Notification":_.a,"models/User":I.a,"models/Post":M.a,"models/Discussion":L.a,"models/Group":R.a,"models/Forum":B.a,Component:H.a,Fragment:Ot,Translator:U.a,"components/AlertManager":F.a,"components/Page":q.a,"components/Switch":z.a,"components/Badge":W.a,"components/LoadingIndicator":V.a,"components/Placeholder":Y.a,"components/Separator":K.a,"components/Dropdown":G.a,"components/SplitDropdown":X.a,"components/RequestErrorModal":J.a,"components/FieldSet":Q.a,"components/Select":Z.a,"components/Navigation":tt.a,"components/Alert":et.a,"components/Link":nt.a,"components/LinkButton":it.a,"components/Checkbox":rt.a,"components/SelectDropdown":ot.a,"components/ModalManager":st.a,"components/Button":at.a,"components/Modal":ct.a,"components/GroupBadge":ut.a,"components/TextEditor":lt.a,"components/TextEditorButton":dt.a,Model:pt.a,Application:ht.a,"helpers/fullTime":ft.a,"helpers/avatar":mt.a,"helpers/icon":vt.a,"helpers/humanTime":gt.a,"helpers/punctuateSeries":bt.a,"helpers/highlight":yt.a,"helpers/username":wt.a,"helpers/userOnline":xt.a,"helpers/listItems":Nt.a,"resolvers/DefaultResolver":Tt.a}},,function(t,e,n){(function(e){t.exports=e.$=n(105)}).call(this,n(27))},function(t,e,n){(function(e){t.exports=e.jQuery=n(106)}).call(this,n(27))},function(t,e,n){var i; /*! * jQuery JavaScript Library v3.5.1 * https://jquery.com/ * * Includes Sizzle.js * https://sizzlejs.com/ * * Copyright JS Foundation and other contributors * Released under the MIT license * https://jquery.org/license * * Date: 2020-05-04T22:49Z */!function(e,n){"use strict";"object"==typeof t.exports?t.exports=e.document?n(e,!0):function(t){if(!t.document)throw new Error("jQuery requires a window with a document");return n(t)}:n(e)}("undefined"!=typeof window?window:this,(function(n,r){"use strict";var o=[],s=Object.getPrototypeOf,a=o.slice,c=o.flat?function(t){return o.flat.call(t)}:function(t){return o.concat.apply([],t)},u=o.push,l=o.indexOf,d={},p=d.toString,h=d.hasOwnProperty,f=h.toString,m=f.call(Object),v={},g=function(t){return"function"==typeof t&&"number"!=typeof t.nodeType},b=function(t){return null!=t&&t===t.window},y=n.document,w={type:!0,src:!0,nonce:!0,noModule:!0};function x(t,e,n){var i,r,o=(n=n||y).createElement("script");if(o.text=t,e)for(i in w)(r=e[i]||e.getAttribute&&e.getAttribute(i))&&o.setAttribute(i,r);n.head.appendChild(o).parentNode.removeChild(o)}function N(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?d[p.call(t)]||"object":typeof t}var C=function(t,e){return new C.fn.init(t,e)};function O(t){var e=!!t&&"length"in t&&t.length,n=N(t);return!g(t)&&!b(t)&&("array"===n||0===e||"number"==typeof e&&e>0&&e-1 in t)}C.fn=C.prototype={jquery:"3.5.1",constructor:C,length:0,toArray:function(){return a.call(this)},get:function(t){return null==t?a.call(this):t<0?this[t+this.length]:this[t]},pushStack:function(t){var e=C.merge(this.constructor(),t);return e.prevObject=this,e},each:function(t){return C.each(this,t)},map:function(t){return this.pushStack(C.map(this,(function(e,n){return t.call(e,n,e)})))},slice:function(){return this.pushStack(a.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(C.grep(this,(function(t,e){return(e+1)%2})))},odd:function(){return this.pushStack(C.grep(this,(function(t,e){return e%2})))},eq:function(t){var e=this.length,n=+t+(t<0?e:0);return this.pushStack(n>=0&&n<e?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:u,sort:o.sort,splice:o.splice},C.extend=C.fn.extend=function(){var t,e,n,i,r,o,s=arguments[0]||{},a=1,c=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[a]||{},a++),"object"==typeof s||g(s)||(s={}),a===c&&(s=this,a--);a<c;a++)if(null!=(t=arguments[a]))for(e in t)i=t[e],"__proto__"!==e&&s!==i&&(u&&i&&(C.isPlainObject(i)||(r=Array.isArray(i)))?(n=s[e],o=r&&!Array.isArray(n)?[]:r||C.isPlainObject(n)?n:{},r=!1,s[e]=C.extend(u,o,i)):void 0!==i&&(s[e]=i));return s},C.extend({expando:"jQuery"+("3.5.1"+Math.random()).replace(/\D/g,""),isReady:!0,error:function(t){throw new Error(t)},noop:function(){},isPlainObject:function(t){var e,n;return!(!t||"[object Object]"!==p.call(t))&&(!(e=s(t))||"function"==typeof(n=h.call(e,"constructor")&&e.constructor)&&f.call(n)===m)},isEmptyObject:function(t){var e;for(e in t)return!1;return!0},globalEval:function(t,e,n){x(t,{nonce:e&&e.nonce},n)},each:function(t,e){var n,i=0;if(O(t))for(n=t.length;i<n&&!1!==e.call(t[i],i,t[i]);i++);else for(i in t)if(!1===e.call(t[i],i,t[i]))break;return t},makeArray:function(t,e){var n=e||[];return null!=t&&(O(Object(t))?C.merge(n,"string"==typeof t?[t]:t):u.call(n,t)),n},inArray:function(t,e,n){return null==e?-1:l.call(e,t,n)},merge:function(t,e){for(var n=+e.length,i=0,r=t.length;i<n;i++)t[r++]=e[i];return t.length=r,t},grep:function(t,e,n){for(var i=[],r=0,o=t.length,s=!n;r<o;r++)!e(t[r],r)!==s&&i.push(t[r]);return i},map:function(t,e,n){var i,r,o=0,s=[];if(O(t))for(i=t.length;o<i;o++)null!=(r=e(t[o],o,n))&&s.push(r);else for(o in t)null!=(r=e(t[o],o,n))&&s.push(r);return c(s)},guid:1,support:v}),"function"==typeof Symbol&&(C.fn[Symbol.iterator]=o[Symbol.iterator]),C.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),(function(t,e){d["[object "+e+"]"]=e.toLowerCase()}));var T= /*! * Sizzle CSS Selector Engine v2.3.5 * https://sizzlejs.com/ * * Copyright JS Foundation and other contributors * Released under the MIT license * https://js.foundation/ * * Date: 2020-03-14 */ function(t){var e,n,i,r,o,s,a,c,u,l,d,p,h,f,m,v,g,b,y,w="sizzle"+1*new Date,x=t.document,N=0,C=0,O=ct(),T=ct(),k=ct(),j=ct(),S=function(t,e){return t===e&&(d=!0),0},A={}.hasOwnProperty,E=[],P=E.pop,D=E.push,$=E.push,_=E.slice,I=function(t,e){for(var n=0,i=t.length;n<i;n++)if(t[n]===e)return n;return-1},M="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",R="(?:\\\\[\\da-fA-F]{1,6}"+L+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",B="\\["+L+"*("+R+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+R+"))|)"+L+"*\\]",H=":("+R+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+B+")*)|.*)\\)|)",U=new RegExp(L+"+","g"),F=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),q=new RegExp("^"+L+"*,"+L+"*"),z=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),W=new RegExp(L+"|>"),V=new RegExp(H),Y=new RegExp("^"+R+"$"),K={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+B),PSEUDO:new RegExp("^"+H),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+M+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},G=/HTML$/i,X=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,tt=/[+~]/,et=new RegExp("\\\\[\\da-fA-F]{1,6}"+L+"?|\\\\([^\\r\\n\\f])","g"),nt=function(t,e){var n="0x"+t.slice(1)-65536;return e||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},it=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,rt=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},ot=function(){p()},st=wt((function(t){return!0===t.disabled&&"fieldset"===t.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{$.apply(E=_.call(x.childNodes),x.childNodes),E[x.childNodes.length].nodeType}catch(t){$={apply:E.length?function(t,e){D.apply(t,_.call(e))}:function(t,e){for(var n=t.length,i=0;t[n++]=e[i++];);t.length=n-1}}}function at(t,e,i,r){var o,a,u,l,d,f,g,b=e&&e.ownerDocument,x=e?e.nodeType:9;if(i=i||[],"string"!=typeof t||!t||1!==x&&9!==x&&11!==x)return i;if(!r&&(p(e),e=e||h,m)){if(11!==x&&(d=Z.exec(t)))if(o=d[1]){if(9===x){if(!(u=e.getElementById(o)))return i;if(u.id===o)return i.push(u),i}else if(b&&(u=b.getElementById(o))&&y(e,u)&&u.id===o)return i.push(u),i}else{if(d[2])return $.apply(i,e.getElementsByTagName(t)),i;if((o=d[3])&&n.getElementsByClassName&&e.getElementsByClassName)return $.apply(i,e.getElementsByClassName(o)),i}if(n.qsa&&!j[t+" "]&&(!v||!v.test(t))&&(1!==x||"object"!==e.nodeName.toLowerCase())){if(g=t,b=e,1===x&&(W.test(t)||z.test(t))){for((b=tt.test(t)&&gt(e.parentNode)||e)===e&&n.scope||((l=e.getAttribute("id"))?l=l.replace(it,rt):e.setAttribute("id",l=w)),a=(f=s(t)).length;a--;)f[a]=(l?"#"+l:":scope")+" "+yt(f[a]);g=f.join(",")}try{return $.apply(i,b.querySelectorAll(g)),i}catch(e){j(t,!0)}finally{l===w&&e.removeAttribute("id")}}}return c(t.replace(F,"$1"),e,i,r)}function ct(){var t=[];return function e(n,r){return t.push(n+" ")>i.cacheLength&&delete e[t.shift()],e[n+" "]=r}}function ut(t){return t[w]=!0,t}function lt(t){var e=h.createElement("fieldset");try{return!!t(e)}catch(t){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function dt(t,e){for(var n=t.split("|"),r=n.length;r--;)i.attrHandle[n[r]]=e}function pt(t,e){var n=e&&t,i=n&&1===t.nodeType&&1===e.nodeType&&t.sourceIndex-e.sourceIndex;if(i)return i;if(n)for(;n=n.nextSibling;)if(n===e)return-1;return t?1:-1}function ht(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function ft(t){return function(e){var n=e.nodeName.toLowerCase();return("input"===n||"button"===n)&&e.type===t}}function mt(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&st(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function vt(t){return ut((function(e){return e=+e,ut((function(n,i){for(var r,o=t([],n.length,e),s=o.length;s--;)n[r=o[s]]&&(n[r]=!(i[r]=n[r]))}))}))}function gt(t){return t&&void 0!==t.getElementsByTagName&&t}for(e in n=at.support={},o=at.isXML=function(t){var e=t.namespaceURI,n=(t.ownerDocument||t).documentElement;return!G.test(e||n&&n.nodeName||"HTML")},p=at.setDocument=function(t){var e,r,s=t?t.ownerDocument||t:x;return s!=h&&9===s.nodeType&&s.documentElement?(f=(h=s).documentElement,m=!o(h),x!=h&&(r=h.defaultView)&&r.top!==r&&(r.addEventListener?r.addEventListener("unload",ot,!1):r.attachEvent&&r.attachEvent("onunload",ot)),n.scope=lt((function(t){return f.appendChild(t).appendChild(h.createElement("div")),void 0!==t.querySelectorAll&&!t.querySelectorAll(":scope fieldset div").length})),n.attributes=lt((function(t){return t.className="i",!t.getAttribute("className")})),n.getElementsByTagName=lt((function(t){return t.appendChild(h.createComment("")),!t.getElementsByTagName("*").length})),n.getElementsByClassName=Q.test(h.getElementsByClassName),n.getById=lt((function(t){return f.appendChild(t).id=w,!h.getElementsByName||!h.getElementsByName(w).length})),n.getById?(i.filter.ID=function(t){var e=t.replace(et,nt);return function(t){return t.getAttribute("id")===e}},i.find.ID=function(t,e){if(void 0!==e.getElementById&&m){var n=e.getElementById(t);return n?[n]:[]}}):(i.filter.ID=function(t){var e=t.replace(et,nt);return function(t){var n=void 0!==t.getAttributeNode&&t.getAttributeNode("id");return n&&n.value===e}},i.find.ID=function(t,e){if(void 0!==e.getElementById&&m){var n,i,r,o=e.getElementById(t);if(o){if((n=o.getAttributeNode("id"))&&n.value===t)return[o];for(r=e.getElementsByName(t),i=0;o=r[i++];)if((n=o.getAttributeNode("id"))&&n.value===t)return[o]}return[]}}),i.find.TAG=n.getElementsByTagName?function(t,e){return void 0!==e.getElementsByTagName?e.getElementsByTagName(t):n.qsa?e.querySelectorAll(t):void 0}:function(t,e){var n,i=[],r=0,o=e.getElementsByTagName(t);if("*"===t){for(;n=o[r++];)1===n.nodeType&&i.push(n);return i}return o},i.find.CLASS=n.getElementsByClassName&&function(t,e){if(void 0!==e.getElementsByClassName&&m)return e.getElementsByClassName(t)},g=[],v=[],(n.qsa=Q.test(h.querySelectorAll))&&(lt((function(t){var e;f.appendChild(t).innerHTML="<a id='"+w+"'></a><select id='"+w+"-\r\\' msallowcapture=''><option selected=''></option></select>",t.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+L+"*(?:''|\"\")"),t.querySelectorAll("[selected]").length||v.push("\\["+L+"*(?:value|"+M+")"),t.querySelectorAll("[id~="+w+"-]").length||v.push("~="),(e=h.createElement("input")).setAttribute("name",""),t.appendChild(e),t.querySelectorAll("[name='']").length||v.push("\\["+L+"*name"+L+"*="+L+"*(?:''|\"\")"),t.querySelectorAll(":checked").length||v.push(":checked"),t.querySelectorAll("a#"+w+"+*").length||v.push(".#.+[+~]"),t.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")})),lt((function(t){t.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var e=h.createElement("input");e.setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),t.querySelectorAll("[name=d]").length&&v.push("name"+L+"*[*^$|!~]?="),2!==t.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),f.appendChild(t).disabled=!0,2!==t.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),t.querySelectorAll("*,:x"),v.push(",.*:")}))),(n.matchesSelector=Q.test(b=f.matches||f.webkitMatchesSelector||f.mozMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&lt((function(t){n.disconnectedMatch=b.call(t,"*"),b.call(t,"[s!='']:x"),g.push("!=",H)})),v=v.length&&new RegExp(v.join("|")),g=g.length&&new RegExp(g.join("|")),e=Q.test(f.compareDocumentPosition),y=e||Q.test(f.contains)?function(t,e){var n=9===t.nodeType?t.documentElement:t,i=e&&e.parentNode;return t===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):t.compareDocumentPosition&&16&t.compareDocumentPosition(i)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return!0;return!1},S=e?function(t,e){if(t===e)return d=!0,0;var i=!t.compareDocumentPosition-!e.compareDocumentPosition;return i||(1&(i=(t.ownerDocument||t)==(e.ownerDocument||e)?t.compareDocumentPosition(e):1)||!n.sortDetached&&e.compareDocumentPosition(t)===i?t==h||t.ownerDocument==x&&y(x,t)?-1:e==h||e.ownerDocument==x&&y(x,e)?1:l?I(l,t)-I(l,e):0:4&i?-1:1)}:function(t,e){if(t===e)return d=!0,0;var n,i=0,r=t.parentNode,o=e.parentNode,s=[t],a=[e];if(!r||!o)return t==h?-1:e==h?1:r?-1:o?1:l?I(l,t)-I(l,e):0;if(r===o)return pt(t,e);for(n=t;n=n.parentNode;)s.unshift(n);for(n=e;n=n.parentNode;)a.unshift(n);for(;s[i]===a[i];)i++;return i?pt(s[i],a[i]):s[i]==x?-1:a[i]==x?1:0},h):h},at.matches=function(t,e){return at(t,null,null,e)},at.matchesSelector=function(t,e){if(p(t),n.matchesSelector&&m&&!j[e+" "]&&(!g||!g.test(e))&&(!v||!v.test(e)))try{var i=b.call(t,e);if(i||n.disconnectedMatch||t.document&&11!==t.document.nodeType)return i}catch(t){j(e,!0)}return at(e,h,null,[t]).length>0},at.contains=function(t,e){return(t.ownerDocument||t)!=h&&p(t),y(t,e)},at.attr=function(t,e){(t.ownerDocument||t)!=h&&p(t);var r=i.attrHandle[e.toLowerCase()],o=r&&A.call(i.attrHandle,e.toLowerCase())?r(t,e,!m):void 0;return void 0!==o?o:n.attributes||!m?t.getAttribute(e):(o=t.getAttributeNode(e))&&o.specified?o.value:null},at.escape=function(t){return(t+"").replace(it,rt)},at.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)},at.uniqueSort=function(t){var e,i=[],r=0,o=0;if(d=!n.detectDuplicates,l=!n.sortStable&&t.slice(0),t.sort(S),d){for(;e=t[o++];)e===t[o]&&(r=i.push(o));for(;r--;)t.splice(i[r],1)}return l=null,t},r=at.getText=function(t){var e,n="",i=0,o=t.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)n+=r(t)}else if(3===o||4===o)return t.nodeValue}else for(;e=t[i++];)n+=r(e);return n},(i=at.selectors={cacheLength:50,createPseudo:ut,match:K,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(et,nt),t[3]=(t[3]||t[4]||t[5]||"").replace(et,nt),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1].slice(0,3)?(t[3]||at.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3])),t[5]=+(t[7]+t[8]||"odd"===t[3])):t[3]&&at.error(t[0]),t},PSEUDO:function(t){var e,n=!t[6]&&t[2];return K.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":n&&V.test(n)&&(e=s(n,!0))&&(e=n.indexOf(")",n.length-e)-n.length)&&(t[0]=t[0].slice(0,e),t[2]=n.slice(0,e)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(et,nt).toLowerCase();return"*"===t?function(){return!0}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=O[t+" "];return e||(e=new RegExp("(^|"+L+")"+t+"("+L+"|$)"))&&O(t,(function(t){return e.test("string"==typeof t.className&&t.className||void 0!==t.getAttribute&&t.getAttribute("class")||"")}))},ATTR:function(t,e,n){return function(i){var r=at.attr(i,t);return null==r?"!="===e:!e||(r+="","="===e?r===n:"!="===e?r!==n:"^="===e?n&&0===r.indexOf(n):"*="===e?n&&r.indexOf(n)>-1:"$="===e?n&&r.slice(-n.length)===n:"~="===e?(" "+r.replace(U," ")+" ").indexOf(n)>-1:"|="===e&&(r===n||r.slice(0,n.length+1)===n+"-"))}},CHILD:function(t,e,n,i,r){var o="nth"!==t.slice(0,3),s="last"!==t.slice(-4),a="of-type"===e;return 1===i&&0===r?function(t){return!!t.parentNode}:function(e,n,c){var u,l,d,p,h,f,m=o!==s?"nextSibling":"previousSibling",v=e.parentNode,g=a&&e.nodeName.toLowerCase(),b=!c&&!a,y=!1;if(v){if(o){for(;m;){for(p=e;p=p[m];)if(a?p.nodeName.toLowerCase()===g:1===p.nodeType)return!1;f=m="only"===t&&!f&&"nextSibling"}return!0}if(f=[s?v.firstChild:v.lastChild],s&&b){for(y=(h=(u=(l=(d=(p=v)[w]||(p[w]={}))[p.uniqueID]||(d[p.uniqueID]={}))[t]||[])[0]===N&&u[1])&&u[2],p=h&&v.childNodes[h];p=++h&&p&&p[m]||(y=h=0)||f.pop();)if(1===p.nodeType&&++y&&p===e){l[t]=[N,h,y];break}}else if(b&&(y=h=(u=(l=(d=(p=e)[w]||(p[w]={}))[p.uniqueID]||(d[p.uniqueID]={}))[t]||[])[0]===N&&u[1]),!1===y)for(;(p=++h&&p&&p[m]||(y=h=0)||f.pop())&&((a?p.nodeName.toLowerCase()!==g:1!==p.nodeType)||!++y||(b&&((l=(d=p[w]||(p[w]={}))[p.uniqueID]||(d[p.uniqueID]={}))[t]=[N,y]),p!==e)););return(y-=r)===i||y%i==0&&y/i>=0}}},PSEUDO:function(t,e){var n,r=i.pseudos[t]||i.setFilters[t.toLowerCase()]||at.error("unsupported pseudo: "+t);return r[w]?r(e):r.length>1?(n=[t,t,"",e],i.setFilters.hasOwnProperty(t.toLowerCase())?ut((function(t,n){for(var i,o=r(t,e),s=o.length;s--;)t[i=I(t,o[s])]=!(n[i]=o[s])})):function(t){return r(t,0,n)}):r}},pseudos:{not:ut((function(t){var e=[],n=[],i=a(t.replace(F,"$1"));return i[w]?ut((function(t,e,n,r){for(var o,s=i(t,null,r,[]),a=t.length;a--;)(o=s[a])&&(t[a]=!(e[a]=o))})):function(t,r,o){return e[0]=t,i(e,null,o,n),e[0]=null,!n.pop()}})),has:ut((function(t){return function(e){return at(t,e).length>0}})),contains:ut((function(t){return t=t.replace(et,nt),function(e){return(e.textContent||r(e)).indexOf(t)>-1}})),lang:ut((function(t){return Y.test(t||"")||at.error("unsupported lang: "+t),t=t.replace(et,nt).toLowerCase(),function(e){var n;do{if(n=m?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(n=n.toLowerCase())===t||0===n.indexOf(t+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}})),target:function(e){var n=t.location&&t.location.hash;return n&&n.slice(1)===e.id},root:function(t){return t===f},focus:function(t){return t===h.activeElement&&(!h.hasFocus||h.hasFocus())&&!!(t.type||t.href||~t.tabIndex)},enabled:mt(!1),disabled:mt(!0),checked:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&!!t.checked||"option"===e&&!!t.selected},selected:function(t){return t.parentNode&&t.parentNode.selectedIndex,!0===t.selected},empty:function(t){for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeType<6)return!1;return!0},parent:function(t){return!i.pseudos.empty(t)},header:function(t){return J.test(t.nodeName)},input:function(t){return X.test(t.nodeName)},button:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&"button"===t.type||"button"===e},text:function(t){var e;return"input"===t.nodeName.toLowerCase()&&"text"===t.type&&(null==(e=t.getAttribute("type"))||"text"===e.toLowerCase())},first:vt((function(){return[0]})),last:vt((function(t,e){return[e-1]})),eq:vt((function(t,e,n){return[n<0?n+e:n]})),even:vt((function(t,e){for(var n=0;n<e;n+=2)t.push(n);return t})),odd:vt((function(t,e){for(var n=1;n<e;n+=2)t.push(n);return t})),lt:vt((function(t,e,n){for(var i=n<0?n+e:n>e?e:n;--i>=0;)t.push(i);return t})),gt:vt((function(t,e,n){for(var i=n<0?n+e:n;++i<e;)t.push(i);return t}))}}).pseudos.nth=i.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[e]=ht(e);for(e in{submit:!0,reset:!0})i.pseudos[e]=ft(e);function bt(){}function yt(t){for(var e=0,n=t.length,i="";e<n;e++)i+=t[e].value;return i}function wt(t,e,n){var i=e.dir,r=e.next,o=r||i,s=n&&"parentNode"===o,a=C++;return e.first?function(e,n,r){for(;e=e[i];)if(1===e.nodeType||s)return t(e,n,r);return!1}:function(e,n,c){var u,l,d,p=[N,a];if(c){for(;e=e[i];)if((1===e.nodeType||s)&&t(e,n,c))return!0}else for(;e=e[i];)if(1===e.nodeType||s)if(l=(d=e[w]||(e[w]={}))[e.uniqueID]||(d[e.uniqueID]={}),r&&r===e.nodeName.toLowerCase())e=e[i]||e;else{if((u=l[o])&&u[0]===N&&u[1]===a)return p[2]=u[2];if(l[o]=p,p[2]=t(e,n,c))return!0}return!1}}function xt(t){return t.length>1?function(e,n,i){for(var r=t.length;r--;)if(!t[r](e,n,i))return!1;return!0}:t[0]}function Nt(t,e,n,i,r){for(var o,s=[],a=0,c=t.length,u=null!=e;a<c;a++)(o=t[a])&&(n&&!n(o,i,r)||(s.push(o),u&&e.push(a)));return s}function Ct(t,e,n,i,r,o){return i&&!i[w]&&(i=Ct(i)),r&&!r[w]&&(r=Ct(r,o)),ut((function(o,s,a,c){var u,l,d,p=[],h=[],f=s.length,m=o||function(t,e,n){for(var i=0,r=e.length;i<r;i++)at(t,e[i],n);return n}(e||"*",a.nodeType?[a]:a,[]),v=!t||!o&&e?m:Nt(m,p,t,a,c),g=n?r||(o?t:f||i)?[]:s:v;if(n&&n(v,g,a,c),i)for(u=Nt(g,h),i(u,[],a,c),l=u.length;l--;)(d=u[l])&&(g[h[l]]=!(v[h[l]]=d));if(o){if(r||t){if(r){for(u=[],l=g.length;l--;)(d=g[l])&&u.push(v[l]=d);r(null,g=[],u,c)}for(l=g.length;l--;)(d=g[l])&&(u=r?I(o,d):p[l])>-1&&(o[u]=!(s[u]=d))}}else g=Nt(g===s?g.splice(f,g.length):g),r?r(null,s,g,c):$.apply(s,g)}))}function Ot(t){for(var e,n,r,o=t.length,s=i.relative[t[0].type],a=s||i.relative[" "],c=s?1:0,l=wt((function(t){return t===e}),a,!0),d=wt((function(t){return I(e,t)>-1}),a,!0),p=[function(t,n,i){var r=!s&&(i||n!==u)||((e=n).nodeType?l(t,n,i):d(t,n,i));return e=null,r}];c<o;c++)if(n=i.relative[t[c].type])p=[wt(xt(p),n)];else{if((n=i.filter[t[c].type].apply(null,t[c].matches))[w]){for(r=++c;r<o&&!i.relative[t[r].type];r++);return Ct(c>1&&xt(p),c>1&&yt(t.slice(0,c-1).concat({value:" "===t[c-2].type?"*":""})).replace(F,"$1"),n,c<r&&Ot(t.slice(c,r)),r<o&&Ot(t=t.slice(r)),r<o&&yt(t))}p.push(n)}return xt(p)}return bt.prototype=i.filters=i.pseudos,i.setFilters=new bt,s=at.tokenize=function(t,e){var n,r,o,s,a,c,u,l=T[t+" "];if(l)return e?0:l.slice(0);for(a=t,c=[],u=i.preFilter;a;){for(s in n&&!(r=q.exec(a))||(r&&(a=a.slice(r[0].length)||a),c.push(o=[])),n=!1,(r=z.exec(a))&&(n=r.shift(),o.push({value:n,type:r[0].replace(F," ")}),a=a.slice(n.length)),i.filter)!(r=K[s].exec(a))||u[s]&&!(r=u[s](r))||(n=r.shift(),o.push({value:n,type:s,matches:r}),a=a.slice(n.length));if(!n)break}return e?a.length:a?at.error(t):T(t,c).slice(0)},a=at.compile=function(t,e){var n,r=[],o=[],a=k[t+" "];if(!a){for(e||(e=s(t)),n=e.length;n--;)(a=Ot(e[n]))[w]?r.push(a):o.push(a);(a=k(t,function(t,e){var n=e.length>0,r=t.length>0,o=function(o,s,a,c,l){var d,f,v,g=0,b="0",y=o&&[],w=[],x=u,C=o||r&&i.find.TAG("*",l),O=N+=null==x?1:Math.random()||.1,T=C.length;for(l&&(u=s==h||s||l);b!==T&&null!=(d=C[b]);b++){if(r&&d){for(f=0,s||d.ownerDocument==h||(p(d),a=!m);v=t[f++];)if(v(d,s||h,a)){c.push(d);break}l&&(N=O)}n&&((d=!v&&d)&&g--,o&&y.push(d))}if(g+=b,n&&b!==g){for(f=0;v=e[f++];)v(y,w,s,a);if(o){if(g>0)for(;b--;)y[b]||w[b]||(w[b]=P.call(c));w=Nt(w)}$.apply(c,w),l&&!o&&w.length>0&&g+e.length>1&&at.uniqueSort(c)}return l&&(N=O,u=x),y};return n?ut(o):o}(o,r))).selector=t}return a},c=at.select=function(t,e,n,r){var o,c,u,l,d,p="function"==typeof t&&t,h=!r&&s(t=p.selector||t);if(n=n||[],1===h.length){if((c=h[0]=h[0].slice(0)).length>2&&"ID"===(u=c[0]).type&&9===e.nodeType&&m&&i.relative[c[1].type]){if(!(e=(i.find.ID(u.matches[0].replace(et,nt),e)||[])[0]))return n;p&&(e=e.parentNode),t=t.slice(c.shift().value.length)}for(o=K.needsContext.test(t)?0:c.length;o--&&(u=c[o],!i.relative[l=u.type]);)if((d=i.find[l])&&(r=d(u.matches[0].replace(et,nt),tt.test(c[0].type)&&gt(e.parentNode)||e))){if(c.splice(o,1),!(t=r.length&&yt(c)))return $.apply(n,r),n;break}}return(p||a(t,h))(r,e,!m,n,!e||tt.test(t)&&gt(e.parentNode)||e),n},n.sortStable=w.split("").sort(S).join("")===w,n.detectDuplicates=!!d,p(),n.sortDetached=lt((function(t){return 1&t.compareDocumentPosition(h.createElement("fieldset"))})),lt((function(t){return t.innerHTML="<a href='#'></a>","#"===t.firstChild.getAttribute("href")}))||dt("type|href|height|width",(function(t,e,n){if(!n)return t.getAttribute(e,"type"===e.toLowerCase()?1:2)})),n.attributes&&lt((function(t){return t.innerHTML="<input/>",t.firstChild.setAttribute("value",""),""===t.firstChild.getAttribute("value")}))||dt("value",(function(t,e,n){if(!n&&"input"===t.nodeName.toLowerCase())return t.defaultValue})),lt((function(t){return null==t.getAttribute("disabled")}))||dt(M,(function(t,e,n){var i;if(!n)return!0===t[e]?e.toLowerCase():(i=t.getAttributeNode(e))&&i.specified?i.value:null})),at}(n);C.find=T,C.expr=T.selectors,C.expr[":"]=C.expr.pseudos,C.uniqueSort=C.unique=T.uniqueSort,C.text=T.getText,C.isXMLDoc=T.isXML,C.contains=T.contains,C.escapeSelector=T.escape;var k=function(t,e,n){for(var i=[],r=void 0!==n;(t=t[e])&&9!==t.nodeType;)if(1===t.nodeType){if(r&&C(t).is(n))break;i.push(t)}return i},j=function(t,e){for(var n=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&n.push(t);return n},S=C.expr.match.needsContext;function A(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()}var E=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function P(t,e,n){return g(e)?C.grep(t,(function(t,i){return!!e.call(t,i,t)!==n})):e.nodeType?C.grep(t,(function(t){return t===e!==n})):"string"!=typeof e?C.grep(t,(function(t){return l.call(e,t)>-1!==n})):C.filter(e,t,n)}C.filter=function(t,e,n){var i=e[0];return n&&(t=":not("+t+")"),1===e.length&&1===i.nodeType?C.find.matchesSelector(i,t)?[i]:[]:C.find.matches(t,C.grep(e,(function(t){return 1===t.nodeType})))},C.fn.extend({find:function(t){var e,n,i=this.length,r=this;if("string"!=typeof t)return this.pushStack(C(t).filter((function(){for(e=0;e<i;e++)if(C.contains(r[e],this))return!0})));for(n=this.pushStack([]),e=0;e<i;e++)C.find(t,r[e],n);return i>1?C.uniqueSort(n):n},filter:function(t){return this.pushStack(P(this,t||[],!1))},not:function(t){return this.pushStack(P(this,t||[],!0))},is:function(t){return!!P(this,"string"==typeof t&&S.test(t)?C(t):t||[],!1).length}});var D,$=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(C.fn.init=function(t,e,n){var i,r;if(!t)return this;if(n=n||D,"string"==typeof t){if(!(i="<"===t[0]&&">"===t[t.length-1]&&t.length>=3?[null,t,null]:$.exec(t))||!i[1]&&e)return!e||e.jquery?(e||n).find(t):this.constructor(e).find(t);if(i[1]){if(e=e instanceof C?e[0]:e,C.merge(this,C.parseHTML(i[1],e&&e.nodeType?e.ownerDocument||e:y,!0)),E.test(i[1])&&C.isPlainObject(e))for(i in e)g(this[i])?this[i](e[i]):this.attr(i,e[i]);return this}return(r=y.getElementById(i[2]))&&(this[0]=r,this.length=1),this}return t.nodeType?(this[0]=t,this.length=1,this):g(t)?void 0!==n.ready?n.ready(t):t(C):C.makeArray(t,this)}).prototype=C.fn,D=C(y);var _=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};function M(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}C.fn.extend({has:function(t){var e=C(t,this),n=e.length;return this.filter((function(){for(var t=0;t<n;t++)if(C.contains(this,e[t]))return!0}))},closest:function(t,e){var n,i=0,r=this.length,o=[],s="string"!=typeof t&&C(t);if(!S.test(t))for(;i<r;i++)for(n=this[i];n&&n!==e;n=n.parentNode)if(n.nodeType<11&&(s?s.index(n)>-1:1===n.nodeType&&C.find.matchesSelector(n,t))){o.push(n);break}return this.pushStack(o.length>1?C.uniqueSort(o):o)},index:function(t){return t?"string"==typeof t?l.call(C(t),this[0]):l.call(this,t.jquery?t[0]:t):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){return this.pushStack(C.uniqueSort(C.merge(this.get(),C(t,e))))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),C.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return k(t,"parentNode")},parentsUntil:function(t,e,n){return k(t,"parentNode",n)},next:function(t){return M(t,"nextSibling")},prev:function(t){return M(t,"previousSibling")},nextAll:function(t){return k(t,"nextSibling")},prevAll:function(t){return k(t,"previousSibling")},nextUntil:function(t,e,n){return k(t,"nextSibling",n)},prevUntil:function(t,e,n){return k(t,"previousSibling",n)},siblings:function(t){return j((t.parentNode||{}).firstChild,t)},children:function(t){return j(t.firstChild)},contents:function(t){return null!=t.contentDocument&&s(t.contentDocument)?t.contentDocument:(A(t,"template")&&(t=t.content||t),C.merge([],t.childNodes))}},(function(t,e){C.fn[t]=function(n,i){var r=C.map(this,e,n);return"Until"!==t.slice(-5)&&(i=n),i&&"string"==typeof i&&(r=C.filter(i,r)),this.length>1&&(I[t]||C.uniqueSort(r),_.test(t)&&r.reverse()),this.pushStack(r)}}));var L=/[^\x20\t\r\n\f]+/g;function R(t){return t}function B(t){throw t}function H(t,e,n,i){var r;try{t&&g(r=t.promise)?r.call(t).done(e).fail(n):t&&g(r=t.then)?r.call(t,e,n):e.apply(void 0,[t].slice(i))}catch(t){n.apply(void 0,[t])}}C.Callbacks=function(t){t="string"==typeof t?function(t){var e={};return C.each(t.match(L)||[],(function(t,n){e[n]=!0})),e}(t):C.extend({},t);var e,n,i,r,o=[],s=[],a=-1,c=function(){for(r=r||t.once,i=e=!0;s.length;a=-1)for(n=s.shift();++a<o.length;)!1===o[a].apply(n[0],n[1])&&t.stopOnFalse&&(a=o.length,n=!1);t.memory||(n=!1),e=!1,r&&(o=n?[]:"")},u={add:function(){return o&&(n&&!e&&(a=o.length-1,s.push(n)),function e(n){C.each(n,(function(n,i){g(i)?t.unique&&u.has(i)||o.push(i):i&&i.length&&"string"!==N(i)&&e(i)}))}(arguments),n&&!e&&c()),this},remove:function(){return C.each(arguments,(function(t,e){for(var n;(n=C.inArray(e,o,n))>-1;)o.splice(n,1),n<=a&&a--})),this},has:function(t){return t?C.inArray(t,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return r=s=[],o=n="",this},disabled:function(){return!o},lock:function(){return r=s=[],n||e||(o=n=""),this},locked:function(){return!!r},fireWith:function(t,n){return r||(n=[t,(n=n||[]).slice?n.slice():n],s.push(n),e||c()),this},fire:function(){return u.fireWith(this,arguments),this},fired:function(){return!!i}};return u},C.extend({Deferred:function(t){var e=[["notify","progress",C.Callbacks("memory"),C.Callbacks("memory"),2],["resolve","done",C.Callbacks("once memory"),C.Callbacks("once memory"),0,"resolved"],["reject","fail",C.Callbacks("once memory"),C.Callbacks("once memory"),1,"rejected"]],i="pending",r={state:function(){return i},always:function(){return o.done(arguments).fail(arguments),this},catch:function(t){return r.then(null,t)},pipe:function(){var t=arguments;return C.Deferred((function(n){C.each(e,(function(e,i){var r=g(t[i[4]])&&t[i[4]];o[i[1]]((function(){var t=r&&r.apply(this,arguments);t&&g(t.promise)?t.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[i[0]+"With"](this,r?[t]:arguments)}))})),t=null})).promise()},then:function(t,i,r){var o=0;function s(t,e,i,r){return function(){var a=this,c=arguments,u=function(){var n,u;if(!(t<o)){if((n=i.apply(a,c))===e.promise())throw new TypeError("Thenable self-resolution");u=n&&("object"==typeof n||"function"==typeof n)&&n.then,g(u)?r?u.call(n,s(o,e,R,r),s(o,e,B,r)):(o++,u.call(n,s(o,e,R,r),s(o,e,B,r),s(o,e,R,e.notifyWith))):(i!==R&&(a=void 0,c=[n]),(r||e.resolveWith)(a,c))}},l=r?u:function(){try{u()}catch(n){C.Deferred.exceptionHook&&C.Deferred.exceptionHook(n,l.stackTrace),t+1>=o&&(i!==B&&(a=void 0,c=[n]),e.rejectWith(a,c))}};t?l():(C.Deferred.getStackHook&&(l.stackTrace=C.Deferred.getStackHook()),n.setTimeout(l))}}return C.Deferred((function(n){e[0][3].add(s(0,n,g(r)?r:R,n.notifyWith)),e[1][3].add(s(0,n,g(t)?t:R)),e[2][3].add(s(0,n,g(i)?i:B))})).promise()},promise:function(t){return null!=t?C.extend(t,r):r}},o={};return C.each(e,(function(t,n){var s=n[2],a=n[5];r[n[1]]=s.add,a&&s.add((function(){i=a}),e[3-t][2].disable,e[3-t][3].disable,e[0][2].lock,e[0][3].lock),s.add(n[3].fire),o[n[0]]=function(){return o[n[0]+"With"](this===o?void 0:this,arguments),this},o[n[0]+"With"]=s.fireWith})),r.promise(o),t&&t.call(o,o),o},when:function(t){var e=arguments.length,n=e,i=Array(n),r=a.call(arguments),o=C.Deferred(),s=function(t){return function(n){i[t]=this,r[t]=arguments.length>1?a.call(arguments):n,--e||o.resolveWith(i,r)}};if(e<=1&&(H(t,o.done(s(n)).resolve,o.reject,!e),"pending"===o.state()||g(r[n]&&r[n].then)))return o.then();for(;n--;)H(r[n],s(n),o.reject);return o.promise()}});var U=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;C.Deferred.exceptionHook=function(t,e){n.console&&n.console.warn&&t&&U.test(t.name)&&n.console.warn("jQuery.Deferred exception: "+t.message,t.stack,e)},C.readyException=function(t){n.setTimeout((function(){throw t}))};var F=C.Deferred();function q(){y.removeEventListener("DOMContentLoaded",q),n.removeEventListener("load",q),C.ready()}C.fn.ready=function(t){return F.then(t).catch((function(t){C.readyException(t)})),this},C.extend({isReady:!1,readyWait:1,ready:function(t){(!0===t?--C.readyWait:C.isReady)||(C.isReady=!0,!0!==t&&--C.readyWait>0||F.resolveWith(y,[C]))}}),C.ready.then=F.then,"complete"===y.readyState||"loading"!==y.readyState&&!y.documentElement.doScroll?n.setTimeout(C.ready):(y.addEventListener("DOMContentLoaded",q),n.addEventListener("load",q));var z=function(t,e,n,i,r,o,s){var a=0,c=t.length,u=null==n;if("object"===N(n))for(a in r=!0,n)z(t,e,a,n[a],!0,o,s);else if(void 0!==i&&(r=!0,g(i)||(s=!0),u&&(s?(e.call(t,i),e=null):(u=e,e=function(t,e,n){return u.call(C(t),n)})),e))for(;a<c;a++)e(t[a],n,s?i:i.call(t[a],a,e(t[a],n)));return r?t:u?e.call(t):c?e(t[0],n):o},W=/^-ms-/,V=/-([a-z])/g;function Y(t,e){return e.toUpperCase()}function K(t){return t.replace(W,"ms-").replace(V,Y)}var G=function(t){return 1===t.nodeType||9===t.nodeType||!+t.nodeType};function X(){this.expando=C.expando+X.uid++}X.uid=1,X.prototype={cache:function(t){var e=t[this.expando];return e||(e={},G(t)&&(t.nodeType?t[this.expando]=e:Object.defineProperty(t,this.expando,{value:e,configurable:!0}))),e},set:function(t,e,n){var i,r=this.cache(t);if("string"==typeof e)r[K(e)]=n;else for(i in e)r[K(i)]=e[i];return r},get:function(t,e){return void 0===e?this.cache(t):t[this.expando]&&t[this.expando][K(e)]},access:function(t,e,n){return void 0===e||e&&"string"==typeof e&&void 0===n?this.get(t,e):(this.set(t,e,n),void 0!==n?n:e)},remove:function(t,e){var n,i=t[this.expando];if(void 0!==i){if(void 0!==e){n=(e=Array.isArray(e)?e.map(K):(e=K(e))in i?[e]:e.match(L)||[]).length;for(;n--;)delete i[e[n]]}(void 0===e||C.isEmptyObject(i))&&(t.nodeType?t[this.expando]=void 0:delete t[this.expando])}},hasData:function(t){var e=t[this.expando];return void 0!==e&&!C.isEmptyObject(e)}};var J=new X,Q=new X,Z=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,tt=/[A-Z]/g;function et(t,e,n){var i;if(void 0===n&&1===t.nodeType)if(i="data-"+e.replace(tt,"-$&").toLowerCase(),"string"==typeof(n=t.getAttribute(i))){try{n=function(t){return"true"===t||"false"!==t&&("null"===t?null:t===+t+""?+t:Z.test(t)?JSON.parse(t):t)}(n)}catch(t){}Q.set(t,e,n)}else n=void 0;return n}C.extend({hasData:function(t){return Q.hasData(t)||J.hasData(t)},data:function(t,e,n){return Q.access(t,e,n)},removeData:function(t,e){Q.remove(t,e)},_data:function(t,e,n){return J.access(t,e,n)},_removeData:function(t,e){J.remove(t,e)}}),C.fn.extend({data:function(t,e){var n,i,r,o=this[0],s=o&&o.attributes;if(void 0===t){if(this.length&&(r=Q.get(o),1===o.nodeType&&!J.get(o,"hasDataAttrs"))){for(n=s.length;n--;)s[n]&&0===(i=s[n].name).indexOf("data-")&&(i=K(i.slice(5)),et(o,i,r[i]));J.set(o,"hasDataAttrs",!0)}return r}return"object"==typeof t?this.each((function(){Q.set(this,t)})):z(this,(function(e){var n;if(o&&void 0===e)return void 0!==(n=Q.get(o,t))||void 0!==(n=et(o,t))?n:void 0;this.each((function(){Q.set(this,t,e)}))}),null,e,arguments.length>1,null,!0)},removeData:function(t){return this.each((function(){Q.remove(this,t)}))}}),C.extend({queue:function(t,e,n){var i;if(t)return e=(e||"fx")+"queue",i=J.get(t,e),n&&(!i||Array.isArray(n)?i=J.access(t,e,C.makeArray(n)):i.push(n)),i||[]},dequeue:function(t,e){e=e||"fx";var n=C.queue(t,e),i=n.length,r=n.shift(),o=C._queueHooks(t,e);"inprogress"===r&&(r=n.shift(),i--),r&&("fx"===e&&n.unshift("inprogress"),delete o.stop,r.call(t,(function(){C.dequeue(t,e)}),o)),!i&&o&&o.empty.fire()},_queueHooks:function(t,e){var n=e+"queueHooks";return J.get(t,n)||J.access(t,n,{empty:C.Callbacks("once memory").add((function(){J.remove(t,[e+"queue",n])}))})}}),C.fn.extend({queue:function(t,e){var n=2;return"string"!=typeof t&&(e=t,t="fx",n--),arguments.length<n?C.queue(this[0],t):void 0===e?this:this.each((function(){var n=C.queue(this,t,e);C._queueHooks(this,t),"fx"===t&&"inprogress"!==n[0]&&C.dequeue(this,t)}))},dequeue:function(t){return this.each((function(){C.dequeue(this,t)}))},clearQueue:function(t){return this.queue(t||"fx",[])},promise:function(t,e){var n,i=1,r=C.Deferred(),o=this,s=this.length,a=function(){--i||r.resolveWith(o,[o])};for("string"!=typeof t&&(e=t,t=void 0),t=t||"fx";s--;)(n=J.get(o[s],t+"queueHooks"))&&n.empty&&(i++,n.empty.add(a));return a(),r.promise(e)}});var nt=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,it=new RegExp("^(?:([+-])=|)("+nt+")([a-z%]*)$","i"),rt=["Top","Right","Bottom","Left"],ot=y.documentElement,st=function(t){return C.contains(t.ownerDocument,t)},at={composed:!0};ot.getRootNode&&(st=function(t){return C.contains(t.ownerDocument,t)||t.getRootNode(at)===t.ownerDocument});var ct=function(t,e){return"none"===(t=e||t).style.display||""===t.style.display&&st(t)&&"none"===C.css(t,"display")};function ut(t,e,n,i){var r,o,s=20,a=i?function(){return i.cur()}:function(){return C.css(t,e,"")},c=a(),u=n&&n[3]||(C.cssNumber[e]?"":"px"),l=t.nodeType&&(C.cssNumber[e]||"px"!==u&&+c)&&it.exec(C.css(t,e));if(l&&l[3]!==u){for(c/=2,u=u||l[3],l=+c||1;s--;)C.style(t,e,l+u),(1-o)*(1-(o=a()/c||.5))<=0&&(s=0),l/=o;l*=2,C.style(t,e,l+u),n=n||[]}return n&&(l=+l||+c||0,r=n[1]?l+(n[1]+1)*n[2]:+n[2],i&&(i.unit=u,i.start=l,i.end=r)),r}var lt={};function dt(t){var e,n=t.ownerDocument,i=t.nodeName,r=lt[i];return r||(e=n.body.appendChild(n.createElement(i)),r=C.css(e,"display"),e.parentNode.removeChild(e),"none"===r&&(r="block"),lt[i]=r,r)}function pt(t,e){for(var n,i,r=[],o=0,s=t.length;o<s;o++)(i=t[o]).style&&(n=i.style.display,e?("none"===n&&(r[o]=J.get(i,"display")||null,r[o]||(i.style.display="")),""===i.style.display&&ct(i)&&(r[o]=dt(i))):"none"!==n&&(r[o]="none",J.set(i,"display",n)));for(o=0;o<s;o++)null!=r[o]&&(t[o].style.display=r[o]);return t}C.fn.extend({show:function(){return pt(this,!0)},hide:function(){return pt(this)},toggle:function(t){return"boolean"==typeof t?t?this.show():this.hide():this.each((function(){ct(this)?C(this).show():C(this).hide()}))}});var ht,ft,mt=/^(?:checkbox|radio)$/i,vt=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,gt=/^$|^module$|\/(?:java|ecma)script/i;ht=y.createDocumentFragment().appendChild(y.createElement("div")),(ft=y.createElement("input")).setAttribute("type","radio"),ft.setAttribute("checked","checked"),ft.setAttribute("name","t"),ht.appendChild(ft),v.checkClone=ht.cloneNode(!0).cloneNode(!0).lastChild.checked,ht.innerHTML="<textarea>x</textarea>",v.noCloneChecked=!!ht.cloneNode(!0).lastChild.defaultValue,ht.innerHTML="<option></option>",v.option=!!ht.lastChild;var bt={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function yt(t,e){var n;return n=void 0!==t.getElementsByTagName?t.getElementsByTagName(e||"*"):void 0!==t.querySelectorAll?t.querySelectorAll(e||"*"):[],void 0===e||e&&A(t,e)?C.merge([t],n):n}function wt(t,e){for(var n=0,i=t.length;n<i;n++)J.set(t[n],"globalEval",!e||J.get(e[n],"globalEval"))}bt.tbody=bt.tfoot=bt.colgroup=bt.caption=bt.thead,bt.th=bt.td,v.option||(bt.optgroup=bt.option=[1,"<select multiple='multiple'>","</select>"]);var xt=/<|&#?\w+;/;function Nt(t,e,n,i,r){for(var o,s,a,c,u,l,d=e.createDocumentFragment(),p=[],h=0,f=t.length;h<f;h++)if((o=t[h])||0===o)if("object"===N(o))C.merge(p,o.nodeType?[o]:o);else if(xt.test(o)){for(s=s||d.appendChild(e.createElement("div")),a=(vt.exec(o)||["",""])[1].toLowerCase(),c=bt[a]||bt._default,s.innerHTML=c[1]+C.htmlPrefilter(o)+c[2],l=c[0];l--;)s=s.lastChild;C.merge(p,s.childNodes),(s=d.firstChild).textContent=""}else p.push(e.createTextNode(o));for(d.textContent="",h=0;o=p[h++];)if(i&&C.inArray(o,i)>-1)r&&r.push(o);else if(u=st(o),s=yt(d.appendChild(o),"script"),u&&wt(s),n)for(l=0;o=s[l++];)gt.test(o.type||"")&&n.push(o);return d}var Ct=/^key/,Ot=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Tt=/^([^.]*)(?:\.(.+)|)/;function kt(){return!0}function jt(){return!1}function St(t,e){return t===function(){try{return y.activeElement}catch(t){}}()==("focus"===e)}function At(t,e,n,i,r,o){var s,a;if("object"==typeof e){for(a in"string"!=typeof n&&(i=i||n,n=void 0),e)At(t,a,n,i,e[a],o);return t}if(null==i&&null==r?(r=n,i=n=void 0):null==r&&("string"==typeof n?(r=i,i=void 0):(r=i,i=n,n=void 0)),!1===r)r=jt;else if(!r)return t;return 1===o&&(s=r,(r=function(t){return C().off(t),s.apply(this,arguments)}).guid=s.guid||(s.guid=C.guid++)),t.each((function(){C.event.add(this,e,r,i,n)}))}function Et(t,e,n){n?(J.set(t,e,!1),C.event.add(t,e,{namespace:!1,handler:function(t){var i,r,o=J.get(this,e);if(1&t.isTrigger&&this[e]){if(o.length)(C.event.special[e]||{}).delegateType&&t.stopPropagation();else if(o=a.call(arguments),J.set(this,e,o),i=n(this,e),this[e](),o!==(r=J.get(this,e))||i?J.set(this,e,!1):r={},o!==r)return t.stopImmediatePropagation(),t.preventDefault(),r.value}else o.length&&(J.set(this,e,{value:C.event.trigger(C.extend(o[0],C.Event.prototype),o.slice(1),this)}),t.stopImmediatePropagation())}})):void 0===J.get(t,e)&&C.event.add(t,e,kt)}C.event={global:{},add:function(t,e,n,i,r){var o,s,a,c,u,l,d,p,h,f,m,v=J.get(t);if(G(t))for(n.handler&&(n=(o=n).handler,r=o.selector),r&&C.find.matchesSelector(ot,r),n.guid||(n.guid=C.guid++),(c=v.events)||(c=v.events=Object.create(null)),(s=v.handle)||(s=v.handle=function(e){return void 0!==C&&C.event.triggered!==e.type?C.event.dispatch.apply(t,arguments):void 0}),u=(e=(e||"").match(L)||[""]).length;u--;)h=m=(a=Tt.exec(e[u])||[])[1],f=(a[2]||"").split(".").sort(),h&&(d=C.event.special[h]||{},h=(r?d.delegateType:d.bindType)||h,d=C.event.special[h]||{},l=C.extend({type:h,origType:m,data:i,handler:n,guid:n.guid,selector:r,needsContext:r&&C.expr.match.needsContext.test(r),namespace:f.join(".")},o),(p=c[h])||((p=c[h]=[]).delegateCount=0,d.setup&&!1!==d.setup.call(t,i,f,s)||t.addEventListener&&t.addEventListener(h,s)),d.add&&(d.add.call(t,l),l.handler.guid||(l.handler.guid=n.guid)),r?p.splice(p.delegateCount++,0,l):p.push(l),C.event.global[h]=!0)},remove:function(t,e,n,i,r){var o,s,a,c,u,l,d,p,h,f,m,v=J.hasData(t)&&J.get(t);if(v&&(c=v.events)){for(u=(e=(e||"").match(L)||[""]).length;u--;)if(h=m=(a=Tt.exec(e[u])||[])[1],f=(a[2]||"").split(".").sort(),h){for(d=C.event.special[h]||{},p=c[h=(i?d.delegateType:d.bindType)||h]||[],a=a[2]&&new RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=o=p.length;o--;)l=p[o],!r&&m!==l.origType||n&&n.guid!==l.guid||a&&!a.test(l.namespace)||i&&i!==l.selector&&("**"!==i||!l.selector)||(p.splice(o,1),l.selector&&p.delegateCount--,d.remove&&d.remove.call(t,l));s&&!p.length&&(d.teardown&&!1!==d.teardown.call(t,f,v.handle)||C.removeEvent(t,h,v.handle),delete c[h])}else for(h in c)C.event.remove(t,h+e[u],n,i,!0);C.isEmptyObject(c)&&J.remove(t,"handle events")}},dispatch:function(t){var e,n,i,r,o,s,a=new Array(arguments.length),c=C.event.fix(t),u=(J.get(this,"events")||Object.create(null))[c.type]||[],l=C.event.special[c.type]||{};for(a[0]=c,e=1;e<arguments.length;e++)a[e]=arguments[e];if(c.delegateTarget=this,!l.preDispatch||!1!==l.preDispatch.call(this,c)){for(s=C.event.handlers.call(this,c,u),e=0;(r=s[e++])&&!c.isPropagationStopped();)for(c.currentTarget=r.elem,n=0;(o=r.handlers[n++])&&!c.isImmediatePropagationStopped();)c.rnamespace&&!1!==o.namespace&&!c.rnamespace.test(o.namespace)||(c.handleObj=o,c.data=o.data,void 0!==(i=((C.event.special[o.origType]||{}).handle||o.handler).apply(r.elem,a))&&!1===(c.result=i)&&(c.preventDefault(),c.stopPropagation()));return l.postDispatch&&l.postDispatch.call(this,c),c.result}},handlers:function(t,e){var n,i,r,o,s,a=[],c=e.delegateCount,u=t.target;if(c&&u.nodeType&&!("click"===t.type&&t.button>=1))for(;u!==this;u=u.parentNode||this)if(1===u.nodeType&&("click"!==t.type||!0!==u.disabled)){for(o=[],s={},n=0;n<c;n++)void 0===s[r=(i=e[n]).selector+" "]&&(s[r]=i.needsContext?C(r,this).index(u)>-1:C.find(r,this,null,[u]).length),s[r]&&o.push(i);o.length&&a.push({elem:u,handlers:o})}return u=this,c<e.length&&a.push({elem:u,handlers:e.slice(c)}),a},addProp:function(t,e){Object.defineProperty(C.Event.prototype,t,{enumerable:!0,configurable:!0,get:g(e)?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set:function(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})},fix:function(t){return t[C.expando]?t:new C.Event(t)},special:{load:{noBubble:!0},click:{setup:function(t){var e=this||t;return mt.test(e.type)&&e.click&&A(e,"input")&&Et(e,"click",kt),!1},trigger:function(t){var e=this||t;return mt.test(e.type)&&e.click&&A(e,"input")&&Et(e,"click"),!0},_default:function(t){var e=t.target;return mt.test(e.type)&&e.click&&A(e,"input")&&J.get(e,"click")||A(e,"a")}},beforeunload:{postDispatch:function(t){void 0!==t.result&&t.originalEvent&&(t.originalEvent.returnValue=t.result)}}}},C.removeEvent=function(t,e,n){t.removeEventListener&&t.removeEventListener(e,n)},C.Event=function(t,e){if(!(this instanceof C.Event))return new C.Event(t,e);t&&t.type?(this.originalEvent=t,this.type=t.type,this.isDefaultPrevented=t.defaultPrevented||void 0===t.defaultPrevented&&!1===t.returnValue?kt:jt,this.target=t.target&&3===t.target.nodeType?t.target.parentNode:t.target,this.currentTarget=t.currentTarget,this.relatedTarget=t.relatedTarget):this.type=t,e&&C.extend(this,e),this.timeStamp=t&&t.timeStamp||Date.now(),this[C.expando]=!0},C.Event.prototype={constructor:C.Event,isDefaultPrevented:jt,isPropagationStopped:jt,isImmediatePropagationStopped:jt,isSimulated:!1,preventDefault:function(){var t=this.originalEvent;this.isDefaultPrevented=kt,t&&!this.isSimulated&&t.preventDefault()},stopPropagation:function(){var t=this.originalEvent;this.isPropagationStopped=kt,t&&!this.isSimulated&&t.stopPropagation()},stopImmediatePropagation:function(){var t=this.originalEvent;this.isImmediatePropagationStopped=kt,t&&!this.isSimulated&&t.stopImmediatePropagation(),this.stopPropagation()}},C.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,char:!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(t){var e=t.button;return null==t.which&&Ct.test(t.type)?null!=t.charCode?t.charCode:t.keyCode:!t.which&&void 0!==e&&Ot.test(t.type)?1&e?1:2&e?3:4&e?2:0:t.which}},C.event.addProp),C.each({focus:"focusin",blur:"focusout"},(function(t,e){C.event.special[t]={setup:function(){return Et(this,t,St),!1},trigger:function(){return Et(this,t),!0},delegateType:e}})),C.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},(function(t,e){C.event.special[t]={delegateType:e,bindType:e,handle:function(t){var n,i=this,r=t.relatedTarget,o=t.handleObj;return r&&(r===i||C.contains(i,r))||(t.type=o.origType,n=o.handler.apply(this,arguments),t.type=e),n}}})),C.fn.extend({on:function(t,e,n,i){return At(this,t,e,n,i)},one:function(t,e,n,i){return At(this,t,e,n,i,1)},off:function(t,e,n){var i,r;if(t&&t.preventDefault&&t.handleObj)return i=t.handleObj,C(t.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof t){for(r in t)this.off(r,e,t[r]);return this}return!1!==e&&"function"!=typeof e||(n=e,e=void 0),!1===n&&(n=jt),this.each((function(){C.event.remove(this,t,n,e)}))}});var Pt=/<script|<style|<link/i,Dt=/checked\s*(?:[^=]|=\s*.checked.)/i,$t=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function _t(t,e){return A(t,"table")&&A(11!==e.nodeType?e:e.firstChild,"tr")&&C(t).children("tbody")[0]||t}function It(t){return t.type=(null!==t.getAttribute("type"))+"/"+t.type,t}function Mt(t){return"true/"===(t.type||"").slice(0,5)?t.type=t.type.slice(5):t.removeAttribute("type"),t}function Lt(t,e){var n,i,r,o,s,a;if(1===e.nodeType){if(J.hasData(t)&&(a=J.get(t).events))for(r in J.remove(e,"handle events"),a)for(n=0,i=a[r].length;n<i;n++)C.event.add(e,r,a[r][n]);Q.hasData(t)&&(o=Q.access(t),s=C.extend({},o),Q.set(e,s))}}function Rt(t,e){var n=e.nodeName.toLowerCase();"input"===n&&mt.test(t.type)?e.checked=t.checked:"input"!==n&&"textarea"!==n||(e.defaultValue=t.defaultValue)}function Bt(t,e,n,i){e=c(e);var r,o,s,a,u,l,d=0,p=t.length,h=p-1,f=e[0],m=g(f);if(m||p>1&&"string"==typeof f&&!v.checkClone&&Dt.test(f))return t.each((function(r){var o=t.eq(r);m&&(e[0]=f.call(this,r,o.html())),Bt(o,e,n,i)}));if(p&&(o=(r=Nt(e,t[0].ownerDocument,!1,t,i)).firstChild,1===r.childNodes.length&&(r=o),o||i)){for(a=(s=C.map(yt(r,"script"),It)).length;d<p;d++)u=r,d!==h&&(u=C.clone(u,!0,!0),a&&C.merge(s,yt(u,"script"))),n.call(t[d],u,d);if(a)for(l=s[s.length-1].ownerDocument,C.map(s,Mt),d=0;d<a;d++)u=s[d],gt.test(u.type||"")&&!J.access(u,"globalEval")&&C.contains(l,u)&&(u.src&&"module"!==(u.type||"").toLowerCase()?C._evalUrl&&!u.noModule&&C._evalUrl(u.src,{nonce:u.nonce||u.getAttribute("nonce")},l):x(u.textContent.replace($t,""),u,l))}return t}function Ht(t,e,n){for(var i,r=e?C.filter(e,t):t,o=0;null!=(i=r[o]);o++)n||1!==i.nodeType||C.cleanData(yt(i)),i.parentNode&&(n&&st(i)&&wt(yt(i,"script")),i.parentNode.removeChild(i));return t}C.extend({htmlPrefilter:function(t){return t},clone:function(t,e,n){var i,r,o,s,a=t.cloneNode(!0),c=st(t);if(!(v.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||C.isXMLDoc(t)))for(s=yt(a),i=0,r=(o=yt(t)).length;i<r;i++)Rt(o[i],s[i]);if(e)if(n)for(o=o||yt(t),s=s||yt(a),i=0,r=o.length;i<r;i++)Lt(o[i],s[i]);else Lt(t,a);return(s=yt(a,"script")).length>0&&wt(s,!c&&yt(t,"script")),a},cleanData:function(t){for(var e,n,i,r=C.event.special,o=0;void 0!==(n=t[o]);o++)if(G(n)){if(e=n[J.expando]){if(e.events)for(i in e.events)r[i]?C.event.remove(n,i):C.removeEvent(n,i,e.handle);n[J.expando]=void 0}n[Q.expando]&&(n[Q.expando]=void 0)}}}),C.fn.extend({detach:function(t){return Ht(this,t,!0)},remove:function(t){return Ht(this,t)},text:function(t){return z(this,(function(t){return void 0===t?C.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=t)}))}),null,t,arguments.length)},append:function(){return Bt(this,arguments,(function(t){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||_t(this,t).appendChild(t)}))},prepend:function(){return Bt(this,arguments,(function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=_t(this,t);e.insertBefore(t,e.firstChild)}}))},before:function(){return Bt(this,arguments,(function(t){this.parentNode&&this.parentNode.insertBefore(t,this)}))},after:function(){return Bt(this,arguments,(function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)}))},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(C.cleanData(yt(t,!1)),t.textContent="");return this},clone:function(t,e){return t=null!=t&&t,e=null==e?t:e,this.map((function(){return C.clone(this,t,e)}))},html:function(t){return z(this,(function(t){var e=this[0]||{},n=0,i=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!Pt.test(t)&&!bt[(vt.exec(t)||["",""])[1].toLowerCase()]){t=C.htmlPrefilter(t);try{for(;n<i;n++)1===(e=this[n]||{}).nodeType&&(C.cleanData(yt(e,!1)),e.innerHTML=t);e=0}catch(t){}}e&&this.empty().append(t)}),null,t,arguments.length)},replaceWith:function(){var t=[];return Bt(this,arguments,(function(e){var n=this.parentNode;C.inArray(this,t)<0&&(C.cleanData(yt(this)),n&&n.replaceChild(e,this))}),t)}}),C.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},(function(t,e){C.fn[t]=function(t){for(var n,i=[],r=C(t),o=r.length-1,s=0;s<=o;s++)n=s===o?this:this.clone(!0),C(r[s])[e](n),u.apply(i,n.get());return this.pushStack(i)}}));var Ut=new RegExp("^("+nt+")(?!px)[a-z%]+$","i"),Ft=function(t){var e=t.ownerDocument.defaultView;return e&&e.opener||(e=n),e.getComputedStyle(t)},qt=function(t,e,n){var i,r,o={};for(r in e)o[r]=t.style[r],t.style[r]=e[r];for(r in i=n.call(t),e)t.style[r]=o[r];return i},zt=new RegExp(rt.join("|"),"i");function Wt(t,e,n){var i,r,o,s,a=t.style;return(n=n||Ft(t))&&(""!==(s=n.getPropertyValue(e)||n[e])||st(t)||(s=C.style(t,e)),!v.pixelBoxStyles()&&Ut.test(s)&&zt.test(e)&&(i=a.width,r=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=s,s=n.width,a.width=i,a.minWidth=r,a.maxWidth=o)),void 0!==s?s+"":s}function Vt(t,e){return{get:function(){if(!t())return(this.get=e).apply(this,arguments);delete this.get}}}!function(){function t(){if(l){u.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",l.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",ot.appendChild(u).appendChild(l);var t=n.getComputedStyle(l);i="1%"!==t.top,c=12===e(t.marginLeft),l.style.right="60%",s=36===e(t.right),r=36===e(t.width),l.style.position="absolute",o=12===e(l.offsetWidth/3),ot.removeChild(u),l=null}}function e(t){return Math.round(parseFloat(t))}var i,r,o,s,a,c,u=y.createElement("div"),l=y.createElement("div");l.style&&(l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",v.clearCloneStyle="content-box"===l.style.backgroundClip,C.extend(v,{boxSizingReliable:function(){return t(),r},pixelBoxStyles:function(){return t(),s},pixelPosition:function(){return t(),i},reliableMarginLeft:function(){return t(),c},scrollboxSize:function(){return t(),o},reliableTrDimensions:function(){var t,e,i,r;return null==a&&(t=y.createElement("table"),e=y.createElement("tr"),i=y.createElement("div"),t.style.cssText="position:absolute;left:-11111px",e.style.height="1px",i.style.height="9px",ot.appendChild(t).appendChild(e).appendChild(i),r=n.getComputedStyle(e),a=parseInt(r.height)>3,ot.removeChild(t)),a}}))}();var Yt=["Webkit","Moz","ms"],Kt=y.createElement("div").style,Gt={};function Xt(t){var e=C.cssProps[t]||Gt[t];return e||(t in Kt?t:Gt[t]=function(t){for(var e=t[0].toUpperCase()+t.slice(1),n=Yt.length;n--;)if((t=Yt[n]+e)in Kt)return t}(t)||t)}var Jt=/^(none|table(?!-c[ea]).+)/,Qt=/^--/,Zt={position:"absolute",visibility:"hidden",display:"block"},te={letterSpacing:"0",fontWeight:"400"};function ee(t,e,n){var i=it.exec(e);return i?Math.max(0,i[2]-(n||0))+(i[3]||"px"):e}function ne(t,e,n,i,r,o){var s="width"===e?1:0,a=0,c=0;if(n===(i?"border":"content"))return 0;for(;s<4;s+=2)"margin"===n&&(c+=C.css(t,n+rt[s],!0,r)),i?("content"===n&&(c-=C.css(t,"padding"+rt[s],!0,r)),"margin"!==n&&(c-=C.css(t,"border"+rt[s]+"Width",!0,r))):(c+=C.css(t,"padding"+rt[s],!0,r),"padding"!==n?c+=C.css(t,"border"+rt[s]+"Width",!0,r):a+=C.css(t,"border"+rt[s]+"Width",!0,r));return!i&&o>=0&&(c+=Math.max(0,Math.ceil(t["offset"+e[0].toUpperCase()+e.slice(1)]-o-c-a-.5))||0),c}function ie(t,e,n){var i=Ft(t),r=(!v.boxSizingReliable()||n)&&"border-box"===C.css(t,"boxSizing",!1,i),o=r,s=Wt(t,e,i),a="offset"+e[0].toUpperCase()+e.slice(1);if(Ut.test(s)){if(!n)return s;s="auto"}return(!v.boxSizingReliable()&&r||!v.reliableTrDimensions()&&A(t,"tr")||"auto"===s||!parseFloat(s)&&"inline"===C.css(t,"display",!1,i))&&t.getClientRects().length&&(r="border-box"===C.css(t,"boxSizing",!1,i),(o=a in t)&&(s=t[a])),(s=parseFloat(s)||0)+ne(t,e,n||(r?"border":"content"),o,i,s)+"px"}function re(t,e,n,i,r){return new re.prototype.init(t,e,n,i,r)}C.extend({cssHooks:{opacity:{get:function(t,e){if(e){var n=Wt(t,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(t,e,n,i){if(t&&3!==t.nodeType&&8!==t.nodeType&&t.style){var r,o,s,a=K(e),c=Qt.test(e),u=t.style;if(c||(e=Xt(a)),s=C.cssHooks[e]||C.cssHooks[a],void 0===n)return s&&"get"in s&&void 0!==(r=s.get(t,!1,i))?r:u[e];"string"===(o=typeof n)&&(r=it.exec(n))&&r[1]&&(n=ut(t,e,r),o="number"),null!=n&&n==n&&("number"!==o||c||(n+=r&&r[3]||(C.cssNumber[a]?"":"px")),v.clearCloneStyle||""!==n||0!==e.indexOf("background")||(u[e]="inherit"),s&&"set"in s&&void 0===(n=s.set(t,n,i))||(c?u.setProperty(e,n):u[e]=n))}},css:function(t,e,n,i){var r,o,s,a=K(e);return Qt.test(e)||(e=Xt(a)),(s=C.cssHooks[e]||C.cssHooks[a])&&"get"in s&&(r=s.get(t,!0,n)),void 0===r&&(r=Wt(t,e,i)),"normal"===r&&e in te&&(r=te[e]),""===n||n?(o=parseFloat(r),!0===n||isFinite(o)?o||0:r):r}}),C.each(["height","width"],(function(t,e){C.cssHooks[e]={get:function(t,n,i){if(n)return!Jt.test(C.css(t,"display"))||t.getClientRects().length&&t.getBoundingClientRect().width?ie(t,e,i):qt(t,Zt,(function(){return ie(t,e,i)}))},set:function(t,n,i){var r,o=Ft(t),s=!v.scrollboxSize()&&"absolute"===o.position,a=(s||i)&&"border-box"===C.css(t,"boxSizing",!1,o),c=i?ne(t,e,i,a,o):0;return a&&s&&(c-=Math.ceil(t["offset"+e[0].toUpperCase()+e.slice(1)]-parseFloat(o[e])-ne(t,e,"border",!1,o)-.5)),c&&(r=it.exec(n))&&"px"!==(r[3]||"px")&&(t.style[e]=n,n=C.css(t,e)),ee(0,n,c)}}})),C.cssHooks.marginLeft=Vt(v.reliableMarginLeft,(function(t,e){if(e)return(parseFloat(Wt(t,"marginLeft"))||t.getBoundingClientRect().left-qt(t,{marginLeft:0},(function(){return t.getBoundingClientRect().left})))+"px"})),C.each({margin:"",padding:"",border:"Width"},(function(t,e){C.cssHooks[t+e]={expand:function(n){for(var i=0,r={},o="string"==typeof n?n.split(" "):[n];i<4;i++)r[t+rt[i]+e]=o[i]||o[i-2]||o[0];return r}},"margin"!==t&&(C.cssHooks[t+e].set=ee)})),C.fn.extend({css:function(t,e){return z(this,(function(t,e,n){var i,r,o={},s=0;if(Array.isArray(e)){for(i=Ft(t),r=e.length;s<r;s++)o[e[s]]=C.css(t,e[s],!1,i);return o}return void 0!==n?C.style(t,e,n):C.css(t,e)}),t,e,arguments.length>1)}}),C.Tween=re,re.prototype={constructor:re,init:function(t,e,n,i,r,o){this.elem=t,this.prop=n,this.easing=r||C.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=i,this.unit=o||(C.cssNumber[n]?"":"px")},cur:function(){var t=re.propHooks[this.prop];return t&&t.get?t.get(this):re.propHooks._default.get(this)},run:function(t){var e,n=re.propHooks[this.prop];return this.options.duration?this.pos=e=C.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):this.pos=e=t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):re.propHooks._default.set(this),this}},re.prototype.init.prototype=re.prototype,re.propHooks={_default:{get:function(t){var e;return 1!==t.elem.nodeType||null!=t.elem[t.prop]&&null==t.elem.style[t.prop]?t.elem[t.prop]:(e=C.css(t.elem,t.prop,""))&&"auto"!==e?e:0},set:function(t){C.fx.step[t.prop]?C.fx.step[t.prop](t):1!==t.elem.nodeType||!C.cssHooks[t.prop]&&null==t.elem.style[Xt(t.prop)]?t.elem[t.prop]=t.now:C.style(t.elem,t.prop,t.now+t.unit)}}},re.propHooks.scrollTop=re.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},C.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},_default:"swing"},C.fx=re.prototype.init,C.fx.step={};var oe,se,ae=/^(?:toggle|show|hide)$/,ce=/queueHooks$/;function ue(){se&&(!1===y.hidden&&n.requestAnimationFrame?n.requestAnimationFrame(ue):n.setTimeout(ue,C.fx.interval),C.fx.tick())}function le(){return n.setTimeout((function(){oe=void 0})),oe=Date.now()}function de(t,e){var n,i=0,r={height:t};for(e=e?1:0;i<4;i+=2-e)r["margin"+(n=rt[i])]=r["padding"+n]=t;return e&&(r.opacity=r.width=t),r}function pe(t,e,n){for(var i,r=(he.tweeners[e]||[]).concat(he.tweeners["*"]),o=0,s=r.length;o<s;o++)if(i=r[o].call(n,e,t))return i}function he(t,e,n){var i,r,o=0,s=he.prefilters.length,a=C.Deferred().always((function(){delete c.elem})),c=function(){if(r)return!1;for(var e=oe||le(),n=Math.max(0,u.startTime+u.duration-e),i=1-(n/u.duration||0),o=0,s=u.tweens.length;o<s;o++)u.tweens[o].run(i);return a.notifyWith(t,[u,i,n]),i<1&&s?n:(s||a.notifyWith(t,[u,1,0]),a.resolveWith(t,[u]),!1)},u=a.promise({elem:t,props:C.extend({},e),opts:C.extend(!0,{specialEasing:{},easing:C.easing._default},n),originalProperties:e,originalOptions:n,startTime:oe||le(),duration:n.duration,tweens:[],createTween:function(e,n){var i=C.Tween(t,u.opts,e,n,u.opts.specialEasing[e]||u.opts.easing);return u.tweens.push(i),i},stop:function(e){var n=0,i=e?u.tweens.length:0;if(r)return this;for(r=!0;n<i;n++)u.tweens[n].run(1);return e?(a.notifyWith(t,[u,1,0]),a.resolveWith(t,[u,e])):a.rejectWith(t,[u,e]),this}}),l=u.props;for(!function(t,e){var n,i,r,o,s;for(n in t)if(r=e[i=K(n)],o=t[n],Array.isArray(o)&&(r=o[1],o=t[n]=o[0]),n!==i&&(t[i]=o,delete t[n]),(s=C.cssHooks[i])&&"expand"in s)for(n in o=s.expand(o),delete t[i],o)n in t||(t[n]=o[n],e[n]=r);else e[i]=r}(l,u.opts.specialEasing);o<s;o++)if(i=he.prefilters[o].call(u,t,l,u.opts))return g(i.stop)&&(C._queueHooks(u.elem,u.opts.queue).stop=i.stop.bind(i)),i;return C.map(l,pe,u),g(u.opts.start)&&u.opts.start.call(t,u),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always),C.fx.timer(C.extend(c,{elem:t,anim:u,queue:u.opts.queue})),u}C.Animation=C.extend(he,{tweeners:{"*":[function(t,e){var n=this.createTween(t,e);return ut(n.elem,t,it.exec(e),n),n}]},tweener:function(t,e){g(t)?(e=t,t=["*"]):t=t.match(L);for(var n,i=0,r=t.length;i<r;i++)n=t[i],he.tweeners[n]=he.tweeners[n]||[],he.tweeners[n].unshift(e)},prefilters:[function(t,e,n){var i,r,o,s,a,c,u,l,d="width"in e||"height"in e,p=this,h={},f=t.style,m=t.nodeType&&ct(t),v=J.get(t,"fxshow");for(i in n.queue||(null==(s=C._queueHooks(t,"fx")).unqueued&&(s.unqueued=0,a=s.empty.fire,s.empty.fire=function(){s.unqueued||a()}),s.unqueued++,p.always((function(){p.always((function(){s.unqueued--,C.queue(t,"fx").length||s.empty.fire()}))}))),e)if(r=e[i],ae.test(r)){if(delete e[i],o=o||"toggle"===r,r===(m?"hide":"show")){if("show"!==r||!v||void 0===v[i])continue;m=!0}h[i]=v&&v[i]||C.style(t,i)}if((c=!C.isEmptyObject(e))||!C.isEmptyObject(h))for(i in d&&1===t.nodeType&&(n.overflow=[f.overflow,f.overflowX,f.overflowY],null==(u=v&&v.display)&&(u=J.get(t,"display")),"none"===(l=C.css(t,"display"))&&(u?l=u:(pt([t],!0),u=t.style.display||u,l=C.css(t,"display"),pt([t]))),("inline"===l||"inline-block"===l&&null!=u)&&"none"===C.css(t,"float")&&(c||(p.done((function(){f.display=u})),null==u&&(l=f.display,u="none"===l?"":l)),f.display="inline-block")),n.overflow&&(f.overflow="hidden",p.always((function(){f.overflow=n.overflow[0],f.overflowX=n.overflow[1],f.overflowY=n.overflow[2]}))),c=!1,h)c||(v?"hidden"in v&&(m=v.hidden):v=J.access(t,"fxshow",{display:u}),o&&(v.hidden=!m),m&&pt([t],!0),p.done((function(){for(i in m||pt([t]),J.remove(t,"fxshow"),h)C.style(t,i,h[i])}))),c=pe(m?v[i]:0,i,p),i in v||(v[i]=c.start,m&&(c.end=c.start,c.start=0))}],prefilter:function(t,e){e?he.prefilters.unshift(t):he.prefilters.push(t)}}),C.speed=function(t,e,n){var i=t&&"object"==typeof t?C.extend({},t):{complete:n||!n&&e||g(t)&&t,duration:t,easing:n&&e||e&&!g(e)&&e};return C.fx.off?i.duration=0:"number"!=typeof i.duration&&(i.duration in C.fx.speeds?i.duration=C.fx.speeds[i.duration]:i.duration=C.fx.speeds._default),null!=i.queue&&!0!==i.queue||(i.queue="fx"),i.old=i.complete,i.complete=function(){g(i.old)&&i.old.call(this),i.queue&&C.dequeue(this,i.queue)},i},C.fn.extend({fadeTo:function(t,e,n,i){return this.filter(ct).css("opacity",0).show().end().animate({opacity:e},t,n,i)},animate:function(t,e,n,i){var r=C.isEmptyObject(t),o=C.speed(e,n,i),s=function(){var e=he(this,C.extend({},t),o);(r||J.get(this,"finish"))&&e.stop(!0)};return s.finish=s,r||!1===o.queue?this.each(s):this.queue(o.queue,s)},stop:function(t,e,n){var i=function(t){var e=t.stop;delete t.stop,e(n)};return"string"!=typeof t&&(n=e,e=t,t=void 0),e&&this.queue(t||"fx",[]),this.each((function(){var e=!0,r=null!=t&&t+"queueHooks",o=C.timers,s=J.get(this);if(r)s[r]&&s[r].stop&&i(s[r]);else for(r in s)s[r]&&s[r].stop&&ce.test(r)&&i(s[r]);for(r=o.length;r--;)o[r].elem!==this||null!=t&&o[r].queue!==t||(o[r].anim.stop(n),e=!1,o.splice(r,1));!e&&n||C.dequeue(this,t)}))},finish:function(t){return!1!==t&&(t=t||"fx"),this.each((function(){var e,n=J.get(this),i=n[t+"queue"],r=n[t+"queueHooks"],o=C.timers,s=i?i.length:0;for(n.finish=!0,C.queue(this,t,[]),r&&r.stop&&r.stop.call(this,!0),e=o.length;e--;)o[e].elem===this&&o[e].queue===t&&(o[e].anim.stop(!0),o.splice(e,1));for(e=0;e<s;e++)i[e]&&i[e].finish&&i[e].finish.call(this);delete n.finish}))}}),C.each(["toggle","show","hide"],(function(t,e){var n=C.fn[e];C.fn[e]=function(t,i,r){return null==t||"boolean"==typeof t?n.apply(this,arguments):this.animate(de(e,!0),t,i,r)}})),C.each({slideDown:de("show"),slideUp:de("hide"),slideToggle:de("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},(function(t,e){C.fn[t]=function(t,n,i){return this.animate(e,t,n,i)}})),C.timers=[],C.fx.tick=function(){var t,e=0,n=C.timers;for(oe=Date.now();e<n.length;e++)(t=n[e])()||n[e]!==t||n.splice(e--,1);n.length||C.fx.stop(),oe=void 0},C.fx.timer=function(t){C.timers.push(t),C.fx.start()},C.fx.interval=13,C.fx.start=function(){se||(se=!0,ue())},C.fx.stop=function(){se=null},C.fx.speeds={slow:600,fast:200,_default:400},C.fn.delay=function(t,e){return t=C.fx&&C.fx.speeds[t]||t,e=e||"fx",this.queue(e,(function(e,i){var r=n.setTimeout(e,t);i.stop=function(){n.clearTimeout(r)}}))},function(){var t=y.createElement("input"),e=y.createElement("select").appendChild(y.createElement("option"));t.type="checkbox",v.checkOn=""!==t.value,v.optSelected=e.selected,(t=y.createElement("input")).value="t",t.type="radio",v.radioValue="t"===t.value}();var fe,me=C.expr.attrHandle;C.fn.extend({attr:function(t,e){return z(this,C.attr,t,e,arguments.length>1)},removeAttr:function(t){return this.each((function(){C.removeAttr(this,t)}))}}),C.extend({attr:function(t,e,n){var i,r,o=t.nodeType;if(3!==o&&8!==o&&2!==o)return void 0===t.getAttribute?C.prop(t,e,n):(1===o&&C.isXMLDoc(t)||(r=C.attrHooks[e.toLowerCase()]||(C.expr.match.bool.test(e)?fe:void 0)),void 0!==n?null===n?void C.removeAttr(t,e):r&&"set"in r&&void 0!==(i=r.set(t,n,e))?i:(t.setAttribute(e,n+""),n):r&&"get"in r&&null!==(i=r.get(t,e))?i:null==(i=C.find.attr(t,e))?void 0:i)},attrHooks:{type:{set:function(t,e){if(!v.radioValue&&"radio"===e&&A(t,"input")){var n=t.value;return t.setAttribute("type",e),n&&(t.value=n),e}}}},removeAttr:function(t,e){var n,i=0,r=e&&e.match(L);if(r&&1===t.nodeType)for(;n=r[i++];)t.removeAttribute(n)}}),fe={set:function(t,e,n){return!1===e?C.removeAttr(t,n):t.setAttribute(n,n),n}},C.each(C.expr.match.bool.source.match(/\w+/g),(function(t,e){var n=me[e]||C.find.attr;me[e]=function(t,e,i){var r,o,s=e.toLowerCase();return i||(o=me[s],me[s]=r,r=null!=n(t,e,i)?s:null,me[s]=o),r}}));var ve=/^(?:input|select|textarea|button)$/i,ge=/^(?:a|area)$/i;function be(t){return(t.match(L)||[]).join(" ")}function ye(t){return t.getAttribute&&t.getAttribute("class")||""}function we(t){return Array.isArray(t)?t:"string"==typeof t&&t.match(L)||[]}C.fn.extend({prop:function(t,e){return z(this,C.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each((function(){delete this[C.propFix[t]||t]}))}}),C.extend({prop:function(t,e,n){var i,r,o=t.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&C.isXMLDoc(t)||(e=C.propFix[e]||e,r=C.propHooks[e]),void 0!==n?r&&"set"in r&&void 0!==(i=r.set(t,n,e))?i:t[e]=n:r&&"get"in r&&null!==(i=r.get(t,e))?i:t[e]},propHooks:{tabIndex:{get:function(t){var e=C.find.attr(t,"tabindex");return e?parseInt(e,10):ve.test(t.nodeName)||ge.test(t.nodeName)&&t.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),v.optSelected||(C.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(t){var e=t.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),C.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){C.propFix[this.toLowerCase()]=this})),C.fn.extend({addClass:function(t){var e,n,i,r,o,s,a,c=0;if(g(t))return this.each((function(e){C(this).addClass(t.call(this,e,ye(this)))}));if((e=we(t)).length)for(;n=this[c++];)if(r=ye(n),i=1===n.nodeType&&" "+be(r)+" "){for(s=0;o=e[s++];)i.indexOf(" "+o+" ")<0&&(i+=o+" ");r!==(a=be(i))&&n.setAttribute("class",a)}return this},removeClass:function(t){var e,n,i,r,o,s,a,c=0;if(g(t))return this.each((function(e){C(this).removeClass(t.call(this,e,ye(this)))}));if(!arguments.length)return this.attr("class","");if((e=we(t)).length)for(;n=this[c++];)if(r=ye(n),i=1===n.nodeType&&" "+be(r)+" "){for(s=0;o=e[s++];)for(;i.indexOf(" "+o+" ")>-1;)i=i.replace(" "+o+" "," ");r!==(a=be(i))&&n.setAttribute("class",a)}return this},toggleClass:function(t,e){var n=typeof t,i="string"===n||Array.isArray(t);return"boolean"==typeof e&&i?e?this.addClass(t):this.removeClass(t):g(t)?this.each((function(n){C(this).toggleClass(t.call(this,n,ye(this),e),e)})):this.each((function(){var e,r,o,s;if(i)for(r=0,o=C(this),s=we(t);e=s[r++];)o.hasClass(e)?o.removeClass(e):o.addClass(e);else void 0!==t&&"boolean"!==n||((e=ye(this))&&J.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===t?"":J.get(this,"__className__")||""))}))},hasClass:function(t){var e,n,i=0;for(e=" "+t+" ";n=this[i++];)if(1===n.nodeType&&(" "+be(ye(n))+" ").indexOf(e)>-1)return!0;return!1}});var xe=/\r/g;C.fn.extend({val:function(t){var e,n,i,r=this[0];return arguments.length?(i=g(t),this.each((function(n){var r;1===this.nodeType&&(null==(r=i?t.call(this,n,C(this).val()):t)?r="":"number"==typeof r?r+="":Array.isArray(r)&&(r=C.map(r,(function(t){return null==t?"":t+""}))),(e=C.valHooks[this.type]||C.valHooks[this.nodeName.toLowerCase()])&&"set"in e&&void 0!==e.set(this,r,"value")||(this.value=r))}))):r?(e=C.valHooks[r.type]||C.valHooks[r.nodeName.toLowerCase()])&&"get"in e&&void 0!==(n=e.get(r,"value"))?n:"string"==typeof(n=r.value)?n.replace(xe,""):null==n?"":n:void 0}}),C.extend({valHooks:{option:{get:function(t){var e=C.find.attr(t,"value");return null!=e?e:be(C.text(t))}},select:{get:function(t){var e,n,i,r=t.options,o=t.selectedIndex,s="select-one"===t.type,a=s?null:[],c=s?o+1:r.length;for(i=o<0?c:s?o:0;i<c;i++)if(((n=r[i]).selected||i===o)&&!n.disabled&&(!n.parentNode.disabled||!A(n.parentNode,"optgroup"))){if(e=C(n).val(),s)return e;a.push(e)}return a},set:function(t,e){for(var n,i,r=t.options,o=C.makeArray(e),s=r.length;s--;)((i=r[s]).selected=C.inArray(C.valHooks.option.get(i),o)>-1)&&(n=!0);return n||(t.selectedIndex=-1),o}}}}),C.each(["radio","checkbox"],(function(){C.valHooks[this]={set:function(t,e){if(Array.isArray(e))return t.checked=C.inArray(C(t).val(),e)>-1}},v.checkOn||(C.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})})),v.focusin="onfocusin"in n;var Ne=/^(?:focusinfocus|focusoutblur)$/,Ce=function(t){t.stopPropagation()};C.extend(C.event,{trigger:function(t,e,i,r){var o,s,a,c,u,l,d,p,f=[i||y],m=h.call(t,"type")?t.type:t,v=h.call(t,"namespace")?t.namespace.split("."):[];if(s=p=a=i=i||y,3!==i.nodeType&&8!==i.nodeType&&!Ne.test(m+C.event.triggered)&&(m.indexOf(".")>-1&&(v=m.split("."),m=v.shift(),v.sort()),u=m.indexOf(":")<0&&"on"+m,(t=t[C.expando]?t:new C.Event(m,"object"==typeof t&&t)).isTrigger=r?2:3,t.namespace=v.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+v.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),e=null==e?[t]:C.makeArray(e,[t]),d=C.event.special[m]||{},r||!d.trigger||!1!==d.trigger.apply(i,e))){if(!r&&!d.noBubble&&!b(i)){for(c=d.delegateType||m,Ne.test(c+m)||(s=s.parentNode);s;s=s.parentNode)f.push(s),a=s;a===(i.ownerDocument||y)&&f.push(a.defaultView||a.parentWindow||n)}for(o=0;(s=f[o++])&&!t.isPropagationStopped();)p=s,t.type=o>1?c:d.bindType||m,(l=(J.get(s,"events")||Object.create(null))[t.type]&&J.get(s,"handle"))&&l.apply(s,e),(l=u&&s[u])&&l.apply&&G(s)&&(t.result=l.apply(s,e),!1===t.result&&t.preventDefault());return t.type=m,r||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(f.pop(),e)||!G(i)||u&&g(i[m])&&!b(i)&&((a=i[u])&&(i[u]=null),C.event.triggered=m,t.isPropagationStopped()&&p.addEventListener(m,Ce),i[m](),t.isPropagationStopped()&&p.removeEventListener(m,Ce),C.event.triggered=void 0,a&&(i[u]=a)),t.result}},simulate:function(t,e,n){var i=C.extend(new C.Event,n,{type:t,isSimulated:!0});C.event.trigger(i,null,e)}}),C.fn.extend({trigger:function(t,e){return this.each((function(){C.event.trigger(t,e,this)}))},triggerHandler:function(t,e){var n=this[0];if(n)return C.event.trigger(t,e,n,!0)}}),v.focusin||C.each({focus:"focusin",blur:"focusout"},(function(t,e){var n=function(t){C.event.simulate(e,t.target,C.event.fix(t))};C.event.special[e]={setup:function(){var i=this.ownerDocument||this.document||this,r=J.access(i,e);r||i.addEventListener(t,n,!0),J.access(i,e,(r||0)+1)},teardown:function(){var i=this.ownerDocument||this.document||this,r=J.access(i,e)-1;r?J.access(i,e,r):(i.removeEventListener(t,n,!0),J.remove(i,e))}}}));var Oe=n.location,Te={guid:Date.now()},ke=/\?/;C.parseXML=function(t){var e;if(!t||"string"!=typeof t)return null;try{e=(new n.DOMParser).parseFromString(t,"text/xml")}catch(t){e=void 0}return e&&!e.getElementsByTagName("parsererror").length||C.error("Invalid XML: "+t),e};var je=/\[\]$/,Se=/\r?\n/g,Ae=/^(?:submit|button|image|reset|file)$/i,Ee=/^(?:input|select|textarea|keygen)/i;function Pe(t,e,n,i){var r;if(Array.isArray(e))C.each(e,(function(e,r){n||je.test(t)?i(t,r):Pe(t+"["+("object"==typeof r&&null!=r?e:"")+"]",r,n,i)}));else if(n||"object"!==N(e))i(t,e);else for(r in e)Pe(t+"["+r+"]",e[r],n,i)}C.param=function(t,e){var n,i=[],r=function(t,e){var n=g(e)?e():e;i[i.length]=encodeURIComponent(t)+"="+encodeURIComponent(null==n?"":n)};if(null==t)return"";if(Array.isArray(t)||t.jquery&&!C.isPlainObject(t))C.each(t,(function(){r(this.name,this.value)}));else for(n in t)Pe(n,t[n],e,r);return i.join("&")},C.fn.extend({serialize:function(){return C.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var t=C.prop(this,"elements");return t?C.makeArray(t):this})).filter((function(){var t=this.type;return this.name&&!C(this).is(":disabled")&&Ee.test(this.nodeName)&&!Ae.test(t)&&(this.checked||!mt.test(t))})).map((function(t,e){var n=C(this).val();return null==n?null:Array.isArray(n)?C.map(n,(function(t){return{name:e.name,value:t.replace(Se,"\r\n")}})):{name:e.name,value:n.replace(Se,"\r\n")}})).get()}});var De=/%20/g,$e=/#.*$/,_e=/([?&])_=[^&]*/,Ie=/^(.*?):[ \t]*([^\r\n]*)$/gm,Me=/^(?:GET|HEAD)$/,Le=/^\/\//,Re={},Be={},He="*/".concat("*"),Ue=y.createElement("a");function Fe(t){return function(e,n){"string"!=typeof e&&(n=e,e="*");var i,r=0,o=e.toLowerCase().match(L)||[];if(g(n))for(;i=o[r++];)"+"===i[0]?(i=i.slice(1)||"*",(t[i]=t[i]||[]).unshift(n)):(t[i]=t[i]||[]).push(n)}}function qe(t,e,n,i){var r={},o=t===Be;function s(a){var c;return r[a]=!0,C.each(t[a]||[],(function(t,a){var u=a(e,n,i);return"string"!=typeof u||o||r[u]?o?!(c=u):void 0:(e.dataTypes.unshift(u),s(u),!1)})),c}return s(e.dataTypes[0])||!r["*"]&&s("*")}function ze(t,e){var n,i,r=C.ajaxSettings.flatOptions||{};for(n in e)void 0!==e[n]&&((r[n]?t:i||(i={}))[n]=e[n]);return i&&C.extend(!0,t,i),t}Ue.href=Oe.href,C.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Oe.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Oe.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":He,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":C.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?ze(ze(t,C.ajaxSettings),e):ze(C.ajaxSettings,t)},ajaxPrefilter:Fe(Re),ajaxTransport:Fe(Be),ajax:function(t,e){"object"==typeof t&&(e=t,t=void 0),e=e||{};var i,r,o,s,a,c,u,l,d,p,h=C.ajaxSetup({},e),f=h.context||h,m=h.context&&(f.nodeType||f.jquery)?C(f):C.event,v=C.Deferred(),g=C.Callbacks("once memory"),b=h.statusCode||{},w={},x={},N="canceled",O={readyState:0,getResponseHeader:function(t){var e;if(u){if(!s)for(s={};e=Ie.exec(o);)s[e[1].toLowerCase()+" "]=(s[e[1].toLowerCase()+" "]||[]).concat(e[2]);e=s[t.toLowerCase()+" "]}return null==e?null:e.join(", ")},getAllResponseHeaders:function(){return u?o:null},setRequestHeader:function(t,e){return null==u&&(t=x[t.toLowerCase()]=x[t.toLowerCase()]||t,w[t]=e),this},overrideMimeType:function(t){return null==u&&(h.mimeType=t),this},statusCode:function(t){var e;if(t)if(u)O.always(t[O.status]);else for(e in t)b[e]=[b[e],t[e]];return this},abort:function(t){var e=t||N;return i&&i.abort(e),T(0,e),this}};if(v.promise(O),h.url=((t||h.url||Oe.href)+"").replace(Le,Oe.protocol+"//"),h.type=e.method||e.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(L)||[""],null==h.crossDomain){c=y.createElement("a");try{c.href=h.url,c.href=c.href,h.crossDomain=Ue.protocol+"//"+Ue.host!=c.protocol+"//"+c.host}catch(t){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=C.param(h.data,h.traditional)),qe(Re,h,e,O),u)return O;for(d in(l=C.event&&h.global)&&0==C.active++&&C.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Me.test(h.type),r=h.url.replace($e,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(De,"+")):(p=h.url.slice(r.length),h.data&&(h.processData||"string"==typeof h.data)&&(r+=(ke.test(r)?"&":"?")+h.data,delete h.data),!1===h.cache&&(r=r.replace(_e,"$1"),p=(ke.test(r)?"&":"?")+"_="+Te.guid+++p),h.url=r+p),h.ifModified&&(C.lastModified[r]&&O.setRequestHeader("If-Modified-Since",C.lastModified[r]),C.etag[r]&&O.setRequestHeader("If-None-Match",C.etag[r])),(h.data&&h.hasContent&&!1!==h.contentType||e.contentType)&&O.setRequestHeader("Content-Type",h.contentType),O.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+He+"; q=0.01":""):h.accepts["*"]),h.headers)O.setRequestHeader(d,h.headers[d]);if(h.beforeSend&&(!1===h.beforeSend.call(f,O,h)||u))return O.abort();if(N="abort",g.add(h.complete),O.done(h.success),O.fail(h.error),i=qe(Be,h,e,O)){if(O.readyState=1,l&&m.trigger("ajaxSend",[O,h]),u)return O;h.async&&h.timeout>0&&(a=n.setTimeout((function(){O.abort("timeout")}),h.timeout));try{u=!1,i.send(w,T)}catch(t){if(u)throw t;T(-1,t)}}else T(-1,"No Transport");function T(t,e,s,c){var d,p,y,w,x,N=e;u||(u=!0,a&&n.clearTimeout(a),i=void 0,o=c||"",O.readyState=t>0?4:0,d=t>=200&&t<300||304===t,s&&(w=function(t,e,n){for(var i,r,o,s,a=t.contents,c=t.dataTypes;"*"===c[0];)c.shift(),void 0===i&&(i=t.mimeType||e.getResponseHeader("Content-Type"));if(i)for(r in a)if(a[r]&&a[r].test(i)){c.unshift(r);break}if(c[0]in n)o=c[0];else{for(r in n){if(!c[0]||t.converters[r+" "+c[0]]){o=r;break}s||(s=r)}o=o||s}if(o)return o!==c[0]&&c.unshift(o),n[o]}(h,O,s)),!d&&C.inArray("script",h.dataTypes)>-1&&(h.converters["text script"]=function(){}),w=function(t,e,n,i){var r,o,s,a,c,u={},l=t.dataTypes.slice();if(l[1])for(s in t.converters)u[s.toLowerCase()]=t.converters[s];for(o=l.shift();o;)if(t.responseFields[o]&&(n[t.responseFields[o]]=e),!c&&i&&t.dataFilter&&(e=t.dataFilter(e,t.dataType)),c=o,o=l.shift())if("*"===o)o=c;else if("*"!==c&&c!==o){if(!(s=u[c+" "+o]||u["* "+o]))for(r in u)if((a=r.split(" "))[1]===o&&(s=u[c+" "+a[0]]||u["* "+a[0]])){!0===s?s=u[r]:!0!==u[r]&&(o=a[0],l.unshift(a[1]));break}if(!0!==s)if(s&&t.throws)e=s(e);else try{e=s(e)}catch(t){return{state:"parsererror",error:s?t:"No conversion from "+c+" to "+o}}}return{state:"success",data:e}}(h,w,O,d),d?(h.ifModified&&((x=O.getResponseHeader("Last-Modified"))&&(C.lastModified[r]=x),(x=O.getResponseHeader("etag"))&&(C.etag[r]=x)),204===t||"HEAD"===h.type?N="nocontent":304===t?N="notmodified":(N=w.state,p=w.data,d=!(y=w.error))):(y=N,!t&&N||(N="error",t<0&&(t=0))),O.status=t,O.statusText=(e||N)+"",d?v.resolveWith(f,[p,N,O]):v.rejectWith(f,[O,N,y]),O.statusCode(b),b=void 0,l&&m.trigger(d?"ajaxSuccess":"ajaxError",[O,h,d?p:y]),g.fireWith(f,[O,N]),l&&(m.trigger("ajaxComplete",[O,h]),--C.active||C.event.trigger("ajaxStop")))}return O},getJSON:function(t,e,n){return C.get(t,e,n,"json")},getScript:function(t,e){return C.get(t,void 0,e,"script")}}),C.each(["get","post"],(function(t,e){C[e]=function(t,n,i,r){return g(n)&&(r=r||i,i=n,n=void 0),C.ajax(C.extend({url:t,type:e,dataType:r,data:n,success:i},C.isPlainObject(t)&&t))}})),C.ajaxPrefilter((function(t){var e;for(e in t.headers)"content-type"===e.toLowerCase()&&(t.contentType=t.headers[e]||"")})),C._evalUrl=function(t,e,n){return C.ajax({url:t,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(t){C.globalEval(t,e,n)}})},C.fn.extend({wrapAll:function(t){var e;return this[0]&&(g(t)&&(t=t.call(this[0])),e=C(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map((function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t})).append(this)),this},wrapInner:function(t){return g(t)?this.each((function(e){C(this).wrapInner(t.call(this,e))})):this.each((function(){var e=C(this),n=e.contents();n.length?n.wrapAll(t):e.append(t)}))},wrap:function(t){var e=g(t);return this.each((function(n){C(this).wrapAll(e?t.call(this,n):t)}))},unwrap:function(t){return this.parent(t).not("body").each((function(){C(this).replaceWith(this.childNodes)})),this}}),C.expr.pseudos.hidden=function(t){return!C.expr.pseudos.visible(t)},C.expr.pseudos.visible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)},C.ajaxSettings.xhr=function(){try{return new n.XMLHttpRequest}catch(t){}};var We={0:200,1223:204},Ve=C.ajaxSettings.xhr();v.cors=!!Ve&&"withCredentials"in Ve,v.ajax=Ve=!!Ve,C.ajaxTransport((function(t){var e,i;if(v.cors||Ve&&!t.crossDomain)return{send:function(r,o){var s,a=t.xhr();if(a.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(s in t.xhrFields)a[s]=t.xhrFields[s];for(s in t.mimeType&&a.overrideMimeType&&a.overrideMimeType(t.mimeType),t.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest"),r)a.setRequestHeader(s,r[s]);e=function(t){return function(){e&&(e=i=a.onload=a.onerror=a.onabort=a.ontimeout=a.onreadystatechange=null,"abort"===t?a.abort():"error"===t?"number"!=typeof a.status?o(0,"error"):o(a.status,a.statusText):o(We[a.status]||a.status,a.statusText,"text"!==(a.responseType||"text")||"string"!=typeof a.responseText?{binary:a.response}:{text:a.responseText},a.getAllResponseHeaders()))}},a.onload=e(),i=a.onerror=a.ontimeout=e("error"),void 0!==a.onabort?a.onabort=i:a.onreadystatechange=function(){4===a.readyState&&n.setTimeout((function(){e&&i()}))},e=e("abort");try{a.send(t.hasContent&&t.data||null)}catch(t){if(e)throw t}},abort:function(){e&&e()}}})),C.ajaxPrefilter((function(t){t.crossDomain&&(t.contents.script=!1)})),C.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return C.globalEval(t),t}}}),C.ajaxPrefilter("script",(function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET")})),C.ajaxTransport("script",(function(t){var e,n;if(t.crossDomain||t.scriptAttrs)return{send:function(i,r){e=C("<script>").attr(t.scriptAttrs||{}).prop({charset:t.scriptCharset,src:t.url}).on("load error",n=function(t){e.remove(),n=null,t&&r("error"===t.type?404:200,t.type)}),y.head.appendChild(e[0])},abort:function(){n&&n()}}}));var Ye,Ke=[],Ge=/(=)\?(?=&|$)|\?\?/;C.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var t=Ke.pop()||C.expando+"_"+Te.guid++;return this[t]=!0,t}}),C.ajaxPrefilter("json jsonp",(function(t,e,i){var r,o,s,a=!1!==t.jsonp&&(Ge.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ge.test(t.data)&&"data");if(a||"jsonp"===t.dataTypes[0])return r=t.jsonpCallback=g(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,a?t[a]=t[a].replace(Ge,"$1"+r):!1!==t.jsonp&&(t.url+=(ke.test(t.url)?"&":"?")+t.jsonp+"="+r),t.converters["script json"]=function(){return s||C.error(r+" was not called"),s[0]},t.dataTypes[0]="json",o=n[r],n[r]=function(){s=arguments},i.always((function(){void 0===o?C(n).removeProp(r):n[r]=o,t[r]&&(t.jsonpCallback=e.jsonpCallback,Ke.push(r)),s&&g(o)&&o(s[0]),s=o=void 0})),"script"})),v.createHTMLDocument=((Ye=y.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",2===Ye.childNodes.length),C.parseHTML=function(t,e,n){return"string"!=typeof t?[]:("boolean"==typeof e&&(n=e,e=!1),e||(v.createHTMLDocument?((i=(e=y.implementation.createHTMLDocument("")).createElement("base")).href=y.location.href,e.head.appendChild(i)):e=y),o=!n&&[],(r=E.exec(t))?[e.createElement(r[1])]:(r=Nt([t],e,o),o&&o.length&&C(o).remove(),C.merge([],r.childNodes)));var i,r,o},C.fn.load=function(t,e,n){var i,r,o,s=this,a=t.indexOf(" ");return a>-1&&(i=be(t.slice(a)),t=t.slice(0,a)),g(e)?(n=e,e=void 0):e&&"object"==typeof e&&(r="POST"),s.length>0&&C.ajax({url:t,type:r||"GET",dataType:"html",data:e}).done((function(t){o=arguments,s.html(i?C("<div>").append(C.parseHTML(t)).find(i):t)})).always(n&&function(t,e){s.each((function(){n.apply(this,o||[t.responseText,e,t])}))}),this},C.expr.pseudos.animated=function(t){return C.grep(C.timers,(function(e){return t===e.elem})).length},C.offset={setOffset:function(t,e,n){var i,r,o,s,a,c,u=C.css(t,"position"),l=C(t),d={};"static"===u&&(t.style.position="relative"),a=l.offset(),o=C.css(t,"top"),c=C.css(t,"left"),("absolute"===u||"fixed"===u)&&(o+c).indexOf("auto")>-1?(s=(i=l.position()).top,r=i.left):(s=parseFloat(o)||0,r=parseFloat(c)||0),g(e)&&(e=e.call(t,n,C.extend({},a))),null!=e.top&&(d.top=e.top-a.top+s),null!=e.left&&(d.left=e.left-a.left+r),"using"in e?e.using.call(t,d):("number"==typeof d.top&&(d.top+="px"),"number"==typeof d.left&&(d.left+="px"),l.css(d))}},C.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each((function(e){C.offset.setOffset(this,t,e)}));var e,n,i=this[0];return i?i.getClientRects().length?(e=i.getBoundingClientRect(),n=i.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var t,e,n,i=this[0],r={top:0,left:0};if("fixed"===C.css(i,"position"))e=i.getBoundingClientRect();else{for(e=this.offset(),n=i.ownerDocument,t=i.offsetParent||n.documentElement;t&&(t===n.body||t===n.documentElement)&&"static"===C.css(t,"position");)t=t.parentNode;t&&t!==i&&1===t.nodeType&&((r=C(t).offset()).top+=C.css(t,"borderTopWidth",!0),r.left+=C.css(t,"borderLeftWidth",!0))}return{top:e.top-r.top-C.css(i,"marginTop",!0),left:e.left-r.left-C.css(i,"marginLeft",!0)}}},offsetParent:function(){return this.map((function(){for(var t=this.offsetParent;t&&"static"===C.css(t,"position");)t=t.offsetParent;return t||ot}))}}),C.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},(function(t,e){var n="pageYOffset"===e;C.fn[t]=function(i){return z(this,(function(t,i,r){var o;if(b(t)?o=t:9===t.nodeType&&(o=t.defaultView),void 0===r)return o?o[e]:t[i];o?o.scrollTo(n?o.pageXOffset:r,n?r:o.pageYOffset):t[i]=r}),t,i,arguments.length)}})),C.each(["top","left"],(function(t,e){C.cssHooks[e]=Vt(v.pixelPosition,(function(t,n){if(n)return n=Wt(t,e),Ut.test(n)?C(t).position()[e]+"px":n}))})),C.each({Height:"height",Width:"width"},(function(t,e){C.each({padding:"inner"+t,content:e,"":"outer"+t},(function(n,i){C.fn[i]=function(r,o){var s=arguments.length&&(n||"boolean"!=typeof r),a=n||(!0===r||!0===o?"margin":"border");return z(this,(function(e,n,r){var o;return b(e)?0===i.indexOf("outer")?e["inner"+t]:e.document.documentElement["client"+t]:9===e.nodeType?(o=e.documentElement,Math.max(e.body["scroll"+t],o["scroll"+t],e.body["offset"+t],o["offset"+t],o["client"+t])):void 0===r?C.css(e,n,a):C.style(e,n,r,a)}),e,s?r:void 0,s)}}))})),C.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],(function(t,e){C.fn[e]=function(t){return this.on(e,t)}})),C.fn.extend({bind:function(t,e,n){return this.on(t,null,e,n)},unbind:function(t,e){return this.off(t,null,e)},delegate:function(t,e,n,i){return this.on(e,t,n,i)},undelegate:function(t,e,n){return 1===arguments.length?this.off(t,"**"):this.off(e,t||"**",n)},hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)}}),C.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),(function(t,e){C.fn[e]=function(t,n){return arguments.length>0?this.on(e,null,t,n):this.trigger(e)}}));var Xe=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;C.proxy=function(t,e){var n,i,r;if("string"==typeof e&&(n=t[e],e=t,t=n),g(t))return i=a.call(arguments,2),(r=function(){return t.apply(e||this,i.concat(a.call(arguments)))}).guid=t.guid=t.guid||C.guid++,r},C.holdReady=function(t){t?C.readyWait++:C.ready(!0)},C.isArray=Array.isArray,C.parseJSON=JSON.parse,C.nodeName=A,C.isFunction=g,C.isWindow=b,C.camelCase=K,C.type=N,C.now=Date.now,C.isNumeric=function(t){var e=C.type(t);return("number"===e||"string"===e)&&!isNaN(t-parseFloat(t))},C.trim=function(t){return null==t?"":(t+"").replace(Xe,"")},void 0===(i=function(){return C}.apply(e,[]))||(t.exports=i);var Je=n.jQuery,Qe=n.$;return C.noConflict=function(t){return n.$===C&&(n.$=Qe),t&&n.jQuery===C&&(n.jQuery=Je),C},void 0===r&&(n.jQuery=n.$=C),C}))},function(t,e,n){(function(e){t.exports=e.m=n(108)}).call(this,n(27))},function(t,e,n){"use strict";var i=n(109),r=n(112),o=n(73),s=function(){return i.apply(this,arguments)};s.m=i,s.trust=i.trust,s.fragment=i.fragment,s.mount=o.mount,s.route=n(118),s.render=n(93),s.redraw=o.redraw,s.request=r.request,s.jsonp=r.jsonp,s.parseQueryString=n(96),s.buildQueryString=n(94),s.parsePathname=n(75),s.buildPathname=n(74),s.vnode=n(30),s.PromisePolyfill=n(91),t.exports=s},function(t,e,n){"use strict";var i=n(88);i.trust=n(110),i.fragment=n(111),t.exports=i},function(t,e,n){"use strict";var i=n(30);t.exports=function(t){return null==t&&(t=""),i("<",void 0,void 0,t,void 0,void 0)}},function(t,e,n){"use strict";var i=n(30),r=n(89);t.exports=function(){var t=r.apply(0,arguments);return t.tag="[",t.children=i.normalizeChildren(t.children),t}},function(t,e,n){"use strict";var i=n(90),r=n(73);t.exports=n(117)(window,i,r.redraw)},function(t,e,n){(function(t,e){!function(t,n){"use strict";if(!t.setImmediate){var i,r,o,s,a,c=1,u={},l=!1,d=t.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(t);p=p&&p.setTimeout?p:t,"[object process]"==={}.toString.call(t.process)?i=function(t){e.nextTick((function(){f(t)}))}:!function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?t.MessageChannel?((o=new MessageChannel).port1.onmessage=function(t){f(t.data)},i=function(t){o.port2.postMessage(t)}):d&&"onreadystatechange"in d.createElement("script")?(r=d.documentElement,i=function(t){var e=d.createElement("script");e.onreadystatechange=function(){f(t),e.onreadystatechange=null,r.removeChild(e),e=null},r.appendChild(e)}):i=function(t){setTimeout(f,0,t)}:(s="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(s)&&f(+e.data.slice(s.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),i=function(e){t.postMessage(s+e,"*")}),p.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var r={callback:t,args:e};return u[c]=r,i(c),c++},p.clearImmediate=h}function h(t){delete u[t]}function f(t){if(l)setTimeout(f,0,t);else{var e=u[t];if(e){l=!0;try{!function(t){var e=t.callback,n=t.args;switch(n.length){case 0:e();break;case 1:e(n[0]);break;case 2:e(n[0],n[1]);break;case 3:e(n[0],n[1],n[2]);break;default:e.apply(void 0,n)}}(e)}finally{h(t),l=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n(27),n(114))},function(t,e){var n,i,r=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(t){i=s}}();var c,u=[],l=!1,d=-1;function p(){l&&c&&(l=!1,c.length?u=c.concat(u):d=-1,u.length&&h())}function h(){if(!l){var t=a(p);l=!0;for(var e=u.length;e;){for(c=u,u=[];++d<e;)c&&c[d].run();d=-1,e=u.length}c=null,l=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}function f(t,e){this.fun=t,this.array=e}function m(){}r.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];u.push(new f(t,e)),1!==u.length||l||a(h)},f.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=m,r.addListener=m,r.once=m,r.off=m,r.removeListener=m,r.removeAllListeners=m,r.emit=m,r.prependListener=m,r.prependOnceListener=m,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(t,e,n){"use strict";var i=n(30);t.exports=function(t){var e,n=t&&t.document,r={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"};function o(t){return t.attrs&&t.attrs.xmlns||r[t.tag]}function s(t,e){if(t.state!==e)throw new Error("`vnode.state` must not be modified")}function a(t){var e=t.state;try{return this.apply(e,arguments)}finally{s(t,e)}}function c(){try{return n.activeElement}catch(t){return null}}function u(t,e,n,i,r,o,s){for(var a=n;a<i;a++){var c=e[a];null!=c&&l(t,c,r,s,o)}}function l(t,e,r,s,c){var d=e.tag;if("string"==typeof d)switch(e.state={},null!=e.attrs&&M(e.attrs,e,r),d){case"#":!function(t,e,i){e.dom=n.createTextNode(e.children),y(t,e.dom,i)}(t,e,c);break;case"<":p(t,e,s,c);break;case"[":!function(t,e,i,r,o){var s=n.createDocumentFragment();if(null!=e.children){var a=e.children;u(s,a,0,a.length,i,null,r)}e.dom=s.firstChild,e.domSize=s.childNodes.length,y(t,s,o)}(t,e,r,s,c);break;default:!function(t,e,r,s,a){var c=e.tag,l=e.attrs,d=l&&l.is,p=(s=o(e)||s)?d?n.createElementNS(s,c,{is:d}):n.createElementNS(s,c):d?n.createElement(c,{is:d}):n.createElement(c);e.dom=p,null!=l&&function(t,e,n){for(var i in e)k(t,i,null,e[i],n)}(e,l,s);if(y(t,p,a),!w(e)&&(null!=e.text&&(""!==e.text?p.textContent=e.text:e.children=[i("#",void 0,void 0,e.text,void 0,void 0)]),null!=e.children)){var h=e.children;u(p,h,0,h.length,r,null,s),"select"===e.tag&&null!=l&&function(t,e){if("value"in e)if(null===e.value)-1!==t.dom.selectedIndex&&(t.dom.value=null);else{var n=""+e.value;t.dom.value===n&&-1!==t.dom.selectedIndex||(t.dom.value=n)}"selectedIndex"in e&&k(t,"selectedIndex",null,e.selectedIndex,void 0)}(e,l)}}(t,e,r,s,c)}else!function(t,e,n,r,o){(function(t,e){var n;if("function"==typeof t.tag.view){if(t.state=Object.create(t.tag),null!=(n=t.state.view).$$reentrantLock$$)return;n.$$reentrantLock$$=!0}else{if(t.state=void 0,null!=(n=t.tag).$$reentrantLock$$)return;n.$$reentrantLock$$=!0,t.state=null!=t.tag.prototype&&"function"==typeof t.tag.prototype.view?new t.tag(t):t.tag(t)}M(t.state,t,e),null!=t.attrs&&M(t.attrs,t,e);if(t.instance=i.normalize(a.call(t.state.view,t)),t.instance===t)throw Error("A view cannot return the vnode it received as argument");n.$$reentrantLock$$=null})(e,n),null!=e.instance?(l(t,e.instance,n,r,o),e.dom=e.instance.dom,e.domSize=null!=e.dom?e.instance.domSize:0):e.domSize=0}(t,e,r,s,c)}var d={caption:"table",thead:"table",tbody:"table",tfoot:"table",tr:"tbody",th:"tr",td:"tr",colgroup:"table",col:"colgroup"};function p(t,e,i,r){var o=e.children.match(/^\s*?<(\w+)/im)||[],s=n.createElement(d[o[1]]||"div");"http://www.w3.org/2000/svg"===i?(s.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+e.children+"</svg>",s=s.firstChild):s.innerHTML=e.children,e.dom=s.firstChild,e.domSize=s.childNodes.length,e.instance=[];for(var a,c=n.createDocumentFragment();a=s.firstChild;)e.instance.push(a),c.appendChild(a);y(t,c,r)}function h(t,e,n,i,r,o){if(e!==n&&(null!=e||null!=n))if(null==e||0===e.length)u(t,n,0,n.length,i,r,o);else if(null==n||0===n.length)x(t,e,0,e.length);else{var s=null!=e[0]&&null!=e[0].key,a=null!=n[0]&&null!=n[0].key,c=0,d=0;if(!s)for(;d<e.length&&null==e[d];)d++;if(!a)for(;c<n.length&&null==n[c];)c++;if(null===a&&null==s)return;if(s!==a)x(t,e,d,e.length),u(t,n,c,n.length,i,r,o);else if(a){for(var p,h,y,w,C,O=e.length-1,T=n.length-1;O>=d&&T>=c&&(y=e[O],w=n[T],y.key===w.key);)y!==w&&f(t,y,w,i,r,o),null!=w.dom&&(r=w.dom),O--,T--;for(;O>=d&&T>=c&&(p=e[d],h=n[c],p.key===h.key);)d++,c++,p!==h&&f(t,p,h,i,g(e,d,r),o);for(;O>=d&&T>=c&&c!==T&&p.key===w.key&&y.key===h.key;)b(t,y,C=g(e,d,r)),y!==h&&f(t,y,h,i,C,o),++c<=--T&&b(t,p,r),p!==w&&f(t,p,w,i,r,o),null!=w.dom&&(r=w.dom),d++,y=e[--O],w=n[T],p=e[d],h=n[c];for(;O>=d&&T>=c&&y.key===w.key;)y!==w&&f(t,y,w,i,r,o),null!=w.dom&&(r=w.dom),T--,y=e[--O],w=n[T];if(c>T)x(t,e,d,O+1);else if(d>O)u(t,n,c,T+1,i,r,o);else{var k,j,S=r,A=T-c+1,E=new Array(A),P=0,D=0,$=2147483647,_=0;for(D=0;D<A;D++)E[D]=-1;for(D=T;D>=c;D--){null==k&&(k=m(e,d,O+1));var I=k[(w=n[D]).key];null!=I&&($=I<$?I:-1,E[D-c]=I,y=e[I],e[I]=null,y!==w&&f(t,y,w,i,r,o),null!=w.dom&&(r=w.dom),_++)}if(r=S,_!==O-d+1&&x(t,e,d,O+1),0===_)u(t,n,c,T+1,i,r,o);else if(-1===$)for(P=(j=function(t){var e=[0],n=0,i=0,r=0,o=v.length=t.length;for(r=0;r<o;r++)v[r]=t[r];for(r=0;r<o;++r)if(-1!==t[r]){var s=e[e.length-1];if(t[s]<t[r])v[r]=s,e.push(r);else{for(n=0,i=e.length-1;n<i;){var a=(n>>>1)+(i>>>1)+(n&i&1);t[e[a]]<t[r]?n=a+1:i=a}t[r]<t[e[n]]&&(n>0&&(v[r]=e[n-1]),e[n]=r)}}n=e.length,i=e[n-1];for(;n-- >0;)e[n]=i,i=v[i];return v.length=0,e}(E)).length-1,D=T;D>=c;D--)h=n[D],-1===E[D-c]?l(t,h,i,o,r):j[P]===D-c?P--:b(t,h,r),null!=h.dom&&(r=n[D].dom);else for(D=T;D>=c;D--)h=n[D],-1===E[D-c]&&l(t,h,i,o,r),null!=h.dom&&(r=n[D].dom)}}else{var M=e.length<n.length?e.length:n.length;for(c=c<d?c:d;c<M;c++)(p=e[c])===(h=n[c])||null==p&&null==h||(null==p?l(t,h,i,o,g(e,c+1,r)):null==h?N(t,p):f(t,p,h,i,g(e,c+1,r),o));e.length>M&&x(t,e,c,e.length),n.length>M&&u(t,n,c,n.length,i,r,o)}}}function f(t,e,n,r,s,c){var u=e.tag;if(u===n.tag){if(n.state=e.state,n.events=e.events,function(t,e){do{var n;if(null!=t.attrs&&"function"==typeof t.attrs.onbeforeupdate)if(void 0!==(n=a.call(t.attrs.onbeforeupdate,t,e))&&!n)break;if("string"!=typeof t.tag&&"function"==typeof t.state.onbeforeupdate)if(void 0!==(n=a.call(t.state.onbeforeupdate,t,e))&&!n)break;return!1}while(0);return t.dom=e.dom,t.domSize=e.domSize,t.instance=e.instance,t.attrs=e.attrs,t.children=e.children,t.text=e.text,!0}(n,e))return;if("string"==typeof u)switch(null!=n.attrs&&L(n.attrs,n,r),u){case"#":!function(t,e){t.children.toString()!==e.children.toString()&&(t.dom.nodeValue=e.children);e.dom=t.dom}(e,n);break;case"<":!function(t,e,n,i,r){e.children!==n.children?(C(t,e),p(t,n,i,r)):(n.dom=e.dom,n.domSize=e.domSize,n.instance=e.instance)}(t,e,n,c,s);break;case"[":!function(t,e,n,i,r,o){h(t,e.children,n.children,i,r,o);var s=0,a=n.children;if(n.dom=null,null!=a){for(var c=0;c<a.length;c++){var u=a[c];null!=u&&null!=u.dom&&(null==n.dom&&(n.dom=u.dom),s+=u.domSize||1)}1!==s&&(n.domSize=s)}}(t,e,n,r,s,c);break;default:!function(t,e,n,r){var s=e.dom=t.dom;r=o(e)||r,"textarea"===e.tag&&(null==e.attrs&&(e.attrs={}),null!=e.text&&(e.attrs.value=e.text,e.text=void 0));(function(t,e,n,i){if(null!=n)for(var r in n)k(t,r,e&&e[r],n[r],i);var o;if(null!=e)for(var r in e)null==(o=e[r])||null!=n&&null!=n[r]||j(t,r,o,i)})(e,t.attrs,e.attrs,r),w(e)||(null!=t.text&&null!=e.text&&""!==e.text?t.text.toString()!==e.text.toString()&&(t.dom.firstChild.nodeValue=e.text):(null!=t.text&&(t.children=[i("#",void 0,void 0,t.text,void 0,t.dom.firstChild)]),null!=e.text&&(e.children=[i("#",void 0,void 0,e.text,void 0,void 0)]),h(s,t.children,e.children,n,null,r)))}(e,n,r,c)}else!function(t,e,n,r,o,s){if(n.instance=i.normalize(a.call(n.state.view,n)),n.instance===n)throw Error("A view cannot return the vnode it received as argument");L(n.state,n,r),null!=n.attrs&&L(n.attrs,n,r);null!=n.instance?(null==e.instance?l(t,n.instance,r,s,o):f(t,e.instance,n.instance,r,o,s),n.dom=n.instance.dom,n.domSize=n.instance.domSize):null!=e.instance?(N(t,e.instance),n.dom=void 0,n.domSize=0):(n.dom=e.dom,n.domSize=e.domSize)}(t,e,n,r,s,c)}else N(t,e),l(t,n,r,c,s)}function m(t,e,n){for(var i=Object.create(null);e<n;e++){var r=t[e];if(null!=r){var o=r.key;null!=o&&(i[o]=e)}}return i}var v=[];function g(t,e,n){for(;e<t.length;e++)if(null!=t[e]&&null!=t[e].dom)return t[e].dom;return n}function b(t,e,i){var r=n.createDocumentFragment();!function t(e,n,i){for(;null!=i.dom&&i.dom.parentNode===e;){if("string"!=typeof i.tag){if(null!=(i=i.instance))continue}else if("<"===i.tag)for(var r=0;r<i.instance.length;r++)n.appendChild(i.instance[r]);else if("["!==i.tag)n.appendChild(i.dom);else if(1===i.children.length){if(null!=(i=i.children[0]))continue}else for(r=0;r<i.children.length;r++){var o=i.children[r];null!=o&&t(e,n,o)}break}}(t,r,e),y(t,r,i)}function y(t,e,n){null!=n?t.insertBefore(e,n):t.appendChild(e)}function w(t){if(null==t.attrs||null==t.attrs.contenteditable&&null==t.attrs.contentEditable)return!1;var e=t.children;if(null!=e&&1===e.length&&"<"===e[0].tag){var n=e[0].children;t.dom.innerHTML!==n&&(t.dom.innerHTML=n)}else if(null!=t.text||null!=e&&0!==e.length)throw new Error("Child node of a contenteditable must be trusted");return!0}function x(t,e,n,i){for(var r=n;r<i;r++){var o=e[r];null!=o&&N(t,o)}}function N(t,e){var n,i,r,o=0,c=e.state;"string"!=typeof e.tag&&"function"==typeof e.state.onbeforeremove&&(null!=(r=a.call(e.state.onbeforeremove,e))&&"function"==typeof r.then&&(o=1,n=r));e.attrs&&"function"==typeof e.attrs.onbeforeremove&&(null!=(r=a.call(e.attrs.onbeforeremove,e))&&"function"==typeof r.then&&(o|=2,i=r));if(s(e,c),o){if(null!=n){var u=function(){1&o&&((o&=2)||l())};n.then(u,u)}if(null!=i){u=function(){2&o&&((o&=1)||l())};i.then(u,u)}}else T(e),O(t,e);function l(){s(e,c),T(e),O(t,e)}}function C(t,e){for(var n=0;n<e.instance.length;n++)t.removeChild(e.instance[n])}function O(t,e){for(;null!=e.dom&&e.dom.parentNode===t;){if("string"!=typeof e.tag){if(null!=(e=e.instance))continue}else if("<"===e.tag)C(t,e);else{if("["!==e.tag&&(t.removeChild(e.dom),!Array.isArray(e.children)))break;if(1===e.children.length){if(null!=(e=e.children[0]))continue}else for(var n=0;n<e.children.length;n++){var i=e.children[n];null!=i&&O(t,i)}}break}}function T(t){if("string"!=typeof t.tag&&"function"==typeof t.state.onremove&&a.call(t.state.onremove,t),t.attrs&&"function"==typeof t.attrs.onremove&&a.call(t.attrs.onremove,t),"string"!=typeof t.tag)null!=t.instance&&T(t.instance);else{var e=t.children;if(Array.isArray(e))for(var n=0;n<e.length;n++){var i=e[n];null!=i&&T(i)}}}function k(t,e,i,r,o){if("key"!==e&&"is"!==e&&null!=r&&!S(e)&&(i!==r||function(t,e){return"value"===e||"checked"===e||"selectedIndex"===e||"selected"===e&&t.dom===c()||"option"===t.tag&&t.dom.parentNode===n.activeElement}(t,e)||"object"==typeof r)){if("o"===e[0]&&"n"===e[1])return I(t,e,r);if("xlink:"===e.slice(0,6))t.dom.setAttributeNS("http://www.w3.org/1999/xlink",e.slice(6),r);else if("style"===e)$(t.dom,i,r);else if(A(t,e,o)){if("value"===e){if(("input"===t.tag||"textarea"===t.tag)&&t.dom.value===""+r&&t.dom===c())return;if("select"===t.tag&&null!==i&&t.dom.value===""+r)return;if("option"===t.tag&&null!==i&&t.dom.value===""+r)return}"input"===t.tag&&"type"===e?t.dom.setAttribute(e,r):t.dom[e]=r}else"boolean"==typeof r?r?t.dom.setAttribute(e,""):t.dom.removeAttribute(e):t.dom.setAttribute("className"===e?"class":e,r)}}function j(t,e,n,i){if("key"!==e&&"is"!==e&&null!=n&&!S(e))if("o"!==e[0]||"n"!==e[1]||S(e))if("style"===e)$(t.dom,n,null);else if(!A(t,e,i)||"className"===e||"value"===e&&("option"===t.tag||"select"===t.tag&&-1===t.dom.selectedIndex&&t.dom===c())||"input"===t.tag&&"type"===e){var r=e.indexOf(":");-1!==r&&(e=e.slice(r+1)),!1!==n&&t.dom.removeAttribute("className"===e?"class":e)}else t.dom[e]=null;else I(t,e,void 0)}function S(t){return"oninit"===t||"oncreate"===t||"onupdate"===t||"onremove"===t||"onbeforeremove"===t||"onbeforeupdate"===t}function A(t,e,n){return void 0===n&&(t.tag.indexOf("-")>-1||null!=t.attrs&&t.attrs.is||"href"!==e&&"list"!==e&&"form"!==e&&"width"!==e&&"height"!==e)&&e in t.dom}var E=/[A-Z]/g;function P(t){return"-"+t.toLowerCase()}function D(t){return"-"===t[0]&&"-"===t[1]?t:"cssFloat"===t?"float":t.replace(E,P)}function $(t,e,n){if(e===n);else if(null==n)t.style.cssText="";else if("object"!=typeof n)t.style.cssText=n;else if(null==e||"object"!=typeof e)for(var i in t.style.cssText="",n){null!=(r=n[i])&&t.style.setProperty(D(i),String(r))}else{for(var i in n){var r;null!=(r=n[i])&&(r=String(r))!==String(e[i])&&t.style.setProperty(D(i),r)}for(var i in e)null!=e[i]&&null==n[i]&&t.style.removeProperty(D(i))}}function _(){this._=e}function I(t,e,n){if(null!=t.events){if(t.events[e]===n)return;null==n||"function"!=typeof n&&"object"!=typeof n?(null!=t.events[e]&&t.dom.removeEventListener(e.slice(2),t.events,!1),t.events[e]=void 0):(null==t.events[e]&&t.dom.addEventListener(e.slice(2),t.events,!1),t.events[e]=n)}else null==n||"function"!=typeof n&&"object"!=typeof n||(t.events=new _,t.dom.addEventListener(e.slice(2),t.events,!1),t.events[e]=n)}function M(t,e,n){"function"==typeof t.oninit&&a.call(t.oninit,e),"function"==typeof t.oncreate&&n.push(a.bind(t.oncreate,e))}function L(t,e,n){"function"==typeof t.onupdate&&n.push(a.bind(t.onupdate,e))}return _.prototype=Object.create(null),_.prototype.handleEvent=function(t){var e,n=this["on"+t.type];"function"==typeof n?e=n.call(t.currentTarget,t):"function"==typeof n.handleEvent&&n.handleEvent(t),this._&&!1!==t.redraw&&(0,this._)(),!1===e&&(t.preventDefault(),t.stopPropagation())},function(t,n,r){if(!t)throw new TypeError("Ensure the DOM element being passed to m.route/m.mount/m.render is not undefined.");var o=[],s=c(),a=t.namespaceURI;null==t.vnodes&&(t.textContent=""),n=i.normalizeChildren(Array.isArray(n)?n:[n]);var u=e;try{e="function"==typeof r?r:void 0,h(t,t.vnodes,n,o,null,"http://www.w3.org/1999/xhtml"===a?void 0:a)}finally{e=u}t.vnodes=n,null!=s&&c()!==s&&"function"==typeof s.focus&&s.focus();for(var l=0;l<o.length;l++)o[l]()}}},function(t,e,n){"use strict";var i=n(30);t.exports=function(t,e,n){var r=[],o=!1,s=!1;function a(){if(o)throw new Error("Nested m.redraw.sync() call");o=!0;for(var e=0;e<r.length;e+=2)try{t(r[e],i(r[e+1]),c)}catch(t){n.error(t)}o=!1}function c(){s||(s=!0,e((function(){s=!1,a()})))}return c.sync=a,{mount:function(e,n){if(null!=n&&null==n.view&&"function"!=typeof n)throw new TypeError("m.mount(element, component) expects a component, not a vnode");var o=r.indexOf(e);o>=0&&(r.splice(o,2),t(e,[],c)),null!=n&&(r.push(e,n),t(e,i(n),c))},redraw:c}}},function(t,e,n){"use strict";var i=n(74);t.exports=function(t,e,n){var r=0;function o(t){return new e(t)}function s(t){return function(r,s){"string"!=typeof r?(s=r,r=r.url):null==s&&(s={});var a=new e((function(e,n){t(i(r,s.params),s,(function(t){if("function"==typeof s.type)if(Array.isArray(t))for(var n=0;n<t.length;n++)t[n]=new s.type(t[n]);else t=new s.type(t);e(t)}),n)}));if(!0===s.background)return a;var c=0;function u(){0==--c&&"function"==typeof n&&n()}return function t(e){var n=e.then;return e.constructor=o,e.then=function(){c++;var i=n.apply(e,arguments);return i.then(u,(function(t){if(u(),0===c)throw t})),t(i)},e}(a)}}function a(t,e){for(var n in t.headers)if({}.hasOwnProperty.call(t.headers,n)&&e.test(n))return!0;return!1}return o.prototype=e.prototype,o.__proto__=e,{request:s((function(e,n,i,r){var o,s=null!=n.method?n.method.toUpperCase():"GET",c=n.body,u=!(null!=n.serialize&&n.serialize!==JSON.serialize||c instanceof t.FormData),l=n.responseType||("function"==typeof n.extract?"":"json"),d=new t.XMLHttpRequest,p=!1,h=d,f=d.abort;for(var m in d.abort=function(){p=!0,f.call(this)},d.open(s,e,!1!==n.async,"string"==typeof n.user?n.user:void 0,"string"==typeof n.password?n.password:void 0),u&&null!=c&&!a(n,/^content-type$/i)&&d.setRequestHeader("Content-Type","application/json; charset=utf-8"),"function"==typeof n.deserialize||a(n,/^accept$/i)||d.setRequestHeader("Accept","application/json, text/*"),n.withCredentials&&(d.withCredentials=n.withCredentials),n.timeout&&(d.timeout=n.timeout),d.responseType=l,n.headers)({}).hasOwnProperty.call(n.headers,m)&&d.setRequestHeader(m,n.headers[m]);d.onreadystatechange=function(t){if(!p&&4===t.target.readyState)try{var o,s=t.target.status>=200&&t.target.status<300||304===t.target.status||/^file:\/\//i.test(e),a=t.target.response;if("json"===l?t.target.responseType||"function"==typeof n.extract||(a=JSON.parse(t.target.responseText)):l&&"text"!==l||null==a&&(a=t.target.responseText),"function"==typeof n.extract?(a=n.extract(t.target,n),s=!0):"function"==typeof n.deserialize&&(a=n.deserialize(a)),s)i(a);else{try{o=t.target.responseText}catch(t){o=a}var c=new Error(o);c.code=t.target.status,c.response=a,r(c)}}catch(t){r(t)}},"function"==typeof n.config&&(d=n.config(d,n,e)||d)!==h&&(o=d.abort,d.abort=function(){p=!0,o.call(this)}),null==c?d.send():"function"==typeof n.serialize?d.send(n.serialize(c)):c instanceof t.FormData?d.send(c):d.send(JSON.stringify(c))})),jsonp:s((function(e,n,i,o){var s=n.callbackName||"_mithril_"+Math.round(1e16*Math.random())+"_"+r++,a=t.document.createElement("script");t[s]=function(e){delete t[s],a.parentNode.removeChild(a),i(e)},a.onerror=function(){delete t[s],a.parentNode.removeChild(a),o(new Error("JSONP request failed"))},a.src=e+(e.indexOf("?")<0?"?":"&")+encodeURIComponent(n.callbackKey||"callback")+"="+encodeURIComponent(s),t.document.documentElement.appendChild(a)}))}}},function(t,e,n){"use strict";var i=n(73);t.exports=n(119)(window,i)},function(t,e,n){"use strict";(function(e){var i=n(30),r=n(88),o=n(90),s=n(74),a=n(75),c=n(120),u=n(95),l={};t.exports=function(t,n){var d;function p(e,n,i){if(e=s(e,n),null!=d){d();var r=i?i.state:null,o=i?i.title:null;i&&i.replace?t.history.replaceState(r,o,y.prefix+e):t.history.pushState(r,o,y.prefix+e)}else t.location.href=y.prefix+e}var h,f,m,v,g=l,b=y.SKIP={};function y(r,s,w){if(null==r)throw new Error("Ensure the DOM element that was passed to `m.route` is not undefined");var x,N=0,C=Object.keys(w).map((function(t){if("/"!==t[0])throw new SyntaxError("Routes must start with a `/`");if(/:([^\/\.-]+)(\.{3})?:/.test(t))throw new SyntaxError("Route parameter names must be separated with either `/`, `.`, or `-`");return{route:t,component:w[t],check:c(t)}})),O="function"==typeof e?e:setTimeout,T=o.resolve(),k=!1;if(d=null,null!=s){var j=a(s);if(!C.some((function(t){return t.check(j)})))throw new ReferenceError("Default route doesn't match any known routes")}function S(){k=!1;var e=t.location.hash;"#"!==y.prefix[0]&&(e=t.location.search+e,"?"!==y.prefix[0]&&"/"!==(e=t.location.pathname+e)[0]&&(e="/"+e));var i=e.concat().replace(/(?:%[a-f89][a-f0-9])+/gim,decodeURIComponent).slice(y.prefix.length),r=a(i);function o(){if(i===s)throw new Error("Could not resolve default route "+s);p(s,null,{replace:!0})}u(r.params,t.history.state),function t(e){for(;e<C.length;e++)if(C[e].check(r)){var s=C[e].component,a=C[e].route,c=s,u=v=function(o){if(u===v){if(o===b)return t(e+1);h=null==o||"function"!=typeof o.view&&"function"!=typeof o?"div":o,f=r.params,m=i,v=null,g=s.render?s:null,2===N?n.redraw():(N=2,n.redraw.sync())}};return void(s.view||"function"==typeof s?(s={},u(c)):s.onmatch?T.then((function(){return s.onmatch(r.params,i,a)})).then(u,o):u("div"))}o()}(0)}return d=function(){k||(k=!0,O(S))},"function"==typeof t.history.pushState?(x=function(){t.removeEventListener("popstate",d,!1)},t.addEventListener("popstate",d,!1)):"#"===y.prefix[0]&&(d=null,x=function(){t.removeEventListener("hashchange",S,!1)},t.addEventListener("hashchange",S,!1)),n.mount(r,{onbeforeupdate:function(){return!(!(N=N?2:1)||l===g)},oncreate:S,onremove:x,view:function(){if(N&&l!==g){var t=[i(h,f.key,f)];return g&&(t=g.render(t[0])),t}}})}return y.set=function(t,e,n){null!=v&&((n=n||{}).replace=!0),v=null,p(t,e,n)},y.get=function(){return m},y.prefix="#!",y.Link={view:function(t){var e,n,i=t.attrs.options,o={};u(o,t.attrs),o.selector=o.options=o.key=o.oninit=o.oncreate=o.onbeforeupdate=o.onupdate=o.onbeforeremove=o.onremove=null;var s=r(t.attrs.selector||"a",o,t.children);return(s.attrs.disabled=Boolean(s.attrs.disabled))?(s.attrs.href=null,s.attrs["aria-disabled"]="true",s.attrs.onclick=null):(e=s.attrs.onclick,n=s.attrs.href,s.attrs.href=y.prefix+n,s.attrs.onclick=function(t){var r;"function"==typeof e?r=e.call(t.currentTarget,t):null==e||"object"!=typeof e||"function"==typeof e.handleEvent&&e.handleEvent(t),!1===r||t.defaultPrevented||0!==t.button&&0!==t.which&&1!==t.which||t.currentTarget.target&&"_self"!==t.currentTarget.target||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||(t.preventDefault(),t.redraw=!1,y.set(n,null,i))}),s}},y.param=function(t){return f&&null!=t?f[t]:f},y}}).call(this,n(92).setImmediate)},function(t,e,n){"use strict";var i=n(75);t.exports=function(t){var e=i(t),n=Object.keys(e.params),r=[],o=new RegExp("^"+e.path.replace(/:([^\/.-]+)(\.{3}|\.(?!\.)|-)?|[\\^$*+.()|\[\]{}]/g,(function(t,e,n){return null==e?"\\"+t:(r.push({k:e,r:"..."===n}),"..."===n?"(.*)":"."===n?"([^/]+)\\.":"([^/]+)"+(n||""))}))+"$");return function(t){for(var i=0;i<n.length;i++)if(e.params[n[i]]!==t.params[n[i]])return!1;if(!r.length)return o.test(t.path);var s=o.exec(t.path);if(null==s)return!1;for(i=0;i<r.length;i++)t.params[r[i].k]=r[i].r?s[i+1]:decodeURIComponent(s[i+1]);return!0}}},function(t,e,n){(function(e){t.exports=e.dayjs=n(26)}).call(this,n(27))},function(t,e){!function(t){"use strict";var e=function(n,i){this.options=t.extend({},e.DEFAULTS,i);var r=this.options.target===e.DEFAULTS.target?t(this.options.target):t(document).find(this.options.target);this.$target=r.on("scroll.bs.affix.data-api",t.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",t.proxy(this.checkPositionWithEventLoop,this)),this.$element=t(n),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};function n(n){return this.each((function(){var i=t(this),r=i.data("bs.affix"),o="object"==typeof n&&n;r||i.data("bs.affix",r=new e(this,o)),"string"==typeof n&&r[n]()}))}e.VERSION="3.4.1",e.RESET="affix affix-top affix-bottom",e.DEFAULTS={offset:0,target:window},e.prototype.getState=function(t,e,n,i){var r=this.$target.scrollTop(),o=this.$element.offset(),s=this.$target.height();if(null!=n&&"top"==this.affixed)return r<n&&"top";if("bottom"==this.affixed)return null!=n?!(r+this.unpin<=o.top)&&"bottom":!(r+s<=t-i)&&"bottom";var a=null==this.affixed,c=a?r:o.top;return null!=n&&r<=n?"top":null!=i&&c+(a?s:e)>=t-i&&"bottom"},e.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(e.RESET).addClass("affix");var t=this.$target.scrollTop(),n=this.$element.offset();return this.pinnedOffset=n.top-t},e.prototype.checkPositionWithEventLoop=function(){setTimeout(t.proxy(this.checkPosition,this),1)},e.prototype.checkPosition=function(){if(this.$element.is(":visible")){var n=this.$element.height(),i=this.options.offset,r=i.top,o=i.bottom,s=Math.max(t(document).height(),t(document.body).height());"object"!=typeof i&&(o=r=i),"function"==typeof r&&(r=i.top(this.$element)),"function"==typeof o&&(o=i.bottom(this.$element));var a=this.getState(s,n,r,o);if(this.affixed!=a){null!=this.unpin&&this.$element.css("top","");var c="affix"+(a?"-"+a:""),u=t.Event(c+".bs.affix");if(this.$element.trigger(u),u.isDefaultPrevented())return;this.affixed=a,this.unpin="bottom"==a?this.getPinnedOffset():null,this.$element.removeClass(e.RESET).addClass(c).trigger(c.replace("affix","affixed")+".bs.affix")}"bottom"==a&&this.$element.offset({top:s-n-o})}};var i=t.fn.affix;t.fn.affix=n,t.fn.affix.Constructor=e,t.fn.affix.noConflict=function(){return t.fn.affix=i,this},t(window).on("load",(function(){t('[data-spy="affix"]').each((function(){var e=t(this),i=e.data();i.offset=i.offset||{},null!=i.offsetBottom&&(i.offset.bottom=i.offsetBottom),null!=i.offsetTop&&(i.offset.top=i.offsetTop),n.call(e,i)}))}))}(jQuery)},function(t,e){!function(t){"use strict";var e='[data-toggle="dropdown"]',n=function(e){t(e).on("click.bs.dropdown",this.toggle)};function i(e){var n=e.attr("data-target");n||(n=(n=e.attr("href"))&&/#[A-Za-z]/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,""));var i="#"!==n?t(document).find(n):null;return i&&i.length?i:e.parent()}function r(n){n&&3===n.which||(t(".dropdown-backdrop").remove(),t(e).each((function(){var e=t(this),r=i(e),o={relatedTarget:this};r.hasClass("open")&&(n&&"click"==n.type&&/input|textarea/i.test(n.target.tagName)&&t.contains(r[0],n.target)||(r.trigger(n=t.Event("hide.bs.dropdown",o)),n.isDefaultPrevented()||(e.attr("aria-expanded","false"),r.removeClass("open").trigger(t.Event("hidden.bs.dropdown",o)))))})))}n.VERSION="3.4.1",n.prototype.toggle=function(e){var n=t(this);if(!n.is(".disabled, :disabled")){var o=i(n),s=o.hasClass("open");if(r(),!s){"ontouchstart"in document.documentElement&&!o.closest(".navbar-nav").length&&t(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(t(this)).on("click",r);var a={relatedTarget:this};if(o.trigger(e=t.Event("show.bs.dropdown",a)),e.isDefaultPrevented())return;n.trigger("focus").attr("aria-expanded","true"),o.toggleClass("open").trigger(t.Event("shown.bs.dropdown",a))}return!1}},n.prototype.keydown=function(n){if(/(38|40|27|32)/.test(n.which)&&!/input|textarea/i.test(n.target.tagName)){var r=t(this);if(n.preventDefault(),n.stopPropagation(),!r.is(".disabled, :disabled")){var o=i(r),s=o.hasClass("open");if(!s&&27!=n.which||s&&27==n.which)return 27==n.which&&o.find(e).trigger("focus"),r.trigger("click");var a=o.find(".dropdown-menu li:not(.disabled):visible a");if(a.length){var c=a.index(n.target);38==n.which&&c>0&&c--,40==n.which&&c<a.length-1&&c++,~c||(c=0),a.eq(c).trigger("focus")}}}};var o=t.fn.dropdown;t.fn.dropdown=function(e){return this.each((function(){var i=t(this),r=i.data("bs.dropdown");r||i.data("bs.dropdown",r=new n(this)),"string"==typeof e&&r[e].call(i)}))},t.fn.dropdown.Constructor=n,t.fn.dropdown.noConflict=function(){return t.fn.dropdown=o,this},t(document).on("click.bs.dropdown.data-api",r).on("click.bs.dropdown.data-api",".dropdown form",(function(t){t.stopPropagation()})).on("click.bs.dropdown.data-api",e,n.prototype.toggle).on("keydown.bs.dropdown.data-api",e,n.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",n.prototype.keydown)}(jQuery)},function(t,e){!function(t){"use strict";var e=function(e,n){this.options=n,this.$body=t(document.body),this.$element=t(e),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.fixedContent=".navbar-fixed-top, .navbar-fixed-bottom",this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,t.proxy((function(){this.$element.trigger("loaded.bs.modal")}),this))};function n(n,i){return this.each((function(){var r=t(this),o=r.data("bs.modal"),s=t.extend({},e.DEFAULTS,r.data(),"object"==typeof n&&n);o||r.data("bs.modal",o=new e(this,s)),"string"==typeof n?o[n](i):s.show&&o.show(i)}))}e.VERSION="3.4.1",e.TRANSITION_DURATION=300,e.BACKDROP_TRANSITION_DURATION=150,e.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},e.prototype.toggle=function(t){return this.isShown?this.hide():this.show(t)},e.prototype.show=function(n){var i=this,r=t.Event("show.bs.modal",{relatedTarget:n});this.$element.trigger(r),this.isShown||r.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',t.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",(function(){i.$element.one("mouseup.dismiss.bs.modal",(function(e){t(e.target).is(i.$element)&&(i.ignoreBackdropClick=!0)}))})),this.backdrop((function(){var r=t.support.transition&&i.$element.hasClass("fade");i.$element.parent().length||i.$element.appendTo(i.$body),i.$element.show().scrollTop(0),i.adjustDialog(),r&&i.$element[0].offsetWidth,i.$element.addClass("in"),i.enforceFocus();var o=t.Event("shown.bs.modal",{relatedTarget:n});r?i.$dialog.one("bsTransitionEnd",(function(){i.$element.trigger("focus").trigger(o)})).emulateTransitionEnd(e.TRANSITION_DURATION):i.$element.trigger("focus").trigger(o)})))},e.prototype.hide=function(n){n&&n.preventDefault(),n=t.Event("hide.bs.modal"),this.$element.trigger(n),this.isShown&&!n.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),t(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),t.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",t.proxy(this.hideModal,this)).emulateTransitionEnd(e.TRANSITION_DURATION):this.hideModal())},e.prototype.enforceFocus=function(){t(document).off("focusin.bs.modal").on("focusin.bs.modal",t.proxy((function(t){document===t.target||this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.trigger("focus")}),this))},e.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",t.proxy((function(t){27==t.which&&this.hide()}),this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},e.prototype.resize=function(){this.isShown?t(window).on("resize.bs.modal",t.proxy(this.handleUpdate,this)):t(window).off("resize.bs.modal")},e.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop((function(){t.$body.removeClass("modal-open"),t.resetAdjustments(),t.resetScrollbar(),t.$element.trigger("hidden.bs.modal")}))},e.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},e.prototype.backdrop=function(n){var i=this,r=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var o=t.support.transition&&r;if(this.$backdrop=t(document.createElement("div")).addClass("modal-backdrop "+r).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",t.proxy((function(t){this.ignoreBackdropClick?this.ignoreBackdropClick=!1:t.target===t.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide())}),this)),o&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!n)return;o?this.$backdrop.one("bsTransitionEnd",n).emulateTransitionEnd(e.BACKDROP_TRANSITION_DURATION):n()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var s=function(){i.removeBackdrop(),n&&n()};t.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",s).emulateTransitionEnd(e.BACKDROP_TRANSITION_DURATION):s()}else n&&n()},e.prototype.handleUpdate=function(){this.adjustDialog()},e.prototype.adjustDialog=function(){var t=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&t?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!t?this.scrollbarWidth:""})},e.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},e.prototype.checkScrollbar=function(){var t=window.innerWidth;if(!t){var e=document.documentElement.getBoundingClientRect();t=e.right-Math.abs(e.left)}this.bodyIsOverflowing=document.body.clientWidth<t,this.scrollbarWidth=this.measureScrollbar()},e.prototype.setScrollbar=function(){var e=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"";var n=this.scrollbarWidth;this.bodyIsOverflowing&&(this.$body.css("padding-right",e+n),t(this.fixedContent).each((function(e,i){var r=i.style.paddingRight,o=t(i).css("padding-right");t(i).data("padding-right",r).css("padding-right",parseFloat(o)+n+"px")})))},e.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad),t(this.fixedContent).each((function(e,n){var i=t(n).data("padding-right");t(n).removeData("padding-right"),n.style.paddingRight=i||""}))},e.prototype.measureScrollbar=function(){var t=document.createElement("div");t.className="modal-scrollbar-measure",this.$body.append(t);var e=t.offsetWidth-t.clientWidth;return this.$body[0].removeChild(t),e};var i=t.fn.modal;t.fn.modal=n,t.fn.modal.Constructor=e,t.fn.modal.noConflict=function(){return t.fn.modal=i,this},t(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',(function(e){var i=t(this),r=i.attr("href"),o=i.attr("data-target")||r&&r.replace(/.*(?=#[^\s]+$)/,""),s=t(document).find(o),a=s.data("bs.modal")?"toggle":t.extend({remote:!/#/.test(r)&&r},s.data(),i.data());i.is("a")&&e.preventDefault(),s.one("show.bs.modal",(function(t){t.isDefaultPrevented()||s.one("hidden.bs.modal",(function(){i.is(":visible")&&i.trigger("focus")}))})),n.call(s,a,this)}))}(jQuery)},function(t,e){!function(t){"use strict";var e=["sanitize","whiteList","sanitizeFn"],n=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],i={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},r=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,o=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;function s(e,i){var s=e.nodeName.toLowerCase();if(-1!==t.inArray(s,i))return-1===t.inArray(s,n)||Boolean(e.nodeValue.match(r)||e.nodeValue.match(o));for(var a=t(i).filter((function(t,e){return e instanceof RegExp})),c=0,u=a.length;c<u;c++)if(s.match(a[c]))return!0;return!1}function a(e,n,i){if(0===e.length)return e;if(i&&"function"==typeof i)return i(e);if(!document.implementation||!document.implementation.createHTMLDocument)return e;var r=document.implementation.createHTMLDocument("sanitization");r.body.innerHTML=e;for(var o=t.map(n,(function(t,e){return e})),a=t(r.body).find("*"),c=0,u=a.length;c<u;c++){var l=a[c],d=l.nodeName.toLowerCase();if(-1!==t.inArray(d,o))for(var p=t.map(l.attributes,(function(t){return t})),h=[].concat(n["*"]||[],n[d]||[]),f=0,m=p.length;f<m;f++)s(p[f],h)||l.removeAttribute(p[f].nodeName);else l.parentNode.removeChild(l)}return r.body.innerHTML}var c=function(t,e){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",t,e)};c.VERSION="3.4.1",c.TRANSITION_DURATION=150,c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0},sanitize:!0,sanitizeFn:null,whiteList:i},c.prototype.init=function(e,n,i){if(this.enabled=!0,this.type=e,this.$element=t(n),this.options=this.getOptions(i),this.$viewport=this.options.viewport&&t(document).find(t.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var r=this.options.trigger.split(" "),o=r.length;o--;){var s=r[o];if("click"==s)this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this));else if("manual"!=s){var a="hover"==s?"mouseenter":"focusin",c="hover"==s?"mouseleave":"focusout";this.$element.on(a+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(c+"."+this.type,this.options.selector,t.proxy(this.leave,this))}}this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(n){var i=this.$element.data();for(var r in i)i.hasOwnProperty(r)&&-1!==t.inArray(r,e)&&delete i[r];return(n=t.extend({},this.getDefaults(),i,n)).delay&&"number"==typeof n.delay&&(n.delay={show:n.delay,hide:n.delay}),n.sanitize&&(n.template=a(n.template,n.whiteList,n.sanitizeFn)),n},c.prototype.getDelegateOptions=function(){var e={},n=this.getDefaults();return this._options&&t.each(this._options,(function(t,i){n[t]!=i&&(e[t]=i)})),e},c.prototype.enter=function(e){var n=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);if(n||(n=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,n)),e instanceof t.Event&&(n.inState["focusin"==e.type?"focus":"hover"]=!0),n.tip().hasClass("in")||"in"==n.hoverState)n.hoverState="in";else{if(clearTimeout(n.timeout),n.hoverState="in",!n.options.delay||!n.options.delay.show)return n.show();n.timeout=setTimeout((function(){"in"==n.hoverState&&n.show()}),n.options.delay.show)}},c.prototype.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},c.prototype.leave=function(e){var n=e instanceof this.constructor?e:t(e.currentTarget).data("bs."+this.type);if(n||(n=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,n)),e instanceof t.Event&&(n.inState["focusout"==e.type?"focus":"hover"]=!1),!n.isInStateTrue()){if(clearTimeout(n.timeout),n.hoverState="out",!n.options.delay||!n.options.delay.hide)return n.hide();n.timeout=setTimeout((function(){"out"==n.hoverState&&n.hide()}),n.options.delay.hide)}},c.prototype.show=function(){var e=t.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(e);var n=t.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(e.isDefaultPrevented()||!n)return;var i=this,r=this.tip(),o=this.getUID(this.type);this.setContent(),r.attr("id",o),this.$element.attr("aria-describedby",o),this.options.animation&&r.addClass("fade");var s="function"==typeof this.options.placement?this.options.placement.call(this,r[0],this.$element[0]):this.options.placement,a=/\s?auto?\s?/i,u=a.test(s);u&&(s=s.replace(a,"")||"top"),r.detach().css({top:0,left:0,display:"block"}).addClass(s).data("bs."+this.type,this),this.options.container?r.appendTo(t(document).find(this.options.container)):r.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var l=this.getPosition(),d=r[0].offsetWidth,p=r[0].offsetHeight;if(u){var h=s,f=this.getPosition(this.$viewport);s="bottom"==s&&l.bottom+p>f.bottom?"top":"top"==s&&l.top-p<f.top?"bottom":"right"==s&&l.right+d>f.width?"left":"left"==s&&l.left-d<f.left?"right":s,r.removeClass(h).addClass(s)}var m=this.getCalculatedOffset(s,l,d,p);this.applyPlacement(m,s);var v=function(){var t=i.hoverState;i.$element.trigger("shown.bs."+i.type),i.hoverState=null,"out"==t&&i.leave(i)};t.support.transition&&this.$tip.hasClass("fade")?r.one("bsTransitionEnd",v).emulateTransitionEnd(c.TRANSITION_DURATION):v()}},c.prototype.applyPlacement=function(e,n){var i=this.tip(),r=i[0].offsetWidth,o=i[0].offsetHeight,s=parseInt(i.css("margin-top"),10),a=parseInt(i.css("margin-left"),10);isNaN(s)&&(s=0),isNaN(a)&&(a=0),e.top+=s,e.left+=a,t.offset.setOffset(i[0],t.extend({using:function(t){i.css({top:Math.round(t.top),left:Math.round(t.left)})}},e),0),i.addClass("in");var c=i[0].offsetWidth,u=i[0].offsetHeight;"top"==n&&u!=o&&(e.top=e.top+o-u);var l=this.getViewportAdjustedDelta(n,e,c,u);l.left?e.left+=l.left:e.top+=l.top;var d=/top|bottom/.test(n),p=d?2*l.left-r+c:2*l.top-o+u,h=d?"offsetWidth":"offsetHeight";i.offset(e),this.replaceArrow(p,i[0][h],d)},c.prototype.replaceArrow=function(t,e,n){this.arrow().css(n?"left":"top",50*(1-t/e)+"%").css(n?"top":"left","")},c.prototype.setContent=function(){var t=this.tip(),e=this.getTitle();this.options.html?(this.options.sanitize&&(e=a(e,this.options.whiteList,this.options.sanitizeFn)),t.find(".tooltip-inner").html(e)):t.find(".tooltip-inner").text(e),t.removeClass("fade in top bottom left right")},c.prototype.hide=function(e){var n=this,i=t(this.$tip),r=t.Event("hide.bs."+this.type);function o(){"in"!=n.hoverState&&i.detach(),n.$element&&n.$element.removeAttr("aria-describedby").trigger("hidden.bs."+n.type),e&&e()}if(this.$element.trigger(r),!r.isDefaultPrevented())return i.removeClass("in"),t.support.transition&&i.hasClass("fade")?i.one("bsTransitionEnd",o).emulateTransitionEnd(c.TRANSITION_DURATION):o(),this.hoverState=null,this},c.prototype.fixTitle=function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(e){var n=(e=e||this.$element)[0],i="BODY"==n.tagName,r=n.getBoundingClientRect();null==r.width&&(r=t.extend({},r,{width:r.right-r.left,height:r.bottom-r.top}));var o=window.SVGElement&&n instanceof window.SVGElement,s=i?{top:0,left:0}:o?null:e.offset(),a={scroll:i?document.documentElement.scrollTop||document.body.scrollTop:e.scrollTop()},c=i?{width:t(window).width(),height:t(window).height()}:null;return t.extend({},r,a,c,s)},c.prototype.getCalculatedOffset=function(t,e,n,i){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-n/2}:"top"==t?{top:e.top-i,left:e.left+e.width/2-n/2}:"left"==t?{top:e.top+e.height/2-i/2,left:e.left-n}:{top:e.top+e.height/2-i/2,left:e.left+e.width}},c.prototype.getViewportAdjustedDelta=function(t,e,n,i){var r={top:0,left:0};if(!this.$viewport)return r;var o=this.options.viewport&&this.options.viewport.padding||0,s=this.getPosition(this.$viewport);if(/right|left/.test(t)){var a=e.top-o-s.scroll,c=e.top+o-s.scroll+i;a<s.top?r.top=s.top-a:c>s.top+s.height&&(r.top=s.top+s.height-c)}else{var u=e.left-o,l=e.left+o+n;u<s.left?r.left=s.left-u:l>s.right&&(r.left=s.left+s.width-l)}return r},c.prototype.getTitle=function(){var t=this.$element,e=this.options;return t.attr("data-original-title")||("function"==typeof e.title?e.title.call(t[0]):e.title)},c.prototype.getUID=function(t){do{t+=~~(1e6*Math.random())}while(document.getElementById(t));return t},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=t(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(e){var n=this;e&&((n=t(e.currentTarget).data("bs."+this.type))||(n=new this.constructor(e.currentTarget,this.getDelegateOptions()),t(e.currentTarget).data("bs."+this.type,n))),e?(n.inState.click=!n.inState.click,n.isInStateTrue()?n.enter(n):n.leave(n)):n.tip().hasClass("in")?n.leave(n):n.enter(n)},c.prototype.destroy=function(){var t=this;clearTimeout(this.timeout),this.hide((function(){t.$element.off("."+t.type).removeData("bs."+t.type),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null,t.$element=null}))},c.prototype.sanitizeHtml=function(t){return a(t,this.options.whiteList,this.options.sanitizeFn)};var u=t.fn.tooltip;t.fn.tooltip=function(e){return this.each((function(){var n=t(this),i=n.data("bs.tooltip"),r="object"==typeof e&&e;!i&&/destroy|hide/.test(e)||(i||n.data("bs.tooltip",i=new c(this,r)),"string"==typeof e&&i[e]())}))},t.fn.tooltip.Constructor=c,t.fn.tooltip.noConflict=function(){return t.fn.tooltip=u,this}}(jQuery)},function(t,e){!function(t){"use strict";t.fn.emulateTransitionEnd=function(e){var n=!1,i=this;t(this).one("bsTransitionEnd",(function(){n=!0}));return setTimeout((function(){n||t(i).trigger(t.support.transition.end)}),e),this},t((function(){t.support.transition=function(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var n in e)if(void 0!==t.style[n])return{end:e[n]};return!1}(),t.support.transition&&(t.event.special.bsTransitionEnd={bindType:t.support.transition.end,delegateType:t.support.transition.end,handle:function(e){if(t(e.target).is(this))return e.handleObj.handler.apply(this,arguments)}})}))}(jQuery)},function(t,e){!function(t){function e(e){if("string"==typeof e.data&&(e.data={keys:e.data}),e.data&&e.data.keys&&"string"==typeof e.data.keys){var n=e.handler,i=e.data.keys.toLowerCase().split(" ");e.handler=function(e){if(this===e.target||!(t.hotkeys.options.filterInputAcceptingElements&&t.hotkeys.textInputTypes.test(e.target.nodeName)||t.hotkeys.options.filterContentEditable&&t(e.target).attr("contenteditable")||t.hotkeys.options.filterTextInputs&&t.inArray(e.target.type,t.hotkeys.textAcceptingInputTypes)>-1)){var r="keypress"!==e.type&&t.hotkeys.specialKeys[e.which],o=String.fromCharCode(e.which).toLowerCase(),s="",a={};t.each(["alt","ctrl","shift"],(function(t,n){e[n+"Key"]&&r!==n&&(s+=n+"+")})),e.metaKey&&!e.ctrlKey&&"meta"!==r&&(s+="meta+"),e.metaKey&&"meta"!==r&&s.indexOf("alt+ctrl+shift+")>-1&&(s=s.replace("alt+ctrl+shift+","hyper+")),r?a[s+r]=!0:(a[s+o]=!0,a[s+t.hotkeys.shiftNums[o]]=!0,"shift+"===s&&(a[t.hotkeys.shiftNums[o]]=!0));for(var c=0,u=i.length;c<u;c++)if(a[i[c]])return n.apply(this,arguments)}}}}t.hotkeys={version:"0.2.0",specialKeys:{8:"backspace",9:"tab",10:"return",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",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:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"},textAcceptingInputTypes:["text","password","number","email","url","range","date","month","week","time","datetime","datetime-local","search","color","tel"],textInputTypes:/textarea|input|select/i,options:{filterInputAcceptingElements:!0,filterTextInputs:!0,filterContentEditable:!0}},t.each(["keydown","keyup","keypress"],(function(){t.event.special[this]={add:e}}))}(jQuery||this.jQuery||window.jQuery)},function(t,e,n){!function(){"use strict";n.SKIP={},n.lift=function(){var t=arguments[0],e=Array.prototype.slice.call(arguments,1);return r(e).map((function(e){return t.apply(void 0,e)}))},n.scan=function(t,e,i){var r=i.map((function(i){var r=t(e,i);return r!==n.SKIP&&(e=r),r}));return r(e),r},n.merge=r,n.combine=i,n.scanMerge=function(t,e){var n=t.map((function(t){return t[0]})),r=i((function(){var i=arguments[arguments.length-1];return n.forEach((function(n,r){i.indexOf(n)>-1&&(e=t[r][1](e,n()))})),e}),n);return r(e),r},n["fantasy-land/of"]=n;var e=!1;function n(t){var e,r=[],s=[];function a(e){return arguments.length&&e!==n.SKIP&&(t=e,o(a)&&(a._changing(),a._state="active",r.forEach((function(e,n){e(s[n](t))})))),t}function c(){return(e=n()).map((function(t){return!0===t&&(a._parents.forEach((function(t){t._unregisterChild(a)})),a._state="ended",a._parents.length=r.length=s.length=0),t})),e}return a.constructor=n,a._state=arguments.length&&t!==n.SKIP?"active":"pending",a._parents=[],a._changing=function(){o(a)&&(a._state="changing"),r.forEach((function(t){t._changing()}))},a._map=function(e,i){var o=i?n():n(e(t));return o._parents.push(a),r.push(o),s.push(e),o},a.map=function(t){return a._map(t,"active"!==a._state)},a.toJSON=function(){return null!=t&&"function"==typeof t.toJSON?t.toJSON():t},a["fantasy-land/map"]=a.map,a["fantasy-land/ap"]=function(t){return i((function(t,e){return t()(e())}),[t,a])},a._unregisterChild=function(t){var e=r.indexOf(t);-1!==e&&(r.splice(e,1),s.splice(e,1))},Object.defineProperty(a,"end",{get:function(){return e||c()}}),a}function i(t,e){var i=e.every((function(t){if(t.constructor!==n)throw new Error("Ensure that each item passed to stream.combine/stream.merge/lift is a stream");return"active"===t._state})),r=i?n(t.apply(null,e.concat([e]))):n(),o=[],s=e.map((function(n){return n._map((function(s){return o.push(n),(i||e.every((function(t){return"pending"!==t._state})))&&(i=!0,r(t.apply(null,e.concat([o]))),o=[]),s}),!0)})),a=r.end.map((function(t){!0===t&&(s.forEach((function(t){t.end(!0)})),a.end(!0))}));return r}function r(t){return i((function(){return t.map((function(t){return t()}))}),t)}function o(t){return"pending"===t._state||"active"===t._state||"changing"===t._state}Object.defineProperty(n,"HALT",{get:function(){return e||console.log("HALT is deprecated and has been renamed to SKIP"),e=!0,n.SKIP}}),t.exports=n}()},function(t,e,n){(function(e){t.exports=e.punycode=n(130)}).call(this,n(27))},function(t,e,n){(function(t,i){var r;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(o){e&&e.nodeType,t&&t.nodeType;var s="object"==typeof i&&i;s.global!==s&&s.window!==s&&s.self;var a,c=2147483647,u=/^xn--/,l=/[^\x20-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},h=Math.floor,f=String.fromCharCode;function m(t){throw new RangeError(p[t])}function v(t,e){for(var n=t.length,i=[];n--;)i[n]=e(t[n]);return i}function g(t,e){var n=t.split("@"),i="";return n.length>1&&(i=n[0]+"@",t=n[1]),i+v((t=t.replace(d,".")).split("."),e).join(".")}function b(t){for(var e,n,i=[],r=0,o=t.length;r<o;)(e=t.charCodeAt(r++))>=55296&&e<=56319&&r<o?56320==(64512&(n=t.charCodeAt(r++)))?i.push(((1023&e)<<10)+(1023&n)+65536):(i.push(e),r--):i.push(e);return i}function y(t){return v(t,(function(t){var e="";return t>65535&&(e+=f((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=f(t)})).join("")}function w(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function x(t,e,n){var i=0;for(t=n?h(t/700):t>>1,t+=h(t/e);t>455;i+=36)t=h(t/35);return h(i+36*t/(t+38))}function N(t){var e,n,i,r,o,s,a,u,l,d,p,f=[],v=t.length,g=0,b=128,w=72;for((n=t.lastIndexOf("-"))<0&&(n=0),i=0;i<n;++i)t.charCodeAt(i)>=128&&m("not-basic"),f.push(t.charCodeAt(i));for(r=n>0?n+1:0;r<v;){for(o=g,s=1,a=36;r>=v&&m("invalid-input"),((u=(p=t.charCodeAt(r++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:36)>=36||u>h((c-g)/s))&&m("overflow"),g+=u*s,!(u<(l=a<=w?1:a>=w+26?26:a-w));a+=36)s>h(c/(d=36-l))&&m("overflow"),s*=d;w=x(g-o,e=f.length+1,0==o),h(g/e)>c-b&&m("overflow"),b+=h(g/e),g%=e,f.splice(g++,0,b)}return y(f)}function C(t){var e,n,i,r,o,s,a,u,l,d,p,v,g,y,N,C=[];for(v=(t=b(t)).length,e=128,n=0,o=72,s=0;s<v;++s)(p=t[s])<128&&C.push(f(p));for(i=r=C.length,r&&C.push("-");i<v;){for(a=c,s=0;s<v;++s)(p=t[s])>=e&&p<a&&(a=p);for(a-e>h((c-n)/(g=i+1))&&m("overflow"),n+=(a-e)*g,e=a,s=0;s<v;++s)if((p=t[s])<e&&++n>c&&m("overflow"),p==e){for(u=n,l=36;!(u<(d=l<=o?1:l>=o+26?26:l-o));l+=36)N=u-d,y=36-d,C.push(f(w(d+N%y,0))),u=h(N/y);C.push(f(w(u,0))),o=x(n,g,i==r),n=0,++i}++n,++e}return C.join("")}a={version:"1.4.1",ucs2:{decode:b,encode:y},decode:N,encode:C,toASCII:function(t){return g(t,(function(t){return l.test(t)?"xn--"+C(t):t}))},toUnicode:function(t){return g(t,(function(t){return u.test(t)?N(t.slice(4).toLowerCase()):t}))}},void 0===(r=function(){return a}.call(e,n,e,t))||(t.exports=r)}()}).call(this,n(131)(t),n(27))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){(function(e){t.exports=e.ColorThief=n(133)}).call(this,n(27))},function(t,e){ /*! * Color Thief v2.0 * by Lokesh Dhakar - http://www.lokeshdhakar.com * * Thanks * ------ * Nick Rabinowitz - For creating quantize.js. * John Schulz - For clean up and optimization. @JFSIII * Nathan Spady - For adding drag and drop support to the demo page. * * License * ------- * Copyright 2011, 2015 Lokesh Dhakar * Released under the MIT license * https://raw.githubusercontent.com/lokesh/color-thief/master/LICENSE * */ var n=function(t){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),document.body.appendChild(this.canvas),this.width=this.canvas.width=t.width,this.height=this.canvas.height=t.height,this.context.drawImage(t,0,0,this.width,this.height)};n.prototype.clear=function(){this.context.clearRect(0,0,this.width,this.height)},n.prototype.update=function(t){this.context.putImageData(t,0,0)},n.prototype.getPixelCount=function(){return this.width*this.height},n.prototype.getImageData=function(){return this.context.getImageData(0,0,this.width,this.height)},n.prototype.removeCanvas=function(){this.canvas.parentNode.removeChild(this.canvas)};var i=function(){}; /*! * quantize.js Copyright 2008 Nick Rabinowitz. * Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php */ /*! * Block below copied from Protovis: http://mbostock.github.com/protovis/ * Copyright 2010 Stanford Visualization Group * Licensed under the BSD License: http://www.opensource.org/licenses/bsd-license.php */if(i.prototype.getColor=function(t,e){return this.getPalette(t,5,e)[0]},i.prototype.getPalette=function(t,e,i){void 0===e&&(e=10),(void 0===i||1>i)&&(i=10);for(var r,s,a,c,u=new n(t),l=u.getImageData().data,d=u.getPixelCount(),p=[],h=0;d>h;h+=i)s=l[(r=4*h)+0],a=l[r+1],c=l[r+2],l[r+3]>=125&&(s>250&&a>250&&c>250||p.push([s,a,c]));var f=o.quantize(p,e),m=f?f.palette():null;return u.removeCanvas(),m},!r)var r={map:function(t,e){var n={};return e?t.map((function(t,i){return n.index=i,e.call(n,t)})):t.slice()},naturalOrder:function(t,e){return e>t?-1:t>e?1:0},sum:function(t,e){var n={};return t.reduce(e?function(t,i,r){return n.index=r,t+e.call(n,i)}:function(t,e){return t+e},0)},max:function(t,e){return Math.max.apply(null,e?r.map(t,e):t)}};var o=function(){function t(t,e,n){return(t<<2*c)+(e<<c)+n}function e(t){function e(){n.sort(t),i=!0}var n=[],i=!1;return{push:function(t){n.push(t),i=!1},peek:function(t){return i||e(),void 0===t&&(t=n.length-1),n[t]},pop:function(){return i||e(),n.pop()},size:function(){return n.length},map:function(t){return n.map(t)},debug:function(){return i||e(),n}}}function n(t,e,n,i,r,o,s){var a=this;a.r1=t,a.r2=e,a.g1=n,a.g2=i,a.b1=r,a.b2=o,a.histo=s}function i(){this.vboxes=new e((function(t,e){return r.naturalOrder(t.vbox.count()*t.vbox.volume(),e.vbox.count()*e.vbox.volume())}))}function o(e){var n,i,r,o,s=new Array(1<<3*c);return e.forEach((function(e){i=e[0]>>u,r=e[1]>>u,o=e[2]>>u,n=t(i,r,o),s[n]=(s[n]||0)+1})),s}function s(t,e){var i,r,o,s=1e6,a=0,c=1e6,l=0,d=1e6,p=0;return t.forEach((function(t){i=t[0]>>u,r=t[1]>>u,o=t[2]>>u,s>i?s=i:i>a&&(a=i),c>r?c=r:r>l&&(l=r),d>o?d=o:o>p&&(p=o)})),new n(s,a,c,l,d,p,e)}function a(e,n){if(n.count()){var i=n.r2-n.r1+1,o=n.g2-n.g1+1,s=n.b2-n.b1+1,a=r.max([i,o,s]);if(1==n.count())return[n.copy()];var c,u,l,d,p=0,h=[],f=[];if(a==i)for(c=n.r1;c<=n.r2;c++){for(d=0,u=n.g1;u<=n.g2;u++)for(l=n.b1;l<=n.b2;l++)d+=e[t(c,u,l)]||0;p+=d,h[c]=p}else if(a==o)for(c=n.g1;c<=n.g2;c++){for(d=0,u=n.r1;u<=n.r2;u++)for(l=n.b1;l<=n.b2;l++)d+=e[t(u,c,l)]||0;p+=d,h[c]=p}else for(c=n.b1;c<=n.b2;c++){for(d=0,u=n.r1;u<=n.r2;u++)for(l=n.g1;l<=n.g2;l++)d+=e[t(u,l,c)]||0;p+=d,h[c]=p}return h.forEach((function(t,e){f[e]=p-t})),function(t){var e,i,r,o,s,a=t+"1",u=t+"2",l=0;for(c=n[a];c<=n[u];c++)if(h[c]>p/2){for(r=n.copy(),o=n.copy(),e=c-n[a],s=(i=n[u]-c)>=e?Math.min(n[u]-1,~~(c+i/2)):Math.max(n[a],~~(c-1-e/2));!h[s];)s++;for(l=f[s];!l&&h[s-1];)l=f[--s];return r[u]=s,o[a]=r[u]+1,[r,o]}}(a==i?"r":a==o?"g":"b")}}var c=5,u=8-c,l=1e3,d=.75;return n.prototype={volume:function(t){var e=this;return(!e._volume||t)&&(e._volume=(e.r2-e.r1+1)*(e.g2-e.g1+1)*(e.b2-e.b1+1)),e._volume},count:function(e){var n=this,i=n.histo;if(!n._count_set||e){var r,o,s,a=0;for(r=n.r1;r<=n.r2;r++)for(o=n.g1;o<=n.g2;o++)for(s=n.b1;s<=n.b2;s++)index=t(r,o,s),a+=i[index]||0;n._count=a,n._count_set=!0}return n._count},copy:function(){var t=this;return new n(t.r1,t.r2,t.g1,t.g2,t.b1,t.b2,t.histo)},avg:function(e){var n=this,i=n.histo;if(!n._avg||e){var r,o,s,a,u=0,l=1<<8-c,d=0,p=0,h=0;for(o=n.r1;o<=n.r2;o++)for(s=n.g1;s<=n.g2;s++)for(a=n.b1;a<=n.b2;a++)u+=r=i[t(o,s,a)]||0,d+=r*(o+.5)*l,p+=r*(s+.5)*l,h+=r*(a+.5)*l;n._avg=u?[~~(d/u),~~(p/u),~~(h/u)]:[~~(l*(n.r1+n.r2+1)/2),~~(l*(n.g1+n.g2+1)/2),~~(l*(n.b1+n.b2+1)/2)]}return n._avg},contains:function(t){var e=this,n=t[0]>>u;return gval=t[1]>>u,bval=t[2]>>u,n>=e.r1&&n<=e.r2&&gval>=e.g1&&gval<=e.g2&&bval>=e.b1&&bval<=e.b2}},i.prototype={push:function(t){this.vboxes.push({vbox:t,color:t.avg()})},palette:function(){return this.vboxes.map((function(t){return t.color}))},size:function(){return this.vboxes.size()},map:function(t){for(var e=this.vboxes,n=0;n<e.size();n++)if(e.peek(n).vbox.contains(t))return e.peek(n).color;return this.nearest(t)},nearest:function(t){for(var e,n,i,r=this.vboxes,o=0;o<r.size();o++)(e>(n=Math.sqrt(Math.pow(t[0]-r.peek(o).color[0],2)+Math.pow(t[1]-r.peek(o).color[1],2)+Math.pow(t[2]-r.peek(o).color[2],2)))||void 0===e)&&(e=n,i=r.peek(o).color);return i},forcebw:function(){var t=this.vboxes;t.sort((function(t,e){return r.naturalOrder(r.sum(t.color),r.sum(e.color))}));var e=t[0].color;e[0]<5&&e[1]<5&&e[2]<5&&(t[0].color=[0,0,0]);var n=t.length-1,i=t[n].color;i[0]>251&&i[1]>251&&i[2]>251&&(t[n].color=[255,255,255])}},{quantize:function(t,n){function c(t,e){for(var n,i=1,r=0;l>r;)if((n=t.pop()).count()){var o=a(u,n),s=o[0],c=o[1];if(!s)return;if(t.push(s),c&&(t.push(c),i++),i>=e)return;if(r++>l)return}else t.push(n),r++}if(!t.length||2>n||n>256)return!1;var u=o(t);u.forEach((function(){0}));var p=s(t,u),h=new e((function(t,e){return r.naturalOrder(t.count(),e.count())}));h.push(p),c(h,d*n);for(var f=new e((function(t,e){return r.naturalOrder(t.count()*t.volume(),e.count()*e.volume())}));h.size();)f.push(h.pop());c(f,n-f.size());for(var m=new i;f.size();)m.push(f.pop());return m}}}();t.exports=i},function(t,e){},function(t,e,n){"use strict";n.r(e),n.d(e,"Extend",(function(){return i.a})),n.d(e,"app",(function(){return en})),n.d(e,"compat",(function(){return nn}));var i=n(97),r=(n(129),n(132),n(22)),o=n(0),s=n(5),a=n(2),c=n(51),u=function(){function t(t){this.stack=[]}var e=t.prototype;return e.getCurrent=function(){return this.stack[this.stack.length-1]},e.getPrevious=function(){return this.stack[this.stack.length-2]},e.push=function(t,e,n){void 0===n&&(n=m.route.get());var i=this.stack[this.stack.length-2];i&&i.name===t&&this.stack.pop();var r=this.getCurrent();r&&r.name===t?Object(a.a)(r,{url:n,title:e}):this.stack.push({name:t,url:n,title:e})},e.canGoBack=function(){return this.stack.length>1},e.back=function(){if(!this.canGoBack())return this.home();this.stack.pop(),m.route.set(this.getCurrent().url)},e.backUrl=function(){return this.stack[this.stack.length-2].url},e.home=function(){this.stack.splice(0),Object(c.a)("/")},t}(),l=function(){function t(t){this.pinnedKey="panePinned",this.$element=$(t),this.pinned="true"===localStorage.getItem(this.pinnedKey),this.active=!1,this.showing=!1,this.render()}var e=t.prototype;return e.enable=function(){this.active=!0,this.render()},e.disable=function(){this.active=!1,this.showing=!1,this.render()},e.show=function(){clearTimeout(this.hideTimeout),this.showing=!0,this.render()},e.hide=function(){this.showing=!1,this.render()},e.onmouseleave=function(){this.hideTimeout=setTimeout(this.hide.bind(this),250)},e.togglePinned=function(){this.pinned=!this.pinned,localStorage.setItem(this.pinnedKey,this.pinned?"true":"false"),this.render()},e.render=function(){this.$element.toggleClass("panePinned",this.pinned).toggleClass("hasPane",this.active).toggleClass("paneShowing",this.showing)},t}(),d=n(31),p=n(6),h=n(3),f=n(8),v=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.view=function(){return m("header",{className:"Hero DiscussionHero"},m("div",{className:"container"},m("ul",{className:"DiscussionHero-items"},Object(f.a)(this.items().toArray()))))},n.items=function(){var t=new p.a,e=this.attrs.discussion,n=e.badges().toArray();return n.length&&t.add("badges",m("ul",{className:"DiscussionHero-badges badges"},Object(f.a)(n)),10),t.add("title",m("h2",{className:"DiscussionHero-title"},e.title())),t},e}(h.a),g=n(13),b=n(19),y=n(35),w=n(7),x=n(28),N=n(77),C=n(17),O=n(44),T=function(t){function e(){return t.apply(this,arguments)||this}return Object(o.a)(e,t),e.prototype.view=function(){var t=this.attrs.discussion,e=this.attrs.lastPost&&t.replyCount(),n=t[e?"lastPostedUser":"user"](),i=t[e?"lastPostedAt":"createdAt"]();return m("span",null,e?Object(w.a)("fas fa-reply"):""," ",app.translator.trans("core.forum.discussion_list."+(e?"replied":"started")+"_text",{user:n,ago:Object(O.a)(i)}))},e}(h.a),k=n(52),j=n(18),S=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.handler=function(){return this.attrs.when()||void 0},n.oncreate=function(e){t.prototype.oncreate.call(this,e),this.boundHandler=this.handler.bind(this),$(window).on("beforeunload",this.boundHandler)},n.onremove=function(){$(window).off("beforeunload",this.boundHandler)},n.view=function(t){return t.children[0]},e}(h.a),A=n(53),E=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){var n=this;t.prototype.oninit.call(this,e),this.composer=this.attrs.composer,this.loading=!1,this.attrs.confirmExit&&this.composer.preventClosingWhen((function(){return n.hasChanges()}),this.attrs.confirmExit),this.composer.fields.content(this.attrs.originalContent||"")},n.view=function(){return m(S,{when:this.hasChanges.bind(this)},m("div",{className:"ComposerBody "+(this.attrs.className||"")},Object(b.a)(this.attrs.user,{className:"ComposerBody-avatar"}),m("div",{className:"ComposerBody-content"},m("ul",{className:"ComposerBody-header"},Object(f.a)(this.headerItems().toArray())),m("div",{className:"ComposerBody-editor"},A.a.component({submitLabel:this.attrs.submitLabel,placeholder:this.attrs.placeholder,disabled:this.loading||this.attrs.disabled,composer:this.composer,preview:this.jumpToPreview&&this.jumpToPreview.bind(this),onchange:this.composer.fields.content,onsubmit:this.onsubmit.bind(this),value:this.composer.fields.content()}))),j.a.component({className:"ComposerBody-loading"+(this.loading?" active":"")})))},n.hasChanges=function(){var t=this.composer.fields.content();return t&&t!==this.attrs.originalContent},n.headerItems=function(){return new p.a},n.onsubmit=function(){},n.loaded=function(){this.loading=!1,m.redraw()},e}(h.a),P=n(4),D=n(9);function _(t){app.composer.isFullScreen()&&(app.composer.minimize(),t.stopPropagation())}var I=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t),e.initAttrs=function(e){t.initAttrs.call(this,e),e.placeholder=e.placeholder||Object(D.a)(app.translator.trans("core.forum.composer_reply.body_placeholder")),e.submitLabel=e.submitLabel||app.translator.trans("core.forum.composer_reply.submit_button"),e.confirmExit=e.confirmExit||Object(D.a)(app.translator.trans("core.forum.composer_reply.discard_confirmation"))};var n=e.prototype;return n.headerItems=function(){var e=t.prototype.headerItems.call(this),n=this.attrs.discussion;return e.add("title",m("h3",null,Object(w.a)("fas fa-reply")," ",m(g.a,{href:app.route.discussion(n),onclick:_},n.title()))),e},n.jumpToPreview=function(t){_(t),m.route.set(app.route.discussion(this.attrs.discussion,"reply"))},n.data=function(){return{content:this.composer.fields.content(),relationships:{discussion:this.attrs.discussion}}},n.onsubmit=function(){var t=this,e=this.attrs.discussion;this.loading=!0,m.redraw();var n=this.data();app.store.createRecord("posts").save(n).then((function(n){if(app.viewingDiscussion(e)){var i=app.current.get("stream");i.update().then((function(){return i.goToNumber(n.number())}))}else{var r,o=P.a.component({className:"Button Button--link",onclick:function(){m.route.set(app.route.post(n)),app.alerts.dismiss(r)}},app.translator.trans("core.forum.composer_reply.view_button"));r=app.alerts.show({type:"success",controls:[o]},app.translator.trans("core.forum.composer_reply.posted_message"))}t.composer.hide()}),this.loaded.bind(this))},e}(E),M=n(14),L=n(11),R=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.email=Object(L.a)(this.attrs.email||""),this.success=!1},n.className=function(){return"ForgotPasswordModal Modal--small"},n.title=function(){return app.translator.trans("core.forum.forgot_password.title")},n.content=function(){return this.success?m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("p",{className:"helpText"},app.translator.trans("core.forum.forgot_password.email_sent_message")),m("div",{className:"Form-group"},m(P.a,{className:"Button Button--primary Button--block",onclick:this.hide.bind(this)},app.translator.trans("core.forum.forgot_password.dismiss_button"))))):m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("p",{className:"helpText"},app.translator.trans("core.forum.forgot_password.text")),m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"email",type:"email",placeholder:Object(D.a)(app.translator.trans("core.forum.forgot_password.email_placeholder")),bidi:this.email,disabled:this.loading})),m("div",{className:"Form-group"},P.a.component({className:"Button Button--primary Button--block",type:"submit",loading:this.loading},app.translator.trans("core.forum.forgot_password.submit_button")))))},n.onsubmit=function(t){var e=this;t.preventDefault(),this.loading=!0,app.request({method:"POST",url:app.forum.attribute("apiUrl")+"/forgot",body:{email:this.email()},errorHandler:this.onerror.bind(this)}).then((function(){e.success=!0,e.alert=null})).catch((function(){})).then(this.loaded.bind(this))},n.onerror=function(e){404===e.status&&(e.alert.content=app.translator.trans("core.forum.forgot_password.not_found_message")),t.prototype.onerror.call(this,e)},e}(M.a),B=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.view=function(){return m("div",{className:"LogInButtons"},this.items().toArray())},n.items=function(){return new p.a},e}(h.a),H=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.username=Object(L.a)(this.attrs.username||""),this.email=Object(L.a)(this.attrs.email||""),this.password=Object(L.a)(this.attrs.password||"")},n.className=function(){return"Modal--small SignUpModal"},n.title=function(){return app.translator.trans("core.forum.sign_up.title")},n.content=function(){return[m("div",{className:"Modal-body"},this.body()),m("div",{className:"Modal-footer"},this.footer())]},n.isProvided=function(t){return this.attrs.provided&&-1!==this.attrs.provided.indexOf(t)},n.body=function(){return[this.attrs.token?"":m(B,null),m("div",{className:"Form Form--centered"},this.fields().toArray())]},n.fields=function(){var t=new p.a;return t.add("username",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"username",type:"text",placeholder:Object(D.a)(app.translator.trans("core.forum.sign_up.username_placeholder")),bidi:this.username,disabled:this.loading||this.isProvided("username")})),30),t.add("email",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"email",type:"email",placeholder:Object(D.a)(app.translator.trans("core.forum.sign_up.email_placeholder")),bidi:this.email,disabled:this.loading||this.isProvided("email")})),20),this.attrs.token||t.add("password",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"password",type:"password",placeholder:Object(D.a)(app.translator.trans("core.forum.sign_up.password_placeholder")),bidi:this.password,disabled:this.loading})),10),t.add("submit",m("div",{className:"Form-group"},m(P.a,{className:"Button Button--primary Button--block",type:"submit",loading:this.loading},app.translator.trans("core.forum.sign_up.submit_button"))),-10),t},n.footer=function(){return[m("p",{className:"SignUpModal-logIn"},app.translator.trans("core.forum.sign_up.log_in_text",{a:m("a",{onclick:this.logIn.bind(this)})}))]},n.logIn=function(){var t={identification:this.email()||this.username(),password:this.password()};app.modal.show(U,t)},n.onready=function(){this.attrs.username&&!this.attrs.email?this.$("[name=email]").select():this.$("[name=username]").select()},n.onsubmit=function(t){t.preventDefault(),this.loading=!0;var e=this.submitData();app.request({url:app.forum.attribute("baseUrl")+"/register",method:"POST",body:e,errorHandler:this.onerror.bind(this)}).then((function(){return window.location.reload()}),this.loaded.bind(this))},n.submitData=function(){var t={username:this.username(),email:this.email()};return this.attrs.token?t.token=this.attrs.token:t.password=this.password(),t},e}(M.a),U=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.identification=Object(L.a)(this.attrs.identification||""),this.password=Object(L.a)(this.attrs.password||""),this.remember=Object(L.a)(!!this.attrs.remember)},n.className=function(){return"LogInModal Modal--small"},n.title=function(){return app.translator.trans("core.forum.log_in.title")},n.content=function(){return[m("div",{className:"Modal-body"},this.body()),m("div",{className:"Modal-footer"},this.footer())]},n.body=function(){return[m(B,null),m("div",{className:"Form Form--centered"},this.fields().toArray())]},n.fields=function(){var t=new p.a;return t.add("identification",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"identification",type:"text",placeholder:Object(D.a)(app.translator.trans("core.forum.log_in.username_or_email_placeholder")),bidi:this.identification,disabled:this.loading})),30),t.add("password",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"password",type:"password",placeholder:Object(D.a)(app.translator.trans("core.forum.log_in.password_placeholder")),bidi:this.password,disabled:this.loading})),20),t.add("remember",m("div",{className:"Form-group"},m("div",null,m("label",{className:"checkbox"},m("input",{type:"checkbox",bidi:this.remember,disabled:this.loading}),app.translator.trans("core.forum.log_in.remember_me_label")))),10),t.add("submit",m("div",{className:"Form-group"},P.a.component({className:"Button Button--primary Button--block",type:"submit",loading:this.loading},app.translator.trans("core.forum.log_in.submit_button"))),-10),t},n.footer=function(){return[m("p",{className:"LogInModal-forgotPassword"},m("a",{onclick:this.forgotPassword.bind(this)},app.translator.trans("core.forum.log_in.forgot_password_link"))),app.forum.attribute("allowSignUp")?m("p",{className:"LogInModal-signUp"},app.translator.trans("core.forum.log_in.sign_up_text",{a:m("a",{onclick:this.signUp.bind(this)})})):""]},n.forgotPassword=function(){var t=this.identification(),e=-1!==t.indexOf("@")?{email:t}:void 0;app.modal.show(R,e)},n.signUp=function(){var t={password:this.password()},e=this.identification();t[-1!==e.indexOf("@")?"email":"username"]=e,app.modal.show(H,t)},n.onready=function(){this.$("[name="+(this.identification()?"password":"identification")+"]").select()},n.onsubmit=function(t){t.preventDefault(),this.loading=!0;var e=this.identification(),n=this.password(),i=this.remember();app.session.login({identification:e,password:n,remember:i},{errorHandler:this.onerror.bind(this)}).then((function(){return window.location.reload()}),this.loaded.bind(this))},n.onerror=function(e){401===e.status&&(e.alert.content=app.translator.trans("core.forum.log_in.invalid_login_message")),t.prototype.onerror.call(this,e)},e}(M.a),F=n(25),q=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.discussion=this.attrs.discussion,this.currentTitle=this.attrs.currentTitle,this.newTitle=Object(L.a)(this.currentTitle)},n.className=function(){return"RenameDiscussionModal Modal--small"},n.title=function(){return app.translator.trans("core.forum.rename_discussion.title")},n.content=function(){return m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("div",{className:"Form-group"},m("input",{className:"FormControl",bidi:this.newTitle,type:"text"})),m("div",{className:"Form-group"},P.a.component({className:"Button Button--primary Button--block",type:"submit",loading:this.loading},app.translator.trans("core.forum.rename_discussion.submit_button")))))},n.onsubmit=function(t){var e=this;t.preventDefault(),this.loading=!0;var n=this.newTitle,i=this.currentTitle;if(n&&n!==i)return this.discussion.save({title:n}).then((function(){app.viewingDiscussion(e.discussion)&&app.current.get("stream").update(),m.redraw(),e.hide()})).catch((function(){e.loading=!1,m.redraw()}));this.hide()},e}(M.a),z={controls:function(t,e){var n=this,i=new p.a;return["user","moderation","destructive"].forEach((function(r){var o=n[r+"Controls"](t,e).toArray();o.length&&(o.forEach((function(t){return i.add(t.itemName,t)})),i.add(r+"Separator",F.a.component()))})),i},userControls:function(t,e){var n=this,i=new p.a;return e instanceof Mt&&i.add("reply",!app.session.user||t.canReply()?P.a.component({icon:"fas fa-reply",onclick:function(){return n.replyAction.bind(t)(!0,!1).catch((function(){}))}},app.translator.trans(app.session.user?"core.forum.discussion_controls.reply_button":"core.forum.discussion_controls.log_in_to_reply_button")):P.a.component({icon:"fas fa-reply",className:"disabled",title:app.translator.trans("core.forum.discussion_controls.cannot_reply_text")},app.translator.trans("core.forum.discussion_controls.cannot_reply_button"))),i},moderationControls:function(t){var e=new p.a;return t.canRename()&&e.add("rename",P.a.component({icon:"fas fa-pencil-alt",onclick:this.renameAction.bind(t)},app.translator.trans("core.forum.discussion_controls.rename_button"))),e},destructiveControls:function(t){var e=new p.a;return t.isHidden()?(t.canHide()&&e.add("restore",P.a.component({icon:"fas fa-reply",onclick:this.restoreAction.bind(t)},app.translator.trans("core.forum.discussion_controls.restore_button"))),t.canDelete()&&e.add("delete",P.a.component({icon:"fas fa-times",onclick:this.deleteAction.bind(t)},app.translator.trans("core.forum.discussion_controls.delete_forever_button")))):t.canHide()&&e.add("hide",P.a.component({icon:"far fa-trash-alt",onclick:this.hideAction.bind(t)},app.translator.trans("core.forum.discussion_controls.delete_button"))),e},replyAction:function(t,e){var n=this;return new Promise((function(i,r){return app.session.user?n.canReply()?(app.composer.composingReplyTo(n)&&!e||app.composer.load(I,{user:app.session.user,discussion:n}),app.composer.show(),t&&app.viewingDiscussion(n)&&!app.composer.isFullScreen()&&app.current.get("stream").goToNumber("reply"),i(app.composer)):r():(app.modal.show(U),r())}))},hideAction:function(){return this.pushAttributes({hiddenAt:new Date,hiddenUser:app.session.user}),this.save({isHidden:!0})},restoreAction:function(){return this.pushAttributes({hiddenAt:null,hiddenUser:null}),this.save({isHidden:!1})},deleteAction:function(){var t=this;if(confirm(Object(D.a)(app.translator.trans("core.forum.discussion_controls.delete_confirmation"))))return app.viewingDiscussion(this)&&app.history.back(),this.delete().then((function(){return app.discussions.removeDiscussion(t)}))},renameAction:function(){return app.modal.show(q,{currentTitle:this.title(),discussion:this})}};function W(t){var e,n,i,r,o=$(t),s=!1,a=!1,c=0,u=function(t,e){void 0===e&&(e={}),e.duration=e.duration||"fast",e.step=function(t){$(this).css("transform","translate("+t+"px, 0)")},o.find(".Slidable-content").animate({"background-position-x":t},e)},l=function(){u(0,{complete:function(){o.removeClass("sliding"),e.hide(),n.hide(),a=!1}})};return o.find(".Slidable-content").on("touchstart",(function(t){e=o.find(".Slidable-underneath--left:not(.disabled)"),n=o.find(".Slidable-underneath--right:not(.disabled)"),i=t.originalEvent.targetTouches[0].clientX,r=t.originalEvent.targetTouches[0].clientY,s=!0,c=0})).on("touchmove",(function(t){var u=t.originalEvent.targetTouches[0].clientX,l=t.originalEvent.targetTouches[0].clientY;if(s&&Math.abs(u-i)>Math.abs(l-r)&&(a=!0),s=!1,a){c=u-i;var d=function(t,e){if(t.length){var n="left"===e?c>0:c<0;n&&t.hasClass("Slidable-underneath--elastic")&&(c-=.5*c),t.toggle(n);var i=Math.max(0,Math.min(1,(Math.abs(c)-25)/50));t.find(".icon").css("transform","scale("+i+")")}else c=Math["left"===e?"min":"max"](0,c)};d(e,"left"),d(n,"right"),$(this).css("transform","translate("+c+"px, 0)"),$(this).css("background-position-x",c+"px"),o.toggleClass("sliding",!!c),t.preventDefault()}})).on("touchend",(function(){var t=function(t){t.click(),t.hasClass("Slidable-underneath--elastic")?l():u((c>0?1:-1)*o.width())};n.length&&c<-50?t(n):e.length&&c>50?t(e):l(),s=!1,a=!1})),{reset:l}}var V=n(16),Y=n(24);var K=function(t,e){for(var n=-1,i=null==t?0:t.length,r=Array(i);++n<i;)r[n]=e(t[n],n,t);return r},G=n(79),X=n(87),J=n(45);var Q=function(t){return"symbol"==typeof t||Object(J.a)(t)&&"[object Symbol]"==Object(X.a)(t)},Z=Y.a?Y.a.prototype:void 0,tt=Z?Z.toString:void 0;var et=function t(e){if("string"==typeof e)return e;if(Object(G.a)(e))return K(e,t)+"";if(Q(e))return tt?tt.call(e):"";var n=e+"";return"0"==n&&1/e==-1/0?"-0":n};var nt=function(t){return null==t?"":et(t)},it=/[\\^$.*+?()[\]{}|]/g,rt=RegExp(it.source);var ot=function(t){return(t=nt(t))&&rt.test(t)?t.replace(it,"\\$&"):t},st=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){var n=this;t.prototype.oninit.call(this,e),this.subtree=new k.a((function(){return n.attrs.discussion.freshness}),(function(){var t=app.session.user&&app.session.user.markedAllAsReadAt();return t&&t.getTime()}),(function(){return n.active()}))},n.elementAttrs=function(){return{className:Object(V.a)(["DiscussionListItem",this.active()?"active":"",this.attrs.discussion.isHidden()?"DiscussionListItem--hidden":"","ontouchstart"in window?"Slidable":""])}},n.view=function(){var t=this.attrs.discussion,e=t.user(),n=t.isUnread(),i=t.isRead(),r=!this.showRepliesCount()&&n,o=0,s=z.controls(t,this).toArray(),a=this.elementAttrs();if(this.attrs.params.q){var c=t.mostRelevantPost();c&&(o=c.number());var u=ot(this.attrs.params.q);this.highlightRegExp=new RegExp(u+"|"+u.trim().replace(/\s+/g,"|"),"gi")}else o=Math.min(t.lastPostNumber(),(t.lastReadPostNumber()||0)+1);return m("div",a,s.length?C.a.component({icon:"fas fa-ellipsis-v",className:"DiscussionListItem-controls",buttonClassName:"Button Button--icon Button--flat Slidable-underneath Slidable-underneath--right"},s):"",m("span",{className:"Slidable-underneath Slidable-underneath--left Slidable-underneath--elastic"+(n?"":" disabled"),onclick:this.markAsRead.bind(this)},Object(w.a)("fas fa-check")),m("div",{className:"DiscussionListItem-content Slidable-content"+(n?" unread":"")+(i?" read":"")},m(g.a,{href:e?app.route.user(e):"#",className:"DiscussionListItem-author",title:Object(D.a)(app.translator.trans("core.forum.discussion_list.started_text",{user:e,ago:Object(x.a)(t.createdAt())})),oncreate:function(t){$(t.dom).tooltip({placement:"right"})}},Object(b.a)(e,{title:""})),m("ul",{className:"DiscussionListItem-badges badges"},Object(f.a)(t.badges().toArray())),m(g.a,{href:app.route.discussion(t,o),className:"DiscussionListItem-main"},m("h3",{className:"DiscussionListItem-title"},Object(y.a)(t.title(),this.highlightRegExp)),m("ul",{className:"DiscussionListItem-info"},Object(f.a)(this.infoItems().toArray()))),m("span",{tabindex:"0",role:"button",className:"DiscussionListItem-count",onclick:this.markAsRead.bind(this),title:r?app.translator.trans("core.forum.discussion_list.mark_as_read_tooltip"):""},Object(N.a)(t[r?"unreadCount":"replyCount"]()))))},n.oncreate=function(e){if(t.prototype.oncreate.call(this,e),"ontouchstart"in window){var n=W(this.$());this.$(".DiscussionListItem-controls").on("hidden.bs.dropdown",(function(){return n.reset()}))}},n.onbeforeupdate=function(e,n){return t.prototype.onbeforeupdate.call(this,e,n),this.subtree.needsRebuild()},n.active=function(){return app.current.matches(Mt,{discussion:this.attrs.discussion})},n.showFirstPost=function(){return-1!==["newest","oldest"].indexOf(this.attrs.params.sort)},n.showRepliesCount=function(){return"replies"===this.attrs.params.sort},n.markAsRead=function(){var t=this.attrs.discussion;t.isUnread()&&(t.save({lastReadPostNumber:t.lastPostNumber()}),m.redraw())},n.infoItems=function(){var t=new p.a;if(this.attrs.params.q){var e=this.attrs.discussion.mostRelevantPost()||this.attrs.discussion.firstPost();if(e&&"comment"===e.contentType()){var n=Object(y.a)(e.contentPlain(),this.highlightRegExp,175);t.add("excerpt",n,-100)}}else t.add("terminalPost",T.component({discussion:this.attrs.discussion,lastPost:!this.showFirstPost()}));return t},e}(h.a),at=n(54),ct=function(t){function e(){return t.apply(this,arguments)||this}return Object(o.a)(e,t),e.prototype.view=function(){var t,e=this.attrs.state,n=e.getParams();if(e.isLoading()?t=j.a.component():e.moreResults&&(t=P.a.component({className:"Button",onclick:e.loadMore.bind(e)},app.translator.trans("core.forum.discussion_list.load_more_button"))),e.empty()){var i=app.translator.trans("core.forum.discussion_list.empty_text");return m("div",{className:"DiscussionList"},at.a.component({text:i}))}return m("div",{className:"DiscussionList"+(e.isSearchResults()?" DiscussionList--searchResults":"")},m("ul",{className:"DiscussionList-discussions"},e.discussions.map((function(t){return m("li",{key:t.id(),"data-id":t.id()},st.component({discussion:t,params:n}))}))),m("div",{className:"DiscussionList-loadMore"},t))},e}(h.a),ut=function(t){t.pageX<10&&app.pane.show()},lt=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.view=function(){if(this.attrs.state.hasDiscussions())return m("div",{className:"DiscussionPage-list"},this.enoughSpace()&&m(ct,{state:this.attrs.state}))},n.oncreate=function(e){t.prototype.oncreate.call(this,e);var n=$(e.dom),i=app.pane;if(n.hover(i.show.bind(i),i.onmouseleave.bind(i)),$(document).on("mousemove",ut),app.previous.matches(Mt)){var r=app.cache.discussionListPaneScrollTop||0;n.scrollTop(r)}else{var o=n.find(".DiscussionListItem.active");if(o.length){var s=n.offset().top,a=s+n.outerHeight(),c=o.offset().top,u=c+o.outerHeight();(c<s||u>a)&&n.scrollTop(n.scrollTop()-s+c)}}},n.onremove=function(t){app.cache.discussionListPaneScrollTop=$(t.dom).scrollTop(),$(document).off("mousemove",ut)},n.enoughSpace=function(){return!$(".App-navigation").is(":visible")},e}(h.a),dt=n(36),pt=function(t){function e(){return t.apply(this,arguments)||this}return Object(o.a)(e,t),e.prototype.view=function(){return m("div",{className:"Post CommentPost LoadingPost"},m("header",{className:"Post-header"},Object(b.a)(null,{className:"PostUser-avatar"}),m("div",{className:"fakeText"})),m("div",{className:"Post-body"},m("div",{className:"fakeText"}),m("div",{className:"fakeText"}),m("div",{className:"fakeText"})))},e}(h.a),ht=n(20),ft=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t),e.initAttrs=function(t){t.className=t.className||"",t.surround=t.surround||function(t){return t()}};var n=e.prototype;return n.view=function(){return m("div",{className:this.attrs.className})},n.oncreate=function(e){var n,i=this;t.prototype.oncreate.call(this,e);var r=function(){if(i.attrs.composer.isVisible()){var t=i.attrs.composer.fields.content();n!==t&&(n=t,i.attrs.surround((function(){return s9e.TextFormatter.preview(n||"",e.dom)})))}};r(),this.updateInterval=setInterval(r,50)},n.onremove=function(){clearInterval(this.updateInterval)},e}(h.a),mt=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.view=function(){var t=this;if(app.composer.composingReplyTo(this.attrs.discussion))return m("article",{className:"Post CommentPost editing"},m("header",{className:"Post-header"},m("div",{className:"PostUser"},m("h3",null,Object(b.a)(app.session.user,{className:"PostUser-avatar"}),Object(ht.a)(app.session.user)),m("ul",{className:"PostUser-badges badges"},Object(f.a)(app.session.user.badges().toArray())))),m(ft,{className:"Post-body",composer:app.composer,surround:this.anchorPreview.bind(this)}));return m("article",{className:"Post ReplyPlaceholder",onclick:function(){z.replyAction.call(t.attrs.discussion,!0).catch((function(){}))}},m("header",{className:"Post-header"},Object(b.a)(app.session.user,{className:"PostUser-avatar"})," ",app.translator.trans("core.forum.post_stream.reply_placeholder")))},n.anchorPreview=function(t){var e=$(window).scrollTop()+$(window).height()>=$(document).height();t(),e&&$(window).scrollTop($(document).height())},e}(h.a),vt=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.discussion=this.attrs.discussion,this.stream=this.attrs.stream,this.scrollListener=new dt.a(this.onscroll.bind(this))},n.view=function(){var t,e=this,n=this.stream.viewingEnd(),i=this.stream.posts(),r=this.discussion.postIds(),o=function(t){$(t.dom).addClass("fadeIn"),setTimeout((function(){return $(t.dom).removeClass("fadeIn")}),500)},s=i.map((function(n,i){var s,c={"data-index":e.stream.visibleStart+i};if(n){var u=n.createdAt(),l=app.postComponents[n.contentType()];s=l?l.component({post:n}):"",c.key="post"+n.id(),c.oncreate=o,c["data-time"]=u.toISOString(),c["data-number"]=n.number(),c["data-id"]=n.id(),c["data-type"]=n.contentType();var d=u-t;d>3456e5&&(s=[m("div",{className:"PostStream-timeGap"},m("span",null,app.translator.trans("core.forum.post_stream.time_lapsed_text",{period:dayjs().add(d,"ms").fromNow(!0)}))),s]),t=u}else c.key="post"+r[e.stream.visibleStart+i],s=pt.component();return m("div",Object(a.a)({className:"PostStream-item"},c),s)}));return!n&&i[this.stream.visibleEnd-this.stream.visibleStart-1]&&s.push(m("div",{className:"PostStream-loadMore",key:"loadMore"},m(P.a,{className:"Button",onclick:this.stream.loadNext.bind(this.stream)},app.translator.trans("core.forum.post_stream.load_more_button")))),!n||app.session.user&&!this.discussion.canReply()||s.push(m("div",{className:"PostStream-item",key:"reply","data-index":this.stream.count(),oncreate:o},mt.component({discussion:this.discussion}))),m("div",{className:"PostStream"},s)},n.onupdate=function(){this.triggerScroll()},n.oncreate=function(e){var n=this;t.prototype.oncreate.call(this,e),this.triggerScroll(),setTimeout((function(){return n.scrollListener.start()}))},n.onremove=function(){this.scrollListener.stop(),clearTimeout(this.calculatePositionTimeout)},n.triggerScroll=function(){if(this.stream.needsScroll){var t=this.stream.targetPost;this.stream.needsScroll=!1,"number"in t?this.scrollToNumber(t.number,this.stream.animateScroll):"index"in t&&this.scrollToIndex(t.index,this.stream.animateScroll,t.reply)}},n.onscroll=function(t){void 0===t&&(t=window.pageYOffset),this.stream.paused||this.stream.pagesLoading||(this.updateScrubber(t),this.loadPostsIfNeeded(t),clearTimeout(this.calculatePositionTimeout),this.calculatePositionTimeout=setTimeout(this.calculatePosition.bind(this,t),100))},n.loadPostsIfNeeded=function(t){void 0===t&&(t=window.pageYOffset);var e=this.getMarginTop(),n=$(window).height()-e,i=t+e;if(this.stream.visibleStart>0){var r=this.$(".PostStream-item[data-index="+this.stream.visibleStart+"]");r.length&&r.offset().top>i-300&&this.stream.loadPrevious()}if(this.stream.visibleEnd<this.stream.count()){var o=this.$(".PostStream-item[data-index="+(this.stream.visibleEnd-1)+"]");o.length&&o.offset().top+o.outerHeight(!0)<i+n+300&&this.stream.loadNext()}},n.updateScrubber=function(t){void 0===t&&(t=window.pageYOffset);var e=this.getMarginTop(),n=$(window).height()-e,i=t+e,r=this.$(".PostStream-item[data-index]"),o=0,s="",a=null;r.each((function(){var t=$(this),e=t.offset().top,r=t.outerHeight(!0);if(e+r<i)return!0;if(e>i+n)return!1;var c=Math.max(0,i-e),u=Math.min(r,i+n-e)-c;null===a&&(a=parseFloat(t.data("index"))+c/r),u>0&&(o+=u/r);var l=t.data("time");l&&(s=l)})),this.stream.index=null!==a?a+1:this.stream.count(),this.stream.visible=o,s&&(this.stream.description=dayjs(s).format("MMMM YYYY"))},n.calculatePosition=function(t){void 0===t&&(t=window.pageYOffset);var e,n,i=this.getMarginTop(),r=$(window),o=r.height()-i,s=r.scrollTop()+i,a=t+i;this.$(".PostStream-item").each((function(){var t=$(this),i=t.offset().top,r=t.outerHeight(!0),c=Math.max(0,a-i);if(void 0===e&&(c/r<.75||(r-c)/o>.25)&&(e=t.data("number")),i+r>s){if(!(i+r<s+o))return!1;t.data("number")&&(n=t.data("number"))}})),e&&this.attrs.onPositionChange(e||1,n,e)},n.getMarginTop=function(){var t="phone"===app.screen()?"#app-navigation":"#header";return this.$()&&$(t).outerHeight()+parseInt(this.$().css("margin-top"),10)},n.scrollToNumber=function(t,e){var n=this.$(".PostStream-item[data-number="+t+"]");return this.scrollToItem(n,e).then(this.flashItem.bind(this,n))},n.scrollToIndex=function(t,e,n){var i=n?$(".PostStream-item:last-child"):this.$(".PostStream-item[data-index="+t+"]");this.scrollToItem(i,e,!0,n),n&&this.flashItem(i)},n.scrollToItem=function(t,e,n,i){var r=this,o=$("html, body").stop(!0),s=t.data("index");if(t.length){var a=t.offset().top-this.getMarginTop(),c=t.offset().top+t.height(),u=$(document).scrollTop(),l=u+$(window).height();if(n||a<u||c>l){var d=i?c-$(window).height()+app.composer.computedHeight():t.is(":first-child")?0:a;e?d!==u&&o.animate({scrollTop:d},"fast"):o.scrollTop(d)}}var p=function(){r.updateScrubber(),void 0!==s&&(r.stream.index=s+1)};return p(),this.stream.forceUpdateScrubber=!0,Promise.all([o.promise(),this.stream.loadPromise]).then((function(){var t;if(m.redraw.sync(),i){var e=$(".PostStream-item:last-child");$(window).scrollTop(e.offset().top+e.height()-$(window).height()+app.composer.computedHeight())}else 0===s?$(window).scrollTop(0):(t=$(".PostStream-item[data-index="+s+"]").offset())&&$(window).scrollTop(t.top-r.getMarginTop());p(),r.calculatePosition(),r.stream.paused=!1,r.loadPostsIfNeeded()}))},n.flashItem=function(t){t.removeClass("fadeIn"),t.addClass("flash").on("animationend webkitAnimationEnd",(function(e){t.removeClass("flash")}))},e}(h.a),gt=n(72),bt=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.stream=this.attrs.stream,this.handlers={},this.scrollListener=new dt.a(this.updateScrubberValues.bind(this,{fromScroll:!0,forceHeightChange:!0}))},n.view=function(){var t=this.stream.count(),e=app.translator.transChoice("core.forum.post_scrubber.viewing_text",t,{index:m("span",{className:"Scrubber-index"}),count:m("span",{className:"Scrubber-count"},Object(gt.a)(t))}),n=this.stream.discussion.unreadCount(),i=t?Math.min(t-this.stream.index,n)/t:0;function r(t){var e=$(t.dom),n={top:100-100*i+"%",height:100*i+"%"};t.state.oldStyle?e.stop(!0).css(t.state.oldStyle).animate(n):e.css(n),t.state.oldStyle=n}var o=["PostStreamScrubber","Dropdown"];return this.attrs.className&&o.push(this.attrs.className),m("div",{className:o.join(" ")},m("button",{className:"Button Dropdown-toggle","data-toggle":"dropdown"},e," ",Object(w.a)("fas fa-sort")),m("div",{className:"Dropdown-menu dropdown-menu"},m("div",{className:"Scrubber"},m("a",{className:"Scrubber-first",onclick:this.goToFirst.bind(this)},Object(w.a)("fas fa-angle-double-up")," ",app.translator.trans("core.forum.post_scrubber.original_post_link")),m("div",{className:"Scrubber-scrollbar"},m("div",{className:"Scrubber-before"}),m("div",{className:"Scrubber-handle"},m("div",{className:"Scrubber-bar"}),m("div",{className:"Scrubber-info"},m("strong",null,e),m("span",{className:"Scrubber-description"}))),m("div",{className:"Scrubber-after"}),m("div",{className:"Scrubber-unread",oncreate:r,onupdate:r},app.translator.trans("core.forum.post_scrubber.unread_text",{count:n}))),m("a",{className:"Scrubber-last",onclick:this.goToLast.bind(this)},Object(w.a)("fas fa-angle-double-down")," ",app.translator.trans("core.forum.post_scrubber.now_link")))))},n.onupdate=function(){var t=this;this.stream.forceUpdateScrubber&&(this.stream.forceUpdateScrubber=!1,this.stream.loadPromise.then((function(){return t.updateScrubberValues({animate:!0,forceHeightChange:!0})})))},n.oncreate=function(e){var n=this;t.prototype.oncreate.call(this,e),$(window).on("resize",this.handlers.onresize=this.onresize.bind(this)).resize(),this.$(".Scrubber-scrollbar").bind("click",this.onclick.bind(this)).css({cursor:"pointer","user-select":"none"}).bind("dragstart mousedown touchstart",(function(t){return t.preventDefault()})),this.dragging=!1,this.mouseStart=0,this.indexStart=0,this.$(".Scrubber-handle").css("cursor","move").bind("mousedown touchstart",this.onmousedown.bind(this)).click((function(t){return t.stopPropagation()})),$(document).on("mousemove touchmove",this.handlers.onmousemove=this.onmousemove.bind(this)).on("mouseup touchend",this.handlers.onmouseup=this.onmouseup.bind(this)),setTimeout((function(){return n.scrollListener.start()})),this.stream.loadPromise.then((function(){return n.updateScrubberValues({animate:!1,forceHeightChange:!0})}))},n.onremove=function(){this.scrollListener.stop(),$(window).off("resize",this.handlers.onresize),$(document).off("mousemove touchmove",this.handlers.onmousemove).off("mouseup touchend",this.handlers.onmouseup)},n.updateScrubberValues=function(t){var e=this;void 0===t&&(t={});var n=this.stream.index,i=this.stream.count(),r=this.stream.visible||1,o=this.percentPerPost(),s=this.$();s.find(".Scrubber-index").text(Object(gt.a)(this.stream.sanitizeIndex(Math.max(1,n)))),s.find(".Scrubber-description").text(this.stream.description),s.toggleClass("disabled",this.stream.disabled());var a={};if(a.before=Math.max(0,o.index*Math.min(n-1,i-r)),a.handle=Math.min(100-a.before,o.visible*r),a.after=100-a.before-a.handle,!(t.fromScroll&&this.stream.paused||this.adjustingHeight&&!t.forceHeightChange)){var c=t.animate?"animate":"css";this.adjustingHeight=!0;var u=[];for(var l in a){var d=s.find(".Scrubber-"+l);u.push(d.stop(!0,!0)[c]({height:a[l]+"%"},"fast").promise()),"animate"===c&&d.css("overflow","visible")}Promise.all(u).then((function(){return e.adjustingHeight=!1}))}},n.goToFirst=function(){this.stream.goToFirst(),this.updateScrubberValues({animate:!0,forceHeightChange:!0})},n.goToLast=function(){this.stream.goToLast(),this.updateScrubberValues({animate:!0,forceHeightChange:!0})},n.onresize=function(){var t=this.$(),e=this.$(".Scrubber-scrollbar");e.css("max-height",$(window).height()-t.offset().top+$(window).scrollTop()-parseInt($("#app").css("padding-bottom"),10)-(t.outerHeight()-e.outerHeight()))},n.onmousedown=function(t){t.redraw=!1,this.mouseStart=t.clientY||t.originalEvent.touches[0].clientY,this.indexStart=this.stream.index,this.dragging=!0,$("body").css("cursor","move"),this.$().toggleClass("dragging",this.dragging)},n.onmousemove=function(t){if(this.dragging){var e=((t.clientY||t.originalEvent.touches[0].clientY)-this.mouseStart)/this.$(".Scrubber-scrollbar").outerHeight()*100/this.percentPerPost().index||0,n=Math.min(this.indexStart+e,this.stream.count()-1);this.stream.index=Math.max(0,n),this.updateScrubberValues()}},n.onmouseup=function(){if(this.$().toggleClass("dragging",this.dragging),this.dragging){this.mouseStart=0,this.indexStart=0,this.dragging=!1,$("body").css("cursor",""),this.$().removeClass("open");var t=Math.floor(this.stream.index);this.stream.goToIndex(t)}},n.onclick=function(t){var e=this.$(".Scrubber-scrollbar"),n=((t.pageY||t.originalEvent.touches[0].pageY)-e.offset().top+$("body").scrollTop())/e.outerHeight()*100,i=(n-=parseFloat(e.find(".Scrubber-handle")[0].style.height)/2)/this.percentPerPost().index;i=Math.max(0,Math.min(this.stream.count()-1,i)),this.stream.goToIndex(Math.floor(i)),this.updateScrubberValues({animate:!0,forceHeightChange:!0}),this.$().removeClass("open")},n.percentPerPost=function(){var t=this.stream.count()||1,e=this.stream.visible||1,n=50/this.$(".Scrubber-scrollbar").outerHeight()*100,i=Math.max(100/t,n/e),r=t===e?0:(100-i*e)/(t-e);return{index:r,visible:i}},e}(h.a),yt=n(80);var wt=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},xt=n(78),Nt=function(){return xt.a.Date.now()},Ct=/^\s+|\s+$/g,Ot=/^[-+]0x[0-9a-f]+$/i,Tt=/^0b[01]+$/i,kt=/^0o[0-7]+$/i,jt=parseInt;var St=function(t){if("number"==typeof t)return t;if(Q(t))return NaN;if(wt(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=wt(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(Ct,"");var n=Tt.test(t);return n||kt.test(t)?jt(t.slice(2),n?2:8):Ot.test(t)?NaN:+t},At=Math.max,Et=Math.min;var Pt=function(t,e,n){var i,r,o,s,a,c,u=0,l=!1,d=!1,p=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function h(e){var n=i,o=r;return i=r=void 0,u=e,s=t.apply(o,n)}function f(t){return u=t,a=setTimeout(v,e),l?h(t):s}function m(t){var n=t-c;return void 0===c||n>=e||n<0||d&&t-u>=o}function v(){var t=Nt();if(m(t))return g(t);a=setTimeout(v,function(t){var n=e-(t-c);return d?Et(n,o-(t-u)):n}(t))}function g(t){return a=void 0,p&&i?h(t):(i=r=void 0,s)}function b(){var t=Nt(),n=m(t);if(i=arguments,r=this,c=t,n){if(void 0===a)return f(c);if(d)return clearTimeout(a),a=setTimeout(v,e),h(c)}return void 0===a&&(a=setTimeout(v,e)),s}return e=St(e)||0,wt(n)&&(l=!!n.leading,o=(d="maxWait"in n)?At(St(n.maxWait)||0,e):o,p="trailing"in n?!!n.trailing:p),b.cancel=function(){void 0!==a&&clearTimeout(a),u=0,i=c=r=a=void 0},b.flush=function(){return void 0===a?s:g(Nt())},b};var Dt=function(t,e,n){var i=!0,r=!0;if("function"!=typeof t)throw new TypeError("Expected a function");return wt(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),Pt(t,e,{leading:i,maxWait:e,trailing:r})},$t=n(81),_t=function(){function t(t,e){void 0===e&&(e=[]),this.discussion=t,this.paused=!1,this.loadPageTimeouts={},this.pagesLoading=0,this.index=0,this.number=1,this.visible=1,this.description="",this.forceUpdateScrubber=!1,this.loadNext=Dt(this._loadNext,300),this.loadPrevious=Dt(this._loadPrevious,300),this.show(e)}var e=t.prototype;return e.update=function(){return this.viewingEnd()?(this.visibleEnd=this.count(),this.loadRange(this.visibleStart,this.visibleEnd)):Promise.resolve()},e.goToFirst=function(){return this.goToIndex(0)},e.goToLast=function(){return this.goToIndex(this.count()-1,!0)},e.goToNumber=function(t,e){if(void 0===e&&(e=!1),"reply"===t){var n=this.goToLast();return this.targetPost.reply=!0,n}return this.paused=!0,this.loadPromise=this.loadNearNumber(t),this.needsScroll=!0,this.targetPost={number:t},this.animateScroll=!e,this.number=t,this.loadPromise.then((function(){return m.redraw()}))},e.goToIndex=function(t,e){return void 0===e&&(e=!1),this.paused=!0,this.loadPromise=this.loadNearIndex(t),this.needsScroll=!0,this.targetPost={index:t},this.animateScroll=!e,this.index=t,m.redraw(),this.loadPromise},e.loadNearNumber=function(t){return this.posts().some((function(e){return e&&Number(e.number())===Number(t)}))?Promise.resolve():(this.reset(),app.store.find("posts",{filter:{discussion:this.discussion.id()},page:{near:t}}).then(this.show.bind(this)))},e.loadNearIndex=function(t){if(t>=this.visibleStart&&t<this.visibleEnd)return Promise.resolve();var e=this.sanitizeIndex(t-this.constructor.loadCount/2),n=e+this.constructor.loadCount;return this.reset(e,n),this.loadRange(e,n).then(this.show.bind(this))},e._loadNext=function(){var t=this.visibleEnd,e=this.visibleEnd=this.sanitizeIndex(this.visibleEnd+this.constructor.loadCount),n=t-2*this.constructor.loadCount;n>this.visibleStart&&n>=0&&(this.visibleStart=n+this.constructor.loadCount+1,this.loadPageTimeouts[n]&&(clearTimeout(this.loadPageTimeouts[n]),this.loadPageTimeouts[n]=null,this.pagesLoading--)),this.loadPage(t,e)},e._loadPrevious=function(){var t=this.visibleStart,e=this.visibleStart=this.sanitizeIndex(this.visibleStart-this.constructor.loadCount),n=e+2*this.constructor.loadCount;n<this.visibleEnd&&n<=this.count()&&(this.visibleEnd=n,this.loadPageTimeouts[n]&&(clearTimeout(this.loadPageTimeouts[n]),this.loadPageTimeouts[n]=null,this.pagesLoading--)),this.loadPage(e,t,!0)},e.loadPage=function(t,e,n){var i=this;void 0===n&&(n=!1),this.pagesLoading++;var r=function(){if(!(t<i.visibleStart||e>i.visibleEnd)){var r=n?i.visibleEnd-1:i.visibleStart;Object($t.a)('.PostStream-item[data-index="'+r+'"]',m.redraw.sync)}};r(),this.loadPageTimeouts[t]=setTimeout((function(){i.loadRange(t,e).then((function(){r(),i.pagesLoading--})),i.loadPageTimeouts[t]=null}),this.pagesLoading-1?1e3:0)},e.loadRange=function(t,e){var n=[],i=[];return this.discussion.postIds().slice(t,e).forEach((function(t){var e=app.store.getById("posts",t);e&&e.discussion()&&void 0!==e.canEdit()?i.push(e):n.push(t)})),n.length?app.store.find("posts",n).then((function(t){return i.concat(t).sort((function(t,e){return t.createdAt()-e.createdAt()}))})):Promise.resolve(i)},e.show=function(t){this.visibleStart=t.length?this.discussion.postIds().indexOf(t[0].id()):0,this.visibleEnd=this.sanitizeIndex(this.visibleStart+t.length)},e.reset=function(t,e){this.visibleStart=t||0,this.visibleEnd=this.sanitizeIndex(e||this.constructor.loadCount)},e.posts=function(){return this.discussion.postIds().slice(this.visibleStart,this.visibleEnd).map((function(t){var e=app.store.getById("posts",t);return e&&e.discussion()&&void 0!==e.canEdit()?e:null}))},e.count=function(){return this.discussion.postIds().length},e.disabled=function(){return this.visible>=this.count()},e.viewingEnd=function(){return Math.abs(this.count()-this.visibleEnd)<=1},e.sanitizeIndex=function(t){return Math.max(0,Math.min(this.count(),Math.floor(t)))},t}();_t.loadCount=20;var It=_t,Mt=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.useBrowserScrollRestoration=!1,this.discussion=null,this.near=m.route.param("near")||0,this.load(),app.discussions.hasDiscussions()&&(app.pane.enable(),app.pane.hide()),app.history.push("discussion"),this.bodyClass="App--discussion"},n.onremove=function(){t.prototype.onremove.call(this),app.pane.disable(),app.composer.composingReplyTo(this.discussion)&&!app.composer.fields.content()?app.composer.hide():app.composer.minimize()},n.view=function(){var t=this.discussion;return m("div",{className:"DiscussionPage"},m(lt,{state:app.discussions}),m("div",{className:"DiscussionPage-discussion"},t?[v.component({discussion:t}),m("div",{className:"container"},m("nav",{className:"DiscussionPage-nav"},m("ul",null,Object(f.a)(this.sidebarItems().toArray()))),m("div",{className:"DiscussionPage-stream"},vt.component({discussion:t,stream:this.stream,onPositionChange:this.positionChanged.bind(this)})))]:j.a.component({className:"LoadingIndicator--block"})))},n.load=function(){var t=app.preloadedApiDocument();if(t)setTimeout(this.show.bind(this,t),0);else{var e=this.requestParams();app.store.find("discussions",m.route.param("id"),e).then(this.show.bind(this))}m.redraw()},n.requestParams=function(){return{bySlug:!0,page:{near:this.near}}},n.show=function(t){var e=this;app.history.push("discussion",t.title()),app.setTitle(t.title()),app.setTitleCount(0);var n=[];if(t.payload&&t.payload.included){var i=t.id();n=t.payload.included.filter((function(t){return"posts"===t.type&&t.relationships&&t.relationships.discussion&&t.relationships.discussion.data.id===i})).map((function(t){return app.store.getById("posts",t.id)})).sort((function(t,e){return t.createdAt()-e.createdAt()})).slice(0,20)}this.stream=new It(t,n),this.stream.goToNumber(m.route.param("near")||n[0]&&n[0].number(),!0).then((function(){e.discussion=t,app.current.set("discussion",t),app.current.set("stream",e.stream)}))},n.sidebarItems=function(){var t=new p.a;return t.add("controls",yt.a.component({icon:"fas fa-ellipsis-v",className:"App-primaryControl",buttonClassName:"Button--primary"},z.controls(this.discussion,this).toArray())),t.add("scrubber",bt.component({stream:this.stream,className:"App-titleControl"}),-100),t},n.positionChanged=function(t,e){var n=this.discussion,i=app.route.discussion(n,this.near=t);window.history.replaceState(null,document.title,i),app.history.push("discussion",n.title()),app.session.user&&e>(n.lastReadPostNumber()||0)&&(n.save({lastReadPostNumber:e}),m.redraw())},e}(d.a),Lt=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.view=function(){return m("ul",{className:"Header-controls"},Object(f.a)(this.items().toArray()))},n.items=function(){return new p.a},e}(h.a),Rt=n(15),Bt=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t),e.initAttrs=function(e){t.initAttrs.call(this,e),e.className="SessionDropdown",e.buttonClassName="Button Button--user Button--flat",e.menuClassName="Dropdown-menu--right"};var n=e.prototype;return n.view=function(e){return t.prototype.view.call(this,Object(a.a)({},e,{children:this.items().toArray()}))},n.getButtonContent=function(){var t=app.session.user;return[Object(b.a)(t)," ",m("span",{className:"Button-label"},Object(ht.a)(t))]},n.items=function(){var t=new p.a,e=app.session.user;return t.add("profile",Rt.a.component({icon:"fas fa-user",href:app.route.user(e)},app.translator.trans("core.forum.header.profile_button")),100),t.add("settings",Rt.a.component({icon:"fas fa-cog",href:app.route("settings")},app.translator.trans("core.forum.header.settings_button")),50),app.forum.attribute("adminUrl")&&t.add("administration",Rt.a.component({icon:"fas fa-wrench",href:app.forum.attribute("adminUrl"),target:"_blank"},app.translator.trans("core.forum.header.admin_button")),0),t.add("separator",F.a.component(),-90),t.add("logOut",P.a.component({icon:"fas fa-sign-out-alt",onclick:app.session.logout.bind(app.session)},app.translator.trans("core.forum.header.log_out_button")),-100),t},e}(C.a),Ht=n(33),Ut=n(46),Ft=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.view=function(){var t=this.attrs.state,e=t.getNotificationPages();return m("div",{className:"NotificationList"},m("div",{className:"NotificationList-header"},m("div",{className:"App-primaryControl"},P.a.component({className:"Button Button--icon Button--link",icon:"fas fa-check",title:app.translator.trans("core.forum.notifications.mark_all_as_read_tooltip"),onclick:t.markAllAsRead.bind(t)})),m("h4",{className:"App-titleControl App-titleControl--text"},app.translator.trans("core.forum.notifications.title"))),m("div",{className:"NotificationList-content"},e.length?e.map((function(t){var e=[],n={};return t.forEach((function(t){var i=t.subject();if(void 0!==i){var r=!1;i instanceof Ut.a?r=i:i&&i.discussion&&(r=i.discussion());var o=r?r.id():0;n[o]=n[o]||{discussion:r,notifications:[]},n[o].notifications.push(t),-1===e.indexOf(n[o])&&e.push(n[o])}})),e.map((function(t){var e=t.discussion&&t.discussion.badges().toArray();return m("div",{className:"NotificationGroup"},t.discussion?m(g.a,{className:"NotificationGroup-header",href:app.route.discussion(t.discussion)},e&&e.length?m("ul",{className:"NotificationGroup-badges badges"},Object(f.a)(e)):"",t.discussion.title()):m("div",{className:"NotificationGroup-header"},app.forum.attribute("title")),m("ul",{className:"NotificationGroup-content"},t.notifications.map((function(t){var e=app.notificationComponents[t.contentType()];return e?m("li",null,e.component({notification:t})):""}))))}))})):"",t.isLoading()?m(j.a,{className:"LoadingIndicator--block"}):e.length?"":m("div",{className:"NotificationList-empty"},app.translator.trans("core.forum.notifications.empty_text"))))},n.oncreate=function(e){t.prototype.oncreate.call(this,e),this.$notifications=this.$(".NotificationList-content"),this.$scrollParent=this.inPanel()?this.$notifications:$(window),this.boundScrollHandler=this.scrollHandler.bind(this),this.$scrollParent.on("scroll",this.boundScrollHandler)},n.onremove=function(){this.$scrollParent.off("scroll",this.boundScrollHandler)},n.scrollHandler=function(){var t=this.attrs.state,e=this.inPanel()?this.$scrollParent[0]:document.documentElement,n=Math.abs(e.scrollHeight-e.scrollTop-e.clientHeight)<=1;t.hasMoreResults()&&!t.isLoading()&&n&&t.loadMore()},n.inPanel=function(){return"auto"===this.$notifications.css("overflow")},e}(h.a),qt=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t),e.initAttrs=function(e){e.className=e.className||"NotificationsDropdown",e.buttonClassName=e.buttonClassName||"Button Button--flat",e.menuClassName=e.menuClassName||"Dropdown-menu--right",e.label=e.label||app.translator.trans("core.forum.notifications.tooltip"),e.icon=e.icon||"fas fa-bell",t.initAttrs.call(this,e)};var n=e.prototype;return n.getButton=function(){var e=this.getNewCount(),n=t.prototype.getButton.call(this);return n.attrs.title=this.attrs.label,n.attrs.className+=e?" new":"",n.attrs.onclick=this.onclick.bind(this),n},n.getButtonContent=function(){var t=this.getUnreadCount();return[Object(w.a)(this.attrs.icon,{className:"Button-icon"}),t?m("span",{className:"NotificationsDropdown-unread"},t):"",m("span",{className:"Button-label"},this.attrs.label)]},n.getMenu=function(){return m("div",{className:"Dropdown-menu "+this.attrs.menuClassName,onclick:this.menuClick.bind(this)},this.showing?Ft.component({state:this.attrs.state}):"")},n.onclick=function(){app.drawer.isOpen()?this.goToRoute():this.attrs.state.load()},n.goToRoute=function(){m.route.set(app.route("notifications"))},n.getUnreadCount=function(){return app.session.user.unreadNotificationCount()},n.getNewCount=function(){return app.session.user.newNotificationCount()},n.menuClick=function(t){(t.shiftKey||t.metaKey||t.ctrlKey||2===t.which)&&t.stopPropagation()},e}(C.a),zt=function(){function t(){this.callbacks={},this.whenCallback=function(t){return!0}}var e=t.prototype;return e.onUp=function(t){return this.callbacks[38]=function(e){e.preventDefault(),t(e)},this},e.onDown=function(t){return this.callbacks[40]=function(e){e.preventDefault(),t(e)},this},e.onSelect=function(t){return this.callbacks[9]=this.callbacks[13]=function(e){e.preventDefault(),t(e)},this},e.onCancel=function(t){return this.callbacks[27]=function(e){e.stopPropagation(),e.preventDefault(),t(e)},this},e.onRemove=function(t){return this.callbacks[8]=function(e){0===e.target.selectionStart&&0===e.target.selectionEnd&&(t(e),e.preventDefault())},this},e.when=function(t){return this.whenCallback=t,this},e.bindTo=function(t){t.on("keydown",this.navigate.bind(this))},e.navigate=function(t){if(this.whenCallback(t)){var e=this.callbacks[t.which];e&&e(t)}},t}(),Wt=function(){function t(){this.results={}}var e=t.prototype;return e.search=function(t){var e=this;t=t.toLowerCase(),this.results[t]=[];var n={filter:{q:t},page:{limit:3},include:"mostRelevantPost"};return app.store.find("discussions",n).then((function(n){return e.results[t]=n}))},e.view=function(t){t=t.toLowerCase();var e=this.results[t]||[];return[m("li",{className:"Dropdown-header"},app.translator.trans("core.forum.search.discussions_heading")),m("li",null,Rt.a.component({icon:"fas fa-search",href:app.route("index",{q:t})},app.translator.trans("core.forum.search.all_discussions_button",{query:t}))),e.map((function(e){var n=e.mostRelevantPost();return m("li",{className:"DiscussionSearchResult","data-index":"discussions"+e.id()},m(g.a,{href:app.route.discussion(e,n&&n.number())},m("div",{className:"DiscussionSearchResult-title"},Object(y.a)(e.title(),t)),n?m("div",{className:"DiscussionSearchResult-excerpt"},Object(y.a)(n.contentPlain(),t,100)):""))}))]},t}(),Vt=function(){function t(){this.results={}}var e=t.prototype;return e.search=function(t){var e=this;return app.store.find("users",{filter:{q:t},page:{limit:5}}).then((function(n){e.results[t]=n,m.redraw()}))},e.view=function(t){t=t.toLowerCase();var e=(this.results[t]||[]).concat(app.store.all("users").filter((function(e){return[e.username(),e.displayName()].some((function(e){return e.toLowerCase().substr(0,t.length)===t}))}))).filter((function(t,e,n){return n.lastIndexOf(t)===e})).sort((function(t,e){return t.displayName().localeCompare(e.displayName())}));return e.length?[m("li",{className:"Dropdown-header"},app.translator.trans("core.forum.search.users_heading")),e.map((function(e){var n=Object(ht.a)(e),i=[Object(y.a)(n.text,t)];return m("li",{className:"UserSearchResult","data-index":"users"+e.id()},m(g.a,{href:app.route.user(e)},Object(b.a)(e),Object(a.a)({},n,{text:void 0,children:i})))}))]:""},t}(),Yt=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.state=this.attrs.state,this.hasFocus=!1,this.sources=null,this.loadingSources=0,this.index=0},n.view=function(){var t=this,e=this.state.getInitialSearch();return this.sources||(this.sources=this.sourceItems().toArray()),this.sources.length?m("div",{className:"Search "+Object(V.a)({open:this.state.getValue()&&this.hasFocus,focused:this.hasFocus,active:!!e,loading:!!this.loadingSources})},m("div",{className:"Search-input"},m("input",{className:"FormControl",type:"search",placeholder:Object(D.a)(app.translator.trans("core.forum.header.search_placeholder")),value:this.state.getValue(),oninput:function(e){return t.state.setValue(e.target.value)},onfocus:function(){return t.hasFocus=!0},onblur:function(){return t.hasFocus=!1}}),this.loadingSources?j.a.component({size:"tiny",className:"Button Button--icon Button--link"}):e?m("button",{className:"Search-clear Button Button--icon Button--link",onclick:this.clear.bind(this)},Object(w.a)("fas fa-times-circle")):""),m("ul",{className:"Dropdown-menu Search-results"},this.state.getValue()&&this.hasFocus?this.sources.map((function(e){return e.view(t.state.getValue())})):"")):m("div",null)},n.onupdate=function(){if(this.setIndex(this.getCurrentNumericIndex()),this.sources.length){var t=window.innerHeight-this.element.querySelector(".Search-input>.FormControl").getBoundingClientRect().bottom-14;this.element.querySelector(".Search-results").style["max-height"]=t+"px"}},n.oncreate=function(n){var i=this;t.prototype.oncreate.call(this,n);var r=this,o=this.state;this.setIndex(this.getCurrentNumericIndex()),this.$(".Search-results").on("mousedown",(function(t){return t.preventDefault()})).on("click",(function(){return i.$("input").blur()})).on("mouseenter","> li:not(.Dropdown-header)",(function(){r.setIndex(r.selectableItems().index(this))}));var s=this.$("input");this.navigator=new zt,this.navigator.onUp((function(){return i.setIndex(i.getCurrentNumericIndex()-1,!0)})).onDown((function(){return i.setIndex(i.getCurrentNumericIndex()+1,!0)})).onSelect(this.selectResult.bind(this)).onCancel(this.clear.bind(this)).bindTo(s),s.on("input focus",(function(){var t=this.value.toLowerCase();t&&(clearTimeout(r.searchTimeout),r.searchTimeout=setTimeout((function(){o.isCached(t)||(t.length>=e.MIN_SEARCH_LEN&&r.sources.map((function(e){e.search&&(r.loadingSources++,e.search(t).then((function(){r.loadingSources=Math.max(0,r.loadingSources-1),m.redraw()})))})),o.cache(t),m.redraw())}),250))})).on("focus",(function(){$(this).one("mouseup",(function(t){return t.preventDefault()})).select()}))},n.selectResult=function(){clearTimeout(this.searchTimeout),this.loadingSources=0,this.state.getValue()?m.route.set(this.getItem(this.index).find("a").attr("href")):this.clear(),this.$("input").blur()},n.clear=function(){this.state.clear()},n.sourceItems=function(){var t=new p.a;return app.forum.attribute("canViewDiscussions")&&t.add("discussions",new Wt),app.forum.attribute("canViewUserList")&&t.add("users",new Vt),t},n.selectableItems=function(){return this.$(".Search-results > li:not(.Dropdown-header)")},n.getCurrentNumericIndex=function(){return this.selectableItems().index(this.getItem(this.index))},n.getItem=function(t){var e=this.selectableItems(),n=e.filter('[data-index="'+t+'"]');return n.length||(n=e.eq(t)),n},n.setIndex=function(t,e){var n=this.selectableItems(),i=n.parent(),r=t;t<0?r=n.length-1:t>=n.length&&(r=0);var o=n.removeClass("active").eq(r).addClass("active");if(this.index=o.attr("data-index")||r,e){var s,a=i.scrollTop(),c=i.offset().top,u=c+i.outerHeight(),l=o.offset().top,d=l+o.outerHeight();l<c?s=a-c+l-parseInt(i.css("padding-top"),10):d>u&&(s=a-u+d+parseInt(i.css("padding-bottom"),10)),void 0!==s&&i.stop(!0).animate({scrollTop:s},100)}},e}(h.a);Object(s.a)(Yt,"MIN_SEARCH_LEN",3);var Kt=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.view=function(){return m("ul",{className:"Header-controls"},Object(f.a)(this.items().toArray()))},n.items=function(){var t=new p.a;if(t.add("search",Yt.component({state:app.search}),30),app.forum.attribute("showLanguageSelector")&&Object.keys(app.data.locales).length>1){var e=[],n=function(t){e.push(P.a.component({active:app.data.locale===t,icon:app.data.locale!==t||"fas fa-check",onclick:function(){app.session.user?app.session.user.savePreferences({locale:t}).then((function(){return window.location.reload()})):(document.cookie="locale="+t+"; path=/; expires=Tue, 19 Jan 2038 03:14:07 GMT",window.location.reload())}},app.data.locales[t]))};for(var i in app.data.locales)n(i);t.add("locale",Ht.a.component({buttonClassName:"Button Button--link"},e),20)}return app.session.user?(t.add("notifications",qt.component({state:app.notifications}),10),t.add("session",Bt.component(),0)):(app.forum.attribute("allowSignUp")&&t.add("signUp",P.a.component({className:"Button Button--link",onclick:function(){return app.modal.show(H)}},app.translator.trans("core.forum.header.sign_up_link")),10),t.add("logIn",P.a.component({className:"Button Button--link",onclick:function(){return app.modal.show(U)}},app.translator.trans("core.forum.header.log_in_link")),0)),t},e}(h.a),Gt=function(t){function e(){return t.apply(this,arguments)||this}return Object(o.a)(e,t),e.initAttrs=function(e){t.initAttrs.call(this,e),e.className=e.className||"Button Button--icon Button--link"},e}(P.a),Xt=n(43),Jt=(n(134),function(){function t(){this.position=t.Position.HIDDEN,this.height=null,this.body={attrs:{}},this.editor=null,this.clear()}var e=t.prototype;return e.load=function(t,e){var n={componentClass:t,attrs:e};this.preventExit()||(this.isVisible()&&(this.clear(),m.redraw.sync()),this.body=n)},e.clear=function(){this.position=t.Position.HIDDEN,this.body={attrs:{}},this.onExit=null,this.fields={content:Object(L.a)("")},this.editor&&this.editor.destroy(),this.editor=null},e.show=function(){this.position!==t.Position.NORMAL&&this.position!==t.Position.FULLSCREEN&&(this.position=t.Position.NORMAL,m.redraw.sync())},e.hide=function(){this.clear(),m.redraw()},e.close=function(){this.preventExit()||this.hide()},e.minimize=function(){this.isVisible()&&(this.position=t.Position.MINIMIZED,m.redraw())},e.fullScreen=function(){this.isVisible()&&(this.position=t.Position.FULLSCREEN,m.redraw())},e.exitFullScreen=function(){this.position===t.Position.FULLSCREEN&&(this.position=t.Position.NORMAL,m.redraw())},e.bodyMatches=function(t,e){var n=this;return void 0===e&&(e={}),!!Object(Xt.a)(this.body.componentClass,t)&&Object.keys(e).every((function(t){return n.body.attrs[t]===e[t]}))},e.isVisible=function(){return this.position!==t.Position.HIDDEN},e.isFullScreen=function(){return this.position===t.Position.FULLSCREEN||"phone"===app.screen()},e.composingReplyTo=function(t){return this.isVisible()&&this.bodyMatches(I,{discussion:t})},e.preventExit=function(){if(this.isVisible()&&this.onExit)return this.onExit.callback()?!confirm(this.onExit.message):void 0},e.preventClosingWhen=function(t,e){this.onExit={callback:t,message:e}},e.minimumHeight=function(){return 200},e.maximumHeight=function(){return $(window).height()-$("#header").outerHeight()},e.computedHeight=function(){return this.position===t.Position.MINIMIZED?"":this.position===t.Position.FULLSCREEN?$(window).height():Math.max(this.minimumHeight(),Math.min(this.height,this.maximumHeight()))},t}());Jt.Position={HIDDEN:"hidden",NORMAL:"normal",MINIMIZED:"minimized",FULLSCREEN:"fullScreen"};var Qt=Jt,Zt=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.state=this.attrs.state,this.active=!1,this.prevPosition=this.state.position},n.view=function(){var t=this.state.body,e={normal:this.state.position===Qt.Position.NORMAL,minimized:this.state.position===Qt.Position.MINIMIZED,fullScreen:this.state.position===Qt.Position.FULLSCREEN,active:this.active,visible:this.state.isVisible()},n=this.state.position===Qt.Position.MINIMIZED?this.state.show.bind(this.state):void 0;return m("div",{className:"Composer "+Object(V.a)(e)},m("div",{className:"Composer-handle",oncreate:this.configHandle.bind(this)}),m("ul",{className:"Composer-controls"},Object(f.a)(this.controlItems().toArray())),m("div",{className:"Composer-content",onclick:n},t.componentClass?t.componentClass.component(Object(a.a)({},t.attrs,{composer:this.state,disabled:e.minimized})):""))},n.onupdate=function(){this.state.position===this.prevPosition?this.updateHeight():(this.animatePositionChange(),this.prevPosition=this.state.position)},n.oncreate=function(e){var n=this;t.prototype.oncreate.call(this,e),this.initializeHeight(),this.$().hide().css("bottom",-this.state.computedHeight()),this.$().on("focus blur",":input,.TextEditor-editorContainer",(function(t){n.active="focusin"===t.type,m.redraw()})),this.$().on("keydown",":input,.TextEditor-editorContainer","esc",(function(){return n.state.close()})),this.handlers={},$(window).on("resize",this.handlers.onresize=this.updateHeight.bind(this)).resize(),$(document).on("mousemove",this.handlers.onmousemove=this.onmousemove.bind(this)).on("mouseup",this.handlers.onmouseup=this.onmouseup.bind(this))},n.onremove=function(){$(window).off("resize",this.handlers.onresize),$(document).off("mousemove",this.handlers.onmousemove).off("mouseup",this.handlers.onmouseup)},n.configHandle=function(t){var e=this;$(t.dom).css("cursor","row-resize").bind("dragstart mousedown",(function(t){return t.preventDefault()})).mousedown((function(t){e.mouseStart=t.clientY,e.heightStart=e.$().height(),e.handle=$(this),$("body").css("cursor","row-resize")}))},n.onmousemove=function(t){if(this.handle){var e=this.mouseStart-t.clientY;this.changeHeight(this.heightStart+e);var n=$(window).scrollTop(),i=n>0&&n+$(window).height()>=$(document).height();this.updateBodyPadding(i)}},n.onmouseup=function(){this.handle&&(this.handle=null,$("body").css("cursor",""))},n.focus=function(){this.$(".Composer-content :input:enabled:visible, .TextEditor-editor").first().focus()},n.updateHeight=function(){var t=this.state.computedHeight(),e=this.$(".Composer-flexible");if(this.$().height(t),e.length){var n=e.offset().top-this.$().offset().top,i=parseInt(e.css("padding-bottom"),10),r=this.$(".Composer-footer").outerHeight(!0);e.height(this.$().outerHeight()-n-i-r)}},n.updateBodyPadding=function(){var t=this.state.position!==Qt.Position.HIDDEN&&this.state.position!==Qt.Position.MINIMIZED&&"phone"!==app.screen()?this.state.computedHeight()-parseInt($("#app").css("padding-bottom"),10):0;$("#content").css({paddingBottom:t})},n.animatePositionChange=function(){if(this.prevPosition!==Qt.Position.FULLSCREEN||this.state.position!==Qt.Position.NORMAL)switch(this.state.position){case Qt.Position.HIDDEN:return this.hide();case Qt.Position.MINIMIZED:return this.minimize();case Qt.Position.FULLSCREEN:return this.focus();case Qt.Position.NORMAL:return this.show()}else this.focus()},n.animateHeightChange=function(){var t=this.$().stop(!0),e=t.outerHeight(),n=$(window).scrollTop();t.show(),this.updateHeight();var i=t.outerHeight();this.prevPosition===Qt.Position.HIDDEN?t.css({bottom:-i,height:i}):t.css({height:e});var r=t.animate({bottom:0,height:i},"fast").promise();return this.updateBodyPadding(),$(window).scrollTop(n),r},n.showBackdrop=function(){this.$backdrop=$("<div/>").addClass("composer-backdrop").appendTo("body")},n.hideBackdrop=function(){this.$backdrop&&this.$backdrop.remove()},n.show=function(){var t=this;if(this.animateHeightChange().then((function(){return t.focus()})),"phone"===app.screen()){var e=document.documentElement,n=Math.min(e.scrollTop,e.scrollHeight-e.clientHeight);this.$().css("top",$(".App").is(".mobile-safari")?n:0),this.showBackdrop()}},n.hide=function(){var t=this,e=this.$();e.stop(!0).animate({bottom:-e.height()},"fast",(function(){e.hide(),t.hideBackdrop(),t.updateBodyPadding()}))},n.minimize=function(){this.animateHeightChange(),this.$().css("top","auto"),this.hideBackdrop()},n.controlItems=function(){var t=new p.a;return this.state.position===Qt.Position.FULLSCREEN?t.add("exitFullScreen",Gt.component({icon:"fas fa-compress",title:app.translator.trans("core.forum.composer.exit_full_screen_tooltip"),onclick:this.state.exitFullScreen.bind(this.state)})):(this.state.position!==Qt.Position.MINIMIZED&&(t.add("minimize",Gt.component({icon:"fas fa-minus minimize",title:app.translator.trans("core.forum.composer.minimize_tooltip"),onclick:this.state.minimize.bind(this.state),itemClassName:"App-backControl"})),t.add("fullScreen",Gt.component({icon:"fas fa-expand",title:app.translator.trans("core.forum.composer.full_screen_tooltip"),onclick:this.state.fullScreen.bind(this.state)}))),t.add("close",Gt.component({icon:"fas fa-times",title:app.translator.trans("core.forum.composer.close_tooltip"),onclick:this.state.close.bind(this.state)}))),t},n.initializeHeight=function(){this.state.height=localStorage.getItem("composerHeight"),this.state.height||(this.state.height=this.defaultHeight())},n.defaultHeight=function(){return this.$().height()},n.changeHeight=function(t){this.state.height=t,this.updateHeight(),localStorage.setItem("composerHeight",this.state.height)},e}(h.a),te=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.view=function(){var t=this,e=this.attrs.notification,n=this.href();return m(g.a,{className:"Notification Notification--"+e.contentType()+" "+(e.isRead()?"":"unread"),href:n,external:n.includes("://"),onclick:this.markAsRead.bind(this)},!e.isRead()&&P.a.component({className:"Notification-action Button Button--icon Button--link",icon:"fas fa-check",title:app.translator.trans("core.forum.notifications.mark_as_read_tooltip"),onclick:function(e){e.preventDefault(),e.stopPropagation(),t.markAsRead()}}),Object(b.a)(e.fromUser()),Object(w.a)(this.icon(),{className:"Notification-icon"}),m("span",{className:"Notification-content"},this.content()),Object(O.a)(e.createdAt()),m("div",{className:"Notification-excerpt"},this.excerpt()))},n.icon=function(){},n.href=function(){},n.content=function(){},n.excerpt=function(){},n.markAsRead=function(){this.attrs.notification.isRead()||(app.session.user.pushAttributes({unreadNotificationCount:app.session.user.unreadNotificationCount()-1}),this.attrs.notification.save({isRead:!0}))},e}(h.a),ee=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.icon=function(){return"fas fa-pencil-alt"},n.href=function(){var t=this.attrs.notification;return app.route.discussion(t.subject(),t.content().postNumber)},n.content=function(){return app.translator.trans("core.forum.notifications.discussion_renamed_text",{user:this.attrs.notification.fromUser()})},e}(te);function ne(t){app.composer.isFullScreen()&&(app.composer.minimize(),t.stopPropagation())}var ie=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t),e.initAttrs=function(e){t.initAttrs.call(this,e),e.submitLabel=e.submitLabel||app.translator.trans("core.forum.composer_edit.submit_button"),e.confirmExit=e.confirmExit||app.translator.trans("core.forum.composer_edit.discard_confirmation"),e.originalContent=e.originalContent||e.post.content(),e.user=e.user||e.post.user(),e.post.editedContent=e.originalContent};var n=e.prototype;return n.headerItems=function(){var e=t.prototype.headerItems.call(this),n=this.attrs.post;return e.add("title",m("h3",null,Object(w.a)("fas fa-pencil-alt")," ",m(g.a,{href:app.route.discussion(n.discussion(),n.number()),onclick:ne},app.translator.trans("core.forum.composer_edit.post_link",{number:n.number(),discussion:n.discussion().title()})))),e},n.jumpToPreview=function(t){ne(t),m.route.set(app.route.post(this.attrs.post))},n.data=function(){return{content:this.composer.fields.content()}},n.onsubmit=function(){var t=this,e=this.attrs.post.discussion();this.loading=!0;var n=this.data();this.attrs.post.save(n).then((function(n){if(app.viewingDiscussion(e))app.current.get("stream").goToNumber(n.number());else{var i,r=P.a.component({className:"Button Button--link",onclick:function(){m.route.set(app.route.post(n)),app.alerts.dismiss(i)}},app.translator.trans("core.forum.composer_edit.view_button"));i=app.alerts.show({type:"success",controls:[r]},app.translator.trans("core.forum.composer_edit.edited_message"))}t.composer.hide()}),this.loaded.bind(this))},e}(E),re={controls:function(t,e){var n=this,i=new p.a;return["user","moderation","destructive"].forEach((function(r){var o=n[r+"Controls"](t,e).toArray();o.length&&(o.forEach((function(t){return i.add(t.itemName,t)})),i.add(r+"Separator",F.a.component()))})),i},userControls:function(t,e){return new p.a},moderationControls:function(t,e){var n=new p.a;return"comment"===t.contentType()&&t.canEdit()&&(t.isHidden()||n.add("edit",P.a.component({icon:"fas fa-pencil-alt",onclick:this.editAction.bind(t)},app.translator.trans("core.forum.post_controls.edit_button")))),n},destructiveControls:function(t,e){var n=new p.a;return"comment"!==t.contentType()||t.isHidden()?("comment"===t.contentType()&&t.canHide()&&n.add("restore",P.a.component({icon:"fas fa-reply",onclick:this.restoreAction.bind(t)},app.translator.trans("core.forum.post_controls.restore_button"))),t.canDelete()&&n.add("delete",P.a.component({icon:"fas fa-times",onclick:this.deleteAction.bind(t,e)},app.translator.trans("core.forum.post_controls.delete_forever_button")))):t.canHide()&&n.add("hide",P.a.component({icon:"far fa-trash-alt",onclick:this.hideAction.bind(t)},app.translator.trans("core.forum.post_controls.delete_button"))),n},editAction:function(){var t=this;return new Promise((function(e){return app.composer.load(ie,{post:t}),app.composer.show(),e()}))},hideAction:function(){if(confirm(Object(D.a)(app.translator.trans("core.forum.post_controls.hide_confirmation"))))return this.pushAttributes({hiddenAt:new Date,hiddenUser:app.session.user}),this.save({isHidden:!0}).then((function(){return m.redraw()}))},restoreAction:function(){return this.pushAttributes({hiddenAt:null,hiddenUser:null}),this.save({isHidden:!1}).then((function(){return m.redraw()}))},deleteAction:function(t){var e=this;if(confirm(Object(D.a)(app.translator.trans("core.forum.post_controls.delete_confirmation"))))return t&&(t.loading=!0),this.delete().then((function(){var t=e.discussion();t.removePost(e.id()),t.postIds().length||(app.discussions.removeDiscussion(t),app.viewingDiscussion(t)&&app.history.back())})).catch((function(){})).then((function(){t&&(t.loading=!1),m.redraw()}))}},oe=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){var n=this;t.prototype.oninit.call(this,e),this.loading=!1,this.subtree=new k.a((function(){return n.attrs.post.freshness}),(function(){var t=n.attrs.post.user();return t&&t.freshness}),(function(){return n.controlsOpen}))},n.view=function(){var t=this,e=this.elementAttrs();e.className=this.classes(e.className).join(" ");var n=re.controls(this.attrs.post,this).toArray();return m("article",e,m("div",null,this.content(),m("aside",{className:"Post-actions"},m("ul",null,Object(f.a)(this.actionItems().toArray()),n.length?m("li",null,m(C.a,{className:"Post-controls",buttonClassName:"Button Button--icon Button--flat",menuClassName:"Dropdown-menu--right",icon:"fas fa-ellipsis-h",onshow:function(){return t.$(".Post-actions").addClass("open")},onhide:function(){return t.$(".Post-actions").removeClass("open")}},n)):"")),m("footer",{className:"Post-footer"},m("ul",null,Object(f.a)(this.footerItems().toArray())))))},n.onbeforeupdate=function(e){return t.prototype.onbeforeupdate.call(this,e),this.subtree.needsRebuild()},n.onupdate=function(){var t=this.$(".Post-actions"),e=this.$(".Post-controls");t.toggleClass("open",e.hasClass("open"))},n.elementAttrs=function(){return{}},n.content=function(){return[]},n.classes=function(t){var e=(t||"").split(" ").concat(["Post"]),n=this.attrs.post.user(),i=this.attrs.post.discussion();return this.loading&&e.push("Post--loading"),n&&n===app.session.user&&e.push("Post--by-actor"),n&&n===i.user()&&e.push("Post--by-start-user"),e},n.actionItems=function(){return new p.a},n.footerItems=function(){return new p.a},e}(h.a),se=n(34),ae=n(12),ce=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){var n=this;t.prototype.oninit.call(this,e);var i=this.attrs.user;this.username=Object(L.a)(i.username()||""),this.email=Object(L.a)(i.email()||""),this.isEmailConfirmed=Object(L.a)(i.isEmailConfirmed()||!1),this.setPassword=Object(L.a)(!1),this.password=Object(L.a)(i.password()||""),this.groups={},app.store.all("groups").filter((function(t){return-1===[ae.a.GUEST_ID,ae.a.MEMBER_ID].indexOf(t.id())})).forEach((function(t){return n.groups[t.id()]=Object(L.a)(-1!==i.groups().indexOf(t))}))},n.className=function(){return"EditUserModal Modal--small"},n.title=function(){return app.translator.trans("core.forum.edit_user.title")},n.content=function(){var t=this.fields().toArray();return m("div",{className:"Modal-body"},t.length>1?m("div",{className:"Form"},this.fields().toArray()):app.translator.trans("core.forum.edit_user.nothing_available"))},n.fields=function(){var t=this,e=new p.a;return app.session.user.canEditCredentials()&&(e.add("username",m("div",{className:"Form-group"},m("label",null,app.translator.trans("core.forum.edit_user.username_heading")),m("input",{className:"FormControl",placeholder:Object(D.a)(app.translator.trans("core.forum.edit_user.username_label")),bidi:this.username,disabled:this.nonAdminEditingAdmin()})),40),app.session.user!==this.attrs.user&&(e.add("email",m("div",{className:"Form-group"},m("label",null,app.translator.trans("core.forum.edit_user.email_heading")),m("div",null,m("input",{className:"FormControl",placeholder:Object(D.a)(app.translator.trans("core.forum.edit_user.email_label")),bidi:this.email,disabled:this.nonAdminEditingAdmin()})),!this.isEmailConfirmed()&&this.userIsAdmin(app.session.user)?m("div",null,P.a.component({className:"Button Button--block",loading:this.loading,onclick:this.activate.bind(this)},app.translator.trans("core.forum.edit_user.activate_button"))):""),30),e.add("password",m("div",{className:"Form-group"},m("label",null,app.translator.trans("core.forum.edit_user.password_heading")),m("div",null,m("label",{className:"checkbox"},m("input",{type:"checkbox",onchange:function(e){t.setPassword(e.target.checked),m.redraw.sync(),e.target.checked&&t.$("[name=password]").select(),e.redraw=!1},disabled:this.nonAdminEditingAdmin()}),app.translator.trans("core.forum.edit_user.set_password_label")),this.setPassword()?m("input",{className:"FormControl",type:"password",name:"password",placeholder:Object(D.a)(app.translator.trans("core.forum.edit_user.password_label")),bidi:this.password,disabled:this.nonAdminEditingAdmin()}):"")),20))),app.session.user.canEditGroups()&&e.add("groups",m("div",{className:"Form-group EditUserModal-groups"},m("label",null,app.translator.trans("core.forum.edit_user.groups_heading")),m("div",null,Object.keys(this.groups).map((function(t){return app.store.getById("groups",t)})).map((function(e){return m("label",{className:"checkbox"},m("input",{type:"checkbox",bidi:t.groups[e.id()],disabled:e.id()===ae.a.ADMINISTRATOR_ID&&(t.attrs.user===app.session.user||!t.userIsAdmin(app.session.user))}),se.a.component({group:e,label:""})," ",e.nameSingular())})))),10),e.add("submit",m("div",{className:"Form-group"},P.a.component({className:"Button Button--primary",type:"submit",loading:this.loading},app.translator.trans("core.forum.edit_user.submit_button"))),-10),e},n.activate=function(){var t=this;this.loading=!0;var e={username:this.username(),isEmailConfirmed:!0};this.attrs.user.save(e,{errorHandler:this.onerror.bind(this)}).then((function(){t.isEmailConfirmed(!0),t.loading=!1,m.redraw()})).catch((function(){t.loading=!1,m.redraw()}))},n.data=function(){var t=this,e={relationships:{}};return this.attrs.user.canEditCredentials()&&!this.nonAdminEditingAdmin()&&(e.username=this.username(),app.session.user!==this.attrs.user&&(e.email=this.email()),this.setPassword()&&(e.password=this.password())),this.attrs.user.canEditGroups()&&(e.relationships.groups=Object.keys(this.groups).filter((function(e){return t.groups[e]()})).map((function(t){return app.store.getById("groups",t)}))),e},n.onsubmit=function(t){var e=this;t.preventDefault(),this.loading=!0,this.attrs.user.save(this.data(),{errorHandler:this.onerror.bind(this)}).then(this.hide.bind(this)).catch((function(){e.loading=!1,m.redraw()}))},n.nonAdminEditingAdmin=function(){return this.userIsAdmin(this.attrs.user)&&!this.userIsAdmin(app.session.user)},n.userIsAdmin=function(t){return t.groups().some((function(t){return t.id()===ae.a.ADMINISTRATOR_ID}))},e}(M.a),ue=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.view=function(t){return t.children[0]},n.oncreate=function(e){t.prototype.oncreate.call(this,e),this.boundOnresize=this.onresize.bind(this),$(window).on("resize",this.boundOnresize).resize()},n.onremove=function(){$(window).off("resize",this.boundOnresize)},n.onresize=function(){var t=this,e=this.$(),n=$("#header"),i=$("#footer"),r=e.find("> ul");$(window).off(".affix"),r.removeClass("affix affix-top affix-bottom").removeData("bs.affix"),e.outerHeight(!0)>$(window).height()-n.outerHeight(!0)||r.affix({offset:{top:function(){return e.offset().top-n.outerHeight(!0)-parseInt(e.css("margin-top"),10)},bottom:function(){return t.bottom=i.outerHeight(!0)}}})},e}(h.a),le=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.user=null,this.bodyClass="App--user"},n.view=function(){return m("div",{className:"UserPage"},this.user?[m(he,{user:this.user,className:"Hero UserHero",editable:this.user.canEdit()||this.user===app.session.user,controlsButtonClassName:"Button"}),m("div",{className:"container"},m("div",{className:"sideNavContainer"},m(ue,null,m("nav",{className:"sideNav UserPage-nav"},m("ul",null,Object(f.a)(this.sidebarItems().toArray())))),m("div",{className:"sideNavOffset UserPage-content"},this.content())))]:[m(j.a,{className:"LoadingIndicator--block"})])},n.content=function(){},n.show=function(t){this.user=t,app.current.set("user",t),app.setTitle(t.displayName()),m.redraw()},n.loadUser=function(t){var e=this,n=t.toLowerCase();app.preloadedApiDocument(),app.store.all("users").some((function(i){if((i.username().toLowerCase()===n||i.id()===t)&&i.joinTime())return e.show(i),!0})),this.user||app.store.find("users",t,{bySlug:!0}).then(this.show.bind(this))},n.sidebarItems=function(){var t=new p.a;return t.add("nav",m(Ht.a,{className:"App-titleControl",buttonClassName:"Button"},this.navItems().toArray())),t},n.navItems=function(){var t=new p.a,e=this.user;return t.add("posts",m(Rt.a,{href:app.route("user.posts",{username:e.username()}),icon:"far fa-comment"},app.translator.trans("core.forum.user.posts_link")," ",m("span",{className:"Button-badge"},e.commentCount())),100),t.add("discussions",m(Rt.a,{href:app.route("user.discussions",{username:e.username()}),icon:"fas fa-bars"},app.translator.trans("core.forum.user.discussions_link")," ",m("span",{className:"Button-badge"},e.discussionCount())),90),app.session.user===e&&(t.add("separator",m(F.a,null),-90),t.add("settings",m(Rt.a,{href:app.route("settings"),icon:"fas fa-cog"},app.translator.trans("core.forum.user.settings_link")),-100)),t},e}(d.a),de={controls:function(t,e){var n=this,i=new p.a;return["user","moderation","destructive"].forEach((function(r){var o=n[r+"Controls"](t,e).toArray();o.length&&(o.forEach((function(t){return i.add(t.itemName,t)})),i.add(r+"Separator",m(F.a,null)))})),i},userControls:function(){return new p.a},moderationControls:function(t){var e=new p.a;return(t.canEdit()||t.canEditCredentials()||t.canEditGroups())&&e.add("edit",m(P.a,{icon:"fas fa-pencil-alt",onclick:this.editAction.bind(this,t)},app.translator.trans("core.forum.user_controls.edit_button"))),e},destructiveControls:function(t){var e=new p.a;return"1"!==t.id()&&t.canDelete()&&e.add("delete",m(P.a,{icon:"fas fa-times",onclick:this.deleteAction.bind(this,t)},app.translator.trans("core.forum.user_controls.delete_button"))),e},deleteAction:function(t){var e=this;confirm(app.translator.trans("core.forum.user_controls.delete_confirmation"))&&t.delete().then((function(){e.showDeletionAlert(t,"success"),app.current.matches(le,{user:t})?app.history.back():window.location.reload()})).catch((function(){return e.showDeletionAlert(t,"error")}))},showDeletionAlert:function(t,e){var n=t.data.attributes,i=n.username,r=n.email,o={success:"core.forum.user_controls.delete_success_message",error:"core.forum.user_controls.delete_error_message"}[e];app.alerts.show({type:e},app.translator.trans(o,{username:i,email:r}))},editAction:function(t){app.modal.show(ce,{user:t})}},pe=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.loading=!1,this.isDraggedOver=!1},n.view=function(){var t=this.attrs.user;return m("div",{className:Object(V.a)(["AvatarEditor","Dropdown",this.attrs.className,this.loading&&"loading",this.isDraggedOver&&"dragover"])},Object(b.a)(t),m("a",{className:t.avatarUrl()?"Dropdown-toggle":"Dropdown-toggle AvatarEditor--noAvatar",title:app.translator.trans("core.forum.user.avatar_upload_tooltip"),"data-toggle":"dropdown",onclick:this.quickUpload.bind(this),ondragover:this.enableDragover.bind(this),ondragenter:this.enableDragover.bind(this),ondragleave:this.disableDragover.bind(this),ondragend:this.disableDragover.bind(this),ondrop:this.dropUpload.bind(this)},this.loading?m(j.a,null):t.avatarUrl()?Object(w.a)("fas fa-pencil-alt"):Object(w.a)("fas fa-plus-circle")),m("ul",{className:"Dropdown-menu Menu"},Object(f.a)(this.controlItems().toArray())))},n.controlItems=function(){var t=new p.a;return t.add("upload",m(P.a,{icon:"fas fa-upload",onclick:this.openPicker.bind(this)},app.translator.trans("core.forum.user.avatar_upload_button"))),t.add("remove",m(P.a,{icon:"fas fa-times",onclick:this.remove.bind(this)},app.translator.trans("core.forum.user.avatar_remove_button"))),t},n.enableDragover=function(t){t.preventDefault(),t.stopPropagation(),this.isDraggedOver=!0},n.disableDragover=function(t){t.preventDefault(),t.stopPropagation(),this.isDraggedOver=!1},n.dropUpload=function(t){t.preventDefault(),t.stopPropagation(),this.isDraggedOver=!1,this.upload(t.dataTransfer.files[0])},n.quickUpload=function(t){this.attrs.user.avatarUrl()||(t.preventDefault(),t.stopPropagation(),this.openPicker())},n.openPicker=function(){var t=this;this.loading||$('<input type="file">').appendTo("body").hide().click().on("input",(function(e){t.upload($(e.target)[0].files[0])}))},n.upload=function(t){if(!this.loading){var e=this.attrs.user,n=new FormData;n.append("avatar",t),this.loading=!0,m.redraw(),app.request({method:"POST",url:app.forum.attribute("apiUrl")+"/users/"+e.id()+"/avatar",serialize:function(t){return t},body:n}).then(this.success.bind(this),this.failure.bind(this))}},n.remove=function(){var t=this.attrs.user;this.loading=!0,m.redraw(),app.request({method:"DELETE",url:app.forum.attribute("apiUrl")+"/users/"+t.id()+"/avatar"}).then(this.success.bind(this),this.failure.bind(this))},n.success=function(t){app.store.pushPayload(t),delete this.attrs.user.avatarColor,this.loading=!1,m.redraw()},n.failure=function(t){this.loading=!1,m.redraw()},e}(h.a),he=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.view=function(){var t=this.attrs.user,e=de.controls(t,this).toArray(),n=t.color(),i=t.badges().toArray();return m("div",{className:"UserCard "+(this.attrs.className||""),style:n?{backgroundColor:n}:""},m("div",{className:"darkenBackground"},m("div",{className:"container"},e.length?C.a.component({className:"UserCard-controls App-primaryControl",menuClassName:"Dropdown-menu--right",buttonClassName:this.attrs.controlsButtonClassName,label:app.translator.trans("core.forum.user_controls.button"),icon:"fas fa-ellipsis-v"},e):"",m("div",{className:"UserCard-profile"},m("h2",{className:"UserCard-identity"},this.attrs.editable?[pe.component({user:t,className:"UserCard-avatar"}),Object(ht.a)(t)]:m(g.a,{href:app.route.user(t)},m("div",{className:"UserCard-avatar"},Object(b.a)(t)),Object(ht.a)(t))),i.length?m("ul",{className:"UserCard-badges badges"},Object(f.a)(i)):"",m("ul",{className:"UserCard-info"},Object(f.a)(this.infoItems().toArray()))))))},n.infoItems=function(){var t=new p.a,e=this.attrs.user,n=e.lastSeenAt();if(n){var i=e.isOnline();t.add("lastSeen",m("span",{className:"UserCard-lastSeen"+(i?" online":"")},i?[Object(w.a)("fas fa-circle")," ",app.translator.trans("core.forum.user.online_text")]:[Object(w.a)("far fa-clock")," ",Object(x.a)(n)]))}return t.add("joined",app.translator.trans("core.forum.user.joined_date_text",{ago:Object(x.a)(e.joinTime())})),t},e}(h.a),fe=n(82),me=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.view=function(){var t=this.attrs.post,e=t.user();if(!e)return m("div",{className:"PostUser"},m("h3",null,Object(b.a)(e,{className:"PostUser-avatar"})," ",Object(ht.a)(e)));var n="";return!t.isHidden()&&this.attrs.cardVisible&&(n=he.component({user:e,className:"UserCard--popover",controlsButtonClassName:"Button Button--icon Button--flat"})),m("div",{className:"PostUser"},m("h3",null,m(g.a,{href:app.route.user(e)},Object(b.a)(e,{className:"PostUser-avatar"}),Object(fe.a)(e),Object(ht.a)(e))),m("ul",{className:"PostUser-badges badges"},Object(f.a)(e.badges().toArray())),n)},n.oncreate=function(e){var n,i=this;t.prototype.oncreate.call(this,e),this.$().on("mouseover","h3 a, .UserCard",(function(){clearTimeout(n),n=setTimeout(i.showCard.bind(i),500)})).on("mouseout","h3 a, .UserCard",(function(){clearTimeout(n),n=setTimeout(i.hideCard.bind(i),250)}))},n.showCard=function(){var t=this;this.attrs.oncardshow(),setTimeout((function(){return t.$(".UserCard").addClass("in")}))},n.hideCard=function(){var t=this;this.$(".UserCard").removeClass("in").one("transitionend webkitTransitionEnd oTransitionEnd",(function(){t.attrs.oncardhide()}))},e}(h.a),ve=n(83),ge=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.view=function(){var t=this.attrs.post,e=t.createdAt(),n=this.getPermalink(t),i="ontouchstart"in document.documentElement;return m("div",{className:"Dropdown PostMeta"},m("a",{className:"Dropdown-toggle",onclick:function(t){var e=this;setTimeout((function(){return $(e).parent().find(".PostMeta-permalink").select()})),t.redraw=!1},"data-toggle":"dropdown"},Object(O.a)(e)),m("div",{className:"Dropdown-menu dropdown-menu"},m("span",{className:"PostMeta-number"},app.translator.trans("core.forum.post.number_tooltip",{number:t.number()}))," ",m("span",{className:"PostMeta-time"},Object(ve.a)(e))," ",m("span",{className:"PostMeta-ip"},t.data.attributes.ipAddress),i?m("a",{className:"Button PostMeta-permalink",href:n},n):m("input",{className:"FormControl PostMeta-permalink",value:n,onclick:function(t){return t.stopPropagation()}})))},n.getPermalink=function(t){return window.location.origin+app.route.post(t)},e}(h.a),be=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.shouldUpdateTooltip=!1,this.oldEditedInfo=null},n.view=function(){var t=this.attrs.post,e=t.editedUser(),n=Object(D.a)(app.translator.trans("core.forum.post.edited_tooltip",{user:e,ago:Object(x.a)(t.editedAt())}));return n!==this.oldEditedInfo&&(this.shouldUpdateTooltip=!0,this.oldEditedInfo=n),m("span",{className:"PostEdited",title:n},app.translator.trans("core.forum.post.edited_text"))},n.oncreate=function(e){t.prototype.oncreate.call(this,e),this.rebuildTooltip()},n.onupdate=function(){this.rebuildTooltip()},n.rebuildTooltip=function(){this.shouldUpdateTooltip&&(this.$().tooltip("destroy").tooltip(),this.shouldUpdateTooltip=!1)},e}(h.a),ye=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){var n=this;t.prototype.oninit.call(this,e),this.revealContent=!1,this.cardVisible=!1,this.subtree.check((function(){return n.cardVisible}),(function(){return n.isEditing()}),(function(){return n.revealContent}))},n.content=function(){return t.prototype.content.call(this).concat([m("header",{className:"Post-header"},m("ul",null,Object(f.a)(this.headerItems().toArray()))),m("div",{className:"Post-body"},this.isEditing()?m(ft,{className:"Post-preview",composer:app.composer}):m.trust(this.attrs.post.contentHtml()))])},n.refreshContent=function(){var t=this.isEditing()?"":this.attrs.post.contentHtml();this.contentHtml!==t&&this.$(".Post-body script").each((function(){var t=document.createElement("script");t.textContent=this.textContent,Array.from(this.attributes).forEach((function(e){return t.setAttribute(e.name,e.value)})),this.parentNode.replaceChild(t,this)})),this.contentHtml=t},n.oncreate=function(e){t.prototype.oncreate.call(this,e),this.refreshContent()},n.onupdate=function(e){t.prototype.onupdate.call(this,e),this.refreshContent()},n.isEditing=function(){return app.composer.bodyMatches(ie,{post:this.attrs.post})},n.elementAttrs=function(){var e=this.attrs.post,n=t.prototype.elementAttrs.call(this);return n.className=(n.className||"")+" "+Object(V.a)({CommentPost:!0,"Post--hidden":e.isHidden(),"Post--edited":e.isEdited(),revealContent:this.revealContent,editing:this.isEditing()}),n},n.toggleContent=function(){this.revealContent=!this.revealContent},n.headerItems=function(){var t=this,e=new p.a,n=this.attrs.post;return e.add("user",me.component({post:n,cardVisible:this.cardVisible,oncardshow:function(){t.cardVisible=!0,m.redraw()},oncardhide:function(){t.cardVisible=!1,m.redraw()}}),100),e.add("meta",ge.component({post:n})),n.isEdited()&&!n.isHidden()&&e.add("edited",be.component({post:n})),n.isHidden()&&e.add("toggle",P.a.component({className:"Button Button--default Button--more",icon:"fas fa-ellipsis-h",onclick:this.toggleContent.bind(this)})),e},e}(oe),we=n(32),xe=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.elementAttrs=function(){var e=t.prototype.elementAttrs.call(this);return e.className=(e.className||"")+" EventPost "+Object(we.ucfirst)(this.attrs.post.contentType())+"Post",e},n.content=function(){var e=this.attrs.post.user(),n=Object(ht.a)(e),i=Object(a.a)(this.descriptionData(),{user:e,username:e?m(g.a,{className:"EventPost-user",href:app.route.user(e)},n):n});return t.prototype.content.call(this).concat([Object(w.a)(this.icon(),{className:"EventPost-icon"}),m("div",{class:"EventPost-info"},this.description(i))])},n.icon=function(){return""},n.description=function(t){return app.translator.transChoice(this.descriptionKey(),t.count,t)},n.descriptionKey=function(){return""},n.descriptionData=function(){return{}},e}(oe),Ne=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.icon=function(){return"fas fa-pencil-alt"},n.description=function(t){var e=app.translator.trans("core.forum.post_stream.discussion_renamed_text",t),n=app.translator.trans("core.forum.post_stream.discussion_renamed_old_tooltip",t);return m("span",{title:Object(D.a)(n)},e)},n.descriptionData=function(){var t=this.attrs.post,e=t.content()[0],n=t.content()[1];return{old:e,new:m("strong",{className:"DiscussionRenamedPost-new"},n)}},e}(xe),Ce=(n(41),function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.hidden=localStorage.getItem("welcomeHidden")},n.view=function(){var t=this;if(this.hidden)return m("div",null);return m("header",{className:"Hero WelcomeHero"},m("div",{class:"container"},P.a.component({icon:"fas fa-times",onclick:function(){t.$().slideUp(t.hide.bind(t))},className:"Hero-close Button Button--icon Button--link"}),m("div",{className:"containerNarrow"},m("h2",{className:"Hero-title"},app.forum.attribute("welcomeTitle")),m("div",{className:"Hero-subtitle"},m.trust(app.forum.attribute("welcomeMessage"))))))},n.hide=function(){localStorage.setItem("welcomeHidden","true"),this.hidden=!0},e}(h.a)),Oe=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t),e.initAttrs=function(e){t.initAttrs.call(this,e),e.placeholder=e.placeholder||Object(D.a)(app.translator.trans("core.forum.composer_discussion.body_placeholder")),e.submitLabel=e.submitLabel||app.translator.trans("core.forum.composer_discussion.submit_button"),e.confirmExit=e.confirmExit||Object(D.a)(app.translator.trans("core.forum.composer_discussion.discard_confirmation")),e.titlePlaceholder=e.titlePlaceholder||Object(D.a)(app.translator.trans("core.forum.composer_discussion.title_placeholder")),e.className="ComposerBody--discussion"};var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.composer.fields.title=this.composer.fields.title||Object(L.a)(""),this.title=this.composer.fields.title},n.headerItems=function(){var e=t.prototype.headerItems.call(this);return e.add("title",m("h3",null,app.translator.trans("core.forum.composer_discussion.title")),100),e.add("discussionTitle",m("h3",null,m("input",{className:"FormControl",bidi:this.title,placeholder:this.attrs.titlePlaceholder,disabled:!!this.attrs.disabled,onkeydown:this.onkeydown.bind(this)}))),e},n.onkeydown=function(t){13===t.which&&(t.preventDefault(),this.composer.editor.moveCursorTo(0)),t.redraw=!1},n.hasChanges=function(){return this.title()||this.composer.fields.content()},n.data=function(){return{title:this.title(),content:this.composer.fields.content()}},n.onsubmit=function(){var t=this;this.loading=!0;var e=this.data();app.store.createRecord("discussions").save(e).then((function(e){t.composer.hide(),app.discussions.refresh({deferClear:!0}),m.route.set(app.route.discussion(e))}),this.loaded.bind(this))},e}(E),Te=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(n){t.prototype.oninit.call(this,n),app.previous.matches(Mt)&&(this.lastDiscussion=app.previous.get("discussion")),app.previous.matches(e)&&app.discussions.clear(),app.discussions.refreshParams(app.search.params()),app.history.push("index",app.translator.trans("core.forum.header.back_to_index_tooltip")),this.bodyClass="App--index",this.scrollTopOnCreate=!1},n.view=function(){return m("div",{className:"IndexPage"},this.hero(),m("div",{className:"container"},m("div",{className:"sideNavContainer"},m("nav",{className:"IndexPage-nav sideNav"},m("ul",null,Object(f.a)(this.sidebarItems().toArray()))),m("div",{className:"IndexPage-results sideNavOffset"},m("div",{className:"IndexPage-toolbar"},m("ul",{className:"IndexPage-toolbar-view"},Object(f.a)(this.viewItems().toArray())),m("ul",{className:"IndexPage-toolbar-action"},Object(f.a)(this.actionItems().toArray()))),m(ct,{state:app.discussions})))))},n.setTitle=function(){app.setTitle(app.translator.trans("core.forum.index.meta_title_text")),app.setTitleCount(0)},n.oncreate=function(e){t.prototype.oncreate.call(this,e),this.setTitle();var n=app.cache.heroHeight,i=app.cache.heroHeight=this.$(".Hero").outerHeight()||0,r=app.cache.scrollTop;if($("#app").css("min-height",$(window).height()+i),null!=app.previous.type&&("desktop"==app.screen()||"desktop-hd"==app.screen()||this.lastDiscussion?$(window).scrollTop(r-n+i):$(window).scrollTop(0),this.lastDiscussion)){var o=this.$('li[data-id="'+this.lastDiscussion.id()+'"] .DiscussionListItem');if(o.length){var s=$("#header").outerHeight(),a=$(window).height(),c=o.offset().top,u=c+o.outerHeight();(c<r+s||u>r+a)&&$(window).scrollTop(c-s)}}},n.onbeforeremove=function(){app.cache.scrollTop=$(window).scrollTop()},n.onremove=function(){t.prototype.onremove.call(this),$("#app").css("min-height","")},n.hero=function(){return Ce.component()},n.sidebarItems=function(){var t=this,e=new p.a,n=app.forum.attribute("canStartDiscussion")||!app.session.user;return e.add("newDiscussion",P.a.component({icon:"fas fa-edit",className:"Button Button--primary IndexPage-newDiscussion",itemClassName:"App-primaryControl",onclick:function(){return t.newDiscussionAction().catch((function(){}))},disabled:!n},app.translator.trans(n?"core.forum.index.start_discussion_button":"core.forum.index.cannot_start_discussion_button"))),e.add("nav",Ht.a.component({buttonClassName:"Button",className:"App-titleControl"},this.navItems(this).toArray())),e},n.navItems=function(){var t=new p.a,e=app.search.stickyParams();return t.add("allDiscussions",Rt.a.component({href:app.route("index",e),icon:"far fa-comments"},app.translator.trans("core.forum.index.all_discussions_link")),100),t},n.viewItems=function(){var t=new p.a,e=app.discussions.sortMap(),n={};for(var i in e)n[i]=app.translator.trans("core.forum.index_sort."+i+"_button");return t.add("sort",C.a.component({buttonClassName:"Button",label:n[app.search.params().sort]||Object.keys(e).map((function(t){return n[t]}))[0]},Object.keys(n).map((function(t){var i=n[t],r=(app.search.params().sort||Object.keys(e)[0])===t;return P.a.component({icon:!r||"fas fa-check",onclick:app.search.changeSort.bind(app.search,t),active:r},i)})))),t},n.actionItems=function(){var t=new p.a;return t.add("refresh",P.a.component({title:app.translator.trans("core.forum.index.refresh_tooltip"),icon:"fas fa-sync",className:"Button Button--icon",onclick:function(){app.discussions.refresh(),app.session.user&&(app.store.find("users",app.session.user.id()),m.redraw())}})),app.session.user&&t.add("markAllAsRead",P.a.component({title:app.translator.trans("core.forum.index.mark_all_as_read_tooltip"),icon:"fas fa-check",className:"Button Button--icon",onclick:this.markAllAsRead.bind(this)})),t},n.newDiscussionAction=function(){return new Promise((function(t,e){return app.session.user?(app.composer.load(Oe,{user:app.session.user}),app.composer.show(),t(app.composer)):(app.modal.show(U),e())}))},n.markAllAsRead=function(){confirm(app.translator.trans("core.forum.index.mark_all_as_read_confirmation"))&&app.session.user.save({markedAllAsReadAt:new Date})},e}(d.a);Object(s.a)(Te,"providesInitialSearch",!0);var ke=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.loading=!0,this.moreResults=!1,this.posts=[],this.loadLimit=20,this.loadUser(m.route.param("username"))},n.content=function(){return 0!==this.posts.length||this.loading?(this.loading?t=m(j.a,null):this.moreResults&&(t=m("div",{className:"PostsUserPage-loadMore"},m(P.a,{className:"Button",onclick:this.loadMore.bind(this)},app.translator.trans("core.forum.user.posts_load_more_button")))),m("div",{className:"PostsUserPage"},m("ul",{className:"PostsUserPage-list"},this.posts.map((function(t){return m("li",null,m("div",{className:"PostsUserPage-discussion"},app.translator.trans("core.forum.user.in_discussion_text",{discussion:m(g.a,{href:app.route.post(t)},t.discussion().title())})),m(ye,{post:t}))}))),m("div",{className:"PostsUserPage-loadMore"},t))):m("div",{className:"PostsUserPage"},m(at.a,{text:app.translator.trans("core.forum.user.posts_empty_text")}));var t},n.show=function(e){t.prototype.show.call(this,e),this.refresh()},n.refresh=function(){this.loading=!0,this.posts=[],m.redraw(),this.loadResults().then(this.parseResults.bind(this))},n.loadResults=function(t){return app.store.find("posts",{filter:{author:this.user.username(),type:"comment"},page:{offset:t,limit:this.loadLimit},sort:"-createdAt"})},n.loadMore=function(){this.loading=!0,this.loadResults(this.posts.length).then(this.parseResults.bind(this))},n.parseResults=function(t){return this.loading=!1,[].push.apply(this.posts,t),this.moreResults=t.length>=this.loadLimit,m.redraw(),t},e}(le),je=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e=window.app),this.params=t,this.app=e,this.discussions=[],this.moreResults=!1,this.loading=!1}var e=t.prototype;return e.requestParams=function(){var t={include:["user","lastPostedUser"],filter:{}};return t.sort=this.sortMap()[this.params.sort],this.params.q&&(t.filter.q=this.params.q,t.include.push("mostRelevantPost","mostRelevantPost.user")),t},e.sortMap=function(){var t={};return this.params.q&&(t.relevance=""),t.latest="-lastPostedAt",t.top="-commentCount",t.newest="-createdAt",t.oldest="createdAt",t},e.getParams=function(){return this.params},e.clear=function(){this.discussions=[],m.redraw()},e.refreshParams=function(t){var e=this;this.hasDiscussions()&&!Object.keys(t).some((function(n){return e.getParams()[n]!==t[n]}))||(this.params=t,this.refresh())},e.refresh=function(t){var e=this,n=(void 0===t?{}:t).deferClear,i=void 0!==n&&n;return this.loading=!0,i||this.clear(),this.loadResults().then((function(t){e.discussions=[],e.parseResults(t)}),(function(){e.loading=!1,m.redraw()}))},e.loadResults=function(t){var e=this.app.preloadedApiDocument();if(e)return Promise.resolve(e);var n=this.requestParams();return n.page={offset:t},n.include=n.include.join(","),this.app.store.find("discussions",n)},e.loadMore=function(){this.loading=!0,this.loadResults(this.discussions.length).then(this.parseResults.bind(this))},e.parseResults=function(t){var e;return(e=this.discussions).push.apply(e,t),this.loading=!1,this.moreResults=!!t.payload.links&&!!t.payload.links.next,m.redraw(),t},e.removeDiscussion=function(t){var e=this.discussions.indexOf(t);-1!==e&&this.discussions.splice(e,1),m.redraw()},e.addDiscussion=function(t){this.discussions.unshift(t),m.redraw()},e.hasDiscussions=function(){return this.discussions.length>0},e.isLoading=function(){return this.loading},e.isSearchResults=function(){return!!this.params.q},e.empty=function(){return!this.hasDiscussions()&&!this.isLoading()},t}(),Se=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.loadUser(m.route.param("username"))},n.show=function(e){t.prototype.show.call(this,e),this.state=new je({q:"author:"+e.username(),sort:"newest"}),this.state.refresh()},n.content=function(){return m("div",{className:"DiscussionsUserPage"},ct.component({state:this.state}))},e}(le),Ae=n(37),Ee=n(42),Pe=n(47),De=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.methods=this.notificationMethods().toArray(),this.loading={},this.types=this.notificationTypes().toArray()},n.view=function(){var t=this,e=this.attrs.user.preferences();return m("table",{className:"NotificationGrid"},m("thead",null,m("tr",null,m("td",null),this.methods.map((function(e){return m("th",{className:"NotificationGrid-groupToggle",onclick:t.toggleMethod.bind(t,e.name)},Object(w.a)(e.icon)," ",e.label)})))),m("tbody",null,this.types.map((function(n){return m("tr",null,m("td",{className:"NotificationGrid-groupToggle",onclick:t.toggleType.bind(t,n.name)},Object(w.a)(n.icon)," ",n.label),t.methods.map((function(i){var r=t.preferenceKey(n.name,i.name);return m("td",{className:"NotificationGrid-checkbox"},m(Pe.a,{state:!!e[r],loading:t.loading[r],disabled:!(r in e),onchange:t.toggle.bind(t,[r])}))})))}))))},n.oncreate=function(e){t.prototype.oncreate.call(this,e),this.$("thead .NotificationGrid-groupToggle").bind("mouseenter mouseleave",(function(t){var e=parseInt($(this).index(),10)+1;$(this).parents("table").find("td:nth-child("+e+")").toggleClass("highlighted","mouseenter"===t.type)})),this.$("tbody .NotificationGrid-groupToggle").bind("mouseenter mouseleave",(function(t){$(this).parent().find("td").toggleClass("highlighted","mouseenter"===t.type)}))},n.toggle=function(t){var e=this,n=this.attrs.user,i=n.preferences(),r=!i[t[0]];t.forEach((function(t){e.loading[t]=!0,i[t]=r})),m.redraw(),n.save({preferences:i}).then((function(){t.forEach((function(t){return e.loading[t]=!1})),m.redraw()}))},n.toggleMethod=function(t){var e=this,n=this.types.map((function(n){return e.preferenceKey(n.name,t)})).filter((function(t){return t in e.attrs.user.preferences()}));this.toggle(n)},n.toggleType=function(t){var e=this,n=this.methods.map((function(n){return e.preferenceKey(t,n.name)})).filter((function(t){return t in e.attrs.user.preferences()}));this.toggle(n)},n.preferenceKey=function(t,e){return"notify_"+t+"_"+e},n.notificationMethods=function(){var t=new p.a;return t.add("alert",{name:"alert",icon:"fas fa-bell",label:app.translator.trans("core.forum.settings.notify_by_web_heading")}),t.add("email",{name:"email",icon:"far fa-envelope",label:app.translator.trans("core.forum.settings.notify_by_email_heading")}),t},n.notificationTypes=function(){var t=new p.a;return t.add("discussionRenamed",{name:"discussionRenamed",icon:"fas fa-pencil-alt",label:app.translator.trans("core.forum.settings.notify_discussion_renamed_label")}),t},e}(h.a),$e=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.className=function(){return"ChangePasswordModal Modal--small"},n.title=function(){return app.translator.trans("core.forum.change_password.title")},n.content=function(){return m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("p",{className:"helpText"},app.translator.trans("core.forum.change_password.text")),m("div",{className:"Form-group"},P.a.component({className:"Button Button--primary Button--block",type:"submit",loading:this.loading},app.translator.trans("core.forum.change_password.send_button")))))},n.onsubmit=function(t){t.preventDefault(),this.loading=!0,app.request({method:"POST",url:app.forum.attribute("apiUrl")+"/forgot",body:{email:app.session.user.email()}}).then(this.hide.bind(this),this.loaded.bind(this))},e}(M.a),_e=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.success=!1,this.email=Object(L.a)(app.session.user.email()),this.password=Object(L.a)("")},n.className=function(){return"ChangeEmailModal Modal--small"},n.title=function(){return app.translator.trans("core.forum.change_email.title")},n.content=function(){return this.success?m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("p",{className:"helpText"},app.translator.trans("core.forum.change_email.confirmation_message",{email:m("strong",null,this.email())})),m("div",{className:"Form-group"},m(P.a,{className:"Button Button--primary Button--block",onclick:this.hide.bind(this)},app.translator.trans("core.forum.change_email.dismiss_button"))))):m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("div",{className:"Form-group"},m("input",{type:"email",name:"email",className:"FormControl",placeholder:app.session.user.email(),bidi:this.email,disabled:this.loading})),m("div",{className:"Form-group"},m("input",{type:"password",name:"password",className:"FormControl",placeholder:app.translator.trans("core.forum.change_email.confirm_password_placeholder"),bidi:this.password,disabled:this.loading})),m("div",{className:"Form-group"},P.a.component({className:"Button Button--primary Button--block",type:"submit",loading:this.loading},app.translator.trans("core.forum.change_email.submit_button")))))},n.onsubmit=function(t){var e=this;t.preventDefault(),this.email()!==app.session.user.email()?(this.loading=!0,this.alertAttrs=null,app.session.user.save({email:this.email()},{errorHandler:this.onerror.bind(this),meta:{password:this.password()}}).then((function(){e.success=!0})).catch((function(){})).then(this.loaded.bind(this))):this.hide()},n.onerror=function(e){401===e.status&&(e.alert.content=app.translator.trans("core.forum.change_email.incorrect_password_message")),t.prototype.onerror.call(this,e)},e}(M.a),Ie=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),this.show(app.session.user),app.setTitle(app.translator.trans("core.forum.settings.title"))},n.content=function(){return m("div",{className:"SettingsPage"},m("ul",null,Object(f.a)(this.settingsItems().toArray())))},n.settingsItems=function(){var t=this,e=new p.a;return["account","notifications","privacy"].forEach((function(n){e.add(n,m(Ee.a,{className:"Settings-"+n,label:app.translator.trans("core.forum.settings."+n+"_heading")},t[n+"Items"]().toArray()))})),e},n.accountItems=function(){var t=new p.a;return t.add("changePassword",m(P.a,{className:"Button",onclick:function(){return app.modal.show($e)}},app.translator.trans("core.forum.settings.change_password_button"))),t.add("changeEmail",m(P.a,{className:"Button",onclick:function(){return app.modal.show(_e)}},app.translator.trans("core.forum.settings.change_email_button"))),t},n.notificationsItems=function(){var t=new p.a;return t.add("notificationGrid",m(De,{user:this.user})),t},n.privacyItems=function(){var t=this,e=new p.a;return e.add("discloseOnline",m(Ae.a,{state:this.user.preferences().discloseOnline,onchange:function(e){t.discloseOnlineLoading=!0,t.user.savePreferences({discloseOnline:e}).then((function(){t.discloseOnlineLoading=!1,m.redraw()}))},loading:this.discloseOnlineLoading},app.translator.trans("core.forum.settings.privacy_disclose_online_label"))),e},e}(le),Me=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e),app.history.push("notifications"),app.notifications.load(),this.bodyClass="App--notifications"},n.view=function(){return m("div",{className:"NotificationsPage"},m(Ft,{state:app.notifications}))},e}(d.a),Le=function(t){function e(){return t.apply(this,arguments)||this}Object(o.a)(e,t);var n=e.prototype;return n.canonicalizeDiscussionSlug=function(t){if(t)return t.split("-")[0]},n.makeKey=function(){var t=Object(a.a)({},m.route.param());return"near"in t&&delete t.near,t.id=this.canonicalizeDiscussionSlug(t.id),this.routeName.replace(".near","")+JSON.stringify(t)},n.onmatch=function(n,i,r){return app.current.matches(Mt)&&this.canonicalizeDiscussionSlug(n.id)===this.canonicalizeDiscussionSlug(m.route.param("id"))&&(e.scrollToPostNumber=n.near||"1"),t.prototype.onmatch.call(this,n,i,r)},n.render=function(n){if(null!==e.scrollToPostNumber){var i=e.scrollToPostNumber;setTimeout((function(){return app.current.get("stream").goToNumber(i)})),e.scrollToPostNumber=null}return t.prototype.render.call(this,n)},e}(n(39).a);Object(s.a)(Le,"scrollToPostNumber",null);var Re=function(t){t.routes={index:{path:"/all",component:Te},discussion:{path:"/d/:id",component:Mt,resolverClass:Le},"discussion.near":{path:"/d/:id/:near",component:Mt,resolverClass:Le},user:{path:"/u/:username",component:ke},"user.posts":{path:"/u/:username",component:ke},"user.discussions":{path:"/u/:username/discussions",component:Se},settings:{path:"/settings",component:Ie},notifications:{path:"/notifications",component:Me}},t.route.discussion=function(e,n){return t.route(n&&1!==n?"discussion.near":"discussion",{id:e.slug(),near:n&&1!==n?n:void 0})},t.route.post=function(e){return t.route.discussion(e.discussion(),e.number())},t.route.user=function(e){return t.route("user",{username:e.slug()})}},Be=n(23);function He(t){var e=t.session.user;if(e&&!e.isEmailConfirmed()){var n=function(n){function i(){return n.apply(this,arguments)||this}Object(o.a)(i,n);var r=i.prototype;return r.oninit=function(t){n.prototype.oninit.call(this,t),this.loading=!1,this.sent=!1},r.view=function(){return m(P.a,{class:"Button Button--link",onclick:this.onclick.bind(this),loading:this.loading,disabled:this.sent},this.sent?[Object(w.a)("fas fa-check")," ",t.translator.trans("core.forum.user_email_confirmation.sent_message")]:t.translator.trans("core.forum.user_email_confirmation.resend_button"))},r.onclick=function(){var n=this;this.loading=!0,m.redraw(),t.request({method:"POST",url:t.forum.attribute("apiUrl")+"/users/"+e.id()+"/send-confirmation"}).then((function(){n.loading=!1,n.sent=!0,m.redraw()})).catch((function(){n.loading=!1,m.redraw()}))},i}(h.a),i=function(t){function e(){return t.apply(this,arguments)||this}return Object(o.a)(e,t),e.prototype.view=function(e){var n=t.prototype.view.call(this,e);return Object(a.a)({},n,{children:[m("div",{className:"container"},n.children)]})},e}(Be.a);m.mount($("<div/>").insertBefore("#content")[0],{view:function(){return m(i,{dismissible:!1,controls:[m(n,null)]},t.translator.trans("core.forum.user_email_confirmation.alert_message",{email:m("strong",null,e.email())}))}})}}var Ue=n(70),Fe=n(50),qe=function(){function t(t){this.app=t,this.notificationPages=[],this.loading=!1,this.moreResults=!1}var e=t.prototype;return e.clear=function(){this.notificationPages=[]},e.getNotificationPages=function(){return this.notificationPages},e.isLoading=function(){return this.loading},e.hasMoreResults=function(){return this.moreResults},e.load=function(){this.app.session.user.newNotificationCount()&&(this.notificationPages=[]),this.notificationPages.length>0||(this.app.session.user.pushAttributes({newNotificationCount:0}),this.loadMore())},e.loadMore=function(){var t=this;this.loading=!0,m.redraw();var e=this.notificationPages.length>0?{page:{offset:10*this.notificationPages.length}}:null;return this.app.store.find("notifications",e).then(this.parseResults.bind(this)).catch((function(){})).then((function(){t.loading=!1,m.redraw()}))},e.parseResults=function(t){return t.length&&this.notificationPages.push(t),this.moreResults=!!t.payload.links.next,t},e.markAllAsRead=function(){0!==this.notificationPages.length&&(this.app.session.user.pushAttributes({unreadNotificationCount:0}),this.notificationPages.forEach((function(t){t.forEach((function(t){return t.pushAttributes({isRead:!0})}))})),this.app.request({url:this.app.forum.attribute("apiUrl")+"/notifications/read",method:"POST"}))},t}(),ze=function(){function t(t){void 0===t&&(t=[]),this.cachedSearches=t}var e=t.prototype;return e.getValue=function(){return this.value},e.setValue=function(t){this.value=t},e.clear=function(){this.setValue("")},e.cache=function(t){this.cachedSearches.push(t)},e.isCached=function(t){return-1!==this.cachedSearches.indexOf(t)},t}(),We=function(t){function e(e){return void 0===e&&(e=[]),t.call(this,e)||this}Object(o.a)(e,t);var n=e.prototype;return n.getValue=function(){return void 0===this.value&&(this.value=this.getInitialSearch()||""),t.prototype.getValue.call(this)},n.clear=function(){t.prototype.clear.call(this),this.getInitialSearch()?this.clearInitialSearch():m.redraw()},n.stickyParams=function(){return{sort:m.route.param("sort"),q:m.route.param("q")}},n.params=function(){var t=this.stickyParams();return t.filter=m.route.param("filter"),t},n.changeSort=function(t){var e=this.params();t===Object.keys(app.discussions.sortMap())[0]?delete e.sort:e.sort=t,Object(c.a)(app.route(app.current.get("routeName"),e))},n.getInitialSearch=function(){return app.current.type&&app.current.type.providesInitialSearch&&this.params().q},n.clearInitialSearch=function(){var t=this.params();delete t.q,Object(c.a)(app.route(app.current.get("routeName"),t))},e}(ze);var Ve=function(t){function e(){var e;return e=t.call(this)||this,Object(s.a)(Object(r.a)(e),"notificationComponents",{discussionRenamed:ee}),Object(s.a)(Object(r.a)(e),"postComponents",{comment:ye,discussionRenamed:Ne}),Object(s.a)(Object(r.a)(e),"pane",null),Object(s.a)(Object(r.a)(e),"drawer",null),Object(s.a)(Object(r.a)(e),"history",new u),Object(s.a)(Object(r.a)(e),"notifications",new qe(Object(r.a)(e))),Object(s.a)(Object(r.a)(e),"search",new We),Object(s.a)(Object(r.a)(e),"composer",new Qt),Re(Object(r.a)(e)),e.discussions=new je({},Object(r.a)(e)),e}Object(o.a)(e,t);var n=e.prototype;return n.mount=function(){var e=this,n=this.forum.attribute("defaultRoute"),i="index";for(var r in this.routes)this.routes[r].path===n&&(i=r);this.routes[i].path="/",this.history.push(i,this.translator.trans("core.forum.header.back_to_index_tooltip"),"/"),this.pane=new l(document.getElementById("app")),m.route.prefix="",t.prototype.mount.call(this,this.forum.attribute("basePath")),m.mount(document.getElementById("app-navigation"),{view:function(){return Fe.a.component({className:"App-backControl",drawer:!0})}}),m.mount(document.getElementById("header-navigation"),Fe.a),m.mount(document.getElementById("header-primary"),Lt),m.mount(document.getElementById("header-secondary"),Kt),m.mount(document.getElementById("composer"),{view:function(){return Zt.component({state:e.composer})}}),He(this),$("#home-link").click((function(t){t.ctrlKey||t.metaKey||2===t.which||(t.preventDefault(),app.history.home(),app.session.user&&(app.store.find("users",app.session.user.id()),m.redraw()))})),"ontouchstart"in window&&navigator.vendor&&navigator.vendor.includes("Apple")&&navigator.userAgent&&!navigator.userAgent.includes("CriOS")&&!navigator.userAgent.includes("FxiOS")&&$((function(){$(".App").addClass("mobile-safari")}))},n.viewingDiscussion=function(t){return this.current.matches(Mt,{discussion:t})},n.authenticationComplete=function(t){t.loggedIn?window.location.reload():this.modal.show(H,t)},e}(Ue.a),Ye=n(102),Ke=function(t){function e(){return t.apply(this,arguments)||this}return Object(o.a)(e,t),e.initAttrs=function(e){e.className=(e.className||"")+" LogInButton",e.onclick=function(){var t=$(window);window.open(app.forum.attribute("baseUrl")+e.path,"logInPopup","width=580,height=400,top="+(t.height()/2-200)+",left="+(t.width()/2-290)+",status=no,scrollbars=yes,resizable=no")},t.initAttrs.call(this,e)},e}(P.a),Ge=n(85),Xe=function(t){function e(){return t.apply(this,arguments)||this}return Object(o.a)(e,t),e.prototype.view=function(){var t=this.attrs.post,e=t.user(),n=Object(y.a)(t.contentPlain(),this.attrs.highlight,300);return m(g.a,{className:"PostPreview",href:app.route.post(t),onclick:this.attrs.onclick},m("span",{className:"PostPreview-content"},Object(b.a)(e),Object(ht.a)(e)," ",m("span",{className:"PostPreview-excerpt"},n)))},e}(h.a),Je=function(){function t(){}var e=t.prototype;return e.search=function(){},e.view=function(){},t}(),Qe=n(40),Ze=Object(a.a)(Ye.a,{"utils/PostControls":re,"utils/KeyboardNavigatable":zt,"utils/slidable":W,"utils/History":u,"utils/DiscussionControls":z,"utils/alertEmailConfirmation":He,"utils/UserControls":de,"utils/Pane":l,"utils/BasicEditorDriver":Qe.a,"utils/SuperTextarea":Qe.a,"states/ComposerState":Qt,"states/DiscussionListState":je,"states/GlobalSearchState":We,"states/NotificationListState":qe,"states/PostStreamState":It,"states/SearchState":ze,"components/AffixedSidebar":ue,"components/DiscussionPage":Mt,"components/DiscussionListPane":lt,"components/LogInModal":U,"components/ComposerBody":E,"components/ForgotPasswordModal":R,"components/Notification":te,"components/LogInButton":Ke,"components/DiscussionsUserPage":Se,"components/Composer":Zt,"components/SessionDropdown":Bt,"components/HeaderPrimary":Lt,"components/PostEdited":be,"components/PostStream":vt,"components/ChangePasswordModal":$e,"components/IndexPage":Te,"components/DiscussionRenamedNotification":ee,"components/DiscussionsSearchSource":Wt,"components/HeaderSecondary":Kt,"components/ComposerButton":Gt,"components/DiscussionList":ct,"components/ReplyPlaceholder":mt,"components/TextEditor":A.a,"components/TextEditorButton":Ge.a,"components/AvatarEditor":pe,"components/Post":oe,"components/SettingsPage":Ie,"components/TerminalPost":T,"components/ChangeEmailModal":_e,"components/NotificationsDropdown":qt,"components/UserPage":le,"components/PostUser":me,"components/UserCard":he,"components/UsersSearchSource":Vt,"components/NotificationGrid":De,"components/PostPreview":Xe,"components/EventPost":xe,"components/DiscussionHero":v,"components/PostMeta":ge,"components/EditUserModal":ce,"components/SearchSource":Je,"components/DiscussionRenamedPost":Ne,"components/DiscussionComposer":Oe,"components/LogInButtons":B,"components/NotificationList":Ft,"components/WelcomeHero":Ce,"components/SignUpModal":H,"components/CommentPost":ye,"components/ComposerPostPreview":ft,"components/ReplyComposer":I,"components/NotificationsPage":Me,"components/PostStreamScrubber":bt,"components/EditPostComposer":ie,"components/RenameDiscussionModal":q,"components/Search":Yt,"components/DiscussionListItem":st,"components/LoadingPost":pt,"components/PostsUserPage":ke,"resolvers/DiscussionPageResolver":Le,routes:Re,ForumApplication:Ve}),tn=n(69),en=new Ve;window.app=en,Ze.app=en;var nn=Object(tn.a)(Ze,"forum")}]); (function(){var HINT={};HINT.EMOTICONS_NOT_AFTER=0;HINT.LITEDOWN_DECODE_HTML_ENTITIES=0;HINT.PREG_HAS_PASSTHROUGH=!1;HINT.RULE_AUTO_CLOSE=1;HINT.RULE_AUTO_REOPEN=1;HINT.RULE_BREAK_PARAGRAPH=1;HINT.RULE_CREATE_PARAGRAPHS=1;HINT.RULE_DISABLE_AUTO_BR=1;HINT.RULE_ENABLE_AUTO_BR=1;HINT.RULE_IGNORE_TAGS=1;HINT.RULE_IGNORE_TEXT=1;HINT.RULE_IGNORE_WHITESPACE=1;HINT.RULE_IS_TRANSPARENT=1;HINT.RULE_PREVENT_BR=1;HINT.RULE_SUSPEND_AUTO_BR=1;HINT.RULE_TRIM_FIRST_LINE=1;HINT.attributeDefaultValue=0;HINT.closeAncestor=0;HINT.closeParent=1;HINT.createChild=1;HINT.fosterParent=1;HINT.hash=1;HINT.ignoreAttrs=1;HINT.namespaces=0;HINT.onRender=1;HINT.onUpdate=1;HINT.regexp=1;HINT.regexpLimit=1;HINT.requireAncestor=0;var o553403F9=[0];var oC06C5BF5=[8481];var oD363F9C5=[32551];var oF6AF222C=[32623];var o3C789569=[15661];var oB565876D={flags:2};var o939F1698={flags:514};var oA80287CC={flags:3089};var o1BC3EAF4={filterChain:[],required:!1};var o02D8DBB5={filterChain:[],required:!0};var oD4869BFF={"B":1,"C":1,"COLOR":1,"EM":1,"EMAIL":1,"I":1,"S":1,"SIZE":1,"STRONG":1,"U":1,"URL":1};var oDF43256F=[function(attrValue,attrName){return NumericFilter.filterUint(attrValue)}];var o118B31AC=function(tag,tagConfig){return filterAttributes(tag,tagConfig,registeredVars,logger)};var o1B4F5B52=[o118B31AC];var o75AB9259={filterChain:oDF43256F,required:!1};var o6CB0A318={filterChain:oDF43256F,required:!0};var oF307D35C={filterChain:[function(attrValue,attrName){return UrlFilter.filter(attrValue,registeredVars.urlConfig,logger)}],required:!0};var o1AF69066={closeParent:oD4869BFF,flags:268,fosterParent:oD4869BFF};var o8F52476D={allowed:oD363F9C5,attributes:{},bitNumber:2,filterChain:o1B4F5B52,nestingLimit:10,rules:{flags:0},tagLimit:5000};var o5B6ED7AA={allowed:oD363F9C5,attributes:{},bitNumber:2,filterChain:o1B4F5B52,nestingLimit:10,rules:oB565876D,tagLimit:5000};var oE13673F5={allowed:oD363F9C5,attributes:{},bitNumber:3,filterChain:o1B4F5B52,nestingLimit:10,rules:{closeParent:oD4869BFF,flags:260,fosterParent:oD4869BFF},tagLimit:5000};var xsl=("<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http:\/\/www.w3.org\/1999\/XSL\/Transform\"><xsl:output method=\"html\" encoding=\"utf-8\" indent=\"no\"\/><xsl:decimal-format decimal-separator=\".\"\/><xsl:param$kDISCUSSION_URL\">http:\/\/192.168.33.10\/d\/<\/xsl:param><xsl:param$kPROFILE_URL\">http:\/\/192.168.33.10\/u\/<\/xsl:param>$aB|DEL|EM|H1|H2|H3|H4|H5|H6|I|LI|S|STRONG|SUB|SUP|U|p\"><xsl:element$k{translate(name(),'BDEGHILMNOPRSTU','bdeghilmnoprstu')}\">$b<\/xsl:element>$c$aC\"><code>$b<\/code>$c$aCENTER\"><div$itext-align:center\">$b<\/div>$c$aCODE\"><pre data-s9e-livepreview-hash=\"\" data-s9e-livepreview-onupdate=\"if(typeof hljsLoader!=='undefined')hljsLoader.highlightBlocks(this)\"><code><xsl:if$e@lang\"><xsl:attribute$kclass\">language-$d@lang\"\/><\/xsl:attribute><\/xsl:if>$b<\/code><script async=\"\" crossorigin=\"anonymous\" data-hljs-style=\"github-gist\" data-s9e-livepreview-onrender=\"if(typeof hljsLoader!=='undefined')this.parentNode.removeChild(this)\" integrity=\"sha384-Zfy9yY0HoZgx1o+Wwpq3DNS175QjdzWikhpgByq7JX5QvCeOu7lUDfJx2HUMt++k\" onload=\"hljsLoader.highlightBlocks(this.parentNode)\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/s9e\/hljs-loader@1.0.21\/loader.min.js\"\/><\/pre>$c$aCOLOR\"><span$icolor:{@color}\">$b<\/span>$c$aE\"><xsl:choose><$f$e.=':)'\">\ud83d\ude42<\/$f><$f$e.=':D'\">\ud83d\ude03<\/$f><$f$e.=':P'\">\ud83d\ude1b<\/$f><$f$e.=':('\">\ud83d\ude41<\/$f><$f$e.=':|'\">\ud83d\ude10<\/$f><$f$e.=';)'\">\ud83d\ude09<\/$f><$f$e.=&quot;:'(&quot;\">\ud83d\ude22<\/$f><$f$e.=':O'\">\ud83d\ude2e<\/$f><$f$e.='&gt;:('\">\ud83d\ude21<\/$f><xsl:otherwise>$d.\"\/><\/xsl:otherwise><\/xsl:choose>$c$aEMAIL\"><a href=\"mailto:{@email}\">$b<\/a>$c$aESC\">$b$c$aHR\"><hr\/>$c$aIMG\"><img src=\"{@src}\" title=\"{@title}\" alt=\"{@alt}\">$gheight|@width\"\/><\/img>$c$aISPOILER\"><span$lspoiler\"$hclass\" onclick=\"removeAttribute('class')\">$b<\/span>$c$aLIST\"><xsl:choose><$f$enot(@type)\"><ul>$b<\/ul><\/$f><$f$estarts-with(@type,'decimal')or starts-with(@type,'lower')or starts-with(@type,'upper')\"><ol$i$j>$gstart\"\/>$b<\/ol><\/$f><xsl:otherwise><ul$i$j>$b<\/ul><\/xsl:otherwise><\/xsl:choose>$c$aPOSTMENTION\"><a href=\"{$DISCUSSION_URL}{@discussionid}\/{@number}"+"\"$lPostMention\" data-id=\"{@id}\">$d@displayname\"\/><\/a>$c$aQUOTE\"><blockquote><xsl:if$enot(@author)\"><xsl:attribute$kclass\">uncited<\/xsl:attribute><\/xsl:if><div><xsl:if$e@author\"><cite>$d@author\"\/> wrote:<\/cite><\/xsl:if>$b<\/div><\/blockquote>$c$aSIZE\"><span$ifont-size:{@size}px\">$b<\/span>$c$aSPOILER\"><details$lspoiler\"$hopen\">$b<\/details>$c$aURL\"><a href=\"{@url}\" rel=\" nofollow ugc\">$gtitle\"\/>$b<\/a>$c$aUSERMENTION\"><a href=\"{$PROFILE_URL}{@username}\"$lUserMention\">@$d@displayname\"\/><\/a>$c$abr\"><br\/>$c$ae|i|s\"\/><\/xsl:stylesheet>").replace(/\$[a-l]/g,function(k){return{"$a":"<xsl:template match=\"","$b":"<xsl:apply-templates\/>","$c":"<\/xsl:template>","$d":"<xsl:value-of select=\"","$e":" test=\"","$f":"xsl:when","$g":"<xsl:copy-of select=\"@","$h":" data-s9e-livepreview-ignore-attrs=\"","$i":" style=\"","$j":"list-style-type:{@type}\"","$k":" name=\"","$l":" class=\""}[k]});var EmailFilter={filter:function(attrValue){return/^[-\w.+]+@[-\w.]+$/.test(attrValue)?attrValue:!1}};var FalseFilter={filter:function(attrValue){return!1}};var HashmapFilter={filter:function(attrValue,map,strict){if(attrValue in map){return map[attrValue]} return(strict)?!1:attrValue}};var MapFilter={filter:function(attrValue,map){var i=-1,cnt=map.length;while(++i<cnt){if(map[i][0].test(attrValue)){return map[i][1]}} return attrValue}};var NetworkFilter={filterIp:function(attrValue){if(/^[\d.]+$/.test(attrValue)){return NetworkFilter.filterIpv4(attrValue)} if(/^[\da-f:]+$/i.test(attrValue)){return NetworkFilter.filterIpv6(attrValue)} return!1},filterIpport:function(attrValue){var m,ip;if(m=/^\[([\da-f:]+)(\]:[1-9]\d*)$/i.exec(attrValue)){ip=NetworkFilter.filterIpv6(m[1]);if(ip===!1){return!1} return'['+ip+m[2]} if(m=/^([\d.]+)(:[1-9]\d*)$/.exec(attrValue)){ip=NetworkFilter.filterIpv4(m[1]);if(ip===!1){return!1} return ip+m[2]} return!1},filterIpv4:function(attrValue){if(!/^\d+\.\d+\.\d+\.\d+$/.test(attrValue)){return!1} var i=4,p=attrValue.split('.');while(--i>=0){if(p[i][0]==='0'||p[i]>255){return!1}} return attrValue},filterIpv6:function(attrValue){return/^([\da-f]{0,4}:){2,7}(?:[\da-f]{0,4}|\d+\.\d+\.\d+\.\d+)$/.test(attrValue)?attrValue:!1}};var NumericFilter={filterFloat:function(attrValue){return/^(?:0|-?[1-9]\d*)(?:\.\d+)?(?:e[1-9]\d*)?$/i.test(attrValue)?attrValue:!1},filterInt:function(attrValue){return/^(?:0|-?[1-9]\d*)$/.test(attrValue)?attrValue:!1},filterRange:function(attrValue,min,max,logger){if(!/^(?:0|-?[1-9]\d*)$/.test(attrValue)){return!1} attrValue=parseInt(attrValue,10);if(attrValue<min){if(logger){logger.warn('Value outside of range, adjusted up to min value',{'attrValue':attrValue,'min':min,'max':max})} return min} if(attrValue>max){if(logger){logger.warn('Value outside of range, adjusted down to max value',{'attrValue':attrValue,'min':min,'max':max})} return max} return attrValue},filterUint:function(attrValue){return/^(?:0|[1-9]\d*)$/.test(attrValue)?attrValue:!1}};var RegexpFilter={filter:function(attrValue,regexp){return regexp.test(attrValue)?attrValue:!1}};var TimestampFilter={filter:function(attrValue){var m=/^(?=\d)(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/.exec(attrValue);if(m){return 3600*(m[1]||0)+60*(m[2]||0)+(+m[3]||0)} return NumericFilter.filterUint(attrValue)}};var UrlFilter={filter:function(attrValue,urlConfig,logger){var p=UrlFilter.parseUrl(attrValue.replace(/^\s+/,'').replace(/\s+$/,''));var error=UrlFilter.validateUrl(urlConfig,p);if(error){if(logger){p.attrValue=attrValue;logger.err(error,p)} return!1} return UrlFilter.rebuildUrl(urlConfig,p)},parseUrl:function(url){var regexp=/^(?:([a-z][-+.\w]*):)?(?:\/\/(?:([^:\/?#]*)(?::([^\/?#]*)?)?@)?(?:(\[[a-f\d:]+\]|[^:\/?#]+)(?::(\d*))?)?(?![^\/?#]))?([^?#]*)(\?[^#]*)?(#.*)?$/i;var m=regexp.exec(url),parts={},tokens=['scheme','user','pass','host','port','path','query','fragment'];tokens.forEach(function(name,i){parts[name]=(m[i+1]>'')?m[i+1]:''});parts.scheme=parts.scheme.toLowerCase();parts.host=parts.host.replace(/[\u3002\uff0e\uff61]/g,'.').replace(/\.+$/g,'');if(/[^\x00-\x7F]/.test(parts.host)&&typeof punycode!=='undefined'){parts.host=punycode.toASCII(parts.host)} return parts},rebuildUrl:function(urlConfig,p){var url='';if(p.scheme!==''){url+=p.scheme+':'} if(p.host!==''){url+='//';if(p.user!==''){url+=rawurlencode(decodeURIComponent(p.user));if(p.pass!==''){url+=':'+rawurlencode(decodeURIComponent(p.pass))} url+='@'} url+=p.host;if(p.port!==''){url+=':'+p.port}}else if(p.scheme==='file'){url+='//'} var path=p.path+p.query+p.fragment;path=path.replace(/%.?[a-f]/g,function(str){return str.toUpperCase()},path);url+=UrlFilter.sanitizeUrl(path);if(!p.scheme){url=url.replace(/^([^\/]*):/,'$1%3A')} return url},sanitizeUrl:function(url){return url.replace(/[^\u0020-\u007E]+/g,encodeURIComponent).replace(/%(?![0-9A-Fa-f]{2})|[^!#-&*-;=?-Z_a-z~]/g,escape)},validateUrl:function(urlConfig,p){if(p.scheme!==''&&!urlConfig.allowedSchemes.test(p.scheme)){return'URL scheme is not allowed'} if(p.host!==''){var regexp=/^(?!-)[-a-z0-9]{0,62}[a-z0-9](?:\.(?!-)[-a-z0-9]{0,62}[a-z0-9])*$/i;if(!regexp.test(p.host)){if(!NetworkFilter.filterIpv4(p.host)&&!NetworkFilter.filterIpv6(p.host.replace(/^\[(.*)\]$/,'$1',p.host))){return'URL host is invalid'}} if((urlConfig.disallowedHosts&&urlConfig.disallowedHosts.test(p.host))||(urlConfig.restrictedHosts&&!urlConfig.restrictedHosts.test(p.host))){return'URL host is not allowed'}}else if(/^(?:(?:f|ht)tps?)$/.test(p.scheme)){return'Missing host'}}};function html_entity_decode(str){var b=document.createElement('b');html_entity_decode=function(str){b.innerHTML=str.replace(/</g,'&lt;');return b.textContent};return html_entity_decode(str)} function htmlspecialchars_compat(str){var t={'<':'&lt;','>':'&gt;','&':'&amp;','"':'&quot;'};return str.replace(/[<>&"]/g,function(c){return t[c]})} function htmlspecialchars_noquotes(str){var t={'<':'&lt;','>':'&gt;','&':'&amp;'};return str.replace(/[<>&]/g,function(c){return t[c]})} function rawurlencode(str){return encodeURIComponent(str).replace(/[!'()*]/g,function(c){return'%'+c.charCodeAt(0).toString(16).toUpperCase()})} function returnFalse(){return!1} function returnTrue(){return!0} function executeAttributePreprocessors(tag,tagConfig){if(typeof tagConfig.attributePreprocessors==='undefined'){return} tagConfig.attributePreprocessors.forEach(function(ap){var attrName=ap[0],regexp=ap[1],map=ap[2];if(tag.hasAttribute(attrName)){executeAttributePreprocessor(tag,attrName,regexp,map)}})} function filterAttributes(tag,tagConfig,registeredVars,logger){var attributes={},attrName;for(attrName in tagConfig.attributes){var attrConfig=tagConfig.attributes[attrName],attrValue=!1;if(tag.hasAttribute(attrName)){attrValue=executeAttributeFilterChain(attrConfig.filterChain,attrName,tag.getAttribute(attrName))} if(attrValue!==!1){attributes[attrName]=attrValue}else if(HINT.attributeDefaultValue&&typeof attrConfig.defaultValue!=='undefined'){attributes[attrName]=attrConfig.defaultValue}else if(attrConfig.required){tag.invalidate()}} tag.setAttributes(attributes)} function filterTag(tag){var tagName=tag.getName(),tagConfig=tagsConfig[tagName];logger.setTag(tag);for(var i=0;i<tagConfig.filterChain.length;++i){if(tag.isInvalid()){break} tagConfig.filterChain[i](tag,tagConfig)} logger.unsetTag()} function executeAttributeFilterChain(filterChain,attrName,attrValue){logger.setAttribute(attrName);for(var i=0;i<filterChain.length;++i){attrValue=filterChain[i](attrValue,attrName);if(attrValue===!1){break}} logger.unsetAttribute();return attrValue} function executeAttributePreprocessor(tag,attrName,regexp,map){var attrValue=tag.getAttribute(attrName),captures=getNamedCaptures(attrValue,regexp,map),k;for(k in captures){if(k===attrName||!tag.hasAttribute(k)){tag.setAttribute(k,captures[k])}}} function getNamedCaptures(attrValue,regexp,map){var m=regexp.exec(attrValue);if(!m){return[]} var values={};map.forEach(function(k,i){if(typeof m[i]==='string'&&m[i]!==''){values[k]=m[i]}});return values} function Logger(){}Logger.prototype={add:function(type,msg,context){},clear:function(){},setAttribute:function(attrName){},setTag:function(tag){},unsetAttribute:function(){},unsetTag:function(){},debug:function(msg,context){},err:function(msg,context){},info:function(msg,context){},warn:function(msg,context){}};function Tag(type,name,pos,len,priority){this.type=+type;this.name=name;this.pos=+pos;this.len=+len;this.sortPriority=+priority||0;this.attributes={};this.cascade=[];if(isNaN(type+pos+len)){this.invalidate()}} Tag.START_TAG=1;Tag.END_TAG=2;Tag.SELF_CLOSING_TAG=3;Tag.prototype.attributes;Tag.prototype.cascade;Tag.prototype.endTag;Tag.prototype.invalid=!1;Tag.prototype.len;Tag.prototype.name;Tag.prototype.pos;Tag.prototype.sortPriority;Tag.prototype.startTag;Tag.prototype.type;Tag.prototype.addFlags=function(flags){this.flags|=flags};Tag.prototype.cascadeInvalidationTo=function(tag){this.cascade.push(tag);if(this.invalid){tag.invalidate()}};Tag.prototype.invalidate=function(){if(!this.invalid){this.invalid=!0;this.cascade.forEach(function(tag){tag.invalidate()})}};Tag.prototype.pairWith=function(tag){if(this.canBePaired(this,tag)){this.endTag=tag;tag.startTag=this;this.cascadeInvalidationTo(tag)}else if(this.canBePaired(tag,this)){this.startTag=tag;tag.endTag=this}};Tag.prototype.canBePaired=function(startTag,endTag){return startTag.name===endTag.name&&startTag.type===Tag.START_TAG&&endTag.type===Tag.END_TAG&&startTag.pos<=startTag.pos};Tag.prototype.removeFlags=function(flags){this.flags&=~flags};Tag.prototype.setFlags=function(flags){this.flags=flags};Tag.prototype.getAttributes=function(){var attributes={};for(var attrName in this.attributes){attributes[attrName]=this.attributes[attrName]} return attributes};Tag.prototype.getEndTag=function(){return this.endTag};Tag.prototype.getFlags=function(){return this.flags};Tag.prototype.getLen=function(){return this.len};Tag.prototype.getName=function(){return this.name};Tag.prototype.getPos=function(){return this.pos};Tag.prototype.getSortPriority=function(){return this.sortPriority};Tag.prototype.getStartTag=function(){return this.startTag};Tag.prototype.getType=function(){return this.type};Tag.prototype.canClose=function(startTag){if(this.invalid||!this.canBePaired(startTag,this)||(this.startTag&&this.startTag!==startTag)||(startTag.endTag&&startTag.endTag!==this)){return!1} return!0};Tag.prototype.isBrTag=function(){return(this.name==='br')};Tag.prototype.isEndTag=function(){return!!(this.type&Tag.END_TAG)};Tag.prototype.isIgnoreTag=function(){return(this.name==='i')};Tag.prototype.isInvalid=function(){return this.invalid};Tag.prototype.isParagraphBreak=function(){return(this.name==='pb')};Tag.prototype.isSelfClosingTag=function(){return(this.type===Tag.SELF_CLOSING_TAG)};Tag.prototype.isSystemTag=function(){return('br i pb v'.indexOf(this.name)>-1)};Tag.prototype.isStartTag=function(){return!!(this.type&Tag.START_TAG)};Tag.prototype.isVerbatim=function(){return(this.name==='v')};Tag.prototype.getAttribute=function(attrName){return this.attributes[attrName]};Tag.prototype.hasAttribute=function(attrName){return(attrName in this.attributes)};Tag.prototype.removeAttribute=function(attrName){delete this.attributes[attrName]};Tag.prototype.setAttribute=function(attrName,attrValue){this.attributes[attrName]=attrValue};Tag.prototype.setAttributes=function(attributes){this.attributes={};for(var attrName in attributes){this.attributes[attrName]=attributes[attrName]}};var RULE_AUTO_CLOSE=1<<0;var RULE_AUTO_REOPEN=1<<1;var RULE_BREAK_PARAGRAPH=1<<2;var RULE_CREATE_PARAGRAPHS=1<<3;var RULE_DISABLE_AUTO_BR=1<<4;var RULE_ENABLE_AUTO_BR=1<<5;var RULE_IGNORE_TAGS=1<<6;var RULE_IGNORE_TEXT=1<<7;var RULE_IGNORE_WHITESPACE=1<<8;var RULE_IS_TRANSPARENT=1<<9;var RULE_PREVENT_BR=1<<10;var RULE_SUSPEND_AUTO_BR=1<<11;var RULE_TRIM_FIRST_LINE=1<<12;var RULES_AUTO_LINEBREAKS=RULE_DISABLE_AUTO_BR|RULE_ENABLE_AUTO_BR|RULE_SUSPEND_AUTO_BR;var RULES_INHERITANCE=RULE_ENABLE_AUTO_BR;var WHITESPACE=" \n\t";var cntOpen;var cntTotal;var context;var currentFixingCost;var currentTag;var isRich;var logger=new Logger;var maxFixingCost=10000;var namespaces;var openTags;var output;var plugins={"Autoemail":{parser:function(text,matches){var config={attrName:"email",tagName:"EMAIL"};var tagName=config.tagName,attrName=config.attrName;matches.forEach(function(m){var startTag=addStartTag(tagName,m[0][1],0);startTag.setAttribute(attrName,m[0][0]);var endTag=addEndTag(tagName,m[0][1]+m[0][0].length,0);startTag.pairWith(endTag)})},quickMatch:"@",regexp:/\b[-a-z0-9_+.]+@[-a-z0-9.]*[a-z0-9]/ig,regexpLimit:50000},"Autolink":{parser:function(text,matches){var config={attrName:"url",tagName:"URL"};matches.forEach(function(m){linkifyUrl(m[0][1],trimUrl(m[0][0]))});function linkifyUrl(tagPos,url){var endPos=tagPos+url.length,endTag=addEndTag(config.tagName,endPos,0);if(url[3]==='.'){url='http://'+url} var startTag=addStartTag(config.tagName,tagPos,0,1);startTag.setAttribute(config.attrName,url);startTag.pairWith(endTag);var contentTag=addVerbatim(tagPos,endPos-tagPos,1000);startTag.cascadeInvalidationTo(contentTag)} function trimUrl(url){return url.replace(/(?:(?![-=)\/_])[\s!-.:-@[-`{-~])+$/,'')}},quickMatch:":",regexp:/\bhttps?:(?:[^\s()\[\]\uFF01-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65]|\([^\s()]*\)|\[\w*\])+/ig,regexpLimit:50000},"BBCodes":{parser:function(text,matches){var config={bbcodes:{"*":{tagName:"LI"},"B":[],"CENTER":[],"CODE":{defaultAttribute:"lang"},"COLOR":[],"DEL":[],"EMAIL":{contentAttributes:["email"]},"I":[],"IMG":{contentAttributes:["src"],defaultAttribute:"src"},"LIST":{defaultAttribute:"type"},"QUOTE":{defaultAttribute:"author"},"S":[],"SIZE":[],"U":[],"URL":{contentAttributes:["url"]}}};var attributes;var bbcodeConfig;var bbcodeName;var bbcodeSuffix;var pos;var startPos;var textLen=text.length;var uppercaseText='';matches.forEach(function(m){bbcodeName=m[1][0].toUpperCase();if(!(bbcodeName in config.bbcodes)){return} bbcodeConfig=config.bbcodes[bbcodeName];startPos=m[0][1];pos=startPos+m[0][0].length;try {parseBBCode()}catch(e){}});function addBBCodeEndTag(){return addEndTag(getTagName(),startPos,pos-startPos)} function addBBCodeSelfClosingTag(){var tag=addSelfClosingTag(getTagName(),startPos,pos-startPos);tag.setAttributes(attributes);return tag} function addBBCodeStartTag(){var tag=addStartTag(getTagName(),startPos,pos-startPos);tag.setAttributes(attributes);return tag} function captureEndTag(){if(!uppercaseText){uppercaseText=text.toUpperCase()} var match='[/'+bbcodeName+bbcodeSuffix+']',endTagPos=uppercaseText.indexOf(match,pos);if(endTagPos<0){return null} return addEndTag(getTagName(),endTagPos,match.length)} function getTagName(){return bbcodeConfig.tagName||bbcodeName} function parseAttributes(){var firstPos=pos,attrName;attributes={};while(pos<textLen){var c=text[pos];if(" \n\t".indexOf(c)>-1){++pos;continue} if('/]'.indexOf(c)>-1){return} var spn=/^[-\w]*/.exec(text.substr(pos,100))[0].length;if(spn){attrName=text.substr(pos,spn).toLowerCase();pos+=spn;if(pos>=textLen){throw ''} if(text[pos]!=='='){continue}}else if(c==='='&&pos===firstPos){attrName=bbcodeConfig.defaultAttribute||bbcodeName.toLowerCase()}else{throw ''} if(++pos>=textLen){throw ''} attributes[attrName]=parseAttributeValue()}} function parseAttributeValue(){if(text[pos]==='"'||text[pos]==="'"){return parseQuotedAttributeValue()} var match=/(?:[^\s\]]|[ \t](?!\s*(?:[-\w]+=|\/?\])))*/.exec(text.substr(pos)),attrValue=match[0];pos+=attrValue.length;return attrValue} function parseBBCode(){parseBBCodeSuffix();if(text[startPos+1]==='/'){if(text[pos]===']'&&bbcodeSuffix===''){++pos;addBBCodeEndTag()} return} parseAttributes();if(bbcodeConfig.predefinedAttributes){for(var attrName in bbcodeConfig.predefinedAttributes){if(!(attrName in attributes)){attributes[attrName]=bbcodeConfig.predefinedAttributes[attrName]}}} if(text[pos]===']'){++pos}else{if(text.substr(pos,2)==='/]'){pos+=2;addBBCodeSelfClosingTag()} return} var contentAttributes=[];if(bbcodeConfig.contentAttributes){bbcodeConfig.contentAttributes.forEach(function(attrName){if(!(attrName in attributes)){contentAttributes.push(attrName)}})} var requireEndTag=(bbcodeSuffix||bbcodeConfig.forceLookahead),endTag=(requireEndTag||contentAttributes.length)?captureEndTag():null;if(endTag){contentAttributes.forEach(function(attrName){attributes[attrName]=text.substr(pos,endTag.getPos()-pos)})}else if(requireEndTag){return} var tag=addBBCodeStartTag();if(endTag){tag.pairWith(endTag)}} function parseBBCodeSuffix(){bbcodeSuffix='';if(text[pos]===':'){bbcodeSuffix=/^:\d*/.exec(text.substr(pos))[0];pos+=bbcodeSuffix.length}} function parseQuotedAttributeValue(){var quote=text[pos],valuePos=pos+1;do{pos=text.indexOf(quote,pos+1);if(pos<0){throw ''} var n=1;while(text[pos-n]==='\\'){++n}} while(n%2===0);var attrValue=text.substr(valuePos,pos-valuePos);if(attrValue.indexOf('\\')>-1){attrValue=attrValue.replace(/\\([\\'"])/g,'$1')} ++pos;return attrValue}},quickMatch:"[",regexp:/\[\/?(\*|[-\w]+)(?=[\]\s=:\/])/g,regexpLimit:50000},"Emoticons":{parser:function(text,matches){var config={tagName:"E"};matches.forEach(function(m){if(HINT.EMOTICONS_NOT_AFTER&&config.notAfter&&m[0][1]&&config.notAfter.test(text[m[0][1]-1])){return} addSelfClosingTag(config.tagName,m[0][1],m[0][0].length)})},regexp:/(?::(?:[()DOP|]|'\()|;\)|>:\()/g,regexpLimit:50000},"Escaper":{parser:function(text,matches){var config={tagName:"ESC"};matches.forEach(function(m){addTagPair(config.tagName,m[0][1],1,m[0][1]+m[0][0].length,0)})},quickMatch:"\\",regexp:/\\[-!#()*+.:<>@[\\\]^_`{|}~]/g,regexpLimit:50000},"Litedown":{parser:function(text,matches){var config={decodeHtmlEntities:!1};var decodeHtmlEntities=config.decodeHtmlEntities;var hasEscapedChars=!1;var hasReferences=!1;var linkReferences={};if(text.indexOf('\\')>=0){hasEscapedChars=!0;text=text.replace(/\\[!"'()*<>[\\\]^_`~]/g,function(str){return{'\\!':"\x1B0",'\\"':"\x1B1","\\'":"\x1B2",'\\(':"\x1B3",'\\)':"\x1B4",'\\*':"\x1B5",'\\<':"\x1B6",'\\>':"\x1B7",'\\[':"\x1B8",'\\\\':"\x1B9",'\\]':"\x1BA",'\\^':"\x1BB",'\\_':"\x1BC",'\\`':"\x1BD",'\\~':"\x1BE"}[str]})} text+="\n\n\x17";function decode(str){if(HINT.LITEDOWN_DECODE_HTML_ENTITIES&&decodeHtmlEntities&&str.indexOf('&')>-1){str=html_entity_decode(str)} str=str.replace(/\x1A/g,'');if(hasEscapedChars){str=str.replace(/\x1B./g,function(seq){return{"\x1B0":'!',"\x1B1":'"',"\x1B2":"'","\x1B3":'(',"\x1B4":')',"\x1B5":'*',"\x1B6":'<',"\x1B7":'>',"\x1B8":'[',"\x1B9":'\\',"\x1BA":']',"\x1BB":'^',"\x1BC":'_',"\x1BD":'`',"\x1BE":'~'}[seq]})} return str} function isAfterWhitespace(pos){return(pos>0&&isWhitespace(text.charAt(pos-1)))} function isAlnum(chr){return(' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.indexOf(chr)>0)} function isBeforeWhitespace(pos){return isWhitespace(text[pos+1])} function isSurroundedByAlnum(pos,len){return(pos>0&&isAlnum(text[pos-1])&&isAlnum(text[pos+len]))} function isWhitespace(chr){return(" \n\t".indexOf(chr)>-1)} function markBoundary(pos){text=text.substr(0,pos)+"\x17"+text.substr(pos+1)} function overwrite(pos,len){if(len>0){text=text.substr(0,pos)+new Array(1+len).join("\x1A")+text.substr(pos+len)}} function parseInlineMarkup(str,regexp,tagName){if(text.indexOf(str)===-1){return} var m;while(m=regexp.exec(text)){var match=m[0],matchPos=m.index,matchLen=match.length,endPos=matchPos+matchLen-2;addTagPair(tagName,matchPos,2,endPos,2);overwrite(matchPos,2);overwrite(endPos,2)}} function parseAbstractScript(tagName,syntaxChar,shortRegexp,longRegexp){var pos=text.indexOf(syntaxChar);if(pos===-1){return} parseShortForm(pos);parseLongForm(pos);function parseLongForm(pos){pos=text.indexOf(syntaxChar+'(',pos);if(pos===-1){return} var m,regexp=longRegexp;regexp.lastIndex=pos;while(m=regexp.exec(text)){var match=m[0],matchPos=m.index,matchLen=match.length;addTagPair(tagName,matchPos,2,matchPos+matchLen-1,1);overwrite(matchPos,matchLen)} if(match){parseLongForm(pos)}} function parseShortForm(pos){var m,regexp=shortRegexp;regexp.lastIndex=pos;while(m=regexp.exec(text)){var match=m[0],matchPos=m.index,matchLen=match.length,startPos=matchPos,endLen=(match.substr(-1)===syntaxChar)?1:0,endPos=matchPos+matchLen-endLen;addTagPair(tagName,startPos,1,endPos,endLen)}}} function setLinkAttributes(tag,linkInfo,attrName){var url=linkInfo.replace(/^\s*/,'').replace(/\s*$/,''),title='',pos=url.indexOf(' ');if(pos!==-1){title=url.substr(pos).replace(/^\s*\S/,'').replace(/\S\s*$/,'');url=url.substr(0,pos)} if(/^<.+>$/.test(url)){url=url.replace(/^<(.+)>$/,'$1').replace(/\\>/g,'>')} tag.setAttribute(attrName,decode(url));if(title>''){tag.setAttribute('title',decode(title))}}(function(){var setextLines={};function parse(){matchSetextLines();var blocks=[],blocksCnt=0,codeFence,codeIndent=4,codeTag,lineIsEmpty=!0,lists=[],listsCnt=0,newContext=!1,textBoundary=0,breakParagraph,continuation,ignoreLen,indentStr,indentLen,lfPos,listIndex,maxIndent,minIndent,blockDepth,tagPos,tagLen;var matches=[],m,regexp=/^(?:(?=[-*+\d \t>`~#_])((?: {0,3}>(?:(?!!)|!(?![^\n>]*?!<)) ?)+)?([ \t]+)?(\* *\* *\*[* ]*$|- *- *-[- ]*$|_ *_ *_[_ ]*$)?((?:[-*+]|\d+\.)[ \t]+(?=\S))?[ \t]*(#{1,6}[ \t]+|```+[^`\n]*$|~~~+[^~\n]*$)?)?/gm;while(m=regexp.exec(text)){matches.push(m);if(m.index===regexp.lastIndex){++regexp.lastIndex}} matches.forEach(function(m){var blockMarks=[],matchPos=m.index,matchLen=m[0].length,startPos,startLen,endPos,endLen;ignoreLen=0;blockDepth=0;continuation=!lineIsEmpty;lfPos=text.indexOf("\n",matchPos);lineIsEmpty=(lfPos===matchPos+matchLen&&!m[3]&&!m[4]&&!m[5]);if(!matchLen){++regexp.lastIndex} breakParagraph=(lineIsEmpty&&continuation);if(m[1]){blockMarks=getBlockMarks(m[1]);blockDepth=blockMarks.length;ignoreLen=m[1].length;if(codeTag&&codeTag.hasAttribute('blockDepth')){blockDepth=Math.min(blockDepth,codeTag.getAttribute('blockDepth'));ignoreLen=computeBlockIgnoreLen(m[1],blockDepth)} overwrite(matchPos,ignoreLen)} if(blockDepth<blocksCnt&&!continuation){newContext=!0;do{var startTag=blocks.pop();addEndTag(startTag.getName(),textBoundary,0).pairWith(startTag)} while(blockDepth<--blocksCnt);} if(blockDepth>blocksCnt&&!lineIsEmpty){newContext=!0;do{var tagName=(blockMarks[blocksCnt]==='>!')?'SPOILER':'QUOTE';blocks.push(addStartTag(tagName,matchPos,0,-999))} while(blockDepth>++blocksCnt);} var indentWidth=0,indentPos=0;if(m[2]&&!codeFence){indentStr=m[2];indentLen=indentStr.length;do{if(indentStr[indentPos]===' '){++indentWidth}else{indentWidth=(indentWidth+4)&~3}} while(++indentPos<indentLen&&indentWidth<codeIndent);} if(codeTag&&!codeFence&&indentWidth<codeIndent&&!lineIsEmpty){newContext=!0} if(newContext){newContext=!1;if(codeTag){if(textBoundary>codeTag.getPos()){overwrite(codeTag.getPos(),textBoundary-codeTag.getPos());codeTag.pairWith(addEndTag('CODE',textBoundary,0,-1))}else{codeTag.invalidate()} codeTag=null;codeFence=null} lists.forEach(function(list){closeList(list,textBoundary)});lists=[];listsCnt=0;if(matchPos){markBoundary(matchPos-1)}} if(indentWidth>=codeIndent){if(codeTag||!continuation){ignoreLen=(m[1]||'').length+indentPos;if(!codeTag){codeTag=addStartTag('CODE',matchPos+ignoreLen,0,-999)} m={}}}else if(!codeTag){var hasListItem=!!m[4];if(!indentWidth&&!continuation&&!hasListItem){listIndex=-1}else if(continuation&&!hasListItem){listIndex=listsCnt-1}else if(!listsCnt){listIndex=(hasListItem)?0:-1}else{listIndex=0;while(listIndex<listsCnt&&indentWidth>lists[listIndex].maxIndent){++listIndex}} while(listIndex<listsCnt-1){closeList(lists.pop(),textBoundary);--listsCnt} if(listIndex===listsCnt&&!hasListItem){--listIndex} if(hasListItem&&listIndex>=0){breakParagraph=!0;tagPos=matchPos+ignoreLen+indentPos;tagLen=m[4].length;var itemTag=addStartTag('LI',tagPos,tagLen);overwrite(tagPos,tagLen);if(listIndex<listsCnt){addEndTag('LI',textBoundary,0).pairWith(lists[listIndex].itemTag);lists[listIndex].itemTag=itemTag;lists[listIndex].itemTags.push(itemTag)}else{++listsCnt;if(listIndex){minIndent=lists[listIndex-1].maxIndent+1;maxIndent=Math.max(minIndent,listIndex*4)}else{minIndent=0;maxIndent=indentWidth} var listTag=addStartTag('LIST',tagPos,0);if(m[4].indexOf('.')>-1){listTag.setAttribute('type','decimal');var start=+m[4];if(start!==1){listTag.setAttribute('start',start)}} lists.push({listTag:listTag,itemTag:itemTag,itemTags:[itemTag],minIndent:minIndent,maxIndent:maxIndent,tight:!0})}} if(listsCnt&&!continuation&&!lineIsEmpty){if(lists[0].itemTags.length>1||!hasListItem){lists.forEach(function(list){list.tight=!1})}} codeIndent=(listsCnt+1)*4} if(m[5]){if(m[5][0]==='#'){startLen=m[5].length;startPos=matchPos+matchLen-startLen;endLen=getAtxHeaderEndTagLen(matchPos+matchLen,lfPos);endPos=lfPos-endLen;addTagPair('H'+/#{1,6}/.exec(m[5])[0].length,startPos,startLen,endPos,endLen);markBoundary(startPos);markBoundary(lfPos);if(continuation){breakParagraph=!0}}else if(m[5][0]==='`'||m[5][0]==='~'){tagPos=matchPos+ignoreLen;tagLen=lfPos-tagPos;if(codeTag&&m[5]===codeFence){codeTag.pairWith(addEndTag('CODE',tagPos,tagLen,-1));addIgnoreTag(textBoundary,tagPos-textBoundary);overwrite(codeTag.getPos(),tagPos+tagLen-codeTag.getPos());codeTag=null;codeFence=null}else if(!codeTag){codeTag=addStartTag('CODE',tagPos,tagLen);codeFence=m[5].replace(/[^`~]+/,'');codeTag.setAttribute('blockDepth',blockDepth);addIgnoreTag(tagPos+tagLen,1);var lang=m[5].replace(/^[`~\s]*/,'').replace(/\s+$/,'');if(lang!==''){codeTag.setAttribute('lang',lang)}}}}else if(m[3]&&!listsCnt&&text[matchPos+matchLen]!=="\x17"){addSelfClosingTag('HR',matchPos+ignoreLen,matchLen-ignoreLen);breakParagraph=!0;markBoundary(lfPos)}else if(setextLines[lfPos]&&setextLines[lfPos].blockDepth===blockDepth&&!lineIsEmpty&&!listsCnt&&!codeTag){addTagPair(setextLines[lfPos].tagName,matchPos+ignoreLen,0,setextLines[lfPos].endPos,setextLines[lfPos].endLen);markBoundary(setextLines[lfPos].endPos+setextLines[lfPos].endLen)} if(breakParagraph){addParagraphBreak(textBoundary);markBoundary(textBoundary)} if(!lineIsEmpty){textBoundary=lfPos} if(ignoreLen){addIgnoreTag(matchPos,ignoreLen,1000)}})} function closeList(list,textBoundary){addEndTag('LIST',textBoundary,0).pairWith(list.listTag);addEndTag('LI',textBoundary,0).pairWith(list.itemTag);if(list.tight){list.itemTags.forEach(function(itemTag){itemTag.removeFlags(RULE_CREATE_PARAGRAPHS)})}} function computeBlockIgnoreLen(str,maxBlockDepth){var remaining=str;while(--maxBlockDepth>=0){remaining=remaining.replace(/^ *>!? ?/,'')} return str.length-remaining.length} function getAtxHeaderEndTagLen(startPos,endPos){var content=text.substr(startPos,endPos-startPos),m=/[ \t]*#*[ \t]*$/.exec(content);return m[0].length} function getBlockMarks(str){var blockMarks=[],regexp=/>!?/g,m;while(m=regexp.exec(str)){blockMarks.push(m[0])} return blockMarks} function matchSetextLines(){if(text.indexOf('-')===-1&&text.indexOf('=')===-1){return} var m,regexp=/^(?=[-=>])(?:>!? ?)*(?=[-=])(?:-+|=+) *$/gm;while(m=regexp.exec(text)){var match=m[0],matchPos=m.index;var endPos=matchPos-1;while(endPos>0&&text[endPos-1]===' '){--endPos} setextLines[matchPos-1]={endLen:matchPos+match.length-endPos,endPos:endPos,blockDepth:match.length-match.replace(/>/g,'').length,tagName:(match[0]==='=')?'H1':'H2'}}} parse()})();(function(){function parse(){if(text.indexOf(']:')<0){return} var m,regexp=/^\x1A* {0,3}\[([^\x17\]]+)\]: *([^[\s\x17]+ *(?:"[^\x17]*?"|'[^\x17]*?'|\([^\x17)]*\))?) *(?=$|\x17)\n?/gm;while(m=regexp.exec(text)){addIgnoreTag(m.index,m[0].length);var id=m[1].toLowerCase();if(!linkReferences[id]){hasReferences=!0;linkReferences[id]=m[2]}}} parse()})();(function(){function parse(){var markers=getInlineCodeMarkers(),i=-1,cnt=markers.length;while(++i<(cnt-1)){var pos=markers[i].next,j=i;if(text[markers[i].pos]!=='`'){++markers[i].pos;--markers[i].len} while(++j<cnt&&markers[j].pos===pos){if(markers[j].len===markers[i].len){addInlineCodeTags(markers[i],markers[j]);i=j;break} pos=markers[j].next}}} function addInlineCodeTags(left,right){var startPos=left.pos,startLen=left.len+left.trimAfter,endPos=right.pos-right.trimBefore,endLen=right.len+right.trimBefore;addTagPair('C',startPos,startLen,endPos,endLen);overwrite(startPos,endPos+endLen-startPos)} function getInlineCodeMarkers(){var pos=text.indexOf('`');if(pos<0){return[]} var regexp=/(`+)(\s*)[^\x17`]*/g,trimNext=0,markers=[],_text=text.replace(/\x1BD/g,'\\`'),m;regexp.lastIndex=pos;while(m=regexp.exec(_text)){markers.push({pos:m.index,len:m[1].length,trimBefore:trimNext,trimAfter:m[2].length,next:m.index+m[0].length});trimNext=m[0].length-m[0].replace(/\s+$/,'').length} return markers} parse()})();(function(){function parse(){var pos=text.indexOf('![');if(pos===-1){return} if(text.indexOf('](',pos)>0){parseInlineImages()} if(hasReferences){parseReferenceImages()}} function addImageTag(startPos,endPos,endLen,linkInfo,alt){var tag=addTagPair('IMG',startPos,2,endPos,endLen);setLinkAttributes(tag,linkInfo,'src');tag.setAttribute('alt',decode(alt));overwrite(startPos,endPos+endLen-startPos)} function parseInlineImages(){var m,regexp=/!\[(?:[^\x17[\]]|\[[^\x17[\]]*\])*\]\(( *(?:[^\x17\s()]|\([^\x17\s()]*\))*(?=[ )]) *(?:"[^\x17]*?"|'[^\x17]*?'|\([^\x17)]*\))? *)\)/g;while(m=regexp.exec(text)){var linkInfo=m[1],startPos=m.index,endLen=3+linkInfo.length,endPos=startPos+m[0].length-endLen,alt=m[0].substr(2,m[0].length-endLen-2);addImageTag(startPos,endPos,endLen,linkInfo,alt)}} function parseReferenceImages(){var m,regexp=/!\[((?:[^\x17[\]]|\[[^\x17[\]]*\])*)\](?: ?\[([^\x17[\]]+)\])?/g;while(m=regexp.exec(text)){var startPos=m.index,endPos=startPos+2+m[1].length,endLen=1,alt=m[1],id=alt;if(m[2]>''&&linkReferences[m[2]]){endLen=m[0].length-alt.length-2;id=m[2]}else if(!linkReferences[id]){continue} addImageTag(startPos,endPos,endLen,linkReferences[id],alt)}} parse()})();(function(){function parse(){parseInlineMarkup('>!',/>![^\x17]+?!</g,'ISPOILER');parseInlineMarkup('||',/\|\|[^\x17]+?\|\|/g,'ISPOILER')} parse()})();(function(){function parse(){if(text.indexOf('](')!==-1){parseInlineLinks()} if(text.indexOf('<')!==-1){parseAutomaticLinks()} if(hasReferences){parseReferenceLinks()}} function addLinkTag(startPos,endPos,endLen,linkInfo){var priority=(endLen===1)?1:-1;var tag=addTagPair('URL',startPos,1,endPos,endLen,priority);setLinkAttributes(tag,linkInfo,'url');overwrite(startPos,1);overwrite(endPos,endLen)} function getLabels(){var labels={},m,regexp=/\[((?:[^\x17[\]]|\[[^\x17[\]]*\])*)\]/g;while(m=regexp.exec(text)){labels[m.index]=m[1].toLowerCase()} return labels} function parseAutomaticLinks(){var m,regexp=/<[-+.\w]+([:@])[^\x17\s>]+?(?:>|\x1B7)/g;while(m=regexp.exec(text)){var content=decode(m[0].replace(/\x1B/g,"\\\x1B")).replace(/^<(.+)>$/,'$1'),startPos=m.index,endPos=startPos+m[0].length-1,tagName=(m[1]===':')?'URL':'EMAIL',attrName=tagName.toLowerCase();addTagPair(tagName,startPos,1,endPos,1).setAttribute(attrName,content)}} function parseInlineLinks(){var m,regexp=/\[(?:[^\x17[\]]|\[[^\x17[\]]*\])*\]\(( *(?:\([^\x17\s()]*\)|[^\x17\s)])*(?=[ )]) *(?:"[^\x17]*?"|'[^\x17]*?'|\([^\x17)]*\))? *)\)/g;while(m=regexp.exec(text)){var linkInfo=m[1],startPos=m.index,endLen=3+linkInfo.length,endPos=startPos+m[0].length-endLen;addLinkTag(startPos,endPos,endLen,linkInfo)}} function parseReferenceLinks(){var labels=getLabels(),startPos;for(startPos in labels){var id=labels[startPos],labelPos=+startPos+2+id.length,endPos=labelPos-1,endLen=1;if(text[labelPos]===' '){++labelPos} if(labels[labelPos]>''&&linkReferences[labels[labelPos]]){id=labels[labelPos];endLen=labelPos+2+id.length-endPos} if(linkReferences[id]){addLinkTag(+startPos,endPos,endLen,linkReferences[id])}}} parse()})();(function(){function parse(){parseInlineMarkup('~~',/~~[^\x17]+?~~(?!~)/g,'DEL')} parse()})();(function(){function parse(){parseAbstractScript('SUB','~',/~[^\x17\s!"#$%&\'()*+,\-.\/:;<=>?@[\]^_`{}|~]+~?/g,/~\([^\x17()]+\)/g)} parse()})();(function(){function parse(){parseAbstractScript('SUP','^',/\^[^\x17\s!"#$%&\'()*+,\-.\/:;<=>?@[\]^_`{}|~]+\^?/g,/\^\([^\x17()]+\)/g)} parse()})();(function(){var closeEm;var closeStrong;var emPos;var emEndPos;var remaining;var strongPos;var strongEndPos;function parse(){parseEmphasisByCharacter('*',/\*+/g);parseEmphasisByCharacter('_',/_+/g)} function adjustEndingPositions(){if(closeEm&&closeStrong){if(emPos<strongPos){emEndPos+=2}else{++strongEndPos}}} function adjustStartingPositions(){if(emPos>=0&&emPos===strongPos){if(closeEm){emPos+=2}else{++strongPos}}} function closeSpans(){if(closeEm){--remaining;addTagPair('EM',emPos,1,emEndPos,1);emPos=-1} if(closeStrong){remaining-=2;addTagPair('STRONG',strongPos,2,strongEndPos,2);strongPos=-1}} function getEmphasisByBlock(regexp,pos){var block=[],blocks=[],breakPos=text.indexOf("\x17",pos),m;regexp.lastIndex=pos;while(m=regexp.exec(text)){var matchPos=m.index,matchLen=m[0].length;if(matchPos>breakPos){blocks.push(block);block=[];breakPos=text.indexOf("\x17",matchPos)} if(!ignoreEmphasis(matchPos,matchLen)){block.push([matchPos,matchLen])}} blocks.push(block);return blocks} function ignoreEmphasis(pos,len){return(text.charAt(pos)==='_'&&len===1&&isSurroundedByAlnum(pos,len))} function openSpans(pos){if(remaining&1){emPos=pos-remaining} if(remaining&2){strongPos=pos-remaining}} function parseEmphasisByCharacter(character,regexp){var pos=text.indexOf(character);if(pos===-1){return} getEmphasisByBlock(regexp,pos).forEach(processEmphasisBlock)} function processEmphasisBlock(block){emPos=-1,strongPos=-1;block.forEach(function(pair){processEmphasisMatch(pair[0],pair[1])})} function processEmphasisMatch(matchPos,matchLen){var canOpen=!isBeforeWhitespace(matchPos+matchLen-1),canClose=!isAfterWhitespace(matchPos),closeLen=(canClose)?Math.min(matchLen,3):0;closeEm=!!(closeLen&1)&&emPos>=0;closeStrong=!!(closeLen&2)&&strongPos>=0;emEndPos=matchPos;strongEndPos=matchPos;remaining=matchLen;adjustStartingPositions();adjustEndingPositions();closeSpans();remaining=(canOpen)?Math.min(remaining,3):0;openSpans(matchPos+matchLen)} parse()})();(function(){function parse(){var pos=text.indexOf(" \n");while(pos>0){addBrTag(pos+2).cascadeInvalidationTo(addVerbatim(pos+2,1));pos=text.indexOf(" \n",pos+3)}} parse()})()}},"Preg":{parser:function(text,matches){var config={generics:[["USERMENTION",/\B@([a-z0-9_-]+)(?!#)/ig,0,["","username"]],["POSTMENTION",/\B@([a-z0-9_-]+)#(\d+)/ig,0,["","username","id"]]]};config.generics.forEach(function(entry){var tagName=entry[0],regexp=entry[1],passthroughIdx=entry[2],map=entry[3],m;regexp.lastIndex=0;while(m=regexp.exec(text)){var startTagPos=m.index,matchLen=m[0].length,tag;if(HINT.PREG_HAS_PASSTHROUGH&&passthroughIdx&&m[passthroughIdx]!==''){var contentPos=text.indexOf(m[passthroughIdx],startTagPos),contentLen=m[passthroughIdx].length,startTagLen=contentPos-startTagPos,endTagPos=contentPos+contentLen,endTagLen=matchLen-(startTagLen+contentLen);tag=addTagPair(tagName,startTagPos,startTagLen,endTagPos,endTagLen,-100)}else{tag=addSelfClosingTag(tagName,startTagPos,matchLen,-100)} map.forEach(function(attrName,i){if(attrName&&typeof m[i]!=='undefined'){tag.setAttribute(attrName,m[i])}})}})}}};var pos;var registeredVars={"urlConfig":{allowedSchemes:/^https?$/i}};var rootContext={allowed:oF6AF222C,flags:40};var tagsConfig={"B":o5B6ED7AA,"C":{allowed:o553403F9,attributes:{},bitNumber:2,filterChain:o1B4F5B52,nestingLimit:10,rules:{flags:66},tagLimit:5000},"CENTER":{allowed:oF6AF222C,attributes:{},bitNumber:3,filterChain:o1B4F5B52,nestingLimit:10,rules:o1AF69066,tagLimit:5000},"CODE":{allowed:o553403F9,attributes:{"lang":{filterChain:[function(attrValue,attrName){return RegexpFilter.filter(attrValue,/^[-0-9A-Za-z_]+$/)}],required:!1}},bitNumber:3,filterChain:o1B4F5B52,nestingLimit:10,rules:{closeParent:oD4869BFF,flags:4436,fosterParent:oD4869BFF},tagLimit:5000},"COLOR":{allowed:oD363F9C5,attributes:{"color":{filterChain:[function(attrValue,attrName){return RegexpFilter.filter(attrValue,/^(?:#(?:(?:[0-9a-f]{3}){1,2}|(?:[0-9a-f]{4}){1,2})|rgb\(\d{1,3}, *\d{1,3}, *\d{1,3}\)|rgba\(\d{1,3}, *\d{1,3}, *\d{1,3}, *\d*(?:\.\d+)?\)|[a-z]+)$/i)}],required:!0}},bitNumber:2,filterChain:o1B4F5B52,nestingLimit:10,rules:oB565876D,tagLimit:5000},"DEL":{allowed:oF6AF222C,attributes:{},bitNumber:2,filterChain:o1B4F5B52,nestingLimit:10,rules:{flags:512},tagLimit:5000},"E":{allowed:oC06C5BF5,attributes:{},bitNumber:5,filterChain:o1B4F5B52,nestingLimit:10,rules:oA80287CC,tagLimit:5000},"EM":o5B6ED7AA,"EMAIL":{allowed:o3C789569,attributes:{"email":{filterChain:[function(attrValue,attrName){return EmailFilter.filter(attrValue)}],required:!0}},bitNumber:1,filterChain:o1B4F5B52,nestingLimit:10,rules:o939F1698,tagLimit:5000},"ESC":{allowed:o553403F9,attributes:{},bitNumber:0,filterChain:o1B4F5B52,nestingLimit:10,rules:{flags:1616},tagLimit:5000},"H1":oE13673F5,"H2":oE13673F5,"H3":oE13673F5,"H4":oE13673F5,"H5":oE13673F5,"H6":oE13673F5,"HR":{allowed:oC06C5BF5,attributes:{},bitNumber:3,filterChain:o1B4F5B52,nestingLimit:10,rules:{closeParent:oD4869BFF,flags:3349},tagLimit:5000},"I":o5B6ED7AA,"IMG":{allowed:oC06C5BF5,attributes:{"alt":o1BC3EAF4,"height":o75AB9259,"src":oF307D35C,"title":o1BC3EAF4,"width":o75AB9259},bitNumber:2,filterChain:o1B4F5B52,nestingLimit:10,rules:oA80287CC,tagLimit:5000},"ISPOILER":o8F52476D,"LI":{allowed:oF6AF222C,attributes:{},bitNumber:4,filterChain:o1B4F5B52,nestingLimit:10,rules:{closeParent:{"B":1,"C":1,"COLOR":1,"EM":1,"EMAIL":1,"I":1,"LI":1,"S":1,"SIZE":1,"STRONG":1,"U":1,"URL":1},flags:264,fosterParent:oD4869BFF},tagLimit:5000},"LIST":{allowed:[32529],attributes:{"start":o75AB9259,"type":{filterChain:[function(attrValue,attrName){return HashmapFilter.filter(attrValue,{"A":"upper-alpha","I":"upper-roman","a":"lower-alpha","i":"lower-roman","1":"decimal"},!1)},function(attrValue,attrName){return RegexpFilter.filter(attrValue,/^[- +,.0-9A-Za-z_]+$/)}],required:!1}},bitNumber:3,filterChain:o1B4F5B52,nestingLimit:10,rules:{closeParent:oD4869BFF,createChild:["LI"],flags:3460,fosterParent:oD4869BFF},tagLimit:5000},"POSTMENTION":{allowed:oC06C5BF5,attributes:{"discussionid":o6CB0A318,"displayname":o02D8DBB5,"id":o6CB0A318,"number":o6CB0A318,"username":o02D8DBB5},bitNumber:1,filterChain:[function(tag,tagConfig){return(function(tag){return flarum.extensions["flarum-mentions"].filterPostMentions(tag)})(tag)},o118B31AC],nestingLimit:10,rules:oA80287CC,tagLimit:5000},"QUOTE":{allowed:oF6AF222C,attributes:{"author":o1BC3EAF4},bitNumber:3,filterChain:o1B4F5B52,nestingLimit:10,rules:o1AF69066,tagLimit:5000},"S":o5B6ED7AA,"SIZE":{allowed:oD363F9C5,attributes:{"size":{filterChain:[function(attrValue,attrName){return NumericFilter.filterRange(attrValue,8,36,logger)}],required:!0}},bitNumber:2,filterChain:o1B4F5B52,nestingLimit:10,rules:oB565876D,tagLimit:5000},"SPOILER":{allowed:oF6AF222C,attributes:{},bitNumber:6,filterChain:o1B4F5B52,nestingLimit:10,rules:o1AF69066,tagLimit:5000},"STRONG":o5B6ED7AA,"SUB":o8F52476D,"SUP":o8F52476D,"U":o5B6ED7AA,"URL":{allowed:o3C789569,attributes:{"title":o1BC3EAF4,"url":oF307D35C},bitNumber:1,filterChain:o1B4F5B52,nestingLimit:10,rules:o939F1698,tagLimit:5000},"USERMENTION":{allowed:oC06C5BF5,attributes:{"displayname":o02D8DBB5,"id":o6CB0A318,"username":o02D8DBB5},bitNumber:1,filterChain:[function(tag,tagConfig){return(function(tag){return flarum.extensions["flarum-mentions"].filterUserMentions(tag)})(tag)},o118B31AC],nestingLimit:10,rules:oA80287CC,tagLimit:5000}};var tagStack;var tagStackIsSorted;var text;var textLen;var uid=0;var wsPos;function disableTag(tagName){if(tagsConfig[tagName]){copyTagConfig(tagName).isDisabled=!0}} function enableTag(tagName){if(tagsConfig[tagName]){copyTagConfig(tagName).isDisabled=!1}} function getLogger(){return logger} function parse(_text){reset(_text);var _uid=uid;executePluginParsers();processTags();finalizeOutput();if(uid!==_uid){throw 'The parser has been reset during execution'} if(currentFixingCost>maxFixingCost){logger.warn('Fixing cost limit exceeded')} return output} function reset(_text){_text=_text.replace(/\r\n?/g,"\n");_text=_text.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]+/g,'');logger.clear();cntOpen={};cntTotal={};currentFixingCost=0;currentTag=null;isRich=!1;namespaces={};openTags=[];output='';pos=0;tagStack=[];tagStackIsSorted=!1;text=_text;textLen=text.length;wsPos=0;context=rootContext;context.inParagraph=!1;++uid} function setTagLimit(tagName,tagLimit){if(tagsConfig[tagName]){copyTagConfig(tagName).tagLimit=tagLimit}} function setNestingLimit(tagName,nestingLimit){if(tagsConfig[tagName]){copyTagConfig(tagName).nestingLimit=nestingLimit}} function copyTagConfig(tagName){var tagConfig={},k;for(k in tagsConfig[tagName]){tagConfig[k]=tagsConfig[tagName][k]} return tagsConfig[tagName]=tagConfig} function encodeUnicodeSupplementaryCharacters(){output=output.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,encodeUnicodeSupplementaryCharactersCallback)} function encodeUnicodeSupplementaryCharactersCallback(pair){var cp=(pair.charCodeAt(0)<<10)+pair.charCodeAt(1)-56613888;return'&#'+cp+';'} function finalizeOutput(){var tmp;outputText(textLen,0,!0);do{tmp=output;output=output.replace(/<([^ />]+)[^>]*><\/\1>/g,'')} while(output!==tmp);output=output.replace(/<\/i><i>/g,'');output=output.replace(/[\x00-\x08\x0B-\x1F]/g,'');encodeUnicodeSupplementaryCharacters();var tagName=(isRich)?'r':'t';tmp='<'+tagName;if(HINT.namespaces){for(var prefix in namespaces){tmp+=' xmlns:'+prefix+'="urn:s9e:TextFormatter:'+prefix+'"'}} output=tmp+'>'+output+'</'+tagName+'>'} function outputTag(tag){isRich=!0;var tagName=tag.getName(),tagPos=tag.getPos(),tagLen=tag.getLen(),tagFlags=tag.getFlags(),skipBefore=0,skipAfter=0;if(HINT.RULE_IGNORE_WHITESPACE&&(tagFlags&RULE_IGNORE_WHITESPACE)){skipBefore=1;skipAfter=(tag.isEndTag())?2:1} var closeParagraph=!!(!tag.isStartTag()||(HINT.RULE_BREAK_PARAGRAPH&&(tagFlags&RULE_BREAK_PARAGRAPH)));outputText(tagPos,skipBefore,closeParagraph);var tagText=(tagLen)?htmlspecialchars_noquotes(text.substr(tagPos,tagLen)):'';if(tag.isStartTag()){if(!HINT.RULE_BREAK_PARAGRAPH||!(tagFlags&RULE_BREAK_PARAGRAPH)){outputParagraphStart(tagPos)} if(HINT.namespaces){var colonPos=tagName.indexOf(':');if(colonPos>0){namespaces[tagName.substr(0,colonPos)]=0}} output+='<'+tagName;var attributes=tag.getAttributes(),attributeNames=[];for(var attrName in attributes){attributeNames.push(attrName)} attributeNames.sort(function(a,b){return(a>b)?1:-1});attributeNames.forEach(function(attrName){output+=' '+attrName+'="'+htmlspecialchars_compat(attributes[attrName].toString()).replace(/\n/g,'&#10;')+'"'});if(tag.isSelfClosingTag()){if(tagLen){output+='>'+tagText+'</'+tagName+'>'}else{output+='/>'}}else if(tagLen){output+='><s>'+tagText+'</s>'}else{output+='>'}}else{if(tagLen){output+='<e>'+tagText+'</e>'} output+='</'+tagName+'>'} pos=tagPos+tagLen;wsPos=pos;while(skipAfter&&wsPos<textLen&&text[wsPos]==="\n"){--skipAfter;++wsPos}} function outputText(catchupPos,maxLines,closeParagraph){if(closeParagraph){if(!(context.flags&RULE_CREATE_PARAGRAPHS)){closeParagraph=!1}else{maxLines=-1}} if(pos>=catchupPos){if(closeParagraph){outputParagraphEnd()}} if(wsPos>pos){var skipPos=Math.min(catchupPos,wsPos);output+=text.substr(pos,skipPos-pos);pos=skipPos;if(pos>=catchupPos){if(closeParagraph){outputParagraphEnd()}}} var catchupLen,catchupText;if(HINT.RULE_IGNORE_TEXT&&context.flags&RULE_IGNORE_TEXT){catchupLen=catchupPos-pos,catchupText=text.substr(pos,catchupLen);if(!/^[ \n\t]*$/.test(catchupText)){catchupText='<i>'+htmlspecialchars_noquotes(catchupText)+'</i>'} output+=catchupText;pos=catchupPos;if(closeParagraph){outputParagraphEnd()} return} var ignorePos=catchupPos,ignoreLen=0;while(maxLines&&--ignorePos>=pos){var c=text[ignorePos];if(c!==' '&&c!=="\n"&&c!=="\t"){break} if(c==="\n"){--maxLines} ++ignoreLen} catchupPos-=ignoreLen;if(HINT.RULE_CREATE_PARAGRAPHS&&context.flags&RULE_CREATE_PARAGRAPHS){if(!context.inParagraph){outputWhitespace(catchupPos);if(catchupPos>pos){outputParagraphStart(catchupPos)}} var pbPos=text.indexOf("\n\n",pos);while(pbPos>-1&&pbPos<catchupPos){outputText(pbPos,0,!0);outputParagraphStart(catchupPos);pbPos=text.indexOf("\n\n",pos)}} if(catchupPos>pos){catchupText=htmlspecialchars_noquotes(text.substr(pos,catchupPos-pos));if(HINT.RULE_ENABLE_AUTO_BR&&(context.flags&RULES_AUTO_LINEBREAKS)===RULE_ENABLE_AUTO_BR){catchupText=catchupText.replace(/\n/g,"<br/>\n")} output+=catchupText} if(closeParagraph){outputParagraphEnd()} if(ignoreLen){output+=text.substr(catchupPos,ignoreLen)} pos=catchupPos+ignoreLen} function outputBrTag(tag){outputText(tag.getPos(),0,!1);output+='<br/>'} function outputIgnoreTag(tag){var tagPos=tag.getPos(),tagLen=tag.getLen();var ignoreText=text.substr(tagPos,tagLen);outputText(tagPos,0,!1);output+='<i>'+htmlspecialchars_noquotes(ignoreText)+'</i>';isRich=!0;pos=tagPos+tagLen} function outputParagraphStart(maxPos){if(!HINT.RULE_CREATE_PARAGRAPHS){return} if(context.inParagraph||!(context.flags&RULE_CREATE_PARAGRAPHS)){return} outputWhitespace(maxPos);if(pos<textLen){output+='<p>';context.inParagraph=!0}} function outputParagraphEnd(){if(!context.inParagraph){return} output+='</p>';context.inParagraph=!1} function outputVerbatim(tag){var flags=context.flags;context.flags=tag.getFlags();outputText(currentTag.getPos()+currentTag.getLen(),0,!1);context.flags=flags} function outputWhitespace(maxPos){while(pos<maxPos&&" \n\t".indexOf(text[pos])>-1){output+=text[pos];++pos}} function disablePlugin(pluginName){if(plugins[pluginName]){plugins[pluginName].isDisabled=!0}} function enablePlugin(pluginName){if(plugins[pluginName]){plugins[pluginName].isDisabled=!1}} function executePluginParser(pluginName){var pluginConfig=plugins[pluginName];if(pluginConfig.quickMatch&&text.indexOf(pluginConfig.quickMatch)<0){return} var matches=[];if(HINT.regexp&&HINT.regexpLimit&&typeof pluginConfig.regexp!=='undefined'&&typeof pluginConfig.regexpLimit!=='undefined'){matches=getMatches(pluginConfig.regexp,pluginConfig.regexpLimit);if(!matches.length){return}} getPluginParser(pluginName)(text,matches)} function executePluginParsers(){for(var pluginName in plugins){if(!plugins[pluginName].isDisabled){executePluginParser(pluginName)}}} function getMatches(regexp,limit){regexp.lastIndex=0;var matches=[],cnt=0,m;while(++cnt<=limit&&(m=regexp.exec(text))){var pos=m.index,match=[[m[0],pos]],i=0;while(++i<m.length){var str=m[i];if(str===undefined){match.push(['',-1])}else{match.push([str,text.indexOf(str,pos)]);pos+=str.length}} matches.push(match)} return matches} function getPluginParser(pluginName){return plugins[pluginName].parser} function registerParser(pluginName,parser,regexp,limit){if(!plugins[pluginName]){plugins[pluginName]={}} if(regexp){plugins[pluginName].regexp=regexp;plugins[pluginName].limit=limit||Infinity} plugins[pluginName].parser=parser} function closeAncestor(tag){if(!HINT.closeAncestor){return!1} if(openTags.length){var tagName=tag.getName(),tagConfig=tagsConfig[tagName];if(tagConfig.rules.closeAncestor){var i=openTags.length;while(--i>=0){var ancestor=openTags[i],ancestorName=ancestor.getName();if(tagConfig.rules.closeAncestor[ancestorName]){++currentFixingCost;tagStack.push(tag);addMagicEndTag(ancestor,tag.getPos(),tag.getSortPriority()-1);return!0}}}} return!1} function closeParent(tag){if(!HINT.closeParent){return!1} if(openTags.length){var tagName=tag.getName(),tagConfig=tagsConfig[tagName];if(tagConfig.rules.closeParent){var parent=openTags[openTags.length-1],parentName=parent.getName();if(tagConfig.rules.closeParent[parentName]){++currentFixingCost;tagStack.push(tag);addMagicEndTag(parent,tag.getPos(),tag.getSortPriority()-1);return!0}}} return!1} function createChild(tag){if(!HINT.createChild){return} var tagConfig=tagsConfig[tag.getName()];if(tagConfig.rules.createChild){var priority=-1000,_text=text.substr(pos),tagPos=pos+_text.length-_text.replace(/^[ \n\r\t]+/,'').length;tagConfig.rules.createChild.forEach(function(tagName){addStartTag(tagName,tagPos,0,++priority)})}} function fosterParent(tag){if(!HINT.fosterParent){return!1} if(openTags.length){var tagName=tag.getName(),tagConfig=tagsConfig[tagName];if(tagConfig.rules.fosterParent){var parent=openTags[openTags.length-1],parentName=parent.getName();if(tagConfig.rules.fosterParent[parentName]){if(parentName!==tagName&&currentFixingCost<maxFixingCost){addFosterTag(tag,parent)} tagStack.push(tag);addMagicEndTag(parent,tag.getPos(),tag.getSortPriority()-1);currentFixingCost+=4;return!0}}} return!1} function requireAncestor(tag){if(!HINT.requireAncestor){return!1} var tagName=tag.getName(),tagConfig=tagsConfig[tagName];if(tagConfig.rules.requireAncestor){var i=tagConfig.rules.requireAncestor.length;while(--i>=0){var ancestorName=tagConfig.rules.requireAncestor[i];if(cntOpen[ancestorName]){return!1}} logger.err('Tag requires an ancestor',{'requireAncestor':tagConfig.rules.requireAncestor.join(', '),'tag':tag});return!0} return!1} function addFosterTag(tag,fosterTag){var coords=getMagicStartCoords(tag.getPos()+tag.getLen()),childPos=coords[0],childPrio=coords[1];var childTag=addCopyTag(fosterTag,childPos,0,childPrio);tag.cascadeInvalidationTo(childTag)} function addMagicEndTag(startTag,tagPos,prio){var tagName=startTag.getName();if(HINT.RULE_IGNORE_WHITESPACE&&((currentTag.getFlags()|startTag.getFlags())&RULE_IGNORE_WHITESPACE)){tagPos=getMagicEndPos(tagPos)} var endTag=addEndTag(tagName,tagPos,0,prio||0);endTag.pairWith(startTag);return endTag} function getMagicEndPos(tagPos){while(tagPos>pos&&WHITESPACE.indexOf(text[tagPos-1])>-1){--tagPos} return tagPos} function getMagicStartCoords(tagPos){var nextPos,nextPrio,nextTag,prio;if(!tagStack.length){nextPos=textLen+1;nextPrio=0}else{nextTag=tagStack[tagStack.length-1];nextPos=nextTag.getPos();nextPrio=nextTag.getSortPriority()} while(tagPos<nextPos&&WHITESPACE.indexOf(text[tagPos])>-1){++tagPos} prio=(tagPos===nextPos)?nextPrio-1:0;return[tagPos,prio]} function isFollowedByClosingTag(tag){return(!tagStack.length)?!1:tagStack[tagStack.length-1].canClose(tag)} function processTags(){if(!tagStack.length){return} for(var tagName in tagsConfig){cntOpen[tagName]=0;cntTotal[tagName]=0} do{while(tagStack.length){if(!tagStackIsSorted){sortTags()} currentTag=tagStack.pop();processCurrentTag()} openTags.forEach(function(startTag){addMagicEndTag(startTag,textLen)})} while(tagStack.length);} function processCurrentTag(){if((context.flags&RULE_IGNORE_TAGS)&&!currentTag.canClose(openTags[openTags.length-1])&&!currentTag.isSystemTag()){currentTag.invalidate()} var tagPos=currentTag.getPos(),tagLen=currentTag.getLen();if(pos>tagPos&&!currentTag.isInvalid()){var startTag=currentTag.getStartTag();if(startTag&&openTags.indexOf(startTag)>=0){addEndTag(startTag.getName(),pos,Math.max(0,tagPos+tagLen-pos)).pairWith(startTag);return} if(currentTag.isIgnoreTag()){var ignoreLen=tagPos+tagLen-pos;if(ignoreLen>0){addIgnoreTag(pos,ignoreLen);return}} currentTag.invalidate()} if(currentTag.isInvalid()){return} if(currentTag.isIgnoreTag()){outputIgnoreTag(currentTag)}else if(currentTag.isBrTag()){if(!HINT.RULE_PREVENT_BR||!(context.flags&RULE_PREVENT_BR)){outputBrTag(currentTag)}}else if(currentTag.isParagraphBreak()){outputText(currentTag.getPos(),0,!0)}else if(currentTag.isVerbatim()){outputVerbatim(currentTag)}else if(currentTag.isStartTag()){processStartTag(currentTag)}else{processEndTag(currentTag)}} function processStartTag(tag){var tagName=tag.getName(),tagConfig=tagsConfig[tagName];if(cntTotal[tagName]>=tagConfig.tagLimit){logger.err('Tag limit exceeded',{'tag':tag,'tagName':tagName,'tagLimit':tagConfig.tagLimit});tag.invalidate();return} filterTag(tag);if(tag.isInvalid()){return} if(currentFixingCost<maxFixingCost){if(fosterParent(tag)||closeParent(tag)||closeAncestor(tag)){return}} if(cntOpen[tagName]>=tagConfig.nestingLimit){logger.err('Nesting limit exceeded',{'tag':tag,'tagName':tagName,'nestingLimit':tagConfig.nestingLimit});tag.invalidate();return} if(!tagIsAllowed(tagName)){var msg='Tag is not allowed in this context',context={'tag':tag,'tagName':tagName};if(tag.getLen()>0){logger.warn(msg,context)}else{logger.debug(msg,context)} tag.invalidate();return} if(requireAncestor(tag)){tag.invalidate();return} if(HINT.RULE_AUTO_CLOSE&&tag.getFlags()&RULE_AUTO_CLOSE&&!tag.isSelfClosingTag()&&!tag.getEndTag()&&!isFollowedByClosingTag(tag)){var newTag=new Tag(Tag.SELF_CLOSING_TAG,tagName,tag.getPos(),tag.getLen());newTag.setAttributes(tag.getAttributes());newTag.setFlags(tag.getFlags());tag=newTag} if(HINT.RULE_TRIM_FIRST_LINE&&tag.getFlags()&RULE_TRIM_FIRST_LINE&&text[tag.getPos()+tag.getLen()]==="\n"){addIgnoreTag(tag.getPos()+tag.getLen(),1)} outputTag(tag);pushContext(tag);createChild(tag)} function processEndTag(tag){var tagName=tag.getName();if(!cntOpen[tagName]){return} var closeTags=[];var i=openTags.length;while(--i>=0){var openTag=openTags[i];if(tag.canClose(openTag)){break} closeTags.push(openTag);++currentFixingCost} if(i<0){logger.debug('Skipping end tag with no start tag',{'tag':tag});return} var flags=tag.getFlags();closeTags.forEach(function(openTag){flags|=openTag.getFlags()});var ignoreWhitespace=(HINT.RULE_IGNORE_WHITESPACE&&(flags&RULE_IGNORE_WHITESPACE));var keepReopening=HINT.RULE_AUTO_REOPEN&&(currentFixingCost<maxFixingCost),reopenTags=[];closeTags.forEach(function(openTag){var openTagName=openTag.getName();if(keepReopening){if(openTag.getFlags()&RULE_AUTO_REOPEN){reopenTags.push(openTag)}else{keepReopening=!1}} var tagPos=tag.getPos();if(ignoreWhitespace){tagPos=getMagicEndPos(tagPos)} var endTag=new Tag(Tag.END_TAG,openTagName,tagPos,0);endTag.setFlags(openTag.getFlags());outputTag(endTag);popContext()});outputTag(tag);popContext();if(closeTags.length&&currentFixingCost<maxFixingCost){var ignorePos=pos;i=tagStack.length;while(--i>=0&&++currentFixingCost<maxFixingCost){var upcomingTag=tagStack[i];if(upcomingTag.getPos()>ignorePos||upcomingTag.isStartTag()){break} var j=closeTags.length;while(--j>=0&&++currentFixingCost<maxFixingCost){if(upcomingTag.canClose(closeTags[j])){closeTags.splice(j,1);if(reopenTags[j]){reopenTags.splice(j,1)} ignorePos=Math.max(ignorePos,upcomingTag.getPos()+upcomingTag.getLen());break}}} if(ignorePos>pos){outputIgnoreTag(new Tag(Tag.SELF_CLOSING_TAG,'i',pos,ignorePos-pos))}} reopenTags.forEach(function(startTag){var newTag=addCopyTag(startTag,pos,0);var endTag=startTag.getEndTag();if(endTag){newTag.pairWith(endTag)}})} function popContext(){var tag=openTags.pop();--cntOpen[tag.getName()];context=context.parentContext} function pushContext(tag){var tagName=tag.getName(),tagFlags=tag.getFlags(),tagConfig=tagsConfig[tagName];++cntTotal[tagName];if(tag.isSelfClosingTag()){return} var allowed=[];context.allowed.forEach(function(v,k){if(!HINT.RULE_IS_TRANSPARENT||!(tagFlags&RULE_IS_TRANSPARENT)){v=(v&0xFF00)|(v>>8)} allowed.push(tagConfig.allowed[k]&v)});var flags=tagFlags|(context.flags&RULES_INHERITANCE);if(flags&RULE_DISABLE_AUTO_BR){flags&=~RULE_ENABLE_AUTO_BR} ++cntOpen[tagName];openTags.push(tag);context={parentContext:context};context.allowed=allowed;context.flags=flags} function tagIsAllowed(tagName){var n=tagsConfig[tagName].bitNumber;return!!(context.allowed[n>>3]&(1<<(n&7)))} function addStartTag(name,pos,len,prio){return addTag(Tag.START_TAG,name,pos,len,prio||0)} function addEndTag(name,pos,len,prio){return addTag(Tag.END_TAG,name,pos,len,prio||0)} function addSelfClosingTag(name,pos,len,prio){return addTag(Tag.SELF_CLOSING_TAG,name,pos,len,prio||0)} function addBrTag(pos,prio){return addTag(Tag.SELF_CLOSING_TAG,'br',pos,0,prio||0)} function addIgnoreTag(pos,len,prio){return addTag(Tag.SELF_CLOSING_TAG,'i',pos,Math.min(len,textLen-pos),prio||0)} function addParagraphBreak(pos,prio){return addTag(Tag.SELF_CLOSING_TAG,'pb',pos,0,prio||0)} function addCopyTag(tag,pos,len,prio){var copy=addTag(tag.getType(),tag.getName(),pos,len,tag.getSortPriority());copy.setAttributes(tag.getAttributes());return copy} function addTag(type,name,pos,len,prio){var tag=new Tag(type,name,pos,len,prio||0);if(tagsConfig[name]){tag.setFlags(tagsConfig[name].rules.flags)} if((!tagsConfig[name]&&!tag.isSystemTag())||isInvalidTextSpan(pos,len)){tag.invalidate()}else if(tagsConfig[name]&&tagsConfig[name].isDisabled){logger.warn('Tag is disabled',{'tag':tag,'tagName':name});tag.invalidate()}else{insertTag(tag)} return tag} function isInvalidTextSpan(pos,len){return(len<0||pos<0||pos+len>textLen||/[\uDC00-\uDFFF]/.test(text.substr(pos,1)+text.substr(pos+len,1)))} function insertTag(tag){if(!tagStackIsSorted){tagStack.push(tag)}else{var i=tagStack.length,key=getSortKey(tag);while(i>0&&key>getSortKey(tagStack[i-1])){tagStack[i]=tagStack[i-1];--i} tagStack[i]=tag}} function addTagPair(name,startPos,startLen,endPos,endLen,prio){var endTag=addEndTag(name,endPos,endLen,-prio||0),startTag=addStartTag(name,startPos,startLen,prio||0);startTag.pairWith(endTag);return startTag} function addVerbatim(pos,len,prio){return addTag(Tag.SELF_CLOSING_TAG,'v',pos,len,prio||0)} function sortTags(){var arr={},keys=[],i=tagStack.length;while(--i>=0){var tag=tagStack[i],key=getSortKey(tag,i);keys.push(key);arr[key]=tag} keys.sort();i=keys.length;tagStack=[];while(--i>=0){tagStack.push(arr[keys[i]])} tagStackIsSorted=!0} function getSortKey(tag,tagIndex){var prioFlag=(tag.getSortPriority()>=0),prio=tag.getSortPriority();if(!prioFlag){prio+=(1<<30)} var lenFlag=(tag.getLen()>0),lenOrder;if(lenFlag){lenOrder=textLen-tag.getLen()}else{var order={};order[Tag.END_TAG]=0;order[Tag.SELF_CLOSING_TAG]=1;order[Tag.START_TAG]=2;lenOrder=order[tag.getType()]} return hex32(tag.getPos())+(+prioFlag)+hex32(prio)+(+lenFlag)+hex32(lenOrder)+hex32(tagIndex||0)} function hex32(number){var hex=number.toString(16);return" ".substr(hex.length)+hex} var MSXML=(typeof DOMParser==='undefined'||typeof XSLTProcessor==='undefined');var xslt={init:function(xsl){var stylesheet=xslt.loadXML(xsl);if(MSXML){var generator=new ActiveXObject('MSXML2.XSLTemplate.6.0');generator.stylesheet=stylesheet;xslt.proc=generator.createProcessor()}else{xslt.proc=new XSLTProcessor;xslt.proc.importStylesheet(stylesheet)}},loadXML:function(xml){var dom;if(MSXML){dom=new ActiveXObject('MSXML2.FreeThreadedDOMDocument.6.0');dom.async=!1;dom.validateOnParse=!1;dom.loadXML(xml)}else{dom=(new DOMParser).parseFromString(xml,'text/xml')} if(!dom){throw 'Cannot parse '+xml} return dom},setParameter:function(paramName,paramValue){if(MSXML){xslt.proc.addParameter(paramName,paramValue,'')}else{xslt.proc.setParameter(null,paramName,paramValue)}},transformToFragment:function(xml,targetDoc){if(MSXML){var div=targetDoc.createElement('div'),fragment=targetDoc.createDocumentFragment();xslt.proc.input=xslt.loadXML(xml);xslt.proc.transform();div.innerHTML=xslt.proc.output;while(div.firstChild){fragment.appendChild(div.firstChild)} return fragment} return xslt.proc.transformToFragment(xslt.loadXML(xml),targetDoc)}};xslt.init(xsl);var functionCache={};function preview(text,target){var targetDoc=target.ownerDocument;if(!targetDoc){throw 'Target does not have a ownerDocument'} var resultFragment=xslt.transformToFragment(parse(text).replace(/<[eis]>[^<]*<\/[eis]>/g,''),targetDoc),lastUpdated=target;if(typeof window!=='undefined'&&'chrome' in window){resultFragment.querySelectorAll('script').forEach(function(oldScript){let newScript=document.createElement('script');for(let attribute of oldScript.attributes){newScript.setAttribute(attribute.name,attribute.value)} newScript.textContent=oldScript.textContent;oldScript.parentNode.replaceChild(newScript,oldScript)})} if(HINT.hash){computeHashes(resultFragment)} if(HINT.onRender){executeEvents(resultFragment,'render')} function computeHashes(fragment){var nodes=fragment.querySelectorAll('[data-s9e-livepreview-hash]'),i=nodes.length;while(--i>=0){nodes[i].setAttribute('data-s9e-livepreview-hash',hash(nodes[i].outerHTML))}} function executeEvent(node,eventName){var code=node.getAttribute('data-s9e-livepreview-on'+eventName);if(!functionCache[code]){functionCache[code]=new Function(code)} functionCache[code].call(node)} function executeEvents(root,eventName){if(root instanceof Element&&root.hasAttribute('data-s9e-livepreview-on'+eventName)){executeEvent(root,eventName)} var nodes=root.querySelectorAll('[data-s9e-livepreview-on'+eventName+']'),i=nodes.length;while(--i>=0){executeEvent(nodes[i],eventName)}} function refreshElementContent(oldParent,newParent){var oldNodes=oldParent.childNodes,newNodes=newParent.childNodes,oldCnt=oldNodes.length,newCnt=newNodes.length,oldNode,newNode,left=0,right=0;while(left<oldCnt&&left<newCnt){oldNode=oldNodes[left];newNode=newNodes[left];if(!refreshNode(oldNode,newNode)){break} ++left} var maxRight=Math.min(oldCnt-left,newCnt-left);while(right<maxRight){oldNode=oldNodes[oldCnt-(right+1)];newNode=newNodes[newCnt-(right+1)];if(!refreshNode(oldNode,newNode)){break} ++right} var i=oldCnt-right;while(--i>=left){oldParent.removeChild(oldNodes[i]);lastUpdated=oldParent} var rightBoundary=newCnt-right;if(left>=rightBoundary){return} var newNodesFragment=targetDoc.createDocumentFragment();i=left;do{newNode=newNodes[i];if(HINT.onUpdate&&newNode instanceof Element){executeEvents(newNode,'update')} lastUpdated=newNodesFragment.appendChild(newNode)} while(i<--rightBoundary);if(!right){oldParent.appendChild(newNodesFragment)}else{oldParent.insertBefore(newNodesFragment,oldParent.childNodes[left])}} function refreshNode(oldNode,newNode){if(oldNode.nodeName!==newNode.nodeName||oldNode.nodeType!==newNode.nodeType){return!1} if(oldNode instanceof HTMLElement&&newNode instanceof HTMLElement){if(!oldNode.isEqualNode(newNode)&&!elementHashesMatch(oldNode,newNode)){if(HINT.onUpdate&&newNode.hasAttribute('data-s9e-livepreview-onupdate')){executeEvent(newNode,'update')} syncElementAttributes(oldNode,newNode);refreshElementContent(oldNode,newNode)}}else if(oldNode.nodeType===3||oldNode.nodeType===8){if(oldNode.nodeValue!==newNode.nodeValue){oldNode.nodeValue=newNode.nodeValue;lastUpdated=oldNode}} return!0} function elementHashesMatch(oldEl,newEl){if(!HINT.hash){return!1} const attrName='data-s9e-livepreview-hash';return oldEl.hasAttribute(attrName)&&newEl.hasAttribute(attrName)&&oldEl.getAttribute(attrName)===newEl.getAttribute(attrName)} function hash(text){var pos=text.length,s1=0,s2=0;while(--pos>=0){s1=(s1+text.charCodeAt(pos))%0xFFFF;s2=(s1+s2)%0xFFFF} return(s2<<16)|s1} function syncElementAttributes(oldEl,newEl){var oldAttributes=oldEl.attributes,newAttributes=newEl.attributes,oldCnt=oldAttributes.length,newCnt=newAttributes.length,i=oldCnt,ignoreAttrs=' '+oldEl.getAttribute('data-s9e-livepreview-ignore-attrs')+' ';while(--i>=0){var oldAttr=oldAttributes[i],namespaceURI=oldAttr.namespaceURI,attrName=oldAttr.name;if(HINT.ignoreAttrs&&ignoreAttrs.indexOf(' '+attrName+' ')>-1){continue} if(!newEl.hasAttributeNS(namespaceURI,attrName)){oldEl.removeAttributeNS(namespaceURI,attrName);lastUpdated=oldEl}} i=newCnt;while(--i>=0){var newAttr=newAttributes[i],namespaceURI=newAttr.namespaceURI,attrName=newAttr.name,attrValue=newAttr.value;if(HINT.ignoreAttrs&&ignoreAttrs.indexOf(' '+attrName+' ')>-1){continue} if(attrValue!==oldEl.getAttributeNS(namespaceURI,attrName)){oldEl.setAttributeNS(namespaceURI,attrName,attrValue);lastUpdated=oldEl}}} refreshElementContent(target,resultFragment);return lastUpdated} function setParameter(paramName,paramValue){xslt.setParameter(paramName,paramValue)}if(!window.s9e)window.s9e={};window.s9e.TextFormatter={'preview':preview}})(); var module={} module.exports=function(t){var o={};function e(r){if(o[r])return o[r].exports;var n=o[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,e),n.l=!0,n.exports}return e.m=t,e.c=o,e.d=function(t,o,r){e.o(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,o){if(1&o&&(t=e(t)),8&o)return t;if(4&o&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&o&&"string"!=typeof t)for(var n in t)e.d(r,n,function(o){return t[o]}.bind(null,n));return r},e.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(o,"a",o),o},e.o=function(t,o){return Object.prototype.hasOwnProperty.call(t,o)},e.p="",e(e.s=10)}([function(t,o){t.exports=flarum.core.compat.app},function(t,o){t.exports=flarum.core.compat.extend},function(t,o){t.exports=flarum.core.compat["models/Post"]},function(t,o){t.exports=flarum.core.compat["models/Discussion"]},function(t,o){t.exports=flarum.core.compat["utils/PostControls"]},function(t,o){t.exports=flarum.core.compat["components/Post"]},function(t,o){t.exports=flarum.core.compat["components/Badge"]},function(t,o){t.exports=flarum.core.compat["components/DiscussionListItem"]},function(t,o){t.exports=flarum.core.compat["components/CommentPost"]},function(t,o){t.exports=flarum.core.compat["components/Button"]},function(t,o,e){"use strict";e.r(o);var r=e(1),n=e(0),a=e.n(n),p=e(3),s=e.n(p),i=e(2),u=e.n(i),c=e(6),l=e.n(c),f=e(7),d=e.n(f),v=e(5),b=e.n(v),x=e(8),y=e.n(x),A=e(9),g=e.n(A),h=e(4),_=e.n(h);a.a.initializers.add("flarum-approval",(function(){s.a.prototype.isApproved=s.a.attribute("isApproved"),Object(r.extend)(s.a.prototype,"badges",(function(t){this.isApproved()||t.has("hidden")||t.add("awaitingApproval",m(l.a,{type:"awaitingApproval",icon:"fas fa-gavel",label:a.a.translator.trans("flarum-approval.forum.badge.awaiting_approval_tooltip")}))})),u.a.prototype.isApproved=u.a.attribute("isApproved"),u.a.prototype.canApprove=u.a.attribute("canApprove"),Object(r.extend)(d.a.prototype,"elementAttrs",(function(t){this.attrs.discussion.isApproved()||(t.className+=" DiscussionListItem--unapproved")})),Object(r.extend)(b.a.prototype,"elementAttrs",(function(t){this.attrs.post.isApproved()||(t.className+=" Post--unapproved")})),Object(r.extend)(y.a.prototype,"headerItems",(function(t){this.attrs.post.isApproved()||this.attrs.post.isHidden()||t.add("unapproved",a.a.translator.trans("flarum-approval.forum.post.awaiting_approval_text"))})),Object(r.override)(b.a.prototype,"flagReason",(function(t,o){return"approval"===o.type()?a.a.translator.trans("flarum-approval.forum.post.awaiting_approval_text"):t(o)})),Object(r.extend)(_.a,"destructiveControls",(function(t,o){!o.isApproved()&&o.canApprove()&&t.add("approve",m(g.a,{icon:"fas fa-check",onclick:_.a.approveAction.bind(o)},a.a.translator.trans("flarum-approval.forum.post_controls.approve_button")),10)})),_.a.approveAction=function(){this.save({isApproved:!0}),1===this.number()&&this.discussion().pushAttributes({isApproved:!0})}}),-10)}]); flarum.extensions['flarum-approval']=module.exports var module={} module.exports=function(e){var d={};function a(u){if(d[u])return d[u].exports;var o=d[u]={i:u,l:!1,exports:{}};return e[u].call(o.exports,o,o.exports,a),o.l=!0,o.exports}return a.m=e,a.c=d,a.d=function(e,d,u){a.o(e,d)||Object.defineProperty(e,d,{enumerable:!0,get:u})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,d){if(1&d&&(e=a(e)),8&d)return e;if(4&d&&"object"==typeof e&&e&&e.__esModule)return e;var u=Object.create(null);if(a.r(u),Object.defineProperty(u,"default",{enumerable:!0,value:e}),2&d&&"string"!=typeof e)for(var o in e)a.d(u,o,function(d){return e[d]}.bind(null,o));return u},a.n=function(e){var d=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(d,"a",d),d},a.o=function(e,d){return Object.prototype.hasOwnProperty.call(e,d)},a.p="",a(a.s=9)}([function(e,d){e.exports=flarum.core.compat.extend},function(e,d){e.exports=flarum.core.compat["components/TextEditor"]},function(e){e.exports=JSON.parse('{"😀":["gleeful"],"😃":["glad","smile"],"😄":["happy"],"😁":["blissful","grin"],"😆":["amused","laugh","lol"],"😅":["embarassed","sweat_smile"],"🤣":["entertained","rofl"],"😂":["joyful","haha"],"🙂":["pleased","slight_smile"],"🙃":["ecstatic","upside_down"],"😉":["coy","wink"],"😊":["blush"],"😇":["innocent","halo"],"🥰":["love"],"😍":["lovestruck"],"🤩":["starstruck"],"😘":["flirty"],"😗":["kiss"],"☺️":["relaxed"],"😚":["loving_kiss"],"😙":["happy_kiss"],"🥲":["tear_smile"],"😋":["yum","savour"],"😛":["playful","tongue_out"],"😜":["mischievous"],"🤪":["crazy"],"😝":["facetious","lmao"],"🤑":["pretentious","money_mouth"],"🤗":["hugging"],"🤭":["gasp"],"🤫":["shushing"],"🤔":["curious","thinking"],"🤐":["silenced","zipper_mouth"],"🤨":["contempt"],"😐️":["indifferent","neutral"],"😑":["apathetic","expressionless"],"😶":["vacant","no_mouth"],"😏":["cocky","smirk"],"😒":["unamused"],"🙄":["disbelief"],"😬":["grimaced"],"🤥":["lying"],"😌":["relieved"],"😔":["pensive"],"😪":["sleepy"],"🤤":["drooling"],"😴":["exhausted","sleeping"],"😷":["ill","mask"],"🤒":["sick"],"🤕":["injured"],"🤢":["nauseated"],"🤮":["vomiting"],"🤧":["sneezing"],"🥵":["overheating"],"🥶":["freezing"],"🥴":["woozy"],"😵":["dizzy"],"🤯":["shocked","exploding_head"],"🤠":["cowboy"],"🥳":["partying","celebrating"],"🥸":["disguised_face"],"😎":["confident"],"🤓":["nerd"],"🧐":["monocle"],"😕":["confused"],"😟":["worried"],"🙁":["cheerless","slight_frown"],"☹️":["sad","frowning"],"😮":["surprised"],"😯":["hushed"],"😲":["astonished"],"😳":["flushed"],"🥺":["pleading"],"😦":["bored"],"😧":["anguished","wtf"],"😨":["fearful"],"😰":["cold_sweat","anxious","frustrated"],"😥":["hopeful"],"😢":["upset","cry"],"😭":["distressed","sob"],"😱":["frightened","scream"],"😖":["confounded"],"😣":["persevered"],"😞":["disappointed"],"😓":["shamed"],"😩":["weary"],"😫":["tired"],"🥱":["yawn"],"😤":["annoyed","hrmph"],"😡":["enraged","pout"],"😠":["angry"],"🤬":["censored"],"😈":["imp"],"👿":["angry_imp"],"💀":["skull"],"☠️":["crossbones"],"💩":["poop"],"🤡":["clown"],"👹":["ogre"],"👺":["goblin"],"👻":["ghost"],"👽️":["alien"],"👾":["alien_monster","space_invader"],"🤖":["robot"],"😺":["smiling_cat"],"😸":["grinning_cat"],"😹":["joyful_cat"],"😻":["lovestruck_cat"],"😼":["smirking_cat"],"😽":["kissing_cat"],"🙀":["weary_cat"],"😿":["crying_cat"],"😾":["pouting_cat"],"🙈":["see_no_evil"],"🙉":["hear_no_evil"],"🙊":["speak_no_evil"],"💋":["kiss_lips"],"💌":["love_letter"],"💘":["cupid"],"💝":["heart_ribbon"],"💖":["sparkling_heart"],"💗":["heartpulse"],"💓":["heartbeat"],"💞":["revolving_hearts"],"💕":["two_hearts"],"💟":["heart_decoration"],"❣️":["heart_exclamation"],"💔":["broken_heart"],"❤️":["heart"],"🧡":["orange_heart"],"💛":["yellow_heart"],"💚":["green_heart"],"💙":["blue_heart"],"💜":["purple_heart"],"🤎":["brown_heart"],"🖤":["black_heart"],"🤍":["white_heart"],"💯":["100"],"💢":["anger"],"💥":["boom","collision"],"💫":["dizzy_star"],"💦":["sweat_drops"],"💨":["dash"],"🕳️":["hole"],"💣️":["bomb"],"💬":["speech"],"👁‍🗨":["eye_bubble"],"🗨️":["left_speech"],"🗯️":["right_anger_speech"],"💭":["thought"],"💤":["zzz"],"👋":["wave"],"🤚":["raised_backhand"],"🖐️":["splayed_hand"],"✋":["raised_hand"],"🖖":["vulcan"],"👌":["ok_hand"],"🤌":["pinched_fingers"],"🤏":["pinch"],"✌️":["victory"],"🤞":["fingers_crossed"],"🤟":["love_you_gesture"],"🤘":["metal"],"🤙":["call_me"],"👈️":["point_left"],"👉️":["point_right"],"👆️":["backhand_point_up"],"🖕":["middle_finger"],"👇️":["point_down"],"☝️":["point_up"],"👍️":["thumbsup","+1","yes"],"👎️":["thumbsdown","-1","no"],"✊":["fist"],"👊":["punch"],"🤛":["left_facing_fist"],"🤜":["right_facing_fist"],"👏":["clap"],"🙌":["raised_hands"],"👐":["open_hands"],"🤲":["palms_up"],"🤝":["handshake"],"🙏":["pray"],"✍️":["writing_hand"],"💅":["nail_care"],"🤳":["selfie"],"💪":["muscle","right_bicep"],"🦾":["mech_arm"],"🦿":["mech_leg"],"🦵":["leg"],"🦶":["foot"],"👂️":["ear"],"🦻":["hearing_aid"],"👃":["nose"],"🧠":["brain"],"🫀":["anatomical_heart"],"🫁":["lungs"],"🦷":["tooth"],"🦴":["bone"],"👀":["eyes"],"👁️":["eye"],"👅":["tongue"],"👄":["lips"],"👶":["baby"],"🧒":["child"],"👦":["boy"],"👧":["girl"],"🧑":["adult"],"👱":["blond_person"],"👨":["man"],"🧔":["bearded_person"],"👨‍🦰":["red_haired_man"],"👨‍🦱":["curly_haired_man"],"👨‍🦳":["white_haired_man"],"👨‍🦲":["bald_man"],"👩":["woman"],"👩‍🦰":["red_haired_woman"],"🧑‍🦰":["red_haired_person"],"👩‍🦱":["curly_haired_woman"],"🧑‍🦱":["curly_haired_person"],"👩‍🦳":["white_haired_woman"],"🧑‍🦳":["white_haired_person"],"👩‍🦲":["bald_woman"],"🧑‍🦲":["bald_person"],"👱‍♀️":["blond_woman"],"👱‍♂️":["blond_man"],"🧓":["older_adult"],"👴":["older_man"],"👵":["older_woman"],"🙍":["person_frowning"],"🙍‍♂️":["man_frowning"],"🙍‍♀️":["woman_frowning"],"🙎":["person_pouting"],"🙎‍♂️":["man_pouting"],"🙎‍♀️":["woman_pouting"],"🙅":["person_gesturing_no"],"🙅‍♂️":["man_gesturing_no"],"🙅‍♀️":["woman_gesturing_no"],"🙆":["person_gesturing_ok"],"🙆‍♂️":["man_gesturing_ok"],"🙆‍♀️":["woman_gesturing_ok"],"💁":["person_tipping_hand"],"💁‍♂️":["man_tipping_hand"],"💁‍♀️":["woman_tipping_hand"],"🙋":["person_raising_hand"],"🙋‍♂️":["man_raising_hand"],"🙋‍♀️":["woman_raising_hand"],"🧏":["person_deaf"],"🧏‍♂️":["man_deaf"],"🧏‍♀️":["woman_deaf"],"🙇":["person_bowing"],"🙇‍♂️":["man_bowing"],"🙇‍♀️":["woman_bowing"],"🤦":["person_facepalming"],"🤦‍♂️":["man_facepalming"],"🤦‍♀️":["woman_facepalming"],"🤷":["person_shrugging"],"🤷‍♂️":["man_shrugging"],"🤷‍♀️":["woman_shrugging"],"🧑‍⚕️":["person_health_worker"],"👨‍⚕️":["man_health_worker"],"👩‍⚕️":["woman_health_worker"],"🧑‍🎓":["person_student"],"👨‍🎓":["man_student"],"👩‍🎓":["woman_student"],"🧑‍🏫":["person_teacher"],"👨‍🏫":["man_teacher"],"👩‍🏫":["woman_teacher"],"🧑‍⚖️":["person_judge"],"👨‍⚖️":["man_judge"],"👩‍⚖️":["woman_judge"],"🧑‍🌾":["person_farmer"],"👨‍🌾":["man_farmer"],"👩‍🌾":["woman_farmer"],"🧑‍🍳":["person_cook"],"👨‍🍳":["man_cook"],"👩‍🍳":["woman_cook"],"🧑‍🔧":["person_mechanic"],"👨‍🔧":["man_mechanic"],"👩‍🔧":["woman_mechanic"],"🧑‍🏭":["person_factory_worker"],"👨‍🏭":["man_factory_worker"],"👩‍🏭":["woman_factory_worker"],"🧑‍💼":["person_office_worker"],"👨‍💼":["man_office_worker"],"👩‍💼":["woman_office_worker"],"🧑‍🔬":["person_scientist"],"👨‍🔬":["man_scientist"],"👩‍🔬":["woman_scientist"],"🧑‍💻":["person_technologist"],"👨‍💻":["man_technologist"],"👩‍💻":["woman_technologist"],"🧑‍🎤":["person_singer"],"👨‍🎤":["man_singer"],"👩‍🎤":["woman_singer"],"🧑‍🎨":["person_artist"],"👨‍🎨":["man_artist"],"👩‍🎨":["woman_artist"],"🧑‍✈️":["person_pilot"],"👨‍✈️":["man_pilot"],"👩‍✈️":["woman_pilot"],"🧑‍🚀":["person_astronaut"],"👨‍🚀":["man_astronaut"],"👩‍🚀":["woman_astronaut"],"🧑‍🚒":["person_firefighter"],"👨‍🚒":["man_firefighter"],"👩‍🚒":["woman_firefighter"],"👮":["police_officer"],"👮‍♂️":["man_police_officer"],"👮‍♀️":["woman_police_officer"],"🕵️":["detective"],"🕵️‍♂️":["man_detective"],"🕵️‍♀️":["woman_detective"],"💂":["guard"],"💂‍♂️":["man_guard"],"💂‍♀️":["woman_guard"],"🥷":["ninja"],"👷":["construction_worker"],"👷‍♂️":["man_construction_worker"],"👷‍♀️":["woman_construction_worker"],"🤴":["prince"],"👸":["princess"],"👳":["person_turban"],"👳‍♂️":["man_turban"],"👳‍♀️":["woman_turban"],"👲":["man_chinese_cap"],"🧕":["woman_headscarf"],"🤵":["man_tuxedo"],"🤵‍♂️":["man_in_tuxedo"],"🤵‍♀️":["woman_in_tuxedo"],"👰":["person_veiled_bride","bride_veil"],"👰‍♂️":["man_veiled_bride"],"👰‍♀️":["woman_veiled_bride"],"🤰":["pregnant_woman"],"🤱":["breast_feeding"],"👩‍🍼":["woman_feeding_baby"],"👨‍🍼":["man_feeding_baby"],"🧑‍🍼":["person_feeding_baby"],"👼":["baby_angel"],"🎅":["santa"],"🤶":["mrs_claus"],"🧑‍🎄":["mx_claus"],"🦸":["hero","superhero"],"🦸‍♂️":["man_hero"],"🦸‍♀️":["woman_hero"],"🦹":["villain","supervillain"],"🦹‍♂️":["man_villain"],"🦹‍♀️":["woman_villain"],"🧙":["mage"],"🧙‍♂️":["man_mage"],"🧙‍♀️":["woman_mage"],"🧚":["fairy"],"🧚‍♂️":["man_fairy"],"🧚‍♀️":["woman_fairy"],"🧛":["vampire"],"🧛‍♂️":["man_vampire"],"🧛‍♀️":["woman_vampire"],"🧜":["merperson"],"🧜‍♂️":["merman"],"🧜‍♀️":["mermaid"],"🧝":["elf"],"🧝‍♂️":["man_elf"],"🧝‍♀️":["woman_elf"],"🧞":["genie"],"🧞‍♂️":["man_genie"],"🧞‍♀️":["woman_genie"],"🧟":["zombie"],"🧟‍♂️":["man_zombie"],"🧟‍♀️":["woman_zombie"],"💆":["person_getting_massage"],"💆‍♂️":["man_getting_face_massage"],"💆‍♀️":["woman_getting_face_massage"],"💇":["person_getting_haircut"],"💇‍♂️":["man_getting_haircut"],"💇‍♀️":["woman_getting_haircut"],"🚶":["person_walking"],"🚶‍♂️":["man_walking"],"🚶‍♀️":["woman_walking"],"🧍":["person_standing"],"🧍‍♂️":["man_standing"],"🧍‍♀️":["woman_standing"],"🧎":["person_kneeling"],"🧎‍♂️":["man_kneeling"],"🧎‍♀️":["woman_kneeling"],"🧑‍🦯":["person_probing_cane"],"👨‍🦯":["man_probing_cane"],"👩‍🦯":["woman_probing_cane"],"🧑‍🦼":["person_motor_wheelchair"],"👨‍🦼":["man_motor_wheelchair"],"👩‍🦼":["woman_motor_wheelchair"],"🧑‍🦽":["person_wheelchair"],"👨‍🦽":["man_wheelchair"],"👩‍🦽":["woman_wheelchair"],"🏃":["person_running"],"🏃‍♂️":["man_running"],"🏃‍♀️":["woman_running"],"💃":["dancer","woman_dancing"],"🕺":["man_dancing"],"🕴️":["levitate"],"👯":["people_bunny_ears_partying"],"👯‍♂️":["men_bunny_ears_partying"],"👯‍♀️":["women_bunny_ears_partying"],"🧖":["person_steamy_room"],"🧖‍♂️":["man_steamy_room"],"🧖‍♀️":["woman_steamy_room"],"🧗":["person_climbing"],"🧗‍♂️":["man_climbing"],"🧗‍♀️":["woman_climbing"],"🤺":["person_fencing"],"🏇":["horse_racing"],"⛷️":["skier"],"🏂️":["snowboarder"],"🏌️":["person_golfing"],"🏌️‍♂️":["man_golfing"],"🏌️‍♀️":["woman_golfing"],"🏄️":["person_surfing"],"🏄‍♂️":["man_surfing"],"🏄‍♀️":["woman_surfing"],"🚣":["person_rowing_boat"],"🚣‍♂️":["man_rowing_boat"],"🚣‍♀️":["woman_rowing_boat"],"🏊️":["person_swimming"],"🏊‍♂️":["man_swimming"],"🏊‍♀️":["woman_swimming"],"⛹️":["person_bouncing_ball"],"⛹️‍♂️":["man_bouncing_ball"],"⛹️‍♀️":["woman_bouncing_ball"],"🏋️":["person_lifting_weights"],"🏋️‍♂️":["man_lifting_weights"],"🏋️‍♀️":["woman_lifting_weights"],"🚴":["person_biking"],"🚴‍♂️":["man_biking"],"🚴‍♀️":["woman_biking"],"🚵":["person_mountain_biking"],"🚵‍♂️":["man_mountain_biking"],"🚵‍♀️":["woman_mountain_biking"],"🤸":["person_cartwheel"],"🤸‍♂️":["man_cartwheeling"],"🤸‍♀️":["woman_cartwheeling"],"🤼":["people_wrestling"],"🤼‍♂️":["men_wrestling"],"🤼‍♀️":["women_wrestling"],"🤽":["person_water_polo"],"🤽‍♂️":["man_water_polo"],"🤽‍♀️":["woman_water_polo"],"🤾":["person_handball"],"🤾‍♂️":["man_handball"],"🤾‍♀️":["woman_handball"],"🤹":["person_juggling"],"🤹‍♂️":["man_juggling"],"🤹‍♀️":["woman_juggling"],"🧘":["person_lotus_position"],"🧘‍♂️":["man_lotus_position"],"🧘‍♀️":["woman_lotus_position"],"🛀":["bath"],"🛌":["in_bed"],"🧑‍🤝‍🧑":["holding_hands_people"],"👭":["holding_hands_ww"],"👫":["holding_hands_mw","holding_hands_wm"],"👬":["holding_hands_mm"],"💏":["couple"],"👩‍❤️‍💋‍👨":["kiss_mw","kiss_wm"],"👨‍❤️‍💋‍👨":["kiss_mm"],"👩‍❤️‍💋‍👩":["kiss_ww"],"💑":["couple_heart"],"👩‍❤️‍👨":["couple_mw","couple_wm"],"👨‍❤️‍👨":["couple_mm"],"👩‍❤️‍👩":["couple_ww"],"👪️":["family"],"👨‍👩‍👦":["family_mwb"],"👨‍👩‍👧":["family_mwg"],"👨‍👩‍👧‍👦":["family_mwgb"],"👨‍👩‍👦‍👦":["family_mwbb"],"👨‍👩‍👧‍👧":["family_mwgg"],"👨‍👨‍👦":["family_mmb"],"👨‍👨‍👧":["family_mmg"],"👨‍👨‍👧‍👦":["family_mmgb"],"👨‍👨‍👦‍👦":["family_mmbb"],"👨‍👨‍👧‍👧":["family_mmgg"],"👩‍👩‍👦":["family_wwb"],"👩‍👩‍👧":["family_wwg"],"👩‍👩‍👧‍👦":["family_wwgb"],"👩‍👩‍👦‍👦":["family_wwbb"],"👩‍👩‍👧‍👧":["family_wwgg"],"👨‍👦":["family_mb"],"👨‍👦‍👦":["family_mbb"],"👨‍👧":["family_mg"],"👨‍👧‍👦":["family_mgb"],"👨‍👧‍👧":["family_mgg"],"👩‍👦":["family_wb"],"👩‍👦‍👦":["family_wbb"],"👩‍👧":["family_wg"],"👩‍👧‍👦":["family_wgb"],"👩‍👧‍👧":["family_wgg"],"🗣️":["speaking_head"],"👤":["bust_silhouette"],"👥":["busts_silhouette"],"🫂":["people_hugging"],"👣":["footprints"],"🏻":["tone_light","tone1"],"🏼":["tone_medium_light","tone2"],"🏽":["tone_medium","tone3"],"🏾":["tone_medium_dark","tone4"],"🏿":["tone_dark","tone5"],"🦰":["red_hair"],"🦱":["curly_hair"],"🦳":["white_hair"],"🦲":["bald"],"🐵":["monkey_face"],"🐒":["monkey"],"🦍":["gorilla"],"🦧":["orangutan"],"🐶":["dog_face"],"🐕️":["dog"],"🦮":["guide_dog"],"🐕‍🦺":["service_dog"],"🐩":["poodle"],"🐺":["wolf_face"],"🦊":["fox_face"],"🦝":["raccoon"],"🐱":["cat_face"],"🐈️":["cat"],"🐈‍⬛":["black_cat"],"🦁":["lion_face"],"🐯":["tiger_face"],"🐅":["tiger"],"🐆":["leopard"],"🐴":["horse_face"],"🐎":["horse"],"🦄":["unicorn_face"],"🦓":["zebra"],"🦌":["deer"],"🦬":["bison"],"🐮":["cow_face"],"🐂":["ox"],"🐃":["water_buffalo"],"🐄":["cow"],"🐷":["pig_face"],"🐖":["pig"],"🐗":["boar"],"🐽":["pig_nose"],"🐏":["ram"],"🐑":["sheep"],"🐐":["goat"],"🐪":["camel"],"🐫":["two_hump_camel"],"🦙":["llama"],"🦒":["giraffe"],"🐘":["elephant"],"🦣":["mammoth"],"🦏":["rhino"],"🦛":["hippo"],"🐭":["mouse_face"],"🐁":["mouse"],"🐀":["rat"],"🐹":["hamster_face"],"🐰":["rabbit_face"],"🐇":["rabbit"],"🐿️":["chipmunk"],"🦫":["beaver"],"🦔":["hedgehog"],"🦇":["bat"],"🐻":["bear_face"],"🐻‍❄️":["polar_bear_face"],"🐨":["koala_face"],"🐼":["panda_face"],"🦥":["sloth"],"🦦":["otter"],"🦨":["skunk"],"🦘":["kangaroo"],"🦡":["badger"],"🐾":["feet"],"🦃":["turkey"],"🐔":["chicken"],"🐓":["rooster"],"🐣":["hatching_chick"],"🐤":["baby_chick"],"🐥":["hatched_chick"],"🐦️":["bird"],"🐧":["penguin"],"🕊️":["dove"],"🦅":["eagle"],"🦆":["duck"],"🦢":["swan"],"🦉":["owl"],"🦤":["dodo"],"🪶":["feather"],"🦩":["flamingo"],"🦚":["peacock"],"🦜":["parrot"],"🐸":["frog_face"],"🐊":["crocodile"],"🐢":["turtle"],"🦎":["lizard"],"🐍":["snake"],"🐲":["dragon_face"],"🐉":["dragon"],"🦕":["sauropod"],"🦖":["trex"],"🐳":["spouting_whale"],"🐋":["whale"],"🐬":["dolphin"],"🦭":["seal"],"🐟️":["fish"],"🐠":["tropical_fish"],"🐡":["blowfish"],"🦈":["shark"],"🐙":["octopus"],"🐚":["shell"],"🐌":["snail"],"🦋":["butterfly"],"🐛":["bug"],"🐜":["ant"],"🐝":["bee"],"🪲":["beetle"],"🐞":["lady_bug"],"🦗":["cricket"],"🪳":["cockroach"],"🕷️":["spider"],"🕸️":["spider_web"],"🦂":["scorpion"],"🦟":["mosquito"],"🪰":["fly"],"🪱":["worm"],"🦠":["microbe","germ"],"💐":["bouquet"],"🌸":["cherry_blossom"],"💮":["white_flower"],"🏵️":["rosette"],"🌹":["rose"],"🥀":["wilted_rose"],"🌺":["hibiscus"],"🌻":["sunflower"],"🌼":["blossom"],"🌷":["tulip"],"🌱":["seedling"],"🪴":["potted_plant"],"🌲":["evergreen_tree"],"🌳":["deciduous_tree"],"🌴":["palm_tree"],"🌵":["cactus"],"🌾":["ear_of_rice"],"🌿":["herb"],"☘️":["shamrock"],"🍀":["four_leaf_clover"],"🍁":["maple_leaf"],"🍂":["fallen_leaf"],"🍃":["leaves"],"🍇":["grapes"],"🍈":["melon"],"🍉":["watermelon"],"🍊":["tangerine"],"🍋":["lemon"],"🍌":["banana"],"🍍":["pineapple"],"🥭":["mango"],"🍎":["apple"],"🍏":["green_apple"],"🍐":["pear"],"🍑":["peach"],"🍒":["cherries"],"🍓":["strawberry"],"🫐":["blueberry"],"🥝":["kiwi"],"🍅":["tomato"],"🫒":["olive"],"🥥":["coconut"],"🥑":["avocado"],"🍆":["eggplant"],"🥔":["potato"],"🥕":["carrot"],"🌽":["corn"],"🌶️":["hot_pepper"],"🫑":["bell_pepper"],"🥒":["cucumber"],"🥬":["leafy_green"],"🥦":["broccoli"],"🧄":["garlic"],"🧅":["onion"],"🍄":["mushroom"],"🥜":["peanuts"],"🌰":["chestnut"],"🍞":["bread"],"🥐":["croissant"],"🥖":["french_bread"],"🫓":["flatbread"],"🥨":["pretzel"],"🥯":["bagel"],"🥞":["pancakes"],"🧇":["waffle"],"🧀":["cheese"],"🍖":["meat_on_bone"],"🍗":["poultry_leg"],"🥩":["cut_of_meat"],"🥓":["bacon"],"🍔":["hamburger"],"🍟":["fries"],"🍕":["pizza"],"🌭":["hotdog"],"🥪":["sandwich"],"🌮":["taco"],"🌯":["burrito"],"🫔":["tamale"],"🥙":["stuffed_flatbread"],"🧆":["falafel"],"🥚":["egg"],"🍳":["cooking"],"🥘":["shallow_pan_of_food"],"🍲":["stew"],"🫕":["fondue"],"🥣":["bowl_spoon"],"🥗":["salad"],"🍿":["popcorn"],"🧈":["butter"],"🧂":["salt"],"🥫":["canned_food"],"🍱":["bento"],"🍘":["rice_cracker"],"🍙":["rice_ball"],"🍚":["rice"],"🍛":["curry"],"🍜":["ramen"],"🍝":["spaghetti"],"🍠":["sweet_potato"],"🍢":["oden"],"🍣":["sushi"],"🍤":["fried_shrimp"],"🍥":["fish_cake"],"🥮":["moon_cake"],"🍡":["dango"],"🥟":["dumpling"],"🥠":["fortune_cookie"],"🥡":["takeout_box"],"🦀":["crab"],"🦞":["lobster"],"🦐":["shrimp"],"🦑":["squid"],"🦪":["oyster"],"🍦":["icecream"],"🍧":["shaved_ice"],"🍨":["ice_cream"],"🍩":["doughnut"],"🍪":["cookie"],"🎂":["birthday"],"🍰":["cake"],"🧁":["cupcake"],"🥧":["pie"],"🍫":["chocolate_bar"],"🍬":["candy"],"🍭":["lollipop"],"🍮":["custard"],"🍯":["honey_pot"],"🍼":["baby_bottle"],"🥛":["milk"],"☕️":["coffee"],"🫖":["teapot"],"🍵":["tea"],"🍶":["sake"],"🍾":["champagne"],"🍷":["wine_glass"],"🍸️":["cocktail"],"🍹":["tropical_drink"],"🍺":["beer"],"🍻":["beers"],"🥂":["champagne_glass"],"🥃":["tumbler_glass"],"🥤":["cup_straw"],"🧋":["bubble_tea","boba_drink"],"🧃":["beverage_box","juice_box"],"🧉":["mate","yerba_mate"],"🧊":["ice"],"🥢":["chopsticks"],"🍽️":["fork_knife_plate"],"🍴":["utensils"],"🥄":["spoon"],"🔪":["knife"],"🏺":["amphora"],"🌍️":["earth_africa"],"🌎️":["earth_americas"],"🌏️":["earth_asia"],"🌐":["globe"],"🗺️":["map"],"🗾":["japan"],"🧭":["compass"],"🏔️":["snowy_mountain"],"⛰️":["mountain"],"🌋":["volcano"],"🗻":["mount_fuji"],"🏕️":["camping"],"🏖️":["beach"],"🏜️":["desert"],"🏝️":["island"],"🏞️":["park"],"🏟️":["stadium"],"🏛️":["classical_building"],"🏗️":["construction_site"],"🧱":["brick"],"🪨":["rock"],"🪵":["wood"],"🛖":["hut"],"🏘️":["homes"],"🏚️":["house_abandoned"],"🏠️":["house"],"🏡":["house_garden"],"🏢":["office"],"🏣":["ja_post_office"],"🏤":["post_office"],"🏥":["hospital"],"🏦":["bank"],"🏨":["hotel"],"🏩":["love_hotel"],"🏪":["convenience_store"],"🏫":["school"],"🏬":["department_store"],"🏭️":["factory"],"🏯":["japanese_castle"],"🏰":["castle","european_castle"],"💒":["wedding"],"🗼":["tokyo_tower"],"🗽":["statue_of_liberty"],"⛪️":["church"],"🕌":["mosque"],"🛕":["hindu_temple"],"🕍":["synagogue"],"⛩️":["shinto_shrine"],"🕋":["kaaba"],"⛲️":["fountain"],"⛺️":["tent"],"🌁":["foggy"],"🌃":["night_stars"],"🏙️":["cityscape"],"🌄":["sunrise_over_mountains"],"🌅":["sunrise"],"🌆":["dusk"],"🌇":["sunset"],"🌉":["bridge_at_night"],"♨️":["hotsprings"],"🎠":["carousel_horse"],"🎡":["ferris_wheel"],"🎢":["roller_coaster"],"💈":["barber"],"🎪":["circus_tent"],"🚂":["steam_locomotive"],"🚃":["railway_car"],"🚄":["bullettrain_side"],"🚅":["bullettrain"],"🚆":["train"],"🚇️":["metro"],"🚈":["light_rail"],"🚉":["station"],"🚊":["tram"],"🚝":["monorail"],"🚞":["mountain_railway"],"🚋":["tram_car"],"🚌":["bus"],"🚍️":["oncoming_bus"],"🚎":["trolleybus"],"🚐":["minibus"],"🚑️":["ambulance"],"🚒":["fire_engine"],"🚓":["police_car"],"🚔️":["oncoming_police_car"],"🚕":["taxi"],"🚖":["oncoming_taxi"],"🚗":["red_car"],"🚘️":["oncoming_automobile"],"🚙":["blue_car"],"🛻":["pickup_truck"],"🚚":["truck"],"🚛":["lorry"],"🚜":["tractor"],"🏎️":["race_car"],"🏍️":["motorcycle"],"🛵":["motor_scooter"],"🦽":["wheelchair"],"🦼":["motor_wheelchair"],"🛺":["auto_rickshaw"],"🚲️":["bike"],"🛴":["scooter"],"🛹":["skateboard"],"🛼":["roller_skate"],"🚏":["bus_stop"],"🛣️":["motorway"],"🛤️":["railway_track"],"🛢️":["oil_drum"],"⛽️":["fuel_pump"],"🚨":["rotating_light","police_light"],"🚥":["traffic_light"],"🚦":["vertical_traffic_light"],"🛑":["stop_sign","octagonal_sign"],"🚧":["construction"],"⚓️":["anchor"],"⛵️":["sailboat"],"🛶":["canoe"],"🚤":["speedboat"],"🛳️":["cruise_ship"],"⛴️":["ferry"],"🛥️":["motorboat"],"🚢":["ship"],"✈️":["airplane"],"🛩️":["small_airplane"],"🛫":["airplane_departure"],"🛬":["airplane_arriving"],"🪂":["parachute"],"💺":["seat"],"🚁":["helicopter"],"🚟":["suspension_railway"],"🚠":["mountain_cableway"],"🚡":["aerial_tramway"],"🛰️":["satellite"],"🚀":["rocket"],"🛸":["flying_saucer"],"🛎️":["bellhop"],"🧳":["luggage"],"⌛️":["hourglass"],"⏳️":["hourglass_flowing"],"⌚️":["watch"],"⏰":["alarm_clock"],"⏱️":["stopwatch"],"⏲️":["timer"],"🕰️":["clock"],"🕛️":["clock12"],"🕧️":["clock1230"],"🕐️":["clock1"],"🕜️":["clock130"],"🕑️":["clock2"],"🕝️":["clock230"],"🕒️":["clock3"],"🕞️":["clock330"],"🕓️":["clock4"],"🕟️":["clock430"],"🕔️":["clock5"],"🕠️":["clock530"],"🕕️":["clock6"],"🕡️":["clock630"],"🕖️":["clock7"],"🕢️":["clock730"],"🕗️":["clock8"],"🕣️":["clock830"],"🕘️":["clock9"],"🕤️":["clock930"],"🕙️":["clock10"],"🕥️":["clock1030"],"🕚️":["clock11"],"🕦️":["clock1130"],"🌑":["new_moon"],"🌒":["waxing_crescent_moon"],"🌓":["first_quarter_moon"],"🌔":["waxing_gibbous_moon"],"🌕️":["full_moon"],"🌖":["waning_gibbous_moon"],"🌗":["last_quarter_moon"],"🌘":["waning_crescent_moon"],"🌙":["crescent_moon"],"🌚":["new_moon_face"],"🌛":["first_quarter_moon_face"],"🌜️":["last_quarter_moon_face"],"🌡️":["thermometer"],"☀️":["sun"],"🌝":["full_moon_face"],"🌞":["sun_face"],"🪐":["ringed_planet","saturn"],"⭐️":["star"],"🌟":["star2","glowing_star"],"🌠":["star3","shooting_star"],"🌌":["milky_way"],"☁️":["cloud"],"⛅️":["partly_sunny"],"⛈️":["storm"],"🌤️":["overcast"],"🌥️":["cloudy"],"🌦️":["sunshower"],"🌧️":["rain"],"🌨️":["snow"],"🌩️":["lightning"],"🌪️":["tornado"],"🌫️":["fog"],"🌬️":["wind_face"],"🌀":["cyclone"],"🌈":["rainbow"],"🌂":["closed_umbrella"],"☂️":["umbrella"],"☔️":["umbrella_rain"],"⛱️":["beach_umbrella"],"⚡️":["zap","high_voltage"],"❄️":["snowflake"],"☃️":["snowy_snowman"],"⛄️":["snowman"],"☄️":["comet"],"🔥":["fire"],"💧":["droplet"],"🌊":["ocean"],"🎃":["jack_o_lantern"],"🎄":["christmas_tree","xmas_tree"],"🎆":["fireworks"],"🎇":["sparkler"],"🧨":["firecracker"],"✨":["sparkles"],"🎈":["balloon"],"🎉":["tada","party"],"🎊":["confetti_ball"],"🎋":["tanabata_tree"],"🎍":["bamboo","pine_decor"],"🎎":["dolls"],"🎏":["carp_streamer"],"🎐":["wind_chime"],"🎑":["moon_ceremony","rice_scene"],"🧧":["red_envelope"],"🎀":["ribbon"],"🎁":["gift"],"🎗️":["reminder_ribbon"],"🎟️":["tickets","admission"],"🎫":["ticket"],"🎖️":["military_medal"],"🏆️":["trophy"],"🏅":["medal"],"🥇":["first_place"],"🥈":["second_place"],"🥉":["third_place"],"⚽️":["soccer"],"⚾️":["baseball"],"🥎":["softball"],"🏀":["basketball"],"🏐":["volleyball"],"🏈":["football"],"🏉":["rugby"],"🎾":["tennis"],"🥏":["flying_disc"],"🎳":["bowling"],"🏏":["cricket_game"],"🏑":["field_hockey"],"🏒":["hockey"],"🥍":["lacrosse"],"🏓":["ping_pong"],"🏸":["badminton"],"🥊":["boxing_glove"],"🥋":["gi","martial_arts_uniform"],"🥅":["goal"],"⛳️":["golf"],"⛸️":["ice_skate"],"🎣":["fishing_pole"],"🤿":["diving_mask","scuba_mask"],"🎽":["running_shirt"],"🎿":["ski"],"🛷":["sled"],"🥌":["curling_stone"],"🎯":["dart"],"🪀":["yoyo"],"🪁":["kite"],"🎱":["8ball"],"🔮":["crystal_ball"],"🪄":["wand"],"🧿":["nazar_amulet"],"🎮️":["video_game"],"🕹️":["joystick"],"🎰":["slot_machine"],"🎲":["game_die"],"🧩":["jigsaw","puzzle_piece"],"🧸":["teddy_bear"],"🪅":["pinata"],"🪆":["nesting_dolls"],"♠️":["spades"],"♥️":["hearts"],"♦️":["diamonds"],"♣️":["clubs"],"♟️":["chess_pawn"],"🃏":["black_joker"],"🀄️":["mahjong"],"🎴":["flower_cards"],"🎭️":["performing_arts"],"🖼️":["frame_photo"],"🎨":["art","palette"],"🧵":["spool"],"🪡":["sewing_needle"],"🧶":["yarn"],"🪢":["knot"],"👓️":["glasses"],"🕶️":["sunglasses"],"🥽":["goggles"],"🥼":["lab_coat"],"🦺":["safety_vest"],"👔":["necktie","tie"],"👕":["shirt"],"👖":["jeans"],"🧣":["scarf"],"🧤":["gloves"],"🧥":["coat"],"🧦":["socks"],"👗":["dress"],"👘":["kimono"],"🥻":["sari"],"🩱":["one_piece_swimsuit"],"🩲":["briefs"],"🩳":["shorts"],"👙":["bikini"],"👚":["blouse","womans_clothes"],"👛":["purse"],"👜":["handbag"],"👝":["pouch","clutch_bag"],"🛍️":["shopping_bags"],"🎒":["backpack"],"🩴":["sandal"],"👞":["dress_shoe","mans_shoe"],"👟":["sneaker","athletic_shoe"],"🥾":["hiking_boot"],"🥿":["flat_shoe"],"👠":["high_heel"],"👡":["womans_sandal"],"🩰":["ballet_shoes"],"👢":["womans_boot"],"👑":["crown"],"👒":["womans_hat"],"🎩":["top_hat"],"🎓️":["graduation_cap"],"🧢":["billed_cap"],"🪖":["military_helmet"],"⛑️":["helmet_cross"],"📿":["prayer_beads"],"💄":["lipstick"],"💍":["ring"],"💎":["gem"],"🔇":["mute","no_sound"],"🔈️":["speaker","low_sound"],"🔉":["sound"],"🔊":["loud_sound"],"📢":["loudspeaker"],"📣":["megaphone"],"📯":["postal_horn"],"🔔":["bell"],"🔕":["no_bell"],"🎼":["musical_score"],"🎵":["musical_note"],"🎶":["musical_notes"],"🎙️":["studio_microphone"],"🎚️":["level_slider"],"🎛️":["control_knobs"],"🎤":["microphone"],"🎧️":["headphones"],"📻️":["radio"],"🎷":["saxophone"],"🪗":["accordion"],"🎸":["guitar"],"🎹":["musical_keyboard"],"🎺":["trumpet"],"🎻":["violin"],"🪕":["banjo"],"🥁":["drum"],"🪘":["long_drum"],"📱":["mobile","iphone","android"],"📲":["mobile_calling"],"☎️":["telephone"],"📞":["telephone_receiver"],"📟️":["pager"],"📠":["fax"],"🔋":["battery"],"🔌":["electric_plug"],"💻️":["laptop"],"🖥️":["desktop","computer"],"🖨️":["printer"],"⌨️":["keyboard"],"🖱️":["computer_mouse"],"🖲️":["trackball"],"💽":["minidisc"],"💾":["floppy_disk"],"💿️":["cd","disk"],"📀":["dvd"],"🧮":["abacus"],"🎥":["movie_camera"],"🎞️":["film_frames"],"📽️":["projector"],"🎬️":["clapper"],"📺️":["tv"],"📷️":["camera"],"📸":["camera_flash"],"📹️":["video_camera"],"📼":["vhs"],"🔍️":["mag"],"🔎":["mag_right"],"🕯️":["candle"],"💡":["bulb","light_bulb"],"🔦":["flashlight"],"🏮":["red_lantern"],"🪔":["diya_lamp"],"📔":["decorative_notebook"],"📕":["closed_book"],"📖":["book"],"📗":["green_book"],"📘":["blue_book"],"📙":["orange_book"],"📚️":["books"],"📓":["notebook"],"📒":["ledger"],"📃":["page_curl"],"📜":["scroll"],"📄":["page_facing_up"],"📰":["newspaper"],"🗞️":["rolled_newspaper"],"📑":["bookmark_tabs"],"🔖":["bookmark"],"🏷️":["label"],"💰️":["moneybag"],"🪙":["coin"],"💴":["yen"],"💵":["dollar"],"💶":["euro"],"💷":["pound"],"💸":["money_wings"],"💳️":["credit_card"],"🧾":["receipt"],"💹":["ja_chart"],"✉️":["envelope"],"📧":["email"],"📨":["incoming_envelope"],"📩":["envelope_arrow"],"📤️":["outbox_tray"],"📥️":["inbox_tray"],"📦️":["package"],"📫️":["mailbox"],"📪️":["mailbox_closed"],"📬️":["mailbox_mail"],"📭️":["mailbox_no_mail"],"📮":["postbox"],"🗳️":["ballot_box"],"✏️":["pencil"],"✒️":["black_nib"],"🖋️":["fountain_pen"],"🖊️":["pen"],"🖌️":["paintbrush"],"🖍️":["crayon"],"📝":["memo"],"💼":["briefcase"],"📁":["file_folder"],"📂":["open_file_folder"],"🗂️":["dividers"],"📅":["date","calendar"],"📆":["torn_calendar"],"🗒️":["notepad_spiral"],"🗓️":["calendar_spiral"],"📇":["card_index"],"📈":["chart_up"],"📉":["chart_down"],"📊":["bar_chart"],"📋️":["clipboard"],"📌":["pushpin"],"📍":["round_pushpin"],"📎":["paperclip"],"🖇️":["paperclips"],"📏":["straight_ruler"],"📐":["triangular_ruler"],"✂️":["scissors"],"🗃️":["card_box"],"🗄️":["file_cabinet"],"🗑️":["trashcan","wastebasket"],"🔒️":["lock"],"🔓️":["unlock"],"🔏":["locked_pen"],"🔐":["locked_key"],"🔑":["key"],"🗝️":["old_key"],"🔨":["hammer"],"🪓":["axe"],"⛏️":["pick"],"⚒️":["hammer_pick"],"🛠️":["tools","hammer_wrench"],"🗡️":["dagger"],"⚔️":["crossed_swords"],"🔫":["gun","pistol"],"🪃":["boomerang"],"🏹":["bow"],"🛡️":["shield"],"🪚":["saw"],"🔧":["wrench"],"🪛":["screwdriver"],"🔩":["nut_and_bolt"],"⚙️":["gear"],"🗜️":["clamp","compression"],"⚖️":["scales"],"🦯":["probing_cane"],"🔗":["link"],"⛓️":["chains"],"🪝":["hook"],"🧰":["toolbox"],"🧲":["magnet"],"🪜":["ladder"],"⚗️":["alembic"],"🧪":["test_tube"],"🧫":["petri_dish"],"🧬":["dna","double_helix"],"🔬":["microscope"],"🔭":["telescope"],"📡":["satellite_antenna"],"💉":["syringe"],"🩸":["blood_drop"],"💊":["pill"],"🩹":["bandaid","adhesive_bandage"],"🩺":["stethoscope"],"🚪":["door"],"🛗":["elevator"],"🪞":["mirror"],"🪟":["window"],"🛏️":["bed"],"🛋️":["couch"],"🪑":["chair"],"🚽":["toilet"],"🪠":["plunger"],"🚿":["shower"],"🛁":["bathtub"],"🪤":["mouse_trap"],"🪒":["razor"],"🧴":["lotion"],"🧷":["safety_pin"],"🧹":["broom"],"🧺":["basket"],"🧻":["toilet_paper"],"🪣":["bucket"],"🧼":["soap"],"🪥":["toothbrush"],"🧽":["sponge"],"🧯":["fire_extinguisher"],"🛒":["shopping_cart"],"🚬":["cigarette","smoking"],"⚰️":["coffin"],"🪦":["headstone"],"⚱️":["urn"],"🗿":["moai"],"🪧":["placard"],"🏧":["atm"],"🚮":["litter_bin"],"🚰":["potable_water"],"♿️":["handicapped"],"🚹️":["mens"],"🚺️":["womens"],"🚻":["restroom","bathroom"],"🚼️":["baby_symbol"],"🚾":["wc"],"🛂":["passport_control"],"🛃":["customs"],"🛄":["baggage_claim"],"🛅":["left_luggage"],"⚠️":["warning"],"🚸":["children_crossing"],"⛔️":["no_entry"],"🚫":["no_entry_sign"],"🚳":["no_bicycles"],"🚭️":["no_smoking"],"🚯":["do_not_litter"],"🚱":["non_potable_water"],"🚷":["no_pedestrians"],"📵":["no_mobile_phones"],"🔞":["underage"],"☢️":["radioactive"],"☣️":["biohazard"],"⬆️":["arrow_up"],"↗️":["arrow_upper_right"],"➡️":["arrow_right"],"↘️":["arrow_lower_right"],"⬇️":["arrow_down"],"↙️":["arrow_lower_left"],"⬅️":["arrow_left"],"↖️":["arrow_upper_left"],"↕️":["arrow_up_down"],"↔️":["arrow_left_right"],"↩️":["arrow_left_hook"],"↪️":["arrow_right_hook"],"⤴️":["arrow_heading_up"],"⤵️":["arrow_heading_down"],"🔃":["clockwise"],"🔄":["counter_clockwise"],"🔙":["back"],"🔚":["end"],"🔛":["on"],"🔜":["soon"],"🔝":["top"],"🛐":["place_of_worship"],"⚛️":["atom"],"🕉️":["om_symbol"],"✡️":["star_of_david"],"☸️":["wheel_of_dharma"],"☯️":["yin_yang"],"✝️":["cross"],"☦️":["orthodox_cross"],"☪️":["star_and_crescent"],"☮️":["peace"],"🕎":["menorah"],"🔯":["six_pointed_star"],"♈️":["aries"],"♉️":["taurus"],"♊️":["gemini"],"♋️":["cancer"],"♌️":["leo"],"♍️":["virgo"],"♎️":["libra"],"♏️":["scorpius"],"♐️":["sagittarius"],"♑️":["capricorn"],"♒️":["aquarius"],"♓️":["pisces"],"⛎":["ophiuchus"],"🔀":["shuffle"],"🔁":["repeat"],"🔂":["repeat_single"],"▶️":["play"],"⏩️":["fast_forward"],"⏭️":["next_track"],"⏯️":["play_pause"],"◀️":["reverse"],"⏪️":["rewind"],"⏮️":["previous_track"],"🔼":["up_button"],"⏫":["fast_up_button"],"🔽":["down_button"],"⏬":["fast_down_button"],"⏸️":["pause"],"⏹️":["stop"],"⏺️":["record"],"⏏️":["eject"],"🎦":["cinema"],"🔅":["dim","low_brightness"],"🔆":["bright","high_brightness"],"📶":["signal_strength","antenna_bars"],"📳":["vibration_mode"],"📴":["mobile_phone_off"],"♀️":["female","female_sign"],"♂️":["male","male_sign"],"⚧️":["trans"],"✖️":["multiplication"],"➕":["plus"],"➖":["minus"],"➗":["division"],"♾️":["infinity"],"‼️":["bangbang","double_exclamation"],"⁉️":["interrobang","exclamation_question"],"❓️":["question"],"❔":["white_question"],"❕":["white_exclamation"],"❗️":["exclamation"],"〰️":["wavy_dash"],"💱":["currency_exchange"],"💲":["dollar_sign"],"⚕️":["medical"],"♻️":["recycle"],"⚜️":["fleur-de-lis"],"🔱":["trident"],"📛":["name_badge"],"🔰":["ja_beginner"],"⭕️":["o"],"✅":["white_check_mark"],"☑️":["checked_ballot"],"✔️":["check_mark"],"❌":["x","cross_mark"],"❎":["cross_mark_button"],"➰":["curly_loop"],"➿":["double_curly_loop"],"〽️":["part_alternation_mark"],"✳️":["eight_spoked_asterisk"],"✴️":["eight_pointed_star"],"❇️":["sparkle"],"©️":["copyright"],"®️":["registered"],"™️":["tm"],"#️⃣":["hash"],"*️⃣":["asterisk"],"0️⃣":["zero"],"1️⃣":["one"],"2️⃣":["two"],"3️⃣":["three"],"4️⃣":["four"],"5️⃣":["five"],"6️⃣":["six"],"7️⃣":["seven"],"8️⃣":["eight"],"9️⃣":["nine"],"🔟":["ten"],"🔠":["upper_abcd"],"🔡":["abcd"],"🔢":["1234"],"🔣":["symbols"],"🔤":["abc"],"🅰️":["a_blood"],"🆎":["ab_blood"],"🅱️":["b_blood"],"🆑":["cl"],"🆒":["cool"],"🆓":["free"],"ℹ️":["info"],"🆔":["id"],"Ⓜ️":["m"],"🆕":["new"],"🆖":["ng"],"🅾️":["o_blood"],"🆗":["ok"],"🅿️":["p"],"🆘":["sos"],"🆙":["up"],"🆚":["vs"],"🈁":["ja_here","koko"],"🈂️":["ja_service_charge"],"🈷️":["ja_monthly_amount"],"🈶":["ja_not_free_of_carge"],"🈯️":["ja_reserved"],"🉐":["ja_bargain"],"🈹":["ja_discount"],"🈚️":["ja_free_of_charge"],"🈲":["ja_prohibited"],"🉑":["ja_acceptable"],"🈸":["ja_application"],"🈴":["ja_passing_grade"],"🈳":["ja_vacancy"],"㊗️":["ja_congratulations"],"㊙️":["ja_secret"],"🈺":["ja_open_for_business"],"🈵":["ja_no_vacancy"],"🔴":["red_circle"],"🟠":["orange_circle"],"🟡":["yellow_circle"],"🟢":["green_circle"],"🔵":["blue_circle"],"🟣":["purple_circle"],"🟤":["brown_circle"],"⚫️":["black_circle"],"⚪️":["white_circle"],"🟥":["red_square"],"🟧":["orange_square"],"🟨":["yellow_square"],"🟩":["green_square"],"🟦":["blue_square"],"🟪":["purple_square"],"🟫":["brown_square"],"⬛️":["large_black_square"],"⬜️":["large_white_square"],"◼️":["medium_black_square"],"◻️":["medium_white_square"],"◾️":["medium_small_black_square"],"◽️":["medium_small_white_square"],"▪️":["small_black_square"],"▫️":["small_white_square"],"🔶":["large_orange_diamond"],"🔷":["large_blue_diamond"],"🔸":["small_orange_diamond"],"🔹":["small_blue_diamond"],"🔺":["up_red_triangle"],"🔻":["down_red_triangle"],"💠":["diamond_dot"],"🔘":["radio_button"],"🔳":["white_square_button"],"🔲":["black_square_button"],"🏁":["checkered_flag"],"🚩":["triangle_flag"],"🎌":["crossed_flags"],"🏴":["black_flag"],"🏳️":["white_flag"],"🏳️‍🌈":["rainbow_flag"],"🏳️‍⚧️":["trans_flag"],"🏴‍☠️":["pirate_flag","jolly_roger"],"🇦🇨":["flag_ac"],"🇦🇩":["flag_ad"],"🇦🇪":["flag_ae"],"🇦🇫":["flag_af"],"🇦🇬":["flag_ag"],"🇦🇮":["flag_ai"],"🇦🇱":["flag_al"],"🇦🇲":["flag_am"],"🇦🇴":["flag_ao"],"🇦🇶":["flag_aq"],"🇦🇷":["flag_ar"],"🇦🇸":["flag_as"],"🇦🇹":["flag_at"],"🇦🇺":["flag_au"],"🇦🇼":["flag_aw"],"🇦🇽":["flag_ax"],"🇦🇿":["flag_az"],"🇧🇦":["flag_ba"],"🇧🇧":["flag_bb"],"🇧🇩":["flag_bd"],"🇧🇪":["flag_be"],"🇧🇫":["flag_bf"],"🇧🇬":["flag_bg"],"🇧🇭":["flag_bh"],"🇧🇮":["flag_bi"],"🇧🇯":["flag_bj"],"🇧🇱":["flag_bl"],"🇧🇲":["flag_bm"],"🇧🇳":["flag_bn"],"🇧🇴":["flag_bo"],"🇧🇶":["flag_bq"],"🇧🇷":["flag_br"],"🇧🇸":["flag_bs"],"🇧🇹":["flag_bt"],"🇧🇻":["flag_bv"],"🇧🇼":["flag_bw"],"🇧🇾":["flag_by"],"🇧🇿":["flag_bz"],"🇨🇦":["flag_ca"],"🇨🇨":["flag_cc"],"🇨🇩":["flag_cd"],"🇨🇫":["flag_cf"],"🇨🇬":["flag_cg"],"🇨🇭":["flag_ch"],"🇨🇮":["flag_ci"],"🇨🇰":["flag_ck"],"🇨🇱":["flag_cl"],"🇨🇲":["flag_cm"],"🇨🇳":["flag_cn"],"🇨🇴":["flag_co"],"🇨🇵":["flag_cp"],"🇨🇷":["flag_cr"],"🇨🇺":["flag_cu"],"🇨🇻":["flag_cv"],"🇨🇼":["flag_cw"],"🇨🇽":["flag_cx"],"🇨🇾":["flag_cy"],"🇨🇿":["flag_cz"],"🇩🇪":["flag_de"],"🇩🇬":["flag_dg"],"🇩🇯":["flag_dj"],"🇩🇰":["flag_dk"],"🇩🇲":["flag_dm"],"🇩🇴":["flag_do"],"🇩🇿":["flag_dz"],"🇪🇦":["flag_ea"],"🇪🇨":["flag_ec"],"🇪🇪":["flag_ee"],"🇪🇬":["flag_eg"],"🇪🇭":["flag_eh"],"🇪🇷":["flag_er"],"🇪🇸":["flag_es"],"🇪🇹":["flag_et"],"🇪🇺":["flag_eu"],"🇫🇮":["flag_fi"],"🇫🇯":["flag_fj"],"🇫🇰":["flag_fk"],"🇫🇲":["flag_fm"],"🇫🇴":["flag_fo"],"🇫🇷":["flag_fr"],"🇬🇦":["flag_ga"],"🇬🇧":["flag_gb"],"🇬🇩":["flag_gd"],"🇬🇪":["flag_ge"],"🇬🇫":["flag_gf"],"🇬🇬":["flag_gg"],"🇬🇭":["flag_gh"],"🇬🇮":["flag_gi"],"🇬🇱":["flag_gl"],"🇬🇲":["flag_gm"],"🇬🇳":["flag_gn"],"🇬🇵":["flag_gp"],"🇬🇶":["flag_gq"],"🇬🇷":["flag_gr"],"🇬🇸":["flag_gs"],"🇬🇹":["flag_gt"],"🇬🇺":["flag_gu"],"🇬🇼":["flag_gw"],"🇬🇾":["flag_gy"],"🇭🇰":["flag_hk"],"🇭🇲":["flag_hm"],"🇭🇳":["flag_hn"],"🇭🇷":["flag_hr"],"🇭🇹":["flag_ht"],"🇭🇺":["flag_hu"],"🇮🇨":["flag_ic"],"🇮🇩":["flag_id"],"🇮🇪":["flag_ie"],"🇮🇱":["flag_il"],"🇮🇲":["flag_im"],"🇮🇳":["flag_in"],"🇮🇴":["flag_io"],"🇮🇶":["flag_iq"],"🇮🇷":["flag_ir"],"🇮🇸":["flag_is"],"🇮🇹":["flag_it"],"🇯🇪":["flag_je"],"🇯🇲":["flag_jm"],"🇯🇴":["flag_jo"],"🇯🇵":["flag_jp"],"🇰🇪":["flag_ke"],"🇰🇬":["flag_kg"],"🇰🇭":["flag_kh"],"🇰🇮":["flag_ki"],"🇰🇲":["flag_km"],"🇰🇳":["flag_kn"],"🇰🇵":["flag_kp"],"🇰🇷":["flag_kr"],"🇰🇼":["flag_kw"],"🇰🇾":["flag_ky"],"🇰🇿":["flag_kz"],"🇱🇦":["flag_la"],"🇱🇧":["flag_lb"],"🇱🇨":["flag_lc"],"🇱🇮":["flag_li"],"🇱🇰":["flag_lk"],"🇱🇷":["flag_lr"],"🇱🇸":["flag_ls"],"🇱🇹":["flag_lt"],"🇱🇺":["flag_lu"],"🇱🇻":["flag_lv"],"🇱🇾":["flag_ly"],"🇲🇦":["flag_ma"],"🇲🇨":["flag_mc"],"🇲🇩":["flag_md"],"🇲🇪":["flag_me"],"🇲🇫":["flag_mf"],"🇲🇬":["flag_mg"],"🇲🇭":["flag_mh"],"🇲🇰":["flag_mk"],"🇲🇱":["flag_ml"],"🇲🇲":["flag_mm"],"🇲🇳":["flag_mn"],"🇲🇴":["flag_mo"],"🇲🇵":["flag_mp"],"🇲🇶":["flag_mq"],"🇲🇷":["flag_mr"],"🇲🇸":["flag_ms"],"🇲🇹":["flag_mt"],"🇲🇺":["flag_mu"],"🇲🇻":["flag_mv"],"🇲🇼":["flag_mw"],"🇲🇽":["flag_mx"],"🇲🇾":["flag_my"],"🇲🇿":["flag_mz"],"🇳🇦":["flag_na"],"🇳🇨":["flag_nc"],"🇳🇪":["flag_ne"],"🇳🇫":["flag_nf"],"🇳🇬":["flag_ng"],"🇳🇮":["flag_ni"],"🇳🇱":["flag_nl"],"🇳🇴":["flag_no"],"🇳🇵":["flag_np"],"🇳🇷":["flag_nr"],"🇳🇺":["flag_nu"],"🇳🇿":["flag_nz"],"🇴🇲":["flag_om"],"🇵🇦":["flag_pa"],"🇵🇪":["flag_pe"],"🇵🇫":["flag_pf"],"🇵🇬":["flag_pg"],"🇵🇭":["flag_ph"],"🇵🇰":["flag_pk"],"🇵🇱":["flag_pl"],"🇵🇲":["flag_pm"],"🇵🇳":["flag_pn"],"🇵🇷":["flag_pr"],"🇵🇸":["flag_ps"],"🇵🇹":["flag_pt"],"🇵🇼":["flag_pw"],"🇵🇾":["flag_py"],"🇶🇦":["flag_qa"],"🇷🇪":["flag_re"],"🇷🇴":["flag_ro"],"🇷🇸":["flag_rs"],"🇷🇺":["flag_ru"],"🇷🇼":["flag_rw"],"🇸🇦":["flag_sa"],"🇸🇧":["flag_sb"],"🇸🇨":["flag_sc"],"🇸🇩":["flag_sd"],"🇸🇪":["flag_se"],"🇸🇬":["flag_sg"],"🇸🇭":["flag_sh"],"🇸🇮":["flag_si"],"🇸🇯":["flag_sj"],"🇸🇰":["flag_sk"],"🇸🇱":["flag_sl"],"🇸🇲":["flag_sm"],"🇸🇳":["flag_sn"],"🇸🇴":["flag_so"],"🇸🇷":["flag_sr"],"🇸🇸":["flag_ss"],"🇸🇹":["flag_st"],"🇸🇻":["flag_sv"],"🇸🇽":["flag_sx"],"🇸🇾":["flag_sy"],"🇸🇿":["flag_sz"],"🇹🇦":["flag_ta"],"🇹🇨":["flag_tc"],"🇹🇩":["flag_td"],"🇹🇫":["flag_tf"],"🇹🇬":["flag_tg"],"🇹🇭":["flag_th"],"🇹🇯":["flag_tj"],"🇹🇰":["flag_tk"],"🇹🇱":["flag_tl"],"🇹🇲":["flag_tm"],"🇹🇳":["flag_tn"],"🇹🇴":["flag_to"],"🇹🇷":["flag_tr"],"🇹🇹":["flag_tt"],"🇹🇻":["flag_tv"],"🇹🇼":["flag_tw"],"🇹🇿":["flag_tz"],"🇺🇦":["flag_ua"],"🇺🇬":["flag_ug"],"🇺🇲":["flag_um"],"🇺🇳":["flag_un"],"🇺🇸":["flag_us","usa"],"🇺🇾":["flag_uy"],"🇺🇿":["flag_uz"],"🇻🇦":["flag_va"],"🇻🇨":["flag_vc"],"🇻🇪":["flag_ve"],"🇻🇬":["flag_vg"],"🇻🇮":["flag_vi"],"🇻🇳":["flag_vn"],"🇻🇺":["flag_vu"],"🇼🇫":["flag_wf"],"🇼🇸":["flag_ws"],"🇽🇰":["flag_xk"],"🇾🇪":["flag_ye"],"🇾🇹":["flag_yt"],"🇿🇦":["flag_za"],"🇿🇲":["flag_zm"],"🇿🇼":["flag_zw"],"🏴󠁧󠁢󠁥󠁮󠁧󠁿":["flag_gbeng","england"],"🏴󠁧󠁢󠁳󠁣󠁴󠁿":["flag_gbsct","scotland"],"🏴󠁧󠁢󠁷󠁬󠁳󠁿":["flag_gbwls","wales"]}')},function(e){e.exports=JSON.parse("{}")},function(e,d){e.exports=flarum.core.compat.app},function(e,d){e.exports=flarum.core.compat["components/TextEditorButton"]},function(e,d){e.exports=flarum.core.compat["utils/KeyboardNavigatable"]},function(e,d){e.exports=flarum.core.compat.Fragment},function(e,d){e.exports=flarum.core.compat["models/Post"]},function(e,d,a){"use strict";a.r(d);var u=a(4),o=a.n(u),n=a(2),r=(a(3),a(0)),t=a(1),c=a.n(t),f=a(5),i=a.n(f),_=a(6),l=a.n(_);function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,d,a){return d in e?Object.defineProperty(e,d,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[d]=a,e}var p=a(7),b=function(e){var d,a;function u(){for(var d,a=arguments.length,u=new Array(a),o=0;o<a;o++)u[o]=arguments[o];return g(s(s(d=e.call.apply(e,[this].concat(u))||this)),"items",[]),g(s(s(d)),"active",!1),g(s(s(d)),"index",0),g(s(s(d)),"keyWasJustPressed",!1),d}a=e,(d=u).prototype=Object.create(a.prototype),d.prototype.constructor=d,d.__proto__=a;var o=u.prototype;return o.view=function(){return m("ul",{className:"Dropdown-menu EmojiDropdown"},m("li",{className:"Dropdown-header"},app.translator.trans("flarum-emoji.forum.composer.type_to_search_text")),this.items.map((function(e){return m("li",{key:e.attrs.key},e)})))},o.show=function(e,d){this.$().show().css({left:e+"px",top:d+"px"}),this.active=!0},o.hide=function(){this.$().hide(),this.active=!1},o.navigate=function(e){var d=this;this.keyWasJustPressed=!0,this.setIndex(this.index+e,!0),clearTimeout(this.keyWasJustPressedTimeout),this.keyWasJustPressedTimeout=setTimeout((function(){return d.keyWasJustPressed=!1}),500)},o.complete=function(){this.$("li:not(.Dropdown-header)").eq(this.index).find("button").click()},o.setIndex=function(e,d){if(!this.keyWasJustPressed||d){var a=this.$(),u=a.find("li:not(.Dropdown-header)"),o=e;o<0?o=u.length-1:o>=u.length&&(o=0),this.index=o;var n=u.removeClass("active").eq(o).addClass("active");if(d){var r,t=a.scrollTop(),c=a.offset().top,f=c+a.outerHeight(),i=n.offset().top,_=i+n.outerHeight();i<c?r=t-c+i-parseInt(a.css("padding-top"),10):_>f&&(r=t-f+_+parseInt(a.css("padding-bottom"),10)),void 0!==r&&a.stop(!0).animate({scrollTop:r},100)}}},u}(a.n(p).a),h=function(){var e={base:"https://twemoji.maxcdn.com/v/13.0.0/",ext:".png",size:"72x72",className:"emoji",convert:{fromCodePoint:function(e){var d="string"==typeof e?parseInt(e,16):e;if(d<65536)return t(d);return t(55296+((d-=65536)>>10),56320+(1023&d))},toCodePoint:p},onerror:function(){this.parentNode&&this.parentNode.replaceChild(c(this.alt,!1),this)},parse:function(d,a){a&&"function"!=typeof a||(a={callback:a});return("string"==typeof d?l:_)(d,{callback:a.callback||f,attributes:"function"==typeof a.attributes?a.attributes:g,base:"string"==typeof a.base?a.base:e.base,ext:a.ext||e.ext,size:a.folder||(u=a.size||e.size,"number"==typeof u?u+"x"+u:u),className:a.className||e.className,onerror:a.onerror||e.onerror});var u},replace:m,test:function(e){a.lastIndex=0;var d=a.test(e);return a.lastIndex=0,d}},d={"&":"&amp;","<":"&lt;",">":"&gt;","'":"&#39;",'"':"&quot;"},a=/(?:\ud83d\udc68\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc68\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc68\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc68\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc68\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffc-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffd-\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb\udffc\udffe\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffd\udfff]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc68\ud83c[\udffb-\udffe]|\ud83d\udc69\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83d\udc69\ud83c[\udffb-\udffe]|\ud83e\uddd1\ud83c\udffb\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffc\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffd\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udffe\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\ud83c\udfff\u200d\ud83e\udd1d\u200d\ud83e\uddd1\ud83c[\udffb-\udfff]|\ud83e\uddd1\u200d\ud83e\udd1d\u200d\ud83e\uddd1|\ud83d\udc6b\ud83c[\udffb-\udfff]|\ud83d\udc6c\ud83c[\udffb-\udfff]|\ud83d\udc6d\ud83c[\udffb-\udfff]|\ud83d[\udc6b-\udc6d])|(?:\ud83d[\udc68\udc69]|\ud83e\uddd1)(?:\ud83c[\udffb-\udfff])?\u200d(?:\u2695\ufe0f|\u2696\ufe0f|\u2708\ufe0f|\ud83c[\udf3e\udf73\udf7c\udf84\udf93\udfa4\udfa8\udfeb\udfed]|\ud83d[\udcbb\udcbc\udd27\udd2c\ude80\ude92]|\ud83e[\uddaf-\uddb3\uddbc\uddbd])|(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75]|\u26f9)((?:\ud83c[\udffb-\udfff]|\ufe0f)\u200d[\u2640\u2642]\ufe0f)|(?:\ud83c[\udfc3\udfc4\udfca]|\ud83d[\udc6e\udc70\udc71\udc73\udc77\udc81\udc82\udc86\udc87\ude45-\ude47\ude4b\ude4d\ude4e\udea3\udeb4-\udeb6]|\ud83e[\udd26\udd35\udd37-\udd39\udd3d\udd3e\uddb8\uddb9\uddcd-\uddcf\uddd6-\udddd])(?:\ud83c[\udffb-\udfff])?\u200d[\u2640\u2642]\ufe0f|(?:\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d[\udc68\udc69]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc68|\ud83d\udc68\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc68\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d[\udc68\udc69]|\ud83d\udc69\u200d\ud83d\udc66\u200d\ud83d\udc66|\ud83d\udc69\u200d\ud83d\udc67\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83c\udff3\ufe0f\u200d\u26a7\ufe0f|\ud83c\udff3\ufe0f\u200d\ud83c\udf08|\ud83c\udff4\u200d\u2620\ufe0f|\ud83d\udc15\u200d\ud83e\uddba|\ud83d\udc3b\u200d\u2744\ufe0f|\ud83d\udc41\u200d\ud83d\udde8|\ud83d\udc68\u200d\ud83d[\udc66\udc67]|\ud83d\udc69\u200d\ud83d[\udc66\udc67]|\ud83d\udc6f\u200d\u2640\ufe0f|\ud83d\udc6f\u200d\u2642\ufe0f|\ud83e\udd3c\u200d\u2640\ufe0f|\ud83e\udd3c\u200d\u2642\ufe0f|\ud83e\uddde\u200d\u2640\ufe0f|\ud83e\uddde\u200d\u2642\ufe0f|\ud83e\udddf\u200d\u2640\ufe0f|\ud83e\udddf\u200d\u2642\ufe0f|\ud83d\udc08\u200d\u2b1b)|[#*0-9]\ufe0f?\u20e3|(?:[©®\u2122\u265f]\ufe0f)|(?:\ud83c[\udc04\udd70\udd71\udd7e\udd7f\ude02\ude1a\ude2f\ude37\udf21\udf24-\udf2c\udf36\udf7d\udf96\udf97\udf99-\udf9b\udf9e\udf9f\udfcd\udfce\udfd4-\udfdf\udff3\udff5\udff7]|\ud83d[\udc3f\udc41\udcfd\udd49\udd4a\udd6f\udd70\udd73\udd76-\udd79\udd87\udd8a-\udd8d\udda5\udda8\uddb1\uddb2\uddbc\uddc2-\uddc4\uddd1-\uddd3\udddc-\uddde\udde1\udde3\udde8\uddef\uddf3\uddfa\udecb\udecd-\udecf\udee0-\udee5\udee9\udef0\udef3]|[\u203c\u2049\u2139\u2194-\u2199\u21a9\u21aa\u231a\u231b\u2328\u23cf\u23ed-\u23ef\u23f1\u23f2\u23f8-\u23fa\u24c2\u25aa\u25ab\u25b6\u25c0\u25fb-\u25fe\u2600-\u2604\u260e\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262a\u262e\u262f\u2638-\u263a\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267b\u267f\u2692-\u2697\u2699\u269b\u269c\u26a0\u26a1\u26a7\u26aa\u26ab\u26b0\u26b1\u26bd\u26be\u26c4\u26c5\u26c8\u26cf\u26d1\u26d3\u26d4\u26e9\u26ea\u26f0-\u26f5\u26f8\u26fa\u26fd\u2702\u2708\u2709\u270f\u2712\u2714\u2716\u271d\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u2764\u27a1\u2934\u2935\u2b05-\u2b07\u2b1b\u2b1c\u2b50\u2b55\u3030\u303d\u3297\u3299])(?:\ufe0f|(?!\ufe0e))|(?:(?:\ud83c[\udfcb\udfcc]|\ud83d[\udd74\udd75\udd90]|[\u261d\u26f7\u26f9\u270c\u270d])(?:\ufe0f|(?!\ufe0e))|(?:\ud83c[\udf85\udfc2-\udfc4\udfc7\udfca]|\ud83d[\udc42\udc43\udc46-\udc50\udc66-\udc69\udc6e\udc70-\udc78\udc7c\udc81-\udc83\udc85-\udc87\udcaa\udd7a\udd95\udd96\ude45-\ude47\ude4b-\ude4f\udea3\udeb4-\udeb6\udec0\udecc]|\ud83e[\udd0c\udd0f\udd18-\udd1c\udd1e\udd1f\udd26\udd30-\udd39\udd3d\udd3e\udd77\uddb5\uddb6\uddb8\uddb9\uddbb\uddcd-\uddcf\uddd1-\udddd]|[\u270a\u270b]))(?:\ud83c[\udffb-\udfff])?|(?:\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc73\udb40\udc63\udb40\udc74\udb40\udc7f|\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc77\udb40\udc6c\udb40\udc73\udb40\udc7f|\ud83c\udde6\ud83c[\udde8-\uddec\uddee\uddf1\uddf2\uddf4\uddf6-\uddfa\uddfc\uddfd\uddff]|\ud83c\udde7\ud83c[\udde6\udde7\udde9-\uddef\uddf1-\uddf4\uddf6-\uddf9\uddfb\uddfc\uddfe\uddff]|\ud83c\udde8\ud83c[\udde6\udde8\udde9\uddeb-\uddee\uddf0-\uddf5\uddf7\uddfa-\uddff]|\ud83c\udde9\ud83c[\uddea\uddec\uddef\uddf0\uddf2\uddf4\uddff]|\ud83c\uddea\ud83c[\udde6\udde8\uddea\uddec\udded\uddf7-\uddfa]|\ud83c\uddeb\ud83c[\uddee-\uddf0\uddf2\uddf4\uddf7]|\ud83c\uddec\ud83c[\udde6\udde7\udde9-\uddee\uddf1-\uddf3\uddf5-\uddfa\uddfc\uddfe]|\ud83c\udded\ud83c[\uddf0\uddf2\uddf3\uddf7\uddf9\uddfa]|\ud83c\uddee\ud83c[\udde8-\uddea\uddf1-\uddf4\uddf6-\uddf9]|\ud83c\uddef\ud83c[\uddea\uddf2\uddf4\uddf5]|\ud83c\uddf0\ud83c[\uddea\uddec-\uddee\uddf2\uddf3\uddf5\uddf7\uddfc\uddfe\uddff]|\ud83c\uddf1\ud83c[\udde6-\udde8\uddee\uddf0\uddf7-\uddfb\uddfe]|\ud83c\uddf2\ud83c[\udde6\udde8-\udded\uddf0-\uddff]|\ud83c\uddf3\ud83c[\udde6\udde8\uddea-\uddec\uddee\uddf1\uddf4\uddf5\uddf7\uddfa\uddff]|\ud83c\uddf4\ud83c\uddf2|\ud83c\uddf5\ud83c[\udde6\uddea-\udded\uddf0-\uddf3\uddf7-\uddf9\uddfc\uddfe]|\ud83c\uddf6\ud83c\udde6|\ud83c\uddf7\ud83c[\uddea\uddf4\uddf8\uddfa\uddfc]|\ud83c\uddf8\ud83c[\udde6-\uddea\uddec-\uddf4\uddf7-\uddf9\uddfb\uddfd-\uddff]|\ud83c\uddf9\ud83c[\udde6\udde8\udde9\uddeb-\udded\uddef-\uddf4\uddf7\uddf9\uddfb\uddfc\uddff]|\ud83c\uddfa\ud83c[\udde6\uddec\uddf2\uddf3\uddf8\uddfe\uddff]|\ud83c\uddfb\ud83c[\udde6\udde8\uddea\uddec\uddee\uddf3\uddfa]|\ud83c\uddfc\ud83c[\uddeb\uddf8]|\ud83c\uddfd\ud83c\uddf0|\ud83c\uddfe\ud83c[\uddea\uddf9]|\ud83c\uddff\ud83c[\udde6\uddf2\uddfc]|\ud83c[\udccf\udd8e\udd91-\udd9a\udde6-\uddff\ude01\ude32-\ude36\ude38-\ude3a\ude50\ude51\udf00-\udf20\udf2d-\udf35\udf37-\udf7c\udf7e-\udf84\udf86-\udf93\udfa0-\udfc1\udfc5\udfc6\udfc8\udfc9\udfcf-\udfd3\udfe0-\udff0\udff4\udff8-\udfff]|\ud83d[\udc00-\udc3e\udc40\udc44\udc45\udc51-\udc65\udc6a\udc6f\udc79-\udc7b\udc7d-\udc80\udc84\udc88-\udca9\udcab-\udcfc\udcff-\udd3d\udd4b-\udd4e\udd50-\udd67\udda4\uddfb-\ude44\ude48-\ude4a\ude80-\udea2\udea4-\udeb3\udeb7-\udebf\udec1-\udec5\uded0-\uded2\uded5-\uded7\udeeb\udeec\udef4-\udefc\udfe0-\udfeb]|\ud83e[\udd0d\udd0e\udd10-\udd17\udd1d\udd20-\udd25\udd27-\udd2f\udd3a\udd3c\udd3f-\udd45\udd47-\udd76\udd78\udd7a-\uddb4\uddb7\uddba\uddbc-\uddcb\uddd0\uddde-\uddff\ude70-\ude74\ude78-\ude7a\ude80-\ude86\ude90-\udea8\udeb0-\udeb6\udec0-\udec2\uded0-\uded6]|[\u23e9-\u23ec\u23f0\u23f3\u267e\u26ce\u2705\u2728\u274c\u274e\u2753-\u2755\u2795-\u2797\u27b0\u27bf\ue50a])|\ufe0f/g,u=/\uFE0F/g,o=String.fromCharCode(8205),n=/[&<>'"]/g,r=/^(?:iframe|noframes|noscript|script|select|style|textarea)$/,t=String.fromCharCode;return e;function c(e,d){return document.createTextNode(d?e.replace(u,""):e)}function f(e,d){return"".concat(d.base,d.size,"/",e,d.ext)}function i(e){return p(e.indexOf(o)<0?e.replace(u,""):e)}function _(e,d){for(var u,o,n,t,f,_,l,s,g,m,p,b,h,w=function e(d,a){for(var u,o,n=d.childNodes,t=n.length;t--;)3===(o=(u=n[t]).nodeType)?a.push(u):1!==o||"ownerSVGElement"in u||r.test(u.nodeName.toLowerCase())||e(u,a);return a}(e,[]),k=w.length;k--;){for(n=!1,t=document.createDocumentFragment(),_=(f=w[k]).nodeValue,s=0;l=a.exec(_);){if((g=l.index)!==s&&t.appendChild(c(_.slice(s,g),!0)),b=i(p=l[0]),s=g+p.length,h=d.callback(b,d),b&&h){for(o in(m=new Image).onerror=d.onerror,m.setAttribute("draggable","false"),u=d.attributes(p,b))u.hasOwnProperty(o)&&0!==o.indexOf("on")&&!m.hasAttribute(o)&&m.setAttribute(o,u[o]);m.className=d.className,m.alt=p,m.src=h,n=!0,t.appendChild(m)}m||t.appendChild(c(p,!1)),m=null}n&&(s<_.length&&t.appendChild(c(_.slice(s),!0)),f.parentNode.replaceChild(t,f))}return e}function l(e,d){return m(e,(function(e){var a,u,o=e,r=i(e),t=d.callback(r,d);if(r&&t){for(u in o="<img ".concat('class="',d.className,'" ','draggable="false" ','alt="',e,'"',' src="',t,'"'),a=d.attributes(e,r))a.hasOwnProperty(u)&&0!==u.indexOf("on")&&-1===o.indexOf(" "+u+"=")&&(o=o.concat(" ",u,'="',a[u].replace(n,s),'"'));o=o.concat("/>")}return o}))}function s(e){return d[e]}function g(){return null}function m(e,d){return String(e).replace(a,d)}function p(e,d){for(var a=[],u=0,o=0,n=0;n<e.length;)u=e.charCodeAt(n++),o?(a.push((65536+(o-55296<<10)+(u-56320)).toString(16)),o=0):55296<=u&&u<=56319?o=u:a.push(u.toString(16));return a.join(d||"-")}}(),w=String.fromCharCode(8205),k=/\uFE0F/g;function y(e){return h.convert.toCodePoint(e.indexOf(w)<0?e.replace(k,""):e)}var v="https://cdn.jsdelivr.net/gh/twitter/twemoji@"+/([0-9]+).[0-9]+.[0-9]+/g.exec(h.base)[1]+"/assets/";function x(){var e=Object.keys(n),d=$('<div class="ComposerBody-emojiDropdownContainer"></div>'),a=new b;Object(r.extend)(c.a.prototype,"oncreate",(function(){var e=this.$(".TextEditor-editor").wrap('<div class="ComposerBody-emojiWrapper"></div>');this.navigator=new l.a,this.navigator.when((function(){return a.active})).onUp((function(){return a.navigate(-1)})).onDown((function(){return a.navigate(1)})).onSelect(a.complete.bind(a)).onCancel(a.hide.bind(a)).bindTo(e),e.after(d)})),Object(r.extend)(c.a.prototype,"buildEditorParams",(function(u){var o,r,t,c=this;u.inputListeners.push((function(u){var f=app.composer.editor.getSelectionRange(),i=f[0];if(!(f[1]-i>0)){var _=app.composer.editor.getLastNChars(15);r=0;for(var l=_.length-1;l>=0;l--){var s=_.substr(l,1);if(!/[a-z0-9]|\+|\-|_|\:/.test(s))break;if(":"===s&&(0==l||/\s/.test(_.substr(l-1,1)))){o=l+1,r=i-_.length+l+1;break}}if(a.hide(),a.active=!1,r){t=_.substring(o).toLowerCase();var g=function(e){var d=e.emoji,u=e.name,o=e.code;return m("button",{key:d,onclick:function(){return e=d,c.attrs.composer.editor.replaceBeforeCursor(r-1,e+" "),void a.hide();var e},onmouseenter:function(){a.setIndex($(this).parent().index()-1)}},m("img",{alt:d,class:"emoji",draggable:"false",loading:"lazy",src:v+"72x72/"+o+".png"}),u)};!function(){var u,o,c=[],f=(u=t,o=new RegExp("\\((["+"+.*?[]{}()^$|\\".replace(/(.)/g,"\\$1")+"])\\)","g"),new RegExp("(.*)"+u.toLowerCase().replace(/(.)/g,"($1)(.*?)").replace(o,"(\\$1)")+"$","i")),i=7,_=function(d){for(var a=0;a<e.length&&i>0;a++){var u=e[a];if(-1===c.indexOf(u)){var o=n[u],r=Array.isArray(o),t=0;for(o=r?o:o[Symbol.iterator]();;){var f;if(r){if(t>=o.length)break;f=o[t++]}else{if((t=o.next()).done)break;f=t.value}if(d(f)){--i,c.push(u);break}}}}};_((function(e){return 0===e.indexOf(t)})),_((function(e){return f.test(e)}));var l=c.map((function(e){return{emoji:e,name:n[e][0],code:y(e)}})).map(g);if(l.length){a.items=l,m.render(d[0],a.render()),a.show();var s=app.composer.editor.getCaretCoordinates(r),p=a.$().outerWidth(),b=a.$().outerHeight(),h=a.$().offsetParent(),w=s.left,k=s.top+15;k+b>h.height()&&(k=s.top-b-15),w+p>h.width()&&(w=h.width()-p),k=Math.max(-(h.offset().top-$(document).scrollTop()),k),w=Math.max(-h.offset().left,w),a.show(w,k)}}(),a.setIndex(0),a.$().scrollTop(0),a.active=!0}}}))})),Object(r.extend)(c.a.prototype,"toolbarItems",(function(e){var d=this;e.add("emoji",m(i.a,{onclick:function(){return d.attrs.composer.editor.insertAtCursor(" :")},icon:"far fa-smile"},app.translator.trans("flarum-emoji.forum.composer.emoji_tooltip")))}))}var j=a(8),z=a.n(j),q={base:v,attributes:function(){return{loading:"lazy"}}};o.a.initializers.add("flarum-emoji",(function(){x(),Object(r.override)(z.a.prototype,"contentHtml",(function(e){var d=e();return this.oldContentHtml!==d&&(this.emojifiedContentHtml=h.parse(d,q),this.oldContentHtml=d),this.emojifiedContentHtml})),Object(r.override)(s9e.TextFormatter,"preview",(function(e,d,a){e(d,a),h.parse(a,q)}))}))}]); flarum.extensions['flarum-emoji']=module.exports var module={} module.exports=function(t){var a={};function o(e){if(a[e])return a[e].exports;var s=a[e]={i:e,l:!1,exports:{}};return t[e].call(s.exports,s,s.exports,o),s.l=!0,s.exports}return o.m=t,o.c=a,o.d=function(t,a,e){o.o(t,a)||Object.defineProperty(t,a,{enumerable:!0,get:e})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,a){if(1&a&&(t=o(t)),8&a)return t;if(4&a&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(o.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&a&&"string"!=typeof t)for(var s in t)o.d(e,s,function(a){return t[a]}.bind(null,s));return e},o.n=function(t){var a=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(a,"a",a),a},o.o=function(t,a){return Object.prototype.hasOwnProperty.call(t,a)},o.p="",o(o.s=22)}([function(t,a){t.exports=flarum.core.compat.app},function(t,a){t.exports=flarum.core.compat.Model},function(t,a){t.exports=flarum.core.compat["utils/withAttr"]},function(t,a){t.exports=flarum.core.compat.extend},function(t,a){t.exports=flarum.core.compat["components/Button"]},function(t,a){t.exports=flarum.core.compat["components/Post"]},function(t,a){t.exports=flarum.core.compat["utils/PostControls"]},function(t,a){t.exports=flarum.core.compat["utils/Stream"]},function(t,a){t.exports=flarum.core.compat["components/Page"]},function(t,a){t.exports=flarum.core.compat.Component},function(t,a){t.exports=flarum.core.compat["components/Link"]},function(t,a){t.exports=flarum.core.compat["components/LoadingIndicator"]},function(t,a){t.exports=flarum.core.compat["helpers/avatar"]},function(t,a){t.exports=flarum.core.compat["helpers/username"]},function(t,a){t.exports=flarum.core.compat["helpers/icon"]},function(t,a){t.exports=flarum.core.compat["helpers/humanTime"]},function(t,a){t.exports=flarum.core.compat["components/Modal"]},function(t,a){t.exports=flarum.core.compat["components/HeaderSecondary"]},function(t,a){t.exports=flarum.core.compat["components/NotificationsDropdown"]},function(t,a){t.exports=flarum.core.compat["utils/ItemList"]},function(t,a){t.exports=flarum.core.compat["utils/humanTime"]},function(t,a){t.exports=flarum.core},function(t,a,o){"use strict";function e(){return(e=Object.assign||function(t){for(var a=1;a<arguments.length;a++){var o=arguments[a];for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&(t[e]=o[e])}return t}).apply(this,arguments)}o.r(a);var s=o(0),n=o.n(s),r=o(1),l=o.n(r);function i(t,a){t.prototype=Object.create(a.prototype),t.prototype.constructor=t,t.__proto__=a}var c=function(t){function a(){return t.apply(this,arguments)||this}return i(a,t),a}(l.a);e(c.prototype,{type:l.a.attribute("type"),reason:l.a.attribute("reason"),reasonDetail:l.a.attribute("reasonDetail"),createdAt:l.a.attribute("createdAt",l.a.transformDate),post:l.a.hasOne("post"),user:l.a.hasOne("user")});var u=c,p=o(8),f=o.n(p),d=o(9),g=o.n(d),h=o(10),v=o.n(h),b=o(11),_=o.n(b),y=o(12),x=o.n(y),N=o(13),F=o.n(N),k=o(14),w=o.n(k),C=o(15),D=o.n(C),P=function(t){function a(){return t.apply(this,arguments)||this}i(a,t);var o=a.prototype;return o.oninit=function(a){t.prototype.oninit.call(this,a),this.state=this.attrs.state},o.view=function(){var t=this.state.cache||[];return m("div",{className:"NotificationList FlagList"},m("div",{className:"NotificationList-header"},m("h4",{className:"App-titleControl App-titleControl--text"},app.translator.trans("flarum-flags.forum.flagged_posts.title"))),m("div",{className:"NotificationList-content"},m("ul",{className:"NotificationGroup-content"},t.length?t.map((function(t){var a=t.post();return m("li",null,m(v.a,{href:app.route.post(a),className:"Notification Flag",onclick:function(t){app.flags.index=a,t.redraw=!1}},x()(a.user()),w()("fas fa-flag",{className:"Notification-icon"}),m("span",{className:"Notification-content"},app.translator.trans("flarum-flags.forum.flagged_posts.item_text",{username:F()(a.user()),em:m("em",null),discussion:a.discussion().title()})),D()(t.createdAt()),m("div",{className:"Notification-excerpt"},a.contentPlain())))})):this.state.loading?_.a.component({className:"LoadingIndicator--block"}):m("div",{className:"NotificationList-empty"},app.translator.trans("flarum-flags.forum.flagged_posts.empty_text")))))},a}(g.a),O=function(t){function a(){return t.apply(this,arguments)||this}i(a,t);var o=a.prototype;return o.oninit=function(a){t.prototype.oninit.call(this,a),app.history.push("flags"),app.flags.load(),this.bodyClass="App--flags"},o.view=function(){return m("div",{className:"FlagsPage"},m(P,{state:app.flags}))},a}(f.a),A=function(){function t(t){this.app=t,this.loading=!1}return t.prototype.load=function(){var t=this;this.cache&&!this.app.session.user.attribute("newFlagCount")||(this.loading=!0,m.redraw(),this.app.store.find("flags").then((function(a){t.app.session.user.pushAttributes({newFlagCount:0}),t.cache=a.sort((function(t,a){return a.createdAt()-t.createdAt()}))})).catch((function(){})).then((function(){t.loading=!1,m.redraw()})))},t}(),j=o(3),M=o(6),L=o.n(M),B=o(4),T=o.n(B),S=o(16),E=o.n(S),I=o(7),H=o.n(I),R=o(2),U=o.n(R),G=function(t){function a(){return t.apply(this,arguments)||this}i(a,t);var o=a.prototype;return o.oninit=function(a){t.prototype.oninit.call(this,a),this.success=!1,this.reason=H()(""),this.reasonDetail=H()("")},o.className=function(){return"FlagPostModal Modal--medium"},o.title=function(){return app.translator.trans("flarum-flags.forum.flag_post.title")},o.content=function(){if(this.success)return m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("p",{className:"helpText"},app.translator.trans("flarum-flags.forum.flag_post.confirmation_message")),m("div",{className:"Form-group"},m(T.a,{className:"Button Button--primary Button--block",onclick:this.hide.bind(this)},app.translator.trans("flarum-flags.forum.flag_post.dismiss_button")))));var t=app.forum.attribute("guidelinesUrl");return m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("div",{className:"Form-group"},m("div",null,m("label",{className:"checkbox"},m("input",{type:"radio",name:"reason",checked:"off_topic"===this.reason(),value:"off_topic",onclick:U()("value",this.reason)}),m("strong",null,app.translator.trans("flarum-flags.forum.flag_post.reason_off_topic_label")),app.translator.trans("flarum-flags.forum.flag_post.reason_off_topic_text"),"off_topic"===this.reason()?m("textarea",{className:"FormControl",placeholder:app.translator.trans("flarum-flags.forum.flag_post.reason_details_placeholder"),value:this.reasonDetail(),oninput:U()("value",this.reasonDetail)}):""),m("label",{className:"checkbox"},m("input",{type:"radio",name:"reason",checked:"inappropriate"===this.reason(),value:"inappropriate",onclick:U()("value",this.reason)}),m("strong",null,app.translator.trans("flarum-flags.forum.flag_post.reason_inappropriate_label")),app.translator.trans("flarum-flags.forum.flag_post.reason_inappropriate_text",{a:t?m("a",{href:t,target:"_blank"}):void 0}),"inappropriate"===this.reason()?m("textarea",{className:"FormControl",placeholder:app.translator.trans("flarum-flags.forum.flag_post.reason_details_placeholder"),value:this.reasonDetail(),oninput:U()("value",this.reasonDetail)}):""),m("label",{className:"checkbox"},m("input",{type:"radio",name:"reason",checked:"spam"===this.reason(),value:"spam",onclick:U()("value",this.reason)}),m("strong",null,app.translator.trans("flarum-flags.forum.flag_post.reason_spam_label")),app.translator.trans("flarum-flags.forum.flag_post.reason_spam_text"),"spam"===this.reason()?m("textarea",{className:"FormControl",placeholder:app.translator.trans("flarum-flags.forum.flag_post.reason_details_placeholder"),value:this.reasonDetail(),oninput:U()("value",this.reasonDetail)}):""),m("label",{className:"checkbox"},m("input",{type:"radio",name:"reason",checked:"other"===this.reason(),value:"other",onclick:U()("value",this.reason)}),m("strong",null,app.translator.trans("flarum-flags.forum.flag_post.reason_other_label")),"other"===this.reason()?m("textarea",{className:"FormControl",value:this.reasonDetail(),oninput:U()("value",this.reasonDetail)}):""))),m("div",{className:"Form-group"},m(T.a,{className:"Button Button--primary Button--block",type:"submit",loading:this.loading,disabled:!this.reason()},app.translator.trans("flarum-flags.forum.flag_post.submit_button")))))},o.onsubmit=function(t){var a=this;t.preventDefault(),this.loading=!0,app.store.createRecord("flags").save({reason:"other"===this.reason()?null:this.reason(),reasonDetail:this.reasonDetail(),relationships:{user:app.session.user,post:this.attrs.post}},{errorHandler:this.onerror.bind(this)}).then((function(){return a.success=!0})).catch((function(){})).then(this.loaded.bind(this))},a}(E.a),q=function(){Object(j.extend)(L.a,"userControls",(function(t,a){!a.isHidden()&&"comment"===a.contentType()&&a.canFlag()&&t.add("flag",m(T.a,{icon:"fas fa-flag",onclick:function(){return n.a.modal.show(G,{post:a})}},n.a.translator.trans("flarum-flags.forum.post_controls.flag_button")))}))},z=o(17),V=o.n(z),J=o(18),K=function(t){function a(){return t.apply(this,arguments)||this}i(a,t),a.initAttrs=function(a){a.label=a.label||app.translator.trans("flarum-flags.forum.flagged_posts.tooltip"),a.icon=a.icon||"fas fa-flag",t.initAttrs.call(this,a)};var o=a.prototype;return o.getMenu=function(){return m("div",{className:"Dropdown-menu "+this.attrs.menuClassName,onclick:this.menuClick.bind(this)},this.showing?P.component({state:this.attrs.state}):"")},o.goToRoute=function(){m.route.set(app.route("flags"))},o.getUnreadCount=function(){return app.flags.cache?app.flags.cache.length:app.forum.attribute("flagCount")},o.getNewCount=function(){return app.session.user.attribute("newFlagCount")},a}(o.n(J).a),Q=function(){Object(j.extend)(V.a.prototype,"items",(function(t){n.a.forum.attribute("canViewFlags")&&t.add("flags",m(K,{state:n.a.flags}),15)}))},W=o(5),X=o.n(W),Y=o(19),Z=o.n(Y),$=o(20),tt=o.n($),at=function(){Object(j.extend)(X.a.prototype,"elementAttrs",(function(t){this.attrs.post.flags().length&&(t.className+=" Post--flagged")})),X.a.prototype.dismissFlag=function(t){var a=this.attrs.post;return delete a.data.relationships.flags,this.subtree.invalidate(),n.a.flags.cache&&n.a.flags.cache.some((function(t,o){if(t.post()===a){if(n.a.flags.cache.splice(o,1),n.a.flags.index===a){var e=n.a.flags.cache[o];if(e||(e=n.a.flags.cache[0]),e){var s=e.post();n.a.flags.index=s,m.route.set(n.a.route.post(s))}}return!0}})),n.a.request({url:n.a.forum.attribute("apiUrl")+a.apiEndpoint()+"/flags",method:"DELETE",body:t})},X.a.prototype.flagActionItems=function(){var t=this,a=new Z.a,o=L.a.destructiveControls(this.attrs.post);return Object.keys(o.items).forEach((function(a){var e=o.get(a).attrs;e.className="Button",Object(j.extend)(e,"onclick",(function(){return t.dismissFlag()}))})),a.add("controls",m("div",{className:"ButtonGroup"},o.toArray())),a.add("dismiss",m(T.a,{className:"Button",icon:"far fa-eye-slash",onclick:this.dismissFlag.bind(this)},n.a.translator.trans("flarum-flags.forum.post.dismiss_flag_button")),-100),a},Object(j.extend)(X.a.prototype,"content",(function(t){var a=this,o=this.attrs.post,e=o.flags();e.length&&(o.isHidden()&&(this.revealContent=!0),t.unshift(m("div",{className:"Post-flagged"},m("div",{className:"Post-flagged-flags"},e.map((function(t){return m("div",{className:"Post-flagged-flag"},a.flagReason(t))}))),m("div",{className:"Post-flagged-actions"},this.flagActionItems().toArray()))))})),X.a.prototype.flagReason=function(t){if("user"===t.type()){var a=t.user(),o=t.reason(),e=t.reasonDetail(),s=tt()(t.createdAt());return[n.a.translator.trans(o?"flarum-flags.forum.post.flagged_by_with_reason_text":"flarum-flags.forum.post.flagged_by_text",{time:s,user:a,reason:o}),e?m("span",{className:"Post-flagged-detail"},e):""]}}},ot={"flags/addFlagsToPosts":at,"flags/addFlagControl":q,"flags/addFlagsDropdown":Q,"flags/models/Flag":u,"flags/components/FlagList":P,"flags/components/FlagPostModal":G,"flags/components/FlagsPage":O,"flags/components/FlagsDropdown":K},et=o(21);n.a.initializers.add("flarum-flags",(function(){n.a.store.models.posts.prototype.flags=l.a.hasMany("flags"),n.a.store.models.posts.prototype.canFlag=l.a.attribute("canFlag"),n.a.store.models.flags=u,n.a.routes.flags={path:"/flags",component:O},n.a.flags=new A(n.a),q(),Q(),at()})),e(et.compat,ot)}]); flarum.extensions['flarum-flags']=module.exports var module={} module.exports=function(t){var e={};function o(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=t,o.c=e,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=16)}([function(t,e){t.exports=flarum.core.compat.app},function(t,e){t.exports=flarum.core.compat.extend},function(t,e){t.exports=flarum.core.compat["components/CommentPost"]},function(t,e){t.exports=flarum.core.compat["components/Link"]},function(t,e){t.exports=flarum.core.compat["helpers/username"]},function(t,e){t.exports=flarum.core.compat["models/Post"]},function(t,e){t.exports=flarum.core.compat.Model},function(t,e){t.exports=flarum.core.compat["components/NotificationGrid"]},function(t,e){t.exports=flarum.core.compat["components/Button"]},function(t,e){t.exports=flarum.core.compat["helpers/punctuateSeries"]},function(t,e){t.exports=flarum.core.compat["helpers/icon"]},function(t,e){t.exports=flarum.core.compat["components/Modal"]},function(t,e){t.exports=flarum.core.compat["helpers/avatar"]},function(t,e){t.exports=flarum.core.compat["components/Notification"]},function(t,e){t.exports=flarum.core.compat["utils/string"]},,function(t,e,o){"use strict";o.r(e);var n=o(1),r=o(0),a=o.n(r),s=o(5),i=o.n(s),u=o(6),c=o.n(u),l=o(7),f=o.n(l),p=o(8),d=o.n(p),k=o(2),h=o.n(k),y=o(3),x=o.n(y),b=o(9),v=o.n(b),_=o(4),g=o.n(_),j=o(10),O=o.n(j);function M(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var P=o(11),L=o.n(P),N=o(12),S=o.n(N),C=function(t){function e(){return t.apply(this,arguments)||this}M(e,t);var o=e.prototype;return o.className=function(){return"PostLikesModal Modal--small"},o.title=function(){return app.translator.trans("flarum-likes.forum.post_likes.title")},o.content=function(){return m("div",{className:"Modal-body"},m("ul",{className:"PostLikesModal-list"},this.attrs.post.likes().map((function(t){return m("li",null,m(x.a,{href:app.route.user(t)},S()(t)," "," ",g()(t)))}))))},e}(L.a),B=o(13),T=o.n(B),w=o(14),I=function(t){function e(){return t.apply(this,arguments)||this}M(e,t);var o=e.prototype;return o.icon=function(){return"far fa-thumbs-up"},o.href=function(){return app.route.post(this.attrs.notification.subject())},o.content=function(){var t=this.attrs.notification.fromUser();return app.translator.transChoice("flarum-likes.forum.notifications.post_liked_text",1,{user:t})},o.excerpt=function(){return Object(w.truncate)(this.attrs.notification.subject().contentPlain(),200)},e}(T.a);a.a.initializers.add("flarum-likes",(function(){a.a.notificationComponents.postLiked=I,i.a.prototype.canLike=c.a.attribute("canLike"),i.a.prototype.likes=c.a.hasMany("likes"),Object(n.extend)(h.a.prototype,"actionItems",(function(t){var e=this.attrs.post;if(!e.isHidden()&&e.canLike()){var o=e.likes(),n=a.a.session.user&&o&&o.some((function(t){return t===a.a.session.user}));t.add("like",d.a.component({className:"Button Button--link",onclick:function(){n=!n,e.save({isLiked:n});var t=e.data.relationships.likes.data;t.some((function(e,o){if(e.id===a.a.session.user.id())return t.splice(o,1),!0})),n&&t.unshift({type:"users",id:a.a.session.user.id()})}},a.a.translator.trans(n?"flarum-likes.forum.post.unlike_link":"flarum-likes.forum.post.like_link")))}})),Object(n.extend)(h.a.prototype,"footerItems",(function(t){var e=this.attrs.post,o=e.likes();if(o&&o.length){var n=o.length>4,r=o.sort((function(t){return t===a.a.session.user?-1:1})).slice(0,n?3:4).map((function(t){return m(x.a,{href:a.a.route.user(t)},t===a.a.session.user?a.a.translator.trans("flarum-likes.forum.post.you_text"):g()(t))}));if(n){var s=o.length-r.length;r.push(m("a",{href:"#",onclick:function(t){t.preventDefault(),a.a.modal.show(C,{post:e})}},a.a.translator.transChoice("flarum-likes.forum.post.others_link",s,{count:s})))}t.add("liked",m("div",{className:"Post-likedBy"},O()("far fa-thumbs-up"),a.a.translator.transChoice("flarum-likes.forum.post.liked_by"+(o[0]===a.a.session.user?"_self":"")+"_text",r.length,{count:r.length,users:v()(r)})))}})),Object(n.extend)(f.a.prototype,"notificationTypes",(function(t){t.add("postLiked",{name:"postLiked",icon:"far fa-thumbs-up",label:a.a.translator.trans("flarum-likes.forum.settings.notify_post_liked_label")})}))}))}]); flarum.extensions['flarum-likes']=module.exports var module={} module.exports=function(o){var t={};function n(e){if(t[e])return t[e].exports;var r=t[e]={i:e,l:!1,exports:{}};return o[e].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=o,n.c=t,n.d=function(o,t,e){n.o(o,t)||Object.defineProperty(o,t,{enumerable:!0,get:e})},n.r=function(o){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},n.t=function(o,t){if(1&t&&(o=n(o)),8&t)return o;if(4&t&&"object"==typeof o&&o&&o.__esModule)return o;var e=Object.create(null);if(n.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:o}),2&t&&"string"!=typeof o)for(var r in o)n.d(e,r,function(t){return o[t]}.bind(null,r));return e},n.n=function(o){var t=o&&o.__esModule?function(){return o.default}:function(){return o};return n.d(t,"a",t),t},n.o=function(o,t){return Object.prototype.hasOwnProperty.call(o,t)},n.p="",n(n.s=11)}([function(o,t){o.exports=flarum.core.compat.app},function(o,t){o.exports=flarum.core.compat.extend},function(o,t){o.exports=flarum.core.compat["models/Discussion"]},function(o,t){o.exports=flarum.core.compat.Model},function(o,t){o.exports=flarum.core.compat["utils/DiscussionControls"]},function(o,t){o.exports=flarum.core.compat["components/NotificationGrid"]},function(o,t){o.exports=flarum.core.compat["components/EventPost"]},function(o,t){o.exports=flarum.core.compat["components/Notification"]},function(o,t){o.exports=flarum.core.compat["components/Badge"]},function(o,t){o.exports=flarum.core.compat["components/DiscussionPage"]},function(o,t){o.exports=flarum.core.compat["components/Button"]},function(o,t,n){"use strict";n.r(t);var e=n(1),r=n(0),c=n.n(r),i=n(3),a=n.n(i),s=n(2),u=n.n(s),f=n(5),p=n.n(f);function l(o,t){o.prototype=Object.create(t.prototype),o.prototype.constructor=o,o.__proto__=t}var d=n(6),k=function(o){function t(){return o.apply(this,arguments)||this}l(t,o);var n=t.prototype;return n.icon=function(){return this.attrs.post.content().locked?"fas fa-lock":"fas fa-unlock"},n.descriptionKey=function(){return this.attrs.post.content().locked?"flarum-lock.forum.post_stream.discussion_locked_text":"flarum-lock.forum.post_stream.discussion_unlocked_text"},t}(n.n(d).a),b=n(7),y=function(o){function t(){return o.apply(this,arguments)||this}l(t,o);var n=t.prototype;return n.icon=function(){return"fas fa-lock"},n.href=function(){var o=this.attrs.notification;return app.route.discussion(o.subject(),o.content().postNumber)},n.content=function(){return app.translator.trans("flarum-lock.forum.notifications.discussion_locked_text",{user:this.attrs.notification.fromUser()})},t}(n.n(b).a),_=n(8),x=n.n(_);var h=n(4),v=n.n(h),L=n(9),g=n.n(L),j=n(10),O=n.n(j);c.a.initializers.add("flarum-lock",(function(){c.a.postComponents.discussionLocked=k,c.a.notificationComponents.discussionLocked=y,u.a.prototype.isLocked=a.a.attribute("isLocked"),u.a.prototype.canLock=a.a.attribute("canLock"),Object(e.extend)(u.a.prototype,"badges",(function(o){this.isLocked()&&o.add("locked",x.a.component({type:"locked",label:app.translator.trans("flarum-lock.forum.badge.locked_tooltip"),icon:"fas fa-lock"}))})),Object(e.extend)(v.a,"moderationControls",(function(o,t){t.canLock()&&o.add("lock",O.a.component({icon:"fas fa-lock",onclick:this.lockAction.bind(t)},app.translator.trans(t.isLocked()?"flarum-lock.forum.discussion_controls.unlock_button":"flarum-lock.forum.discussion_controls.lock_button")))})),v.a.lockAction=function(){this.save({isLocked:!this.isLocked()}).then((function(){app.current.matches(g.a)&&app.current.get("stream").update(),m.redraw()}))},Object(e.extend)(p.a.prototype,"notificationTypes",(function(o){o.add("discussionLocked",{name:"discussionLocked",icon:"fas fa-lock",label:c.a.translator.trans("flarum-lock.forum.settings.notify_discussion_locked_label")})}))}))}]); flarum.extensions['flarum-lock']=module.exports var module={} module.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(e,t){e.exports=flarum.core.compat.extend},function(e,t){e.exports=flarum.core.compat["components/TextEditor"]},,function(e,t){e.exports=flarum.core.compat.Component},function(e,t){e.exports=flarum.core.compat["helpers/icon"]},function(e,t,n){e.exports=function(){"use strict";const e=/^[ \t]*(?:(?:[-+*]|\d+\.)[ \t]+(?:\[[ x]][ \t]+)?|>[ \t]*)*(?::[ \t]*)?/,t=/(?:[-+*]|\d+\.)[ \t]+(?:\[[ x]][ \t]+)?$/,n=/[-+*\[\]x\d.]/g,i=/[^ \t]/g,r=/(\d+)\.(?=[ \t]+$)/,o=/(?:(?:^[ \t]+)?(?:[-+*]|\d+\.|[>:])(?:[ \t]+\[[ x]])?[ \t]*|^[ \t]+)$/,s=/[*_]/,l=/[-=\s"'`<>\[\](){}+*^$\\.|]$/,a=/^(?:\n|$)/,c=/^(?!$)/gm,u={"`":/^``$/m,"~":/^~~$/m},d={"[":"]","(":")","{":"}","<":">"},f={"]":"[",")":"(","}":"{",">":"<"},h={enter:(n,i,s,l,c)=>{const u=s?null:function(t){const n=t.lastIndexOf("\n")+1,i=t.substring(n),r=e.exec(i);return{line:i,offset:n,prefix:r&&r[0]}}(i);if(u)if(u.line&&u.line.charAt(u.line.length-1)in d){const e=u.prefix?m(u.prefix,!0):"";l="\n"+e+l,c.shiftKey||(i+="\n"+e+n.indent)}else u.prefix?!c.shiftKey&&u.prefix===u.line&&a.test(l)?i=i.substring(0,u.offset)+function(e){return e.replace(o,"")}(u.prefix):!c.shiftKey&&function(e){return t.test(e)}(u.prefix)?i+="\n"+function(e){return e.replace(r,(function(e,t){return parseInt(t)+1+"."}))}(u.prefix):i+="\n"+m(u.prefix,c.shiftKey):i+="\n";else i+="\n";return{v:i+l,s:i.length}},indent:(e,t,n,i)=>{let r=t.length,o=t.lastIndexOf("\n")+1;return o<r&&(n=t.substring(o)+n,t=t.substring(0,o)),(o<r||!n)&&(r+=e.indent.length),n?n=n.replace(c,e.indent):t+=e.indent,{v:t+n+i,s:r,e:n?o+n.length:r}},outdent:(e,t,n,i)=>{let r=t.length,o=t.lastIndexOf("\n")+1;return o<r&&(n=t.substring(o)+n,t=t.substring(0,o),n.substring(0,e.indent.length)===e.indent&&(r-=e.indent.length)),{v:t+(n=n.replace(e.reOutdent,""))+i,s:r,e:o+n.length}},inline:(e,t,n,i,r)=>n||r.key in d||i.charAt(0)!==r.key?n||("'"!==r.key||l.test(t))&&!(r.key in f)?!n&&r.key in u&&u[r.key].test(t)?{v:t+r.key+"language\n"+r.key+r.key+r.key+("\n"!==i.charAt(0)?"\n":"")+i,s:t.length+1,e:t.length+9}:r.key===t.slice(-1)&&r.key===i.slice(0,1)?{v:t.slice(0,-1)+n+i.slice(1),s:t.length-1,e:t.length-1+n.length}:{v:t+(f[r.key]||r.key)+n+(d[r.key]||r.key)+i,s:t.length+1,e:t.length+1+n.length}:{v:t+r.key+i,s:t.length+1}:{v:t+(s.test(r.key)?r.key+r.key:"")+i,s:t.length+1}};class p{constructor(e){this.options=e}handleKey(e,t,n,i){const r=this.options.keyMap.find(e=>function(e,t){for(const n in t)if(t.hasOwnProperty(n)&&e[n]!==t[n])return!1;return!0}(i,e.key));if(r&&h[r.action])return h[r.action](this.options,e,t,n,i)}}function m(e,t){return e.replace(t?i:n," ")}const y=/mac|iphone|ipad|ipod/i.test(navigator.platform),v=/firefox/i.test(navigator.userAgent),x=y?"metaKey":"ctrlKey",g={enter:["Enter","Shift+Enter"],indent:["Tab","Cmd+m"],outdent:["Shift+Tab","Cmd+Shift+m"],inline:['"',"'","`","*","_","[","]","(",")","{","}","<",">"]};function k(e={}){const t={},n=[];for(let i in g)if(g.hasOwnProperty(i)){let r=e[i]||g[i];Array.isArray(r)||(r=r.toString().trim().split(/\s*[|,]\s*/g)),n.push.apply(n,r.map(e=>{const n=b(e);return n.key in t||(t[n.key]=0),++t[n.key],{key:n,action:i}}))}return n.forEach(e=>{var n;t[e.key.key]>1&&("ctrlKey"in(n=e.key)||(n.ctrlKey=!1),"altKey"in n||(n.altKey=!1),"shiftKey"in n||(n.shiftKey=!1),"metaKey"in n||(n.metaKey=!1))}),n}function b(e){const t={};return e.trim().split(/\s*\+\s*/g).forEach((function(e){switch(e.toLowerCase()){case"cmd":t[x]=!0;break;case"ctrl":case"alt":case"shift":case"meta":t[e.toLowerCase()+"Key"]=!0;break;default:t.key=e}})),t}function E(){const e=document.createElement("div");return e.setAttribute("aria-hidden","true"),e.tabIndex=-1,e.contentEditable=!0,e.textContent="0",e.addEventListener("focus",()=>setTimeout(()=>e.blur(),0)),e.style.position="fixed",e.style.overflow="hidden",e.style.left="-1000px",e.style.top="50%",e.style.width=e.style.height="1px",e.style.opacity="0",e}function S(e,t=!1){return{s:e.selectionStart,e:e.selectionEnd,x:e.scrollLeft,y:e.scrollTop,v:e.value.replace(/\u00A0/g," "),c:t}}function w(e,t){e.lock=!0;const n=void 0===t.e?t.s:t.e,i=void 0===t.x?e.elem.scrollLeft:t.x,r=void 0===t.y?e.elem.scrollTop:t.y;C(e,{...t,e:n,x:i,y:r,c:!0},!0),e.lock=!1}function O(e,t){if(!e.elem||t.defaultPrevented)return;if(v&&t[x]&&"z"===t.key)return void e.elem.blur();const n=S(e.elem),i=n.v.substring(0,n.s),r=n.v.substring(n.s,n.e),o=n.v.substring(n.e);for(let n=0,s=e.options.extensions.length;n<s;n++){const s=e.options.extensions[n].handleKey(i,r,o,t);if(s){t.preventDefault(),w(e,s);break}}}function K(e,t){if(e.lock||"insertFromPaste"===t.type)return;e.lock=!0;const n=S(e.elem);document.execCommand("undo"),C(e,n),e.lock=!1}function j(e){e.lock||(e.lock=!0,e.idx=+(e.helper.textContent||"0"),e.state=e.history[e.idx],I(e.elem,e.state),e.lock=!1)}function L(e){e.helper.textContent="0",e.state=S(e.elem),e.history=[e.state],e.idx=0}function C(e,t,n=!1){(e.idx<1||n&&!e.state.c)&&T(e,S(e.elem,!0)),e.state.c?function(e,t){e.history.splice(++e.idx,e.history.length,t),e.state=t,e.helper.focus(),document.execCommand("selectAll"),document.execCommand("insertText",!1,e.idx.toString())}(e,t):T(e,t),I(e.elem,e.state)}function T(e,t){Object.assign(e.state,t)}function I(e,t){e.value=t.v,e.selectionStart=t.s,e.selectionEnd=t.e,e.scrollTo(t.x,t.y),e.focus()}class P{constructor(e,t){const n=function(e={}){const t=function(e=4){return"number"!=typeof e&&(e=(e+"").length),new Array(e+1).join(" ")}(e.indent),n={indent:t,reOutdent:new RegExp("^"+t,"mg"),keyMap:k(e.keyMap),extensions:e.extensions||[]};return n.extensions.push(new p(n)),n}(t),i=this.ed={elem:e,options:n,helper:E(),history:[],state:void 0,idx:-1,lock:!1};i.onKeyDown=O.bind(null,i),i.onInput=K.bind(null,i),i.onUndo=j.bind(null,i),i.helper.addEventListener("input",i.onUndo),document.body.appendChild(i.helper),this.setElement(e)}getElement(){return this.ed.elem}setElement(e){this.ed.elem&&(this.ed.options.extensions.forEach(e=>e.cleanup&&e.cleanup(this)),this.ed.elem.removeEventListener("input",this.ed.onInput),this.ed.elem.removeEventListener("keydown",this.ed.onKeyDown)),this.ed.elem=e,e.addEventListener("keydown",this.ed.onKeyDown),e.addEventListener("input",this.ed.onInput),L(this.ed),this.ed.options.extensions.forEach(e=>e.init&&e.init(this))}getValue(){return this.ed.elem.value.replace(/\u00A0/g," ")}setValue(e,t=!1){this.ed.elem.value=e,t||L(this.ed)}pushState(e){w(this.ed,e)}destroy(){return this.ed.options.extensions.forEach(e=>e.cleanup&&e.cleanup(this)),this.ed.elem.removeEventListener("keydown",this.ed.onKeyDown),this.ed.elem.removeEventListener("input",this.ed.onInput),this.ed.helper.removeEventListener("input",this.ed.onUndo),document.body.removeChild(this.ed.helper),this.ed.options.extensions.forEach(e=>e.destroy&&e.destroy()),Object.assign(this.ed,{elem:null,helper:null,options:null,reOutdent:null,onKeyDown:null,onInput:null,onUndo:null,history:null}),Object.assign(this,{ed:null}),null}}return function(e){e.version="v2.0.9"}(P||(P={})),P}()},function(e,t){e.exports=flarum.core.compat["utils/BasicEditorDriver"]},function(e,t,n){"use strict";n.r(t);var i=n(0),r=n(1),o=n.n(r);function s(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var l=n(3),a=n.n(l),c=navigator.userAgent.match(/Macintosh/)?"Meta":"Control",u=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.oncreate=function(t){e.prototype.oncreate.call(this,t),this.attrs.setShortcutHandler(this.shortcut.bind(this))},n.view=function(e){return m("div",{id:"MarkdownToolbar","data-for":this.attrs.for,style:{display:"inline-block"}},e.children)},n.shortcut=function(e){if(e.metaKey&&"Meta"===c||e.ctrlKey&&"Control"===c){var t=this.element.querySelector('[data-hotkey="'+e.key+'"]');t&&(t.click(),e.preventDefault())}},t}(a.a),d=n(4),f=n.n(d);function h(){return(h=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}var p=null;function y(e){return e.trim().split("\n").length>1}function v(e,t){return Array(t+1).join(e)}function x(e,t){for(var n=t;e[n]&&null!=e[n-1]&&!e[n-1].match(/\s/);)n--;return n}function g(e,t,n){for(var i=t,r=n?/\n/:/\s/;e[i]&&!e[i].match(r);)i++;return i}function k(e){var t,n,i=e.value.slice(0,e.selectionStart),r=e.value.slice(e.selectionEnd),o=i.match(/\n*$/),s=r.match(/^\n*/),l=o?o[0].length:0,a=s?s[0].length:0;return i.match(/\S/)&&l<2&&(t=v("\n",2-l)),r.match(/\S/)&&a<2&&(n=v("\n",2-a)),null==t&&(t=""),null==n&&(n=""),{newlinesToAppend:t,newlinesToPrepend:n}}var b=function(e,t){var n=t.prefix,i=t.suffix,r=t.blockPrefix,o=t.blockSuffix,s=t.replaceNext,l=t.prefixSpace,a=t.scanFor,c=t.surroundWithNewlines,u=e.selectionStart,d=e.selectionEnd,f=e.value.slice(e.selectionStart,e.selectionEnd),h=y(f)&&r.length>0?r+"\n":n,p=y(f)&&o.length>0?"\n"+o:i;if(l){var m=e.value[e.selectionStart-1];0===e.selectionStart||null==m||m.match(/\s/)||(h=" "+h)}f=function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.selectionStart===e.selectionEnd)e.selectionStart=x(e.value,e.selectionStart),e.selectionEnd=g(e.value,e.selectionEnd,i);else{var r=e.selectionStart-t.length,o=e.selectionEnd+n.length,s=e.value.slice(r,e.selectionStart)===t,l=e.value.slice(e.selectionEnd,o)===n;s&&l&&(e.selectionStart=r,e.selectionEnd=o)}return e.value.slice(e.selectionStart,e.selectionEnd)}(e,h,p,t.multiline);var v=e.selectionStart,b=e.selectionEnd,E=s.length>0&&p.indexOf(s)>-1&&f.length>0;if(c){var S=k(e);h=S.newlinesToAppend+n,p+=S.newlinesToPrepend}if(f.startsWith(h)&&f.endsWith(p)){var w=f.slice(h.length,f.length-p.length);if(u===d){var O=u-h.length;O=Math.max(O,v),v=b=O=Math.min(O,v+w.length)}else b=v+w.length;return{text:w,selectionStart:v,selectionEnd:b}}if(E)return a.length>0&&f.match(a)?{text:h+(p=p.replace(s,f)),selectionStart:v=b=v+h.length,selectionEnd:b}:{text:h+f+p,selectionStart:v=v+h.length+f.length+p.indexOf(s),selectionEnd:b=v+s.length};var K=h+f+p;v=u+h.length,b=d+h.length;var j=f.match(/^\s*|\s*$/g);if(t.trimFirst&&j){var L=j[0]||"",C=j[1]||"";K=L+h+f.trim()+p+C,v+=L.length,b-=C.length}return{text:K,selectionStart:v,selectionEnd:b}},E=function(e,t){var n,i=e.value.slice(e.selectionStart,e.selectionEnd);n=t.orderedList?function(e){var t,n,i,r,o=/^\d+\.\s+/,s=e.selectionStart===e.selectionEnd,l=e.value.slice(e.selectionStart,e.selectionEnd),a=l,c=l.split("\n");if(s){var u=e.value.slice(0,e.selectionStart).split(/\n/);i=e.selectionStart-u[u.length-1].length,r=g(e.value,e.selectionStart,!0),a=e.value.slice(i,r)}var d=a.split("\n");if(d.every((function(e){return o.test(e)}))){if(l=(c=d.map((function(e){return e.replace(o,"")}))).join("\n"),s&&i&&r){var f=d[0].length-c[0].length;n=t=e.selectionStart-f,e.selectionStart=i,e.selectionEnd=r}}else{l=(c=function(){var e,t,n,i=[];for(n=e=0,t=c.length;e<t;n=++e){var r=c[n];i.push(n+1+". "+r)}return i}()).join("\n");var h=k(e),p=h.newlinesToAppend,m=h.newlinesToPrepend;t=(n=e.selectionStart+p.length)+l.length,s&&(n=t),l=p+l+m}return{text:l,selectionStart:n,selectionEnd:t}}(e):t.multiline&&y(i)?function(e,t){var n=t.prefix,i=t.suffix,r=t.surroundWithNewlines,o=e.value.slice(e.selectionStart,e.selectionEnd),s=e.selectionStart,l=e.selectionEnd,a=o.split("\n");if(a.every((function(e){return e.startsWith(n)&&e.endsWith(i)})))l=s+(o=a.map((function(e){return e.slice(n.length,e.length-i.length)})).join("\n")).length;else if(o=a.map((function(e){return n+e+i})).join("\n"),r){var c=k(e),u=c.newlinesToAppend,d=c.newlinesToPrepend;l=(s+=u.length)+o.length,o=u+o+d}return{text:o,selectionStart:s,selectionEnd:l}}(e,t):b(e,t),function(e,t){var n=t.text,i=t.selectionStart,r=t.selectionEnd,o=e.selectionStart,s=e.value.slice(0,o),l=e.value.slice(e.selectionEnd);if(null===p||!0===p){e.contentEditable="true";try{p=document.execCommand("insertText",!1,n)}catch(e){p=!1}e.contentEditable="false"}if(p&&!e.value.slice(0,e.selectionStart).endsWith(n)&&(p=!1),!p){try{document.execCommand("ms-beginUndoUnit")}catch(e){}e.value=s+n+l;try{document.execCommand("ms-endUndoUnit")}catch(e){}var a=document.createEvent("Event");a.initEvent("input",!0,!0),e.dispatchEvent(a)}null!=i&&null!=r?e.setSelectionRange(i,r):e.setSelectionRange(o,e.selectionEnd)}(e,n)},S=navigator.userAgent.match(/Macintosh/)?"⌘":"ctrl",w=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.oncreate=function(t){e.prototype.oncreate.call(this,t),this.$().tooltip()},n.view=function(){return m("button",{className:"Button Button--icon Button--link",title:this.title(),"data-hotkey":this.attrs.hotkey,onclick:this.click.bind(this),onkeydown:this.keydown.bind(this)},f()(this.attrs.icon))},n.keydown=function(e){" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),this.click())},n.click=function(){return e=this.element,t=this.attrs.style,n=e.parentElement,i=h({},{prefix:"",suffix:"",blockPrefix:"",blockSuffix:"",multiline:!1,replaceNext:"",prefixSpace:!1,scanFor:"",surroundWithNewlines:!1,orderedList:!1,trimFirst:!1},t),void((r=document.getElementById(n.dataset.for))&&(r.focus(),E(r,i)));var e,t,n,i,r},n.title=function(){var e=this.attrs.title;return this.attrs.hotkey&&(e+=" <"+S+"-"+this.attrs.hotkey+">"),e},t}(a.a),O=n(5),K=n.n(O),j=n(6),L=n.n(j),C=function(){function e(e,t,n){this.oninput=e,this.callInputListeners=t,this.onsubmit=n}return e.prototype.handleKey=function(e,t,n,i){var r=this;setTimeout((function(){if(r.oninput(i.target.value),(i.metaKey||i.ctrlKey)&&"Enter"===i.key)return r.onsubmit();r.callInputListeners(i)}),25)},e}(),T=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var n=t.prototype;return n.build=function(t,n){if(app.forum.attribute("flarum-markdown.mdarea")){this.el.className=n.classNames.join(" "),this.el.disabled=n.disabled,this.el.placeholder=n.placeholder,this.el.value=n.value,t.append(this.el);var i=function(e){n.inputListeners.forEach((function(e){e()})),e.redraw=!1};this.el.addEventListener("input",(function(e){e instanceof CustomEvent&&(n.oninput(e.target.value),i(e))})),this.el.addEventListener("click",i),this.mdarea=new K.a(this.el,{keyMap:{indent:["Ctrl+m"],outdent:["Ctrl+M"],inline:[]},extensions:[new C(n.oninput,i,n.onsubmit)]})}else e.prototype.build.call(this,t,n);this.el.id=n.textareaId,this.el.addEventListener("keydown",(function(e){return n.shortcutHandler.apply(n,arguments)}))},n.destroy=function(){app.forum.attribute("flarum-markdown.mdarea")&&this.mdarea.destroy(),e.prototype.destroy.call(this)},t}(L.a),I=function(){};app.initializers.add("flarum-markdown",(function(e){var t=1;Object(i.extend)(o.a.prototype,"oninit",(function(){this.textareaId="textarea"+t++})),Object(i.override)(o.a.prototype,"buildEditor",(function(e,t){return new T(t,this.buildEditorParams())})),Object(i.extend)(o.a.prototype,"buildEditorParams",(function(e){e.textareaId=this.textareaId,e.shortcutHandler=I})),Object(i.extend)(o.a.prototype,"toolbarItems",(function(t){var n=function(t){return e.translator.trans("flarum-markdown.forum.composer."+t+"_tooltip")};t.add("markdown",m(u,{for:this.textareaId,setShortcutHandler:function(e){return I=e}},m(w,{title:n("header"),icon:"fas fa-heading",style:{prefix:"### "}}),m(w,{title:n("bold"),icon:"fas fa-bold",style:{prefix:"**",suffix:"**",trimFirst:!0},hotkey:"b"}),m(w,{title:n("italic"),icon:"fas fa-italic",style:{prefix:"_",suffix:"_",trimFirst:!0},hotkey:"i"}),m(w,{title:n("quote"),icon:"fas fa-quote-left",style:{prefix:"> ",multiline:!0,surroundWithNewlines:!0}}),m(w,{title:n("code"),icon:"fas fa-code",style:{prefix:"`",suffix:"`",blockPrefix:"```",blockSuffix:"```"}}),m(w,{title:n("link"),icon:"fas fa-link",style:{prefix:"[",suffix:"](https://)",replaceNext:"https://",scanFor:"https?://"}}),m(w,{title:n("image"),icon:"fas fa-image",style:{prefix:"![",suffix:"](https://)",replaceNext:"https://",scanFor:"https?://"}}),m(w,{title:n("unordered_list"),icon:"fas fa-list-ul",style:{prefix:"- ",multiline:!0,surroundWithNewlines:!0}}),m(w,{title:n("ordered_list"),icon:"fas fa-list-ol",style:{prefix:"1. ",multiline:!0,orderedList:!0}})),100)}))}))}]); flarum.extensions['flarum-markdown']=module.exports var module={} module.exports=function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=28)}([function(t,e){t.exports=flarum.core.compat.extend},function(t,e){t.exports=flarum.core.compat["components/CommentPost"]},function(t,e){t.exports=flarum.core.compat.app},function(t,e){t.exports=flarum.core.compat["utils/string"]},function(t,e){t.exports=flarum.core.compat["helpers/username"]},function(t,e){t.exports=flarum.core.compat["components/PostPreview"]},function(t,e){t.exports=flarum.core.compat["helpers/icon"]},function(t,e){t.exports=flarum.core.compat["components/EditPostComposer"]},function(t,e){t.exports=flarum.core.compat.Fragment},function(t,e){t.exports=flarum.core.compat["components/Notification"]},function(t,e){t.exports=flarum.core.compat["components/TextEditor"]},function(t,e){t.exports=flarum.core.compat["utils/extractText"]},function(t,e){t.exports=flarum.core.compat["components/NotificationGrid"]},function(t,e){t.exports=flarum.core.compat["components/LoadingIndicator"]},function(t,e){t.exports=flarum.core.compat.Model},function(t,e){t.exports=flarum.core.compat["models/Post"]},function(t,e){t.exports=flarum.core.compat["components/Link"]},function(t,e){t.exports=flarum.core.compat["helpers/punctuateSeries"]},function(t,e){t.exports=flarum.core.compat["components/Button"]},function(t,e){t.exports=flarum.core.compat["utils/DiscussionControls"]},function(t,e){t.exports=flarum.core.compat["components/TextEditorButton"]},function(t,e){t.exports=flarum.core.compat["components/ReplyComposer"]},function(t,e){t.exports=flarum.core.compat["helpers/avatar"]},function(t,e){t.exports=flarum.core.compat["helpers/highlight"]},function(t,e){t.exports=flarum.core.compat["utils/KeyboardNavigatable"]},function(t,e){t.exports=flarum.core.compat["components/UserPage"]},function(t,e){t.exports=flarum.core.compat["components/LinkButton"]},function(t,e){t.exports=flarum.core.compat["components/PostsUserPage"]},function(t,e,n){"use strict";n.r(e),n.d(e,"filterUserMentions",(function(){return vt})),n.d(e,"filterPostMentions",(function(){return bt}));var o=n(0),r=n(2),i=n.n(r),s=n(12),a=n.n(s),u=n(3),c=n(1),p=n.n(c),f=n(5),l=n.n(f),d=n(13),h=n.n(d);var v=n(14),b=n.n(v),y=n(15),g=n.n(y),x=n(16),w=n.n(x),P=n(17),C=n.n(P),T=n(4),_=n.n(T),j=n(6),M=n.n(j);var O=n(18),B=n.n(O),k=n(19),A=n.n(k),S=n(7),H=n.n(S);function N(t,e,n){var o=t.user(),r="@"+(o?o.username():t.number())+"#"+t.id()+" ";e.fields.content()||(e.body.attrs.originalContent=r);var i=e.editor.getSelectionRange()[0],s=e.fields.content().slice(0,i),a=0==s.length?0:3-s.match(/(\n{0,2})$/)[0].length;e.editor.insertAtCursor(Array(a).join("\n")+(n?"> "+r+n.trim().replace(/\n/g,"\n> ")+"\n\n":r),!1)}function E(t,e){app.composer.bodyMatches(H.a)&&app.composer.body.attrs.post.discussion()===t.discussion()?N(t,app.composer,e):A.a.replyAction.call(t.discussion()).then((function(n){return N(t,n,e)}))}function I(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var W=n(8),D=n.n(W),L=function(t){function e(e){var n;return(n=t.call(this)||this).post=e,n}I(e,t);var n=e.prototype;return n.view=function(){var t=this;return m("button",{class:"Button PostQuoteButton",onclick:function(){E(t.post,t.content)}},M()("fas fa-quote-left",{className:"Button-icon"}),app.translator.trans("flarum-mentions.forum.post.quote_button"))},n.show=function(t,e){var n=this.$().show(),o=n.offsetParent().offset();n.css("left",t-o.left).css("top",e-o.top),this.hideHandler=this.hide.bind(this),$(document).on("mouseup",this.hideHandler)},n.showStart=function(t,e){var n=this.$();this.show(t,$(window).scrollTop()+e-n.outerHeight()-5)},n.showEnd=function(t,e){var n=this.$();this.show(t-n.outerWidth(),$(window).scrollTop()+e+5)},n.hide=function(){this.$().hide(),$(document).off("mouseup",this.hideHandler)},e}(D.a);function R(){Object(o.extend)(p.a.prototype,"oncreate",(function(){var t=this.attrs.post;if(!(t.isHidden()||app.session.user&&!t.discussion().canReply())){var e=this.$(".Post-body"),n=$('<div class="Post-quoteButtonContainer"></div>'),o=new L(t),r=function(t){setTimeout((function(){var r=function(t){var e=window.getSelection();if(e.rangeCount){var n=e.getRangeAt(0),o=n.commonAncestorContainer;if(t[0]===o||$.contains(t[0],o)){var r=$("<div>").append(n.cloneContents());return r.find("img.emoji").replaceWith((function(){return this.alt})),r.find("img").replaceWith((function(){return"![]("+this.src+")"})),r.find("a").replaceWith((function(){return"["+this.innerText+"]("+this.href+")"})),r.text()}}return""}(e);if(r){o.content=r,m.render(n[0],o.render());var i=window.getSelection().getRangeAt(0).getClientRects(),s=i[0];if(t.clientY<s.bottom&&t.clientX-s.right<s.left-t.clientX)o.showStart(s.left,s.top);else{var a=i[i.length-1];o.showEnd(a.right,a.bottom)}}}),1)};this.$().after(n).on("mouseup",r),"ontouchstart"in window&&document.addEventListener("selectionchange",r,!1)}}))}var U=n(10),q=n.n(U),J=n(20),X=n.n(J),Y=n(21),z=n.n(Y),F=n(22),G=n.n(F),K=n(23),Q=n.n(K),V=n(24),Z=n.n(V);function tt(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function et(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var nt=function(t){function e(){for(var e,n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];return et(tt(tt(e=t.call.apply(t,[this].concat(o))||this)),"items",[]),et(tt(tt(e)),"active",!1),et(tt(tt(e)),"index",0),et(tt(tt(e)),"keyWasJustPressed",!1),e}I(e,t);var n=e.prototype;return n.view=function(){return m("ul",{className:"Dropdown-menu MentionsDropdown"},this.items.map((function(t){return m("li",null,t)})))},n.show=function(t,e){this.$().show().css({left:t+"px",top:e+"px"}),this.active=!0},n.hide=function(){this.$().hide(),this.active=!1},n.navigate=function(t){var e=this;this.keyWasJustPressed=!0,this.setIndex(this.index+t,!0),clearTimeout(this.keyWasJustPressedTimeout),this.keyWasJustPressedTimeout=setTimeout((function(){return e.keyWasJustPressed=!1}),500)},n.complete=function(){this.$("li").eq(this.index).find("button").click()},n.setIndex=function(t,e){if(!this.keyWasJustPressed||e){var n=this.$(),o=n.find("li"),r=t;r<0?r=o.length-1:r>=o.length&&(r=0),this.index=r;var i=o.removeClass("active").eq(r).addClass("active");if(e){var s,a=n.scrollTop(),u=n.offset().top,c=u+n.outerHeight(),p=i.offset().top,f=p+i.outerHeight();p<u?s=a-u+p-parseInt(n.css("padding-top"),10):f>c&&(s=a-c+f+parseInt(n.css("padding-bottom"),10)),void 0!==s&&n.stop(!0).animate({scrollTop:s},100)}}},e}(D.a);function ot(){var t=$('<div class="ComposerBody-mentionsDropdownContainer"></div>'),e=new nt;Object(o.extend)(q.a.prototype,"oncreate",(function(n){var o=this.$(".TextEditor-editor").wrap('<div class="ComposerBody-mentionsWrapper"></div>');this.navigator=new Z.a,this.navigator.when((function(){return e.active})).onUp((function(){return e.navigate(-1)})).onDown((function(){return e.navigate(1)})).onSelect(e.complete.bind(e)).onCancel(e.hide.bind(e)).bindTo(o),o.after(t)})),Object(o.extend)(q.a.prototype,"buildEditorParams",(function(n){var o,r,i,s,a=[],c=Array.from(app.store.all("users")),p=new Set(c.map((function(t){return t.id()})));n.inputListeners.push((function(n){var f=app.composer.editor.getSelectionRange(),l=f[0];if(!(f[1]-l>0)){var d=app.composer.editor.getLastNChars(30);r=0;for(var h=d.length-1;h>=0;h--){if("@"===d.substr(h,1)&&(0==h||/\s/.test(d.substr(h-1,1)))){o=h+1,r=l-d.length+h+1;break}}if(e.hide(),e.active=!1,r){i=d.substring(o).toLowerCase();var v=function(t,n,o,s){void 0===s&&(s="");var a=_()(t);return i&&(a.children=[Q()(a.text,i)],delete a.text),m("button",{className:"PostPreview "+s,onclick:function(){return function(t){app.composer.editor.replaceBeforeCursor(r-1,t+" "),e.hide()}(n)},onmouseenter:function(){e.setIndex($(this).parent().index())}},m("span",{className:"PostPreview-content"},G()(t),a," "," ",o))},b=function(t){return[t.username(),t.displayName()].some((function(t){return t.toLowerCase().substr(0,i.length)===i}))},y=function(){var n=[];if(i&&c.forEach((function(t){b(t)&&n.push(v(t,"@"+t.username(),"","MentionsDropdown-user"))})),app.composer.bodyMatches(z.a)||app.composer.bodyMatches(H.a)){var o=app.composer.body.attrs,s=o.post,a=s&&s.discussion()||o.discussion;a&&a.posts().filter((function(t){return t&&"comment"===t.contentType()&&(!s||t.number()<s.number())})).sort((function(t,e){return e.createdAt()-t.createdAt()})).filter((function(t){var e=t.user();return e&&b(e)})).splice(0,5).forEach((function(t){var e=t.user();n.push(v(e,"@"+e.username()+"#"+t.id(),[app.translator.trans("flarum-mentions.forum.composer.reply_to_post_text",{number:t.number()})," — ",Object(u.truncate)(t.contentPlain(),200)],"MentionsDropdown-post"))}))}if(n.length){e.items=n,m.render(t[0],e.render()),e.show();var p=app.composer.editor.getCaretCoordinates(r),f=e.$().outerWidth(),l=e.$().outerHeight(),d=e.$().offsetParent(),h=p.left,y=p.top+15;y+l>d.height()&&(y=p.top-l-15),h+f>d.width()&&(h=d.width()-f),y=Math.max(-(d.offset().top-$(document).scrollTop()),y),h=Math.max(-d.offset().left,h),e.show(h,y)}else e.active=!1,e.hide()};e.active=!0,y(),e.setIndex(0),e.$().scrollTop(0),clearTimeout(s),i.length>1&&(s=setTimeout((function(){var t=i.toLowerCase();-1===a.indexOf(t)&&(app.store.find("users",{filter:{q:i},page:{limit:5}}).then((function(t){t.forEach((function(t){p.has(t.id())||(p.add(t.id()),c.push(t))})),e.active&&y()})),a.push(t))}),250))}}}))})),Object(o.extend)(q.a.prototype,"toolbarItems",(function(t){var e=this;t.add("mention",m(X.a,{onclick:function(){return e.attrs.composer.editor.insertAtCursor(" @")},icon:"fas fa-at"},app.translator.trans("flarum-mentions.forum.composer.mention_tooltip")))}))}var rt=n(9),it=n.n(rt),st=function(t){function e(){return t.apply(this,arguments)||this}I(e,t);var n=e.prototype;return n.icon=function(){return"fas fa-reply"},n.href=function(){var t=this.attrs.notification,e=t.subject(),n=t.content();return app.route.discussion(e.discussion(),n&&n.replyNumber)},n.content=function(){var t=this.attrs.notification.fromUser();return app.translator.transChoice("flarum-mentions.forum.notifications.post_mentioned_text",1,{user:t})},n.excerpt=function(){return Object(u.truncate)(this.attrs.notification.subject().contentPlain(),200)},e}(it.a),at=function(t){function e(){return t.apply(this,arguments)||this}I(e,t);var n=e.prototype;return n.icon=function(){return"fas fa-at"},n.href=function(){var t=this.attrs.notification.subject();return app.route.discussion(t.discussion(),t.number())},n.content=function(){var t=this.attrs.notification.fromUser();return app.translator.trans("flarum-mentions.forum.notifications.user_mentioned_text",{user:t})},n.excerpt=function(){return Object(u.truncate)(this.attrs.notification.subject().contentPlain(),200)},e}(it.a),ut=n(25),ct=n.n(ut),pt=n(26),ft=n.n(pt),mt=n(27),lt=function(t){function e(){return t.apply(this,arguments)||this}return I(e,t),e.prototype.loadResults=function(t){return app.store.find("posts",{filter:{type:"comment",mentioned:this.user.id()},page:{offset:t,limit:this.loadLimit},sort:"-createdAt"})},e}(n.n(mt).a),dt=n(11),ht=n.n(dt);function vt(t){var e=app.store.getBy("users","username",t.getAttribute("username"));if(e)return t.setAttribute("id",e.id()),t.setAttribute("displayname",ht()(_()(e))),!0}function bt(t){var e=app.store.getById("posts",t.getAttribute("id"));if(e)return t.setAttribute("discussionid",e.discussion().id()),t.setAttribute("number",e.number()),t.setAttribute("displayname",ht()(_()(e.user()))),!0}i.a.initializers.add("flarum-mentions",(function(){!function(){function t(){var t=this.attrs.post.contentHtml();if(t!==this.oldPostContentHtml&&!this.isEditing()){this.oldPostContentHtml=t;var e=this.attrs.post,n=this.$();this.$().on("click",".UserMention, .PostMention",(function(t){m.route.set(this.getAttribute("href")),t.preventDefault()})),this.$(".PostMention").each((function(){var t,o=$(this),r=o.data("id"),i=$('<ul class="Dropdown-menu PostMention-preview fade"/>');n.append(i);var s=function(){return $('.PostStream-item[data-id="'+r+'"]')},a=function(){var t=s(),a=!1;if(t.length){var u=t.offset().top,c=window.pageYOffset;u>c&&u+t.height()<c+$(window).height()&&(t.addClass("pulsate"),a=!0)}if(!a){var p=function(){var t=i.outerHeight(!0),e=0;o.offset().top-t<$(window).scrollTop()+$("#header").outerHeight()?e+=o.outerHeight(!0):e-=t,i.show().css("top",o.offset().top-n.offset().top+e).css("left",o.offsetParent().offset().left-n.offset().left).css("max-width",o.offsetParent().width())},f=function(t){var n=t.discussion();m.render(i[0],[n!==e.discussion()?m("li",null,m("span",{className:"PostMention-preview-discussion"},n.title())):"",m("li",null,l.a.component({post:t}))]),p()},d=app.store.getById("posts",r);d&&d.discussion()?f(d):(m.render(i[0],h.a.component()),app.store.find("posts",r).then(f),p()),setTimeout((function(){return i.off("transitionend").addClass("in")}))}},u=function(){s().removeClass("pulsate"),i.hasClass("in")&&i.removeClass("in").one("transitionend",(function(){return i.hide()}))};o.on("touchend",(function(t){t.cancelable&&t.preventDefault()})),o.add(i).hover((function(){clearTimeout(t),t=setTimeout(a,250)}),(function(){clearTimeout(t),s().removeClass("pulsate"),t=setTimeout(u,250)})).on("touchend",(function(t){a(),t.stopPropagation()})),$(document).on("touchend",u)}))}}Object(o.extend)(p.a.prototype,"oncreate",t),Object(o.extend)(p.a.prototype,"onupdate",t)}(),g.a.prototype.mentionedBy=b.a.hasMany("mentionedBy"),Object(o.extend)(p.a.prototype,"footerItems",(function(t){var e=this,n=this.attrs.post.mentionedBy();if(n&&n.length){var o=function(){e.$(".Post-mentionedBy-preview").removeClass("in").one("transitionend",(function(){$(this).hide()}))},r=[],i=n.sort((function(t){return t.user()===app.session.user?-1:0})).filter((function(t){var e=t.user();if(-1===r.indexOf(e))return r.push(e),!0})),s=i.length>4,a=i.slice(0,s?3:4).map((function(t){var e=t.user();return m(w.a,{href:app.route.post(t),onclick:o,"data-number":t.number()},app.session.user===e?app.translator.trans("flarum-mentions.forum.post.you_text"):_()(e))}));if(s){var u=i.length-a.length;a.push(app.translator.transChoice("flarum-mentions.forum.post.others_text",u,{count:u}))}t.add("replies",m("div",{className:"Post-mentionedBy",oncreate:function(t){var e,r=$(t.dom),i=$('<ul class="Dropdown-menu Post-mentionedBy-preview fade"/>');r.append(i),r.children().hover((function(){clearTimeout(e),e=setTimeout((function(){!i.hasClass("in")&&i.is(":visible")||(m.render(i[0],n.map((function(t){return m("li",{"data-number":t.number()},l.a.component({post:t,onclick:o}))}))),i.show(),setTimeout((function(){return i.off("transitionend").addClass("in")})))}),500)}),(function(){clearTimeout(e),e=setTimeout(o,250)})),r.find(".Post-mentionedBy-summary a").hover((function(){i.find('[data-number="'+$(this).data("number")+'"]').addClass("active")}),(function(){i.find("[data-number]").removeClass("active")}))}},m("span",{className:"Post-mentionedBy-summary"},M()("fas fa-reply"),app.translator.transChoice("flarum-mentions.forum.post.mentioned_by"+(i[0].user()===app.session.user?"_self":"")+"_text",a.length,{count:a.length,users:C()(a)}))))}})),Object(o.extend)(p.a.prototype,"actionItems",(function(t){var e=this.attrs.post;e.isHidden()||app.session.user&&!e.discussion().canReply()||t.add("reply",m(B.a,{className:"Button Button--link",onclick:function(){return E(e)}},app.translator.trans("flarum-mentions.forum.post.reply_link")))})),R(),ot(),i.a.notificationComponents.postMentioned=st,i.a.notificationComponents.userMentioned=at,Object(o.extend)(a.a.prototype,"notificationTypes",(function(t){t.add("postMentioned",{name:"postMentioned",icon:"fas fa-reply",label:i.a.translator.trans("flarum-mentions.forum.settings.notify_post_mentioned_label")}),t.add("userMentioned",{name:"userMentioned",icon:"fas fa-at",label:i.a.translator.trans("flarum-mentions.forum.settings.notify_user_mentioned_label")})})),i.a.routes["user.mentions"]={path:"/u/:username/mentions",component:lt},Object(o.extend)(ct.a.prototype,"navItems",(function(t){var e=this.user;t.add("mentions",ft.a.component({href:i.a.route("user.mentions",{username:e.username()}),name:"mentions",icon:"fas fa-at"},i.a.translator.trans("flarum-mentions.forum.user.mentions_link")),80)})),u.getPlainContent.removeSelectors.push("a.PostMention")}))}]); flarum.extensions['flarum-mentions']=module.exports var module={} module.exports=function(t){var o={};function n(e){if(o[e])return o[e].exports;var r=o[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=o,n.d=function(t,o,e){n.o(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:e})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,o){if(1&o&&(t=n(t)),8&o)return t;if(4&o&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(n.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&o&&"string"!=typeof t)for(var r in t)n.d(e,r,function(o){return t[o]}.bind(null,r));return e},n.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(o,"a",o),o},n.o=function(t,o){return Object.prototype.hasOwnProperty.call(t,o)},n.p="",n(n.s=13)}([function(t,o){t.exports=flarum.core.compat.app},function(t,o){t.exports=flarum.core.compat.extend},function(t,o){t.exports=flarum.core.compat["models/Discussion"]},function(t,o){t.exports=flarum.core.compat["components/DiscussionPage"]},function(t,o){t.exports=flarum.core.compat.Model},function(t,o){t.exports=flarum.core.compat["utils/DiscussionControls"]},function(t,o){t.exports=flarum.core.compat["components/EventPost"]},function(t,o){t.exports=flarum.core.compat["components/Badge"]},function(t,o){t.exports=flarum.core.compat["components/Button"]},function(t,o){t.exports=flarum.core.compat["states/DiscussionListState"]},function(t,o){t.exports=flarum.core.compat["components/DiscussionListItem"]},function(t,o){t.exports=flarum.core.compat["components/IndexPage"]},function(t,o){t.exports=flarum.core.compat["utils/string"]},function(t,o,n){"use strict";n.r(o);var e=n(0),r=n.n(e),c=n(4),i=n.n(c),s=n(2),a=n.n(s);var u=n(6),p=function(t){var o,n;function e(){return t.apply(this,arguments)||this}n=t,(o=e).prototype=Object.create(n.prototype),o.prototype.constructor=o,o.__proto__=n;var r=e.prototype;return r.icon=function(){return"fas fa-thumbtack"},r.descriptionKey=function(){return this.attrs.post.content().sticky?"flarum-sticky.forum.post_stream.discussion_stickied_text":"flarum-sticky.forum.post_stream.discussion_unstickied_text"},e}(n.n(u).a),f=n(1),l=n(7),d=n.n(l);var y=n(5),k=n.n(y),b=n(3),x=n.n(b),_=n(8),v=n.n(_);var h=n(9),S=n.n(h),g=n(10),j=n.n(g),O=n(11),P=n.n(O),D=n(12);r.a.initializers.add("flarum-sticky",(function(){r.a.postComponents.discussionStickied=p,a.a.prototype.isSticky=i.a.attribute("isSticky"),a.a.prototype.canSticky=i.a.attribute("canSticky"),Object(f.extend)(a.a.prototype,"badges",(function(t){this.isSticky()&&t.add("sticky",d.a.component({type:"sticky",label:app.translator.trans("flarum-sticky.forum.badge.sticky_tooltip"),icon:"fas fa-thumbtack"}),10)})),Object(f.extend)(k.a,"moderationControls",(function(t,o){o.canSticky()&&t.add("sticky",v.a.component({icon:"fas fa-thumbtack",onclick:this.stickyAction.bind(o)},app.translator.trans(o.isSticky()?"flarum-sticky.forum.discussion_controls.unsticky_button":"flarum-sticky.forum.discussion_controls.sticky_button")))})),k.a.stickyAction=function(){this.save({isSticky:!this.isSticky()}).then((function(){app.current.matches(x.a)&&app.current.get("stream").update(),m.redraw()}))},Object(f.extend)(S.a.prototype,"requestParams",(function(t){(app.current.matches(P.a)||app.current.matches(x.a))&&t.include.push("firstPost")})),Object(f.extend)(j.a.prototype,"infoItems",(function(t){var o=this.attrs.discussion;if(o.isSticky()&&!this.attrs.params.q&&!o.lastReadPostNumber()){var n=o.firstPost();if(n){var e=Object(D.truncate)(n.contentPlain(),175);t.add("excerpt",m("div",null,e),-100)}}}))}))}]); flarum.extensions['flarum-sticky']=module.exports var module={} module.exports=function(t){var o={};function n(r){if(o[r])return o[r].exports;var s=o[r]={i:r,l:!1,exports:{}};return t[r].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=t,n.c=o,n.d=function(t,o,r){n.o(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,o){if(1&o&&(t=n(t)),8&o)return t;if(4&o&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&o&&"string"!=typeof t)for(var s in t)n.d(r,s,function(o){return t[o]}.bind(null,s));return r},n.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(o,"a",o),o},n.o=function(t,o){return Object.prototype.hasOwnProperty.call(t,o)},n.p="",n(n.s=21)}([function(t,o){t.exports=flarum.core.compat.extend},function(t,o){t.exports=flarum.core.compat["components/IndexPage"]},function(t,o){t.exports=flarum.core.compat["helpers/icon"]},function(t,o){t.exports=flarum.core.compat.app},function(t,o){t.exports=flarum.core.compat["models/Discussion"]},function(t,o){t.exports=flarum.core.compat["components/Button"]},function(t,o){t.exports=flarum.core.compat["components/Badge"]},function(t,o){t.exports=flarum.core.compat["components/DiscussionPage"]},function(t,o){t.exports=flarum.core.compat.Model},function(t,o){t.exports=flarum.core.compat["components/NotificationGrid"]},function(t,o){t.exports=flarum.core.compat["utils/DiscussionControls"]},function(t,o){t.exports=flarum.core.compat["components/Dropdown"]},function(t,o){t.exports=flarum.core.compat["utils/extractText"]},function(t,o){t.exports=flarum.core.compat.Component},function(t,o){t.exports=flarum.core.compat["components/LinkButton"]},function(t,o){t.exports=flarum.core.compat["states/DiscussionListState"]},function(t,o){t.exports=flarum.core.compat["states/GlobalSearchState"]},function(t,o){t.exports=flarum.core.compat["components/SettingsPage"]},function(t,o){t.exports=flarum.core.compat["components/Switch"]},function(t,o){t.exports=flarum.core.compat["components/Notification"]},function(t,o){t.exports=flarum.core.compat["helpers/username"]},function(t,o,n){"use strict";n.r(o);var r=n(0),s=n(3),e=n.n(s),a=n(8),i=n.n(a),c=n(4),u=n.n(c),p=n(1),l=n.n(p),f=n(9),b=n.n(f),d=n(6),g=n.n(d);var _=n(5),w=n.n(_),y=n(7),h=n.n(y),x=n(10),v=n.n(x);function O(){return(O=Object.assign||function(t){for(var o=1;o<arguments.length;o++){var n=arguments[o];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function S(t,o){t.prototype=Object.create(o.prototype),t.prototype.constructor=t,t.__proto__=o}var j=n(11),P=n.n(j),N=n(2),M=n.n(N),k=n(12),B=n.n(k),D=n(13),I=function(t){function o(){return t.apply(this,arguments)||this}return S(o,t),o.prototype.view=function(){return m("button",{className:"SubscriptionMenuItem hasIcon",onclick:this.attrs.onclick},this.attrs.active?M()("fas fa-check",{className:"Button-icon"}):"",m("span",{className:"SubscriptionMenuItem-label"},M()(this.attrs.icon,{className:"Button-icon"}),m("strong",null,this.attrs.label),m("span",{className:"SubscriptionMenuItem-description"},this.attrs.description)))},o}(n.n(D).a),A=function(t){function o(){return t.apply(this,arguments)||this}S(o,t);var n=o.prototype;return n.oninit=function(o){t.prototype.oninit.call(this,o),this.options=[{subscription:!1,icon:"far fa-star",label:app.translator.trans("flarum-subscriptions.forum.sub_controls.not_following_button"),description:app.translator.trans("flarum-subscriptions.forum.sub_controls.not_following_text")},{subscription:"follow",icon:"fas fa-star",label:app.translator.trans("flarum-subscriptions.forum.sub_controls.following_button"),description:app.translator.trans("flarum-subscriptions.forum.sub_controls.following_text")},{subscription:"ignore",icon:"far fa-eye-slash",label:app.translator.trans("flarum-subscriptions.forum.sub_controls.ignoring_button"),description:app.translator.trans("flarum-subscriptions.forum.sub_controls.ignoring_text")}]},n.view=function(){var t=this,o=this.attrs.discussion,n=o.subscription(),r=app.translator.trans("flarum-subscriptions.forum.sub_controls.follow_button"),s="far fa-star",e="SubscriptionMenu-button--"+n;switch(n){case"follow":r=app.translator.trans("flarum-subscriptions.forum.sub_controls.following_button"),s="fas fa-star";break;case"ignore":r=app.translator.trans("flarum-subscriptions.forum.sub_controls.ignoring_button"),s="far fa-eye-slash"}var a=app.session.user.preferences(),i=a.notify_newPost_email,c=a.notify_newPost_alert,u=B()(app.translator.trans(i?"flarum-subscriptions.forum.sub_controls.notify_email_tooltip":"flarum-subscriptions.forum.sub_controls.notify_alert_tooltip")),p={className:"Button SubscriptionMenu-button "+e,icon:s,onclick:this.saveSubscription.bind(this,o,-1===["follow","ignore"].indexOf(n)&&"follow"),title:u};return(i||c)&&!1===n?p.oncreate=p.onupdate=function(t){$(t.dom).tooltip({container:".SubscriptionMenu",placement:"bottom",delay:250,title:u})}:p.onupdate=function(t){return $(t.dom).tooltip("destroy")},m("div",{className:"Dropdown ButtonGroup SubscriptionMenu"},w.a.component(p,r),m("button",{className:"Dropdown-toggle Button Button--icon "+e,"data-toggle":"dropdown"},M()("fas fa-caret-down",{className:"Button-icon"})),m("ul",{className:"Dropdown-menu dropdown-menu Dropdown-menu--right"},this.options.map((function(r){return m("li",null,I.component(O(O({},r),{},{onclick:t.saveSubscription.bind(t,o,r.subscription),active:n===r.subscription})))}))))},n.saveSubscription=function(t,o){t.save({subscription:o}),this.$(".SubscriptionMenu-button").tooltip("hide")},o}(P.a);var R=n(14),T=n.n(R),L=n(15),C=n.n(L),G=n(16),F=n.n(G);var q=n(17),z=n.n(q),U=n(18),E=n.n(U),H=n(19),J=n.n(H),K=(n(20),function(t){function o(){return t.apply(this,arguments)||this}S(o,t);var n=o.prototype;return n.icon=function(){return"fas fa-star"},n.href=function(){var t=this.attrs.notification,o=t.subject(),n=t.content()||{};return app.route.discussion(o,n.postNumber)},n.content=function(){return app.translator.trans("flarum-subscriptions.forum.notifications.new_post_text",{user:this.attrs.notification.fromUser()})},o}(J.a));e.a.initializers.add("subscriptions",(function(){e.a.routes.following={path:"/following",component:l.a},e.a.notificationComponents.newPost=K,u.a.prototype.subscription=i.a.attribute("subscription"),Object(r.extend)(u.a.prototype,"badges",(function(t){var o;switch(this.subscription()){case"follow":o=g.a.component({label:app.translator.trans("flarum-subscriptions.forum.badge.following_tooltip"),icon:"fas fa-star",type:"following"});break;case"ignore":o=g.a.component({label:app.translator.trans("flarum-subscriptions.forum.badge.ignoring_tooltip"),icon:"far fa-eye-slash",type:"ignoring"})}o&&t.add("subscription",o)})),Object(r.extend)(v.a,"userControls",(function(t,o,n){if(app.session.user&&!(n instanceof h.a)){var r={none:{label:app.translator.trans("flarum-subscriptions.forum.discussion_controls.follow_button"),icon:"fas fa-star",save:"follow"},follow:{label:app.translator.trans("flarum-subscriptions.forum.discussion_controls.unfollow_button"),icon:"far fa-star",save:!1},ignore:{label:app.translator.trans("flarum-subscriptions.forum.discussion_controls.unignore_button"),icon:"fas fa-eye",save:!1}},s=o.subscription()||"none";t.add("subscription",w.a.component({icon:r[s].icon,onclick:o.save.bind(o,{subscription:r[s].save})},r[s].label))}})),Object(r.extend)(h.a.prototype,"sidebarItems",(function(t){if(app.session.user){var o=this.discussion;t.add("subscription",A.component({discussion:o}))}})),Object(r.extend)(l.a.prototype,"navItems",(function(t){if(app.session.user){var o=app.search.stickyParams();t.add("following",T.a.component({href:app.route("following",o),icon:"fas fa-star"},app.translator.trans("flarum-subscriptions.forum.index.following_link")),50)}})),Object(r.extend)(l.a.prototype,"setTitle",(function(){"following"===app.current.get("routeName")&&app.setTitle(app.translator.trans("flarum-subscriptions.forum.following.meta_title_text"))})),Object(r.extend)(F.a.prototype,"params",(function(t){t.onFollowing="following"===app.current.get("routeName")})),Object(r.extend)(C.a.prototype,"requestParams",(function(t){this.params.onFollowing&&(t.filter.subscription="following")})),Object(r.extend)(z.a.prototype,"notificationsItems",(function(t){var o=this;t.add("followAfterReply",E.a.component({state:this.user.preferences().followAfterReply,onchange:function(t){o.followAfterReplyLoading=!0,o.user.savePreferences({followAfterReply:t}).then((function(){o.followAfterReplyLoading=!1,m.redraw()}))},loading:this.followAfterReplyLoading},app.translator.trans("flarum-subscriptions.forum.settings.follow_after_reply_label")))})),Object(r.extend)(b.a.prototype,"notificationTypes",(function(t){t.add("newPost",{name:"newPost",icon:"fas fa-star",label:e.a.translator.trans("flarum-subscriptions.forum.settings.notify_new_post_label")})}))}))}]); flarum.extensions['flarum-subscriptions']=module.exports var module={} module.exports=function(t){var e={};function n(s){if(e[s])return e[s].exports;var a=e[s]={i:s,l:!1,exports:{}};return t[s].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=t,n.c=e,n.d=function(t,e,s){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)n.d(s,a,function(e){return t[e]}.bind(null,a));return s},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=11)}([function(t,e){t.exports=flarum.core.compat.app},function(t,e){t.exports=flarum.core.compat["components/Button"]},function(t,e){t.exports=flarum.core.compat["components/Notification"]},function(t,e){t.exports=flarum.core.compat.Model},function(t,e){t.exports=flarum.core.compat["models/User"]},function(t,e){t.exports=flarum.core.compat["utils/withAttr"]},function(t,e){t.exports=flarum.core.compat.extend},function(t,e){t.exports=flarum.core.compat["utils/Stream"]},function(t,e){t.exports=flarum.core.compat["utils/UserControls"]},function(t,e){t.exports=flarum.core.compat["components/Badge"]},function(t,e){t.exports=flarum.core.compat["components/Modal"]},function(t,e,n){"use strict";n.r(e);var s=n(6),a=n(0),r=n.n(a),o=n(8),u=n.n(o),i=n(1),l=n.n(i),p=n(9),c=n.n(p),d=n(3),f=n.n(d),y=n(4),h=n.n(y);function b(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var v=n(10),_=n.n(v),x=n(7),g=n.n(x),j=n(5),S=n.n(j),U=function(t){function e(){return t.apply(this,arguments)||this}b(e,t);var n=e.prototype;return n.oninit=function(e){t.prototype.oninit.call(this,e);var n=this.attrs.user.suspendedUntil(),s=null;new Date>n&&(n=null),n&&(s=9999===n.getFullYear()?"indefinitely":"limited"),this.status=g()(s),this.daysRemaining=g()("limited"===s&&1-dayjs().diff(n,"days"))},n.className=function(){return"SuspendUserModal Modal--small"},n.title=function(){return app.translator.trans("flarum-suspend.forum.suspend_user.title",{user:this.attrs.user})},n.content=function(){var t=this;return m("div",{className:"Modal-body"},m("div",{className:"Form"},m("div",{className:"Form-group"},m("label",null,app.translator.trans("flarum-suspend.forum.suspend_user.status_heading")),m("div",null,m("label",{className:"checkbox"},m("input",{type:"radio",name:"status",checked:!this.status(),value:"",onclick:S()("value",this.status)}),app.translator.trans("flarum-suspend.forum.suspend_user.not_suspended_label")),m("label",{className:"checkbox"},m("input",{type:"radio",name:"status",checked:"indefinitely"===this.status(),value:"indefinitely",onclick:S()("value",this.status)}),app.translator.trans("flarum-suspend.forum.suspend_user.indefinitely_label")),m("label",{className:"checkbox SuspendUserModal-days"},m("input",{type:"radio",name:"status",checked:"limited"===this.status(),value:"limited",onclick:function(e){t.status(e.target.value),m.redraw.sync(),t.$(".SuspendUserModal-days-input input").select(),e.redraw=!1}}),app.translator.trans("flarum-suspend.forum.suspend_user.limited_time_label"),"limited"===this.status()?m("div",{className:"SuspendUserModal-days-input"},m("input",{type:"number",min:"0",value:this.daysRemaining(),oninput:S()("value",this.daysRemaining),className:"FormControl"}),app.translator.trans("flarum-suspend.forum.suspend_user.limited_time_days_text")):""))),m("div",{className:"Form-group"},m(l.a,{className:"Button Button--primary",loading:this.loading,type:"submit"},app.translator.trans("flarum-suspend.forum.suspend_user.submit_button")))))},n.onsubmit=function(t){var e=this;t.preventDefault(),this.loading=!0;var n=null;switch(this.status()){case"indefinitely":n=new Date("2038-01-01");break;case"limited":n=dayjs().add(this.daysRemaining(),"days").toDate()}this.attrs.user.save({suspendedUntil:n}).then((function(){return e.hide()}),this.loaded.bind(this))},e}(_.a),M=n(2),N=n.n(M),k=function(t){function e(){return t.apply(this,arguments)||this}b(e,t);var n=e.prototype;return n.icon=function(){return"fas fa-ban"},n.href=function(){return app.route.user(this.attrs.notification.subject())},n.content=function(){var t=this.attrs.notification,e=t.content(),n=dayjs(e).from(t.createdAt(),!0);return app.translator.trans("flarum-suspend.forum.notifications.user_suspended_text",{user:t.fromUser(),timeReadable:n})},e}(N.a),O=function(t){function e(){return t.apply(this,arguments)||this}b(e,t);var n=e.prototype;return n.icon=function(){return"fas fa-ban"},n.href=function(){return app.route.user(this.attrs.notification.subject())},n.content=function(){var t=this.attrs.notification;return app.translator.trans("flarum-suspend.forum.notifications.user_unsuspended_text",{user:t.fromUser()})},e}(N.a);r.a.initializers.add("flarum-suspend",(function(){r.a.notificationComponents.userSuspended=k,r.a.notificationComponents.userUnsuspended=O,h.a.prototype.canSuspend=f.a.attribute("canSuspend"),h.a.prototype.suspendedUntil=f.a.attribute("suspendedUntil",f.a.transformDate),Object(s.extend)(u.a,"moderationControls",(function(t,e){e.canSuspend()&&t.add("suspend",l.a.component({icon:"fas fa-ban",onclick:function(){return r.a.modal.show(U,{user:e})}},r.a.translator.trans("flarum-suspend.forum.user_controls.suspend_button")))})),Object(s.extend)(h.a.prototype,"badges",(function(t){var e=this.suspendedUntil();new Date<e&&t.add("suspended",c.a.component({icon:"fas fa-ban",type:"suspended",label:r.a.translator.trans("flarum-suspend.forum.user_badge.suspended_tooltip")}))}))}))}]); flarum.extensions['flarum-suspend']=module.exports var module={} module.exports=function(t){var e={};function a(s){if(e[s])return e[s].exports;var n=e[s]={i:s,l:!1,exports:{}};return t[s].call(n.exports,n,n.exports,a),n.l=!0,n.exports}return a.m=t,a.c=e,a.d=function(t,e,s){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(a.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)a.d(s,n,function(e){return t[e]}.bind(null,n));return s},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="",a(a.s=50)}([function(t,e){t.exports=flarum.core.compat.Model},function(t,e){t.exports=flarum.core.compat.extend},function(t,e,a){"use strict";function s(t){return t.slice(0).sort((function(t,e){var a=t.position(),s=e.position();if(null===a&&null===s)return e.discussionCount()-t.discussionCount();if(null===s)return-1;if(null===a)return 1;var n=t.parent(),o=e.parent();return n===o?a-s:n&&o?n.position()-o.position():n?n===e?1:n.position()-s:o?o===t?-1:a-o.position():0}))}a.d(e,"a",(function(){return s}))},function(t,e,a){"use strict";a.d(e,"a",(function(){return o}));var s=a(9),n=a.n(s);function o(t,e,a){void 0===e&&(e={}),void 0===a&&(a={});var s=t&&t.icon(),o=a.useColor,r=void 0===o||o;return e.className=n()([e.className,"icon",s?t.icon():"TagIcon"]),t?(e.style=e.style||{},s?e.style.color=r?t.color():"":e.style.backgroundColor=t.color()):e.className+=" untagged",s?m("i",e):m("span",e)}},function(t,e,a){"use strict";function s(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}a.d(e,"a",(function(){return s}))},function(t,e,a){"use strict";a.d(e,"a",(function(){return c}));var s=a(14),n=a.n(s),o=a(10),r=a.n(o),i=a(3);function c(t,e){void 0===e&&(e={}),e.style=e.style||{},e.className="TagLabel "+(e.className||"");var a=n()(e,"link"),s=t?t.name():app.translator.trans("flarum-tags.lib.deleted_tag_text");if(t){var o=t.color();o&&(e.style.backgroundColor=e.style.color=o,e.className+=" colored"),a&&(e.title=t.description()||"",e.href=app.route("tag",{tags:t.slug()})),t.isChild()&&(e.className+=" TagLabel--child")}else e.className+=" untagged";return m(a?r.a:"span",e,m("span",{className:"TagLabel-text"},t&&t.icon()&&Object(i.a)(t,{},{useColor:!1})," ",s))}},function(t,e){t.exports=flarum.core.compat["components/IndexPage"]},function(t,e,a){"use strict";a.d(e,"a",(function(){return i}));var s=a(14),n=a.n(s),o=a(5),r=a(2);function i(t,e){void 0===e&&(e={});var a=[],s=n()(e,"link");return e.className="TagsLabel "+(e.className||""),t?Object(r.a)(t).forEach((function(e){(e||1===t.length)&&a.push(Object(o.a)(e,{link:s}))})):a.push(Object(o.a)()),m("span",e,a)}},function(t,e){t.exports=flarum.core.compat["components/Button"]},function(t,e){t.exports=flarum.core.compat["utils/classList"]},function(t,e){t.exports=flarum.core.compat["components/Link"]},function(t,e){t.exports=flarum.core.compat["utils/Stream"]},function(t,e,a){"use strict";function s(){return(s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var a=arguments[e];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(t[s]=a[s])}return t}).apply(this,arguments)}a.d(e,"a",(function(){return s}))},function(t,e,a){"use strict";a.d(e,"a",(function(){return l}));var s=a(4),n=a(0),o=a.n(n),r=a(16),i=a.n(r),c=a(17),u=a.n(c),l=function(t){function e(){return t.apply(this,arguments)||this}return Object(s.a)(e,t),e}(i()(o.a,{name:o.a.attribute("name"),slug:o.a.attribute("slug"),description:o.a.attribute("description"),color:o.a.attribute("color"),backgroundUrl:o.a.attribute("backgroundUrl"),backgroundMode:o.a.attribute("backgroundMode"),icon:o.a.attribute("icon"),position:o.a.attribute("position"),parent:o.a.hasOne("parent"),defaultSort:o.a.attribute("defaultSort"),isChild:o.a.attribute("isChild"),isHidden:o.a.attribute("isHidden"),discussionCount:o.a.attribute("discussionCount"),lastPostedAt:o.a.attribute("lastPostedAt",o.a.transformDate),lastPostedDiscussion:o.a.hasOne("lastPostedDiscussion"),isRestricted:o.a.attribute("isRestricted"),canStartDiscussion:o.a.attribute("canStartDiscussion"),canAddToDiscussion:o.a.attribute("canAddToDiscussion"),isPrimary:u()("position","parent",(function(t,e){return null!==t&&!1===e}))}))},function(t,e){t.exports=flarum.core.compat["utils/extract"]},function(t,e){},function(t,e){t.exports=flarum.core.compat["utils/mixin"]},function(t,e){t.exports=flarum.core.compat["utils/computed"]},function(t,e){t.exports=flarum.core.compat["components/Modal"]},function(t,e,a){"use strict";var s=a(2),n=a(13),o=a(7),r=a(3),i=a(5);e.a={"tags/utils/sortTags":s.a,"tags/models/Tag":n.a,"tags/helpers/tagsLabel":o.a,"tags/helpers/tagIcon":r.a,"tags/helpers/tagLabel":i.a}},function(t,e){t.exports=flarum.core},function(t,e){t.exports=flarum.core.compat["components/LinkButton"]},,function(t,e){t.exports=flarum.core.compat["components/DiscussionComposer"]},function(t,e){t.exports=flarum.core.compat["models/Discussion"]},function(t,e){t.exports=flarum.core.compat["components/DiscussionHero"]},function(t,e){t.exports=flarum.core.compat["utils/extractText"]},,function(t,e,a){"use strict";var s=a(12),n=a(0),o=a.n(n),r=a(24),i=a.n(r),c=a(6),u=a.n(c),l=a(13),p=a(4),d=a(30),f=a.n(d),g=a(10),h=a.n(g),b=a(31),v=a.n(b),y=a(32),x=a.n(y),T=a(3),O=a(5),N=a(2),_=function(t){function e(){return t.apply(this,arguments)||this}Object(p.a)(e,t);var a=e.prototype;return a.oninit=function(e){t.prototype.oninit.call(this,e),this.tags=Object(N.a)(app.store.all("tags").filter((function(t){return!t.parent()}))),app.history.push("tags",app.translator.trans("flarum-tags.forum.header.back_to_tags_tooltip"))},a.view=function(){var t=this.tags.filter((function(t){return null!==t.position()})),e=this.tags.filter((function(t){return null===t.position()}));return m("div",{className:"TagsPage"},u.a.prototype.hero(),m("div",{className:"container"},m("nav",{className:"TagsPage-nav IndexPage-nav sideNav"},m("ul",null,v()(u.a.prototype.sidebarItems().toArray()))),m("div",{className:"TagsPage-content sideNavOffset"},m("ul",{className:"TagTiles"},t.map((function(t){var e=t.lastPostedDiscussion(),a=Object(N.a)(app.store.all("tags").filter((function(e){return e.parent()===t})));return m("li",{className:"TagTile "+(t.color()?"colored":""),style:{backgroundColor:t.color()}},m(h.a,{className:"TagTile-info",href:app.route.tag(t)},t.icon()&&Object(T.a)(t,{},{useColor:!1}),m("h3",{className:"TagTile-name"},t.name()),m("p",{className:"TagTile-description"},t.description()),a?m("div",{className:"TagTile-children"},a.map((function(t){return[m(h.a,{href:app.route.tag(t)},t.name())," "]}))):""),e?m(h.a,{className:"TagTile-lastPostedDiscussion",href:app.route.discussion(e,e.lastPostNumber())},m("span",{className:"TagTile-lastPostedDiscussion-title"},e.title()),x()(e.lastPostedAt())):m("span",{className:"TagTile-lastPostedDiscussion"}))}))),e.length?m("div",{className:"TagCloud"},e.map((function(t){return[Object(O.a)(t,{link:!0})," "]}))):"")))},a.oncreate=function(e){t.prototype.oncreate.call(this,e),app.setTitle(app.translator.trans("flarum-tags.forum.all_tags.meta_title_text")),app.setTitleCount(0)},e}(f.a),j=a(33),C=a.n(j),P=a(7),D=function(t){function e(){return t.apply(this,arguments)||this}Object(p.a)(e,t),e.initAttrs=function(e){t.initAttrs.call(this,e);var a=e.post.content()[0],s=e.post.content()[1];function n(t,e){return t.filter((function(t){return-1===e.indexOf(t)})).map((function(t){return app.store.getById("tags",t)}))}e.tagsAdded=n(s,a),e.tagsRemoved=n(a,s)};var a=e.prototype;return a.icon=function(){return"fas fa-tag"},a.descriptionKey=function(){return this.attrs.tagsAdded.length?this.attrs.tagsRemoved.length?"flarum-tags.forum.post_stream.added_and_removed_tags_text":"flarum-tags.forum.post_stream.added_tags_text":"flarum-tags.forum.post_stream.removed_tags_text"},a.descriptionData=function(){var t={};return this.attrs.tagsAdded.length&&(t.tagsAdded=app.translator.transChoice("flarum-tags.forum.post_stream.tags_text",this.attrs.tagsAdded.length,{tags:Object(P.a)(this.attrs.tagsAdded,{link:!0}),count:this.attrs.tagsAdded.length})),this.attrs.tagsRemoved.length&&(t.tagsRemoved=app.translator.transChoice("flarum-tags.forum.post_stream.tags_text",this.attrs.tagsRemoved.length,{tags:Object(P.a)(this.attrs.tagsRemoved,{link:!0}),count:this.attrs.tagsRemoved.length})),t},e}(C.a),I=a(1),k=a(34),S=a.n(k),w=a(21),A=a.n(w),L=a(9),M=a.n(L),B=function(t){function e(){return t.apply(this,arguments)||this}return Object(p.a)(e,t),e.prototype.view=function(t){var e=this.attrs.model,a=this.constructor.isActive(this.attrs),s=e&&e.description(),n=M()(["TagLinkButton","hasIcon",this.attrs.className,e.isChild()&&"child"]);return m(h.a,{className:n,href:this.attrs.route,style:a&&e?{color:e.color()}:"",title:s||""},Object(T.a)(e,{className:"Button-icon"}),m("span",{className:"Button-label"},e?e.name():app.translator.trans("flarum-tags.forum.index.untagged_link")))},e.initAttrs=function(e){t.initAttrs.call(this,e);var a=e.model;e.params.tags=a?a.slug():"untagged",e.route=app.route("tag",e.params)},e}(A.a),H=function(){Object(I.extend)(u.a.prototype,"navItems",(function(t){if(t.add("tags",m(A.a,{icon:"fas fa-th-large",href:app.route("tags")},app.translator.trans("flarum-tags.forum.index.tags_link")),-10),!app.current.matches(_)){t.add("separator",S.a.component(),-12);var e=app.search.stickyParams(),a=app.store.all("tags"),s=this.currentTag(),n=function(a){var n=s===a;!n&&s&&(n=s.parent()===a),t.add("tag"+a.id(),B.component({model:a,params:e,active:n},null==a?void 0:a.name()),-14)};Object(N.a)(a).filter((function(t){return null!==t.position()&&(!t.isChild()||s&&(t.parent()===s||t.parent()===s.parent()))})).forEach(n);var o=a.filter((function(t){return null===t.position()})).sort((function(t,e){return e.discussionCount()-t.discussionCount()}));o.splice(0,3).forEach(n),o.length&&t.add("moreTags",m(A.a,{href:app.route("tags")},app.translator.trans("flarum-tags.forum.index.more_link")),-16)}}))},R=a(35),E=a.n(R),q=a(36),K=a.n(q),$=a(37),F=function(t){function e(){return t.apply(this,arguments)||this}return Object(p.a)(e,t),e.prototype.view=function(){var t=this.attrs.model,e=t.color();return m("header",{className:"Hero TagHero"+(e?" TagHero--colored":""),style:e?{color:"#fff",backgroundColor:e}:""},m("div",{className:"container"},m("div",{className:"containerNarrow"},m("h2",{className:"Hero-title"},t.icon()&&Object(T.a)(t,{},{useColor:!1})," ",t.name()),m("div",{className:"Hero-subtitle"},t.description()))))},e}(a.n($).a),U=function(){u.a.prototype.currentTag=function(){var t=app.search.params().tags;if(t)return app.store.getBy("tags","slug",t)},Object(I.override)(u.a.prototype,"hero",(function(t){var e=this.currentTag();return e?m(F,{model:e}):t()})),Object(I.extend)(u.a.prototype,"view",(function(t){var e=this.currentTag();e&&(t.attrs.className+=" IndexPage--tag"+e.id())})),Object(I.extend)(u.a.prototype,"setTitle",(function(){var t=this.currentTag();t&&app.setTitle(t.name())})),Object(I.extend)(u.a.prototype,"sidebarItems",(function(t){var e=this.currentTag();if(e){var a=e.color(),s=e.canStartDiscussion()||!app.session.user;a&&(t.get("newDiscussion").attrs.style={backgroundColor:a}),t.get("newDiscussion").attrs.disabled=!s,t.get("newDiscussion").children=app.translator.trans(s?"core.forum.index.start_discussion_button":"core.forum.index.cannot_start_discussion_button")}})),Object(I.extend)(K.a.prototype,"params",(function(t){t.tags=m.route.param("tags")})),Object(I.extend)(E.a.prototype,"requestParams",(function(t){t.include.push("tags"),this.params.tags&&(t.filter.tag=this.params.tags)}))},z=a(38),G=a.n(z),J=a(25),Q=a.n(J),V=function(){Object(I.extend)(G.a.prototype,"infoItems",(function(t){var e=this.attrs.discussion.tags();e&&e.length&&t.add("tags",Object(P.a)(e),10)})),Object(I.extend)(Q.a.prototype,"view",(function(t){var e=Object(N.a)(this.attrs.discussion.tags());if(e&&e.length){var a=e[0].color();a&&(t.attrs.style={backgroundColor:a},t.attrs.className+=" DiscussionHero--colored")}})),Object(I.extend)(Q.a.prototype,"items",(function(t){var e=this.attrs.discussion.tags();e&&e.length&&t.add("tags",Object(P.a)(e,{link:!0}),5)}))},W=a(39),X=a.n(W),Y=a(8),Z=a.n(Y),tt=a(18),et=a.n(tt),at=a(40),st=a.n(at),nt=a(41),ot=a.n(nt),rt=a(26),it=a.n(rt),ct=a(42),ut=a.n(ct),lt=a(11),pt=a.n(lt);function mt(t){var e=app.store.all("tags");return e=t?e.filter((function(e){return e.canAddToDiscussion()||-1!==t.tags().indexOf(e)})):e.filter((function(t){return t.canStartDiscussion()}))}var dt=function(t){function e(){return t.apply(this,arguments)||this}Object(p.a)(e,t);var a=e.prototype;return a.oninit=function(e){var a=this;t.prototype.oninit.call(this,e),this.tags=mt(this.attrs.discussion),this.tags=Object(N.a)(this.tags),this.selected=[],this.filter=pt()(""),this.index=this.tags[0].id(),this.focused=!1,this.attrs.selectedTags?this.attrs.selectedTags.map(this.addTag.bind(this)):this.attrs.discussion&&this.attrs.discussion.tags().map(this.addTag.bind(this)),this.minPrimary=app.forum.attribute("minPrimaryTags"),this.maxPrimary=app.forum.attribute("maxPrimaryTags"),this.minSecondary=app.forum.attribute("minSecondaryTags"),this.maxSecondary=app.forum.attribute("maxSecondaryTags"),this.navigator=new ut.a,this.navigator.onUp((function(){return a.setIndex(a.getCurrentNumericIndex()-1,!0)})).onDown((function(){return a.setIndex(a.getCurrentNumericIndex()+1,!0)})).onSelect(this.select.bind(this)).onRemove((function(){return a.selected.splice(a.selected.length-1,1)}))},a.primaryCount=function(){return this.selected.filter((function(t){return t.isPrimary()})).length},a.secondaryCount=function(){return this.selected.filter((function(t){return!t.isPrimary()})).length},a.addTag=function(t){if(t.canStartDiscussion()){var e=t.parent();e&&-1===this.selected.indexOf(e)&&this.selected.push(e),-1===this.selected.indexOf(t)&&this.selected.push(t)}},a.removeTag=function(t){var e=this.selected.indexOf(t);-1!==e&&(this.selected.splice(e,1),this.selected.filter((function(e){return e.parent()===t})).forEach(this.removeTag.bind(this)))},a.className=function(){return"TagDiscussionModal"},a.title=function(){return this.attrs.discussion?app.translator.trans("flarum-tags.forum.choose_tags.edit_title",{title:m("em",null,this.attrs.discussion.title())}):app.translator.trans("flarum-tags.forum.choose_tags.title")},a.getInstruction=function(t,e){if(t<this.minPrimary){var a=this.minPrimary-t;return app.translator.transChoice("flarum-tags.forum.choose_tags.choose_primary_placeholder",a,{count:a})}if(e<this.minSecondary){var s=this.minSecondary-e;return app.translator.transChoice("flarum-tags.forum.choose_tags.choose_secondary_placeholder",s,{count:s})}return""},a.content=function(){var t=this,e=this.tags,a=this.filter().toLowerCase(),s=this.primaryCount(),n=this.secondaryCount();e=e.filter((function(e){var a=e.parent();return!1===a||-1!==t.selected.indexOf(a)})),s>=this.maxPrimary&&(e=e.filter((function(e){return!e.isPrimary()||-1!==t.selected.indexOf(e)}))),n>=this.maxSecondary&&(e=e.filter((function(e){return e.isPrimary()||-1!==t.selected.indexOf(e)}))),a&&(e=e.filter((function(t){return t.name().substr(0,a.length).toLowerCase()===a}))),-1===e.indexOf(this.index)&&(this.index=e[0]);var o=Math.max(it()(this.getInstruction(s,n)).length,this.filter().length);return[m("div",{className:"Modal-body"},m("div",{className:"TagDiscussionModal-form"},m("div",{className:"TagDiscussionModal-form-input"},m("div",{className:"TagsInput FormControl "+(this.focused?"focus":""),onclick:function(){return t.$(".TagsInput input").focus()}},m("span",{className:"TagsInput-selected"},this.selected.map((function(e){return m("span",{className:"TagsInput-tag",onclick:function(){t.removeTag(e),t.onready()}},Object(O.a)(e))}))),m("input",{className:"FormControl",placeholder:it()(this.getInstruction(s,n)),bidi:this.filter,style:{width:o+"ch"},onkeydown:this.navigator.navigate.bind(this.navigator),onfocus:function(){return t.focused=!0},onblur:function(){return t.focused=!1}}))),m("div",{className:"TagDiscussionModal-form-submit App-primaryControl"},m(Z.a,{type:"submit",className:"Button Button--primary",disabled:!this.meetsRequirements(s,n),icon:"fas fa-check"},app.translator.trans("flarum-tags.forum.choose_tags.submit_button"))))),m("div",{className:"Modal-footer"},m("ul",{className:"TagDiscussionModal-list SelectTagList"},e.filter((function(e){return a||!e.parent()||-1!==t.selected.indexOf(e.parent())})).map((function(e){return m("li",{"data-index":e.id(),className:M()({pinned:null!==e.position(),child:!!e.parent(),colored:!!e.color(),selected:-1!==t.selected.indexOf(e),active:t.index===e}),style:{color:e.color()},onmouseover:function(){return t.index=e},onclick:t.toggleTag.bind(t,e)},Object(T.a)(e),m("span",{className:"SelectTagListItem-name"},ot()(e.name(),a)),e.description()?m("span",{className:"SelectTagListItem-description"},e.description()):"")}))))]},a.meetsRequirements=function(t,e){return!!app.forum.attribute("canBypassTagCounts")||t>=this.minPrimary&&e>=this.minSecondary},a.toggleTag=function(t){-1!==this.selected.indexOf(t)?this.removeTag(t):this.addTag(t),this.filter()&&(this.filter(""),this.index=this.tags[0]),this.onready()},a.select=function(t){t.metaKey||t.ctrlKey||-1!==this.selected.indexOf(this.index)?this.selected.length&&this.$('button[type="submit"]').click():this.getItem(this.index)[0].dispatchEvent(new Event("click"))},a.selectableItems=function(){return this.$(".TagDiscussionModal-list > li")},a.getCurrentNumericIndex=function(){return this.selectableItems().index(this.getItem(this.index))},a.getItem=function(t){return this.selectableItems().filter('[data-index="'+t.id()+'"]')},a.setIndex=function(t,e){var a=this.selectableItems(),s=a.parent();t<0?t=a.length-1:t>=a.length&&(t=0);var n=a.eq(t);if(this.index=app.store.getById("tags",n.attr("data-index")),m.redraw(),e){var o,r=s.scrollTop(),i=s.offset().top,c=i+s.outerHeight(),u=n.offset().top,l=u+n.outerHeight();u<i?o=r-i+u-parseInt(s.css("padding-top"),10):l>c&&(o=r-c+l+parseInt(s.css("padding-bottom"),10)),void 0!==o&&s.stop(!0).animate({scrollTop:o},100)}},a.onsubmit=function(t){t.preventDefault();var e=this.attrs.discussion,a=this.selected;e&&e.save({relationships:{tags:a}}).then((function(){app.current.matches(st.a)&&app.current.get("stream").update(),m.redraw()})),this.attrs.onsubmit&&this.attrs.onsubmit(a),this.hide()},e}(et.a),ft=function(){Object(I.extend)(X.a,"moderationControls",(function(t,e){e.canTag()&&t.add("tags",m(Z.a,{icon:"fas fa-tag",onclick:function(){return app.modal.show(dt,{discussion:e})}},app.translator.trans("flarum-tags.forum.discussion_controls.edit_tags_button")))}))},gt=a(23),ht=a.n(gt),bt=function(){Object(I.extend)(u.a.prototype,"newDiscussionAction",(function(t){var e=app.store.getBy("tags","slug",app.search.params().tags);if(e){var a=e.parent(),s=a?[a,e]:[e];t.then((function(t){return t.fields.tags=s}))}else app.composer.fields.tags=[]})),ht.a.prototype.chooseTags=function(){var t=this;mt().length&&app.modal.show(dt,{selectedTags:(this.composer.fields.tags||[]).slice(0),onsubmit:function(e){t.composer.fields.tags=e,t.$("textarea").focus()}})},Object(I.extend)(ht.a.prototype,"headerItems",(function(t){var e=this.composer.fields.tags||[],a=mt();t.add("tags",m("a",{className:M()(["DiscussionComposer-changeTags",!a.length&&"disabled"]),onclick:this.chooseTags.bind(this)},e.length?Object(P.a)(e):m("span",{className:"TagLabel untagged"},app.translator.trans("flarum-tags.forum.composer_discussion.choose_tags_link"))),10)})),Object(I.override)(ht.a.prototype,"onsubmit",(function(t){var e=this,a=this.composer.fields.tags||[],s=a.filter((function(t){return null!==t.position()&&!t.isChild()})),n=a.filter((function(t){return null===t.position()})),o=mt();(!a.length||s.length<app.forum.attribute("minPrimaryTags")||n.length<app.forum.attribute("minSecondaryTags"))&&o.length?app.modal.show(dt,{selectedTags:a,onsubmit:function(a){e.composer.fields.tags=a,t()}}):t()})),Object(I.extend)(ht.a.prototype,"data",(function(t){t.relationships=t.relationships||{},t.relationships.tags=this.composer.fields.tags}))},vt=a(19),yt=Object(s.a)(vt.a,{"tags/addTagFilter":U,"tags/addTagControl":ft,"tags/components/TagHero":F,"tags/components/TagDiscussionModal":dt,"tags/components/TagsPage":_,"tags/components/DiscussionTaggedPost":D,"tags/components/TagLinkButton":B,"tags/addTagList":H,"tags/addTagLabels":V,"tags/addTagComposer":bt}),xt=a(20);app.initializers.add("flarum-tags",(function(t){t.routes.tags={path:"/tags",component:_},t.routes.tag={path:"/t/:tags",component:u.a},t.route.tag=function(e){return t.route("tag",{tags:e.slug()})},t.postComponents.discussionTagged=D,t.store.models.tags=l.a,i.a.prototype.tags=o.a.hasMany("tags"),i.a.prototype.canTag=o.a.attribute("canTag"),H(),U(),V(),ft(),bt()})),Object(s.a)(xt.compat,yt)},,function(t,e){t.exports=flarum.core.compat["components/Page"]},function(t,e){t.exports=flarum.core.compat["helpers/listItems"]},function(t,e){t.exports=flarum.core.compat["helpers/humanTime"]},function(t,e){t.exports=flarum.core.compat["components/EventPost"]},function(t,e){t.exports=flarum.core.compat["components/Separator"]},function(t,e){t.exports=flarum.core.compat["states/DiscussionListState"]},function(t,e){t.exports=flarum.core.compat["states/GlobalSearchState"]},function(t,e){t.exports=flarum.core.compat.Component},function(t,e){t.exports=flarum.core.compat["components/DiscussionListItem"]},function(t,e){t.exports=flarum.core.compat["utils/DiscussionControls"]},function(t,e){t.exports=flarum.core.compat["components/DiscussionPage"]},function(t,e){t.exports=flarum.core.compat["helpers/highlight"]},function(t,e){t.exports=flarum.core.compat["utils/KeyboardNavigatable"]},,,,,,,,function(t,e,a){"use strict";a.r(e);var s=a(15);for(var n in s)"default"!==n&&function(t){a.d(e,t,(function(){return s[t]}))}(n);a(28)}]); flarum.extensions['flarum-tags']=module.exports //# sourceMappingURL=http://192.168.33.10/assets/forum-ae6b4a14.js.map
const t = require('tap') const sinon = require('sinon') const subject = require('../') const fixture = require('./fixture') const noop = () => {} t.test('Express Request Mock', (t) => { t.test('interface', (t) => { t.test('when imported', (t) => { t.type(subject, Function, 'provides a function') t.type(subject(noop), Promise, 'that returns a promise') t.end() }) t.test('when called with a method', (t) => { const stub = sinon.stub() subject(stub) t.ok(stub.calledOnce, 'it calls the method') t.ok( stub.calledWithMatch(sinon.match.object, sinon.match.object, sinon.match.func), 'with the request, response and fallthrough function' ) t.end() }) t.test('when called without a method', (t) => { t.throws(subject, TypeError, 'it throws a type error') t.end() }) t.test('when given options', (t) => { const stub = sinon.stub() const query = { search: true } subject(stub, { query }) t.ok( stub.calledWithMatch(sinon.match.has('query', query), sinon.match.object, sinon.match.func), 'the mocks are created with the options' ) t.end() }) t.test('when given decorators', (t) => { const stub = sinon.stub() const locals = { authorized: true } subject(stub, undefined, { locals }) t.ok( stub.calledWithMatch( sinon.match.has('locals', locals), sinon.match.has('locals', locals), sinon.match.func ), 'the mocks are assigned the decorators' ) t.end() }) t.end() }) t.test('when the promise is resolved', (t) => { t.test('by the end event being emitted (sync)', (t) => { const options = { params: { case: 'ok-sync' } } return subject(fixture, options).then((props) => { t.type(props.req, Object, 'it provides the request object') t.type(props.res, Object, 'and the response object') }) }) t.test('by the end event being emitted (async)', (t) => { const options = { params: { case: 'ok-async' } } return subject(fixture, options).then((props) => { t.type(props.req, Object, 'it provides the request object') t.type(props.res, Object, 'and the response object') }) }) t.test('by the fallthrough function being called', (t) => { const options = { params: { case: 'ok-next' } } return subject(fixture, options).then((props) => { t.type(props.req, Object, 'it provides the request object') t.type(props.res, Object, 'and the response object') }) }) t.test('by the fallthrough function being called with a bypass command', (t) => { const options = { params: { case: 'ok-bypass' } } return subject(fixture, options).then((props) => { t.type(props.req, Object, 'it provides the request object') t.type(props.res, Object, 'and the response object') }) }) t.end() }) t.test('when the promise is rejected', (t) => { t.test('by the fallthrough function being called with an error', (t) => { const options = { params: { case: 'fail-next' } } return subject(fixture, options) .then(() => t.fail('the promise should not resolve')) .catch((err) => t.equal(err.message, 'next', 'it passes the error along')) }) t.test('by the code under test throwing an error', (t) => { const options = { params: { case: 'fail-throws' } } return subject(fixture, options) .then(() => t.fail('the promise should not resolve')) .catch((err) => t.equal(err.message, 'throws', 'it passes the error along')) }) t.end() }) t.end() })
import React from 'react'; import styled from 'styled-components'; import fonts from '../../styles/font'; import colors from '../../styles/colors'; export default function LabelSeats() { return( <ContainerLabel> <div> <input type='button' className='green' /> <label>Selecionado</label> </div> <div> <input type='button' className='gray' /> <label>Disponível</label> </div> <div> <input type='button'className='yelow' /> <label>Indisponível</label> </div> </ContainerLabel> ) }; const ContainerLabel = styled.div` display: flex; flex-direction: column; margin: 20px 0; width: 100%; padding: 0 10px; div{ margin-bottom: 10px; display: flex; justify-content: flex-start; align-items: center; font-family: ${fonts.familyRoboto}; font-size: 18px; font-weight: 400; } input{ width: 25px; height: 25px; border-radius: 10px; flex-shrink: 0; margin-right: 10px; border: 1px solid; } .green{ background-color: ${colors.greenSweet}; border-color: ${colors.greenStrong}; } .yelow{ background-color: ${colors.yelowSweet}; border-color: ${colors.yelowStrong}; } .gray{ background-color: ${colors.graySweet}; border-color: ${colors.grayStrong}; } `;
import { ServerService } from '../ServerService.js'; import { RoomConnectionService } from '../RoomConnectionService.js'; import { WelcomeRoomService } from './rooms/WelcomeRoomService.js'; import { ClientRoomService } from './rooms/ClientRoomService.js'; import { ClientCommand } from '../ClientCommand.js'; export class ChildServerService extends ServerService { constructor(name) { super(name); this.parentServerService = null; //set by parentServerService } commandHandler_enter() { const welcomeRoomName = "child_welcome_room"; const roomId = this.parentServerService.getChildServerWelcomeRoomId(welcomeRoomName); const welcomeRoomConnectionConfig = { roomPort: 2567, roomName: welcomeRoomName, roomId: roomId, passphrase : "i_have_token_a_shower__portal", }; RoomConnectionService.joinPrivateRoom_p(welcomeRoomConnectionConfig) .then(room => { console.log(this.constructor.name, "welcome_room:", room); this.welcomeRoomService = new WelcomeRoomService(room); this.observed_welcomed.notifyObservers(); // this.notifyNewRoom(); //listen to next room message return RoomConnectionService.nextMessage_p(room); }) .then(([room, message]) => { console.log("message", message); const command = message.command; if(command == "two_step") { const parentServerService = this.parentServerService; const singleUseCommand = message.payload.command; const clientCommand = new ClientCommand(parentServerService.connectToChildServerCommandName(), { // childServerService : this, singleUseCommand : singleUseCommand }); return parentServerService.do_p(clientCommand); } else { console.log("OHHHHHHHHHHHHHHHHHHHH"); throw new Error("two_step message was expected but received:", message); } }) .then(clientRoomConnectionConfig => { console.log("yoyoyoyoyoyo", clientRoomConnectionConfig); this.connect(clientRoomConnectionConfig); }); } }
/* global APP, $, config */ /* jshint -W101 */ import JitsiPopover from "../util/JitsiPopover"; import VideoLayout from "./VideoLayout"; /** * Constructs new connection indicator. * @param videoContainer the video container associated with the indicator. * @constructor */ function ConnectionIndicator(videoContainer, id) { this.videoContainer = videoContainer; this.bandwidth = null; this.packetLoss = null; this.bitrate = null; this.showMoreValue = false; this.resolution = null; this.isResolutionHD = null; this.transport = []; this.popover = null; this.id = id; this.create(); } /** * Values for the connection quality * @type {{98: string, * 81: string, * 64: string, * 47: string, * 30: string, * 0: string}} */ ConnectionIndicator.connectionQualityValues = { 98: "18px", //full 81: "15px",//4 bars 64: "11px",//3 bars 47: "7px",//2 bars 30: "3px",//1 bar 0: "0px"//empty }; ConnectionIndicator.getIP = function(value) { return value.substring(0, value.lastIndexOf(":")); }; ConnectionIndicator.getPort = function(value) { return value.substring(value.lastIndexOf(":") + 1, value.length); }; ConnectionIndicator.getStringFromArray = function (array) { var res = ""; for(var i = 0; i < array.length; i++) { res += (i === 0? "" : ", ") + array[i]; } return res; }; /** * Generates the html content. * @returns {string} the html content. */ ConnectionIndicator.prototype.generateText = function () { var downloadBitrate, uploadBitrate, packetLoss, i; var translate = APP.translation.translateString; if(this.bitrate === null) { downloadBitrate = "N/A"; uploadBitrate = "N/A"; } else { downloadBitrate = this.bitrate.download? this.bitrate.download + " Kbps" : "N/A"; uploadBitrate = this.bitrate.upload? this.bitrate.upload + " Kbps" : "N/A"; } if(this.packetLoss === null) { packetLoss = "N/A"; } else { packetLoss = "<span class='jitsipopover_green'>&darr;</span>" + (this.packetLoss.download !== null ? this.packetLoss.download : "N/A") + "% <span class='jitsipopover_orange'>&uarr;</span>" + (this.packetLoss.upload !== null? this.packetLoss.upload : "N/A") + "%"; } // GENERATE RESOLUTIONS STRING let resolutions = this.resolution || {}; let resolutionStr = Object.keys(resolutions).map(function (ssrc) { let {width, height} = resolutions[ssrc]; return `${width}x${height}`; }).join(', ') || 'N/A'; var result = "<table style='width:100%'>" + "<tr>" + "<td><span class='jitsipopover_blue' data-i18n='connectionindicator.bitrate'>" + translate("connectionindicator.bitrate") + "</span></td>" + "<td><span class='jitsipopover_green'>&darr;</span>" + downloadBitrate + " <span class='jitsipopover_orange'>&uarr;</span>" + uploadBitrate + "</td>" + "</tr><tr>" + "<td><span class='jitsipopover_blue' data-i18n='connectionindicator.packetloss'>" + translate("connectionindicator.packetloss") + "</span></td>" + "<td>" + packetLoss + "</td>" + "</tr><tr>" + "<td><span class='jitsipopover_blue' data-i18n='connectionindicator.resolution'>" + translate("connectionindicator.resolution") + "</span></td>" + "<td>" + resolutionStr + "</td></tr></table>"; if(this.videoContainer.videoSpanId == "localVideoContainer") { result += "<div class=\"jitsipopover_showmore\" " + "onclick = \"APP.UI.connectionIndicatorShowMore('" + // FIXME: we do not know local id when this text is generated //this.id + "')\" data-i18n='connectionindicator." + "local')\" data-i18n='connectionindicator." + (this.showMoreValue ? "less" : "more") + "'>" + translate("connectionindicator." + (this.showMoreValue ? "less" : "more")) + "</div><br />"; } if (this.showMoreValue) { var downloadBandwidth, uploadBandwidth, transport; if (this.bandwidth === null) { downloadBandwidth = "N/A"; uploadBandwidth = "N/A"; } else { downloadBandwidth = this.bandwidth.download? this.bandwidth.download + " Kbps" : "N/A"; uploadBandwidth = this.bandwidth.upload? this.bandwidth.upload + " Kbps" : "N/A"; } if (!this.transport || this.transport.length === 0) { transport = "<tr>" + "<td><span class='jitsipopover_blue' " + "data-i18n='connectionindicator.address'>" + translate("connectionindicator.address") + "</span></td>" + "<td> N/A</td></tr>"; } else { var data = {remoteIP: [], localIP:[], remotePort:[], localPort:[]}; for(i = 0; i < this.transport.length; i++) { var ip = ConnectionIndicator.getIP(this.transport[i].ip); var port = ConnectionIndicator.getPort(this.transport[i].ip); var localIP = ConnectionIndicator.getIP(this.transport[i].localip); var localPort = ConnectionIndicator.getPort(this.transport[i].localip); if(data.remoteIP.indexOf(ip) == -1) { data.remoteIP.push(ip); } if(data.remotePort.indexOf(port) == -1) { data.remotePort.push(port); } if(data.localIP.indexOf(localIP) == -1) { data.localIP.push(localIP); } if(data.localPort.indexOf(localPort) == -1) { data.localPort.push(localPort); } } var local_address_key = "connectionindicator.localaddress"; var remote_address_key = "connectionindicator.remoteaddress"; var localTransport = "<tr><td><span class='jitsipopover_blue' data-i18n='" + local_address_key +"' data-i18n-options='" + JSON.stringify({count: data.localIP.length}) + "'>" + translate(local_address_key, {count: data.localIP.length}) + "</span></td><td> " + ConnectionIndicator.getStringFromArray(data.localIP) + "</td></tr>"; transport = "<tr><td><span class='jitsipopover_blue' data-i18n='" + remote_address_key + "' data-i18n-options='" + JSON.stringify({count: data.remoteIP.length}) + "'>" + translate(remote_address_key, {count: data.remoteIP.length}) + "</span></td><td> " + ConnectionIndicator.getStringFromArray(data.remoteIP) + "</td></tr>"; var key_remote = "connectionindicator.remoteport", key_local = "connectionindicator.localport"; transport += "<tr>" + "<td>" + "<span class='jitsipopover_blue' data-i18n='" + key_remote + "' data-i18n-options='" + JSON.stringify({count: this.transport.length}) + "'>" + translate(key_remote, {count: this.transport.length}) + "</span></td><td>"; localTransport += "<tr>" + "<td>" + "<span class='jitsipopover_blue' data-i18n='" + key_local + "' data-i18n-options='" + JSON.stringify({count: this.transport.length}) + "'>" + translate(key_local, {count: this.transport.length}) + "</span></td><td>"; transport += ConnectionIndicator.getStringFromArray(data.remotePort); localTransport += ConnectionIndicator.getStringFromArray(data.localPort); transport += "</td></tr>"; transport += localTransport + "</td></tr>"; transport +="<tr>" + "<td><span class='jitsipopover_blue' data-i18n='connectionindicator.transport'>" + translate("connectionindicator.transport") + "</span></td>" + "<td>" + this.transport[0].type + "</td></tr>"; } result += "<table style='width:100%'>" + "<tr>" + "<td>" + "<span class='jitsipopover_blue' data-i18n='connectionindicator.bandwidth'>" + translate("connectionindicator.bandwidth") + "</span>" + "</td><td>" + "<span class='jitsipopover_green'>&darr;</span>" + downloadBandwidth + " <span class='jitsipopover_orange'>&uarr;</span>" + uploadBandwidth + "</td></tr>"; result += transport + "</table>"; } return result; }; /** * Shows or hide the additional information. */ ConnectionIndicator.prototype.showMore = function () { this.showMoreValue = !this.showMoreValue; this.updatePopoverData(); }; function createIcon(classes, iconClass) { var icon = document.createElement("span"); for(var i in classes) { icon.classList.add(classes[i]); } icon.appendChild( document.createElement("i")).classList.add(iconClass); return icon; } /** * Creates the indicator */ ConnectionIndicator.prototype.create = function () { this.connectionIndicatorContainer = document.createElement("div"); this.connectionIndicatorContainer.className = "connectionindicator"; this.connectionIndicatorContainer.style.display = "none"; this.videoContainer.container.appendChild( this.connectionIndicatorContainer); this.popover = new JitsiPopover( $("#" + this.videoContainer.videoSpanId + " > .connectionindicator"), {content: "<div class=\"connection_info\" data-i18n='connectionindicator.na'>" + APP.translation.translateString("connectionindicator.na") + "</div>", skin: "black"}); // override popover show method to make sure we will update the content // before showing the popover var origShowFunc = this.popover.show; this.popover.show = function () { // update content by forcing it, to finish even if popover // is not visible this.updatePopoverData(true); // call the original show, passing its actual this origShowFunc.call(this.popover); }.bind(this); this.emptyIcon = this.connectionIndicatorContainer.appendChild( createIcon(["connection", "connection_empty"], "icon-connection")); this.fullIcon = this.connectionIndicatorContainer.appendChild( createIcon(["connection", "connection_full"], "icon-connection")); this.interruptedIndicator = this.connectionIndicatorContainer.appendChild( createIcon(["connection", "connection_lost"],"icon-connection-lost")); $(this.interruptedIndicator).hide(); }; /** * Removes the indicator */ ConnectionIndicator.prototype.remove = function() { if (this.connectionIndicatorContainer.parentNode) { this.connectionIndicatorContainer.parentNode.removeChild( this.connectionIndicatorContainer); } this.popover.forceHide(); }; /** * Updates the UI which displays warning about user's connectivity problems. * * @param {boolean} isActive true if the connection is working fine or false if * the user is having connectivity issues. */ ConnectionIndicator.prototype.updateConnectionStatusIndicator = function (isActive) { this.isConnectionActive = isActive; if (this.isConnectionActive) { $(this.interruptedIndicator).hide(); $(this.emptyIcon).show(); $(this.fullIcon).show(); } else { $(this.interruptedIndicator).show(); $(this.emptyIcon).hide(); $(this.fullIcon).hide(); this.updateConnectionQuality(0 /* zero bars */); } }; /** * Updates the data of the indicator * @param percent the percent of connection quality * @param object the statistics data. */ ConnectionIndicator.prototype.updateConnectionQuality = function (percent, object) { if (percent === null) { this.connectionIndicatorContainer.style.display = "none"; this.popover.forceHide(); return; } else { if(this.connectionIndicatorContainer.style.display == "none") { this.connectionIndicatorContainer.style.display = "block"; } } if (object) { this.bandwidth = object.bandwidth; this.bitrate = object.bitrate; this.packetLoss = object.packetLoss; this.transport = object.transport; if (object.resolution) { this.resolution = object.resolution; } } for (var quality in ConnectionIndicator.connectionQualityValues) { if (percent >= quality) { this.fullIcon.style.width = ConnectionIndicator.connectionQualityValues[quality]; } } if (object && typeof object.isResolutionHD === 'boolean') { this.isResolutionHD = object.isResolutionHD; } this.updateResolutionIndicator(); this.updatePopoverData(); }; /** * Updates the resolution * @param resolution the new resolution */ ConnectionIndicator.prototype.updateResolution = function (resolution) { this.resolution = resolution; this.updateResolutionIndicator(); this.updatePopoverData(); }; /** * Updates the content of the popover if its visible * @param force to work even if popover is not visible */ ConnectionIndicator.prototype.updatePopoverData = function (force) { // generate content, translate it and add it to document only if // popover is visible or we force to do so. if(this.popover.popoverShown || force) { this.popover.updateContent( `<div class="connection_info">${this.generateText()}</div>` ); APP.translation.translateElement($(".connection_info")); } }; /** * Hides the popover */ ConnectionIndicator.prototype.hide = function () { this.popover.forceHide(); }; /** * Hides the indicator */ ConnectionIndicator.prototype.hideIndicator = function () { this.connectionIndicatorContainer.style.display = "none"; if(this.popover) this.popover.forceHide(); }; /** * Updates the resolution indicator. */ ConnectionIndicator.prototype.updateResolutionIndicator = function () { if (this.id !== null && VideoLayout.isCurrentlyOnLarge(this.id)) { let showResolutionLabel = false; if (this.isResolutionHD !== null) showResolutionLabel = this.isResolutionHD; else if (this.resolution !== null) { let resolutions = this.resolution || {}; Object.keys(resolutions).map(function (ssrc) { const { height } = resolutions[ssrc]; if (height >= config.minHDHeight) showResolutionLabel = true; }); } VideoLayout.updateResolutionLabel(showResolutionLabel); } }; export default ConnectionIndicator;
ngDescribe({ name: 'Test estado-add component', modules: 'app', element: '<estado-add></estado-add>', tests: function (deps) { it('basic test', () => { // }); } });
import init, { run_app } from './klopodavka_yew'; async function main() { await init('./klopodavka_yew_bg.wasm'); run_app(); } main();
'use strict'; var Constants = {}; Constants.SCRIPT_TYPES = { P2SH: 'P2SH', P2PKH: 'P2PKH', }; // not used, since Credentials 2.0 Constants.DERIVATION_STRATEGIES = { BIP44: 'BIP44', BIP45: 'BIP45', BIP48: 'BIP48', }; Constants.PATHS = { REQUEST_KEY: "m/1'/0", // TXPROPOSAL_KEY: "m/1'/1", REQUEST_KEY_AUTH: "m/2", // relative to BASE }; Constants.BIP45_SHARED_INDEX = 0x80000000 - 1; Constants.UNITS = { btc: { toSatoshis: 100000000, full: { maxDecimals: 8, minDecimals: 8, }, short: { maxDecimals: 6, minDecimals: 2, } }, bit: { toSatoshis: 100, full: { maxDecimals: 2, minDecimals: 2, }, short: { maxDecimals: 0, minDecimals: 0, } }, }; Constants.COINS = [ 'btc', 'bch']; module.exports = Constants;
/* * Translated default messages for the jQuery validation plugin. * Language: HU * Skipped dateISO/DE, numberDE */ jQuery.extend(jQuery.validator.messages, { required: "Kötelező megadni.", maxlength: jQuery.format("Legfeljebb {0} karakter hosszú legyen."), minlength: jQuery.format("Legalább {0} karakter hosszú legyen."), rangelength: jQuery.format("Legalább {0} és legfeljebb {1} karakter hosszú legyen."), email: "Érvényes e-mail címnek kell lennie.", url: "Érvényes URL-nek kell lennie.", date: "Dátumnak kell lennie.", number: "Számnak kell lennie.", digits: "Csak számjegyek lehetnek.", equalTo: "Meg kell egyeznie a két értéknek.", range: jQuery.format("{0} és {1} közé kell esnie."), max: jQuery.format("Nem lehet nagyobb, mint {0}."), min: jQuery.format("Nem lehet kisebb, mint {0}."), creditcard: "Érvényes hitelkártyaszámnak kell lennie." });
angular.module('helpNow').factory('ResourceRequest', function ($resource) { return $resource('api/resourcerequest/:id', null ,{ update: { method: 'PUT' } }); });
(function () { var Sprite = Laya.Sprite; var Stage = Laya.Stage; var Event = Laya.Event; var Keyboard = Laya.Keyboard; var TimeLine = Laya.TimeLine; var WebGL = Laya.WebGL; var target; var timeLine = new TimeLine(); (function () { // 不支持WebGL时自动切换至Canvas Laya.init(550, 400, WebGL); Laya.stage.alignV = Stage.ALIGN_MIDDLE; Laya.stage.alignH = Stage.ALIGN_CENTER; Laya.stage.scaleMode = Stage.SCALE_SHOWALL; Laya.stage.bgColor = "#232628"; setup(); })(); function setup() { createApe(); createTimerLine(); Laya.stage.on( Event.KEY_DOWN, this, this.keyDown); } function createApe() { target = new Sprite(); target.loadImage("../../../../res/apes/monkey2.png"); Laya.stage.addChild(target); target.pivot(55, 72); target.pos(100,100); } function createTimerLine() { timeLine.addLabel("turnRight",0).to(target,{x:450, y:100, scaleX:0.5, scaleY:0.5},2000,null,0) .addLabel("turnDown",0).to(target,{x:450, y:300, scaleX:0.2, scaleY:1, alpha:1},2000,null,0) .addLabel("turnLeft",0).to(target,{x:100, y:300, scaleX:1, scaleY:0.2, alpha:0.1},2000,null,0) .addLabel("turnUp",0).to(target,{x:100, y:100, scaleX:1, scaleY:1, alpha:1},2000,null,0); timeLine.play(0,true); timeLine.on(Event.COMPLETE,this,this.onComplete); timeLine.on(Event.LABEL, this, this.onLabel); } function onComplete() { console.log("timeLine complete!!!!"); } function onLabel(label) { console.log("LabelName:" + label); } function keyDown(e) { switch(e.keyCode) { case Keyboard.LEFT: timeLine.play("turnLeft"); break; case Keyboard.RIGHT: timeLine.play("turnRight"); break; case Keyboard.UP: timeLine.play("turnUp"); break; case Keyboard.DOWN: timeLine.play("turnDown"); break; case Keyboard.P: timeLine.pause(); break; case Keyboard.R: timeLine.resume(); break; } } })();
browser.topSites.get() .then((sites) => { var div = document.getElementById('site-list'); if (!sites.length) { div.innerText = 'No sites returned from the topSites API.'; return; } let ul = document.createElement('ul'); ul.className = 'list-group'; for (let site of sites) { let li = document.createElement('li'); li.className = 'list-group-item'; let a = document.createElement('a'); a.href = site.url; a.innerText = site.title || site.url; li.appendChild(a); ul.appendChild(li); } div.appendChild(ul); });
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const React = require("react"); const wrapIcon_1 = require("../utils/wrapIcon"); const rawSvg = (iconProps) => { const { className, primaryFill } = iconProps; return React.createElement("svg", { width: 24, height: 24, viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", className: className }, React.createElement("path", { d: "M5.25 3.5c-.97 0-1.75.78-1.75 1.75v3a.75.75 0 01-1.5 0v-3C2 3.45 3.46 2 5.25 2h3a.75.75 0 010 1.5h-3zm0 17c-.97 0-1.75-.78-1.75-1.75v-3a.75.75 0 00-1.5 0v3C2 20.55 3.46 22 5.25 22h3a.75.75 0 000-1.5h-3zM20.5 5.25c0-.97-.78-1.75-1.75-1.75h-3a.75.75 0 010-1.5h3C20.55 2 22 3.46 22 5.25v3a.75.75 0 01-1.5 0v-3zM18.75 20.5c.97 0 1.75-.78 1.75-1.75v-3a.75.75 0 011.5 0v3c0 1.8-1.46 3.25-3.25 3.25h-3a.75.75 0 010-1.5h3zM7.75 6a.75.75 0 00-.75.75V8a.75.75 0 001.5 0v-.5h2.75v9h-1.5a.75.75 0 000 1.5h4.5a.75.75 0 000-1.5h-1.5v-9h2.75V8A.75.75 0 0017 8V6.75a.75.75 0 00-.75-.75h-8.5z", fill: primaryFill })); }; const ScanType24Regular = wrapIcon_1.default(rawSvg({}), 'ScanType24Regular'); exports.default = ScanType24Regular;
/** * This module contains code for converting to and from the Textgrid * datastructure. Textgrid files are typically stored as plain text. * This library does not do actual file IO but instead converts * to and from loaded strings to instances of Textgrid. * * @author Tim Mahrt * @since March 25, 2015 * @module textgrid_io */ import iconvlite from 'iconv-lite'; import { Textgrid, IntervalTier, PointTier, copyTier, POINT_TIER, INTERVAL_TIER, MIN_INTERVAL_LENGTH } from './textgrid.js'; import { cropTextgrid } from './textgrid_modifiers.js'; /** * Python-like split from * http://stackoverflow.com/questions/6131195/javascript-splitting-string-from-the-first-comma * @param {string} str * @param {string} separator - the separator to split on * @param {number} max - the max number of times to split * @return {Array} * @ignore */ function extendedSplit (str, separator, max) { const out = []; let index = 0; let next; if (max) { while (out.length < max - 1) { next = str.indexOf(separator, index); if (next === -1) { break; } out.push(str.substring(index, next)); index = next + separator.length; } } out.push(str.substring(index)); return out; } function findAllSubstrings (sourceStr, subStr) { const indexList = []; let index = sourceStr.indexOf(subStr); while (index !== -1) { indexList.push(index); index += 1; index = sourceStr.indexOf(subStr, index); } return indexList; } function fetchRow (dataStr, searchStr, index) { const startIndex = dataStr.indexOf(searchStr, index) + searchStr.length; let endIndex = dataStr.indexOf('\n', startIndex); let word = dataStr.substring(startIndex, endIndex); word = word.trim(); if (word[0] === '"' && word[word.length - 1] === '"') { word = word.substring(1, word.length - 1); } word = word.trim(); // Increment the index by 1, unless nothing was found if (endIndex !== -1) endIndex += 1; return [word, endIndex]; } function parseNormalTextgrid (data) { // Toss header const tierList = data.split('item ['); const textgridHeader = tierList.shift(); const tgMin = parseFloat(textgridHeader.split('xmin = ', 2)[1].split('\n', 1)[0].trim()); const tgMax = parseFloat(textgridHeader.split('xmax = ', 2)[1].split('\n', 1)[0].trim()); // Process each tier individually // tierList = data.split('item'); // tierList = tierList[1,tierList.length]; let tierTxt = ''; tierList.shift(); // Removing the document root empty item const textgrid = new Textgrid(); textgrid.minTimestamp = tgMin; textgrid.maxTimestamp = tgMax; for (let i = 0; i < tierList.length; i++) { tierTxt = tierList[i]; // Get tier type let tierType = POINT_TIER; let searchWord = 'points'; if (tierTxt.indexOf('class = "IntervalTier"') > -1) { tierType = INTERVAL_TIER; searchWord = 'intervals'; } // Get tier meta-information const tmpArray = extendedSplit(tierTxt, searchWord + ':', 2); const header = tmpArray[0]; const tierData = tmpArray[1]; let tierName = header.split('name = ', 2)[1].split('\n', 1)[0].trim(); tierName = tierName.slice(1, tierName.length - 1); // remove quotes const tierStart = header.split('xmin = ', 2)[1].split('\n', 1)[0].trim(); const tierEnd = header.split('xmax = ', 2)[1].split('\n', 1)[0].trim(); // Get the tier entry list const entryList = []; let labelI = 0; let label = null; let tier = null; if (tierType === INTERVAL_TIER) { let timeStartI = null; let timeEndI = null; let timeStart = null; let timeEnd = null; while (true) { [timeStart, timeStartI] = fetchRow(tierData, 'xmin = ', labelI); // Break condition here. indexof loops around at the end of a file if (timeStartI <= labelI) break; [timeEnd, timeEndI] = fetchRow(tierData, 'xmax = ', timeStartI); [label, labelI] = fetchRow(tierData, 'text =', timeEndI); label = label.trim(); entryList.push([parseFloat(timeStart), parseFloat(timeEnd), label]); } tier = new IntervalTier(tierName, entryList, tierStart, tierEnd); } else { let timePointI = null; let timePoint = null; while (true) { [timePoint, timePointI] = fetchRow(tierData, 'number = ', labelI); // Break condition here. indexof loops around at the end of a file if (timePointI <= labelI) break; [label, labelI] = fetchRow(tierData, 'mark =', timePointI); label = label.trim(); entryList.push([parseFloat(timePoint), label]); } tier = new PointTier(tierName, entryList, tierStart, tierEnd); } textgrid.addTier(tier); } return textgrid; } function parseShortTextgrid (data) { const indexList = []; const intervalIndicies = findAllSubstrings(data, '"IntervalTier"'); for (let i = 0; i < intervalIndicies.length; i++) { indexList.push([intervalIndicies[i], true]); } const pointIndicies = findAllSubstrings(data, '"TextTier"'); for (let i = 0; i < pointIndicies.length; i++) { indexList.push([pointIndicies[i], false]); } indexList.push([data.length, null]); // The 'end' of the file indexList.sort(function (x, y) { return x[0] - y[0]; }); const tupleList = []; for (let i = 0; i < indexList.length - 1; i++) { tupleList.push([indexList[i][0], indexList[i + 1][0], indexList[i][1]]); } // Set the textgrid's min and max times const header = data.slice(0, tupleList[0][0]); const headerList = header.split('\n'); const tgMin = parseFloat(headerList[3]); const tgMax = parseFloat(headerList[4]); // Add the textgrid tiers const textgrid = new Textgrid(); textgrid.minTimestamp = tgMin; textgrid.maxTimestamp = tgMax; for (let i = 0; i < tupleList.length; i++) { let tier = null; const blockStartI = tupleList[i][0]; const blockEndI = tupleList[i][1]; const isInterval = tupleList[i][2]; const tierData = data.slice(blockStartI, blockEndI); const metaStartI = fetchRow(tierData, '', 0)[1]; // Tier meta-information const [tierName, tierNameEndI] = fetchRow(tierData, '', metaStartI); let [tierStartTime, tierStartTimeI] = fetchRow(tierData, '', tierNameEndI); let [tierEndTime, tierEndTimeI] = fetchRow(tierData, '', tierStartTimeI); let startTimeI = fetchRow(tierData, '', tierEndTimeI)[1]; tierStartTime = parseFloat(tierStartTime); tierEndTime = parseFloat(tierEndTime); // Tier entry data let startTime = null; let endTime = null; let label = null; // let tierType = null; let endTimeI = null; let labelI = null; const entryList = []; if (isInterval === true) { while (true) { [startTime, endTimeI] = fetchRow(tierData, '', startTimeI); if (endTimeI === -1) break; [endTime, labelI] = fetchRow(tierData, '', endTimeI); [label, startTimeI] = fetchRow(tierData, '', labelI); label = label.trim(); entryList.push([startTime, endTime, label]); } tier = new IntervalTier(tierName, entryList, tierStartTime, tierEndTime); } else { while (true) { [startTime, labelI] = fetchRow(tierData, '', startTimeI); if (labelI === -1) break; [label, startTimeI] = fetchRow(tierData, '', labelI); label = label.trim(); entryList.push([startTime, label]); } tier = new PointTier(tierName, entryList, tierStartTime, tierEndTime); } textgrid.addTier(tier); } return textgrid; } /** * Fills in the space between intervals with empty space. * This is necessary to do when saving to create a well-formed textgrid. * @ignore */ function fillInBlanks (tier, blankLabel = '', startTime = null, endTime = null) { if (startTime === null) startTime = tier.minTimestamp; if (endTime === null) endTime = tier.maxTimestamp; // Special case: empty textgrid if (tier.entryList.length === 0) tier.entryList.push([startTime, endTime, blankLabel]); // Create a new entry list const entryList = tier.entryList.slice(); const entry = entryList[0]; let prevEnd = parseFloat(entry[1]); const newEntryList = [entry]; for (let i = 1; i < entryList.length; i++) { const newStart = parseFloat(entryList[i][0]); const newEnd = parseFloat(entryList[i][1]); if (prevEnd < newStart) newEntryList.push([prevEnd, newStart, blankLabel]); newEntryList.push(entryList[i]); prevEnd = newEnd; } // Special case: If there is a gap at the start of the file if (parseFloat(newEntryList[0][0]) < parseFloat(startTime)) { throw new Error('Tier data is before the tier start time.'); } if (parseFloat(newEntryList[0][0]) > parseFloat(startTime)) { newEntryList.splice(0, 0, [startTime, newEntryList[0][0], blankLabel]); } // Special case: If there is a gap at the end of the file if (endTime !== null) { const lastI = newEntryList.length - 1 if (parseFloat(newEntryList[lastI][1]) > parseFloat(endTime)) { throw new Error('Tier data is after the tier end time.'); } if (parseFloat(newEntryList[lastI][1]) < parseFloat(endTime)) { newEntryList.push([newEntryList[lastI][1], endTime, blankLabel]); } } return copyTier(tier, { entryList: newEntryList }); } /** * Prints each entry in the tier on a separate line w/ timing info * @ignore */ function tierToText (tier) { let text = '' text += `"${tier.tierType}"\n`; text += `"${tier.name}"\n`; text += `${tier.minTimestamp}\n${tier.maxTimestamp}\n`; text += `${tier.entryList.length}\n`; for (let i = 0; i < tier.entryList.length; i++) { let entry = tier.entryList[i]; entry = entry.map(val => `${val}`); let labelI; if (tier.tierType === POINT_TIER) { labelI = 1; } else if (tier.tierType === INTERVAL_TIER) { labelI = 2; } entry[labelI] = `"${entry[labelI]}"` text += entry.join('\n') + '\n'; } return text } /** * Remove intervals that are very tiny * Doing many small manipulations on intervals can lead to the creation * of ultrashort intervals (e.g. 1*10^-15 seconds long). This function * removes such intervals. * @ignore */ function removeUltrashortIntervals (tier, minLength, minTimestamp) { // First, remove tiny intervals const newEntryList = []; let j = 0; for (let i = 0; i < tier.entryList.length; i++) { const [start, stop, label] = tier.entryList[i]; if (stop - start < minLength) { // Correct ultra-short entries if (newEntryList.length > 0) { newEntryList[j - 1] = (newEntryList[j - 1], stop, newEntryList[j - 1]); } } else { // Special case: the first entry in oldEntryList was ultra-short if (newEntryList.length === 0 && start !== minTimestamp) { newEntryList.push([minTimestamp, stop, label]); } else { // Normal case newEntryList.push([start, stop, label]); } j += 1; } } // Next, shift near equivalent tiny boundaries j = 0; while (j < newEntryList.length - 1) { const diff = Math.abs(newEntryList[j][1] - newEntryList[j + 1][0]); if (diff > 0 && diff < minLength) { newEntryList[j] = [newEntryList[j][0], newEntryList[j + 1][0], newEntryList[j][2]]; } j += 1; } return copyTier(tier, { entryList: newEntryList }); } /** * Formats a textgrid instance for saving to a .csv file * @param {Textgrid} tg * @param {string} pivotTierName - One row in the output is listed for each entry in this tier. * The corresponding entry in each tier will be provided on the same row * along with the start and end time of the entry from the pivot tier. * @param {Array} [tierNameList=null] - the list of tier names to save. If null, save all tiers. * @return {text} */ function serializeTextgridToCsv (tg, pivotTierName, tierNameList = null, includeHeader = true) { if (!tierNameList) tierNameList = tg.tierNameList; let table = []; if (includeHeader === true) { const colHeader = tierNameList.slice(); colHeader.push('Start Time'); colHeader.push('End Time'); table.push(colHeader); } const tier = tg.tierDict[pivotTierName]; for (let i = 0; i < tier.entryList.length; i++) { const start = tier.entryList[i][0]; const stop = tier.entryList[i][1]; // let label = tier.entryList[i][2]; const subTG = cropTextgrid(tg, start, stop, 'truncated', false); const row = []; for (let j = 0; j < tierNameList.length; j++) { let subLabel = ''; if (subTG.tierNameList.includes(tierNameList[j])) { const subTier = subTG.tierDict[tierNameList[j]]; if (subTier.entryList.length > 0) { subLabel = subTier.entryList[0][2]; } } row.push(subLabel); } row.push(start); row.push(stop); table.push(row); } table = table.map(row => row.join(',')); const csv = table.join('\n'); return csv; } /** * Formats a textgrid instance for saving to a .TextGrid file. * @param {Textgrid} tg * @param {number} [minimumIntervalLength=MIN_INTERVAL_LENGTH] - remove all intervals shorter than this; if null, don't remove any intervals * @param {number} [minTimestamp = null] -- the minTimestamp of the saved Textgrid; if None, use whatever is defined in the Textgrid object. If minTimestamp is larger than timestamps in your textgrid, an exception will be thrown. * @param {number} [maxTimestamp = null] -- the maxTimestamp of the saved Textgrid; if None, use whatever is defined in the Textgrid object. If maxTimestamp is larger than timestamps in your textgrid, an exception will be thrown. * @param {boolean} [useShortForm = true] -- specifies whether to use the short or long form specification of a textgrid; the long form is more human readable, the short form is more compact * @return A text representation of a textgrid that can be opened by Praat */ function serializeTextgrid (tg, minimumIntervalLength = MIN_INTERVAL_LENGTH, minTimestamp = null, maxTimestamp = null, useShortForm = true) { if (minTimestamp === null) minTimestamp = tg.minTimestamp; if (maxTimestamp === null) maxTimestamp = tg.maxTimestamp; const outputTg = prepTgForSaving(tg, minimumIntervalLength, minTimestamp, maxTimestamp); let outputTxt = ''; if (useShortForm) { outputTxt = tgToShortTextForm(outputTg, minTimestamp, maxTimestamp); } else { outputTxt = tgToLongTextForm(outputTg, minTimestamp, maxTimestamp); } return outputTxt; } function tgToShortTextForm (tg, minTimestamp, maxTimestamp) { let outputTxt = ''; outputTxt += 'File type = "ooTextFile"\n'; outputTxt += 'Object class = "TextGrid"\n\n'; outputTxt += `${minTimestamp}\n${maxTimestamp}\n`; outputTxt += `<exists>\n${tg.tierNameList.length}\n`; for (let i = 0; i < tg.tierNameList.length; i++) { outputTxt += tierToText(tg.tierDict[tg.tierNameList[i]]); } return outputTxt; } function tgToLongTextForm (tg, minTimestamp, maxTimestamp) { const tab = ' '.repeat(4); let outputTxt = ''; // File header outputTxt += 'File type = "ooTextFile"\n'; outputTxt += 'Object class = "TextGrid"\n\n'; outputTxt += `xmin = ${minTimestamp} \n` outputTxt += `xmax = ${maxTimestamp} \n` outputTxt += 'tiers? <exists> \n' outputTxt += `size = ${tg.tierNameList.length} \n` outputTxt += 'item []: \n' for (let i = 0; i < tg.tierNameList.length; i++) { const tierName = tg.tierNameList[i]; const tier = tg.tierDict[tierName]; // Interval header outputTxt += tab + `item [${i + 1}]:\n` outputTxt += tab.repeat(2) + `class = "${tier.tierType}" \n` outputTxt += tab.repeat(2) + `name = "${tierName}" \n` outputTxt += tab.repeat(2) + `xmin = ${minTimestamp} \n` outputTxt += tab.repeat(2) + `xmax = ${maxTimestamp} \n` if (tier.tierType === INTERVAL_TIER) { outputTxt += tab.repeat(2) + `intervals: size = ${tier.entryList.length} \n` for (let j = 0; j < tier.entryList.length; j++) { const [start, stop, label] = tier.entryList[j]; outputTxt += tab.repeat(2) + `intervals [${j + 1}]:\n` outputTxt += tab.repeat(3) + `xmin = ${start} \n` outputTxt += tab.repeat(3) + `xmax = ${stop} \n` outputTxt += tab.repeat(3) + `text = "${label}" \n` } } else { outputTxt += tab.repeat(2) + `points: size = ${tier.entryList.length} \n` for (let j = 0; j < tier.entryList.length; j++) { const [timestamp, label] = tier.entryList[j]; outputTxt += tab.repeat(2) + `points [${j + 1}]:\n` outputTxt += tab.repeat(3) + `number = ${timestamp} \n` outputTxt += tab.repeat(3) + `mark = "${label}" \n` } } } return outputTxt; } /** * Processing done before every textgrid is saved (serializeTextgrid calls this function) -- gaps are filled with silence and short intervals can be removed * @param {Textgrid} tg * @param {number} [minimumIntervalLength=MIN_INTERVAL_LENGTH] - remove all intervals shorter than this; if null, don't remove any intervals * @param {number} [minTimestamp = null] -- the minTimestamp of the saved Textgrid; if None, use whatever is defined in the Textgrid object. If minTimestamp is larger than timestamps in your textgrid, an exception will be thrown. * @param {number} [maxTimestamp = null] -- the maxTimestamp of the saved Textgrid; if None, use whatever is defined in the Textgrid object. If maxTimestamp is larger than timestamps in your textgrid, an exception will be thrown. * @return A cleaned TextGrid */ function prepTgForSaving (tg, minimumIntervalLength = MIN_INTERVAL_LENGTH, minTimestamp = null, maxTimestamp = null) { if (minTimestamp === null) minTimestamp = tg.minTimestamp; if (maxTimestamp === null) maxTimestamp = tg.maxTimestamp; for (let i = 0; i < tg.tierNameList.length; i++) { tg.tierDict[tg.tierNameList[i]].sort(); } // Fill in the blank spaces for interval tiers for (let i = 0; i < tg.tierNameList.length; i++) { const tierName = tg.tierNameList[i]; let tier = tg.tierDict[tierName]; if (tier instanceof IntervalTier) { tier = fillInBlanks(tier, '', minTimestamp, maxTimestamp); if (minimumIntervalLength !== null) { tier = removeUltrashortIntervals(tier, minimumIntervalLength, minTimestamp); } tg.tierDict[tierName] = tier; } } for (let i = 0; i < tg.tierNameList.length; i++) { tg.tierDict[tg.tierNameList[i]].sort(); } return tg; } /** * Creates an instance of a Textgrid from the contents of a .Textgrid file. * @param {Buffer|string} text - can be either a buffer or a raw text string * @param {boolean} readRaw - default false; if true, points and intervals with an empty label '' are removed * @return {Textgrid} */ function parseTextgrid (text, readRaw = false) { text = decodeBuffer(text); text = text.replace(/\r\n/g, '\n'); let textgrid; const caseA = text.indexOf('ooTextFile short') > -1; // 'short' in header const caseB = text.indexOf('item [') === -1; // 'item' keyword not in file if (caseA || caseB) { textgrid = parseShortTextgrid(text); } else { textgrid = parseNormalTextgrid(text); } if (readRaw === false) { for (let i = 0; i < textgrid.tierNameList.length; i++) { const tierName = textgrid.tierNameList[i]; const tier = removeBlanks(textgrid.tierDict[tierName]); textgrid.replaceTier(tierName, tier); } } return textgrid; } function removeBlanks (tier) { const entryList = []; for (let i = 0; i < tier.entryList.length; i++) { const entry = tier.entryList[i]; if (entry[entry.length - 1] === '') { continue; } entryList.push(entry); } return copyTier(tier, { entryList: entryList }); } /** * Decodes a buffer from utf16/8 to text. * @param {Buffer} buffer - if not of type Buffer, it will be returned without modification. * @return {string} * @ignore */ function decodeBuffer (buffer) { let returnText = buffer if (Buffer.isBuffer(buffer)) { let decodedText = iconvlite.decode(buffer, 'utf16'); if (decodedText.indexOf('ooTextFile') === -1) { decodedText = iconvlite.decode(buffer, 'utf8'); } returnText = decodedText; } return returnText; } export { parseTextgrid, serializeTextgrid, serializeTextgridToCsv, decodeBuffer, prepTgForSaving };
import React from "react"; import PropTypes from "prop-types"; import "./slider.css"; function Slider({ name, on, handle }) { return ( <label className="slider"> <input type="checkbox" name={name} checked={on} onChange={handle} /> <span className="toggle" /> </label> ); } Slider.propTypes = { name: PropTypes.string.isRequired, on: PropTypes.bool.isRequired, handle: PropTypes.func.isRequired }; export default Slider;
import external from '../externalModules.js'; import { getToolState } from '../stateManagement/toolState.js'; import loadHandlerManager from '../stateManagement/loadHandlerManager.js'; import clip from '../util/clip.js'; // This function causes the image in the target stack to be set to the one closest // To the image in the source stack by image position export default function (synchronizer, sourceElement, targetElement) { // Ignore the case where the source and target are the same enabled element if (targetElement === sourceElement) { return; } const cornerstone = external.cornerstone; const sourceStackToolDataSource = getToolState(sourceElement, 'stack'); const sourceStackData = sourceStackToolDataSource.data[0]; const targetStackToolDataSource = getToolState(targetElement, 'stack'); const targetStackData = targetStackToolDataSource.data[0]; let newImageIdIndex = sourceStackData.currentImageIdIndex; // Clamp the index newImageIdIndex = clip(newImageIdIndex, 0, targetStackData.imageIds.length - 1); // Do nothing if the index has not changed if (newImageIdIndex === targetStackData.currentImageIdIndex) { return; } const startLoadingHandler = loadHandlerManager.getStartLoadHandler(); const endLoadingHandler = loadHandlerManager.getEndLoadHandler(); const errorLoadingHandler = loadHandlerManager.getErrorLoadingHandler(); if (startLoadingHandler) { startLoadingHandler(targetElement); } let loader; if (targetStackData.preventCache === true) { loader = cornerstone.loadImage(targetStackData.imageIds[newImageIdIndex]); } else { loader = cornerstone.loadAndCacheImage(targetStackData.imageIds[newImageIdIndex]); } loader.then(function (image) { const viewport = cornerstone.getViewport(targetElement); targetStackData.currentImageIdIndex = newImageIdIndex; synchronizer.displayImage(targetElement, image, viewport); if (endLoadingHandler) { endLoadingHandler(targetElement, image); } }, function (error) { const imageId = targetStackData.imageIds[newImageIdIndex]; if (errorLoadingHandler) { errorLoadingHandler(targetElement, imageId, error); } }); }
import React from 'react' import Layout from '../components/layout' import SEO from '../components/seo' import Hero from '../components/hero'; import Cards from '../components/cards' import Section from '../components/section' import Cells from '../components/cells'; const IndexPage = () => ( <Layout> <SEO title='Arty' keywords={[`gatsby`, `landing page`, `react`, `contentful`, `graphql`]} /> <Hero /> <Cards /> <Section /> <Cells /> </Layout> ) export default IndexPage
var Discord = require('discord.js'); var Bot = new Discord.Client(); var Helper = require('./components/helper.js'); var Queue = require('./components/queue.js'); var TrackHelper = require('./components/trackhelper.js'); var WordService = require('./components/wordservice.js'); var WeatherService = require('./components/weatherservice.js'); var commands = { 'm!video': { execute: getVideo, description: 'Получить видео с YouTube по поисковому слову' }, 'm!weather': { execute: getWeather, description: 'Получить текущую погоду для данного города, по умолчанию Стокгольм' }, 'm!roll': { execute: roll, description: 'Рулон от 1 до 100' }, 'm!help': { execute: showHelp }, 'm!words': { execute: countWordsByUser, description: 'Получить самые популярные слова для пользователя данного имени пользователя, по умолчанию используется ваше имя пользователя' }, 'm!play': { execute: doQueue, description: 'Сыграть свою песню' }, 'm!skip': { execute: voteSkip, description: 'Пропустить текущую песню' }, 'm!song': { execute: showSong, description: 'Получить текущую песню' } }; Bot.on('ready', () => { console.log("bots launching"); console.log("loading discord.js"); console.log("loading config"); console.log("loaded discord.js"); console.log("loaded config"); console.log("bots launched..."); Bot.user.setStatus('invisible'); Bot.user.setStatus('online'); Bot.user.setGame('type !help'); console.log("status seted or error!"); Bot.user.setUsername('MusicBot'); console.log("Nick seted or error!"); }); Bot.on('message', message => { WordService.registerMessage(message); if (isBotCommand(message)) { execute(message.content, message); } }); function showSong(args, message) { Queue.showSong(message); } function voteSkip(args, message) { Queue.voteSkip(message); } function doQueue(args, message) { if (args.length <= 0) { return message.reply(Helper.wrap('Сделайте сслыку музыки, например https://www.youtube.com/watch?v=ih2xubMaZWI')); } if (Queue.isFull()) { return message.reply(Helper.wrap('Список уже полный.')); } if (args.startsWith('http')) { TrackHelper.getVideoFromUrl(args).then(track => { Queue.add(track, message); }).catch(err => { message.reply(Helper.wrap(err)); }); } else { TrackHelper.getRandomTrack(args, 5).then(track => { Queue.add(track, message); }).catch(err => { message.reply(Helper.wrap(err)); }); } } function getVideo(args, message) { TrackHelper.getRandomTrack(args, 5).then(track => { message.reply(track.url); }).catch(err => { message.reply(Helper.wrap(err)); }); } function countWordsByUser(args, message) { WordService.countWordsByUser(args, message); } function getWeather(args, message) { WeatherService.getWeather(args, message); } function showHelp(args, message) { var toReturn = 'Нет команды чтобы запустить!'; if (Object.keys(commands).length > 1) { var toReturn = 'Доступные команды:\n'; for (var command in commands) { if (command != 'm!help') { data = commands[command]; toReturn += command + ': ' + data.description + getAvailableCommandAsText(data) + '\n'; } } } message.reply(Helper.wrap(toReturn)); } function getAvailableCommandAsText(command) { if (!Helper.commandIsAvailable(command)) return ' (Не доступно)'; return ''; } function roll(content, message) { message.reply(Helper.wrap('На roll ' + getRandomNumber(1, 100) + ' (1-100)')); } function isBotCommand(message) { if (message.content.startsWith('m!') && message.author.id != Bot.user.id) { return true; } return false; } function execute(content, message) { var args = content.split(" "); var command = commands[args[0]]; if (command) executeCommand(command, message, args); } function executeCommand(command, message, args) { if (!Helper.commandIsAvailable(command)) { return message.reply(Helper.wrap('Команда не доступен.')); } command.execute(getCommandArguments(args), message); } function getCommandArguments(args) { var withoutCommand = args.slice(1); return withoutCommand.join(" "); } function getRandomNumber(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } function registerService(service, affectedCommands) { service = new service(); if (affectedCommands) { affectedCommands.forEach(command => { var c = commands[command]; if (c) { if (!c.services) c.services = []; c.services.push(service); } }); } return service; } function init() { Helper.keys('apikeys', ['discord']).then(keys => { Bot.login(keys.discord); Queue = registerService(Queue, ['m!play', 'm!skip', 'm!song']); TrackHelper = registerService(TrackHelper, ['m!play', 'm!video']); WordService = registerService(WordService, ['m!words']); WeatherService = registerService(WeatherService, ['m!weather']); }).catch(console.error); } init();
export default class $JSONObject { json; object; postCallback; constructor(json, object) { this.json = json; this.object = object; } static fromJSON(json) { let object = JSON.parse(json); return new $JSONObject(json, object); } static fromObject(object) { let json = JSON.stringify(object); return new $JSONObject(json, object); } updateJson(callback) { let json = callback(this.json); this.json = json; this.object = JSON.parse(json); this.doPostCallback(); } updateObject(callback) { let object = callback(this.object); this.object = object; this.json = JSON.stringify(object); this.doPostCallback(); } doPostCallback() { if (this.postCallback) { this.postCallback(this.json, this.object); } } setPostCallback(callback) { this.postCallback = callback; } }
pbjsChunk([50],{50:function(e,r,n){n(51),e.exports=n(52)},51:function(e,r,n){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.spec=void 0;var i=n(6),t=(function(e){{if(e&&e.__esModule)return e;var r={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r.default=e,r}})(n(0));function o(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var u=r.spec={code:"a4g",isBidRequestValid:function(e){return e.params&&!!e.params.zoneId},buildRequests:function(e){var r,n="",i="",u=[],a=[],d=[];return t._each(e,(function(e){n||"string"!=typeof e.params.deliveryUrl||(n=e.params.deliveryUrl),i||(i=e.bidId),u.push(e.placementCode),a.push(e.sizes.map((function(e){return e.join("x")})).join(",")),d.push(e.params.zoneId)})),n||(n="//ads.ad4game.com/v1/bid"),{method:"GET",url:n,bidId:i,data:(r={},o(r,"if",0),o(r,"siteurl",t.getTopWindowUrl()),o(r,"size",a.join(";")),o(r,"id",u.join(";")),o(r,"zoneId",d.join(";")),r)}},interpretResponse:function(e,r){var n=[];return t._each(e.body,(function(e){var i={requestId:r.bidId,cpm:e.cpm,width:e.width,height:e.height,creativeId:e.zoneid,currency:"USD",netRevenue:!0,ttl:120,ad:e.ad};n.push(i)})),n}};(0,i.registerBidder)(u)},52:function(e,r){}},[50]);
(this["webpackJsonp@coreui/coreui-free-react-admin-template"]=this["webpackJsonp@coreui/coreui-free-react-admin-template"]||[]).push([[24],{1041:function(e,t,n){"use strict";n.r(t);var a=n(2),c=n(9),r=n(1),o=n.n(r),i=n(631),s=n.n(i),l=n(632),j=n.n(l),d=n(163),b=n(629),u=n(627),O=n(641),p=n.n(O),h=n(20),m=n(637),x=n(657),f=n(587),g=n(571),k=n(697),v=n(626),w=n(749),y=n(648),C=n(166),N=n(642),P=n(665),S=n(685),T=n(17),_=function(e){var t=e.modal,n=e.setModal,o=Object(r.useState)([]),i=Object(c.a)(o,2),s=i[0],l=i[1],j=Object(r.useState)({kolom:"",order:"asc"}),d=Object(c.a)(j,2),b=d[0],O=d[1],p=Object(r.useState)(""),h=Object(c.a)(p,2),m=h[0],x=h[1];Object(r.useEffect)((function(){t.modal&&Object(S.a)(l)}),[t]);var f=Object(r.memo)((function(e){var t=e.filter;return"jenjang"!==t.kolom&&x(""),Object(T.jsx)(T.Fragment,{children:"jenjang"===t.kolom&&Object(T.jsxs)(u.y,{children:[Object(T.jsx)(u.L,{children:"Jenjang Pendidikan"}),Object(T.jsxs)(u.Y,{required:!0,value:m,onChange:function(e){return x(e.target.value)},className:m?null:"is-invalid",children:[Object(T.jsx)("option",{value:"",children:"-- Pilih Jenjang --"}),s.map((function(e,t){return Object(T.jsx)("option",{value:e.jenjang,children:e.jenjang},t)}))]}),!m&&Object(T.jsx)("div",{className:"invalid-feedback",children:"Jenjang harus diisi!"})]})})}));return Object(T.jsxs)(u.N,{show:t.modal,onClose:function(){return n(Object(a.a)(Object(a.a)({},t),{},{type:"",modal:!1}))},children:[Object(T.jsx)(u.Q,{closeButton:!0,children:Object(T.jsx)(u.R,{children:"Filter Print"})}),Object(T.jsxs)(u.x,{children:[Object(T.jsxs)(u.O,{children:[Object(T.jsxs)(u.y,{children:[Object(T.jsx)(u.L,{children:"Urutan"}),Object(T.jsxs)(u.Y,{name:"order",value:b.order,onChange:function(e){return O(Object(a.a)(Object(a.a)({},b),{},Object(C.a)({},e.target.name,e.target.value)))},children:[Object(T.jsx)("option",{value:"asc",children:"A - Z (Ascending)"}),Object(T.jsx)("option",{value:"desc",children:"Z - A (Descending)"})]})]}),Object(T.jsxs)(u.y,{children:[Object(T.jsx)(u.L,{children:"Kolom"}),Object(T.jsxs)(u.Y,{name:"kolom",value:b.kolom,onChange:function(e){return function(e){O(Object(a.a)(Object(a.a)({},b),{},Object(C.a)({},e.target.name,e.target.value)))}(e)},children:[Object(T.jsx)("option",{value:"",children:"Semua"}),Object(T.jsx)("option",{value:"nama",children:"Nama"}),Object(T.jsx)("option",{value:"bidang",children:"Bidang"}),Object(T.jsx)("option",{value:"jabatan",children:"Tugas Pokok"}),Object(T.jsx)("option",{value:"jenjang",children:"Jenjang Pendidikan"})]})]}),Object(T.jsx)(f,{filter:b})]}),Object(T.jsxs)(u.P,{children:[Object(T.jsx)(u.f,{color:"primary",onClick:function(e){e.preventDefault();var c="",r={};m?(r={jenjang:m,order:b.order},b.kolom={jenjang:m},c="pttb?jenjang=".concat(b.kolom.jenjang,"&order=").concat(b.order)):(r={kolom:b.kolom,order:b.order},c="pttb?kolom=".concat(b.kolom,"&order=").concat(b.order)),"print"===t.type?Object(P.a)(c):Object(N.a)("pttb",r,"filter_pegawai"),n(Object(a.a)(Object(a.a)({},t),{},{type:"",modal:!1}))},disabled:"jenjang"===b.kolom&&!m,children:"Print"}),Object(T.jsx)(u.f,{color:"secondary",onClick:function(){return n(Object(a.a)(Object(a.a)({},t),{},{type:"",modal:!1}))},children:"Close"})]})]})]})},A=j()(s.a);t.default=function(){var e=Object(h.g)(),t=Object(r.useState)(""),n=Object(c.a)(t,2),i=n[0],s=n[1],l=Object(r.useState)(!1),j=Object(c.a)(l,2),O=j[0],C=j[1],N=Object(r.useContext)(d.a),P=N.pttbState,S=N.pttbDispatch,L=P.data,R=P.loading,B=Object(r.useState)({type:"",modal:!1}),D=Object(c.a)(B,2),F=D[0],M=D[1];Object(r.useEffect)((function(){Object(k.a)(S)}),[S]);var K=L.filter((function(e){return!(!e.nama||!e.jabatan||!e.nama.toLowerCase().includes(i.toLowerCase())&&!e.jabatan.toLowerCase().includes(i.toLowerCase()))})),J=[{name:"No",selector:"no",sortable:!0,width:"75px"},{name:"Nama",selector:"nama",sortable:!0,wrap:!0},{name:"Penetap SK",selector:"penetap_sk",sortable:!0,wrap:!0},{name:"Tugas Pokok",selector:"jabatan",sortable:!0,wrap:!0},{name:"Bidang",selector:"bidang",sortable:!0,wrap:!0},{name:"Action",sortable:!0,cell:function(e){return Object(T.jsx)("div",{"data-tag":"allowRowEvents",children:Object(T.jsxs)(u.g,{children:[Object(T.jsx)(u.f,{color:"info",className:"btn btn-sm",onClick:function(){return Y(e.id_pegawai)},children:"Kelengkapan"}),Object(T.jsx)(u.f,{color:"success",className:"btn btn-sm",onClick:function(){return H(e.id_pegawai)},children:Object(T.jsx)(m.a,{content:x.a,color:"white"})}),Object(T.jsx)(u.f,{color:"danger",className:"btn btn-sm",onClick:function(){return Z(e.id_pegawai)},children:Object(T.jsx)(m.a,{content:f.a,color:"white"})})]})})}}],X={headCells:{style:{fontSize:"1.15em"}}},E=o.a.useMemo((function(){return Object(T.jsxs)(T.Fragment,{children:[Object(T.jsx)(y.a,{onFilter:function(e){return s(e.target.value)},onClear:function(){i&&(C(!O),s(""))},filterText:i}),Object(T.jsxs)(u.f,{type:"button",color:"info",className:"ml-2",onClick:function(){return M(Object(a.a)(Object(a.a)({},F),{},{type:"print",modal:!0}))},children:["PDF ",Object(T.jsx)(m.a,{content:g.a})]}),Object(T.jsxs)(u.f,{type:"button",color:"success",className:"ml-2",onClick:function(){return M(Object(a.a)(Object(a.a)({},F),{},{type:"excel",modal:!0}))},children:["Excel ",Object(T.jsx)(m.a,{content:g.a})]})]})}),[i,O,F]),H=function(t){e.push("/epekerja/admin/pegawai/pttb-edit/".concat(t))},Y=function(t){e.push("/epekerja/admin/pegawai-detail/".concat(t))},Z=function(e){A.fire({icon:"warning",title:"Anda yakin ingin menghapus data ini ?",text:"Jika yakin, klik YA",showConfirmButton:!0,showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"YA"}).then((function(t){t.isConfirmed&&(!function(e,t){v.a.delete("admin/pegawai/pttb/".concat(e)).then((function(e){Object(k.a)(t)})).catch((function(e){}))}(e,S),A.fire({icon:"success",title:"Terhapus",text:"Data berhasil dihapus"}))}))},z=function(e){var t=e.data;return Object(T.jsx)(T.Fragment,{children:Object(T.jsxs)("div",{style:{padding:"10px 63px"},children:[Object(T.jsxs)(u.X,{className:"mb-1",children:[Object(T.jsx)(u.n,{md:"2",children:Object(T.jsx)("strong",{children:"NIP"})}),Object(T.jsx)(u.n,{children:t.nip})]}),Object(T.jsxs)(u.X,{className:"mb-1",children:[Object(T.jsx)(u.n,{md:"2",children:Object(T.jsx)("strong",{children:"Tgl. Penetapan SK"})}),Object(T.jsx)(u.n,{children:Object(w.a)(new Date(t.tgl_penetapan_sk),"dd/MM/y")})]}),Object(T.jsxs)(u.X,{className:"mb-1",children:[Object(T.jsx)(u.n,{md:"2",children:Object(T.jsx)("strong",{children:"No. SK"})}),Object(T.jsx)(u.n,{children:t.no_sk})]}),Object(T.jsxs)(u.X,{className:"mb-1",children:[Object(T.jsx)(u.n,{md:"2",children:Object(T.jsx)("strong",{children:"Tgl. Mulai Tugas"})}),Object(T.jsx)(u.n,{children:t.tgl_mulai_tugas})]}),Object(T.jsxs)(u.X,{className:"mb-1",children:[Object(T.jsx)(u.n,{md:"2",children:Object(T.jsx)("strong",{children:"Kontrak Ke"})}),Object(T.jsx)(u.n,{children:t.kontrak_ke})]}),Object(T.jsxs)(u.X,{className:"mb-1",children:[Object(T.jsx)(u.n,{md:"2",children:Object(T.jsx)("strong",{children:"Masa Kerja"})}),Object(T.jsx)(u.n,{children:t.masa_kerja})]})]})})};return Object(T.jsxs)(T.Fragment,{children:[Object(T.jsxs)(u.h,{children:[Object(T.jsx)(u.l,{children:Object(T.jsx)("h3",{children:"Data Pegawai Tidak Tetap Bulanan (PTTB)"})}),Object(T.jsxs)(u.i,{children:[Object(T.jsx)(u.f,{color:"primary",className:"btn btn-md",onClick:function(){e.push("/epekerja/admin/pegawai/pttb-tambah")},children:"Tambah Data"}),L.length>0?Object(T.jsx)(p.a,{columns:J,data:K,noHeader:!0,responsive:!0,customStyles:X,pagination:!0,paginationResetDefaultPage:O,subHeader:!0,subHeaderComponent:E,expandableRows:!0,expandOnRowClicked:!0,highlightOnHover:!0,expandableRowsComponent:Object(T.jsx)(z,{})}):R?Object(T.jsx)(T.Fragment,{children:Object(T.jsx)("div",{children:Object(T.jsx)(u.X,{children:Object(T.jsx)(u.n,{className:"text-center",children:Object(T.jsx)("img",{className:"mt-4 ml-3",width:30,src:b.d,alt:"load-animation"})})})})}):Object(T.jsx)(p.a,{columns:J,data:K,noHeader:!0,responsive:!0,customStyles:X})]})]}),Object(T.jsx)(_,{modal:F,setModal:M})]})}},640:function(e,t,n){"use strict";function a(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}n.d(t,"a",(function(){return a}))},644:function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},648:function(e,t,n){"use strict";n(1);var a,c,r=n(640),o=n(643),i=o.default.button(a||(a=Object(r.a)(["\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n border-top-right-radius: 5px;\n border-bottom-right-radius: 5px;\n height: 37px;\n text-align: center;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #3e5973;\n border: none;\n color: white;\n padding: 0 10px;\n transition: 0.3s;\n\n &:hover {\n background-color: #283c4f;\n }\n"]))),s=o.default.input(c||(c=Object(r.a)(["\n height: 37px;\n width: 200px;\n border-radius: 3px;\n border-top-left-radius: 5px;\n border-bottom-left-radius: 5px;\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n border: 1px solid #e5e5e5;\n padding: 0 32px 0 16px;\n\n &:hover {\n cursor: pointer;\n }\n"]))),l=n(17);t.a=function(e){var t=e.filterText,n=e.onFilter,a=e.onClear;return Object(l.jsxs)(l.Fragment,{children:[Object(l.jsx)(s,{id:"search",type:"text",placeholder:"Cari pegawai","aria-label":"Search Input",value:t,onChange:n}),Object(l.jsx)(i,{type:"button",onClick:a,children:"Reset"})]})}},657:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var a=["512 512","<path fill='var(--ci-primary-color, currentColor)' d='M345.994,42.019,179.531,208.481A646.3,646.3,0,0,0,25.325,456.521a24.845,24.845,0,0,0,6,25.708l.087.087a24.84,24.84,0,0,0,17.611,7.342,25.172,25.172,0,0,0,8.1-1.344,646.283,646.283,0,0,0,248.04-154.207L471.62,167.646A88.831,88.831,0,0,0,345.994,42.019ZM282.531,311.48A614.445,614.445,0,0,1,60.419,453.221,614.435,614.435,0,0,1,202.158,231.108l99.162-99.161,80.372,80.372ZM448.993,145.019l-44.674,44.673L323.947,109.32l44.674-44.674a56.832,56.832,0,1,1,80.372,80.373Z' class='ci-primary'/>"]},665:function(e,t,n){"use strict";t.a=function(e){window.open("".concat(localStorage.baseURL,"print-daftar-pegawai/").concat(e),"_blank")}},685:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var a=n(626),c=function(e){a.a.get("admin/pegawai/pendidikan/jenjang").then((function(t){e(t.data.data),console.log(t.data)})).catch((function(e){console.log(e.response.data)}))}},697:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var a=n(40),c=n(626),r=function(e){e({type:a.LOADING}),c.a.get("admin/pegawai/pttb").then((function(t){e({type:a.SUCCESS,payload:t.data.data})})).catch((function(t){e({type:a.ERROR,payload:t.response.data.message})}))}}}]); //# sourceMappingURL=24.a675ef5f.chunk.js.map
'use strict'; const pWaitFor = require('p-wait-for'); const { randomString } = require('@cumulus/common/test-utils'); const { buildAndExecuteWorkflow, loadCollection, loadProvider, waitForCompletedExecution } = require('@cumulus/integration-tests'); const { LambdaStep } = require('@cumulus/integration-tests/sfnStep'); const { createCollection, deleteCollection } = require('@cumulus/api-client/collections'); const { getExecution } = require('@cumulus/api-client/executions'); const { createProvider, deleteProvider } = require('@cumulus/api-client/providers'); const { deleteFolder, loadConfig, updateAndUploadTestDataToBucket } = require('../../helpers/testUtils'); describe('The DiscoverGranules workflow', () => { let beforeAllCompleted = false; let collection; let provider; let queueGranulesOutput; let workflowExecution; let stackName; let bucket; let providerPath; beforeAll(async () => { ({ stackName, bucket } = await loadConfig()); process.env.stackName = stackName; process.env.system_bucket = bucket; process.env.ProvidersTable = `${stackName}-ProvidersTable`; const testId = randomString(); // Create the provider provider = await loadProvider({ filename: './data/providers/s3/s3_provider.json', postfix: testId, s3Host: bucket }); await createProvider({ prefix: stackName, provider }); // Create the collection collection = await loadCollection({ filename: './data/collections/s3_MOD09GQ_006/s3_MOD09GQ_006.json', postfix: testId }); await createCollection({ prefix: stackName, collection }); providerPath = `cumulus-test-data/${testId}`; // Upload the granule to be discovered await updateAndUploadTestDataToBucket( bucket, [ '@cumulus/test-data/granules/MOD09GQ.A2016358.h13v04.006.2016360104606.hdf.met', '@cumulus/test-data/granules/MOD09GQ.A2016358.h13v04.006.2016360104606.hdf', '@cumulus/test-data/granules/MOD09GQ.A2016358.h13v04.006.2016360104606_ndvi.jpg' ], providerPath ); // Execute the DiscoverGranules workflow workflowExecution = await buildAndExecuteWorkflow( stackName, bucket, 'DiscoverGranules', collection, provider, undefined, { provider_path: providerPath } ); // Get the output of the QueueGranules task. Doing it here because there are // two tests that need it. queueGranulesOutput = await (new LambdaStep()).getStepOutput( workflowExecution.executionArn, 'QueueGranules' ); beforeAllCompleted = true; }); afterAll(() => Promise.all([ deleteFolder(bucket, providerPath), deleteCollection({ prefix: stackName, collectionName: collection.name, collectionVersion: collection.version }), deleteProvider({ prefix: stackName, provider: provider.id }) ])); it('executes successfully', () => { if (!beforeAllCompleted) fail('beforeAll() failed'); else expect(workflowExecution.status).toEqual('SUCCEEDED'); }); it('can be fetched from the API', async () => { if (!beforeAllCompleted) fail('beforeAll() failed'); else { await expectAsync( pWaitFor( async () => { const { status } = await getExecution({ prefix: stackName, arn: workflowExecution.executionArn }); return status === 'completed'; }, { interval: 2000, timeout: 60000 } ) ).toBeResolved(); } }); it('results in a successful IngestGranule workflow execution', async () => { if (!beforeAllCompleted) fail('beforeAll() failed'); else { const ingestGranuleExecutionStatus = await waitForCompletedExecution( queueGranulesOutput.payload.running[0] ); expect(ingestGranuleExecutionStatus).toEqual('SUCCEEDED'); } }); describe('DiscoverGranules task', () => { it('outputs the list of discovered granules', async () => { if (!beforeAllCompleted) fail('beforeAll() failed'); else { const discoverGranulesOutput = await (new LambdaStep()).getStepOutput( workflowExecution.executionArn, 'DiscoverGranules' ); expect(discoverGranulesOutput.payload.granules.length).toEqual(1); const granule = discoverGranulesOutput.payload.granules[0]; expect(granule.granuleId).toEqual('MOD09GQ.A2016358.h13v04.006.2016360104606'); expect(granule.dataType).toEqual(collection.name); expect(granule.version).toEqual(collection.version); expect(granule.files.length).toEqual(3); } }); }); describe('QueueGranules task', () => { it('has queued the granule', () => { if (!beforeAllCompleted) fail('beforeAll() failed'); else expect(queueGranulesOutput.payload.running.length).toEqual(1); }); }); });
const path = require("path"); const webpack = require("webpack"); const HtmlWebpackPlugin = require("html-webpack-plugin"); const TerserPlugin = require("terser-webpack-plugin"); const CopyPlugin = require("copy-webpack-plugin"); function initCanisterEnv() { let localCanisters, prodCanisters; try { localCanisters = require(path.resolve( ".dfx", "local", "canister_ids.json" )); } catch (error) { console.log("No local canister_ids.json found. Continuing production"); } try { prodCanisters = require(path.resolve("canister_ids.json")); } catch (error) { console.log("No production canister_ids.json found. Continuing with local"); } const network = process.env.DFX_NETWORK || (process.env.NODE_ENV === "production" ? "ic" : "local"); const canisterConfig = network === "local" ? localCanisters : prodCanisters; return Object.entries(canisterConfig).reduce((prev, current) => { const [canisterName, canisterDetails] = current; prev[canisterName.toUpperCase() + "_CANISTER_ID"] = canisterDetails[network]; return prev; }, {}); } const canisterEnvVariables = initCanisterEnv(); const isDevelopment = process.env.NODE_ENV !== "production"; const frontendDirectory = "tipjar_assets"; const asset_entry = path.join("src", frontendDirectory, "src", "index.html"); module.exports = { target: "web", mode: isDevelopment ? "development" : "production", entry: { // The frontend.entrypoint points to the HTML file for this build, so we need // to replace the extension to `.js`. index: path.join(__dirname, asset_entry).replace(/\.html$/, ".js"), }, devtool: isDevelopment ? "source-map" : false, optimization: { minimize: !isDevelopment, minimizer: [new TerserPlugin()], }, resolve: { extensions: [".js", ".ts", ".jsx", ".tsx"], fallback: { assert: require.resolve("assert/"), buffer: require.resolve("buffer/"), events: require.resolve("events/"), stream: require.resolve("stream-browserify/"), util: require.resolve("util/"), }, }, output: { filename: "index.js", path: path.join(__dirname, "dist", frontendDirectory), }, // Depending in the language or framework you are using for // front-end development, add module loaders to the default // webpack configuration. For example, if you are using React // modules and CSS as described in the "Adding a stylesheet" // tutorial, uncomment the following lines: // module: { // rules: [ // { test: /\.(ts|tsx|jsx)$/, loader: "ts-loader" }, // { test: /\.css$/, use: ['style-loader','css-loader'] } // ] // }, plugins: [ new HtmlWebpackPlugin({ template: path.join(__dirname, asset_entry), cache: false, }), new CopyPlugin({ patterns: [ { from: path.join(__dirname, "src", frontendDirectory, "assets"), to: path.join(__dirname, "dist", frontendDirectory), }, ], }), new webpack.EnvironmentPlugin({ NODE_ENV: "development", ...canisterEnvVariables, }), new webpack.ProvidePlugin({ Buffer: [require.resolve("buffer/"), "Buffer"], process: require.resolve("process/browser"), }), ], // proxy /api to port 8000 during development devServer: { proxy: { "/api": { target: "http://localhost:8000", changeOrigin: true, pathRewrite: { "^/api": "/api", }, }, }, hot: true, watchFiles: [path.resolve(__dirname, "src", frontendDirectory)], liveReload: true, }, };
import { StyleSheet, View } from 'react-native'; const Color = (props) => { return ( <View style={[styles.color__div, { backgroundColor: props.color }]}> </View> ); } const styles = StyleSheet.create({ color__div: { width: 50, height: 50, justifyContent: 'center', alignItems: 'center', padding: 10, borderRadius: 100, borderWidth: 1, borderColor: '#fff', } }); export default Color;
import clone from "../Core/clone.js"; import defined from "../Core/defined.js"; import Expression from "./Expression.js"; /** * An expression for a style applied to a {@link Cesium3DTileset}. * <p> * Evaluates a conditions expression defined using the * {@link https://github.com/CesiumGS/3d-tiles/tree/main/specification/Styling|3D Tiles Styling language}. * </p> * <p> * Implements the {@link StyleExpression} interface. * </p> * * @alias ConditionsExpression * @constructor * * @param {Object} [conditionsExpression] The conditions expression defined using the 3D Tiles Styling language. * @param {Object} [defines] Defines in the style. * * @example * var expression = new Cesium.ConditionsExpression({ * conditions : [ * ['${Area} > 10, 'color("#FF0000")'], * ['${id} !== "1"', 'color("#00FF00")'], * ['true', 'color("#FFFFFF")'] * ] * }); * expression.evaluateColor(feature, result); // returns a Cesium.Color object */ function ConditionsExpression(conditionsExpression, defines) { this._conditionsExpression = clone(conditionsExpression, true); this._conditions = conditionsExpression.conditions; this._runtimeConditions = undefined; setRuntime(this, defines); } Object.defineProperties(ConditionsExpression.prototype, { /** * Gets the conditions expression defined in the 3D Tiles Styling language. * * @memberof ConditionsExpression.prototype * * @type {Object} * @readonly * * @default undefined */ conditionsExpression: { get: function () { return this._conditionsExpression; }, }, }); function Statement(condition, expression) { this.condition = condition; this.expression = expression; } function setRuntime(expression, defines) { const runtimeConditions = []; const conditions = expression._conditions; if (!defined(conditions)) { return; } const length = conditions.length; for (let i = 0; i < length; ++i) { const statement = conditions[i]; const cond = String(statement[0]); const condExpression = String(statement[1]); runtimeConditions.push( new Statement( new Expression(cond, defines), new Expression(condExpression, defines) ) ); } expression._runtimeConditions = runtimeConditions; } /** * Evaluates the result of an expression, optionally using the provided feature's properties. If the result of * the expression in the * {@link https://github.com/CesiumGS/3d-tiles/tree/main/specification/Styling|3D Tiles Styling language} * is of type <code>Boolean</code>, <code>Number</code>, or <code>String</code>, the corresponding JavaScript * primitive type will be returned. If the result is a <code>RegExp</code>, a Javascript <code>RegExp</code> * object will be returned. If the result is a <code>Cartesian2</code>, <code>Cartesian3</code>, or <code>Cartesian4</code>, * a {@link Cartesian2}, {@link Cartesian3}, or {@link Cartesian4} object will be returned. If the <code>result</code> argument is * a {@link Color}, the {@link Cartesian4} value is converted to a {@link Color} and then returned. * * @param {Cesium3DTileFeature} feature The feature whose properties may be used as variables in the expression. * @param {Object} [result] The object onto which to store the result. * @returns {Boolean|Number|String|RegExp|Cartesian2|Cartesian3|Cartesian4|Color} The result of evaluating the expression. */ ConditionsExpression.prototype.evaluate = function (feature, result) { const conditions = this._runtimeConditions; if (!defined(conditions)) { return undefined; } const length = conditions.length; for (let i = 0; i < length; ++i) { const statement = conditions[i]; if (statement.condition.evaluate(feature)) { return statement.expression.evaluate(feature, result); } } }; /** * Evaluates the result of a Color expression, using the values defined by a feature. * <p> * This is equivalent to {@link ConditionsExpression#evaluate} but always returns a {@link Color} object. * </p> * @param {Cesium3DTileFeature} feature The feature whose properties may be used as variables in the expression. * @param {Color} [result] The object in which to store the result * @returns {Color} The modified result parameter or a new Color instance if one was not provided. */ ConditionsExpression.prototype.evaluateColor = function (feature, result) { const conditions = this._runtimeConditions; if (!defined(conditions)) { return undefined; } const length = conditions.length; for (let i = 0; i < length; ++i) { const statement = conditions[i]; if (statement.condition.evaluate(feature)) { return statement.expression.evaluateColor(feature, result); } } }; /** * Gets the shader function for this expression. * Returns undefined if the shader function can't be generated from this expression. * * @param {String} functionSignature Signature of the generated function. * @param {Object} variableSubstitutionMap Maps variable names to shader variable names. * @param {Object} shaderState Stores information about the generated shader function, including whether it is translucent. * @param {String} returnType The return type of the generated function. * * @returns {String} The shader function. * * @private */ ConditionsExpression.prototype.getShaderFunction = function ( functionSignature, variableSubstitutionMap, shaderState, returnType ) { const conditions = this._runtimeConditions; if (!defined(conditions) || conditions.length === 0) { return undefined; } let shaderFunction = ""; const length = conditions.length; for (let i = 0; i < length; ++i) { const statement = conditions[i]; const condition = statement.condition.getShaderExpression( variableSubstitutionMap, shaderState ); const expression = statement.expression.getShaderExpression( variableSubstitutionMap, shaderState ); // Build the if/else chain from the list of conditions shaderFunction += " " + (i === 0 ? "if" : "else if") + " (" + condition + ")\n" + " {\n" + " return " + expression + ";\n" + " }\n"; } shaderFunction = returnType + " " + functionSignature + "\n" + "{\n" + shaderFunction + " return " + returnType + "(1.0);\n" + // Return a default value if no conditions are met "}\n"; return shaderFunction; }; /** * Gets the variables used by the expression. * * @returns {String[]} The variables used by the expression. * * @private */ ConditionsExpression.prototype.getVariables = function () { let variables = []; const conditions = this._runtimeConditions; if (!defined(conditions) || conditions.length === 0) { return variables; } const length = conditions.length; for (let i = 0; i < length; ++i) { const statement = conditions[i]; variables.push.apply(variables, statement.condition.getVariables()); variables.push.apply(variables, statement.expression.getVariables()); } // Remove duplicates variables = variables.filter(function (variable, index, variables) { return variables.indexOf(variable) === index; }); return variables; }; export default ConditionsExpression;
import React from 'react'; import marked from 'marked'; import { storiesOf } from '@storybook/react'; import readme from '../../README.md'; import 'github-markdown-css'; import './intro.css'; storiesOf('Docs|Introduction', module) .add( 'Getting started', () => ( <div className="markdown-body" style={{ padding: 15 }}> <div dangerouslySetInnerHTML={{ __html: marked(readme) }} /> </div> ), { options: { showPanel: false } } ) .add('Version', () => <div>{require('../../package.json').version}</div>); // export default { // title: 'Docs|Introduction', // }; // export const gettingStarted = () => ( // <div className="markdown-body" style={{ padding: 15 }}> // <div dangerouslySetInnerHTML={{ __html: marked(readme) }} /> // </div> // ); // gettingStarted.story = { // name: 'Getting started', // };
/** * Unit tests for harModelLoader. */ define([ "preview/harModelLoader", ], function(Loader) { var registerSuite = intern.getInterface("object").registerSuite; var assert = intern.getPlugin("chai").assert; function assign(target, src1, src2, etc) { for (var i = 1; i < arguments.length; i++) { for (var k in arguments[i]) { target[k] = arguments[i][k]; } } return target; } function prefix(prefix, arr) { return arr.map(function(it) { return ("string" === typeof prefix) ? prefix + it : it; }); } function makeUrlFromParams(baseUrl, params) { params = params || []; var url = "http://harviewer:49001/webapp/"; if (baseUrl) { url += "?baseUrl=" + baseUrl + "&"; } else { url += "?"; } return url + params.join("&"); } function makeUrl(baseUrl, paths, inputUrls, hars, harps) { paths = paths || []; inputUrls = inputUrls || []; hars = hars || []; harps = harps || []; var params = prefix("path=", paths) .concat(prefix("inputUrl=", inputUrls)) .concat(prefix("har=", hars)) .concat(prefix("harp=", harps)); return makeUrlFromParams(baseUrl, params); } /** * Returns the default expectations. */ function makeExpected() { return { callbackName: null, baseUrl: null, urls: [], inputUrls: [], hars: [], harps: [], filePath: null, }; } var getLoadOptionsSubSuite = { 'returns empty options when no parameters exist': function() { var expected = makeExpected(); assert.deepEqual(Loader.getLoadOptions(""), expected); }, // Tests for legacy parameters, "path" and "inputUrl" 'single "path" parameter (with "baseUrl") populates "loadOptions.urls"': function() { var baseUrl = "http://harviewer:49001/selenium/tests/hars/"; var paths = ["path.har"]; var expected = assign(makeExpected(), { baseUrl: baseUrl, urls: prefix(baseUrl, paths), filePath: paths[0] }); var actual = Loader.getLoadOptions(makeUrl(baseUrl, paths)); assert.deepEqual(actual, expected); }, 'single "path" parameter (without "baseUrl") populates "loadOptions.urls"': function() { var baseUrl = null; var paths = ["path.har"]; var expected = assign(makeExpected(), { baseUrl: baseUrl, urls: prefix(baseUrl, paths), filePath: paths[0] }); var actual = Loader.getLoadOptions(makeUrl(baseUrl, paths)); assert.deepEqual(actual, expected); }, 'multiple "path" parameters (with "baseUrl") populates "loadOptions.urls"': function() { var baseUrl = "http://harviewer:49001/selenium/tests/hars/"; var paths = ["path1.har", "path2.har"]; var expected = assign(makeExpected(), { baseUrl: baseUrl, urls: prefix(baseUrl, paths), filePath: paths[0] }); var actual = Loader.getLoadOptions(makeUrl(baseUrl, paths)); assert.deepEqual(actual, expected); }, 'multiple "path" parameters (without "baseUrl") populates "loadOptions.urls"': function() { var baseUrl = null; var paths = ["path1.har", "path2.har"]; var expected = assign(makeExpected(), { baseUrl: baseUrl, urls: prefix(baseUrl, paths), filePath: paths[0] }); var actual = Loader.getLoadOptions(makeUrl(baseUrl, paths)); assert.deepEqual(actual, expected); }, 'single "inputUrl" parameters (with "baseUrl") populates "loadOptions.urls" and "loadOptions.inputUrls"': function() { var baseUrl = "http://harviewer:49001/selenium/tests/hars/"; var inputUrls = ["inputUrl.harp"]; var expected = assign(makeExpected(), { baseUrl: baseUrl, urls: inputUrls, inputUrls: inputUrls }); var actual = Loader.getLoadOptions(makeUrl(baseUrl, [], inputUrls)); assert.deepEqual(actual, expected); }, 'single "inputUrl" parameters (without "baseUrl") populates "loadOptions.urls" and "loadOptions.inputUrls"': function() { var baseUrl = null; var inputUrls = ["inputUrl.harp"]; var expected = assign(makeExpected(), { baseUrl: baseUrl, urls: inputUrls, inputUrls: inputUrls }); var actual = Loader.getLoadOptions(makeUrl(baseUrl, [], inputUrls)); assert.deepEqual(actual, expected); }, 'multiple "inputUrl" parameters (with "baseUrl") populates "loadOptions.urls" and "loadOptions.inputUrls"': function() { var baseUrl = "http://harviewer:49001/selenium/tests/hars/"; var inputUrls = ["inputUrl1.harp", "inputUrl2.harp"]; var expected = assign(makeExpected(), { baseUrl: baseUrl, urls: inputUrls, inputUrls: inputUrls }); var actual = Loader.getLoadOptions(makeUrl(baseUrl, [], inputUrls)); assert.deepEqual(actual, expected); }, 'multiple "inputUrl" parameters (without "baseUrl") populates "loadOptions.urls" and "loadOptions.inputUrls"': function() { var baseUrl = null; var inputUrls = ["inputUrl1.harp", "inputUrl2.harp"]; var expected = assign(makeExpected(), { baseUrl: baseUrl, urls: inputUrls, inputUrls: inputUrls }); var actual = Loader.getLoadOptions(makeUrl(baseUrl, [], inputUrls)); assert.deepEqual(actual, expected); }, 'mixed "path" and "inputUrl" parameters (with "baseUrl") populates "loadOptions.urls" and "loadOptions.inputUrls"': function() { var baseUrl = "http://harviewer:49001/selenium/tests/hars/"; var paths = ["path1.har", "path2.har"]; var inputUrls = ["inputUrl1.harp", "inputUrl2.harp"]; var expected = assign(makeExpected(), { baseUrl: baseUrl, urls: prefix(baseUrl, paths).concat(inputUrls), inputUrls: inputUrls, filePath: paths[0] }); var actual = Loader.getLoadOptions(makeUrl(baseUrl, paths, inputUrls)); assert.deepEqual(actual, expected); }, 'mixed "path" and "inputUrl" parameters (without "baseUrl") populates "loadOptions.urls" and "loadOptions.inputUrls"': function() { var baseUrl = null; var paths = ["path1.har", "path2.har"]; var inputUrls = ["inputUrl1.harp", "inputUrl2.harp"]; var expected = assign(makeExpected(), { baseUrl: baseUrl, urls: prefix(baseUrl, paths).concat(inputUrls), inputUrls: inputUrls, filePath: paths[0] }); var actual = Loader.getLoadOptions(makeUrl(baseUrl, paths, inputUrls)); assert.deepEqual(actual, expected); }, // Tests for new parameters, "har" and "harp" 'single "har" parameter (without "baseUrl") populates "loadOptions.hars"': function() { var baseUrl = null; var hars = ["har.har"]; var expected = assign(makeExpected(), { baseUrl: baseUrl, hars: prefix(baseUrl, hars) }); var actual = Loader.getLoadOptions(makeUrl(baseUrl, [], [], hars)); assert.deepEqual(actual, expected); }, 'single "har" parameter and single "path" parameter (without "baseUrl") populates "loadOptions.hars"': function() { // Expect path to be ignored. var baseUrl = null; var hars = ["har.har"]; var paths = ["path.har"]; var expected = assign(makeExpected(), { baseUrl: baseUrl, hars: prefix(baseUrl, hars) }); var actual = Loader.getLoadOptions(makeUrl(baseUrl, [], [], hars)); assert.deepEqual(actual, expected); } }; var loadArchivesSubSuite = (function() { function counter() { var f = function() { f.count++; }; f.count = 0; return f; } var LoaderAjax = Loader.ajax; var ajax = function(ajaxOpts) { var context = ajaxOpts.context; setTimeout(function() { if (ajaxOpts.url === "error") { ajaxOpts.error.call(context); } else { ajaxOpts.success.call(context); } }, 1); }; function rejecter(value) { return function(dfd) { return dfd.callback(function() { throw new Error(value); }); } } var callbackRejecter = rejecter("callback should not be called"); var errorCallbackRejecter = rejecter("errorCallback should not be called"); var doneCallbackRejecter = rejecter("doneCallback should not be called"); var noop = function() { }; var timeout = 500; return { beforeEach: function() { Loader.ajax = ajax; }, afterEach: function() { Loader.ajax = LoaderAjax; }, tests: { 'null hars, null harps': function() { var dfd = this.async(timeout); Loader.loadArchives(null, null, null, callbackRejecter(dfd), errorCallbackRejecter(dfd), dfd.callback(noop)); }, 'empty hars, empty harps': function() { var dfd = this.async(timeout); Loader.loadArchives([], [], null, callbackRejecter(dfd), errorCallbackRejecter(dfd), dfd.callback(noop)); }, '1 har error, empty harps': function() { var dfd = this.async(timeout); Loader.loadArchives(["error"], [], null, callbackRejecter(dfd), dfd.callback(noop), doneCallbackRejecter(dfd)); }, '1 ok har, 1 error har, empty harps': function() { var dfd = this.async(timeout); var callback = counter(); Loader.loadArchives(["1", "error"], [], null, callback, dfd.callback(function() { assert.strictEqual(callback.count, 1, "expect callback to be called once"); }), doneCallbackRejecter(dfd)); }, '1 har, null harps': function() { var dfd = this.async(timeout); var callback = counter(); Loader.loadArchives(["1"], [], null, callback, errorCallbackRejecter(dfd), dfd.callback(function() { assert.strictEqual(callback.count, 1, "expect callback to be called once"); })); }, '1 har, 1 harp': function() { var dfd = this.async(timeout); var callback = counter(); Loader.loadArchives(["1"], ["1"], null, callback, errorCallbackRejecter(dfd), dfd.callback(function() { assert.strictEqual(callback.count, 2, "expect callback to be called twice"); })); } } }; }()); registerSuite("preview/harModelLoader", { 'getLoadOptions': getLoadOptionsSubSuite, 'loadArchives': loadArchivesSubSuite }); });
!function(a){var b={exports:{}};(function(a){function b(){this._events={},this._maxListeners=10}function c(a,b,c,d,e){this.type=a,this.listener=b,this.scope=c,this.once=d,this.instance=e}c.prototype.fire=function(a){this.listener.apply(this.scope||this,a);if(this.once)return this.instance.removeListener(this.type,this.listener),!1},b.prototype.eachListener=function(a,b){var c=null,d=null,e=null;if(this._events.hasOwnProperty(a)){d=this._events[a];for(c=0;c<d.length;c+=1)if(e=b.call(this,d[c],c),e===!1)c-=1;else if(e===!0)break}return this},b.prototype.addListener=function(a,b,d,e){return this._events.hasOwnProperty(a)||(this._events[a]=[]),this._events[a].push(new c(a,b,d,e,this)),this.emit("newListener",a,b,d,e),this._maxListeners&&!this._events[a].warned&&this._events[a].length>this._maxListeners&&(typeof console!="undefined"&&console.warn("Possible EventEmitter memory leak detected. "+this._events[a].length+" listeners added. Use emitter.setMaxListeners() to increase limit."),this._events[a].warned=!0),this},b.prototype.on=b.prototype.addListener,b.prototype.once=function(a,b,c){return this.addListener(a,b,c,!0)},b.prototype.removeListener=function(a,b){return this.eachListener(a,function(c,d){c.listener===b&&this._events[a].splice(d,1)}),this._events[a]&&this._events[a].length===0&&delete this._events[a],this},b.prototype.removeAllListeners=function(a){return a&&this._events.hasOwnProperty(a)?delete this._events[a]:a||(this._events={}),this},b.prototype.listeners=function(a){if(this._events.hasOwnProperty(a)){var b=[];return this.eachListener(a,function(a){b.push(a.listener)}),b}return[]},b.prototype.emit=function(a){for(var b=[],c=null,c=1;c<arguments.length;c+=1)b.push(arguments[c]);return this.eachListener(a,function(a){return a.fire(b)}),this},b.prototype.setMaxListeners=function(a){return this._maxListeners=a,this},a.EventEmitter=b})(this),b.events=new EventEmitter,b.exports.events=new EventEmitter,a.remark=b.exports,!function(a){var b=["highlightInline","highlightLanguage","highlightStyle"],c=a.config=a.exports.config=function(a){var b;f(a)},d=function(){var a=/remark(-\d\.\d(\.\d)?)?(\.min)?\.js/i,b=document.getElementsByTagName("script"),c,d;for(d=0;d<b.length;++d){c=b[d];if(a.exec(c.src)){e(c.innerHTML.trim());break}}},e=function(a){var b={};if(a==="")return;try{b=JSON.parse(a)}catch(c){alert("Parsing of remark config failed! Be sure to use valid JSON.")}f(b)},f=function(a){var d,e;for(d=0;d<b.length;++d)e=b[d],a.hasOwnProperty(e)&&(c[e]=a[e])};d()}(b),!function(a){var b=a.controller={},c=-1;b.create=function(b){var e=function(){slideNo=parseInt((location.hash||"").substr(1),10)||1,d(b,slideNo-1)};window.onhashchange=e,e(),a.events.on("previousSlide",function(){d(b,c-1)}),a.events.on("nextSlide",function(){d(b,c+1)})};var d=function(a,b){var d=b===c,e=a.getSlideCount()-1,f=b<0||b>e;if(d||f)return;c!==-1&&a.hideSlide(c),a.showSlide(b),c=b,location.hash=c+1}}(b),!function(a){((function(){function l(){var a="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+";return a}function m(a){return a=a.source,function b(c,d){return c?(a=a.replace(c,d.source||d),b):new RegExp(a)}}function n(){}var a={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:n,hr:/^( *[\-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,lheading:/^([^\n]+)\n *(=|-){3,} *\n*/,blockquote:/^( *>[^\n]+(\n[^\n]+)*\n*)+/,list:/^( *)([*+-]|\d+\.) [^\0]+?(?:\n{2,}(?! )(?!\1bullet)\n*|\s*$)/,html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *([^\s]+)(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,paragraph:/^([^\n]+\n?(?!body))+\n*/,text:/^[^\n]+/};a.list=m(a.list)("bullet",/(?:[*+-](?!(?: *[-*]){2,})|\d+\.)/)(),a.html=m(a.html)("comment",/<!--[^\0]*?-->/)("closed",/<(tag)[^\0]+?<\/\1>/)("closing",/<tag(?!:\/|@)\b(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,l())(),a.paragraph=function(){var b=a.paragraph.source,c=[];return function d(b){return b=a[b]?a[b].source:b,c.push(b.replace(/(^|[^\[])\^/g,"$1")),d}("hr")("heading")("lheading")("blockquote")("<"+l())("def"),new RegExp(b.replace("body",c.join("|")))}(),a.normal={fences:a.fences,paragraph:a.paragraph},a.gfm={fences:/^ *``` *(\w+)? *\n([^\0]+?)\s*``` *(?:\n+|$)/,paragraph:/^/},a.gfm.paragraph=m(a.paragraph)("(?!","(?!"+a.gfm.fences.source.replace(/(^|[^\[])\^/g,"$1")+"|")(),a.lexer=function(b){var c=[];return c.links={},b=b.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),a.token(b,c,!0)},a.token=function(b,c,d){var b=b.replace(/^ +$/gm,""),e,f,g,h,i,j,k;while(b){if(g=a.newline.exec(b))b=b.substring(g[0].length),g[0].length>1&&c.push({type:"space"});if(g=a.code.exec(b)){b=b.substring(g[0].length),g=g[0].replace(/^ {4}/gm,""),c.push({type:"code",text:p.pedantic?g:g.replace(/\n+$/,"")});continue}if(g=a.fences.exec(b)){b=b.substring(g[0].length),c.push({type:"code",lang:g[1],text:g[2]});continue}if(g=a.heading.exec(b)){b=b.substring(g[0].length),c.push({type:"heading",depth:g[1].length,text:g[2]});continue}if(g=a.lheading.exec(b)){b=b.substring(g[0].length),c.push({type:"heading",depth:g[2]==="="?1:2,text:g[1]});continue}if(g=a.hr.exec(b)){b=b.substring(g[0].length),c.push({type:"hr"});continue}if(g=a.blockquote.exec(b)){b=b.substring(g[0].length),c.push({type:"blockquote_start"}),g=g[0].replace(/^ *> ?/gm,""),a.token(g,c,d),c.push({type:"blockquote_end"});continue}if(g=a.list.exec(b)){b=b.substring(g[0].length),c.push({type:"list_start",ordered:isFinite(g[2])}),g=g[0].match(/^( *)([*+-]|\d+\.) [^\n]*(?:\n(?!\1(?:[*+-]|\d+\.) )[^\n]*)*/gm),e=!1,k=g.length,j=0;for(;j<k;j++)h=g[j],i=h.length,h=h.replace(/^ *([*+-]|\d+\.) +/,""),~h.indexOf("\n ")&&(i-=h.length,h=p.pedantic?h.replace(/^ {1,4}/gm,""):h.replace(new RegExp("^ {1,"+i+"}","gm"),"")),f=e||/\n\n(?!\s*$)/.test(h),j!==k-1&&(e=h[h.length-1]==="\n",f||(f=e)),c.push({type:f?"loose_item_start":"list_item_start"}),a.token(h,c),c.push({type:"list_item_end"});c.push({type:"list_end"});continue}if(g=a.html.exec(b)){b=b.substring(g[0].length),c.push({type:"html",pre:g[1]==="pre",text:g[0]});continue}if(d&&(g=a.def.exec(b))){b=b.substring(g[0].length),c.links[g[1].toLowerCase()]={href:g[2],title:g[3]};continue}if(d&&(g=a.paragraph.exec(b))){b=b.substring(g[0].length),c.push({type:"paragraph",text:g[0]});continue}if(g=a.text.exec(b)){b=b.substring(g[0].length),c.push({type:"text",text:g[0]});continue}}return c};var b={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:n,tag:/^<!--[^\0]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([^\0]+?)__(?!_)|^\*\*([^\0]+?)\*\*(?!\*)/,em:/^\b_((?:__|[^\0])+?)_\b|^\*((?:\*\*|[^\0])+?)\*(?!\*)/,code:/^(`+)([^\0]*?[^`])\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,text:/^[^\0]+?(?=[\\<!\[_*`]| {2,}\n|$)/};b._linkInside=/(?:\[[^\]]*\]|[^\]]|\](?=[^\[]*\]))*/,b._linkHref=/\s*<?([^\s]*?)>?(?:\s+"([^\n]+)")?\s*/,b.link=m(b.link)("inside",b._linkInside)("href",b._linkHref)(),b.reflink=m(b.reflink)("inside",b._linkInside)(),b.normal={url:b.url,strong:b.strong,em:b.em,text:b.text},b.pedantic={strong:/^__(?=\S)([^\0]*?\S)__(?!_)|^\*\*(?=\S)([^\0]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([^\0]*?\S)_(?!_)|^\*(?=\S)([^\0]*?\S)\*(?!\*)/},b.gfm={url:/^(https?:\/\/[^\s]+[^.,:;"')\]\s])/,text:/^[^\0]+?(?=[\\<!\[_*`]|https?:\/\/| {2,}\n|$)/},b.lexer=function(a){var e="",f=d.links,g,h,i,l;while(a){if(l=b.escape.exec(a)){a=a.substring(l[0].length),e+=l[1];continue}if(l=b.autolink.exec(a)){a=a.substring(l[0].length),l[2]==="@"?(h=l[1][6]===":"?k(l[1].substring(7)):k(l[1]),i=k("mailto:")+h):(h=j(l[1]),i=h),e+='<a href="'+i+'">'+h+"</a>";continue}if(l=b.url.exec(a)){a=a.substring(l[0].length),h=j(l[1]),i=h,e+='<a href="'+i+'">'+h+"</a>";continue}if(l=b.tag.exec(a)){a=a.substring(l[0].length),e+=p.sanitize?j(l[0]):l[0];continue}if(l=b.link.exec(a)){a=a.substring(l[0].length),e+=c(l,{href:l[2],title:l[3]});continue}if((l=b.reflink.exec(a))||(l=b.nolink.exec(a))){a=a.substring(l[0].length),g=(l[2]||l[1]).replace(/\s+/g," "),g=f[g.toLowerCase()];if(!g||!g.href){e+=l[0][0],a=l[0].substring(1)+a;continue}e+=c(l,g);continue}if(l=b.strong.exec(a)){a=a.substring(l[0].length),e+="<strong>"+b.lexer(l[2]||l[1])+"</strong>";continue}if(l=b.em.exec(a)){a=a.substring(l[0].length),e+="<em>"+b.lexer(l[2]||l[1])+"</em>";continue}if(l=b.code.exec(a)){a=a.substring(l[0].length),e+="<code>"+j(l[2],!0)+"</code>";continue}if(l=b.br.exec(a)){a=a.substring(l[0].length),e+="<br>";continue}if(l=b.text.exec(a)){a=a.substring(l[0].length),e+=j(l[0]);continue}}return e};var c=function(a,c){return a[0][0]!=="!"?'<a href="'+j(c.href)+'"'+(c.title?' title="'+j(c.title)+'"':"")+">"+b.lexer(a[1])+"</a>":'<img src="'+j(c.href)+'" alt="'+j(a[1])+'"'+(c.title?' title="'+j(c.title)+'"':"")+">"},d,e,f=function(){return e=d.pop()},g=function(){switch(e.type){case"space":return"";case"hr":return"<hr>\n";case"heading":return"<h"+e.depth+">"+b.lexer(e.text)+"</h"+e.depth+">\n";case"code":return"<pre><code"+(e.lang?' class="'+e.lang+'"':"")+">"+(e.escaped?e.text:j(e.text,!0))+"</code></pre>\n";case"blockquote_start":var a="";while(f().type!=="blockquote_end")a+=g();return"<blockquote>\n"+a+"</blockquote>\n";case"list_start":var c=e.ordered?"ol":"ul",a="";while(f().type!=="list_end")a+=g();return"<"+c+">\n"+a+"</"+c+">\n";case"list_item_start":var a="";while(f().type!=="list_item_end")a+=e.type==="text"?h():g();return"<li>"+a+"</li>\n";case"loose_item_start":var a="";while(f().type!=="list_item_end")a+=g();return"<li>"+a+"</li>\n";case"html":return p.sanitize?b.lexer(e.text):!e.pre&&!p.pedantic?b.lexer(e.text):e.text;case"paragraph":return"<p>"+b.lexer(e.text)+"</p>\n";case"text":return"<p>"+h()+"</p>\n"}},h=function(){var a=e.text,c;while((c=d[d.length-1])&&c.type==="text")a+="\n"+f().text;return b.lexer(a)},i=function(a){d=a.reverse();var b="";while(f())b+=g();return d=null,e=null,b},j=function(a,b){return a.replace(b?/&/g:/&(?!#?\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")},k=function(a){var b="",c=a.length,d=0,e;for(;d<c;d++)e=a.charCodeAt(d),Math.random()>.5&&(e="x"+e.toString(16)),b+="&#"+e+";";return b};n.exec=n;var o=function(b,c){return r(c),i(a.lexer(b))},p,q,r=function(c){c||(c=q);if(p===c)return;p=c,p.gfm?(a.fences=a.gfm.fences,a.paragraph=a.gfm.paragraph,b.text=b.gfm.text,b.url=b.gfm.url):(a.fences=a.normal.fences,a.paragraph=a.normal.paragraph,b.text=b.normal.text,b.url=b.normal.url),p.pedantic?(b.em=b.pedantic.em,b.strong=b.pedantic.strong):(b.em=b.normal.em,b.strong=b.normal.strong)};o.options=o.setOptions=function(a){q=a,r(a)},o.options({gfm:!0,pedantic:!1,sanitize:!1}),o.parser=function(a,b){return r(b),i(a)},o.lexer=function(b,c){return r(c),a.lexer(b)},o.parse=o,typeof module!="undefined"?module.exports=o:this.marked=o})).call(this);var b=a.converter={};marked.setOptions({gfm:!1}),b.convertSlideClasses=function(a){var b=/(?:^|\n)(\\)?((?:\.[a-z_-][a-z-_0-9]*)+)\s*(?:$|\n)/ig,c,d,e=["content"],f;while(f=b.exec(a.innerHTML))f[1]?d=f[0].replace(/\\/,""):(d="",c=f[2].substr(1).split("."),e=e.concat(c)),a.innerHTML=a.innerHTML.substr(0,f.index)+d+a.innerHTML.substr(f.index+f[0].length),b.lastIndex=f.index+d.length;e.length&&(a.className=e.join(" "))},b.convertContentClasses=function(a){var b=/(\\)?((?:\.[a-z_-][a-z-_0-9]*)+)\[/ig,d,e,f,g,h;while(d=b.exec(a.innerHTML)){f=c(a.innerHTML.substr(d.index+d[0].length));if(f===null)continue;d[1]?(g=d[2]+"["+f+"]",b.lastIndex=d.index+g.length):(e=d[2].substr(1).split("."),g='<span class="'+e.join(" ")+'">'+f+"</span>",b.lastIndex=d.index+('<span class="'+e.join(" ")+'">').length),h=a.innerHTML.substr(d.index+d[0].length+f.length+1),a.innerHTML=a.innerHTML.substr(0,d.index)+g+h}};var c=function(a){var b=1,c=0,d;while(b>0&&c<a.length)d=a[c++],b+=d==="["&&1||d==="]"&&-1||0;return b===0&&a.substr(0,c-1)||null};b.convertMarkdown=function(a){a.innerHTML=marked(a.innerHTML.trim(" ")),a.innerHTML=a.innerHTML.replace(/&[l|g]t;/g,function(a){return a==="&lt;"?"<":">"}),a.innerHTML=a.innerHTML.replace(/&amp;/g,"&")},b.convertCodeClasses=function(a){var b=a.getElementsByTagName("code"),c;for(c=0;c<b.length;c++)d(b[c])};var d=function(b){var c=a.config.highlightLanguage,d=a.config.highlightInline,f=b.parentNode.nodeName.toUpperCase()!=="PRE";if(e(b))return;f&&!d?b.className="no-highlight":c&&(b.className=c)},e=function(a){var b=/^(\\)?\.([a-z_-][a-z-_0-9]*)(?:\n|\ )/i,c;if(c=b.exec(a.innerHTML)){if(!c[1])return a.innerHTML=a.innerHTML.substr(c[0].length),a.className=c[2],!0;a.innerHTML=a.innerHTML.substr(c[1].length)}return!1}}(b),!function(a){var b=a.dispatcher={};b.create=function(){return c(),d(),e(),{}};var c=function(){window.onkeydown=function(a){switch(a.keyCode){case 33:case 37:case 38:case 75:g();break;case 32:case 34:case 39:case 40:case 74:f()}}},d=function(){var a=window.innerWidth,b,c,d,e=function(){return Math.abs(c-d)<10},h=function(){d<a/2?g():f()},i=function(){c>d?f():g()};document.addEventListener("touchstart",function(a){b=a.touches[0],c=b.clientX}),document.addEventListener("touchend",function(a){if(a.target.nodeName.toUpperCase()==="A")return;b=a.changedTouches[0],d=b.clientX,e()?h():i()}),document.addEventListener("touchmove",function(a){a.preventDefault()})},e=function(){document.addEventListener("mousewheel",function(a){a.wheelDeltaY>0?g():a.wheelDeltaY<0&&f()})},f=function(){a.events.emit("nextSlide")},g=function(){a.events.emit("previousSlide")}}(b),!function(a){var b=new function(){function a(a){return a.replace(/&/gm,"&amp;").replace(/</gm,"&lt;")}function c(a,b,c){return RegExp(b,"m"+(a.cI?"i":"")+(c?"g":""))}function d(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="CODE")return c;if(c.nodeType!=3||!c.nodeValue.match(/\s+/))break}}function e(a,b){var c="";for(var d=0;d<a.childNodes.length;d++)if(a.childNodes[d].nodeType==3){var f=a.childNodes[d].nodeValue;b&&(f=f.replace(/\n/g,"")),c+=f}else a.childNodes[d].nodeName=="BR"?c+="\n":c+=e(a.childNodes[d]);return/MSIE [678]/.test(navigator.userAgent)&&(c=c.replace(/\r/g,"\n")),c}function f(a){var b=a.className.split(/\s+/);b=b.concat(a.parentNode.className.split(/\s+/));for(var c=0;c<b.length;c++){var d=b[c].replace(/^language-/,"");if(p[d]||d=="no-highlight")return d}}function g(a){var b=[];return function(a,c){for(var d=0;d<a.childNodes.length;d++)a.childNodes[d].nodeType==3?c+=a.childNodes[d].nodeValue.length:a.childNodes[d].nodeName=="BR"?c+=1:(b.push({event:"start",offset:c,node:a.childNodes[d]}),c=arguments.callee(a.childNodes[d],c),b.push({event:"stop",offset:c,node:a.childNodes[d]}));return c}(a,0),b}function h(b,c,d){function h(){return b.length&&c.length?b[0].offset!=c[0].offset?b[0].offset<c[0].offset?b:c:c[0].event=="start"?b:c:b.length?b:c}function i(b){var c="<"+b.nodeName.toLowerCase();for(var d=0;d<b.attributes.length;d++){var e=b.attributes[d];c+=" "+e.nodeName.toLowerCase(),e.nodeValue!=undefined&&e.nodeValue!=0&&e.nodeValue!=null&&(c+='="'+a(e.nodeValue)+'"')}return c+">"}var e=0,f="",g=[];while(b.length||c.length){var j=h().splice(0,1)[0];f+=a(d.substr(e,j.offset-e)),e=j.offset;if(j.event=="start")f+=i(j.node),g.push(j.node);else if(j.event=="stop"){var k=g.length;do{k--;var l=g[k];f+="</"+l.nodeName.toLowerCase()+">"}while(l!=j.node);g.splice(k,1);while(k<g.length)f+=i(g[k]),k++}}return f+=d.substr(e),f}function i(){function a(d,e,f){if(d.compiled)return;f||(d.bR=c(e,d.b?d.b:"\\B|\\b"),!d.e&&!d.eW&&(d.e="\\B|\\b"),d.e&&(d.eR=c(e,d.e))),d.i&&(d.iR=c(e,d.i)),d.r==undefined&&(d.r=1),d.k&&(d.lR=c(e,d.l||b.IR,!0));for(var g in d.k){if(!d.k.hasOwnProperty(g))continue;d.k[g]instanceof Object?d.kG=d.k:d.kG={keyword:d.k};break}d.c||(d.c=[]),d.compiled=!0;for(var h=0;h<d.c.length;h++)a(d.c[h],e,!1);d.starts&&a(d.starts,e,!1)}for(var d in p){if(!p.hasOwnProperty(d))continue;a(p[d].dM,p[d],!0)}}function j(b,d){function e(a,b){for(var c=0;c<b.c.length;c++)if(b.c[c].bR.test(a))return b.c[c]}function f(a,b){if(s[a].e&&s[a].eR.test(b))return 1;if(s[a].eW){var c=f(a-1,b);return c?c+1:0}return 0}function g(a,b){return b.iR&&b.iR.test(a)}function h(a,b){var d=[];for(var e=0;e<a.c.length;e++)d.push(a.c[e].b);var f=s.length-1;do s[f].e&&d.push(s[f].e),f--;while(s[f+1].eW);return a.i&&d.push(a.i),c(b,"("+d.join("|")+")",!0)}function k(a,b){var c=s[s.length-1];c.t||(c.t=h(c,r)),c.t.lastIndex=b;var d=c.t.exec(a);return d?[a.substr(b,d.index-b),d[0],!1]:[a.substr(b),"",!0]}function l(a,b){var c=r.cI?b[0].toLowerCase():b[0];for(var d in a.kG){if(!a.kG.hasOwnProperty(d))continue;var e=a.kG[d].hasOwnProperty(c);if(e)return[d,e]}return!1}function m(b,c){if(!c.k)return a(b);var d="",e=0;c.lR.lastIndex=0;var f=c.lR.exec(b);while(f){d+=a(b.substr(e,f.index-e));var g=l(c,f);g?(u+=g[1],d+='<span class="'+g[0]+'">'+a(f[0])+"</span>"):d+=a(f[0]),e=c.lR.lastIndex,f=c.lR.exec(b)}return d+=a(b.substr(e,b.length-e)),d}function n(a,b){if(b.sL&&p[b.sL]){var c=j(b.sL,a);return u+=c.keyword_count,c.value}return m(a,b)}function o(b,c){var d=b.cN?'<span class="'+b.cN+'">':"";b.rB?(v+=d,b.buffer=""):b.eB?(v+=a(c)+d,b.buffer=""):(v+=d,b.buffer=c),s.push(b),t+=b.r}function q(b,c,d){var h=s[s.length-1];if(d)return v+=n(h.buffer+b,h),!1;var i=e(c,h);if(i)return v+=n(h.buffer+b,h),o(i,c),i.rB;var j=f(s.length-1,c);if(j){var k=h.cN?"</span>":"";h.rE?v+=n(h.buffer+b,h)+k:h.eE?v+=n(h.buffer+b,h)+k+a(c):v+=n(h.buffer+b+c,h)+k;while(j>1)k=s[s.length-2].cN?"</span>":"",v+=k,j--,s.length--;var l=s[s.length-1];return s.length--,s[s.length-1].buffer="",l.starts&&o(l.starts,""),h.rE}if(g(c,h))throw"Illegal"}i.called||(i(),i.called=!0);var r=p[b],s=[r.dM],t=0,u=0,v="";try{var w=0;r.dM.buffer="";do{var x=k(d,w),y=q(x[0],x[1],x[2]);w+=x[0].length,y||(w+=x[1].length)}while(!x[2]);if(s.length>1)throw"Illegal";return{r:t,keyword_count:u,value:v}}catch(z){if(z=="Illegal")return{r:0,keyword_count:0,value:a(d)};throw z}}function k(b){var c={keyword_count:0,r:0,value:a(b)},d=c;for(var e in p){if(!p.hasOwnProperty(e))continue;var f=j(e,b);f.language=e,f.keyword_count+f.r>d.keyword_count+d.r&&(d=f),f.keyword_count+f.r>c.keyword_count+c.r&&(d=c,c=f)}return d.language&&(c.second_best=d),c}function l(a,b,c){return b&&(a=a.replace(/^((<[^>]+>|\t)+)/gm,function(a,c,d,e){return c.replace(/\t/g,b)})),c&&(a=a.replace(/\n/g,"<br>")),a}function m(a,b,c){var d=e(a,c),i=f(a);if(i=="no-highlight")return;if(i)var m=j(i,d);else{var m=k(d);i=m.language}var n=g(a);if(n.length){var o=document.createElement("pre");o.innerHTML=m.value,m.value=h(n,g(o),d)}m.value=l(m.value,b,c);var p=a.className;p.match("(\\s|^)(language-)?"+i+"(\\s|$)")||(p=p?p+" "+i:i);if(/MSIE [678]/.test(navigator.userAgent)&&a.tagName=="CODE"&&a.parentNode.tagName=="PRE"){var o=a.parentNode,q=document.createElement("div");q.innerHTML="<pre><code>"+m.value+"</code></pre>",a=q.firstChild.firstChild,q.firstChild.cN=o.cN,o.parentNode.replaceChild(q.firstChild,o)}else a.innerHTML=m.value;a.className=p,a.result={language:i,kw:m.keyword_count,re:m.r},m.second_best&&(a.second_best={language:m.second_best.language,kw:m.second_best.keyword_count,re:m.second_best.r})}function n(){if(n.called)return;n.called=!0;var a=document.getElementsByTagName("pre");for(var c=0;c<a.length;c++){var e=d(a[c]);e&&m(e,b.tabReplace)}}function o(){window.addEventListener?(window.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",n,!1)):window.attachEvent?window.attachEvent("onload",n):window.onload=n}var p={};this.LANGUAGES=p,this.highlight=j,this.highlightAuto=k,this.fixMarkup=l,this.highlightBlock=m,this.initHighlighting=n,this.initHighlightingOnLoad=o,this.IR="[a-zA-Z][a-zA-Z0-9_]*",this.UIR="[a-zA-Z_][a-zA-Z0-9_]*",this.NR="\\b\\d+(\\.\\d+)?",this.CNR="\\b(0x[A-Za-z0-9]+|\\d+(\\.\\d+)?)",this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|\\.|-|-=|/|/=|:|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",this.BE={b:"\\\\.",r:0},this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE],r:0},this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE],r:0},this.CLCM={cN:"comment",b:"//",e:"$"},this.CBLCLM={cN:"comment",b:"/\\*",e:"\\*/"},this.HCM={cN:"comment",b:"#",e:"$"},this.NM={cN:"number",b:this.NR,r:0},this.CNM={cN:"number",b:this.CNR,r:0},this.inherit=function(a,b){var c={};for(var d in a)c[d]=a[d];if(b)for(var d in b)c[d]=b[d];return c}};b.LANGUAGES.bash=function(){var a={"true":1,"false":1},c={cN:"variable",b:"\\$([a-zA-Z0-9_]+)\\b"},d={cN:"variable",b:"\\$\\{(([^}])|(\\\\}))+\\}",c:[b.CNM]},e={cN:"string",b:'"',e:'"',i:"\\n",c:[b.BE,c,d],r:0},f={cN:"test_condition",b:"",e:"",c:[e,c,d,b.CNM],k:{literal:a},r:0};return{dM:{k:{keyword:{"if":1,then:1,"else":1,fi:1,"for":1,"break":1,"continue":1,"while":1,"in":1,"do":1,done:1,echo:1,exit:1,"return":1,set:1,declare:1},literal:a},c:[{cN:"shebang",b:"(#!\\/bin\\/bash)|(#!\\/bin\\/sh)",r:10},b.HCM,b.CNM,e,c,d,b.inherit(f,{b:"\\[ ",e:" \\]",r:0}),b.inherit(f,{b:"\\[\\[ ",e:" \\]\\]"})]}}}(),b.LANGUAGES.erlang=function(){var a="[a-z'][a-zA-Z0-9_']*",c="("+a+":"+a+"|"+a+")",d={keyword:{after:1,and:1,andalso:10,band:1,begin:1,bnot:1,bor:1,bsl:1,bzr:1,bxor:1,"case":1,"catch":1,cond:1,div:1,end:1,fun:1,let:1,not:1,of:1,orelse:10,query:1,receive:1,rem:1,"try":1,when:1,xor:1},literal:{"false":1,"true":1}},e={cN:"comment",b:"%",e:"$",r:0},f={b:"fun\\s+"+a+"/\\d+"},g={b:c+"\\(",e:"\\)",rB:!0,r:0,c:[{cN:"function_name",b:c,r:0},{b:"\\(",e:"\\)",eW:!0,rE:!0,r:0}]},h={cN:"tuple",b:"{",e:"}",r:0},i={cN:"variable",b:"\\b_([A-Z][A-Za-z0-9_]*)?",r:0},j={cN:"variable",b:"[A-Z][a-zA-Z0-9_]*",r:0},k={b:"#",e:"}",i:".",r:0,rB:!0,c:[{cN:"record_name",b:"#"+b.UIR,r:0},{b:"{",eW:!0,r:0}]},l={k:d,b:"(fun|receive|if|try|case)",e:"end"};l.c=[e,f,b.inherit(b.ASM,{cN:""}),l,g,b.QSM,b.CNM,h,i,j,k];var m=[e,f,l,g,b.QSM,b.CNM,h,i,j,k];g.c[1].c=m,h.c=m,k.c[1].c=m;var n={cN:"params",b:"\\(",e:"\\)",eW:!0,c:m};return{dM:{k:d,i:"(</|\\*=|\\+=|-=|/=|/\\*|\\*/|\\(\\*|\\*\\))",c:[{cN:"function",b:"^"+a+"\\(",e:";|\\.",rB:!0,c:[n,{cN:"title",b:a},{k:d,b:"->",eW:!0,c:m}]},e,{cN:"pp",b:"^-",e:"\\.",r:0,eE:!0,rB:!0,l:"-"+b.IR,k:{"-module":1,"-record":1,"-undef":1,"-export":1,"-ifdef":1,"-ifndef":1,"-author":1,"-copyright":1,"-doc":1,"-vsn":1,"-import":1,"-include":1,"-include_lib":1,"-compile":1,"-define":1,"-else":1,"-endif":1,"-file":1,"-behaviour":1,"-behavior":1},c:[n]},b.CNM,b.QSM,k,i,j,h]}}}(),b.LANGUAGES.cs={dM:{k:{"abstract":1,as:1,base:1,bool:1,"break":1,"byte":1,"case":1,"catch":1,"char":1,checked:1,"class":1,"const":1,"continue":1,decimal:1,"default":1,delegate:1,"do":1,"do":1,"double":1,"else":1,"enum":1,event:1,explicit:1,extern:1,"false":1,"finally":1,fixed:1,"float":1,"for":1,foreach:1,"goto":1,"if":1,implicit:1,"in":1,"int":1,"interface":1,internal:1,is:1,lock:1,"long":1,namespace:1,"new":1,"null":1,object:1,operator:1,out:1,override:1,params:1,"private":1,"protected":1,"public":1,readonly:1,ref:1,"return":1,sbyte:1,sealed:1,"short":1,sizeof:1,stackalloc:1,"static":1,string:1,struct:1,"switch":1,"this":1,"throw":1,"true":1,"try":1,"typeof":1,uint:1,ulong:1,unchecked:1,unsafe:1,ushort:1,using:1,virtual:1,"volatile":1,"void":1,"while":1,ascending:1,descending:1,from:1,get:1,group:1,into:1,join:1,let:1,orderby:1,partial:1,select:1,set:1,value:1,"var":1,where:1,yield:1},c:[{cN:"comment",b:"///",e:"$",rB:!0,c:[{cN:"xmlDocTag",b:"///|<!--|-->"},{cN:"xmlDocTag",b:"</?",e:">"}]},b.CLCM,b.CBLCLM,{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},b.ASM,b.QSM,b.CNM]}},b.LANGUAGES.ruby=function(){var a="[a-zA-Z_][a-zA-Z0-9_]*(\\!|\\?)?",c="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",d={keyword:{and:1,"false":1,then:1,defined:1,module:1,"in":1,"return":1,redo:1,"if":1,BEGIN:1,retry:1,end:1,"for":1,"true":1,self:1,when:1,next:1,until:1,"do":1,begin:1,unless:1,END:1,rescue:1,nil:1,"else":1,"break":1,undef:1,not:1,"super":1,"class":1,"case":1,require:1,yield:1,alias:1,"while":1,ensure:1,elsif:1,or:1,def:1},keymethods:{__id__:1,__send__:1,abort:1,abs:1,"all?":1,allocate:1,ancestors:1,"any?":1,arity:1,assoc:1,at:1,at_exit:1,autoload:1,"autoload?":1,"between?":1,binding:1,binmode:1,"block_given?":1,call:1,callcc:1,caller:1,capitalize:1,"capitalize!":1,casecmp:1,"catch":1,ceil:1,center:1,chomp:1,"chomp!":1,chop:1,"chop!":1,chr:1,"class":1,class_eval:1,"class_variable_defined?":1,class_variables:1,clear:1,clone:1,close:1,close_read:1,close_write:1,"closed?":1,coerce:1,collect:1,"collect!":1,compact:1,"compact!":1,concat:1,"const_defined?":1,const_get:1,const_missing:1,const_set:1,constants:1,count:1,crypt:1,"default":1,default_proc:1,"delete":1,"delete!":1,delete_at:1,delete_if:1,detect:1,display:1,div:1,divmod:1,downcase:1,"downcase!":1,downto:1,dump:1,dup:1,each:1,each_byte:1,each_index:1,each_key:1,each_line:1,each_pair:1,each_value:1,each_with_index:1,"empty?":1,entries:1,eof:1,"eof?":1,"eql?":1,"equal?":1,eval:1,exec:1,exit:1,"exit!":1,extend:1,fail:1,fcntl:1,fetch:1,fileno:1,fill:1,find:1,find_all:1,first:1,flatten:1,"flatten!":1,floor:1,flush:1,for_fd:1,foreach:1,fork:1,format:1,freeze:1,"frozen?":1,fsync:1,getc:1,gets:1,global_variables:1,grep:1,gsub:1,"gsub!":1,"has_key?":1,"has_value?":1,hash:1,hex:1,id:1,include:1,"include?":1,included_modules:1,index:1,indexes:1,indices:1,induced_from:1,inject:1,insert:1,inspect:1,instance_eval:1,instance_method:1,instance_methods:1,"instance_of?":1,"instance_variable_defined?":1,instance_variable_get:1,instance_variable_set:1,instance_variables:1,"integer?":1,intern:1,invert:1,ioctl:1,"is_a?":1,isatty:1,"iterator?":1,join:1,"key?":1,keys:1,"kind_of?":1,lambda:1,last:1,length:1,lineno:1,ljust:1,load:1,local_variables:1,loop:1,lstrip:1,"lstrip!":1,map:1,"map!":1,match:1,max:1,"member?":1,merge:1,"merge!":1,method:1,"method_defined?":1,method_missing:1,methods:1,min:1,module_eval:1,modulo:1,name:1,nesting:1,"new":1,next:1,"next!":1,"nil?":1,nitems:1,"nonzero?":1,object_id:1,oct:1,open:1,pack:1,partition:1,pid:1,pipe:1,pop:1,popen:1,pos:1,prec:1,prec_f:1,prec_i:1,print:1,printf:1,private_class_method:1,private_instance_methods:1,"private_method_defined?":1,private_methods:1,proc:1,protected_instance_methods:1,"protected_method_defined?":1,protected_methods:1,public_class_method:1,public_instance_methods:1,"public_method_defined?":1,public_methods:1,push:1,putc:1,puts:1,quo:1,raise:1,rand:1,rassoc:1,read:1,read_nonblock:1,readchar:1,readline:1,readlines:1,readpartial:1,rehash:1,reject:1,"reject!":1,remainder:1,reopen:1,replace:1,require:1,"respond_to?":1,reverse:1,"reverse!":1,reverse_each:1,rewind:1,rindex:1,rjust:1,round:1,rstrip:1,"rstrip!":1,scan:1,seek:1,select:1,send:1,set_trace_func:1,shift:1,singleton_method_added:1,singleton_methods:1,size:1,sleep:1,slice:1,"slice!":1,sort:1,"sort!":1,sort_by:1,split:1,sprintf:1,squeeze:1,"squeeze!":1,srand:1,stat:1,step:1,store:1,strip:1,"strip!":1,sub:1,"sub!":1,succ:1,"succ!":1,sum:1,superclass:1,swapcase:1,"swapcase!":1,sync:1,syscall:1,sysopen:1,sysread:1,sysseek:1,system:1,syswrite:1,taint:1,"tainted?":1,tell:1,test:1,"throw":1,times:1,to_a:1,to_ary:1,to_f:1,to_hash:1,to_i:1,to_int:1,to_io:1,to_proc:1,to_s:1,to_str:1,to_sym:1,tr:1,"tr!":1,tr_s:1,"tr_s!":1,trace_var:1,transpose:1,trap:1,truncate:1,"tty?":1,type:1,ungetc:1,uniq:1,"uniq!":1,unpack:1,unshift:1,untaint:1,untrace_var:1,upcase:1,"upcase!":1,update:1,upto:1,"value?":1,values:1,values_at:1,warn:1,write:1,write_nonblock:1,"zero?":1,zip:1}},e={cN:"yardoctag",b:"@[A-Za-z]+"},f={cN:"comment",b:"#",e:"$",c:[e]},g={cN:"comment",b:"^\\=begin",e:"^\\=end",c:[e],r:10},h={cN:"comment",b:"^__END__",e:"\\n$"},i={cN:"subst",b:"#\\{",e:"}",l:a,k:d},j=[b.BE,i],k={cN:"string",b:"'",e:"'",c:j,r:0},l={cN:"string",b:'"',e:'"',c:j,r:0},m={cN:"string",b:"%[qw]?\\(",e:"\\)",c:j,r:10},n={cN:"string",b:"%[qw]?\\[",e:"\\]",c:j,r:10},o={cN:"string",b:"%[qw]?{",e:"}",c:j,r:10},p={cN:"string",b:"%[qw]?<",e:">",c:j,r:10},q={cN:"string",b:"%[qw]?/",e:"/",c:j,r:10},r={cN:"string",b:"%[qw]?%",e:"%",c:j,r:10},s={cN:"string",b:"%[qw]?-",e:"-",c:j,r:10},t={cN:"string",b:"%[qw]?\\|",e:"\\|",c:j,r:10},u={cN:"function",b:"\\bdef\\s+",e:" |$|;",l:a,k:d,c:[{cN:"title",b:c,l:a,k:d},{cN:"params",b:"\\(",e:"\\)",l:a,k:d},f,g,h]},v={cN:"identifier",b:a,l:a,k:d,r:0},w=[f,g,h,k,l,m,n,o,p,q,r,s,t,{cN:"class",b:"\\b(class|module)\\b",e:"$|;",k:{"class":1,module:1},c:[{cN:"title",b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?",r:0},{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+b.IR+"::)?"+b.IR}]},f,g,h]},u,{cN:"constant",b:"(::)?([A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:":",c:[k,l,m,n,o,p,q,r,s,t,v],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"number",b:"\\?\\w"},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},v,{b:"("+b.RSR+")\\s*",c:[f,g,h,{cN:"regexp",b:"/",e:"/[a-z]*",i:"\\n",c:[b.BE]}],r:0}];return i.c=w,u.c[1].c=w,{dM:{l:a,k:d,c:w}}}(),b.LANGUAGES.diff={cI:!0,dM:{c:[{cN:"chunk",b:"^\\@\\@ +\\-\\d+,\\d+ +\\+\\d+,\\d+ +\\@\\@$",r:10},{cN:"chunk",b:"^\\*\\*\\* +\\d+,\\d+ +\\*\\*\\*\\*$",r:10},{cN:"chunk",b:"^\\-\\-\\- +\\d+,\\d+ +\\-\\-\\-\\-$",r:10},{cN:"header",b:"Index: ",e:"$"},{cN:"header",b:"=====",e:"=====$"},{cN:"header",b:"^\\-\\-\\-",e:"$"},{cN:"header",b:"^\\*{3} ",e:"$"},{cN:"header",b:"^\\+\\+\\+",e:"$"},{cN:"header",b:"\\*{5}",e:"\\*{5}$"},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"change",b:"^\\!",e:"$"}]}},b.LANGUAGES.rib={dM:{k:{keyword:{ArchiveRecord:1,AreaLightSource:1,Atmosphere:1,Attribute:1,AttributeBegin:1,AttributeEnd:1,Basis:1,Begin:1,Blobby:1,Bound:1,Clipping:1,ClippingPlane:1,Color:1,ColorSamples:1,ConcatTransform:1,Cone:1,CoordinateSystem:1,CoordSysTransform:1,CropWindow:1,Curves:1,Cylinder:1,DepthOfField:1,Detail:1,DetailRange:1,Disk:1,Displacement:1,Display:1,End:1,ErrorHandler:1,Exposure:1,Exterior:1,Format:1,FrameAspectRatio:1,FrameBegin:1,FrameEnd:1,GeneralPolygon:1,GeometricApproximation:1,Geometry:1,Hider:1,Hyperboloid:1,Identity:1,Illuminate:1,Imager:1,Interior:1,LightSource:1,MakeCubeFaceEnvironment:1,MakeLatLongEnvironment:1,MakeShadow:1,MakeTexture:1,Matte:1,MotionBegin:1,MotionEnd:1,NuPatch:1,ObjectBegin:1,ObjectEnd:1,ObjectInstance:1,Opacity:1,Option:1,Orientation:1,Paraboloid:1,Patch:1,PatchMesh:1,Perspective:1,PixelFilter:1,PixelSamples:1,PixelVariance:1,Points:1,PointsGeneralPolygons:1,PointsPolygons:1,Polygon:1,Procedural:1,Projection:1,Quantize:1,ReadArchive:1,RelativeDetail:1,ReverseOrientation:1,Rotate:1,Scale:1,ScreenWindow:1,ShadingInterpolation:1,ShadingRate:1,Shutter:1,Sides:1,Skew:1,SolidBegin:1,SolidEnd:1,Sphere:1,SubdivisionMesh:1,Surface:1,TextureCoordinates:1,Torus:1,Transform:1,TransformBegin:1,TransformEnd:1,TransformPoints:1,Translate:1,TrimCurve:1,WorldBegin:1,WorldEnd:1}},i:"</",c:[b.HCM,b.CNM,b.ASM,b.QSM]}},b.LANGUAGES.rsl={dM:{k:{keyword:{"float":1,color:1,point:1,normal:1,vector:1,matrix:1,"while":1,"for":1,"if":1,"do":1,"return":1,"else":1,"break":1,extern:1,"continue":1},built_in:{abs:1,acos:1,ambient:1,area:1,asin:1,atan:1,atmosphere:1,attribute:1,calculatenormal:1,ceil:1,cellnoise:1,clamp:1,comp:1,concat:1,cos:1,degrees:1,depth:1,Deriv:1,diffuse:1,distance:1,Du:1,Dv:1,environment:1,exp:1,faceforward:1,filterstep:1,floor:1,format:1,fresnel:1,incident:1,length:1,lightsource:1,log:1,match:1,max:1,min:1,mod:1,noise:1,normalize:1,ntransform:1,opposite:1,option:1,phong:1,pnoise:1,pow:1,printf:1,ptlined:1,radians:1,random:1,reflect:1,refract:1,renderinfo:1,round:1,setcomp:1,setxcomp:1,setycomp:1,setzcomp:1,shadow:1,sign:1,sin:1,smoothstep:1,specular:1,specularbrdf:1,spline:1,sqrt:1,step:1,tan:1,texture:1,textureinfo:1,trace:1,transform:1,vtransform:1,xcomp:1,ycomp:1,zcomp:1}},i:"</",c:[b.CLCM,b.CBLCLM,b.QSM,b.ASM,b.CNM,{cN:"preprocessor",b:"#",e:"$"},{cN:"shader",b:"surface |displacement |light |volume |imager ",e:"\\(",k:{surface:1,displacement:1,light:1,volume:1,imager:1}},{cN:"shading",b:"illuminate|illuminance|gather",e:"\\(",k:{illuminate:1,illuminance:1,gather:1}}]}},b.LANGUAGES.javascript={dM:{k:{keyword:{"in":1,"if":1,"for":1,"while":1,"finally":1,"var":1,"new":1,"function":1,"do":1,"return":1,"void":1,"else":1,"break":1,"catch":1,"instanceof":1,"with":1,"throw":1,"case":1,"default":1,"try":1,"this":1,"switch":1,"continue":1,"typeof":1,"delete":1},literal:{"true":1,"false":1,"null":1}},c:[b.ASM,b.QSM,b.CLCM,b.CBLCLM,b.CNM,{b:"("+b.RSR+"|case|return|throw)\\s*",k:{"return":1,"throw":1,"case":1},c:[b.CLCM,b.CBLCLM,{cN:"regexp",b:"/",e:"/[gim]*",c:[{b:"\\\\/"}]}],r:0},{cN:"function",b:"\\bfunction\\b",e:"{",k:{"function":1},c:[{cN:"title",b:"[A-Za-z$_][0-9A-Za-z$_]*"},{cN:"params",b:"\\(",e:"\\)",c:[b.ASM,b.QSM,b.CLCM,b.CBLCLM]}]}]}},b.LANGUAGES.lua=function(){var a="\\[=*\\[",c="\\]=*\\]",d={b:a,e:c};d.c=[d];var e={cN:"comment",b:"--(?!"+a+")",e:"$"},f={cN:"comment",b:"--"+a,e:c,c:[d],r:10};return{dM:{l:b.UIR,k:{keyword:{and:1,"break":1,"do":1,"else":1,elseif:1,end:1,"false":1,"for":1,"if":1,"in":1,local:1,nil:1,not:1,or:1,repeat:1,"return":1,then:1,"true":1,until:1,"while":1},built_in:{_G:1,_VERSION:1,assert:1,collectgarbage:1,dofile:1,error:1,getfenv:1,getmetatable:1,ipairs:1,load:1,loadfile:1,loadstring:1,module:1,next:1,pairs:1,pcall:1,print:1,rawequal:1,rawget:1,rawset:1,require:1,select:1,setfenv:1,setmetatable:1,tonumber:1,tostring:1,type:1,unpack:1,xpcall:1,coroutine:1,debug:1,io:1,math:1,os:1,"package":1,string:1,table:1}},c:[e,f,{cN:"function",b:"\\bfunction\\b",e:"\\)",k:{"function":1},c:[{cN:"title",b:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"},{cN:"params",b:"\\(",eW:!0,c:[e,f]},e,f]},b.CNM,b.ASM,b.QSM,{cN:"string",b:a,e:c,c:[d],r:10}]}}}(),b.LANGUAGES.css=function(){var a={cN:"function",b:b.IR+"\\(",e:"\\)",c:[{eW:!0,eE:!0,c:[b.NM,b.ASM,b.QSM]}]};return{cI:!0,dM:{i:"[=/|']",c:[b.CBLCLM,{cN:"id",b:"\\#[A-Za-z0-9_-]+"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{cN:"at_rule",b:"@(font-face|page)",l:"[a-z-]+",k:{"font-face":1,page:1}},{cN:"at_rule",b:"@",e:"[{;]",eE:!0,k:{"import":1,page:1,media:1,charset:1},c:[a,b.ASM,b.QSM,b.NM]},{cN:"tag",b:b.IR,r:0},{cN:"rules",b:"{",e:"}",i:"[^\\s]",r:0,c:[b.CBLCLM,{cN:"rule",b:"[^\\s]",rB:!0,e:";",eW:!0,c:[{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:!0,i:"[^\\s]",starts:{cN:"value",eW:!0,eE:!0,c:[a,b.NM,b.QSM,b.ASM,b.CBLCLM,{cN:"hexcolor",b:"\\#[0-9A-F]+"},{cN:"important",b:"!important"}]}}]}]}]}}}(),b.LANGUAGES.xml=function(){var a="[A-Za-z0-9\\._:-]+",b={eW:!0,c:[{cN:"attribute",b:a,r:0},{b:'="',rB:!0,e:'"',c:[{cN:"value",b:'"',eW:!0}]},{b:"='",rB:!0,e:"'",c:[{cN:"value",b:"'",eW:!0}]},{b:"=",c:[{cN:"value",b:"[^\\s/>]+"}]}]};return{cI:!0,dM:{c:[{cN:"pi",b:"<\\?",e:"\\?>",r:10},{cN:"doctype",b:"<!DOCTYPE",e:">",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"<!--",e:"-->",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"<style",e:">",k:{title:{style:1}},c:[b],starts:{cN:"css",e:"</style>",rE:!0,sL:"css"}},{cN:"tag",b:"<script",e:">",k:{title:{script:1}},c:[b],starts:{cN:"javascript",e:"</script>",rE:!0,sL:"javascript"}},{cN:"vbscript",b:"<%",e:"%>",sL:"vbscript"},{cN:"tag",b:"</?",e:"/?>",c:[{cN:"title",b:"[^ />]+"},b]}]}}}(),b.LANGUAGES.lisp=function(){var a="[a-zA-Z_\\-\\+\\*\\/\\<\\=\\>\\&\\#][a-zA-Z0-9_\\-\\+\\*\\/\\<\\=\\>\\&\\#]*",c="(\\-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s)(\\+|\\-)?\\d+)?",d={cN:"literal",b:"\\b(t{1}|nil)\\b"},e={cN:"number",b:c},f={cN:"number",b:"#b[0-1]+(/[0-1]+)?"},g={cN:"number",b:"#o[0-7]+(/[0-7]+)?"},h={cN:"number",b:"#x[0-9a-f]+(/[0-9a-f]+)?"},i={cN:"number",b:"#c\\("+c+" +"+c,e:"\\)"},j={cN:"string",b:'"',e:'"',c:[b.BE],r:0},k={cN:"comment",b:";",e:"$"},l={cN:"variable",b:"\\*",e:"\\*"},m={cN:"keyword",b:"[:&]"+a},n={b:"\\(",e:"\\)"};n.c=[n,d,e,f,g,h,i,j];var o={cN:"quoted",b:"['`]\\(",e:"\\)",c:[e,f,g,h,i,j,l,m,n]},p={cN:"quoted",b:"\\(quote ",e:"\\)",k:{title:{quote:1}},c:[e,f,g,h,i,j,l,m,n]},q={cN:"list",b:"\\(",e:"\\)"},r={cN:"body",eW:!0,eE:!0};return q.c=[{cN:"title",b:a},r],r.c=[o,p,q,d,e,f,g,h,i,j,k,l,m],{cI:!0,dM:{i:"[^\\s]",c:[d,e,f,g,h,i,j,k,o,p,q]}}}(),b.LANGUAGES.profile={dM:{c:[b.CNM,{cN:"builtin",b:"{",e:"}$",eB:!0,eE:!0,c:[b.ASM,b.QSM],r:0},{cN:"filename",b:"(/w|[a-zA-Z_][da-zA-Z_]+\\.[da-zA-Z_]{1,3})",e:":",eE:!0},{cN:"header",b:"(ncalls|tottime|cumtime)",e:"$",k:{ncalls:1,tottime:10,cumtime:10,filename:1},r:10},{cN:"summary",b:"function calls",e:"$",c:[b.CNM],r:10},b.ASM,b.QSM,{cN:"function",b:"\\(",e:"\\)$",c:[{cN:"title",b:b.UIR,r:0}],r:0}]}},b.LANGUAGES.java={dM:{k:{"false":1,"synchronized":1,"int":1,"abstract":1,"float":1,"private":1,"char":1,"interface":1,"boolean":1,"static":1,"null":1,"if":1,"const":1,"for":1,"true":1,"while":1,"long":1,"throw":1,strictfp:1,"finally":1,"protected":1,"extends":1,"import":1,"native":1,"final":1,"implements":1,"return":1,"void":1,"enum":1,"else":1,"break":1,"transient":1,"new":1,"catch":1,"instanceof":1,"byte":1,"super":1,"class":1,"volatile":1,"case":1,assert:1,"short":1,"package":1,"default":1,"double":1,"public":1,"try":1,"this":1,"switch":1,"continue":1,"throws":1},c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",c:[{cN:"javadoctag",b:"@[A-Za-z]+"}],r:10},b.CLCM,b.CBLCLM,b.ASM,b.QSM,{cN:"class",b:"(class |interface )",e:"{",k:{"class":1,"interface":1},i:":",c:[{b:"(implements|extends)",k:{"extends":1,"implements":1},r:10},{cN:"title",b:b.UIR}]},b.CNM,{cN:"annotation",b:"@[A-Za-z]+"}]}},b.LANGUAGES.php={cI:!0,dM:{k:{and:1,include_once:1,list:1,"abstract":1,global:1,"private":1,echo:1,"interface":1,as:1,"static":1,endswitch:1,array:1,"null":1,"if":1,endwhile:1,or:1,"const":1,"for":1,endforeach:1,self:1,"var":1,"while":1,isset:1,"public":1,"protected":1,exit:1,foreach:1,"throw":1,elseif:1,"extends":1,include:1,__FILE__:1,empty:1,require_once:1,"function":1,"do":1,xor:1,"return":1,"implements":1,parent:1,clone:1,use:1,__CLASS__:1,__LINE__:1,"else":1,"break":1,print:1,eval:1,"new":1,"catch":1,__METHOD__:1,"class":1,"case":1,exception:1,php_user_filter:1,"default":1,die:1,require:1,__FUNCTION__:1,enddeclare:1,"final":1,"try":1,"this":1,"switch":1,"continue":1,endfor:1,endif:1,declare:1,unset:1,"true":1,"false":1,namespace:1},c:[b.CLCM,b.HCM,{cN:"comment",b:"/\\*",e:"\\*/",c:[{cN:"phpdoc",b:"\\s@[A-Za-z]+",r:10}]},b.CNM,b.inherit(b.ASM,{i:null}),b.inherit(b.QSM,{i:null}),{cN:"variable",b:"\\$[a-zA-Z_-ÿ][a-zA-Z0-9_-ÿ]*"},{cN:"preprocessor",b:"<\\?php",r:10},{cN:"preprocessor",b:"\\?>"}]}},b.LANGUAGES.haskell=function(){var a={cN:"label",b:"\\b[A-Z][\\w']*",r:0},c={cN:"container",b:"\\(",e:"\\)",c:[{cN:"label",b:"\\b[A-Z][\\w\\(\\)\\.']*"},{cN:"title",b:"[_a-z][\\w']*"}]};return{dM:{k:{keyword:{let:1,"in":1,"if":1,then:1,"else":1,"case":1,of:1,where:1,"do":1,module:1,"import":1,hiding:1,qualified:1,type:1,data:1,newtype:1,deriving:1,"class":1,instance:1,"null":1,not:1,as:1}},c:[{cN:"comment",b:"--",e:"$"},{cN:"comment",b:"{-",e:"-}"},{cN:"string",b:"\\s+'",e:"'",c:[b.BE],r:0},b.QSM,{cN:"import",b:"\\bimport",e:"$",k:{"import":1,qualified:1,as:1,hiding:1},c:[c]},{cN:"module",b:"\\bmodule",e:"where",k:{module:1,where:1},c:[c]},{cN:"class",b:"\\b(class|instance|data|(new)?type)",e:"(where|$)",k:{"class":1,where:1,instance:1,data:1,type:1,newtype:1,deriving:1},c:[a]},b.CNM,{cN:"shebang",b:"#!\\/usr\\/bin\\/env runhaskell",e:"$"},a,{cN:"title",b:"^[_a-z][\\w']*"}]}}}(),b.LANGUAGES["1c"]=function(){var a="[a-zA-Zа-яА-Я][a-zA-Z0-9_а-яА-Я]*",c={"возврат":1,"дата":1,"для":1,"если":1,"и":1,"или":1,"иначе":1,"иначеесли":1,"исключение":1,"конецесли":1,"конецпопытки":1,"конецпроцедуры":1,"конецфункции":1,"конеццикла":1,"константа":1,"не":1,"перейти":1,"перем":1,"перечисление":1,"по":1,"пока":1,"попытка":1,"прервать":1,"продолжить":1,"процедура":1,"строка":1,"тогда":1,"фс":1,"функция":1,"цикл":1,"число":1,"экспорт":1},d={ansitooem:1,oemtoansi:1,"ввестивидсубконто":1,"ввестидату":1,"ввестизначение":1,"ввестиперечисление":1,"ввестипериод":1,"ввестиплансчетов":1,"ввестистроку":1,"ввестичисло":1,"вопрос":1,"восстановитьзначение":1,"врег":1,"выбранныйплансчетов":1,"вызватьисключение":1,"датагод":1,"датамесяц":1,"датачисло":1,"добавитьмесяц":1,"завершитьработусистемы":1,"заголовоксистемы":1,"записьжурналарегистрации":1,"запуститьприложение":1,"зафиксироватьтранзакцию":1,"значениевстроку":1,"значениевстрокувнутр":1,"значениевфайл":1,"значениеизстроки":1,"значениеизстрокивнутр":1,"значениеизфайла":1,"имякомпьютера":1,"имяпользователя":1,"каталогвременныхфайлов":1,"каталогиб":1,"каталогпользователя":1,"каталогпрограммы":1,"кодсимв":1,"командасистемы":1,"конгода":1,"конецпериодаби":1,"конецрассчитанногопериодаби":1,"конецстандартногоинтервала":1,"конквартала":1,"конмесяца":1,"коннедели":1,"лев":1,"лог":1,"лог10":1,"макс":1,"максимальноеколичествосубконто":1,"мин":1,"монопольныйрежим":1,"названиеинтерфейса":1,"названиенабораправ":1,"назначитьвид":1,"назначитьсчет":1,"найти":1,"найтипомеченныенаудаление":1,"найтиссылки":1,"началопериодаби":1,"началостандартногоинтервала":1,"начатьтранзакцию":1,"начгода":1,"начквартала":1,"начмесяца":1,"начнедели":1,"номерднягода":1,"номерднянедели":1,"номернеделигода":1,"нрег":1,"обработкаожидания":1,"окр":1,"описаниеошибки":1,"основнойжурналрасчетов":1,"основнойплансчетов":1,"основнойязык":1,"открытьформу":1,"открытьформумодально":1,"отменитьтранзакцию":1,"очиститьокносообщений":1,"периодстр":1,"полноеимяпользователя":1,"получитьвремята":1,"получитьдатута":1,"получитьдокументта":1,"получитьзначенияотбора":1,"получитьпозициюта":1,"получитьпустоезначение":1,"получитьта":1,"прав":1,"праводоступа":1,"предупреждение":1,"префиксавтонумерации":1,"пустаястрока":1,"пустоезначение":1,"рабочаядаттьпустоезначение":1,"получитьта":1,"прав":1,"праводоступа":1,"предупреждение":1,"префиксавтонумерации":1,"пустаястрока":1,"пустоезначение":1,"рабочаядата":1,"разделительстраниц":1,"разделительстрок":1,"разм":1,"разобратьпозициюдокумента":1,"рассчитатьрегистрына":1,"рассчитатьрегистрыпо":1,"сигнал":1,"симв":1,"символтабуляции":1,"создатьобъект":1,"сокрл":1,"сокрлп":1,"сокрп":1," сообщить":1,"состояние":1,"сохранитьзначение":1,"сред":1,"статусвозврата":1,"стрдлина":1,"стрзаменить":1,"стрколичествострок":1,"стрполучитьстроку":1," стрчисловхождений":1,"сформироватьпозициюдокумента":1,"счетпокоду":1,"текущаядата":1,"текущеевремя":1,"типзначения":1,"типзначениястр":1,"удалитьобъекты":1,"установитьтана":1,"установитьтапо":1,"фиксшаблон":1,"формат":1,"цел":1,"шаблон":1},e={cN:"dquote",b:'""'},f={cN:"string",b:'"',e:'"|$',c:[e],r:0},g={cN:"string",b:"\\|",e:'"|$',c:[e]};return{cI:!0,dM:{l:a,k:{keyword:c,built_in:d},c:[b.CLCM,b.NM,f,g,{cN:"function",b:"(процедура|функция)",e:"$",l:a,k:{"процедура":1,"экспорт":1,"функция":1},c:[{cN:"title",b:a},{cN:"tail",eW:!0,c:[{cN:"params",b:"\\(",e:"\\)",l:a,k:{"знач":1},c:[f,g]},{cN:"export",b:"экспорт",eW:!0,l:a,k:{"экспорт":1},c:[b.CLCM]}]},b.CLCM]},{cN:"preprocessor",b:"#",e:"$"},{cN:"date",b:"'\\d{2}\\.\\d{2}\\.(\\d{2}|\\d{4})'"}]}}}(),b.LANGUAGES.python=function(){var a={cN:"string",b:"(u|b)?r?'''",e:"'''",r:10},c={cN:"string",b:'(u|b)?r?"""',e:'"""',r:10},d={cN:"string",b:"(u|r|ur|b|br)'",e:"'",c:[b.BE],r:10},e={cN:"string",b:'(u|r|ur|b|br)"',e:'"',c:[b.BE],r:10},f={cN:"title",b:b.UIR},g={cN:"params",b:"\\(",e:"\\)",c:[a,c,d,e,b.ASM,b.QSM]};return{dM:{k:{keyword:{and:1,elif:1,is:1,global:1,as:1,"in":1,"if":1,from:1,raise:1,"for":1,except:1,"finally":1,print:1,"import":1,pass:1,"return":1,exec:1,"else":1,"break":1,not:1,"with":1,"class":1,assert:1,yield:1,"try":1,"while":1,"continue":1,del:1,or:1,def:1,lambda:1,nonlocal:10},built_in:{None:1,True:1,False:1,Ellipsis:1,NotImplemented:1}},i:"(</|->|\\?)",c:[b.HCM,a,c,d,e,b.ASM,b.QSM,{cN:"function",b:"\\bdef ",e:":",i:"$",k:{def:1},c:[f,g],r:10},{cN:"class",b:"\\bclass ",e:":",i:"[${]",k:{"class":1},c:[f,g],r:10},b.CNM,{cN:"decorator",b:"@",e:"$"}]}}}(),b.LANGUAGES.smalltalk=function(){var a="[a-z][a-zA-Z0-9_]*",c={cN:"char",b:"\\$.{1}"},d={cN:"symbol",b:"#"+b.UIR};return{dM:{k:{self:1,"super":1,nil:1,"true":1,"false":1,thisContext:1},c:[{cN:"comment",b:'"',e:'"',r:0},b.ASM,{cN:"class",b:"\\b[A-Z][A-Za-z0-9_]*",r:0},{cN:"method",b:a+":"},b.CNM,d,c,{cN:"localvars",b:"\\|\\s*(("+a+")\\s*)+\\|"},{cN:"array",b:"\\#\\(",e:"\\)",c:[b.ASM,c,b.CNM,d]}]}}}(),b.LANGUAGES.tex=function(){var a={cN:"command",b:"\\\\[a-zA-Zа-яА-я]+[\\*]?",r:10},b={cN:"command",b:"\\\\[^a-zA-Zа-яА-я0-9]",r:0},c={cN:"special",b:"[{}\\[\\]\\&#~]",r:0};return{dM:{c:[{b:"\\\\[a-zA-Zа-яА-я]+[\\*]? *= *-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?",rB:!0,c:[a,b,{cN:"number",b:" *=",e:"-?\\d*\\.?\\d+(pt|pc|mm|cm|in|dd|cc|ex|em)?",eB:!0}],r:10},a,b,c,{cN:"formula",b:"\\$\\$",e:"\\$\\$",c:[a,b,c],r:0},{cN:"formula",b:"\\$",e:"\\$",c:[a,b,c],r:0},{cN:"comment",b:"%",e:"$",r:0}]}}}(),b.LANGUAGES.sql={cI:!0,dM:{i:"[^\\s]",c:[{cN:"operator",b:"(begin|start|commit|rollback|savepoint|lock|alter|create|drop|rename|call|delete|do|handler|insert|load|replace|select|truncate|update|set|show|pragma)\\b",e:";|$",k:{keyword:{all:1,partial:1,global:1,month:1,current_timestamp:1,using:1,go:1,revoke:1,smallint:1,indicator:1,"end-exec":1,disconnect:1,zone:1,"with":1,character:1,assertion:1,to:1,add:1,current_user:1,usage:1,input:1,local:1,alter:1,match:1,collate:1,real:1,then:1,rollback:1,get:1,read:1,timestamp:1,session_user:1,not:1,integer:1,bit:1,unique:1,day:1,minute:1,desc:1,insert:1,execute:1,like:1,ilike:2,level:1,decimal:1,drop:1,"continue":1,isolation:1,found:1,where:1,constraints:1,domain:1,right:1,national:1,some:1,module:1,transaction:1,relative:1,second:1,connect:1,escape:1,close:1,system_user:1,"for":1,deferred:1,section:1,cast:1,current:1,sqlstate:1,allocate:1,intersect:1,deallocate:1,numeric:1,"public":1,preserve:1,full:1,"goto":1,initially:1,asc:1,no:1,key:1,output:1,collation:1,group:1,by:1,union:1,session:1,both:1,last:1,language:1,constraint:1,column:1,of:1,space:1,foreign:1,deferrable:1,prior:1,connection:1,unknown:1,action:1,commit:1,view:1,or:1,first:1,into:1,"float":1,year:1,primary:1,cascaded:1,except:1,restrict:1,set:1,references:1,names:1,table:1,outer:1,open:1,select:1,size:1,are:1,rows:1,from:1,prepare:1,distinct:1,leading:1,create:1,only:1,next:1,inner:1,authorization:1,schema:1,corresponding:1,option:1,declare:1,precision:1,immediate:1,"else":1,timezone_minute:1,external:1,varying:1,translation:1,"true":1,"case":1,exception:1,join:1,hour:1,"default":1,"double":1,scroll:1,value:1,cursor:1,descriptor:1,values:1,dec:1,fetch:1,procedure:1,"delete":1,and:1,"false":1,"int":1,is:1,describe:1,"char":1,as:1,at:1,"in":1,varchar:1,"null":1,trailing:1,any:1,absolute:1,current_time:1,end:1,grant:1,privileges:1,when:1,cross:1,check:1,write:1,current_date:1,pad:1,begin:1,temporary:1,exec:1,time:1,update:1,catalog:1,user:1,sql:1,date:1,on:1,identity:1,timezone_hour:1,natural:1,whenever:1,interval:1,work:1,order:1,cascade:1,diagnostics:1,nchar:1,having:1,left:1,call:1,"do":1,handler:1,load:1,replace:1,truncate:1,start:1,lock:1,show:1,pragma:1},aggregate:{count:1,sum:1,min:1,max:1,avg:1}},c:[{cN:"string",b:"'",e:"'",c:[b.BE,{b:"''"}],r:0},{cN:"string",b:'"',e:'"',c:[b.BE,{b:'""'}],r:0},{cN:"string",b:"`",e:"`",c:[b.BE]},b.CNM,{b:"\\n"}]},b.CBLCLM,{cN:"comment",b:"--",e:"$"}]}},b.LANGUAGES.vala={dM:{k:{keyword:{"char":1,uchar:1,unichar:1,"int":1,uint:1,"long":1,ulong:1,"short":1,ushort:1,int8:1,int16:1,int32:1,int64:1,uint8:1,uint16:1,uint32:1,uint64:1,"float":1,"double":1,bool:1,struct:1,"enum":1,string:1,"void":1,weak:5,unowned:5,owned:5,async:5,signal:5,"static":1,"abstract":1,"interface":1,override:1,"while":1,"do":1,"for":1,foreach:1,"else":1,"switch":1,"case":1,"break":1,"default":1,"return":1,"try":1,"catch":1,"public":1,"private":1,"protected":1,internal:1,using:1,"new":1,"this":1,get:1,set:1,"const":1,stdout:1,stdin:1,stderr:1,"var":1,DBus:2,GLib:2,CCode:10,Gee:10,Object:1},literal:{"false":1,"true":1,"null":1}},c:[{cN:"class",b:"(class |interface |delegate |namespace )",e:"{",k:{"class":1,"interface":1},c:[{b:"(implements|extends)",e:b.IMMEDIATE_RE,k:{"extends":1,"implements":1},r:1},{cN:"title",b:b.UIR,e:b.IMMEDIATE_RE}]},b.CLCM,b.CBLCLM,{cN:"string",b:'"""',e:'"""',r:5},b.ASM,b.QSM,b.CNM,{cN:"preprocessor",b:"^#",e:"$",r:2},{cN:"constant",b:" [A-Z_]+ ",e:b.IMMEDIATE_RE,r:0}]}},b.LANGUAGES.ini={cI:!0,dM:{i:"[^\\s]",c:[{cN:"comment",b:";",e:"$"},{cN:"title",b:"^\\[",e:"\\]"},{cN:"setting",b:"^[a-z0-9_\\[\\]]+[ \\t]*=[ \\t]*",e:"$",c:[{cN:"value",eW:!0,k:{on:1,off:1,"true":1,"false":1,yes:1,no:1},c:[b.QSM,b.NM]}]}]}},b.LANGUAGES.axapta={dM:{k:{"false":1,"int":1,"abstract":1,"private":1,"char":1,"interface":1,"boolean":1,"static":1,"null":1,"if":1,"for":1,"true":1,"while":1,"long":1,"throw":1,"finally":1,"protected":1,"extends":1,"final":1,"implements":1,"return":1,"void":1,"enum":1,"else":1,"break":1,"new":1,"catch":1,"byte":1,"super":1,"class":1,"case":1,"short":1,"default":1,"double":1,"public":1,"try":1,"this":1,"switch":1,"continue":1,reverse:1,firstfast:1,firstonly:1,forupdate:1,nofetch:1,sum:1,avg:1,minof:1,maxof:1,count:1,order:1,group:1,by:1,asc:1,desc:1,index:1,hint:1,like:1,dispaly:1,edit:1,client:1,server:1,ttsbegin:1,ttscommit:1,str:1,real:1,date:1,container:1,anytype:1,common:1,div:1,mod:1},c:[b.CLCM,b.CBLCLM,b.ASM,b.QSM,b.CNM,{cN:"preprocessor",b:"#",e:"$"},{cN:"class",b:"(class |interface )",e:"{",i:":",k:{"class":1,"interface":1},c:[{cN:"inheritance",b:"(implements|extends)",k:{"extends":1,"implements":1},r:10},{cN:"title",b:b.UIR}]}]}},b.LANGUAGES.perl=function(){var a={getpwent:1,getservent:1,quotemeta:1,msgrcv:1,scalar:1,kill:1,dbmclose:1,undef:1,lc:1,ma:1,syswrite:1,tr:1,send:1,umask:1,sysopen:1,shmwrite:1,vec:1,qx:1,utime:1,local:1,oct:1,semctl:1,localtime:1,readpipe:1,"do":1,"return":1,format:1,read:1,sprintf:1,dbmopen:1,pop:1,getpgrp:1,not:1,getpwnam:1,rewinddir:1,qq:1,fileno:1,qw:1,endprotoent:1,wait:1,sethostent:1,bless:1,s:1,opendir:1,"continue":1,each:1,sleep:1,endgrent:1,shutdown:1,dump:1,chomp:1,connect:1,getsockname:1,die:1,socketpair:1,close:1,flock:1,exists:1,index:1,shmget:1,sub:1,"for":1,endpwent:1,redo:1,lstat:1,msgctl:1,setpgrp:1,abs:1,exit:1,select:1,print:1,ref:1,gethostbyaddr:1,unshift:1,fcntl:1,syscall:1,"goto":1,getnetbyaddr:1,join:1,gmtime:1,symlink:1,semget:1,splice:1,x:1,getpeername:1,recv:1,log:1,setsockopt:1,cos:1,last:1,reverse:1,gethostbyname:1,getgrnam:1,study:1,formline:1,endhostent:1,times:1,chop:1,length:1,gethostent:1,getnetent:1,pack:1,getprotoent:1,getservbyname:1,rand:1,mkdir:1,pos:1,chmod:1,y:1,substr:1,endnetent:1,printf:1,next:1,open:1,msgsnd:1,readdir:1,use:1,unlink:1,getsockopt:1,getpriority:1,rindex:1,wantarray:1,hex:1,system:1,getservbyport:1,endservent:1,"int":1,chr:1,untie:1,rmdir:1,prototype:1,tell:1,listen:1,fork:1,shmread:1,ucfirst:1,setprotoent:1,"else":1,sysseek:1,link:1,getgrgid:1,shmctl:1,waitpid:1,unpack:1,getnetbyname:1,reset:1,chdir:1,grep:1,split:1,require:1,caller:1,lcfirst:1,until:1,warn:1,"while":1,values:1,shift:1,telldir:1,getpwuid:1,my:1,getprotobynumber:1,"delete":1,and:1,sort:1,uc:1,defined:1,srand:1,accept:1,"package":1,seekdir:1,getprotobyname:1,semop:1,our:1,rename:1,seek:1,"if":1,q:1,chroot:1,sysread:1,setpwent:1,no:1,crypt:1,getc:1,chown:1,sqrt:1,write:1,setnetent:1,setpriority:1,foreach:1,tie:1,sin:1,msgget:1,map:1,stat:1,getlogin:1,unless:1,elsif:1,truncate:1,exec:1,keys:1,glob:1,tied:1,closedir:1,ioctl:1,socket:1,readlink:1,eval:1,xor:1,readline:1,binmode:1,setservent:1,eof:1,ord:1,bind:1,alarm:1,pipe:1,atan2:1,getgrent:1,exp:1,time:1,push:1,setgrent:1,gt:1,lt:1,or:1,ne:1,m:1},c={cN:"subst",b:"[$@]\\{",e:"}",k:a,r:10},d={cN:"variable",b:"\\$\\d"},e={cN:"variable",b:"[\\$\\%\\@\\*](\\^\\w\\b|#\\w+(\\:\\:\\w+)*|[^\\s\\w{]|{\\w+}|\\w+(\\:\\:\\w*)*)"},f=[b.BE,c,d,e],g={b:"->",c:[{b:b.IR},{b:"{",e:"}"}]},h=[d,e,b.HCM,{cN:"comment",b:"^(__END__|__DATA__)",e:"\\n$",r:5},g,{cN:"string",b:"q[qwxr]?\\s*\\(",e:"\\)",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\[",e:"\\]",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\{",e:"\\}",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\|",e:"\\|",c:f,r:5},{cN:"string",b:"q[qwxr]?\\s*\\<",e:"\\>",c:f,r:5},{cN:"string",b:"qw\\s+q",e:"q",c:f,r:5},{cN:"string",b:"'",e:"'",c:[b.BE],r:0},{cN:"string",b:'"',e:'"',c:f,r:0},{cN:"string",b:"`",e:"`",c:[b.BE]},{cN:"string",b:"{\\w+}",r:0},{cN:"string",b:"-?\\w+\\s*\\=\\>",r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[b.BE],r:0},{cN:"sub",b:"\\bsub\\b",e:"(\\s*\\(.*?\\))?[;{]",k:{sub:1},r:5},{cN:"operator",b:"-\\w\\b",r:0},{cN:"pod",b:"\\=\\w",e:"\\=cut"}];return c.c=h,g.c[1].c=h,{dM:{k:a,c:h}}}(),b.LANGUAGES.scala=function(){var a={cN:"annotation",b:"@[A-Za-z]+"},c={cN:"string",b:'u?r?"""',e:'"""',r:10};return{dM:{k:{type:1,yield:1,lazy:1,override:1,def:1,"with":1,val:1,"var":1,"false":1,"true":1,sealed:1,"abstract":1,"private":1,trait:1,object:1,"null":1,"if":1,"for":1,"while":1,"throw":1,"finally":1,"protected":1,"extends":1,"import":1,"final":1,"return":1,"else":1,"break":1,"new":1,"catch":1,"super":1,"class":1,"case":1,"package":1,"default":1,"try":1,"this":1,match:1,"continue":1,"throws":1},c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",c:[{cN:"javadoctag",b:"@[A-Za-z]+"}],r:10},b.CLCM,b.CBLCLM,b.ASM,b.QSM,c,{cN:"class",b:"((case )?class |object |trait )",e:"({|$)",i:":",k:{"case":1,"class":1,trait:1,object:1},c:[{b:"(extends|with)",k:{"extends":1,"with":1},r:10},{cN:"title",b:b.UIR},{cN:"params",b:"\\(",e:"\\)",c:[b.ASM,b.QSM,c,a]}]},b.CNM,a]}}}(),b.LANGUAGES.cmake={cI:!0,dM:{k:{add_custom_command:2,add_custom_target:2,add_definitions:2,add_dependencies:2,add_executable:2,add_library:2,add_subdirectory:2,add_executable:2,add_library:2,add_subdirectory:2,add_test:2,aux_source_directory:2,"break":1,build_command:2,cmake_minimum_required:3,cmake_policy:3,configure_file:1,create_test_sourcelist:1,define_property:1,"else":1,elseif:1,enable_language:2,enable_testing:2,endforeach:1,endfunction:1,endif:1,endmacro:1,endwhile:1,execute_process:2,"export":1,find_file:1,find_library:2,find_package:2,find_path:1,find_program:1,fltk_wrap_ui:2,foreach:1,"function":1,get_cmake_property:3,get_directory_property:1,get_filename_component:1,get_property:1,get_source_file_property:1,get_target_property:1,get_test_property:1,"if":1,include:1,include_directories:2,include_external_msproject:1,include_regular_expression:2,install:1,link_directories:1,load_cache:1,load_command:1,macro:1,mark_as_advanced:1,message:1,option:1,output_required_files:1,project:1,qt_wrap_cpp:2,qt_wrap_ui:2,remove_definitions:2,"return":1,separate_arguments:1,set:1,set_directory_properties:1,set_property:1,set_source_files_properties:1,set_target_properties:1,set_tests_properties:1,site_name:1,source_group:1,string:1,target_link_libraries:2,try_compile:2,try_run:2,unset:1,variable_watch:2,"while":1,build_name:1,exec_program:1,export_library_dependencies:1,install_files:1,install_programs:1,install_targets:1,link_libraries:1,make_directory:1,remove:1,subdir_depends:1,subdirs:1,use_mangled_mesa:1,utility_source:1,variable_requires:1,write_file:1},c:[{cN:"envvar",b:"\\${",e:"}"},b.HCM,b.QSM,b.NM]}},b.LANGUAGES.objectivec=function(){var a={keyword:{"false":1,"int":1,"float":1,"while":1,"private":1,"char":1,"catch":1,"export":1,sizeof:2,typedef:2,"const":1,struct:1,"for":1,union:1,unsigned:1,"long":1,"volatile":2,"static":1,"protected":1,bool:1,mutable:1,"if":1,"public":1,"do":1,"return":1,"goto":1,"void":2,"enum":1,"else":1,"break":1,extern:1,"true":1,"class":1,asm:1,"case":1,"short":1,"default":1,"double":1,"throw":1,register:1,explicit:1,signed:1,typename:1,"try":1,"this":1,"switch":1,"continue":1,wchar_t:1,inline:1,readonly:1,assign:1,property:1,protocol:10,self:1,"synchronized":1,end:1,synthesize:50,id:1,optional:1,required:1,implementation:10,nonatomic:1,"interface":1,"super":1,unichar:1,"finally":2,dynamic:2,nil:1},built_in:{YES:5,NO:5,NULL:1,IBOutlet:50,IBAction:50,NSString:50,NSDictionary:50,CGRect:50,CGPoint:50,NSRange:50,release:1,retain:1,autorelease:50,UIButton:50,UILabel:50,UITextView:50,UIWebView:50,MKMapView:50,UISegmentedControl:50,NSObject:50,UITableViewDelegate:50,UITableViewDataSource:50,NSThread:50,UIActivityIndicator:50,UITabbar:50,UIToolBar:50,UIBarButtonItem:50,UIImageView:50,NSAutoreleasePool:50,UITableView:50,BOOL:1,NSInteger:20,CGFloat:20,NSException:50,NSLog:50,NSMutableString:50,NSMutableArray:50,NSMutableDictionary:50,NSURL:50}};return{dM:{k:a,i:"</",c:[b.CLCM,b.CBLCLM,b.CNM,b.QSM,{cN:"string",b:"'",e:"[^\\\\]'",i:"[^\\\\][^']"},{cN:"preprocessor",b:"#import",e:"$",c:[{cN:"title",b:'"',e:'"'},{cN:"title",b:"<",e:">"}]},{cN:"preprocessor",b:"#",e:"$"},{cN:"class",b:"interface|class|protocol|implementation",e:"({|$)",k:{"interface":1,"class":1,protocol:5,implementation:5},c:[{cN:"id",b:b.UIR}]}]}}}(),b.LANGUAGES.avrasm={cI:!0,dM:{k:{keyword:{adc:1,add:1,adiw:1,and:1,andi:1,asr:1,bclr:1,bld:1,brbc:1,brbs:1,brcc:1,brcs:1,"break":1,breq:1,brge:1,brhc:1,brhs:1,brid:1,brie:1,brlo:1,brlt:1,brmi:1,brne:1,brpl:1,brsh:1,brtc:1,brts:1,brvc:1,brvs:1,bset:1,bst:1,call:1,cbi:1,cbr:1,clc:1,clh:1,cli:1,cln:1,clr:1,cls:1,clt:1,clv:1,clz:1,com:1,cp:1,cpc:1,cpi:1,cpse:1,dec:1,eicall:1,eijmp:1,elpm:1,eor:1,fmul:1,fmuls:1,fmulsu:1,icall:1,ijmp:1,"in":1,inc:1,jmp:1,ld:1,ldd:1,ldi:1,lds:1,lpm:1,lsl:1,lsr:1,mov:1,movw:1,mul:1,muls:1,mulsu:1,neg:1,nop:1,or:1,ori:1,out:1,pop:1,push:1,rcall:1,ret:1,reti:1,rjmp:1,rol:1,ror:1,sbc:1,sbr:1,sbrc:1,sbrs:1,sec:1,seh:1,sbi:1,sbci:1,sbic:1,sbis:1,sbiw:1,sei:1,sen:1,ser:1,ses:1,set:1,sev:1,sez:1,sleep:1,spm:1,st:1,std:1,sts:1,sub:1,subi:1,swap:1,tst:1,wdr:1},built_in:{r0:1,r1:1,r2:1,r3:1,r4:1,r5:1,r6:1,r7:1,r8:1,r9:1,r10:1,r11:1,r12:1,r13:1,r14:1,r15:1,r16:1,r17:1,r18:1,r19:1,r20:1,r21:1,r22:1,r23:1,r24:1,r25:1,r26:1,r27:1,r28:1,r29:1,r30:1,r31:1,x:1,xh:1,xl:1,y:1,yh:1,yl:1,z:1,zh:1,zl:1,ucsr1c:1,udr1:1,ucsr1a:1,ucsr1b:1,ubrr1l:1,ubrr1h:1,ucsr0c:1,ubrr0h:1,tccr3c:1,tccr3a:1,tccr3b:1,tcnt3h:1,tcnt3l:1,ocr3ah:1,ocr3al:1,ocr3bh:1,ocr3bl:1,ocr3ch:1,ocr3cl:1,icr3h:1,icr3l:1,etimsk:1,etifr:1,tccr1c:1,ocr1ch:1,ocr1cl:1,twcr:1,twdr:1,twar:1,twsr:1,twbr:1,osccal:1,xmcra:1,xmcrb:1,eicra:1,spmcsr:1,spmcr:1,portg:1,ddrg:1,ping:1,portf:1,ddrf:1,sreg:1,sph:1,spl:1,xdiv:1,rampz:1,eicrb:1,eimsk:1,gimsk:1,gicr:1,eifr:1,gifr:1,timsk:1,tifr:1,mcucr:1,mcucsr:1,tccr0:1,tcnt0:1,ocr0:1,assr:1,tccr1a:1,tccr1b:1,tcnt1h:1,tcnt1l:1,ocr1ah:1,ocr1al:1,ocr1bh:1,ocr1bl:1,icr1h:1,icr1l:1,tccr2:1,tcnt2:1,ocr2:1,ocdr:1,wdtcr:1,sfior:1,eearh:1,eearl:1,eedr:1,eecr:1,porta:1,ddra:1,pina:1,portb:1,ddrb:1,pinb:1,portc:1,ddrc:1,pinc:1,portd:1,ddrd:1,pind:1,spdr:1,spsr:1,spcr:1,udr0:1,ucsr0a:1,ucsr0b:1,ubrr0l:1,acsr:1,admux:1,adcsr:1,adch:1,adcl:1,porte:1,ddre:1,pine:1,pinf:1}},c:[b.CBLCLM,{cN:"comment",b:";",e:"$"},b.CNM,b.QSM,{cN:"string",b:"'",e:"[^\\\\]'",i:"[^\\\\][^']"},{cN:"label",b:"^[A-Za-z0-9_.$]+:"},{cN:"preprocessor",b:"#",e:"$"},{cN:"preprocessor",b:"\\.[a-zA-Z]+"},{cN:"localvars",b:"@[0-9]+"}]}},b.LANGUAGES.vhdl={cI:!0,dM:{k:{keyword:{abs:1,access:1,after:1,alias:1,all:1,and:1,architecture:2,array:1,assert:1,attribute:1,begin:1,block:1,body:1,buffer:1,bus:1,"case":1,component:2,configuration:1,constant:1,disconnect:2,downto:2,"else":1,elsif:1,end:1,entity:2,exit:1,file:1,"for":1,"function":1,generate:2,generic:2,group:1,guarded:2,"if":0,impure:2,"in":1,inertial:1,inout:1,is:1,label:1,library:1,linkage:1,literal:1,loop:1,map:1,mod:1,nand:1,"new":1,next:1,nor:1,not:1,"null":1,of:1,on:1,open:1,or:1,others:1,out:1,"package":1,port:2,postponed:1,procedure:1,process:1,pure:2,range:1,record:1,register:1,reject:1,"return":1,rol:1,ror:1,select:1,severity:1,signal:1,shared:1,sla:1,sli:1,sra:1,srl:1,subtype:2,then:1,to:1,transport:1,type:1,units:1,until:1,use:1,variable:1,wait:1,when:1,"while":1,"with":1,xnor:1,xor:1},type:{"boolean":1,bit:1,character:1,severity_level:2,integer:1,time:1,delay_length:2,natural:1,positive:1,string:1,bit_vector:2,file_open_kind:2,file_open_status:2,std_ulogic:2,std_ulogic_vector:2,std_logic:2,std_logic_vector:2}},c:[{cN:"comment",b:"--",e:"$"},b.QSM,b.CNM,{cN:"literal",b:"'(U|X|0|1|Z|W|L|H|-)",e:"'",c:[b.BE],r:5}]}},b.LANGUAGES.nginx=function(){var a={cN:"variable",b:"\\$\\d+"},c={cN:"variable",b:"\\${",e:"}"},d={cN:"variable",b:"[\\$\\@]"+b.UIR};return{dM:{c:[b.HCM,{b:b.UIR,e:";|{",rE:!0,k:{accept_mutex:1,accept_mutex_delay:1,access_log:1,add_after_body:1,add_before_body:1,add_header:1,addition_types:1,alias:1,allow:1,ancient_browser:1,ancient_browser:1,ancient_browser_value:1,ancient_browser_value:1,auth_basic:1,auth_basic_user_file:1,autoindex:1,autoindex_exact_size:1,autoindex_localtime:1,"break":1,charset:1,charset:1,charset_map:1,charset_map:1,charset_types:1,charset_types:1,client_body_buffer_size:1,client_body_in_file_only:1,client_body_in_single_buffer:1,client_body_temp_path:1,client_body_timeout:1,client_header_buffer_size:1,client_header_timeout:1,client_max_body_size:1,connection_pool_size:1,connections:1,create_full_put_path:1,daemon:1,dav_access:1,dav_methods:1,debug_connection:1,debug_points:1,default_type:1,deny:1,directio:1,directio_alignment:1,echo:1,echo_after_body:1,echo_before_body:1,echo_blocking_sleep:1,echo_duplicate:1,echo_end:1,echo_exec:1,echo_flush:1,echo_foreach_split:1,echo_location:1,echo_location_async:1,echo_read_request_body:1,echo_request_body:1,echo_reset_timer:1,echo_sleep:1,echo_subrequest:1,echo_subrequest_async:1,empty_gif:1,empty_gif:1,env:1,error_log:1,error_log:1,error_page:1,events:1,expires:1,fastcgi_bind:1,fastcgi_buffer_size:1,fastcgi_buffers:1,fastcgi_busy_buffers_size:1,fastcgi_cache:1,fastcgi_cache_key:1,fastcgi_cache_methods:1,fastcgi_cache_min_uses:1,fastcgi_cache_path:1,fastcgi_cache_use_stale:1,fastcgi_cache_valid:1,fastcgi_catch_stderr:1,fastcgi_connect_timeout:1,fastcgi_hide_header:1,fastcgi_ignore_client_abort:1,fastcgi_ignore_headers:1,fastcgi_index:1,fastcgi_intercept_errors:1,fastcgi_max_temp_file_size:1,fastcgi_next_upstream:1,fastcgi_param:1,fastcgi_pass:1,fastcgi_pass_header:1,fastcgi_pass_request_body:1,fastcgi_pass_request_headers:1,fastcgi_read_timeout:1,fastcgi_send_lowat:1,fastcgi_send_timeout:1,fastcgi_split_path_info:1,fastcgi_store:1,fastcgi_store_access:1,fastcgi_temp_file_write_size:1,fastcgi_temp_path:1,fastcgi_upstream_fail_timeout:1,fastcgi_upstream_max_fails:1,flv:1,geo:1,geo:1,geoip_city:1,geoip_country:1,gzip:1,gzip_buffers:1,gzip_comp_level:1,gzip_disable:1,gzip_hash:1,gzip_http_version:1,gzip_min_length:1,gzip_no_buffer:1,gzip_proxied:1,gzip_static:1,gzip_types:1,gzip_vary:1,gzip_window:1,http:1,"if":1,if_modified_since:1,ignore_invalid_headers:1,image_filter:1,image_filter_buffer:1,image_filter_jpeg_quality:1,image_filter_transparency:1,include:1,index:1,internal:1,ip_hash:1,js:1,js_load:1,js_require:1,js_utf8:1,keepalive_requests:1,keepalive_timeout:1,kqueue_changes:1,kqueue_events:1,large_client_header_buffers:1,limit_conn:1,limit_conn_log_level:1,limit_except:1,limit_rate:1,limit_rate_after:1,limit_req:1,limit_req_log_level:1,limit_req_zone:1,limit_zone:1,lingering_time:1,lingering_timeout:1,listen:1,location:1,lock_file:1,log_format:1,log_not_found:1,log_subrequest:1,map:1,map_hash_bucket_size:1,map_hash_max_size:1,master_process:1,memcached_bind:1,memcached_buffer_size:1,memcached_connect_timeout:1,memcached_next_upstream:1,memcached_pass:1,memcached_read_timeout:1,memcached_send_timeout:1,memcached_upstream_fail_timeout:1,memcached_upstream_max_fails:1,merge_slashes:1,min_delete_depth:1,modern_browser:1,modern_browser:1,modern_browser_value:1,modern_browser_value:1,more_clear_headers:1,more_clear_input_headers:1,more_set_headers:1,more_set_input_headers:1,msie_padding:1,msie_refresh:1,multi_accept:1,open_file_cache:1,open_file_cache_errors:1,open_file_cache_events:1,open_file_cache_min_uses:1,open_file_cache_retest:1,open_file_cache_valid:1,open_log_file_cache:1,optimize_server_names:1,output_buffers:1,override_charset:1,override_charset:1,perl:1,perl_modules:1,perl_require:1,perl_set:1,pid:1,port_in_redirect:1,post_action:1,postpone_gzipping:1,postpone_output:1,proxy_bind:1,proxy_buffer_size:1,proxy_buffering:1,proxy_buffers:1,proxy_busy_buffers_size:1,proxy_cache:1,proxy_cache_key:1,proxy_cache_methods:1,proxy_cache_min_uses:1,proxy_cache_path:1,proxy_cache_use_stale:1,proxy_cache_valid:1,proxy_connect_timeout:1,proxy_headers_hash_bucket_size:1,proxy_headers_hash_max_size:1,proxy_hide_header:1,proxy_ignore_client_abort:1,proxy_ignore_headers:1,proxy_intercept_errors:1,proxy_max_temp_file_size:1,proxy_method:1,proxy_next_upstream:1,proxy_pass:1,proxy_pass_header:1,proxy_pass_request_body:1,proxy_pass_request_headers:1,proxy_read_timeout:1,proxy_redirect:1,proxy_send_lowat:1,proxy_send_timeout:1,proxy_set_body:1,proxy_set_header:1,proxy_store:1,proxy_store_access:1,proxy_temp_file_write_size:1,proxy_temp_path:1,proxy_upstream_fail_timeout:1,proxy_upstream_max_fails:1,push_authorized_channels_only:1,push_channel_group:1,push_max_channel_id_length:1,push_max_channel_subscribers:1,push_max_message_buffer_length:1,push_max_reserved_memory:1,push_message_buffer_length:1,push_message_timeout:1,push_min_message_buffer_length:1,push_min_message_recipients:1,push_publisher:1,push_store_messages:1,push_subscriber:1,push_subscriber_concurrency:1,random_index:1,read_ahead:1,real_ip_header:1,recursive_error_pages:1,request_pool_size:1,reset_timedout_connection:1,resolver:1,resolver_timeout:1,"return":1,rewrite:1,rewrite_log:1,root:1,satisfy:1,satisfy_any:1,send_lowat:1,send_timeout:1,sendfile:1,sendfile_max_chunk:1,server:1,server:1,server_name:1,server_name_in_redirect:1,server_names_hash_bucket_size:1,server_names_hash_max_size:1,server_tokens:1,set:1,set_real_ip_from:1,source_charset:1,source_charset:1,ssi:1,ssi_ignore_recycled_buffers:1,ssi_min_file_chunk:1,ssi_silent_errors:1,ssi_types:1,ssi_value_length:1,ssl:1,ssl_certificate:1,ssl_certificate_key:1,ssl_ciphers:1,ssl_client_certificate:1,ssl_crl:1,ssl_dhparam:1,ssl_prefer_server_ciphers:1,ssl_protocols:1,ssl_session_cache:1,ssl_session_timeout:1,ssl_verify_client:1,ssl_verify_depth:1,sub_filter:1,sub_filter_once:1,sub_filter_types:1,tcp_nodelay:1,tcp_nopush:1,timer_resolution:1,try_files:1,types:1,types_hash_bucket_size:1,types_hash_max_size:1,underscores_in_headers:1,uninitialized_variable_warn:1,upstream:1,use:1,user:1,userid:1,userid:1,userid_domain:1,userid_domain:1,userid_expires:1,userid_expires:1,userid_mark:1,userid_name:1,userid_name:1,userid_p3p:1,userid_p3p:1,userid_path:1,userid_path:1,userid_service:1,userid_service:1,valid_referers:1,variables_hash_bucket_size:1,variables_hash_max_size:1,worker_connections:1,worker_cpu_affinity:1,worker_priority:1,worker_processes:1,worker_rlimit_core:1,worker_rlimit_nofile:1,worker_rlimit_sigpending:1,working_directory:1,xml_entities:1,xslt_stylesheet:1,xslt_types:1},r:0,c:[b.HCM,{b:"\\s",e:"[;{]",rB:!0,rE:!0,l:"[a-z/]+",k:{built_in:{on:1,off:1,yes:1,no:1,"true":1,"false":1,none:1,blocked:1,debug:1,info:1,notice:1,warn:1,error:1,crit:1,select:1,permanent:1,redirect:1,kqueue:1,rtsig:1,epoll:1,poll:1,"/dev/poll":1}},r:0,c:[b.HCM,{cN:"string",b:'"',e:'"',c:[b.BE,a,c,d],r:0},{cN:"string",b:"'",e:"'",c:[b.BE,a,c,d],r:0},{cN:"string",b:"([a-z]+):/",e:"[;\\s]",rE:!0},{cN:"regexp",b:"\\s\\^",e:"\\s|{|;",rE:!0,c:[b.BE,a,c,d]},{cN:"regexp",b:"~\\*?\\s+",e:"\\s|{|;",rE:!0,c:[b.BE,a,c,d]},{cN:"regexp",b:"\\*(\\.[a-z\\-]+)+",c:[b.BE,a,c,d]},{cN:"regexp",b:"([a-z\\-]+\\.)+\\*",c:[b.BE,a,c,d]},{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b"},{cN:"number",b:"\\s\\d+[kKmMgGdshdwy]*\\b",r:0},a,c,d]}]}]}}}(),b.LANGUAGES.erlang_repl={dM:{k:{special_functions:{spawn:10,spawn_link:10,self:2},reserved:{after:1,and:1,andalso:5,band:1,begin:1,bnot:1,bor:1,bsl:1,bsr:1,bxor:1,"case":1,"catch":0,cond:1,div:1,end:1,fun:0,"if":0,let:1,not:0,of:1,or:1,orelse:5,query:1,receive:0,rem:1,"try":0,when:1,xor:1}},c:[{cN:"input_number",b:"^[0-9]+> ",r:10},{cN:"comment",b:"%",e:"$"},b.NM,b.ASM,b.QSM,{cN:"constant",b:"\\?(::)?([A-Z]\\w*(::)?)+"},{cN:"arrow",b:"->"},{cN:"ok",b:"ok"},{cN:"exclamation_mark",b:"!"},{cN:"function_or_atom",b:"(\\b[a-z'][a-zA-Z0-9_']*:[a-z'][a-zA-Z0-9_']*)|(\\b[a-z'][a-zA-Z0-9_']*)",r:0},{cN:"variable",b:"[A-Z][a-zA-Z0-9_']*",r:0}]}},b.LANGUAGES.django=function(){function a(a,b){return b==undefined||!a.cN&&b.cN=="tag"||a.cN=="value"}function c(b,d){var f={};for(var g in b){g!="contains"&&(f[g]=b[g]);var h=[];for(var i=0;b.c&&i<b.c.length;i++)h.push(c(b.c[i],b));a(b,d)&&(h=e.concat(h)),h.length&&(f.c=h)}return f}var d={cN:"filter",b:"\\|[A-Za-z]+\\:?",eE:!0,k:{truncatewords:1,removetags:1,linebreaksbr:1,yesno:1,get_digit:1,timesince:1,random:1,striptags:1,filesizeformat:1,escape:1,linebreaks:1,length_is:1,ljust:1,rjust:1,cut:1,urlize:1,fix_ampersands:1,title:1,floatformat:1,capfirst:1,pprint:1,divisibleby:1,add:1,make_list:1,unordered_list:1,urlencode:1,timeuntil:1,urlizetrunc:1,wordcount:1,stringformat:1,linenumbers:1,slice:1,date:1,dictsort:1,dictsortreversed:1,default_if_none:1,pluralize:1,lower:1,join:1,center:1,"default":1,truncatewords_html:1,upper:1,length:1,phone2numeric:1,wordwrap:1,time:1,addslashes:1,slugify:1,first:1},c:[{cN:"argument",b:'"',e:'"'}]},e=[{cN:"template_comment",b:"{%\\s*comment\\s*%}",e:"{%\\s*endcomment\\s*%}"},{cN:"template_comment",b:"{#",e:"#}"},{cN:"template_tag",b:"{%",e:"%}",k:{comment:1,endcomment:1,load:1,templatetag:1,ifchanged:1,endifchanged:1,"if":1,endif:1,firstof:1,"for":1,endfor:1,"in":1,ifnotequal:1,endifnotequal:1,widthratio:1,"extends":1,include:1,spaceless:1,endspaceless:1,regroup:1,by:1,as:1,ifequal:1,endifequal:1,ssi:1,now:1,"with":1,cycle:1,url:1,filter:1,endfilter:1,debug:1,block:1,endblock:1,"else":1},c:[d]},{cN:"variable",b:"{{",e:"}}",c:[d]}];return{cI:!0,dM:c(b.LANGUAGES.xml.dM)}}(),b.LANGUAGES.delphi=function(){var a={and:1,safecall:1,cdecl:1,then:1,string:1,exports:1,library:1,not:1,pascal:1,set:1,virtual:1,file:1,"in":1,array:1,label:1,packed:1,"end.":1,index:1,"while":1,"const":1,raise:1,"for":1,to:1,implementation:1,"with":1,except:1,overload:1,destructor:1,downto:1,"finally":1,program:1,exit:1,unit:1,inherited:1,override:1,"if":1,type:1,until:1,"function":1,"do":1,begin:1,repeat:1,"goto":1,nil:1,far:1,initialization:1,object:1,"else":1,"var":1,uses:1,external:1,resourcestring:1,"interface":1,end:1,finalization:1,"class":1,asm:1,mod:1,"case":1,on:1,shr:1,shl:1,of:1,register:1,xorwrite:1,threadvar:1,"try":1,record:1,near:1,stored:1,constructor:1,stdcall:1,inline:1,div:1,out:1,or:1,procedure:1},c={safecall:1,stdcall:1,pascal:1,stored:1,"const":1,implementation:1,finalization:1,except:1,to:1,"finally":1,program:1,inherited:1,override:1,then:1,exports:1,string:1,read:1,not:1,mod:1,shr:1,"try":1,div:1,shl:1,set:1,library:1,message:1,packed:1,index:1,"for":1,near:1,overload:1,label:1,downto:1,exit:1,"public":1,"goto":1,"interface":1,asm:1,on:1,of:1,constructor:1,or:1,"private":1,array:1,unit:1,raise:1,destructor:1,"var":1,type:1,until:1,"function":1,"else":1,external:1,"with":1,"case":1,"default":1,record:1,"while":1,"protected":1,property:1,procedure:1,published:1,and:1,cdecl:1,"do":1,threadvar:1,file:1,"in":1,"if":1,end:1,virtual:1,write:1,far:1,out:1,begin:1,repeat:1,nil:1,initialization:1,object:1,uses:1,resourcestring:1,"class":1,register:1,xorwrite:1,inline:1,"static":1},d={cN:"comment",b:"{",e:"}",r:0},e={cN:"comment",b:"\\(\\*",e:"\\*\\)",r:10},f={cN:"string",b:"'",e:"'",c:[{b:"''"}],r:0},g={cN:"string",b:"(#\\d+)+"},h={cN:"function",b:"(procedure|constructor|destructor|function)\\b",e:"[:;]",k:{"function":1,constructor:10,destructor:10,procedure:10},c:[{cN:"title",b:b.IR},{cN:"params",b:"\\(",e:"\\)",k:a,c:[f,g]},d,e]};return{cI:!0,dM:{k:a,i:'("|\\$[G-Zg-z]|\\/\\*|</)',c:[d,e,b.CLCM,f,g,b.NM,h,{cN:"class",b:"=\\bclass\\b",e:"end;",k:c,c:[f,g,d,e,h]}]},m:[]}}(),b.LANGUAGES.vbscript={cI:!0,dM:{k:{keyword:{call:1,"class":1,"const":1,dim:1,"do":1,loop:1,erase:1,execute:1,executeglobal:1,exit:1,"for":1,each:1,next:1,"function":1,"if":1,then:1,"else":1,on:1,error:1,option:1,explicit:1,"new":1,"private":1,property:1,let:1,get:1,"public":1,randomize:1,redim:1,rem:1,select:1,"case":1,set:1,stop:1,sub:1,"while":1,wend:1,"with":1,end:1,to:1,elseif:1,is:1,or:1,xor:1,and:1,not:1,class_initialize:1,class_terminate:1,"default":1,preserve:1,"in":1,me:1,byval:1,byref:1,step:1,resume:1,"goto":1},built_in:{lcase:1,month:1,vartype:1,instrrev:1,ubound:1,setlocale:1,getobject:1,rgb:1,getref:1,string:1,weekdayname:1,rnd:1,dateadd:1,monthname:1,now:1,day:1,minute:1,isarray:1,cbool:1,round:1,formatcurrency:1,conversions:1,csng:1,timevalue:1,second:1,year:1,space:1,abs:1,clng:1,timeserial:1,fixs:1,len:1,asc:1,isempty:1,maths:1,dateserial:1,atn:1,timer:1,isobject:1,filter:1,weekday:1,datevalue:1,ccur:1,isdate:1,instr:1,datediff:1,formatdatetime:1,replace:1,isnull:1,right:1,sgn:1,array:1,snumeric:1,log:1,cdbl:1,hex:1,chr:1,lbound:1,msgbox:1,ucase:1,getlocale:1,cos:1,cdate:1,cbyte:1,rtrim:1,join:1,hour:1,oct:1,typename:1,trim:1,strcomp:1,"int":1,createobject:1,loadpicture:1,tan:1,formatnumber:1,mid:1,scriptenginebuildversion:1,scriptengine:1,split:1,scriptengineminorversion:1,cint:1,sin:1,datepart:1,ltrim:1,sqr:1,scriptenginemajorversion:1,time:1,derived:1,eval:1,date:1,formatpercent:1,exp:1,inputbox:1,left:1,ascw:1,chrw:1,regexp:1,server:1,response:1,request:1,cstr:1,err:1},literal:{"true":1,"false":1,"null":1,nothing:1,empty:1}},c:[{cN:"string",b:'"',e:'"',i:"\\n",c:[{b:'""'}],r:0},{cN:"comment",b:"'",e:"$"},b.CNM]}},b.LANGUAGES.mel={dM:{k:{"int":1,"float":1,string:1,"float":1,vector:1,matrix:1,"if":1,"else":1,"switch":1,"case":1,"default":1,"while":1,"do":1,"for":1,"in":1,"break":1,"continue":1,exists:1,objExists:1,attributeExists:1,global:1,proc:1,"return":1,error:1,warning:1,trace:1,"catch":1,about:1,abs:1,addAttr:1,addAttributeEditorNodeHelp:1,addDynamic:1,addNewShelfTab:1,addPP:1,addPanelCategory:1,addPrefixToName:1,advanceToNextDrivenKey:1,affectedNet:1,affects:1,aimConstraint:1,air:1,alias:1,aliasAttr:1,align:1,alignCtx:1,alignCurve:1,alignSurface:1,allViewFit:1,ambientLight:1,angle:1,angleBetween:1,animCone:1,animCurveEditor:1,animDisplay:1,animView:1,annotate:1,appendStringArray:1,applicationName:1,applyAttrPreset:1,applyTake:1,arcLenDimContext:1,arcLengthDimension:1,arclen:1,arrayMapper:1,art3dPaintCtx:1,artAttrCtx:1,artAttrPaintVertexCtx:1,artAttrSkinPaintCtx:1,artAttrTool:1,artBuildPaintMenu:1,artFluidAttrCtx:1,artPuttyCtx:1,artSelectCtx:1,artSetPaintCtx:1,artUserPaintCtx:1,assignCommand:1,assignInputDevice:1,assignViewportFactories:1,attachCurve:1,attachDeviceAttr:1,attachSurface:1,attrColorSliderGrp:1,attrCompatibility:1,attrControlGrp:1,attrEnumOptionMenu:1,attrEnumOptionMenuGrp:1,attrFieldGrp:1,attrFieldSliderGrp:1,attrNavigationControlGrp:1,attrPresetEditWin:1,attributeExists:1,attributeInfo:1,attributeMenu:1,attributeQuery:1,autoKeyframe:1,autoPlace:1,bakeClip:1,bakeFluidShading:1,bakePartialHistory:1,bakeResults:1,bakeSimulation:1,basename:1,basenameEx:1,batchRender:1,bessel:1,bevel:1,bevelPlus:1,binMembership:1,bindSkin:1,blend2:1,blendShape:1,blendShapeEditor:1,blendShapePanel:1,blendTwoAttr:1,blindDataType:1,boneLattice:1,boundary:1,boxDollyCtx:1,boxZoomCtx:1,bufferCurve:1,buildBookmarkMenu:1,buildKeyframeMenu:1,button:1,buttonManip:1,CBG:1,cacheFile:1,cacheFileCombine:1,cacheFileMerge:1,cacheFileTrack:1,camera:1,cameraView:1,canCreateManip:1,canvas:1,capitalizeString:1,"catch":1,catchQuiet:1,ceil:1,changeSubdivComponentDisplayLevel:1,changeSubdivRegion:1,channelBox:1,character:1,characterMap:1,characterOutlineEditor:1,characterize:1,chdir:1,checkBox:1,checkBoxGrp:1,checkDefaultRenderGlobals:1,choice:1,circle:1,circularFillet:1,clamp:1,clear:1,clearCache:1,clip:1,clipEditor:1,clipEditorCurrentTimeCtx:1,clipSchedule:1,clipSchedulerOutliner:1,clipTrimBefore:1,closeCurve:1,closeSurface:1,cluster:1,cmdFileOutput:1,cmdScrollFieldExecuter:1,cmdScrollFieldReporter:1,cmdShell:1,coarsenSubdivSelectionList:1,collision:1,color:1,colorAtPoint:1,colorEditor:1,colorIndex:1,colorIndexSliderGrp:1,colorSliderButtonGrp:1,colorSliderGrp:1,columnLayout:1,commandEcho:1,commandLine:1,commandPort:1,compactHairSystem:1,componentEditor:1,compositingInterop:1,computePolysetVolume:1,condition:1,cone:1,confirmDialog:1,connectAttr:1,connectControl:1,connectDynamic:1,connectJoint:1,connectionInfo:1,constrain:1,constrainValue:1,constructionHistory:1,container:1,containsMultibyte:1,contextInfo:1,control:1,convertFromOldLayers:1,convertIffToPsd:1,convertLightmap:1,convertSolidTx:1,convertTessellation:1,convertUnit:1,copyArray:1,copyFlexor:1,copyKey:1,copySkinWeights:1,cos:1,cpButton:1,cpCache:1,cpClothSet:1,cpCollision:1,cpConstraint:1,cpConvClothToMesh:1,cpForces:1,cpGetSolverAttr:1,cpPanel:1,cpProperty:1,cpRigidCollisionFilter:1,cpSeam:1,cpSetEdit:1,cpSetSolverAttr:1,cpSolver:1,cpSolverTypes:1,cpTool:1,cpUpdateClothUVs:1,createDisplayLayer:1,createDrawCtx:1,createEditor:1,createLayeredPsdFile:1,createMotionField:1,createNewShelf:1,createNode:1,createRenderLayer:1,createSubdivRegion:1,cross:1,crossProduct:1,ctxAbort:1,ctxCompletion:1,ctxEditMode:1,ctxTraverse:1,currentCtx:1,currentTime:1,currentTimeCtx:1,currentUnit:1,currentUnit:1,curve:1,curveAddPtCtx:1,curveCVCtx:1,curveEPCtx:1,curveEditorCtx:1,curveIntersect:1,curveMoveEPCtx:1,curveOnSurface:1,curveSketchCtx:1,cutKey:1,cycleCheck:1,cylinder:1,dagPose:1,date:1,defaultLightListCheckBox:1,defaultNavigation:1,defineDataServer:1,defineVirtualDevice:1,deformer:1,deg_to_rad:1,"delete":1,deleteAttr:1,deleteShadingGroupsAndMaterials:1,deleteShelfTab:1,deleteUI:1,deleteUnusedBrushes:1,delrandstr:1,detachCurve:1,detachDeviceAttr:1,detachSurface:1,deviceEditor:1,devicePanel:1,dgInfo:1,dgdirty:1,dgeval:1,dgtimer:1,dimWhen:1,directKeyCtx:1,directionalLight:1,dirmap:1,dirname:1,disable:1,disconnectAttr:1,disconnectJoint:1,diskCache:1,displacementToPoly:1,displayAffected:1,displayColor:1,displayCull:1,displayLevelOfDetail:1,displayPref:1,displayRGBColor:1,displaySmoothness:1,displayStats:1,displayString:1,displaySurface:1,distanceDimContext:1,distanceDimension:1,doBlur:1,dolly:1,dollyCtx:1,dopeSheetEditor:1,dot:1,dotProduct:1,doubleProfileBirailSurface:1,drag:1,dragAttrContext:1,draggerContext:1,dropoffLocator:1,duplicate:1,duplicateCurve:1,duplicateSurface:1,dynCache:1,dynControl:1,dynExport:1,dynExpression:1,dynGlobals:1,dynPaintEditor:1,dynParticleCtx:1,dynPref:1,dynRelEdPanel:1,dynRelEditor:1,dynamicLoad:1,editAttrLimits:1,editDisplayLayerGlobals:1,editDisplayLayerMembers:1,editRenderLayerAdjustment:1,editRenderLayerGlobals:1,editRenderLayerMembers:1,editor:1,editorTemplate:1,effector:1,emit:1,emitter:1,enableDevice:1,encodeString:1,endString:1,endsWith:1,env:1,equivalent:1,equivalentTol:1,erf:1,error:1,eval:1,eval:1,evalDeferred:1,evalEcho:1,event:1,exactWorldBoundingBox:1,exclusiveLightCheckBox:1,exec:1,executeForEachObject:1,exists:1,exp:1,expression:1,expressionEditorListen:1,extendCurve:1,extendSurface:1,extrude:1,fcheck:1,fclose:1,feof:1,fflush:1,fgetline:1,fgetword:1,file:1,fileBrowserDialog:1,fileDialog:1,fileExtension:1,fileInfo:1,filetest:1,filletCurve:1,filter:1,filterCurve:1,filterExpand:1,filterStudioImport:1,findAllIntersections:1,findAnimCurves:1,findKeyframe:1,findMenuItem:1,findRelatedSkinCluster:1,finder:1,firstParentOf:1,fitBspline:1,flexor:1,floatEq:1,floatField:1,floatFieldGrp:1,floatScrollBar:1,floatSlider:1,floatSlider2:1,floatSliderButtonGrp:1,floatSliderGrp:1,floor:1,flow:1,fluidCacheInfo:1,fluidEmitter:1,fluidVoxelInfo:1,flushUndo:1,fmod:1,fontDialog:1,fopen:1,formLayout:1,format:1,fprint:1,frameLayout:1,fread:1,freeFormFillet:1,frewind:1,fromNativePath:1,fwrite:1,gamma:1,gauss:1,geometryConstraint:1,getApplicationVersionAsFloat:1,getAttr:1,getClassification:1,getDefaultBrush:1,getFileList:1,getFluidAttr:1,getInputDeviceRange:1,getMayaPanelTypes:1,getModifiers:1,getPanel:1,getParticleAttr:1,getPluginResource:1,getenv:1,getpid:1,glRender:1,glRenderEditor:1,globalStitch:1,gmatch:1,goal:1,gotoBindPose:1,grabColor:1,gradientControl:1,gradientControlNoAttr:1,graphDollyCtx:1,graphSelectContext:1,graphTrackCtx:1,gravity:1,grid:1,gridLayout:1,group:1,groupObjectsByName:1,HfAddAttractorToAS:1,HfAssignAS:1,HfBuildEqualMap:1,HfBuildFurFiles:1,HfBuildFurImages:1,HfCancelAFR:1,HfConnectASToHF:1,HfCreateAttractor:1,HfDeleteAS:1,HfEditAS:1,HfPerformCreateAS:1,HfRemoveAttractorFromAS:1,HfSelectAttached:1,HfSelectAttractors:1,HfUnAssignAS:1,hardenPointCurve:1,hardware:1,hardwareRenderPanel:1,headsUpDisplay:1,headsUpMessage:1,help:1,helpLine:1,hermite:1,hide:1,hilite:1,hitTest:1,hotBox:1,hotkey:1,hotkeyCheck:1,hsv_to_rgb:1,hudButton:1,hudSlider:1,hudSliderButton:1,hwReflectionMap:1,hwRender:1,hwRenderLoad:1,hyperGraph:1,hyperPanel:1,hyperShade:1,hypot:1,iconTextButton:1,iconTextCheckBox:1,iconTextRadioButton:1,iconTextRadioCollection:1,iconTextScrollList:1,iconTextStaticLabel:1,ikHandle:1,ikHandleCtx:1,ikHandleDisplayScale:1,ikSolver:1,ikSplineHandleCtx:1,ikSystem:1,ikSystemInfo:1,ikfkDisplayMethod:1,illustratorCurves:1,image:1,imfPlugins:1,inheritTransform:1,insertJoint:1,insertJointCtx:1,insertKeyCtx:1,insertKnotCurve:1,insertKnotSurface:1,instance:1,instanceable:1,instancer:1,intField:1,intFieldGrp:1,intScrollBar:1,intSlider:1,intSliderGrp:1,interToUI:1,internalVar:1,intersect:1,iprEngine:1,isAnimCurve:1,isConnected:1,isDirty:1,isParentOf:1,isSameObject:1,isTrue:1,isValidObjectName:1,isValidString:1,isValidUiName:1,isolateSelect:1,itemFilter:1,itemFilterAttr:1,itemFilterRender:1,itemFilterType:1,joint:1,jointCluster:1,jointCtx:1,jointDisplayScale:1,jointLattice:1,keyTangent:1,keyframe:1,keyframeOutliner:1,keyframeRegionCurrentTimeCtx:1,keyframeRegionDirectKeyCtx:1,keyframeRegionDollyCtx:1,keyframeRegionInsertKeyCtx:1,keyframeRegionMoveKeyCtx:1,keyframeRegionScaleKeyCtx:1,keyframeRegionSelectKeyCtx:1,keyframeRegionSetKeyCtx:1,keyframeRegionTrackCtx:1,keyframeStats:1,lassoContext:1,lattice:1,latticeDeformKeyCtx:1,launch:1,launchImageEditor:1,layerButton:1,layeredShaderPort:1,layeredTexturePort:1,layout:1,layoutDialog:1,lightList:1,lightListEditor:1,lightListPanel:1,lightlink:1,lineIntersection:1,linearPrecision:1,linstep:1,listAnimatable:1,listAttr:1,listCameras:1,listConnections:1,listDeviceAttachments:1,listHistory:1,listInputDeviceAxes:1,listInputDeviceButtons:1,listInputDevices:1,listMenuAnnotation:1,listNodeTypes:1,listPanelCategories:1,listRelatives:1,listSets:1,listTransforms:1,listUnselected:1,listerEditor:1,loadFluid:1,loadNewShelf:1,loadPlugin:1,loadPluginLanguageResources:1,loadPrefObjects:1,localizedPanelLabel:1,lockNode:1,loft:1,log:1,longNameOf:1,lookThru:1,ls:1,lsThroughFilter:1,lsType:1,lsUI:1,Mayatomr:1,mag:1,makeIdentity:1,makeLive:1,makePaintable:1,makeRoll:1,makeSingleSurface:1,makeTubeOn:1,makebot:1,manipMoveContext:1,manipMoveLimitsCtx:1,manipOptions:1,manipRotateContext:1,manipRotateLimitsCtx:1,manipScaleContext:1,manipScaleLimitsCtx:1,marker:1,match:1,max:1,memory:1,menu:1,menuBarLayout:1,menuEditor:1,menuItem:1,menuItemToShelf:1,menuSet:1,menuSetPref:1,messageLine:1,min:1,minimizeApp:1,mirrorJoint:1,modelCurrentTimeCtx:1,modelEditor:1,modelPanel:1,mouse:1,movIn:1,movOut:1,move:1,moveIKtoFK:1,moveKeyCtx:1,moveVertexAlongDirection:1,multiProfileBirailSurface:1,mute:1,nParticle:1,nameCommand:1,nameField:1,namespace:1,namespaceInfo:1,newPanelItems:1,newton:1,nodeCast:1,nodeIconButton:1,nodeOutliner:1,nodePreset:1,nodeType:1,noise:1,nonLinear:1,normalConstraint:1,normalize:1,nurbsBoolean:1,nurbsCopyUVSet:1,nurbsCube:1,nurbsEditUV:1,nurbsPlane:1,nurbsSelect:1,nurbsSquare:1,nurbsToPoly:1,nurbsToPolygonsPref:1,nurbsToSubdiv:1,nurbsToSubdivPref:1,nurbsUVSet:1,nurbsViewDirectionVector:1,objExists:1,objectCenter:1,objectLayer:1,objectType:1,objectTypeUI:1,obsoleteProc:1,oceanNurbsPreviewPlane:1,offsetCurve:1,offsetCurveOnSurface:1,offsetSurface:1,openGLExtension:1,openMayaPref:1,optionMenu:1,optionMenuGrp:1,optionVar:1,orbit:1,orbitCtx:1,orientConstraint:1,outlinerEditor:1,outlinerPanel:1,overrideModifier:1,paintEffectsDisplay:1,pairBlend:1,palettePort:1,paneLayout:1,panel:1,panelConfiguration:1,panelHistory:1,paramDimContext:1,paramDimension:1,paramLocator:1,parent:1,parentConstraint:1,particle:1,particleExists:1,particleInstancer:1,particleRenderInfo:1,partition:1,pasteKey:1,pathAnimation:1,pause:1,pclose:1,percent:1,performanceOptions:1,pfxstrokes:1,pickWalk:1,picture:1,pixelMove:1,planarSrf:1,plane:1,play:1,playbackOptions:1,playblast:1,plugAttr:1,plugNode:1,pluginInfo:1,pluginResourceUtil:1,pointConstraint:1,pointCurveConstraint:1,pointLight:1,pointMatrixMult:1,pointOnCurve:1,pointOnSurface:1,pointPosition:1,poleVectorConstraint:1,polyAppend:1,polyAppendFacetCtx:1,polyAppendVertex:1,polyAutoProjection:1,polyAverageNormal:1,polyAverageVertex:1,polyBevel:1,polyBlendColor:1,polyBlindData:1,polyBoolOp:1,polyBridgeEdge:1,polyCacheMonitor:1,polyCheck:1,polyChipOff:1,polyClipboard:1,polyCloseBorder:1,polyCollapseEdge:1,polyCollapseFacet:1,polyColorBlindData:1,polyColorDel:1,polyColorPerVertex:1,polyColorSet:1,polyCompare:1,polyCone:1,polyCopyUV:1,polyCrease:1,polyCreaseCtx:1,polyCreateFacet:1,polyCreateFacetCtx:1,polyCube:1,polyCut:1,polyCutCtx:1,polyCylinder:1,polyCylindricalProjection:1,polyDelEdge:1,polyDelFacet:1,polyDelVertex:1,polyDuplicateAndConnect:1,polyDuplicateEdge:1,polyEditUV:1,polyEditUVShell:1,polyEvaluate:1,polyExtrudeEdge:1,polyExtrudeFacet:1,polyExtrudeVertex:1,polyFlipEdge:1,polyFlipUV:1,polyForceUV:1,polyGeoSampler:1,polyHelix:1,polyInfo:1,polyInstallAction:1,polyLayoutUV:1,polyListComponentConversion:1,polyMapCut:1,polyMapDel:1,polyMapSew:1,polyMapSewMove:1,polyMergeEdge:1,polyMergeEdgeCtx:1,polyMergeFacet:1,polyMergeFacetCtx:1,polyMergeUV:1,polyMergeVertex:1,polyMirrorFace:1,polyMoveEdge:1,polyMoveFacet:1,polyMoveFacetUV:1,polyMoveUV:1,polyMoveVertex:1,polyNormal:1,polyNormalPerVertex:1,polyNormalizeUV:1,polyOptUvs:1,polyOptions:1,polyOutput:1,polyPipe:1,polyPlanarProjection:1,polyPlane:1,polyPlatonicSolid:1,polyPoke:1,polyPrimitive:1,polyPrism:1,polyProjection:1,polyPyramid:1,polyQuad:1,polyQueryBlindData:1,polyReduce:1,polySelect:1,polySelectConstraint:1,polySelectConstraintMonitor:1,polySelectCtx:1,polySelectEditCtx:1,polySeparate:1,polySetToFaceNormal:1,polySewEdge:1,polyShortestPathCtx:1,polySmooth:1,polySoftEdge:1,polySphere:1,polySphericalProjection:1,polySplit:1,polySplitCtx:1,polySplitEdge:1,polySplitRing:1,polySplitVertex:1,polyStraightenUVBorder:1,polySubdivideEdge:1,polySubdivideFacet:1,polyToSubdiv:1,polyTorus:1,polyTransfer:1,polyTriangulate:1,polyUVSet:1,polyUnite:1,polyWedgeFace:1,popen:1,popupMenu:1,pose:1,pow:1,preloadRefEd:1,print:1,progressBar:1,progressWindow:1,projFileViewer:1,projectCurve:1,projectTangent:1,projectionContext:1,projectionManip:1,promptDialog:1,propModCtx:1,propMove:1,psdChannelOutliner:1,psdEditTextureFile:1,psdExport:1,psdTextureFile:1,putenv:1,pwd:1,python:1,querySubdiv:1,quit:1,rad_to_deg:1,radial:1,radioButton:1,radioButtonGrp:1,radioCollection:1,radioMenuItemCollection:1,rampColorPort:1,rand:1,randomizeFollicles:1,randstate:1,rangeControl:1,readTake:1,rebuildCurve:1,rebuildSurface:1,recordAttr:1,recordDevice:1,redo:1,reference:1,referenceEdit:1,referenceQuery:1,refineSubdivSelectionList:1,refresh:1,refreshAE:1,registerPluginResource:1,rehash:1,reloadImage:1,removeJoint:1,removeMultiInstance:1,removePanelCategory:1,rename:1,renameAttr:1,renameSelectionList:1,renameUI:1,render:1,renderGlobalsNode:1,renderInfo:1,renderLayerButton:1,renderLayerParent:1,renderLayerPostProcess:1,renderLayerUnparent:1,renderManip:1,renderPartition:1,renderQualityNode:1,renderSettings:1,renderThumbnailUpdate:1,renderWindowEditor:1,renderWindowSelectContext:1,renderer:1,reorder:1,reorderDeformers:1,requires:1,reroot:1,resampleFluid:1,resetAE:1,resetPfxToPolyCamera:1,resetTool:1,resolutionNode:1,retarget:1,reverseCurve:1,reverseSurface:1,revolve:1,rgb_to_hsv:1,rigidBody:1,rigidSolver:1,roll:1,rollCtx:1,rootOf:1,rot:1,rotate:1,rotationInterpolation:1,roundConstantRadius:1,rowColumnLayout:1,rowLayout:1,runTimeCommand:1,runup:1,sampleImage:1,saveAllShelves:1,saveAttrPreset:1,saveFluid:1,saveImage:1,saveInitialState:1,saveMenu:1,savePrefObjects:1,savePrefs:1,saveShelf:1,saveToolSettings:1,scale:1,scaleBrushBrightness:1,scaleComponents:1,scaleConstraint:1,scaleKey:1,scaleKeyCtx:1,sceneEditor:1,sceneUIReplacement:1,scmh:1,scriptCtx:1,scriptEditorInfo:1,scriptJob:1,scriptNode:1,scriptTable:1,scriptToShelf:1,scriptedPanel:1,scriptedPanelType:1,scrollField:1,scrollLayout:1,sculpt:1,searchPathArray:1,seed:1,selLoadSettings:1,select:1,selectContext:1,selectCurveCV:1,selectKey:1,selectKeyCtx:1,selectKeyframeRegionCtx:1,selectMode:1,selectPref:1,selectPriority:1,selectType:1,selectedNodes:1,selectionConnection:1,separator:1,setAttr:1,setAttrEnumResource:1,setAttrMapping:1,setAttrNiceNameResource:1,setConstraintRestPosition:1,setDefaultShadingGroup:1,setDrivenKeyframe:1,setDynamic:1,setEditCtx:1,setEditor:1,setFluidAttr:1,setFocus:1,setInfinity:1,setInputDeviceMapping:1,setKeyCtx:1,setKeyPath:1,setKeyframe:1,setKeyframeBlendshapeTargetWts:1,setMenuMode:1,setNodeNiceNameResource:1,setNodeTypeFlag:1,setParent:1,setParticleAttr:1,setPfxToPolyCamera:1,setPluginResource:1,setProject:1,setStampDensity:1,setStartupMessage:1,setState:1,setToolTo:1,setUITemplate:1,setXformManip:1,sets:1,shadingConnection:1,shadingGeometryRelCtx:1,shadingLightRelCtx:1,shadingNetworkCompare:1,shadingNode:1,shapeCompare:1,shelfButton:1,shelfLayout:1,shelfTabLayout:1,shellField:1,shortNameOf:1,showHelp:1,showHidden:1,showManipCtx:1,showSelectionInTitle:1,showShadingGroupAttrEditor:1,showWindow:1,sign:1,simplify:1,sin:1,singleProfileBirailSurface:1,size:1,sizeBytes:1,skinCluster:1,skinPercent:1,smoothCurve:1,smoothTangentSurface:1,smoothstep:1,snap2to2:1,snapKey:1,snapMode:1,snapTogetherCtx:1,snapshot:1,soft:1,softMod:1,softModCtx:1,sort:1,sound:1,soundControl:1,source:1,spaceLocator:1,sphere:1,sphrand:1,spotLight:1,spotLightPreviewPort:1,spreadSheetEditor:1,spring:1,sqrt:1,squareSurface:1,srtContext:1,stackTrace:1,startString:1,startsWith:1,stitchAndExplodeShell:1,stitchSurface:1,stitchSurfacePoints:1,strcmp:1,stringArrayCatenate:1,stringArrayContains:1,stringArrayCount:1,stringArrayInsertAtIndex:1,stringArrayIntersector:1,stringArrayRemove:1,stringArrayRemoveAtIndex:1,stringArrayRemoveDuplicates:1,stringArrayRemoveExact:1,stringArrayToString:1,stringToStringArray:1,strip:1,stripPrefixFromName:1,stroke:1,subdAutoProjection:1,subdCleanTopology:1,subdCollapse:1,subdDuplicateAndConnect:1,subdEditUV:1,subdListComponentConversion:1,subdMapCut:1,subdMapSewMove:1,subdMatchTopology:1,subdMirror:1,subdToBlind:1,subdToPoly:1,subdTransferUVsToCache:1,subdiv:1,subdivCrease:1,subdivDisplaySmoothness:1,substitute:1,substituteAllString:1,substituteGeometry:1,substring:1,surface:1,surfaceSampler:1,surfaceShaderList:1,swatchDisplayPort:1,switchTable:1,symbolButton:1,symbolCheckBox:1,sysFile:1,system:1,tabLayout:1,tan:1,tangentConstraint:1,texLatticeDeformContext:1,texManipContext:1,texMoveContext:1,texMoveUVShellContext:1,texRotateContext:1,texScaleContext:1,texSelectContext:1,texSelectShortestPathCtx:1,texSmudgeUVContext:1,texWinToolCtx:1,text:1,textCurves:1,textField:1,textFieldButtonGrp:1,textFieldGrp:1,textManip:1,textScrollList:1,textToShelf:1,textureDisplacePlane:1,textureHairColor:1,texturePlacementContext:1,textureWindow:1,threadCount:1,threePointArcCtx:1,timeControl:1,timePort:1,timerX:1,toNativePath:1,toggle:1,toggleAxis:1,toggleWindowVisibility:1,tokenize:1,tokenizeList:1,tolerance:1,tolower:1,toolButton:1,toolCollection:1,toolDropped:1,toolHasOptions:1,toolPropertyWindow:1,torus:1,toupper:1,trace:1,track:1,trackCtx:1,transferAttributes:1,transformCompare:1,transformLimits:1,translator:1,trim:1,trunc:1,truncateFluidCache:1,truncateHairCache:1,tumble:1,tumbleCtx:1,turbulence:1,twoPointArcCtx:1,uiRes:1,uiTemplate:1,unassignInputDevice:1,undo:1,undoInfo:1,ungroup:1,uniform:1,unit:1,unloadPlugin:1,untangleUV:1,untitledFileName:1,untrim:1,upAxis:1,updateAE:1,userCtx:1,uvLink:1,uvSnapshot:1,validateShelfName:1,vectorize:1,view2dToolCtx:1,viewCamera:1,viewClipPlane:1,viewFit:1,viewHeadOn:1,viewLookAt:1,viewManip:1,viewPlace:1,viewSet:1,visor:1,volumeAxis:1,vortex:1,waitCursor:1,warning:1,webBrowser:1,webBrowserPrefs:1,whatIs:1,window:1,windowPref:1,wire:1,wireContext:1,workspace:1,wrinkle:1,wrinkleContext:1,writeTake:1,xbmLangPathList:1,xform:1},i:"</",c:[b.CNM,b.ASM,b.QSM,{cN:"string",b:"`",e:"`",c:[b.BE]},{cN:"variable",b:"\\$\\d",r:5},{cN:"variable",b:"[\\$\\%\\@\\*](\\^\\w\\b|#\\w+|[^\\s\\w{]|{\\w+}|\\w+)"},b.CLCM,b.CBLCLM]}},b.LANGUAGES.dos={cI:!0,dM:{k:{flow:{"if":1,"else":1,"goto":1,"for":1,"in":1,"do":1,call:1,exit:1,not:1,exist:1,errorlevel:1,defined:1,equ:1,neq:1,lss:1,leq:1,gtr:1,geq:1},keyword:{shift:1,cd:1,dir:1,echo:1,setlocal:1,endlocal:1,set:1,pause:1,copy:1},stream:{prn:1,nul:1,lpt3:1,lpt2:1,lpt1:1,con:1,com4:1,com3:1,com2:1,com1:1,aux:1},winutils:{ping:1,net:1,ipconfig:1,taskkill:1,xcopy:1,ren:1,del:1}},c:[{cN:"envvar",b:"%[^ ]+?%"},{cN:"number",b:"\\b\\d+",r:0},{cN:"comment",b:"@?rem",e:"$"}]}},b.LANGUAGES.apache=function(){var a={cN:"number",b:"[\\$%]\\d+"},c={cN:"cbracket",b:"[\\$%]\\{",e:"\\}"};return c.c=[c,a],{cI:!0,dM:{k:{keyword:{acceptfilter:1,acceptmutex:1,acceptpathinfo:1,accessfilename:1,action:1,addalt:1,addaltbyencoding:1,addaltbytype:1,addcharset:1,adddefaultcharset:1,adddescription:1,addencoding:1,addhandler:1,addicon:1,addiconbyencoding:1,addiconbytype:1,addinputfilter:1,addlanguage:1,addmoduleinfo:1,addoutputfilter:1,addoutputfilterbytype:1,addtype:1,alias:1,aliasmatch:1,allow:1,allowconnect:1,allowencodedslashes:1,allowoverride:1,anonymous:1,anonymous_logemail:1,anonymous_mustgiveemail:1,anonymous_nouserid:1,anonymous_verifyemail:1,authbasicauthoritative:1,authbasicprovider:1,authdbduserpwquery:1,authdbduserrealmquery:1,authdbmgroupfile:1,authdbmtype:1,authdbmuserfile:1,authdefaultauthoritative:1,authdigestalgorithm:1,authdigestdomain:1,authdigestnccheck:1,authdigestnonceformat:1,authdigestnoncelifetime:1,authdigestprovider:1,authdigestqop:1,authdigestshmemsize:1,authgroupfile:1,authldapbinddn:1,authldapbindpassword:1,authldapcharsetconfig:1,authldapcomparednonserver:1,authldapdereferencealiases:1,authldapgroupattribute:1,authldapgroupattributeisdn:1,authldapremoteuserattribute:1,authldapremoteuserisdn:1,authldapurl:1,authname:1,authnprovideralias:1,authtype:1,authuserfile:1,authzdbmauthoritative:1,authzdbmtype:1,authzdefaultauthoritative:1,authzgroupfileauthoritative:1,authzldapauthoritative:1,authzownerauthoritative:1,authzuserauthoritative:1,balancermember:1,browsermatch:1,browsermatchnocase:1,bufferedlogs:1,cachedefaultexpire:1,cachedirlength:1,cachedirlevels:1,cachedisable:1,cacheenable:1,cachefile:1,cacheignorecachecontrol:1,cacheignoreheaders:1,cacheignorenolastmod:1,cacheignorequerystring:1,cachelastmodifiedfactor:1,cachemaxexpire:1,cachemaxfilesize:1,cacheminfilesize:1,cachenegotiateddocs:1,cacheroot:1,cachestorenostore:1,cachestoreprivate:1,cgimapextension:1,charsetdefault:1,charsetoptions:1,charsetsourceenc:1,checkcaseonly:1,checkspelling:1,chrootdir:1,contentdigest:1,cookiedomain:1,cookieexpires:1,cookielog:1,cookiename:1,cookiestyle:1,cookietracking:1,coredumpdirectory:1,customlog:1,dav:1,davdepthinfinity:1,davgenericlockdb:1,davlockdb:1,davmintimeout:1,dbdexptime:1,dbdkeep:1,dbdmax:1,dbdmin:1,dbdparams:1,dbdpersist:1,dbdpreparesql:1,dbdriver:1,defaulticon:1,defaultlanguage:1,defaulttype:1,deflatebuffersize:1,deflatecompressionlevel:1,deflatefilternote:1,deflatememlevel:1,deflatewindowsize:1,deny:1,directoryindex:1,directorymatch:1,directoryslash:1,documentroot:1,dumpioinput:1,dumpiologlevel:1,dumpiooutput:1,enableexceptionhook:1,enablemmap:1,enablesendfile:1,errordocument:1,errorlog:1,example:1,expiresactive:1,expiresbytype:1,expiresdefault:1,extendedstatus:1,extfilterdefine:1,extfilteroptions:1,fileetag:1,filterchain:1,filterdeclare:1,filterprotocol:1,filterprovider:1,filtertrace:1,forcelanguagepriority:1,forcetype:1,forensiclog:1,gracefulshutdowntimeout:1,group:1,header:1,headername:1,hostnamelookups:1,identitycheck:1,identitychecktimeout:1,imapbase:1,imapdefault:1,imapmenu:1,include:1,indexheadinsert:1,indexignore:1,indexoptions:1,indexorderdefault:1,indexstylesheet:1,isapiappendlogtoerrors:1,isapiappendlogtoquery:1,isapicachefile:1,isapifakeasync:1,isapilognotsupported:1,isapireadaheadbuffer:1,keepalive:1,keepalivetimeout:1,languagepriority:1,ldapcacheentries:1,ldapcachettl:1,ldapconnectiontimeout:1,ldapopcacheentries:1,ldapopcachettl:1,ldapsharedcachefile:1,ldapsharedcachesize:1,ldaptrustedclientcert:1,ldaptrustedglobalcert:1,ldaptrustedmode:1,ldapverifyservercert:1,limitinternalrecursion:1,limitrequestbody:1,limitrequestfields:1,limitrequestfieldsize:1,limitrequestline:1,limitxmlrequestbody:1,listen:1,listenbacklog:1,loadfile:1,loadmodule:1,lockfile:1,logformat:1,loglevel:1,maxclients:1,maxkeepaliverequests:1,maxmemfree:1,maxrequestsperchild:1,maxrequestsperthread:1,maxspareservers:1,maxsparethreads:1,maxthreads:1,mcachemaxobjectcount:1,mcachemaxobjectsize:1,mcachemaxstreamingbuffer:1,mcacheminobjectsize:1,mcacheremovalalgorithm:1,mcachesize:1,metadir:1,metafiles:1,metasuffix:1,mimemagicfile:1,minspareservers:1,minsparethreads:1,mmapfile:1,mod_gzip_on:1,mod_gzip_add_header_count:1,mod_gzip_keep_workfiles:1,mod_gzip_dechunk:1,mod_gzip_min_http:1,mod_gzip_minimum_file_size:1,mod_gzip_maximum_file_size:1,mod_gzip_maximum_inmem_size:1,mod_gzip_temp_dir:1,mod_gzip_item_include:1,mod_gzip_item_exclude:1,mod_gzip_command_version:1,mod_gzip_can_negotiate:1,mod_gzip_handle_methods:1,mod_gzip_static_suffix:1,mod_gzip_send_vary:1,mod_gzip_update_static:1,modmimeusepathinfo:1,multiviewsmatch:1,namevirtualhost:1,noproxy:1,nwssltrustedcerts:1,nwsslupgradeable:1,options:1,order:1,passenv:1,pidfile:1,protocolecho:1,proxybadheader:1,proxyblock:1,proxydomain:1,proxyerroroverride:1,proxyftpdircharset:1,proxyiobuffersize:1,proxymaxforwards:1,proxypass:1,proxypassinterpolateenv:1,proxypassmatch:1,proxypassreverse:1,proxypassreversecookiedomain:1,proxypassreversecookiepath:1,proxypreservehost:1,proxyreceivebuffersize:1,proxyremote:1,proxyremotematch:1,proxyrequests:1,proxyset:1,proxystatus:1,proxytimeout:1,proxyvia:1,readmename:1,receivebuffersize:1,redirect:1,redirectmatch:1,redirectpermanent:1,redirecttemp:1,removecharset:1,removeencoding:1,removehandler:1,removeinputfilter:1,removelanguage:1,removeoutputfilter:1,removetype:1,requestheader:1,require:2,rewritebase:1,rewritecond:10,rewriteengine:1,rewritelock:1,rewritelog:1,rewriteloglevel:1,rewritemap:1,rewriteoptions:1,rewriterule:10,rlimitcpu:1,rlimitmem:1,rlimitnproc:1,satisfy:1,scoreboardfile:1,script:1,scriptalias:1,scriptaliasmatch:1,scriptinterpretersource:1,scriptlog:1,scriptlogbuffer:1,scriptloglength:1,scriptsock:1,securelisten:1,seerequesttail:1,sendbuffersize:1,serveradmin:1,serveralias:1,serverlimit:1,servername:1,serverpath:1,serverroot:1,serversignature:1,servertokens:1,setenv:1,setenvif:1,setenvifnocase:1,sethandler:1,setinputfilter:1,setoutputfilter:1,ssienableaccess:1,ssiendtag:1,ssierrormsg:1,ssistarttag:1,ssitimeformat:1,ssiundefinedecho:1,sslcacertificatefile:1,sslcacertificatepath:1,sslcadnrequestfile:1,sslcadnrequestpath:1,sslcarevocationfile:1,sslcarevocationpath:1,sslcertificatechainfile:1,sslcertificatefile:1,sslcertificatekeyfile:1,sslciphersuite:1,sslcryptodevice:1,sslengine:1,sslhonorciperorder:1,sslmutex:1,ssloptions:1,sslpassphrasedialog:1,sslprotocol:1,sslproxycacertificatefile:1,sslproxycacertificatepath:1,sslproxycarevocationfile:1,sslproxycarevocationpath:1,sslproxyciphersuite:1,sslproxyengine:1,sslproxymachinecertificatefile:1,sslproxymachinecertificatepath:1,sslproxyprotocol:1,sslproxyverify:1,sslproxyverifydepth:1,sslrandomseed:1,sslrequire:1,sslrequiressl:1,sslsessioncache:1,sslsessioncachetimeout:1,sslusername:1,sslverifyclient:1,sslverifydepth:1,startservers:1,startthreads:1,substitute:1,suexecusergroup:1,threadlimit:1,threadsperchild:1,threadstacksize:1,timeout:1,traceenable:1,transferlog:1,typesconfig:1,unsetenv:1,usecanonicalname:1,usecanonicalphysicalport:1,user:1,userdir:1,virtualdocumentroot:1,virtualdocumentrootip:1,virtualscriptalias:1,virtualscriptaliasip:1,win32disableacceptex:1,xbithack:1},literal:{on:1,off:1}},c:[b.HCM,{cN:"sqbracket",b:"\\s\\[",e:"\\]$"},c,a,{cN:"tag",b:"</?",e:">"},b.QSM]}}}(),b.LANGUAGES.cpp=function(){var a={keyword:{"false":1,"int":1,"float":1,"while":1,"private":1,"char":1,"catch":1,"export":1,virtual:1,operator:2,sizeof:2,dynamic_cast:2,typedef:2,const_cast:2,"const":1,struct:1,"for":1,static_cast:2,union:1,namespace:1,unsigned:1,"long":1,"throw":1,"volatile":2,"static":1,"protected":1,bool:1,template:1,mutable:1,"if":1,"public":1,friend:2,"do":1,"return":1,"goto":1,auto:1,"void":2,"enum":1,"else":1,"break":1,"new":1,extern:1,using:1,"true":1,"class":1,asm:1,"case":1,typeid:1,"short":1,reinterpret_cast:2,"default":1,"double":1,register:1,explicit:1,signed:1,typename:1,"try":1,"this":1,"switch":1,"continue":1,wchar_t:1,inline:1,"delete":1,alignof:1,char16_t:1,char32_t:1,constexpr:1,decltype:1,noexcept:1,nullptr:1,static_assert:1,thread_local:1},built_in:{std:1,string:1,cin:1,cout:1,cerr:1,clog:1,stringstream:1,istringstream:1,ostringstream:1,auto_ptr:1,deque:1,list:1,queue:1,stack:1,vector:1,map:1,set:1,bitset:1,multiset:1,multimap:1,unordered_set:1,unordered_map:1,unordered_multiset:1,unordered_multimap:1,array:1,shared_ptr:1}},c={cN:"stl_container",b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:a,r:10};return c.c=[c],{dM:{k:a,i:"</",c:[b.CLCM,b.CBLCLM,b.QSM,{cN:"string",b:"'",e:"[^\\\\]'",i:"[^\\\\][^']"},b.CNM,{cN:"preprocessor",b:"#",e:"$"},c]}}}(),b.LANGUAGES.parser3=function(){var a={b:"{",e:"}"};return a.c=[a],{dM:{sL:"html",c:[{cN:"comment",b:"^#",e:"$"},{cN:"comment",c:[a],b:"\\^rem{",e:"}",r:10},{cN:"preprocessor",b:"^@(?:BASE|USE|CLASS|OPTIONS)$",r:10},{cN:"title",b:"@[\\w\\-]+\\[[\\w^;\\-]*\\](?:\\[[\\w^;\\-]*\\])?(?:.*)$"},{cN:"variable",b:"\\$\\{?[\\w\\-\\.\\:]+\\}?"},{cN:"keyword",b:"\\^[\\w\\-\\.\\:]+"},{cN:"number",b:"\\^#[0-9a-fA-F]+"},b.CNM]}}}(),b.LANGUAGES.go=function(){var a={keyword:{"break":1,"default":1,func:1,"interface":1,select:1,"case":1,map:1,struct:1,chan:1,"else":1,"goto":1,"package":1,"switch":1,"const":1,fallthrough:1,"if":1,range:1,type:1,"continue":1,"for":1,"import":1,"return":1,"var":1,go:1,defer:1},constant:{"true":1,"false":1,iota:1,nil:1},typename:{bool:1,"byte":1,complex64:1,complex128:1,float32:1,float64:1,int8:1,int16:1,int32:1,int64:1,string:1,uint8:1,uint16:1,uint32:1,uint64:1,"int":1,uint:1,uintptr:1},built_in:{append:1,cap:1,close:1,complex:1,copy:1,imag:1,len:1,make:1,"new":1,panic:1,print:1,println:1,real:1,recover:1}};return{dM:{k:a,i:"</",c:[b.CLCM,b.CBLCLM,b.QSM,{cN:"string",b:"'",e:"[^\\\\]'",r:0},{cN:"string",b:"`",e:"[^\\\\]`"},{cN:"number",b:"[^a-zA-Z_0-9](\\-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s)(\\+|\\-)?\\d+)?",r:0},b.CNM]}}}();var c=a.highlighter={};a.exports.highlighter={engine:function(){return b}};var d={arta:"pre code{display:block;padding:0.5em;}code{background:#222;}code .header,code .profile .header *,code .ini .title{color:#fff;}code .comment,code .javadoc,code .preprocessor,code .shebang,code .profile .summary,code .diff,code .pi,code .doctype,code .xml .tag,code .template_comment,code .css .rules,code .tex .special{color:#444;}code .string,code .symbol,code .diff .change,code .regexp,code .xml .attribute,code .xml .value,code .smalltalk .char,code .ini .value{color:#ffcc33;}code .number,code .addition{color:#00cc66;}code .built_in,code .literal,code .vhdl .type,code .go .constant,code .go .typename,code .ini .keyword,code .lua .title,code .perl .variable,code .php .variable,code .mel .variable,code .django .variable,code .css .funtion,code .smalltalk .method,code .hexcolor,code .important,code .flow,code .inheritance,code .parser3 .variable{color:#32AAEE;}code .keyword,code .xml .tag .title,code .css .tag,code .css .class,code .css .id,code .css .pseudo,code .css .attr_selector,code .lisp .title,code .winutils,code .tex .command{color:#6644aa;}code .class .title,code .ruby .constant,code .vala .constant,code .parent,code .deletion,code .template_tag,code .css .keyword,code .javascript .title,code .objectivec .class .id,code .smalltalk .class,code .lisp .keyword,code .apache .tag,code .nginx .variable,code .envvar,code .bash .variable,code .go .built_in,code .vbscript .built_in,code .lua .built_in,code .rsl .built_in,code .tail,code .avrasm .label,code .parser3 .title,code .tex .formula,code .tex .formula *{color:#bb1166;}code .yardoctag,code .phpdoc,code .profile .header,code .ini .title,code .apache .tag,code .parser3 .title{font-weight:bold;}code .xml .javascript,code .xml .css,code .xml .cdata{opacity:0.6;}code,code .javascript,code .css,code .xml,code .subst,code .diff .chunk,code .css .value,code .css .attribute,code .lisp .string,code .lisp .number,code .tail .params,code .container,code .haskell *,code .erlang *,code .erlang_repl *{color:#aaa;}",ascetic:"pre code{display:block;padding:0.5em;}code{background:white;color:black;}code .string,code .tag .value,code .filter .argument,code .addition,code .change,code .apache .tag,code .apache .cbracket,code .nginx .built_in,code .tex .formula{color:#888;}code .comment,code .template_comment,code .shebang,code .doctype,code .pi,code .javadoc,code .deletion,code .apache .sqbracket{color:#CCC;}code .keyword,code .tag .title,code .css .tag,code .ini .title,code .winutils,code .flow,code .lisp .title,code .apache .tag,code .tex .command{font-weight:bold;}",dark:"pre code{display:block;padding:0.5em;}code{background:#444;}code .keyword,code .literal,code .change,code .winutils,code .flow,code .lisp .title,code .tex .special{color:white;}code,code .ruby .subst{color:#DDD;}code .string,code .function .title,code .class .title,code .haskell .label,code .ini .title,code .tag .value,code .css .rules .value,code .preprocessor,code .ruby .symbol,code .ruby .symbol .string,code .ruby .symbol .keyword,code .ruby .symbol .keymethods,code .ruby .instancevar,code .ruby .class .parent,code .built_in,code .sql .aggregate,code .django .template_tag,code .django .variable,code .smalltalk .class,code .javadoc,code .ruby .string,code .django .filter .argument,code .smalltalk .localvars,code .smalltalk .array,code .attr_selector,code .pseudo,code .addition,code .stream,code .envvar,code .apache .tag,code .apache .cbracket,code .tex .command,code .input_number{color:#D88;}code .comment,code .java .annotation,code .python .decorator,code .template_comment,code .pi,code .doctype,code .deletion,code .shebang,code .apache .sqbracket,code .tex .formula{color:#777;}code .keyword,code .literal,code .css .id,code .phpdoc,code .function .title,code .class .title,code .haskell .label,code .vbscript .built_in,code .sql .aggregate,code .rsl .built_in,code .smalltalk .class,code .xml .tag .title,code .diff .header,code .chunk,code .winutils,code .bash .variable,code .lisp .title,code .apache .tag,code .tex .special{font-weight:bold;}code .xml .css,code .xml .javascript,code .xml .vbscript,code .tex .formula{opacity:0.5;}","default":"pre code{display:block;padding:0.5em;}code{background:#F0F0F0;}code,code .ruby .subst,code .tag .title,code .lisp .title{color:black;}code .string,code .title,code .constant,code .parent,code .tag .value,code .rules .value,code .rules .value .number,code .preprocessor,code .ruby .symbol,code .ruby .symbol .string,code .ruby .symbol .keyword,code .ruby .symbol .keymethods,code .instancevar,code .aggregate,code .template_tag,code .django .variable,code .smalltalk .class,code .addition,code .flow,code .stream,code .bash .variable,code .apache .tag,code .apache .cbracket,code .tex .command,code .tex .special,code .erlang_repl .function_or_atom{color:#800;}code .comment,code .annotation,code .template_comment,code .diff .header,code .chunk{color:#888;}code .number,code .date,code .regexp,code .literal,code .smalltalk .symbol,code .smalltalk .char,code .go .constant,code .change{color:#080;}code .label,code .javadoc,code .ruby .string,code .decorator,code .filter .argument,code .localvars,code .array,code .attr_selector,code .important,code .pseudo,code .pi,code .doctype,code .deletion,code .envvar,code .shebang,code .apache .sqbracket,code .nginx .built_in,code .tex .formula,code .erlang_repl .reserved,code .input_number{color:#8888ff;}code .css .tag,code .javadoctag,code .phpdoc,code .yardoctag{font-weight:bold;}code .keyword,code .id,code .phpdoc,code .title,code .built_in,code .aggregate,code .smalltalk .class,code .winutils,code .bash .variable,code .apache .tag,code .go .typename,code .tex .command{font-weight:bold;}code .nginx .built_in{font-weight:normal;}code .xml .css,code .xml .javascript,code .xml .vbscript,code .tex .formula{opacity:0.5;}",far:"pre code{display:block;padding:0.5em;}code{background:#000080;}code,.ruby .subst{color:#0FF;}code .string,code .ruby .string,code .function .title,code .class .title,code .haskell .label,code .ini .title,code .tag .value,code .css .rules .value,code .css .rules .value .number,code .preprocessor,code .ruby .symbol,code .ruby .symbol .string,code .ruby .symbol .keyword,code .ruby .symbol .keymethods,code .built_in,code .sql .aggregate,code .django .template_tag,code .django .variable,code .smalltalk .class,code .addition,code .apache .tag,code .apache .cbracket,code .tex .command{color:#FF0;}code .keyword,code .css .id,code .function .title,code .class .title,code .haskell .label,code .ini .title,code .vbscript .built_in,code .sql .aggregate,code .rsl .built_in,code .smalltalk .class,code .xml .tag .title,code .winutils,code .flow,code .lisp .title,code .change,code .envvar,code .bash .variable,code .tex .special{color:#FFF;}code .comment,code .phpdoc,code .javadoc,code .java .annotation,code .template_comment,code .deletion,code .apache .sqbracket,code .tex .formula{color:#888;}code .number,code .date,code .regexp,code .literal,code .smalltalk .symbol,code .smalltalk .char{color:#0F0;}code .python .decorator,code .django .filter .argument,code .smalltalk .localvars,code .smalltalk .array,code .attr_selector,code .pseudo,code .xml .pi,code .diff .header,code .chunk,code .shebang,code .nginx .built_in,code .input_number{color:#008080;}code .keyword,code .css .id,code .function .title,code .class .title,code .haskell .label,code .ini .title,code .vbscript .built_in,code .sql .aggregate,code .rsl .built_in,code .smalltalk .class,code .xml .tag .title,code .winutils,code .flow,code .lisp .title,code .apache .tag,code .nginx .built_in,code .tex .command,code .tex .special{font-weight:bold;}",github:"pre code{display:block;padding:0.5em;}code{color:#000;background:#f8f8ff;}code .comment,code .template_comment,code .diff .header,code .javadoc{color:#998;font-style:italic;}code .keyword,code .css .rule .keyword,code .winutils,code .javascript .title,code .lisp .title,code .subst{color:#000;font-weight:bold;}code .number,code .hexcolor{color:#40a070;}code .string,code .tag .value,code .phpdoc,code .tex .formula{color:#dd1144;}code .title,code .id{color:#900;font-weight:bold;}code .javascript .title,code .lisp .title,code .subst{font-weight:normal;}code .class .title,code .haskell .label,code .tex .command{color:#458;font-weight:bold;}code .tag,code .tag .title,code .rules .property,code .django .tag .keyword{color:#000080;font-weight:normal;}code .attribute,code .variable,code .instancevar,code .lisp .body{color:#008080;}code .regexp{color:#009926;}code .class{color:#458;font-weight:bold;}code .symbol,code .ruby .symbol .string,code .ruby .symbol .keyword,code .ruby .symbol .keymethods,code .lisp .keyword,code .tex .special,code .input_number{color:#990073;}code .builtin,code .built_in,code .lisp .title{color:#0086b3;}code .preprocessor,code .pi,code .doctype,code .shebang,code .cdata{color:#999;font-weight:bold;}code .deletion{background:#ffdddd;}code .addition{background:#ddffdd;}code .diff .change{background:#0086b3;}code .chunk{color:#aaaaaa;}code .tex .formula{opacity:0.5;}",idea:"pre code{display:block;padding:0.5em;}code{color:#000;background:#fff;}code .subst,code .title{font-weight:normal;color:#000;}code .comment,code .template_comment,code .javadoc,code .diff .header{color:#808080;font-style:italic;}code .annotation,code .decorator,code .preprocessor,code .doctype,code .pi,code .chunk,code .shebang,code .apache .cbracket,code .input_number{color:#808000;}code .tag,code .pi{background:#efefef;}code .tag .title,code .id,code .attr_selector,code .pseudo,code .literal,code .keyword,code .hexcolor,code .css .function,code .ini .title,code .css .class,code .list .title,code .tex .command{font-weight:bold;color:#000080;}code .attribute,code .rules .keyword,code .number,code .date,code .regexp,code .tex .special{font-weight:bold;color:#0000ff;}code .number,code .regexp{font-weight:normal;}code .string,code .value,code .filter .argument,code .css .function .params,code .apache .tag{color:#008000;font-weight:bold;}code .symbol,code .ruby .symbol .string,code .ruby .symbol .keyword,code .ruby .symbol .keymethods,code .char,code .tex .formula{color:#000;background:#d0eded;font-style:italic;}code .phpdoc,code .yardoctag,code .javadoctag{text-decoration:underline;}code .variable,code .envvar,code .apache .sqbracket,code .nginx .built_in{color:#660e7a;}code .addition{background:#baeeba;}code .deletion{background:#ffc8bd;}code .diff .change{background:#bccff9;}",ir_black:"pre code{display:block;padding:0.5em;}code{background:#000;color:#f8f8f8;}code .shebang,code .comment,code .template_comment,code .javadoc{color:#7c7c7c;}code .keyword,code .tag,code .ruby .function .keyword,code .tex .command{color:#96CBFE;}code .function .keyword,code .sub .keyword,code .method,code .list .title{color:#FFFFB6;}code .string,code .tag .value,code .cdata,code .filter .argument,code .attr_selector,code .apache .cbracket,code .date{color:#A8FF60;}code .subst{color:#DAEFA3;}code .regexp{color:#E9C062;}code .function .title,code .sub .identifier,code .pi,code .decorator,code .ini .title,code .tex .special{color:#FFFFB6;}code .class .title,code .haskell .label,code .constant,code .smalltalk .class,code .javadoctag,code .yardoctag,code .phpdoc,code .nginx .built_in{color:#FFFFB6;}code .symbol,code .ruby .symbol .string,code .ruby .symbol .keyword,code .ruby .symbol .keymethods,code .number,code .variable,code .vbscript,code .literal{color:#C6C5FE;}code .css .tag{color:#96CBFE;}code .css .rules .property,code .css .id{color:#FFFFB6;}code .css .class{color:#FFF;}code .hexcolor{color:#C6C5FE;}code .number{color:#FF73FD;}code .tex .formula{opacity:0.7;}",magula:"pre code{display:block;padding:0.5em;}code{background-color:#f4f4f4;}code,code .ruby .subst,code .lisp .title{color:black;}code .string,code .title,code .parent,code .tag .value,code .rules .value,code .rules .value .number,code .preprocessor,code .ruby .symbol,code .ruby .symbol .string,code .ruby .symbol .keyword,code .ruby .symbol .keymethods,code .instancevar,code .aggregate,code .template_tag,code .django .variable,code .smalltalk .class,code .addition,code .flow,code .stream,code .bash .variable,code .apache .cbracket{color:#050;}code .comment,code .annotation,code .template_comment,code .diff .header,code .chunk{color:#777;}code .number,code .date,code .regexp,code .literal,code .smalltalk .symbol,code .smalltalk .char,code .change,code .tex .special{color:#800;}code .label,code .javadoc,code .ruby .string,code .decorator,code .filter .argument,code .localvars,code .array,code .attr_selector,code .pseudo,code .pi,code .doctype,code .deletion,code .envvar,code .shebang,code .apache .sqbracket,code .nginx .built_in,code .tex .formula,code .input_number{color:#00e;}code .keyword,code .id,code .phpdoc,code .title,code .built_in,code .aggregate,code .smalltalk .class,code .winutils,code .bash .variable,code .apache .tag,code .xml .tag,code .xml .title,code .tex .command{font-weight:bold;color:navy;}code .nginx .built_in{font-weight:normal;}code .xml .css,code .xml .javascript,code .xml .vbscript,code .tex .formula{opacity:0.5;}code .apache .tag{font-weight:bold;color:blue;}",solarized_dark:"pre code{display:block;padding:0.5em;}code{background:#002b36;color:#839496;}code .comment,code .template_comment,code .diff .header,code .doctype,code .lisp .string,code .javadoc{color:#586e75;font-style:italic;}code .keyword,code .css .rule .keyword,code .winutils,code .javascript .title,code .method,code .addition,code .css .tag,code .lisp .title{color:#859900;}code .number,code .command,code .string,code .tag .value,code .phpdoc,code .tex .formula,code .regexp,code .hexcolor{color:#2aa198;}code .title,code .localvars,code .function .title,code .chunk,code .decorator,code .builtin,code .built_in,code .lisp .title,code .identifier,code .title .keymethods,code .id{color:#268bd2;}code .tag .title,code .rules .property,code .django .tag .keyword{font-weight:bold;}code .attribute,code .variable,code .instancevar,code .lisp .body,code .smalltalk .number,code .constant,code .class .title,code .parent,code .haskell .label{color:#b58900;}code .preprocessor,code .pi,code .shebang,code .symbol,code .diff .change,code .special,code .keymethods,code .attr_selector,code .important,code .subst,code .cdata{color:#cb4b16;}code .deletion{color:#dc322f;}code .tex .formula{background:#073642;}",solarized_light:"pre code{display:block;padding:0.5em;}code{background:#fdf6e3;color:#657b83;}code .comment,code .template_comment,code .diff .header,code .doctype,code .lisp .string,code .javadoc{color:#93a1a1;font-style:italic;}code .keyword,code .css .rule .keyword,code .winutils,code .javascript .title,code .method,code .addition,code .css .tag,code .lisp .title{color:#859900;}code .number,code .command,code .string,code .tag .value,code .phpdoc,code .tex .formula,code .regexp,code .hexcolor{color:#2aa198;}code .title,code .localvars,code .function .title,code .chunk,code .decorator,code .builtin,code .built_in,code .lisp .title,code .identifier,code .title .keymethods,code .id{color:#268bd2;}code .tag .title,code .rules .property,code .django .tag .keyword{font-weight:bold;}code .attribute,code .variable,code .instancevar,code .lisp .body,code .smalltalk .number,code .constant,code .class .title,code .parent,code .haskell .label{color:#b58900;}code .preprocessor,code .pi,code .shebang,code .symbol,code .diff .change,code .special,code .keymethods,code .attr_selector,code .important,code .subst,code .cdata{color:#cb4b16;}code .deletion{color:#dc322f;}code .tex .formula{background:#eee8d5;}",sunburst:"pre code{display:block;padding:0.5em;}code{background:#000;color:#f8f8f8;}code .comment,code .template_comment,code .javadoc{color:#aeaeae;font-style:italic;}code .keyword,code .ruby .function .keyword{color:#E28964;}code .function .keyword,code .sub .keyword,code .method,code .list .title{color:#99CF50;}code .string,code .tag .value,code .cdata,code .filter .argument,code .attr_selector,code .apache .cbracket,code .date,code .tex .command{color:#65B042;}code .subst{color:#DAEFA3;}code .regexp{color:#E9C062;}code .function .title,code .sub .identifier,code .pi,code .tag,code .tag .keyword,code .decorator,code .ini .title,code .shebang,code .input_number{color:#89BDFF;}code .class .title,code .haskell .label,code .smalltalk .class,code .javadoctag,code .yardoctag,code .phpdoc{text-decoration:underline;}code .symbol,code .ruby .symbol .string,code .ruby .symbol .keyword,code .ruby .symbol .keymethods,code .number{color:#3387CC;}code .params,code .variable{color:#3E87E3;}code .css .tag,code .rules .property,code .pseudo,code .tex .special{color:#CDA869;}code .css .class{color:#9B703F;}code .rules .keyword{color:#C5AF75;}code .rules .value{color:#CF6A4C;}code .css .id{color:#8B98AB;}code .annotation,code .apache .sqbracket,code .nginx .built_in{color:#9B859D;}code .preprocessor{color:#8996A8;}code .hexcolor,code .css .value .number{color:#DD7B3B;}code .css .function{color:#DAD085;}code .diff .header,code .chunk,code .tex .formula{background-color:#0E2231;color:#F8F8F8;font-style:italic;}code .diff .change{background-color:#4A410D;color:#F8F8F8;}code .addition{background-color:#253B22;color:#F8F8F8;}code .deletion{background-color:#420E09;color:#F8F8F8;}",vs:"pre code{display:block;padding:0.5em;}code .comment,code .annotation,code .template_comment,code .diff .header,code .chunk,code .apache .cbracket{color:#008000;}code .keyword,code .id,code .title,code .built_in,code .aggregate,code .smalltalk .class,code .winutils,code .bash .variable,code .tex .command{color:#0000ff;}code .string,code .title,code .parent,code .tag .value,code .rules .value,code .rules .value .number,code .ruby .symbol,code .ruby .symbol .string,code .ruby .symbol .keyword,code .ruby .symbol .keymethods,code .instancevar,code .aggregate,code .template_tag,code .django .variable,code .addition,code .flow,code .stream,code .apache .tag,code .date,code .tex .formula{color:#a31515;}code .ruby .string,code .decorator,code .filter .argument,code .localvars,code .array,code .attr_selector,code .pseudo,code .pi,code .doctype,code .deletion,code .envvar,code .shebang,code .preprocessor,code .userType,code .apache .sqbracket,code .nginx .built_in,code .tex .special,code .input_number{color:#2b91af;}code .phpdoc,code .javadoc,code .xmlDocTag{color:#808080;}code .vhdl .type{font-weight:bold;}code .vhdl .string{color:#666666;}code .vhdl .literal{color:#a31515;}",zenburn:"pre code{display:block;padding:0.5em;}code{background:#3F3F3F;color:#DCDCDC;}code .keyword,code .tag,code .django .tag,code .django .keyword,code .css .class,code .css .id,code .lisp .title{color:#E3CEAB;}code .django .template_tag,code .django .variable,code .django .filter .argument{color:#DCDCDC;}code .number,code .date{color:#8CD0D3;}code .dos .envvar,code .dos .stream,code .variable,code .apache .sqbracket{color:#EFDCBC;}code .dos .flow,code .diff .change,code .python .exception,code .python .built_in,code .literal,code .tex .special{color:#EFEFAF;}code .diff .chunk,code .ruby .subst{color:#8F8F8F;}code .dos .keyword,code .python .decorator,code .class .title,code .haskell .label,code .function .title,code .ini .title,code .diff .header,code .ruby .class .parent,code .apache .tag,code .nginx .built_in,code .tex .command,code .input_number{color:#efef8f;}code .dos .winutils,code .ruby .symbol,code .ruby .symbol .string,code .ruby .symbol .keyword,code .ruby .symbol .keymethods,code .ruby .string,code .ruby .instancevar{color:#DCA3A3;}code .diff .deletion,code .string,code .tag .value,code .preprocessor,code .built_in,code .sql .aggregate,code .javadoc,code .smalltalk .class,code .smalltalk .localvars,code .smalltalk .array,code .css .rules .value,code .attr_selector,code .pseudo,code .apache .cbracket,code .tex .formula{color:#CC9393;}code .shebang,code .diff .addition,code .comment,code .java .annotation,code .template_comment,code .pi,code .doctype{color:#7F9F7F;}code .xml .css,code .xml .javascript,code .xml .vbscript,code .tex .formula{opacity:0.5;}"};c.cssForStyle=function(){var b=a.config;return b.highlightStyle===undefined&&(b.highlightStyle="default"),b.highlightStyle===null?"":d[b.highlightStyle]},c.highlightCodeBlocks=function(a){var c=a.getElementsByTagName("code"),d,e;for(e=0;e<c.length;e++)d=c[e],b.highlightBlock(d," ")}}(b),!function(a){!function(a){var b=a.slide={};b.create=function(a){var b={},d=a,e;return b.source=function(a){if(a===undefined)return d;d=a,e!==undefined&&c(b)},b.element=function(){return e===undefined&&(e=document.createElement("div"),e.className="slide",e.style.display="none",e.appendChild(document.createElement("div")),c(b)),e},b};var c=function(a){var b=a.element().children[0];b.innerHTML=a.source(),d(b)},d=function(b){a.converter.convertContentClasses(b),a.converter.convertSlideClasses(b),a.converter.convertMarkdown(b),a.converter.convertCodeClasses(b),a.highlighter.highlightCodeBlocks(b)}}(a);var b=a.slideshow={},c=227,d=3,e=4;b.create=function(b,c){var d=f(b,c),e=document.createElement("div");e.className="position",c.appendChild(e),g(c);for(var h=0;h<d.length;h++){var i=d[h];c.appendChild(i.element())}return{showSlide:function(b){var c=d[b];a.exports.events.emit("slidein",c.element(),b),c.element().style.display="table",e.innerHTML=b+1+" / "+d.length},hideSlide:function(b){var c=d[b];a.exports.events.emit("slideout",c.element(),b),c.element().style.display="none"},getSlideCount:function(){return d.length}}};var f=function(b,c){var d,e=[],f,g;d=b.split(/\n\n---\n/);for(g=0;g<d.length;++g)e.push(a.slide.create(d[g]));return e},g=function(a){var b=c*e,f=c*d,g=function(){var g=window.innerHeight,h=window.innerWidth,i;h/e>g/d?i=g/(c*d):i=h/(c*e),a.style["-webkit-transform"]="scale("+i+")",a.style.MozTransform="scale("+i+")",a.style.left=(h-b*i)/2+"px",a.style.top=(g-f*i)/2+"px"};a.style.width=c*e+"px",a.style.height=c*d+"px",window.onresize=g,window.onresize()}}(b),window.onload=function(){var a=document.getElementById("source"),b=document.getElementById("slideshow");if(!c(a,b))return;a.style.display="none",d(),e(a,b)};var c=function(a,b){return a?b?!0:(alert("remark error: slideshow element not present."),!1):(alert("remark error: source element not present."),!1)},d=function(){var a=document.createElement("style"),c=document.getElementsByTagName("head")[0];a.type="text/css",a.innerHTML="html,body{background:#d7d7d7;font-family:Georgia;font-size:20px;overflow:hidden;}#slideshow{background:#fff;position:absolute;-webkit-transform-origin:top left;-moz-transform-origin:top left;transform-origin:top-left;}#slideshow .slide{display:table;float:left;height:100%;overflow:hidden;width:100%;-moz-box-shadow:0 0 30px #888;-webkit-box-shadow:0 0 30px #888;box-shadow:0 0 30px #888;}#slideshow .slide>.center{text-align:center;}#slideshow .slide>.middle{vertical-align:middle;}#slideshow .slide .content{display:table-cell;padding:1em 4em 1em 4em;}#slideshow .slide .content .center{display:block;text-align:center;}#slideshow .slide .content pre,#slideshow .slide .content code{font-family:Monaco, monospace;font-size:16px;}#slideshow .slide .content h1 code{font-size:0.8em;}#slideshow .position{bottom:12px;opacity:0.5;position:absolute;right:20px;}p>code{padding:1px 4px;}",a.innerHTML+=b.highlighter.cssForStyle(),c.insertBefore(a,c.firstChild)},e=function(a,c){var d=a.innerHTML,e;e=b.slideshow.create(d,c),b.controller.create(e),b.dispatcher.create()}}(this)
module.exports = context => { return { Program() { context .getSourceCode() .getAllComments() .forEach(commentNode => { if (/\b(FOO)\b/.test(commentNode.value)) { context.report({ node: commentNode, message: 'Has "FOO"', }); } }); }, }; };
import React from "react"; import styled from "styled-components"; import { BaseContainer } from "../../helpers/layout"; import { getDomain } from "../../helpers/getDomain"; import { Spinner } from "../../views/design/Spinner"; import { Button } from "../../views/design/Button"; import { withRouter } from "react-router-dom"; import Player from "../../views/Player"; import User from "../shared/models/User"; const Container = styled(BaseContainer)` color: white; text-align: center; `; const Users = styled.ul` list-style: none; padding-left: 0; `; const PlayerContainer = styled.li` display: flex; flex-direction: column; align-items: center; justify-content: center; `; const UserName = styled.div` font-weight: lighter; margin-left: 5px; `; const Name = styled.div` font-weight: bold; color: #06c4ff; `; const Id = styled.div` margin-left: auto; margin-right: 10px; font-weight: bold; `; class Game extends React.Component { constructor() { super(); this.state = { users: null }; } logout() { localStorage.removeItem("token"); fetch(`${getDomain()}/logout/`+localStorage.getItem("id"), { method: "GET", headers: { "Content-Type": "application/json" } }) .then(response => response.json()) .catch(err => { alert(`Something went wrong during the logout: ${err.message}`); }); localStorage.removeItem( "id"); this.props.history.push("/login"); } componentDidMount() { fetch(`${getDomain()}/users`, { method: "GET", headers: { "Content-Type": "application/json" } }) .then(response => response.json()) .then(async users => { // delays continuous execution of an async operation for 0.8 seconds. // This is just a fake async call, so that the spinner can be displayed // feel free to remove it :) await new Promise(resolve => setTimeout(resolve, 800)); this.setState({ users }); }) .catch(err => { console.log(err); alert("Something went wrong fetching the users: " + err); }); } render() { return ( <Container> <h2>Happy Coding! </h2> <p>Get all users from secure end point:</p> {!this.state.users ? ( <Spinner /> ) : ( <div> <Users> {this.state.users.map(user => { return ( <PlayerContainer key={user.id}> <Container> <td><nobr><Name>{user.name}</Name> <a href="#" onClick={()=>{this.props.history.push('/profile'); localStorage.setItem("selectedID", user.id);}}> {user.username}</a> <Id>Id: {user.id}</Id></nobr></td> </Container> </PlayerContainer> ); })} </Users> <Button width="100%" onClick={() => { this.logout(); }} > Logout </Button> </div> )} </Container> ); } } /*<Button width="30%" onClick={() => { this.props.history.push('/profile' ); localStorage.setItem("selectedID", user.id); }} >Info </Button>*/ export default withRouter(Game);
/** * Drop Menu * author: Pavel Khoroshkov aka pgood * http://pgood.ru */ function initDropMenu(id){ var menu=todo.get(id); if(!menu)return; var _dmCookie=new Cookie('sidemenu'+id), indexes=_dmCookie.indexes?_dmCookie.indexes.split(','):[], isOpen=function(id){for(var i=0;i<indexes.length;i++)if(indexes[i]==id)return true;}, createFolderButton=function(state,parent){ var e=parent.appendChild(todo.create('span')); e._dmChangeState=function(){ this._dmState=!this._dmState; this.className=this._dmState?'open':'close'; }; e.onclick=function(){ if(this.parentNode.parentNode._dmSubmenu()) this._dmChangeState(); return false; }; e._dmState=!state; e._dmChangeState(); return e; }; _dmCookie.addIndex=function(id){ var idx=this.indexes?this.indexes.split(','):[]; for(var i=0;i<idx.length;i++)if(idx[i]==id)return; idx.push(id); this.indexes=idx.join(','); this.store(1); }; _dmCookie.removeIndex=function(id){ var idx=this.indexes?this.indexes.split(','):[]; for(var i=0;i<idx.length;i++)if(idx[i]==id){ idx.splice(i,1); this.indexes=idx.join(','); this.store(1); } }; todo.loop(menu.getElementsByTagName('dt'),function(k){ this._dmIndex=k; this._dmGetDd=function(){ return function(e){while(e=e.nextSibling)if(e.nodeType==1)return e.nodeName.toLowerCase()=='dd'?e:null;}(this); }; var dd=this._dmGetDd(), s=this.className.search(/open/)!=-1||isOpen(this._dmIndex); if(dd){ this._dmButton=createFolderButton(s,this.getElementsByTagName('a')[0]||this.getElementsByTagName('span')[0]); if(s)dd.style.height='auto'; this._dmSubmenu=function(){ var dd=this._dmGetDd(), m=function(){ var r=todo.motion(dd.style.height,dd._task.start,dd._task.finish,4); if(r.ready){ dd.style.height=dd._task.finish?'auto':0; window.clearInterval(dd._timer); dd._timer=null; }else dd.style.height=r.res+'px'; }; if(!dd._timer){ if(this._dmButton._dmState){ _dmCookie.removeIndex(this._dmIndex); dd.style.height=dd.offsetHeight+'px'; dd._task={'start':dd.offsetHeight,'finish':0}; }else{ _dmCookie.addIndex(this._dmIndex); if(isNaN(parseInt(dd.style.height)))dd.style.height=0; dd._task={'start':0,'finish':dd.getElementsByTagName('dl')[0].offsetHeight}; }; dd._timer=window.setInterval(m,50); return true; } return false; } } }); };
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):"object"==typeof exports?exports.ReactModal=t(require("react"),require("react-dom")):e.ReactModal=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t(t.s=10)}([function(e,t,n){"use strict";function o(e){return function(){return e}}var r=function(){};r.thatReturns=o,r.thatReturnsFalse=o(!1),r.thatReturnsTrue=o(!0),r.thatReturnsNull=o(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t,n){"use strict";function o(e,t,n,o,a,u,s,i){if(r(t),!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,o,a,u,s,i],f=0;l=new Error(t.replace(/%s/g,function(){return c[f++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}}var r=function(e){};r=function(e){if(void 0===e)throw new Error("invariant requires an error message argument")},e.exports=o},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,n){t.exports=e},function(e,t,n){var o="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,r=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===o};e.exports=n(13)(r,!0)},function(e,t,n){"use strict";var o=n(0),r=o;!function(){var e=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];var r=0,a="Warning: "+e.replace(/%s/g,function(){return n[r++]});"undefined"!=typeof console&&console.error(a);try{throw new Error(a)}catch(e){}};r=function(t,n){if(void 0===n)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==n.indexOf("Failed Composite propType: ")&&!t){for(var o=arguments.length,r=Array(o>2?o-2:0),a=2;a<o;a++)r[a-2]=arguments[a];e.apply(void 0,[n].concat(r))}}}(),e.exports=r},function(e,t,n){"use strict";function o(e){return e.offsetWidth<=0&&e.offsetHeight<=0||"none"===e.style.display}function r(e){for(var t=e;t&&t!==document.body;){if(o(t))return!1;t=t.parentNode}return!0}function a(e,t){var n=e.nodeName.toLowerCase();return(i.test(n)&&!e.disabled||("a"===n?e.href||t:t))&&r(e)}function u(e){var t=e.getAttribute("tabindex");null===t&&(t=void 0);var n=isNaN(t);return(n||t>=0)&&a(e,!n)}function s(e){return[].slice.call(e.querySelectorAll("*"),0).filter(u)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;/*! * Adapted from jQuery UI core * * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/category/ui-core/ */ var i=/input|select|textarea|button|object/;e.exports=t.default},function(e,t,n){"use strict";function o(e,t){if(!e||!e.length)throw new Error("react-modal: No elements were found for selector "+t+".")}function r(e){var t=e;if("string"==typeof t){var n=document.querySelectorAll(t);o(n,t),t="length"in n?n[0]:n}return f=t||f}function a(){return!(!document||!document.body)&&(r(document.body),!0)}function u(e){if(!e&&!f&&!a())throw new Error(["react-modal: Cannot fallback to `document.body`, because it's not ready or available.","If you are doing server-side rendering, use this function to defined an element.","`Modal.setAppElement(el)` to make this accessible"])}function s(e){u(e),(e||f).setAttribute("aria-hidden","true")}function i(e){u(e),(e||f).removeAttribute("aria-hidden")}function l(){f=null}function c(){f=document.body}Object.defineProperty(t,"__esModule",{value:!0}),t.assertNodeList=o,t.setElement=r,t.tryForceFallback=a,t.validateElement=u,t.hide=s,t.show=i,t.documentNotReadyOrSSRTesting=l,t.resetForTesting=c;var f=null},function(e,t,n){"use strict";function o(){return s}function r(e){return s[e]||(s[e]=0),s[e]+=1,e}function a(e){return s[e]&&(s[e]-=1),e}function u(){return Object.keys(s).reduce(function(e,t){return e+s[t]},0)}Object.defineProperty(t,"__esModule",{value:!0}),t.get=o,t.add=r,t.remove=a,t.totalCount=u;var s={}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(20),r=function(e){return e&&e.__esModule?e:{default:e}}(o),a=r.default,u=a.canUseDOM?window.HTMLElement:{};t.default=u,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(11),r=function(e){return e&&e.__esModule?e:{default:e}}(o);t.default=r.default,e.exports=t.default},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){return e()}Object.defineProperty(t,"__esModule",{value:!0}),t.bodyOpenClassName=t.portalClassName=void 0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),c=n(3),f=o(c),p=n(12),d=o(p),y=n(4),v=o(y),h=n(16),m=o(h),b=n(7),O=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(b),C=n(9),w=o(C),g=t.portalClassName="ReactModalPortal",T=t.bodyOpenClassName="ReactModal__Body--open",P=d.default.unstable_renderSubtreeIntoContainer,_=function(e){function t(){var e,n,o,u;r(this,t);for(var l=arguments.length,c=Array(l),p=0;p<l;p++)c[p]=arguments[p];return n=o=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(c))),o.removePortal=function(){d.default.unmountComponentAtNode(o.node),s(o.props.parentSelector).removeChild(o.node)},o.renderPortal=function(e){o.portal=P(o,f.default.createElement(m.default,i({defaultStyles:t.defaultStyles},e)),o.node)},u=n,a(o,u)}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.node=document.createElement("div"),this.node.className=this.props.portalClassName,s(this.props.parentSelector).appendChild(this.node),this.renderPortal(this.props)}},{key:"componentWillReceiveProps",value:function(e){var t=e.isOpen;if(this.props.isOpen||t){var n=s(this.props.parentSelector),o=s(e.parentSelector);o!==n&&(n.removeChild(this.node),o.appendChild(this.node)),this.renderPortal(e)}}},{key:"componentWillUpdate",value:function(e){e.portalClassName!==this.props.portalClassName&&(this.node.className=e.portalClassName)}},{key:"componentWillUnmount",value:function(){if(this.node&&this.portal){var e=this.portal.state,t=Date.now(),n=e.isOpen&&this.props.closeTimeoutMS&&(e.closesAt||t+this.props.closeTimeoutMS);n?(e.beforeClose||this.portal.closeWithTimeout(),setTimeout(this.removePortal,n-t)):this.removePortal()}}},{key:"render",value:function(){return null}}],[{key:"setAppElement",value:function(e){O.setElement(e)}},{key:"injectCSS",value:function(){console.warn("React-Modal: injectCSS has been deprecated and no longer has any effect. It will be removed in a later version")}}]),t}(c.Component);_.propTypes={isOpen:v.default.bool.isRequired,style:v.default.shape({content:v.default.object,overlay:v.default.object}),portalClassName:v.default.string,bodyOpenClassName:v.default.string,className:v.default.oneOfType([v.default.string,v.default.object]),overlayClassName:v.default.oneOfType([v.default.string,v.default.object]),appElement:v.default.instanceOf(w.default),onAfterOpen:v.default.func,onRequestClose:v.default.func,closeTimeoutMS:v.default.number,ariaHideApp:v.default.bool,shouldFocusAfter:v.default.bool,shouldCloseOnOverlayClick:v.default.bool,parentSelector:v.default.func,aria:v.default.object,role:v.default.string,contentLabel:v.default.string},_.defaultProps={isOpen:!1,portalClassName:g,bodyOpenClassName:T,ariaHideApp:!0,closeTimeoutMS:0,shouldFocusAfterRender:!0,shouldCloseOnOverlayClick:!0,parentSelector:function(){return document.body}},_.defaultStyles={overlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.75)"},content:{position:"absolute",top:"40px",left:"40px",right:"40px",bottom:"40px",border:"1px solid #ccc",background:"#fff",overflow:"auto",WebkitOverflowScrolling:"touch",borderRadius:"4px",outline:"none",padding:"20px"}},t.default=_},function(e,n){e.exports=t},function(e,t,n){"use strict";var o=n(0),r=n(1),a=n(5),u=n(2),s=n(14);e.exports=function(e,t){function n(e){var t=e&&(P&&e[P]||e[_]);if("function"==typeof t)return t}function i(e,t){return e===t?0!==e||1/e==1/t:e!==e&&t!==t}function l(e){this.message=e,this.stack=""}function c(e){function n(n,i,c,f,p,d,y){if(f=f||j,d=d||c,y!==u)if(t)r(!1,"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");else if("undefined"!=typeof console){var v=f+":"+c;!o[v]&&s<3&&(a(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",d,f),o[v]=!0,s++)}return null==i[c]?n?new l(null===i[c]?"The "+p+" `"+d+"` is marked as required in `"+f+"`, but its value is `null`.":"The "+p+" `"+d+"` is marked as required in `"+f+"`, but its value is `undefined`."):null:e(i,c,f,p,d)}var o={},s=0,i=n.bind(null,!1);return i.isRequired=n.bind(null,!0),i}function f(e){function t(t,n,o,r,a,u){var s=t[n];if(C(s)!==e)return new l("Invalid "+r+" `"+a+"` of type `"+w(s)+"` supplied to `"+o+"`, expected `"+e+"`.");return null}return c(t)}function p(e){function t(t,n,o,r,a){if("function"!=typeof e)return new l("Property `"+a+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var s=t[n];if(!Array.isArray(s)){return new l("Invalid "+r+" `"+a+"` of type `"+C(s)+"` supplied to `"+o+"`, expected an array.")}for(var i=0;i<s.length;i++){var c=e(s,i,o,r,a+"["+i+"]",u);if(c instanceof Error)return c}return null}return c(t)}function d(e){function t(t,n,o,r,a){if(!(t[n]instanceof e)){var u=e.name||j;return new l("Invalid "+r+" `"+a+"` of type `"+T(t[n])+"` supplied to `"+o+"`, expected instance of `"+u+"`.")}return null}return c(t)}function y(e){function t(t,n,o,r,a){for(var u=t[n],s=0;s<e.length;s++)if(i(u,e[s]))return null;return new l("Invalid "+r+" `"+a+"` of value `"+u+"` supplied to `"+o+"`, expected one of "+JSON.stringify(e)+".")}return Array.isArray(e)?c(t):(a(!1,"Invalid argument supplied to oneOf, expected an instance of array."),o.thatReturnsNull)}function v(e){function t(t,n,o,r,a){if("function"!=typeof e)return new l("Property `"+a+"` of component `"+o+"` has invalid PropType notation inside objectOf.");var s=t[n],i=C(s);if("object"!==i)return new l("Invalid "+r+" `"+a+"` of type `"+i+"` supplied to `"+o+"`, expected an object.");for(var c in s)if(s.hasOwnProperty(c)){var f=e(s,c,o,r,a+"."+c,u);if(f instanceof Error)return f}return null}return c(t)}function h(e){function t(t,n,o,r,a){for(var s=0;s<e.length;s++){if(null==(0,e[s])(t,n,o,r,a,u))return null}return new l("Invalid "+r+" `"+a+"` supplied to `"+o+"`.")}if(!Array.isArray(e))return a(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),o.thatReturnsNull;for(var n=0;n<e.length;n++){var r=e[n];if("function"!=typeof r)return a(!1,"Invalid argument supplid to oneOfType. Expected an array of check functions, but received %s at index %s.",g(r),n),o.thatReturnsNull}return c(t)}function m(e){function t(t,n,o,r,a){var s=t[n],i=C(s);if("object"!==i)return new l("Invalid "+r+" `"+a+"` of type `"+i+"` supplied to `"+o+"`, expected `object`.");for(var c in e){var f=e[c];if(f){var p=f(s,c,o,r,a+"."+c,u);if(p)return p}}return null}return c(t)}function b(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(b);if(null===t||e(t))return!0;var o=n(t);if(!o)return!1;var r,a=o.call(t);if(o!==t.entries){for(;!(r=a.next()).done;)if(!b(r.value))return!1}else for(;!(r=a.next()).done;){var u=r.value;if(u&&!b(u[1]))return!1}return!0;default:return!1}}function O(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function C(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":O(t,e)?"symbol":t}function w(e){if(void 0===e||null===e)return""+e;var t=C(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function g(e){var t=w(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}function T(e){return e.constructor&&e.constructor.name?e.constructor.name:j}var P="function"==typeof Symbol&&Symbol.iterator,_="@@iterator",j="<<anonymous>>",E={array:f("array"),bool:f("boolean"),func:f("function"),number:f("number"),object:f("object"),string:f("string"),symbol:f("symbol"),any:function(){return c(o.thatReturnsNull)}(),arrayOf:p,element:function(){function t(t,n,o,r,a){var u=t[n];if(!e(u)){return new l("Invalid "+r+" `"+a+"` of type `"+C(u)+"` supplied to `"+o+"`, expected a single ReactElement.")}return null}return c(t)}(),instanceOf:d,node:function(){function e(e,t,n,o,r){return b(e[t])?null:new l("Invalid "+o+" `"+r+"` supplied to `"+n+"`, expected a ReactNode.")}return c(e)}(),objectOf:v,oneOf:y,oneOfType:h,shape:m};return l.prototype=Error.prototype,E.checkPropTypes=s,E.PropTypes=E,E}},function(e,t,n){"use strict";function o(e,t,n,o,i){for(var l in e)if(e.hasOwnProperty(l)){var c;try{r("function"==typeof e[l],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",o||"React class",n,l),c=e[l](t,l,o,n,null,u)}catch(e){c=e}if(a(!c||c instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",o||"React class",n,l,typeof c),c instanceof Error&&!(c.message in s)){s[c.message]=!0;var f=i?i():"";a(!1,"Failed %s type: %s%s",n,c.message,null!=f?f:"")}}}var r=n(1),a=n(5),u=n(2),s={};e.exports=o},function(e,t,n){"use strict";var o=n(0),r=n(1),a=n(2);e.exports=function(){function e(e,t,n,o,u,s){s!==a&&r(!1,"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")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return n.checkPropTypes=o,n.PropTypes=n,n}},function(e,t,n){"use strict";function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),f=n(3),p=r(f),d=n(4),y=n(17),v=o(y),h=n(18),m=r(h),b=n(7),O=o(b),C=n(8),w=o(C),g=n(19),T=o(g),P=n(9),_=r(P),j={overlay:"ReactModal__Overlay",content:"ReactModal__Content"},E=9,R=27,x=function(e){function t(e){a(this,t);var n=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.setFocusAfterRender=function(e){n.focusAfterRender=n.props.shouldFocusAfterRender&&e},n.setOverlayRef=function(e){n.overlay=e},n.setContentRef=function(e){n.content=e},n.afterClose=function(){v.returnFocus(),v.teardownScopedFocus()},n.open=function(){n.beforeOpen(),n.state.afterOpen&&n.state.beforeClose?(clearTimeout(n.closeTimer),n.setState({beforeClose:!1})):(v.setupScopedFocus(n.node),v.markForFocusLater(),n.setState({isOpen:!0},function(){n.setState({afterOpen:!0}),n.props.isOpen&&n.props.onAfterOpen&&n.props.onAfterOpen()}))},n.close=function(){n.beforeClose(),n.props.closeTimeoutMS>0?n.closeWithTimeout():n.closeWithoutTimeout()},n.focusContent=function(){return n.content&&!n.contentHasFocus()&&n.content.focus()},n.closeWithTimeout=function(){var e=Date.now()+n.props.closeTimeoutMS;n.setState({beforeClose:!0,closesAt:e},function(){n.closeTimer=setTimeout(n.closeWithoutTimeout,n.state.closesAt-Date.now())})},n.closeWithoutTimeout=function(){n.setState({beforeClose:!1,isOpen:!1,afterOpen:!1,closesAt:null},n.afterClose)},n.handleKeyDown=function(e){e.keyCode===E&&(0,m.default)(n.content,e),e.keyCode===R&&(e.preventDefault(),n.requestClose(e))},n.handleOverlayOnClick=function(e){null===n.shouldClose&&(n.shouldClose=!0),n.shouldClose&&n.props.shouldCloseOnOverlayClick&&(n.ownerHandlesClose()?n.requestClose(e):n.focusContent()),n.shouldClose=null,n.moveFromContentToOverlay=null},n.handleOverlayOnMouseUp=function(){null===n.moveFromContentToOverlay&&(n.shouldClose=!1)},n.handleContentOnMouseUp=function(){n.shouldClose=!1},n.handleOverlayOnMouseDown=function(){n.moveFromContentToOverlay=!1},n.handleContentOnClick=function(){n.shouldClose=!1},n.handleContentOnMouseDown=function(){n.shouldClose=!1,n.moveFromContentToOverlay=!1},n.requestClose=function(e){return n.ownerHandlesClose()&&n.props.onRequestClose(e)},n.ownerHandlesClose=function(){return n.props.onRequestClose},n.shouldBeClosed=function(){return!n.state.isOpen&&!n.state.beforeClose},n.contentHasFocus=function(){return document.activeElement===n.content||n.content.contains(document.activeElement)},n.buildClassName=function(e,t){var o="object"===(void 0===t?"undefined":l(t))?t:{base:j[e],afterOpen:j[e]+"--after-open",beforeClose:j[e]+"--before-close"},r=o.base;return n.state.afterOpen&&(r=r+" "+o.afterOpen),n.state.beforeClose&&(r=r+" "+o.beforeClose),"string"==typeof t&&t?r+" "+t:r},n.ariaAttributes=function(e){return Object.keys(e).reduce(function(t,n){return t["aria-"+n]=e[n],t},{})},n.state={afterOpen:!1,beforeClose:!1},n.shouldClose=null,n.moveFromContentToOverlay=null,n}return s(t,e),c(t,[{key:"componentDidMount",value:function(){this.props.isOpen&&(this.setFocusAfterRender(!0),this.open())}},{key:"componentWillReceiveProps",value:function(e){e.bodyOpenClassName!==this.props.bodyOpenClassName&&console.warn('React-Modal: "bodyOpenClassName" prop has been modified. This may cause unexpected behavior when multiple modals are open.'),!this.props.isOpen&&e.isOpen?(this.setFocusAfterRender(!0),this.open()):this.props.isOpen&&!e.isOpen&&this.close()}},{key:"componentDidUpdate",value:function(){this.focusAfterRender&&(this.focusContent(),this.setFocusAfterRender(!1))}},{key:"componentWillUnmount",value:function(){this.beforeClose(),clearTimeout(this.closeTimer)}},{key:"beforeOpen",value:function(){var e=this.props,t=e.appElement,n=e.ariaHideApp,o=e.bodyOpenClassName;T.add(o),n&&O.hide(t)}},{key:"beforeClose",value:function(){var e=this.props,t=e.appElement,n=e.ariaHideApp,o=e.bodyOpenClassName;T.remove(o),n&&w.totalCount()<1&&O.show(t)}},{key:"render",value:function(){var e=this.props,t=e.className,n=e.overlayClassName,o=e.defaultStyles,r=t?{}:o.content,a=n?{}:o.overlay;return this.shouldBeClosed()?null:p.default.createElement("div",{ref:this.setOverlayRef,className:this.buildClassName("overlay",n),style:i({},a,this.props.style.overlay),onClick:this.handleOverlayOnClick,onMouseDown:this.handleOverlayOnMouseDown,onMouseUp:this.handleOverlayOnMouseUp},p.default.createElement("div",i({ref:this.setContentRef,style:i({},r,this.props.style.content),className:this.buildClassName("content",t),tabIndex:"-1",onKeyDown:this.handleKeyDown,onMouseDown:this.handleContentOnMouseDown,onMouseUp:this.handleContentOnMouseUp,onClick:this.handleContentOnClick,role:this.props.role,"aria-label":this.props.contentLabel},this.ariaAttributes(this.props.aria||{})),this.props.children))}}]),t}(f.Component);x.defaultProps={style:{overlay:{},content:{}}},x.propTypes={isOpen:d.PropTypes.bool.isRequired,defaultStyles:d.PropTypes.shape({content:d.PropTypes.object,overlay:d.PropTypes.object}),style:d.PropTypes.shape({content:d.PropTypes.object,overlay:d.PropTypes.object}),className:d.PropTypes.oneOfType([d.PropTypes.string,d.PropTypes.object]),overlayClassName:d.PropTypes.oneOfType([d.PropTypes.string,d.PropTypes.object]),bodyOpenClassName:d.PropTypes.string,ariaHideApp:d.PropTypes.bool,appElement:d.PropTypes.instanceOf(_.default),onAfterOpen:d.PropTypes.func,onRequestClose:d.PropTypes.func,closeTimeoutMS:d.PropTypes.number,shouldFocusAfterRender:d.PropTypes.bool,shouldCloseOnOverlayClick:d.PropTypes.bool,role:d.PropTypes.string,contentLabel:d.PropTypes.string,aria:d.PropTypes.object,children:d.PropTypes.node},t.default=x,e.exports=t.default},function(e,t,n){"use strict";function o(){d=!0}function r(){if(d){if(d=!1,!p)return;setTimeout(function(){if(!p.contains(document.activeElement)){((0,c.default)(p)[0]||p).focus()}},0)}}function a(){f.push(document.activeElement)}function u(){var e=null;try{return e=f.pop(),void e.focus()}catch(t){console.warn(["You tried to return focus to",e,"but it is not in the DOM anymore"].join(" "))}}function s(e){p=e,window.addEventListener?(window.addEventListener("blur",o,!1),document.addEventListener("focus",r,!0)):(window.attachEvent("onBlur",o),document.attachEvent("onFocus",r))}function i(){p=null,window.addEventListener?(window.removeEventListener("blur",o),document.removeEventListener("focus",r)):(window.detachEvent("onBlur",o),document.detachEvent("onFocus",r))}Object.defineProperty(t,"__esModule",{value:!0}),t.handleBlur=o,t.handleFocus=r,t.markForFocusLater=a,t.returnFocus=u,t.setupScopedFocus=s,t.teardownScopedFocus=i;var l=n(6),c=function(e){return e&&e.__esModule?e:{default:e}}(l),f=[],p=null,d=!1},function(e,t,n){"use strict";function o(e,t){var n=(0,a.default)(e);if(!n.length)return void t.preventDefault();n[t.shiftKey?0:n.length-1]!==document.activeElement&&e!==document.activeElement||(t.preventDefault(),n[t.shiftKey?n.length-1:0].focus())}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var r=n(6),a=function(e){return e&&e.__esModule?e:{default:e}}(r);e.exports=t.default},function(e,t,n){"use strict";function o(e){e.split(" ").map(u.add).forEach(function(e){return document.body.classList.add(e)})}function r(e){var t=u.get();e.split(" ").map(u.remove).filter(function(e){return 0===t[e]}).forEach(function(e){return document.body.classList.remove(e)})}Object.defineProperty(t,"__esModule",{value:!0}),t.add=o,t.remove=r;var a=n(8),u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(a)},function(e,t,n){var o;/*! Copyright (c) 2015 Jed Watson. Based on code that is Copyright 2013-2015, Facebook, Inc. All rights reserved. */ !function(){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),a={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen};void 0!==(o=function(){return a}.call(t,n,t,e))&&(e.exports=o)}()}])});
// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://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. // // ** This file is automatically generated by gapic-generator-typescript. ** // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** 'use strict'; function main(parent, entityTypeNames) { // [START dialogflow_v2_generated_EntityTypes_BatchDeleteEntityTypes_async] /** * TODO(developer): Uncomment these variables before running the sample. */ /** * Required. The name of the agent to delete all entities types for. Format: * `projects/<Project ID>/agent`. */ // const parent = 'abc123' /** * Required. The names entity types to delete. All names must point to the * same agent as `parent`. */ // const entityTypeNames = 'abc123' // Imports the Dialogflow library const {EntityTypesClient} = require('@google-cloud/dialogflow').v2; // Instantiates a client const dialogflowClient = new EntityTypesClient(); async function callBatchDeleteEntityTypes() { // Construct request const request = { parent, entityTypeNames, }; // Run request const [operation] = await dialogflowClient.batchDeleteEntityTypes(request); const [response] = await operation.promise(); console.log(response); } callBatchDeleteEntityTypes(); // [END dialogflow_v2_generated_EntityTypes_BatchDeleteEntityTypes_async] } process.on('unhandledRejection', err => { console.error(err.message); process.exitCode = 1; }); main(...process.argv.slice(2));
var src = './'; module.exports = { sass: { src: [ src + 'sass/*.scss', src + 'sass/**/*.scss' ], dest: './css' } };
const { When } = require('cucumber'); const parseData = require('./helpers/parseData'); When(/^I call the "([^"]*)" endpoint with data:$/, async function (endpoint, data) { data = parseData(data.hashes()); await this.callFunction(endpoint, data[0]); }); When(/^I call the "([^"]*)" endpoint with no data$/, async function (endpoint) { await this.callFunction(endpoint); });
function Compile (el, templateDescriptor, model, options) { this.model = model this.$vm = Object.assign({}, model.data, model.methods, options.inject) this.$el = document.querySelector(el) if (this.$el) { this.$fragment = this.node2Fragment() this.init(templateDescriptor) this.$el.appendChild(this.$fragment) } } function createElement (tag, data, childrens = []) { const dom = document.createElement(tag) const attrs = (data && data.attrs) ? data.attrs : {} Object.keys(attrs).forEach((attr) => { dom.setAttribute(attr, data.attrs[attr]) }) if (data && (data.class || data.staticClass)) { dom.setAttribute('class', ((data.class ? data.class : ' ') + ' ' + (data.staticClass ? data.staticClass : ' ')).trim()) } childrens && childrens.forEach((child) => { dom.appendChild(child) }) return dom } Compile.prototype = { node2Fragment: function () { var fragment = document.createDocumentFragment() return fragment }, init: function (templateDescriptor) { this.$vm.ast = templateDescriptor.ast this.$vm.render = new Function(templateDescriptor.render) this.$vm._c = createElement this.$vm._e = document.createComment.bind(document, '') // this.$vm._v = document.createTextNode; this.$vm._v = document.createTextNode.bind(document) this.$vm._s = (str) => { return `${str.toString()}` } let res = this.$vm.render() this.$fragment.appendChild(res) this.compileElement(this.$fragment, [this.$vm.ast]) this.model.mounted.call(this.$vm) }, compileElement: function (el, ast) { var childNodes = el.childNodes; [].slice.call(childNodes).forEach((node, index) => { if (this.isElementNode(node) || this.isTextNode(node)) { this.compile(node, ast[index]) } if (node.childNodes && node.childNodes.length) { this.compileElement(node, ast[index].children) } }) }, compile: function (node, ast) { if (ast.events) { const self = this Object.keys(ast.events).forEach((event) => { if (event === 'click') { const exp = ast.events[event].value const fn = self.$vm[exp] node.addEventListener('click', fn.bind(self.$vm), false) } if (event === 'mousedown') { const exp = ast.events[event].value const fn = self.$vm[exp] node.addEventListener('mousedown', fn.bind(self.$vm), false) } }) } }, isDirective: function (attr) { return attr.indexOf('v-') === 0 }, isEventDirective: function (dir) { return dir.indexOf('on') === 0 }, isElementNode: function (node) { return node.nodeType === 1 }, isTextNode: function (node) { return node.nodeType === 3 } } export default Compile
module.exports = (config) => { return { name: 'shortName', type: 'input', default: config.default.name.split(' ').join('').substring(0, 12), message: 'Define a short name (maximum of 12 characters) https://developers.chrome.com/apps/manifest/name', filter: ( value, other, again ) => { return new Promise((resolve, reject) => { if (value.length) { config.shortName = value resolve(value) } reject('Please enter a project shortName') }) } } }
export default { dsn: 'https://d1f4810475164ea4a071563f0699cbcf@sentry.io/2449507', };
const express = require('express') const app = express() const cache = require('./') app.use(cache({duration: 30, redis: {port: 6379}})) app.get('/', (req, res) => { res.send({test: true}) }) app.listen(8000)
import {format, differenceInCalendarDays} from 'date-fns' export const schedules = { data() { return {} }, mounted() { }, methods: { compareDays(targetEnd, currentEnd) { let targetDays = this.generateTagTime(targetEnd), currentDays = this.generateTagTime(currentEnd); return targetDays > currentDays; }, calculateProperties(item) { let scheduleTarget = null, nearToStart = false; item.schedules.map((schedule, index) => { if (this.isWithinRange(schedule.date_register_start, schedule.date_register_end) === 'included') { if (scheduleTarget !== null) { if (this.compareDays(scheduleTarget.date_register_end, schedule.date_register_end)) { scheduleTarget = schedule; } } else { scheduleTarget = schedule; } } }); if (scheduleTarget === null) { item.schedules.map((schedule, index) => { if (this.isWithinRange(schedule.date_register_start, schedule.date_register_end) === 'includedBefore') { if (scheduleTarget !== null) { if (this.compareDays(scheduleTarget.date_register_start, schedule.date_register_start)) { scheduleTarget = schedule; } } else { scheduleTarget = schedule; nearToStart = true; } } }); } if (scheduleTarget) { if (nearToStart) { return this.generateTagString(this.generateTagTime(scheduleTarget.date_register_start), nearToStart, scheduleTarget.date_register_start); } else { return this.generateTagString(this.generateTagTime(scheduleTarget.date_register_end), nearToStart, scheduleTarget.date_register_end); } } return false; }, isWithinRange(start, end) { let currentDate = new Date(), dateStart = new Date(start), dateEnd = new Date(end); if (dateStart < currentDate && dateEnd > currentDate) { return 'included'; } if (dateStart > currentDate && dateEnd > currentDate) { return 'includedBefore'; } return; }, generateTagTime(date) { return differenceInCalendarDays(new Date(date), new Date); }, generateTagString(days, nearToStart, date) { let formatDate = format(new Date(date), 'dd.MM'); if (nearToStart) { return { name: `Набор с ${formatDate}`, color: 'yellow-bright' } } else { if (days <= 10) { return { name: `Остал${this.declOfNum(days === 0 ? 1 : days, ['ся', 'ось', 'ось'])} ${days === 0 ? 1 : days} д${this.declOfNum(days === 0 ? 1 : days, ['ень', 'ня', 'ней'])} на запись`, color: 'pink' } } else { return { name: `Идет набор до ${formatDate}`, color: 'yellow-bright' } } } }, declOfNum(number, titles) { let cases = [2, 0, 1, 1, 1, 2]; return titles[(number % 100 > 4 && number % 100 < 20) ? 2 : cases[(number % 10 < 5) ? number % 10 : 5]]; } } }
import {b} from "./library/a.js"; output = [b];
module.exports = function (gameServer, split) { var key = split[1]; var value = split[2]; // Check if int/float if (value.indexOf('.') != -1) { value = parseFloat(value); } else { value = parseInt(value); } if (typeof gameServer.config[key] != 'undefined') { gameServer.config[key] = value; console.log("[Console] Set " + key + " to " + value); } else { console.log("[Console] Invalid config value"); } };
import React from 'react'; import {Route} from 'react-router'; import Home from '../pages/home/home.container'; import Main from '../templates/main/main.component'; export default ( <Route path="/" component={Main}> <Route path="*" component={Home}/> </Route> );
/* ------------------------------------------------------------------------------ * * # Idle timeout * * Specific JS code additions for extra_idle_timeout.html page * * Version: 1.0 * Latest update: Aug 1, 2015 * * ---------------------------------------------------------------------------- */ $(function() { // Session timeout $.sessionTimeout({ heading: 'h5', title: 'Session Timeout', message: 'Your session is about to expire. Do you want to stay connected?', ignoreUserActivity: true, warnAfter: 10000, redirAfter: 30000, keepAliveUrl: '/', redirUrl: 'login_unlock.html', logoutUrl: 'login_advanced.html' }); });
enyo.kind({ name: "DevModeService", kind: "enyo.PalmService", service: "palm://org.webosports.service.devmode/" });
import React, { Component } from 'react'; import './alert.css'; export default class Alert extends Component{ render(){ if(this.props.alert.alertVisible){ return( <div className="alert alert-danger " role="alert"> <h2>{this.props.alert.message}</h2> </div> ); } return null; } }
const async = require('async'); const Connection = require('../../src/connection'); const Request = require('../../src/request'); const fs = require('fs'); const homedir = require('os').homedir(); const assert = require('chai').assert; const os = require('os'); function getConfig() { const config = JSON.parse( fs.readFileSync(homedir + '/.tedious/test-connection.json', 'utf8') ).config; config.options.debug = { packet: true, data: true, payload: true, token: true, log: true, }; config.options.tdsVersion = process.env.TEDIOUS_TDS_VERSION; return config; } process.on('uncaughtException', function(err) { console.error(err.stack); }); function getInstanceName() { return JSON.parse( fs.readFileSync(homedir + '/.tedious/test-connection.json', 'utf8') ).instanceName; } function getNtlmConfig() { return JSON.parse( fs.readFileSync(homedir + '/.tedious/test-connection.json', 'utf8') ).ntlm; } describe('Initiate Connect Test', function() { this.timeout(20000); it('should be bad server', function(done) { const config = getConfig(); config.server = 'bad-server'; const connection = new Connection(config); connection.on('end', function(info) { done(); }); connection.on('debug', function(text) { // console.log(text) }); connection.connect(function(err) { assert.ok(err); }); }); it('should be bad port', function(done) { const config = getConfig(); config.options.port = -1; config.options.connectTimeout = 200; assert.throws(function() { new Connection(config); }); done(); }); it('should be bad credentials', function(done) { const config = getConfig(); if (config.authentication && config.authentication.type !== 'default') { return done(); } config.authentication.options.userName = 'bad-user'; config.authentication.options.password = 'bad-password'; const connection = new Connection(config); connection.on('end', function(info) { done(); }); connection.on('infoMessage', function(info) { // console.log("#{info.number} : #{info.message}") }); connection.on('errorMessage', function(error) { // console.log(`${error.number} : ${error.message}`) return assert.ok(~error.message.indexOf('failed') || ~error.message.indexOf('登录失败')); }); connection.on('debug', function(text) { // console.log(text) }); connection.connect(function(err) { assert.ok(err); connection.close(); }); }); it('should connect by port', function(done) { const config = getConfig(); if ((config.options != null ? config.options.port : undefined) == null) { // Config says don't do this test (probably because ports are dynamic). return this.skip(); } const connection = new Connection(config); connection.connect(function(err) { assert.ifError(err); connection.close(); }); connection.on('end', function(info) { done(); }); connection.on('databaseChange', function(database) { assert.strictEqual(database, config.options.database); }); connection.on('infoMessage', function(info) { // console.log("#{info.number} : #{info.message}") }); return connection.on('debug', function(text) { // console.log(text) }); }); it('should connect by instance name', function(done) { if (!getInstanceName()) { // Config says don't do this test (probably because SQL Server Browser is not available). return this.skip(); } const config = getConfig(); delete config.options.port; config.options.instanceName = getInstanceName(); const connection = new Connection(config); connection.connect(function(err) { assert.ifError(err); connection.close(); }); connection.on('end', function(info) { done(); }); connection.on('databaseChange', function(database) { assert.strictEqual(database, config.options.database); }); connection.on('infoMessage', function(info) { // console.log("#{info.number} : #{info.message}") }); return connection.on('debug', function(text) { // console.log(text) }); }); it('should connect by invalid instance name', function(done) { if (!getInstanceName()) { // Config says don't do this test (probably because SQL Server Browser is not available). return this.skip(); } const config = getConfig(); delete config.options.port; config.options.instanceName = `${getInstanceName()}X`; const connection = new Connection(config); connection.connect(function(err) { assert.ok(err); connection.close(); }); connection.on('end', function(info) { done(); }); connection.on('infoMessage', function(info) { // console.log("#{info.number} : #{info.message}") }); return connection.on('debug', function(text) { // console.log(text) }); }); it('should potentially throw an error on invalid crypto credential details', function(done) { const config = getConfig(); config.options.encrypt = true; // On newer Node.js versions, this will throw an error when passed to `tls.createSecureContext` config.options.cryptoCredentialsDetails = { ciphers: '!ALL' }; try { const { createSecureContext } = require('tls'); createSecureContext(config.options.cryptoCredentialsDetails); } catch { assert.throws(() => { new Connection(config); }); } done(); }); it('should allow connecting by calling `.connect` on the returned connection', function(done) { const config = getConfig(); const connection = new Connection(config); connection.connect((err) => { if (err) { return done(err); } connection.on('end', () => { done(); }); connection.close(); }); }); it('should not allow calling `.connect` on a connected connection', function(done) { const config = getConfig(); const connection = new Connection(config); connection.connect((err) => { if (err) { return done(err); } connection.on('end', () => { done(); }); process.nextTick(() => { connection.close(); }); assert.throws(() => { connection.connect(); }, '`.connect` can not be called on a Connection in `LoggedIn` state.'); }); }); it('should allow calling `.connect` without a callback', function(done) { const config = getConfig(); const connection = new Connection(config); connection.on('connect', (err) => { if (err) { return done(err); } connection.on('end', () => { done(); }); connection.close(); }); connection.connect(); }); it('should fail if no cipher can be negotiated', function(done) { const config = getConfig(); config.options.encrypt = true; // Specify a cipher that should never be supported by SQL Server config.options.cryptoCredentialsDetails = { ciphers: 'NULL' }; const connection = new Connection(config); connection.connect(function(err) { assert.ok(err); assert.strictEqual(err.code, 'ESOCKET'); }); connection.on('end', function() { done(); }); }); it('should use the local hostname as the default workstation identifier', function(done) { const config = getConfig(); const request = new Request('SELECT HOST_NAME()', function(err, rowCount) { assert.ifError(err); assert.strictEqual(rowCount, 1); connection.close(); }); request.on('row', function(columns) { assert.strictEqual(columns.length, 1); assert.strictEqual(columns[0].value, os.hostname()); }); let connection = new Connection(config); connection.connect((err) => { assert.ifError(err); connection.execSql(request); }); connection.on('end', () => { done(); }); }); it('should allow specifying a custom workstation identifier', function(done) { const config = getConfig(); const request = new Request('SELECT HOST_NAME()', function(err, rowCount) { assert.ifError(err); assert.strictEqual(rowCount, 1); connection.close(); }); request.on('row', function(columns) { assert.strictEqual(columns.length, 1); assert.strictEqual(columns[0].value, 'foo.bar.baz'); }); let connection = new Connection({ ...config, options: { ...config.options, workstationId: 'foo.bar.baz' } }); connection.connect((err) => { assert.ifError(err); connection.execSql(request); }); connection.on('end', () => { done(); }); }); it('should not emit error after connect timeout', function(done) { const config = getConfig(); config.options.connectTimeout = 1; const connection = new Connection(config); connection.on('error', (error) => { assert.ifError(error); }); connection.connect((err) => { }); setTimeout(() => { done(); }, 500); }); }); describe('Ntlm Test', function() { const DomainCaseEnum = { AsIs: 0, Lower: 1, Upper: 2, }; function runNtlmTest(done, domainCase) { const ntlmConfig = getNtlmConfig(); if (!ntlmConfig) { return this.skip(); } switch (domainCase) { case DomainCaseEnum.AsIs: break; case DomainCaseEnum.Lower: ntlmConfig.authentication.options.domain = ntlmConfig.authentication.options.domain.toLowerCase(); break; case DomainCaseEnum.Upper: ntlmConfig.authentication.options.domain = ntlmConfig.authentication.options.domain.toUpperCase(); break; default: assert.ok(false, 'Unexpected value for domainCase: ' + domainCase); } const connection = new Connection(ntlmConfig); connection.connect(function(err) { assert.ifError(err); connection.close(); }); connection.on('end', function(info) { done(); }); connection.on('infoMessage', function(info) { // console.log("#{info.number} : #{info.message}") }); return connection.on('debug', function(text) { // console.log(text) }); } it('should ntlm', function(done) { runNtlmTest.call(this, done, DomainCaseEnum.AsIs); }); it('should ntlm lower', function(done) { runNtlmTest.call(this, done, DomainCaseEnum.Lower); }); it('should ntlm upper', function(done) { runNtlmTest.call(this, done, DomainCaseEnum.Upper); }); }); describe('Encrypt Test', function() { it('should encrypt', function(done) { const config = getConfig(); config.options.encrypt = true; const connection = new Connection(config); connection.connect(function(err) { assert.ifError(err); connection.close(); }); connection.on('end', function(info) { done(); }); connection.on('databaseChange', function(database) { assert.strictEqual(database, config.options.database); }); connection.on('secure', function(cleartext) { assert.ok(cleartext); assert.ok(cleartext.getCipher()); assert.ok(cleartext.getPeerCertificate()); }); connection.on('infoMessage', function(info) { // console.log("#{info.number} : #{info.message}") }); return connection.on('debug', function(text) { // console.log(text) }); }); }); describe('BeginTransaction Tests', function() { let connection; beforeEach(function(done) { const config = getConfig(); connection = new Connection(config); connection.connect(done); }); afterEach(function(done) { if (!connection.closed) { connection.on('end', done); connection.close(); } else { done(); } }); it('should validate isolation level is a number', function() { assert.throws(() => { const callback = () => { assert.fail('callback should not be executed'); }; connection.beginTransaction(callback, 'test', 'some string'); }, TypeError, 'The "isolationLevel" argument must be of type number. Received type string (some string)'); }); it('should validate isolation level is an integer', function() { assert.throws(() => { const callback = () => { assert.fail('callback should not be executed'); }; connection.beginTransaction(callback, 'test', 2.3); }, RangeError, 'The value of "isolationLevel" is out of range. It must be an integer. Received: 2.3'); }); it('should validate isolation level is a valid isolation level value', function() { assert.throws(() => { const callback = () => { assert.fail('callback should not be executed'); }; connection.beginTransaction(callback, 'test', 9); }, RangeError, 'The value of "isolationLevel" is out of range. It must be >= 0 && <= 5. Received: 9'); }); }); describe('Insertion Tests', function() { this.timeout(30000); it('should execSql', function(done) { const config = getConfig(); const request = new Request('select 8 as C1', function(err, rowCount) { assert.ifError(err); assert.strictEqual(rowCount, 1); connection.close(); }); request.on('doneInProc', function(rowCount, more) { assert.ok(more); assert.strictEqual(rowCount, 1); }); request.on('columnMetadata', function(columnsMetadata) { assert.strictEqual(columnsMetadata.length, 1); }); request.on('row', function(columns) { assert.strictEqual(columns.length, 1); assert.strictEqual(columns[0].value, 8); }); let connection = new Connection(config); connection.connect(function(err) { connection.execSql(request); }); connection.on('end', function(info) { done(); }); connection.on('infoMessage', function(info) { // console.log("#{info.number} : #{info.message}") }); return connection.on('debug', function(text) { // console.log(text) }); }); it('should numeric column name', function(done) { const config = getConfig(); config.options.useColumnNames = true; const request = new Request('select 8 as [123]', function(err, rowCount) { assert.ifError(err); assert.strictEqual(rowCount, 1); connection.close(); }); request.on('columnMetadata', function(columnsMetadata) { assert.strictEqual(Object.keys(columnsMetadata).length, 1); }); request.on('row', function(columns) { assert.strictEqual(Object.keys(columns).length, 1); assert.strictEqual(columns[123].value, 8); }); let connection = new Connection(config); connection.connect(function(err) { connection.execSql(request); }); connection.on('end', function(info) { done(); }); connection.on('infoMessage', function(info) { // console.log("#{info.number} : #{info.message}") }); connection.on('debug', function(text) { // console.log(text) }); }); it('should duplicate column name', function(done) { const config = getConfig(); config.options.useColumnNames = true; const request = new Request("select 1 as abc, 2 as xyz, '3' as abc", function( err, rowCount ) { assert.ifError(err); assert.strictEqual(rowCount, 1); connection.close(); }); request.on('columnMetadata', function(columnsMetadata) { assert.strictEqual(Object.keys(columnsMetadata).length, 2); }); request.on('row', function(columns) { assert.strictEqual(Object.keys(columns).length, 2); assert.strictEqual(columns.abc.value, 1); assert.strictEqual(columns.xyz.value, 2); }); let connection = new Connection(config); connection.connect(function(err) { connection.execSql(request); }); connection.on('end', function(info) { done(); }); connection.on('infoMessage', function(info) { // console.log("#{info.number} : #{info.message}") }); connection.on('debug', function(text) { // console.log(text) }); }); it('should exec Sql multiple times', function(done) { const timesToExec = 5; let sqlExecCount = 0; const config = getConfig(); function execSql() { if (sqlExecCount === timesToExec) { connection.close(); return; } const request = new Request('select 8 as C1', function(err, rowCount) { assert.ifError(err); assert.strictEqual(rowCount, 1); sqlExecCount++; execSql(); }); request.on('doneInProc', function(rowCount, more) { assert.ok(more); assert.strictEqual(rowCount, 1); }); request.on('columnMetadata', function(columnsMetadata) { assert.strictEqual(columnsMetadata.length, 1); }); request.on('row', function(columns) { assert.strictEqual(columns.length, 1); assert.strictEqual(columns[0].value, 8); }); connection.execSql(request); } let connection = new Connection(config); connection.connect(function(err) { execSql(); }); connection.on('end', function(info) { done(); }); connection.on('infoMessage', function(info) { // console.log("#{info.number} : #{info.message}") }); connection.on('debug', function(text) { // console.log(text) }); }); it('should exec sql with order', function(done) { const config = getConfig(); const sql = 'select top 2 object_id, name, column_id, system_type_id from sys.columns order by name, system_type_id'; const request = new Request(sql, function(err, rowCount) { assert.ifError(err); assert.strictEqual(rowCount, 2); connection.close(); }); request.on('doneInProc', function(rowCount, more) { assert.ok(more); assert.strictEqual(rowCount, 2); }); request.on('columnMetadata', function(columnsMetadata) { assert.strictEqual(columnsMetadata.length, 4); }); request.on('order', function(orderColumns) { assert.strictEqual(orderColumns.length, 2); assert.strictEqual(orderColumns[0], 2); assert.strictEqual(orderColumns[1], 4); }); request.on('row', function(columns) { assert.strictEqual(columns.length, 4); }); let connection = new Connection(config); connection.connect(function(err) { connection.execSql(request); }); connection.on('end', function(info) { done(); }); connection.on('infoMessage', function(info) { // console.log("#{info.number} : #{info.message}") }); connection.on('errorMessage', function(error) { // console.log("#{error.number} : #{error.message}") }); connection.on('debug', function(text) { // console.log(text) }); }); it('should exec Bad Sql', function(done) { const config = getConfig(); const request = new Request('bad syntax here', function(err) { assert.ok(err); connection.close(); }); let connection = new Connection(config); connection.connect(function(err) { connection.execSql(request); }); connection.on('end', function(info) { done(); }); connection.on('errorMessage', function(error) { // console.log("#{error.number} : #{error.message}") assert.ok(error); }); connection.on('debug', function(text) { // console.log(text) }); }); it('should close connection request pending', function(done) { const config = getConfig(); const request = new Request('select 8 as C1', function(err, rowCount) { assert.ok(err); assert.strictEqual(err.code, 'ECLOSE'); }); const connection = new Connection(config); connection.connect(function(err) { assert.ifError(err); connection.execSql(request); // This should trigger request callback with error as there is // request pending now. connection.close(); }); connection.on('end', function(info) { done(); }); connection.on('error', function(err) { }); connection.on('infoMessage', function(info) { // console.log("#{info.number} : #{info.message}") }); connection.on('debug', function(text) { // console.log(text) }); }); it('should sql with multiple result sets', function(done) { const config = getConfig(); let row = 0; const request = new Request('select 1; select 2;', function(err, rowCount) { assert.ifError(err); assert.strictEqual(rowCount, 2); connection.close(); }); request.on('doneInProc', function(rowCount, more) { assert.strictEqual(rowCount, 1); }); request.on('columnMetadata', function(columnsMetadata) { assert.strictEqual(columnsMetadata.length, 1); }); request.on('row', function(columns) { assert.strictEqual(columns[0].value, ++row); }); let connection = new Connection(config); connection.connect(function(err) { connection.execSql(request); }); connection.on('end', function(info) { done(); }); connection.on('infoMessage', function(info) { // console.log("#{info.number} : #{info.message}") }); connection.on('debug', function(text) { // console.log(text) }); }); it('should row count for update', function(done) { const config = getConfig(); const setupSql = `\ create table #tab1 (id int, name nvarchar(10)); insert into #tab1 values(1, N'a1'); insert into #tab1 values(2, N'a2'); insert into #tab1 values(3, N'b1'); update #tab1 set name = 'a3' where name like 'a%'\ `; const request = new Request(setupSql, function(err, rowCount) { assert.ifError(err); assert.strictEqual(rowCount, 5); connection.close(); }); let connection = new Connection(config); connection.connect(function(err) { connection.execSql(request); }); connection.on('end', function(info) { done(); }); connection.on('infoMessage', function(info) { // console.log("#{info.number} : #{info.message}") }); connection.on('debug', function(text) { // console.log(text) }); }); it('should row collection on request completion', function(done) { const config = getConfig(); config.options.rowCollectionOnRequestCompletion = true; const request = new Request('select 1 as a; select 2 as b;', function( err, rowCount, rows ) { assert.strictEqual(rows.length, 2); assert.strictEqual(rows[0][0].metadata.colName, 'a'); assert.strictEqual(rows[0][0].value, 1); assert.strictEqual(rows[1][0].metadata.colName, 'b'); assert.strictEqual(rows[1][0].value, 2); connection.close(); }); let connection = new Connection(config); connection.connect(function(err) { connection.execSql(request); }); connection.on('end', function(info) { done(); }); connection.on('infoMessage', function(info) { // console.log("#{info.number} : #{info.message}") }); connection.on('debug', function(text) { // console.log(text) }); }); it('should row collection on Done', function(done) { const config = getConfig(); config.options.rowCollectionOnDone = true; let doneCount = 0; const request = new Request('select 1 as a; select 2 as b;', function( err, rowCount, rows ) { connection.close(); }); request.on('doneInProc', function(rowCount, more, rows) { assert.strictEqual(rows.length, 1); switch (++doneCount) { case 1: assert.strictEqual(rows[0][0].metadata.colName, 'a'); assert.strictEqual(rows[0][0].value, 1); break; case 2: assert.strictEqual(rows[0][0].metadata.colName, 'b'); assert.strictEqual(rows[0][0].value, 2); break; } }); let connection = new Connection(config); connection.connect(function(err) { connection.execSql(request); }); connection.on('end', function(info) { done(); }); connection.on('infoMessage', function(info) { // console.log("#{info.number} : #{info.message}") }); connection.on('debug', function(text) { // console.log(text) }); }); it('should exec proc as sql', function(done) { const config = getConfig(); const request = new Request('exec sp_help int', function(err, rowCount) { assert.ifError(err); assert.strictEqual(rowCount, 0); connection.close(); }); request.on('doneProc', function(rowCount, more, returnStatus) { assert.ok(!more); assert.strictEqual(returnStatus, 0); }); request.on('doneInProc', function(rowCount, more) { assert.ok(more); }); request.on('row', function(columns) { assert.ok(true); }); let connection = new Connection(config); connection.connect(function(err) { connection.execSql(request); }); connection.on('end', function(info) { done(); }); connection.on('infoMessage', function(info) { // console.log("#{info.number} : #{info.message}") }); connection.on('debug', function(text) { // console.log(text) }); }); it('should reset Connection', function(done) { const config = getConfig(); function testAnsiNullsOptionOn(callback) { testAnsiNullsOption(true, callback); } function testAnsiNullsOptionOff(callback) { testAnsiNullsOption(false, callback); } function testAnsiNullsOption(expectedOptionOn, callback) { const request = new Request('select @@options & 32', function(err, rowCount) { callback(err); }); request.on('row', function(columns) { const optionOn = columns[0].value === 32; assert.strictEqual(optionOn, expectedOptionOn); }); connection.execSql(request); } function setAnsiNullsOptionOff(callback) { const request = new Request('set ansi_nulls off', function(err, rowCount) { callback(err); }); connection.execSqlBatch(request); } let connection = new Connection(config); connection.on('resetConnection', function() { assert.ok(true); }); connection.connect(function(err) { async.series([ testAnsiNullsOptionOn, setAnsiNullsOptionOff, testAnsiNullsOptionOff, function(callback) { connection.reset(function(err) { if (connection.config.options.tdsVersion < '7_2') { // TDS 7_1 doesnt send RESETCONNECTION acknowledgement packet assert.ok(true); } callback(err); }); }, testAnsiNullsOptionOn, function(callback) { connection.close(); callback(); }, ]); }); connection.on('end', function(info) { done(); }); connection.on('infoMessage', function(info) { // console.log("#{info.number} : #{info.message}") }); connection.on('debug', function(text) { // console.log(text) }); }); it('should cancel request', function(done) { const config = getConfig(); const request = new Request( "select 1 as C1;waitfor delay '00:00:05';select 2 as C2", function(err, rowCount, rows) { assert.strictEqual(err.message, 'Canceled.'); connection.close(); } ); request.on('doneInProc', function(rowCount, more) { assert.ok(false); }); request.on('doneProc', function(rowCount, more) { assert.ok(false); }); request.on('done', function(rowCount, more, rows) { assert.ok(false); }); request.on('columnMetadata', function(columnsMetadata) { assert.ok(false); }); request.on('row', function(columns) { assert.ok(false); }); let connection = new Connection(config); connection.connect(function(err) { connection.execSql(request); setTimeout(connection.cancel.bind(connection), 2000); }); connection.on('end', function(info) { done(); }); connection.on('infoMessage', function(info) { // console.log("#{info.number} : #{info.message}") }); connection.on('debug', function(text) { // console.log(text) }); }); it('should request timeout', function(done) { const config = getConfig(); config.options.requestTimeout = 1000; const request = new Request( "select 1 as C1;waitfor delay '00:00:05';select 2 as C2", function(err, rowCount, rows) { assert.equal(err.message, 'Timeout: Request failed to complete in 1000ms'); connection.close(); } ); request.on('doneInProc', function(rowCount, more) { assert.ok(false); }); request.on('doneProc', function(rowCount, more) { assert.ok(false); }); request.on('done', function(rowCount, more, rows) { assert.ok(false); }); request.on('columnMetadata', function(columnsMetadata) { assert.ok(false); }); request.on('row', function(columns) { assert.ok(false); }); let connection = new Connection(config); connection.connect(function(err) { connection.execSql(request); }); connection.on('end', function(info) { done(); }); connection.on('infoMessage', function(info) { // console.log("#{info.number} : #{info.message}") }); connection.on('debug', function(text) { // console.log(text) }); }); }); describe('Advanced Input Test', function() { function runSqlBatch(done, config, sql, requestCallback) { const connection = new Connection(config); const request = new Request(sql, function() { requestCallback.apply(this, arguments); connection.close(); }); connection.connect(function(err) { assert.ifError(err); connection.execSqlBatch(request); }); connection.on('end', function(info) { done(); }); } // Test that the default behavior allows adding null values to a // temporary table where the nullability is not explicitly declared. it('should test AnsiNullDefault', function(done) { const sql = 'create table #testAnsiNullDefault (id int);\n' + 'insert #testAnsiNullDefault values (null);\n' + 'drop table #testAnsiNullDefault;'; runSqlBatch(done, getConfig(), sql, function(err) { assert.ifError(err); }); }); // Test that the default behavior can be overridden (so that temporary // table columns are non-nullable by default). it('should disable ansi null default', function(done) { const sql = 'create table #testAnsiNullDefaults (id int);\n' + 'insert #testAnsiNullDefaults values (null);\n' + 'drop table #testAnsiNullDefaults;'; const config = getConfig(); config.options.enableAnsiNullDefault = false; runSqlBatch(done, config, sql, function(err) { assert.ok(err instanceof Error); assert.strictEqual(err != null ? err.number : undefined, 515); }); // Cannot insert the value NULL }); }); describe('Date Insert Test', function() { const testDateFirstImpl = (done, datefirst) => { datefirst = datefirst || 7; const config = getConfig(); config.options.datefirst = datefirst; const connection = new Connection(config); const request = new Request('select @@datefirst', function(err) { assert.ifError(err); connection.close(); }); request.on('row', function(columns) { const dateFirstActual = columns[0].value; assert.strictEqual(dateFirstActual, datefirst); }); connection.connect(function(err) { assert.ifError(err); connection.execSql(request); }); connection.on('end', function(info) { done(); }); }; // Test that the default setting for DATEFIRST is 7 it('should test date first default', function(done) { testDateFirstImpl(done, undefined); }); // Test that the DATEFIRST setting can be changed via an optional configuration it('should test date first custom', function(done) { testDateFirstImpl(done, 3); }); // Test that an invalid DATEFIRST setting throws it('should test bad date first', function(done) { const config = getConfig(); config.options.datefirst = -1; assert.throws(function() { new Connection(config); }); done(); }); }); describe('Language Insert Test', function() { function testLanguage(done, language) { language = language || 'us_english'; const config = getConfig(); config.options.language = language; const connection = new Connection(config); const request = new Request('select @@language', function(err) { assert.ifError(err); connection.close(); }); request.on('row', function(columns) { const languageActual = columns[0].value; assert.strictEqual(languageActual, language); }); connection.connect(function(err) { assert.ifError(err); connection.execSql(request); }); connection.on('end', function(info) { done(); }); } // Test that the default setting for LANGUAGE is us_english it('should test language default', function(done) { testLanguage(done, undefined); }); // Test that the LANGUAGE setting can be changed via an optional configuration it('should test language custom', function(done) { testLanguage(done, 'Deutsch'); }); }); describe('should test date format', function() { function testDateFormat(done, dateFormat) { dateFormat = dateFormat || 'mdy'; const config = getConfig(); config.options.dateFormat = dateFormat; const connection = new Connection(config); const request = new Request( 'SELECT DATE_FORMAT FROM sys.dm_exec_sessions WHERE SESSION_ID = @@SPID ', function(err) { assert.ifError(err); connection.close(); } ); request.on('row', function(columns) { const dateFormatActual = columns[0].value; assert.strictEqual(dateFormatActual, dateFormat); }); connection.connect(function(err) { assert.ifError(err); connection.execSql(request); }); connection.on('end', function(info) { done(); }); } // Test that the default setting for DATEFORMAT is mdy it('should test date format default', function(done) { testDateFormat(done, undefined); }); // Test that the DATEFORMAT setting can be changed via an optional configuration it('should test custom dateformat', function(done) { testDateFormat(done, 'dmy'); }); }); describe('Boolean Config Options Test', function() { function testBooleanConfigOption(done, optionName, optionValue, optionFlag, defaultOn) { const config = getConfig(); config.options[optionName] = optionValue; const connection = new Connection(config); const request = new Request( `SELECT (${optionFlag} & @@OPTIONS) AS OPTION_FLAG_OR_ZERO;`, function(err, rowCount) { assert.ifError(err); assert.strictEqual(rowCount, 1); connection.close(); } ); request.on('columnMetadata', function(columnsMetadata) { assert.strictEqual(Object.keys(columnsMetadata).length, 1); }); request.on('row', function(columns) { assert.strictEqual(Object.keys(columns).length, 1); let expectedValue; if (optionValue === true || (optionValue === undefined && defaultOn)) { expectedValue = optionFlag; } else { expectedValue = 0; } assert.strictEqual(columns[0].value, expectedValue); }); connection.connect(function(err) { assert.ifError(err); connection.execSql(request); }); connection.on('end', function(info) { done(); }); } function testBadBooleanConfigOption(done, optionName) { const config = getConfig(); config.options[optionName] = 'on'; assert.throws(function() { new Connection(config); }); done(); } it('should test ansi null default', function(done) { testBooleanConfigOption(done, 'enableAnsiNull', undefined, 32, true); }); it('should test ansi null on', function(done) { testBooleanConfigOption(done, 'enableAnsiNull', true, 32, true); }); it('should test ansi null off', function(done) { testBooleanConfigOption(done, 'enableAnsiNull', false, 32, true); }); it('should test bad ansi null', function(done) { testBadBooleanConfigOption(done, 'enableAnsiNull'); }); it('should test ansi null default default', function(done) { testBooleanConfigOption(done, 'enableAnsiNullDefault', undefined, 1024, true); }); it('should test ansi null default on', function(done) { testBooleanConfigOption(done, 'enableAnsiNullDefault', true, 1024, true); }); it('should test ansi null default off', function(done) { testBooleanConfigOption(done, 'enableAnsiNullDefault', false, 1024, true); }); it('should test bad ansi null default', function(done) { testBadBooleanConfigOption(done, 'enableAnsiNullDefault'); }); it('should test ansi padding default', function(done) { testBooleanConfigOption(done, 'enableAnsiPadding', undefined, 16, true); }); it('should test ansi padding on', function(done) { testBooleanConfigOption(done, 'enableAnsiPadding', true, 16, true); }); it('should test ansi padding off', function(done) { testBooleanConfigOption(done, 'enableAnsiPadding', false, 16, true); }); it('should test bad ansi padding', function(done) { testBadBooleanConfigOption(done, 'enableAnsiPadding'); }); it('should test ansi warnings default', function(done) { testBooleanConfigOption(done, 'enableAnsiWarnings', undefined, 8, true); }); it('should test ansi warnings on', function(done) { testBooleanConfigOption(done, 'enableAnsiWarnings', true, 8, true); }); it('should test ansi warnings off', function(done) { testBooleanConfigOption(done, 'enableAnsiWarnings', false, 8, true); }); it('should test bad ansi warnings', function(done) { testBadBooleanConfigOption(done, 'enableAnsiWarnings'); }); it('should test arith abort default', function(done) { testBooleanConfigOption(done, 'enableArithAbort', undefined, 64, true); }); it('should test arith abort on', function(done) { testBooleanConfigOption(done, 'enableArithAbort', true, 64, false); }); it('should test arith abort off', function(done) { testBooleanConfigOption(done, 'enableArithAbort', false, 64, false); }); it('should test bad arith abort', function(done) { testBadBooleanConfigOption(done, 'enableArithAbort'); }); it('should test concat null yield null default', function(done) { testBooleanConfigOption(done, 'enableConcatNullYieldsNull', undefined, 4096, true); }); it('should test concat null yields null on', function(done) { testBooleanConfigOption(done, 'enableConcatNullYieldsNull', true, 4096, true); }); it('should test ocncat null yields null off', function(done) { testBooleanConfigOption(done, 'enableConcatNullYieldsNull', false, 4096, true); }); it('should test bad concat null yields null', function(done) { testBadBooleanConfigOption(done, 'enableConcatNullYieldsNull'); }); it('should test cursor close on commit default', function(done) { testBooleanConfigOption(done, 'enableCursorCloseOnCommit', undefined, 4, false); }); it('should test cursor close on commit on', function(done) { testBooleanConfigOption(done, 'enableCursorCloseOnCommit', true, 4, false); }); it('should test cursor close on commit off', function(done) { testBooleanConfigOption(done, 'enableCursorCloseOnCommit', false, 4, false); }); it('should test bad cursor close on commit', function(done) { testBadBooleanConfigOption(done, 'enableCursorCloseOnCommit'); }); it('should test implicit transactions default', function(done) { testBooleanConfigOption(done, 'enableImplicitTransactions', undefined, 2, false); }); it('should test implicit transactions on', function(done) { testBooleanConfigOption(done, 'enableImplicitTransactions', true, 2, false); }); it('should test implicit transactions off', function(done) { testBooleanConfigOption(done, 'enableImplicitTransactions', false, 2, false); }); it('should test bad implicit transactions', function(done) { testBadBooleanConfigOption(done, 'enableImplicitTransactions'); }); it('should test numeric round abort default', function(done) { testBooleanConfigOption(done, 'enableNumericRoundabort', undefined, 8192, false); }); it('should test numeric round abort on', function(done) { testBooleanConfigOption(done, 'enableNumericRoundabort', true, 8192, false); }); it('should test numeric round abort off', function(done) { testBooleanConfigOption(done, 'enableNumericRoundabort', false, 8192, false); }); it('should test bad numeric round abort', function(done) { testBadBooleanConfigOption(done, 'enableNumericRoundabort'); }); it('should test quoted identifier default', function(done) { testBooleanConfigOption(done, 'enableQuotedIdentifier', undefined, 256, true); }); it('should test quoted identifier on', function(done) { testBooleanConfigOption(done, 'enableQuotedIdentifier', true, 256, true); }); it('should test quoted identifier off', function(done) { testBooleanConfigOption(done, 'enableQuotedIdentifier', false, 256, true); }); it('should test bad quoted identifier', function(done) { testBadBooleanConfigOption(done, 'enableQuotedIdentifier'); }); it('should test abort transaction on error default', function(done) { testBooleanConfigOption(done, 'abortTransactionOnError', undefined, 16384, false); }); it('should test abort transaction on error on', function(done) { testBooleanConfigOption(done, 'abortTransactionOnError', true, 16384, false); }); it('should test abort transaction on error off', function(done) { testBooleanConfigOption(done, 'abortTransactionOnError', false, 16384, false); }); it('should test bad abort transaction on error', function(done) { testBadBooleanConfigOption(done, 'abortTransactionOnError'); }); });
/*! jQuery UI - v1.11.1 - 2014-08-19 * http://jqueryui.com * Includes: core.js, widget.js, mouse.js, position.js, draggable.js, droppable.js, resizable.js, selectable.js, sortable.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, menu.js, progressbar.js, selectmenu.js, slider.js, spinner.js, tabs.js, tooltip.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js * Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */ (function( factory ) { if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. define([ "jquery" ], factory ); } else { // Browser globals factory( jQuery ); } }(function( $ ) { /*! * jQuery UI Core 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/category/ui-core/ */ // $.ui might exist from components with no dependencies, e.g., $.ui.position $.ui = $.ui || {}; $.extend( $.ui, { version: "1.11.1", keyCode: { BACKSPACE: 8, COMMA: 188, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, LEFT: 37, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, RIGHT: 39, SPACE: 32, TAB: 9, UP: 38 } }); // plugins $.fn.extend({ scrollParent: function( includeHidden ) { var position = this.css( "position" ), excludeStaticParent = position === "absolute", overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, scrollParent = this.parents().filter( function() { var parent = $( this ); if ( excludeStaticParent && parent.css( "position" ) === "static" ) { return false; } return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) ); }).eq( 0 ); return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent; }, uniqueId: (function() { var uuid = 0; return function() { return this.each(function() { if ( !this.id ) { this.id = "ui-id-" + ( ++uuid ); } }); }; })(), removeUniqueId: function() { return this.each(function() { if ( /^ui-id-\d+$/.test( this.id ) ) { $( this ).removeAttr( "id" ); } }); } }); // selectors function focusable( element, isTabIndexNotNaN ) { var map, mapName, img, nodeName = element.nodeName.toLowerCase(); if ( "area" === nodeName ) { map = element.parentNode; mapName = map.name; if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { return false; } img = $( "img[usemap='#" + mapName + "']" )[ 0 ]; return !!img && visible( img ); } return ( /input|select|textarea|button|object/.test( nodeName ) ? !element.disabled : "a" === nodeName ? element.href || isTabIndexNotNaN : isTabIndexNotNaN) && // the element and all of its ancestors must be visible visible( element ); } function visible( element ) { return $.expr.filters.visible( element ) && !$( element ).parents().addBack().filter(function() { return $.css( this, "visibility" ) === "hidden"; }).length; } $.extend( $.expr[ ":" ], { data: $.expr.createPseudo ? $.expr.createPseudo(function( dataName ) { return function( elem ) { return !!$.data( elem, dataName ); }; }) : // support: jQuery <1.8 function( elem, i, match ) { return !!$.data( elem, match[ 3 ] ); }, focusable: function( element ) { return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) ); }, tabbable: function( element ) { var tabIndex = $.attr( element, "tabindex" ), isTabIndexNaN = isNaN( tabIndex ); return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN ); } }); // support: jQuery <1.8 if ( !$( "<a>" ).outerWidth( 1 ).jquery ) { $.each( [ "Width", "Height" ], function( i, name ) { var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], type = name.toLowerCase(), orig = { innerWidth: $.fn.innerWidth, innerHeight: $.fn.innerHeight, outerWidth: $.fn.outerWidth, outerHeight: $.fn.outerHeight }; function reduce( elem, size, border, margin ) { $.each( side, function() { size -= parseFloat( $.css( elem, "padding" + this ) ) || 0; if ( border ) { size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0; } if ( margin ) { size -= parseFloat( $.css( elem, "margin" + this ) ) || 0; } }); return size; } $.fn[ "inner" + name ] = function( size ) { if ( size === undefined ) { return orig[ "inner" + name ].call( this ); } return this.each(function() { $( this ).css( type, reduce( this, size ) + "px" ); }); }; $.fn[ "outer" + name] = function( size, margin ) { if ( typeof size !== "number" ) { return orig[ "outer" + name ].call( this, size ); } return this.each(function() { $( this).css( type, reduce( this, size, true, margin ) + "px" ); }); }; }); } // support: jQuery <1.8 if ( !$.fn.addBack ) { $.fn.addBack = function( selector ) { return this.add( selector == null ? this.prevObject : this.prevObject.filter( selector ) ); }; } // support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413) if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) { $.fn.removeData = (function( removeData ) { return function( key ) { if ( arguments.length ) { return removeData.call( this, $.camelCase( key ) ); } else { return removeData.call( this ); } }; })( $.fn.removeData ); } // deprecated $.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); $.fn.extend({ focus: (function( orig ) { return function( delay, fn ) { return typeof delay === "number" ? this.each(function() { var elem = this; setTimeout(function() { $( elem ).focus(); if ( fn ) { fn.call( elem ); } }, delay ); }) : orig.apply( this, arguments ); }; })( $.fn.focus ), disableSelection: (function() { var eventType = "onselectstart" in document.createElement( "div" ) ? "selectstart" : "mousedown"; return function() { return this.bind( eventType + ".ui-disableSelection", function( event ) { event.preventDefault(); }); }; })(), enableSelection: function() { return this.unbind( ".ui-disableSelection" ); }, zIndex: function( zIndex ) { if ( zIndex !== undefined ) { return this.css( "zIndex", zIndex ); } if ( this.length ) { var elem = $( this[ 0 ] ), position, value; while ( elem.length && elem[ 0 ] !== document ) { // Ignore z-index if position is set to a value where z-index is ignored by the browser // This makes behavior of this function consistent across browsers // WebKit always returns auto if the element is positioned position = elem.css( "position" ); if ( position === "absolute" || position === "relative" || position === "fixed" ) { // IE returns 0 when zIndex is not specified // other browsers return a string // we ignore the case of nested elements with an explicit value of 0 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> value = parseInt( elem.css( "zIndex" ), 10 ); if ( !isNaN( value ) && value !== 0 ) { return value; } } elem = elem.parent(); } } return 0; } }); // $.ui.plugin is deprecated. Use $.widget() extensions instead. $.ui.plugin = { add: function( module, option, set ) { var i, proto = $.ui[ module ].prototype; for ( i in set ) { proto.plugins[ i ] = proto.plugins[ i ] || []; proto.plugins[ i ].push( [ option, set[ i ] ] ); } }, call: function( instance, name, args, allowDisconnected ) { var i, set = instance.plugins[ name ]; if ( !set ) { return; } if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) { return; } for ( i = 0; i < set.length; i++ ) { if ( instance.options[ set[ i ][ 0 ] ] ) { set[ i ][ 1 ].apply( instance.element, args ); } } } }; /*! * jQuery UI Widget 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/jQuery.widget/ */ var widget_uuid = 0, widget_slice = Array.prototype.slice; $.cleanData = (function( orig ) { return function( elems ) { var events, elem, i; for ( i = 0; (elem = elems[i]) != null; i++ ) { try { // Only trigger remove when necessary to save time events = $._data( elem, "events" ); if ( events && events.remove ) { $( elem ).triggerHandler( "remove" ); } // http://bugs.jquery.com/ticket/8235 } catch( e ) {} } orig( elems ); }; })( $.cleanData ); $.widget = function( name, base, prototype ) { var fullName, existingConstructor, constructor, basePrototype, // proxiedPrototype allows the provided prototype to remain unmodified // so that it can be used as a mixin for multiple widgets (#8876) proxiedPrototype = {}, namespace = name.split( "." )[ 0 ]; name = name.split( "." )[ 1 ]; fullName = namespace + "-" + name; if ( !prototype ) { prototype = base; base = $.Widget; } // create selector for plugin $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { return !!$.data( elem, fullName ); }; $[ namespace ] = $[ namespace ] || {}; existingConstructor = $[ namespace ][ name ]; constructor = $[ namespace ][ name ] = function( options, element ) { // allow instantiation without "new" keyword if ( !this._createWidget ) { return new constructor( options, element ); } // allow instantiation without initializing for simple inheritance // must use "new" keyword (the code above always passes args) if ( arguments.length ) { this._createWidget( options, element ); } }; // extend with the existing constructor to carry over any static properties $.extend( constructor, existingConstructor, { version: prototype.version, // copy the object used to create the prototype in case we need to // redefine the widget later _proto: $.extend( {}, prototype ), // track widgets that inherit from this widget in case this widget is // redefined after a widget inherits from it _childConstructors: [] }); basePrototype = new base(); // we need to make the options hash a property directly on the new instance // otherwise we'll modify the options hash on the prototype that we're // inheriting from basePrototype.options = $.widget.extend( {}, basePrototype.options ); $.each( prototype, function( prop, value ) { if ( !$.isFunction( value ) ) { proxiedPrototype[ prop ] = value; return; } proxiedPrototype[ prop ] = (function() { var _super = function() { return base.prototype[ prop ].apply( this, arguments ); }, _superApply = function( args ) { return base.prototype[ prop ].apply( this, args ); }; return function() { var __super = this._super, __superApply = this._superApply, returnValue; this._super = _super; this._superApply = _superApply; returnValue = value.apply( this, arguments ); this._super = __super; this._superApply = __superApply; return returnValue; }; })(); }); constructor.prototype = $.widget.extend( basePrototype, { // TODO: remove support for widgetEventPrefix // always use the name + a colon as the prefix, e.g., draggable:start // don't prefix for widgets that aren't DOM-based widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name }, proxiedPrototype, { constructor: constructor, namespace: namespace, widgetName: name, widgetFullName: fullName }); // If this widget is being redefined then we need to find all widgets that // are inheriting from it and redefine all of them so that they inherit from // the new version of this widget. We're essentially trying to replace one // level in the prototype chain. if ( existingConstructor ) { $.each( existingConstructor._childConstructors, function( i, child ) { var childPrototype = child.prototype; // redefine the child widget using the same prototype that was // originally used, but inherit from the new version of the base $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto ); }); // remove the list of existing child constructors from the old constructor // so the old child constructors can be garbage collected delete existingConstructor._childConstructors; } else { base._childConstructors.push( constructor ); } $.widget.bridge( name, constructor ); return constructor; }; $.widget.extend = function( target ) { var input = widget_slice.call( arguments, 1 ), inputIndex = 0, inputLength = input.length, key, value; for ( ; inputIndex < inputLength; inputIndex++ ) { for ( key in input[ inputIndex ] ) { value = input[ inputIndex ][ key ]; if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { // Clone objects if ( $.isPlainObject( value ) ) { target[ key ] = $.isPlainObject( target[ key ] ) ? $.widget.extend( {}, target[ key ], value ) : // Don't extend strings, arrays, etc. with objects $.widget.extend( {}, value ); // Copy everything else by reference } else { target[ key ] = value; } } } } return target; }; $.widget.bridge = function( name, object ) { var fullName = object.prototype.widgetFullName || name; $.fn[ name ] = function( options ) { var isMethodCall = typeof options === "string", args = widget_slice.call( arguments, 1 ), returnValue = this; // allow multiple hashes to be passed on init options = !isMethodCall && args.length ? $.widget.extend.apply( null, [ options ].concat(args) ) : options; if ( isMethodCall ) { this.each(function() { var methodValue, instance = $.data( this, fullName ); if ( options === "instance" ) { returnValue = instance; return false; } if ( !instance ) { return $.error( "cannot call methods on " + name + " prior to initialization; " + "attempted to call method '" + options + "'" ); } if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) { return $.error( "no such method '" + options + "' for " + name + " widget instance" ); } methodValue = instance[ options ].apply( instance, args ); if ( methodValue !== instance && methodValue !== undefined ) { returnValue = methodValue && methodValue.jquery ? returnValue.pushStack( methodValue.get() ) : methodValue; return false; } }); } else { this.each(function() { var instance = $.data( this, fullName ); if ( instance ) { instance.option( options || {} ); if ( instance._init ) { instance._init(); } } else { $.data( this, fullName, new object( options, this ) ); } }); } return returnValue; }; }; $.Widget = function( /* options, element */ ) {}; $.Widget._childConstructors = []; $.Widget.prototype = { widgetName: "widget", widgetEventPrefix: "", defaultElement: "<div>", options: { disabled: false, // callbacks create: null }, _createWidget: function( options, element ) { element = $( element || this.defaultElement || this )[ 0 ]; this.element = $( element ); this.uuid = widget_uuid++; this.eventNamespace = "." + this.widgetName + this.uuid; this.options = $.widget.extend( {}, this.options, this._getCreateOptions(), options ); this.bindings = $(); this.hoverable = $(); this.focusable = $(); if ( element !== this ) { $.data( element, this.widgetFullName, this ); this._on( true, this.element, { remove: function( event ) { if ( event.target === element ) { this.destroy(); } } }); this.document = $( element.style ? // element within the document element.ownerDocument : // element is window or document element.document || element ); this.window = $( this.document[0].defaultView || this.document[0].parentWindow ); } this._create(); this._trigger( "create", null, this._getCreateEventData() ); this._init(); }, _getCreateOptions: $.noop, _getCreateEventData: $.noop, _create: $.noop, _init: $.noop, destroy: function() { this._destroy(); // we can probably remove the unbind calls in 2.0 // all event bindings should go through this._on() this.element .unbind( this.eventNamespace ) .removeData( this.widgetFullName ) // support: jquery <1.6.3 // http://bugs.jquery.com/ticket/9413 .removeData( $.camelCase( this.widgetFullName ) ); this.widget() .unbind( this.eventNamespace ) .removeAttr( "aria-disabled" ) .removeClass( this.widgetFullName + "-disabled " + "ui-state-disabled" ); // clean up events and states this.bindings.unbind( this.eventNamespace ); this.hoverable.removeClass( "ui-state-hover" ); this.focusable.removeClass( "ui-state-focus" ); }, _destroy: $.noop, widget: function() { return this.element; }, option: function( key, value ) { var options = key, parts, curOption, i; if ( arguments.length === 0 ) { // don't return a reference to the internal hash return $.widget.extend( {}, this.options ); } if ( typeof key === "string" ) { // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } options = {}; parts = key.split( "." ); key = parts.shift(); if ( parts.length ) { curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); for ( i = 0; i < parts.length - 1; i++ ) { curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; curOption = curOption[ parts[ i ] ]; } key = parts.pop(); if ( arguments.length === 1 ) { return curOption[ key ] === undefined ? null : curOption[ key ]; } curOption[ key ] = value; } else { if ( arguments.length === 1 ) { return this.options[ key ] === undefined ? null : this.options[ key ]; } options[ key ] = value; } } this._setOptions( options ); return this; }, _setOptions: function( options ) { var key; for ( key in options ) { this._setOption( key, options[ key ] ); } return this; }, _setOption: function( key, value ) { this.options[ key ] = value; if ( key === "disabled" ) { this.widget() .toggleClass( this.widgetFullName + "-disabled", !!value ); // If the widget is becoming disabled, then nothing is interactive if ( value ) { this.hoverable.removeClass( "ui-state-hover" ); this.focusable.removeClass( "ui-state-focus" ); } } return this; }, enable: function() { return this._setOptions({ disabled: false }); }, disable: function() { return this._setOptions({ disabled: true }); }, _on: function( suppressDisabledCheck, element, handlers ) { var delegateElement, instance = this; // no suppressDisabledCheck flag, shuffle arguments if ( typeof suppressDisabledCheck !== "boolean" ) { handlers = element; element = suppressDisabledCheck; suppressDisabledCheck = false; } // no element argument, shuffle and use this.element if ( !handlers ) { handlers = element; element = this.element; delegateElement = this.widget(); } else { element = delegateElement = $( element ); this.bindings = this.bindings.add( element ); } $.each( handlers, function( event, handler ) { function handlerProxy() { // allow widgets to customize the disabled handling // - disabled as an array instead of boolean // - disabled class as method for disabling individual parts if ( !suppressDisabledCheck && ( instance.options.disabled === true || $( this ).hasClass( "ui-state-disabled" ) ) ) { return; } return ( typeof handler === "string" ? instance[ handler ] : handler ) .apply( instance, arguments ); } // copy the guid so direct unbinding works if ( typeof handler !== "string" ) { handlerProxy.guid = handler.guid = handler.guid || handlerProxy.guid || $.guid++; } var match = event.match( /^([\w:-]*)\s*(.*)$/ ), eventName = match[1] + instance.eventNamespace, selector = match[2]; if ( selector ) { delegateElement.delegate( selector, eventName, handlerProxy ); } else { element.bind( eventName, handlerProxy ); } }); }, _off: function( element, eventName ) { eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace; element.unbind( eventName ).undelegate( eventName ); }, _delay: function( handler, delay ) { function handlerProxy() { return ( typeof handler === "string" ? instance[ handler ] : handler ) .apply( instance, arguments ); } var instance = this; return setTimeout( handlerProxy, delay || 0 ); }, _hoverable: function( element ) { this.hoverable = this.hoverable.add( element ); this._on( element, { mouseenter: function( event ) { $( event.currentTarget ).addClass( "ui-state-hover" ); }, mouseleave: function( event ) { $( event.currentTarget ).removeClass( "ui-state-hover" ); } }); }, _focusable: function( element ) { this.focusable = this.focusable.add( element ); this._on( element, { focusin: function( event ) { $( event.currentTarget ).addClass( "ui-state-focus" ); }, focusout: function( event ) { $( event.currentTarget ).removeClass( "ui-state-focus" ); } }); }, _trigger: function( type, event, data ) { var prop, orig, callback = this.options[ type ]; data = data || {}; event = $.Event( event ); event.type = ( type === this.widgetEventPrefix ? type : this.widgetEventPrefix + type ).toLowerCase(); // the original event may come from any element // so we need to reset the target on the new event event.target = this.element[ 0 ]; // copy original event properties over to the new event orig = event.originalEvent; if ( orig ) { for ( prop in orig ) { if ( !( prop in event ) ) { event[ prop ] = orig[ prop ]; } } } this.element.trigger( event, data ); return !( $.isFunction( callback ) && callback.apply( this.element[0], [ event ].concat( data ) ) === false || event.isDefaultPrevented() ); } }; $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { if ( typeof options === "string" ) { options = { effect: options }; } var hasOptions, effectName = !options ? method : options === true || typeof options === "number" ? defaultEffect : options.effect || defaultEffect; options = options || {}; if ( typeof options === "number" ) { options = { duration: options }; } hasOptions = !$.isEmptyObject( options ); options.complete = callback; if ( options.delay ) { element.delay( options.delay ); } if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { element[ method ]( options ); } else if ( effectName !== method && element[ effectName ] ) { element[ effectName ]( options.duration, options.easing, callback ); } else { element.queue(function( next ) { $( this )[ method ](); if ( callback ) { callback.call( element[ 0 ] ); } next(); }); } }; }); var widget = $.widget; /*! * jQuery UI Mouse 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/mouse/ */ var mouseHandled = false; $( document ).mouseup( function() { mouseHandled = false; }); var mouse = $.widget("ui.mouse", { version: "1.11.1", options: { cancel: "input,textarea,button,select,option", distance: 1, delay: 0 }, _mouseInit: function() { var that = this; this.element .bind("mousedown." + this.widgetName, function(event) { return that._mouseDown(event); }) .bind("click." + this.widgetName, function(event) { if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) { $.removeData(event.target, that.widgetName + ".preventClickEvent"); event.stopImmediatePropagation(); return false; } }); this.started = false; }, // TODO: make sure destroying one instance of mouse doesn't mess with // other instances of mouse _mouseDestroy: function() { this.element.unbind("." + this.widgetName); if ( this._mouseMoveDelegate ) { this.document .unbind("mousemove." + this.widgetName, this._mouseMoveDelegate) .unbind("mouseup." + this.widgetName, this._mouseUpDelegate); } }, _mouseDown: function(event) { // don't let more than one widget handle mouseStart if ( mouseHandled ) { return; } // we may have missed mouseup (out of window) (this._mouseStarted && this._mouseUp(event)); this._mouseDownEvent = event; var that = this, btnIsLeft = (event.which === 1), // event.target.nodeName works around a bug in IE 8 with // disabled inputs (#7620) elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false); if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { return true; } this.mouseDelayMet = !this.options.delay; if (!this.mouseDelayMet) { this._mouseDelayTimer = setTimeout(function() { that.mouseDelayMet = true; }, this.options.delay); } if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { this._mouseStarted = (this._mouseStart(event) !== false); if (!this._mouseStarted) { event.preventDefault(); return true; } } // Click event may never have fired (Gecko & Opera) if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) { $.removeData(event.target, this.widgetName + ".preventClickEvent"); } // these delegates are required to keep context this._mouseMoveDelegate = function(event) { return that._mouseMove(event); }; this._mouseUpDelegate = function(event) { return that._mouseUp(event); }; this.document .bind( "mousemove." + this.widgetName, this._mouseMoveDelegate ) .bind( "mouseup." + this.widgetName, this._mouseUpDelegate ); event.preventDefault(); mouseHandled = true; return true; }, _mouseMove: function(event) { // IE mouseup check - mouseup happened when mouse was out of window if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) { return this._mouseUp(event); // Iframe mouseup check - mouseup occurred in another document } else if ( !event.which ) { return this._mouseUp( event ); } if (this._mouseStarted) { this._mouseDrag(event); return event.preventDefault(); } if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { this._mouseStarted = (this._mouseStart(this._mouseDownEvent, event) !== false); (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); } return !this._mouseStarted; }, _mouseUp: function(event) { this.document .unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate ) .unbind( "mouseup." + this.widgetName, this._mouseUpDelegate ); if (this._mouseStarted) { this._mouseStarted = false; if (event.target === this._mouseDownEvent.target) { $.data(event.target, this.widgetName + ".preventClickEvent", true); } this._mouseStop(event); } mouseHandled = false; return false; }, _mouseDistanceMet: function(event) { return (Math.max( Math.abs(this._mouseDownEvent.pageX - event.pageX), Math.abs(this._mouseDownEvent.pageY - event.pageY) ) >= this.options.distance ); }, _mouseDelayMet: function(/* event */) { return this.mouseDelayMet; }, // These are placeholder methods, to be overriden by extending plugin _mouseStart: function(/* event */) {}, _mouseDrag: function(/* event */) {}, _mouseStop: function(/* event */) {}, _mouseCapture: function(/* event */) { return true; } }); /*! * jQuery UI Position 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/position/ */ (function() { $.ui = $.ui || {}; var cachedScrollbarWidth, supportsOffsetFractions, max = Math.max, abs = Math.abs, round = Math.round, rhorizontal = /left|center|right/, rvertical = /top|center|bottom/, roffset = /[\+\-]\d+(\.[\d]+)?%?/, rposition = /^\w+/, rpercent = /%$/, _position = $.fn.position; function getOffsets( offsets, width, height ) { return [ parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) ]; } function parseCss( element, property ) { return parseInt( $.css( element, property ), 10 ) || 0; } function getDimensions( elem ) { var raw = elem[0]; if ( raw.nodeType === 9 ) { return { width: elem.width(), height: elem.height(), offset: { top: 0, left: 0 } }; } if ( $.isWindow( raw ) ) { return { width: elem.width(), height: elem.height(), offset: { top: elem.scrollTop(), left: elem.scrollLeft() } }; } if ( raw.preventDefault ) { return { width: 0, height: 0, offset: { top: raw.pageY, left: raw.pageX } }; } return { width: elem.outerWidth(), height: elem.outerHeight(), offset: elem.offset() }; } $.position = { scrollbarWidth: function() { if ( cachedScrollbarWidth !== undefined ) { return cachedScrollbarWidth; } var w1, w2, div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ), innerDiv = div.children()[0]; $( "body" ).append( div ); w1 = innerDiv.offsetWidth; div.css( "overflow", "scroll" ); w2 = innerDiv.offsetWidth; if ( w1 === w2 ) { w2 = div[0].clientWidth; } div.remove(); return (cachedScrollbarWidth = w1 - w2); }, getScrollInfo: function( within ) { var overflowX = within.isWindow || within.isDocument ? "" : within.element.css( "overflow-x" ), overflowY = within.isWindow || within.isDocument ? "" : within.element.css( "overflow-y" ), hasOverflowX = overflowX === "scroll" || ( overflowX === "auto" && within.width < within.element[0].scrollWidth ), hasOverflowY = overflowY === "scroll" || ( overflowY === "auto" && within.height < within.element[0].scrollHeight ); return { width: hasOverflowY ? $.position.scrollbarWidth() : 0, height: hasOverflowX ? $.position.scrollbarWidth() : 0 }; }, getWithinInfo: function( element ) { var withinElement = $( element || window ), isWindow = $.isWindow( withinElement[0] ), isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9; return { element: withinElement, isWindow: isWindow, isDocument: isDocument, offset: withinElement.offset() || { left: 0, top: 0 }, scrollLeft: withinElement.scrollLeft(), scrollTop: withinElement.scrollTop(), // support: jQuery 1.6.x // jQuery 1.6 doesn't support .outerWidth/Height() on documents or windows width: isWindow || isDocument ? withinElement.width() : withinElement.outerWidth(), height: isWindow || isDocument ? withinElement.height() : withinElement.outerHeight() }; } }; $.fn.position = function( options ) { if ( !options || !options.of ) { return _position.apply( this, arguments ); } // make a copy, we don't want to modify arguments options = $.extend( {}, options ); var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, target = $( options.of ), within = $.position.getWithinInfo( options.within ), scrollInfo = $.position.getScrollInfo( within ), collision = ( options.collision || "flip" ).split( " " ), offsets = {}; dimensions = getDimensions( target ); if ( target[0].preventDefault ) { // force left top to allow flipping options.at = "left top"; } targetWidth = dimensions.width; targetHeight = dimensions.height; targetOffset = dimensions.offset; // clone to reuse original targetOffset later basePosition = $.extend( {}, targetOffset ); // force my and at to have valid horizontal and vertical positions // if a value is missing or invalid, it will be converted to center $.each( [ "my", "at" ], function() { var pos = ( options[ this ] || "" ).split( " " ), horizontalOffset, verticalOffset; if ( pos.length === 1) { pos = rhorizontal.test( pos[ 0 ] ) ? pos.concat( [ "center" ] ) : rvertical.test( pos[ 0 ] ) ? [ "center" ].concat( pos ) : [ "center", "center" ]; } pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; // calculate offsets horizontalOffset = roffset.exec( pos[ 0 ] ); verticalOffset = roffset.exec( pos[ 1 ] ); offsets[ this ] = [ horizontalOffset ? horizontalOffset[ 0 ] : 0, verticalOffset ? verticalOffset[ 0 ] : 0 ]; // reduce to just the positions without the offsets options[ this ] = [ rposition.exec( pos[ 0 ] )[ 0 ], rposition.exec( pos[ 1 ] )[ 0 ] ]; }); // normalize collision option if ( collision.length === 1 ) { collision[ 1 ] = collision[ 0 ]; } if ( options.at[ 0 ] === "right" ) { basePosition.left += targetWidth; } else if ( options.at[ 0 ] === "center" ) { basePosition.left += targetWidth / 2; } if ( options.at[ 1 ] === "bottom" ) { basePosition.top += targetHeight; } else if ( options.at[ 1 ] === "center" ) { basePosition.top += targetHeight / 2; } atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); basePosition.left += atOffset[ 0 ]; basePosition.top += atOffset[ 1 ]; return this.each(function() { var collisionPosition, using, elem = $( this ), elemWidth = elem.outerWidth(), elemHeight = elem.outerHeight(), marginLeft = parseCss( this, "marginLeft" ), marginTop = parseCss( this, "marginTop" ), collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width, collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height, position = $.extend( {}, basePosition ), myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); if ( options.my[ 0 ] === "right" ) { position.left -= elemWidth; } else if ( options.my[ 0 ] === "center" ) { position.left -= elemWidth / 2; } if ( options.my[ 1 ] === "bottom" ) { position.top -= elemHeight; } else if ( options.my[ 1 ] === "center" ) { position.top -= elemHeight / 2; } position.left += myOffset[ 0 ]; position.top += myOffset[ 1 ]; // if the browser doesn't support fractions, then round for consistent results if ( !supportsOffsetFractions ) { position.left = round( position.left ); position.top = round( position.top ); } collisionPosition = { marginLeft: marginLeft, marginTop: marginTop }; $.each( [ "left", "top" ], function( i, dir ) { if ( $.ui.position[ collision[ i ] ] ) { $.ui.position[ collision[ i ] ][ dir ]( position, { targetWidth: targetWidth, targetHeight: targetHeight, elemWidth: elemWidth, elemHeight: elemHeight, collisionPosition: collisionPosition, collisionWidth: collisionWidth, collisionHeight: collisionHeight, offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], my: options.my, at: options.at, within: within, elem: elem }); } }); if ( options.using ) { // adds feedback as second argument to using callback, if present using = function( props ) { var left = targetOffset.left - position.left, right = left + targetWidth - elemWidth, top = targetOffset.top - position.top, bottom = top + targetHeight - elemHeight, feedback = { target: { element: target, left: targetOffset.left, top: targetOffset.top, width: targetWidth, height: targetHeight }, element: { element: elem, left: position.left, top: position.top, width: elemWidth, height: elemHeight }, horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" }; if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { feedback.horizontal = "center"; } if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { feedback.vertical = "middle"; } if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { feedback.important = "horizontal"; } else { feedback.important = "vertical"; } options.using.call( this, props, feedback ); }; } elem.offset( $.extend( position, { using: using } ) ); }); }; $.ui.position = { fit: { left: function( position, data ) { var within = data.within, withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, outerWidth = within.width, collisionPosLeft = position.left - data.collisionPosition.marginLeft, overLeft = withinOffset - collisionPosLeft, overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, newOverRight; // element is wider than within if ( data.collisionWidth > outerWidth ) { // element is initially over the left side of within if ( overLeft > 0 && overRight <= 0 ) { newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset; position.left += overLeft - newOverRight; // element is initially over right side of within } else if ( overRight > 0 && overLeft <= 0 ) { position.left = withinOffset; // element is initially over both left and right sides of within } else { if ( overLeft > overRight ) { position.left = withinOffset + outerWidth - data.collisionWidth; } else { position.left = withinOffset; } } // too far left -> align with left edge } else if ( overLeft > 0 ) { position.left += overLeft; // too far right -> align with right edge } else if ( overRight > 0 ) { position.left -= overRight; // adjust based on position and margin } else { position.left = max( position.left - collisionPosLeft, position.left ); } }, top: function( position, data ) { var within = data.within, withinOffset = within.isWindow ? within.scrollTop : within.offset.top, outerHeight = data.within.height, collisionPosTop = position.top - data.collisionPosition.marginTop, overTop = withinOffset - collisionPosTop, overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, newOverBottom; // element is taller than within if ( data.collisionHeight > outerHeight ) { // element is initially over the top of within if ( overTop > 0 && overBottom <= 0 ) { newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset; position.top += overTop - newOverBottom; // element is initially over bottom of within } else if ( overBottom > 0 && overTop <= 0 ) { position.top = withinOffset; // element is initially over both top and bottom of within } else { if ( overTop > overBottom ) { position.top = withinOffset + outerHeight - data.collisionHeight; } else { position.top = withinOffset; } } // too far up -> align with top } else if ( overTop > 0 ) { position.top += overTop; // too far down -> align with bottom edge } else if ( overBottom > 0 ) { position.top -= overBottom; // adjust based on position and margin } else { position.top = max( position.top - collisionPosTop, position.top ); } } }, flip: { left: function( position, data ) { var within = data.within, withinOffset = within.offset.left + within.scrollLeft, outerWidth = within.width, offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, collisionPosLeft = position.left - data.collisionPosition.marginLeft, overLeft = collisionPosLeft - offsetLeft, overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, myOffset = data.my[ 0 ] === "left" ? -data.elemWidth : data.my[ 0 ] === "right" ? data.elemWidth : 0, atOffset = data.at[ 0 ] === "left" ? data.targetWidth : data.at[ 0 ] === "right" ? -data.targetWidth : 0, offset = -2 * data.offset[ 0 ], newOverRight, newOverLeft; if ( overLeft < 0 ) { newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset; if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { position.left += myOffset + atOffset + offset; } } else if ( overRight > 0 ) { newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft; if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { position.left += myOffset + atOffset + offset; } } }, top: function( position, data ) { var within = data.within, withinOffset = within.offset.top + within.scrollTop, outerHeight = within.height, offsetTop = within.isWindow ? within.scrollTop : within.offset.top, collisionPosTop = position.top - data.collisionPosition.marginTop, overTop = collisionPosTop - offsetTop, overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, top = data.my[ 1 ] === "top", myOffset = top ? -data.elemHeight : data.my[ 1 ] === "bottom" ? data.elemHeight : 0, atOffset = data.at[ 1 ] === "top" ? data.targetHeight : data.at[ 1 ] === "bottom" ? -data.targetHeight : 0, offset = -2 * data.offset[ 1 ], newOverTop, newOverBottom; if ( overTop < 0 ) { newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset; if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) { position.top += myOffset + atOffset + offset; } } else if ( overBottom > 0 ) { newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop; if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) { position.top += myOffset + atOffset + offset; } } } }, flipfit: { left: function() { $.ui.position.flip.left.apply( this, arguments ); $.ui.position.fit.left.apply( this, arguments ); }, top: function() { $.ui.position.flip.top.apply( this, arguments ); $.ui.position.fit.top.apply( this, arguments ); } } }; // fraction support test (function() { var testElement, testElementParent, testElementStyle, offsetLeft, i, body = document.getElementsByTagName( "body" )[ 0 ], div = document.createElement( "div" ); //Create a "fake body" for testing based on method used in jQuery.support testElement = document.createElement( body ? "div" : "body" ); testElementStyle = { visibility: "hidden", width: 0, height: 0, border: 0, margin: 0, background: "none" }; if ( body ) { $.extend( testElementStyle, { position: "absolute", left: "-1000px", top: "-1000px" }); } for ( i in testElementStyle ) { testElement.style[ i ] = testElementStyle[ i ]; } testElement.appendChild( div ); testElementParent = body || document.documentElement; testElementParent.insertBefore( testElement, testElementParent.firstChild ); div.style.cssText = "position: absolute; left: 10.7432222px;"; offsetLeft = $( div ).offset().left; supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11; testElement.innerHTML = ""; testElementParent.removeChild( testElement ); })(); })(); var position = $.ui.position; /*! * jQuery UI Draggable 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/draggable/ */ $.widget("ui.draggable", $.ui.mouse, { version: "1.11.1", widgetEventPrefix: "drag", options: { addClasses: true, appendTo: "parent", axis: false, connectToSortable: false, containment: false, cursor: "auto", cursorAt: false, grid: false, handle: false, helper: "original", iframeFix: false, opacity: false, refreshPositions: false, revert: false, revertDuration: 500, scope: "default", scroll: true, scrollSensitivity: 20, scrollSpeed: 20, snap: false, snapMode: "both", snapTolerance: 20, stack: false, zIndex: false, // callbacks drag: null, start: null, stop: null }, _create: function() { if (this.options.helper === "original" && !(/^(?:r|a|f)/).test(this.element.css("position"))) { this.element[0].style.position = "relative"; } if (this.options.addClasses){ this.element.addClass("ui-draggable"); } if (this.options.disabled){ this.element.addClass("ui-draggable-disabled"); } this._setHandleClassName(); this._mouseInit(); }, _setOption: function( key, value ) { this._super( key, value ); if ( key === "handle" ) { this._removeHandleClassName(); this._setHandleClassName(); } }, _destroy: function() { if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) { this.destroyOnClear = true; return; } this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" ); this._removeHandleClassName(); this._mouseDestroy(); }, _mouseCapture: function(event) { var document = this.document[ 0 ], o = this.options; // support: IE9 // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> try { // Support: IE9+ // If the <body> is blurred, IE will switch windows, see #9520 if ( document.activeElement && document.activeElement.nodeName.toLowerCase() !== "body" ) { // Blur any element that currently has focus, see #4261 $( document.activeElement ).blur(); } } catch ( error ) {} // among others, prevent a drag on a resizable-handle if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) { return false; } //Quit if we're not on a valid handle this.handle = this._getHandle(event); if (!this.handle) { return false; } $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() { $("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>") .css({ width: this.offsetWidth + "px", height: this.offsetHeight + "px", position: "absolute", opacity: "0.001", zIndex: 1000 }) .css($(this).offset()) .appendTo("body"); }); return true; }, _mouseStart: function(event) { var o = this.options; //Create and append the visible helper this.helper = this._createHelper(event); this.helper.addClass("ui-draggable-dragging"); //Cache the helper size this._cacheHelperProportions(); //If ddmanager is used for droppables, set the global draggable if ($.ui.ddmanager) { $.ui.ddmanager.current = this; } /* * - Position generation - * This block generates everything position related - it's the core of draggables. */ //Cache the margins of the original element this._cacheMargins(); //Store the helper's css position this.cssPosition = this.helper.css( "position" ); this.scrollParent = this.helper.scrollParent( true ); this.offsetParent = this.helper.offsetParent(); this.offsetParentCssPosition = this.offsetParent.css( "position" ); //The element's absolute position on the page minus margins this.offset = this.positionAbs = this.element.offset(); this.offset = { top: this.offset.top - this.margins.top, left: this.offset.left - this.margins.left }; //Reset scroll cache this.offset.scroll = false; $.extend(this.offset, { click: { //Where the click happened, relative to the element left: event.pageX - this.offset.left, top: event.pageY - this.offset.top }, parent: this._getParentOffset(), relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper }); //Generate the original position this.originalPosition = this.position = this._generatePosition( event, false ); this.originalPageX = event.pageX; this.originalPageY = event.pageY; //Adjust the mouse offset relative to the helper if "cursorAt" is supplied (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); //Set a containment if given in the options this._setContainment(); //Trigger event + callbacks if (this._trigger("start", event) === false) { this._clear(); return false; } //Recache the helper size this._cacheHelperProportions(); //Prepare the droppable offsets if ($.ui.ddmanager && !o.dropBehaviour) { $.ui.ddmanager.prepareOffsets(this, event); } this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003) if ( $.ui.ddmanager ) { $.ui.ddmanager.dragStart(this, event); } return true; }, _mouseDrag: function(event, noPropagation) { // reset any necessary cached properties (see #5009) if ( this.offsetParentCssPosition === "fixed" ) { this.offset.parent = this._getParentOffset(); } //Compute the helpers position this.position = this._generatePosition( event, true ); this.positionAbs = this._convertPositionTo("absolute"); //Call plugins and callbacks and use the resulting position if something is returned if (!noPropagation) { var ui = this._uiHash(); if (this._trigger("drag", event, ui) === false) { this._mouseUp({}); return false; } this.position = ui.position; } this.helper[ 0 ].style.left = this.position.left + "px"; this.helper[ 0 ].style.top = this.position.top + "px"; if ($.ui.ddmanager) { $.ui.ddmanager.drag(this, event); } return false; }, _mouseStop: function(event) { //If we are using droppables, inform the manager about the drop var that = this, dropped = false; if ($.ui.ddmanager && !this.options.dropBehaviour) { dropped = $.ui.ddmanager.drop(this, event); } //if a drop comes from outside (a sortable) if (this.dropped) { dropped = this.dropped; this.dropped = false; } if ((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { if (that._trigger("stop", event) !== false) { that._clear(); } }); } else { if (this._trigger("stop", event) !== false) { this._clear(); } } return false; }, _mouseUp: function(event) { //Remove frame helpers $("div.ui-draggable-iframeFix").each(function() { this.parentNode.removeChild(this); }); //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003) if ( $.ui.ddmanager ) { $.ui.ddmanager.dragStop(this, event); } // The interaction is over; whether or not the click resulted in a drag, focus the element this.element.focus(); return $.ui.mouse.prototype._mouseUp.call(this, event); }, cancel: function() { if (this.helper.is(".ui-draggable-dragging")) { this._mouseUp({}); } else { this._clear(); } return this; }, _getHandle: function(event) { return this.options.handle ? !!$( event.target ).closest( this.element.find( this.options.handle ) ).length : true; }, _setHandleClassName: function() { this.handleElement = this.options.handle ? this.element.find( this.options.handle ) : this.element; this.handleElement.addClass( "ui-draggable-handle" ); }, _removeHandleClassName: function() { this.handleElement.removeClass( "ui-draggable-handle" ); }, _createHelper: function(event) { var o = this.options, helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[ 0 ], [ event ])) : (o.helper === "clone" ? this.element.clone().removeAttr("id") : this.element); if (!helper.parents("body").length) { helper.appendTo((o.appendTo === "parent" ? this.element[0].parentNode : o.appendTo)); } if (helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) { helper.css("position", "absolute"); } return helper; }, _adjustOffsetFromHelper: function(obj) { if (typeof obj === "string") { obj = obj.split(" "); } if ($.isArray(obj)) { obj = { left: +obj[0], top: +obj[1] || 0 }; } if ("left" in obj) { this.offset.click.left = obj.left + this.margins.left; } if ("right" in obj) { this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; } if ("top" in obj) { this.offset.click.top = obj.top + this.margins.top; } if ("bottom" in obj) { this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; } }, _isRootNode: function( element ) { return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ]; }, _getParentOffset: function() { //Get the offsetParent and cache its position var po = this.offsetParent.offset(), document = this.document[ 0 ]; // This is a special case where we need to modify a offset calculated on start, since the following happened: // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag if (this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) { po.left += this.scrollParent.scrollLeft(); po.top += this.scrollParent.scrollTop(); } if ( this._isRootNode( this.offsetParent[ 0 ] ) ) { po = { top: 0, left: 0 }; } return { top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) }; }, _getRelativeOffset: function() { if ( this.cssPosition !== "relative" ) { return { top: 0, left: 0 }; } var p = this.element.position(), scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); return { top: p.top - ( parseInt(this.helper.css( "top" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ), left: p.left - ( parseInt(this.helper.css( "left" ), 10) || 0 ) + ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 ) }; }, _cacheMargins: function() { this.margins = { left: (parseInt(this.element.css("marginLeft"), 10) || 0), top: (parseInt(this.element.css("marginTop"), 10) || 0), right: (parseInt(this.element.css("marginRight"), 10) || 0), bottom: (parseInt(this.element.css("marginBottom"), 10) || 0) }; }, _cacheHelperProportions: function() { this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() }; }, _setContainment: function() { var over, c, ce, o = this.options, document = this.document[ 0 ]; this.relativeContainer = null; if ( !o.containment ) { this.containment = null; return; } if ( o.containment === "window" ) { this.containment = [ $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left, $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top, $( window ).scrollLeft() + $( window ).width() - this.helperProportions.width - this.margins.left, $( window ).scrollTop() + ( $( window ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top ]; return; } if ( o.containment === "document") { this.containment = [ 0, 0, $( document ).width() - this.helperProportions.width - this.margins.left, ( $( document ).height() || document.body.parentNode.scrollHeight ) - this.helperProportions.height - this.margins.top ]; return; } if ( o.containment.constructor === Array ) { this.containment = o.containment; return; } if ( o.containment === "parent" ) { o.containment = this.helper[ 0 ].parentNode; } c = $( o.containment ); ce = c[ 0 ]; if ( !ce ) { return; } over = c.css( "overflow" ) !== "hidden"; this.containment = [ ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ), ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ), ( over ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - this.helperProportions.width - this.margins.left - this.margins.right, ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - this.helperProportions.height - this.margins.top - this.margins.bottom ]; this.relativeContainer = c; }, _convertPositionTo: function(d, pos) { if (!pos) { pos = this.position; } var mod = d === "absolute" ? 1 : -1, scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); return { top: ( pos.top + // The absolute mouse position this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border) ( ( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod) ), left: ( pos.left + // The absolute mouse position this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border) ( ( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod) ) }; }, _generatePosition: function( event, constrainPosition ) { var containment, co, top, left, o = this.options, scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ), pageX = event.pageX, pageY = event.pageY; // Cache the scroll if ( !scrollIsRootNode || !this.offset.scroll ) { this.offset.scroll = { top: this.scrollParent.scrollTop(), left: this.scrollParent.scrollLeft() }; } /* * - Position constraining - * Constrain the position to a mix of grid, containment. */ // If we are not dragging yet, we won't check for options if ( constrainPosition ) { if ( this.containment ) { if ( this.relativeContainer ){ co = this.relativeContainer.offset(); containment = [ this.containment[ 0 ] + co.left, this.containment[ 1 ] + co.top, this.containment[ 2 ] + co.left, this.containment[ 3 ] + co.top ]; } else { containment = this.containment; } if (event.pageX - this.offset.click.left < containment[0]) { pageX = containment[0] + this.offset.click.left; } if (event.pageY - this.offset.click.top < containment[1]) { pageY = containment[1] + this.offset.click.top; } if (event.pageX - this.offset.click.left > containment[2]) { pageX = containment[2] + this.offset.click.left; } if (event.pageY - this.offset.click.top > containment[3]) { pageY = containment[3] + this.offset.click.top; } } if (o.grid) { //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950) top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY; pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX; pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; } if ( o.axis === "y" ) { pageX = this.originalPageX; } if ( o.axis === "x" ) { pageY = this.originalPageY; } } return { top: ( pageY - // The absolute mouse position this.offset.click.top - // Click offset (relative to the element) this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.parent.top + // The offsetParent's offset without borders (offset + border) ( this.cssPosition === "fixed" ? -this.offset.scroll.top : ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) ), left: ( pageX - // The absolute mouse position this.offset.click.left - // Click offset (relative to the element) this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.parent.left + // The offsetParent's offset without borders (offset + border) ( this.cssPosition === "fixed" ? -this.offset.scroll.left : ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) ) }; }, _clear: function() { this.helper.removeClass("ui-draggable-dragging"); if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) { this.helper.remove(); } this.helper = null; this.cancelHelperRemoval = false; if ( this.destroyOnClear ) { this.destroy(); } }, // From now on bulk stuff - mainly helpers _trigger: function(type, event, ui) { ui = ui || this._uiHash(); $.ui.plugin.call( this, type, [ event, ui, this ], true ); //The absolute position has to be recalculated after plugins if (type === "drag") { this.positionAbs = this._convertPositionTo("absolute"); } return $.Widget.prototype._trigger.call(this, type, event, ui); }, plugins: {}, _uiHash: function() { return { helper: this.helper, position: this.position, originalPosition: this.originalPosition, offset: this.positionAbs }; } }); $.ui.plugin.add("draggable", "connectToSortable", { start: function( event, ui, inst ) { var o = inst.options, uiSortable = $.extend({}, ui, { item: inst.element }); inst.sortables = []; $(o.connectToSortable).each(function() { var sortable = $( this ).sortable( "instance" ); if (sortable && !sortable.options.disabled) { inst.sortables.push({ instance: sortable, shouldRevert: sortable.options.revert }); sortable.refreshPositions(); // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page). sortable._trigger("activate", event, uiSortable); } }); }, stop: function( event, ui, inst ) { //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper var uiSortable = $.extend( {}, ui, { item: inst.element }); $.each(inst.sortables, function() { if (this.instance.isOver) { this.instance.isOver = 0; inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work) //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: "valid/invalid" if (this.shouldRevert) { this.instance.options.revert = this.shouldRevert; } //Trigger the stop of the sortable this.instance._mouseStop(event); this.instance.options.helper = this.instance.options._helper; //If the helper has been the original item, restore properties in the sortable if (inst.options.helper === "original") { this.instance.currentItem.css({ top: "auto", left: "auto" }); } } else { this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance this.instance._trigger("deactivate", event, uiSortable); } }); }, drag: function( event, ui, inst ) { var that = this; $.each(inst.sortables, function() { var innermostIntersecting = false, thisSortable = this; //Copy over some variables to allow calling the sortable's native _intersectsWith this.instance.positionAbs = inst.positionAbs; this.instance.helperProportions = inst.helperProportions; this.instance.offset.click = inst.offset.click; if (this.instance._intersectsWith(this.instance.containerCache)) { innermostIntersecting = true; $.each(inst.sortables, function() { this.instance.positionAbs = inst.positionAbs; this.instance.helperProportions = inst.helperProportions; this.instance.offset.click = inst.offset.click; if (this !== thisSortable && this.instance._intersectsWith(this.instance.containerCache) && $.contains(thisSortable.instance.element[0], this.instance.element[0]) ) { innermostIntersecting = false; } return innermostIntersecting; }); } if (innermostIntersecting) { //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once if (!this.instance.isOver) { this.instance.isOver = 1; //Now we fake the start of dragging for the sortable instance, //by cloning the list group item, appending it to the sortable and using it as inst.currentItem //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one) this.instance.currentItem = $(that).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item", true); this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it this.instance.options.helper = function() { return ui.helper[0]; }; event.target = this.instance.currentItem[0]; this.instance._mouseCapture(event, true); this.instance._mouseStart(event, true, true); //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes this.instance.offset.click.top = inst.offset.click.top; this.instance.offset.click.left = inst.offset.click.left; this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left; this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top; inst._trigger("toSortable", event); inst.dropped = this.instance.element; //draggable revert needs that //hack so receive/update callbacks work (mostly) inst.currentItem = inst.element; this.instance.fromOutside = inst; } //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable if (this.instance.currentItem) { this.instance._mouseDrag(event); } } else { //If it doesn't intersect with the sortable, and it intersected before, //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval if (this.instance.isOver) { this.instance.isOver = 0; this.instance.cancelHelperRemoval = true; //Prevent reverting on this forced stop this.instance.options.revert = false; // The out event needs to be triggered independently this.instance._trigger("out", event, this.instance._uiHash(this.instance)); this.instance._mouseStop(event, true); this.instance.options.helper = this.instance.options._helper; //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size this.instance.currentItem.remove(); if (this.instance.placeholder) { this.instance.placeholder.remove(); } inst._trigger("fromSortable", event); inst.dropped = false; //draggable revert needs that } } }); } }); $.ui.plugin.add("draggable", "cursor", { start: function( event, ui, instance ) { var t = $( "body" ), o = instance.options; if (t.css("cursor")) { o._cursor = t.css("cursor"); } t.css("cursor", o.cursor); }, stop: function( event, ui, instance ) { var o = instance.options; if (o._cursor) { $("body").css("cursor", o._cursor); } } }); $.ui.plugin.add("draggable", "opacity", { start: function( event, ui, instance ) { var t = $( ui.helper ), o = instance.options; if (t.css("opacity")) { o._opacity = t.css("opacity"); } t.css("opacity", o.opacity); }, stop: function( event, ui, instance ) { var o = instance.options; if (o._opacity) { $(ui.helper).css("opacity", o._opacity); } } }); $.ui.plugin.add("draggable", "scroll", { start: function( event, ui, i ) { if ( !i.scrollParentNotHidden ) { i.scrollParentNotHidden = i.helper.scrollParent( false ); } if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) { i.overflowOffset = i.scrollParentNotHidden.offset(); } }, drag: function( event, ui, i ) { var o = i.options, scrolled = false, scrollParent = i.scrollParentNotHidden[ 0 ], document = i.document[ 0 ]; if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) { if ( !o.axis || o.axis !== "x" ) { if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < o.scrollSensitivity ) { scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) { scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; } } if ( !o.axis || o.axis !== "y" ) { if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < o.scrollSensitivity ) { scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) { scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; } } } else { if (!o.axis || o.axis !== "x") { if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) { scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); } else if ($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) { scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); } } if (!o.axis || o.axis !== "y") { if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) { scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); } else if ($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) { scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); } } } if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { $.ui.ddmanager.prepareOffsets(i, event); } } }); $.ui.plugin.add("draggable", "snap", { start: function( event, ui, i ) { var o = i.options; i.snapElements = []; $(o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap).each(function() { var $t = $(this), $o = $t.offset(); if (this !== i.element[0]) { i.snapElements.push({ item: this, width: $t.outerWidth(), height: $t.outerHeight(), top: $o.top, left: $o.left }); } }); }, drag: function( event, ui, inst ) { var ts, bs, ls, rs, l, r, t, b, i, first, o = inst.options, d = o.snapTolerance, x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; for (i = inst.snapElements.length - 1; i >= 0; i--){ l = inst.snapElements[i].left; r = l + inst.snapElements[i].width; t = inst.snapElements[i].top; b = t + inst.snapElements[i].height; if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || !$.contains( inst.snapElements[ i ].item.ownerDocument, inst.snapElements[ i ].item ) ) { if (inst.snapElements[i].snapping) { (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); } inst.snapElements[i].snapping = false; continue; } if (o.snapMode !== "inner") { ts = Math.abs(t - y2) <= d; bs = Math.abs(b - y1) <= d; ls = Math.abs(l - x2) <= d; rs = Math.abs(r - x1) <= d; if (ts) { ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top; } if (bs) { ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top; } if (ls) { ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left; } if (rs) { ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left; } } first = (ts || bs || ls || rs); if (o.snapMode !== "outer") { ts = Math.abs(t - y1) <= d; bs = Math.abs(b - y2) <= d; ls = Math.abs(l - x1) <= d; rs = Math.abs(r - x2) <= d; if (ts) { ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top; } if (bs) { ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top; } if (ls) { ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left; } if (rs) { ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left; } } if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) { (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); } inst.snapElements[i].snapping = (ts || bs || ls || rs || first); } } }); $.ui.plugin.add("draggable", "stack", { start: function( event, ui, instance ) { var min, o = instance.options, group = $.makeArray($(o.stack)).sort(function(a, b) { return (parseInt($(a).css("zIndex"), 10) || 0) - (parseInt($(b).css("zIndex"), 10) || 0); }); if (!group.length) { return; } min = parseInt($(group[0]).css("zIndex"), 10) || 0; $(group).each(function(i) { $(this).css("zIndex", min + i); }); this.css("zIndex", (min + group.length)); } }); $.ui.plugin.add("draggable", "zIndex", { start: function( event, ui, instance ) { var t = $( ui.helper ), o = instance.options; if (t.css("zIndex")) { o._zIndex = t.css("zIndex"); } t.css("zIndex", o.zIndex); }, stop: function( event, ui, instance ) { var o = instance.options; if (o._zIndex) { $(ui.helper).css("zIndex", o._zIndex); } } }); var draggable = $.ui.draggable; /*! * jQuery UI Droppable 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/droppable/ */ $.widget( "ui.droppable", { version: "1.11.1", widgetEventPrefix: "drop", options: { accept: "*", activeClass: false, addClasses: true, greedy: false, hoverClass: false, scope: "default", tolerance: "intersect", // callbacks activate: null, deactivate: null, drop: null, out: null, over: null }, _create: function() { var proportions, o = this.options, accept = o.accept; this.isover = false; this.isout = true; this.accept = $.isFunction( accept ) ? accept : function( d ) { return d.is( accept ); }; this.proportions = function( /* valueToWrite */ ) { if ( arguments.length ) { // Store the droppable's proportions proportions = arguments[ 0 ]; } else { // Retrieve or derive the droppable's proportions return proportions ? proportions : proportions = { width: this.element[ 0 ].offsetWidth, height: this.element[ 0 ].offsetHeight }; } }; this._addToManager( o.scope ); o.addClasses && this.element.addClass( "ui-droppable" ); }, _addToManager: function( scope ) { // Add the reference and positions to the manager $.ui.ddmanager.droppables[ scope ] = $.ui.ddmanager.droppables[ scope ] || []; $.ui.ddmanager.droppables[ scope ].push( this ); }, _splice: function( drop ) { var i = 0; for ( ; i < drop.length; i++ ) { if ( drop[ i ] === this ) { drop.splice( i, 1 ); } } }, _destroy: function() { var drop = $.ui.ddmanager.droppables[ this.options.scope ]; this._splice( drop ); this.element.removeClass( "ui-droppable ui-droppable-disabled" ); }, _setOption: function( key, value ) { if ( key === "accept" ) { this.accept = $.isFunction( value ) ? value : function( d ) { return d.is( value ); }; } else if ( key === "scope" ) { var drop = $.ui.ddmanager.droppables[ this.options.scope ]; this._splice( drop ); this._addToManager( value ); } this._super( key, value ); }, _activate: function( event ) { var draggable = $.ui.ddmanager.current; if ( this.options.activeClass ) { this.element.addClass( this.options.activeClass ); } if ( draggable ){ this._trigger( "activate", event, this.ui( draggable ) ); } }, _deactivate: function( event ) { var draggable = $.ui.ddmanager.current; if ( this.options.activeClass ) { this.element.removeClass( this.options.activeClass ); } if ( draggable ){ this._trigger( "deactivate", event, this.ui( draggable ) ); } }, _over: function( event ) { var draggable = $.ui.ddmanager.current; // Bail if draggable and droppable are same element if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) { return; } if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) { if ( this.options.hoverClass ) { this.element.addClass( this.options.hoverClass ); } this._trigger( "over", event, this.ui( draggable ) ); } }, _out: function( event ) { var draggable = $.ui.ddmanager.current; // Bail if draggable and droppable are same element if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) { return; } if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) { if ( this.options.hoverClass ) { this.element.removeClass( this.options.hoverClass ); } this._trigger( "out", event, this.ui( draggable ) ); } }, _drop: function( event, custom ) { var draggable = custom || $.ui.ddmanager.current, childrenIntersection = false; // Bail if draggable and droppable are same element if ( !draggable || ( draggable.currentItem || draggable.element )[ 0 ] === this.element[ 0 ] ) { return false; } this.element.find( ":data(ui-droppable)" ).not( ".ui-draggable-dragging" ).each(function() { var inst = $( this ).droppable( "instance" ); if ( inst.options.greedy && !inst.options.disabled && inst.options.scope === draggable.options.scope && inst.accept.call( inst.element[ 0 ], ( draggable.currentItem || draggable.element ) ) && $.ui.intersect( draggable, $.extend( inst, { offset: inst.element.offset() } ), inst.options.tolerance, event ) ) { childrenIntersection = true; return false; } }); if ( childrenIntersection ) { return false; } if ( this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) { if ( this.options.activeClass ) { this.element.removeClass( this.options.activeClass ); } if ( this.options.hoverClass ) { this.element.removeClass( this.options.hoverClass ); } this._trigger( "drop", event, this.ui( draggable ) ); return this.element; } return false; }, ui: function( c ) { return { draggable: ( c.currentItem || c.element ), helper: c.helper, position: c.position, offset: c.positionAbs }; } }); $.ui.intersect = (function() { function isOverAxis( x, reference, size ) { return ( x >= reference ) && ( x < ( reference + size ) ); } return function( draggable, droppable, toleranceMode, event ) { if ( !droppable.offset ) { return false; } var x1 = ( draggable.positionAbs || draggable.position.absolute ).left, y1 = ( draggable.positionAbs || draggable.position.absolute ).top, x2 = x1 + draggable.helperProportions.width, y2 = y1 + draggable.helperProportions.height, l = droppable.offset.left, t = droppable.offset.top, r = l + droppable.proportions().width, b = t + droppable.proportions().height; switch ( toleranceMode ) { case "fit": return ( l <= x1 && x2 <= r && t <= y1 && y2 <= b ); case "intersect": return ( l < x1 + ( draggable.helperProportions.width / 2 ) && // Right Half x2 - ( draggable.helperProportions.width / 2 ) < r && // Left Half t < y1 + ( draggable.helperProportions.height / 2 ) && // Bottom Half y2 - ( draggable.helperProportions.height / 2 ) < b ); // Top Half case "pointer": return isOverAxis( event.pageY, t, droppable.proportions().height ) && isOverAxis( event.pageX, l, droppable.proportions().width ); case "touch": return ( ( y1 >= t && y1 <= b ) || // Top edge touching ( y2 >= t && y2 <= b ) || // Bottom edge touching ( y1 < t && y2 > b ) // Surrounded vertically ) && ( ( x1 >= l && x1 <= r ) || // Left edge touching ( x2 >= l && x2 <= r ) || // Right edge touching ( x1 < l && x2 > r ) // Surrounded horizontally ); default: return false; } }; })(); /* This manager tracks offsets of draggables and droppables */ $.ui.ddmanager = { current: null, droppables: { "default": [] }, prepareOffsets: function( t, event ) { var i, j, m = $.ui.ddmanager.droppables[ t.options.scope ] || [], type = event ? event.type : null, // workaround for #2317 list = ( t.currentItem || t.element ).find( ":data(ui-droppable)" ).addBack(); droppablesLoop: for ( i = 0; i < m.length; i++ ) { // No disabled and non-accepted if ( m[ i ].options.disabled || ( t && !m[ i ].accept.call( m[ i ].element[ 0 ], ( t.currentItem || t.element ) ) ) ) { continue; } // Filter out elements in the current dragged item for ( j = 0; j < list.length; j++ ) { if ( list[ j ] === m[ i ].element[ 0 ] ) { m[ i ].proportions().height = 0; continue droppablesLoop; } } m[ i ].visible = m[ i ].element.css( "display" ) !== "none"; if ( !m[ i ].visible ) { continue; } // Activate the droppable if used directly from draggables if ( type === "mousedown" ) { m[ i ]._activate.call( m[ i ], event ); } m[ i ].offset = m[ i ].element.offset(); m[ i ].proportions({ width: m[ i ].element[ 0 ].offsetWidth, height: m[ i ].element[ 0 ].offsetHeight }); } }, drop: function( draggable, event ) { var dropped = false; // Create a copy of the droppables in case the list changes during the drop (#9116) $.each( ( $.ui.ddmanager.droppables[ draggable.options.scope ] || [] ).slice(), function() { if ( !this.options ) { return; } if ( !this.options.disabled && this.visible && $.ui.intersect( draggable, this, this.options.tolerance, event ) ) { dropped = this._drop.call( this, event ) || dropped; } if ( !this.options.disabled && this.visible && this.accept.call( this.element[ 0 ], ( draggable.currentItem || draggable.element ) ) ) { this.isout = true; this.isover = false; this._deactivate.call( this, event ); } }); return dropped; }, dragStart: function( draggable, event ) { // Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003) draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() { if ( !draggable.options.refreshPositions ) { $.ui.ddmanager.prepareOffsets( draggable, event ); } }); }, drag: function( draggable, event ) { // If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse. if ( draggable.options.refreshPositions ) { $.ui.ddmanager.prepareOffsets( draggable, event ); } // Run through all droppables and check their positions based on specific tolerance options $.each( $.ui.ddmanager.droppables[ draggable.options.scope ] || [], function() { if ( this.options.disabled || this.greedyChild || !this.visible ) { return; } var parentInstance, scope, parent, intersects = $.ui.intersect( draggable, this, this.options.tolerance, event ), c = !intersects && this.isover ? "isout" : ( intersects && !this.isover ? "isover" : null ); if ( !c ) { return; } if ( this.options.greedy ) { // find droppable parents with same scope scope = this.options.scope; parent = this.element.parents( ":data(ui-droppable)" ).filter(function() { return $( this ).droppable( "instance" ).options.scope === scope; }); if ( parent.length ) { parentInstance = $( parent[ 0 ] ).droppable( "instance" ); parentInstance.greedyChild = ( c === "isover" ); } } // we just moved into a greedy child if ( parentInstance && c === "isover" ) { parentInstance.isover = false; parentInstance.isout = true; parentInstance._out.call( parentInstance, event ); } this[ c ] = true; this[c === "isout" ? "isover" : "isout"] = false; this[c === "isover" ? "_over" : "_out"].call( this, event ); // we just moved out of a greedy child if ( parentInstance && c === "isout" ) { parentInstance.isout = false; parentInstance.isover = true; parentInstance._over.call( parentInstance, event ); } }); }, dragStop: function( draggable, event ) { draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" ); // Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003) if ( !draggable.options.refreshPositions ) { $.ui.ddmanager.prepareOffsets( draggable, event ); } } }; var droppable = $.ui.droppable; /*! * jQuery UI Resizable 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/resizable/ */ $.widget("ui.resizable", $.ui.mouse, { version: "1.11.1", widgetEventPrefix: "resize", options: { alsoResize: false, animate: false, animateDuration: "slow", animateEasing: "swing", aspectRatio: false, autoHide: false, containment: false, ghost: false, grid: false, handles: "e,s,se", helper: false, maxHeight: null, maxWidth: null, minHeight: 10, minWidth: 10, // See #7960 zIndex: 90, // callbacks resize: null, start: null, stop: null }, _num: function( value ) { return parseInt( value, 10 ) || 0; }, _isNumber: function( value ) { return !isNaN( parseInt( value, 10 ) ); }, _hasScroll: function( el, a ) { if ( $( el ).css( "overflow" ) === "hidden") { return false; } var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop", has = false; if ( el[ scroll ] > 0 ) { return true; } // TODO: determine which cases actually cause this to happen // if the element doesn't have the scroll set, see if it's possible to // set the scroll el[ scroll ] = 1; has = ( el[ scroll ] > 0 ); el[ scroll ] = 0; return has; }, _create: function() { var n, i, handle, axis, hname, that = this, o = this.options; this.element.addClass("ui-resizable"); $.extend(this, { _aspectRatio: !!(o.aspectRatio), aspectRatio: o.aspectRatio, originalElement: this.element, _proportionallyResizeElements: [], _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null }); // Wrap the element if it cannot hold child nodes if (this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) { this.element.wrap( $("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({ position: this.element.css("position"), width: this.element.outerWidth(), height: this.element.outerHeight(), top: this.element.css("top"), left: this.element.css("left") }) ); this.element = this.element.parent().data( "ui-resizable", this.element.resizable( "instance" ) ); this.elementIsWrapper = true; this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") }); this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0 }); // support: Safari // Prevent Safari textarea resize this.originalResizeStyle = this.originalElement.css("resize"); this.originalElement.css("resize", "none"); this._proportionallyResizeElements.push( this.originalElement.css({ position: "static", zoom: 1, display: "block" }) ); // support: IE9 // avoid IE jump (hard set the margin) this.originalElement.css({ margin: this.originalElement.css("margin") }); this._proportionallyResize(); } this.handles = o.handles || ( !$(".ui-resizable-handle", this.element).length ? "e,s,se" : { n: ".ui-resizable-n", e: ".ui-resizable-e", s: ".ui-resizable-s", w: ".ui-resizable-w", se: ".ui-resizable-se", sw: ".ui-resizable-sw", ne: ".ui-resizable-ne", nw: ".ui-resizable-nw" } ); if (this.handles.constructor === String) { if ( this.handles === "all") { this.handles = "n,e,s,w,se,sw,ne,nw"; } n = this.handles.split(","); this.handles = {}; for (i = 0; i < n.length; i++) { handle = $.trim(n[i]); hname = "ui-resizable-" + handle; axis = $("<div class='ui-resizable-handle " + hname + "'></div>"); axis.css({ zIndex: o.zIndex }); // TODO : What's going on here? if ("se" === handle) { axis.addClass("ui-icon ui-icon-gripsmall-diagonal-se"); } this.handles[handle] = ".ui-resizable-" + handle; this.element.append(axis); } } this._renderAxis = function(target) { var i, axis, padPos, padWrapper; target = target || this.element; for (i in this.handles) { if (this.handles[i].constructor === String) { this.handles[i] = this.element.children( this.handles[ i ] ).first().show(); } if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) { axis = $(this.handles[i], this.element); padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth(); padPos = [ "padding", /ne|nw|n/.test(i) ? "Top" : /se|sw|s/.test(i) ? "Bottom" : /^e$/.test(i) ? "Right" : "Left" ].join(""); target.css(padPos, padWrapper); this._proportionallyResize(); } // TODO: What's that good for? There's not anything to be executed left if (!$(this.handles[i]).length) { continue; } } }; // TODO: make renderAxis a prototype function this._renderAxis(this.element); this._handles = $(".ui-resizable-handle", this.element) .disableSelection(); this._handles.mouseover(function() { if (!that.resizing) { if (this.className) { axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); } that.axis = axis && axis[1] ? axis[1] : "se"; } }); if (o.autoHide) { this._handles.hide(); $(this.element) .addClass("ui-resizable-autohide") .mouseenter(function() { if (o.disabled) { return; } $(this).removeClass("ui-resizable-autohide"); that._handles.show(); }) .mouseleave(function() { if (o.disabled) { return; } if (!that.resizing) { $(this).addClass("ui-resizable-autohide"); that._handles.hide(); } }); } this._mouseInit(); }, _destroy: function() { this._mouseDestroy(); var wrapper, _destroy = function(exp) { $(exp) .removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing") .removeData("resizable") .removeData("ui-resizable") .unbind(".resizable") .find(".ui-resizable-handle") .remove(); }; // TODO: Unwrap at same DOM position if (this.elementIsWrapper) { _destroy(this.element); wrapper = this.element; this.originalElement.css({ position: wrapper.css("position"), width: wrapper.outerWidth(), height: wrapper.outerHeight(), top: wrapper.css("top"), left: wrapper.css("left") }).insertAfter( wrapper ); wrapper.remove(); } this.originalElement.css("resize", this.originalResizeStyle); _destroy(this.originalElement); return this; }, _mouseCapture: function(event) { var i, handle, capture = false; for (i in this.handles) { handle = $(this.handles[i])[0]; if (handle === event.target || $.contains(handle, event.target)) { capture = true; } } return !this.options.disabled && capture; }, _mouseStart: function(event) { var curleft, curtop, cursor, o = this.options, el = this.element; this.resizing = true; this._renderProxy(); curleft = this._num(this.helper.css("left")); curtop = this._num(this.helper.css("top")); if (o.containment) { curleft += $(o.containment).scrollLeft() || 0; curtop += $(o.containment).scrollTop() || 0; } this.offset = this.helper.offset(); this.position = { left: curleft, top: curtop }; this.size = this._helper ? { width: this.helper.width(), height: this.helper.height() } : { width: el.width(), height: el.height() }; this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() }; this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() }; this.originalPosition = { left: curleft, top: curtop }; this.originalMousePosition = { left: event.pageX, top: event.pageY }; this.aspectRatio = (typeof o.aspectRatio === "number") ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1); cursor = $(".ui-resizable-" + this.axis).css("cursor"); $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor); el.addClass("ui-resizable-resizing"); this._propagate("start", event); return true; }, _mouseDrag: function(event) { var data, props, smp = this.originalMousePosition, a = this.axis, dx = (event.pageX - smp.left) || 0, dy = (event.pageY - smp.top) || 0, trigger = this._change[a]; this._updatePrevProperties(); if (!trigger) { return false; } data = trigger.apply(this, [ event, dx, dy ]); this._updateVirtualBoundaries(event.shiftKey); if (this._aspectRatio || event.shiftKey) { data = this._updateRatio(data, event); } data = this._respectSize(data, event); this._updateCache(data); this._propagate("resize", event); props = this._applyChanges(); if ( !this._helper && this._proportionallyResizeElements.length ) { this._proportionallyResize(); } if ( !$.isEmptyObject( props ) ) { this._updatePrevProperties(); this._trigger( "resize", event, this.ui() ); this._applyChanges(); } return false; }, _mouseStop: function(event) { this.resizing = false; var pr, ista, soffseth, soffsetw, s, left, top, o = this.options, that = this; if (this._helper) { pr = this._proportionallyResizeElements; ista = pr.length && (/textarea/i).test(pr[0].nodeName); soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height; soffsetw = ista ? 0 : that.sizeDiff.width; s = { width: (that.helper.width() - soffsetw), height: (that.helper.height() - soffseth) }; left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null; top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null; if (!o.animate) { this.element.css($.extend(s, { top: top, left: left })); } that.helper.height(that.size.height); that.helper.width(that.size.width); if (this._helper && !o.animate) { this._proportionallyResize(); } } $("body").css("cursor", "auto"); this.element.removeClass("ui-resizable-resizing"); this._propagate("stop", event); if (this._helper) { this.helper.remove(); } return false; }, _updatePrevProperties: function() { this.prevPosition = { top: this.position.top, left: this.position.left }; this.prevSize = { width: this.size.width, height: this.size.height }; }, _applyChanges: function() { var props = {}; if ( this.position.top !== this.prevPosition.top ) { props.top = this.position.top + "px"; } if ( this.position.left !== this.prevPosition.left ) { props.left = this.position.left + "px"; } if ( this.size.width !== this.prevSize.width ) { props.width = this.size.width + "px"; } if ( this.size.height !== this.prevSize.height ) { props.height = this.size.height + "px"; } this.helper.css( props ); return props; }, _updateVirtualBoundaries: function(forceAspectRatio) { var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, o = this.options; b = { minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0, maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : Infinity, minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0, maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity }; if (this._aspectRatio || forceAspectRatio) { pMinWidth = b.minHeight * this.aspectRatio; pMinHeight = b.minWidth / this.aspectRatio; pMaxWidth = b.maxHeight * this.aspectRatio; pMaxHeight = b.maxWidth / this.aspectRatio; if (pMinWidth > b.minWidth) { b.minWidth = pMinWidth; } if (pMinHeight > b.minHeight) { b.minHeight = pMinHeight; } if (pMaxWidth < b.maxWidth) { b.maxWidth = pMaxWidth; } if (pMaxHeight < b.maxHeight) { b.maxHeight = pMaxHeight; } } this._vBoundaries = b; }, _updateCache: function(data) { this.offset = this.helper.offset(); if (this._isNumber(data.left)) { this.position.left = data.left; } if (this._isNumber(data.top)) { this.position.top = data.top; } if (this._isNumber(data.height)) { this.size.height = data.height; } if (this._isNumber(data.width)) { this.size.width = data.width; } }, _updateRatio: function( data ) { var cpos = this.position, csize = this.size, a = this.axis; if (this._isNumber(data.height)) { data.width = (data.height * this.aspectRatio); } else if (this._isNumber(data.width)) { data.height = (data.width / this.aspectRatio); } if (a === "sw") { data.left = cpos.left + (csize.width - data.width); data.top = null; } if (a === "nw") { data.top = cpos.top + (csize.height - data.height); data.left = cpos.left + (csize.width - data.width); } return data; }, _respectSize: function( data ) { var o = this._vBoundaries, a = this.axis, ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height), dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height, cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); if (isminw) { data.width = o.minWidth; } if (isminh) { data.height = o.minHeight; } if (ismaxw) { data.width = o.maxWidth; } if (ismaxh) { data.height = o.maxHeight; } if (isminw && cw) { data.left = dw - o.minWidth; } if (ismaxw && cw) { data.left = dw - o.maxWidth; } if (isminh && ch) { data.top = dh - o.minHeight; } if (ismaxh && ch) { data.top = dh - o.maxHeight; } // Fixing jump error on top/left - bug #2330 if (!data.width && !data.height && !data.left && data.top) { data.top = null; } else if (!data.width && !data.height && !data.top && data.left) { data.left = null; } return data; }, _getPaddingPlusBorderDimensions: function( element ) { var i = 0, widths = [], borders = [ element.css( "borderTopWidth" ), element.css( "borderRightWidth" ), element.css( "borderBottomWidth" ), element.css( "borderLeftWidth" ) ], paddings = [ element.css( "paddingTop" ), element.css( "paddingRight" ), element.css( "paddingBottom" ), element.css( "paddingLeft" ) ]; for ( ; i < 4; i++ ) { widths[ i ] = ( parseInt( borders[ i ], 10 ) || 0 ); widths[ i ] += ( parseInt( paddings[ i ], 10 ) || 0 ); } return { height: widths[ 0 ] + widths[ 2 ], width: widths[ 1 ] + widths[ 3 ] }; }, _proportionallyResize: function() { if (!this._proportionallyResizeElements.length) { return; } var prel, i = 0, element = this.helper || this.element; for ( ; i < this._proportionallyResizeElements.length; i++) { prel = this._proportionallyResizeElements[i]; // TODO: Seems like a bug to cache this.outerDimensions // considering that we are in a loop. if (!this.outerDimensions) { this.outerDimensions = this._getPaddingPlusBorderDimensions( prel ); } prel.css({ height: (element.height() - this.outerDimensions.height) || 0, width: (element.width() - this.outerDimensions.width) || 0 }); } }, _renderProxy: function() { var el = this.element, o = this.options; this.elementOffset = el.offset(); if (this._helper) { this.helper = this.helper || $("<div style='overflow:hidden;'></div>"); this.helper.addClass(this._helper).css({ width: this.element.outerWidth() - 1, height: this.element.outerHeight() - 1, position: "absolute", left: this.elementOffset.left + "px", top: this.elementOffset.top + "px", zIndex: ++o.zIndex //TODO: Don't modify option }); this.helper .appendTo("body") .disableSelection(); } else { this.helper = this.element; } }, _change: { e: function(event, dx) { return { width: this.originalSize.width + dx }; }, w: function(event, dx) { var cs = this.originalSize, sp = this.originalPosition; return { left: sp.left + dx, width: cs.width - dx }; }, n: function(event, dx, dy) { var cs = this.originalSize, sp = this.originalPosition; return { top: sp.top + dy, height: cs.height - dy }; }, s: function(event, dx, dy) { return { height: this.originalSize.height + dy }; }, se: function(event, dx, dy) { return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [ event, dx, dy ])); }, sw: function(event, dx, dy) { return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [ event, dx, dy ])); }, ne: function(event, dx, dy) { return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [ event, dx, dy ])); }, nw: function(event, dx, dy) { return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [ event, dx, dy ])); } }, _propagate: function(n, event) { $.ui.plugin.call(this, n, [ event, this.ui() ]); (n !== "resize" && this._trigger(n, event, this.ui())); }, plugins: {}, ui: function() { return { originalElement: this.originalElement, element: this.element, helper: this.helper, position: this.position, size: this.size, originalSize: this.originalSize, originalPosition: this.originalPosition }; } }); /* * Resizable Extensions */ $.ui.plugin.add("resizable", "animate", { stop: function( event ) { var that = $(this).resizable( "instance" ), o = that.options, pr = that._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height, soffsetw = ista ? 0 : that.sizeDiff.width, style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) }, left = (parseInt(that.element.css("left"), 10) + (that.position.left - that.originalPosition.left)) || null, top = (parseInt(that.element.css("top"), 10) + (that.position.top - that.originalPosition.top)) || null; that.element.animate( $.extend(style, top && left ? { top: top, left: left } : {}), { duration: o.animateDuration, easing: o.animateEasing, step: function() { var data = { width: parseInt(that.element.css("width"), 10), height: parseInt(that.element.css("height"), 10), top: parseInt(that.element.css("top"), 10), left: parseInt(that.element.css("left"), 10) }; if (pr && pr.length) { $(pr[0]).css({ width: data.width, height: data.height }); } // propagating resize, and updating values for each animation step that._updateCache(data); that._propagate("resize", event); } } ); } }); $.ui.plugin.add( "resizable", "containment", { start: function() { var element, p, co, ch, cw, width, height, that = $( this ).resizable( "instance" ), o = that.options, el = that.element, oc = o.containment, ce = ( oc instanceof $ ) ? oc.get( 0 ) : ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc; if ( !ce ) { return; } that.containerElement = $( ce ); if ( /document/.test( oc ) || oc === document ) { that.containerOffset = { left: 0, top: 0 }; that.containerPosition = { left: 0, top: 0 }; that.parentData = { element: $( document ), left: 0, top: 0, width: $( document ).width(), height: $( document ).height() || document.body.parentNode.scrollHeight }; } else { element = $( ce ); p = []; $([ "Top", "Right", "Left", "Bottom" ]).each(function( i, name ) { p[ i ] = that._num( element.css( "padding" + name ) ); }); that.containerOffset = element.offset(); that.containerPosition = element.position(); that.containerSize = { height: ( element.innerHeight() - p[ 3 ] ), width: ( element.innerWidth() - p[ 1 ] ) }; co = that.containerOffset; ch = that.containerSize.height; cw = that.containerSize.width; width = ( that._hasScroll ( ce, "left" ) ? ce.scrollWidth : cw ); height = ( that._hasScroll ( ce ) ? ce.scrollHeight : ch ) ; that.parentData = { element: ce, left: co.left, top: co.top, width: width, height: height }; } }, resize: function( event ) { var woset, hoset, isParent, isOffsetRelative, that = $( this ).resizable( "instance" ), o = that.options, co = that.containerOffset, cp = that.position, pRatio = that._aspectRatio || event.shiftKey, cop = { top: 0, left: 0 }, ce = that.containerElement, continueResize = true; if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) { cop = co; } if ( cp.left < ( that._helper ? co.left : 0 ) ) { that.size.width = that.size.width + ( that._helper ? ( that.position.left - co.left ) : ( that.position.left - cop.left ) ); if ( pRatio ) { that.size.height = that.size.width / that.aspectRatio; continueResize = false; } that.position.left = o.helper ? co.left : 0; } if ( cp.top < ( that._helper ? co.top : 0 ) ) { that.size.height = that.size.height + ( that._helper ? ( that.position.top - co.top ) : that.position.top ); if ( pRatio ) { that.size.width = that.size.height * that.aspectRatio; continueResize = false; } that.position.top = that._helper ? co.top : 0; } isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 ); isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) ); if ( isParent && isOffsetRelative ) { that.offset.left = that.parentData.left + that.position.left; that.offset.top = that.parentData.top + that.position.top; } else { that.offset.left = that.element.offset().left; that.offset.top = that.element.offset().top; } woset = Math.abs( that.sizeDiff.width + (that._helper ? that.offset.left - cop.left : (that.offset.left - co.left)) ); hoset = Math.abs( that.sizeDiff.height + (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)) ); if ( woset + that.size.width >= that.parentData.width ) { that.size.width = that.parentData.width - woset; if ( pRatio ) { that.size.height = that.size.width / that.aspectRatio; continueResize = false; } } if ( hoset + that.size.height >= that.parentData.height ) { that.size.height = that.parentData.height - hoset; if ( pRatio ) { that.size.width = that.size.height * that.aspectRatio; continueResize = false; } } if ( !continueResize ){ that.position.left = that.prevPosition.left; that.position.top = that.prevPosition.top; that.size.width = that.prevSize.width; that.size.height = that.prevSize.height; } }, stop: function() { var that = $( this ).resizable( "instance" ), o = that.options, co = that.containerOffset, cop = that.containerPosition, ce = that.containerElement, helper = $( that.helper ), ho = helper.offset(), w = helper.outerWidth() - that.sizeDiff.width, h = helper.outerHeight() - that.sizeDiff.height; if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) { $( this ).css({ left: ho.left - cop.left - co.left, width: w, height: h }); } if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) { $( this ).css({ left: ho.left - cop.left - co.left, width: w, height: h }); } } }); $.ui.plugin.add("resizable", "alsoResize", { start: function() { var that = $(this).resizable( "instance" ), o = that.options, _store = function(exp) { $(exp).each(function() { var el = $(this); el.data("ui-resizable-alsoresize", { width: parseInt(el.width(), 10), height: parseInt(el.height(), 10), left: parseInt(el.css("left"), 10), top: parseInt(el.css("top"), 10) }); }); }; if (typeof(o.alsoResize) === "object" && !o.alsoResize.parentNode) { if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } else { $.each(o.alsoResize, function(exp) { _store(exp); }); } } else { _store(o.alsoResize); } }, resize: function(event, ui) { var that = $(this).resizable( "instance" ), o = that.options, os = that.originalSize, op = that.originalPosition, delta = { height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0, top: (that.position.top - op.top) || 0, left: (that.position.left - op.left) || 0 }, _alsoResize = function(exp, c) { $(exp).each(function() { var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {}, css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? [ "width", "height" ] : [ "width", "height", "top", "left" ]; $.each(css, function(i, prop) { var sum = (start[prop] || 0) + (delta[prop] || 0); if (sum && sum >= 0) { style[prop] = sum || null; } }); el.css(style); }); }; if (typeof(o.alsoResize) === "object" && !o.alsoResize.nodeType) { $.each(o.alsoResize, function(exp, c) { _alsoResize(exp, c); }); } else { _alsoResize(o.alsoResize); } }, stop: function() { $(this).removeData("resizable-alsoresize"); } }); $.ui.plugin.add("resizable", "ghost", { start: function() { var that = $(this).resizable( "instance" ), o = that.options, cs = that.size; that.ghost = that.originalElement.clone(); that.ghost .css({ opacity: 0.25, display: "block", position: "relative", height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 }) .addClass("ui-resizable-ghost") .addClass(typeof o.ghost === "string" ? o.ghost : ""); that.ghost.appendTo(that.helper); }, resize: function() { var that = $(this).resizable( "instance" ); if (that.ghost) { that.ghost.css({ position: "relative", height: that.size.height, width: that.size.width }); } }, stop: function() { var that = $(this).resizable( "instance" ); if (that.ghost && that.helper) { that.helper.get(0).removeChild(that.ghost.get(0)); } } }); $.ui.plugin.add("resizable", "grid", { resize: function() { var outerDimensions, that = $(this).resizable( "instance" ), o = that.options, cs = that.size, os = that.originalSize, op = that.originalPosition, a = that.axis, grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid, gridX = (grid[0] || 1), gridY = (grid[1] || 1), ox = Math.round((cs.width - os.width) / gridX) * gridX, oy = Math.round((cs.height - os.height) / gridY) * gridY, newWidth = os.width + ox, newHeight = os.height + oy, isMaxWidth = o.maxWidth && (o.maxWidth < newWidth), isMaxHeight = o.maxHeight && (o.maxHeight < newHeight), isMinWidth = o.minWidth && (o.minWidth > newWidth), isMinHeight = o.minHeight && (o.minHeight > newHeight); o.grid = grid; if (isMinWidth) { newWidth += gridX; } if (isMinHeight) { newHeight += gridY; } if (isMaxWidth) { newWidth -= gridX; } if (isMaxHeight) { newHeight -= gridY; } if (/^(se|s|e)$/.test(a)) { that.size.width = newWidth; that.size.height = newHeight; } else if (/^(ne)$/.test(a)) { that.size.width = newWidth; that.size.height = newHeight; that.position.top = op.top - oy; } else if (/^(sw)$/.test(a)) { that.size.width = newWidth; that.size.height = newHeight; that.position.left = op.left - ox; } else { if ( newHeight - gridY <= 0 || newWidth - gridX <= 0) { outerDimensions = that._getPaddingPlusBorderDimensions( this ); } if ( newHeight - gridY > 0 ) { that.size.height = newHeight; that.position.top = op.top - oy; } else { newHeight = gridY - outerDimensions.height; that.size.height = newHeight; that.position.top = op.top + os.height - newHeight; } if ( newWidth - gridX > 0 ) { that.size.width = newWidth; that.position.left = op.left - ox; } else { newWidth = gridY - outerDimensions.height; that.size.width = newWidth; that.position.left = op.left + os.width - newWidth; } } } }); var resizable = $.ui.resizable; /*! * jQuery UI Selectable 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/selectable/ */ var selectable = $.widget("ui.selectable", $.ui.mouse, { version: "1.11.1", options: { appendTo: "body", autoRefresh: true, distance: 0, filter: "*", tolerance: "touch", // callbacks selected: null, selecting: null, start: null, stop: null, unselected: null, unselecting: null }, _create: function() { var selectees, that = this; this.element.addClass("ui-selectable"); this.dragged = false; // cache selectee children based on filter this.refresh = function() { selectees = $(that.options.filter, that.element[0]); selectees.addClass("ui-selectee"); selectees.each(function() { var $this = $(this), pos = $this.offset(); $.data(this, "selectable-item", { element: this, $element: $this, left: pos.left, top: pos.top, right: pos.left + $this.outerWidth(), bottom: pos.top + $this.outerHeight(), startselected: false, selected: $this.hasClass("ui-selected"), selecting: $this.hasClass("ui-selecting"), unselecting: $this.hasClass("ui-unselecting") }); }); }; this.refresh(); this.selectees = selectees.addClass("ui-selectee"); this._mouseInit(); this.helper = $("<div class='ui-selectable-helper'></div>"); }, _destroy: function() { this.selectees .removeClass("ui-selectee") .removeData("selectable-item"); this.element .removeClass("ui-selectable ui-selectable-disabled"); this._mouseDestroy(); }, _mouseStart: function(event) { var that = this, options = this.options; this.opos = [ event.pageX, event.pageY ]; if (this.options.disabled) { return; } this.selectees = $(options.filter, this.element[0]); this._trigger("start", event); $(options.appendTo).append(this.helper); // position helper (lasso) this.helper.css({ "left": event.pageX, "top": event.pageY, "width": 0, "height": 0 }); if (options.autoRefresh) { this.refresh(); } this.selectees.filter(".ui-selected").each(function() { var selectee = $.data(this, "selectable-item"); selectee.startselected = true; if (!event.metaKey && !event.ctrlKey) { selectee.$element.removeClass("ui-selected"); selectee.selected = false; selectee.$element.addClass("ui-unselecting"); selectee.unselecting = true; // selectable UNSELECTING callback that._trigger("unselecting", event, { unselecting: selectee.element }); } }); $(event.target).parents().addBack().each(function() { var doSelect, selectee = $.data(this, "selectable-item"); if (selectee) { doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass("ui-selected"); selectee.$element .removeClass(doSelect ? "ui-unselecting" : "ui-selected") .addClass(doSelect ? "ui-selecting" : "ui-unselecting"); selectee.unselecting = !doSelect; selectee.selecting = doSelect; selectee.selected = doSelect; // selectable (UN)SELECTING callback if (doSelect) { that._trigger("selecting", event, { selecting: selectee.element }); } else { that._trigger("unselecting", event, { unselecting: selectee.element }); } return false; } }); }, _mouseDrag: function(event) { this.dragged = true; if (this.options.disabled) { return; } var tmp, that = this, options = this.options, x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY; if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; } if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; } this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 }); this.selectees.each(function() { var selectee = $.data(this, "selectable-item"), hit = false; //prevent helper from being selected if appendTo: selectable if (!selectee || selectee.element === that.element[0]) { return; } if (options.tolerance === "touch") { hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) ); } else if (options.tolerance === "fit") { hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2); } if (hit) { // SELECT if (selectee.selected) { selectee.$element.removeClass("ui-selected"); selectee.selected = false; } if (selectee.unselecting) { selectee.$element.removeClass("ui-unselecting"); selectee.unselecting = false; } if (!selectee.selecting) { selectee.$element.addClass("ui-selecting"); selectee.selecting = true; // selectable SELECTING callback that._trigger("selecting", event, { selecting: selectee.element }); } } else { // UNSELECT if (selectee.selecting) { if ((event.metaKey || event.ctrlKey) && selectee.startselected) { selectee.$element.removeClass("ui-selecting"); selectee.selecting = false; selectee.$element.addClass("ui-selected"); selectee.selected = true; } else { selectee.$element.removeClass("ui-selecting"); selectee.selecting = false; if (selectee.startselected) { selectee.$element.addClass("ui-unselecting"); selectee.unselecting = true; } // selectable UNSELECTING callback that._trigger("unselecting", event, { unselecting: selectee.element }); } } if (selectee.selected) { if (!event.metaKey && !event.ctrlKey && !selectee.startselected) { selectee.$element.removeClass("ui-selected"); selectee.selected = false; selectee.$element.addClass("ui-unselecting"); selectee.unselecting = true; // selectable UNSELECTING callback that._trigger("unselecting", event, { unselecting: selectee.element }); } } } }); return false; }, _mouseStop: function(event) { var that = this; this.dragged = false; $(".ui-unselecting", this.element[0]).each(function() { var selectee = $.data(this, "selectable-item"); selectee.$element.removeClass("ui-unselecting"); selectee.unselecting = false; selectee.startselected = false; that._trigger("unselected", event, { unselected: selectee.element }); }); $(".ui-selecting", this.element[0]).each(function() { var selectee = $.data(this, "selectable-item"); selectee.$element.removeClass("ui-selecting").addClass("ui-selected"); selectee.selecting = false; selectee.selected = true; selectee.startselected = true; that._trigger("selected", event, { selected: selectee.element }); }); this._trigger("stop", event); this.helper.remove(); return false; } }); /*! * jQuery UI Sortable 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/sortable/ */ var sortable = $.widget("ui.sortable", $.ui.mouse, { version: "1.11.1", widgetEventPrefix: "sort", ready: false, options: { appendTo: "parent", axis: false, connectWith: false, containment: false, cursor: "auto", cursorAt: false, dropOnEmpty: true, forcePlaceholderSize: false, forceHelperSize: false, grid: false, handle: false, helper: "original", items: "> *", opacity: false, placeholder: false, revert: false, scroll: true, scrollSensitivity: 20, scrollSpeed: 20, scope: "default", tolerance: "intersect", zIndex: 1000, // callbacks activate: null, beforeStop: null, change: null, deactivate: null, out: null, over: null, receive: null, remove: null, sort: null, start: null, stop: null, update: null }, _isOverAxis: function( x, reference, size ) { return ( x >= reference ) && ( x < ( reference + size ) ); }, _isFloating: function( item ) { return (/left|right/).test(item.css("float")) || (/inline|table-cell/).test(item.css("display")); }, _create: function() { var o = this.options; this.containerCache = {}; this.element.addClass("ui-sortable"); //Get the items this.refresh(); //Let's determine if the items are being displayed horizontally this.floating = this.items.length ? o.axis === "x" || this._isFloating(this.items[0].item) : false; //Let's determine the parent's offset this.offset = this.element.offset(); //Initialize mouse events for interaction this._mouseInit(); this._setHandleClassName(); //We're ready to go this.ready = true; }, _setOption: function( key, value ) { this._super( key, value ); if ( key === "handle" ) { this._setHandleClassName(); } }, _setHandleClassName: function() { this.element.find( ".ui-sortable-handle" ).removeClass( "ui-sortable-handle" ); $.each( this.items, function() { ( this.instance.options.handle ? this.item.find( this.instance.options.handle ) : this.item ) .addClass( "ui-sortable-handle" ); }); }, _destroy: function() { this.element .removeClass( "ui-sortable ui-sortable-disabled" ) .find( ".ui-sortable-handle" ) .removeClass( "ui-sortable-handle" ); this._mouseDestroy(); for ( var i = this.items.length - 1; i >= 0; i-- ) { this.items[i].item.removeData(this.widgetName + "-item"); } return this; }, _mouseCapture: function(event, overrideHandle) { var currentItem = null, validHandle = false, that = this; if (this.reverting) { return false; } if(this.options.disabled || this.options.type === "static") { return false; } //We have to refresh the items data once first this._refreshItems(event); //Find out if the clicked node (or one of its parents) is a actual item in this.items $(event.target).parents().each(function() { if($.data(this, that.widgetName + "-item") === that) { currentItem = $(this); return false; } }); if($.data(event.target, that.widgetName + "-item") === that) { currentItem = $(event.target); } if(!currentItem) { return false; } if(this.options.handle && !overrideHandle) { $(this.options.handle, currentItem).find("*").addBack().each(function() { if(this === event.target) { validHandle = true; } }); if(!validHandle) { return false; } } this.currentItem = currentItem; this._removeCurrentsFromItems(); return true; }, _mouseStart: function(event, overrideHandle, noActivation) { var i, body, o = this.options; this.currentContainer = this; //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture this.refreshPositions(); //Create and append the visible helper this.helper = this._createHelper(event); //Cache the helper size this._cacheHelperProportions(); /* * - Position generation - * This block generates everything position related - it's the core of draggables. */ //Cache the margins of the original element this._cacheMargins(); //Get the next scrolling parent this.scrollParent = this.helper.scrollParent(); //The element's absolute position on the page minus margins this.offset = this.currentItem.offset(); this.offset = { top: this.offset.top - this.margins.top, left: this.offset.left - this.margins.left }; $.extend(this.offset, { click: { //Where the click happened, relative to the element left: event.pageX - this.offset.left, top: event.pageY - this.offset.top }, parent: this._getParentOffset(), relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper }); // Only after we got the offset, we can change the helper's position to absolute // TODO: Still need to figure out a way to make relative sorting possible this.helper.css("position", "absolute"); this.cssPosition = this.helper.css("position"); //Generate the original position this.originalPosition = this._generatePosition(event); this.originalPageX = event.pageX; this.originalPageY = event.pageY; //Adjust the mouse offset relative to the helper if "cursorAt" is supplied (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); //Cache the former DOM position this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }; //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way if(this.helper[0] !== this.currentItem[0]) { this.currentItem.hide(); } //Create the placeholder this._createPlaceholder(); //Set a containment if given in the options if(o.containment) { this._setContainment(); } if( o.cursor && o.cursor !== "auto" ) { // cursor option body = this.document.find( "body" ); // support: IE this.storedCursor = body.css( "cursor" ); body.css( "cursor", o.cursor ); this.storedStylesheet = $( "<style>*{ cursor: "+o.cursor+" !important; }</style>" ).appendTo( body ); } if(o.opacity) { // opacity option if (this.helper.css("opacity")) { this._storedOpacity = this.helper.css("opacity"); } this.helper.css("opacity", o.opacity); } if(o.zIndex) { // zIndex option if (this.helper.css("zIndex")) { this._storedZIndex = this.helper.css("zIndex"); } this.helper.css("zIndex", o.zIndex); } //Prepare scrolling if(this.scrollParent[0] !== document && this.scrollParent[0].tagName !== "HTML") { this.overflowOffset = this.scrollParent.offset(); } //Call callbacks this._trigger("start", event, this._uiHash()); //Recache the helper size if(!this._preserveHelperProportions) { this._cacheHelperProportions(); } //Post "activate" events to possible containers if( !noActivation ) { for ( i = this.containers.length - 1; i >= 0; i-- ) { this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) ); } } //Prepare possible droppables if($.ui.ddmanager) { $.ui.ddmanager.current = this; } if ($.ui.ddmanager && !o.dropBehaviour) { $.ui.ddmanager.prepareOffsets(this, event); } this.dragging = true; this.helper.addClass("ui-sortable-helper"); this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position return true; }, _mouseDrag: function(event) { var i, item, itemElement, intersection, o = this.options, scrolled = false; //Compute the helpers position this.position = this._generatePosition(event); this.positionAbs = this._convertPositionTo("absolute"); if (!this.lastPositionAbs) { this.lastPositionAbs = this.positionAbs; } //Do scrolling if(this.options.scroll) { if(this.scrollParent[0] !== document && this.scrollParent[0].tagName !== "HTML") { if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) { this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed; } else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity) { this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed; } if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) { this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed; } else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity) { this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed; } } else { if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) { scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); } else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) { scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); } if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) { scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); } else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) { scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); } } if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) { $.ui.ddmanager.prepareOffsets(this, event); } } //Regenerate the absolute position used for position checks this.positionAbs = this._convertPositionTo("absolute"); //Set the helper position if(!this.options.axis || this.options.axis !== "y") { this.helper[0].style.left = this.position.left+"px"; } if(!this.options.axis || this.options.axis !== "x") { this.helper[0].style.top = this.position.top+"px"; } //Rearrange for (i = this.items.length - 1; i >= 0; i--) { //Cache variables and intersection, continue if no intersection item = this.items[i]; itemElement = item.item[0]; intersection = this._intersectsWithPointer(item); if (!intersection) { continue; } // Only put the placeholder inside the current Container, skip all // items from other containers. This works because when moving // an item from one container to another the // currentContainer is switched before the placeholder is moved. // // Without this, moving items in "sub-sortables" can cause // the placeholder to jitter between the outer and inner container. if (item.instance !== this.currentContainer) { continue; } // cannot intersect with itself // no useless actions that have been done before // no action if the item moved is the parent of the item checked if (itemElement !== this.currentItem[0] && this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement && !$.contains(this.placeholder[0], itemElement) && (this.options.type === "semi-dynamic" ? !$.contains(this.element[0], itemElement) : true) ) { this.direction = intersection === 1 ? "down" : "up"; if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) { this._rearrange(event, item); } else { break; } this._trigger("change", event, this._uiHash()); break; } } //Post events to containers this._contactContainers(event); //Interconnect with droppables if($.ui.ddmanager) { $.ui.ddmanager.drag(this, event); } //Call callbacks this._trigger("sort", event, this._uiHash()); this.lastPositionAbs = this.positionAbs; return false; }, _mouseStop: function(event, noPropagation) { if(!event) { return; } //If we are using droppables, inform the manager about the drop if ($.ui.ddmanager && !this.options.dropBehaviour) { $.ui.ddmanager.drop(this, event); } if(this.options.revert) { var that = this, cur = this.placeholder.offset(), axis = this.options.axis, animation = {}; if ( !axis || axis === "x" ) { animation.left = cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollLeft); } if ( !axis || axis === "y" ) { animation.top = cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollTop); } this.reverting = true; $(this.helper).animate( animation, parseInt(this.options.revert, 10) || 500, function() { that._clear(event); }); } else { this._clear(event, noPropagation); } return false; }, cancel: function() { if(this.dragging) { this._mouseUp({ target: null }); if(this.options.helper === "original") { this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); } else { this.currentItem.show(); } //Post deactivating events to containers for (var i = this.containers.length - 1; i >= 0; i--){ this.containers[i]._trigger("deactivate", null, this._uiHash(this)); if(this.containers[i].containerCache.over) { this.containers[i]._trigger("out", null, this._uiHash(this)); this.containers[i].containerCache.over = 0; } } } if (this.placeholder) { //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! if(this.placeholder[0].parentNode) { this.placeholder[0].parentNode.removeChild(this.placeholder[0]); } if(this.options.helper !== "original" && this.helper && this.helper[0].parentNode) { this.helper.remove(); } $.extend(this, { helper: null, dragging: false, reverting: false, _noFinalSort: null }); if(this.domPosition.prev) { $(this.domPosition.prev).after(this.currentItem); } else { $(this.domPosition.parent).prepend(this.currentItem); } } return this; }, serialize: function(o) { var items = this._getItemsAsjQuery(o && o.connected), str = []; o = o || {}; $(items).each(function() { var res = ($(o.item || this).attr(o.attribute || "id") || "").match(o.expression || (/(.+)[\-=_](.+)/)); if (res) { str.push((o.key || res[1]+"[]")+"="+(o.key && o.expression ? res[1] : res[2])); } }); if(!str.length && o.key) { str.push(o.key + "="); } return str.join("&"); }, toArray: function(o) { var items = this._getItemsAsjQuery(o && o.connected), ret = []; o = o || {}; items.each(function() { ret.push($(o.item || this).attr(o.attribute || "id") || ""); }); return ret; }, /* Be careful with the following core functions */ _intersectsWith: function(item) { var x1 = this.positionAbs.left, x2 = x1 + this.helperProportions.width, y1 = this.positionAbs.top, y2 = y1 + this.helperProportions.height, l = item.left, r = l + item.width, t = item.top, b = t + item.height, dyClick = this.offset.click.top, dxClick = this.offset.click.left, isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && ( y1 + dyClick ) < b ), isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && ( x1 + dxClick ) < r ), isOverElement = isOverElementHeight && isOverElementWidth; if ( this.options.tolerance === "pointer" || this.options.forcePointerForContainers || (this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"]) ) { return isOverElement; } else { return (l < x1 + (this.helperProportions.width / 2) && // Right Half x2 - (this.helperProportions.width / 2) < r && // Left Half t < y1 + (this.helperProportions.height / 2) && // Bottom Half y2 - (this.helperProportions.height / 2) < b ); // Top Half } }, _intersectsWithPointer: function(item) { var isOverElementHeight = (this.options.axis === "x") || this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height), isOverElementWidth = (this.options.axis === "y") || this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width), isOverElement = isOverElementHeight && isOverElementWidth, verticalDirection = this._getDragVerticalDirection(), horizontalDirection = this._getDragHorizontalDirection(); if (!isOverElement) { return false; } return this.floating ? ( ((horizontalDirection && horizontalDirection === "right") || verticalDirection === "down") ? 2 : 1 ) : ( verticalDirection && (verticalDirection === "down" ? 2 : 1) ); }, _intersectsWithSides: function(item) { var isOverBottomHalf = this._isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height), isOverRightHalf = this._isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width), verticalDirection = this._getDragVerticalDirection(), horizontalDirection = this._getDragHorizontalDirection(); if (this.floating && horizontalDirection) { return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf)); } else { return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf)); } }, _getDragVerticalDirection: function() { var delta = this.positionAbs.top - this.lastPositionAbs.top; return delta !== 0 && (delta > 0 ? "down" : "up"); }, _getDragHorizontalDirection: function() { var delta = this.positionAbs.left - this.lastPositionAbs.left; return delta !== 0 && (delta > 0 ? "right" : "left"); }, refresh: function(event) { this._refreshItems(event); this._setHandleClassName(); this.refreshPositions(); return this; }, _connectWith: function() { var options = this.options; return options.connectWith.constructor === String ? [options.connectWith] : options.connectWith; }, _getItemsAsjQuery: function(connected) { var i, j, cur, inst, items = [], queries = [], connectWith = this._connectWith(); if(connectWith && connected) { for (i = connectWith.length - 1; i >= 0; i--){ cur = $(connectWith[i]); for ( j = cur.length - 1; j >= 0; j--){ inst = $.data(cur[j], this.widgetFullName); if(inst && inst !== this && !inst.options.disabled) { queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), inst]); } } } } queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]); function addItems() { items.push( this ); } for (i = queries.length - 1; i >= 0; i--){ queries[i][0].each( addItems ); } return $(items); }, _removeCurrentsFromItems: function() { var list = this.currentItem.find(":data(" + this.widgetName + "-item)"); this.items = $.grep(this.items, function (item) { for (var j=0; j < list.length; j++) { if(list[j] === item.item[0]) { return false; } } return true; }); }, _refreshItems: function(event) { this.items = []; this.containers = [this]; var i, j, cur, inst, targetData, _queries, item, queriesLength, items = this.items, queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]], connectWith = this._connectWith(); if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down for (i = connectWith.length - 1; i >= 0; i--){ cur = $(connectWith[i]); for (j = cur.length - 1; j >= 0; j--){ inst = $.data(cur[j], this.widgetFullName); if(inst && inst !== this && !inst.options.disabled) { queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]); this.containers.push(inst); } } } } for (i = queries.length - 1; i >= 0; i--) { targetData = queries[i][1]; _queries = queries[i][0]; for (j=0, queriesLength = _queries.length; j < queriesLength; j++) { item = $(_queries[j]); item.data(this.widgetName + "-item", targetData); // Data for target checking (mouse manager) items.push({ item: item, instance: targetData, width: 0, height: 0, left: 0, top: 0 }); } } }, refreshPositions: function(fast) { //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change if(this.offsetParent && this.helper) { this.offset.parent = this._getParentOffset(); } var i, item, t, p; for (i = this.items.length - 1; i >= 0; i--){ item = this.items[i]; //We ignore calculating positions of all connected containers when we're not over them if(item.instance !== this.currentContainer && this.currentContainer && item.item[0] !== this.currentItem[0]) { continue; } t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item; if (!fast) { item.width = t.outerWidth(); item.height = t.outerHeight(); } p = t.offset(); item.left = p.left; item.top = p.top; } if(this.options.custom && this.options.custom.refreshContainers) { this.options.custom.refreshContainers.call(this); } else { for (i = this.containers.length - 1; i >= 0; i--){ p = this.containers[i].element.offset(); this.containers[i].containerCache.left = p.left; this.containers[i].containerCache.top = p.top; this.containers[i].containerCache.width = this.containers[i].element.outerWidth(); this.containers[i].containerCache.height = this.containers[i].element.outerHeight(); } } return this; }, _createPlaceholder: function(that) { that = that || this; var className, o = that.options; if(!o.placeholder || o.placeholder.constructor === String) { className = o.placeholder; o.placeholder = { element: function() { var nodeName = that.currentItem[0].nodeName.toLowerCase(), element = $( "<" + nodeName + ">", that.document[0] ) .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder") .removeClass("ui-sortable-helper"); if ( nodeName === "tr" ) { that.currentItem.children().each(function() { $( "<td>&#160;</td>", that.document[0] ) .attr( "colspan", $( this ).attr( "colspan" ) || 1 ) .appendTo( element ); }); } else if ( nodeName === "img" ) { element.attr( "src", that.currentItem.attr( "src" ) ); } if ( !className ) { element.css( "visibility", "hidden" ); } return element; }, update: function(container, p) { // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified if(className && !o.forcePlaceholderSize) { return; } //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css("paddingTop")||0, 10) - parseInt(that.currentItem.css("paddingBottom")||0, 10)); } if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css("paddingLeft")||0, 10) - parseInt(that.currentItem.css("paddingRight")||0, 10)); } } }; } //Create the placeholder that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem)); //Append it after the actual current item that.currentItem.after(that.placeholder); //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) o.placeholder.update(that, that.placeholder); }, _contactContainers: function(event) { var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis, innermostContainer = null, innermostIndex = null; // get innermost container that intersects with item for (i = this.containers.length - 1; i >= 0; i--) { // never consider a container that's located within the item itself if($.contains(this.currentItem[0], this.containers[i].element[0])) { continue; } if(this._intersectsWith(this.containers[i].containerCache)) { // if we've already found a container and it's more "inner" than this, then continue if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0])) { continue; } innermostContainer = this.containers[i]; innermostIndex = i; } else { // container doesn't intersect. trigger "out" event if necessary if(this.containers[i].containerCache.over) { this.containers[i]._trigger("out", event, this._uiHash(this)); this.containers[i].containerCache.over = 0; } } } // if no intersecting containers found, return if(!innermostContainer) { return; } // move the item into the container if it's not there already if(this.containers.length === 1) { if (!this.containers[innermostIndex].containerCache.over) { this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); this.containers[innermostIndex].containerCache.over = 1; } } else { //When entering a new container, we will find the item with the least distance and append our item near it dist = 10000; itemWithLeastDistance = null; floating = innermostContainer.floating || this._isFloating(this.currentItem); posProperty = floating ? "left" : "top"; sizeProperty = floating ? "width" : "height"; axis = floating ? "clientX" : "clientY"; for (j = this.items.length - 1; j >= 0; j--) { if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) { continue; } if(this.items[j].item[0] === this.currentItem[0]) { continue; } cur = this.items[j].item.offset()[posProperty]; nearBottom = false; if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) { nearBottom = true; } if ( Math.abs( event[ axis ] - cur ) < dist ) { dist = Math.abs( event[ axis ] - cur ); itemWithLeastDistance = this.items[ j ]; this.direction = nearBottom ? "up": "down"; } } //Check if dropOnEmpty is enabled if(!itemWithLeastDistance && !this.options.dropOnEmpty) { return; } if(this.currentContainer === this.containers[innermostIndex]) { return; } itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true); this._trigger("change", event, this._uiHash()); this.containers[innermostIndex]._trigger("change", event, this._uiHash(this)); this.currentContainer = this.containers[innermostIndex]; //Update the placeholder this.options.placeholder.update(this.currentContainer, this.placeholder); this.containers[innermostIndex]._trigger("over", event, this._uiHash(this)); this.containers[innermostIndex].containerCache.over = 1; } }, _createHelper: function(event) { var o = this.options, helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper === "clone" ? this.currentItem.clone() : this.currentItem); //Add the helper to the DOM if that didn't happen already if(!helper.parents("body").length) { $(o.appendTo !== "parent" ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]); } if(helper[0] === this.currentItem[0]) { this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") }; } if(!helper[0].style.width || o.forceHelperSize) { helper.width(this.currentItem.width()); } if(!helper[0].style.height || o.forceHelperSize) { helper.height(this.currentItem.height()); } return helper; }, _adjustOffsetFromHelper: function(obj) { if (typeof obj === "string") { obj = obj.split(" "); } if ($.isArray(obj)) { obj = {left: +obj[0], top: +obj[1] || 0}; } if ("left" in obj) { this.offset.click.left = obj.left + this.margins.left; } if ("right" in obj) { this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; } if ("top" in obj) { this.offset.click.top = obj.top + this.margins.top; } if ("bottom" in obj) { this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; } }, _getParentOffset: function() { //Get the offsetParent and cache its position this.offsetParent = this.helper.offsetParent(); var po = this.offsetParent.offset(); // This is a special case where we need to modify a offset calculated on start, since the following happened: // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag if(this.cssPosition === "absolute" && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) { po.left += this.scrollParent.scrollLeft(); po.top += this.scrollParent.scrollTop(); } // This needs to be actually done for all browsers, since pageX/pageY includes this information // with an ugly IE fix if( this.offsetParent[0] === document.body || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) { po = { top: 0, left: 0 }; } return { top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0) }; }, _getRelativeOffset: function() { if(this.cssPosition === "relative") { var p = this.currentItem.position(); return { top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft() }; } else { return { top: 0, left: 0 }; } }, _cacheMargins: function() { this.margins = { left: (parseInt(this.currentItem.css("marginLeft"),10) || 0), top: (parseInt(this.currentItem.css("marginTop"),10) || 0) }; }, _cacheHelperProportions: function() { this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() }; }, _setContainment: function() { var ce, co, over, o = this.options; if(o.containment === "parent") { o.containment = this.helper[0].parentNode; } if(o.containment === "document" || o.containment === "window") { this.containment = [ 0 - this.offset.relative.left - this.offset.parent.left, 0 - this.offset.relative.top - this.offset.parent.top, $(o.containment === "document" ? document : window).width() - this.helperProportions.width - this.margins.left, ($(o.containment === "document" ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top ]; } if(!(/^(document|window|parent)$/).test(o.containment)) { ce = $(o.containment)[0]; co = $(o.containment).offset(); over = ($(ce).css("overflow") !== "hidden"); this.containment = [ co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left, co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top, co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left, co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top ]; } }, _convertPositionTo: function(d, pos) { if(!pos) { pos = this.position; } var mod = d === "absolute" ? 1 : -1, scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); return { top: ( pos.top + // The absolute mouse position this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border) ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) ), left: ( pos.left + // The absolute mouse position this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border) ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) ) }; }, _generatePosition: function(event) { var top, left, o = this.options, pageX = event.pageX, pageY = event.pageY, scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); // This is another very weird special case that only happens for relative elements: // 1. If the css position is relative // 2. and the scroll parent is the document or similar to the offset parent // we have to refresh the relative offset during the scroll so there are no jumps if(this.cssPosition === "relative" && !(this.scrollParent[0] !== document && this.scrollParent[0] !== this.offsetParent[0])) { this.offset.relative = this._getRelativeOffset(); } /* * - Position constraining - * Constrain the position to a mix of grid, containment. */ if(this.originalPosition) { //If we are not dragging yet, we won't check for options if(this.containment) { if(event.pageX - this.offset.click.left < this.containment[0]) { pageX = this.containment[0] + this.offset.click.left; } if(event.pageY - this.offset.click.top < this.containment[1]) { pageY = this.containment[1] + this.offset.click.top; } if(event.pageX - this.offset.click.left > this.containment[2]) { pageX = this.containment[2] + this.offset.click.left; } if(event.pageY - this.offset.click.top > this.containment[3]) { pageY = this.containment[3] + this.offset.click.top; } } if(o.grid) { top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; pageY = this.containment ? ( (top - this.offset.click.top >= this.containment[1] && top - this.offset.click.top <= this.containment[3]) ? top : ((top - this.offset.click.top >= this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; pageX = this.containment ? ( (left - this.offset.click.left >= this.containment[0] && left - this.offset.click.left <= this.containment[2]) ? left : ((left - this.offset.click.left >= this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; } } return { top: ( pageY - // The absolute mouse position this.offset.click.top - // Click offset (relative to the element) this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.parent.top + // The offsetParent's offset without borders (offset + border) ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) ), left: ( pageX - // The absolute mouse position this.offset.click.left - // Click offset (relative to the element) this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.parent.left + // The offsetParent's offset without borders (offset + border) ( ( this.cssPosition === "fixed" ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) ) }; }, _rearrange: function(event, i, a, hardRefresh) { a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction === "down" ? i.item[0] : i.item[0].nextSibling)); //Various things done here to improve the performance: // 1. we create a setTimeout, that calls refreshPositions // 2. on the instance, we have a counter variable, that get's higher after every append // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same // 4. this lets only the last addition to the timeout stack through this.counter = this.counter ? ++this.counter : 1; var counter = this.counter; this._delay(function() { if(counter === this.counter) { this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove } }); }, _clear: function(event, noPropagation) { this.reverting = false; // We delay all events that have to be triggered to after the point where the placeholder has been removed and // everything else normalized again var i, delayedTriggers = []; // We first have to update the dom position of the actual currentItem // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088) if(!this._noFinalSort && this.currentItem.parent().length) { this.placeholder.before(this.currentItem); } this._noFinalSort = null; if(this.helper[0] === this.currentItem[0]) { for(i in this._storedCSS) { if(this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") { this._storedCSS[i] = ""; } } this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); } else { this.currentItem.show(); } if(this.fromOutside && !noPropagation) { delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); }); } if((this.fromOutside || this.domPosition.prev !== this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) { delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed } // Check if the items Container has Changed and trigger appropriate // events. if (this !== this.currentContainer) { if(!noPropagation) { delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); }); delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer)); delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer)); } } //Post events to containers function delayEvent( type, instance, container ) { return function( event ) { container._trigger( type, event, instance._uiHash( instance ) ); }; } for (i = this.containers.length - 1; i >= 0; i--){ if (!noPropagation) { delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) ); } if(this.containers[i].containerCache.over) { delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) ); this.containers[i].containerCache.over = 0; } } //Do what was originally in plugins if ( this.storedCursor ) { this.document.find( "body" ).css( "cursor", this.storedCursor ); this.storedStylesheet.remove(); } if(this._storedOpacity) { this.helper.css("opacity", this._storedOpacity); } if(this._storedZIndex) { this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex); } this.dragging = false; if(this.cancelHelperRemoval) { if(!noPropagation) { this._trigger("beforeStop", event, this._uiHash()); for (i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); } //Trigger all delayed events this._trigger("stop", event, this._uiHash()); } this.fromOutside = false; return false; } if(!noPropagation) { this._trigger("beforeStop", event, this._uiHash()); } //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! this.placeholder[0].parentNode.removeChild(this.placeholder[0]); if(this.helper[0] !== this.currentItem[0]) { this.helper.remove(); } this.helper = null; if(!noPropagation) { for (i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); } //Trigger all delayed events this._trigger("stop", event, this._uiHash()); } this.fromOutside = false; return true; }, _trigger: function() { if ($.Widget.prototype._trigger.apply(this, arguments) === false) { this.cancel(); } }, _uiHash: function(_inst) { var inst = _inst || this; return { helper: inst.helper, placeholder: inst.placeholder || $([]), position: inst.position, originalPosition: inst.originalPosition, offset: inst.positionAbs, item: inst.currentItem, sender: _inst ? _inst.element : null }; } }); /*! * jQuery UI Accordion 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/accordion/ */ var accordion = $.widget( "ui.accordion", { version: "1.11.1", options: { active: 0, animate: {}, collapsible: false, event: "click", header: "> li > :first-child,> :not(li):even", heightStyle: "auto", icons: { activeHeader: "ui-icon-triangle-1-s", header: "ui-icon-triangle-1-e" }, // callbacks activate: null, beforeActivate: null }, hideProps: { borderTopWidth: "hide", borderBottomWidth: "hide", paddingTop: "hide", paddingBottom: "hide", height: "hide" }, showProps: { borderTopWidth: "show", borderBottomWidth: "show", paddingTop: "show", paddingBottom: "show", height: "show" }, _create: function() { var options = this.options; this.prevShow = this.prevHide = $(); this.element.addClass( "ui-accordion ui-widget ui-helper-reset" ) // ARIA .attr( "role", "tablist" ); // don't allow collapsible: false and active: false / null if ( !options.collapsible && (options.active === false || options.active == null) ) { options.active = 0; } this._processPanels(); // handle negative values if ( options.active < 0 ) { options.active += this.headers.length; } this._refresh(); }, _getCreateEventData: function() { return { header: this.active, panel: !this.active.length ? $() : this.active.next() }; }, _createIcons: function() { var icons = this.options.icons; if ( icons ) { $( "<span>" ) .addClass( "ui-accordion-header-icon ui-icon " + icons.header ) .prependTo( this.headers ); this.active.children( ".ui-accordion-header-icon" ) .removeClass( icons.header ) .addClass( icons.activeHeader ); this.headers.addClass( "ui-accordion-icons" ); } }, _destroyIcons: function() { this.headers .removeClass( "ui-accordion-icons" ) .children( ".ui-accordion-header-icon" ) .remove(); }, _destroy: function() { var contents; // clean up main element this.element .removeClass( "ui-accordion ui-widget ui-helper-reset" ) .removeAttr( "role" ); // clean up headers this.headers .removeClass( "ui-accordion-header ui-accordion-header-active ui-state-default " + "ui-corner-all ui-state-active ui-state-disabled ui-corner-top" ) .removeAttr( "role" ) .removeAttr( "aria-expanded" ) .removeAttr( "aria-selected" ) .removeAttr( "aria-controls" ) .removeAttr( "tabIndex" ) .removeUniqueId(); this._destroyIcons(); // clean up content panels contents = this.headers.next() .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom " + "ui-accordion-content ui-accordion-content-active ui-state-disabled" ) .css( "display", "" ) .removeAttr( "role" ) .removeAttr( "aria-hidden" ) .removeAttr( "aria-labelledby" ) .removeUniqueId(); if ( this.options.heightStyle !== "content" ) { contents.css( "height", "" ); } }, _setOption: function( key, value ) { if ( key === "active" ) { // _activate() will handle invalid values and update this.options this._activate( value ); return; } if ( key === "event" ) { if ( this.options.event ) { this._off( this.headers, this.options.event ); } this._setupEvents( value ); } this._super( key, value ); // setting collapsible: false while collapsed; open first panel if ( key === "collapsible" && !value && this.options.active === false ) { this._activate( 0 ); } if ( key === "icons" ) { this._destroyIcons(); if ( value ) { this._createIcons(); } } // #5332 - opacity doesn't cascade to positioned elements in IE // so we need to add the disabled class to the headers and panels if ( key === "disabled" ) { this.element .toggleClass( "ui-state-disabled", !!value ) .attr( "aria-disabled", value ); this.headers.add( this.headers.next() ) .toggleClass( "ui-state-disabled", !!value ); } }, _keydown: function( event ) { if ( event.altKey || event.ctrlKey ) { return; } var keyCode = $.ui.keyCode, length = this.headers.length, currentIndex = this.headers.index( event.target ), toFocus = false; switch ( event.keyCode ) { case keyCode.RIGHT: case keyCode.DOWN: toFocus = this.headers[ ( currentIndex + 1 ) % length ]; break; case keyCode.LEFT: case keyCode.UP: toFocus = this.headers[ ( currentIndex - 1 + length ) % length ]; break; case keyCode.SPACE: case keyCode.ENTER: this._eventHandler( event ); break; case keyCode.HOME: toFocus = this.headers[ 0 ]; break; case keyCode.END: toFocus = this.headers[ length - 1 ]; break; } if ( toFocus ) { $( event.target ).attr( "tabIndex", -1 ); $( toFocus ).attr( "tabIndex", 0 ); toFocus.focus(); event.preventDefault(); } }, _panelKeyDown: function( event ) { if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) { $( event.currentTarget ).prev().focus(); } }, refresh: function() { var options = this.options; this._processPanels(); // was collapsed or no panel if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) { options.active = false; this.active = $(); // active false only when collapsible is true } else if ( options.active === false ) { this._activate( 0 ); // was active, but active panel is gone } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { // all remaining panel are disabled if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) { options.active = false; this.active = $(); // activate previous panel } else { this._activate( Math.max( 0, options.active - 1 ) ); } // was active, active panel still exists } else { // make sure active index is correct options.active = this.headers.index( this.active ); } this._destroyIcons(); this._refresh(); }, _processPanels: function() { this.headers = this.element.find( this.options.header ) .addClass( "ui-accordion-header ui-state-default ui-corner-all" ); this.headers.next() .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" ) .filter( ":not(.ui-accordion-content-active)" ) .hide(); }, _refresh: function() { var maxHeight, options = this.options, heightStyle = options.heightStyle, parent = this.element.parent(); this.active = this._findActive( options.active ) .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" ) .removeClass( "ui-corner-all" ); this.active.next() .addClass( "ui-accordion-content-active" ) .show(); this.headers .attr( "role", "tab" ) .each(function() { var header = $( this ), headerId = header.uniqueId().attr( "id" ), panel = header.next(), panelId = panel.uniqueId().attr( "id" ); header.attr( "aria-controls", panelId ); panel.attr( "aria-labelledby", headerId ); }) .next() .attr( "role", "tabpanel" ); this.headers .not( this.active ) .attr({ "aria-selected": "false", "aria-expanded": "false", tabIndex: -1 }) .next() .attr({ "aria-hidden": "true" }) .hide(); // make sure at least one header is in the tab order if ( !this.active.length ) { this.headers.eq( 0 ).attr( "tabIndex", 0 ); } else { this.active.attr({ "aria-selected": "true", "aria-expanded": "true", tabIndex: 0 }) .next() .attr({ "aria-hidden": "false" }); } this._createIcons(); this._setupEvents( options.event ); if ( heightStyle === "fill" ) { maxHeight = parent.height(); this.element.siblings( ":visible" ).each(function() { var elem = $( this ), position = elem.css( "position" ); if ( position === "absolute" || position === "fixed" ) { return; } maxHeight -= elem.outerHeight( true ); }); this.headers.each(function() { maxHeight -= $( this ).outerHeight( true ); }); this.headers.next() .each(function() { $( this ).height( Math.max( 0, maxHeight - $( this ).innerHeight() + $( this ).height() ) ); }) .css( "overflow", "auto" ); } else if ( heightStyle === "auto" ) { maxHeight = 0; this.headers.next() .each(function() { maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() ); }) .height( maxHeight ); } }, _activate: function( index ) { var active = this._findActive( index )[ 0 ]; // trying to activate the already active panel if ( active === this.active[ 0 ] ) { return; } // trying to collapse, simulate a click on the currently active header active = active || this.active[ 0 ]; this._eventHandler({ target: active, currentTarget: active, preventDefault: $.noop }); }, _findActive: function( selector ) { return typeof selector === "number" ? this.headers.eq( selector ) : $(); }, _setupEvents: function( event ) { var events = { keydown: "_keydown" }; if ( event ) { $.each( event.split( " " ), function( index, eventName ) { events[ eventName ] = "_eventHandler"; }); } this._off( this.headers.add( this.headers.next() ) ); this._on( this.headers, events ); this._on( this.headers.next(), { keydown: "_panelKeyDown" }); this._hoverable( this.headers ); this._focusable( this.headers ); }, _eventHandler: function( event ) { var options = this.options, active = this.active, clicked = $( event.currentTarget ), clickedIsActive = clicked[ 0 ] === active[ 0 ], collapsing = clickedIsActive && options.collapsible, toShow = collapsing ? $() : clicked.next(), toHide = active.next(), eventData = { oldHeader: active, oldPanel: toHide, newHeader: collapsing ? $() : clicked, newPanel: toShow }; event.preventDefault(); if ( // click on active header, but not collapsible ( clickedIsActive && !options.collapsible ) || // allow canceling activation ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { return; } options.active = collapsing ? false : this.headers.index( clicked ); // when the call to ._toggle() comes after the class changes // it causes a very odd bug in IE 8 (see #6720) this.active = clickedIsActive ? $() : clicked; this._toggle( eventData ); // switch classes // corner classes on the previously active header stay after the animation active.removeClass( "ui-accordion-header-active ui-state-active" ); if ( options.icons ) { active.children( ".ui-accordion-header-icon" ) .removeClass( options.icons.activeHeader ) .addClass( options.icons.header ); } if ( !clickedIsActive ) { clicked .removeClass( "ui-corner-all" ) .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" ); if ( options.icons ) { clicked.children( ".ui-accordion-header-icon" ) .removeClass( options.icons.header ) .addClass( options.icons.activeHeader ); } clicked .next() .addClass( "ui-accordion-content-active" ); } }, _toggle: function( data ) { var toShow = data.newPanel, toHide = this.prevShow.length ? this.prevShow : data.oldPanel; // handle activating a panel during the animation for another activation this.prevShow.add( this.prevHide ).stop( true, true ); this.prevShow = toShow; this.prevHide = toHide; if ( this.options.animate ) { this._animate( toShow, toHide, data ); } else { toHide.hide(); toShow.show(); this._toggleComplete( data ); } toHide.attr({ "aria-hidden": "true" }); toHide.prev().attr( "aria-selected", "false" ); // if we're switching panels, remove the old header from the tab order // if we're opening from collapsed state, remove the previous header from the tab order // if we're collapsing, then keep the collapsing header in the tab order if ( toShow.length && toHide.length ) { toHide.prev().attr({ "tabIndex": -1, "aria-expanded": "false" }); } else if ( toShow.length ) { this.headers.filter(function() { return $( this ).attr( "tabIndex" ) === 0; }) .attr( "tabIndex", -1 ); } toShow .attr( "aria-hidden", "false" ) .prev() .attr({ "aria-selected": "true", tabIndex: 0, "aria-expanded": "true" }); }, _animate: function( toShow, toHide, data ) { var total, easing, duration, that = this, adjust = 0, down = toShow.length && ( !toHide.length || ( toShow.index() < toHide.index() ) ), animate = this.options.animate || {}, options = down && animate.down || animate, complete = function() { that._toggleComplete( data ); }; if ( typeof options === "number" ) { duration = options; } if ( typeof options === "string" ) { easing = options; } // fall back from options to animation in case of partial down settings easing = easing || options.easing || animate.easing; duration = duration || options.duration || animate.duration; if ( !toHide.length ) { return toShow.animate( this.showProps, duration, easing, complete ); } if ( !toShow.length ) { return toHide.animate( this.hideProps, duration, easing, complete ); } total = toShow.show().outerHeight(); toHide.animate( this.hideProps, { duration: duration, easing: easing, step: function( now, fx ) { fx.now = Math.round( now ); } }); toShow .hide() .animate( this.showProps, { duration: duration, easing: easing, complete: complete, step: function( now, fx ) { fx.now = Math.round( now ); if ( fx.prop !== "height" ) { adjust += fx.now; } else if ( that.options.heightStyle !== "content" ) { fx.now = Math.round( total - toHide.outerHeight() - adjust ); adjust = 0; } } }); }, _toggleComplete: function( data ) { var toHide = data.oldPanel; toHide .removeClass( "ui-accordion-content-active" ) .prev() .removeClass( "ui-corner-top" ) .addClass( "ui-corner-all" ); // Work around for rendering bug in IE (#5421) if ( toHide.length ) { toHide.parent()[ 0 ].className = toHide.parent()[ 0 ].className; } this._trigger( "activate", null, data ); } }); /*! * jQuery UI Menu 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/menu/ */ var menu = $.widget( "ui.menu", { version: "1.11.1", defaultElement: "<ul>", delay: 300, options: { icons: { submenu: "ui-icon-carat-1-e" }, items: "> *", menus: "ul", position: { my: "left-1 top", at: "right top" }, role: "menu", // callbacks blur: null, focus: null, select: null }, _create: function() { this.activeMenu = this.element; // Flag used to prevent firing of the click handler // as the event bubbles up through nested menus this.mouseHandled = false; this.element .uniqueId() .addClass( "ui-menu ui-widget ui-widget-content" ) .toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length ) .attr({ role: this.options.role, tabIndex: 0 }); if ( this.options.disabled ) { this.element .addClass( "ui-state-disabled" ) .attr( "aria-disabled", "true" ); } this._on({ // Prevent focus from sticking to links inside menu after clicking // them (focus should always stay on UL during navigation). "mousedown .ui-menu-item": function( event ) { event.preventDefault(); }, "click .ui-menu-item": function( event ) { var target = $( event.target ); if ( !this.mouseHandled && target.not( ".ui-state-disabled" ).length ) { this.select( event ); // Only set the mouseHandled flag if the event will bubble, see #9469. if ( !event.isPropagationStopped() ) { this.mouseHandled = true; } // Open submenu on click if ( target.has( ".ui-menu" ).length ) { this.expand( event ); } else if ( !this.element.is( ":focus" ) && $( this.document[ 0 ].activeElement ).closest( ".ui-menu" ).length ) { // Redirect focus to the menu this.element.trigger( "focus", [ true ] ); // If the active item is on the top level, let it stay active. // Otherwise, blur the active item since it is no longer visible. if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) { clearTimeout( this.timer ); } } } }, "mouseenter .ui-menu-item": function( event ) { var target = $( event.currentTarget ); // Remove ui-state-active class from siblings of the newly focused menu item // to avoid a jump caused by adjacent elements both having a class with a border target.siblings( ".ui-state-active" ).removeClass( "ui-state-active" ); this.focus( event, target ); }, mouseleave: "collapseAll", "mouseleave .ui-menu": "collapseAll", focus: function( event, keepActiveItem ) { // If there's already an active item, keep it active // If not, activate the first item var item = this.active || this.element.find( this.options.items ).eq( 0 ); if ( !keepActiveItem ) { this.focus( event, item ); } }, blur: function( event ) { this._delay(function() { if ( !$.contains( this.element[0], this.document[0].activeElement ) ) { this.collapseAll( event ); } }); }, keydown: "_keydown" }); this.refresh(); // Clicks outside of a menu collapse any open menus this._on( this.document, { click: function( event ) { if ( this._closeOnDocumentClick( event ) ) { this.collapseAll( event ); } // Reset the mouseHandled flag this.mouseHandled = false; } }); }, _destroy: function() { // Destroy (sub)menus this.element .removeAttr( "aria-activedescendant" ) .find( ".ui-menu" ).addBack() .removeClass( "ui-menu ui-widget ui-widget-content ui-menu-icons ui-front" ) .removeAttr( "role" ) .removeAttr( "tabIndex" ) .removeAttr( "aria-labelledby" ) .removeAttr( "aria-expanded" ) .removeAttr( "aria-hidden" ) .removeAttr( "aria-disabled" ) .removeUniqueId() .show(); // Destroy menu items this.element.find( ".ui-menu-item" ) .removeClass( "ui-menu-item" ) .removeAttr( "role" ) .removeAttr( "aria-disabled" ) .removeUniqueId() .removeClass( "ui-state-hover" ) .removeAttr( "tabIndex" ) .removeAttr( "role" ) .removeAttr( "aria-haspopup" ) .children().each( function() { var elem = $( this ); if ( elem.data( "ui-menu-submenu-carat" ) ) { elem.remove(); } }); // Destroy menu dividers this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" ); }, _keydown: function( event ) { var match, prev, character, skip, regex, preventDefault = true; function escape( value ) { return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ); } switch ( event.keyCode ) { case $.ui.keyCode.PAGE_UP: this.previousPage( event ); break; case $.ui.keyCode.PAGE_DOWN: this.nextPage( event ); break; case $.ui.keyCode.HOME: this._move( "first", "first", event ); break; case $.ui.keyCode.END: this._move( "last", "last", event ); break; case $.ui.keyCode.UP: this.previous( event ); break; case $.ui.keyCode.DOWN: this.next( event ); break; case $.ui.keyCode.LEFT: this.collapse( event ); break; case $.ui.keyCode.RIGHT: if ( this.active && !this.active.is( ".ui-state-disabled" ) ) { this.expand( event ); } break; case $.ui.keyCode.ENTER: case $.ui.keyCode.SPACE: this._activate( event ); break; case $.ui.keyCode.ESCAPE: this.collapse( event ); break; default: preventDefault = false; prev = this.previousFilter || ""; character = String.fromCharCode( event.keyCode ); skip = false; clearTimeout( this.filterTimer ); if ( character === prev ) { skip = true; } else { character = prev + character; } regex = new RegExp( "^" + escape( character ), "i" ); match = this.activeMenu.find( this.options.items ).filter(function() { return regex.test( $( this ).text() ); }); match = skip && match.index( this.active.next() ) !== -1 ? this.active.nextAll( ".ui-menu-item" ) : match; // If no matches on the current filter, reset to the last character pressed // to move down the menu to the first item that starts with that character if ( !match.length ) { character = String.fromCharCode( event.keyCode ); regex = new RegExp( "^" + escape( character ), "i" ); match = this.activeMenu.find( this.options.items ).filter(function() { return regex.test( $( this ).text() ); }); } if ( match.length ) { this.focus( event, match ); if ( match.length > 1 ) { this.previousFilter = character; this.filterTimer = this._delay(function() { delete this.previousFilter; }, 1000 ); } else { delete this.previousFilter; } } else { delete this.previousFilter; } } if ( preventDefault ) { event.preventDefault(); } }, _activate: function( event ) { if ( !this.active.is( ".ui-state-disabled" ) ) { if ( this.active.is( "[aria-haspopup='true']" ) ) { this.expand( event ); } else { this.select( event ); } } }, refresh: function() { var menus, items, that = this, icon = this.options.icons.submenu, submenus = this.element.find( this.options.menus ); this.element.toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length ); // Initialize nested menus submenus.filter( ":not(.ui-menu)" ) .addClass( "ui-menu ui-widget ui-widget-content ui-front" ) .hide() .attr({ role: this.options.role, "aria-hidden": "true", "aria-expanded": "false" }) .each(function() { var menu = $( this ), item = menu.parent(), submenuCarat = $( "<span>" ) .addClass( "ui-menu-icon ui-icon " + icon ) .data( "ui-menu-submenu-carat", true ); item .attr( "aria-haspopup", "true" ) .prepend( submenuCarat ); menu.attr( "aria-labelledby", item.attr( "id" ) ); }); menus = submenus.add( this.element ); items = menus.find( this.options.items ); // Initialize menu-items containing spaces and/or dashes only as dividers items.not( ".ui-menu-item" ).each(function() { var item = $( this ); if ( that._isDivider( item ) ) { item.addClass( "ui-widget-content ui-menu-divider" ); } }); // Don't refresh list items that are already adapted items.not( ".ui-menu-item, .ui-menu-divider" ) .addClass( "ui-menu-item" ) .uniqueId() .attr({ tabIndex: -1, role: this._itemRole() }); // Add aria-disabled attribute to any disabled menu item items.filter( ".ui-state-disabled" ).attr( "aria-disabled", "true" ); // If the active item has been removed, blur the menu if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { this.blur(); } }, _itemRole: function() { return { menu: "menuitem", listbox: "option" }[ this.options.role ]; }, _setOption: function( key, value ) { if ( key === "icons" ) { this.element.find( ".ui-menu-icon" ) .removeClass( this.options.icons.submenu ) .addClass( value.submenu ); } if ( key === "disabled" ) { this.element .toggleClass( "ui-state-disabled", !!value ) .attr( "aria-disabled", value ); } this._super( key, value ); }, focus: function( event, item ) { var nested, focused; this.blur( event, event && event.type === "focus" ); this._scrollIntoView( item ); this.active = item.first(); focused = this.active.addClass( "ui-state-focus" ).removeClass( "ui-state-active" ); // Only update aria-activedescendant if there's a role // otherwise we assume focus is managed elsewhere if ( this.options.role ) { this.element.attr( "aria-activedescendant", focused.attr( "id" ) ); } // Highlight active parent menu item, if any this.active .parent() .closest( ".ui-menu-item" ) .addClass( "ui-state-active" ); if ( event && event.type === "keydown" ) { this._close(); } else { this.timer = this._delay(function() { this._close(); }, this.delay ); } nested = item.children( ".ui-menu" ); if ( nested.length && event && ( /^mouse/.test( event.type ) ) ) { this._startOpening(nested); } this.activeMenu = item.parent(); this._trigger( "focus", event, { item: item } ); }, _scrollIntoView: function( item ) { var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight; if ( this._hasScroll() ) { borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0; paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0; offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop; scroll = this.activeMenu.scrollTop(); elementHeight = this.activeMenu.height(); itemHeight = item.outerHeight(); if ( offset < 0 ) { this.activeMenu.scrollTop( scroll + offset ); } else if ( offset + itemHeight > elementHeight ) { this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight ); } } }, blur: function( event, fromFocus ) { if ( !fromFocus ) { clearTimeout( this.timer ); } if ( !this.active ) { return; } this.active.removeClass( "ui-state-focus" ); this.active = null; this._trigger( "blur", event, { item: this.active } ); }, _startOpening: function( submenu ) { clearTimeout( this.timer ); // Don't open if already open fixes a Firefox bug that caused a .5 pixel // shift in the submenu position when mousing over the carat icon if ( submenu.attr( "aria-hidden" ) !== "true" ) { return; } this.timer = this._delay(function() { this._close(); this._open( submenu ); }, this.delay ); }, _open: function( submenu ) { var position = $.extend({ of: this.active }, this.options.position ); clearTimeout( this.timer ); this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) ) .hide() .attr( "aria-hidden", "true" ); submenu .show() .removeAttr( "aria-hidden" ) .attr( "aria-expanded", "true" ) .position( position ); }, collapseAll: function( event, all ) { clearTimeout( this.timer ); this.timer = this._delay(function() { // If we were passed an event, look for the submenu that contains the event var currentMenu = all ? this.element : $( event && event.target ).closest( this.element.find( ".ui-menu" ) ); // If we found no valid submenu ancestor, use the main menu to close all sub menus anyway if ( !currentMenu.length ) { currentMenu = this.element; } this._close( currentMenu ); this.blur( event ); this.activeMenu = currentMenu; }, this.delay ); }, // With no arguments, closes the currently active menu - if nothing is active // it closes all menus. If passed an argument, it will search for menus BELOW _close: function( startMenu ) { if ( !startMenu ) { startMenu = this.active ? this.active.parent() : this.element; } startMenu .find( ".ui-menu" ) .hide() .attr( "aria-hidden", "true" ) .attr( "aria-expanded", "false" ) .end() .find( ".ui-state-active" ).not( ".ui-state-focus" ) .removeClass( "ui-state-active" ); }, _closeOnDocumentClick: function( event ) { return !$( event.target ).closest( ".ui-menu" ).length; }, _isDivider: function( item ) { // Match hyphen, em dash, en dash return !/[^\-\u2014\u2013\s]/.test( item.text() ); }, collapse: function( event ) { var newItem = this.active && this.active.parent().closest( ".ui-menu-item", this.element ); if ( newItem && newItem.length ) { this._close(); this.focus( event, newItem ); } }, expand: function( event ) { var newItem = this.active && this.active .children( ".ui-menu " ) .find( this.options.items ) .first(); if ( newItem && newItem.length ) { this._open( newItem.parent() ); // Delay so Firefox will not hide activedescendant change in expanding submenu from AT this._delay(function() { this.focus( event, newItem ); }); } }, next: function( event ) { this._move( "next", "first", event ); }, previous: function( event ) { this._move( "prev", "last", event ); }, isFirstItem: function() { return this.active && !this.active.prevAll( ".ui-menu-item" ).length; }, isLastItem: function() { return this.active && !this.active.nextAll( ".ui-menu-item" ).length; }, _move: function( direction, filter, event ) { var next; if ( this.active ) { if ( direction === "first" || direction === "last" ) { next = this.active [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" ) .eq( -1 ); } else { next = this.active [ direction + "All" ]( ".ui-menu-item" ) .eq( 0 ); } } if ( !next || !next.length || !this.active ) { next = this.activeMenu.find( this.options.items )[ filter ](); } this.focus( event, next ); }, nextPage: function( event ) { var item, base, height; if ( !this.active ) { this.next( event ); return; } if ( this.isLastItem() ) { return; } if ( this._hasScroll() ) { base = this.active.offset().top; height = this.element.height(); this.active.nextAll( ".ui-menu-item" ).each(function() { item = $( this ); return item.offset().top - base - height < 0; }); this.focus( event, item ); } else { this.focus( event, this.activeMenu.find( this.options.items ) [ !this.active ? "first" : "last" ]() ); } }, previousPage: function( event ) { var item, base, height; if ( !this.active ) { this.next( event ); return; } if ( this.isFirstItem() ) { return; } if ( this._hasScroll() ) { base = this.active.offset().top; height = this.element.height(); this.active.prevAll( ".ui-menu-item" ).each(function() { item = $( this ); return item.offset().top - base + height > 0; }); this.focus( event, item ); } else { this.focus( event, this.activeMenu.find( this.options.items ).first() ); } }, _hasScroll: function() { return this.element.outerHeight() < this.element.prop( "scrollHeight" ); }, select: function( event ) { // TODO: It should never be possible to not have an active item at this // point, but the tests don't trigger mouseenter before click. this.active = this.active || $( event.target ).closest( ".ui-menu-item" ); var ui = { item: this.active }; if ( !this.active.has( ".ui-menu" ).length ) { this.collapseAll( event, true ); } this._trigger( "select", event, ui ); } }); /*! * jQuery UI Autocomplete 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/autocomplete/ */ $.widget( "ui.autocomplete", { version: "1.11.1", defaultElement: "<input>", options: { appendTo: null, autoFocus: false, delay: 300, minLength: 1, position: { my: "left top", at: "left bottom", collision: "none" }, source: null, // callbacks change: null, close: null, focus: null, open: null, response: null, search: null, select: null }, requestIndex: 0, pending: 0, _create: function() { // Some browsers only repeat keydown events, not keypress events, // so we use the suppressKeyPress flag to determine if we've already // handled the keydown event. #7269 // Unfortunately the code for & in keypress is the same as the up arrow, // so we use the suppressKeyPressRepeat flag to avoid handling keypress // events when we know the keydown event was used to modify the // search term. #7799 var suppressKeyPress, suppressKeyPressRepeat, suppressInput, nodeName = this.element[ 0 ].nodeName.toLowerCase(), isTextarea = nodeName === "textarea", isInput = nodeName === "input"; this.isMultiLine = // Textareas are always multi-line isTextarea ? true : // Inputs are always single-line, even if inside a contentEditable element // IE also treats inputs as contentEditable isInput ? false : // All other element types are determined by whether or not they're contentEditable this.element.prop( "isContentEditable" ); this.valueMethod = this.element[ isTextarea || isInput ? "val" : "text" ]; this.isNewMenu = true; this.element .addClass( "ui-autocomplete-input" ) .attr( "autocomplete", "off" ); this._on( this.element, { keydown: function( event ) { if ( this.element.prop( "readOnly" ) ) { suppressKeyPress = true; suppressInput = true; suppressKeyPressRepeat = true; return; } suppressKeyPress = false; suppressInput = false; suppressKeyPressRepeat = false; var keyCode = $.ui.keyCode; switch ( event.keyCode ) { case keyCode.PAGE_UP: suppressKeyPress = true; this._move( "previousPage", event ); break; case keyCode.PAGE_DOWN: suppressKeyPress = true; this._move( "nextPage", event ); break; case keyCode.UP: suppressKeyPress = true; this._keyEvent( "previous", event ); break; case keyCode.DOWN: suppressKeyPress = true; this._keyEvent( "next", event ); break; case keyCode.ENTER: // when menu is open and has focus if ( this.menu.active ) { // #6055 - Opera still allows the keypress to occur // which causes forms to submit suppressKeyPress = true; event.preventDefault(); this.menu.select( event ); } break; case keyCode.TAB: if ( this.menu.active ) { this.menu.select( event ); } break; case keyCode.ESCAPE: if ( this.menu.element.is( ":visible" ) ) { if ( !this.isMultiLine ) { this._value( this.term ); } this.close( event ); // Different browsers have different default behavior for escape // Single press can mean undo or clear // Double press in IE means clear the whole form event.preventDefault(); } break; default: suppressKeyPressRepeat = true; // search timeout should be triggered before the input value is changed this._searchTimeout( event ); break; } }, keypress: function( event ) { if ( suppressKeyPress ) { suppressKeyPress = false; if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { event.preventDefault(); } return; } if ( suppressKeyPressRepeat ) { return; } // replicate some key handlers to allow them to repeat in Firefox and Opera var keyCode = $.ui.keyCode; switch ( event.keyCode ) { case keyCode.PAGE_UP: this._move( "previousPage", event ); break; case keyCode.PAGE_DOWN: this._move( "nextPage", event ); break; case keyCode.UP: this._keyEvent( "previous", event ); break; case keyCode.DOWN: this._keyEvent( "next", event ); break; } }, input: function( event ) { if ( suppressInput ) { suppressInput = false; event.preventDefault(); return; } this._searchTimeout( event ); }, focus: function() { this.selectedItem = null; this.previous = this._value(); }, blur: function( event ) { if ( this.cancelBlur ) { delete this.cancelBlur; return; } clearTimeout( this.searching ); this.close( event ); this._change( event ); } }); this._initSource(); this.menu = $( "<ul>" ) .addClass( "ui-autocomplete ui-front" ) .appendTo( this._appendTo() ) .menu({ // disable ARIA support, the live region takes care of that role: null }) .hide() .menu( "instance" ); this._on( this.menu.element, { mousedown: function( event ) { // prevent moving focus out of the text field event.preventDefault(); // IE doesn't prevent moving focus even with event.preventDefault() // so we set a flag to know when we should ignore the blur event this.cancelBlur = true; this._delay(function() { delete this.cancelBlur; }); // clicking on the scrollbar causes focus to shift to the body // but we can't detect a mouseup or a click immediately afterward // so we have to track the next mousedown and close the menu if // the user clicks somewhere outside of the autocomplete var menuElement = this.menu.element[ 0 ]; if ( !$( event.target ).closest( ".ui-menu-item" ).length ) { this._delay(function() { var that = this; this.document.one( "mousedown", function( event ) { if ( event.target !== that.element[ 0 ] && event.target !== menuElement && !$.contains( menuElement, event.target ) ) { that.close(); } }); }); } }, menufocus: function( event, ui ) { var label, item; // support: Firefox // Prevent accidental activation of menu items in Firefox (#7024 #9118) if ( this.isNewMenu ) { this.isNewMenu = false; if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) { this.menu.blur(); this.document.one( "mousemove", function() { $( event.target ).trigger( event.originalEvent ); }); return; } } item = ui.item.data( "ui-autocomplete-item" ); if ( false !== this._trigger( "focus", event, { item: item } ) ) { // use value to match what will end up in the input, if it was a key event if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) { this._value( item.value ); } } // Announce the value in the liveRegion label = ui.item.attr( "aria-label" ) || item.value; if ( label && $.trim( label ).length ) { this.liveRegion.children().hide(); $( "<div>" ).text( label ).appendTo( this.liveRegion ); } }, menuselect: function( event, ui ) { var item = ui.item.data( "ui-autocomplete-item" ), previous = this.previous; // only trigger when focus was lost (click on menu) if ( this.element[ 0 ] !== this.document[ 0 ].activeElement ) { this.element.focus(); this.previous = previous; // #6109 - IE triggers two focus events and the second // is asynchronous, so we need to reset the previous // term synchronously and asynchronously :-( this._delay(function() { this.previous = previous; this.selectedItem = item; }); } if ( false !== this._trigger( "select", event, { item: item } ) ) { this._value( item.value ); } // reset the term after the select event // this allows custom select handling to work properly this.term = this._value(); this.close( event ); this.selectedItem = item; } }); this.liveRegion = $( "<span>", { role: "status", "aria-live": "assertive", "aria-relevant": "additions" }) .addClass( "ui-helper-hidden-accessible" ) .appendTo( this.document[ 0 ].body ); // turning off autocomplete prevents the browser from remembering the // value when navigating through history, so we re-enable autocomplete // if the page is unloaded before the widget is destroyed. #7790 this._on( this.window, { beforeunload: function() { this.element.removeAttr( "autocomplete" ); } }); }, _destroy: function() { clearTimeout( this.searching ); this.element .removeClass( "ui-autocomplete-input" ) .removeAttr( "autocomplete" ); this.menu.element.remove(); this.liveRegion.remove(); }, _setOption: function( key, value ) { this._super( key, value ); if ( key === "source" ) { this._initSource(); } if ( key === "appendTo" ) { this.menu.element.appendTo( this._appendTo() ); } if ( key === "disabled" && value && this.xhr ) { this.xhr.abort(); } }, _appendTo: function() { var element = this.options.appendTo; if ( element ) { element = element.jquery || element.nodeType ? $( element ) : this.document.find( element ).eq( 0 ); } if ( !element || !element[ 0 ] ) { element = this.element.closest( ".ui-front" ); } if ( !element.length ) { element = this.document[ 0 ].body; } return element; }, _initSource: function() { var array, url, that = this; if ( $.isArray( this.options.source ) ) { array = this.options.source; this.source = function( request, response ) { response( $.ui.autocomplete.filter( array, request.term ) ); }; } else if ( typeof this.options.source === "string" ) { url = this.options.source; this.source = function( request, response ) { if ( that.xhr ) { that.xhr.abort(); } that.xhr = $.ajax({ url: url, data: request, dataType: "json", success: function( data ) { response( data ); }, error: function() { response([]); } }); }; } else { this.source = this.options.source; } }, _searchTimeout: function( event ) { clearTimeout( this.searching ); this.searching = this._delay(function() { // Search if the value has changed, or if the user retypes the same value (see #7434) var equalValues = this.term === this._value(), menuVisible = this.menu.element.is( ":visible" ), modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey; if ( !equalValues || ( equalValues && !menuVisible && !modifierKey ) ) { this.selectedItem = null; this.search( null, event ); } }, this.options.delay ); }, search: function( value, event ) { value = value != null ? value : this._value(); // always save the actual value, not the one passed as an argument this.term = this._value(); if ( value.length < this.options.minLength ) { return this.close( event ); } if ( this._trigger( "search", event ) === false ) { return; } return this._search( value ); }, _search: function( value ) { this.pending++; this.element.addClass( "ui-autocomplete-loading" ); this.cancelSearch = false; this.source( { term: value }, this._response() ); }, _response: function() { var index = ++this.requestIndex; return $.proxy(function( content ) { if ( index === this.requestIndex ) { this.__response( content ); } this.pending--; if ( !this.pending ) { this.element.removeClass( "ui-autocomplete-loading" ); } }, this ); }, __response: function( content ) { if ( content ) { content = this._normalize( content ); } this._trigger( "response", null, { content: content } ); if ( !this.options.disabled && content && content.length && !this.cancelSearch ) { this._suggest( content ); this._trigger( "open" ); } else { // use ._close() instead of .close() so we don't cancel future searches this._close(); } }, close: function( event ) { this.cancelSearch = true; this._close( event ); }, _close: function( event ) { if ( this.menu.element.is( ":visible" ) ) { this.menu.element.hide(); this.menu.blur(); this.isNewMenu = true; this._trigger( "close", event ); } }, _change: function( event ) { if ( this.previous !== this._value() ) { this._trigger( "change", event, { item: this.selectedItem } ); } }, _normalize: function( items ) { // assume all items have the right format when the first item is complete if ( items.length && items[ 0 ].label && items[ 0 ].value ) { return items; } return $.map( items, function( item ) { if ( typeof item === "string" ) { return { label: item, value: item }; } return $.extend( {}, item, { label: item.label || item.value, value: item.value || item.label }); }); }, _suggest: function( items ) { var ul = this.menu.element.empty(); this._renderMenu( ul, items ); this.isNewMenu = true; this.menu.refresh(); // size and position menu ul.show(); this._resizeMenu(); ul.position( $.extend({ of: this.element }, this.options.position ) ); if ( this.options.autoFocus ) { this.menu.next(); } }, _resizeMenu: function() { var ul = this.menu.element; ul.outerWidth( Math.max( // Firefox wraps long text (possibly a rounding bug) // so we add 1px to avoid the wrapping (#7513) ul.width( "" ).outerWidth() + 1, this.element.outerWidth() ) ); }, _renderMenu: function( ul, items ) { var that = this; $.each( items, function( index, item ) { that._renderItemData( ul, item ); }); }, _renderItemData: function( ul, item ) { return this._renderItem( ul, item ).data( "ui-autocomplete-item", item ); }, _renderItem: function( ul, item ) { return $( "<li>" ).text( item.label ).appendTo( ul ); }, _move: function( direction, event ) { if ( !this.menu.element.is( ":visible" ) ) { this.search( null, event ); return; } if ( this.menu.isFirstItem() && /^previous/.test( direction ) || this.menu.isLastItem() && /^next/.test( direction ) ) { if ( !this.isMultiLine ) { this._value( this.term ); } this.menu.blur(); return; } this.menu[ direction ]( event ); }, widget: function() { return this.menu.element; }, _value: function() { return this.valueMethod.apply( this.element, arguments ); }, _keyEvent: function( keyEvent, event ) { if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) { this._move( keyEvent, event ); // prevents moving cursor to beginning/end of the text field in some browsers event.preventDefault(); } } }); $.extend( $.ui.autocomplete, { escapeRegex: function( value ) { return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" ); }, filter: function( array, term ) { var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" ); return $.grep( array, function( value ) { return matcher.test( value.label || value.value || value ); }); } }); // live region extension, adding a `messages` option // NOTE: This is an experimental API. We are still investigating // a full solution for string manipulation and internationalization. $.widget( "ui.autocomplete", $.ui.autocomplete, { options: { messages: { noResults: "No search results.", results: function( amount ) { return amount + ( amount > 1 ? " results are" : " result is" ) + " available, use up and down arrow keys to navigate."; } } }, __response: function( content ) { var message; this._superApply( arguments ); if ( this.options.disabled || this.cancelSearch ) { return; } if ( content && content.length ) { message = this.options.messages.results( content.length ); } else { message = this.options.messages.noResults; } this.liveRegion.children().hide(); $( "<div>" ).text( message ).appendTo( this.liveRegion ); } }); var autocomplete = $.ui.autocomplete; /*! * jQuery UI Button 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/button/ */ var lastActive, baseClasses = "ui-button ui-widget ui-state-default ui-corner-all", typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only", formResetHandler = function() { var form = $( this ); setTimeout(function() { form.find( ":ui-button" ).button( "refresh" ); }, 1 ); }, radioGroup = function( radio ) { var name = radio.name, form = radio.form, radios = $( [] ); if ( name ) { name = name.replace( /'/g, "\\'" ); if ( form ) { radios = $( form ).find( "[name='" + name + "'][type=radio]" ); } else { radios = $( "[name='" + name + "'][type=radio]", radio.ownerDocument ) .filter(function() { return !this.form; }); } } return radios; }; $.widget( "ui.button", { version: "1.11.1", defaultElement: "<button>", options: { disabled: null, text: true, label: null, icons: { primary: null, secondary: null } }, _create: function() { this.element.closest( "form" ) .unbind( "reset" + this.eventNamespace ) .bind( "reset" + this.eventNamespace, formResetHandler ); if ( typeof this.options.disabled !== "boolean" ) { this.options.disabled = !!this.element.prop( "disabled" ); } else { this.element.prop( "disabled", this.options.disabled ); } this._determineButtonType(); this.hasTitle = !!this.buttonElement.attr( "title" ); var that = this, options = this.options, toggleButton = this.type === "checkbox" || this.type === "radio", activeClass = !toggleButton ? "ui-state-active" : ""; if ( options.label === null ) { options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html()); } this._hoverable( this.buttonElement ); this.buttonElement .addClass( baseClasses ) .attr( "role", "button" ) .bind( "mouseenter" + this.eventNamespace, function() { if ( options.disabled ) { return; } if ( this === lastActive ) { $( this ).addClass( "ui-state-active" ); } }) .bind( "mouseleave" + this.eventNamespace, function() { if ( options.disabled ) { return; } $( this ).removeClass( activeClass ); }) .bind( "click" + this.eventNamespace, function( event ) { if ( options.disabled ) { event.preventDefault(); event.stopImmediatePropagation(); } }); // Can't use _focusable() because the element that receives focus // and the element that gets the ui-state-focus class are different this._on({ focus: function() { this.buttonElement.addClass( "ui-state-focus" ); }, blur: function() { this.buttonElement.removeClass( "ui-state-focus" ); } }); if ( toggleButton ) { this.element.bind( "change" + this.eventNamespace, function() { that.refresh(); }); } if ( this.type === "checkbox" ) { this.buttonElement.bind( "click" + this.eventNamespace, function() { if ( options.disabled ) { return false; } }); } else if ( this.type === "radio" ) { this.buttonElement.bind( "click" + this.eventNamespace, function() { if ( options.disabled ) { return false; } $( this ).addClass( "ui-state-active" ); that.buttonElement.attr( "aria-pressed", "true" ); var radio = that.element[ 0 ]; radioGroup( radio ) .not( radio ) .map(function() { return $( this ).button( "widget" )[ 0 ]; }) .removeClass( "ui-state-active" ) .attr( "aria-pressed", "false" ); }); } else { this.buttonElement .bind( "mousedown" + this.eventNamespace, function() { if ( options.disabled ) { return false; } $( this ).addClass( "ui-state-active" ); lastActive = this; that.document.one( "mouseup", function() { lastActive = null; }); }) .bind( "mouseup" + this.eventNamespace, function() { if ( options.disabled ) { return false; } $( this ).removeClass( "ui-state-active" ); }) .bind( "keydown" + this.eventNamespace, function(event) { if ( options.disabled ) { return false; } if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) { $( this ).addClass( "ui-state-active" ); } }) // see #8559, we bind to blur here in case the button element loses // focus between keydown and keyup, it would be left in an "active" state .bind( "keyup" + this.eventNamespace + " blur" + this.eventNamespace, function() { $( this ).removeClass( "ui-state-active" ); }); if ( this.buttonElement.is("a") ) { this.buttonElement.keyup(function(event) { if ( event.keyCode === $.ui.keyCode.SPACE ) { // TODO pass through original event correctly (just as 2nd argument doesn't work) $( this ).click(); } }); } } this._setOption( "disabled", options.disabled ); this._resetButton(); }, _determineButtonType: function() { var ancestor, labelSelector, checked; if ( this.element.is("[type=checkbox]") ) { this.type = "checkbox"; } else if ( this.element.is("[type=radio]") ) { this.type = "radio"; } else if ( this.element.is("input") ) { this.type = "input"; } else { this.type = "button"; } if ( this.type === "checkbox" || this.type === "radio" ) { // we don't search against the document in case the element // is disconnected from the DOM ancestor = this.element.parents().last(); labelSelector = "label[for='" + this.element.attr("id") + "']"; this.buttonElement = ancestor.find( labelSelector ); if ( !this.buttonElement.length ) { ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings(); this.buttonElement = ancestor.filter( labelSelector ); if ( !this.buttonElement.length ) { this.buttonElement = ancestor.find( labelSelector ); } } this.element.addClass( "ui-helper-hidden-accessible" ); checked = this.element.is( ":checked" ); if ( checked ) { this.buttonElement.addClass( "ui-state-active" ); } this.buttonElement.prop( "aria-pressed", checked ); } else { this.buttonElement = this.element; } }, widget: function() { return this.buttonElement; }, _destroy: function() { this.element .removeClass( "ui-helper-hidden-accessible" ); this.buttonElement .removeClass( baseClasses + " ui-state-active " + typeClasses ) .removeAttr( "role" ) .removeAttr( "aria-pressed" ) .html( this.buttonElement.find(".ui-button-text").html() ); if ( !this.hasTitle ) { this.buttonElement.removeAttr( "title" ); } }, _setOption: function( key, value ) { this._super( key, value ); if ( key === "disabled" ) { this.widget().toggleClass( "ui-state-disabled", !!value ); this.element.prop( "disabled", !!value ); if ( value ) { if ( this.type === "checkbox" || this.type === "radio" ) { this.buttonElement.removeClass( "ui-state-focus" ); } else { this.buttonElement.removeClass( "ui-state-focus ui-state-active" ); } } return; } this._resetButton(); }, refresh: function() { //See #8237 & #8828 var isDisabled = this.element.is( "input, button" ) ? this.element.is( ":disabled" ) : this.element.hasClass( "ui-button-disabled" ); if ( isDisabled !== this.options.disabled ) { this._setOption( "disabled", isDisabled ); } if ( this.type === "radio" ) { radioGroup( this.element[0] ).each(function() { if ( $( this ).is( ":checked" ) ) { $( this ).button( "widget" ) .addClass( "ui-state-active" ) .attr( "aria-pressed", "true" ); } else { $( this ).button( "widget" ) .removeClass( "ui-state-active" ) .attr( "aria-pressed", "false" ); } }); } else if ( this.type === "checkbox" ) { if ( this.element.is( ":checked" ) ) { this.buttonElement .addClass( "ui-state-active" ) .attr( "aria-pressed", "true" ); } else { this.buttonElement .removeClass( "ui-state-active" ) .attr( "aria-pressed", "false" ); } } }, _resetButton: function() { if ( this.type === "input" ) { if ( this.options.label ) { this.element.val( this.options.label ); } return; } var buttonElement = this.buttonElement.removeClass( typeClasses ), buttonText = $( "<span></span>", this.document[0] ) .addClass( "ui-button-text" ) .html( this.options.label ) .appendTo( buttonElement.empty() ) .text(), icons = this.options.icons, multipleIcons = icons.primary && icons.secondary, buttonClasses = []; if ( icons.primary || icons.secondary ) { if ( this.options.text ) { buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) ); } if ( icons.primary ) { buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" ); } if ( icons.secondary ) { buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" ); } if ( !this.options.text ) { buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" ); if ( !this.hasTitle ) { buttonElement.attr( "title", $.trim( buttonText ) ); } } } else { buttonClasses.push( "ui-button-text-only" ); } buttonElement.addClass( buttonClasses.join( " " ) ); } }); $.widget( "ui.buttonset", { version: "1.11.1", options: { items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(ui-button)" }, _create: function() { this.element.addClass( "ui-buttonset" ); }, _init: function() { this.refresh(); }, _setOption: function( key, value ) { if ( key === "disabled" ) { this.buttons.button( "option", key, value ); } this._super( key, value ); }, refresh: function() { var rtl = this.element.css( "direction" ) === "rtl", allButtons = this.element.find( this.options.items ), existingButtons = allButtons.filter( ":ui-button" ); // Initialize new buttons allButtons.not( ":ui-button" ).button(); // Refresh existing buttons existingButtons.button( "refresh" ); this.buttons = allButtons .map(function() { return $( this ).button( "widget" )[ 0 ]; }) .removeClass( "ui-corner-all ui-corner-left ui-corner-right" ) .filter( ":first" ) .addClass( rtl ? "ui-corner-right" : "ui-corner-left" ) .end() .filter( ":last" ) .addClass( rtl ? "ui-corner-left" : "ui-corner-right" ) .end() .end(); }, _destroy: function() { this.element.removeClass( "ui-buttonset" ); this.buttons .map(function() { return $( this ).button( "widget" )[ 0 ]; }) .removeClass( "ui-corner-left ui-corner-right" ) .end() .button( "destroy" ); } }); var button = $.ui.button; /*! * jQuery UI Datepicker 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/datepicker/ */ $.extend($.ui, { datepicker: { version: "1.11.1" } }); var datepicker_instActive; function datepicker_getZindex( elem ) { var position, value; while ( elem.length && elem[ 0 ] !== document ) { // Ignore z-index if position is set to a value where z-index is ignored by the browser // This makes behavior of this function consistent across browsers // WebKit always returns auto if the element is positioned position = elem.css( "position" ); if ( position === "absolute" || position === "relative" || position === "fixed" ) { // IE returns 0 when zIndex is not specified // other browsers return a string // we ignore the case of nested elements with an explicit value of 0 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> value = parseInt( elem.css( "zIndex" ), 10 ); if ( !isNaN( value ) && value !== 0 ) { return value; } } elem = elem.parent(); } return 0; } /* Date picker manager. Use the singleton instance of this class, $.datepicker, to interact with the date picker. Settings for (groups of) date pickers are maintained in an instance object, allowing multiple different settings on the same page. */ function Datepicker() { this._curInst = null; // The current instance in use this._keyEvent = false; // If the last event was a key event this._disabledInputs = []; // List of date picker inputs that have been disabled this._datepickerShowing = false; // True if the popup picker is showing , false if not this._inDialog = false; // True if showing within a "dialog", false if not this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class this._appendClass = "ui-datepicker-append"; // The name of the append marker class this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class this.regional = []; // Available regional settings, indexed by language code this.regional[""] = { // Default regional settings closeText: "Done", // Display text for close link prevText: "Prev", // Display text for previous month link nextText: "Next", // Display text for next month link currentText: "Today", // Display text for current month link monthNames: ["January","February","March","April","May","June", "July","August","September","October","November","December"], // Names of months for drop-down and formatting monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting dayNamesMin: ["Su","Mo","Tu","We","Th","Fr","Sa"], // Column headings for days starting at Sunday weekHeader: "Wk", // Column header for week of the year dateFormat: "mm/dd/yy", // See format options on parseDate firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... isRTL: false, // True if right-to-left language, false if left-to-right showMonthAfterYear: false, // True if the year select precedes month, false for month then year yearSuffix: "" // Additional text to append to the year in the month headers }; this._defaults = { // Global defaults for all the date picker instances showOn: "focus", // "focus" for popup on focus, // "button" for trigger button, or "both" for either showAnim: "fadeIn", // Name of jQuery animation for popup showOptions: {}, // Options for enhanced animations defaultDate: null, // Used when field is blank: actual date, // +/-number for offset from today, null for today appendText: "", // Display text following the input box, e.g. showing the format buttonText: "...", // Text for trigger button buttonImage: "", // URL for trigger button image buttonImageOnly: false, // True if the image appears alone, false if it appears on a button hideIfNoPrevNext: false, // True to hide next/previous month links // if not applicable, false to just disable them navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links gotoCurrent: false, // True if today link goes back to current selection instead changeMonth: false, // True if month can be selected directly, false if only prev/next changeYear: false, // True if year can be selected directly, false if only prev/next yearRange: "c-10:c+10", // Range of years to display in drop-down, // either relative to today's year (-nn:+nn), relative to currently displayed year // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) showOtherMonths: false, // True to show dates in other months, false to leave blank selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable showWeek: false, // True to show week of the year, false to not show it calculateWeek: this.iso8601Week, // How to calculate the week of the year, // takes a Date and returns the number of the week for it shortYearCutoff: "+10", // Short year values < this are in the current century, // > this are in the previous century, // string value starting with "+" for current year + value minDate: null, // The earliest selectable date, or null for no limit maxDate: null, // The latest selectable date, or null for no limit duration: "fast", // Duration of display/closure beforeShowDay: null, // Function that takes a date and returns an array with // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", // [2] = cell title (optional), e.g. $.datepicker.noWeekends beforeShow: null, // Function that takes an input field and // returns a set of custom settings for the date picker onSelect: null, // Define a callback function when a date is selected onChangeMonthYear: null, // Define a callback function when the month or year is changed onClose: null, // Define a callback function when the datepicker is closed numberOfMonths: 1, // Number of months to show at a time showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) stepMonths: 1, // Number of months to step back/forward stepBigMonths: 12, // Number of months to step back/forward for the big links altField: "", // Selector for an alternate field to store selected dates into altFormat: "", // The date format to use for the alternate field constrainInput: true, // The input is constrained by the current date format showButtonPanel: false, // True to show button panel, false to not show it autoSize: false, // True to size the input for the date format, false to leave as is disabled: false // The initial disabled state }; $.extend(this._defaults, this.regional[""]); this.regional.en = $.extend( true, {}, this.regional[ "" ]); this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en ); this.dpDiv = datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")); } $.extend(Datepicker.prototype, { /* Class name added to elements to indicate already configured with a date picker. */ markerClassName: "hasDatepicker", //Keep track of the maximum number of rows displayed (see #7043) maxRows: 4, // TODO rename to "widget" when switching to widget factory _widgetDatepicker: function() { return this.dpDiv; }, /* Override the default settings for all instances of the date picker. * @param settings object - the new settings to use as defaults (anonymous object) * @return the manager object */ setDefaults: function(settings) { datepicker_extendRemove(this._defaults, settings || {}); return this; }, /* Attach the date picker to a jQuery selection. * @param target element - the target input field or division or span * @param settings object - the new settings to use for this date picker instance (anonymous) */ _attachDatepicker: function(target, settings) { var nodeName, inline, inst; nodeName = target.nodeName.toLowerCase(); inline = (nodeName === "div" || nodeName === "span"); if (!target.id) { this.uuid += 1; target.id = "dp" + this.uuid; } inst = this._newInst($(target), inline); inst.settings = $.extend({}, settings || {}); if (nodeName === "input") { this._connectDatepicker(target, inst); } else if (inline) { this._inlineDatepicker(target, inst); } }, /* Create a new instance object. */ _newInst: function(target, inline) { var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars return {id: id, input: target, // associated target selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection drawMonth: 0, drawYear: 0, // month being drawn inline: inline, // is datepicker inline or not dpDiv: (!inline ? this.dpDiv : // presentation div datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")))}; }, /* Attach the date picker to an input field. */ _connectDatepicker: function(target, inst) { var input = $(target); inst.append = $([]); inst.trigger = $([]); if (input.hasClass(this.markerClassName)) { return; } this._attachments(input, inst); input.addClass(this.markerClassName).keydown(this._doKeyDown). keypress(this._doKeyPress).keyup(this._doKeyUp); this._autoSize(inst); $.data(target, "datepicker", inst); //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) if( inst.settings.disabled ) { this._disableDatepicker( target ); } }, /* Make attachments based on settings. */ _attachments: function(input, inst) { var showOn, buttonText, buttonImage, appendText = this._get(inst, "appendText"), isRTL = this._get(inst, "isRTL"); if (inst.append) { inst.append.remove(); } if (appendText) { inst.append = $("<span class='" + this._appendClass + "'>" + appendText + "</span>"); input[isRTL ? "before" : "after"](inst.append); } input.unbind("focus", this._showDatepicker); if (inst.trigger) { inst.trigger.remove(); } showOn = this._get(inst, "showOn"); if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field input.focus(this._showDatepicker); } if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked buttonText = this._get(inst, "buttonText"); buttonImage = this._get(inst, "buttonImage"); inst.trigger = $(this._get(inst, "buttonImageOnly") ? $("<img/>").addClass(this._triggerClass). attr({ src: buttonImage, alt: buttonText, title: buttonText }) : $("<button type='button'></button>").addClass(this._triggerClass). html(!buttonImage ? buttonText : $("<img/>").attr( { src:buttonImage, alt:buttonText, title:buttonText }))); input[isRTL ? "before" : "after"](inst.trigger); inst.trigger.click(function() { if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) { $.datepicker._hideDatepicker(); } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) { $.datepicker._hideDatepicker(); $.datepicker._showDatepicker(input[0]); } else { $.datepicker._showDatepicker(input[0]); } return false; }); } }, /* Apply the maximum length for the date format. */ _autoSize: function(inst) { if (this._get(inst, "autoSize") && !inst.inline) { var findMax, max, maxI, i, date = new Date(2009, 12 - 1, 20), // Ensure double digits dateFormat = this._get(inst, "dateFormat"); if (dateFormat.match(/[DM]/)) { findMax = function(names) { max = 0; maxI = 0; for (i = 0; i < names.length; i++) { if (names[i].length > max) { max = names[i].length; maxI = i; } } return maxI; }; date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ? "monthNames" : "monthNamesShort")))); date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? "dayNames" : "dayNamesShort"))) + 20 - date.getDay()); } inst.input.attr("size", this._formatDate(inst, date).length); } }, /* Attach an inline date picker to a div. */ _inlineDatepicker: function(target, inst) { var divSpan = $(target); if (divSpan.hasClass(this.markerClassName)) { return; } divSpan.addClass(this.markerClassName).append(inst.dpDiv); $.data(target, "datepicker", inst); this._setDate(inst, this._getDefaultDate(inst), true); this._updateDatepicker(inst); this._updateAlternate(inst); //If disabled option is true, disable the datepicker before showing it (see ticket #5665) if( inst.settings.disabled ) { this._disableDatepicker( target ); } // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height inst.dpDiv.css( "display", "block" ); }, /* Pop-up the date picker in a "dialog" box. * @param input element - ignored * @param date string or Date - the initial date to display * @param onSelect function - the function to call when a date is selected * @param settings object - update the dialog date picker instance's settings (anonymous object) * @param pos int[2] - coordinates for the dialog's position within the screen or * event - with x/y coordinates or * leave empty for default (screen centre) * @return the manager object */ _dialogDatepicker: function(input, date, onSelect, settings, pos) { var id, browserWidth, browserHeight, scrollX, scrollY, inst = this._dialogInst; // internal instance if (!inst) { this.uuid += 1; id = "dp" + this.uuid; this._dialogInput = $("<input type='text' id='" + id + "' style='position: absolute; top: -100px; width: 0px;'/>"); this._dialogInput.keydown(this._doKeyDown); $("body").append(this._dialogInput); inst = this._dialogInst = this._newInst(this._dialogInput, false); inst.settings = {}; $.data(this._dialogInput[0], "datepicker", inst); } datepicker_extendRemove(inst.settings, settings || {}); date = (date && date.constructor === Date ? this._formatDate(inst, date) : date); this._dialogInput.val(date); this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); if (!this._pos) { browserWidth = document.documentElement.clientWidth; browserHeight = document.documentElement.clientHeight; scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; scrollY = document.documentElement.scrollTop || document.body.scrollTop; this._pos = // should use actual width/height below [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; } // move input on screen for focus, but hidden behind dialog this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px"); inst.settings.onSelect = onSelect; this._inDialog = true; this.dpDiv.addClass(this._dialogClass); this._showDatepicker(this._dialogInput[0]); if ($.blockUI) { $.blockUI(this.dpDiv); } $.data(this._dialogInput[0], "datepicker", inst); return this; }, /* Detach a datepicker from its control. * @param target element - the target input field or division or span */ _destroyDatepicker: function(target) { var nodeName, $target = $(target), inst = $.data(target, "datepicker"); if (!$target.hasClass(this.markerClassName)) { return; } nodeName = target.nodeName.toLowerCase(); $.removeData(target, "datepicker"); if (nodeName === "input") { inst.append.remove(); inst.trigger.remove(); $target.removeClass(this.markerClassName). unbind("focus", this._showDatepicker). unbind("keydown", this._doKeyDown). unbind("keypress", this._doKeyPress). unbind("keyup", this._doKeyUp); } else if (nodeName === "div" || nodeName === "span") { $target.removeClass(this.markerClassName).empty(); } }, /* Enable the date picker to a jQuery selection. * @param target element - the target input field or division or span */ _enableDatepicker: function(target) { var nodeName, inline, $target = $(target), inst = $.data(target, "datepicker"); if (!$target.hasClass(this.markerClassName)) { return; } nodeName = target.nodeName.toLowerCase(); if (nodeName === "input") { target.disabled = false; inst.trigger.filter("button"). each(function() { this.disabled = false; }).end(). filter("img").css({opacity: "1.0", cursor: ""}); } else if (nodeName === "div" || nodeName === "span") { inline = $target.children("." + this._inlineClass); inline.children().removeClass("ui-state-disabled"); inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). prop("disabled", false); } this._disabledInputs = $.map(this._disabledInputs, function(value) { return (value === target ? null : value); }); // delete entry }, /* Disable the date picker to a jQuery selection. * @param target element - the target input field or division or span */ _disableDatepicker: function(target) { var nodeName, inline, $target = $(target), inst = $.data(target, "datepicker"); if (!$target.hasClass(this.markerClassName)) { return; } nodeName = target.nodeName.toLowerCase(); if (nodeName === "input") { target.disabled = true; inst.trigger.filter("button"). each(function() { this.disabled = true; }).end(). filter("img").css({opacity: "0.5", cursor: "default"}); } else if (nodeName === "div" || nodeName === "span") { inline = $target.children("." + this._inlineClass); inline.children().addClass("ui-state-disabled"); inline.find("select.ui-datepicker-month, select.ui-datepicker-year"). prop("disabled", true); } this._disabledInputs = $.map(this._disabledInputs, function(value) { return (value === target ? null : value); }); // delete entry this._disabledInputs[this._disabledInputs.length] = target; }, /* Is the first field in a jQuery collection disabled as a datepicker? * @param target element - the target input field or division or span * @return boolean - true if disabled, false if enabled */ _isDisabledDatepicker: function(target) { if (!target) { return false; } for (var i = 0; i < this._disabledInputs.length; i++) { if (this._disabledInputs[i] === target) { return true; } } return false; }, /* Retrieve the instance data for the target control. * @param target element - the target input field or division or span * @return object - the associated instance data * @throws error if a jQuery problem getting data */ _getInst: function(target) { try { return $.data(target, "datepicker"); } catch (err) { throw "Missing instance data for this datepicker"; } }, /* Update or retrieve the settings for a date picker attached to an input field or division. * @param target element - the target input field or division or span * @param name object - the new settings to update or * string - the name of the setting to change or retrieve, * when retrieving also "all" for all instance settings or * "defaults" for all global defaults * @param value any - the new value for the setting * (omit if above is an object or to retrieve a value) */ _optionDatepicker: function(target, name, value) { var settings, date, minDate, maxDate, inst = this._getInst(target); if (arguments.length === 2 && typeof name === "string") { return (name === "defaults" ? $.extend({}, $.datepicker._defaults) : (inst ? (name === "all" ? $.extend({}, inst.settings) : this._get(inst, name)) : null)); } settings = name || {}; if (typeof name === "string") { settings = {}; settings[name] = value; } if (inst) { if (this._curInst === inst) { this._hideDatepicker(); } date = this._getDateDatepicker(target, true); minDate = this._getMinMaxDate(inst, "min"); maxDate = this._getMinMaxDate(inst, "max"); datepicker_extendRemove(inst.settings, settings); // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) { inst.settings.minDate = this._formatDate(inst, minDate); } if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) { inst.settings.maxDate = this._formatDate(inst, maxDate); } if ( "disabled" in settings ) { if ( settings.disabled ) { this._disableDatepicker(target); } else { this._enableDatepicker(target); } } this._attachments($(target), inst); this._autoSize(inst); this._setDate(inst, date); this._updateAlternate(inst); this._updateDatepicker(inst); } }, // change method deprecated _changeDatepicker: function(target, name, value) { this._optionDatepicker(target, name, value); }, /* Redraw the date picker attached to an input field or division. * @param target element - the target input field or division or span */ _refreshDatepicker: function(target) { var inst = this._getInst(target); if (inst) { this._updateDatepicker(inst); } }, /* Set the dates for a jQuery selection. * @param target element - the target input field or division or span * @param date Date - the new date */ _setDateDatepicker: function(target, date) { var inst = this._getInst(target); if (inst) { this._setDate(inst, date); this._updateDatepicker(inst); this._updateAlternate(inst); } }, /* Get the date(s) for the first entry in a jQuery selection. * @param target element - the target input field or division or span * @param noDefault boolean - true if no default date is to be used * @return Date - the current date */ _getDateDatepicker: function(target, noDefault) { var inst = this._getInst(target); if (inst && !inst.inline) { this._setDateFromField(inst, noDefault); } return (inst ? this._getDate(inst) : null); }, /* Handle keystrokes. */ _doKeyDown: function(event) { var onSelect, dateStr, sel, inst = $.datepicker._getInst(event.target), handled = true, isRTL = inst.dpDiv.is(".ui-datepicker-rtl"); inst._keyEvent = true; if ($.datepicker._datepickerShowing) { switch (event.keyCode) { case 9: $.datepicker._hideDatepicker(); handled = false; break; // hide on tab out case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." + $.datepicker._currentClass + ")", inst.dpDiv); if (sel[0]) { $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); } onSelect = $.datepicker._get(inst, "onSelect"); if (onSelect) { dateStr = $.datepicker._formatDate(inst); // trigger custom callback onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); } else { $.datepicker._hideDatepicker(); } return false; // don't submit the form case 27: $.datepicker._hideDatepicker(); break; // hide on escape case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? -$.datepicker._get(inst, "stepBigMonths") : -$.datepicker._get(inst, "stepMonths")), "M"); break; // previous month/year on page up/+ ctrl case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? +$.datepicker._get(inst, "stepBigMonths") : +$.datepicker._get(inst, "stepMonths")), "M"); break; // next month/year on page down/+ ctrl case 35: if (event.ctrlKey || event.metaKey) { $.datepicker._clearDate(event.target); } handled = event.ctrlKey || event.metaKey; break; // clear on ctrl or command +end case 36: if (event.ctrlKey || event.metaKey) { $.datepicker._gotoToday(event.target); } handled = event.ctrlKey || event.metaKey; break; // current on ctrl or command +home case 37: if (event.ctrlKey || event.metaKey) { $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D"); } handled = event.ctrlKey || event.metaKey; // -1 day on ctrl or command +left if (event.originalEvent.altKey) { $.datepicker._adjustDate(event.target, (event.ctrlKey ? -$.datepicker._get(inst, "stepBigMonths") : -$.datepicker._get(inst, "stepMonths")), "M"); } // next month/year on alt +left on Mac break; case 38: if (event.ctrlKey || event.metaKey) { $.datepicker._adjustDate(event.target, -7, "D"); } handled = event.ctrlKey || event.metaKey; break; // -1 week on ctrl or command +up case 39: if (event.ctrlKey || event.metaKey) { $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D"); } handled = event.ctrlKey || event.metaKey; // +1 day on ctrl or command +right if (event.originalEvent.altKey) { $.datepicker._adjustDate(event.target, (event.ctrlKey ? +$.datepicker._get(inst, "stepBigMonths") : +$.datepicker._get(inst, "stepMonths")), "M"); } // next month/year on alt +right break; case 40: if (event.ctrlKey || event.metaKey) { $.datepicker._adjustDate(event.target, +7, "D"); } handled = event.ctrlKey || event.metaKey; break; // +1 week on ctrl or command +down default: handled = false; } } else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home $.datepicker._showDatepicker(this); } else { handled = false; } if (handled) { event.preventDefault(); event.stopPropagation(); } }, /* Filter entered characters - based on date format. */ _doKeyPress: function(event) { var chars, chr, inst = $.datepicker._getInst(event.target); if ($.datepicker._get(inst, "constrainInput")) { chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat")); chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode); return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1); } }, /* Synchronise manual entry and field/alternate field. */ _doKeyUp: function(event) { var date, inst = $.datepicker._getInst(event.target); if (inst.input.val() !== inst.lastVal) { try { date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), (inst.input ? inst.input.val() : null), $.datepicker._getFormatConfig(inst)); if (date) { // only if valid $.datepicker._setDateFromField(inst); $.datepicker._updateAlternate(inst); $.datepicker._updateDatepicker(inst); } } catch (err) { } } return true; }, /* Pop-up the date picker for a given input field. * If false returned from beforeShow event handler do not show. * @param input element - the input field attached to the date picker or * event - if triggered by focus */ _showDatepicker: function(input) { input = input.target || input; if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger input = $("input", input.parentNode)[0]; } if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here return; } var inst, beforeShow, beforeShowSettings, isFixed, offset, showAnim, duration; inst = $.datepicker._getInst(input); if ($.datepicker._curInst && $.datepicker._curInst !== inst) { $.datepicker._curInst.dpDiv.stop(true, true); if ( inst && $.datepicker._datepickerShowing ) { $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] ); } } beforeShow = $.datepicker._get(inst, "beforeShow"); beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {}; if(beforeShowSettings === false){ return; } datepicker_extendRemove(inst.settings, beforeShowSettings); inst.lastVal = null; $.datepicker._lastInput = input; $.datepicker._setDateFromField(inst); if ($.datepicker._inDialog) { // hide cursor input.value = ""; } if (!$.datepicker._pos) { // position below input $.datepicker._pos = $.datepicker._findPos(input); $.datepicker._pos[1] += input.offsetHeight; // add the height } isFixed = false; $(input).parents().each(function() { isFixed |= $(this).css("position") === "fixed"; return !isFixed; }); offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]}; $.datepicker._pos = null; //to avoid flashes on Firefox inst.dpDiv.empty(); // determine sizing offscreen inst.dpDiv.css({position: "absolute", display: "block", top: "-1000px"}); $.datepicker._updateDatepicker(inst); // fix width for dynamic number of date pickers // and adjust position before showing offset = $.datepicker._checkOffset(inst, offset, isFixed); inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ? "static" : (isFixed ? "fixed" : "absolute")), display: "none", left: offset.left + "px", top: offset.top + "px"}); if (!inst.inline) { showAnim = $.datepicker._get(inst, "showAnim"); duration = $.datepicker._get(inst, "duration"); inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 ); $.datepicker._datepickerShowing = true; if ( $.effects && $.effects.effect[ showAnim ] ) { inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration); } else { inst.dpDiv[showAnim || "show"](showAnim ? duration : null); } if ( $.datepicker._shouldFocusInput( inst ) ) { inst.input.focus(); } $.datepicker._curInst = inst; } }, /* Generate the date picker content. */ _updateDatepicker: function(inst) { this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) datepicker_instActive = inst; // for delegate hover events inst.dpDiv.empty().append(this._generateHTML(inst)); this._attachHandlers(inst); var origyearshtml, numMonths = this._getNumberOfMonths(inst), cols = numMonths[1], width = 17, activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" ); if ( activeCell.length > 0 ) { datepicker_handleMouseover.apply( activeCell.get( 0 ) ); } inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""); if (cols > 1) { inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em"); } inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") + "Class"]("ui-datepicker-multi"); inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") + "Class"]("ui-datepicker-rtl"); if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) { inst.input.focus(); } // deffered render of the years select (to avoid flashes on Firefox) if( inst.yearshtml ){ origyearshtml = inst.yearshtml; setTimeout(function(){ //assure that inst.yearshtml didn't change. if( origyearshtml === inst.yearshtml && inst.yearshtml ){ inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml); } origyearshtml = inst.yearshtml = null; }, 0); } }, // #6694 - don't focus the input if it's already focused // this breaks the change event in IE // Support: IE and jQuery <1.9 _shouldFocusInput: function( inst ) { return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ) && !inst.input.is( ":focus" ); }, /* Check positioning to remain on screen. */ _checkOffset: function(inst, offset, isFixed) { var dpWidth = inst.dpDiv.outerWidth(), dpHeight = inst.dpDiv.outerHeight(), inputWidth = inst.input ? inst.input.outerWidth() : 0, inputHeight = inst.input ? inst.input.outerHeight() : 0, viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()), viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop()); offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0); offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0; offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; // now check if datepicker is showing outside window viewport - move to a better place if so. offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? Math.abs(offset.left + dpWidth - viewWidth) : 0); offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? Math.abs(dpHeight + inputHeight) : 0); return offset; }, /* Find an object's position on the screen. */ _findPos: function(obj) { var position, inst = this._getInst(obj), isRTL = this._get(inst, "isRTL"); while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) { obj = obj[isRTL ? "previousSibling" : "nextSibling"]; } position = $(obj).offset(); return [position.left, position.top]; }, /* Hide the date picker from view. * @param input element - the input field attached to the date picker */ _hideDatepicker: function(input) { var showAnim, duration, postProcess, onClose, inst = this._curInst; if (!inst || (input && inst !== $.data(input, "datepicker"))) { return; } if (this._datepickerShowing) { showAnim = this._get(inst, "showAnim"); duration = this._get(inst, "duration"); postProcess = function() { $.datepicker._tidyDialog(inst); }; // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) ) { inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess); } else { inst.dpDiv[(showAnim === "slideDown" ? "slideUp" : (showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess); } if (!showAnim) { postProcess(); } this._datepickerShowing = false; onClose = this._get(inst, "onClose"); if (onClose) { onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]); } this._lastInput = null; if (this._inDialog) { this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" }); if ($.blockUI) { $.unblockUI(); $("body").append(this.dpDiv); } } this._inDialog = false; } }, /* Tidy up after a dialog display. */ _tidyDialog: function(inst) { inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar"); }, /* Close date picker if clicked elsewhere. */ _checkExternalClick: function(event) { if (!$.datepicker._curInst) { return; } var $target = $(event.target), inst = $.datepicker._getInst($target[0]); if ( ( ( $target[0].id !== $.datepicker._mainDivId && $target.parents("#" + $.datepicker._mainDivId).length === 0 && !$target.hasClass($.datepicker.markerClassName) && !$target.closest("." + $.datepicker._triggerClass).length && $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) || ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst ) ) { $.datepicker._hideDatepicker(); } }, /* Adjust one of the date sub-fields. */ _adjustDate: function(id, offset, period) { var target = $(id), inst = this._getInst(target[0]); if (this._isDisabledDatepicker(target[0])) { return; } this._adjustInstDate(inst, offset + (period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning period); this._updateDatepicker(inst); }, /* Action for current link. */ _gotoToday: function(id) { var date, target = $(id), inst = this._getInst(target[0]); if (this._get(inst, "gotoCurrent") && inst.currentDay) { inst.selectedDay = inst.currentDay; inst.drawMonth = inst.selectedMonth = inst.currentMonth; inst.drawYear = inst.selectedYear = inst.currentYear; } else { date = new Date(); inst.selectedDay = date.getDate(); inst.drawMonth = inst.selectedMonth = date.getMonth(); inst.drawYear = inst.selectedYear = date.getFullYear(); } this._notifyChange(inst); this._adjustDate(target); }, /* Action for selecting a new month/year. */ _selectMonthYear: function(id, select, period) { var target = $(id), inst = this._getInst(target[0]); inst["selected" + (period === "M" ? "Month" : "Year")] = inst["draw" + (period === "M" ? "Month" : "Year")] = parseInt(select.options[select.selectedIndex].value,10); this._notifyChange(inst); this._adjustDate(target); }, /* Action for selecting a day. */ _selectDay: function(id, month, year, td) { var inst, target = $(id); if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { return; } inst = this._getInst(target[0]); inst.selectedDay = inst.currentDay = $("a", td).html(); inst.selectedMonth = inst.currentMonth = month; inst.selectedYear = inst.currentYear = year; this._selectDate(id, this._formatDate(inst, inst.currentDay, inst.currentMonth, inst.currentYear)); }, /* Erase the input field and hide the date picker. */ _clearDate: function(id) { var target = $(id); this._selectDate(target, ""); }, /* Update the input field with the selected date. */ _selectDate: function(id, dateStr) { var onSelect, target = $(id), inst = this._getInst(target[0]); dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); if (inst.input) { inst.input.val(dateStr); } this._updateAlternate(inst); onSelect = this._get(inst, "onSelect"); if (onSelect) { onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback } else if (inst.input) { inst.input.trigger("change"); // fire the change event } if (inst.inline){ this._updateDatepicker(inst); } else { this._hideDatepicker(); this._lastInput = inst.input[0]; if (typeof(inst.input[0]) !== "object") { inst.input.focus(); // restore focus } this._lastInput = null; } }, /* Update any alternate field to synchronise with the main field. */ _updateAlternate: function(inst) { var altFormat, date, dateStr, altField = this._get(inst, "altField"); if (altField) { // update alternate field too altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat"); date = this._getDate(inst); dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); $(altField).each(function() { $(this).val(dateStr); }); } }, /* Set as beforeShowDay function to prevent selection of weekends. * @param date Date - the date to customise * @return [boolean, string] - is this date selectable?, what is its CSS class? */ noWeekends: function(date) { var day = date.getDay(); return [(day > 0 && day < 6), ""]; }, /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. * @param date Date - the date to get the week for * @return number - the number of the week within the year that contains this date */ iso8601Week: function(date) { var time, checkDate = new Date(date.getTime()); // Find Thursday of this week starting on Monday checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); time = checkDate.getTime(); checkDate.setMonth(0); // Compare with Jan 1 checkDate.setDate(1); return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; }, /* Parse a string value into a date object. * See formatDate below for the possible formats. * * @param format string - the expected format of the date * @param value string - the date in the above format * @param settings Object - attributes include: * shortYearCutoff number - the cutoff year for determining the century (optional) * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) * dayNames string[7] - names of the days from Sunday (optional) * monthNamesShort string[12] - abbreviated names of the months (optional) * monthNames string[12] - names of the months (optional) * @return Date - the extracted date value or null if value is blank */ parseDate: function (format, value, settings) { if (format == null || value == null) { throw "Invalid arguments"; } value = (typeof value === "object" ? value.toString() : value + ""); if (value === "") { return null; } var iFormat, dim, extra, iValue = 0, shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff, shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp : new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)), dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, year = -1, month = -1, day = -1, doy = -1, literal = false, date, // Check whether a format character is doubled lookAhead = function(match) { var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); if (matches) { iFormat++; } return matches; }, // Extract a number from the string value getNumber = function(match) { var isDoubled = lookAhead(match), size = (match === "@" ? 14 : (match === "!" ? 20 : (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))), minSize = (match === "y" ? size : 1), digits = new RegExp("^\\d{" + minSize + "," + size + "}"), num = value.substring(iValue).match(digits); if (!num) { throw "Missing number at position " + iValue; } iValue += num[0].length; return parseInt(num[0], 10); }, // Extract a name from the string value and convert to an index getName = function(match, shortNames, longNames) { var index = -1, names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) { return [ [k, v] ]; }).sort(function (a, b) { return -(a[1].length - b[1].length); }); $.each(names, function (i, pair) { var name = pair[1]; if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) { index = pair[0]; iValue += name.length; return false; } }); if (index !== -1) { return index + 1; } else { throw "Unknown name at position " + iValue; } }, // Confirm that a literal character matches the string value checkLiteral = function() { if (value.charAt(iValue) !== format.charAt(iFormat)) { throw "Unexpected literal at position " + iValue; } iValue++; }; for (iFormat = 0; iFormat < format.length; iFormat++) { if (literal) { if (format.charAt(iFormat) === "'" && !lookAhead("'")) { literal = false; } else { checkLiteral(); } } else { switch (format.charAt(iFormat)) { case "d": day = getNumber("d"); break; case "D": getName("D", dayNamesShort, dayNames); break; case "o": doy = getNumber("o"); break; case "m": month = getNumber("m"); break; case "M": month = getName("M", monthNamesShort, monthNames); break; case "y": year = getNumber("y"); break; case "@": date = new Date(getNumber("@")); year = date.getFullYear(); month = date.getMonth() + 1; day = date.getDate(); break; case "!": date = new Date((getNumber("!") - this._ticksTo1970) / 10000); year = date.getFullYear(); month = date.getMonth() + 1; day = date.getDate(); break; case "'": if (lookAhead("'")){ checkLiteral(); } else { literal = true; } break; default: checkLiteral(); } } } if (iValue < value.length){ extra = value.substr(iValue); if (!/^\s+/.test(extra)) { throw "Extra/unparsed characters found in date: " + extra; } } if (year === -1) { year = new Date().getFullYear(); } else if (year < 100) { year += new Date().getFullYear() - new Date().getFullYear() % 100 + (year <= shortYearCutoff ? 0 : -100); } if (doy > -1) { month = 1; day = doy; do { dim = this._getDaysInMonth(year, month - 1); if (day <= dim) { break; } month++; day -= dim; } while (true); } date = this._daylightSavingAdjust(new Date(year, month - 1, day)); if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) { throw "Invalid date"; // E.g. 31/02/00 } return date; }, /* Standard date formats. */ ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) COOKIE: "D, dd M yy", ISO_8601: "yy-mm-dd", RFC_822: "D, d M y", RFC_850: "DD, dd-M-y", RFC_1036: "D, d M y", RFC_1123: "D, d M yy", RFC_2822: "D, d M yy", RSS: "D, d M y", // RFC 822 TICKS: "!", TIMESTAMP: "@", W3C: "yy-mm-dd", // ISO 8601 _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000), /* Format a date object into a string value. * The format can be combinations of the following: * d - day of month (no leading zero) * dd - day of month (two digit) * o - day of year (no leading zeros) * oo - day of year (three digit) * D - day name short * DD - day name long * m - month of year (no leading zero) * mm - month of year (two digit) * M - month name short * MM - month name long * y - year (two digit) * yy - year (four digit) * @ - Unix timestamp (ms since 01/01/1970) * ! - Windows ticks (100ns since 01/01/0001) * "..." - literal text * '' - single quote * * @param format string - the desired format of the date * @param date Date - the date value to format * @param settings Object - attributes include: * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) * dayNames string[7] - names of the days from Sunday (optional) * monthNamesShort string[12] - abbreviated names of the months (optional) * monthNames string[12] - names of the months (optional) * @return string - the date in the above format */ formatDate: function (format, date, settings) { if (!date) { return ""; } var iFormat, dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort, dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames, monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort, monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames, // Check whether a format character is doubled lookAhead = function(match) { var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); if (matches) { iFormat++; } return matches; }, // Format a number, with leading zero if necessary formatNumber = function(match, value, len) { var num = "" + value; if (lookAhead(match)) { while (num.length < len) { num = "0" + num; } } return num; }, // Format a name, short or long as requested formatName = function(match, value, shortNames, longNames) { return (lookAhead(match) ? longNames[value] : shortNames[value]); }, output = "", literal = false; if (date) { for (iFormat = 0; iFormat < format.length; iFormat++) { if (literal) { if (format.charAt(iFormat) === "'" && !lookAhead("'")) { literal = false; } else { output += format.charAt(iFormat); } } else { switch (format.charAt(iFormat)) { case "d": output += formatNumber("d", date.getDate(), 2); break; case "D": output += formatName("D", date.getDay(), dayNamesShort, dayNames); break; case "o": output += formatNumber("o", Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3); break; case "m": output += formatNumber("m", date.getMonth() + 1, 2); break; case "M": output += formatName("M", date.getMonth(), monthNamesShort, monthNames); break; case "y": output += (lookAhead("y") ? date.getFullYear() : (date.getYear() % 100 < 10 ? "0" : "") + date.getYear() % 100); break; case "@": output += date.getTime(); break; case "!": output += date.getTime() * 10000 + this._ticksTo1970; break; case "'": if (lookAhead("'")) { output += "'"; } else { literal = true; } break; default: output += format.charAt(iFormat); } } } } return output; }, /* Extract all possible characters from the date format. */ _possibleChars: function (format) { var iFormat, chars = "", literal = false, // Check whether a format character is doubled lookAhead = function(match) { var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match); if (matches) { iFormat++; } return matches; }; for (iFormat = 0; iFormat < format.length; iFormat++) { if (literal) { if (format.charAt(iFormat) === "'" && !lookAhead("'")) { literal = false; } else { chars += format.charAt(iFormat); } } else { switch (format.charAt(iFormat)) { case "d": case "m": case "y": case "@": chars += "0123456789"; break; case "D": case "M": return null; // Accept anything case "'": if (lookAhead("'")) { chars += "'"; } else { literal = true; } break; default: chars += format.charAt(iFormat); } } } return chars; }, /* Get a setting value, defaulting if necessary. */ _get: function(inst, name) { return inst.settings[name] !== undefined ? inst.settings[name] : this._defaults[name]; }, /* Parse existing date and initialise date picker. */ _setDateFromField: function(inst, noDefault) { if (inst.input.val() === inst.lastVal) { return; } var dateFormat = this._get(inst, "dateFormat"), dates = inst.lastVal = inst.input ? inst.input.val() : null, defaultDate = this._getDefaultDate(inst), date = defaultDate, settings = this._getFormatConfig(inst); try { date = this.parseDate(dateFormat, dates, settings) || defaultDate; } catch (event) { dates = (noDefault ? "" : dates); } inst.selectedDay = date.getDate(); inst.drawMonth = inst.selectedMonth = date.getMonth(); inst.drawYear = inst.selectedYear = date.getFullYear(); inst.currentDay = (dates ? date.getDate() : 0); inst.currentMonth = (dates ? date.getMonth() : 0); inst.currentYear = (dates ? date.getFullYear() : 0); this._adjustInstDate(inst); }, /* Retrieve the default date shown on opening. */ _getDefaultDate: function(inst) { return this._restrictMinMax(inst, this._determineDate(inst, this._get(inst, "defaultDate"), new Date())); }, /* A date may be specified as an exact value or a relative one. */ _determineDate: function(inst, date, defaultDate) { var offsetNumeric = function(offset) { var date = new Date(); date.setDate(date.getDate() + offset); return date; }, offsetString = function(offset) { try { return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"), offset, $.datepicker._getFormatConfig(inst)); } catch (e) { // Ignore } var date = (offset.toLowerCase().match(/^c/) ? $.datepicker._getDate(inst) : null) || new Date(), year = date.getFullYear(), month = date.getMonth(), day = date.getDate(), pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, matches = pattern.exec(offset); while (matches) { switch (matches[2] || "d") { case "d" : case "D" : day += parseInt(matches[1],10); break; case "w" : case "W" : day += parseInt(matches[1],10) * 7; break; case "m" : case "M" : month += parseInt(matches[1],10); day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); break; case "y": case "Y" : year += parseInt(matches[1],10); day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); break; } matches = pattern.exec(offset); } return new Date(year, month, day); }, newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) : (typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime())))); newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate); if (newDate) { newDate.setHours(0); newDate.setMinutes(0); newDate.setSeconds(0); newDate.setMilliseconds(0); } return this._daylightSavingAdjust(newDate); }, /* Handle switch to/from daylight saving. * Hours may be non-zero on daylight saving cut-over: * > 12 when midnight changeover, but then cannot generate * midnight datetime, so jump to 1AM, otherwise reset. * @param date (Date) the date to check * @return (Date) the corrected date */ _daylightSavingAdjust: function(date) { if (!date) { return null; } date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); return date; }, /* Set the date(s) directly. */ _setDate: function(inst, date, noChange) { var clear = !date, origMonth = inst.selectedMonth, origYear = inst.selectedYear, newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); inst.selectedDay = inst.currentDay = newDate.getDate(); inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) { this._notifyChange(inst); } this._adjustInstDate(inst); if (inst.input) { inst.input.val(clear ? "" : this._formatDate(inst)); } }, /* Retrieve the date(s) directly. */ _getDate: function(inst) { var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null : this._daylightSavingAdjust(new Date( inst.currentYear, inst.currentMonth, inst.currentDay))); return startDate; }, /* Attach the onxxx handlers. These are declared statically so * they work with static code transformers like Caja. */ _attachHandlers: function(inst) { var stepMonths = this._get(inst, "stepMonths"), id = "#" + inst.id.replace( /\\\\/g, "\\" ); inst.dpDiv.find("[data-handler]").map(function () { var handler = { prev: function () { $.datepicker._adjustDate(id, -stepMonths, "M"); }, next: function () { $.datepicker._adjustDate(id, +stepMonths, "M"); }, hide: function () { $.datepicker._hideDatepicker(); }, today: function () { $.datepicker._gotoToday(id); }, selectDay: function () { $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this); return false; }, selectMonth: function () { $.datepicker._selectMonthYear(id, this, "M"); return false; }, selectYear: function () { $.datepicker._selectMonthYear(id, this, "Y"); return false; } }; $(this).bind(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]); }); }, /* Generate the HTML for the current state of the date picker. */ _generateHTML: function(inst) { var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin, monthNames, monthNamesShort, beforeShowDay, showOtherMonths, selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows, printDate, dRow, tbody, daySettings, otherMonth, unselectable, tempDate = new Date(), today = this._daylightSavingAdjust( new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time isRTL = this._get(inst, "isRTL"), showButtonPanel = this._get(inst, "showButtonPanel"), hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"), navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"), numMonths = this._getNumberOfMonths(inst), showCurrentAtPos = this._get(inst, "showCurrentAtPos"), stepMonths = this._get(inst, "stepMonths"), isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1), currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : new Date(inst.currentYear, inst.currentMonth, inst.currentDay))), minDate = this._getMinMaxDate(inst, "min"), maxDate = this._getMinMaxDate(inst, "max"), drawMonth = inst.drawMonth - showCurrentAtPos, drawYear = inst.drawYear; if (drawMonth < 0) { drawMonth += 12; drawYear--; } if (maxDate) { maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate())); maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { drawMonth--; if (drawMonth < 0) { drawMonth = 11; drawYear--; } } } inst.drawMonth = drawMonth; inst.drawYear = drawYear; prevText = this._get(inst, "prevText"); prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), this._getFormatConfig(inst))); prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" + " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>" : (hideIfNoPrevNext ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+ prevText +"'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>")); nextText = this._get(inst, "nextText"); nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), this._getFormatConfig(inst))); next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" + " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>" : (hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+ nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>")); currentText = this._get(inst, "currentText"); gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today); currentText = (!navigationAsDateFormat ? currentText : this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); controls = (!inst.inline ? "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" + this._get(inst, "closeText") + "</button>" : ""); buttonPanel = (showButtonPanel) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + (isRTL ? controls : "") + (this._isInRange(inst, gotoDate) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'" + ">" + currentText + "</button>" : "") + (isRTL ? "" : controls) + "</div>" : ""; firstDay = parseInt(this._get(inst, "firstDay"),10); firstDay = (isNaN(firstDay) ? 0 : firstDay); showWeek = this._get(inst, "showWeek"); dayNames = this._get(inst, "dayNames"); dayNamesMin = this._get(inst, "dayNamesMin"); monthNames = this._get(inst, "monthNames"); monthNamesShort = this._get(inst, "monthNamesShort"); beforeShowDay = this._get(inst, "beforeShowDay"); showOtherMonths = this._get(inst, "showOtherMonths"); selectOtherMonths = this._get(inst, "selectOtherMonths"); defaultDate = this._getDefaultDate(inst); html = ""; dow; for (row = 0; row < numMonths[0]; row++) { group = ""; this.maxRows = 4; for (col = 0; col < numMonths[1]; col++) { selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); cornerClass = " ui-corner-all"; calender = ""; if (isMultiMonth) { calender += "<div class='ui-datepicker-group"; if (numMonths[1] > 1) { switch (col) { case 0: calender += " ui-datepicker-group-first"; cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break; case numMonths[1]-1: calender += " ui-datepicker-group-last"; cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break; default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break; } } calender += "'>"; } calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") + (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") + this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers "</div><table class='ui-datepicker-calendar'><thead>" + "<tr>"; thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : ""); for (dow = 0; dow < 7; dow++) { // days of the week day = (dow + firstDay) % 7; thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" + "<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>"; } calender += thead + "</tr></thead><tbody>"; daysInMonth = this._getDaysInMonth(drawYear, drawMonth); if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) { inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); } leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043) this.maxRows = numRows; printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows calender += "<tr>"; tbody = (!showWeek ? "" : "<td class='ui-datepicker-week-col'>" + this._get(inst, "calculateWeek")(printDate) + "</td>"); for (dow = 0; dow < 7; dow++) { // create date picker days daySettings = (beforeShowDay ? beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]); otherMonth = (printDate.getMonth() !== drawMonth); unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || (minDate && printDate < minDate) || (maxDate && printDate > maxDate); tbody += "<td class='" + ((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends (otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months ((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key (defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ? // or defaultDate is current printedDate and defaultDate is selectedDate " " + this._dayOverClass : "") + // highlight selected day (unselectable ? " " + this._unselectableClass + " ui-state-disabled": "") + // highlight unselectable days (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates (printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day (printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different) ((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "&#39;") + "'" : "") + // cell title (unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions (otherMonth && !showOtherMonths ? "&#xa0;" : // display for other months (unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + (printDate.getTime() === today.getTime() ? " ui-state-highlight" : "") + (printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "") + // highlight selected day (otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months "' href='#'>" + printDate.getDate() + "</a>")) + "</td>"; // display selectable date printDate.setDate(printDate.getDate() + 1); printDate = this._daylightSavingAdjust(printDate); } calender += tbody + "</tr>"; } drawMonth++; if (drawMonth > 11) { drawMonth = 0; drawYear++; } calender += "</tbody></table>" + (isMultiMonth ? "</div>" + ((numMonths[0] > 0 && col === numMonths[1]-1) ? "<div class='ui-datepicker-row-break'></div>" : "") : ""); group += calender; } html += group; } html += buttonPanel; inst._keyEvent = false; return html; }, /* Generate the month and year header. */ _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, secondary, monthNames, monthNamesShort) { var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, changeMonth = this._get(inst, "changeMonth"), changeYear = this._get(inst, "changeYear"), showMonthAfterYear = this._get(inst, "showMonthAfterYear"), html = "<div class='ui-datepicker-title'>", monthHtml = ""; // month selection if (secondary || !changeMonth) { monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>"; } else { inMinYear = (minDate && minDate.getFullYear() === drawYear); inMaxYear = (maxDate && maxDate.getFullYear() === drawYear); monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>"; for ( month = 0; month < 12; month++) { if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) { monthHtml += "<option value='" + month + "'" + (month === drawMonth ? " selected='selected'" : "") + ">" + monthNamesShort[month] + "</option>"; } } monthHtml += "</select>"; } if (!showMonthAfterYear) { html += monthHtml + (secondary || !(changeMonth && changeYear) ? "&#xa0;" : ""); } // year selection if ( !inst.yearshtml ) { inst.yearshtml = ""; if (secondary || !changeYear) { html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; } else { // determine range of years to display years = this._get(inst, "yearRange").split(":"); thisYear = new Date().getFullYear(); determineYear = function(value) { var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) : (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) : parseInt(value, 10))); return (isNaN(year) ? thisYear : year); }; year = determineYear(years[0]); endYear = Math.max(year, determineYear(years[1] || "")); year = (minDate ? Math.max(year, minDate.getFullYear()) : year); endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>"; for (; year <= endYear; year++) { inst.yearshtml += "<option value='" + year + "'" + (year === drawYear ? " selected='selected'" : "") + ">" + year + "</option>"; } inst.yearshtml += "</select>"; html += inst.yearshtml; inst.yearshtml = null; } } html += this._get(inst, "yearSuffix"); if (showMonthAfterYear) { html += (secondary || !(changeMonth && changeYear) ? "&#xa0;" : "") + monthHtml; } html += "</div>"; // Close datepicker_header return html; }, /* Adjust one of the date sub-fields. */ _adjustInstDate: function(inst, offset, period) { var year = inst.drawYear + (period === "Y" ? offset : 0), month = inst.drawMonth + (period === "M" ? offset : 0), day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0), date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day))); inst.selectedDay = date.getDate(); inst.drawMonth = inst.selectedMonth = date.getMonth(); inst.drawYear = inst.selectedYear = date.getFullYear(); if (period === "M" || period === "Y") { this._notifyChange(inst); } }, /* Ensure a date is within any min/max bounds. */ _restrictMinMax: function(inst, date) { var minDate = this._getMinMaxDate(inst, "min"), maxDate = this._getMinMaxDate(inst, "max"), newDate = (minDate && date < minDate ? minDate : date); return (maxDate && newDate > maxDate ? maxDate : newDate); }, /* Notify change of month/year. */ _notifyChange: function(inst) { var onChange = this._get(inst, "onChangeMonthYear"); if (onChange) { onChange.apply((inst.input ? inst.input[0] : null), [inst.selectedYear, inst.selectedMonth + 1, inst]); } }, /* Determine the number of months to show. */ _getNumberOfMonths: function(inst) { var numMonths = this._get(inst, "numberOfMonths"); return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths)); }, /* Determine the current maximum date - ensure no time components are set. */ _getMinMaxDate: function(inst, minMax) { return this._determineDate(inst, this._get(inst, minMax + "Date"), null); }, /* Find the number of days in a given month. */ _getDaysInMonth: function(year, month) { return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate(); }, /* Find the day of the week of the first of a month. */ _getFirstDayOfMonth: function(year, month) { return new Date(year, month, 1).getDay(); }, /* Determines if we should allow a "next/prev" month display change. */ _canAdjustMonth: function(inst, offset, curYear, curMonth) { var numMonths = this._getNumberOfMonths(inst), date = this._daylightSavingAdjust(new Date(curYear, curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); if (offset < 0) { date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); } return this._isInRange(inst, date); }, /* Is the given date in the accepted range? */ _isInRange: function(inst, date) { var yearSplit, currentYear, minDate = this._getMinMaxDate(inst, "min"), maxDate = this._getMinMaxDate(inst, "max"), minYear = null, maxYear = null, years = this._get(inst, "yearRange"); if (years){ yearSplit = years.split(":"); currentYear = new Date().getFullYear(); minYear = parseInt(yearSplit[0], 10); maxYear = parseInt(yearSplit[1], 10); if ( yearSplit[0].match(/[+\-].*/) ) { minYear += currentYear; } if ( yearSplit[1].match(/[+\-].*/) ) { maxYear += currentYear; } } return ((!minDate || date.getTime() >= minDate.getTime()) && (!maxDate || date.getTime() <= maxDate.getTime()) && (!minYear || date.getFullYear() >= minYear) && (!maxYear || date.getFullYear() <= maxYear)); }, /* Provide the configuration settings for formatting/parsing. */ _getFormatConfig: function(inst) { var shortYearCutoff = this._get(inst, "shortYearCutoff"); shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff : new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); return {shortYearCutoff: shortYearCutoff, dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"), monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames")}; }, /* Format the given date for display. */ _formatDate: function(inst, day, month, year) { if (!day) { inst.currentDay = inst.selectedDay; inst.currentMonth = inst.selectedMonth; inst.currentYear = inst.selectedYear; } var date = (day ? (typeof day === "object" ? day : this._daylightSavingAdjust(new Date(year, month, day))) : this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst)); } }); /* * Bind hover events for datepicker elements. * Done via delegate so the binding only occurs once in the lifetime of the parent div. * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. */ function datepicker_bindHover(dpDiv) { var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; return dpDiv.delegate(selector, "mouseout", function() { $(this).removeClass("ui-state-hover"); if (this.className.indexOf("ui-datepicker-prev") !== -1) { $(this).removeClass("ui-datepicker-prev-hover"); } if (this.className.indexOf("ui-datepicker-next") !== -1) { $(this).removeClass("ui-datepicker-next-hover"); } }) .delegate( selector, "mouseover", datepicker_handleMouseover ); } function datepicker_handleMouseover() { if (!$.datepicker._isDisabledDatepicker( datepicker_instActive.inline? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) { $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"); $(this).addClass("ui-state-hover"); if (this.className.indexOf("ui-datepicker-prev") !== -1) { $(this).addClass("ui-datepicker-prev-hover"); } if (this.className.indexOf("ui-datepicker-next") !== -1) { $(this).addClass("ui-datepicker-next-hover"); } } } /* jQuery extend now ignores nulls! */ function datepicker_extendRemove(target, props) { $.extend(target, props); for (var name in props) { if (props[name] == null) { target[name] = props[name]; } } return target; } /* Invoke the datepicker functionality. @param options string - a command, optionally followed by additional parameters or Object - settings for attaching new datepicker functionality @return jQuery object */ $.fn.datepicker = function(options){ /* Verify an empty collection wasn't passed - Fixes #6976 */ if ( !this.length ) { return this; } /* Initialise the date picker. */ if (!$.datepicker.initialized) { $(document).mousedown($.datepicker._checkExternalClick); $.datepicker.initialized = true; } /* Append datepicker main container to body if not exist. */ if ($("#"+$.datepicker._mainDivId).length === 0) { $("body").append($.datepicker.dpDiv); } var otherArgs = Array.prototype.slice.call(arguments, 1); if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) { return $.datepicker["_" + options + "Datepicker"]. apply($.datepicker, [this[0]].concat(otherArgs)); } if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") { return $.datepicker["_" + options + "Datepicker"]. apply($.datepicker, [this[0]].concat(otherArgs)); } return this.each(function() { typeof options === "string" ? $.datepicker["_" + options + "Datepicker"]. apply($.datepicker, [this].concat(otherArgs)) : $.datepicker._attachDatepicker(this, options); }); }; $.datepicker = new Datepicker(); // singleton instance $.datepicker.initialized = false; $.datepicker.uuid = new Date().getTime(); $.datepicker.version = "1.11.1"; var datepicker = $.datepicker; /*! * jQuery UI Dialog 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/dialog/ */ var dialog = $.widget( "ui.dialog", { version: "1.11.1", options: { appendTo: "body", autoOpen: true, buttons: [], closeOnEscape: true, closeText: "Close", dialogClass: "", draggable: true, hide: null, height: "auto", maxHeight: null, maxWidth: null, minHeight: 150, minWidth: 150, modal: false, position: { my: "center", at: "center", of: window, collision: "fit", // Ensure the titlebar is always visible using: function( pos ) { var topOffset = $( this ).css( pos ).offset().top; if ( topOffset < 0 ) { $( this ).css( "top", pos.top - topOffset ); } } }, resizable: true, show: null, title: null, width: 300, // callbacks beforeClose: null, close: null, drag: null, dragStart: null, dragStop: null, focus: null, open: null, resize: null, resizeStart: null, resizeStop: null }, sizeRelatedOptions: { buttons: true, height: true, maxHeight: true, maxWidth: true, minHeight: true, minWidth: true, width: true }, resizableRelatedOptions: { maxHeight: true, maxWidth: true, minHeight: true, minWidth: true }, _create: function() { this.originalCss = { display: this.element[ 0 ].style.display, width: this.element[ 0 ].style.width, minHeight: this.element[ 0 ].style.minHeight, maxHeight: this.element[ 0 ].style.maxHeight, height: this.element[ 0 ].style.height }; this.originalPosition = { parent: this.element.parent(), index: this.element.parent().children().index( this.element ) }; this.originalTitle = this.element.attr( "title" ); this.options.title = this.options.title || this.originalTitle; this._createWrapper(); this.element .show() .removeAttr( "title" ) .addClass( "ui-dialog-content ui-widget-content" ) .appendTo( this.uiDialog ); this._createTitlebar(); this._createButtonPane(); if ( this.options.draggable && $.fn.draggable ) { this._makeDraggable(); } if ( this.options.resizable && $.fn.resizable ) { this._makeResizable(); } this._isOpen = false; this._trackFocus(); }, _init: function() { if ( this.options.autoOpen ) { this.open(); } }, _appendTo: function() { var element = this.options.appendTo; if ( element && (element.jquery || element.nodeType) ) { return $( element ); } return this.document.find( element || "body" ).eq( 0 ); }, _destroy: function() { var next, originalPosition = this.originalPosition; this._destroyOverlay(); this.element .removeUniqueId() .removeClass( "ui-dialog-content ui-widget-content" ) .css( this.originalCss ) // Without detaching first, the following becomes really slow .detach(); this.uiDialog.stop( true, true ).remove(); if ( this.originalTitle ) { this.element.attr( "title", this.originalTitle ); } next = originalPosition.parent.children().eq( originalPosition.index ); // Don't try to place the dialog next to itself (#8613) if ( next.length && next[ 0 ] !== this.element[ 0 ] ) { next.before( this.element ); } else { originalPosition.parent.append( this.element ); } }, widget: function() { return this.uiDialog; }, disable: $.noop, enable: $.noop, close: function( event ) { var activeElement, that = this; if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) { return; } this._isOpen = false; this._focusedElement = null; this._destroyOverlay(); this._untrackInstance(); if ( !this.opener.filter( ":focusable" ).focus().length ) { // support: IE9 // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe> try { activeElement = this.document[ 0 ].activeElement; // Support: IE9, IE10 // If the <body> is blurred, IE will switch windows, see #4520 if ( activeElement && activeElement.nodeName.toLowerCase() !== "body" ) { // Hiding a focused element doesn't trigger blur in WebKit // so in case we have nothing to focus on, explicitly blur the active element // https://bugs.webkit.org/show_bug.cgi?id=47182 $( activeElement ).blur(); } } catch ( error ) {} } this._hide( this.uiDialog, this.options.hide, function() { that._trigger( "close", event ); }); }, isOpen: function() { return this._isOpen; }, moveToTop: function() { this._moveToTop(); }, _moveToTop: function( event, silent ) { var moved = false, zIndicies = $(document).find(".ui-front").map(function() { //bug fix. return +$( this ).css( "z-index" ); }).get(), zIndexMax = Math.max.apply( null, zIndicies ) + 1; if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) { this.uiDialog.css( "z-index", zIndexMax + 1 ); moved = true; } if ( moved && !silent ) { this._trigger( "focus", event ); } return moved; }, open: function() { var that = this; if ( this._isOpen ) { if ( this._moveToTop() ) { this._focusTabbable(); } return; } this._isOpen = true; this.opener = $( this.document[ 0 ].activeElement ); this._size(); this._position(); this._createOverlay(); this._moveToTop( null, true ); // Ensure the overlay is moved to the top with the dialog, but only when // opening. The overlay shouldn't move after the dialog is open so that // modeless dialogs opened after the modal dialog stack properly. if ( this.overlay ) { this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 ); } this._show( this.uiDialog, this.options.show, function() { that._focusTabbable(); that._trigger( "focus" ); }); // Track the dialog immediately upon openening in case a focus event // somehow occurs outside of the dialog before an element inside the // dialog is focused (#10152) this._makeFocusTarget(); this._trigger( "open" ); }, _focusTabbable: function() { // Set focus to the first match: // 1. An element that was focused previously // 2. First element inside the dialog matching [autofocus] // 3. Tabbable element inside the content element // 4. Tabbable element inside the buttonpane // 5. The close button // 6. The dialog itself var hasFocus = this._focusedElement; if ( !hasFocus ) { hasFocus = this.element.find( "[autofocus]" ); } if ( !hasFocus.length ) { hasFocus = this.element.find( ":tabbable" ); } if ( !hasFocus.length ) { hasFocus = this.uiDialogButtonPane.find( ":tabbable" ); } if ( !hasFocus.length ) { hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" ); } if ( !hasFocus.length ) { hasFocus = this.uiDialog; } hasFocus.eq( 0 ).focus(); }, _keepFocus: function( event ) { function checkFocus() { var activeElement = this.document[0].activeElement, isActive = this.uiDialog[0] === activeElement || $.contains( this.uiDialog[0], activeElement ); if ( !isActive ) { this._focusTabbable(); } } event.preventDefault(); checkFocus.call( this ); // support: IE // IE <= 8 doesn't prevent moving focus even with event.preventDefault() // so we check again later this._delay( checkFocus ); }, _createWrapper: function() { this.uiDialog = $("<div>") .addClass( "ui-dialog ui-widget ui-widget-content ui-corner-all ui-front " + this.options.dialogClass ) .hide() .attr({ // Setting tabIndex makes the div focusable tabIndex: -1, role: "dialog" }) .appendTo( this._appendTo() ); this._on( this.uiDialog, { keydown: function( event ) { if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && event.keyCode === $.ui.keyCode.ESCAPE ) { event.preventDefault(); this.close( event ); return; } // prevent tabbing out of dialogs if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) { return; } var tabbables = this.uiDialog.find( ":tabbable" ), first = tabbables.filter( ":first" ), last = tabbables.filter( ":last" ); if ( ( event.target === last[0] || event.target === this.uiDialog[0] ) && !event.shiftKey ) { this._delay(function() { first.focus(); }); event.preventDefault(); } else if ( ( event.target === first[0] || event.target === this.uiDialog[0] ) && event.shiftKey ) { this._delay(function() { last.focus(); }); event.preventDefault(); } }, mousedown: function( event ) { if ( this._moveToTop( event ) ) { this._focusTabbable(); } } }); // We assume that any existing aria-describedby attribute means // that the dialog content is marked up properly // otherwise we brute force the content as the description if ( !this.element.find( "[aria-describedby]" ).length ) { this.uiDialog.attr({ "aria-describedby": this.element.uniqueId().attr( "id" ) }); } }, _createTitlebar: function() { var uiDialogTitle; this.uiDialogTitlebar = $( "<div>" ) .addClass( "ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix" ) .prependTo( this.uiDialog ); this._on( this.uiDialogTitlebar, { mousedown: function( event ) { // Don't prevent click on close button (#8838) // Focusing a dialog that is partially scrolled out of view // causes the browser to scroll it into view, preventing the click event if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) { // Dialog isn't getting focus when dragging (#8063) this.uiDialog.focus(); } } }); // support: IE // Use type="button" to prevent enter keypresses in textboxes from closing the // dialog in IE (#9312) this.uiDialogTitlebarClose = $( "<button type='button'></button>" ) .button({ label: this.options.closeText, icons: { primary: "ui-icon-closethick" }, text: false }) .addClass( "ui-dialog-titlebar-close" ) .appendTo( this.uiDialogTitlebar ); this._on( this.uiDialogTitlebarClose, { click: function( event ) { event.preventDefault(); this.close( event ); } }); uiDialogTitle = $( "<span>" ) .uniqueId() .addClass( "ui-dialog-title" ) .prependTo( this.uiDialogTitlebar ); this._title( uiDialogTitle ); this.uiDialog.attr({ "aria-labelledby": uiDialogTitle.attr( "id" ) }); }, _title: function( title ) { if ( !this.options.title ) { title.html( "&#160;" ); } title.text( this.options.title ); }, _createButtonPane: function() { this.uiDialogButtonPane = $( "<div>" ) .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" ); this.uiButtonSet = $( "<div>" ) .addClass( "ui-dialog-buttonset" ) .appendTo( this.uiDialogButtonPane ); this._createButtons(); }, _createButtons: function() { var that = this, buttons = this.options.buttons; // if we already have a button pane, remove it this.uiDialogButtonPane.remove(); this.uiButtonSet.empty(); if ( $.isEmptyObject( buttons ) || ($.isArray( buttons ) && !buttons.length) ) { this.uiDialog.removeClass( "ui-dialog-buttons" ); return; } $.each( buttons, function( name, props ) { var click, buttonOptions; props = $.isFunction( props ) ? { click: props, text: name } : props; // Default to a non-submitting button props = $.extend( { type: "button" }, props ); // Change the context for the click callback to be the main element click = props.click; props.click = function() { click.apply( that.element[ 0 ], arguments ); }; buttonOptions = { icons: props.icons, text: props.showText }; delete props.icons; delete props.showText; $( "<button></button>", props ) .button( buttonOptions ) .appendTo( that.uiButtonSet ); }); this.uiDialog.addClass( "ui-dialog-buttons" ); this.uiDialogButtonPane.appendTo( this.uiDialog ); }, _makeDraggable: function() { var that = this, options = this.options; function filteredUi( ui ) { return { position: ui.position, offset: ui.offset }; } this.uiDialog.draggable({ cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", handle: ".ui-dialog-titlebar", containment: "document", start: function( event, ui ) { $( this ).addClass( "ui-dialog-dragging" ); that._blockFrames(); that._trigger( "dragStart", event, filteredUi( ui ) ); }, drag: function( event, ui ) { that._trigger( "drag", event, filteredUi( ui ) ); }, stop: function( event, ui ) { var left = ui.offset.left - that.document.scrollLeft(), top = ui.offset.top - that.document.scrollTop(); options.position = { my: "left top", at: "left" + (left >= 0 ? "+" : "") + left + " " + "top" + (top >= 0 ? "+" : "") + top, of: that.window }; $( this ).removeClass( "ui-dialog-dragging" ); that._unblockFrames(); that._trigger( "dragStop", event, filteredUi( ui ) ); } }); }, _makeResizable: function() { var that = this, options = this.options, handles = options.resizable, // .ui-resizable has position: relative defined in the stylesheet // but dialogs have to use absolute or fixed positioning position = this.uiDialog.css("position"), resizeHandles = typeof handles === "string" ? handles : "n,e,s,w,se,sw,ne,nw"; function filteredUi( ui ) { return { originalPosition: ui.originalPosition, originalSize: ui.originalSize, position: ui.position, size: ui.size }; } this.uiDialog.resizable({ cancel: ".ui-dialog-content", containment: "document", alsoResize: this.element, maxWidth: options.maxWidth, maxHeight: options.maxHeight, minWidth: options.minWidth, minHeight: this._minHeight(), handles: resizeHandles, start: function( event, ui ) { $( this ).addClass( "ui-dialog-resizing" ); that._blockFrames(); that._trigger( "resizeStart", event, filteredUi( ui ) ); }, resize: function( event, ui ) { that._trigger( "resize", event, filteredUi( ui ) ); }, stop: function( event, ui ) { var offset = that.uiDialog.offset(), left = offset.left - that.document.scrollLeft(), top = offset.top - that.document.scrollTop(); options.height = that.uiDialog.height(); options.width = that.uiDialog.width(); options.position = { my: "left top", at: "left" + (left >= 0 ? "+" : "") + left + " " + "top" + (top >= 0 ? "+" : "") + top, of: that.window }; $( this ).removeClass( "ui-dialog-resizing" ); that._unblockFrames(); that._trigger( "resizeStop", event, filteredUi( ui ) ); } }) .css( "position", position ); }, _trackFocus: function() { this._on( this.widget(), { focusin: function( event ) { this._makeFocusTarget(); this._focusedElement = $( event.target ); } }); }, _makeFocusTarget: function() { this._untrackInstance(); this._trackingInstances().unshift( this ); }, _untrackInstance: function() { var instances = this._trackingInstances(), exists = $.inArray( this, instances ); if ( exists !== -1 ) { instances.splice( exists, 1 ); } }, _trackingInstances: function() { var instances = this.document.data( "ui-dialog-instances" ); if ( !instances ) { instances = []; this.document.data( "ui-dialog-instances", instances ); } return instances; }, _minHeight: function() { var options = this.options; return options.height === "auto" ? options.minHeight : Math.min( options.minHeight, options.height ); }, _position: function() { // Need to show the dialog to get the actual offset in the position plugin var isVisible = this.uiDialog.is( ":visible" ); if ( !isVisible ) { this.uiDialog.show(); } this.uiDialog.position( this.options.position ); if ( !isVisible ) { this.uiDialog.hide(); } }, _setOptions: function( options ) { var that = this, resize = false, resizableOptions = {}; $.each( options, function( key, value ) { that._setOption( key, value ); if ( key in that.sizeRelatedOptions ) { resize = true; } if ( key in that.resizableRelatedOptions ) { resizableOptions[ key ] = value; } }); if ( resize ) { this._size(); this._position(); } if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { this.uiDialog.resizable( "option", resizableOptions ); } }, _setOption: function( key, value ) { var isDraggable, isResizable, uiDialog = this.uiDialog; if ( key === "dialogClass" ) { uiDialog .removeClass( this.options.dialogClass ) .addClass( value ); } if ( key === "disabled" ) { return; } this._super( key, value ); if ( key === "appendTo" ) { this.uiDialog.appendTo( this._appendTo() ); } if ( key === "buttons" ) { this._createButtons(); } if ( key === "closeText" ) { this.uiDialogTitlebarClose.button({ // Ensure that we always pass a string label: "" + value }); } if ( key === "draggable" ) { isDraggable = uiDialog.is( ":data(ui-draggable)" ); if ( isDraggable && !value ) { uiDialog.draggable( "destroy" ); } if ( !isDraggable && value ) { this._makeDraggable(); } } if ( key === "position" ) { this._position(); } if ( key === "resizable" ) { // currently resizable, becoming non-resizable isResizable = uiDialog.is( ":data(ui-resizable)" ); if ( isResizable && !value ) { uiDialog.resizable( "destroy" ); } // currently resizable, changing handles if ( isResizable && typeof value === "string" ) { uiDialog.resizable( "option", "handles", value ); } // currently non-resizable, becoming resizable if ( !isResizable && value !== false ) { this._makeResizable(); } } if ( key === "title" ) { this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) ); } }, _size: function() { // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content // divs will both have width and height set, so we need to reset them var nonContentHeight, minContentHeight, maxContentHeight, options = this.options; // Reset content sizing this.element.show().css({ width: "auto", minHeight: 0, maxHeight: "none", height: 0 }); if ( options.minWidth > options.width ) { options.width = options.minWidth; } // reset wrapper sizing // determine the height of all the non-content elements nonContentHeight = this.uiDialog.css({ height: "auto", width: options.width }) .outerHeight(); minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); maxContentHeight = typeof options.maxHeight === "number" ? Math.max( 0, options.maxHeight - nonContentHeight ) : "none"; if ( options.height === "auto" ) { this.element.css({ minHeight: minContentHeight, maxHeight: maxContentHeight, height: "auto" }); } else { this.element.height( Math.max( 0, options.height - nonContentHeight ) ); } if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { this.uiDialog.resizable( "option", "minHeight", this._minHeight() ); } }, _blockFrames: function() { this.iframeBlocks = this.document.find( "iframe" ).map(function() { var iframe = $( this ); return $( "<div>" ) .css({ position: "absolute", width: iframe.outerWidth(), height: iframe.outerHeight() }) .appendTo( iframe.parent() ) .offset( iframe.offset() )[0]; }); }, _unblockFrames: function() { if ( this.iframeBlocks ) { this.iframeBlocks.remove(); delete this.iframeBlocks; } }, _allowInteraction: function( event ) { if ( $( event.target ).closest( ".ui-dialog" ).length ) { return true; } // TODO: Remove hack when datepicker implements // the .ui-front logic (#8989) return !!$( event.target ).closest( ".ui-datepicker" ).length; }, _createOverlay: function() { if ( !this.options.modal ) { return; } // We use a delay in case the overlay is created from an // event that we're going to be cancelling (#2804) var isOpening = true; this._delay(function() { isOpening = false; }); if ( !this.document.data( "ui-dialog-overlays" ) ) { // Prevent use of anchors and inputs // Using _on() for an event handler shared across many instances is // safe because the dialogs stack and must be closed in reverse order this._on( this.document, { focusin: function( event ) { if ( isOpening ) { return; } if ( !this._allowInteraction( event ) ) { event.preventDefault(); this._trackingInstances()[ 0 ]._focusTabbable(); } } }); } this.overlay = $( "<div>" ) .addClass( "ui-widget-overlay ui-front" ) .appendTo( this._appendTo() ); this._on( this.overlay, { mousedown: "_keepFocus" }); this.document.data( "ui-dialog-overlays", (this.document.data( "ui-dialog-overlays" ) || 0) + 1 ); }, _destroyOverlay: function() { if ( !this.options.modal ) { return; } if ( this.overlay ) { var overlays = this.document.data( "ui-dialog-overlays" ) - 1; if ( !overlays ) { this.document .unbind( "focusin" ) .removeData( "ui-dialog-overlays" ); } else { this.document.data( "ui-dialog-overlays", overlays ); } this.overlay.remove(); this.overlay = null; } } }); /*! * jQuery UI Progressbar 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/progressbar/ */ var progressbar = $.widget( "ui.progressbar", { version: "1.11.1", options: { max: 100, value: 0, change: null, complete: null }, min: 0, _create: function() { // Constrain initial value this.oldValue = this.options.value = this._constrainedValue(); this.element .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) .attr({ // Only set static values, aria-valuenow and aria-valuemax are // set inside _refreshValue() role: "progressbar", "aria-valuemin": this.min }); this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" ) .appendTo( this.element ); this._refreshValue(); }, _destroy: function() { this.element .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) .removeAttr( "role" ) .removeAttr( "aria-valuemin" ) .removeAttr( "aria-valuemax" ) .removeAttr( "aria-valuenow" ); this.valueDiv.remove(); }, value: function( newValue ) { if ( newValue === undefined ) { return this.options.value; } this.options.value = this._constrainedValue( newValue ); this._refreshValue(); }, _constrainedValue: function( newValue ) { if ( newValue === undefined ) { newValue = this.options.value; } this.indeterminate = newValue === false; // sanitize value if ( typeof newValue !== "number" ) { newValue = 0; } return this.indeterminate ? false : Math.min( this.options.max, Math.max( this.min, newValue ) ); }, _setOptions: function( options ) { // Ensure "value" option is set after other values (like max) var value = options.value; delete options.value; this._super( options ); this.options.value = this._constrainedValue( value ); this._refreshValue(); }, _setOption: function( key, value ) { if ( key === "max" ) { // Don't allow a max less than min value = Math.max( this.min, value ); } if ( key === "disabled" ) { this.element .toggleClass( "ui-state-disabled", !!value ) .attr( "aria-disabled", value ); } this._super( key, value ); }, _percentage: function() { return this.indeterminate ? 100 : 100 * ( this.options.value - this.min ) / ( this.options.max - this.min ); }, _refreshValue: function() { var value = this.options.value, percentage = this._percentage(); this.valueDiv .toggle( this.indeterminate || value > this.min ) .toggleClass( "ui-corner-right", value === this.options.max ) .width( percentage.toFixed(0) + "%" ); this.element.toggleClass( "ui-progressbar-indeterminate", this.indeterminate ); if ( this.indeterminate ) { this.element.removeAttr( "aria-valuenow" ); if ( !this.overlayDiv ) { this.overlayDiv = $( "<div class='ui-progressbar-overlay'></div>" ).appendTo( this.valueDiv ); } } else { this.element.attr({ "aria-valuemax": this.options.max, "aria-valuenow": value }); if ( this.overlayDiv ) { this.overlayDiv.remove(); this.overlayDiv = null; } } if ( this.oldValue !== value ) { this.oldValue = value; this._trigger( "change" ); } if ( value === this.options.max ) { this._trigger( "complete" ); } } }); /*! * jQuery UI Selectmenu 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/selectmenu */ var selectmenu = $.widget( "ui.selectmenu", { version: "1.11.1", defaultElement: "<select>", options: { appendTo: null, disabled: null, icons: { button: "ui-icon-triangle-1-s" }, position: { my: "left top", at: "left bottom", collision: "none" }, width: null, // callbacks change: null, close: null, focus: null, open: null, select: null }, _create: function() { var selectmenuId = this.element.uniqueId().attr( "id" ); this.ids = { element: selectmenuId, button: selectmenuId + "-button", menu: selectmenuId + "-menu" }; this._drawButton(); this._drawMenu(); if ( this.options.disabled ) { this.disable(); } }, _drawButton: function() { var that = this, tabindex = this.element.attr( "tabindex" ); // Associate existing label with the new button this.label = $( "label[for='" + this.ids.element + "']" ).attr( "for", this.ids.button ); this._on( this.label, { click: function( event ) { this.button.focus(); event.preventDefault(); } }); // Hide original select element this.element.hide(); // Create button this.button = $( "<span>", { "class": "ui-selectmenu-button ui-widget ui-state-default ui-corner-all", tabindex: tabindex || this.options.disabled ? -1 : 0, id: this.ids.button, role: "combobox", "aria-expanded": "false", "aria-autocomplete": "list", "aria-owns": this.ids.menu, "aria-haspopup": "true" }) .insertAfter( this.element ); $( "<span>", { "class": "ui-icon " + this.options.icons.button }) .prependTo( this.button ); this.buttonText = $( "<span>", { "class": "ui-selectmenu-text" }) .appendTo( this.button ); this._setText( this.buttonText, this.element.find( "option:selected" ).text() ); this._resizeButton(); this._on( this.button, this._buttonEvents ); this.button.one( "focusin", function() { // Delay rendering the menu items until the button receives focus. // The menu may have already been rendered via a programmatic open. if ( !that.menuItems ) { that._refreshMenu(); } }); this._hoverable( this.button ); this._focusable( this.button ); }, _drawMenu: function() { var that = this; // Create menu this.menu = $( "<ul>", { "aria-hidden": "true", "aria-labelledby": this.ids.button, id: this.ids.menu }); // Wrap menu this.menuWrap = $( "<div>", { "class": "ui-selectmenu-menu ui-front" }) .append( this.menu ) .appendTo( this._appendTo() ); // Initialize menu widget this.menuInstance = this.menu .menu({ role: "listbox", select: function( event, ui ) { event.preventDefault(); that._select( ui.item.data( "ui-selectmenu-item" ), event ); }, focus: function( event, ui ) { var item = ui.item.data( "ui-selectmenu-item" ); // Prevent inital focus from firing and check if its a newly focused item if ( that.focusIndex != null && item.index !== that.focusIndex ) { that._trigger( "focus", event, { item: item } ); if ( !that.isOpen ) { that._select( item, event ); } } that.focusIndex = item.index; that.button.attr( "aria-activedescendant", that.menuItems.eq( item.index ).attr( "id" ) ); } }) .menu( "instance" ); // Adjust menu styles to dropdown this.menu .addClass( "ui-corner-bottom" ) .removeClass( "ui-corner-all" ); // Don't close the menu on mouseleave this.menuInstance._off( this.menu, "mouseleave" ); // Cancel the menu's collapseAll on document click this.menuInstance._closeOnDocumentClick = function() { return false; }; // Selects often contain empty items, but never contain dividers this.menuInstance._isDivider = function() { return false; }; }, refresh: function() { this._refreshMenu(); this._setText( this.buttonText, this._getSelectedItem().text() ); if ( !this.options.width ) { this._resizeButton(); } }, _refreshMenu: function() { this.menu.empty(); var item, options = this.element.find( "option" ); if ( !options.length ) { return; } this._parseOptions( options ); this._renderMenu( this.menu, this.items ); this.menuInstance.refresh(); this.menuItems = this.menu.find( "li" ).not( ".ui-selectmenu-optgroup" ); item = this._getSelectedItem(); // Update the menu to have the correct item focused this.menuInstance.focus( null, item ); this._setAria( item.data( "ui-selectmenu-item" ) ); // Set disabled state this._setOption( "disabled", this.element.prop( "disabled" ) ); }, open: function( event ) { if ( this.options.disabled ) { return; } // If this is the first time the menu is being opened, render the items if ( !this.menuItems ) { this._refreshMenu(); } else { // Menu clears focus on close, reset focus to selected item this.menu.find( ".ui-state-focus" ).removeClass( "ui-state-focus" ); this.menuInstance.focus( null, this._getSelectedItem() ); } this.isOpen = true; this._toggleAttr(); this._resizeMenu(); this._position(); this._on( this.document, this._documentClick ); this._trigger( "open", event ); }, _position: function() { this.menuWrap.position( $.extend( { of: this.button }, this.options.position ) ); }, close: function( event ) { if ( !this.isOpen ) { return; } this.isOpen = false; this._toggleAttr(); this._off( this.document ); this._trigger( "close", event ); }, widget: function() { return this.button; }, menuWidget: function() { return this.menu; }, _renderMenu: function( ul, items ) { var that = this, currentOptgroup = ""; $.each( items, function( index, item ) { if ( item.optgroup !== currentOptgroup ) { $( "<li>", { "class": "ui-selectmenu-optgroup ui-menu-divider" + ( item.element.parent( "optgroup" ).prop( "disabled" ) ? " ui-state-disabled" : "" ), text: item.optgroup }) .appendTo( ul ); currentOptgroup = item.optgroup; } that._renderItemData( ul, item ); }); }, _renderItemData: function( ul, item ) { return this._renderItem( ul, item ).data( "ui-selectmenu-item", item ); }, _renderItem: function( ul, item ) { var li = $( "<li>" ); if ( item.disabled ) { li.addClass( "ui-state-disabled" ); } this._setText( li, item.label ); return li.appendTo( ul ); }, _setText: function( element, value ) { if ( value ) { element.text( value ); } else { element.html( "&#160;" ); } }, _move: function( direction, event ) { var item, next, filter = ".ui-menu-item"; if ( this.isOpen ) { item = this.menuItems.eq( this.focusIndex ); } else { item = this.menuItems.eq( this.element[ 0 ].selectedIndex ); filter += ":not(.ui-state-disabled)"; } if ( direction === "first" || direction === "last" ) { next = item[ direction === "first" ? "prevAll" : "nextAll" ]( filter ).eq( -1 ); } else { next = item[ direction + "All" ]( filter ).eq( 0 ); } if ( next.length ) { this.menuInstance.focus( event, next ); } }, _getSelectedItem: function() { return this.menuItems.eq( this.element[ 0 ].selectedIndex ); }, _toggle: function( event ) { this[ this.isOpen ? "close" : "open" ]( event ); }, _documentClick: { mousedown: function( event ) { if ( !this.isOpen ) { return; } if ( !$( event.target ).closest( ".ui-selectmenu-menu, #" + this.ids.button ).length ) { this.close( event ); } } }, _buttonEvents: { // Prevent text selection from being reset when interacting with the selectmenu (#10144) mousedown: function( event ) { event.preventDefault(); }, click: "_toggle", keydown: function( event ) { var preventDefault = true; switch ( event.keyCode ) { case $.ui.keyCode.TAB: case $.ui.keyCode.ESCAPE: this.close( event ); preventDefault = false; break; case $.ui.keyCode.ENTER: if ( this.isOpen ) { this._selectFocusedItem( event ); } break; case $.ui.keyCode.UP: if ( event.altKey ) { this._toggle( event ); } else { this._move( "prev", event ); } break; case $.ui.keyCode.DOWN: if ( event.altKey ) { this._toggle( event ); } else { this._move( "next", event ); } break; case $.ui.keyCode.SPACE: if ( this.isOpen ) { this._selectFocusedItem( event ); } else { this._toggle( event ); } break; case $.ui.keyCode.LEFT: this._move( "prev", event ); break; case $.ui.keyCode.RIGHT: this._move( "next", event ); break; case $.ui.keyCode.HOME: case $.ui.keyCode.PAGE_UP: this._move( "first", event ); break; case $.ui.keyCode.END: case $.ui.keyCode.PAGE_DOWN: this._move( "last", event ); break; default: this.menu.trigger( event ); preventDefault = false; } if ( preventDefault ) { event.preventDefault(); } } }, _selectFocusedItem: function( event ) { var item = this.menuItems.eq( this.focusIndex ); if ( !item.hasClass( "ui-state-disabled" ) ) { this._select( item.data( "ui-selectmenu-item" ), event ); } }, _select: function( item, event ) { var oldIndex = this.element[ 0 ].selectedIndex; // Change native select element this.element[ 0 ].selectedIndex = item.index; this._setText( this.buttonText, item.label ); this._setAria( item ); this._trigger( "select", event, { item: item } ); if ( item.index !== oldIndex ) { this._trigger( "change", event, { item: item } ); } this.close( event ); }, _setAria: function( item ) { var id = this.menuItems.eq( item.index ).attr( "id" ); this.button.attr({ "aria-labelledby": id, "aria-activedescendant": id }); this.menu.attr( "aria-activedescendant", id ); }, _setOption: function( key, value ) { if ( key === "icons" ) { this.button.find( "span.ui-icon" ) .removeClass( this.options.icons.button ) .addClass( value.button ); } this._super( key, value ); if ( key === "appendTo" ) { this.menuWrap.appendTo( this._appendTo() ); } if ( key === "disabled" ) { this.menuInstance.option( "disabled", value ); this.button .toggleClass( "ui-state-disabled", value ) .attr( "aria-disabled", value ); this.element.prop( "disabled", value ); if ( value ) { this.button.attr( "tabindex", -1 ); this.close(); } else { this.button.attr( "tabindex", 0 ); } } if ( key === "width" ) { this._resizeButton(); } }, _appendTo: function() { var element = this.options.appendTo; if ( element ) { element = element.jquery || element.nodeType ? $( element ) : this.document.find( element ).eq( 0 ); } if ( !element || !element[ 0 ] ) { element = this.element.closest( ".ui-front" ); } if ( !element.length ) { element = this.document[ 0 ].body; } return element; }, _toggleAttr: function() { this.button .toggleClass( "ui-corner-top", this.isOpen ) .toggleClass( "ui-corner-all", !this.isOpen ) .attr( "aria-expanded", this.isOpen ); this.menuWrap.toggleClass( "ui-selectmenu-open", this.isOpen ); this.menu.attr( "aria-hidden", !this.isOpen ); }, _resizeButton: function() { var width = this.options.width; if ( !width ) { width = this.element.show().outerWidth(); this.element.hide(); } this.button.outerWidth( width ); }, _resizeMenu: function() { this.menu.outerWidth( Math.max( this.button.outerWidth(), // support: IE10 // IE10 wraps long text (possibly a rounding bug) // so we add 1px to avoid the wrapping this.menu.width( "" ).outerWidth() + 1 ) ); }, _getCreateOptions: function() { return { disabled: this.element.prop( "disabled" ) }; }, _parseOptions: function( options ) { var data = []; options.each(function( index, item ) { var option = $( item ), optgroup = option.parent( "optgroup" ); data.push({ element: option, index: index, value: option.attr( "value" ), label: option.text(), optgroup: optgroup.attr( "label" ) || "", disabled: optgroup.prop( "disabled" ) || option.prop( "disabled" ) }); }); this.items = data; }, _destroy: function() { this.menuWrap.remove(); this.button.remove(); this.element.show(); this.element.removeUniqueId(); this.label.attr( "for", this.ids.element ); } }); /*! * jQuery UI Slider 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/slider/ */ var slider = $.widget( "ui.slider", $.ui.mouse, { version: "1.11.1", widgetEventPrefix: "slide", options: { animate: false, distance: 0, max: 100, min: 0, orientation: "horizontal", range: false, step: 1, value: 0, values: null, // callbacks change: null, slide: null, start: null, stop: null }, // number of pages in a slider // (how many times can you page up/down to go through the whole range) numPages: 5, _create: function() { this._keySliding = false; this._mouseSliding = false; this._animateOff = true; this._handleIndex = null; this._detectOrientation(); this._mouseInit(); this.element .addClass( "ui-slider" + " ui-slider-" + this.orientation + " ui-widget" + " ui-widget-content" + " ui-corner-all"); this._refresh(); this._setOption( "disabled", this.options.disabled ); this._animateOff = false; }, _refresh: function() { this._createRange(); this._createHandles(); this._setupEvents(); this._refreshValue(); }, _createHandles: function() { var i, handleCount, options = this.options, existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ), handle = "<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>", handles = []; handleCount = ( options.values && options.values.length ) || 1; if ( existingHandles.length > handleCount ) { existingHandles.slice( handleCount ).remove(); existingHandles = existingHandles.slice( 0, handleCount ); } for ( i = existingHandles.length; i < handleCount; i++ ) { handles.push( handle ); } this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) ); this.handle = this.handles.eq( 0 ); this.handles.each(function( i ) { $( this ).data( "ui-slider-handle-index", i ); }); }, _createRange: function() { var options = this.options, classes = ""; if ( options.range ) { if ( options.range === true ) { if ( !options.values ) { options.values = [ this._valueMin(), this._valueMin() ]; } else if ( options.values.length && options.values.length !== 2 ) { options.values = [ options.values[0], options.values[0] ]; } else if ( $.isArray( options.values ) ) { options.values = options.values.slice(0); } } if ( !this.range || !this.range.length ) { this.range = $( "<div></div>" ) .appendTo( this.element ); classes = "ui-slider-range" + // note: this isn't the most fittingly semantic framework class for this element, // but worked best visually with a variety of themes " ui-widget-header ui-corner-all"; } else { this.range.removeClass( "ui-slider-range-min ui-slider-range-max" ) // Handle range switching from true to min/max .css({ "left": "", "bottom": "" }); } this.range.addClass( classes + ( ( options.range === "min" || options.range === "max" ) ? " ui-slider-range-" + options.range : "" ) ); } else { if ( this.range ) { this.range.remove(); } this.range = null; } }, _setupEvents: function() { this._off( this.handles ); this._on( this.handles, this._handleEvents ); this._hoverable( this.handles ); this._focusable( this.handles ); }, _destroy: function() { this.handles.remove(); if ( this.range ) { this.range.remove(); } this.element .removeClass( "ui-slider" + " ui-slider-horizontal" + " ui-slider-vertical" + " ui-widget" + " ui-widget-content" + " ui-corner-all" ); this._mouseDestroy(); }, _mouseCapture: function( event ) { var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle, that = this, o = this.options; if ( o.disabled ) { return false; } this.elementSize = { width: this.element.outerWidth(), height: this.element.outerHeight() }; this.elementOffset = this.element.offset(); position = { x: event.pageX, y: event.pageY }; normValue = this._normValueFromMouse( position ); distance = this._valueMax() - this._valueMin() + 1; this.handles.each(function( i ) { var thisDistance = Math.abs( normValue - that.values(i) ); if (( distance > thisDistance ) || ( distance === thisDistance && (i === that._lastChangedValue || that.values(i) === o.min ))) { distance = thisDistance; closestHandle = $( this ); index = i; } }); allowed = this._start( event, index ); if ( allowed === false ) { return false; } this._mouseSliding = true; this._handleIndex = index; closestHandle .addClass( "ui-state-active" ) .focus(); offset = closestHandle.offset(); mouseOverHandle = !$( event.target ).parents().addBack().is( ".ui-slider-handle" ); this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { left: event.pageX - offset.left - ( closestHandle.width() / 2 ), top: event.pageY - offset.top - ( closestHandle.height() / 2 ) - ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) - ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) + ( parseInt( closestHandle.css("marginTop"), 10 ) || 0) }; if ( !this.handles.hasClass( "ui-state-hover" ) ) { this._slide( event, index, normValue ); } this._animateOff = true; return true; }, _mouseStart: function() { return true; }, _mouseDrag: function( event ) { var position = { x: event.pageX, y: event.pageY }, normValue = this._normValueFromMouse( position ); this._slide( event, this._handleIndex, normValue ); return false; }, _mouseStop: function( event ) { this.handles.removeClass( "ui-state-active" ); this._mouseSliding = false; this._stop( event, this._handleIndex ); this._change( event, this._handleIndex ); this._handleIndex = null; this._clickOffset = null; this._animateOff = false; return false; }, _detectOrientation: function() { this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal"; }, _normValueFromMouse: function( position ) { var pixelTotal, pixelMouse, percentMouse, valueTotal, valueMouse; if ( this.orientation === "horizontal" ) { pixelTotal = this.elementSize.width; pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 ); } else { pixelTotal = this.elementSize.height; pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 ); } percentMouse = ( pixelMouse / pixelTotal ); if ( percentMouse > 1 ) { percentMouse = 1; } if ( percentMouse < 0 ) { percentMouse = 0; } if ( this.orientation === "vertical" ) { percentMouse = 1 - percentMouse; } valueTotal = this._valueMax() - this._valueMin(); valueMouse = this._valueMin() + percentMouse * valueTotal; return this._trimAlignValue( valueMouse ); }, _start: function( event, index ) { var uiHash = { handle: this.handles[ index ], value: this.value() }; if ( this.options.values && this.options.values.length ) { uiHash.value = this.values( index ); uiHash.values = this.values(); } return this._trigger( "start", event, uiHash ); }, _slide: function( event, index, newVal ) { var otherVal, newValues, allowed; if ( this.options.values && this.options.values.length ) { otherVal = this.values( index ? 0 : 1 ); if ( ( this.options.values.length === 2 && this.options.range === true ) && ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) ) ) { newVal = otherVal; } if ( newVal !== this.values( index ) ) { newValues = this.values(); newValues[ index ] = newVal; // A slide can be canceled by returning false from the slide callback allowed = this._trigger( "slide", event, { handle: this.handles[ index ], value: newVal, values: newValues } ); otherVal = this.values( index ? 0 : 1 ); if ( allowed !== false ) { this.values( index, newVal ); } } } else { if ( newVal !== this.value() ) { // A slide can be canceled by returning false from the slide callback allowed = this._trigger( "slide", event, { handle: this.handles[ index ], value: newVal } ); if ( allowed !== false ) { this.value( newVal ); } } } }, _stop: function( event, index ) { var uiHash = { handle: this.handles[ index ], value: this.value() }; if ( this.options.values && this.options.values.length ) { uiHash.value = this.values( index ); uiHash.values = this.values(); } this._trigger( "stop", event, uiHash ); }, _change: function( event, index ) { if ( !this._keySliding && !this._mouseSliding ) { var uiHash = { handle: this.handles[ index ], value: this.value() }; if ( this.options.values && this.options.values.length ) { uiHash.value = this.values( index ); uiHash.values = this.values(); } //store the last changed value index for reference when handles overlap this._lastChangedValue = index; this._trigger( "change", event, uiHash ); } }, value: function( newValue ) { if ( arguments.length ) { this.options.value = this._trimAlignValue( newValue ); this._refreshValue(); this._change( null, 0 ); return; } return this._value(); }, values: function( index, newValue ) { var vals, newValues, i; if ( arguments.length > 1 ) { this.options.values[ index ] = this._trimAlignValue( newValue ); this._refreshValue(); this._change( null, index ); return; } if ( arguments.length ) { if ( $.isArray( arguments[ 0 ] ) ) { vals = this.options.values; newValues = arguments[ 0 ]; for ( i = 0; i < vals.length; i += 1 ) { vals[ i ] = this._trimAlignValue( newValues[ i ] ); this._change( null, i ); } this._refreshValue(); } else { if ( this.options.values && this.options.values.length ) { return this._values( index ); } else { return this.value(); } } } else { return this._values(); } }, _setOption: function( key, value ) { var i, valsLength = 0; if ( key === "range" && this.options.range === true ) { if ( value === "min" ) { this.options.value = this._values( 0 ); this.options.values = null; } else if ( value === "max" ) { this.options.value = this._values( this.options.values.length - 1 ); this.options.values = null; } } if ( $.isArray( this.options.values ) ) { valsLength = this.options.values.length; } if ( key === "disabled" ) { this.element.toggleClass( "ui-state-disabled", !!value ); } this._super( key, value ); switch ( key ) { case "orientation": this._detectOrientation(); this.element .removeClass( "ui-slider-horizontal ui-slider-vertical" ) .addClass( "ui-slider-" + this.orientation ); this._refreshValue(); // Reset positioning from previous orientation this.handles.css( value === "horizontal" ? "bottom" : "left", "" ); break; case "value": this._animateOff = true; this._refreshValue(); this._change( null, 0 ); this._animateOff = false; break; case "values": this._animateOff = true; this._refreshValue(); for ( i = 0; i < valsLength; i += 1 ) { this._change( null, i ); } this._animateOff = false; break; case "min": case "max": this._animateOff = true; this._refreshValue(); this._animateOff = false; break; case "range": this._animateOff = true; this._refresh(); this._animateOff = false; break; } }, //internal value getter // _value() returns value trimmed by min and max, aligned by step _value: function() { var val = this.options.value; val = this._trimAlignValue( val ); return val; }, //internal values getter // _values() returns array of values trimmed by min and max, aligned by step // _values( index ) returns single value trimmed by min and max, aligned by step _values: function( index ) { var val, vals, i; if ( arguments.length ) { val = this.options.values[ index ]; val = this._trimAlignValue( val ); return val; } else if ( this.options.values && this.options.values.length ) { // .slice() creates a copy of the array // this copy gets trimmed by min and max and then returned vals = this.options.values.slice(); for ( i = 0; i < vals.length; i+= 1) { vals[ i ] = this._trimAlignValue( vals[ i ] ); } return vals; } else { return []; } }, // returns the step-aligned value that val is closest to, between (inclusive) min and max _trimAlignValue: function( val ) { if ( val <= this._valueMin() ) { return this._valueMin(); } if ( val >= this._valueMax() ) { return this._valueMax(); } var step = ( this.options.step > 0 ) ? this.options.step : 1, valModStep = (val - this._valueMin()) % step, alignValue = val - valModStep; if ( Math.abs(valModStep) * 2 >= step ) { alignValue += ( valModStep > 0 ) ? step : ( -step ); } // Since JavaScript has problems with large floats, round // the final value to 5 digits after the decimal point (see #4124) return parseFloat( alignValue.toFixed(5) ); }, _valueMin: function() { return this.options.min; }, _valueMax: function() { return this.options.max; }, _refreshValue: function() { var lastValPercent, valPercent, value, valueMin, valueMax, oRange = this.options.range, o = this.options, that = this, animate = ( !this._animateOff ) ? o.animate : false, _set = {}; if ( this.options.values && this.options.values.length ) { this.handles.each(function( i ) { valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100; _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); if ( that.options.range === true ) { if ( that.orientation === "horizontal" ) { if ( i === 0 ) { that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate ); } if ( i === 1 ) { that.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); } } else { if ( i === 0 ) { that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate ); } if ( i === 1 ) { that.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } ); } } } lastValPercent = valPercent; }); } else { value = this.value(); valueMin = this._valueMin(); valueMax = this._valueMax(); valPercent = ( valueMax !== valueMin ) ? ( value - valueMin ) / ( valueMax - valueMin ) * 100 : 0; _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%"; this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate ); if ( oRange === "min" && this.orientation === "horizontal" ) { this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate ); } if ( oRange === "max" && this.orientation === "horizontal" ) { this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); } if ( oRange === "min" && this.orientation === "vertical" ) { this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate ); } if ( oRange === "max" && this.orientation === "vertical" ) { this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } ); } } }, _handleEvents: { keydown: function( event ) { var allowed, curVal, newVal, step, index = $( event.target ).data( "ui-slider-handle-index" ); switch ( event.keyCode ) { case $.ui.keyCode.HOME: case $.ui.keyCode.END: case $.ui.keyCode.PAGE_UP: case $.ui.keyCode.PAGE_DOWN: case $.ui.keyCode.UP: case $.ui.keyCode.RIGHT: case $.ui.keyCode.DOWN: case $.ui.keyCode.LEFT: event.preventDefault(); if ( !this._keySliding ) { this._keySliding = true; $( event.target ).addClass( "ui-state-active" ); allowed = this._start( event, index ); if ( allowed === false ) { return; } } break; } step = this.options.step; if ( this.options.values && this.options.values.length ) { curVal = newVal = this.values( index ); } else { curVal = newVal = this.value(); } switch ( event.keyCode ) { case $.ui.keyCode.HOME: newVal = this._valueMin(); break; case $.ui.keyCode.END: newVal = this._valueMax(); break; case $.ui.keyCode.PAGE_UP: newVal = this._trimAlignValue( curVal + ( ( this._valueMax() - this._valueMin() ) / this.numPages ) ); break; case $.ui.keyCode.PAGE_DOWN: newVal = this._trimAlignValue( curVal - ( (this._valueMax() - this._valueMin()) / this.numPages ) ); break; case $.ui.keyCode.UP: case $.ui.keyCode.RIGHT: if ( curVal === this._valueMax() ) { return; } newVal = this._trimAlignValue( curVal + step ); break; case $.ui.keyCode.DOWN: case $.ui.keyCode.LEFT: if ( curVal === this._valueMin() ) { return; } newVal = this._trimAlignValue( curVal - step ); break; } this._slide( event, index, newVal ); }, keyup: function( event ) { var index = $( event.target ).data( "ui-slider-handle-index" ); if ( this._keySliding ) { this._keySliding = false; this._stop( event, index ); this._change( event, index ); $( event.target ).removeClass( "ui-state-active" ); } } } }); /*! * jQuery UI Spinner 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/spinner/ */ function spinner_modifier( fn ) { return function() { var previous = this.element.val(); fn.apply( this, arguments ); this._refresh(); if ( previous !== this.element.val() ) { this._trigger( "change" ); } }; } var spinner = $.widget( "ui.spinner", { version: "1.11.1", defaultElement: "<input>", widgetEventPrefix: "spin", options: { culture: null, icons: { down: "ui-icon-triangle-1-s", up: "ui-icon-triangle-1-n" }, incremental: true, max: null, min: null, numberFormat: null, page: 10, step: 1, change: null, spin: null, start: null, stop: null }, _create: function() { // handle string values that need to be parsed this._setOption( "max", this.options.max ); this._setOption( "min", this.options.min ); this._setOption( "step", this.options.step ); // Only format if there is a value, prevents the field from being marked // as invalid in Firefox, see #9573. if ( this.value() !== "" ) { // Format the value, but don't constrain. this._value( this.element.val(), true ); } this._draw(); this._on( this._events ); this._refresh(); // turning off autocomplete prevents the browser from remembering the // value when navigating through history, so we re-enable autocomplete // if the page is unloaded before the widget is destroyed. #7790 this._on( this.window, { beforeunload: function() { this.element.removeAttr( "autocomplete" ); } }); }, _getCreateOptions: function() { var options = {}, element = this.element; $.each( [ "min", "max", "step" ], function( i, option ) { var value = element.attr( option ); if ( value !== undefined && value.length ) { options[ option ] = value; } }); return options; }, _events: { keydown: function( event ) { if ( this._start( event ) && this._keydown( event ) ) { event.preventDefault(); } }, keyup: "_stop", focus: function() { this.previous = this.element.val(); }, blur: function( event ) { if ( this.cancelBlur ) { delete this.cancelBlur; return; } this._stop(); this._refresh(); if ( this.previous !== this.element.val() ) { this._trigger( "change", event ); } }, mousewheel: function( event, delta ) { if ( !delta ) { return; } if ( !this.spinning && !this._start( event ) ) { return false; } this._spin( (delta > 0 ? 1 : -1) * this.options.step, event ); clearTimeout( this.mousewheelTimer ); this.mousewheelTimer = this._delay(function() { if ( this.spinning ) { this._stop( event ); } }, 100 ); event.preventDefault(); }, "mousedown .ui-spinner-button": function( event ) { var previous; // We never want the buttons to have focus; whenever the user is // interacting with the spinner, the focus should be on the input. // If the input is focused then this.previous is properly set from // when the input first received focus. If the input is not focused // then we need to set this.previous based on the value before spinning. previous = this.element[0] === this.document[0].activeElement ? this.previous : this.element.val(); function checkFocus() { var isActive = this.element[0] === this.document[0].activeElement; if ( !isActive ) { this.element.focus(); this.previous = previous; // support: IE // IE sets focus asynchronously, so we need to check if focus // moved off of the input because the user clicked on the button. this._delay(function() { this.previous = previous; }); } } // ensure focus is on (or stays on) the text field event.preventDefault(); checkFocus.call( this ); // support: IE // IE doesn't prevent moving focus even with event.preventDefault() // so we set a flag to know when we should ignore the blur event // and check (again) if focus moved off of the input. this.cancelBlur = true; this._delay(function() { delete this.cancelBlur; checkFocus.call( this ); }); if ( this._start( event ) === false ) { return; } this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event ); }, "mouseup .ui-spinner-button": "_stop", "mouseenter .ui-spinner-button": function( event ) { // button will add ui-state-active if mouse was down while mouseleave and kept down if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) { return; } if ( this._start( event ) === false ) { return false; } this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event ); }, // TODO: do we really want to consider this a stop? // shouldn't we just stop the repeater and wait until mouseup before // we trigger the stop event? "mouseleave .ui-spinner-button": "_stop" }, _draw: function() { var uiSpinner = this.uiSpinner = this.element .addClass( "ui-spinner-input" ) .attr( "autocomplete", "off" ) .wrap( this._uiSpinnerHtml() ) .parent() // add buttons .append( this._buttonHtml() ); this.element.attr( "role", "spinbutton" ); // button bindings this.buttons = uiSpinner.find( ".ui-spinner-button" ) .attr( "tabIndex", -1 ) .button() .removeClass( "ui-corner-all" ); // IE 6 doesn't understand height: 50% for the buttons // unless the wrapper has an explicit height if ( this.buttons.height() > Math.ceil( uiSpinner.height() * 0.5 ) && uiSpinner.height() > 0 ) { uiSpinner.height( uiSpinner.height() ); } // disable spinner if element was already disabled if ( this.options.disabled ) { this.disable(); } }, _keydown: function( event ) { var options = this.options, keyCode = $.ui.keyCode; switch ( event.keyCode ) { case keyCode.UP: this._repeat( null, 1, event ); return true; case keyCode.DOWN: this._repeat( null, -1, event ); return true; case keyCode.PAGE_UP: this._repeat( null, options.page, event ); return true; case keyCode.PAGE_DOWN: this._repeat( null, -options.page, event ); return true; } return false; }, _uiSpinnerHtml: function() { return "<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"; }, _buttonHtml: function() { return "" + "<a class='ui-spinner-button ui-spinner-up ui-corner-tr'>" + "<span class='ui-icon " + this.options.icons.up + "'>&#9650;</span>" + "</a>" + "<a class='ui-spinner-button ui-spinner-down ui-corner-br'>" + "<span class='ui-icon " + this.options.icons.down + "'>&#9660;</span>" + "</a>"; }, _start: function( event ) { if ( !this.spinning && this._trigger( "start", event ) === false ) { return false; } if ( !this.counter ) { this.counter = 1; } this.spinning = true; return true; }, _repeat: function( i, steps, event ) { i = i || 500; clearTimeout( this.timer ); this.timer = this._delay(function() { this._repeat( 40, steps, event ); }, i ); this._spin( steps * this.options.step, event ); }, _spin: function( step, event ) { var value = this.value() || 0; if ( !this.counter ) { this.counter = 1; } value = this._adjustValue( value + step * this._increment( this.counter ) ); if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false) { this._value( value ); this.counter++; } }, _increment: function( i ) { var incremental = this.options.incremental; if ( incremental ) { return $.isFunction( incremental ) ? incremental( i ) : Math.floor( i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1 ); } return 1; }, _precision: function() { var precision = this._precisionOf( this.options.step ); if ( this.options.min !== null ) { precision = Math.max( precision, this._precisionOf( this.options.min ) ); } return precision; }, _precisionOf: function( num ) { var str = num.toString(), decimal = str.indexOf( "." ); return decimal === -1 ? 0 : str.length - decimal - 1; }, _adjustValue: function( value ) { var base, aboveMin, options = this.options; // make sure we're at a valid step // - find out where we are relative to the base (min or 0) base = options.min !== null ? options.min : 0; aboveMin = value - base; // - round to the nearest step aboveMin = Math.round(aboveMin / options.step) * options.step; // - rounding is based on 0, so adjust back to our base value = base + aboveMin; // fix precision from bad JS floating point math value = parseFloat( value.toFixed( this._precision() ) ); // clamp the value if ( options.max !== null && value > options.max) { return options.max; } if ( options.min !== null && value < options.min ) { return options.min; } return value; }, _stop: function( event ) { if ( !this.spinning ) { return; } clearTimeout( this.timer ); clearTimeout( this.mousewheelTimer ); this.counter = 0; this.spinning = false; this._trigger( "stop", event ); }, _setOption: function( key, value ) { if ( key === "culture" || key === "numberFormat" ) { var prevValue = this._parse( this.element.val() ); this.options[ key ] = value; this.element.val( this._format( prevValue ) ); return; } if ( key === "max" || key === "min" || key === "step" ) { if ( typeof value === "string" ) { value = this._parse( value ); } } if ( key === "icons" ) { this.buttons.first().find( ".ui-icon" ) .removeClass( this.options.icons.up ) .addClass( value.up ); this.buttons.last().find( ".ui-icon" ) .removeClass( this.options.icons.down ) .addClass( value.down ); } this._super( key, value ); if ( key === "disabled" ) { this.widget().toggleClass( "ui-state-disabled", !!value ); this.element.prop( "disabled", !!value ); this.buttons.button( value ? "disable" : "enable" ); } }, _setOptions: spinner_modifier(function( options ) { this._super( options ); }), _parse: function( val ) { if ( typeof val === "string" && val !== "" ) { val = window.Globalize && this.options.numberFormat ? Globalize.parseFloat( val, 10, this.options.culture ) : +val; } return val === "" || isNaN( val ) ? null : val; }, _format: function( value ) { if ( value === "" ) { return ""; } return window.Globalize && this.options.numberFormat ? Globalize.format( value, this.options.numberFormat, this.options.culture ) : value; }, _refresh: function() { this.element.attr({ "aria-valuemin": this.options.min, "aria-valuemax": this.options.max, // TODO: what should we do with values that can't be parsed? "aria-valuenow": this._parse( this.element.val() ) }); }, isValid: function() { var value = this.value(); // null is invalid if ( value === null ) { return false; } // if value gets adjusted, it's invalid return value === this._adjustValue( value ); }, // update the value without triggering change _value: function( value, allowAny ) { var parsed; if ( value !== "" ) { parsed = this._parse( value ); if ( parsed !== null ) { if ( !allowAny ) { parsed = this._adjustValue( parsed ); } value = this._format( parsed ); } } this.element.val( value ); this._refresh(); }, _destroy: function() { this.element .removeClass( "ui-spinner-input" ) .prop( "disabled", false ) .removeAttr( "autocomplete" ) .removeAttr( "role" ) .removeAttr( "aria-valuemin" ) .removeAttr( "aria-valuemax" ) .removeAttr( "aria-valuenow" ); this.uiSpinner.replaceWith( this.element ); }, stepUp: spinner_modifier(function( steps ) { this._stepUp( steps ); }), _stepUp: function( steps ) { if ( this._start() ) { this._spin( (steps || 1) * this.options.step ); this._stop(); } }, stepDown: spinner_modifier(function( steps ) { this._stepDown( steps ); }), _stepDown: function( steps ) { if ( this._start() ) { this._spin( (steps || 1) * -this.options.step ); this._stop(); } }, pageUp: spinner_modifier(function( pages ) { this._stepUp( (pages || 1) * this.options.page ); }), pageDown: spinner_modifier(function( pages ) { this._stepDown( (pages || 1) * this.options.page ); }), value: function( newVal ) { if ( !arguments.length ) { return this._parse( this.element.val() ); } spinner_modifier( this._value ).call( this, newVal ); }, widget: function() { return this.uiSpinner; } }); /*! * jQuery UI Tabs 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/tabs/ */ var tabs = $.widget( "ui.tabs", { version: "1.11.1", delay: 300, options: { active: null, collapsible: false, event: "click", heightStyle: "content", hide: null, show: null, // callbacks activate: null, beforeActivate: null, beforeLoad: null, load: null }, _isLocal: (function() { var rhash = /#.*$/; return function( anchor ) { var anchorUrl, locationUrl; // support: IE7 // IE7 doesn't normalize the href property when set via script (#9317) anchor = anchor.cloneNode( false ); anchorUrl = anchor.href.replace( rhash, "" ); locationUrl = location.href.replace( rhash, "" ); // decoding may throw an error if the URL isn't UTF-8 (#9518) try { anchorUrl = decodeURIComponent( anchorUrl ); } catch ( error ) {} try { locationUrl = decodeURIComponent( locationUrl ); } catch ( error ) {} return anchor.hash.length > 1 && anchorUrl === locationUrl; }; })(), _create: function() { var that = this, options = this.options; this.running = false; this.element .addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" ) .toggleClass( "ui-tabs-collapsible", options.collapsible ); this._processTabs(); options.active = this._initialActive(); // Take disabling tabs via class attribute from HTML // into account and update option properly. if ( $.isArray( options.disabled ) ) { options.disabled = $.unique( options.disabled.concat( $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) { return that.tabs.index( li ); }) ) ).sort(); } // check for length avoids error when initializing empty list if ( this.options.active !== false && this.anchors.length ) { this.active = this._findActive( options.active ); } else { this.active = $(); } this._refresh(); if ( this.active.length ) { this.load( options.active ); } }, _initialActive: function() { var active = this.options.active, collapsible = this.options.collapsible, locationHash = location.hash.substring( 1 ); if ( active === null ) { // check the fragment identifier in the URL if ( locationHash ) { this.tabs.each(function( i, tab ) { if ( $( tab ).attr( "aria-controls" ) === locationHash ) { active = i; return false; } }); } // check for a tab marked active via a class if ( active === null ) { active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) ); } // no active tab, set to false if ( active === null || active === -1 ) { active = this.tabs.length ? 0 : false; } } // handle numbers: negative, out of range if ( active !== false ) { active = this.tabs.index( this.tabs.eq( active ) ); if ( active === -1 ) { active = collapsible ? false : 0; } } // don't allow collapsible: false and active: false if ( !collapsible && active === false && this.anchors.length ) { active = 0; } return active; }, _getCreateEventData: function() { return { tab: this.active, panel: !this.active.length ? $() : this._getPanelForTab( this.active ) }; }, _tabKeydown: function( event ) { var focusedTab = $( this.document[0].activeElement ).closest( "li" ), selectedIndex = this.tabs.index( focusedTab ), goingForward = true; if ( this._handlePageNav( event ) ) { return; } switch ( event.keyCode ) { case $.ui.keyCode.RIGHT: case $.ui.keyCode.DOWN: selectedIndex++; break; case $.ui.keyCode.UP: case $.ui.keyCode.LEFT: goingForward = false; selectedIndex--; break; case $.ui.keyCode.END: selectedIndex = this.anchors.length - 1; break; case $.ui.keyCode.HOME: selectedIndex = 0; break; case $.ui.keyCode.SPACE: // Activate only, no collapsing event.preventDefault(); clearTimeout( this.activating ); this._activate( selectedIndex ); return; case $.ui.keyCode.ENTER: // Toggle (cancel delayed activation, allow collapsing) event.preventDefault(); clearTimeout( this.activating ); // Determine if we should collapse or activate this._activate( selectedIndex === this.options.active ? false : selectedIndex ); return; default: return; } // Focus the appropriate tab, based on which key was pressed event.preventDefault(); clearTimeout( this.activating ); selectedIndex = this._focusNextTab( selectedIndex, goingForward ); // Navigating with control key will prevent automatic activation if ( !event.ctrlKey ) { // Update aria-selected immediately so that AT think the tab is already selected. // Otherwise AT may confuse the user by stating that they need to activate the tab, // but the tab will already be activated by the time the announcement finishes. focusedTab.attr( "aria-selected", "false" ); this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" ); this.activating = this._delay(function() { this.option( "active", selectedIndex ); }, this.delay ); } }, _panelKeydown: function( event ) { if ( this._handlePageNav( event ) ) { return; } // Ctrl+up moves focus to the current tab if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) { event.preventDefault(); this.active.focus(); } }, // Alt+page up/down moves focus to the previous/next tab (and activates) _handlePageNav: function( event ) { if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) { this._activate( this._focusNextTab( this.options.active - 1, false ) ); return true; } if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) { this._activate( this._focusNextTab( this.options.active + 1, true ) ); return true; } }, _findNextTab: function( index, goingForward ) { var lastTabIndex = this.tabs.length - 1; function constrain() { if ( index > lastTabIndex ) { index = 0; } if ( index < 0 ) { index = lastTabIndex; } return index; } while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) { index = goingForward ? index + 1 : index - 1; } return index; }, _focusNextTab: function( index, goingForward ) { index = this._findNextTab( index, goingForward ); this.tabs.eq( index ).focus(); return index; }, _setOption: function( key, value ) { if ( key === "active" ) { // _activate() will handle invalid values and update this.options this._activate( value ); return; } if ( key === "disabled" ) { // don't use the widget factory's disabled handling this._setupDisabled( value ); return; } this._super( key, value); if ( key === "collapsible" ) { this.element.toggleClass( "ui-tabs-collapsible", value ); // Setting collapsible: false while collapsed; open first panel if ( !value && this.options.active === false ) { this._activate( 0 ); } } if ( key === "event" ) { this._setupEvents( value ); } if ( key === "heightStyle" ) { this._setupHeightStyle( value ); } }, _sanitizeSelector: function( hash ) { return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : ""; }, refresh: function() { var options = this.options, lis = this.tablist.children( ":has(a[href])" ); // get disabled tabs from class attribute from HTML // this will get converted to a boolean if needed in _refresh() options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) { return lis.index( tab ); }); this._processTabs(); // was collapsed or no tabs if ( options.active === false || !this.anchors.length ) { options.active = false; this.active = $(); // was active, but active tab is gone } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) { // all remaining tabs are disabled if ( this.tabs.length === options.disabled.length ) { options.active = false; this.active = $(); // activate previous tab } else { this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) ); } // was active, active tab still exists } else { // make sure active index is correct options.active = this.tabs.index( this.active ); } this._refresh(); }, _refresh: function() { this._setupDisabled( this.options.disabled ); this._setupEvents( this.options.event ); this._setupHeightStyle( this.options.heightStyle ); this.tabs.not( this.active ).attr({ "aria-selected": "false", "aria-expanded": "false", tabIndex: -1 }); this.panels.not( this._getPanelForTab( this.active ) ) .hide() .attr({ "aria-hidden": "true" }); // Make sure one tab is in the tab order if ( !this.active.length ) { this.tabs.eq( 0 ).attr( "tabIndex", 0 ); } else { this.active .addClass( "ui-tabs-active ui-state-active" ) .attr({ "aria-selected": "true", "aria-expanded": "true", tabIndex: 0 }); this._getPanelForTab( this.active ) .show() .attr({ "aria-hidden": "false" }); } }, _processTabs: function() { var that = this; this.tablist = this._getList() .addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ) .attr( "role", "tablist" ) // Prevent users from focusing disabled tabs via click .delegate( "> li", "mousedown" + this.eventNamespace, function( event ) { if ( $( this ).is( ".ui-state-disabled" ) ) { event.preventDefault(); } }) // support: IE <9 // Preventing the default action in mousedown doesn't prevent IE // from focusing the element, so if the anchor gets focused, blur. // We don't have to worry about focusing the previously focused // element since clicking on a non-focusable element should focus // the body anyway. .delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() { if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) { this.blur(); } }); this.tabs = this.tablist.find( "> li:has(a[href])" ) .addClass( "ui-state-default ui-corner-top" ) .attr({ role: "tab", tabIndex: -1 }); this.anchors = this.tabs.map(function() { return $( "a", this )[ 0 ]; }) .addClass( "ui-tabs-anchor" ) .attr({ role: "presentation", tabIndex: -1 }); this.panels = $(); this.anchors.each(function( i, anchor ) { var selector, panel, panelId, anchorId = $( anchor ).uniqueId().attr( "id" ), tab = $( anchor ).closest( "li" ), originalAriaControls = tab.attr( "aria-controls" ); // inline tab if ( that._isLocal( anchor ) ) { selector = anchor.hash; panelId = selector.substring( 1 ); panel = that.element.find( that._sanitizeSelector( selector ) ); // remote tab } else { // If the tab doesn't already have aria-controls, // generate an id by using a throw-away element panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id; selector = "#" + panelId; panel = that.element.find( selector ); if ( !panel.length ) { panel = that._createPanel( panelId ); panel.insertAfter( that.panels[ i - 1 ] || that.tablist ); } panel.attr( "aria-live", "polite" ); } if ( panel.length) { that.panels = that.panels.add( panel ); } if ( originalAriaControls ) { tab.data( "ui-tabs-aria-controls", originalAriaControls ); } tab.attr({ "aria-controls": panelId, "aria-labelledby": anchorId }); panel.attr( "aria-labelledby", anchorId ); }); this.panels .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) .attr( "role", "tabpanel" ); }, // allow overriding how to find the list for rare usage scenarios (#7715) _getList: function() { return this.tablist || this.element.find( "ol,ul" ).eq( 0 ); }, _createPanel: function( id ) { return $( "<div>" ) .attr( "id", id ) .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) .data( "ui-tabs-destroy", true ); }, _setupDisabled: function( disabled ) { if ( $.isArray( disabled ) ) { if ( !disabled.length ) { disabled = false; } else if ( disabled.length === this.anchors.length ) { disabled = true; } } // disable tabs for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) { if ( disabled === true || $.inArray( i, disabled ) !== -1 ) { $( li ) .addClass( "ui-state-disabled" ) .attr( "aria-disabled", "true" ); } else { $( li ) .removeClass( "ui-state-disabled" ) .removeAttr( "aria-disabled" ); } } this.options.disabled = disabled; }, _setupEvents: function( event ) { var events = {}; if ( event ) { $.each( event.split(" "), function( index, eventName ) { events[ eventName ] = "_eventHandler"; }); } this._off( this.anchors.add( this.tabs ).add( this.panels ) ); // Always prevent the default action, even when disabled this._on( true, this.anchors, { click: function( event ) { event.preventDefault(); } }); this._on( this.anchors, events ); this._on( this.tabs, { keydown: "_tabKeydown" } ); this._on( this.panels, { keydown: "_panelKeydown" } ); this._focusable( this.tabs ); this._hoverable( this.tabs ); }, _setupHeightStyle: function( heightStyle ) { var maxHeight, parent = this.element.parent(); if ( heightStyle === "fill" ) { maxHeight = parent.height(); maxHeight -= this.element.outerHeight() - this.element.height(); this.element.siblings( ":visible" ).each(function() { var elem = $( this ), position = elem.css( "position" ); if ( position === "absolute" || position === "fixed" ) { return; } maxHeight -= elem.outerHeight( true ); }); this.element.children().not( this.panels ).each(function() { maxHeight -= $( this ).outerHeight( true ); }); this.panels.each(function() { $( this ).height( Math.max( 0, maxHeight - $( this ).innerHeight() + $( this ).height() ) ); }) .css( "overflow", "auto" ); } else if ( heightStyle === "auto" ) { maxHeight = 0; this.panels.each(function() { maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); }).height( maxHeight ); } }, _eventHandler: function( event ) { var options = this.options, active = this.active, anchor = $( event.currentTarget ), tab = anchor.closest( "li" ), clickedIsActive = tab[ 0 ] === active[ 0 ], collapsing = clickedIsActive && options.collapsible, toShow = collapsing ? $() : this._getPanelForTab( tab ), toHide = !active.length ? $() : this._getPanelForTab( active ), eventData = { oldTab: active, oldPanel: toHide, newTab: collapsing ? $() : tab, newPanel: toShow }; event.preventDefault(); if ( tab.hasClass( "ui-state-disabled" ) || // tab is already loading tab.hasClass( "ui-tabs-loading" ) || // can't switch durning an animation this.running || // click on active header, but not collapsible ( clickedIsActive && !options.collapsible ) || // allow canceling activation ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { return; } options.active = collapsing ? false : this.tabs.index( tab ); this.active = clickedIsActive ? $() : tab; if ( this.xhr ) { this.xhr.abort(); } if ( !toHide.length && !toShow.length ) { $.error( "jQuery UI Tabs: Mismatching fragment identifier." ); } if ( toShow.length ) { this.load( this.tabs.index( tab ), event ); } this._toggle( event, eventData ); }, // handles show/hide for selecting tabs _toggle: function( event, eventData ) { var that = this, toShow = eventData.newPanel, toHide = eventData.oldPanel; this.running = true; function complete() { that.running = false; that._trigger( "activate", event, eventData ); } function show() { eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" ); if ( toShow.length && that.options.show ) { that._show( toShow, that.options.show, complete ); } else { toShow.show(); complete(); } } // start out by hiding, then showing, then completing if ( toHide.length && this.options.hide ) { this._hide( toHide, this.options.hide, function() { eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); show(); }); } else { eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" ); toHide.hide(); show(); } toHide.attr( "aria-hidden", "true" ); eventData.oldTab.attr({ "aria-selected": "false", "aria-expanded": "false" }); // If we're switching tabs, remove the old tab from the tab order. // If we're opening from collapsed state, remove the previous tab from the tab order. // If we're collapsing, then keep the collapsing tab in the tab order. if ( toShow.length && toHide.length ) { eventData.oldTab.attr( "tabIndex", -1 ); } else if ( toShow.length ) { this.tabs.filter(function() { return $( this ).attr( "tabIndex" ) === 0; }) .attr( "tabIndex", -1 ); } toShow.attr( "aria-hidden", "false" ); eventData.newTab.attr({ "aria-selected": "true", "aria-expanded": "true", tabIndex: 0 }); }, _activate: function( index ) { var anchor, active = this._findActive( index ); // trying to activate the already active panel if ( active[ 0 ] === this.active[ 0 ] ) { return; } // trying to collapse, simulate a click on the current active header if ( !active.length ) { active = this.active; } anchor = active.find( ".ui-tabs-anchor" )[ 0 ]; this._eventHandler({ target: anchor, currentTarget: anchor, preventDefault: $.noop }); }, _findActive: function( index ) { return index === false ? $() : this.tabs.eq( index ); }, _getIndex: function( index ) { // meta-function to give users option to provide a href string instead of a numerical index. if ( typeof index === "string" ) { index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) ); } return index; }, _destroy: function() { if ( this.xhr ) { this.xhr.abort(); } this.element.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" ); this.tablist .removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" ) .removeAttr( "role" ); this.anchors .removeClass( "ui-tabs-anchor" ) .removeAttr( "role" ) .removeAttr( "tabIndex" ) .removeUniqueId(); this.tablist.unbind( this.eventNamespace ); this.tabs.add( this.panels ).each(function() { if ( $.data( this, "ui-tabs-destroy" ) ) { $( this ).remove(); } else { $( this ) .removeClass( "ui-state-default ui-state-active ui-state-disabled " + "ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel" ) .removeAttr( "tabIndex" ) .removeAttr( "aria-live" ) .removeAttr( "aria-busy" ) .removeAttr( "aria-selected" ) .removeAttr( "aria-labelledby" ) .removeAttr( "aria-hidden" ) .removeAttr( "aria-expanded" ) .removeAttr( "role" ); } }); this.tabs.each(function() { var li = $( this ), prev = li.data( "ui-tabs-aria-controls" ); if ( prev ) { li .attr( "aria-controls", prev ) .removeData( "ui-tabs-aria-controls" ); } else { li.removeAttr( "aria-controls" ); } }); this.panels.show(); if ( this.options.heightStyle !== "content" ) { this.panels.css( "height", "" ); } }, enable: function( index ) { var disabled = this.options.disabled; if ( disabled === false ) { return; } if ( index === undefined ) { disabled = false; } else { index = this._getIndex( index ); if ( $.isArray( disabled ) ) { disabled = $.map( disabled, function( num ) { return num !== index ? num : null; }); } else { disabled = $.map( this.tabs, function( li, num ) { return num !== index ? num : null; }); } } this._setupDisabled( disabled ); }, disable: function( index ) { var disabled = this.options.disabled; if ( disabled === true ) { return; } if ( index === undefined ) { disabled = true; } else { index = this._getIndex( index ); if ( $.inArray( index, disabled ) !== -1 ) { return; } if ( $.isArray( disabled ) ) { disabled = $.merge( [ index ], disabled ).sort(); } else { disabled = [ index ]; } } this._setupDisabled( disabled ); }, load: function( index, event ) { index = this._getIndex( index ); var that = this, tab = this.tabs.eq( index ), anchor = tab.find( ".ui-tabs-anchor" ), panel = this._getPanelForTab( tab ), eventData = { tab: tab, panel: panel }; // not remote if ( this._isLocal( anchor[ 0 ] ) ) { return; } this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) ); // support: jQuery <1.8 // jQuery <1.8 returns false if the request is canceled in beforeSend, // but as of 1.8, $.ajax() always returns a jqXHR object. if ( this.xhr && this.xhr.statusText !== "canceled" ) { tab.addClass( "ui-tabs-loading" ); panel.attr( "aria-busy", "true" ); this.xhr .success(function( response ) { // support: jQuery <1.8 // http://bugs.jquery.com/ticket/11778 setTimeout(function() { panel.html( response ); that._trigger( "load", event, eventData ); }, 1 ); }) .complete(function( jqXHR, status ) { // support: jQuery <1.8 // http://bugs.jquery.com/ticket/11778 setTimeout(function() { if ( status === "abort" ) { that.panels.stop( false, true ); } tab.removeClass( "ui-tabs-loading" ); panel.removeAttr( "aria-busy" ); if ( jqXHR === that.xhr ) { delete that.xhr; } }, 1 ); }); } }, _ajaxSettings: function( anchor, event, eventData ) { var that = this; return { url: anchor.attr( "href" ), beforeSend: function( jqXHR, settings ) { return that._trigger( "beforeLoad", event, $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) ); } }; }, _getPanelForTab: function( tab ) { var id = $( tab ).attr( "aria-controls" ); return this.element.find( this._sanitizeSelector( "#" + id ) ); } }); /*! * jQuery UI Tooltip 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/tooltip/ */ var tooltip = $.widget( "ui.tooltip", { version: "1.11.1", options: { content: function() { // support: IE<9, Opera in jQuery <1.7 // .text() can't accept undefined, so coerce to a string var title = $( this ).attr( "title" ) || ""; // Escape title, since we're going from an attribute to raw HTML return $( "<a>" ).text( title ).html(); }, hide: true, // Disabled elements have inconsistent behavior across browsers (#8661) items: "[title]:not([disabled])", position: { my: "left top+15", at: "left bottom", collision: "flipfit flip" }, show: true, tooltipClass: null, track: false, // callbacks close: null, open: null }, _addDescribedBy: function( elem, id ) { var describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ); describedby.push( id ); elem .data( "ui-tooltip-id", id ) .attr( "aria-describedby", $.trim( describedby.join( " " ) ) ); }, _removeDescribedBy: function( elem ) { var id = elem.data( "ui-tooltip-id" ), describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ), index = $.inArray( id, describedby ); if ( index !== -1 ) { describedby.splice( index, 1 ); } elem.removeData( "ui-tooltip-id" ); describedby = $.trim( describedby.join( " " ) ); if ( describedby ) { elem.attr( "aria-describedby", describedby ); } else { elem.removeAttr( "aria-describedby" ); } }, _create: function() { this._on({ mouseover: "open", focusin: "open" }); // IDs of generated tooltips, needed for destroy this.tooltips = {}; // IDs of parent tooltips where we removed the title attribute this.parents = {}; if ( this.options.disabled ) { this._disable(); } // Append the aria-live region so tooltips announce correctly this.liveRegion = $( "<div>" ) .attr({ role: "log", "aria-live": "assertive", "aria-relevant": "additions" }) .addClass( "ui-helper-hidden-accessible" ) .appendTo( this.document[ 0 ].body ); }, _setOption: function( key, value ) { var that = this; if ( key === "disabled" ) { this[ value ? "_disable" : "_enable" ](); this.options[ key ] = value; // disable element style changes return; } this._super( key, value ); if ( key === "content" ) { $.each( this.tooltips, function( id, element ) { that._updateContent( element ); }); } }, _disable: function() { var that = this; // close open tooltips $.each( this.tooltips, function( id, element ) { var event = $.Event( "blur" ); event.target = event.currentTarget = element[0]; that.close( event, true ); }); // remove title attributes to prevent native tooltips this.element.find( this.options.items ).addBack().each(function() { var element = $( this ); if ( element.is( "[title]" ) ) { element .data( "ui-tooltip-title", element.attr( "title" ) ) .removeAttr( "title" ); } }); }, _enable: function() { // restore title attributes this.element.find( this.options.items ).addBack().each(function() { var element = $( this ); if ( element.data( "ui-tooltip-title" ) ) { element.attr( "title", element.data( "ui-tooltip-title" ) ); } }); }, open: function( event ) { var that = this, target = $( event ? event.target : this.element ) // we need closest here due to mouseover bubbling, // but always pointing at the same event target .closest( this.options.items ); // No element to show a tooltip for or the tooltip is already open if ( !target.length || target.data( "ui-tooltip-id" ) ) { return; } if ( target.attr( "title" ) ) { target.data( "ui-tooltip-title", target.attr( "title" ) ); } target.data( "ui-tooltip-open", true ); // kill parent tooltips, custom or native, for hover if ( event && event.type === "mouseover" ) { target.parents().each(function() { var parent = $( this ), blurEvent; if ( parent.data( "ui-tooltip-open" ) ) { blurEvent = $.Event( "blur" ); blurEvent.target = blurEvent.currentTarget = this; that.close( blurEvent, true ); } if ( parent.attr( "title" ) ) { parent.uniqueId(); that.parents[ this.id ] = { element: this, title: parent.attr( "title" ) }; parent.attr( "title", "" ); } }); } this._updateContent( target, event ); }, _updateContent: function( target, event ) { var content, contentOption = this.options.content, that = this, eventType = event ? event.type : null; if ( typeof contentOption === "string" ) { return this._open( event, target, contentOption ); } content = contentOption.call( target[0], function( response ) { // ignore async response if tooltip was closed already if ( !target.data( "ui-tooltip-open" ) ) { return; } // IE may instantly serve a cached response for ajax requests // delay this call to _open so the other call to _open runs first that._delay(function() { // jQuery creates a special event for focusin when it doesn't // exist natively. To improve performance, the native event // object is reused and the type is changed. Therefore, we can't // rely on the type being correct after the event finished // bubbling, so we set it back to the previous value. (#8740) if ( event ) { event.type = eventType; } this._open( event, target, response ); }); }); if ( content ) { this._open( event, target, content ); } }, _open: function( event, target, content ) { var tooltip, events, delayedShow, a11yContent, positionOption = $.extend( {}, this.options.position ); if ( !content ) { return; } // Content can be updated multiple times. If the tooltip already // exists, then just update the content and bail. tooltip = this._find( target ); if ( tooltip.length ) { tooltip.find( ".ui-tooltip-content" ).html( content ); return; } // if we have a title, clear it to prevent the native tooltip // we have to check first to avoid defining a title if none exists // (we don't want to cause an element to start matching [title]) // // We use removeAttr only for key events, to allow IE to export the correct // accessible attributes. For mouse events, set to empty string to avoid // native tooltip showing up (happens only when removing inside mouseover). if ( target.is( "[title]" ) ) { if ( event && event.type === "mouseover" ) { target.attr( "title", "" ); } else { target.removeAttr( "title" ); } } tooltip = this._tooltip( target ); this._addDescribedBy( target, tooltip.attr( "id" ) ); tooltip.find( ".ui-tooltip-content" ).html( content ); // Support: Voiceover on OS X, JAWS on IE <= 9 // JAWS announces deletions even when aria-relevant="additions" // Voiceover will sometimes re-read the entire log region's contents from the beginning this.liveRegion.children().hide(); if ( content.clone ) { a11yContent = content.clone(); a11yContent.removeAttr( "id" ).find( "[id]" ).removeAttr( "id" ); } else { a11yContent = content; } $( "<div>" ).html( a11yContent ).appendTo( this.liveRegion ); function position( event ) { positionOption.of = event; if ( tooltip.is( ":hidden" ) ) { return; } tooltip.position( positionOption ); } if ( this.options.track && event && /^mouse/.test( event.type ) ) { this._on( this.document, { mousemove: position }); // trigger once to override element-relative positioning position( event ); } else { tooltip.position( $.extend({ of: target }, this.options.position ) ); } this.hiding = false; this.closing = false; tooltip.hide(); this._show( tooltip, this.options.show ); // Handle tracking tooltips that are shown with a delay (#8644). As soon // as the tooltip is visible, position the tooltip using the most recent // event. if ( this.options.show && this.options.show.delay ) { delayedShow = this.delayedShow = setInterval(function() { if ( tooltip.is( ":visible" ) ) { position( positionOption.of ); clearInterval( delayedShow ); } }, $.fx.interval ); } this._trigger( "open", event, { tooltip: tooltip } ); events = { keyup: function( event ) { if ( event.keyCode === $.ui.keyCode.ESCAPE ) { var fakeEvent = $.Event(event); fakeEvent.currentTarget = target[0]; this.close( fakeEvent, true ); } } }; // Only bind remove handler for delegated targets. Non-delegated // tooltips will handle this in destroy. if ( target[ 0 ] !== this.element[ 0 ] ) { events.remove = function() { this._removeTooltip( tooltip ); }; } if ( !event || event.type === "mouseover" ) { events.mouseleave = "close"; } if ( !event || event.type === "focusin" ) { events.focusout = "close"; } this._on( true, target, events ); }, close: function( event ) { var that = this, target = $( event ? event.currentTarget : this.element ), tooltip = this._find( target ); // disabling closes the tooltip, so we need to track when we're closing // to avoid an infinite loop in case the tooltip becomes disabled on close if ( this.closing ) { return; } // Clear the interval for delayed tracking tooltips clearInterval( this.delayedShow ); // only set title if we had one before (see comment in _open()) // If the title attribute has changed since open(), don't restore if ( target.data( "ui-tooltip-title" ) && !target.attr( "title" ) ) { target.attr( "title", target.data( "ui-tooltip-title" ) ); } this._removeDescribedBy( target ); this.hiding = true; tooltip.stop( true ); this._hide( tooltip, this.options.hide, function() { that._removeTooltip( $( this ) ); this.hiding = false; this.closing = false; }); target.removeData( "ui-tooltip-open" ); this._off( target, "mouseleave focusout keyup" ); // Remove 'remove' binding only on delegated targets if ( target[ 0 ] !== this.element[ 0 ] ) { this._off( target, "remove" ); } this._off( this.document, "mousemove" ); if ( event && event.type === "mouseleave" ) { $.each( this.parents, function( id, parent ) { $( parent.element ).attr( "title", parent.title ); delete that.parents[ id ]; }); } this.closing = true; this._trigger( "close", event, { tooltip: tooltip } ); if ( !this.hiding ) { this.closing = false; } }, _tooltip: function( element ) { var tooltip = $( "<div>" ) .attr( "role", "tooltip" ) .addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " + ( this.options.tooltipClass || "" ) ), id = tooltip.uniqueId().attr( "id" ); $( "<div>" ) .addClass( "ui-tooltip-content" ) .appendTo( tooltip ); tooltip.appendTo( this.document[0].body ); this.tooltips[ id ] = element; return tooltip; }, _find: function( target ) { var id = target.data( "ui-tooltip-id" ); return id ? $( "#" + id ) : $(); }, _removeTooltip: function( tooltip ) { tooltip.remove(); delete this.tooltips[ tooltip.attr( "id" ) ]; }, _destroy: function() { var that = this; // close open tooltips $.each( this.tooltips, function( id, element ) { // Delegate to close method to handle common cleanup var event = $.Event( "blur" ); event.target = event.currentTarget = element[0]; that.close( event, true ); // Remove immediately; destroying an open tooltip doesn't use the // hide animation $( "#" + id ).remove(); // Restore the title if ( element.data( "ui-tooltip-title" ) ) { // If the title attribute has changed since open(), don't restore if ( !element.attr( "title" ) ) { element.attr( "title", element.data( "ui-tooltip-title" ) ); } element.removeData( "ui-tooltip-title" ); } }); this.liveRegion.remove(); } }); /*! * jQuery UI Effects 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/category/effects-core/ */ var dataSpace = "ui-effects-", // Create a local jQuery because jQuery Color relies on it and the // global may not exist with AMD and a custom build (#10199) jQuery = $; $.effects = { effect: {} }; /*! * jQuery Color Animations v2.1.2 * https://github.com/jquery/jquery-color * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * Date: Wed Jan 16 08:47:09 2013 -0600 */ (function( jQuery, undefined ) { var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", // plusequals test for += 100 -= 100 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, // a set of RE's that can match strings and generate color tuples. stringParsers = [ { re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, parse: function( execResult ) { return [ execResult[ 1 ], execResult[ 2 ], execResult[ 3 ], execResult[ 4 ] ]; } }, { re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, parse: function( execResult ) { return [ execResult[ 1 ] * 2.55, execResult[ 2 ] * 2.55, execResult[ 3 ] * 2.55, execResult[ 4 ] ]; } }, { // this regex ignores A-F because it's compared against an already lowercased string re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/, parse: function( execResult ) { return [ parseInt( execResult[ 1 ], 16 ), parseInt( execResult[ 2 ], 16 ), parseInt( execResult[ 3 ], 16 ) ]; } }, { // this regex ignores A-F because it's compared against an already lowercased string re: /#([a-f0-9])([a-f0-9])([a-f0-9])/, parse: function( execResult ) { return [ parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ) ]; } }, { re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, space: "hsla", parse: function( execResult ) { return [ execResult[ 1 ], execResult[ 2 ] / 100, execResult[ 3 ] / 100, execResult[ 4 ] ]; } } ], // jQuery.Color( ) color = jQuery.Color = function( color, green, blue, alpha ) { return new jQuery.Color.fn.parse( color, green, blue, alpha ); }, spaces = { rgba: { props: { red: { idx: 0, type: "byte" }, green: { idx: 1, type: "byte" }, blue: { idx: 2, type: "byte" } } }, hsla: { props: { hue: { idx: 0, type: "degrees" }, saturation: { idx: 1, type: "percent" }, lightness: { idx: 2, type: "percent" } } } }, propTypes = { "byte": { floor: true, max: 255 }, "percent": { max: 1 }, "degrees": { mod: 360, floor: true } }, support = color.support = {}, // element for support tests supportElem = jQuery( "<p>" )[ 0 ], // colors = jQuery.Color.names colors, // local aliases of functions called often each = jQuery.each; // determine rgba support immediately supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1; // define cache name and alpha properties // for rgba and hsla spaces each( spaces, function( spaceName, space ) { space.cache = "_" + spaceName; space.props.alpha = { idx: 3, type: "percent", def: 1 }; }); function clamp( value, prop, allowEmpty ) { var type = propTypes[ prop.type ] || {}; if ( value == null ) { return (allowEmpty || !prop.def) ? null : prop.def; } // ~~ is an short way of doing floor for positive numbers value = type.floor ? ~~value : parseFloat( value ); // IE will pass in empty strings as value for alpha, // which will hit this case if ( isNaN( value ) ) { return prop.def; } if ( type.mod ) { // we add mod before modding to make sure that negatives values // get converted properly: -10 -> 350 return (value + type.mod) % type.mod; } // for now all property types without mod have min and max return 0 > value ? 0 : type.max < value ? type.max : value; } function stringParse( string ) { var inst = color(), rgba = inst._rgba = []; string = string.toLowerCase(); each( stringParsers, function( i, parser ) { var parsed, match = parser.re.exec( string ), values = match && parser.parse( match ), spaceName = parser.space || "rgba"; if ( values ) { parsed = inst[ spaceName ]( values ); // if this was an rgba parse the assignment might happen twice // oh well.... inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ]; rgba = inst._rgba = parsed._rgba; // exit each( stringParsers ) here because we matched return false; } }); // Found a stringParser that handled it if ( rgba.length ) { // if this came from a parsed string, force "transparent" when alpha is 0 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) if ( rgba.join() === "0,0,0,0" ) { jQuery.extend( rgba, colors.transparent ); } return inst; } // named colors return colors[ string ]; } color.fn = jQuery.extend( color.prototype, { parse: function( red, green, blue, alpha ) { if ( red === undefined ) { this._rgba = [ null, null, null, null ]; return this; } if ( red.jquery || red.nodeType ) { red = jQuery( red ).css( green ); green = undefined; } var inst = this, type = jQuery.type( red ), rgba = this._rgba = []; // more than 1 argument specified - assume ( red, green, blue, alpha ) if ( green !== undefined ) { red = [ red, green, blue, alpha ]; type = "array"; } if ( type === "string" ) { return this.parse( stringParse( red ) || colors._default ); } if ( type === "array" ) { each( spaces.rgba.props, function( key, prop ) { rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); }); return this; } if ( type === "object" ) { if ( red instanceof color ) { each( spaces, function( spaceName, space ) { if ( red[ space.cache ] ) { inst[ space.cache ] = red[ space.cache ].slice(); } }); } else { each( spaces, function( spaceName, space ) { var cache = space.cache; each( space.props, function( key, prop ) { // if the cache doesn't exist, and we know how to convert if ( !inst[ cache ] && space.to ) { // if the value was null, we don't need to copy it // if the key was alpha, we don't need to copy it either if ( key === "alpha" || red[ key ] == null ) { return; } inst[ cache ] = space.to( inst._rgba ); } // this is the only case where we allow nulls for ALL properties. // call clamp with alwaysAllowEmpty inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); }); // everything defined but alpha? if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { // use the default of 1 inst[ cache ][ 3 ] = 1; if ( space.from ) { inst._rgba = space.from( inst[ cache ] ); } } }); } return this; } }, is: function( compare ) { var is = color( compare ), same = true, inst = this; each( spaces, function( _, space ) { var localCache, isCache = is[ space.cache ]; if (isCache) { localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || []; each( space.props, function( _, prop ) { if ( isCache[ prop.idx ] != null ) { same = ( isCache[ prop.idx ] === localCache[ prop.idx ] ); return same; } }); } return same; }); return same; }, _space: function() { var used = [], inst = this; each( spaces, function( spaceName, space ) { if ( inst[ space.cache ] ) { used.push( spaceName ); } }); return used.pop(); }, transition: function( other, distance ) { var end = color( other ), spaceName = end._space(), space = spaces[ spaceName ], startColor = this.alpha() === 0 ? color( "transparent" ) : this, start = startColor[ space.cache ] || space.to( startColor._rgba ), result = start.slice(); end = end[ space.cache ]; each( space.props, function( key, prop ) { var index = prop.idx, startValue = start[ index ], endValue = end[ index ], type = propTypes[ prop.type ] || {}; // if null, don't override start value if ( endValue === null ) { return; } // if null - use end if ( startValue === null ) { result[ index ] = endValue; } else { if ( type.mod ) { if ( endValue - startValue > type.mod / 2 ) { startValue += type.mod; } else if ( startValue - endValue > type.mod / 2 ) { startValue -= type.mod; } } result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop ); } }); return this[ spaceName ]( result ); }, blend: function( opaque ) { // if we are already opaque - return ourself if ( this._rgba[ 3 ] === 1 ) { return this; } var rgb = this._rgba.slice(), a = rgb.pop(), blend = color( opaque )._rgba; return color( jQuery.map( rgb, function( v, i ) { return ( 1 - a ) * blend[ i ] + a * v; })); }, toRgbaString: function() { var prefix = "rgba(", rgba = jQuery.map( this._rgba, function( v, i ) { return v == null ? ( i > 2 ? 1 : 0 ) : v; }); if ( rgba[ 3 ] === 1 ) { rgba.pop(); prefix = "rgb("; } return prefix + rgba.join() + ")"; }, toHslaString: function() { var prefix = "hsla(", hsla = jQuery.map( this.hsla(), function( v, i ) { if ( v == null ) { v = i > 2 ? 1 : 0; } // catch 1 and 2 if ( i && i < 3 ) { v = Math.round( v * 100 ) + "%"; } return v; }); if ( hsla[ 3 ] === 1 ) { hsla.pop(); prefix = "hsl("; } return prefix + hsla.join() + ")"; }, toHexString: function( includeAlpha ) { var rgba = this._rgba.slice(), alpha = rgba.pop(); if ( includeAlpha ) { rgba.push( ~~( alpha * 255 ) ); } return "#" + jQuery.map( rgba, function( v ) { // default to 0 when nulls exist v = ( v || 0 ).toString( 16 ); return v.length === 1 ? "0" + v : v; }).join(""); }, toString: function() { return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString(); } }); color.fn.parse.prototype = color.fn; // hsla conversions adapted from: // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 function hue2rgb( p, q, h ) { h = ( h + 1 ) % 1; if ( h * 6 < 1 ) { return p + ( q - p ) * h * 6; } if ( h * 2 < 1) { return q; } if ( h * 3 < 2 ) { return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6; } return p; } spaces.hsla.to = function( rgba ) { if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) { return [ null, null, null, rgba[ 3 ] ]; } var r = rgba[ 0 ] / 255, g = rgba[ 1 ] / 255, b = rgba[ 2 ] / 255, a = rgba[ 3 ], max = Math.max( r, g, b ), min = Math.min( r, g, b ), diff = max - min, add = max + min, l = add * 0.5, h, s; if ( min === max ) { h = 0; } else if ( r === max ) { h = ( 60 * ( g - b ) / diff ) + 360; } else if ( g === max ) { h = ( 60 * ( b - r ) / diff ) + 120; } else { h = ( 60 * ( r - g ) / diff ) + 240; } // chroma (diff) == 0 means greyscale which, by definition, saturation = 0% // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) if ( diff === 0 ) { s = 0; } else if ( l <= 0.5 ) { s = diff / add; } else { s = diff / ( 2 - add ); } return [ Math.round(h) % 360, s, l, a == null ? 1 : a ]; }; spaces.hsla.from = function( hsla ) { if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) { return [ null, null, null, hsla[ 3 ] ]; } var h = hsla[ 0 ] / 360, s = hsla[ 1 ], l = hsla[ 2 ], a = hsla[ 3 ], q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s, p = 2 * l - q; return [ Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ), Math.round( hue2rgb( p, q, h ) * 255 ), Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ), a ]; }; each( spaces, function( spaceName, space ) { var props = space.props, cache = space.cache, to = space.to, from = space.from; // makes rgba() and hsla() color.fn[ spaceName ] = function( value ) { // generate a cache for this space if it doesn't exist if ( to && !this[ cache ] ) { this[ cache ] = to( this._rgba ); } if ( value === undefined ) { return this[ cache ].slice(); } var ret, type = jQuery.type( value ), arr = ( type === "array" || type === "object" ) ? value : arguments, local = this[ cache ].slice(); each( props, function( key, prop ) { var val = arr[ type === "object" ? key : prop.idx ]; if ( val == null ) { val = local[ prop.idx ]; } local[ prop.idx ] = clamp( val, prop ); }); if ( from ) { ret = color( from( local ) ); ret[ cache ] = local; return ret; } else { return color( local ); } }; // makes red() green() blue() alpha() hue() saturation() lightness() each( props, function( key, prop ) { // alpha is included in more than one space if ( color.fn[ key ] ) { return; } color.fn[ key ] = function( value ) { var vtype = jQuery.type( value ), fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ), local = this[ fn ](), cur = local[ prop.idx ], match; if ( vtype === "undefined" ) { return cur; } if ( vtype === "function" ) { value = value.call( this, cur ); vtype = jQuery.type( value ); } if ( value == null && prop.empty ) { return this; } if ( vtype === "string" ) { match = rplusequals.exec( value ); if ( match ) { value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 ); } } local[ prop.idx ] = value; return this[ fn ]( local ); }; }); }); // add cssHook and .fx.step function for each named hook. // accept a space separated string of properties color.hook = function( hook ) { var hooks = hook.split( " " ); each( hooks, function( i, hook ) { jQuery.cssHooks[ hook ] = { set: function( elem, value ) { var parsed, curElem, backgroundColor = ""; if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) { value = color( parsed || value ); if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { curElem = hook === "backgroundColor" ? elem.parentNode : elem; while ( (backgroundColor === "" || backgroundColor === "transparent") && curElem && curElem.style ) { try { backgroundColor = jQuery.css( curElem, "backgroundColor" ); curElem = curElem.parentNode; } catch ( e ) { } } value = value.blend( backgroundColor && backgroundColor !== "transparent" ? backgroundColor : "_default" ); } value = value.toRgbaString(); } try { elem.style[ hook ] = value; } catch( e ) { // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' } } }; jQuery.fx.step[ hook ] = function( fx ) { if ( !fx.colorInit ) { fx.start = color( fx.elem, hook ); fx.end = color( fx.end ); fx.colorInit = true; } jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) ); }; }); }; color.hook( stepHooks ); jQuery.cssHooks.borderColor = { expand: function( value ) { var expanded = {}; each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) { expanded[ "border" + part + "Color" ] = value; }); return expanded; } }; // Basic color names only. // Usage of any of the other color names requires adding yourself or including // jquery.color.svg-names.js. colors = jQuery.Color.names = { // 4.1. Basic color keywords aqua: "#00ffff", black: "#000000", blue: "#0000ff", fuchsia: "#ff00ff", gray: "#808080", green: "#008000", lime: "#00ff00", maroon: "#800000", navy: "#000080", olive: "#808000", purple: "#800080", red: "#ff0000", silver: "#c0c0c0", teal: "#008080", white: "#ffffff", yellow: "#ffff00", // 4.2.3. "transparent" color keyword transparent: [ null, null, null, 0 ], _default: "#ffffff" }; })( jQuery ); /******************************************************************************/ /****************************** CLASS ANIMATIONS ******************************/ /******************************************************************************/ (function() { var classAnimationActions = [ "add", "remove", "toggle" ], shorthandStyles = { border: 1, borderBottom: 1, borderColor: 1, borderLeft: 1, borderRight: 1, borderTop: 1, borderWidth: 1, margin: 1, padding: 1 }; $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) { $.fx.step[ prop ] = function( fx ) { if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) { jQuery.style( fx.elem, prop, fx.end ); fx.setAttr = true; } }; }); function getElementStyles( elem ) { var key, len, style = elem.ownerDocument.defaultView ? elem.ownerDocument.defaultView.getComputedStyle( elem, null ) : elem.currentStyle, styles = {}; if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) { len = style.length; while ( len-- ) { key = style[ len ]; if ( typeof style[ key ] === "string" ) { styles[ $.camelCase( key ) ] = style[ key ]; } } // support: Opera, IE <9 } else { for ( key in style ) { if ( typeof style[ key ] === "string" ) { styles[ key ] = style[ key ]; } } } return styles; } function styleDifference( oldStyle, newStyle ) { var diff = {}, name, value; for ( name in newStyle ) { value = newStyle[ name ]; if ( oldStyle[ name ] !== value ) { if ( !shorthandStyles[ name ] ) { if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) { diff[ name ] = value; } } } } return diff; } // support: jQuery <1.8 if ( !$.fn.addBack ) { $.fn.addBack = function( selector ) { return this.add( selector == null ? this.prevObject : this.prevObject.filter( selector ) ); }; } $.effects.animateClass = function( value, duration, easing, callback ) { var o = $.speed( duration, easing, callback ); return this.queue( function() { var animated = $( this ), baseClass = animated.attr( "class" ) || "", applyClassChange, allAnimations = o.children ? animated.find( "*" ).addBack() : animated; // map the animated objects to store the original styles. allAnimations = allAnimations.map(function() { var el = $( this ); return { el: el, start: getElementStyles( this ) }; }); // apply class change applyClassChange = function() { $.each( classAnimationActions, function(i, action) { if ( value[ action ] ) { animated[ action + "Class" ]( value[ action ] ); } }); }; applyClassChange(); // map all animated objects again - calculate new styles and diff allAnimations = allAnimations.map(function() { this.end = getElementStyles( this.el[ 0 ] ); this.diff = styleDifference( this.start, this.end ); return this; }); // apply original class animated.attr( "class", baseClass ); // map all animated objects again - this time collecting a promise allAnimations = allAnimations.map(function() { var styleInfo = this, dfd = $.Deferred(), opts = $.extend({}, o, { queue: false, complete: function() { dfd.resolve( styleInfo ); } }); this.el.animate( this.diff, opts ); return dfd.promise(); }); // once all animations have completed: $.when.apply( $, allAnimations.get() ).done(function() { // set the final class applyClassChange(); // for each animated element, // clear all css properties that were animated $.each( arguments, function() { var el = this.el; $.each( this.diff, function(key) { el.css( key, "" ); }); }); // this is guarnteed to be there if you use jQuery.speed() // it also handles dequeuing the next anim... o.complete.call( animated[ 0 ] ); }); }); }; $.fn.extend({ addClass: (function( orig ) { return function( classNames, speed, easing, callback ) { return speed ? $.effects.animateClass.call( this, { add: classNames }, speed, easing, callback ) : orig.apply( this, arguments ); }; })( $.fn.addClass ), removeClass: (function( orig ) { return function( classNames, speed, easing, callback ) { return arguments.length > 1 ? $.effects.animateClass.call( this, { remove: classNames }, speed, easing, callback ) : orig.apply( this, arguments ); }; })( $.fn.removeClass ), toggleClass: (function( orig ) { return function( classNames, force, speed, easing, callback ) { if ( typeof force === "boolean" || force === undefined ) { if ( !speed ) { // without speed parameter return orig.apply( this, arguments ); } else { return $.effects.animateClass.call( this, (force ? { add: classNames } : { remove: classNames }), speed, easing, callback ); } } else { // without force parameter return $.effects.animateClass.call( this, { toggle: classNames }, force, speed, easing ); } }; })( $.fn.toggleClass ), switchClass: function( remove, add, speed, easing, callback) { return $.effects.animateClass.call( this, { add: add, remove: remove }, speed, easing, callback ); } }); })(); /******************************************************************************/ /*********************************** EFFECTS **********************************/ /******************************************************************************/ (function() { $.extend( $.effects, { version: "1.11.1", // Saves a set of properties in a data storage save: function( element, set ) { for ( var i = 0; i < set.length; i++ ) { if ( set[ i ] !== null ) { element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] ); } } }, // Restores a set of previously saved properties from a data storage restore: function( element, set ) { var val, i; for ( i = 0; i < set.length; i++ ) { if ( set[ i ] !== null ) { val = element.data( dataSpace + set[ i ] ); // support: jQuery 1.6.2 // http://bugs.jquery.com/ticket/9917 // jQuery 1.6.2 incorrectly returns undefined for any falsy value. // We can't differentiate between "" and 0 here, so we just assume // empty string since it's likely to be a more common value... if ( val === undefined ) { val = ""; } element.css( set[ i ], val ); } } }, setMode: function( el, mode ) { if (mode === "toggle") { mode = el.is( ":hidden" ) ? "show" : "hide"; } return mode; }, // Translates a [top,left] array into a baseline value // this should be a little more flexible in the future to handle a string & hash getBaseline: function( origin, original ) { var y, x; switch ( origin[ 0 ] ) { case "top": y = 0; break; case "middle": y = 0.5; break; case "bottom": y = 1; break; default: y = origin[ 0 ] / original.height; } switch ( origin[ 1 ] ) { case "left": x = 0; break; case "center": x = 0.5; break; case "right": x = 1; break; default: x = origin[ 1 ] / original.width; } return { x: x, y: y }; }, // Wraps the element around a wrapper that copies position properties createWrapper: function( element ) { // if the element is already wrapped, return it if ( element.parent().is( ".ui-effects-wrapper" )) { return element.parent(); } // wrap the element var props = { width: element.outerWidth(true), height: element.outerHeight(true), "float": element.css( "float" ) }, wrapper = $( "<div></div>" ) .addClass( "ui-effects-wrapper" ) .css({ fontSize: "100%", background: "transparent", border: "none", margin: 0, padding: 0 }), // Store the size in case width/height are defined in % - Fixes #5245 size = { width: element.width(), height: element.height() }, active = document.activeElement; // support: Firefox // Firefox incorrectly exposes anonymous content // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 try { active.id; } catch( e ) { active = document.body; } element.wrap( wrapper ); // Fixes #7595 - Elements lose focus when wrapped. if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { $( active ).focus(); } wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element // transfer positioning properties to the wrapper if ( element.css( "position" ) === "static" ) { wrapper.css({ position: "relative" }); element.css({ position: "relative" }); } else { $.extend( props, { position: element.css( "position" ), zIndex: element.css( "z-index" ) }); $.each([ "top", "left", "bottom", "right" ], function(i, pos) { props[ pos ] = element.css( pos ); if ( isNaN( parseInt( props[ pos ], 10 ) ) ) { props[ pos ] = "auto"; } }); element.css({ position: "relative", top: 0, left: 0, right: "auto", bottom: "auto" }); } element.css(size); return wrapper.css( props ).show(); }, removeWrapper: function( element ) { var active = document.activeElement; if ( element.parent().is( ".ui-effects-wrapper" ) ) { element.parent().replaceWith( element ); // Fixes #7595 - Elements lose focus when wrapped. if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) { $( active ).focus(); } } return element; }, setTransition: function( element, list, factor, value ) { value = value || {}; $.each( list, function( i, x ) { var unit = element.cssUnit( x ); if ( unit[ 0 ] > 0 ) { value[ x ] = unit[ 0 ] * factor + unit[ 1 ]; } }); return value; } }); // return an effect options object for the given parameters: function _normalizeArguments( effect, options, speed, callback ) { // allow passing all options as the first parameter if ( $.isPlainObject( effect ) ) { options = effect; effect = effect.effect; } // convert to an object effect = { effect: effect }; // catch (effect, null, ...) if ( options == null ) { options = {}; } // catch (effect, callback) if ( $.isFunction( options ) ) { callback = options; speed = null; options = {}; } // catch (effect, speed, ?) if ( typeof options === "number" || $.fx.speeds[ options ] ) { callback = speed; speed = options; options = {}; } // catch (effect, options, callback) if ( $.isFunction( speed ) ) { callback = speed; speed = null; } // add options to effect if ( options ) { $.extend( effect, options ); } speed = speed || options.duration; effect.duration = $.fx.off ? 0 : typeof speed === "number" ? speed : speed in $.fx.speeds ? $.fx.speeds[ speed ] : $.fx.speeds._default; effect.complete = callback || options.complete; return effect; } function standardAnimationOption( option ) { // Valid standard speeds (nothing, number, named speed) if ( !option || typeof option === "number" || $.fx.speeds[ option ] ) { return true; } // Invalid strings - treat as "normal" speed if ( typeof option === "string" && !$.effects.effect[ option ] ) { return true; } // Complete callback if ( $.isFunction( option ) ) { return true; } // Options hash (but not naming an effect) if ( typeof option === "object" && !option.effect ) { return true; } // Didn't match any standard API return false; } $.fn.extend({ effect: function( /* effect, options, speed, callback */ ) { var args = _normalizeArguments.apply( this, arguments ), mode = args.mode, queue = args.queue, effectMethod = $.effects.effect[ args.effect ]; if ( $.fx.off || !effectMethod ) { // delegate to the original method (e.g., .show()) if possible if ( mode ) { return this[ mode ]( args.duration, args.complete ); } else { return this.each( function() { if ( args.complete ) { args.complete.call( this ); } }); } } function run( next ) { var elem = $( this ), complete = args.complete, mode = args.mode; function done() { if ( $.isFunction( complete ) ) { complete.call( elem[0] ); } if ( $.isFunction( next ) ) { next(); } } // If the element already has the correct final state, delegate to // the core methods so the internal tracking of "olddisplay" works. if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) { elem[ mode ](); done(); } else { effectMethod.call( elem[0], args, done ); } } return queue === false ? this.each( run ) : this.queue( queue || "fx", run ); }, show: (function( orig ) { return function( option ) { if ( standardAnimationOption( option ) ) { return orig.apply( this, arguments ); } else { var args = _normalizeArguments.apply( this, arguments ); args.mode = "show"; return this.effect.call( this, args ); } }; })( $.fn.show ), hide: (function( orig ) { return function( option ) { if ( standardAnimationOption( option ) ) { return orig.apply( this, arguments ); } else { var args = _normalizeArguments.apply( this, arguments ); args.mode = "hide"; return this.effect.call( this, args ); } }; })( $.fn.hide ), toggle: (function( orig ) { return function( option ) { if ( standardAnimationOption( option ) || typeof option === "boolean" ) { return orig.apply( this, arguments ); } else { var args = _normalizeArguments.apply( this, arguments ); args.mode = "toggle"; return this.effect.call( this, args ); } }; })( $.fn.toggle ), // helper functions cssUnit: function(key) { var style = this.css( key ), val = []; $.each( [ "em", "px", "%", "pt" ], function( i, unit ) { if ( style.indexOf( unit ) > 0 ) { val = [ parseFloat( style ), unit ]; } }); return val; } }); })(); /******************************************************************************/ /*********************************** EASING ***********************************/ /******************************************************************************/ (function() { // based on easing equations from Robert Penner (http://www.robertpenner.com/easing) var baseEasings = {}; $.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) { baseEasings[ name ] = function( p ) { return Math.pow( p, i + 2 ); }; }); $.extend( baseEasings, { Sine: function( p ) { return 1 - Math.cos( p * Math.PI / 2 ); }, Circ: function( p ) { return 1 - Math.sqrt( 1 - p * p ); }, Elastic: function( p ) { return p === 0 || p === 1 ? p : -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 ); }, Back: function( p ) { return p * p * ( 3 * p - 2 ); }, Bounce: function( p ) { var pow2, bounce = 4; while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {} return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 ); } }); $.each( baseEasings, function( name, easeIn ) { $.easing[ "easeIn" + name ] = easeIn; $.easing[ "easeOut" + name ] = function( p ) { return 1 - easeIn( 1 - p ); }; $.easing[ "easeInOut" + name ] = function( p ) { return p < 0.5 ? easeIn( p * 2 ) / 2 : 1 - easeIn( p * -2 + 2 ) / 2; }; }); })(); var effect = $.effects; /*! * jQuery UI Effects Blind 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/blind-effect/ */ var effectBlind = $.effects.effect.blind = function( o, done ) { // Create element var el = $( this ), rvertical = /up|down|vertical/, rpositivemotion = /up|left|vertical|horizontal/, props = [ "position", "top", "bottom", "left", "right", "height", "width" ], mode = $.effects.setMode( el, o.mode || "hide" ), direction = o.direction || "up", vertical = rvertical.test( direction ), ref = vertical ? "height" : "width", ref2 = vertical ? "top" : "left", motion = rpositivemotion.test( direction ), animation = {}, show = mode === "show", wrapper, distance, margin; // if already wrapped, the wrapper's properties are my property. #6245 if ( el.parent().is( ".ui-effects-wrapper" ) ) { $.effects.save( el.parent(), props ); } else { $.effects.save( el, props ); } el.show(); wrapper = $.effects.createWrapper( el ).css({ overflow: "hidden" }); distance = wrapper[ ref ](); margin = parseFloat( wrapper.css( ref2 ) ) || 0; animation[ ref ] = show ? distance : 0; if ( !motion ) { el .css( vertical ? "bottom" : "right", 0 ) .css( vertical ? "top" : "left", "auto" ) .css({ position: "absolute" }); animation[ ref2 ] = show ? margin : distance + margin; } // start at 0 if we are showing if ( show ) { wrapper.css( ref, 0 ); if ( !motion ) { wrapper.css( ref2, margin + distance ); } } // Animate wrapper.animate( animation, { duration: o.duration, easing: o.easing, queue: false, complete: function() { if ( mode === "hide" ) { el.hide(); } $.effects.restore( el, props ); $.effects.removeWrapper( el ); done(); } }); }; /*! * jQuery UI Effects Bounce 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/bounce-effect/ */ var effectBounce = $.effects.effect.bounce = function( o, done ) { var el = $( this ), props = [ "position", "top", "bottom", "left", "right", "height", "width" ], // defaults: mode = $.effects.setMode( el, o.mode || "effect" ), hide = mode === "hide", show = mode === "show", direction = o.direction || "up", distance = o.distance, times = o.times || 5, // number of internal animations anims = times * 2 + ( show || hide ? 1 : 0 ), speed = o.duration / anims, easing = o.easing, // utility: ref = ( direction === "up" || direction === "down" ) ? "top" : "left", motion = ( direction === "up" || direction === "left" ), i, upAnim, downAnim, // we will need to re-assemble the queue to stack our animations in place queue = el.queue(), queuelen = queue.length; // Avoid touching opacity to prevent clearType and PNG issues in IE if ( show || hide ) { props.push( "opacity" ); } $.effects.save( el, props ); el.show(); $.effects.createWrapper( el ); // Create Wrapper // default distance for the BIGGEST bounce is the outer Distance / 3 if ( !distance ) { distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3; } if ( show ) { downAnim = { opacity: 1 }; downAnim[ ref ] = 0; // if we are showing, force opacity 0 and set the initial position // then do the "first" animation el.css( "opacity", 0 ) .css( ref, motion ? -distance * 2 : distance * 2 ) .animate( downAnim, speed, easing ); } // start at the smallest distance if we are hiding if ( hide ) { distance = distance / Math.pow( 2, times - 1 ); } downAnim = {}; downAnim[ ref ] = 0; // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here for ( i = 0; i < times; i++ ) { upAnim = {}; upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; el.animate( upAnim, speed, easing ) .animate( downAnim, speed, easing ); distance = hide ? distance * 2 : distance / 2; } // Last Bounce when Hiding if ( hide ) { upAnim = { opacity: 0 }; upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance; el.animate( upAnim, speed, easing ); } el.queue(function() { if ( hide ) { el.hide(); } $.effects.restore( el, props ); $.effects.removeWrapper( el ); done(); }); // inject all the animations we just queued to be first in line (after "inprogress") if ( queuelen > 1) { queue.splice.apply( queue, [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); } el.dequeue(); }; /*! * jQuery UI Effects Clip 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/clip-effect/ */ var effectClip = $.effects.effect.clip = function( o, done ) { // Create element var el = $( this ), props = [ "position", "top", "bottom", "left", "right", "height", "width" ], mode = $.effects.setMode( el, o.mode || "hide" ), show = mode === "show", direction = o.direction || "vertical", vert = direction === "vertical", size = vert ? "height" : "width", position = vert ? "top" : "left", animation = {}, wrapper, animate, distance; // Save & Show $.effects.save( el, props ); el.show(); // Create Wrapper wrapper = $.effects.createWrapper( el ).css({ overflow: "hidden" }); animate = ( el[0].tagName === "IMG" ) ? wrapper : el; distance = animate[ size ](); // Shift if ( show ) { animate.css( size, 0 ); animate.css( position, distance / 2 ); } // Create Animation Object: animation[ size ] = show ? distance : 0; animation[ position ] = show ? 0 : distance / 2; // Animate animate.animate( animation, { queue: false, duration: o.duration, easing: o.easing, complete: function() { if ( !show ) { el.hide(); } $.effects.restore( el, props ); $.effects.removeWrapper( el ); done(); } }); }; /*! * jQuery UI Effects Drop 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/drop-effect/ */ var effectDrop = $.effects.effect.drop = function( o, done ) { var el = $( this ), props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ], mode = $.effects.setMode( el, o.mode || "hide" ), show = mode === "show", direction = o.direction || "left", ref = ( direction === "up" || direction === "down" ) ? "top" : "left", motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg", animation = { opacity: show ? 1 : 0 }, distance; // Adjust $.effects.save( el, props ); el.show(); $.effects.createWrapper( el ); distance = o.distance || el[ ref === "top" ? "outerHeight": "outerWidth" ]( true ) / 2; if ( show ) { el .css( "opacity", 0 ) .css( ref, motion === "pos" ? -distance : distance ); } // Animation animation[ ref ] = ( show ? ( motion === "pos" ? "+=" : "-=" ) : ( motion === "pos" ? "-=" : "+=" ) ) + distance; // Animate el.animate( animation, { queue: false, duration: o.duration, easing: o.easing, complete: function() { if ( mode === "hide" ) { el.hide(); } $.effects.restore( el, props ); $.effects.removeWrapper( el ); done(); } }); }; /*! * jQuery UI Effects Explode 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/explode-effect/ */ var effectExplode = $.effects.effect.explode = function( o, done ) { var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3, cells = rows, el = $( this ), mode = $.effects.setMode( el, o.mode || "hide" ), show = mode === "show", // show and then visibility:hidden the element before calculating offset offset = el.show().css( "visibility", "hidden" ).offset(), // width and height of a piece width = Math.ceil( el.outerWidth() / cells ), height = Math.ceil( el.outerHeight() / rows ), pieces = [], // loop i, j, left, top, mx, my; // children animate complete: function childComplete() { pieces.push( this ); if ( pieces.length === rows * cells ) { animComplete(); } } // clone the element for each row and cell. for ( i = 0; i < rows ; i++ ) { // ===> top = offset.top + i * height; my = i - ( rows - 1 ) / 2 ; for ( j = 0; j < cells ; j++ ) { // ||| left = offset.left + j * width; mx = j - ( cells - 1 ) / 2 ; // Create a clone of the now hidden main element that will be absolute positioned // within a wrapper div off the -left and -top equal to size of our pieces el .clone() .appendTo( "body" ) .wrap( "<div></div>" ) .css({ position: "absolute", visibility: "visible", left: -j * width, top: -i * height }) // select the wrapper - make it overflow: hidden and absolute positioned based on // where the original was located +left and +top equal to the size of pieces .parent() .addClass( "ui-effects-explode" ) .css({ position: "absolute", overflow: "hidden", width: width, height: height, left: left + ( show ? mx * width : 0 ), top: top + ( show ? my * height : 0 ), opacity: show ? 0 : 1 }).animate({ left: left + ( show ? 0 : mx * width ), top: top + ( show ? 0 : my * height ), opacity: show ? 1 : 0 }, o.duration || 500, o.easing, childComplete ); } } function animComplete() { el.css({ visibility: "visible" }); $( pieces ).remove(); if ( !show ) { el.hide(); } done(); } }; /*! * jQuery UI Effects Fade 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/fade-effect/ */ var effectFade = $.effects.effect.fade = function( o, done ) { var el = $( this ), mode = $.effects.setMode( el, o.mode || "toggle" ); el.animate({ opacity: mode }, { queue: false, duration: o.duration, easing: o.easing, complete: done }); }; /*! * jQuery UI Effects Fold 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/fold-effect/ */ var effectFold = $.effects.effect.fold = function( o, done ) { // Create element var el = $( this ), props = [ "position", "top", "bottom", "left", "right", "height", "width" ], mode = $.effects.setMode( el, o.mode || "hide" ), show = mode === "show", hide = mode === "hide", size = o.size || 15, percent = /([0-9]+)%/.exec( size ), horizFirst = !!o.horizFirst, widthFirst = show !== horizFirst, ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ], duration = o.duration / 2, wrapper, distance, animation1 = {}, animation2 = {}; $.effects.save( el, props ); el.show(); // Create Wrapper wrapper = $.effects.createWrapper( el ).css({ overflow: "hidden" }); distance = widthFirst ? [ wrapper.width(), wrapper.height() ] : [ wrapper.height(), wrapper.width() ]; if ( percent ) { size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ]; } if ( show ) { wrapper.css( horizFirst ? { height: 0, width: size } : { height: size, width: 0 }); } // Animation animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size; animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0; // Animate wrapper .animate( animation1, duration, o.easing ) .animate( animation2, duration, o.easing, function() { if ( hide ) { el.hide(); } $.effects.restore( el, props ); $.effects.removeWrapper( el ); done(); }); }; /*! * jQuery UI Effects Highlight 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/highlight-effect/ */ var effectHighlight = $.effects.effect.highlight = function( o, done ) { var elem = $( this ), props = [ "backgroundImage", "backgroundColor", "opacity" ], mode = $.effects.setMode( elem, o.mode || "show" ), animation = { backgroundColor: elem.css( "backgroundColor" ) }; if (mode === "hide") { animation.opacity = 0; } $.effects.save( elem, props ); elem .show() .css({ backgroundImage: "none", backgroundColor: o.color || "#ffff99" }) .animate( animation, { queue: false, duration: o.duration, easing: o.easing, complete: function() { if ( mode === "hide" ) { elem.hide(); } $.effects.restore( elem, props ); done(); } }); }; /*! * jQuery UI Effects Size 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/size-effect/ */ var effectSize = $.effects.effect.size = function( o, done ) { // Create element var original, baseline, factor, el = $( this ), props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ], // Always restore props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ], // Copy for children props2 = [ "width", "height", "overflow" ], cProps = [ "fontSize" ], vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ], hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ], // Set options mode = $.effects.setMode( el, o.mode || "effect" ), restore = o.restore || mode !== "effect", scale = o.scale || "both", origin = o.origin || [ "middle", "center" ], position = el.css( "position" ), props = restore ? props0 : props1, zero = { height: 0, width: 0, outerHeight: 0, outerWidth: 0 }; if ( mode === "show" ) { el.show(); } original = { height: el.height(), width: el.width(), outerHeight: el.outerHeight(), outerWidth: el.outerWidth() }; if ( o.mode === "toggle" && mode === "show" ) { el.from = o.to || zero; el.to = o.from || original; } else { el.from = o.from || ( mode === "show" ? zero : original ); el.to = o.to || ( mode === "hide" ? zero : original ); } // Set scaling factor factor = { from: { y: el.from.height / original.height, x: el.from.width / original.width }, to: { y: el.to.height / original.height, x: el.to.width / original.width } }; // Scale the css box if ( scale === "box" || scale === "both" ) { // Vertical props scaling if ( factor.from.y !== factor.to.y ) { props = props.concat( vProps ); el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from ); el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to ); } // Horizontal props scaling if ( factor.from.x !== factor.to.x ) { props = props.concat( hProps ); el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from ); el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to ); } } // Scale the content if ( scale === "content" || scale === "both" ) { // Vertical props scaling if ( factor.from.y !== factor.to.y ) { props = props.concat( cProps ).concat( props2 ); el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from ); el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to ); } } $.effects.save( el, props ); el.show(); $.effects.createWrapper( el ); el.css( "overflow", "hidden" ).css( el.from ); // Adjust if (origin) { // Calculate baseline shifts baseline = $.effects.getBaseline( origin, original ); el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y; el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x; el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y; el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x; } el.css( el.from ); // set top & left // Animate if ( scale === "content" || scale === "both" ) { // Scale the children // Add margins/font-size vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps); hProps = hProps.concat([ "marginLeft", "marginRight" ]); props2 = props0.concat(vProps).concat(hProps); el.find( "*[width]" ).each( function() { var child = $( this ), c_original = { height: child.height(), width: child.width(), outerHeight: child.outerHeight(), outerWidth: child.outerWidth() }; if (restore) { $.effects.save(child, props2); } child.from = { height: c_original.height * factor.from.y, width: c_original.width * factor.from.x, outerHeight: c_original.outerHeight * factor.from.y, outerWidth: c_original.outerWidth * factor.from.x }; child.to = { height: c_original.height * factor.to.y, width: c_original.width * factor.to.x, outerHeight: c_original.height * factor.to.y, outerWidth: c_original.width * factor.to.x }; // Vertical props scaling if ( factor.from.y !== factor.to.y ) { child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from ); child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to ); } // Horizontal props scaling if ( factor.from.x !== factor.to.x ) { child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from ); child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to ); } // Animate children child.css( child.from ); child.animate( child.to, o.duration, o.easing, function() { // Restore children if ( restore ) { $.effects.restore( child, props2 ); } }); }); } // Animate el.animate( el.to, { queue: false, duration: o.duration, easing: o.easing, complete: function() { if ( el.to.opacity === 0 ) { el.css( "opacity", el.from.opacity ); } if ( mode === "hide" ) { el.hide(); } $.effects.restore( el, props ); if ( !restore ) { // we need to calculate our new positioning based on the scaling if ( position === "static" ) { el.css({ position: "relative", top: el.to.top, left: el.to.left }); } else { $.each([ "top", "left" ], function( idx, pos ) { el.css( pos, function( _, str ) { var val = parseInt( str, 10 ), toRef = idx ? el.to.left : el.to.top; // if original was "auto", recalculate the new value from wrapper if ( str === "auto" ) { return toRef + "px"; } return val + toRef + "px"; }); }); } } $.effects.removeWrapper( el ); done(); } }); }; /*! * jQuery UI Effects Scale 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/scale-effect/ */ var effectScale = $.effects.effect.scale = function( o, done ) { // Create element var el = $( this ), options = $.extend( true, {}, o ), mode = $.effects.setMode( el, o.mode || "effect" ), percent = parseInt( o.percent, 10 ) || ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ), direction = o.direction || "both", origin = o.origin, original = { height: el.height(), width: el.width(), outerHeight: el.outerHeight(), outerWidth: el.outerWidth() }, factor = { y: direction !== "horizontal" ? (percent / 100) : 1, x: direction !== "vertical" ? (percent / 100) : 1 }; // We are going to pass this effect to the size effect: options.effect = "size"; options.queue = false; options.complete = done; // Set default origin and restore for show/hide if ( mode !== "effect" ) { options.origin = origin || [ "middle", "center" ]; options.restore = true; } options.from = o.from || ( mode === "show" ? { height: 0, width: 0, outerHeight: 0, outerWidth: 0 } : original ); options.to = { height: original.height * factor.y, width: original.width * factor.x, outerHeight: original.outerHeight * factor.y, outerWidth: original.outerWidth * factor.x }; // Fade option to support puff if ( options.fade ) { if ( mode === "show" ) { options.from.opacity = 0; options.to.opacity = 1; } if ( mode === "hide" ) { options.from.opacity = 1; options.to.opacity = 0; } } // Animate el.effect( options ); }; /*! * jQuery UI Effects Puff 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/puff-effect/ */ var effectPuff = $.effects.effect.puff = function( o, done ) { var elem = $( this ), mode = $.effects.setMode( elem, o.mode || "hide" ), hide = mode === "hide", percent = parseInt( o.percent, 10 ) || 150, factor = percent / 100, original = { height: elem.height(), width: elem.width(), outerHeight: elem.outerHeight(), outerWidth: elem.outerWidth() }; $.extend( o, { effect: "scale", queue: false, fade: true, mode: mode, complete: done, percent: hide ? percent : 100, from: hide ? original : { height: original.height * factor, width: original.width * factor, outerHeight: original.outerHeight * factor, outerWidth: original.outerWidth * factor } }); elem.effect( o ); }; /*! * jQuery UI Effects Pulsate 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/pulsate-effect/ */ var effectPulsate = $.effects.effect.pulsate = function( o, done ) { var elem = $( this ), mode = $.effects.setMode( elem, o.mode || "show" ), show = mode === "show", hide = mode === "hide", showhide = ( show || mode === "hide" ), // showing or hiding leaves of the "last" animation anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ), duration = o.duration / anims, animateTo = 0, queue = elem.queue(), queuelen = queue.length, i; if ( show || !elem.is(":visible")) { elem.css( "opacity", 0 ).show(); animateTo = 1; } // anims - 1 opacity "toggles" for ( i = 1; i < anims; i++ ) { elem.animate({ opacity: animateTo }, duration, o.easing ); animateTo = 1 - animateTo; } elem.animate({ opacity: animateTo }, duration, o.easing); elem.queue(function() { if ( hide ) { elem.hide(); } done(); }); // We just queued up "anims" animations, we need to put them next in the queue if ( queuelen > 1 ) { queue.splice.apply( queue, [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); } elem.dequeue(); }; /*! * jQuery UI Effects Shake 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/shake-effect/ */ var effectShake = $.effects.effect.shake = function( o, done ) { var el = $( this ), props = [ "position", "top", "bottom", "left", "right", "height", "width" ], mode = $.effects.setMode( el, o.mode || "effect" ), direction = o.direction || "left", distance = o.distance || 20, times = o.times || 3, anims = times * 2 + 1, speed = Math.round( o.duration / anims ), ref = (direction === "up" || direction === "down") ? "top" : "left", positiveMotion = (direction === "up" || direction === "left"), animation = {}, animation1 = {}, animation2 = {}, i, // we will need to re-assemble the queue to stack our animations in place queue = el.queue(), queuelen = queue.length; $.effects.save( el, props ); el.show(); $.effects.createWrapper( el ); // Animation animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance; animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2; animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2; // Animate el.animate( animation, speed, o.easing ); // Shakes for ( i = 1; i < times; i++ ) { el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing ); } el .animate( animation1, speed, o.easing ) .animate( animation, speed / 2, o.easing ) .queue(function() { if ( mode === "hide" ) { el.hide(); } $.effects.restore( el, props ); $.effects.removeWrapper( el ); done(); }); // inject all the animations we just queued to be first in line (after "inprogress") if ( queuelen > 1) { queue.splice.apply( queue, [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) ); } el.dequeue(); }; /*! * jQuery UI Effects Slide 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/slide-effect/ */ var effectSlide = $.effects.effect.slide = function( o, done ) { // Create element var el = $( this ), props = [ "position", "top", "bottom", "left", "right", "width", "height" ], mode = $.effects.setMode( el, o.mode || "show" ), show = mode === "show", direction = o.direction || "left", ref = (direction === "up" || direction === "down") ? "top" : "left", positiveMotion = (direction === "up" || direction === "left"), distance, animation = {}; // Adjust $.effects.save( el, props ); el.show(); distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true ); $.effects.createWrapper( el ).css({ overflow: "hidden" }); if ( show ) { el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance ); } // Animation animation[ ref ] = ( show ? ( positiveMotion ? "+=" : "-=") : ( positiveMotion ? "-=" : "+=")) + distance; // Animate el.animate( animation, { queue: false, duration: o.duration, easing: o.easing, complete: function() { if ( mode === "hide" ) { el.hide(); } $.effects.restore( el, props ); $.effects.removeWrapper( el ); done(); } }); }; /*! * jQuery UI Effects Transfer 1.11.1 * http://jqueryui.com * * Copyright 2014 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/transfer-effect/ */ var effectTransfer = $.effects.effect.transfer = function( o, done ) { var elem = $( this ), target = $( o.to ), targetFixed = target.css( "position" ) === "fixed", body = $("body"), fixTop = targetFixed ? body.scrollTop() : 0, fixLeft = targetFixed ? body.scrollLeft() : 0, endPosition = target.offset(), animation = { top: endPosition.top - fixTop, left: endPosition.left - fixLeft, height: target.innerHeight(), width: target.innerWidth() }, startPosition = elem.offset(), transfer = $( "<div class='ui-effects-transfer'></div>" ) .appendTo( document.body ) .addClass( o.className ) .css({ top: startPosition.top - fixTop, left: startPosition.left - fixLeft, height: elem.innerHeight(), width: elem.innerWidth(), position: targetFixed ? "fixed" : "absolute" }) .animate( animation, o.duration, o.easing, function() { transfer.remove(); done(); }); }; }));
/** * * jquery.it7InputRules.js * @summary Filtered and transform input characters jQuery plugin * @see https://github.com/it7-solutions/jquery.it7InputRules * * @version: 1.0.1 * @author ANEKHERo.SyS aka Kolodyazhni Andrew * * @licence MIT License http://www.opensource.org/licenses/mit-license * * @requires jQuery jQuery v1.8.2 */ ;(function ($) { /* Variables */ var defaultOptions = { // jQuery element $root: undefined, // Selector for filter events by elements selector: undefined, // Error message style // 0 - hide // 1 - show native alert errorMessage: 1, // Run-time variables alreadyListened: false }; var rules = {}; /* Private Methods */ function getElementSelection(that) { var position = {}; if (that.selectionStart === undefined) { that.focus(); var select = document.selection.createRange(); position.length = select.text.length; select.moveStart('character', -that.value.length); position.end = select.text.length; position.start = position.end - position.length; } else { position.start = that.selectionStart; position.end = that.selectionEnd; position.length = position.end - position.start; } return position; } function setElementSelection(that, start, end) { if (that.selectionStart === undefined) { that.focus(); var r = that.createTextRange(); r.collapse(true); r.moveEnd('character', end); r.moveStart('character', start); r.select(); } else { that.selectionStart = start; that.selectionEnd = end; } } function getElementRules(element) { var elementRules = $(element).data("it7InputRules"); return (elementRules && typeof elementRules === 'object') ? elementRules : {}; } function makeFakeState(state, added){ return { event: state.event, element: state.element, value: '', added: added, pass: true, selection: { start: 0, end: 0, length: 0 } }; } function createState(event, element){ return { event: event, element: element, value: $(element).val(), added: String.fromCharCode(event.which), pass: true, selection: getElementSelection(element) }; } function applyRules(state, elementRules) { $.each(elementRules, function(ruleName, ruleParameters){ if(ruleParameters && rules[ruleName] && typeof rules[ruleName] === 'function'){ state = rules[ruleName](state); } }); return state; } function placeText(value, replaced, start, end){ return value.substr(0, start) + replaced + value.substring(end); } function setElementValue(state){ if(state.pass){ var cursorPosition = state.selection.start + state.added.length; $(state.element).val(placeText(state.value, state.added, state.selection.start, state.selection.end)); setElementSelection(state.element, cursorPosition, cursorPosition); } } /** * Exclude in FF Ctrl+*, Backspace, etc * * @param event * @returns {boolean} */ function isPrintableCharacter(event){ return !event.ctrlKey && event.which > 31; } function onElementKeyPress(d, event, element){ console.log(event.which +' / '+event.charCode + ' / '+ event.keyCode); if(isPrintableCharacter(event)){ var state = createState(event, element); setElementValue(applyRules(state, getElementRules(element))); event.preventDefault(); return false; } } function getPastedText(state) { var currentValue = $(state.element).val(); var pastedFrom = state.selection.start; var pastedTo = currentValue.length - (state.value.length - state.selection.end); return currentValue.substring(pastedFrom, pastedTo); } function applyToPasted(state, elementRules) { var pasted = getPastedText(state); state.added = ''; $.each(pasted, function(i, character){ var s = makeFakeState(state, character); s = applyRules(s, elementRules); if(s.pass){ state.added += s.added; } }); return state; } function onPasteToElement(d, event, element) { var state = createState(event, element); setTimeout(function () { setElementValue(applyToPasted(state, getElementRules(element))); }, 1); } /** * Disable Ctrl+Z * * @returns {boolean} */ function onElementKeyDown(event) { if(event.ctrlKey && event.which === 90){ event.preventDefault(); return false; } } function setListeners(d){ if(!d.alreadyListened){ d.$root.on('keydown.jquery.it7InputRules', d.selector, function(e){onElementKeyDown(e)}); d.$root.on('keypress.jquery.it7InputRules', d.selector, function(e){onElementKeyPress(d, e, this)}); d.$root.on('paste.jquery.it7InputRules', d.selector, function (e) { onPasteToElement(d, e, this) }); d.alreadyListened = true; } } function initSelectorData(rootOptions, options){ options || (options = {}); var selector = String(options.selector); selector || (selector = 'undefined'); var selectorOption = rootOptions.selectors[selector]; if(!selectorOption){ selectorOption = $.extend({}, defaultOptions); rootOptions.selectors[selector] = selectorOption; selectorOption.$root = rootOptions.$root; } $.extend(selectorOption, options); return selectorOption; } function initRootData($root){ var rootOptions = $root.data('jquery.it7InputRules'); if(!rootOptions){ rootOptions = {selectors: {}, $root: $root}; $root.data('jquery.it7InputRules', rootOptions); } return rootOptions; } /* Public Methods */ function it7InputRules(options){ $(this).each(function(){ var $root = $(this); var rootOptions = initRootData($root); var selectorOptions = initSelectorData(rootOptions, options); setListeners(selectorOptions); }); } /** * Show error Message * * @param message */ function showError(message) { if(defaultOptions.errorMessage){ alert('Javascript runtime error: ' + message); } } /* Register plugin in jQuery namespace */ $.fn.it7InputRules = it7InputRules; $.fn.it7InputRules.defaults = defaultOptions; $.fn.it7InputRules.rules = rules; })(jQuery); (function ($) { var rules = { "uppercase": function (state) { state.added = state.added.toUpperCase(); return state; }, "alphaNumber": function (state) { state.pass = /[a-zA-Z0-9]/.test(state.added); return state; } }; $.extend($.fn.it7InputRules.rules, rules); })(jQuery); $(function(){ $(document).it7InputRules({selector: '.it7InputRulesListen'}); });
const { DynamoDB } = require('aws-sdk'); exports.handler = async function (event) { const dynamo = new DynamoDB(); console.log("request:", JSON.stringify(event, undefined, 2)); // update dynamo entry for "path" with hits++ await dynamo.updateItem({ TableName: process.env.TABLE_NAME, Key: { path: { S: event.path } }, UpdateExpression: 'ADD hits :incr', ExpressionAttributeValues: { ':incr': { N: '1' } } }).promise(); return { statusCode: 200, headers: { "Content-Type": "text/plain" }, body: `Hello, CDK! You've hit ${event.path}\n`, }; };
import { VisFactoryProvider } from 'ui/vis/vis_factory'; import { VisSchemasProvider } from 'ui/vis/editors/default/schemas'; import { CATEGORY } from 'ui/vis/vis_category'; import gaugeTemplate from 'plugins/kbn_vislib_vis_types/editors/gauge.html'; import { vislibColorMaps } from 'ui/vislib/components/color/colormaps'; import image from './images/icon-goal.svg'; export default function GoalVisType(Private) { const VisFactory = Private(VisFactoryProvider); const Schemas = Private(VisSchemasProvider); return VisFactory.createVislibVisualization({ name: 'goal', title: 'Goal', image, description: 'A goal chart indicates how close you are to your final goal.', category: CATEGORY.DATA, visConfig: { defaults: { addTooltip: true, addLegend: false, isDisplayWarning: false, type: 'gauge', gauge: { verticalSplit: false, autoExtend: false, percentageMode: true, gaugeType: 'Arc', gaugeStyle: 'Full', backStyle: 'Full', orientation: 'vertical', useRanges: false, colorSchema: 'Green to Red', gaugeColorMode: 'None', colorsRange: [ { from: 0, to: 10000 } ], invertColors: false, labels: { show: true, color: 'black' }, scale: { show: false, labels: false, color: '#333', width: 2 }, type: 'meter', style: { bgFill: '#000', bgColor: false, labelColor: false, subText: '', fontSize: 60, } } }, }, editorConfig: { collections: { gaugeTypes: ['Arc', 'Circle'], gaugeColorMode: ['None', 'Labels', 'Background'], scales: ['linear', 'log', 'square root'], colorSchemas: Object.keys(vislibColorMaps), }, optionsTemplate: gaugeTemplate, schemas: new Schemas([ { group: 'metrics', name: 'metric', title: 'Metric', min: 1, aggFilter: [ '!std_dev', '!geo_centroid', '!percentiles', '!percentile_ranks', '!derivative', '!serial_diff', '!moving_avg', '!cumulative_sum', '!geo_bounds'], defaults: [ { schema: 'metric', type: 'count' } ] }, { group: 'buckets', name: 'group', title: 'Split Group', min: 0, max: 1, aggFilter: ['!geohash_grid', '!filter'] } ]) } }); }
/** * Copyright 2020 The AMP HTML 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. */ dev().info(TAG, 'Removing iframe query string before navigation:', fromLocation.search); dev().info; dev().fine(TAG, 'fine'); dev().fine; user().fine(TAG, 'user fine'); user().fine;
/* Copyright 2010, Google Inc. 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. * Neither the name of Google Inc. 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 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. */ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) { var doFilterByExpressionPrompt = function(expression, type) { DataTableView.promptExpressionOnVisibleRows( column, (type == "list" ? $.i18n._('core-views')["custom-facet"] : $.i18n._('core-views')["custom-numeric-label"]) +" "+ column.name, expression, function(expression) { var config = { "name" : column.name, "columnName" : column.name, "expression" : expression }; if (type == "range") { config.mode = "range"; } ui.browsingEngine.addFacet(type, config); } ); }; MenuSystem.appendTo(menu, [ "core/facet" ], [ { id: "core/text-facet", label: $.i18n._('core-views')["text-facet"], click: function() { ui.browsingEngine.addFacet( "list", { "name": column.name, "columnName": column.name, "expression": "value" } ); } }, { id: "core/numeric-facet", label: $.i18n._('core-views')["numeric-facet"], click: function() { ui.browsingEngine.addFacet( "range", { "name": column.name, "columnName": column.name, "expression": "value", "mode": "range" } ); } }, { id: "core/time-facet", label: $.i18n._('core-views')["timeline-facet"], click: function() { ui.browsingEngine.addFacet( "timerange", { "name": column.name, "columnName": column.name, "expression": "value", "mode": "range" } ); } }, { id: "core/scatterplot-facet", label: $.i18n._('core-views')["scatterplot-facet"], click: function() { new ScatterplotDialog(column.name); } }, {}, { id: "core/custom-text-facet", label: $.i18n._('core-views')["custom-text-facet"]+'...', click: function() { doFilterByExpressionPrompt(null, "list"); } }, { id: "core/custom-numeric-facet", label: $.i18n._('core-views')["custom-numeric"]+'...', click: function() { doFilterByExpressionPrompt(null, "range"); } }, { id: "core/customized-facets", label: $.i18n._('core-views')["custom-facets"], submenu: [ { id: "core/word-facet", label: $.i18n._('core-views')["word-facet"], click: function() { ui.browsingEngine.addFacet( "list", { "name": column.name, "columnName": column.name, "expression": "value.split(' ')" } ); } }, {}, { id: "core/duplicates-facet", label: $.i18n._('core-views')["duplicates-facet"], click: function() { ui.browsingEngine.addFacet( "list", { "name": column.name, "columnName": column.name, "expression": "facetCount(value, 'value', '" + column.name + "') > 1" } ); } }, {}, { id: "core/numeric-log-facet", label: $.i18n._('core-views')["numeric-log-facet"], click: function() { ui.browsingEngine.addFacet( "range", { "name": column.name, "columnName": column.name, "expression": "value.log()", "mode": "range" } ); } }, { id: "core/bounded-numeric-log-facet", label: $.i18n._('core-views')["bounded-log-facet"], click: function() { ui.browsingEngine.addFacet( "range", { "name": column.name, "columnName": column.name, "expression": "log(max(1, value))", "mode": "range" } ); } }, {}, { id: "core/text-length-facet", label: $.i18n._('core-views')["text-length-facet"], click: function() { ui.browsingEngine.addFacet( "range", { "name": column.name, "columnName": column.name, "expression": "value.length()", "mode": "range" } ); } }, { id: "core/log-text-length-facet", label: $.i18n._('core-views')["log-length-facet"], click: function() { ui.browsingEngine.addFacet( "range", { "name": column.name, "columnName": column.name, "expression": "value.length().log()", "mode": "range" } ); } }, { id: "core/unicode-charcode-facet", label: $.i18n._('core-views')["unicode-facet"], click: function() { ui.browsingEngine.addFacet( "range", { "name": column.name, "columnName": column.name, "expression": "value.unicode()", "mode": "range" } ); } }, {}, { id: "core/error-facet", label: $.i18n._('core-views')["facet-error"], click: function() { ui.browsingEngine.addFacet( "list", { "name": column.name, "columnName": column.name, "expression": "isError(value)" } ); } }, { id: "core/blank-facet", label: $.i18n._('core-views')["facet-blank"], click: function() { ui.browsingEngine.addFacet( "list", { "name": column.name, "columnName": column.name, "expression": "isBlank(value)" } ); } } ] } ]); MenuSystem.insertAfter(menu, [ "core/facet" ], [ { label: $.i18n._('core-views')["text-filter"], click: function() { ui.browsingEngine.addFacet( "text", { "name" : column.name, "columnName" : column.name, "mode" : "text", "caseSensitive" : false } ); } } ]); });
import React from "react"; // reactstrap components import { Container, Row, Col, Carousel, CarouselItem, CarouselIndicators, } from "reactstrap"; // core components const items = [ { src: require("assets/img/bg1.jpg"), altText: "Nature, United States", caption: "Nature, United States", }, { src: require("assets/img/bg3.jpg"), altText: "Somewhere Beyond, United States", caption: "Somewhere Beyond, United States", }, { src: require("assets/img/bg4.jpg"), altText: "Yellowstone National Park, United States", caption: "Yellowstone National Park, United States", }, ]; function CarouselSection() { const [activeIndex, setActiveIndex] = React.useState(0); const [animating, setAnimating] = React.useState(false); const onExiting = () => { setAnimating(true); }; const onExited = () => { setAnimating(false); }; const next = () => { if (animating) return; const nextIndex = activeIndex === items.length - 1 ? 0 : activeIndex + 1; setActiveIndex(nextIndex); }; const previous = () => { if (animating) return; const nextIndex = activeIndex === 0 ? items.length - 1 : activeIndex - 1; setActiveIndex(nextIndex); }; const goToIndex = (newIndex) => { if (animating) return; setActiveIndex(newIndex); }; return ( <> <div className="section" id="carousel"> <Container> <div className="title"> <h4>Carousel</h4> </div> <Row className="justify-content-center"> <Col lg="8" md="12"> <Carousel activeIndex={activeIndex} next={next} previous={previous} > <CarouselIndicators items={items} activeIndex={activeIndex} onClickHandler={goToIndex} /> {items.map((item) => { return ( <CarouselItem onExiting={onExiting} onExited={onExited} key={item.src} > <img src={item.src} alt={item.altText} /> <div className="carousel-caption d-none d-md-block"> <h5>{item.caption}</h5> </div> </CarouselItem> ); })} <a className="carousel-control-prev" data-slide="prev" href="#pablo" onClick={(e) => { e.preventDefault(); previous(); }} role="button" > <i className="now-ui-icons arrows-1_minimal-left"></i> </a> <a className="carousel-control-next" data-slide="next" href="#pablo" onClick={(e) => { e.preventDefault(); next(); }} role="button" > <i className="now-ui-icons arrows-1_minimal-right"></i> </a> </Carousel> </Col> </Row> </Container> </div> </> ); } export default CarouselSection;
import React, { useEffect, useState } from "react"; import FormScreen from "../../components/registration/FormScreen"; import routes from "../../navigation/routes"; import TextInput from "../../components/TextInput"; import Text from "../../components/typography/Text"; import { screen } from "../../config/dimensions"; function NameScreen({ navigation }) { const [username, setUsername] = useState(false); const [disabled, setDisabled] = useState(false); const handleActive = (username) => { if (username.username) { setDisabled(true); return; } setDisabled(false); }; useEffect(() => { handleActive(username); }, [username]); return ( <FormScreen title="My name is" isActive={disabled} onPress={() => navigation.navigate(routes.REGISTERPRONOUN, { ...username }) } pagination={require("../../assets/pagination/2.png")} > <TextInput placeholder={"Name"} onChangeText={(username) => setUsername({ username })} icon="account" value={username["username"]} style={{ marginBottom: 12 }} width={screen.width * 0.83} /> <Text style={{ lineHeight: 25, marginBottom: 120, alignSelf: "center" }}> The chosen name will appear in you profile </Text> </FormScreen> ); } export default NameScreen;
export default [ { path: "/", text: "home", }, { path: "/books", text: "books", }, { path: "/blog", text: "blog", }, { path: "/contact", text: "contact", }, ]
const MongoClient = require('mongodb').MongoClient; module.exports = function (app) { const connection = app.get('mongodb'); const database = connection.substr(connection.lastIndexOf('/') + 1); const mongoClient = MongoClient.connect(connection, { useNewUrlParser: true }) .then(client => client.db(database)); app.set('mongoClient', mongoClient); };
/* eslint @typescript-eslint/no-var-requires: "off" */ const { AwsCdkConstructLibrary, ProjectType, NodePackageManager } = require("projen"); const project = new AwsCdkConstructLibrary({ name: "datadog-cdk-constructs", description: "CDK Construct Library to automatically instrument Python and Node Lambda functions with Datadog", author: "Datadog", authorOrganization: true, entrypoint: "lib/index.js", repositoryUrl: "https://github.com/DataDog/datadog-cdk-constructs", projectType: ProjectType.LIB, packageManager: NodePackageManager.YARN, jsiiFqn: "projen.AwsCdkConstructLibrary", defaultReleaseBranch: "main", releaseEveryCommit: false, cdkDependenciesAsDeps: false, publishToPypi: { distName: "datadog-cdk-constructs", module: "datadog_cdk_constructs", }, cdkVersion: "1.95.1", deps: ["loglevel"], bundledDeps: ["loglevel"], cdkDependencies: [ "@aws-cdk/aws-lambda", "@aws-cdk/aws-logs", "@aws-cdk/aws-logs-destinations", "@aws-cdk/core", "@aws-cdk/aws-apigateway", ], devDeps: ["ts-node", "prettier", "eslint-config-prettier", "eslint-plugin-prettier"], gitignore: [ "*.js", "!jest.config.js", "!src/sample", "*.d.ts", ".cdk.staging", "cdk.out/", ".parcel-cache", "test/__snapshots__", ".DS_Store", ], npmignore: [ "!LICENSE", "!LICENSE-3rdparty.csv", "!NOTICE", "/scripts", ".prettierrc", "cdk.out/*", "yarn-error.log", "CHANGELOG.md", "CONTRIBUTING.md", ], scripts: { "check-formatting": "prettier --check src/**", }, pullRequestTemplate: false, dependabot: false, buildWorkflow: false, releaseWorkflow: false, rebuildBot: false, mergify: false, licensed: true, docgen: false, }); const eslintConfig = project.tryFindObjectFile(".eslintrc.json"); eslintConfig.addOverride("extends", [ "plugin:@typescript-eslint/recommended", "prettier", "plugin:prettier/recommended", ]); eslintConfig.addOverride("rules", { "@typescript-eslint/no-require-imports": "off", "@typescript-eslint/no-var-requires": "off", "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-empty-interface": "off", "@typescript-eslint/explicit-module-boundary-types": "off", "@typescript-eslint/no-unused-vars": "off", "@typescript-eslint/explicit-function-return-type": "off", "no-console": "off", "no-empty": "off", "comma-dangle": [ "error", { imports: "ignore", exports: "ignore", arrays: "always-multiline", functions: "always-multiline", objects: "always-multiline", }, ], }); eslintConfig.addDeletionOverride("rules.quotes"); /* TODO: tasks.json & package.json DeletionOverrides can be simplified to 5 project.removeScript("<scriptName>") calls once https://github.com/projen/projen/issues/631 is fixed. */ const projenTasks = project.tryFindObjectFile(".projen/tasks.json"); projenTasks.addDeletionOverride("tasks.clobber"); projenTasks.addDeletionOverride("tasks.test:update"); projenTasks.addDeletionOverride("tasks.release"); projenTasks.addDeletionOverride("tasks.bump"); projenTasks.addDeletionOverride("tasks.compat"); projenTasks.addDeletionOverride("tasks.test:compile"); projenTasks.addOverride("tasks.test.steps", [ { exec: "rm -fr lib/", }, { exec: "jest --passWithNoTests --all", }, { spawn: "eslint", }, ]); const npmScripts = project.tryFindObjectFile("package.json"); npmScripts.addDeletionOverride("scripts.clobber"); npmScripts.addDeletionOverride("scripts.test:update"); npmScripts.addDeletionOverride("scripts.release"); npmScripts.addDeletionOverride("scripts.bump"); npmScripts.addDeletionOverride("scripts.compat"); projenTasks.addDeletionOverride("scripts.test:compile"); project.synth();
const join = require('path').join; const koa = require('koa'); const app = new koa(); const configs = [{ name: 'user', db: 'demo', username: 'root', password: 'FLYgirl791008.', dialect: 'mysql', host: 'flagcaicai.f3322.net', port: 63003, modelPath: join(__dirname, 'models') }]; const orm = require('koa-orm')(configs); app.use(orm.middleware); app.use(async function (ctx) { const { User } = ctx.orm('user'); const user = await User.findAll(); ctx.body = { user }; }); app.listen(3000); console.log('listening on 3000');
// todo: add auth schema's // { // connection: "Username-Password-Authentication", // email: "john.doe@gmail.com", // password: "Password123!", // user_metadata: { // name: "John", // surname: "Doe", // }, // email_verified: false, // verify_email: false, // app_metadata: {}, // }; // const signUpSchema = Joi.object().keys({ // connection: Joi.string().required(), // email: Joi.string().email().required(), // password: Joi.string().required(), // user_metadata: Joi.object().keys({ // name: Joi.string(), // surname: Joi.string(), // }), // email_verified: Joi.boolean(), // verify_email: Joi.boolean(), // });
const ProfileView = require("./Profile.svelte") const ContactCard = require("./ContactCard.svelte") const AboutCard = require("./AboutCard.svelte") patchfox.package({ name: "contacts", supportedPlatforms: ["nodejs-ssb"], profile: ProfileView, messageTypes: [ { type: "contact", card: ContactCard, short: true, }, { type: "about", validator: (msg) => msg.value.content && msg.value.content.about && !msg.value.content.about.startsWith("%"), card: AboutCard, }, ], menu: { group: "Contacts", label: "You", items: [ { label: "Profile", event: "package:go", data: { pkg: "contacts", view: "profile", }, }, { label: "Friends", event: "package:go", data: { pkg: "contacts", view: "profile", data: { currentSubView: "friends", }, }, }, { label: "Following", event: "package:go", data: { pkg: "contacts", view: "profile", data: { currentSubView: "following", }, }, }, { label: "Followers", event: "package:go", data: { pkg: "contacts", view: "profile", data: { currentSubView: "followers", }, }, }, ], }, })
module.exports = (emotions) => { return emotions.sort((first, second) => { return first.Confidence - second.Confidence; }).pop().Type; };
/* eslint-disable no-console, no-process-exit, global-require */ const fs = require('fs') const path = require('path') const args = process.argv let action = '' let config = {} const zanata = require('./zanata') const configFile = path.join(__dirname, '../zanata.local.json') const availableLanguages = require('../client/gettext/json/available_languages.json') const languages = setLanguages(availableLanguages) /** * Sample Zanata config file * { "ZANATA_API_KEY":"", "ZANATA_PROJECT":"", "ZANATA_USER":"" } */ if (fs.existsSync(configFile)) { config = require(configFile) } else { if (!process.env.ZANATA_API_KEY) { console.log('Please set env variables or create config file') process.exit(1) } else { config.apiKey = process.env.ZANATA_API_KEY config.project = process.env.ZANATA_PROJECT config.version = (process.env.TRAVIS_BRANCH ? process.env.TRAVIS_BRANCH : process.env.zanataVersion) config.user = process.env.ZANATA_USER } } zanata.setConfig(config) if (args.length < 3) { console.log('Did not specify the correct number of args') process.exit(1) } else { action = args[2] } if (action === 'upload') { const potFile = path.join(__dirname, '../client/gettext/po/manageiq-ui-service.pot') zanata.upload(potFile) } else if (action === 'download') { console.log('Downloading Files') const outputDir = path.join(__dirname, '../client/gettext/po/') zanata.download(languages, outputDir) } function setLanguages (languageList) { const tmpLanguages = [] for (var key in languageList) { tmpLanguages.push(key) } return tmpLanguages }
import {all, call, put, take, fork} from 'redux-saga/effects'; import {getTopicArrayByForumIdApi} from 'api'; import {getForumArrayByParentForumId, setPaginationTotalItemsCount, setPaginationPageNumber} from 'containers/reducer'; const initialState = { topicArray: [] }; export const GET_TOPIC_ARRAY_BY_FORUM_ID = 'GET_TOPIC_ARRAY_BY_FORUM_ID'; export const getTopicArrayByForumId = (forumId, pageNumber, pageSize) => ({ type: GET_TOPIC_ARRAY_BY_FORUM_ID, payload: {forumId, pageNumber, pageSize} }); export const GET_TOPIC_ARRAY_BY_FORUM_ID_SUCCESS = 'GET_TOPIC_ARRAY_BY_FORUM_ID_SUCCESS'; export const getTopicArrayByForumIdSuccess = topicArray => ({ type: GET_TOPIC_ARRAY_BY_FORUM_ID_SUCCESS, payload: {topicArray} }); export const forumReducer = (state = initialState, {type, payload}) => { switch (type) { case GET_TOPIC_ARRAY_BY_FORUM_ID_SUCCESS: return {...state, topicArray: payload.topicArray}; default: break; } return state; }; /* eslint-disable func-style, fp/no-nil, fp/no-loops, fp/no-unused-expression, func-names */ export const getTopicArrayForumIdNonBlockSaga = function* ({forumId, pageNumber, pageSize}) { const {response, error} = yield call(getTopicArrayByForumIdApi, {forumId, pageNumber, pageSize}); if (response) { const {data, totalItemsCount} = response; yield put(getTopicArrayByForumIdSuccess(data)); yield put(setPaginationPageNumber(pageNumber)); yield put(setPaginationTotalItemsCount(totalItemsCount)); } else { yield put({type: 'PRODUCTS_REQUEST_FAILED', error}); } }; export const getTopicArrayForumIdSaga = function* () { for (;;) { const {payload} = yield take(GET_TOPIC_ARRAY_BY_FORUM_ID); yield fork(getTopicArrayForumIdNonBlockSaga, payload); yield put(getForumArrayByParentForumId(payload.forumId)); } }; export const forumSaga = function* () { yield all([ getTopicArrayForumIdSaga() ]); }; /* eslint-enable func-style, fp/no-nil, fp/no-loops, fp/no-unused-expression */
/* Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.lang['lt']={"editor":"Pilnas redaktorius","editorPanel":"Pilno redagtoriaus skydelis","common":{"editorHelp":"Spauskite ALT 0 dėl pagalbos","browseServer":"Naršyti po serverį","url":"URL","protocol":"Protokolas","upload":"Siųsti","uploadSubmit":"Siųsti į serverį","image":"Vaizdas","flash":"Flash","form":"Forma","checkbox":"Žymimasis langelis","radio":"Žymimoji akutė","textField":"Teksto laukas","textarea":"Teksto sritis","hiddenField":"Nerodomas laukas","button":"Mygtukas","select":"Atrankos laukas","imageButton":"Vaizdinis mygtukas","notSet":"<nėra nustatyta>","id":"Id","name":"Vardas","langDir":"Teksto kryptis","langDirLtr":"Iš kairės į dešinę (LTR)","langDirRtl":"Iš dešinės į kairę (RTL)","langCode":"Kalbos kodas","longDescr":"Ilgas aprašymas URL","cssClass":"Stilių lentelės klasės","advisoryTitle":"Konsultacinė antraštė","cssStyle":"Stilius","ok":"OK","cancel":"Nutraukti","close":"Uždaryti","preview":"Peržiūrėti","resize":"Pavilkite, kad pakeistumėte dydį","generalTab":"Bendros savybės","advancedTab":"Papildomas","validateNumberFailed":"Ši reikšmė nėra skaičius.","confirmNewPage":"Visas neišsaugotas turinys bus prarastas. Ar tikrai norite įkrauti naują puslapį?","confirmCancel":"Kai kurie parametrai pasikeitė. Ar tikrai norite užverti langą?","options":"Parametrai","target":"Tikslinė nuoroda","targetNew":"Naujas langas (_blank)","targetTop":"Viršutinis langas (_top)","targetSelf":"Esamas langas (_self)","targetParent":"Paskutinis langas (_parent)","langDirLTR":"Iš kairės į dešinę (LTR)","langDirRTL":"Iš dešinės į kairę (RTL)","styles":"Stilius","cssClasses":"Stilių klasės","width":"Plotis","height":"Aukštis","align":"Lygiuoti","left":"Kairę","right":"Dešinę","center":"Centrą","justify":"Lygiuoti abi puses","alignLeft":"Lygiuoti kairę","alignRight":"Lygiuoti dešinę","alignCenter":"Align Center","alignTop":"Viršūnę","alignMiddle":"Vidurį","alignBottom":"Apačią","alignNone":"Niekas","invalidValue":"Neteisinga reikšmė.","invalidHeight":"Aukštis turi būti nurodytas skaičiais.","invalidWidth":"Plotis turi būti nurodytas skaičiais.","invalidLength":"Value specified for the \"%1\" field must be a positive number with or without a valid measurement unit (%2).","invalidCssLength":"Reikšmė nurodyta \"%1\" laukui, turi būti teigiamas skaičius su arba be tinkamo CSS matavimo vieneto (px, %, in, cm, mm, em, ex, pt arba pc).","invalidHtmlLength":"Reikšmė nurodyta \"%1\" laukui, turi būti teigiamas skaičius su arba be tinkamo HTML matavimo vieneto (px arba %).","invalidInlineStyle":"Reikšmė nurodyta vidiniame stiliuje turi būti sudaryta iš vieno šių reikšmių \"vardas : reikšmė\", atskirta kabliataškiais.","cssLengthTooltip":"Įveskite reikšmę pikseliais arba skaičiais su tinkamu CSS vienetu (px, %, in, cm, mm, em, ex, pt arba pc).","unavailable":"%1<span class=\"cke_accessibility\">, netinkamas</span>","keyboard":{"8":"Backspace","13":"Enter","16":"Shift","17":"Ctrl","18":"Alt","32":"Space","35":"End","36":"Home","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","124":"F13","125":"F14","126":"F15","127":"F16","128":"F17","129":"F18","130":"F19","131":"F20","132":"F21","133":"F22","134":"F23","135":"F24","224":"Command"},"keyboardShortcut":"Keyboard shortcut","optionDefault":"Default"},"about":{"copy":"Copyright &copy; $1. Visos teiss saugomos.","dlgTitle":"Apie CKEditor 4","moreInfo":"Dėl licencijavimo apsilankykite mūsų svetainėje:"},"basicstyles":{"bold":"Pusjuodis","italic":"Kursyvas","strike":"Perbrauktas","subscript":"Apatinis indeksas","superscript":"Viršutinis indeksas","underline":"Pabrauktas"},"blockquote":{"toolbar":"Citata"},"notification":{"closed":"Notification closed."},"button":{"selectedLabel":"%1 (Pasirinkta)"},"toolbar":{"toolbarCollapse":"Apjungti įrankių juostą","toolbarExpand":"Išplėsti įrankių juostą","toolbarGroups":{"document":"Dokumentas","clipboard":"Atmintinė/Atgal","editing":"Redagavimas","forms":"Formos","basicstyles":"Pagrindiniai stiliai","paragraph":"Paragrafas","links":"Nuorodos","insert":"Įterpti","styles":"Stiliai","colors":"Spalvos","tools":"Įrankiai"},"toolbars":"Redaktoriaus įrankiai"},"clipboard":{"copy":"Kopijuoti","copyError":"Jūsų naršyklės saugumo nustatymai neleidžia redaktoriui automatiškai įvykdyti kopijavimo operacijų. Tam prašome naudoti klaviatūrą (Ctrl/Cmd+C).","cut":"Iškirpti","cutError":"Jūsų naršyklės saugumo nustatymai neleidžia redaktoriui automatiškai įvykdyti iškirpimo operacijų. Tam prašome naudoti klaviatūrą (Ctrl/Cmd+X).","paste":"Įdėti","pasteNotification":"Press %1 to paste. Your browser doesn‘t support pasting with the toolbar button or context menu option.","pasteArea":"Įkelti dalį","pasteMsg":"Paste your content inside the area below and press OK.","title":"Įdėti"},"contextmenu":{"options":"Kontekstinio meniu parametrai"},"elementspath":{"eleLabel":"Elemento kelias","eleTitle":"%1 elementas"},"filetools":{"loadError":"Error occurred during file read.","networkError":"Network error occurred during file upload.","httpError404":"HTTP error occurred during file upload (404: File not found).","httpError403":"HTTP error occurred during file upload (403: Forbidden).","httpError":"HTTP error occurred during file upload (error status: %1).","noUrlError":"Upload URL is not defined.","responseError":"Incorrect server response."},"format":{"label":"Šrifto formatas","panelTitle":"Šrifto formatas","tag_address":"Kreipinio","tag_div":"Normalus (DIV)","tag_h1":"Antraštinis 1","tag_h2":"Antraštinis 2","tag_h3":"Antraštinis 3","tag_h4":"Antraštinis 4","tag_h5":"Antraštinis 5","tag_h6":"Antraštinis 6","tag_p":"Normalus","tag_pre":"Formuotas"},"horizontalrule":{"toolbar":"Įterpti horizontalią liniją"},"image":{"alt":"Alternatyvus Tekstas","border":"Rėmelis","btnUpload":"Siųsti į serverį","button2Img":"Ar norite mygtuką paversti paprastu paveiksliuku?","hSpace":"Hor.Erdvė","img2Button":"Ar norite paveiksliuką paversti mygtuku?","infoTab":"Vaizdo informacija","linkTab":"Nuoroda","lockRatio":"Išlaikyti proporciją","menu":"Vaizdo savybės","resetSize":"Atstatyti dydį","title":"Vaizdo savybės","titleButton":"Vaizdinio mygtuko savybės","upload":"Nusiųsti","urlMissing":"Paveiksliuko nuorodos nėra.","vSpace":"Vert.Erdvė","validateBorder":"Reikšmė turi būti sveikas skaičius.","validateHSpace":"Reikšmė turi būti sveikas skaičius.","validateVSpace":"Reikšmė turi būti sveikas skaičius."},"indent":{"indent":"Padidinti įtrauką","outdent":"Sumažinti įtrauką"},"fakeobjects":{"anchor":"Žymė","flash":"Flash animacija","hiddenfield":"Paslėptas laukas","iframe":"IFrame","unknown":"Nežinomas objektas"},"link":{"acccessKey":"Prieigos raktas","advanced":"Papildomas","advisoryContentType":"Konsultacinio turinio tipas","advisoryTitle":"Konsultacinė antraštė","anchor":{"toolbar":"Įterpti/modifikuoti žymę","menu":"Žymės savybės","title":"Žymės savybės","name":"Žymės vardas","errorName":"Prašome įvesti žymės vardą","remove":"Pašalinti žymę"},"anchorId":"Pagal žymės Id","anchorName":"Pagal žymės vardą","charset":"Susietų išteklių simbolių lentelė","cssClasses":"Stilių lentelės klasės","download":"Force Download","displayText":"Display Text","emailAddress":"El.pašto adresas","emailBody":"Žinutės turinys","emailSubject":"Žinutės tema","id":"Id","info":"Nuorodos informacija","langCode":"Teksto kryptis","langDir":"Teksto kryptis","langDirLTR":"Iš kairės į dešinę (LTR)","langDirRTL":"Iš dešinės į kairę (RTL)","menu":"Taisyti nuorodą","name":"Vardas","noAnchors":"(Šiame dokumente žymių nėra)","noEmail":"Prašome įvesti el.pašto adresą","noUrl":"Prašome įvesti nuorodos URL","other":"<kitas>","popupDependent":"Priklausomas (Netscape)","popupFeatures":"Išskleidžiamo lango savybės","popupFullScreen":"Visas ekranas (IE)","popupLeft":"Kairė pozicija","popupLocationBar":"Adreso juosta","popupMenuBar":"Meniu juosta","popupResizable":"Kintamas dydis","popupScrollBars":"Slinkties juostos","popupStatusBar":"Būsenos juosta","popupToolbar":"Mygtukų juosta","popupTop":"Viršutinė pozicija","rel":"Sąsajos","selectAnchor":"Pasirinkite žymę","styles":"Stilius","tabIndex":"Tabuliavimo indeksas","target":"Paskirties vieta","targetFrame":"<kadras>","targetFrameName":"Paskirties kadro vardas","targetPopup":"<išskleidžiamas langas>","targetPopupName":"Paskirties lango vardas","title":"Nuoroda","toAnchor":"Žymė šiame puslapyje","toEmail":"El.paštas","toUrl":"Nuoroda","toolbar":"Įterpti/taisyti nuorodą","type":"Nuorodos tipas","unlink":"Panaikinti nuorodą","upload":"Siųsti"},"list":{"bulletedlist":"Suženklintas sąrašas","numberedlist":"Numeruotas sąrašas"},"magicline":{"title":"Insert paragraph here"},"maximize":{"maximize":"Išdidinti","minimize":"Sumažinti"},"pastetext":{"button":"Įdėti kaip gryną tekstą","pasteNotification":"Press %1 to paste. Your browser doesn‘t support pasting with the toolbar button or context menu option.","title":"Įdėti kaip gryną tekstą"},"pastefromword":{"confirmCleanup":"Tekstas, kurį įkeliate yra kopijuojamas iš Word. Ar norite jį išvalyti prieš įkeliant?","error":"Dėl vidinių sutrikimų, nepavyko išvalyti įkeliamo teksto","title":"Įdėti iš Word","toolbar":"Įdėti iš Word"},"removeformat":{"toolbar":"Panaikinti formatą"},"sourcearea":{"toolbar":"Šaltinis"},"specialchar":{"options":"Specialaus simbolio nustatymai","title":"Pasirinkite specialų simbolį","toolbar":"Įterpti specialų simbolį"},"scayt":{"btn_about":"Apie SCAYT","btn_dictionaries":"Žodynai","btn_disable":"Išjungti SCAYT","btn_enable":"Įjungti SCAYT","btn_langs":"Kalbos","btn_options":"Parametrai","text_title":"Tikrinti klaidas kai rašoma"},"stylescombo":{"label":"Stilius","panelTitle":"Stilių formatavimas","panelTitle1":"Blokų stiliai","panelTitle2":"Vidiniai stiliai","panelTitle3":"Objektų stiliai"},"table":{"border":"Rėmelio dydis","caption":"Antraštė","cell":{"menu":"Langelis","insertBefore":"Įterpti langelį prieš","insertAfter":"Įterpti langelį po","deleteCell":"Šalinti langelius","merge":"Sujungti langelius","mergeRight":"Sujungti su dešine","mergeDown":"Sujungti su apačia","splitHorizontal":"Skaidyti langelį horizontaliai","splitVertical":"Skaidyti langelį vertikaliai","title":"Cell nustatymai","cellType":"Cell rūšis","rowSpan":"Eilučių Span","colSpan":"Stulpelių Span","wordWrap":"Sutraukti raides","hAlign":"Horizontalus lygiavimas","vAlign":"Vertikalus lygiavimas","alignBaseline":"Apatinė linija","bgColor":"Fono spalva","borderColor":"Rėmelio spalva","data":"Data","header":"Antraštė","yes":"Taip","no":"Ne","invalidWidth":"Reikšmė turi būti skaičius.","invalidHeight":"Reikšmė turi būti skaičius.","invalidRowSpan":"Reikšmė turi būti skaičius.","invalidColSpan":"Reikšmė turi būti skaičius.","chooseColor":"Pasirinkite"},"cellPad":"Tarpas nuo langelio rėmo iki teksto","cellSpace":"Tarpas tarp langelių","column":{"menu":"Stulpelis","insertBefore":"Įterpti stulpelį prieš","insertAfter":"Įterpti stulpelį po","deleteColumn":"Šalinti stulpelius"},"columns":"Stulpeliai","deleteTable":"Šalinti lentelę","headers":"Antraštės","headersBoth":"Abu","headersColumn":"Pirmas stulpelis","headersNone":"Nėra","headersRow":"Pirma eilutė","invalidBorder":"Reikšmė turi būti nurodyta skaičiumi.","invalidCellPadding":"Reikšmė turi būti nurodyta skaičiumi.","invalidCellSpacing":"Reikšmė turi būti nurodyta skaičiumi.","invalidCols":"Skaičius turi būti didesnis nei 0.","invalidHeight":"Reikšmė turi būti nurodyta skaičiumi.","invalidRows":"Skaičius turi būti didesnis nei 0.","invalidWidth":"Reikšmė turi būti nurodyta skaičiumi.","menu":"Lentelės savybės","row":{"menu":"Eilutė","insertBefore":"Įterpti eilutę prieš","insertAfter":"Įterpti eilutę po","deleteRow":"Šalinti eilutes"},"rows":"Eilutės","summary":"Santrauka","title":"Lentelės savybės","toolbar":"Lentelė","widthPc":"procentais","widthPx":"taškais","widthUnit":"pločio vienetas"},"undo":{"redo":"Atstatyti","undo":"Atšaukti"},"widget":{"move":"Click and drag to move","label":"%1 widget"},"uploadwidget":{"abort":"Upload aborted by the user.","doneOne":"File successfully uploaded.","doneMany":"Successfully uploaded %1 files.","uploadOne":"Uploading file ({percentage}%)...","uploadMany":"Uploading files, {current} of {max} done ({percentage}%)..."},"wsc":{"btnIgnore":"Ignoruoti","btnIgnoreAll":"Ignoruoti visus","btnReplace":"Pakeisti","btnReplaceAll":"Pakeisti visus","btnUndo":"Atšaukti","changeTo":"Pakeisti į","errorLoading":"Klaida įkraunant servisą: %s.","ieSpellDownload":"Rašybos tikrinimas neinstaliuotas. Ar Jūs norite jį dabar atsisiųsti?","manyChanges":"Rašybos tikrinimas baigtas: Pakeista %1 žodžių","noChanges":"Rašybos tikrinimas baigtas: Nėra pakeistų žodžių","noMispell":"Rašybos tikrinimas baigtas: Nerasta rašybos klaidų","noSuggestions":"- Nėra pasiūlymų -","notAvailable":"Atleiskite, šiuo metu servisas neprieinamas.","notInDic":"Žodyne nerastas","oneChange":"Rašybos tikrinimas baigtas: Vienas žodis pakeistas","progress":"Vyksta rašybos tikrinimas...","title":"Tikrinti klaidas","toolbar":"Rašybos tikrinimas"},"colorbutton":{"auto":"Automatinis","bgColorTitle":"Fono spalva","colors":{"000":"Juoda","800000":"Kaštoninė","8B4513":"Tamsiai ruda","2F4F4F":"Pilka tamsaus šiferio","008080":"Teal","000080":"Karinis","4B0082":"Indigo","696969":"Tamsiai pilka","B22222":"Ugnies","A52A2A":"Ruda","DAA520":"Aukso","006400":"Tamsiai žalia","40E0D0":"Turquoise","0000CD":"Vidutinė mėlyna","800080":"Violetinė","808080":"Pilka","F00":"Raudona","FF8C00":"Tamsiai oranžinė","FFD700":"Auksinė","008000":"Žalia","0FF":"Žydra","00F":"Mėlyna","EE82EE":"Violetinė","A9A9A9":"Dim Gray","FFA07A":"Light Salmon","FFA500":"Oranžinė","FFFF00":"Geltona","00FF00":"Citrinų","AFEEEE":"Pale Turquoise","ADD8E6":"Šviesiai mėlyna","DDA0DD":"Plum","D3D3D3":"Šviesiai pilka","FFF0F5":"Lavender Blush","FAEBD7":"Antique White","FFFFE0":"Šviesiai geltona","F0FFF0":"Honeydew","F0FFFF":"Azure","F0F8FF":"Alice Blue","E6E6FA":"Lavender","FFF":"Balta","1ABC9C":"Strong Cyan","2ECC71":"Emerald","3498DB":"Bright Blue","9B59B6":"Amethyst","4E5F70":"Grayish Blue","F1C40F":"Vivid Yellow","16A085":"Dark Cyan","27AE60":"Dark Emerald","2980B9":"Strong Blue","8E44AD":"Dark Violet","2C3E50":"Desaturated Blue","F39C12":"Orange","E67E22":"Carrot","E74C3C":"Pale Red","ECF0F1":"Bright Silver","95A5A6":"Light Grayish Cyan","DDD":"Light Gray","D35400":"Pumpkin","C0392B":"Strong Red","BDC3C7":"Silver","7F8C8D":"Grayish Cyan","999":"Dark Gray"},"more":"Daugiau spalvų...","panelTitle":"Spalva","textColorTitle":"Teksto spalva"},"autoembed":{"embeddingInProgress":"Trying to embed pasted URL...","embeddingFailed":"This URL could not be automatically embedded."},"font":{"fontSize":{"label":"Šrifto dydis","voiceLabel":"Šrifto dydis","panelTitle":"Šrifto dydis"},"label":"Šriftas","panelTitle":"Šriftas","voiceLabel":"Šriftas"},"pastecode":{"button":"Paste as code","title":"Paste as code"},"textindent":{"labelName":"Insert first line indentation"},"save":{"toolbar":"Išsaugoti"},"div":{"IdInputLabel":"Id","advisoryTitleInputLabel":"Patariamas pavadinimas","cssClassInputLabel":"Stilių klasės","edit":"Redaguoti Div","inlineStyleInputLabel":"Vidiniai stiliai","langDirLTRLabel":"Iš kairės į dešinę (LTR)","langDirLabel":"Kalbos nurodymai","langDirRTLLabel":"Iš dešinės į kairę (RTL)","languageCodeInputLabel":" Kalbos kodas","remove":"Pašalinti Div","styleSelectLabel":"Stilius","title":"Sukurti Div elementą","toolbar":"Sukurti Div elementą"},"colordialog":{"clear":"Išvalyti","highlight":"Paryškinti","options":"Spalvos nustatymai","selected":"Pasirinkta spalva","title":"Pasirinkite spalvą"}};
"use strict"; /** * Copyright 2018 Novage LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); function getSchemedUri(uri) { return uri.startsWith("//") ? window.location.protocol + uri : uri; } exports.getSchemedUri = getSchemedUri; function getMasterSwarmId(masterManifestUri, settings) { return (settings.swarmId && (settings.swarmId.length !== 0)) ? settings.swarmId : masterManifestUri.split("?")[0]; } exports.getMasterSwarmId = getMasterSwarmId;