text
stringlengths 2
1.05M
|
|---|
import React, { useState, useRef } from "react";
const Events = (props) => {
const [ counter, setCounter ] = useState(props.counter);
const handleClick = () => {
setCounter(counter + 1);
fetch("/putEvents", {
method : "PUT",
body : JSON.stringify({
id : props.id
}),
headers : {
"Content-Type" : "application/json"
}
})
.then((res) => res.json())
.catch((error) => console.error("Error:", error))
.then((response) => console.log("Success:", response));
};
return (
<div className="col event-card">
<h2 className="text-center">{props.name}</h2>
<img className="mx-auto d-block mt-3" src={props.url} alt="Images taken from API" />
<p className="eText text-justify mt-3">{props.description}</p>
<button className="btn" id="likeBtn" onClick={handleClick}>
suscribete 👍🏻
<span className="ml-2">{counter}</span>
</button>
</div>
);
};
export default Events;
|
/**
* Copyright IBM Corp. 2016, 2020
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*
* Code generated by @carbon/icon-build-helpers. DO NOT EDIT.
*/
'use strict';
var _24 = {
"elem": "svg",
"attrs": {
"xmlns": "http://www.w3.org/2000/svg",
"viewBox": "0 0 32 32",
"fill": "currentColor",
"width": 24,
"height": 24
},
"content": [{
"elem": "path",
"attrs": {
"d": "M28,4H4A2,2,0,0,0,2,6V26a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V6A2,2,0,0,0,28,4ZM4,26V14H28V26Z"
}
}],
"name": "open-panel--filled--top",
"size": 24
};
module.exports = _24;
|
/********************************************
* REVOLUTION 5.4.6.4 EXTENSION - PARALLAX
* @version: 2.2.3 (17.05.2017)
* @requires jquery.themepunch.revolution.js
* @author ThemePunch
*********************************************/
!function(a){"use strict";function e(a,b){a.lastscrolltop=b}var b=jQuery.fn.revolution,c=b.is_mobile(),d={alias:"Parallax Min JS",name:"revolution.extensions.parallax.min.js",min_core:"5.4.5",version:"2.2.3"};jQuery.extend(!0,b,{checkForParallax:function(a,e){function g(a){if("3D"==f.type||"3d"==f.type){a.find(".slotholder").wrapAll('<div class="dddwrapper" style="width:100%;height:100%;position:absolute;top:0px;left:0px;overflow:hidden"></div>'),a.find(".tp-parallax-wrap").wrapAll('<div class="dddwrapper-layer" style="width:100%;height:100%;position:absolute;top:0px;left:0px;z-index:5;overflow:'+f.ddd_layer_overflow+';"></div>'),a.find(".rs-parallaxlevel-tobggroup").closest(".tp-parallax-wrap").wrapAll('<div class="dddwrapper-layertobggroup" style="position:absolute;top:0px;left:0px;z-index:50;width:100%;height:100%"></div>');var b=a.find(".dddwrapper"),c=a.find(".dddwrapper-layer");a.find(".dddwrapper-layertobggroup").appendTo(b),"carousel"==e.sliderType&&("on"==f.ddd_shadow&&b.addClass("dddwrappershadow"),punchgs.TweenLite.set(b,{borderRadius:e.carousel.border_radius})),punchgs.TweenLite.set(a,{overflow:"visible",transformStyle:"preserve-3d",perspective:1600}),punchgs.TweenLite.set(b,{force3D:"auto",transformOrigin:"50% 50%"}),punchgs.TweenLite.set(c,{force3D:"auto",transformOrigin:"50% 50%",zIndex:5}),punchgs.TweenLite.set(e.ul,{transformStyle:"preserve-3d",transformPerspective:1600})}}if("stop"===b.compare_version(d).check)return!1;var f=e.parallax;if(!f.done){if(f.done=!0,c&&"on"==f.disable_onmobile)return!1;"3D"!=f.type&&"3d"!=f.type||(punchgs.TweenLite.set(e.c,{overflow:f.ddd_overflow}),punchgs.TweenLite.set(e.ul,{overflow:f.ddd_overflow}),"carousel"!=e.sliderType&&"on"==f.ddd_shadow&&(e.c.prepend('<div class="dddwrappershadow"></div>'),punchgs.TweenLite.set(e.c.find(".dddwrappershadow"),{force3D:"auto",transformPerspective:1600,transformOrigin:"50% 50%",width:"100%",height:"100%",position:"absolute",top:0,left:0,zIndex:0}))),e.li.each(function(){g(jQuery(this))}),("3D"==f.type||"3d"==f.type)&&e.c.find(".tp-static-layers").length>0&&(punchgs.TweenLite.set(e.c.find(".tp-static-layers"),{top:0,left:0,width:"100%",height:"100%"}),g(e.c.find(".tp-static-layers"))),f.pcontainers=new Array,f.pcontainer_depths=new Array,f.bgcontainers=new Array,f.bgcontainer_depths=new Array,e.c.find(".tp-revslider-slidesli .slotholder, .tp-revslider-slidesli .rs-background-video-layer").each(function(){var a=jQuery(this),b=a.data("bgparallax")||e.parallax.bgparallax;void 0!==(b="on"==b?1:b)&&"off"!==b&&(f.bgcontainers.push(a),f.bgcontainer_depths.push(e.parallax.levels[parseInt(b,0)-1]/100))});for(var h=1;h<=f.levels.length;h++)e.c.find(".rs-parallaxlevel-"+h).each(function(){var a=jQuery(this),b=a.closest(".tp-parallax-wrap");b.data("parallaxlevel",f.levels[h-1]),b.addClass("tp-parallax-container"),f.pcontainers.push(b),f.pcontainer_depths.push(f.levels[h-1])});"mouse"!=f.type&&"scroll+mouse"!=f.type&&"mouse+scroll"!=f.type&&"3D"!=f.type&&"3d"!=f.type||(a.mouseenter(function(b){var c=a.find(".active-revslide"),d=a.offset().top,e=a.offset().left,f=b.pageX-e,g=b.pageY-d;c.data("enterx",f),c.data("entery",g)}),a.on("mousemove.hoverdir, mouseleave.hoverdir, trigger3dpath",function(b,c){var d=c&&c.li?c.li:a.find(".active-revslide");if("enterpoint"==f.origo){var g=a.offset().top,h=a.offset().left;void 0==d.data("enterx")&&d.data("enterx",b.pageX-h),void 0==d.data("entery")&&d.data("entery",b.pageY-g);var i=d.data("enterx")||b.pageX-h,j=d.data("entery")||b.pageY-g,k=i-(b.pageX-h),l=j-(b.pageY-g),m=f.speed/1e3||.4}else var g=a.offset().top,h=a.offset().left,k=e.conw/2-(b.pageX-h),l=e.conh/2-(b.pageY-g),m=f.speed/1e3||3;"mouseleave"==b.type&&(k=f.ddd_lasth||0,l=f.ddd_lastv||0,m=1.5);for(var n=0;n<f.pcontainers.length;n++){var o=f.pcontainers[n],p=f.pcontainer_depths[n],q="3D"==f.type||"3d"==f.type?p/200:p/100,r=k*q,s=l*q;"scroll+mouse"==f.type||"mouse+scroll"==f.type?punchgs.TweenLite.to(o,m,{force3D:"auto",x:r,ease:punchgs.Power3.easeOut,overwrite:"all"}):punchgs.TweenLite.to(o,m,{force3D:"auto",x:r,y:s,ease:punchgs.Power3.easeOut,overwrite:"all"})}if("3D"==f.type||"3d"==f.type){var t=".tp-revslider-slidesli .dddwrapper, .dddwrappershadow, .tp-revslider-slidesli .dddwrapper-layer, .tp-static-layers .dddwrapper-layer";"carousel"===e.sliderType&&(t=".tp-revslider-slidesli .dddwrapper, .tp-revslider-slidesli .dddwrapper-layer, .tp-static-layers .dddwrapper-layer"),e.c.find(t).each(function(){var a=jQuery(this),c=f.levels[f.levels.length-1]/200,d=k*c,g=l*c,h=0==e.conw?0:Math.round(k/e.conw*c*100)||0,i=0==e.conh?0:Math.round(l/e.conh*c*100)||0,j=a.closest("li"),n=0,o=!1;a.hasClass("dddwrapper-layer")&&(n=f.ddd_z_correction||65,o=!0),a.hasClass("dddwrapper-layer")&&(d=0,g=0),j.hasClass("active-revslide")||"carousel"!=e.sliderType?"on"!=f.ddd_bgfreeze||o?punchgs.TweenLite.to(a,m,{rotationX:i,rotationY:-h,x:d,z:n,y:g,ease:punchgs.Power3.easeOut,overwrite:"all"}):punchgs.TweenLite.to(a,.5,{force3D:"auto",rotationY:0,rotationX:0,z:0,ease:punchgs.Power3.easeOut,overwrite:"all"}):punchgs.TweenLite.to(a,.5,{force3D:"auto",rotationY:0,x:0,y:0,rotationX:0,z:0,ease:punchgs.Power3.easeOut,overwrite:"all"}),"mouseleave"==b.type&&punchgs.TweenLite.to(jQuery(this),3.8,{z:0,ease:punchgs.Power3.easeOut})})}}),c&&(window.ondeviceorientation=function(b){var c=Math.round(b.beta||0)-70,d=Math.round(b.gamma||0),g=a.find(".active-revslide");if(jQuery(window).width()>jQuery(window).height()){var h=d;d=c,c=h}var i=a.width(),j=a.height(),k=360/i*d,l=180/j*c,m=f.speed/1e3||3,n=[];if(g.find(".tp-parallax-container").each(function(a){n.push(jQuery(this))}),a.find(".tp-static-layers .tp-parallax-container").each(function(){n.push(jQuery(this))}),jQuery.each(n,function(){var a=jQuery(this),b=parseInt(a.data("parallaxlevel"),0),c=b/100,d=k*c*2,e=l*c*4;punchgs.TweenLite.to(a,m,{force3D:"auto",x:d,y:e,ease:punchgs.Power3.easeOut,overwrite:"all"})}),"3D"==f.type||"3d"==f.type){var o=".tp-revslider-slidesli .dddwrapper, .dddwrappershadow, .tp-revslider-slidesli .dddwrapper-layer, .tp-static-layers .dddwrapper-layer";"carousel"===e.sliderType&&(o=".tp-revslider-slidesli .dddwrapper, .tp-revslider-slidesli .dddwrapper-layer, .tp-static-layers .dddwrapper-layer"),e.c.find(o).each(function(){var a=jQuery(this),c=f.levels[f.levels.length-1]/200,d=k*c,g=l*c*3,h=0==e.conw?0:Math.round(k/e.conw*c*500)||0,i=0==e.conh?0:Math.round(l/e.conh*c*700)||0,j=a.closest("li"),n=0,o=!1;a.hasClass("dddwrapper-layer")&&(n=f.ddd_z_correction||65,o=!0),a.hasClass("dddwrapper-layer")&&(d=0,g=0),j.hasClass("active-revslide")||"carousel"!=e.sliderType?"on"!=f.ddd_bgfreeze||o?punchgs.TweenLite.to(a,m,{rotationX:i,rotationY:-h,x:d,z:n,y:g,ease:punchgs.Power3.easeOut,overwrite:"all"}):punchgs.TweenLite.to(a,.5,{force3D:"auto",rotationY:0,rotationX:0,z:0,ease:punchgs.Power3.easeOut,overwrite:"all"}):punchgs.TweenLite.to(a,.5,{force3D:"auto",rotationY:0,z:0,x:0,y:0,rotationX:0,ease:punchgs.Power3.easeOut,overwrite:"all"}),"mouseleave"==b.type&&punchgs.TweenLite.to(jQuery(this),3.8,{z:0,ease:punchgs.Power3.easeOut})})}}));var i=e.scrolleffect;if(i.bgs=new Array,i.on){if("on"===i.on_slidebg)for(var h=0;h<e.allslotholder.length;h++)i.bgs.push(e.allslotholder[h]);i.multiplicator_layers=parseFloat(i.multiplicator_layers),i.multiplicator=parseFloat(i.multiplicator)}void 0!==i.layers&&0===i.layers.length&&(i.layers=!1),void 0!==i.bgs&&0===i.bgs.length&&(i.bgs=!1),b.scrollTicker(e,a)}},scrollTicker:function(a,d){1!=a.scrollTicker&&(a.scrollTicker=!0,c?(punchgs.TweenLite.ticker.fps(150),punchgs.TweenLite.ticker.addEventListener("tick",function(){b.scrollHandling(a)},d,!1,1)):document.addEventListener("scroll",function(c){b.scrollHandling(a,!0)},{passive:!0})),b.scrollHandling(a,!0)},scrollHandling:function(a,d,f){if(a.lastwindowheight=a.lastwindowheight||window.innerHeight,a.conh=0===a.conh||void 0===a.conh?a.infullscreenmode?a.minHeight:a.c.height():a.conh,a.lastscrolltop==window.scrollY&&!a.duringslidechange&&!d)return!1;punchgs.TweenLite.delayedCall(.2,e,[a,window.scrollY]);var g=a.c[0].getBoundingClientRect(),h=a.viewPort,i=a.parallax,j=g.top<0||g.height>a.lastwindowheight?g.top/g.height:g.bottom>a.lastwindowheight?(g.bottom-a.lastwindowheight)/g.height:0;if(a.scrollproc=j,b.callBackHandling&&b.callBackHandling(a,"parallax","start"),h.enable){var k=1-Math.abs(j);k=k<0?0:k,jQuery.isNumeric(h.visible_area)||-1!==h.visible_area.indexOf("%")&&(h.visible_area=parseInt(h.visible_area)/100),1-h.visible_area<=k?a.inviewport||(a.inviewport=!0,b.enterInViewPort(a)):a.inviewport&&(a.inviewport=!1,b.leaveViewPort(a))}if(c&&"on"==i.disable_onmobile)return!1;if("3d"!=i.type&&"3D"!=i.type){if(("scroll"==i.type||"scroll+mouse"==i.type||"mouse+scroll"==i.type)&&i.pcontainers)for(var l=0;l<i.pcontainers.length;l++)if(i.pcontainers[l].length>0){var m=i.pcontainers[l],n=i.pcontainer_depths[l]/100,o=Math.round(j*(-n*a.conh)*10)/10||0,p=void 0!==f?f:i.speedls/1e3||0;m.data("parallaxoffset",o),punchgs.TweenLite.to(m,p,{overwrite:"auto",force3D:"auto",y:o})}if(i.bgcontainers)for(var l=0;l<i.bgcontainers.length;l++){var q=i.bgcontainers[l],r=i.bgcontainer_depths[l],o=j*(-r*a.conh)||0,p=void 0!==f?f:i.speedbg/1e3||0;punchgs.TweenLite.to(q,p,{position:"absolute",top:"0px",left:"0px",backfaceVisibility:"hidden",force3D:"true",y:o+"px"})}}var s=a.scrolleffect;if(s.on&&("on"!==s.disable_on_mobile||!c)){var t=Math.abs(j)-s.tilt/100;if(t=t<0?0:t,!1!==s.layers){var u=1-t*s.multiplicator_layers,v={backfaceVisibility:"hidden",force3D:"true",z:.001,perspective:600};if("top"==s.direction&&j>=0&&(u=1),"bottom"==s.direction&&j<=0&&(u=1),u=u>1?1:u<0?0:u,"on"===s.fade&&(v.opacity=u),"on"===s.scale){var w=u;v.scale=1-w+1}if("on"===s.blur){var x=(1-u)*s.maxblur;v["-webkit-filter"]="blur("+x+"px)",v.filter="blur("+x+"px)"}if("on"===s.grayscale){var y=100*(1-u),z="grayscale("+y+"%)";v["-webkit-filter"]=void 0===v["-webkit-filter"]?z:v["-webkit-filter"]+" "+z,v.filter=void 0===v.filter?z:v.filter+" "+z}punchgs.TweenLite.set(s.layers,v)}if(!1!==s.bgs){var u=1-t*s.multiplicator,v={backfaceVisibility:"hidden",force3D:"true"};if("top"==s.direction&&j>=0&&(u=1),"bottom"==s.direction&&j<=0&&(u=1),u=u>1?1:u<0?0:u,"on"===s.fade&&(v.opacity=u),"on"===s.scale){var w=u;punchgs.TweenLite.set(jQuery(".tp-kbimg-wrap"),{transformOrigin:"50% 50%",scale:w,force3D:!0})}if("on"===s.blur){var x=(1-u)*s.maxblur;v["-webkit-filter"]="blur("+x+"px)",v.filter="blur("+x+"px)"}if("on"===s.grayscale){var y=100*(1-u),z="grayscale("+y+"%)";v["-webkit-filter"]=void 0===v["-webkit-filter"]?z:v["-webkit-filter"]+" "+z,v.filter=void 0===v.filter?z:v.filter+" "+z}punchgs.TweenLite.set(s.bgs,v)}}b.callBackHandling&&b.callBackHandling(a,"parallax","end")}})}(jQuery);
|
'use strict'
const chai = require('chai')
const chaiAsPromised = require('chai-as-promised')
const expect = chai.expect
const sinon = require('sinon')
const sinonChai = require('sinon-chai')
chai.use(chaiAsPromised)
chai.use(sinonChai)
const proxyquire = require('proxyquire').noCallThru()
const files = require('../lib/files.js')
describe('main', function () {
this.timeout(10000)
let main
let electronAppOnStub
let electronAppQuitStub
let electronBrowserWindowStub
let electronIpcOnStub
let debugCreationStub
let debugReportStub
let testFilename = 'testFilename'
let testSeason = 1
let testMatch = 1
let testPlayer = 1
let testData = {
name: 'testTeam',
seasons: [
{
name: testSeason,
players: [
{id: 1, name: 'testPlayer'}
],
matches: [
{venue: 'sports centre'}
]
}
]
}
beforeEach(() => {
electronAppOnStub = sinon.stub()
electronAppQuitStub = sinon.stub()
electronBrowserWindowStub = sinon.stub()
electronIpcOnStub = sinon.stub()
debugReportStub = sinon.stub()
debugCreationStub = sinon.stub().returns(debugReportStub)
main = proxyquire('../main.js',
{
electron: {
app: {
on: electronAppOnStub,
quit: electronAppQuitStub
},
BrowserWindow: electronBrowserWindowStub,
ipcMain: {
on: electronIpcOnStub
}
},
debug: debugCreationStub
}
)
main.internal.mainWindow = null
main.internal.teamFilename = testFilename
main.internal.teamData = testData
main.internal.teamSeason = testSeason
main.internal.teamMatch = testMatch
main.internal.teamPlayer = testPlayer
})
context('app', () => {
it('listens for ready', () => {
expect(electronAppOnStub).to.be.calledWith('ready', main.internal.createWindow)
})
context('#createWindow', () => {
let loadURLStub
let onStub
beforeEach(() => {
loadURLStub = sinon.stub()
onStub = sinon.stub()
electronBrowserWindowStub.returns({
loadURL: loadURLStub,
on: onStub
})
main.internal.createWindow()
})
afterEach(() => {
electronBrowserWindowStub.reset()
})
it('creates a new window with BrowserWindow()', () => {
let callArgs
expect(electronBrowserWindowStub.callCount).to.equal(1)
callArgs = electronBrowserWindowStub.firstCall.args[0]
expect(callArgs.frame).to.equal(false)
expect(callArgs.resizable).to.equal(true)
expect(typeof callArgs.height).to.equal('number')
expect(typeof callArgs.minHeight).to.equal('number')
expect(typeof callArgs.width).to.equal('number')
expect(typeof callArgs.minWidth).to.equal('number')
})
it('stored the main window', () => {
expect(main.internal.mainWindow).to.not.equal(null)
})
it('loads index.html', () => {
expect(loadURLStub).to.be.calledWithMatch(/app[/\\]index.html/)
})
it('registers the main window for close events', () => {
expect(onStub).to.be.calledWith('closed', main.internal.mainWindowClose)
})
context('mainWindowClose', () => {
beforeEach(() => {
main.internal.mainWindow = {}
})
it('sets mainWindow to null', () => {
main.internal.mainWindowClose()
expect(main.internal.mainWindow).to.equal(null)
})
})
})
it('listens for window-all-closed', () => {
expect(electronAppOnStub).to.be.calledWith('window-all-closed', main.internal.windowAllClosedListener)
})
context('#windowAllClosed', () => {
let originalPlatform = process.platform
afterEach(() => {
Object.defineProperty(process, 'platform', {value: originalPlatform})
})
context('when platform is darwin', () => {
beforeEach(() => {
Object.defineProperty(process, 'platform', {value: 'darwin'})
})
it('does nothing', () => {
main.internal.windowAllClosedListener()
expect(electronAppQuitStub.callCount).to.equal(0)
})
})
context('when platform is not darwin', () => {
beforeEach(() => {
Object.defineProperty(process, 'platform', {value: 'linux'})
})
it('calls to quit the app', () => {
main.internal.windowAllClosedListener()
expect(electronAppQuitStub.callCount).to.equal(1)
})
})
})
it('listens for activate', () => {
expect(electronAppOnStub).to.be.calledWith('activate', main.internal.activateListener)
})
context('#activateListener', () => {
let createWindowStub
beforeEach(() => {
createWindowStub = sinon.stub(main.internal, 'createWindow')
})
afterEach(() => {
createWindowStub.restore()
})
context('when mainWindow is null', () => {
it('calls to create window', () => {
main.internal.activateListener()
expect(createWindowStub.callCount).to.equal(1)
})
})
context('when mainWindow is defined', () => {
beforeEach(() => {
main.internal.mainWindow = {}
})
it('does nothing', () => {
main.internal.activateListener()
expect(createWindowStub.callCount).to.equal(0)
})
})
})
})
context('ipcMain', () => {
it('listens for index-ready', () => {
expect(electronIpcOnStub).to.be.calledWith('index-ready', main.internal.indexReadyListener)
})
context('#indexReadyListener', () => {
let filesListStub
let event
let filesList = [
{filename: 'file1', teamname: 'team1'},
{filename: 'file2', teamname: 'team2'}
]
beforeEach(() => {
filesListStub = sinon.stub(files, 'listTeamFiles')
event = {
sender: {
send: sinon.stub()
}
}
})
afterEach(() => {
filesListStub.restore()
})
context('when file list succeeds', () => {
context('with a list of files', () => {
beforeEach(() => {
filesListStub.returns(Promise.resolve(filesList))
return main.internal.indexReadyListener(event)
})
it('sends an event to change state to pick-a-team', () => {
expect(event.sender.send).to.be.calledWith('change-state', 'loading', 'pick-a-team')
})
})
context('with an empty list', () => {
beforeEach(() => {
filesListStub.returns(Promise.resolve([]))
return main.internal.indexReadyListener(event)
})
it('sends an event to change state to add-first-team', () => {
expect(event.sender.send).to.be.calledWith('change-state', 'loading', 'add-first-team')
})
})
})
context('when file list fails', () => {
beforeEach(() => {
filesListStub.rejects(new Error('Bang!'))
return main.internal.indexReadyListener(event)
})
it('does not send an event to change state', () => {
expect(event.sender.send.callCount).to.equal(0)
})
})
})
it('listens for close-main-window', () => {
expect(electronIpcOnStub).to.be.calledWith('close-main-window', main.internal.closeMainWindowListener)
})
context('#closeMainWindowListener', () => {
it('calls to quit the app', () => {
main.internal.closeMainWindowListener()
expect(electronAppQuitStub.callCount).to.equal(1)
})
})
it('listens for get-team-files', () => {
expect(electronIpcOnStub).to.be.calledWith('get-team-files', main.internal.getTeamFilesListener)
})
context('#getTeamFilesListener', () => {
let filesListStub
let event
let filesList = [
{filename: 'file1', teamname: 'team1'},
{filename: 'file2', teamname: 'team2'}
]
beforeEach(() => {
filesListStub = sinon.stub(files, 'listTeamFiles')
event = {
sender: {
send: sinon.stub()
}
}
})
afterEach(() => {
filesListStub.restore()
})
context('when file list succeeds', () => {
beforeEach(() => {
filesListStub.returns(Promise.resolve(filesList))
return main.internal.getTeamFilesListener(event)
})
it('sends an event with the file list', () => {
expect(event.sender.send).to.be.calledWith('return-team-files', filesList)
})
})
context('when file list fails', () => {
beforeEach(() => {
filesListStub.rejects(new Error('Bang!'))
return main.internal.getTeamFilesListener(event)
})
it('does not send an event with the file list', () => {
expect(event.sender.send.callCount).to.equal(0)
})
})
})
it('listens for save-team-data', () => {
expect(electronIpcOnStub).to.be.calledWith('save-team-data', main.internal.saveTeamDataListener)
})
context('#saveTeamDataListener', () => {
let filesSaveStub
let event
let newTestData = {
name: 'some new name'
}
beforeEach(() => {
filesSaveStub = sinon.stub(files, 'saveTeamFile')
event = {
sender: {
send: sinon.stub()
}
}
})
afterEach(() => {
filesSaveStub.restore()
})
context('when file save succeeds', () => {
let realTestFilename = 'realTestfile'
beforeEach(() => {
filesSaveStub.returns(Promise.resolve(realTestFilename))
return main.internal.saveTeamDataListener(event, 'testFile', newTestData)
})
it('sends an event with the real filename used, and acknowledges', () => {
expect(event.sender.send).to.be.calledWith('team-data-saved', realTestFilename)
})
it('saves the filename and data, and leaves any selectors untouched', () => {
expect(main.internal.teamFilename).to.equal(realTestFilename)
expect(main.internal.teamData).to.deep.equal(newTestData)
expect(main.internal.teamSeason).to.equal(testSeason)
expect(main.internal.teamMatch).to.equal(testMatch)
expect(main.internal.teamPlayer).to.equal(testPlayer)
})
})
context('when file save fails', () => {
beforeEach(() => {
filesSaveStub.returns(Promise.reject(new Error('Bang!')))
return main.internal.saveTeamDataListener(event, 'testFile', newTestData)
})
it('does not return any data', () => {
expect(event.sender.send.callCount).to.equal(0)
})
it('does not change the saved data or selectors', () => {
expect(main.internal.teamFilename).to.equal(testFilename)
expect(main.internal.teamData).to.deep.equal(testData)
expect(main.internal.teamSeason).to.equal(testSeason)
expect(main.internal.teamMatch).to.equal(testMatch)
expect(main.internal.teamPlayer).to.equal(testPlayer)
})
})
})
it('listens for load-team-data', () => {
expect(electronIpcOnStub).to.be.calledWith('load-team-data', main.internal.loadTeamDataListener)
})
context('#loadTeamDataListener', () => {
let filesLoadStub
let event
beforeEach(() => {
filesLoadStub = sinon.stub(files, 'loadTeamFile')
event = {
sender: {
send: sinon.stub()
}
}
})
afterEach(() => {
filesLoadStub.restore()
})
context('when file loading succeeds', () => {
let newTestData = {
name: 'some new name'
}
beforeEach(() => {
filesLoadStub.returns(Promise.resolve(newTestData))
return main.internal.loadTeamDataListener(event, 'testFile')
})
it('sends an event with the loaded filename and data', () => {
expect(event.sender.send).to.be.calledWith('return-team-data', 'testFile', newTestData)
})
it('saves the filename and data, and clears any selectors', () => {
expect(main.internal.teamFilename).to.equal('testFile')
expect(main.internal.teamData).to.deep.equal(newTestData)
expect(main.internal.teamSeason).to.equal(undefined)
expect(main.internal.teamMatch).to.equal(undefined)
expect(main.internal.teamPlayer).to.equal(undefined)
})
})
context('when file loading fails', () => {
beforeEach(() => {
filesLoadStub.returns(Promise.reject(new Error('Bang!')))
return main.internal.loadTeamDataListener(event, 'testFile')
})
it('does not return any data', () => {
expect(event.sender.send.callCount).to.equal(0)
})
it('does not change the saved data or selectors', () => {
expect(main.internal.teamFilename).to.equal(testFilename)
expect(main.internal.teamData).to.deep.equal(testData)
expect(main.internal.teamSeason).to.equal(testSeason)
expect(main.internal.teamMatch).to.equal(testMatch)
expect(main.internal.teamPlayer).to.equal(testPlayer)
})
})
})
it('listens for store-team-season', () => {
expect(electronIpcOnStub).to.be.calledWith('store-team-season', main.internal.storeTeamSeasonListener)
})
context('#storeTeamSeasonListener', () => {
let event
beforeEach(() => {
event = {
sender: {
send: sinon.stub()
}
}
})
it('stores the id of the selected season, then acknowledges with the id', () => {
main.internal.storeTeamSeasonListener(event, 2)
expect(main.internal.teamSeason).to.equal(2)
expect(event.sender.send).to.be.calledWith('team-season-stored', 2)
})
})
it('listens for store-team-match', () => {
expect(electronIpcOnStub).to.be.calledWith('store-team-match', main.internal.storeTeamMatchListener)
})
context('#storeTeamMatchListener', () => {
let event
beforeEach(() => {
event = {
sender: {
send: sinon.stub()
}
}
})
it('stores the id of the selected match, then acknowledges with the id', () => {
main.internal.storeTeamMatchListener(event, 2)
expect(main.internal.teamMatch).to.equal(2)
expect(event.sender.send).to.be.calledWith('team-match-stored', 2)
})
})
it('listens for store-team-player', () => {
expect(electronIpcOnStub).to.be.calledWith('store-team-player', main.internal.storeTeamPlayerListener)
})
context('#storeTeamPlayerListener', () => {
let event
beforeEach(() => {
event = {
sender: {
send: sinon.stub()
}
}
})
it('stores the id of the selected player, then acknowledges with the id', () => {
main.internal.storeTeamPlayerListener(event, 2)
expect(main.internal.teamPlayer).to.equal(2)
expect(event.sender.send).to.be.calledWith('team-player-stored', 2)
})
})
it('listens for get-team-data', () => {
expect(electronIpcOnStub).to.be.calledWith('get-team-data', main.internal.getTeamDataListener)
})
context('#getTeamDataListener', () => {
let event
beforeEach(() => {
event = {
sender: {
send: sinon.stub()
}
}
})
it('sends an event with the team data and any selectors that are set', () => {
main.internal.getTeamDataListener(event)
expect(event.sender.send).to.be.calledWith('return-team-data', testFilename, testData, testSeason, testMatch, testPlayer)
})
})
it('listens for ui-debug', () => {
expect(electronIpcOnStub).to.be.calledWith('ui-debug', main.internal.reportDebugUI)
})
context('#reportDebugUI', () => {
it('reports to debug', () => {
main.internal.reportDebugUI(undefined, 'test message')
expect(debugCreationStub).to.be.calledWith('vbs:ui')
expect(debugReportStub).to.be.calledWith('test message')
})
})
})
})
|
function oceanwpWooCategoriesWidget(){"use strict";$j(".woo-dropdown-cat .product-categories").each(function(){var e='<i class="fa fa-angle-down"></i>';$j(this).find("li").has(".children").has("li").prepend('<div class="open-this">'+e+"</div>"),$j(this).find(".open-this").on("click",function(){$j(this).parent().hasClass("opened")?$j(this).html(e).parent().removeClass("opened").find("> ul").slideUp(200):$j(this).html('<i class="fa fa-angle-up"></i>').parent().addClass("opened").find("> ul").slideDown(200)})})}var $j=jQuery.noConflict();$j(document).on("ready",function(){"use strict";oceanwpWooCategoriesWidget()});
|
import CSSRuleSet from '../internal/CSSProcessor.js'
const defaultFontSize = 12;
const defaultFontFamily = "'Roboto', sans-serif";
const buttonWidth = 44;
const input_and_button_borderBottomWidth = 2;
const tablePadding = 5;
const width = 'var(--width)';
const themeColor = 'var(--theme-color)';
const borderRadius = 'var(--border-radius)';
const borderColor = 'darkgrey';
const transitionDuration = .5; //s
const avatarWidthHeight = 42;
const height = 'var(--height)';
const childCenterBlockPreset = {
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
};
const inputHeight = 'var(--input-height)';
const inputPadding = Object.assign(12, { left: 20 });
function generageSquareProp(name, initialVal, ...excluded){
const res = {};
['top', 'bottom', 'left', 'right'].forEach(s => res[`${name}-${s}`] = initialVal);
for(var i = 0; i < excluded.length; i += 2) res[`${name}-${excluded[i]}`] = excluded[i + 1];
return res
}
export default class {
constructor(stylesRoot){
const ruleSetsPrecached = (/** @return {Object<string, CSSRuleSet>} */ () => {
const cache = Object.create(null);
return new Proxy({}, {
get: (_, s) => {
if(!cache[s]) cache[s] = new CSSRuleSet(s, stylesRoot);
return cache[s]
}
})
})();
const inputSelector = 'div[contentEditable]';
const placeholderSelector = inputSelector + ' + div';
const buttonSelector = placeholderSelector + ' + a';
const tableSelector = '.comments-wrapper';
const commentSelector = tableSelector + ' > div[commentid]';
const avatarSelector = commentSelector + ' > div:first-child';
const {
'*': _all,
[tableSelector]: table,
a: link,
'a:active': link_active,
[inputSelector]: input,
[buttonSelector]: button,
[buttonSelector + ' > span']: button_inner_span,
[buttonSelector + '.login-highlight > span']: button_inner_span_not_logged,
[buttonSelector + '.disabled']: button_disabled,
[`${buttonSelector}:active, ${buttonSelector}.active`]: button_click,
'.input-and-button-wrapper': input_and_button_wrapper,
[buttonSelector + ', ' + inputSelector]: input_and_button,
[inputSelector + ':focus']: focused_input,
[`${buttonSelector}.active`]: focused_input_with_button_click,
[commentSelector]: comment,
[avatarSelector]: avatar,
[avatarSelector + ' > img']: avatar_img,
[commentSelector + ' > .name']: name,
[commentSelector + ' > .time']: time,
[commentSelector + ' > .comment']: comment_text,
[placeholderSelector]: placeholder,
'.box': box,
} = ruleSetsPrecached;
_all.add({
'font-size': defaultFontSize,
'font-family': defaultFontFamily,
'font-weight': 'normal', // normalize font display
'--input-height': 40,
});
const inputWithBorderHeight = {
ruleType: 'calc',
firstArg: inputHeight,
operator: '+',
secondArg: input_and_button_borderBottomWidth + 'px'
};
input_and_button_wrapper.add({
width: width,
position: 'relative',
});
input.add(Object.assign(generageSquareProp('padding', inputPadding * 1, 'left', inputPadding.left), {
'min-height': {
ruleType: 'calc',
firstArg: inputHeight,
operator: '-',
secondArg: (inputPadding * 2) + 'px'
},
width: {
ruleType: 'calc',
firstArg: width,
operator: '-',
secondArg: (buttonWidth + inputPadding.left + inputPadding) + 'px'
},
display: 'inline-block',
'background-color': '#fff',
color: 'black',
'border-top-left-radius': borderRadius,
'border-bottom': `${input_and_button_borderBottomWidth}px solid ${borderColor} !important`,
border: 0,
resize: 'none',
margin: 0,
'line-height': 12,
overflow: 'auto',
'overflow-wrap': 'break-word',
}));
focused_input.add({
outline: 'none',
'border-bottom-color': `${themeColor} !important`,
});
button.add({
width: buttonWidth,
padding: 0,
'border-top-right-radius': borderRadius,
height: {
ruleType: 'calc',
firstArg: '100%',
operator: '-',
secondArg: input_and_button_borderBottomWidth + 'px',
},
'background-color': themeColor,
color: '#fff',
'font-weight': '700',
display: 'inline-block',
outline: 'none',
position: 'relative',
float: 'right',
'text-align': 'center',
'border-bottom': `${input_and_button_borderBottomWidth}px solid ${themeColor}`,
position: 'absolute',
});
button_inner_span.add(Object.assign({
'font-weight': 'inherit',
'white-space': 'nowrap',
}, childCenterBlockPreset));
button_disabled.add({
'background-color': borderColor,
'border-bottom-color': borderColor,
});
button_click.add({
'background-color': '#fff',
'border-bottom-color': borderColor,
color: themeColor,
});
focused_input_with_button_click.add({
'border-bottom-color': `${themeColor} !important`,
});
table.add({
'background-color': '#fff',
padding: tablePadding,
'border-radius': borderRadius,
'border-top-left-radius': 0,
'border-top-right-radius': 0,
width: {
ruleType: 'calc',
firstArg: width,
operator: '-',
secondArg: (tablePadding * 2) + 'px',
},
height: {
ruleType: 'calc',
firstArg: height,
operator: '-',
secondArg: {
ruleType: 'calc',
firstArg: (tablePadding * 2) + 'px',
operator: '+',
secondArg: inputWithBorderHeight
}
},
overflow: 'auto',
position: 'relative',
});
link.add({
color: 'inherit',
'text-decoration': 'none',
outline: 'none',
});
link_active.add({
outline: 'none',
});
comment.add({
width: '100%',
display: 'grid',
'grid-template-columns': `${avatarWidthHeight}px auto minmax(0, min-content)`,
'grid-template-areas': "'avatar name time' 'avatar comment comment'",
'margin-bottom': tablePadding,
});
avatar.add({
width: avatarWidthHeight,
height: avatarWidthHeight,
'border-radius': '50%',
'grid-area': 'avatar',
position: 'relative',
overflow: 'hidden',
});
avatar_img.add(Object.assign({
width: avatarWidthHeight,
}, childCenterBlockPreset));
name.add({
'white-space': 'nowrap',
overflow: 'hidden',
'text-overflow': 'ellipsis',
'grid-area': 'name',
color: themeColor,
'padding-left': tablePadding,
'padding-right': tablePadding,
});
time.add({
'grid-area': 'time',
'text-align': 'right',
'padding-right': tablePadding,
'white-space': 'nowrap',
});
comment_text.add({
'grid-area': 'comment',
'padding-left': tablePadding,
'padding-right': tablePadding,
overflow: 'auto',
'overflow-wrap': 'break-word',
});
button_inner_span_not_logged.add({
'font-family': '"AllBooms Brand Icons" !important',
'font-size': 18,
});
input_and_button.add({
'transition-property': 'border-color, background-color',
'transition-duration': `${transitionDuration}s`,
});
placeholder.add({
position: 'absolute',
'z-index': '1',
top: inputPadding * 1,
left: inputPadding.left,
'pointer-events': 'none',
color: 'dimgray',
});
box.add({
height,
display: 'flex',
'flex-flow': 'column',
overflow: 'hidden',
});
return ruleSetsPrecached
}
}
|
import axios from 'axios'
import util from 'common/js/util'
const io = axios.create({withCredentials: true})
io.interceptors.request.use((config) => {
let token = window.localStorage.getItem('token') || util.cookie.get('token')
if (token) config.headers['X-token'] = token
return config
}, (error) => {
return Promise.reject(error)
})
io.interceptors.response.use((response) => {
if (response.data.resCode === '0') return response.data.data
else return Promise.reject(response.data.resMsg)
}, (error) => {
// 400 参数错误
// 401 未登录
try {
switch (error.response.status) {
case 401: {
let hostname = window.location.hostname
let hostArr = hostname.split('.')
let domain = hostArr.length < 3 ? hostname : (hostArr.splice(0, 1), hostArr.join('.'))
let loginUrl = domain === 'test61.ums86.com' ? 'http://open-client.test61.ums86.com/#/login' : '/client/index/index.html#/login'
setTimeout(() => { window.location.href = loginUrl }, 2000)
return Promise.reject(error.response.data.resMsg || error.response.data.message)
}
default:
return Promise.reject(error.response.data.resMsg || error.response.data.message)
}
} catch (e) {
return Promise.reject(new Error('服务器无响应').message)
}
})
export default io
|
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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.
*/
function onRequest() {
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var constants = require("/app/modules/constants.js");
var viewModel = {};
var permissions = {};
// permission checks
// [1] checking enrollment permissions
permissions["ENROLL_DEVICE"] = userModule.isAuthorized("/permission/admin/device-mgt/devices/enroll/android") ||
userModule.isAuthorized("/permission/admin/device-mgt/devices/enroll/ios") ||
userModule.isAuthorized("/permission/admin/device-mgt/devices/enroll/windows");
// [2] checking advanced device search permissions
permissions["ADVANCED_SEARCH"] = userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/view");
// [3] checking device viewing permission
permissions["VIEW_DEVICES"] = userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/view");
var currentUser = session.get(constants["USER_SESSION_KEY"]);
viewModel["permissions"] = permissions;
viewModel["currentUser"] = currentUser;
return viewModel;
}
|
import React, { Component } from "react";
import { Platform,
Dimensions,
StyleSheet,
FlatList, } from "react-native";
import AsyncStorage from "@react-native-community/async-storage";
import Post from "./Post";
import ServiceAPI from "../services/ServiceAPI";
import Notify from "../api/Notify.ios";
const width = Dimensions.get("screen").width;
export default class Profile extends Component {
static navigationOptions = {
title: "Instalura Mobile - Profile"
};
constructor(props) {
super(props);
this.state = {
fotos: [],
loggedUser: ""
};
this.likeUnlikeFoto = this.likeUnlikeFoto.bind(this);
}
componentDidMount() {
const { navigation } = this.props;
const user = navigation.getParam('user', 'NO-ID');
if (!user) {
AsyncStorage.getItem("usuario").then(nome => {
this.setState({ loggedUser: nome });
uri = uri + "/" + nome;
});
} else {
this.setState({ loggedUser: user });
}
ServiceAPI.get("/fotos").then(json => this.setState({ fotos: json }));
}
findFotoById(fotoId) {
return this.state.fotos.find(foto => foto.id === fotoId);
}
updateFotoListOfState(updatedFoto) {
const fotos = this.state.fotos.map(item =>
item.id === updatedFoto.id ? updatedFoto : item
);
this.setState({ fotos });
}
likeUnlikeFoto(fotoId) {
const originalList = this.state.fotos;
const foundedFoto = this.findFotoById(fotoId);
let newLista = [];
if (!foundedFoto.likeada) {
newLista = [...foundedFoto.likers, { login: this.state.loggedUser }];
} else {
newLista = foundedFoto.likers.filter(liker => {
return liker.login !== this.state.loggedUser;
});
}
const updatedFoto = {
...foundedFoto,
likeada: !foundedFoto.likeada,
likers: newLista
};
const path = `fotos/${fotoId}/like`;
ServiceAPI.post(path, null).catch(e => {
this.setState({fotos: originalList});
Notify.showMessage("Ops...", "Algo deu errado !");
});
this.updateFotoListOfState(updatedFoto);
}
addComment(commentContent, commentInput, fotoId) {
const originalList = this.state.fotos;
if (commentContent === "") return;
const newComment = {
id: commentContent,
login: this.state.loggedUser,
texto: commentContent
};
const foundedFoto = this.findFotoById(fotoId);
const path = `fotos/${fotoId}/comment`;
const bodyData = {
texto: commentContent
};
ServiceAPI.post(path, bodyData)
.then(newComment => [...foundedFoto.comentarios, newComment])
.then(newLista => {
const updatedFoto = {
...foundedFoto,
comentarios: newLista
};
this.updateFotoListOfState(updatedFoto);
commentInput.clear();
}).catch(e => {
this.setState({fotos: originalList});
Notify.showMessage("Ops...", "Algo deu errado no comentário !");
});;
}
render() {
const { navigate } = this.props.navigation;
return (
<FlatList
data={this.state.fotos}
keyExtractor={item => item.id.toString()}
renderItem={({ item }) => (
<Post
foto={item}
likeUnlikeCallback={this.likeUnlikeFoto.bind(this)}
addCommentCallback={this.addComment.bind(this)}
/>
)}
/>
);
}
}
|
(function() {
var module;
module = angular.module('docflow.ui.client', ['docflow.config', 'docflow.ui.utils', 'docflow.ui.httpListener', 'docflow.ui.actions']);
module.factory('$docflowClient', [
'$docflowActions', '$docflowUtils', '$docflowConfig', '$http', '$rootScope', '$document', '$q', (function($docflowActions, $docflowUtils, $docflowConfig, $http, $rootScope, $document, $q) {
var createdDoc, currentAction, formDoc;
currentAction = null;
createdDoc = null;
formDoc = null;
return {
list: (function(options) {}),
get: (function(id, options) {
var deferred, p, query, t, url, v, _ref;
if ((createdDoc != null ? createdDoc.id : void 0) === id) {
_ref = [createdDoc, null], t = _ref[0], createdDoc = _ref[1];
deferred = $q.defer();
deferred.resolve(t);
return deferred.promise;
}
createdDoc = null;
query = [];
if (options) {
for (p in options) {
v = options[p];
if (angular.isDefined(v)) {
query.push("" + p + "=" + v);
}
}
}
url = "/api/get/" + id + "?" + (query.join('&')) + "&" + $docflowConfig.apiParams;
return $http({
method: 'GET',
url: url
}).then((function(resp) {
return resp.data;
}), (function(resp) {
throw Error("Failed to get document with id '" + id + "' (Code: " + resp.status + ")");
}));
}),
action: (function(id, name, options) {
var actionConfig, data, deferred, docConfig, p, query, showMessage, url, v, _ref;
docConfig = $docflowConfig.docs[$docflowUtils.docType(id)];
if (!docConfig) {
throw Error("Doctype " + ($docflowUtils.docType(id)) + " not in docflowConfig");
}
actionConfig = (_ref = docConfig.actions) != null ? _ref[name] : void 0;
if (!actionConfig) {
throw Error("Doctype " + ($docflowUtils.docType(id)) + " has no action " + name + " in docflowConfig");
}
if (currentAction) {
if (typeof currentAction.forceShowMessage === "function") {
currentAction.forceShowMessage();
}
return $q.reject('Another action is currenly running', currentAction);
}
query = [];
for (p in options) {
v = options[p];
if (!(p === 'params' || p === 'doc' || p === 'message')) {
if (angular.isDefined(v)) {
query.push("" + p + "=" + v);
}
}
}
url = "/api/action/" + id + "/" + name + "?" + (query.join('&')) + "&" + $docflowConfig.apiParams;
if (options) {
data = {};
if (options.params) {
data.params = options.params;
}
if (options.doc) {
data.doc = options.doc;
}
showMessage = !angular.isDefined(options.message) || options.message;
} else {
showMessage = true;
}
if (showMessage) {
deferred = $q.defer();
$docflowActions.send(currentAction = new $docflowActions.Action(id, name, deferred.promise));
}
return $http({
method: 'POST',
url: url,
data: data
}).then((function(resp) {
data = resp.data;
if (data.code === 'Ok') {
if (name === 'create') {
createdDoc = data.doc;
}
if (data.file) {
$("<iframe>").hide().prop("src", "/api/download/" + data.file).appendTo("body");
}
if (deferred) {
deferred.resolve(data.message);
currentAction = null;
}
return data;
} else {
if (deferred) {
deferred.reject(data.message);
currentAction = null;
}
return $q.reject(resp);
}
}), (function(resp) {
if (deferred) {
deferred.reject();
currentAction = null;
}
}));
})
};
})
]);
}).call(this);
|
import { axiosInstance } from './axios';
class AuthService {
login(userData) {
return axiosInstance
.post("/api/auth/login", userData)
.then((response) => {
// if (response.data.accessToken) {
// localStorage.setItem("user", JSON.stringify(response.data));
// }
return response.data;
});
}
logout() {
// localStorage.removeItem("user");
}
register(userData) {
return axiosInstance.post("/api/auth/register", userData);
}
}
export default new AuthService();
|
'use strict';
exports.__esModule = true;
var _vue = require('vue');
var _vue2 = _interopRequireDefault(_vue);
var _dom = require('custom-e-ui/lib/utils/dom');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var nodeList = [];
var ctx = '@@clickoutsideContext';
var startClick = void 0;
var seed = 0;
!_vue2.default.prototype.$isServer && (0, _dom.on)(document, 'mousedown', function (e) {
return startClick = e;
});
!_vue2.default.prototype.$isServer && (0, _dom.on)(document, 'mouseup', function (e) {
nodeList.forEach(function (node) {
return node[ctx].documentHandler(e, startClick);
});
});
function createDocumentHandler(el, binding, vnode) {
return function () {
var mouseup = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var mousedown = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (!vnode || !vnode.context || !mouseup.target || !mousedown.target || el.contains(mouseup.target) || el.contains(mousedown.target) || el === mouseup.target || vnode.context.popperElm && (vnode.context.popperElm.contains(mouseup.target) || vnode.context.popperElm.contains(mousedown.target))) return;
if (binding.expression && el[ctx].methodName && vnode.context[el[ctx].methodName]) {
vnode.context[el[ctx].methodName]();
} else {
el[ctx].bindingFn && el[ctx].bindingFn();
}
};
}
/**
* v-clickoutside
* @desc 点击元素外面才会触发的事件
* @example
* ```vue
* <div v-element-clickoutside="handleClose">
* ```
*/
exports.default = {
bind: function bind(el, binding, vnode) {
nodeList.push(el);
var id = seed++;
el[ctx] = {
id: id,
documentHandler: createDocumentHandler(el, binding, vnode),
methodName: binding.expression,
bindingFn: binding.value
};
},
update: function update(el, binding, vnode) {
el[ctx].documentHandler = createDocumentHandler(el, binding, vnode);
el[ctx].methodName = binding.expression;
el[ctx].bindingFn = binding.value;
},
unbind: function unbind(el) {
var len = nodeList.length;
for (var i = 0; i < len; i++) {
if (nodeList[i][ctx].id === el[ctx].id) {
nodeList.splice(i, 1);
break;
}
}
delete el[ctx];
}
};
|
/*
* Reference: https://circleci.com/ja/blog/custom-docker-02/
*/
const express = require('express');
const router = express.Router();
const graphqlHTTP = require('express-graphql');
const schema = require('./schema');
const resolvers = require('./resolvers');
router.use(
'/',
graphqlHTTP({
schema,
rootValue: resolvers,
graphiql: true
})
);
module.exports = router;
|
import { sites } from '@/database/dexie/services/index.js';
import axios from 'axios';
import parser from 'fast-xml-parser';
const zy = {
ports: 44444, // 端口号
xmlConfig: {
// XML 转 JSON 配置
trimValues: true,
textNodeName: '_t',
ignoreAttributes: false,
attributeNamePrefix: '_',
parseAttributeValue: true,
},
getSite(key) {
return new Promise((resolve, reject) => {
sites
.all()
.then((res) => {
for (const i of res) {
if (key === i.key) {
resolve(i);
}
}
})
.catch((err) => {
reject(err);
});
});
},
/**
* 获取资源分类 和 所有资源的总数, 分页等信息
* @param {*} key 资源网 key
* @returns
*/
class(key) {
return new Promise((resolve, reject) => {
this.getSite(key).then((res) => {
const site = res;
axios
.post(`http://localhost:${this.ports}/api`, {
url: site.api,
})
.then((res) => {
const data = res.data.info;
const json = parser.parse(data, this.xmlConfig);
const arr = [];
if (json.rss.class) {
for (const i of json.rss.class.ty) {
const j = {
tid: i._id,
name: i._t,
};
arr.push(j);
}
}
const doc = {
class: arr,
page: json.rss.list._page,
pagecount: json.rss.list._pagecount,
pagesize: json.rss.list._pagesize,
recordcount: json.rss.list._recordcount,
};
resolve(doc);
})
.catch((err) => {
reject(err);
});
});
});
},
/**
* 获取资源列表
* @param {*} key 资源网 key
* @param {number} [pg=1] 翻页 page
* @param {*} t 分类 type
* @returns
*/
list(key, pg = 1, t) {
return new Promise((resolve, reject) => {
this.getSite(key).then((res) => {
const site = res;
let url = null;
if (t) {
url = `${site.api}?ac=videolist&t=${t}&pg=${pg}`;
} else {
url = `${site.api}?ac=videolist&pg=${pg}`;
}
axios
.post(`http://localhost:${this.ports}/api`, { url: url })
.then(async (res) => {
const data = res.data.info;
const json = parser.parse(data, this.xmlConfig);
const videoList = json.rss.list.video;
resolve(videoList);
})
.catch((err) => {
reject(err);
});
});
});
},
/**
* 获取总资源数, 以及页数
* @param {*} key 资源网
* @param {*} t 分类 type
* @returns page object
*/
page(key, t) {
return new Promise((resolve, reject) => {
this.getSite(key).then((res) => {
const site = res;
let url = '';
if (t) {
url = `${site.api}?ac=videolist&t=${t}`;
} else {
url = `${site.api}?ac=videolist`;
}
axios
.post(`http://localhost:${this.ports}/api`, { url: url })
.then(async (res) => {
const data = res.data.info;
const json = parser.parse(data, this.xmlConfig);
const pg = {
page: json.rss.list._page,
pagecount: json.rss.list._pagecount,
pagesize: json.rss.list._pagesize,
recordcount: json.rss.list._recordcount,
};
resolve(pg);
})
.catch((err) => {
reject(err);
});
});
});
},
/**
* 搜索资源
* @param {*} key 资源网 key
* @param {*} wd 搜索关键字
* @returns
*/
search(key, wd) {
return new Promise((resolve, reject) => {
this.getSite(key).then((res) => {
const site = res;
wd = encodeURI(wd);
axios
.post(`http://localhost:${this.ports}/api`, {
url: site.api + '?wd=' + wd,
})
.then((res) => {
const data = res.data.info;
const json = parser.parse(data, this.xmlConfig);
const videoList = json.rss.list.video;
resolve(videoList);
})
.catch((err) => {
reject(err);
});
});
});
},
/**
* 获取资源详情
* @param {*} key 资源网 key
* @param {*} id 资源唯一标识符 id
* @returns
*/
detail(key, id) {
return new Promise((resolve, reject) => {
this.getSite(key)
.then((res) => {
axios
.post(`http://localhost:${this.ports}/api`, {
url: res.api + '?ac=videolist&ids=' + id,
})
.then((res) => {
const data = res.data.info;
const json = parser.parse(data, this.xmlConfig);
const videoList = json.rss.list.video;
resolve(videoList);
})
.catch((err) => {
reject(err);
});
})
.catch((err) => {
reject(err);
});
});
},
/**
* 下载资源
* @param {*} key 资源网 key
* @param {*} id 资源唯一标识符 id
* @returns
*/
download(key, id) {
return new Promise((resolve, reject) => {
this.getSite(key).then((res) => {
const site = res;
const url = site.download;
if (url) {
axios
.post(`http://localhost:${this.ports}/api`, {
url: url + '?ac=videolist&ids=' + id + '&ct=1',
})
.then((res) => {
const data = res.data.info;
const json = parser.parse(data, this.xmlConfig);
const videoList = json.rss.list.video;
resolve(videoList);
})
.catch((err) => {
reject(err);
});
} else {
resolve([]);
}
});
});
},
};
export default zy;
|
module.exports = {
development: {
host: "localhost",
username: "root",
password: "123456789",
port: 3308,
database: "SubscriptionsDb",
dialect: "mysql"
},
production: {
host: "localhost",
username: "root",
password: "123456789",
port: 3308,
database: "SubscriptionsDb",
dialect: "mysql"
}
}
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
/**
* @author Jorge Bay Gondra
*/
'use strict';
const typeSerializers = require('./type-serializers');
/**
* GraphSON Writer
*/
class GraphSONWriter {
/**
* @param {Object} [options]
* @param {Object} options.serializers An object used as an associative array with GraphSON 2 type name as keys and
* serializer instances as values, ie: { 'g:Int64': longSerializer }.
* @constructor
*/
constructor(options) {
this._options = options || {};
// Create instance of the default serializers
this._serializers = serializers.map(serializerConstructor => {
const s = new serializerConstructor();
s.writer = this;
return s;
});
const customSerializers = this._options.serializers || {};
Object.keys(customSerializers).forEach(key => {
const s = customSerializers[key];
if (!s.serialize) {
return;
}
s.writer = this;
// Insert custom serializers first
this._serializers.unshift(s);
});
}
adaptObject(value) {
let s;
for (let i = 0; i < this._serializers.length; i++) {
const currentSerializer = this._serializers[i];
if (currentSerializer.canBeUsedFor && currentSerializer.canBeUsedFor(value)) {
s = currentSerializer;
break;
}
}
if (s) {
return s.serialize(value);
}
if (Array.isArray(value)) {
// We need to handle arrays when there is no serializer
// for older versions of GraphSON
return value.map(item => this.adaptObject(item));
}
// Default (strings / objects / ...)
return value;
}
/**
* Returns the GraphSON representation of the provided object instance.
* @param {Object} obj
* @returns {String}
*/
write(obj) {
return JSON.stringify(this.adaptObject(obj));
}
}
class GraphSONReader {
/**
* GraphSON Reader
* @param {Object} [options]
* @param {Object} [options.serializers] An object used as an associative array with GraphSON 2 type name as keys and
* deserializer instances as values, ie: { 'g:Int64': longSerializer }.
* @constructor
*/
constructor(options) {
this._options = options || {};
this._deserializers = {};
Object.keys(deserializers).forEach(typeName => {
const serializerConstructor = deserializers[typeName];
const s = new serializerConstructor();
s.reader = this;
this._deserializers[typeName] = s;
});
if (this._options.serializers) {
const customSerializers = this._options.serializers || {};
Object.keys(customSerializers).forEach(key => {
const s = customSerializers[key];
if (!s.deserialize) {
return;
}
s.reader = this;
this._deserializers[key] = s;
});
}
}
read(obj) {
if (obj === undefined) {
return undefined;
}
if (obj === null) {
return null;
}
if (Array.isArray(obj)) {
return obj.map(item => this.read(item));
}
const type = obj[typeSerializers.typeKey];
if (type) {
const d = this._deserializers[type];
if (d) {
// Use type serializer
return d.deserialize(obj);
}
return obj[typeSerializers.valueKey];
}
if (obj && typeof obj === 'object' && obj.constructor === Object) {
return this._deserializeObject(obj);
}
// Default (for boolean, number and other scalars)
return obj;
}
_deserializeObject(obj) {
const keys = Object.keys(obj);
const result = {};
for (let i = 0; i < keys.length; i++) {
result[keys[i]] = this.read(obj[keys[i]]);
}
return result;
}
}
const deserializers = {
'g:Traverser': typeSerializers.TraverserSerializer,
'g:TraversalStrategy': typeSerializers.TraversalStrategySerializer,
'g:Int32': typeSerializers.NumberSerializer,
'g:Int64': typeSerializers.NumberSerializer,
'g:Float': typeSerializers.NumberSerializer,
'g:Double': typeSerializers.NumberSerializer,
'g:Date': typeSerializers.DateSerializer,
'g:Direction': typeSerializers.DirectionSerializer,
'g:Vertex': typeSerializers.VertexSerializer,
'g:Edge': typeSerializers.EdgeSerializer,
'g:VertexProperty': typeSerializers.VertexPropertySerializer,
'g:Property': typeSerializers.PropertySerializer,
'g:Path': typeSerializers.Path3Serializer,
'g:T': typeSerializers.TSerializer,
'g:TextP': typeSerializers.TextPSerializer,
'g:List': typeSerializers.ListSerializer,
'g:Set': typeSerializers.SetSerializer,
'g:Map': typeSerializers.MapSerializer,
'g:BulkSet': typeSerializers.BulkSetSerializer
};
const serializers = [
typeSerializers.NumberSerializer,
typeSerializers.DateSerializer,
typeSerializers.BytecodeSerializer,
typeSerializers.TraverserSerializer,
typeSerializers.TraversalStrategySerializer,
typeSerializers.PSerializer,
typeSerializers.TextPSerializer,
typeSerializers.LambdaSerializer,
typeSerializers.EnumSerializer,
typeSerializers.VertexSerializer,
typeSerializers.EdgeSerializer,
typeSerializers.LongSerializer,
typeSerializers.ListSerializer,
typeSerializers.MapSerializer
];
module.exports = {
GraphSONWriter,
GraphSONReader
};
|
import Resource from 'ember-api-store/models/resource';
import { denormalizeId, denormalizeIdArray } from 'ember-api-store/utils/denormalize';
export default Resource.extend({
type: 'lbConfig',
defaultCertificate: denormalizeId('defaultCertificateId','certificate'),
certificates: denormalizeIdArray('certificateIds'),
needsCertificate: function() {
return !!this.get('portRules').findBy('needsCertificate',true);
}.property('portRules.@each.needsCertificate'),
canSticky: function() {
return !!this.get('portRules').findBy('canSticky',true);
}.property('portRules.@each.canSticky'),
});
|
/**
* Copyright IBM Corp. 2019, 2020
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*
* Code generated by @carbon/icon-build-helpers. DO NOT EDIT.
*/
import { _ as _objectWithoutProperties, I as Icon, a as _extends } from '../Icon-882b0ed1.js';
import React from 'react';
import '@carbon/icon-helpers';
import 'prop-types';
var _circle, _path, _path2, _path3;
var DropPhotoFilled24 = /*#__PURE__*/React.forwardRef(function DropPhotoFilled24(_ref, ref) {
var children = _ref.children,
rest = _objectWithoutProperties(_ref, ["children"]);
return /*#__PURE__*/React.createElement(Icon, _extends({
width: 24,
height: 24,
viewBox: "0 0 32 32",
xmlns: "http://www.w3.org/2000/svg",
fill: "currentColor",
ref: ref
}, rest), _circle || (_circle = /*#__PURE__*/React.createElement("circle", {
cx: "19",
cy: "22",
r: "2"
})), _path || (_path = /*#__PURE__*/React.createElement("path", {
d: "M27,16H23.7207l-.5439-1.6328A1.9983,1.9983,0,0,0,21.2793,13H16.7207a1.9981,1.9981,0,0,0-1.8975,1.3677L14.2793,16H11a2.0023,2.0023,0,0,0-2,2v9a2.0023,2.0023,0,0,0,2,2H27a2.0023,2.0023,0,0,0,2-2V18A2.0023,2.0023,0,0,0,27,16ZM19,26a4,4,0,1,1,4-4A4.0045,4.0045,0,0,1,19,26Z"
})), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
fill: "none",
d: "M19,26a4,4,0,1,1,4-4A4.0045,4.0045,0,0,1,19,26Zm0-6a2,2,0,1,0,2,2A2.0021,2.0021,0,0,0,19,20Z",
"data-icon-path": "inner-path"
})), _path3 || (_path3 = /*#__PURE__*/React.createElement("path", {
d: "M27 11H29V13H27zM27 7H29V9H27zM27 3H29V5H27zM23 3H25V5H23zM19 3H21V5H19zM15 3H17V5H15zM11 3H13V5H11zM7 3H9V5H7zM3 3H5V5H3zM3 7H5V9H3zM3 11H5V13H3zM3 15H5V17H3zM3 19H5V21H3zM3 23H5V25H3zM3 27H5V29H3z"
})), children);
});
export default DropPhotoFilled24;
|
/**
* @file videojs-http-streaming.js
*
* The main file for the HLS project.
* License: https://github.com/videojs/videojs-http-streaming/blob/master/LICENSE
*/
import document from 'global/document';
import window from 'global/window';
import PlaylistLoader from './playlist-loader';
import Playlist from './playlist';
import xhrFactory from './xhr';
import { simpleTypeFromSourceType } from '@videojs/vhs-utils/es/media-types.js';
import * as utils from './bin-utils';
import {
getProgramTime,
seekToProgramTime
} from './util/time';
import { timeRangesToArray } from './ranges';
import videojs from 'video.js';
import { MasterPlaylistController } from './master-playlist-controller';
import Config from './config';
import renditionSelectionMixin from './rendition-mixin';
import PlaybackWatcher from './playback-watcher';
import SourceUpdater from './source-updater';
import reloadSourceOnError from './reload-source-on-error';
import {
lastBandwidthSelector,
lowestBitrateCompatibleVariantSelector,
movingAverageBandwidthSelector,
comparePlaylistBandwidth,
comparePlaylistResolution
} from './playlist-selectors.js';
import {
browserSupportsCodec,
getMimeForCodec,
parseCodecs
} from '@videojs/vhs-utils/es/codecs.js';
import { unwrapCodecList } from './util/codecs.js';
import logger from './util/logger';
import {SAFE_TIME_DELTA} from './ranges';
// IMPORTANT:
// keep these at the bottom they are replaced at build time
// because webpack and rollup without plugins do not support json
// and we do not want to break our users
import {version as vhsVersion} from '../package.json';
import {version as muxVersion} from 'mux.js/package.json';
import {version as mpdVersion} from 'mpd-parser/package.json';
import {version as m3u8Version} from 'm3u8-parser/package.json';
import {version as aesVersion} from 'aes-decrypter/package.json';
const Vhs = {
PlaylistLoader,
Playlist,
utils,
STANDARD_PLAYLIST_SELECTOR: lastBandwidthSelector,
INITIAL_PLAYLIST_SELECTOR: lowestBitrateCompatibleVariantSelector,
lastBandwidthSelector,
movingAverageBandwidthSelector,
comparePlaylistBandwidth,
comparePlaylistResolution,
xhr: xhrFactory()
};
// Define getter/setters for config properties
Object.keys(Config).forEach((prop) => {
Object.defineProperty(Vhs, prop, {
get() {
videojs.log.warn(`using Vhs.${prop} is UNSAFE be sure you know what you are doing`);
return Config[prop];
},
set(value) {
videojs.log.warn(`using Vhs.${prop} is UNSAFE be sure you know what you are doing`);
if (typeof value !== 'number' || value < 0) {
videojs.log.warn(`value of Vhs.${prop} must be greater than or equal to 0`);
return;
}
Config[prop] = value;
}
});
});
export const LOCAL_STORAGE_KEY = 'videojs-vhs';
/**
* Updates the selectedIndex of the QualityLevelList when a mediachange happens in vhs.
*
* @param {QualityLevelList} qualityLevels The QualityLevelList to update.
* @param {PlaylistLoader} playlistLoader PlaylistLoader containing the new media info.
* @function handleVhsMediaChange
*/
const handleVhsMediaChange = function(qualityLevels, playlistLoader) {
const newPlaylist = playlistLoader.media();
let selectedIndex = -1;
for (let i = 0; i < qualityLevels.length; i++) {
if (qualityLevels[i].id === newPlaylist.id) {
selectedIndex = i;
break;
}
}
qualityLevels.selectedIndex_ = selectedIndex;
qualityLevels.trigger({
selectedIndex,
type: 'change'
});
};
/**
* Adds quality levels to list once playlist metadata is available
*
* @param {QualityLevelList} qualityLevels The QualityLevelList to attach events to.
* @param {Object} vhs Vhs object to listen to for media events.
* @function handleVhsLoadedMetadata
*/
const handleVhsLoadedMetadata = function(qualityLevels, vhs) {
vhs.representations().forEach((rep) => {
qualityLevels.addQualityLevel(rep);
});
handleVhsMediaChange(qualityLevels, vhs.playlists);
};
// HLS is a source handler, not a tech. Make sure attempts to use it
// as one do not cause exceptions.
Vhs.canPlaySource = function() {
return videojs.log.warn('HLS is no longer a tech. Please remove it from ' +
'your player\'s techOrder.');
};
const emeKeySystems = (keySystemOptions, mainPlaylist, audioPlaylist) => {
if (!keySystemOptions) {
return keySystemOptions;
}
let codecs = {};
if (mainPlaylist && mainPlaylist.attributes && mainPlaylist.attributes.CODECS) {
codecs = unwrapCodecList(parseCodecs(mainPlaylist.attributes.CODECS));
}
if (audioPlaylist && audioPlaylist.attributes && audioPlaylist.attributes.CODECS) {
codecs.audio = audioPlaylist.attributes.CODECS;
}
const videoContentType = getMimeForCodec(codecs.video);
const audioContentType = getMimeForCodec(codecs.audio);
// upsert the content types based on the selected playlist
const keySystemContentTypes = {};
for (const keySystem in keySystemOptions) {
keySystemContentTypes[keySystem] = {};
if (audioContentType) {
keySystemContentTypes[keySystem].audioContentType = audioContentType;
}
if (videoContentType) {
keySystemContentTypes[keySystem].videoContentType = videoContentType;
}
// Default to using the video playlist's PSSH even though they may be different, as
// videojs-contrib-eme will only accept one in the options.
//
// This shouldn't be an issue for most cases as early intialization will handle all
// unique PSSH values, and if they aren't, then encrypted events should have the
// specific information needed for the unique license.
if (mainPlaylist.contentProtection &&
mainPlaylist.contentProtection[keySystem] &&
mainPlaylist.contentProtection[keySystem].pssh) {
keySystemContentTypes[keySystem].pssh =
mainPlaylist.contentProtection[keySystem].pssh;
}
// videojs-contrib-eme accepts the option of specifying: 'com.some.cdm': 'url'
// so we need to prevent overwriting the URL entirely
if (typeof keySystemOptions[keySystem] === 'string') {
keySystemContentTypes[keySystem].url = keySystemOptions[keySystem];
}
}
return videojs.mergeOptions(keySystemOptions, keySystemContentTypes);
};
/**
* @typedef {Object} KeySystems
*
* keySystems configuration for https://github.com/videojs/videojs-contrib-eme
* Note: not all options are listed here.
*
* @property {Uint8Array} [pssh]
* Protection System Specific Header
*/
/**
* Goes through all the playlists and collects an array of KeySystems options objects
* containing each playlist's keySystems and their pssh values, if available.
*
* @param {Object[]} playlists
* The playlists to look through
* @param {string[]} keySystems
* The keySystems to collect pssh values for
*
* @return {KeySystems[]}
* An array of KeySystems objects containing available key systems and their
* pssh values
*/
const getAllPsshKeySystemsOptions = (playlists, keySystems) => {
return playlists.reduce((keySystemsArr, playlist) => {
if (!playlist.contentProtection) {
return keySystemsArr;
}
const keySystemsOptions = keySystems.reduce((keySystemsObj, keySystem) => {
const keySystemOptions = playlist.contentProtection[keySystem];
if (keySystemOptions && keySystemOptions.pssh) {
keySystemsObj[keySystem] = { pssh: keySystemOptions.pssh };
}
return keySystemsObj;
}, {});
if (Object.keys(keySystemsOptions).length) {
keySystemsArr.push(keySystemsOptions);
}
return keySystemsArr;
}, []);
};
/**
* Returns a promise that waits for the
* [eme plugin](https://github.com/videojs/videojs-contrib-eme) to create a key session.
*
* Works around https://bugs.chromium.org/p/chromium/issues/detail?id=895449 in non-IE11
* browsers.
*
* As per the above ticket, this is particularly important for Chrome, where, if
* unencrypted content is appended before encrypted content and the key session has not
* been created, a MEDIA_ERR_DECODE will be thrown once the encrypted content is reached
* during playback.
*
* @param {Object} player
* The player instance
* @param {Object[]} sourceKeySystems
* The key systems options from the player source
* @param {Object} [audioMedia]
* The active audio media playlist (optional)
* @param {Object[]} mainPlaylists
* The playlists found on the master playlist object
*
* @return {Object}
* Promise that resolves when the key session has been created
*/
export const waitForKeySessionCreation = ({
player,
sourceKeySystems,
audioMedia,
mainPlaylists
}) => {
if (!player.eme.initializeMediaKeys) {
return Promise.resolve();
}
// TODO should all audio PSSH values be initialized for DRM?
//
// All unique video rendition pssh values are initialized for DRM, but here only
// the initial audio playlist license is initialized. In theory, an encrypted
// event should be fired if the user switches to an alternative audio playlist
// where a license is required, but this case hasn't yet been tested. In addition, there
// may be many alternate audio playlists unlikely to be used (e.g., multiple different
// languages).
const playlists = audioMedia ? mainPlaylists.concat([audioMedia]) : mainPlaylists;
const keySystemsOptionsArr = getAllPsshKeySystemsOptions(
playlists,
Object.keys(sourceKeySystems)
);
const initializationFinishedPromises = [];
const keySessionCreatedPromises = [];
// Since PSSH values are interpreted as initData, EME will dedupe any duplicates. The
// only place where it should not be deduped is for ms-prefixed APIs, but the early
// return for IE11 above, and the existence of modern EME APIs in addition to
// ms-prefixed APIs on Edge should prevent this from being a concern.
// initializeMediaKeys also won't use the webkit-prefixed APIs.
keySystemsOptionsArr.forEach((keySystemsOptions) => {
keySessionCreatedPromises.push(new Promise((resolve, reject) => {
player.tech_.one('keysessioncreated', resolve);
}));
initializationFinishedPromises.push(new Promise((resolve, reject) => {
player.eme.initializeMediaKeys({
keySystems: keySystemsOptions
}, (err) => {
if (err) {
reject(err);
return;
}
resolve();
});
}));
});
// The reasons Promise.race is chosen over Promise.any:
//
// * Promise.any is only available in Safari 14+.
// * None of these promises are expected to reject. If they do reject, it might be
// better here for the race to surface the rejection, rather than mask it by using
// Promise.any.
return Promise.race([
// If a session was previously created, these will all finish resolving without
// creating a new session, otherwise it will take until the end of all license
// requests, which is why the key session check is used (to make setup much faster).
Promise.all(initializationFinishedPromises),
// Once a single session is created, the browser knows DRM will be used.
Promise.race(keySessionCreatedPromises)
]);
};
/**
* If the [eme](https://github.com/videojs/videojs-contrib-eme) plugin is available, and
* there are keySystems on the source, sets up source options to prepare the source for
* eme.
*
* @param {Object} player
* The player instance
* @param {Object[]} sourceKeySystems
* The key systems options from the player source
* @param {Object} media
* The active media playlist
* @param {Object} [audioMedia]
* The active audio media playlist (optional)
*
* @return {boolean}
* Whether or not options were configured and EME is available
*/
const setupEmeOptions = ({
player,
sourceKeySystems,
media,
audioMedia
}) => {
const sourceOptions = emeKeySystems(sourceKeySystems, media, audioMedia);
if (!sourceOptions) {
return false;
}
player.currentSource().keySystems = sourceOptions;
// eme handles the rest of the setup, so if it is missing
// do nothing.
if (sourceOptions && !player.eme) {
videojs.log.warn('DRM encrypted source cannot be decrypted without a DRM plugin');
return false;
}
return true;
};
const getVhsLocalStorage = () => {
if (!window.localStorage) {
return null;
}
const storedObject = window.localStorage.getItem(LOCAL_STORAGE_KEY);
if (!storedObject) {
return null;
}
try {
return JSON.parse(storedObject);
} catch (e) {
// someone may have tampered with the value
return null;
}
};
const updateVhsLocalStorage = (options) => {
if (!window.localStorage) {
return false;
}
let objectToStore = getVhsLocalStorage();
objectToStore = objectToStore ? videojs.mergeOptions(objectToStore, options) : options;
try {
window.localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(objectToStore));
} catch (e) {
// Throws if storage is full (e.g., always on iOS 5+ Safari private mode, where
// storage is set to 0).
// https://developer.mozilla.org/en-US/docs/Web/API/Storage/setItem#Exceptions
// No need to perform any operation.
return false;
}
return objectToStore;
};
/**
* Parses VHS-supported media types from data URIs. See
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
* for information on data URIs.
*
* @param {string} dataUri
* The data URI
*
* @return {string|Object}
* The parsed object/string, or the original string if no supported media type
* was found
*/
const expandDataUri = (dataUri) => {
if (dataUri.toLowerCase().indexOf('data:application/vnd.videojs.vhs+json,') === 0) {
return JSON.parse(dataUri.substring(dataUri.indexOf(',') + 1));
}
// no known case for this data URI, return the string as-is
return dataUri;
};
/**
* Whether the browser has built-in HLS support.
*/
Vhs.supportsNativeHls = (function() {
if (!document || !document.createElement) {
return false;
}
const video = document.createElement('video');
// native HLS is definitely not supported if HTML5 video isn't
if (!videojs.getTech('Html5').isSupported()) {
return false;
}
// HLS manifests can go by many mime-types
const canPlay = [
// Apple santioned
'application/vnd.apple.mpegurl',
// Apple sanctioned for backwards compatibility
'audio/mpegurl',
// Very common
'audio/x-mpegurl',
// Very common
'application/x-mpegurl',
// Included for completeness
'video/x-mpegurl',
'video/mpegurl',
'application/mpegurl'
];
return canPlay.some(function(canItPlay) {
return (/maybe|probably/i).test(video.canPlayType(canItPlay));
});
}());
Vhs.supportsNativeDash = (function() {
if (!document || !document.createElement || !videojs.getTech('Html5').isSupported()) {
return false;
}
return (/maybe|probably/i).test(document.createElement('video').canPlayType('application/dash+xml'));
}());
Vhs.supportsTypeNatively = (type) => {
if (type === 'hls') {
return Vhs.supportsNativeHls;
}
if (type === 'dash') {
return Vhs.supportsNativeDash;
}
return false;
};
/**
* HLS is a source handler, not a tech. Make sure attempts to use it
* as one do not cause exceptions.
*/
Vhs.isSupported = function() {
return videojs.log.warn('HLS is no longer a tech. Please remove it from ' +
'your player\'s techOrder.');
};
const Component = videojs.getComponent('Component');
/**
* The Vhs Handler object, where we orchestrate all of the parts
* of HLS to interact with video.js
*
* @class VhsHandler
* @extends videojs.Component
* @param {Object} source the soruce object
* @param {Tech} tech the parent tech object
* @param {Object} options optional and required options
*/
class VhsHandler extends Component {
constructor(source, tech, options) {
super(tech, videojs.mergeOptions(options.hls, options.vhs));
if (options.hls && Object.keys(options.hls).length) {
videojs.log.warn('Using hls options is deprecated. Use vhs instead.');
}
// if a tech level `initialBandwidth` option was passed
// use that over the VHS level `bandwidth` option
if (typeof options.initialBandwidth === 'number') {
this.options_.bandwidth = options.initialBandwidth;
}
this.logger_ = logger('VhsHandler');
// tech.player() is deprecated but setup a reference to HLS for
// backwards-compatibility
if (tech.options_ && tech.options_.playerId) {
const _player = videojs(tech.options_.playerId);
if (!_player.hasOwnProperty('hls')) {
Object.defineProperty(_player, 'hls', {
get: () => {
videojs.log.warn('player.hls is deprecated. Use player.tech().vhs instead.');
tech.trigger({ type: 'usage', name: 'hls-player-access' });
return this;
},
configurable: true
});
}
if (!_player.hasOwnProperty('vhs')) {
Object.defineProperty(_player, 'vhs', {
get: () => {
videojs.log.warn('player.vhs is deprecated. Use player.tech().vhs instead.');
tech.trigger({ type: 'usage', name: 'vhs-player-access' });
return this;
},
configurable: true
});
}
if (!_player.hasOwnProperty('dash')) {
Object.defineProperty(_player, 'dash', {
get: () => {
videojs.log.warn('player.dash is deprecated. Use player.tech().vhs instead.');
return this;
},
configurable: true
});
}
this.player_ = _player;
}
this.tech_ = tech;
this.source_ = source;
this.stats = {};
this.ignoreNextSeekingEvent_ = false;
this.setOptions_();
if (this.options_.overrideNative &&
tech.overrideNativeAudioTracks &&
tech.overrideNativeVideoTracks) {
tech.overrideNativeAudioTracks(true);
tech.overrideNativeVideoTracks(true);
} else if (this.options_.overrideNative &&
(tech.featuresNativeVideoTracks || tech.featuresNativeAudioTracks)) {
// overriding native HLS only works if audio tracks have been emulated
// error early if we're misconfigured
throw new Error('Overriding native HLS requires emulated tracks. ' +
'See https://git.io/vMpjB');
}
// listen for fullscreenchange events for this player so that we
// can adjust our quality selection quickly
this.on(document, [
'fullscreenchange', 'webkitfullscreenchange',
'mozfullscreenchange', 'MSFullscreenChange'
], (event) => {
const fullscreenElement = document.fullscreenElement ||
document.webkitFullscreenElement ||
document.mozFullScreenElement ||
document.msFullscreenElement;
if (fullscreenElement && fullscreenElement.contains(this.tech_.el())) {
this.masterPlaylistController_.smoothQualityChange_();
}
});
this.on(this.tech_, 'seeking', function() {
if (this.ignoreNextSeekingEvent_) {
this.ignoreNextSeekingEvent_ = false;
return;
}
this.setCurrentTime(this.tech_.currentTime());
});
this.on(this.tech_, 'error', function() {
// verify that the error was real and we are loaded
// enough to have mpc loaded.
if (this.tech_.error() && this.masterPlaylistController_) {
this.masterPlaylistController_.pauseLoading();
}
});
this.on(this.tech_, 'play', this.play);
}
setOptions_() {
// defaults
this.options_.withCredentials = this.options_.withCredentials || false;
this.options_.handleManifestRedirects = this.options_.handleManifestRedirects === false ? false : true;
this.options_.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions === false ? false : true;
this.options_.useDevicePixelRatio = this.options_.useDevicePixelRatio || false;
this.options_.smoothQualityChange = this.options_.smoothQualityChange || false;
this.options_.useBandwidthFromLocalStorage =
typeof this.source_.useBandwidthFromLocalStorage !== 'undefined' ?
this.source_.useBandwidthFromLocalStorage :
this.options_.useBandwidthFromLocalStorage || false;
this.options_.customTagParsers = this.options_.customTagParsers || [];
this.options_.customTagMappers = this.options_.customTagMappers || [];
this.options_.cacheEncryptionKeys = this.options_.cacheEncryptionKeys || false;
if (typeof this.options_.blacklistDuration !== 'number') {
this.options_.blacklistDuration = 5 * 60;
}
if (typeof this.options_.bandwidth !== 'number') {
if (this.options_.useBandwidthFromLocalStorage) {
const storedObject = getVhsLocalStorage();
if (storedObject && storedObject.bandwidth) {
this.options_.bandwidth = storedObject.bandwidth;
this.tech_.trigger({type: 'usage', name: 'vhs-bandwidth-from-local-storage'});
this.tech_.trigger({type: 'usage', name: 'hls-bandwidth-from-local-storage'});
}
if (storedObject && storedObject.throughput) {
this.options_.throughput = storedObject.throughput;
this.tech_.trigger({type: 'usage', name: 'vhs-throughput-from-local-storage'});
this.tech_.trigger({type: 'usage', name: 'hls-throughput-from-local-storage'});
}
}
}
// if bandwidth was not set by options or pulled from local storage, start playlist
// selection at a reasonable bandwidth
if (typeof this.options_.bandwidth !== 'number') {
this.options_.bandwidth = Config.INITIAL_BANDWIDTH;
}
// If the bandwidth number is unchanged from the initial setting
// then this takes precedence over the enableLowInitialPlaylist option
this.options_.enableLowInitialPlaylist =
this.options_.enableLowInitialPlaylist &&
this.options_.bandwidth === Config.INITIAL_BANDWIDTH;
// grab options passed to player.src
[
'withCredentials',
'useDevicePixelRatio',
'limitRenditionByPlayerDimensions',
'bandwidth',
'smoothQualityChange',
'customTagParsers',
'customTagMappers',
'handleManifestRedirects',
'cacheEncryptionKeys',
'playlistSelector',
'initialPlaylistSelector',
'experimentalBufferBasedABR',
'liveRangeSafeTimeDelta',
'experimentalLLHLS'
].forEach((option) => {
if (typeof this.source_[option] !== 'undefined') {
this.options_[option] = this.source_[option];
}
});
this.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions;
this.useDevicePixelRatio = this.options_.useDevicePixelRatio;
}
/**
* called when player.src gets called, handle a new source
*
* @param {Object} src the source object to handle
*/
src(src, type) {
// do nothing if the src is falsey
if (!src) {
return;
}
this.setOptions_();
// add master playlist controller options
this.options_.src = expandDataUri(this.source_.src);
this.options_.tech = this.tech_;
this.options_.externVhs = Vhs;
this.options_.sourceType = simpleTypeFromSourceType(type);
// Whenever we seek internally, we should update the tech
this.options_.seekTo = (time) => {
this.tech_.setCurrentTime(time);
};
this.masterPlaylistController_ = new MasterPlaylistController(this.options_);
const playbackWatcherOptions = videojs.mergeOptions(
{
liveRangeSafeTimeDelta: SAFE_TIME_DELTA
},
this.options_,
{
seekable: () => this.seekable(),
media: () => this.masterPlaylistController_.media(),
masterPlaylistController: this.masterPlaylistController_
}
);
this.playbackWatcher_ = new PlaybackWatcher(playbackWatcherOptions);
this.masterPlaylistController_.on('error', () => {
const player = videojs.players[this.tech_.options_.playerId];
let error = this.masterPlaylistController_.error;
if (typeof error === 'object' && !error.code) {
error.code = 3;
} else if (typeof error === 'string') {
error = {message: error, code: 3};
}
player.error(error);
});
const defaultSelector = this.options_.experimentalBufferBasedABR ?
Vhs.movingAverageBandwidthSelector(0.55) : Vhs.STANDARD_PLAYLIST_SELECTOR;
// `this` in selectPlaylist should be the VhsHandler for backwards
// compatibility with < v2
this.masterPlaylistController_.selectPlaylist = this.selectPlaylist ?
this.selectPlaylist.bind(this) :
defaultSelector.bind(this);
this.masterPlaylistController_.selectInitialPlaylist =
Vhs.INITIAL_PLAYLIST_SELECTOR.bind(this);
// re-expose some internal objects for backwards compatibility with < v2
this.playlists = this.masterPlaylistController_.masterPlaylistLoader_;
this.mediaSource = this.masterPlaylistController_.mediaSource;
// Proxy assignment of some properties to the master playlist
// controller. Using a custom property for backwards compatibility
// with < v2
Object.defineProperties(this, {
selectPlaylist: {
get() {
return this.masterPlaylistController_.selectPlaylist;
},
set(selectPlaylist) {
this.masterPlaylistController_.selectPlaylist = selectPlaylist.bind(this);
}
},
throughput: {
get() {
return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate;
},
set(throughput) {
this.masterPlaylistController_.mainSegmentLoader_.throughput.rate = throughput;
// By setting `count` to 1 the throughput value becomes the starting value
// for the cumulative average
this.masterPlaylistController_.mainSegmentLoader_.throughput.count = 1;
}
},
bandwidth: {
get() {
return this.masterPlaylistController_.mainSegmentLoader_.bandwidth;
},
set(bandwidth) {
this.masterPlaylistController_.mainSegmentLoader_.bandwidth = bandwidth;
// setting the bandwidth manually resets the throughput counter
// `count` is set to zero that current value of `rate` isn't included
// in the cumulative average
this.masterPlaylistController_.mainSegmentLoader_.throughput = {
rate: 0,
count: 0
};
}
},
/**
* `systemBandwidth` is a combination of two serial processes bit-rates. The first
* is the network bitrate provided by `bandwidth` and the second is the bitrate of
* the entire process after that - decryption, transmuxing, and appending - provided
* by `throughput`.
*
* Since the two process are serial, the overall system bandwidth is given by:
* sysBandwidth = 1 / (1 / bandwidth + 1 / throughput)
*/
systemBandwidth: {
get() {
const invBandwidth = 1 / (this.bandwidth || 1);
let invThroughput;
if (this.throughput > 0) {
invThroughput = 1 / this.throughput;
} else {
invThroughput = 0;
}
const systemBitrate = Math.floor(1 / (invBandwidth + invThroughput));
return systemBitrate;
},
set() {
videojs.log.error('The "systemBandwidth" property is read-only');
}
}
});
if (this.options_.bandwidth) {
this.bandwidth = this.options_.bandwidth;
}
if (this.options_.throughput) {
this.throughput = this.options_.throughput;
}
Object.defineProperties(this.stats, {
bandwidth: {
get: () => this.bandwidth || 0,
enumerable: true
},
mediaRequests: {
get: () => this.masterPlaylistController_.mediaRequests_() || 0,
enumerable: true
},
mediaRequestsAborted: {
get: () => this.masterPlaylistController_.mediaRequestsAborted_() || 0,
enumerable: true
},
mediaRequestsTimedout: {
get: () => this.masterPlaylistController_.mediaRequestsTimedout_() || 0,
enumerable: true
},
mediaRequestsErrored: {
get: () => this.masterPlaylistController_.mediaRequestsErrored_() || 0,
enumerable: true
},
mediaTransferDuration: {
get: () => this.masterPlaylistController_.mediaTransferDuration_() || 0,
enumerable: true
},
mediaBytesTransferred: {
get: () => this.masterPlaylistController_.mediaBytesTransferred_() || 0,
enumerable: true
},
mediaSecondsLoaded: {
get: () => this.masterPlaylistController_.mediaSecondsLoaded_() || 0,
enumerable: true
},
buffered: {
get: () => timeRangesToArray(this.tech_.buffered()),
enumerable: true
},
currentTime: {
get: () => this.tech_.currentTime(),
enumerable: true
},
currentSource: {
get: () => this.tech_.currentSource_,
enumerable: true
},
currentTech: {
get: () => this.tech_.name_,
enumerable: true
},
duration: {
get: () => this.tech_.duration(),
enumerable: true
},
master: {
get: () => this.playlists.master,
enumerable: true
},
playerDimensions: {
get: () => this.tech_.currentDimensions(),
enumerable: true
},
seekable: {
get: () => timeRangesToArray(this.tech_.seekable()),
enumerable: true
},
timestamp: {
get: () => Date.now(),
enumerable: true
},
videoPlaybackQuality: {
get: () => this.tech_.getVideoPlaybackQuality(),
enumerable: true
}
});
this.tech_.one(
'canplay',
this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)
);
this.tech_.on('bandwidthupdate', () => {
if (this.options_.useBandwidthFromLocalStorage) {
updateVhsLocalStorage({
bandwidth: this.bandwidth,
throughput: Math.round(this.throughput)
});
}
});
this.masterPlaylistController_.on('selectedinitialmedia', () => {
// Add the manual rendition mix-in to VhsHandler
renditionSelectionMixin(this);
});
this.masterPlaylistController_.sourceUpdater_.on('createdsourcebuffers', () => {
this.setupEme_();
});
// the bandwidth of the primary segment loader is our best
// estimate of overall bandwidth
this.on(this.masterPlaylistController_, 'progress', function() {
this.tech_.trigger('progress');
});
// In the live case, we need to ignore the very first `seeking` event since
// that will be the result of the seek-to-live behavior
this.on(this.masterPlaylistController_, 'firstplay', function() {
this.ignoreNextSeekingEvent_ = true;
});
this.setupQualityLevels_();
// do nothing if the tech has been disposed already
// this can occur if someone sets the src in player.ready(), for instance
if (!this.tech_.el()) {
return;
}
this.mediaSourceUrl_ = window.URL.createObjectURL(this.masterPlaylistController_.mediaSource);
this.tech_.src(this.mediaSourceUrl_);
}
/**
* If necessary and EME is available, sets up EME options and waits for key session
* creation.
*
* This function also updates the source updater so taht it can be used, as for some
* browsers, EME must be configured before content is appended (if appending unencrypted
* content before encrypted content).
*/
setupEme_() {
const audioPlaylistLoader =
this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;
const didSetupEmeOptions = setupEmeOptions({
player: this.player_,
sourceKeySystems: this.source_.keySystems,
media: this.playlists.media(),
audioMedia: audioPlaylistLoader && audioPlaylistLoader.media()
});
// In IE11 this is too early to initialize media keys, and IE11 does not support
// promises.
if (videojs.browser.IE_VERSION === 11 || !didSetupEmeOptions) {
// If EME options were not set up, we've done all we could to initialize EME.
this.masterPlaylistController_.sourceUpdater_.initializedEme();
return;
}
this.logger_('waiting for EME key session creation');
waitForKeySessionCreation({
player: this.player_,
sourceKeySystems: this.source_.keySystems,
audioMedia: audioPlaylistLoader && audioPlaylistLoader.media(),
mainPlaylists: this.playlists.master.playlists
}).then(() => {
this.logger_('created EME key session');
this.masterPlaylistController_.sourceUpdater_.initializedEme();
}).catch((err) => {
this.logger_('error while creating EME key session', err);
this.player_.error({
message: 'Failed to initialize media keys for EME',
code: 3
});
});
}
/**
* Initializes the quality levels and sets listeners to update them.
*
* @method setupQualityLevels_
* @private
*/
setupQualityLevels_() {
const player = videojs.players[this.tech_.options_.playerId];
// if there isn't a player or there isn't a qualityLevels plugin
// or qualityLevels_ listeners have already been setup, do nothing.
if (!player || !player.qualityLevels || this.qualityLevels_) {
return;
}
this.qualityLevels_ = player.qualityLevels();
this.masterPlaylistController_.on('selectedinitialmedia', () => {
handleVhsLoadedMetadata(this.qualityLevels_, this);
});
this.playlists.on('mediachange', () => {
handleVhsMediaChange(this.qualityLevels_, this.playlists);
});
}
/**
* return the version
*/
static version() {
return {
'@videojs/http-streaming': vhsVersion,
'mux.js': muxVersion,
'mpd-parser': mpdVersion,
'm3u8-parser': m3u8Version,
'aes-decrypter': aesVersion
};
}
/**
* return the version
*/
version() {
return this.constructor.version();
}
canChangeType() {
return SourceUpdater.canChangeType();
}
/**
* Begin playing the video.
*/
play() {
this.masterPlaylistController_.play();
}
/**
* a wrapper around the function in MasterPlaylistController
*/
setCurrentTime(currentTime) {
this.masterPlaylistController_.setCurrentTime(currentTime);
}
/**
* a wrapper around the function in MasterPlaylistController
*/
duration() {
return this.masterPlaylistController_.duration();
}
/**
* a wrapper around the function in MasterPlaylistController
*/
seekable() {
return this.masterPlaylistController_.seekable();
}
/**
* Abort all outstanding work and cleanup.
*/
dispose() {
if (this.playbackWatcher_) {
this.playbackWatcher_.dispose();
}
if (this.masterPlaylistController_) {
this.masterPlaylistController_.dispose();
}
if (this.qualityLevels_) {
this.qualityLevels_.dispose();
}
if (this.player_) {
delete this.player_.vhs;
delete this.player_.dash;
delete this.player_.hls;
}
if (this.tech_ && this.tech_.vhs) {
delete this.tech_.vhs;
}
// don't check this.tech_.hls as it will log a deprecated warning
if (this.tech_) {
delete this.tech_.hls;
}
if (this.mediaSourceUrl_ && window.URL.revokeObjectURL) {
window.URL.revokeObjectURL(this.mediaSourceUrl_);
this.mediaSourceUrl_ = null;
}
super.dispose();
}
convertToProgramTime(time, callback) {
return getProgramTime({
playlist: this.masterPlaylistController_.media(),
time,
callback
});
}
// the player must be playing before calling this
seekToProgramTime(programTime, callback, pauseAfterSeek = true, retryCount = 2) {
return seekToProgramTime({
programTime,
playlist: this.masterPlaylistController_.media(),
retryCount,
pauseAfterSeek,
seekTo: this.options_.seekTo,
tech: this.options_.tech,
callback
});
}
}
/**
* The Source Handler object, which informs video.js what additional
* MIME types are supported and sets up playback. It is registered
* automatically to the appropriate tech based on the capabilities of
* the browser it is running in. It is not necessary to use or modify
* this object in normal usage.
*/
const VhsSourceHandler = {
name: 'videojs-http-streaming',
VERSION: vhsVersion,
canHandleSource(srcObj, options = {}) {
const localOptions = videojs.mergeOptions(videojs.options, options);
return VhsSourceHandler.canPlayType(srcObj.type, localOptions);
},
handleSource(source, tech, options = {}) {
const localOptions = videojs.mergeOptions(videojs.options, options);
tech.vhs = new VhsHandler(source, tech, localOptions);
if (!videojs.hasOwnProperty('hls')) {
Object.defineProperty(tech, 'hls', {
get: () => {
videojs.log.warn('player.tech().hls is deprecated. Use player.tech().vhs instead.');
return tech.vhs;
},
configurable: true
});
}
tech.vhs.xhr = xhrFactory();
tech.vhs.src(source.src, source.type);
return tech.vhs;
},
canPlayType(type, options = {}) {
const { vhs: { overrideNative = !videojs.browser.IS_ANY_SAFARI } } = videojs.mergeOptions(videojs.options, options);
const supportedType = simpleTypeFromSourceType(type);
const canUseMsePlayback = supportedType &&
(!Vhs.supportsTypeNatively(supportedType) || overrideNative);
return canUseMsePlayback ? 'maybe' : '';
}
};
/**
* Check to see if the native MediaSource object exists and supports
* an MP4 container with both H.264 video and AAC-LC audio.
*
* @return {boolean} if native media sources are supported
*/
const supportsNativeMediaSources = () => {
return browserSupportsCodec('avc1.4d400d,mp4a.40.2');
};
// register source handlers with the appropriate techs
if (supportsNativeMediaSources()) {
videojs.getTech('Html5').registerSourceHandler(VhsSourceHandler, 0);
}
videojs.VhsHandler = VhsHandler;
Object.defineProperty(videojs, 'HlsHandler', {
get: () => {
videojs.log.warn('videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead.');
return VhsHandler;
},
configurable: true
});
videojs.VhsSourceHandler = VhsSourceHandler;
Object.defineProperty(videojs, 'HlsSourceHandler', {
get: () => {
videojs.log.warn('videojs.HlsSourceHandler is deprecated. ' +
'Use videojs.VhsSourceHandler instead.');
return VhsSourceHandler;
},
configurable: true
});
videojs.Vhs = Vhs;
Object.defineProperty(videojs, 'Hls', {
get: () => {
videojs.log.warn('videojs.Hls is deprecated. Use videojs.Vhs instead.');
return Vhs;
},
configurable: true
});
if (!videojs.use) {
videojs.registerComponent('Hls', Vhs);
videojs.registerComponent('Vhs', Vhs);
}
videojs.options.vhs = videojs.options.vhs || {};
videojs.options.hls = videojs.options.hls || {};
if (videojs.registerPlugin) {
videojs.registerPlugin('reloadSourceOnError', reloadSourceOnError);
} else {
videojs.plugin('reloadSourceOnError', reloadSourceOnError);
}
export {
Vhs,
VhsHandler,
VhsSourceHandler,
emeKeySystems,
simpleTypeFromSourceType,
expandDataUri,
setupEmeOptions,
getAllPsshKeySystemsOptions
};
|
const visit = require(`unist-util-visit`);
const parseOptions = require(`./parse-options`);
const loadLanguageExtension = require(`./load-prism-language-extension`);
const highlightCode = require(`./highlight-code`);
const addLineNumbers = require(`./add-line-numbers`);
const commandLine = require(`./command-line`);
function prism(options = {}) {
const classPrefix = options.classPrefix || `language-`;
const inlineCodeMarker = options.inlineCodeMarker || null;
const aliases = options.aliases || {};
const noInlineHighlight = options.noInlineHighlight || false;
const showLineNumbersGlobal = options.showLineNumbers || false;
const languageExtensions = options.languageExtensions || [];
const prompt = options.prompt || {
user: `root`,
host: `localhost`,
global: false,
};
function transform(markdownAST) {
const normalizeLanguage = lang => {
const lower = lang.toLowerCase();
return aliases[lower] || lower;
};
//Load language extension if defined
loadLanguageExtension(languageExtensions);
visit(markdownAST, `code`, node => {
let language = node.meta ? node.lang + node.meta : node.lang;
let {
splitLanguage,
highlightLines,
showLineNumbersLocal,
numberLinesStartAt,
outputLines,
promptUserLocal,
promptHostLocal,
} = parseOptions(language);
const showLineNumbers = showLineNumbersLocal || showLineNumbersGlobal;
const promptUser = promptUserLocal || prompt.user;
const promptHost = promptHostLocal || prompt.host;
language = splitLanguage;
// PrismJS's theme styles are targeting pre[class*="language-"]
// to apply its styles. We do the same here so that users
// can apply a PrismJS theme and get the expected, ready-to-use
// outcome without any additional CSS.
//
// @see https://github.com/PrismJS/prism/blob/1d5047df37aacc900f8270b1c6215028f6988eb1/themes/prism.css#L49-L54
let languageName = `text`;
if (language) {
languageName = normalizeLanguage(language);
}
// Allow users to specify a custom class prefix to avoid breaking
// line highlights if Prism is required by any other code.
// This supports custom user styling without causing Prism to
// re-process our already-highlighted markup.
// @see https://github.com/gatsbyjs/gatsby/issues/1486
const className = `${classPrefix}${languageName}`;
let numLinesStyle, numLinesClass, numLinesNumber;
numLinesStyle = numLinesClass = numLinesNumber = ``;
if (showLineNumbers) {
numLinesStyle = ` style="counter-reset: linenumber ${numberLinesStartAt -
1}"`;
numLinesClass = ` line-numbers`;
numLinesNumber = addLineNumbers(node.value);
}
// Replace the node with the markup we need to make
// 100% width highlighted code lines work
node.type = `html`;
let highlightClassName = `gatsby-highlight`;
if (highlightLines && highlightLines.length > 0)
highlightClassName += ` has-highlighted-lines`;
const useCommandLine =
[`bash`].includes(languageName) &&
(prompt.global ||
(outputLines && outputLines.length > 0) ||
promptUserLocal ||
promptHostLocal);
// prettier-ignore
node.value = ``
+ `<div class="${highlightClassName}" data-language="${languageName}">`
+ `<pre${numLinesStyle} class="${className}${numLinesClass}">`
+ `<code class="${className}">`
+ `${useCommandLine ? commandLine(node.value, outputLines, promptUser, promptHost) : ``}`
+ `${highlightCode(languageName, node.value, highlightLines, noInlineHighlight)}`
+ `</code>`
+ `${numLinesNumber}`
+ `</pre>`
+ `</div>`
});
if (!noInlineHighlight) {
visit(markdownAST, `inlineCode`, node => {
let languageName = `text`;
if (inlineCodeMarker) {
let [language, restOfValue] = node.value.split(
`${inlineCodeMarker}`,
2
);
if (language && restOfValue) {
languageName = normalizeLanguage(language);
node.value = restOfValue;
}
}
const className = `${classPrefix}${languageName}`;
node.type = `html`;
node.value = `<code class="${className}">${highlightCode(
languageName,
node.value
)}</code>`;
});
}
}
return transform;
}
module.exports = prism;
|
function generator$legend_of_zelda$korok_kokiris(type) {
var nm1 = ["", "", "", "", "b", "d", "br", "dr", "gr", "g", "h", "k", "l", "m", "r", "tr", "t"];
var nm2 = ["a", "e", "i", "o", "u"];
var nm3 = ["c", "g", "gn", "gm", "k", "kl", "l", "v", "ld", "lm", "ll", "m", "md", "n", "nd", "r", "rn", "s", "sn", "sm", "sr"];
var nm4 = ["", "", "", "", "", "", "", "", "h", "l", "m", "s", "r", "n", "wn", "w"];
var nm5 = ["b", "d", "f", "g", "h", "k", "l", "m", "n", "p", "r", "s", "t", "z"];
var nm6 = ["b", "d", "f", "g", "h", "l", "k", "m", "n", "p", "r", "s", "t", "v", "w", "z"];
var nm7 = ["c", "d", "f", "g", "h", "k", "l", "m", "n", "ph", "r", "s", "t", "th", "w", "z"];
var nm8 = ["a", "e", "i", "o", "u", "ai", "ae", "ea", "ei", "eo", "ia", "io", "iu", "ie", "oa", "oe", "oi", "ou", "ua", "ue", "uo", "ui"];
i = Math.floor(Math.random() * 10); {
if (type === 1) {
rnd = Math.floor(Math.random() * nm6.length);
rnd2 = Math.floor(Math.random() * nm2.length);
rnd3 = Math.floor(Math.random() * nm7.length);
rnd4 = Math.floor(Math.random() * nm8.length);
names = nm6[rnd] + nm2[rnd2] + nm7[rnd3] + nm8[rnd4];
} else {
if (i < 5) {
rnd = Math.floor(Math.random() * nm1.length);
rnd2 = Math.floor(Math.random() * nm2.length);
rnd3 = Math.floor(Math.random() * nm3.length);
rnd4 = Math.floor(Math.random() * nm4.length);
rnd5 = Math.floor(Math.random() * nm2.length);
names = nm1[rnd] + nm2[rnd2] + nm3[rnd3] + nm2[rnd5] + nm4[rnd4];
} else {
rnd = Math.floor(Math.random() * nm5.length);
rnd2 = Math.floor(Math.random() * nm2.length);
rnd3 = Math.floor(Math.random() * nm7.length);
rnd4 = Math.floor(Math.random() * nm2.length);
names = nm5[rnd] + nm2[rnd2] + nm7[rnd3] + nm2[rnd4];
}
}
return names;
}
}
|
const { inherits } = require('util')
const Mocha = require('mocha')
const Base = Mocha.reporters.Base
const after = require('./after')
const readConfig = require('./readConfig')
const getReporterClass = require('./getReporterClass')
function MultiReporter (runner, options) {
const [majorVersion] = Mocha.prototype.version.split('.')
if (Number(majorVersion) >= 6) {
const createStatsCollector = require('mocha/lib/stats-collector')
createStatsCollector(runner)
}
Base.call(this, runner, options)
const config = readConfig(options)
this.reporters = Object.entries(config)
.filter(([name, value]) => value)
.map(([name, value]) => {
const Reporter = getReporterClass(name)
if (Reporter) {
const reporterOptions = typeof value === 'object' ? value : {}
return new Reporter(runner, { reporterOptions })
} else {
console.error(`The reporter "${name}" does not found.`)
}
})
.filter(reporter => reporter)
}
inherits(MultiReporter, Base)
MultiReporter.prototype.done = function (failures, fn) {
const doneableReporters = this.reporters
.filter(({ done }) => typeof done === 'function')
if (doneableReporters.length === 0) {
return fn(failures)
}
const done = after(doneableReporters.length, () => fn(failures))
doneableReporters.forEach(reporter => reporter.done(failures, done))
}
module.exports = MultiReporter
|
import axios from 'axios'
const baseUrl = '/api/fighters'
const getAll = async () => {
const res = await axios.get(`${baseUrl}`)
return res.data
}
const getOne = async (name) => {
const res = await axios.get(`${baseUrl}/${name}`)
return res.data
}
export default {
getAll,
getOne,
}
|
// Copyright 2015, EMC, Inc.
'use strict';
module.exports = {
friendlyName: 'Clear the System Event Log',
injectableName: 'Graph.ClearSEL.Node',
tasks: [
{
label: 'clearsel',
taskName: 'Task.Obm.Node.ClearSEL'
}
]
};
|
function Node (data) {
this.data = data;
this.next = null;
}
function SinglyLinkedList () {
this.head = null;
this.tail = null;
this.numberOfValues = 0;
}
SinglyLinkedList.prototype.add = function (data) {
var node = new Node(data);
if (!this.head) {
this.head = node;
this.tail = node;
} else {
this.tail.next = node;
this.tail = node;
}
this.numberOfValues++;
};
SinglyLinkedList.prototype.remove = function (data) {
var previous = this.head;
var current = this.head;
while (current) {
if (current.data === data) {
if (current === this.head) {
this.head = this.head.next;
}
if (current === this.tail) {
this.tail = previous;
}
previous.next = current.next;
this.numberOfValues--;
} else {
previous = current;
}
current = current.next;
}
};
SinglyLinkedList.prototype.insertAfter = function (data, toNodeData) {
var current = this.head;
while (current) {
if (current.data === toNodeData) {
var node = new Node(data);
if (current === this.tail) {
this.tail.next = node;
this.tail = node;
} else {
node.next = current.next;
current.next = node;
}
this.numberOfValues++;
}
current = current.next;
}
};
SinglyLinkedList.prototype.traverse = function (fn) {
var current = this.head;
while (current) {
if (fn) {
fn(current);
}
current = current.next;
}
};
SinglyLinkedList.prototype.length = function () {
return this.numberOfValues;
};
SinglyLinkedList.prototype.print = function () {
var string = '';
var current = this.head;
while (current) {
string += current.data + ' ';
current = current.next;
}
console.log(string.trim());
};
var singlyLinkedList = new SinglyLinkedList();
singlyLinkedList.print(); // => ''
singlyLinkedList.add(1);
singlyLinkedList.add(2);
singlyLinkedList.add(3);
singlyLinkedList.add(4);
singlyLinkedList.print(); // => 1 2 3 4
console.log('length is 4:', singlyLinkedList.length()); // => 4
singlyLinkedList.remove(3); // remove value
singlyLinkedList.print(); // => 1 2 4
singlyLinkedList.remove(9); // remove non existing value
singlyLinkedList.print(); // => 1 2 4
singlyLinkedList.remove(1); // remove head
singlyLinkedList.print(); // => 2 4
singlyLinkedList.remove(4); // remove tail
singlyLinkedList.print(); // => 2
console.log('length is 1:', singlyLinkedList.length()); // => 1
singlyLinkedList.add(6);
singlyLinkedList.print(); // => 2 6
singlyLinkedList.insertAfter(3, 2);
singlyLinkedList.print(); // => 2 3 6
singlyLinkedList.insertAfter(4, 3);
singlyLinkedList.print(); // => 2 3 4 6
singlyLinkedList.insertAfter(5, 9); // insertAfter a non existing node
singlyLinkedList.print(); // => 2 3 4 6
singlyLinkedList.insertAfter(5, 4);
singlyLinkedList.insertAfter(7, 6); // insertAfter the tail
singlyLinkedList.print(); // => 2 3 4 5 6 7
singlyLinkedList.add(8); // add node with normal method
singlyLinkedList.print(); // => 2 3 4 5 6 7 8
console.log('length is 7:', singlyLinkedList.length()); // => 7
singlyLinkedList.traverse(function (node) { node.data = node.data + 10; });
singlyLinkedList.print(); // => 12 13 14 15 16 17 18
singlyLinkedList.traverse(function (node) { console.log(node.data); }); // => 12 13 14 15 16 17 18
console.log('length is 7:', singlyLinkedList.length()); // => 7
|
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 - present Instructure, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import { error } from '@instructure/console/macro'
import { FocusRegion } from './FocusRegion'
let ENTRIES = []
/**
* ---
* category: utilities/a11y
* ---
* @module FocusManager
* Class for focus operations.
* - Scoping focus within a given context,
* - Mark active element for focus later
* - Return focus to the marked element
*/
class FocusRegionManager {
static focusRegion = (element, idOrOptions = {}) => {
let entry
if (typeof idOrOptions === 'string' ) {
entry = FocusRegionManager.getEntry(element, idOrOptions)
} else {
entry = FocusRegionManager.addEntry(element, idOrOptions)
}
if (entry && entry.region && typeof entry.region.focus === 'function') {
entry.region.focus()
return entry.region
} else {
error(
false,
`[FocusRegionManager] Could not focus region with element: ${element}`
)
}
}
static activateRegion = (element, options) => {
const { region } = FocusRegionManager.addEntry(element, options)
return region
}
static getActiveEntry = () => {
return ENTRIES.find(({ region }) => region.focused)
}
static findEntry = (element, id) => {
let index
if (id) {
index = ENTRIES.findIndex((entry) => entry.id === id)
} else {
index = ENTRIES.findIndex((entry) => entry.element === element)
}
return index
}
static getEntry = (element, id) => {
return ENTRIES[FocusRegionManager.findEntry(element, id)]
}
static addEntry = (element, options = {}) => {
const region = new FocusRegion(element, options)
const activeEntry = FocusRegionManager.getActiveEntry()
const { keyboardFocusable } = region
ENTRIES.forEach(({ region }) => {
if (region) {
// If the active region is triggering a new focus region that does not have
// keyboard focusable content, don't deactivate the active region's keyboard
// focus region
region.deactivate(
region.focused && !keyboardFocusable && { keyboard: false }
)
}
})
region.activate()
if (options.shouldFocusOnOpen) {
region.focus()
}
const entry = {
id: region.id,
element,
region,
children: [],
parent: activeEntry
}
ENTRIES.push(entry)
if (activeEntry) {
activeEntry.children.push(entry)
}
return entry
}
static removeEntry = (element, id) => {
const index = FocusRegionManager.findEntry(element, id)
const entry = ENTRIES[index]
if (index > -1) {
ENTRIES.splice(index, 1)
}
return entry
}
static isFocused = (element, id) => {
const entry = FocusRegionManager.getActiveEntry()
if (id) {
return entry && entry.region && entry.id === id
} else {
return entry && entry.region && entry.element === element
}
}
static clearEntries = () => {
ENTRIES = []
}
static blurRegion = (element, id) => {
const entry = FocusRegionManager.removeEntry(element, id)
if (entry) {
const { children, region, parent } = entry
// deactivate the region...
region && region.deactivate()
// and any regions created from it
if (children) {
children.forEach(({ id, element }) => {
const entry = FocusRegionManager.removeEntry(element, id)
entry && entry.region && entry.region.deactivate()
})
}
// activate the region's parent if it exists
parent && parent.region && parent.region.activate()
region && region.blur() // this should focus the parent region
}
}
}
export default FocusRegionManager
export { FocusRegionManager }
|
export {default} from './ButtonWithOptions.js';
|
const fontDetect = require('./detector');
const mmCharacterRange = /[\u1000-\u109F]/;
const library = {};
/** Syllable Libarary **/
library.syllable = {
zawgyi: [
[/([\u1000-\u1021\u1023-\u1027\u1029\u102a\u104c-\u104f\u1086\u108f-\u1092])/g, '\u200B$1'],
[/([\u1031][\u103b\u107e-\u1084]|[\u1031\u103b\u107e-\u1084])/g, '\u200B$1'],
[/([\u1031\u103b\u107e-\u1084])\u200B([\u1000-\u1021\u1025\u1029\u106A\u106B\u1086\u108F\u1090])/g, '$1$2'],
[/([\u0009-\u000d\u0020\u00a0\u2000-\u200a\u2028\u2029\u202f]|>|\u201C|\u2018|\-|\(|\[|{|[\u2012-\u2014])\u200B([\u1000-\u1021\u1031\u103b\u1025\u1029\u106A\u106B\u107e-\u1084\u1086\u108F\u1090])/g, '$1$2'],
[/\u200B([\u1000-\u1021\u1025\u1029\u106A\u106B\u1086\u108F\u1090]\u1039)/g, '$1'],
[/(\s|\n)\u200B([\u1000-\u1021\u1023-\u1027\u1029\u102a\u104c-\u104f\u1086\u108f-\u1092])/g, '$1$2'],
[/([\u1000-\u1021])\u200B([\u1000-\u1021\u1031\u103b\u107e-\u1084])/g, '$1$2']
],
unicode: [
[/(\u103A)(\u1037)/g, "$2$1"],
[/([\u1000-\u1021\u1023-\u1027\u1029\u102a\u103f\u104c-\u104f])/g, "\u200B$1"],
[/([\u0009-\u000d\u0020\u00a0\u2000-\u200a\u2028\u2029\u202f]|>|\u201C|\u2018|\-|\(|\[|{|[\u2012-\u2014]|\u1039)\u200B([\u1000-\u1021])/g, "$1$2"],
[/\u200B(\u1004\u103A\u1039)/g, "$1"],
[/\u200B([\u1000-\u1021]\u103A)/g, "$1"],
[/(\s|\n)\u200B([\u1000-\u1021\u1023-\u1027\u1029\u102a\u103f\u104c-\u104f])/g, "$1$2"],
[/([\u1000-\u1021])\u200B([\u1000-\u1021])/g, "$1$2"]
]
};
/**
* Syllable-Break agent
* @param content Text content
* @param language Language of content 'zawgyi' ? 'my'
* @param breakpoint Default is '\u200B'
* @return edited text
*/
function syllBreak(content, fontType, breakpoint){
if (!content)
throw new Error('Content must be specified on knayi.fontConvert');
if (content === '' || !mmCharacterRange.test(content))
return content;
content = content.trim().replace(/\u200B/g, '');
if (!fontType)
fontType = fontDetect(content);
var lib = library.syllable[fontType];
for (var i = 0; i < lib.length; i++) {
content = content.replace(lib[i][0], lib[i][1]);
};
content = content.replace(/^\u200B/, '');
if (breakpoint && breakpoint !== '\u200B')
return content.replace(/\u200B/g, breakpoint);
return content
};
module.exports = syllBreak;
|
defineSuite([
'Scene/createTileMapServiceImageryProvider',
'Core/Cartesian2',
'Core/Cartographic',
'Core/DefaultProxy',
'Core/GeographicProjection',
'Core/GeographicTilingScheme',
'Core/getAbsoluteUri',
'Core/loadImage',
'Core/loadWithXhr',
'Core/Math',
'Core/Rectangle',
'Core/RequestScheduler',
'Core/Resource',
'Core/WebMercatorProjection',
'Core/WebMercatorTilingScheme',
'Scene/Imagery',
'Scene/ImageryLayer',
'Scene/ImageryState',
'Scene/UrlTemplateImageryProvider',
'Specs/pollToPromise',
'ThirdParty/when'
], function(
createTileMapServiceImageryProvider,
Cartesian2,
Cartographic,
DefaultProxy,
GeographicProjection,
GeographicTilingScheme,
getAbsoluteUri,
loadImage,
loadWithXhr,
CesiumMath,
Rectangle,
RequestScheduler,
Resource,
WebMercatorProjection,
WebMercatorTilingScheme,
Imagery,
ImageryLayer,
ImageryState,
UrlTemplateImageryProvider,
pollToPromise,
when) {
'use strict';
beforeEach(function() {
RequestScheduler.clearForSpecs();
});
afterEach(function() {
loadImage.createImage = loadImage.defaultCreateImage;
loadWithXhr.load = loadWithXhr.defaultLoad;
});
it('return a UrlTemplateImageryProvider', function() {
var provider = createTileMapServiceImageryProvider({
url: 'made/up/tms/server/'
});
expect(provider).toBeInstanceOf(UrlTemplateImageryProvider);
});
it('resolves readyPromise', function() {
var provider = createTileMapServiceImageryProvider({
url : 'made/up/tms/server/'
});
return provider.readyPromise.then(function(result) {
expect(result).toBe(true);
expect(provider.ready).toBe(true);
});
});
it('resolves readyPromise with Resource', function() {
var resource = new Resource({
url: 'made/up/tms/server/'
});
var provider = createTileMapServiceImageryProvider({
url : resource
});
return provider.readyPromise.then(function(result) {
expect(result).toBe(true);
expect(provider.ready).toBe(true);
});
});
it('rejects readyPromise on error', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
// We can't resolve the promise immediately, because then the error would be raised
// before we could subscribe to it. This a problem particular to tests.
setTimeout(function() {
var parser = new DOMParser();
var xmlString =
'<TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0">' +
' <Title/>' +
' <Abstract/>' +
' <SRS>EPSG:4326</SRS>' +
' <BoundingBox minx="-10.0" miny="-123.0" maxx="11.0" maxy="-110.0"/>' +
' <Origin x="-90.0" y="-180.0"/>' +
' <TileFormat width="256" height="256" mime-type="image/png" extension="png"/>' +
' <TileSets profile="foobar">' +
' <TileSet href="2" units-per-pixel="39135.75848201024200" order="2"/>' +
' <TileSet href="3" units-per-pixel="19567.87924100512100" order="3"/>' +
' </TileSets>' +
'</TileMap>';
var xml = parser.parseFromString(xmlString, "text/xml");
deferred.resolve(xml);
}, 1);
};
var provider = createTileMapServiceImageryProvider({
url : 'made/up/tms/server'
});
return provider.readyPromise.then(function() {
fail('should not resolve');
}).otherwise(function (e) {
expect(provider.ready).toBe(false);
expect(e.message).toContain('unsupported profile');
});
});
it('rejects readyPromise on invalid xml', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
// We can't resolve the promise immediately, because then the error would be raised
// before we could subscribe to it. This a problem particular to tests.
setTimeout(function() {
var parser = new DOMParser();
var xmlString =
'<TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0">' +
' <Title/>' +
' <Abstract/>' +
' <SRS>EPSG:4326</SRS>' +
' <Origin x="-90.0" y="-180.0"/>' +
' <TileFormat width="256" height="256" mime-type="image/png" extension="png"/>' +
' <TileSets profile="foobar">' +
' <TileSet href="2" units-per-pixel="39135.75848201024200" order="2"/>' +
' <TileSet href="3" units-per-pixel="19567.87924100512100" order="3"/>' +
' </TileSets>' +
'</TileMap>';
var xml = parser.parseFromString(xmlString, "text/xml");
deferred.resolve(xml);
}, 1);
};
var provider = createTileMapServiceImageryProvider({
url : 'made/up/tms/server'
});
return provider.readyPromise.then(function() {
fail('should not resolve');
}).otherwise(function (e) {
expect(provider.ready).toBe(false);
expect(e.message).toContain('expected tilesets or bbox attributes');
});
});
it('requires the url to be specified', function() {
function createWithoutUrl() {
return createTileMapServiceImageryProvider({});
}
expect(createWithoutUrl).toThrowDeveloperError();
});
it('returns valid value for hasAlphaChannel', function() {
var provider = createTileMapServiceImageryProvider({
url : 'made/up/tms/server/'
});
return pollToPromise(function() {
return provider.ready;
}).then(function() {
expect(typeof provider.hasAlphaChannel).toBe('boolean');
});
});
it('supports a slash at the end of the URL', function() {
var baseUrl = 'made/up/tms/server/';
var provider = createTileMapServiceImageryProvider({
url : baseUrl
});
return pollToPromise(function() {
return provider.ready;
}).then(function() {
spyOn(loadImage, 'createImage').and.callFake(function(url, crossOrigin, deferred) {
expect(url).toStartWith(getAbsoluteUri(baseUrl));
// Just return any old image.
loadImage.defaultCreateImage('Data/Images/Red16x16.png', crossOrigin, deferred);
});
return provider.requestImage(0, 0, 0).then(function(image) {
expect(loadImage.createImage).toHaveBeenCalled();
expect(image).toBeInstanceOf(Image);
});
});
});
it('supports no slash at the endof the URL', function() {
var provider = createTileMapServiceImageryProvider({
url : 'http://made/up/tms/server'
});
return pollToPromise(function() {
return provider.ready;
}).then(function() {
spyOn(loadImage, 'createImage').and.callFake(function(url, crossOrigin, deferred) {
expect(url).toContain('made/up/tms/server/');
// Just return any old image.
loadImage.defaultCreateImage('Data/Images/Red16x16.png', crossOrigin, deferred);
});
return provider.requestImage(0, 0, 0).then(function(image) {
expect(loadImage.createImage).toHaveBeenCalled();
expect(image).toBeInstanceOf(Image);
});
});
});
it('supports a query string at the end of the URL', function() {
var baseUrl = 'made/up/tms/server/';
var provider = createTileMapServiceImageryProvider({
url : baseUrl + '?a=some&b=query'
});
return pollToPromise(function() {
return provider.ready;
}).then(function() {
spyOn(loadImage, 'createImage').and.callFake(function(url, crossOrigin, deferred) {
expect(url).toStartWith(getAbsoluteUri(baseUrl));
expect(url).toContain('?a=some&b=query');
// Just return any old image.
loadImage.defaultCreateImage('Data/Images/Red16x16.png', crossOrigin, deferred);
});
return provider.requestImage(0, 0, 0).then(function(image) {
expect(loadImage.createImage).toHaveBeenCalled();
expect(image).toBeInstanceOf(Image);
});
});
});
it('requestImage returns a promise for an image and loads it for cross-origin use', function() {
var provider = createTileMapServiceImageryProvider({
url : 'made/up/tms/server/'
});
return pollToPromise(function() {
return provider.ready;
}).then(function() {
expect(provider.url).toEqual(getAbsoluteUri('made/up/tms/server/{z}/{x}/{reverseY}.png'));
expect(provider.tileWidth).toEqual(256);
expect(provider.tileHeight).toEqual(256);
expect(provider.maximumLevel).toBeUndefined();
expect(provider.tilingScheme).toBeInstanceOf(WebMercatorTilingScheme);
expect(provider.rectangle).toEqual(new WebMercatorTilingScheme().rectangle);
spyOn(loadImage, 'createImage').and.callFake(function(url, crossOrigin, deferred) {
// Just return any old image.
loadImage.defaultCreateImage('Data/Images/Red16x16.png', crossOrigin, deferred);
});
return provider.requestImage(0, 0, 0).then(function(image) {
expect(loadImage.createImage).toHaveBeenCalled();
expect(image).toBeInstanceOf(Image);
});
});
});
it('when no credit is supplied, the provider has no logo', function() {
var provider = createTileMapServiceImageryProvider({
url : 'made/up/tms/server'
});
return pollToPromise(function() {
return provider.ready;
}).then(function() {
expect(provider.credit).toBeUndefined();
});
});
it('turns the supplied credit into a logo', function() {
var providerWithCredit = createTileMapServiceImageryProvider({
url : 'made/up/gms/server',
credit : 'Thanks to our awesome made up source of this imagery!'
});
return pollToPromise(function() {
return providerWithCredit.ready;
}).then(function() {
expect(providerWithCredit.credit).toBeDefined();
});
});
it('routes resource request through a proxy if one is specified', function() {
/*eslint-disable no-unused-vars*/
var proxy = new DefaultProxy('/proxy/');
var requestMetadata = when.defer();
spyOn(loadWithXhr, 'load').and.callFake(function(url, responseType, method, data, headers, deferred, overrideMimeType) {
requestMetadata.resolve(url);
deferred.reject(); //since the TMS server doesn't exist (and doesn't need too) we can just reject here.
});
var provider = createTileMapServiceImageryProvider({
url : 'server.invalid',
proxy : proxy
});
return requestMetadata.promise.then(function(url) {
expect(url.indexOf(proxy.getURL(getAbsoluteUri('server.invalid')))).toEqual(0);
});
/*eslint-enable no-unused-vars*/
});
it('resource request takes a query string', function() {
/*eslint-disable no-unused-vars*/
var requestMetadata = when.defer();
spyOn(loadWithXhr, 'load').and.callFake(function(url, responseType, method, data, headers, deferred, overrideMimeType) {
requestMetadata.resolve(url);
deferred.reject(); //since the TMS server doesn't exist (and doesn't need too) we can just reject here.
});
var provider = createTileMapServiceImageryProvider({
url : 'http://server.invalid?query=1'
});
return requestMetadata.promise.then(function(url) {
expect(/\?query=1$/.test(url)).toEqual(true);
});
/*eslint-enable no-unused-vars*/
});
it('routes tile requests through a proxy if one is specified', function() {
var proxy = new DefaultProxy('/proxy/');
var provider = createTileMapServiceImageryProvider({
url : 'made/up/tms/server',
proxy : proxy
});
return pollToPromise(function() {
return provider.ready;
}).then(function() {
expect(provider.proxy).toEqual(proxy);
spyOn(loadImage, 'createImage').and.callFake(function(url, crossOrigin, deferred) {
expect(url.indexOf(proxy.getURL(getAbsoluteUri('made/up/tms/server')))).toEqual(0);
// Just return any old image.
loadImage.defaultCreateImage('Data/Images/Red16x16.png', crossOrigin, deferred);
});
return provider.requestImage(0, 0, 0).then(function(image) {
expect(loadImage.createImage).toHaveBeenCalled();
expect(image).toBeInstanceOf(Image);
});
});
});
it('rectangle passed to constructor does not affect tile numbering', function() {
var rectangle = new Rectangle(0.1, 0.2, 0.3, 0.4);
var provider = createTileMapServiceImageryProvider({
url : 'made/up/tms/server',
rectangle : rectangle
});
return pollToPromise(function() {
return provider.ready;
}).then(function() {
expect(provider.tileWidth).toEqual(256);
expect(provider.tileHeight).toEqual(256);
expect(provider.maximumLevel).toBeUndefined();
expect(provider.tilingScheme).toBeInstanceOf(WebMercatorTilingScheme);
expect(provider.rectangle.west).toEqualEpsilon(rectangle.west, CesiumMath.EPSILON14);
expect(provider.rectangle.east).toEqualEpsilon(rectangle.east, CesiumMath.EPSILON14);
expect(provider.rectangle.north).toEqualEpsilon(rectangle.north, CesiumMath.EPSILON14);
expect(provider.rectangle.south).toEqualEpsilon(rectangle.south, CesiumMath.EPSILON14);
expect(provider.tileDiscardPolicy).toBeUndefined();
spyOn(loadImage, 'createImage').and.callFake(function(url, crossOrigin, deferred) {
expect(url).toContain('/0/0/0');
// Just return any old image.
loadImage.defaultCreateImage('Data/Images/Red16x16.png', crossOrigin, deferred);
});
return provider.requestImage(0, 0, 0).then(function(image) {
expect(loadImage.createImage).toHaveBeenCalled();
expect(image).toBeInstanceOf(Image);
});
});
});
it('uses maximumLevel passed to constructor', function() {
var provider = createTileMapServiceImageryProvider({
url : 'made/up/tms/server',
maximumLevel : 5
});
return pollToPromise(function() {
return provider.ready;
}).then(function() {
expect(provider.maximumLevel).toEqual(5);
});
});
it('raises error event when image cannot be loaded', function() {
var provider = createTileMapServiceImageryProvider({
url : 'made/up/tms/server'
});
var layer = new ImageryLayer(provider);
var tries = 0;
provider.errorEvent.addEventListener(function(error) {
expect(error.timesRetried).toEqual(tries);
++tries;
if (tries < 3) {
error.retry = true;
}
setTimeout(function() {
RequestScheduler.update();
}, 1);
});
loadImage.createImage = function(url, crossOrigin, deferred) {
if (tries === 2) {
// Succeed after 2 tries
loadImage.defaultCreateImage('Data/Images/Red16x16.png', crossOrigin, deferred);
} else {
// fail
setTimeout(function() {
deferred.reject();
}, 1);
}
};
return pollToPromise(function() {
return provider.ready;
}).then(function() {
var imagery = new Imagery(layer, 0, 0, 0);
imagery.addReference();
layer._requestImagery(imagery);
RequestScheduler.update();
return pollToPromise(function() {
return imagery.state === ImageryState.RECEIVED;
}).then(function() {
expect(imagery.image).toBeInstanceOf(Image);
expect(tries).toEqual(2);
imagery.releaseReference();
});
});
});
it('keeps the rectangle within the bounds allowed by the tiling scheme no matter what the tilemapresource.xml says.', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
var parser = new DOMParser();
var xmlString =
"<TileMap version='1.0.0' tilemapservice='http://tms.osgeo.org/1.0.0'>" +
" <Title>dnb_land_ocean_ice.2012.54000x27000_geo.tif</Title>" +
" <Abstract/>" +
" <SRS>EPSG:900913</SRS>" +
" <BoundingBox miny='-88.0' minx='-185.0' maxy='88.0' maxx='185.0'/>" +
" <Origin y='-88.0' x='-180.00000000000000'/>" +
" <TileFormat width='256' height='256' mime-type='image/png' extension='png'/>" +
" <TileSets profile='mercator'>" +
" <TileSet href='8' units-per-pixel='611.49622617187504' order='8'/>" +
" </TileSets>" +
"</TileMap>";
var xml = parser.parseFromString(xmlString, "text/xml");
deferred.resolve(xml);
};
var provider = createTileMapServiceImageryProvider({
url : 'made/up/tms/server'
});
return pollToPromise(function() {
return provider.ready;
}).then(function() {
expect(provider.rectangle.west).toEqualEpsilon(CesiumMath.toRadians(-180.0), CesiumMath.EPSILON14);
expect(provider.rectangle.west).toBeGreaterThanOrEqualTo(provider.tilingScheme.rectangle.west);
expect(provider.rectangle.east).toEqualEpsilon(CesiumMath.toRadians(180.0), CesiumMath.EPSILON14);
expect(provider.rectangle.east).toBeLessThanOrEqualTo(provider.tilingScheme.rectangle.east);
expect(provider.rectangle.south).toEqualEpsilon(-WebMercatorProjection.MaximumLatitude, CesiumMath.EPSILON14);
expect(provider.rectangle.south).toBeGreaterThanOrEqualTo(provider.tilingScheme.rectangle.south);
expect(provider.rectangle.north).toEqualEpsilon(WebMercatorProjection.MaximumLatitude, CesiumMath.EPSILON14);
expect(provider.rectangle.north).toBeLessThanOrEqualTo(provider.tilingScheme.rectangle.north);
});
});
it('uses a minimum level if the tilemapresource.xml specifies one and it is reasonable', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
var parser = new DOMParser();
var xmlString =
"<TileMap version='1.0.0' tilemapservice='http://tms.osgeo.org/1.0.0'>" +
" <Title>dnb_land_ocean_ice.2012.54000x27000_geo.tif</Title>" +
" <Abstract/>" +
" <SRS>EPSG:900913</SRS>" +
" <BoundingBox minx='-10.0' miny='5.0' maxx='-9.0' maxy='6.0'/>" +
" <Origin x='-88.0' y='-180.00000000000000'/>" +
" <TileFormat width='256' height='256' mime-type='image/png' extension='png'/>" +
" <TileSets profile='mercator'>" +
" <TileSet href='7' units-per-pixel='1222.99245234375008' order='7'/>" +
" <TileSet href='8' units-per-pixel='611.49622617187504' order='8'/>" +
" </TileSets>" +
"</TileMap>";
var xml = parser.parseFromString(xmlString, "text/xml");
deferred.resolve(xml);
};
var provider = createTileMapServiceImageryProvider({
url : 'made/up/tms/server'
});
return pollToPromise(function() {
return provider.ready;
}).then(function() {
expect(provider.maximumLevel).toBe(8);
expect(provider.minimumLevel).toBe(7);
});
});
it('ignores the minimum level in the tilemapresource.xml if it is unreasonable', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
var parser = new DOMParser();
var xmlString =
"<TileMap version='1.0.0' tilemapservice='http://tms.osgeo.org/1.0.0'>" +
" <Title>dnb_land_ocean_ice.2012.54000x27000_geo.tif</Title>" +
" <Abstract/>" +
" <SRS>EPSG:900913</SRS>" +
" <BoundingBox minx='-170.0' miny='-85.0' maxx='170.0' maxy='85.0'/>" +
" <Origin x='-88.0' y='-180.00000000000000'/>" +
" <TileFormat width='256' height='256' mime-type='image/png' extension='png'/>" +
" <TileSets profile='mercator'>" +
" <TileSet href='7' units-per-pixel='1222.99245234375008' order='7'/>" +
" <TileSet href='8' units-per-pixel='611.49622617187504' order='8'/>" +
" </TileSets>" +
"</TileMap>";
var xml = parser.parseFromString(xmlString, "text/xml");
deferred.resolve(xml);
};
var provider = createTileMapServiceImageryProvider({
url : 'made/up/tms/server'
});
return pollToPromise(function() {
return provider.ready;
}).then(function() {
expect(provider.maximumLevel).toBe(8);
expect(provider.minimumLevel).toBe(0);
});
});
it('handles XML with casing differences', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
var parser = new DOMParser();
var xmlString =
"<Tilemap version='1.0.0' tilemapservice='http://tms.osgeo.org/1.0.0'>" +
" <Title>dnb_land_ocean_ice.2012.54000x27000_geo.tif</Title>" +
" <Abstract/>" +
" <SRS>EPSG:900913</SRS>" +
" <boundingbox minx='-10.0' miny='5.0' maxx='-9.0' maxy='6.0'/>" +
" <Origin x='-88.0' y='-180.00000000000000'/>" +
" <Tileformat width='256' height='256' mime-type='image/png' extension='png'/>" +
" <TileSets profile='mercator'>" +
" <tiLeset href='7' units-per-pixel='1222.99245234375008' order='7'/>" +
" <tileset href='8' units-per-pixel='611.49622617187504' order='8'/>" +
" </TileSets>" +
"</Tilemap>";
var xml = parser.parseFromString(xmlString, "text/xml");
deferred.resolve(xml);
};
var provider = createTileMapServiceImageryProvider({
url : 'made/up/tms/server'
});
return pollToPromise(function() {
return provider.ready;
}).then(function() {
expect(provider.maximumLevel).toBe(8);
expect(provider.minimumLevel).toBe(7);
});
});
it('supports the global-mercator profile with a non-flipped, mercator bounding box', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
var parser = new DOMParser();
var xmlString =
'<TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0">' +
' <Title/>' +
' <Abstract/>' +
' <SRS>EPSG:900913</SRS>' +
' <BoundingBox minx="-11877789.66764229300000" miny="1707163.75952051670000" maxx="-4696205.45407573510000" maxy="7952627.07365330120000"/>' +
' <Origin x="-20037508.34278924400000" y="-20037508.34278924400000"/>' +
' <TileFormat width="256" height="256" mime-type="image/png" extension="png"/>' +
' <TileSets profile="global-mercator">' +
' <TileSet href="2" units-per-pixel="39135.75848201024200" order="2"/>' +
' <TileSet href="3" units-per-pixel="19567.87924100512100" order="3"/>' +
' </TileSets>' +
'</TileMap>';
var xml = parser.parseFromString(xmlString, "text/xml");
deferred.resolve(xml);
};
var provider = createTileMapServiceImageryProvider({
url : 'made/up/tms/server'
});
return pollToPromise(function() {
return provider.ready;
}).then(function() {
expect(provider.tilingScheme).toBeInstanceOf(WebMercatorTilingScheme);
expect(provider.tilingScheme.projection).toBeInstanceOf(WebMercatorProjection);
var projection = provider.tilingScheme.projection;
var expectedSW = projection.unproject(new Cartesian2(-11877789.66764229300000, 1707163.75952051670000));
var expectedNE = projection.unproject(new Cartesian2(-4696205.45407573510000, 7952627.07365330120000));
expect(provider.rectangle.west).toEqual(expectedSW.longitude);
expect(provider.rectangle.south).toEqual(expectedSW.latitude);
expect(provider.rectangle.east).toBeCloseTo(expectedNE.longitude, CesiumMath.EPSILON14);
expect(provider.rectangle.north).toEqual(expectedNE.latitude);
});
});
it('supports the global-geodetic profile with a non-flipped, geographic bounding box', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
var parser = new DOMParser();
var xmlString =
'<TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0">' +
' <Title/>' +
' <Abstract/>' +
' <SRS>EPSG:4326</SRS>' +
' <BoundingBox minx="-123.0" miny="-10.0" maxx="-110.0" maxy="11.0"/>' +
' <Origin x="-180.0" y="-90.0"/>' +
' <TileFormat width="256" height="256" mime-type="image/png" extension="png"/>' +
' <TileSets profile="global-geodetic">' +
' <TileSet href="2" units-per-pixel="39135.75848201024200" order="2"/>' +
' <TileSet href="3" units-per-pixel="19567.87924100512100" order="3"/>' +
' </TileSets>' +
'</TileMap>';
var xml = parser.parseFromString(xmlString, "text/xml");
deferred.resolve(xml);
};
var provider = createTileMapServiceImageryProvider({
url : 'made/up/tms/server'
});
return pollToPromise(function() {
return provider.ready;
}).then(function() {
expect(provider.tilingScheme).toBeInstanceOf(GeographicTilingScheme);
expect(provider.tilingScheme.projection).toBeInstanceOf(GeographicProjection);
var expectedSW = Cartographic.fromDegrees(-123.0, -10.0);
var expectedNE = Cartographic.fromDegrees(-110.0, 11.0);
expect(provider.rectangle.west).toBeCloseTo(expectedSW.longitude, CesiumMath.EPSILON14);
expect(provider.rectangle.south).toEqual(expectedSW.latitude);
expect(provider.rectangle.east).toBeCloseTo(expectedNE.longitude, CesiumMath.EPSILON14);
expect(provider.rectangle.north).toEqual(expectedNE.latitude);
});
});
it('supports the old mercator profile with a flipped, geographic bounding box', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
var parser = new DOMParser();
var xmlString =
'<TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0">' +
' <Title/>' +
' <Abstract/>' +
' <SRS>EPSG:900913</SRS>' +
' <BoundingBox minx="-10.0" miny="-123.0" maxx="11.0" maxy="-110.0"/>' +
' <Origin x="-90.0" y="-180.0"/>' +
' <TileFormat width="256" height="256" mime-type="image/png" extension="png"/>' +
' <TileSets profile="mercator">' +
' <TileSet href="2" units-per-pixel="39135.75848201024200" order="2"/>' +
' <TileSet href="3" units-per-pixel="19567.87924100512100" order="3"/>' +
' </TileSets>' +
'</TileMap>';
var xml = parser.parseFromString(xmlString, "text/xml");
deferred.resolve(xml);
};
var provider = createTileMapServiceImageryProvider({
url : 'made/up/tms/server',
flipXY : true
});
return pollToPromise(function() {
return provider.ready;
}).then(function() {
expect(provider.tilingScheme).toBeInstanceOf(WebMercatorTilingScheme);
expect(provider.tilingScheme.projection).toBeInstanceOf(WebMercatorProjection);
var expectedSW = Cartographic.fromDegrees(-123.0, -10.0);
var expectedNE = Cartographic.fromDegrees(-110.0, 11.0);
expect(provider.rectangle.west).toBeCloseTo(expectedSW.longitude, CesiumMath.EPSILON14);
expect(provider.rectangle.south).toEqual(expectedSW.latitude);
expect(provider.rectangle.east).toBeCloseTo(expectedNE.longitude, CesiumMath.EPSILON14);
expect(provider.rectangle.north).toEqual(expectedNE.latitude);
});
});
it('supports the old geodetic profile with a flipped, geographic bounding box', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
var parser = new DOMParser();
var xmlString =
'<TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0">' +
' <Title/>' +
' <Abstract/>' +
' <SRS>EPSG:4326</SRS>' +
' <BoundingBox minx="-10.0" miny="-123.0" maxx="11.0" maxy="-110.0"/>' +
' <Origin x="-90.0" y="-180.0"/>' +
' <TileFormat width="256" height="256" mime-type="image/png" extension="png"/>' +
' <TileSets profile="geodetic">' +
' <TileSet href="2" units-per-pixel="39135.75848201024200" order="2"/>' +
' <TileSet href="3" units-per-pixel="19567.87924100512100" order="3"/>' +
' </TileSets>' +
'</TileMap>';
var xml = parser.parseFromString(xmlString, "text/xml");
deferred.resolve(xml);
};
var provider = createTileMapServiceImageryProvider({
url : 'made/up/tms/server',
flipXY : true
});
return pollToPromise(function() {
return provider.ready;
}).then(function() {
expect(provider.tilingScheme).toBeInstanceOf(GeographicTilingScheme);
expect(provider.tilingScheme.projection).toBeInstanceOf(GeographicProjection);
var expectedSW = Cartographic.fromDegrees(-123.0, -10.0);
var expectedNE = Cartographic.fromDegrees(-110.0, 11.0);
expect(provider.rectangle.west).toBeCloseTo(expectedSW.longitude, CesiumMath.EPSILON14);
expect(provider.rectangle.south).toEqual(expectedSW.latitude);
expect(provider.rectangle.east).toBeCloseTo(expectedNE.longitude, CesiumMath.EPSILON14);
expect(provider.rectangle.north).toEqual(expectedNE.latitude);
});
});
it('raises an error if tilemapresource.xml specifies an unsupported profile', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
// We can't resolve the promise immediately, because then the error would be raised
// before we could subscribe to it. This a problem particular to tests.
setTimeout(function() {
var parser = new DOMParser();
var xmlString =
'<TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0">' +
' <Title/>' +
' <Abstract/>' +
' <SRS>EPSG:4326</SRS>' +
' <BoundingBox minx="-10.0" miny="-123.0" maxx="11.0" maxy="-110.0"/>' +
' <Origin x="-90.0" y="-180.0"/>' +
' <TileFormat width="256" height="256" mime-type="image/png" extension="png"/>' +
' <TileSets profile="foobar">' +
' <TileSet href="2" units-per-pixel="39135.75848201024200" order="2"/>' +
' <TileSet href="3" units-per-pixel="19567.87924100512100" order="3"/>' +
' </TileSets>' +
'</TileMap>';
var xml = parser.parseFromString(xmlString, "text/xml");
deferred.resolve(xml);
}, 1);
};
var provider = createTileMapServiceImageryProvider({
url : 'made/up/tms/server'
});
var errorRaised = false;
provider.errorEvent.addEventListener(function(e) {
expect(e.message).toContain('unsupported profile');
errorRaised = true;
});
return pollToPromise(function() {
return errorRaised;
}).then(function() {
expect(errorRaised).toBe(true);
});
});
});
|
/*
Implements functionality for virtual Rover Coder training sessions on the HTML5 canvas.
Author: Nicos Kasenides (nkasenides@uclan.ac.uk)
Date: 21-Dec-2019
*/
import {Position2D} from "./Position2D.js";
import {Rover} from "./Rover.js";
import {GameGrid} from "./GameGrid.js";
import {Direction} from "./Direction.js";
import {Move} from "./Move.js";
import {GameState} from "./GameState.js";
//Constants:
export const CONTEXT = "2d";
export const DEFAULT_SIZE = 500;
export const UPDATE_DELAY = 1000;
const ROVER_IMAGE_PATH = "images/ev3.png";
export class Game {
constructor(width, height) {
this.width= width;
this.height = height;
this.canvas = document.createElement("canvas"); //Create the HTML canvas element
document.getElementById("canvasWrapper").appendChild(this.canvas);
this.canvas.style.backgroundColor = "lightgrey";
this.context = this.canvas.getContext(CONTEXT); //Get the context of the canvas (2D)
this.gameState = GameState.INIT;
this.setup();
}
setup() {
this.currentScale = 1;
this.gameGrid = new GameGrid(this.width, this.height);
this.startPosition = this.selectRandomStartPosition();
this.finishPosition = this.getFinishPosition(this.startPosition);
this.rover = new Rover(this.startPosition, this.gameGrid);
this.roverImage = importImage(ROVER_IMAGE_PATH);
this.cellSizeWidth = 0;
this.cellSizeHeight = 0;
}
start() {
this.resize();
this.initializeScene();
const game = this;
this.gameState = GameState.STARTED;
this.updateSceneInterval = setInterval(this.updateScene, UPDATE_DELAY, game); //Set an interval at which to update the screen
}
initializeScene() { }
updateScene(game) {
//Clear scene:
game.context.clearRect(0, 0, game.canvas.width, game.canvas.height); //Clear the scene
if (game.gameState === GameState.FINISHED) {
this.writeText("Game Over", "green", 0, 0);
}
else {
//Draw the grid:
game.drawGrid();
game.rover.moveForward();
//Draw starting/finish positions:
game.context.fillStyle = "lightgreen";
game.context.fillRect(game.getXCoordinateFromPosition(game.startPosition.x), game.getYCoordinateFromPosition(game.startPosition.y), game.cellSizeWidth, game.cellSizeHeight);
game.context.fillStyle = "red";
game.context.fillRect(game.getXCoordinateFromPosition(game.finishPosition.x), game.getYCoordinateFromPosition(game.finishPosition.y), game.cellSizeWidth, game.cellSizeHeight);
//Draw the robot:
game.drawRover();
}
}
makeMove(move) {
// console.log(move);
this.rover.doMove(move);
}
/*------------------------ UTIL FUNCTIONS --------------------*/
resize() {
const width = window.innerWidth;
const height = window.innerHeight;
const scaledSize = Math.min(height, width) - 20;
this.currentScale = DEFAULT_SIZE / scaledSize;
this.canvas.width = scaledSize * 1.5;
this.canvas.height = scaledSize;
this.cellSizeWidth = scaledSize / this.width * 1.5;
this.cellSizeHeight = scaledSize / this.height;
this.roverImage.width = this.cellSizeWidth; //TODO NOT SURE IF WORKING
this.roverImage.height = this.cellSizeHeight; //TODO NOT SURE IF WORKING
}
getXCoordinateFromPosition(position) {
return position * this.cellSizeWidth;
}
getYCoordinateFromPosition(position) {
return position * this.cellSizeHeight;
}
drawGrid() {
for (let x = 0; x < this.width * this.cellSizeWidth; x += this.cellSizeWidth) {
this.context.moveTo(x, 0);
this.context.lineTo(x, this.canvas.height);
}
for (let y = 0; y < this.height * this.cellSizeHeight; y += this.cellSizeHeight) {
this.context.moveTo(0, y);
this.context.lineTo(this.canvas.width, y);
}
this.context.strokeStyle = 'white';
this.context.stroke();
}
drawRover() {
let xCoord = 0;
let yCoord = 0;
if (this.startPosition.x > 0) {
xCoord = this.getXCoordinateFromPosition(this.rover.position.x);
}
if (this.startPosition.y > 0) {
yCoord = this.getYCoordinateFromPosition(this.rover.position.y);
}
this.drawRotatedRover(this.roverImage, xCoord, yCoord, this.rover.direction);
}
//Kept as generic:
drawRotatedImage(image, x, y, angle) {
this.context.save();
this.context.translate(x, y);
this.context.rotate(angle * (Math.PI / 180));
let xOffset = 0;
let yOffset = 0;
switch (angle) {
case 90:
yOffset = -this.cellSizeHeight;
break;
case 180:
yOffset = -this.cellSizeHeight;
xOffset = -this.cellSizeWidth;
break;
case 270:
xOffset = -this.cellSizeWidth;
break;
case 360:
case 0:
break;
}
this.context.drawImage(this.roverImage, xOffset, yOffset, this.cellSizeWidth, this.cellSizeHeight);
this.context.restore();
}
drawRotatedRover(image, x, y, direction) {
switch (direction) {
case Direction.NORTH:
this.drawRotatedImage(image, x, y, 0);
break;
case Direction.EAST:
this.drawRotatedImage(image, x, y, 90);
break;
case Direction.SOUTH:
this.drawRotatedImage(image, x, y, 180);
break;
case Direction.WEST:
this.drawRotatedImage(image, x, y, 270);
break;
}
}
writeText(text, color, size, x, y) {
const previousStyle = this.context.fillStyle;
this.context.font = size + "px Arial";
this.context.fillStyle = color;
this.context.fillText(text, x, y);
this.context.fillStyle = previousStyle;
}
selectRandomStartPosition() {
let xOrY0 = Math.random();
if (xOrY0 > 0.5) {
let x = 0;
let maxIt = Math.random();
if (maxIt > 0.5) {
x = this.width - 1;
}
let y = Math.floor(Math.random() * this.height);
return new Position2D(x, y);
}
else {
let x = Math.floor(Math.random() * this.width);
let y = 0;
let maxIt = Math.random();
if (maxIt > 0.5) {
y = this.height - 1;
}
return new Position2D(x, y);
}
}
getFinishPosition(startPosition) {
return new Position2D(this.width - startPosition.x - 1, this.height - startPosition.y - 1);
}
}
function importImage(filepath) {
let image = new Image();
image.src = filepath;
return image;
}
|
import axios from 'axios'
export function request(config) {
//创建实例
const instance = axios.create({
baseURL: 'http://123.207.32.32:8000/api/w1',
// baseURL: 'http://106.54.54.237:8000/api/w1',
timeout: 5000,
//POST请求
headers: { 'Content-Type': 'application/x-www-form-urllencoded;' }
})
//拦截器
instance.interceptors.request.use(config => {
// console.log(config + "+++++")
return config
}, err => {
// console.log(err + "+++++")
}
);
//响应拦截
instance.interceptors.response.use(res => { //resulate==res
// console.log(res)
return res.data
}, err => {
// console.log(err)
});
//发送网络请求
return instance(config)
//返回promise
}
|
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[73,4],{JjdP:function(e,n,t){"use strict";t.r(n);var r=t("9og8"),o=t("WmNS"),a=t.n(o),s=t("LtsZ"),i="import React from 'react';\nimport { Button, Col, Form, Input, Row, Table, Select } from 'antd';\nimport { WrappedFormUtils } from 'antd/lib/form/Form';\nimport { useAntdTable } from 'ahooks';\nimport { PaginatedParams } from 'ahooks/lib/useAntdTable';\n\nconst { Option } = Select;\n\ninterface Item {\n name: {\n last: string;\n };\n email: string;\n phone: string;\n gender: 'male' | 'female';\n}\n\ninterface Result {\n total: number;\n list: Item[];\n}\n\ninterface AppListProps {\n form: WrappedFormUtils;\n}\n\nconst getTableData = (\n { current, pageSize }: PaginatedParams[0],\n formData: Object,\n): Promise<Result> => {\n let query = `page=${current}&size=${pageSize}`;\n Object.entries(formData).forEach(([key, value]) => {\n if (value) {\n query += `&${key}=${value}`;\n }\n });\n\n return fetch(`https://randomuser.me/api?results=55&${query}`)\n .then((res) => res.json())\n .then((res) => ({\n total: res.info.results,\n list: res.results,\n }));\n};\n\nconst AppList = (props: AppListProps) => {\n const { getFieldDecorator } = props.form;\n const { tableProps, search, loading } = useAntdTable(getTableData, {\n defaultPageSize: 5,\n form: props.form,\n });\n\n console.log('loading', loading);\n\n const { type, changeType, submit, reset } = search;\n\n const columns = [\n {\n title: 'name',\n dataIndex: 'name.last',\n },\n {\n title: 'email',\n dataIndex: 'email',\n },\n {\n title: 'phone',\n dataIndex: 'phone',\n },\n {\n title: 'gender',\n dataIndex: 'gender',\n },\n ];\n\n const advanceSearchForm = (\n <div>\n <Form>\n <Row gutter={24}>\n <Col span={8}>\n <Form.Item label=\"name\">\n {getFieldDecorator('name')(<Input placeholder=\"name\" />)}\n </Form.Item>\n </Col>\n <Col span={8}>\n <Form.Item label=\"email\">\n {getFieldDecorator('email')(<Input placeholder=\"email\" />)}\n </Form.Item>\n </Col>\n <Col span={8}>\n <Form.Item label=\"phone\">\n {getFieldDecorator('phone')(<Input placeholder=\"phone\" />)}\n </Form.Item>\n </Col>\n </Row>\n <Row>\n <Form.Item style={{ display: 'flex', justifyContent: 'flex-end' }}>\n <Button type=\"primary\" onClick={submit}>\n Search\n </Button>\n <Button onClick={reset} style={{ marginLeft: 16 }}>\n Reset\n </Button>\n <Button type=\"link\" onClick={changeType}>\n Simple Search\n </Button>\n </Form.Item>\n </Row>\n </Form>\n </div>\n );\n\n const searchForm = (\n <div style={{ marginBottom: 16 }}>\n <Form style={{ display: 'flex', justifyContent: 'flex-end' }}>\n {getFieldDecorator('gender', {\n initialValue: 'male',\n })(\n <Select style={{ width: 120, marginRight: 16 }} onChange={submit}>\n <Option value=\"\">all</Option>\n <Option value=\"male\">male</Option>\n <Option value=\"female\">female</Option>\n </Select>,\n )}\n {getFieldDecorator('name')(\n <Input.Search placeholder=\"enter name\" style={{ width: 240 }} onSearch={submit} />,\n )}\n <Button type=\"link\" onClick={changeType}>\n Advanced Search\n </Button>\n </Form>\n </div>\n );\n\n return (\n <div>\n {type === 'simple' ? searchForm : advanceSearchForm}\n <Table columns={columns} rowKey=\"email\" {...tableProps} />\n </div>\n );\n};\n\nexport default Form.create()(AppList);",u="import { Button, Form, Input, Table } from 'antd';\nimport React, { useState } from 'react';\nimport { WrappedFormUtils } from 'antd/lib/form/Form';\nimport { useAntdTable } from 'ahooks';\nimport { PaginatedParams } from 'ahooks/lib/useAntdTable';\n\ninterface Item {\n name: {\n last: string;\n };\n email: string;\n phone: string;\n gender: 'male' | 'female';\n}\n\ninterface Result {\n total: number;\n list: Item[];\n}\n\ninterface AppListProps {\n form: WrappedFormUtils;\n}\n\nconst getTableData = (\n { current, pageSize, filters, sorter }: PaginatedParams[0],\n formData: Object,\n): Promise<Result> => {\n let query = `page=${current}&size=${pageSize}`;\n Object.entries(formData).forEach(([key, value]) => {\n if (value) {\n query += `&${key}=${value}`;\n }\n });\n if (sorter) {\n query += `&sorterFiled=${sorter.field}&sorterOrder=${sorter.order}`;\n }\n if (filters) {\n query += `&gender=${filters.gender}`;\n }\n\n return fetch(`https://randomuser.me/api?results=55&${query}`)\n .then((res) => res.json())\n .then((res) => ({\n total: res.info.results,\n list: res.results,\n }));\n};\n\nconst AppList = (props: AppListProps) => {\n const { getFieldDecorator } = props.form;\n const { tableProps, params, search } = useAntdTable(getTableData, {\n defaultPageSize: 5,\n form: props.form,\n cacheKey: 'tableProps',\n });\n const { sorter = {}, filters = {} } = params[0] || ({} as any);\n const { type, changeType, submit, reset } = search || {};\n\n const columns = [\n {\n title: 'name',\n dataIndex: 'name.last',\n },\n {\n title: 'email',\n dataIndex: 'email',\n },\n {\n title: 'phone',\n dataIndex: 'phone',\n sorter: true,\n sortOrder: sorter.field === 'phone' && sorter.order,\n },\n {\n title: 'gender',\n dataIndex: 'gender',\n filters: [\n { text: 'male', value: 'male' },\n { text: 'female', value: 'female' },\n ],\n filteredValue: filters.gender,\n },\n ];\n\n const searchFrom = (\n <div style={{ marginBottom: 16 }}>\n <Form style={{ display: 'flex', justifyContent: 'flex-end' }}>\n {getFieldDecorator('name')(\n <Input placeholder=\"enter name\" style={{ width: 140, marginRight: 16 }} />,\n )}\n\n {type === 'advance' && (\n <>\n {getFieldDecorator('email', { initialValue: '2' })(\n <Input placeholder=\"enter email\" style={{ width: 140, marginRight: 16 }} />,\n )}\n {getFieldDecorator('phone')(\n <Input placeholder=\"enter phone\" style={{ width: 140, marginRight: 16 }} />,\n )}\n </>\n )}\n <Button type=\"primary\" onClick={submit}>\n Search\n </Button>\n <Button onClick={reset} style={{ marginLeft: 8 }}>\n Reset\n </Button>\n <Button type=\"link\" onClick={changeType}>\n {type === 'simple' ? 'Expand' : 'Close'}\n </Button>\n </Form>\n </div>\n );\n\n return (\n <div>\n {searchFrom}\n <Table columns={columns} rowKey=\"email\" {...tableProps} />\n </div>\n );\n};\n\nconst AppListTable = Form.create()(AppList);\n\nconst Demo = () => {\n const [show, setShow] = useState(true);\n\n return (\n <div>\n <Button\n type=\"danger\"\n onClick={() => {\n setShow(!show);\n }}\n style={{ marginBottom: 16 }}\n >\n {show ? 'Click to destroy' : 'Click recovery'}\n </Button>\n {show && <AppListTable />}\n </div>\n );\n};\n\nexport default Demo;",c="import React from 'react';\nimport { Button, Col, Form, Input, Row, Table, Select } from 'antd';\nimport { WrappedFormUtils } from 'antd/lib/form/Form';\nimport { useAntdTable } from 'ahooks';\nimport { PaginatedParams } from 'ahooks/lib/useAntdTable';\n\nconst { Option } = Select;\n\ninterface Item {\n name: {\n last: string;\n };\n email: string;\n phone: string;\n gender: 'male' | 'female';\n}\n\ninterface Result {\n total: number;\n list: Item[];\n}\n\ninterface AppListProps {\n form: WrappedFormUtils;\n}\n\nconst getTableData = (\n { current, pageSize }: PaginatedParams[0],\n formData: Object,\n): Promise<Result> => {\n let query = `page=${current}&size=${pageSize}`;\n Object.entries(formData).forEach(([key, value]) => {\n if (value) {\n query += `&${key}=${value}`;\n }\n });\n\n return fetch(`https://randomuser.me/api?results=55&${query}`)\n .then((res) => res.json())\n .then((res) => ({\n total: res.info.results,\n list: res.results,\n }));\n};\n\nconst AppList = (props: AppListProps) => {\n const { getFieldDecorator } = props.form;\n const { tableProps, search } = useAntdTable(getTableData, {\n form: props.form,\n defaultParams: [\n { current: 2, pageSize: 5 },\n { name: 'hello', email: 'abc@gmail.com', gender: 'female' },\n ],\n defaultType: 'advance',\n });\n\n const { type, changeType, submit, reset } = search;\n\n const columns = [\n {\n title: 'name',\n dataIndex: 'name.last',\n },\n {\n title: 'email',\n dataIndex: 'email',\n },\n {\n title: 'phone',\n dataIndex: 'phone',\n },\n {\n title: 'gender',\n dataIndex: 'gender',\n },\n ];\n\n const advanceSearchForm = (\n <div>\n <Form>\n <Row gutter={24}>\n <Col span={8}>\n <Form.Item label=\"name\">\n {getFieldDecorator('name')(<Input placeholder=\"name\" />)}\n </Form.Item>\n </Col>\n <Col span={8}>\n <Form.Item label=\"email\">\n {getFieldDecorator('email')(<Input placeholder=\"email\" />)}\n </Form.Item>\n </Col>\n <Col span={8}>\n <Form.Item label=\"phone\">\n {getFieldDecorator('phone')(<Input placeholder=\"phone\" />)}\n </Form.Item>\n </Col>\n </Row>\n <Row>\n <Form.Item style={{ display: 'flex', justifyContent: 'flex-end' }}>\n <Button type=\"primary\" onClick={submit}>\n Search\n </Button>\n <Button onClick={reset} style={{ marginLeft: 16 }}>\n Reset\n </Button>\n <Button type=\"link\" onClick={changeType}>\n Simple Search\n </Button>\n </Form.Item>\n </Row>\n </Form>\n </div>\n );\n\n const searchFrom = (\n <div style={{ marginBottom: 16 }}>\n <Form style={{ display: 'flex', justifyContent: 'flex-end' }}>\n {getFieldDecorator('gender', {\n initialValue: 'male',\n })(\n <Select style={{ width: 120, marginRight: 16 }} onChange={submit}>\n <Option value=\"\">all</Option>\n <Option value=\"male\">male</Option>\n <Option value=\"female\">female</Option>\n </Select>,\n )}\n {getFieldDecorator('name')(\n <Input.Search placeholder=\"enter name\" style={{ width: 240 }} onSearch={submit} />,\n )}\n <Button type=\"link\" onClick={changeType}>\n Advanced Search\n </Button>\n </Form>\n </div>\n );\n\n return (\n <div>\n {type === 'simple' ? searchFrom : advanceSearchForm}\n <Table columns={columns} rowKey=\"email\" {...tableProps} />\n </div>\n );\n};\n\nexport default Form.create()(AppList);",l="import React from 'react';\nimport { Form, Input, Table, Select } from 'antd';\nimport { WrappedFormUtils } from 'antd/lib/form/Form';\nimport { useAntdTable } from 'ahooks';\nimport { PaginatedParams } from 'ahooks/lib/useAntdTable';\n\nconst { Option } = Select;\n\ninterface Item {\n name: {\n last: string;\n };\n email: string;\n phone: string;\n gender: 'male' | 'female';\n}\n\ninterface Result {\n total: number;\n list: Item[];\n}\n\ninterface AppListProps {\n form: WrappedFormUtils;\n}\n\nconst getTableData = (\n { current, pageSize }: PaginatedParams[0],\n formData: Object,\n): Promise<Result> => {\n let query = `page=${current}&size=${pageSize}`;\n Object.entries(formData).forEach(([key, value]) => {\n if (value) {\n query += `&${key}=${value}`;\n }\n });\n\n return fetch(`https://randomuser.me/api?results=55&${query}`)\n .then((res) => res.json())\n .then((res) => ({\n total: res.info.results,\n list: res.results,\n }));\n};\n\nconst AppList = (props: AppListProps) => {\n const { getFieldDecorator } = props.form;\n const { tableProps, search } = useAntdTable(getTableData, {\n defaultPageSize: 5,\n form: props.form,\n });\n\n const { submit } = search;\n\n const columns = [\n {\n title: 'name',\n dataIndex: 'name.last',\n },\n {\n title: 'email',\n dataIndex: 'email',\n },\n {\n title: 'phone',\n dataIndex: 'phone',\n },\n {\n title: 'gender',\n dataIndex: 'gender',\n },\n ];\n\n const searchForm = (\n <div style={{ marginBottom: 16 }}>\n <Form style={{ display: 'flex', justifyContent: 'flex-end' }}>\n <Form.Item label=\"Gender\">\n {getFieldDecorator('gender', {\n initialValue: 'male',\n })(\n <Select style={{ width: 120, marginRight: 16 }} onChange={submit}>\n <Option value=\"\">all</Option>\n <Option value=\"male\">male</Option>\n <Option value=\"female\">female</Option>\n </Select>,\n )}\n </Form.Item>\n <Form.Item label=\"Name\">\n {getFieldDecorator('name', {\n initialValue: 'Lemmers',\n rules: [{ required: true, message: 'name is required' }],\n })(<Input.Search placeholder=\"enter name\" style={{ width: 240 }} onSearch={submit} />)}\n </Form.Item>\n </Form>\n </div>\n );\n\n return (\n <div>\n {searchForm}\n <Table columns={columns} rowKey=\"email\" {...tableProps} />\n </div>\n );\n};\n\nexport default Form.create()(AppList);",d="import React from 'react';\nimport { useBoolean } from 'ahooks';\n\nexport default () => {\n const [state, { toggle, setTrue, setFalse }] = useBoolean(true);\n\n return (\n <div>\n <p>Effects\uff1a{JSON.stringify(state)}</p>\n <p>\n <button type=\"button\" onClick={() => toggle()}>\n Toggle\n </button>\n <button type=\"button\" onClick={setFalse} style={{ margin: '0 16px' }}>\n Set false\n </button>\n <button type=\"button\" onClick={setTrue}>\n Set true\n </button>\n </p>\n </div>\n );\n};",p="import React, { useState, useRef } from 'react';\nimport { useClickAway } from 'ahooks';\n\nexport default () => {\n const [counter, setCounter] = useState(0);\n const ref = useRef<HTMLSpanElement>();\n useClickAway(() => {\n setCounter((s) => s + 1);\n }, ref);\n\n return (\n <div>\n <span ref={ref}>\n <button type=\"button\">box1</button>\n </span>\n <p>counter: {counter}</p>\n </div>\n );\n};",m="import React, { useState } from 'react';\nimport { useClickAway } from 'ahooks';\n\nexport default () => {\n const [counter, setCounter] = useState(0);\n\n useClickAway(\n () => {\n setCounter((s) => s + 1);\n },\n () => document.getElementById('box2'),\n );\n\n return (\n <div>\n <button type=\"button\" id=\"box2\">\n box2\n </button>\n <p>counter: {counter}</p>\n </div>\n );\n};",f="import React, { useState, useRef } from 'react';\nimport { useClickAway } from 'ahooks';\n\nexport default () => {\n const [counter, setCounter] = useState(0);\n const ref1 = useRef();\n const ref2 = useRef();\n useClickAway(() => {\n setCounter((s) => s + 1);\n }, [ref1, ref2]);\n\n return (\n <div>\n <button type=\"button\" ref={ref1}>\n box1\n </button>\n <button type=\"button\" ref={ref2} style={{ marginLeft: 16 }}>\n box2\n </button>\n <p>counter: {counter}</p>\n </div>\n );\n};",v="import React, { useState, useRef } from 'react';\nimport { useClickAway } from 'ahooks';\n\nexport default () => {\n const [counter, setCounter] = useState(0);\n const ref = useRef<HTMLSpanElement>();\n useClickAway(\n () => {\n setCounter((s) => s + 1);\n },\n ref,\n 'contextmenu',\n );\n\n return (\n <div>\n <span ref={ref}>\n <button type=\"button\">box1</button>\n </span>\n <p>counter: {counter}</p>\n </div>\n );\n};",h="import React from 'react';\nimport { useControllableValue } from 'ahooks';\n\nexport default (props: any) => {\n const [state, setState] = useControllableValue<string>(props, {\n defaultValue: '',\n });\n\n return (\n <>\n <input\n value={state}\n onChange={e => setState(e.target.value)}\n style={{ width: 300 }}\n />\n <button type=\"button\" onClick={() => setState('')} style={{ margin: '0 4px'}}>\n Clear\n </button>\n </>\n );\n};",b="import React, { useState } from 'react';\nimport { useControllableValue } from 'ahooks';\n\nconst ControllableComponent = (props: any) => {\n const [state, setState] = useControllableValue<string>(props);\n\n return <input value={state} onChange={e => setState(e.target.value)} style={{ width: 300 }} />;\n};\n\nconst Parent = () => {\n const [state, setState] = useState<string>('');\n const clear = () => {\n setState('');\n };\n\n return (\n <>\n <ControllableComponent value={state} onChange={setState} />\n <button type=\"button\" onClick={clear} style={{ margin: '0 4px' }}>\n Clear\n </button>\n </>\n );\n};\nexport default Parent;",g="import React, { useState } from 'react';\nimport { useControllableValue } from 'ahooks';\n\nconst ControllableComponent = (props: any) => {\n const [state, setState] = useControllableValue<string>(props);\n\n return (\n <input\n value={state}\n onChange={(e) => {\n setState(e.target.value);\n }}\n style={{ width: 300 }}\n />\n );\n};\nconst Parent = () => {\n const [state, setState] = useState<number>(0);\n\n return (\n <>\n <div style={{ marginBottom: 8 }}>state:{state}</div>\n <ControllableComponent onChange={setState} />\n </>\n );\n};\nexport default Parent;",y="import * as React from 'react';\nimport { useCookieState } from 'ahooks';\n\nexport default () => {\n const [message, setMessage] = useCookieState('useCookieStateString');\n return (\n <input\n value={message}\n placeholder=\"Please enter some words...\"\n onChange={(e) => setMessage(e.target.value)}\n style={{ width: 300 }}\n />\n );\n};",w="import * as React from 'react';\nimport { useCookieState } from 'ahooks';\n\nexport default function App() {\n const [value, setValue] = useCookieState('useCookieStateUpdater', {\n defaultValue: '0',\n });\n\n return (\n <>\n <p>{value}</p>\n <button\n type=\"button\"\n style={{ marginRight: '16px' }}\n onClick={() => setValue((v) => String(Number(v) + 1))}\n >\n inc +\n </button>\n <button\n type=\"button\"\n style={{ marginRight: '16px' }}\n onClick={() => setValue((v) => String(Number(v) - 1))}\n >\n dec -\n </button>\n <button type=\"button\" onClick={() => setValue('0')}>\n reset\n </button>\n </>\n );\n}",k="import * as React from 'react';\nimport { useCookieState } from 'ahooks';\n\nexport default function App() {\n const [value, setValue] = useCookieState('useCookieStateOptions', {\n defaultValue: '0',\n path: '/',\n expires: (() => new Date(+new Date() + 10000))(),\n });\n\n return (\n <>\n <p>{value}</p>\n <button\n type=\"button\"\n style={{ marginRight: '16px' }}\n onClick={() =>\n setValue((v) => String(Number(v) + 1), {\n expires: (() => new Date(+new Date() + 10000))(),\n })\n }\n >\n inc + (10s expires)\n </button>\n <button\n type=\"button\"\n style={{ marginRight: '16px' }}\n onClick={() =>\n setValue((v) => String(Number(v) - 1), {\n expires: (() => new Date(+new Date() + 10000))(),\n })\n }\n >\n dec - (10s expires)\n </button>\n <button type=\"button\" onClick={() => setValue('0')}>\n reset\n </button>\n </>\n );\n}",x="import React from 'react';\nimport { useCountDown } from 'ahooks';\n\nexport default () => {\n const [countdown, setTargetDate, formattedRes] = useCountDown({\n targetDate: '2021-12-31 24:00:00',\n });\n const { days, hours, minutes, seconds, milliseconds } = formattedRes;\n\n return (\n <>\n <p>\n There are {days} days {hours} hours {minutes} minutes {seconds} seconds {milliseconds}{' '}\n milliseconds until 2021-12-31 24:00:00\n </p>\n </>\n );\n};",C="import React from 'react';\nimport { useCountDown } from 'ahooks';\n\nexport default () => {\n const onEnd = () => {\n alert('End of the time');\n console.log('onEnd of the time');\n };\n const [countdown, setTargetDate] = useCountDown({ onEnd: onEnd });\n\n return (\n <>\n <button\n onClick={() => {\n setTargetDate(Date.now() + 5000);\n }}\n disabled={countdown !== 0}\n >\n {countdown === 0 ? 'Start Interval' : `Reset After ${Math.round(countdown / 1000)}s`}\n </button>\n <button\n onClick={() => {\n setTargetDate(undefined);\n }}\n style={{ marginLeft: 8 }}\n >\n stop\n </button>\n </>\n );\n};",S='import React from \'react\';\nimport { useCounter } from \'ahooks\';\n\nexport default () => {\n const [current, { inc, dec, set, reset }] = useCounter(100, { min: 1, max: 10 });\n\n return (\n <div>\n <p>{current} [max: 10; min: 1;]</p>\n <div>\n <button\n type="button"\n onClick={() => {\n inc();\n }}\n style={{ marginRight: 8 }}\n >\n inc()\n </button>\n <button\n type="button"\n onClick={() => {\n dec();\n }}\n style={{ marginRight: 8 }}\n >\n dec()\n </button>\n <button\n type="button"\n onClick={() => {\n set(3);\n }}\n style={{ marginRight: 8 }}\n >\n set(3)\n </button>\n <button\n type="button"\n onClick={() => {\n reset();\n }}\n style={{ marginRight: 8 }}\n >\n reset()\n </button>\n </div>\n </div>\n );\n};',P="import React, { useState } from 'react';\nimport { useCreation } from 'ahooks';\n\nclass Foo {\n constructor() {\n this.data = Math.random();\n }\n\n data: number;\n}\n\nexport default function () {\n const foo = useCreation(() => new Foo(), []);\n const [, setFlag] = useState({});\n return (\n <>\n <p>{foo.data}</p>\n <button\n type=\"button\"\n onClick={() => {\n setFlag({});\n }}\n >\n Rerender\n </button>\n </>\n );\n}",R="import React, { useState } from 'react';\nimport { useDebounce } from 'ahooks';\n\nexport default () => {\n const [value, setValue] = useState<string>();\n const debouncedValue = useDebounce(value, { wait: 500 });\n\n return (\n <div>\n <input\n value={value}\n onChange={(e) => setValue(e.target.value)}\n placeholder=\"Typed value\"\n style={{ width: 280 }}\n />\n <p style={{ marginTop: 16 }}>DebouncedValue: {debouncedValue}</p>\n </div>\n );\n};",O="import React, { useState } from 'react';\nimport useDebounceEffect from '../';\n\nexport default () => {\n const [value, setValue] = useState('hello');\n const [records, setRecords] = useState<string[]>([]);\n useDebounceEffect(\n () => {\n setRecords((val) => [...val, value]);\n },\n [value],\n {\n wait: 1000,\n },\n );\n return (\n <div>\n <input\n value={value}\n onChange={(e) => setValue(e.target.value)}\n placeholder=\"Typed value\"\n style={{ width: 280 }}\n />\n <p style={{ marginTop: 16 }}>\n <ul>\n {records.map((record, index) => (\n <li key={index}>{record}</li>\n ))}\n </ul>\n </p>\n </div>\n );\n};",j="import { useEffect, EffectCallback, DependencyList, useState } from 'react';\nimport { DebounceOptions } from '../useDebounce/debounceOptions';\nimport useDebounceFn from '../useDebounceFn';\nimport useUpdateEffect from '../useUpdateEffect';\nimport useUnmount from '../useUnmount';\n\nfunction useDebounceEffect(\n effect: EffectCallback,\n deps?: DependencyList,\n options?: DebounceOptions,\n) {\n const [flag, setFlag] = useState({});\n\n const { run, cancel } = useDebounceFn(() => {\n setFlag({});\n }, options);\n\n useEffect(() => {\n return run();\n }, deps);\n\n useUnmount(cancel);\n\n useUpdateEffect(effect, [flag]);\n}\n\nexport default useDebounceEffect;",I="import debounce from 'lodash.debounce';\nimport { useRef } from 'react';\nimport useCreation from '../useCreation';\nimport { DebounceOptions } from '../useDebounce/debounceOptions';\nimport useUnmount from '../useUnmount';\n\ntype Fn = (...args: any) => any;\n\nfunction useDebounceFn<T extends Fn>(fn: T, options?: DebounceOptions) {\n const fnRef = useRef<T>(fn);\n fnRef.current = fn;\n\n const wait = options?.wait ?? 1000;\n\n const debounced = useCreation(\n () =>\n debounce<T>(\n ((...args: any[]) => {\n return fnRef.current(...args);\n }) as T,\n wait,\n options,\n ),\n [],\n );\n\n useUnmount(() => {\n debounced.cancel();\n });\n\n return {\n run: (debounced as unknown) as T,\n cancel: debounced.cancel,\n flush: debounced.flush,\n };\n}\n\nexport default useDebounceFn;",T="import { useRef } from 'react';\n\nexport default function useCreation<T>(factory: () => T, deps: any[]) {\n const { current } = useRef({\n deps,\n obj: undefined as undefined | T,\n initialized: false,\n });\n if (current.initialized === false || !depsAreSame(current.deps, deps)) {\n current.deps = deps;\n current.obj = factory();\n current.initialized = true;\n }\n return current.obj as T;\n}\n\nfunction depsAreSame(oldDeps: any[], deps: any[]): boolean {\n if (oldDeps === deps) return true;\n for (let i = 0; i < oldDeps.length; i++) {\n if (oldDeps[i] !== deps[i]) return false;\n }\n return true;\n}",z="import { useEffect } from 'react';\nimport usePersistFn from '../usePersistFn';\nimport { isFunction } from '../utils';\n\nconst useUnmount = (fn: any) => {\n const fnPersist = usePersistFn(fn);\n\n useEffect(\n () => () => {\n if (isFunction(fnPersist)) {\n fnPersist();\n }\n },\n [],\n );\n};\n\nexport default useUnmount;",F="import { useRef } from 'react';\n\nexport type noop = (...args: any[]) => any;\n\nfunction usePersistFn<T extends noop>(fn: T) {\n const fnRef = useRef<T>(fn);\n fnRef.current = fn;\n\n const persistFn = useRef<T>();\n if (!persistFn.current) {\n persistFn.current = function (...args) {\n return fnRef.current!.apply(this, args);\n } as T;\n }\n\n return persistFn.current!;\n}\n\nexport default usePersistFn;",N="export function isFunction(obj: any): obj is Function {\n return typeof obj === 'function';\n}",D="import { useEffect, useRef } from 'react';\n\nconst useUpdateEffect: typeof useEffect = (effect, deps) => {\n const isMounted = useRef(false);\n\n useEffect(() => {\n if (!isMounted.current) {\n isMounted.current = true;\n } else {\n return effect();\n }\n }, deps);\n};\n\nexport default useUpdateEffect;",E="import React, { useState } from 'react';\nimport { useDebounceFn } from 'ahooks';\n\nexport default () => {\n const [value, setValue] = useState(0);\n const { run } = useDebounceFn(\n () => {\n setValue(value + 1);\n },\n {\n wait: 500,\n },\n );\n\n return (\n <div>\n <p style={{ marginTop: 16 }}> Clicked count: {value} </p>\n <button type=\"button\" onClick={run}>\n Click fast!\n </button>\n </div>\n );\n};",q="import React, { useEffect } from 'react';\nimport { useDocumentVisibility } from 'ahooks';\n\nexport default () => {\n const documentVisibility = useDocumentVisibility();\n\n useEffect(() => {\n if (documentVisibility === 'visible') {\n console.log(`Current document visibility state: ${documentVisibility}`);\n } else {\n console.log(`Current document visibility state: ${documentVisibility}`);\n }\n }, [documentVisibility]);\n\n return <div>Current document visibility state: {documentVisibility}</div>;\n};",A="import React, { useState } from 'react';\nimport { useDrop, useDrag } from 'ahooks';\n\nexport default () => {\n const [dragging, setDragging] = useState<string | null>(null);\n const getDragProps = useDrag({\n onDragStart: (data) => {\n setDragging(data);\n },\n onDragEnd: () => {\n setDragging(null);\n },\n });\n const [props, { isHovering }] = useDrop({\n onText: (text, e) => {\n console.log(e);\n alert(`'text: ${text}' dropped`);\n },\n onFiles: (files, e) => {\n console.log(e, files);\n alert(`${files.length} file dropped`);\n },\n onUri: (uri, e) => {\n console.log(e);\n alert(`uri: ${uri} dropped`);\n },\n onDom: (content: string, e) => {\n alert(`custom: ${content} dropped`);\n },\n });\n\n return (\n <div>\n <div style={{ border: '1px dashed #e8e8e8', padding: 16, textAlign: 'center' }} {...props}>\n {isHovering ? 'release here' : 'drop here'}\n </div>\n\n <div style={{ display: 'flex', marginTop: 8 }}>\n {Array.from(Array(5)).map((e, i) => (\n <div\n {...getDragProps(`box${i}`)}\n style={{\n border: '1px solid #e8e8e8',\n padding: 16,\n width: 80,\n textAlign: 'center',\n marginRight: 16,\n }}\n >\n box{i}\n </div>\n ))}\n </div>\n <div style={{ marginTop: 8 }}>{dragging ? <>dragging {dragging}</> : 'not dragging'}</div>\n </div>\n );\n};",L="import React, { useState } from 'react';\nimport { Form, Button, Input, Icon } from 'antd';\nimport { FormComponentProps } from 'antd/lib/form';\nimport { useDynamicList } from 'ahooks';\n\nexport default Form.create()((props: FormComponentProps) => {\n const { list, remove, getKey, push } = useDynamicList(['David', 'Jack']);\n const { getFieldDecorator, validateFields } = props.form;\n\n const [result, setResult] = useState('');\n\n const Row = (index: number, item: any) => (\n <Form.Item key={getKey(index)}>\n {getFieldDecorator(`names[${getKey(index)}]`, {\n initialValue: item,\n rules: [\n {\n required: true,\n message: 'required',\n },\n ],\n })(<Input style={{ width: 300 }} placeholder=\"Please enter your name\" />)}\n {list.length > 1 && (\n <Icon\n type=\"minus-circle-o\"\n style={{ marginLeft: 8 }}\n onClick={() => {\n remove(index);\n }}\n />\n )}\n <Icon\n type=\"plus-circle-o\"\n style={{ marginLeft: 8 }}\n onClick={() => {\n push('');\n }}\n />\n </Form.Item>\n );\n\n return (\n <>\n <Form>{list.map((ele, index) => Row(index, ele))}</Form>\n <Button\n style={{ marginTop: 8 }}\n type=\"primary\"\n onClick={() =>\n validateFields((err, val) => {\n if (!err) {\n setResult(JSON.stringify((val || {}).names.filter((e: string) => !!e)));\n }\n })\n }\n >\n Submit\n </Button>\n <div>{result}</div>\n </>\n );\n});",M="import React, { useState } from 'react';\nimport { Form, Input, Button } from 'antd';\nimport { FormComponentProps } from 'antd/lib/form';\nimport { useDynamicList } from 'ahooks';\n\ninterface CardProps extends FormComponentProps {\n index: number;\n list: any[];\n name: string;\n}\n\nconst Card = (props: CardProps) => {\n const { list, getKey, push } = useDynamicList(props.list || [1]);\n\n return (\n <div style={{ border: '1px solid #e8e8e8', padding: 16, marginBottom: 16 }}>\n <Form.Item label=\"Group Name\">\n {props.form.getFieldDecorator(`params[${props.index}].groupName`, {\n initialValue: props.name,\n })(<Input placeholder=\"Please enter group name\" />)}\n </Form.Item>\n\n <Form.Item label=\"frequency\">\n {list.map((ele, index) => (\n <div style={{ marginBottom: 16 }} key={getKey(index)}>\n {props.form.getFieldDecorator(`params[${props.index}].ad[${getKey(index)}].name`, {\n initialValue: ele.name,\n })(<Input placeholder=\"Please enter the advertisement name\" addonBefore=\"name\uff1a\" />)}\n {props.form.getFieldDecorator(`params[${props.index}].ad[${getKey(index)}].frequency`, {\n initialValue: ele.value,\n })(<Input placeholder=\"Please entery the frequency\" addonAfter=\"times/day\" />)}\n </div>\n ))}\n </Form.Item>\n <Button block onClick={push}>\n Add advertisement\n </Button>\n </div>\n );\n};\n\ninterface ListItem {\n name: string;\n list: Array<{ name: string; value: number }>;\n}\n\nexport default Form.create()((props: FormComponentProps) => {\n const [result, setResult] = useState('');\n\n const { list, push, getKey, sortForm } = useDynamicList<ListItem>([\n {\n name: 'Group 1',\n list: [\n { name: 'ad1', value: 2 },\n { name: 'ad2', value: 1 },\n ],\n },\n ]);\n\n return (\n <div style={{ width: 800, margin: 'auto', display: 'flex' }}>\n <div style={{ width: 400, marginRight: 16 }}>\n {list.map((ele, index) => (\n <Card\n form={props.form}\n key={getKey(index)}\n list={ele.list}\n name={ele.name}\n index={getKey(index)}\n />\n ))}\n <Button style={{ marginTop: 16 }} block onClick={() => push({} as ListItem)}>\n Add Group\n </Button>\n </div>\n <div>\n <Button\n onClick={() => {\n const res = props.form.getFieldsValue().params;\n const sortedResult = sortForm(res);\n setResult(JSON.stringify(sortedResult, null, 2));\n }}\n >\n Retrieve form data\n </Button>\n <div>\n <pre>{result}</pre>\n </div>\n </div>\n </div>\n );\n});",B="import React, { useState } from 'react';\nimport { Form, Button, Input, Icon, Table } from 'antd';\nimport { FormComponentProps } from 'antd/lib/form';\nimport ReactDragListView from 'react-drag-listview';\nimport { useDynamicList } from 'ahooks';\n\ninterface Item {\n name?: string;\n age?: string;\n memo?: string;\n}\n\nexport default Form.create()((props: FormComponentProps) => {\n const { list, remove, getKey, move, push, sortForm } = useDynamicList<Item>([\n { name: 'my bro', age: '23', memo: \"he's my bro\" },\n { name: 'my sis', age: '21', memo: \"she's my sis\" },\n {},\n ]);\n const { getFieldDecorator, getFieldsValue } = props.form;\n const [result, setResult] = useState('');\n\n const columns = [\n {\n title: 'Name',\n dataIndex: 'name',\n key: 'name',\n render: (text: string, row: Item, index: number) => (\n <>\n <Icon style={{ cursor: 'move', marginRight: 8 }} type=\"drag\" />\n {getFieldDecorator(`params[${getKey(index)}].name`, { initialValue: text })(\n <Input style={{ width: 120, marginRight: 16 }} placeholder=\"name\" />,\n )}\n </>\n ),\n },\n {\n title: 'Age',\n dataIndex: 'age',\n key: 'age',\n render: (text: string, row: Item, index: number) => (\n <>\n {getFieldDecorator(`params[${getKey(index)}].age`, { initialValue: text })(\n <Input style={{ width: 120, marginRight: 16 }} placeholder=\"age\" />,\n )}\n </>\n ),\n },\n {\n key: 'memo',\n title: 'Memo',\n dataIndex: 'memo',\n render: (text: string, row: Item, index: number) => (\n <>\n {getFieldDecorator(`params[${getKey(index)}].memo`, { initialValue: text })(\n <Input style={{ width: 300, marginRight: 16 }} placeholder=\"please input the memo\" />,\n )}\n <Button.Group>\n <Button type=\"danger\" onClick={() => remove(index)}>\n Delete\n </Button>\n </Button.Group>\n </>\n ),\n },\n ];\n\n return (\n <>\n <ReactDragListView\n onDragEnd={(oldIndex: number, newIndex: number) => move(oldIndex, newIndex)}\n handleSelector={'i[aria-label=\"icon: drag\"]'}\n >\n <Table\n columns={columns}\n dataSource={list}\n rowKey={(r: Item, index: number) => getKey(index).toString()}\n pagination={false}\n />\n </ReactDragListView>\n <Button\n style={{ marginTop: 8 }}\n block\n type=\"dashed\"\n onClick={() => push({ name: 'new row', age: '25' })}\n >\n + Add row\n </Button>\n <Button\n type=\"primary\"\n style={{ marginTop: 16 }}\n onClick={() => setResult(JSON.stringify(sortForm(getFieldsValue().params), null, 2))}\n >\n Submit\n </Button>\n <div style={{ whiteSpace: 'pre' }}>{result && `content: ${result}`}</div>\n </>\n );\n});",_="import React, { useRef, FC } from 'react';\nimport { useEventEmitter } from 'ahooks';\nimport { EventEmitter } from 'ahooks/lib/useEventEmitter';\n\nconst MessageBox: FC<{\n focus$: EventEmitter<void>;\n}> = function (props) {\n return (\n <div style={{ paddingBottom: 24 }}>\n <p>You received a message</p>\n <button\n type=\"button\"\n onClick={() => {\n props.focus$.emit();\n }}\n >\n Reply\n </button>\n </div>\n );\n};\n\nconst InputBox: FC<{\n focus$: EventEmitter<void>;\n}> = function (props) {\n const inputRef = useRef<any>();\n props.focus$.useSubscription(() => {\n inputRef.current.focus();\n });\n return (\n <input ref={inputRef} placeholder=\"Enter reply\" style={{ width: '100%', padding: '4px' }} />\n );\n};\n\nexport default function () {\n const focus$ = useEventEmitter();\n return (\n <>\n <MessageBox focus$={focus$} />\n <InputBox focus$={focus$} />\n </>\n );\n}",U="import React, { useState, useRef } from 'react';\nimport { useEventListener } from 'ahooks';\n\nexport default () => {\n const [value, setValue] = useState(0);\n\n const clickHandler = () => {\n setValue(value + 1);\n };\n\n const ref = useRef();\n useEventListener('click', clickHandler, { target: ref });\n\n return (\n <button ref={ref} type=\"button\">\n You click {value} times\n </button>\n );\n};",V="import React, { useState } from 'react';\nimport { useEventListener } from 'ahooks';\n\nexport default () => {\n const [value, setValue] = useState('');\n\n const keyDownHandler = (ev: KeyboardEvent) => {\n setValue(ev.code);\n };\n useEventListener('keydown', keyDownHandler);\n\n return <p>Your press key is {value}</p>;\n};",$="import React, { Fragment } from 'react';\nimport { useEventTarget } from 'ahooks';\n\nexport default () => {\n const [value, { reset, onChange }] = useEventTarget({ initialValue: 'this is initial value' });\n\n return (\n <Fragment>\n <input value={value} onChange={onChange} style={{ width: 200, marginRight: 20 }} />\n <button type=\"button\" onClick={reset}>\n reset\n </button>\n </Fragment>\n );\n};",K="import React, { Fragment } from 'react';\nimport { useEventTarget } from 'ahooks';\n\nexport default () => {\n const [value, { onChange, reset }] = useEventTarget({\n transformer: (val: string) => val.replace(/[^\\d]/g, ''),\n });\n\n return (\n <Fragment>\n <input\n value={value || ''}\n onChange={onChange}\n style={{ width: 200, marginRight: 20 }}\n placeholder=\"\u8bf7\u8f93\u5165\"\n />\n <button type=\"button\" onClick={reset}>\n reset\n </button>\n </Fragment>\n );\n};",H="import React from 'react';\nimport { useExternal } from 'ahooks';\n\nexport default () => {\n const [status, { toggle, load, unload }] = useExternal('/useExternal/test-external-script.js', {\n async: false,\n });\n\n return (\n <>\n <p>\n Status: <b>{status}</b>\n </p>\n <p>\n Response: <i>{status === 'ready' ? TEST_SCRIPT?.start() : '-'}</i>\n </p>\n <button type=\"button\" style={{ marginRight: 8 }} onClick={() => toggle()}>\n toggle\n </button>\n <button type=\"button\" style={{ marginRight: 8 }} onClick={() => { \n unload();\n // Maybe you wanna remove the global variables or functions after run unload()\n TEST_SCRIPT = undefined;\n }}>\n unload\n </button>\n <button type=\"button\" style={{ marginRight: 8 }} onClick={() => load()}>\n load\n </button>\n </>\n );\n};",W='import React from \'react\';\nimport { useExternal } from \'ahooks\';\n\nexport default () => {\n const [status, { toggle, load, unload }] = useExternal(\'/useExternal/bootstrap-badge.css\', {\n media: \'all\',\n });\n\n return (\n <>\n <p>\n Status: <b>{status}</b>\n </p>\n <div className="bd-example">\n <span className="badge badge-pill badge-primary">Primary</span>\n <span className="badge badge-pill badge-secondary">Secondary</span>\n <span className="badge badge-pill badge-success">Success</span>\n <span className="badge badge-pill badge-danger">Danger</span>\n <span className="badge badge-pill badge-warning">Warning</span>\n <span className="badge badge-pill badge-info">Info</span>\n <span className="badge badge-pill badge-light">Light</span>\n <span className="badge badge-pill badge-dark">Dark</span>\n </div>\n <br />\n <button type="button" style={{ marginRight: 8 }} onClick={() => toggle()}>\n toggle\n </button>\n <button type="button" style={{ marginRight: 8 }} onClick={() => unload()}>\n unload\n </button>\n <button type="button" style={{ marginRight: 8 }} onClick={() => load()}>\n load\n </button>\n </>\n );\n};',J="import React from 'react';\nimport { useExternal } from 'ahooks';\n\nexport default () => {\n const ref = React.useRef();\n\n const [status, { toggle, load, unload }] = useExternal('/logo.svg', {\n target: ref,\n // target: document.querySelector('body')\n });\n\n return (\n <>\n <p>\n Status: <b>{status}</b>\n </p>\n <button type=\"button\" style={{ marginRight: 8 }} onClick={() => toggle()}>\n toggle\n </button>\n <button type=\"button\" style={{ marginRight: 8 }} onClick={() => unload()}>\n unload\n </button>\n <button type=\"button\" style={{ marginRight: 8 }} onClick={() => load()}>\n load\n </button>\n <br />\n <br />\n <div ref={ref}></div>\n </>\n );\n};",Y="import React from 'react';\nimport { useExternal } from 'ahooks';\n\nexport default () => {\n const ref = React.useRef();\n\n const [path, setPath] = React.useState('https://picsum.photos/200/100');\n\n const [status] = useExternal(path, {\n type: 'img',\n target: ref\n });\n\n return (\n <>\n <p>\n Status: <b>{status}</b>\n </p>\n <button\n type=\"button\"\n style={{ marginRight: 8 }}\n onClick={() =>\n setPath(`https://picsum.photos/200/100?random=${Math.floor(Math.random() * 100)}`)\n }\n >\n random a path\n </button>\n <br />\n <br />\n <a href={path} target=\"_blank\">\n {path}\n </a>\n <br />\n <div ref={ref}></div>\n </>\n );\n};",G="import React, { useState } from 'react';\nimport { useFavicon } from 'ahooks';\n\nexport const DEFAULT_FAVICON_URL = 'https://ahooks.js.org/simple-logo.svg';\n\nexport const GOOGLE_FAVICON_URL = 'https://www.google.com/favicon.ico';\n\nexport default () => {\n const [url, setUrl] = useState<string>(DEFAULT_FAVICON_URL);\n\n useFavicon(url);\n\n return (\n <>\n <p>\n Current Favicon: <span>{url}</span>\n </p>\n <button\n style={{ marginRight: 16 }}\n onClick={() => {\n setUrl(GOOGLE_FAVICON_URL);\n }}\n >\n Change To Google Favicon\n </button>\n <button\n onClick={() => {\n setUrl(DEFAULT_FAVICON_URL);\n }}\n >\n Back To AHooks Favicon\n </button>\n </>\n );\n};",Z="import React, { useRef } from 'react';\nimport { useFullscreen } from 'ahooks';\n\nexport default () => {\n const ref = useRef();\n const [isFullscreen, { setFull, exitFull, toggleFull }] = useFullscreen(ref);\n return (\n <div ref={ref} style={{ background: 'white' }}>\n <div style={{ marginBottom: 16 }}>{isFullscreen ? 'Fullscreen' : 'Not fullscreen'}</div>\n <div>\n <button type=\"button\" onClick={setFull}>\n setFull\n </button>\n <button type=\"button\" onClick={exitFull} style={{ margin: '0 8px' }}>\n exitFull\n </button>\n <button type=\"button\" onClick={toggleFull}>\n toggle\n </button>\n </div>\n </div>\n );\n};",Q="import React from 'react';\nimport { useFullscreen } from 'ahooks';\nimport img from './react-hooks.jpg';\n\nexport default () => {\n const [, { setFull }] = useFullscreen(() => document.getElementById('fullscreen-img'));\n return (\n <div style={{ background: 'white' }}>\n <div style={{ marginBottom: 16 }}>\n <img id=\"fullscreen-img\" src={img} style={{ width: 320 }} alt=\"\" />\n </div>\n <button type=\"button\" onClick={setFull}>\n setFull\n </button>\n </div>\n );\n};",X='import React from \'react\';\nimport { Table, Pagination, Field, Form, Input, Button, Select, Icon } from \'@alifd/next\';\nimport { useFusionTable } from \'ahooks\';\n\ninterface Item {\n name: {\n last: string;\n };\n email: string;\n phone: string;\n gender: \'male\' | \'female\';\n}\n\ninterface Result {\n total: number;\n list: Item[];\n}\n\nconst getTableData = ({ current, pageSize }, formData: Object): Promise<Result> => {\n let query = `page=${current}&size=${pageSize}`;\n Object.entries(formData).forEach(([key, value]) => {\n if (value) {\n query += `&${key}=${value}`;\n }\n });\n\n return fetch(`https://randomuser.me/api?results=${pageSize}&${query}`)\n .then((res) => res.json())\n .then((res) => ({\n total: 55,\n list: res.results.slice(0, 10),\n }));\n};\n\nconst AppList = () => {\n const field = Field.useField([]);\n const { paginationProps, tableProps, search, loading } = useFusionTable(getTableData, {\n field,\n });\n const { type, changeType, submit, reset } = search;\n\n const advanceSearchForm = (\n <div>\n <Form\n inline\n style={{ display: \'flex\', alignItems: \'center\', justifyContent: \'flex-end\' }}\n field={field}\n >\n <Form.Item label="name:">\n <Input name="name" placeholder="name" />\n </Form.Item>\n <Form.Item label="email:">\n <Input name="email" placeholder="email" />\n </Form.Item>\n <Form.Item label="phone:">\n <Input name="phone" placeholder="phone" />\n </Form.Item>\n\n <Form.Item label=" ">\n <Form.Submit loading={loading} type="primary" onClick={submit}>\n Search\n </Form.Submit>\n </Form.Item>\n\n <Form.Item label=" ">\n <Button onClick={reset}>reset</Button>\n </Form.Item>\n\n <Form.Item label=" ">\n <Button text type="primary" onClick={changeType}>\n Simple Search\n </Button>\n </Form.Item>\n </Form>\n </div>\n );\n\n const searchForm = (\n <div>\n <Form\n inline\n style={{ display: \'flex\', alignItems: \'center\', justifyContent: \'flex-end\' }}\n field={field}\n >\n <Form.Item label=" ">\n <Select name="gender" defaultValue="all" onChange={submit}>\n <Select.Option value="all">all</Select.Option>\n <Select.Option value="male">male</Select.Option>\n <Select.Option value="female">female</Select.Option>\n </Select>\n </Form.Item>\n\n <Form.Item label=" ">\n <Input\n name="name"\n innerAfter={<Icon type="search" size="xs" onClick={submit} style={{ margin: 4 }} />}\n placeholder="enter name"\n onPressEnter={submit}\n />\n </Form.Item>\n\n <Form.Item label=" ">\n <Button text type="primary" onClick={changeType}>\n Advanced Search\n </Button>\n </Form.Item>\n </Form>\n </div>\n );\n\n return (\n <>\n {type === \'simple\' ? searchForm : advanceSearchForm}\n <Table {...tableProps} primaryKey="email">\n <Table.Column title="name" dataIndex="name.last" width={140} />\n <Table.Column title="email" dataIndex="email" width={500} />\n <Table.Column title="phone" dataIndex="phone" width={500} />\n <Table.Column title="gender" dataIndex="gender" width={500} />\n </Table>\n <Pagination style={{ marginTop: 16 }} {...paginationProps} />\n </>\n );\n};\n\nexport default AppList;',ee='import React, { useState } from \'react\';\nimport { Table, Pagination, Field, Form, Input, Button } from \'@alifd/next\';\nimport { useFusionTable } from \'ahooks\';\n\ninterface Item {\n name: {\n last: string;\n };\n email: string;\n phone: string;\n gender: \'male\' | \'female\';\n}\n\ninterface Result {\n total: number;\n list: Item[];\n}\n\nconst getTableData = (\n { current, pageSize, filters, sorter },\n formData: Object,\n): Promise<Result> => {\n console.log(sorter, filters);\n\n let query = `page=${current}&size=${pageSize}`;\n Object.entries(formData).forEach(([key, value]) => {\n if (value) {\n query += `&${key}=${value}`;\n }\n });\n\n return fetch(`https://randomuser.me/api?results=${pageSize}&${query}`)\n .then((res) => res.json())\n .then((res) => ({\n total: 55,\n list: res.results,\n }));\n};\n\nconst AppList = () => {\n const field = Field.useField([]);\n\n const { tableProps, paginationProps, params, search } = useFusionTable(getTableData, {\n defaultPageSize: 5,\n field,\n cacheKey: \'tableProps\',\n });\n\n const { sorter = {}, filters = {} } = params[0] || {};\n const { type, changeType, submit, reset } = search || {};\n\n const searchFrom = (\n <div style={{ marginBottom: 16 }}>\n <Form\n field={field}\n inline\n style={{ display: \'flex\', justifyContent: \'flex-end\', alignItems: \'center\' }}\n >\n <Form.Item label="name:">\n <Input name="name" placeholder="name" />\n </Form.Item>\n {type === \'advance\' && (\n <>\n <Form.Item label="email:">\n <Input name="email" placeholder="email" />\n </Form.Item>\n <Form.Item label="phone:">\n <Input name="phone" placeholder="phone" />\n </Form.Item>\n </>\n )}\n <Form.Item label=" ">\n <Form.Submit type="primary" onClick={submit}>\n Search\n </Form.Submit>\n </Form.Item>\n\n <Form.Item label=" ">\n <Button onClick={reset}>reset</Button>\n </Form.Item>\n\n <Form.Item label=" ">\n <Button text type="primary" onClick={changeType}>\n {type === \'simple\' ? \'Expand\' : \'Close\'}\n </Button>\n </Form.Item>\n </Form>\n </div>\n );\n\n return (\n <div>\n {searchFrom}\n\n <Table {...tableProps} filterParams={filters} sort={sorter} primaryKey="email">\n <Table.Column title="name" dataIndex="name.last" width={140} />\n <Table.Column title="email" dataIndex="email" width={500} />\n <Table.Column title="phone" sortable dataIndex="phone" width={500} />\n <Table.Column\n title="gender"\n filters={[\n { label: \'male\', value: \'male\' },\n { label: \'female\', value: \'female\' },\n ]}\n dataIndex="gender"\n width={500}\n />\n </Table>\n <Pagination style={{ marginTop: 16 }} {...paginationProps} />\n </div>\n );\n};\n\nconst Demo = () => {\n const [show, setShow] = useState(true);\n\n return (\n <div>\n <Button\n type="primary"\n warning\n onClick={() => {\n setShow(!show);\n }}\n style={{ marginBottom: 16 }}\n >\n {show ? \'Click to destroy\' : \'Click recovery\'}\n </Button>\n {show && <AppList />}\n </div>\n );\n};\n\nexport default Demo;',ne='import React from \'react\';\nimport { Table, Pagination, Field, Form, Input, Button, Select, Icon } from \'@alifd/next\';\nimport { useFusionTable } from \'ahooks\';\n\ninterface Item {\n name: {\n last: string;\n };\n email: string;\n phone: string;\n gender: \'male\' | \'female\';\n}\n\ninterface Result {\n total: number;\n list: Item[];\n}\n\nconst getTableData = ({ current, pageSize }, formData: Object): Promise<Result> => {\n let query = `page=${current}&size=${pageSize}`;\n Object.entries(formData).forEach(([key, value]) => {\n if (value) {\n query += `&${key}=${value}`;\n }\n });\n\n return fetch(`https://randomuser.me/api?results=${pageSize}&${query}`)\n .then((res) => res.json())\n .then((res) => ({\n total: 55,\n list: res.results.slice(0, 10),\n }));\n};\n\nconst AppList = () => {\n const field = Field.useField([]);\n const { paginationProps, tableProps, search, loading } = useFusionTable(getTableData, {\n field,\n defaultParams: [\n { current: 2, pageSize: 5 },\n { name: \'hello\', email: \'abc@gmail.com\', gender: \'female\' },\n ],\n defaultType: \'advance\',\n });\n const { type, changeType, submit, reset } = search;\n\n const advanceSearchForm = (\n <div>\n <Form\n inline\n style={{ display: \'flex\', alignItems: \'center\', justifyContent: \'flex-end\' }}\n field={field}\n >\n <Form.Item label="name:">\n <Input name="name" placeholder="name" />\n </Form.Item>\n <Form.Item label="email:">\n <Input name="email" placeholder="email" />\n </Form.Item>\n <Form.Item label="phone:">\n <Input name="phone" placeholder="phone" />\n </Form.Item>\n\n <Form.Item label=" ">\n <Form.Submit loading={loading} type="primary" onClick={submit}>\n Search\n </Form.Submit>\n </Form.Item>\n\n <Form.Item label=" ">\n <Button onClick={reset}>reset</Button>\n </Form.Item>\n\n <Form.Item label=" ">\n <Button text type="primary" onClick={changeType}>\n Simple Search\n </Button>\n </Form.Item>\n </Form>\n </div>\n );\n\n const searchForm = (\n <div>\n <Form\n inline\n style={{ display: \'flex\', alignItems: \'center\', justifyContent: \'flex-end\' }}\n field={field}\n >\n <Form.Item label=" ">\n <Select name="gender" defaultValue="all" onChange={submit}>\n <Select.Option value="all">all</Select.Option>\n <Select.Option value="male">male</Select.Option>\n <Select.Option value="female">female</Select.Option>\n </Select>\n </Form.Item>\n\n <Form.Item label=" ">\n <Input\n name="name"\n innerAfter={<Icon type="search" size="xs" onClick={submit} style={{ margin: 4 }} />}\n placeholder="enter name"\n onPressEnter={submit}\n />\n </Form.Item>\n\n <Form.Item label=" ">\n <Button text type="primary" onClick={changeType}>\n Advanced Search\n </Button>\n </Form.Item>\n </Form>\n </div>\n );\n\n return (\n <>\n {type === \'simple\' ? searchForm : advanceSearchForm}\n <Table {...tableProps} primaryKey="email">\n <Table.Column title="name" dataIndex="name.last" width={140} />\n <Table.Column title="email" dataIndex="email" width={500} />\n <Table.Column title="phone" dataIndex="phone" width={500} />\n <Table.Column title="gender" dataIndex="gender" width={500} />\n </Table>\n <Pagination style={{ marginTop: 16 }} {...paginationProps} />\n </>\n );\n};\n\nexport default AppList;',te='import React from \'react\';\nimport { Table, Pagination, Field, Form, Input, Select, Icon } from \'@alifd/next\';\nimport { useFusionTable } from \'ahooks\';\n\ninterface Item {\n name: {\n last: string;\n };\n email: string;\n phone: string;\n gender: \'male\' | \'female\';\n}\n\ninterface Result {\n total: number;\n list: Item[];\n}\n\nconst getTableData = ({ current, pageSize }, formData: Object): Promise<Result> => {\n let query = `page=${current}&size=${pageSize}`;\n Object.entries(formData).forEach(([key, value]) => {\n if (value) {\n query += `&${key}=${value}`;\n }\n });\n\n return fetch(`https://randomuser.me/api?results=${pageSize}&${query}`)\n .then((res) => res.json())\n .then((res) => ({\n total: 55,\n list: res.results.slice(0, 10),\n }));\n};\n\nconst AppList = () => {\n const field = Field.useField([]);\n const { paginationProps, tableProps, search } = useFusionTable(getTableData, {\n field,\n defaultParams: [{ current: 1, pageSize: 10 }, { name: \'hello\' }],\n });\n const { submit } = search;\n\n const searchForm = (\n <div>\n <Form\n inline\n style={{ display: \'flex\', alignItems: \'center\', justifyContent: \'flex-end\' }}\n field={field}\n >\n <Form.Item label=" ">\n <Input\n name="name"\n innerAfter={<Icon type="search" size="xs" onClick={submit} style={{ margin: 4 }} />}\n placeholder="enter name"\n onPressEnter={submit}\n {...field.init(\'name\', { rules: [{ required: true }] })}\n />\n </Form.Item>\n </Form>\n </div>\n );\n\n return (\n <>\n {searchForm}\n <Table {...tableProps} primaryKey="email">\n <Table.Column title="name" dataIndex="name.last" width={140} />\n <Table.Column title="email" dataIndex="email" width={500} />\n <Table.Column title="phone" dataIndex="phone" width={500} />\n <Table.Column title="gender" dataIndex="gender" width={500} />\n </Table>\n <Pagination style={{ marginTop: 16 }} {...paginationProps} />\n </>\n );\n};\n\nexport default AppList;',re="import { useHistoryTravel } from 'ahooks';\nimport React from 'react';\n\nexport default () => {\n const { value, setValue, backLength, forwardLength, back, forward } = useHistoryTravel<string>();\n\n return (\n <div>\n <input value={value || ''} onChange={(e) => setValue(e.target.value)} />\n <button disabled={backLength <= 0} onClick={back} style={{ margin: '0 8px' }}>\n back\n </button>\n <button disabled={forwardLength <= 0} onClick={forward}>\n forward\n </button>\n </div>\n );\n};",oe="import { useHistoryTravel } from 'ahooks';\nimport React, { useState } from 'react';\n\nexport default () => {\n const {\n value,\n setValue,\n backLength,\n forwardLength,\n back,\n forward,\n go,\n reset,\n } = useHistoryTravel(['do homework']);\n\n const [inputValue, setInputValue] = useState('');\n const [step, setStep] = useState(0);\n\n const onAdd = () => {\n setValue([...value, inputValue]);\n setInputValue('');\n };\n\n const onGo = () => {\n go(step);\n setStep(0);\n };\n\n const onReset = () => {\n reset();\n setStep(0);\n setInputValue('');\n };\n\n return (\n <div>\n <div style={{ border: '1px solid #ebedf1', padding: 16, marginBottom: 16 }}>\n <h3>TODO List</h3>\n <ul>\n {value.map((it, index) => (\n <li key={index}>{it}</li>\n ))}\n </ul>\n </div>\n <div style={{ marginBottom: 16 }}>\n <input\n value={inputValue}\n onChange={(e) => setInputValue(e.target.value)}\n placeholder=\"Please enter TODO name\"\n style={{ width: 200, marginRight: 8 }}\n />\n <button type=\"button\" onClick={onAdd} style={{ marginRight: 8 }}>\n Add TODO\n </button>\n <button type=\"button\" disabled={backLength <= 0} onClick={back} style={{ marginRight: 8 }}>\n Undo\n </button>\n <button\n type=\"button\"\n disabled={forwardLength <= 0}\n onClick={forward}\n style={{ marginRight: 8 }}\n >\n Redo\n </button>\n <button type=\"button\" disabled={!backLength && !forwardLength} onClick={onReset}>\n Reset\n </button>\n </div>\n <div>\n <input\n type=\"number\"\n value={step}\n onChange={(e) => setStep(e.target.value as any)}\n max={forwardLength}\n min={backLength * -1}\n style={{ marginRight: 8, width: 60 }}\n />\n <button type=\"button\" onClick={onGo}>\n Go\n </button>\n </div>\n </div>\n );\n};",ae="import React, { useRef } from 'react';\nimport { useHover } from 'ahooks';\n\nexport default () => {\n const ref = useRef();\n const isHovering = useHover(ref);\n return <div ref={ref}>{isHovering ? 'hover' : 'leaveHover'}</div>;\n};",se="import React from 'react';\nimport { useHover } from 'ahooks';\n\nexport default () => {\n const isHovering = useHover(() => document.getElementById('hover-div'), {\n onEnter: () => {\n console.log('onEnter');\n },\n onLeave: () => {\n console.log('onLeave');\n },\n });\n\n return <div id=\"hover-div\">{isHovering ? 'hover' : 'leaveHover'}</div>;\n};",ie="import React, { useRef } from 'react';\nimport { useInViewport } from 'ahooks';\n\nexport default () => {\n const ref = useRef();\n const inViewPort = useInViewport(ref);\n return (\n <div>\n <div ref={ref}>observer dom</div>\n <div style={{ marginTop: 70, color: inViewPort ? '#87d068' : '#f50' }}>\n {inViewPort ? 'visible' : 'hidden'}\n </div>\n </div>\n );\n};",ue="import React from 'react';\nimport { useInViewport } from 'ahooks';\n\nexport default () => {\n const inViewPort = useInViewport(() => document.querySelector('#demo2'));\n return (\n <div>\n <div id=\"demo2\">observer dom</div>\n <div style={{ marginTop: 70, color: inViewPort ? '#87d068' : '#f50' }}>\n {inViewPort ? 'visible' : 'hidden'}\n </div>\n </div>\n );\n};",ce="import React, { useState } from 'react';\nimport { useInterval } from 'ahooks';\n\nexport default () => {\n const [count, setCount] = useState(0);\n\n useInterval(() => {\n setCount(count + 1);\n }, 1000);\n\n return <div>count: {count}</div>;\n};",le="import React, { useState } from 'react';\nimport { useInterval } from 'ahooks';\n\nexport default () => {\n const [count, setCount] = useState(0);\n const [interval, setInterval] = useState(1000);\n\n useInterval(\n () => {\n setCount(count + 1);\n },\n interval,\n { immediate: true },\n );\n\n return (\n <div>\n <p> count: {count} </p>\n <p style={{ marginTop: 16 }}> interval: {interval} </p>\n <button onClick={() => setInterval(interval + 1000)} style={{ marginRight: 8 }}>\n interval + 1000\n </button>\n <button\n style={{ marginRight: 8 }}\n onClick={() => {\n setInterval(1000);\n }}\n >\n reset interval\n </button>\n <button\n onClick={() => {\n setInterval(null);\n }}\n >\n clear\n </button>\n </div>\n );\n};",de="import React, { useState } from 'react';\nimport { useKeyPress } from 'ahooks';\n\nexport default () => {\n const [counter, setCounter] = useState(0);\n\n useKeyPress('ArrowUp', () => {\n setCounter((s) => s + 1);\n });\n\n // keyCode value for ArrowDown\n useKeyPress(40, () => {\n setCounter((s) => s - 1);\n });\n\n return (\n <div>\n <p>Try pressing the following: </p>\n <div>1. Press ArrowUp by key to increase</div>\n <div>2. Press ArrowDown by keyCode to decrease</div>\n <div>\n counter: <span style={{ color: '#f00' }}>{counter}</span>\n </div>\n </div>\n );\n};",pe="import React, { useState } from 'react';\nimport { useKeyPress } from 'ahooks';\n\nexport default () => {\n const [counter, setCounter] = useState(0);\n\n useKeyPress('left', () => {\n setCounter((s) => s - 1);\n });\n\n useKeyPress('right', () => {\n setCounter((s) => s + 1);\n });\n\n return (\n <div>\n <p>Try pressing the following: </p>\n <div>1. Press ArrowLeft to decrease</div>\n <div>2. Press ArrowRight to increase</div>\n <div>\n counter: <span style={{ color: '#f00' }}>{counter}</span>\n </div>\n </div>\n );\n};",me="import React, { useState } from 'react';\nimport { Icon } from 'antd';\nimport { useKeyPress } from 'ahooks';\n\nexport default () => {\n const [num, setNum] = useState<string>();\n const [key, setKey] = useState<string>();\n const [state, setState] = useState<number>();\n const filterKey = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];\n useKeyPress(filterKey, (event) => {\n setNum(event.key);\n });\n\n // a s d f, Backspace, 8\n useKeyPress([65, 83, 68, 70, 8, '8'], (event) => {\n setKey(event.key);\n });\n\n useKeyPress(['shift.c'], () => {\n setState(1);\n });\n\n useKeyPress(['meta'], () => {\n setState(2);\n });\n\n useKeyPress('ctrl.alt.c', () => {\n setState(3);\n });\n\n useKeyPress('ctrl.alt.space', () => {\n setState(4);\n });\n\n // Attention: event.key === '0'\n useKeyPress('ctrl.alt.0', () => {\n setState(5);\n });\n\n return (\n <div>\n <p>Try pressing the following: </p>\n <div>\n 1. Number key [0-9]: <span style={{ color: '#f00' }}>{num}</span>\n </div>\n <div>\n 2. Press key [a, s, d, f, Backspace, 8]: <span style={{ color: '#f00' }}>{key}</span>\n </div>\n <div>\n 3. Modifier key [shift.c]: {state === 1 && <Icon type=\"check\" style={{ color: '#f00' }} />}\n </div>\n <div>\n 4. Modifier key [meta]: {state === 2 && <Icon type=\"check\" style={{ color: '#f00' }} />}\n </div>\n <div>\n 5. Modifier key [ctrl.alt.c]:{' '}\n {state === 3 && <Icon type=\"check\" style={{ color: '#f00' }} />}\n </div>\n <div>\n 6. Modifier key [ctrl.alt.space]:{' '}\n {state === 4 && <Icon type=\"check\" style={{ color: '#f00' }} />}\n </div>\n <div>\n 7. Modifier key [ctrl.alt.0]:{' '}\n {state === 5 && <Icon type=\"check\" style={{ color: '#f00' }} />}\n </div>\n </div>\n );\n};",fe="import React, { useState } from 'react';\nimport { useKeyPress } from 'ahooks';\n\nexport default () => {\n const [key, setKey] = useState<string>();\n const filterKey = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];\n useKeyPress(\n (event) => !filterKey.includes(event.key),\n (event) => {\n if (event.type === 'keyup') {\n setKey(event.key);\n }\n },\n {\n events: ['keydown', 'keyup'],\n },\n );\n\n return (\n <div>\n Pressing key except number key\uff1a<span style={{ color: '#f00' }}>{key}</span>\n </div>\n );\n};",ve="import React, { useState, useRef } from 'react';\nimport { useKeyPress } from 'ahooks';\n\nexport default () => {\n const inputRef = useRef();\n\n const [text, setText] = useState('');\n const [textRef, setTextRef] = useState('');\n const [textSync, setTextSync] = useState('');\n useKeyPress(\n 'enter',\n (event: any) => {\n const { value } = event.target;\n setText(value);\n },\n {\n events: ['keyup'],\n target: () => document.getElementById('input'),\n },\n );\n\n useKeyPress(\n 'enter',\n (event: any) => {\n const { value } = event.target;\n setTextRef(value);\n },\n {\n target: inputRef,\n },\n );\n\n // Make sure the DOM exists\n useKeyPress(\n () => true,\n (event: any) => {\n const { value } = event.target;\n setTextSync(value);\n },\n {\n events: ['keyup'],\n target: document.getElementById('input2'),\n },\n );\n\n return (\n <div>\n <div>\n <p>Input and pressing enter: {text}</p>\n <input id=\"input\" style={{ width: 300, marginRight: 24 }} />\n </div>\n <div style={{ marginTop: 24 }}>\n <p>Input and pressing enter: {textRef}</p>\n <input ref={inputRef} style={{ width: 300, marginRight: 24 }} />\n </div>\n <div style={{ marginTop: 24 }}>\n <p>Input after enter change: {textSync}</p>\n <input id=\"input2\" style={{ width: 300, marginRight: 24 }} />\n </div>\n </div>\n );\n};",he="import React from 'react';\nimport { useLocalStorageState } from 'ahooks';\n\nexport default function () {\n const [message, setMessage] = useLocalStorageState('user-message', 'Hello~');\n return (\n <>\n <input\n value={message || ''}\n placeholder=\"Please enter some words...\"\n onChange={(e) => setMessage(e.target.value)}\n />\n <button style={{ margin: '0 8px' }} type=\"button\" onClick={() => setMessage('Hello~')}>\n Reset\n </button>\n <button type=\"button\" onClick={() => setMessage()}>\n Clear\n </button>\n </>\n );\n}",be="import React from 'react';\nimport { useLocalStorageState } from 'ahooks';\n\nconst defaultArray = ['a', 'e', 'i', 'o', 'u'];\n\nexport default function () {\n const [value, setValue] = useLocalStorageState('cascader', defaultArray);\n\n return (\n <>\n <p>{value.join('-')}</p>\n <button\n type=\"button\"\n style={{ marginRight: '16px' }}\n onClick={() => setValue([...value, Math.random().toString(36).slice(-1)])}\n >\n push random\n </button>\n <button type=\"button\" onClick={() => setValue(defaultArray)}>\n reset\n </button>\n </>\n );\n}",ge="import React from 'react';\nimport { useLocalStorageState } from 'ahooks';\n\ninterface IUser {\n id: number;\n name: string;\n age: number;\n}\n\nexport default function () {\n const [user, setUser] = useLocalStorageState('user', {\n id: 9234634791,\n name: 'Zhangsan',\n age: 33,\n } as IUser);\n\n return (\n <>\n <input\n style={{ width: 200 }}\n defaultValue={user.name}\n placeholder=\"input user name\"\n onChange={(e) => {\n setUser((u: IUser) => ({ ...u, name: e.target.value }));\n }}\n />\n </>\n );\n}",ye="import React, { useState } from 'react';\nimport { message } from 'antd';\nimport { useLockFn } from 'ahooks';\n\nfunction mockApiRequest() {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve();\n }, 2000);\n });\n}\n\nexport default () => {\n const [count, setCount] = useState(0);\n\n const submit = useLockFn(async () => {\n message.info('Start to submit');\n await mockApiRequest();\n setCount((val) => val + 1);\n message.success('Submit finished');\n });\n\n return (\n <>\n <p>Submit count: {count}</p>\n <button onClick={submit}>Submit</button>\n </>\n );\n};",we="import React from 'react';\nimport { useMap } from 'ahooks';\n\nexport default () => {\n const [map, { set, setAll, remove, reset, get }] = useMap<string | number, string>([\n ['msg', 'hello world'],\n [123, 'number type'],\n ]);\n\n return (\n <div>\n <button type=\"button\" onClick={() => set(String(Date.now()), new Date().toJSON())}>\n Add\n </button>\n <button\n type=\"button\"\n onClick={() => setAll([['text', 'this is a new Map']])}\n style={{ margin: '0 8px' }}\n >\n Set new Map\n </button>\n <button type=\"button\" onClick={() => remove('msg')} disabled={!get('msg')}>\n Remove 'msg'\n </button>\n <button type=\"button\" onClick={() => reset()} style={{ margin: '0 8px' }}>\n Reset\n </button>\n <div style={{ marginTop: 16 }}>\n <pre>{JSON.stringify(Array.from(map), null, 2)}</pre>\n </div>\n </div>\n );\n};",ke="import React from 'react';\nimport { message } from 'antd';\nimport { useToggle, useMount } from 'ahooks';\n\nconst MyComponent = () => {\n useMount(() => {\n message.info('mount');\n });\n\n return <div>Hello World</div>;\n};\n\nexport default () => {\n const [state, { toggle }] = useToggle(false);\n\n return (\n <>\n <button type=\"button\" onClick={() => toggle()}>\n {state ? 'unmount' : 'mount'}\n </button>\n {state && <MyComponent />}\n </>\n );\n};",xe="import { useMouse } from 'ahooks';\nimport React from 'react';\n\nexport default () => {\n const mouse = useMouse();\n\n return <div>Mouse Pos: {JSON.stringify(mouse)}</div>;\n};",Ce="import React from 'react';\nimport { useNetwork } from 'ahooks';\n\nexport default () => {\n const networkState = useNetwork();\n\n return (\n <div>\n <p>Effects\uff1a{JSON.stringify(networkState)}</p>\n </div>\n );\n};",Se="import React, { useState, useCallback, useRef } from 'react';\nimport { message } from 'antd';\nimport { usePersistFn } from 'ahooks';\n\nexport default () => {\n const [count, setCount] = useState(0);\n\n const showCountPersistFn = usePersistFn(() => {\n message.info(`Current count is ${count}`);\n });\n\n const showCountCommon = useCallback(() => {\n message.info(`Current count is ${count}`);\n }, [count]);\n\n return (\n <>\n <button\n type=\"button\"\n onClick={() => {\n setCount((c) => c + 1);\n }}\n >\n Add Count\n </button>\n <p>You can click the button to see the number of sub-component renderings</p>\n\n <div style={{ marginTop: 32 }}>\n <h4>Component with persist function:</h4>\n {/* use persist function, ExpensiveTree component will only render once */}\n <ExpensiveTree showCount={showCountPersistFn} />\n </div>\n <div style={{ marginTop: 32 }}>\n <h4>Component without persist function:</h4>\n {/* without persist function, ExpensiveTree component will re-render on state change */}\n <ExpensiveTree showCount={showCountCommon} />\n </div>\n </>\n );\n};\n\n// some expensive component with React.memo\nconst ExpensiveTree = React.memo<{ [key: string]: any }>(({ showCount }) => {\n const renderCountRef = useRef(0);\n renderCountRef.current += 1;\n\n return (\n <div>\n <p>Render Count: {renderCountRef.current}</p>\n <button type=\"button\" onClick={showCount}>\n showParentCount\n </button>\n </div>\n );\n});",Pe="import { usePrevious } from 'ahooks';\nimport React, { useState } from 'react';\n\nexport default () => {\n const [count, setCount] = useState(0);\n const previous = usePrevious(count);\n return (\n <>\n <div>counter current value: {count}</div>\n <div style={{ marginBottom: 8 }}>counter previous value: {previous}</div>\n <button type=\"button\" onClick={() => setCount((c) => c + 1)}>\n increase\n </button>\n <button type=\"button\" style={{ marginLeft: 8 }} onClick={() => setCount((c) => c - 1)}>\n decrease\n </button>\n </>\n );\n};",Re="import React, { useState } from 'react';\nimport { usePrevious } from 'ahooks';\n\ninterface Person {\n name: string;\n job: string;\n}\n\nconst nameCompareFunction = (prev: Person | undefined, next: Person) => {\n if (!prev) {\n return true;\n }\n if (prev.name !== next.name) {\n return true;\n }\n return false;\n};\n\nconst jobCompareFunction = (prev: Person | undefined, next: Person) => {\n if (!prev) {\n return true;\n }\n if (prev.job !== next.job) {\n return true;\n }\n return false;\n};\n\nexport default () => {\n const [state, setState] = useState({ name: 'Jack', job: 'student' });\n const [nameInput, setNameInput] = useState('');\n const [jobInput, setJobInput] = useState('');\n const previousName = usePrevious(state, nameCompareFunction);\n const previousJob = usePrevious(state, jobCompareFunction);\n\n return (\n <>\n <div style={{ margin: '8px 0', border: '1px solid #e8e8e8', padding: 8 }}>\n <div>current name: {state.name}</div>\n <div>current job: {state.job}</div>\n </div>\n <div>previous name: {(previousName || {}).name}</div>\n <div style={{ marginBottom: 8 }}>previous job: {(previousJob || {}).job}</div>\n <div style={{ marginTop: 8 }}>\n <input\n style={{ width: 220 }}\n value={nameInput}\n onChange={(e) => setNameInput(e.target.value)}\n placeholder=\"new name\"\n />\n <button\n type=\"button\"\n onClick={() => {\n setState((s) => ({ ...s, name: nameInput }));\n }}\n style={{ marginLeft: 8 }}\n >\n update\n </button>\n </div>\n <div style={{ marginTop: 8 }}>\n <input\n style={{ width: 220 }}\n value={jobInput}\n onChange={(e) => setJobInput(e.target.value)}\n placeholder=\"new job\"\n />\n <button\n type=\"button\"\n onClick={() => {\n setState((s) => ({ ...s, job: jobInput }));\n }}\n style={{ marginLeft: 8 }}\n >\n update\n </button>\n </div>\n </>\n );\n};",Oe="import React from 'react';\nimport { useReactive } from 'ahooks';\n\nexport default () => {\n const state = useReactive({\n count: 0,\n inputVal: '',\n obj: {\n value: '',\n },\n });\n\n return (\n <div>\n <p> state.count\uff1a{state.count}</p>\n\n <button style={{ marginRight: 8 }} onClick={() => state.count++}>\n state.count++\n </button>\n <button onClick={() => state.count--}>state.count--</button>\n\n <p style={{ marginTop: 20 }}> state.inputVal: {state.inputVal}</p>\n <input onChange={(e) => (state.inputVal = e.target.value)} />\n\n <p style={{ marginTop: 20 }}> state.obj.value: {state.obj.value}</p>\n <input onChange={(e) => (state.obj.value = e.target.value)} />\n </div>\n );\n};",je="import React from 'react';\nimport { useReactive } from 'ahooks';\n\nexport default () => {\n const state = useReactive({\n arr: [],\n });\n\n return (\n <div>\n <p>\n state.arr: <span role=\"test-array\">{JSON.stringify(state.arr)}</span>\n </p>\n <button\n style={{ marginRight: '10px' }}\n onClick={() => state.arr.push(Math.floor(Math.random() * 100))}\n role=\"pushbtn\"\n >\n push\n </button>\n <button style={{ marginRight: '10px' }} onClick={() => state.arr.pop()} role=\"popbtn\">\n pop\n </button>\n <button style={{ marginRight: '10px' }} onClick={() => state.arr.shift()} role=\"shiftbtn\">\n shift\n </button>\n <button\n style={{ marginRight: '10px' }}\n role=\"unshiftbtn\"\n onClick={() => state.arr.unshift(Math.floor(Math.random() * 100))}\n >\n unshift\n </button>\n <button style={{ marginRight: '10px' }} role=\"reverse\" onClick={() => state.arr.reverse()}>\n reverse\n </button>\n <button style={{ marginRight: '10px' }} role=\"sort\" onClick={() => state.arr.sort()}>\n sort\n </button>\n </div>\n );\n};",Ie="import React from 'react';\nimport { useReactive } from 'ahooks';\n\nexport default () => {\n const state = useReactive({\n bug: '',\n bugs: ['feat', 'fix', 'chore'],\n addBug(bug) {\n this.bugs.push(bug);\n },\n get bugsCount() {\n return this.bugs.length;\n },\n });\n\n return (\n <div>\n <p>state.bugsCount: {state.bugsCount}</p>\n\n <form\n onSubmit={(e) => {\n state.addBug(state.bug);\n state.bug = '';\n e.preventDefault();\n }}\n >\n <input type=\"text\" value={state.bug} onChange={(e) => (state.bug = e.target.value)} />\n <button type=\"submit\" style={{ marginLeft: '10px' }}>\n Add\n </button>\n <button type=\"button\" style={{ marginLeft: '10px' }} onClick={() => state.bugs.pop()}>\n Delete\n </button>\n </form>\n\n <br />\n\n <ul>\n {state.bugs.map((bug) => (\n <li key={bug}>{bug}</li>\n ))}\n </ul>\n </div>\n );\n};",Te="import React, { useEffect, useState } from 'react';\nimport { useReactive } from 'ahooks';\n\nexport default () => {\n const state = useReactive({ count: 0 });\n const [stateCount, setStateCount] = useState(0);\n\n const state2 = useReactive({ count: 0 });\n const [stateCount2, setStateCount2] = useState(0);\n\n // \u4f9d\u8d56\u7684\u662f\u5bf9\u8c61\uff0c\u56e0\u4e3a\u59cb\u7ec8\u540c\u4e00\u4e2a\u5f15\u7528\uff0c\u6240\u4ee5\u4e0d\u4f1a\u6267\u884c\n useEffect(() => {\n setStateCount(stateCount + 1);\n }, [state]);\n\n // \u4f9d\u8d56\u7684\u57fa\u7840\u6570\u636e\u7c7b\u578b\uff0c\u6240\u4ee5\u53ea\u8981\u6539\u53d8\u5c31\u4f1a\u91cd\u65b0\u6267\u884c\n useEffect(() => {\n setStateCount2(stateCount2 + 1);\n }, [state2.count]);\n\n return (\n <div>\n <button style={{ marginTop: 20 }} onClick={() => (state.count += 1)}>\n stateCount + 1\n </button>\n <p>stateCount:{stateCount}</p>\n\n <button style={{ marginTop: 20 }} onClick={() => (state2.count += 1)}>\n stateCount2 + 1\n </button>\n <p>stateCount2:{stateCount2}</p>\n </div>\n );\n};",ze="import React from 'react';\nimport { configResponsive, useResponsive } from 'ahooks';\n\nconfigResponsive({\n small: 0,\n middle: 800,\n large: 1200,\n});\n\nexport default function () {\n const responsive = useResponsive();\n return (\n <>\n <p>Please change the width of the browser window to see the effect: </p>\n {Object.keys(responsive).map((key) => (\n <p key={key}>\n {key} {responsive[key] ? '\u2714' : '\u2718'}\n </p>\n ))}\n </>\n );\n}",Fe="import React, { useState } from 'react';\nimport useSafeState from '../index';\n\n\nconst Child = () => {\n\n const [value, setValue] = useSafeState<string>()\n React.useEffect(() => {\n setTimeout(() => {\n setValue('\u4ece\u670d\u52a1\u7aef\u83b7\u53d6\u7684\u6570\u636e')\n }, 5000)\n }, [])\n\n const text = value || '\u6b63\u5728\u83b7\u53d6\u6570\u636e\u3002\u3002\u3002'\n\n return (\n <div>{text}</div>\n )\n}\n\n\nexport default () => {\n \n\n const [visible, setVisible] = useSafeState(true);\n\n\n return (\n <div>\n <button onClick={() => setVisible(false)}>\u5378\u8f7d</button>\n {visible && <Child />}\n </div>\n );\n};",Ne="\nimport React, { Dispatch, SetStateAction } from 'react'\nimport useUnmountedRef from '../useUnmountedRef'\n\nfunction useSafeState<S>(initialState: S | (() => S)): [S, Dispatch<SetStateAction<S>>]\n\nfunction useSafeState<S = undefined>(): [S | undefined, Dispatch<SetStateAction<S | undefined>>];\n\n\nfunction useSafeState(initialState?) {\n const unmountedRef = useUnmountedRef()\n const [state, setState] = React.useState(initialState)\n const setCurrentState = (currentState) => {\n /** \u5982\u679c\u7ec4\u4ef6\u5df2\u7ecf\u5378\u8f7d\u5219\u4e0d\u518d\u66f4\u65b0 state */\n if (unmountedRef.current) return\n setState(currentState)\n }\n\n return [state, setCurrentState] as const\n}\n\nexport default useSafeState",De="import { useRef, useEffect } from 'react';\n\nconst useUnmountedRef = () => {\n const unmountedRef = useRef(false);\n useEffect(() => {\n return () => {\n unmountedRef.current = true;\n };\n }, []);\n return unmountedRef;\n};\n\nexport default useUnmountedRef;",Ee="import React, { useRef } from 'react';\nimport { useScroll } from 'ahooks';\n\nexport default () => {\n const ref = useRef(null);\n const scroll = useScroll(ref);\n return (\n <>\n <div>{JSON.stringify(scroll)}</div>\n <div\n style={{\n height: '160px',\n width: '160px',\n border: 'solid 1px #000',\n overflow: 'scroll',\n whiteSpace: 'nowrap',\n fontSize: '32px',\n }}\n ref={ref}\n >\n <div>\n Lorem ipsum dolor sit amet, consectetur adipisicing elit. A aspernatur atque, debitis ex\n excepturi explicabo iste iure labore molestiae neque optio perspiciatis\n </div>\n <div>\n Aspernatur cupiditate, deleniti id incidunt mollitia omnis! A aspernatur assumenda\n consequuntur culpa cumque dignissimos enim eos, et fugit natus nemo nesciunt\n </div>\n <div>\n Alias aut deserunt expedita, inventore maiores minima officia porro rem. Accusamus ducimus\n magni modi mollitia nihil nisi provident\n </div>\n <div>\n Alias aut autem consequuntur doloremque esse facilis id molestiae neque officia placeat,\n quia quisquam repellendus reprehenderit.\n </div>\n <div>\n Adipisci blanditiis facere nam perspiciatis sit soluta ullam! Architecto aut blanditiis,\n consectetur corporis cum deserunt distinctio dolore eius est exercitationem\n </div>\n <div>Ab aliquid asperiores assumenda corporis cumque dolorum expedita</div>\n <div>\n Culpa cumque eveniet natus totam! Adipisci, animi at commodi delectus distinctio dolore\n earum, eum expedita facilis\n </div>\n <div>\n Quod sit, temporibus! Amet animi fugit officiis perspiciatis, quis unde. Cumque\n dignissimos distinctio, dolor eaque est fugit nisi non pariatur porro possimus, quas quasi\n </div>\n </div>\n </>\n );\n};",qe="import React from 'react';\nimport { useScroll } from 'ahooks';\n\nexport default () => {\n const scroll = useScroll(document);\n return (\n <div>\n <div>{JSON.stringify(scroll)}</div>\n </div>\n );\n};",Ae="import React, { useRef } from 'react';\nimport { useScroll } from 'ahooks';\n\nexport default () => {\n const ref = useRef(null);\n\n const scroll = useScroll(ref, (val) => val.top > 100 && val.top < 200);\n\n return (\n <>\n <div>{JSON.stringify(scroll)}</div>\n <div\n className={'main'}\n style={{\n height: '160px',\n width: '160px',\n border: 'solid 1px #000',\n overflow: 'scroll',\n whiteSpace: 'nowrap',\n fontSize: '36px',\n }}\n ref={ref}\n >\n <div>\n Lorem ipsum dolor sit amet, consectetur adipisicing elit. A aspernatur atque, debitis ex\n excepturi explicabo iste iure labore molestiae neque optio perspiciatis\n </div>\n <div>\n Aspernatur cupiditate, deleniti id incidunt mollitia omnis! A aspernatur assumenda\n consequuntur culpa cumque dignissimos enim eos, et fugit natus nemo nesciunt\n </div>\n <div>\n Alias aut deserunt expedita, inventore maiores minima officia porro rem. Accusamus ducimus\n magni modi mollitia nihil nisi provident\n </div>\n <div>\n Alias aut autem consequuntur doloremque esse facilis id molestiae neque officia placeat,\n quia quisquam repellendus reprehenderit.\n </div>\n <div>\n Adipisci blanditiis facere nam perspiciatis sit soluta ullam! Architecto aut blanditiis,\n consectetur corporis cum deserunt distinctio dolore eius est exercitationem\n </div>\n <div>Ab aliquid asperiores assumenda corporis cumque dolorum expedita</div>\n <div>\n Culpa cumque eveniet natus totam! Adipisci, animi at commodi delectus distinctio dolore\n earum, eum expedita facilis\n </div>\n <div>\n Quod sit, temporibus! Amet animi fugit officiis perspiciatis, quis unde. Cumque\n dignissimos distinctio, dolor eaque est fugit nisi non pariatur porro possimus, quas quasi\n </div>\n </div>\n </>\n );\n};",Le="import { Checkbox, Col, Row } from 'antd';\nimport React, { useMemo, useState } from 'react';\nimport { useSelections } from 'ahooks';\n\nexport default () => {\n const [hideOdd, setHideOdd] = useState(false);\n const list = useMemo(() => {\n if (hideOdd) {\n return [2, 4, 6, 8];\n }\n return [1, 2, 3, 4, 5, 6, 7, 8];\n }, [hideOdd]);\n\n const {\n selected,\n allSelected,\n isSelected,\n toggle,\n toggleAll,\n partiallySelected,\n } = useSelections(list, [1]);\n\n return (\n <div>\n <div>Selected : {selected.join(',')}</div>\n <div style={{ borderBottom: '1px solid #E9E9E9', padding: '10px 0' }}>\n <Checkbox checked={allSelected} onClick={toggleAll} indeterminate={partiallySelected}>\n Check all\n </Checkbox>\n <Checkbox checked={hideOdd} onClick={() => setHideOdd((v) => !v)}>\n Hide Odd\n </Checkbox>\n </div>\n <Row style={{ padding: '10px 0' }}>\n {list.map((o) => (\n <Col span={12} key={o}>\n <Checkbox checked={isSelected(o)} onClick={() => toggle(o)}>\n {o}\n </Checkbox>\n </Col>\n ))}\n </Row>\n </div>\n );\n};",Me="import { useSessionStorageState } from 'ahooks';\nimport React from 'react';\n\nexport default function () {\n const [message, setMessage] = useSessionStorageState('user-message', 'Hello~');\n return (\n <>\n <input\n value={message}\n onChange={(e) => {\n setMessage(e.target.value);\n }}\n placeholder=\"Please enter some words...\"\n style={{ width: 200, marginRight: 8 }}\n />\n <button\n type=\"button\"\n onClick={() => {\n setMessage();\n }}\n >\n Reset\n </button>\n </>\n );\n}",Be="import { useSessionStorageState } from 'ahooks';\nimport React from 'react';\n\nconst defaultArray = ['a', 'e', 'i', 'o', 'u'];\n\nexport default function () {\n const [value, setValue] = useSessionStorageState('cascader', defaultArray);\n\n return (\n <>\n <p>{value.join('-')}</p>\n <button\n type=\"button\"\n style={{ marginRight: 8 }}\n onClick={() => setValue([...value, Math.random().toString(36).slice(-1)])}\n >\n push random\n </button>\n <button type=\"button\" onClick={() => setValue(defaultArray)}>\n reset\n </button>\n </>\n );\n}",_e="import React from 'react';\nimport { useSessionStorageState } from 'ahooks';\n\ninterface IUser {\n id: number;\n name: string;\n age: number;\n}\n\nexport default function () {\n const [user, setUser] = useSessionStorageState('user', {\n id: 9234634791,\n name: 'Zhangsan',\n age: 33,\n } as IUser);\n\n return (\n <>\n <input\n style={{ width: 200 }}\n defaultValue={user.name}\n placeholder=\"input user name\"\n onChange={(e) => {\n setUser((u: IUser) => ({ ...u, name: e.target.value }));\n }}\n />\n </>\n );\n}",Ue="import React from 'react';\nimport { useSet } from 'ahooks';\n\nexport default () => {\n const [set, { add, has, remove, reset }] = useSet(['Hello']);\n\n return (\n <div>\n <button type=\"button\" onClick={() => add(String(Date.now()))}>\n Add Timestamp\n </button>\n <button\n type=\"button\"\n onClick={() => remove('Hello')}\n disabled={!has('Hello')}\n style={{ margin: '0 8px' }}\n >\n Remove Hello\n </button>\n <button type=\"button\" onClick={() => reset()}>\n Reset\n </button>\n <div style={{ marginTop: 16 }}>\n <pre>{JSON.stringify(Array.from(set), null, 2)}</pre>\n </div>\n </div>\n );\n};",Ve="import React from 'react';\nimport { useSetState } from 'ahooks';\n\ninterface State {\n hello: string;\n count: number;\n [key: string]: any;\n}\n\nexport default () => {\n const [state, setState] = useSetState<State>({\n hello: '',\n count: 0,\n });\n\n return (\n <div>\n <pre>{JSON.stringify(state, null, 2)}</pre>\n <p>\n <button type=\"button\" onClick={() => setState({ hello: 'world' })}>\n set hello\n </button>\n <button type=\"button\" onClick={() => setState({ foo: 'bar' })} style={{ margin: '0 8px' }}>\n set foo\n </button>\n <button type=\"button\" onClick={() => setState((prev) => ({ count: prev.count + 1 }))}>\n count + 1\n </button>\n </p>\n </div>\n );\n};",$e="import React, { useRef } from 'react';\nimport { useSize } from 'ahooks';\n\nexport default () => {\n const ref = useRef();\n const size = useSize(ref);\n return (\n <div ref={ref}>\n try to resize the preview window <br />\n dimensions -- width: {size.width} px, height: {size.height} px\n </div>\n );\n};",Ke="import React from 'react';\nimport { useSize } from 'ahooks';\n\nexport default () => {\n const dom = document.querySelector('body');\n const size = useSize(dom);\n return (\n <div>\n try to resize the preview window <br />\n dimensions -- width: {size.width} px, height: {size.height} px\n </div>\n );\n};",He="import React from 'react';\nimport { useTextSelection } from 'ahooks';\n\nexport default () => {\n const { text } = useTextSelection();\n return (\n <div>\n <p>You can select text all page.</p>\n <p>Result\uff1a{text}</p>\n </div>\n );\n};",We="import React, { useRef } from 'react';\nimport { useTextSelection } from 'ahooks';\n\nexport default () => {\n const ref = useRef();\n const selection = useTextSelection(ref);\n return (\n <div>\n <div ref={ref} style={{ border: '1px solid', padding: 20 }}>\n <p>Please swipe your mouse to select any text on this paragraph.</p>\n </div>\n <p>Result\uff1a{JSON.stringify(selection)}</p>\n </div>\n );\n};",Je="import { useRequest, useTextSelection } from 'ahooks';\nimport { Popover, Spin } from 'antd';\nimport React, { useEffect, useState } from 'react';\n\nconst getResult = (keyword: string): Promise<string> => {\n const trimedText = keyword.trim() !== '';\n if (!trimedText) {\n return Promise.resolve('');\n }\n return new Promise((resolve) => {\n setTimeout(() => resolve(`[translate result] ${keyword}`), 2000);\n });\n};\n\nexport default () => {\n const { text = '', left = 0, top = 0, height = 0, width = 0 } = useTextSelection(() =>\n document.querySelector('#translate-dom'),\n );\n\n const [visible, setVisible] = useState(false);\n\n const { data, run, loading } = useRequest(getResult, {\n manual: true,\n });\n\n useEffect(() => {\n if (text.trim() === '') {\n setVisible(false);\n return;\n }\n setVisible(true);\n run(text);\n }, [text]);\n\n return (\n <div>\n <p id=\"translate-dom\" style={{ padding: 20, border: '1px solid' }}>\n Translation of this paragraph;Translation of this paragraph;Translation of this paragraph;\n </p>\n <Popover\n content={<Spin spinning={loading}>{loading ? 'Translating\u2026\u2026' : data}</Spin>}\n visible={visible}\n >\n <span\n style={{\n position: 'fixed',\n top: `${top}px`,\n left: `${left}px`,\n height: `${height}px`,\n width: `${width}px`,\n pointerEvents: 'none',\n }}\n />\n </Popover>\n </div>\n );\n};",Ye="import React, { useState } from 'react';\nimport { useThrottle } from 'ahooks';\n\nexport default () => {\n const [value, setValue] = useState<string>();\n const throttledValue = useThrottle(value, { wait: 500 });\n\n return (\n <div>\n <input\n value={value}\n onChange={(e) => setValue(e.target.value)}\n placeholder=\"Typed value\"\n style={{ width: 280 }}\n />\n <p style={{ marginTop: 16 }}>throttledValue: {throttledValue}</p>\n </div>\n );\n};",Ge="import React, { useState } from 'react';\nimport { useThrottleEffect } from 'ahooks';\n\nexport default () => {\n const [value, setValue] = useState('hello');\n const [records, setRecords] = useState<string[]>([]);\n useThrottleEffect(\n () => {\n setRecords((val) => [...val, value]);\n },\n [value],\n {\n wait: 1000,\n },\n );\n return (\n <div>\n <input\n value={value}\n onChange={(e) => setValue(e.target.value)}\n placeholder=\"Typed value\"\n style={{ width: 280 }}\n />\n <p style={{ marginTop: 16 }}>\n <ul>\n {records.map((record, index) => (\n <li key={index}>{record}</li>\n ))}\n </ul>\n </p>\n </div>\n );\n};",Ze="import React, { useState } from 'react';\nimport { useThrottleFn } from 'ahooks';\n\nexport default () => {\n const [value, setValue] = useState(0);\n const { run } = useThrottleFn(\n () => {\n setValue(value + 1);\n },\n { wait: 500 },\n );\n\n return (\n <div>\n <p style={{ marginTop: 16 }}> Clicked count: {value} </p>\n <button type=\"button\" onClick={run}>\n Click fast!\n </button>\n </div>\n );\n};",Qe="import React, { useState } from 'react';\nimport { useTimeout } from 'ahooks';\n\nexport default () => {\n const [state, setState] = useState(1);\n useTimeout(() => {\n setState(state + 1);\n }, 3000);\n\n return (\n <div>\n <p style={{ marginTop: 16 }}> {state} </p>\n </div>\n );\n};",Xe="import React from 'react';\nimport { useTitle } from 'ahooks';\n\nexport default () => {\n useTitle('Page Title');\n\n return (\n <div>\n <p>sets title of the page.</p>\n </div>\n );\n};",en="import React from 'react';\nimport { useToggle } from 'ahooks';\n\nexport default () => {\n const [state, { toggle }] = useToggle();\n\n return (\n <div>\n <p>Effects\uff1a{`${state}`}</p>\n <p>\n <button type=\"button\" onClick={() => toggle()}>\n Toggle\n </button>\n <button type=\"button\" onClick={() => toggle(false)} style={{ margin: '0 8px' }}>\n Toggle False\n </button>\n <button type=\"button\" onClick={() => toggle(true)}>\n Toggle True\n </button>\n </p>\n </div>\n );\n};",nn="import React from 'react';\nimport { useToggle } from 'ahooks';\n\nexport default () => {\n const [state, { toggle, setLeft, setRight }] = useToggle('Hello', 'World');\n\n return (\n <div>\n <p>Effects\uff1a{state}</p>\n <p>\n <button type=\"button\" onClick={() => toggle()}>\n Toggle\n </button>\n <button type=\"button\" onClick={() => toggle('Hello')} style={{ margin: '0 8px' }}>\n Toggle Hello\n </button>\n <button type=\"button\" onClick={() => toggle('World')}>\n Toggle World\n </button>\n <button type=\"button\" onClick={setLeft} style={{ margin: '0 8px' }}>\n Set Hello\n </button>\n <button type=\"button\" onClick={setRight}>\n Set World\n </button>\n </p>\n </div>\n );\n};",tn='import React, { useLayoutEffect, useState } from \'react\';\nimport { useTrackedEffect } from \'ahooks\';\n\nexport default () => {\n const [dep1, setDep1] = useState(0);\n const [dep2, setDep2] = useState(0);\n const [dep3, setDep3] = useState(0);\n const [depActiveList, setDepActiveList] = useState([false, false, false]);\n const [text, setText] = useState(\'Hi there...\');\n const toggleDep = (idx) => {\n const newList = [...depActiveList];\n newList[idx] = !newList[idx];\n setDepActiveList(newList);\n };\n const mutateDep = () => {\n setText(``);\n depActiveList[0] && setDep1((c) => c + 1);\n depActiveList[1] && setDep2((c) => c + 1);\n depActiveList[2] && setDep3((c) => c + 1);\n };\n useTrackedEffect(\n (changes) => {\n setText(`Index of changed dependencies: ` + changes);\n return () => {\n // do something\n };\n },\n [dep1, dep2, dep3],\n );\n return (\n <div>\n <p>\n <input type="checkbox" checked={depActiveList[0]} onChange={() => toggleDep(0)} />\n Dependency 0 : {dep1}\n </p>\n <p>\n <input type="checkbox" checked={depActiveList[1]} onChange={() => toggleDep(1)} />\n Dependency 1 : {dep2}\n </p>\n <p>\n <input type="checkbox" checked={depActiveList[2]} onChange={() => toggleDep(2)} />\n Dependency 2 : {dep3}\n </p>\n <p>\n <button type="button" onClick={mutateDep}>\n Increase count\n </button>\n </p>\n <p>{text}</p>\n </div>\n );\n};',rn="import { useToggle, useUnmount } from 'ahooks';\nimport { message } from 'antd';\nimport React from 'react';\n\nconst MyComponent = () => {\n useUnmount(() => {\n message.info('unmount');\n });\n\n return <div>Hello World</div>;\n};\n\nexport default () => {\n const [state, { toggle }] = useToggle(true);\n\n return (\n <>\n <button type=\"button\" onClick={() => toggle()}>\n {state ? 'unmount' : 'mount'}\n </button>\n {state && <MyComponent />}\n </>\n );\n};",on="import React, { useState } from 'react';\nimport { useUnmountedRef } from 'ahooks';\n\nconst Button = ({ setVisible }) => {\n const unmountRef: { current: boolean } = useUnmountedRef();\n const [text, setText] = useState('I am mounted');\n const handleClick = async () => {\n await setVisible();\n !unmountRef.current && setText('I am unmounted');\n };\n return <button onClick={handleClick}>{text}</button>;\n};\n\nexport default () => {\n const [visible, setVisible] = useState(true);\n return (\n <div>\n click the button to unmount it\n <br />\n {visible ? <Button setVisible={() => setVisible(false)} /> : 'nothing'}\n </div>\n );\n};",an="import React from 'react';\nimport { useUpdate } from 'ahooks';\n\nexport default () => {\n const update = useUpdate();\n\n return (\n <>\n <div>Time: {Date.now()}</div>\n <button type=\"button\" onClick={update} style={{ marginTop: 8 }}>\n update\n </button>\n </>\n );\n};",sn="import React, { useEffect, useState } from 'react';\nimport { useUpdateEffect } from 'ahooks';\n\nexport default () => {\n const [count, setCount] = useState(0);\n const [effectCount, setEffectCount] = useState(0);\n const [updateEffectCount, setUpdateEffectCount] = useState(0);\n\n useEffect(() => {\n setEffectCount((c) => c + 1);\n }, [count]);\n\n useUpdateEffect(() => {\n setUpdateEffectCount((c) => c + 1);\n return () => {\n // do something\n };\n }, [count]); // you can include deps array if necessary\n\n return (\n <div>\n <p>effectCount: {effectCount}</p>\n <p>updateEffectCount: {updateEffectCount}</p>\n <p>\n <button type=\"button\" onClick={() => setCount((c) => c + 1)}>\n reRender\n </button>\n </p>\n </div>\n );\n};",un="import React, { useLayoutEffect, useState } from 'react';\nimport { useUpdateLayoutEffect } from 'ahooks';\n\nexport default () => {\n const [count, setCount] = useState(0);\n const [layoutEffectCount, setLayoutEffectCount] = useState(0);\n const [updateLayoutEffectCount, setUpdateLayoutEffectCount] = useState(0);\n\n useLayoutEffect(() => {\n setLayoutEffectCount((c) => c + 1);\n }, [count]);\n\n useUpdateLayoutEffect(() => {\n setUpdateLayoutEffectCount((c) => c + 1);\n return () => {\n // do something\n };\n }, [count]); // you can include deps array if necessary\n\n return (\n <div>\n <p>layoutEffectCount: {layoutEffectCount}</p>\n <p>updateLayoutEffectCount: {updateLayoutEffectCount}</p>\n <p>\n <button type=\"button\" onClick={() => setCount((c) => c + 1)}>\n reRender\n </button>\n </p>\n </div>\n );\n};",cn="import React from 'react';\nimport { useVirtualList } from 'ahooks';\n\nexport default () => {\n const { list, containerProps, wrapperProps } = useVirtualList(Array.from(Array(99999).keys()), {\n overscan: 30,\n itemHeight: 60,\n });\n return (\n <>\n <div {...containerProps} style={{ height: '300px', overflow: 'auto' }}>\n <div {...wrapperProps}>\n {list.map((ele) => (\n <div\n style={{\n height: 52,\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n border: '1px solid #e8e8e8',\n marginBottom: 8,\n }}\n key={ele.index}\n >\n Row: {ele.data}\n </div>\n ))}\n </div>\n </div>\n </>\n );\n};",ln="import React from 'react';\nimport { useVirtualList } from 'ahooks';\n\nexport default () => {\n const [value, onChange] = React.useState<number>(0);\n const { list, containerProps, wrapperProps, scrollTo } = useVirtualList(\n Array.from(Array(99999).keys()),\n {\n itemHeight: (i) => (i % 2 === 0 ? 42 + 8 : 84 + 8),\n overscan: 10,\n },\n );\n\n return (\n <div>\n <div style={{ textAlign: 'right', marginBottom: 16 }}>\n <input\n style={{ width: 120 }}\n placeholder=\"line number\"\n type=\"number\"\n value={value}\n onChange={(e) => onChange(Number(e.target.value))}\n />\n <button\n style={{ marginLeft: 8 }}\n type=\"button\"\n onClick={() => {\n scrollTo(Number(value));\n }}\n >\n scroll to\n </button>\n </div>\n <div {...containerProps} style={{ height: '300px', overflow: 'auto' }}>\n <div {...wrapperProps}>\n {list.map((ele) => (\n <div\n style={{\n height: ele.index % 2 === 0 ? 42 : 84,\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n border: '1px solid #e8e8e8',\n marginBottom: 8,\n }}\n key={ele.index}\n >\n Row: {ele.data} size: {ele.index % 2 === 0 ? 'small' : 'large'}\n </div>\n ))}\n </div>\n </div>\n </div>\n );\n};",dn="import React, { useRef, useMemo } from 'react';\nimport { useWebSocket } from 'ahooks';\n\nenum ReadyState {\n Connecting = 0,\n Open = 1,\n Closing = 2,\n Closed = 3,\n}\n\nexport default () => {\n const messageHistory = useRef([]);\n\n const { readyState, sendMessage, latestMessage, disconnect, connect } = useWebSocket(\n 'wss://echo.websocket.org',\n );\n\n messageHistory.current = useMemo(() => messageHistory.current.concat(latestMessage), [\n latestMessage,\n ]);\n\n return (\n <div>\n {/* send message */}\n <button\n onClick={() => sendMessage && sendMessage(`${Date.now()}`)}\n disabled={readyState !== ReadyState.Open}\n style={{ marginRight: 8 }}\n >\n \u2709\ufe0f send\n </button>\n {/* disconnect */}\n <button\n onClick={() => disconnect && disconnect()}\n disabled={readyState !== ReadyState.Open}\n style={{ marginRight: 8 }}\n >\n \u274c disconnect\n </button>\n {/* connect */}\n <button onClick={() => connect && connect()} disabled={readyState === ReadyState.Open}>\n \ud83d\udcde connect\n </button>\n <div style={{ marginTop: 8 }}>readyState: {readyState}</div>\n <div style={{ marginTop: 8 }}>\n <p>received message: </p>\n {messageHistory.current.map((message, index) => (\n <p key={index}>{message?.data}</p>\n ))}\n </div>\n </div>\n );\n};",pn="import { useWhyDidYouUpdate } from 'ahooks';\nimport React, { useState } from 'react';\n\nconst Demo: React.FC<{ count: number }> = (props) => {\n const [randomNum, setRandomNum] = useState(Math.random());\n\n useWhyDidYouUpdate('useWhyDidYouUpdateComponent', { ...props, randomNum });\n\n return (\n <div>\n <div>\n <span>number: {props.count}</span>\n </div>\n <div>\n randomNum: {randomNum}\n <button onClick={() => setRandomNum(Math.random)} style={{ marginLeft: 8 }}>\n \ud83c\udfb2\n </button>\n </div>\n </div>\n );\n};\n\nexport default () => {\n const [count, setCount] = useState(0);\n\n return (\n <div>\n <Demo count={count} />\n <div>\n <button onClick={() => setCount((prevCount) => prevCount - 1)}>count -</button>\n <button onClick={() => setCount((prevCount) => prevCount + 1)} style={{ marginLeft: 8 }}>\n count +\n </button>\n </div>\n <p>Please open the browser console to view the output!</p>\n </div>\n );\n};",mn="import { useRequest } from 'ahooks';\nimport Mock from 'mockjs';\nimport React from 'react';\n\nfunction getUsername(): Promise<string> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(Mock.mock('@name'));\n }, 1000);\n });\n}\n\nexport default () => {\n const { data, error, loading } = useRequest(getUsername);\n\n if (error) {\n return <div>failed to load</div>;\n }\n if (loading) {\n return <div>loading...</div>;\n }\n return <div>Username: {data}</div>;\n};",fn="import { useRequest } from 'ahooks';\nimport { message } from 'antd';\nimport React, { useState } from 'react';\n\nfunction changeUsername(username: string): Promise<{ success: boolean }> {\n console.log(username);\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve({ success: true });\n }, 1000);\n });\n}\n\nexport default () => {\n const [state, setState] = useState('');\n const { loading, run } = useRequest(changeUsername, {\n manual: true,\n onSuccess: (result, params) => {\n if (result.success) {\n setState('');\n message.success(`The username was changed to \"${params[0]}\" !`);\n }\n },\n });\n\n return (\n <div>\n <input\n onChange={(e) => setState(e.target.value)}\n value={state}\n placeholder=\"Please enter username\"\n style={{ width: 240, marginRight: 16 }}\n />\n <button disabled={loading} type=\"button\" onClick={() => run(state)}>\n {loading ? 'loading' : 'Edit'}\n </button>\n </div>\n );\n};",vn="import { useRequest } from 'ahooks';\nimport React from 'react';\nimport Mock from 'mockjs';\n\nfunction getUsername(): Promise<string> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(Mock.mock('@name'));\n }, 1000);\n });\n}\n\nexport default () => {\n const { data, loading, run, cancel } = useRequest(getUsername, {\n pollingInterval: 1000,\n pollingWhenHidden: false,\n });\n\n return (\n <>\n <p>Username: {loading ? 'loading' : data}</p>\n <button type=\"button\" onClick={run}>\n start\n </button>\n <button type=\"button\" onClick={cancel} style={{ marginLeft: 8 }}>\n stop\n </button>\n </>\n );\n};",hn="import { useRequest } from 'ahooks';\nimport { message } from 'antd';\nimport React from 'react';\n\nexport function deleteUser(userId: string): Promise<{ success: boolean }> {\n console.log(userId);\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve({ success: true });\n }, 1000);\n });\n}\n\nexport default () => {\n const { run, fetches } = useRequest(deleteUser, {\n manual: true,\n fetchKey: (id) => id,\n onSuccess: (result, params) => {\n if (result.success) {\n message.success(`Disabled user ${params[0]}`);\n }\n },\n });\n\n const users = [\n { id: '1', username: 'A' },\n { id: '2', username: 'B' },\n { id: '3', username: 'C' },\n ];\n\n return (\n <div>\n <div>You can click all buttons, each request has its own status.</div>\n <ul>\n {users.map((user) => (\n <li key={user.id} style={{ marginTop: 8 }}>\n <button\n type=\"button\"\n onClick={() => {\n run(user.id);\n }}\n disabled={fetches[user.id]?.loading}\n >\n {fetches[user.id]?.loading ? 'loading' : `delete ${user.username}`}\n </button>\n </li>\n ))}\n </ul>\n </div>\n );\n};",bn="import { useRequest } from 'ahooks';\nimport Mock from 'mockjs';\nimport React from 'react';\n\nfunction getUserId(): Promise<number> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(1011);\n }, 1000);\n });\n}\n\nfunction getUsername(id: number): Promise<string> {\n console.log('user id:', id);\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(Mock.mock('@name'));\n }, 1000);\n });\n}\n\nexport default () => {\n const userIdRequest = useRequest(getUserId);\n\n const usernameRequest = useRequest(() => getUsername(userIdRequest.data), {\n ready: !!userIdRequest.data,\n });\n\n return (\n <div>\n <p>UserId: {userIdRequest.loading ? 'loading' : userIdRequest.data}</p>\n <p>Username: {usernameRequest.loading ? 'loading' : usernameRequest.data}</p>\n </div>\n );\n};",gn="import { useRequest } from 'ahooks';\nimport Mock from 'mockjs';\nimport React from 'react';\n\nasync function getEmail(search: string): Promise<string[]> {\n console.log(search);\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(Mock.mock({ 'data|5': ['@email'] }).data);\n }, 300);\n });\n}\n\nexport default () => {\n const { data, loading, run } = useRequest(getEmail, {\n debounceInterval: 500,\n manual: true,\n });\n\n return (\n <div>\n <p>Enter quickly to see the effect</p>\n <input placeholder=\"Select Emails\" onChange={(e) => run(e.target.value)} />\n {loading ? (\n <p>loading</p>\n ) : (\n <ul style={{ marginTop: 8 }}>\n {data?.map((i) => (\n <li key={i}>{i}</li>\n ))}\n </ul>\n )}\n </div>\n );\n};",yn="import { useRequest } from 'ahooks';\nimport Mock from 'mockjs';\nimport React from 'react';\n\nasync function getEmail(search: string): Promise<string[]> {\n console.log(search);\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(Mock.mock({ 'data|5': ['@email'] }).data);\n }, 100);\n });\n}\n\nexport default () => {\n const { data, loading, run } = useRequest(getEmail, {\n throttleInterval: 500,\n manual: true,\n });\n\n return (\n <div>\n <p>Enter quickly to see the effect</p>\n <input placeholder=\"Select Emails\" onChange={(e) => run(e.target.value)} />\n {loading ? (\n <p>loading</p>\n ) : (\n <ul style={{ marginTop: 8 }}>\n {data?.map((i) => (\n <li key={i}>{i}</li>\n ))}\n </ul>\n )}\n </div>\n );\n};",wn="import { useBoolean, useRequest } from 'ahooks';\nimport Mock from 'mockjs';\nimport React from 'react';\n\nasync function getArticle(): Promise<{ data: string; time: number }> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve({\n data: Mock.mock('@paragraph'),\n time: new Date().getTime(),\n });\n }, 1000);\n });\n}\n\nconst Article = () => {\n const { data, loading } = useRequest(getArticle, {\n cacheKey: 'article',\n });\n if (!data && loading) {\n return <p>loading</p>;\n }\n return (\n <>\n <p>Latest request time: {data?.time}</p>\n <p>{data?.data}</p>\n </>\n );\n};\n\nexport default () => {\n const [state, { toggle }] = useBoolean();\n return (\n <div>\n <p>\n You can click the button multiple times, the article component will show the cached data\n first.\n </p>\n <p>\n <button type=\"button\" onClick={() => toggle()}>\n show/hidden\n </button>\n </p>\n {state && <Article />}\n </div>\n );\n};",kn="import { useBoolean, useRequest } from 'ahooks';\nimport Mock from 'mockjs';\nimport React from 'react';\n\nasync function getArticle(type?: string): Promise<{ data: string; time: number }> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve({\n data: Mock.mock('@paragraph'),\n time: new Date().getTime(),\n });\n }, 1000);\n });\n}\n\nexport default () => {\n const [state, { toggle }] = useBoolean();\n const { run } = useRequest(getArticle, {\n cacheKey: 'article',\n manual: true,\n });\n return (\n <div>\n <p>When the mouse hovers over the button, the article data is preloaded.</p>\n <p>\n <button type=\"button\" onMouseEnter={() => run()} onClick={() => toggle()}>\n show/hidden\n </button>\n </p>\n {state && <Article />}\n </div>\n );\n};\n\nconst Article = () => {\n const { data, loading } = useRequest(getArticle, {\n cacheKey: 'article',\n });\n\n if (!data && loading) {\n return <p>loading</p>;\n }\n\n return (\n <>\n <p>Latest request time: {data?.time}</p>\n <p>{data?.data}</p>\n </>\n );\n};",xn="import { useRequest } from 'ahooks';\nimport { Spin } from 'antd';\nimport React from 'react';\nimport Mock from 'mockjs';\n\nfunction getUsername(): Promise<string> {\n const userInfo = Mock.mock('@name');\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(userInfo);\n }, 1000);\n });\n}\n\nexport default () => {\n const { data, loading } = useRequest(getUsername, {\n refreshOnWindowFocus: true,\n });\n\n return (\n <div>\n <p>\n You can try to click elsewhere and click back to try. (Or hide the page and show it again)\n </p>\n <Spin spinning={loading}>\n <div>Username: {data}</div>\n </Spin>\n </div>\n );\n};",Cn="import { useRequest } from 'ahooks';\nimport Mock from 'mockjs';\nimport React, { useState } from 'react';\n\nfunction getUsername(): Promise<string> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(Mock.mock('@name'));\n }, 1000);\n });\n}\n\nexport default () => {\n const [state, setState] = useState('');\n const { data, mutate } = useRequest(getUsername, {\n onSuccess: (result) => {\n setState(result);\n },\n });\n\n return (\n <div>\n <p>usrename: {data}</p>\n <input\n onChange={(e) => setState(e.target.value)}\n value={state}\n placeholder=\"Please enter username\"\n style={{ width: 240, marginRight: 16 }}\n />\n <button type=\"button\" onClick={() => mutate(state)}>\n Edit\n </button>\n </div>\n );\n};",Sn="import { useRequest } from 'ahooks';\nimport React from 'react';\n\nasync function getCurrentTime(): Promise<number> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(new Date().getTime());\n }, 100);\n });\n}\n\nexport default () => {\n const getTimeAction = useRequest(getCurrentTime);\n\n const withLoadingDelayAction = useRequest(getCurrentTime, {\n loadingDelay: 200,\n });\n\n const trigger = () => {\n getTimeAction.run();\n withLoadingDelayAction.run();\n };\n\n return (\n <div>\n <p>\n loadingDelay can set delay loading, which can effectively prevent loading from flickering.\n </p>\n <button type=\"button\" onClick={trigger}>\n run\n </button>\n\n <div style={{ margin: '24px 0', width: 300 }}>\n Current Time: {getTimeAction.loading ? 'loading' : getTimeAction.data}\n </div>\n <div>\n Current Time: {withLoadingDelayAction.loading ? 'loading' : withLoadingDelayAction.data}\n </div>\n </div>\n );\n};",Pn="import { useRequest } from 'ahooks';\nimport React, { useState } from 'react';\n\nconst userSchool = (id: string) => {\n switch (id) {\n case '1':\n return 'Tsinghua University';\n case '2':\n return 'Beijing University';\n case '3':\n return 'Zhejiang University';\n default:\n return '';\n }\n};\n\nasync function getUserSchool(userId: string): Promise<string> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(userSchool(userId));\n }, 1000);\n });\n}\n\nexport default () => {\n const [userId, setUserId] = useState('1');\n const { data, loading } = useRequest(() => getUserSchool(userId), {\n refreshDeps: [userId],\n });\n\n return (\n <div>\n <select\n onChange={(e) => setUserId(e.target.value)}\n value={userId}\n style={{ marginBottom: 16, width: 120 }}\n >\n <option value=\"1\">user 1</option>\n <option value=\"2\">user 2</option>\n <option value=\"3\">user 3</option>\n </select>\n <p>School: {loading ? 'loading' : data}</p>\n </div>\n );\n};",Rn="import { useRequest } from 'ahooks';\nimport React from 'react';\n\nexport default () => {\n const { data, error, loading } = useRequest('https://helloacm.com/api/random/?n=8&x=4');\n\n if (error) {\n return <div>failed to load</div>;\n }\n if (loading) {\n return <div>loading...</div>;\n }\n return <div>Number: {data}</div>;\n};",On="import { useRequest } from 'ahooks';\nimport React from 'react';\nimport axios from 'axios';\n\nexport default () => {\n const { data, error, loading } = useRequest('https://helloacm.com/api/random/?n=8&x=4', {\n requestMethod: (param: any) => axios(param),\n });\n if (error) {\n return <div>failed to load</div>;\n }\n if (loading) {\n return <div>loading...</div>;\n }\n return <div>Number: {data?.data}</div>;\n};",jn="import { useRequest } from 'ahooks';\nimport React from 'react';\nimport { List, Pagination } from 'antd';\nimport Mock from 'mockjs';\n\ninterface UserListItem {\n id: string;\n name: string;\n gender: 'male' | 'female';\n email: string;\n disabled: boolean;\n}\n\nconst userList = (current, pageSize) =>\n Mock.mock({\n total: 55,\n [`list|${pageSize}`]: [\n {\n id: '@guid',\n name: '@cname',\n 'gender|1': ['male', 'female'],\n email: '@email',\n disabled: false,\n },\n ],\n });\n\nasync function getUserList(params: {\n current: number;\n pageSize: number;\n gender?: string;\n}): Promise<{ total: number; list: UserListItem[] }> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(userList(params.current, params.pageSize));\n }, 1000);\n });\n}\n\nexport default () => {\n const { data, loading, pagination } = useRequest(\n ({ current, pageSize }) => getUserList({ current, pageSize }),\n {\n paginated: true,\n },\n );\n return (\n <div>\n {loading ? (\n <p>loading</p>\n ) : (\n <ul>\n {data?.list?.map((item) => (\n <li key={item.email}>\n {item.name} - {item.email}\n </li>\n ))}\n </ul>\n )}\n <Pagination\n {...(pagination as any)}\n showQuickJumper\n showSizeChanger\n onShowSizeChange={pagination.onChange}\n style={{ marginTop: 16, textAlign: 'right' }}\n />\n </div>\n );\n};",In="import { useRequest } from 'ahooks';\nimport React from 'react';\nimport { Table, Button } from 'antd';\nimport Mock from 'mockjs';\n\ninterface UserListItem {\n id: string;\n name: string;\n gender: 'male' | 'female';\n email: string;\n disabled: boolean;\n}\n\nconst userList = (current, pageSize) =>\n Mock.mock({\n total: 55,\n [`list|${pageSize}`]: [\n {\n id: '@guid',\n name: '@cname',\n 'gender|1': ['male', 'female'],\n email: '@email',\n disabled: false,\n },\n ],\n });\n\nasync function getUserList(params: {\n current: number;\n pageSize: number;\n gender?: string;\n}): Promise<{ total: number; list: UserListItem[] }> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(userList(params.current, params.pageSize));\n }, 1000);\n });\n}\n\nexport default () => {\n const { tableProps, params, refresh } = useRequest(\n ({ current, pageSize, sorter: s, filters: f }) => {\n const p: any = { current, pageSize };\n if (s?.field && s?.order) {\n p[s.field] = s.order;\n }\n if (f) {\n Object.entries(f).forEach(([filed, value]) => {\n p[filed] = value;\n });\n }\n console.log(p);\n return getUserList(p);\n },\n {\n paginated: true,\n defaultPageSize: 5,\n },\n );\n\n // you can read sorter and filters from params[0]\n const { sorter = {}, filters = {} } = params[0] || ({} as any);\n\n const columns = [\n {\n title: 'name',\n dataIndex: 'name',\n },\n {\n title: 'email',\n dataIndex: 'email',\n },\n {\n title: 'id',\n dataIndex: 'id',\n sorter: true,\n sortOrder: sorter.field === 'id' ? sorter.order : false,\n },\n {\n title: 'gender',\n dataIndex: 'gender',\n filters: [\n { text: 'male', value: 'male' },\n { text: 'female', value: 'female' },\n ],\n filteredValue: filters.gender,\n },\n ];\n\n return (\n <div>\n <Button onClick={refresh} style={{ marginBottom: 16 }}>\n \u5237\u65b0\n </Button>\n <Table columns={columns} rowKey=\"id\" {...tableProps} />\n </div>\n );\n};",Tn="import { useBoolean, useRequest, useUpdateEffect } from 'ahooks';\nimport { Pagination } from 'antd';\nimport Mock from 'mockjs';\nimport React, { useState } from 'react';\n\ninterface UserListItem {\n id: string;\n name: string;\n gender: 'male' | 'female';\n email: string;\n disabled: boolean;\n}\n\nconst userList = (current, pageSize) =>\n Mock.mock({\n total: 55,\n [`list|${pageSize}`]: [\n {\n id: '@guid',\n name: '@cname',\n 'gender|1': ['male', 'female'],\n email: '@email',\n disabled: false,\n },\n ],\n });\n\nasync function getUserList(params: {\n current: number;\n pageSize: number;\n gender?: string;\n}): Promise<{ total: number; list: UserListItem[] }> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve(userList(params.current, params.pageSize));\n }, 1000);\n });\n}\n\nexport default () => {\n const [state, { toggle }] = useBoolean();\n return (\n <div>\n <p>You can click the button multiple times, the conditions of pagination will be cached.</p>\n <p>\n <button type=\"button\" onClick={() => toggle()}>\n show/hidden\n </button>\n </p>\n {state && <PaginationComponent />}\n </div>\n );\n};\n\nconst PaginationComponent = () => {\n const { params, run, data, loading, pagination } = useRequest(\n (p, gender?: string) => getUserList({ ...p, gender }),\n {\n cacheKey: 'paginationDemo',\n paginated: true,\n },\n );\n\n const [gender, setGender] = useState<string>(params[1]);\n\n useUpdateEffect(() => {\n // reload when gender change\n run(\n {\n current: 1,\n pageSize: 10,\n },\n gender,\n );\n }, [gender]);\n\n return (\n <div>\n <select\n value={gender}\n style={{ width: 180, marginBottom: 24 }}\n onChange={(e) => setGender(e.target.value)}\n placeholder=\"select gender\"\n >\n <option value=\"male\">male</option>\n <option value=\"female\">female</option>\n </select>\n {loading ? (\n <p>loading</p>\n ) : (\n <ul>\n {data?.list?.map((item) => (\n <li key={item.email}>\n {item.name} - {item.email}\n </li>\n ))}\n </ul>\n )}\n <Pagination\n {...(pagination as any)}\n showQuickJumper\n showSizeChanger\n onShowSizeChange={pagination.onChange}\n style={{ marginTop: 16, textAlign: 'right' }}\n />\n </div>\n );\n};",zn="import { useBoolean, useRequest } from 'ahooks';\nimport { Button, Spin, List, Typography } from 'antd';\nimport React from 'react';\n\ninterface Item {\n id?: string;\n name: string;\n}\n\ninterface Result {\n list: Item[];\n nextId: string | undefined;\n}\n\nconst resultData = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];\n\nexport async function getLoadMoreList(nextId: any, limit: any): Promise<Result> {\n let start = 0;\n if (nextId) {\n start = resultData.findIndex((i) => i === nextId);\n }\n const end = start + limit;\n const list = resultData.slice(start, end).map((id) => ({\n id,\n name: `project ${id} (server time: ${Date.now()})`,\n }));\n const nId = resultData.length >= end ? resultData[end] : undefined;\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve({\n list,\n nextId: nId,\n });\n }, 1000);\n });\n}\n\nexport default () => {\n const [state, { toggle }] = useBoolean(true);\n return (\n <div>\n <p>You can click the button multiple times, the loadmore will be cached.</p>\n <p>\n <button type=\"button\" onClick={() => toggle()}>\n show/hidden\n </button>\n </p>\n {state && <LoadMoreComponent />}\n </div>\n );\n};\n\nconst LoadMoreComponent = () => {\n const { data, loading, loadMore, loadingMore } = useRequest(\n (d: Result | undefined) => getLoadMoreList(d?.nextId, 3),\n {\n loadMore: true,\n cacheKey: 'loadMoreDemoCacheId',\n },\n );\n\n return (\n <div>\n {loading ? (\n <p>loading</p>\n ) : (\n <ul>\n {data?.list?.map((item) => (\n <li key={item.id}>\n {item.id} - {item.name}\n </li>\n ))}\n </ul>\n )}\n\n {loadingMore ? (\n 'load more...'\n ) : (\n <button type=\"button\" onClick={loadMore} disabled={!data?.nextId}>\n {data?.nextId ? 'click to load more' : 'no more'}\n </button>\n )}\n </div>\n );\n};",Fn="import { useRequest } from 'ahooks';\nimport React, { useRef } from 'react';\n\ninterface Item {\n id: number;\n title: string;\n}\n\ninterface Result {\n total: number;\n list: Item[];\n}\n\nconst dataSource = [\n {\n id: 1,\n title: 'ahooks title 1',\n },\n {\n id: 2,\n title: 'ahooks title 2',\n },\n {\n id: 3,\n title: 'ahooks title 3',\n },\n {\n id: 4,\n title: 'ahooks title 4',\n },\n {\n id: 5,\n title: 'ahooks title 5',\n },\n {\n id: 6,\n title: 'ahooks title 6',\n },\n {\n id: 7,\n title: 'ahooks title 7',\n },\n {\n id: 8,\n title: 'ahooks title 8',\n },\n {\n id: 9,\n title: 'ahooks title 9',\n },\n {\n id: 10,\n title: 'ahooks title 10',\n },\n];\n\nconst asyncFn = ({ pageSize, offset }: any): Promise<Result> =>\n new Promise((resolve) => {\n setTimeout(() => {\n resolve({\n total: dataSource.length,\n list: dataSource.slice(offset, offset + pageSize),\n });\n }, 1000);\n });\n\nexport default () => {\n const containerRef = useRef<HTMLDivElement>(null);\n const { data, loading, loadingMore, reload, loadMore, noMore } = useRequest(\n (d: Result | undefined) =>\n asyncFn({\n offset: d?.list?.length || 0,\n pageSize: 3,\n }),\n {\n loadMore: true,\n ref: containerRef,\n isNoMore: (d) => (d ? d.list.length >= d.total : false),\n },\n );\n\n const { list = [] } = data || {};\n\n return (\n <div ref={containerRef} style={{ height: 200, overflowY: 'auto' }}>\n <button type=\"button\" onClick={reload} disabled={loading}>\n {loading ? 'loading' : 'Reload'}\n </button>\n <ul>\n {list.map((item) => (\n <li style={{ height: 50, borderBottom: '1px', lineHeight: '50px' }}>{item.title}</li>\n ))}\n </ul>\n <div>\n {!noMore && (\n <button type=\"button\" onClick={loadMore} disabled={loadingMore}>\n {loadingMore ? 'Loading more...' : 'Click to load more'}\n </button>\n )}\n\n {noMore && <span>No more data</span>}\n\n <span style={{ float: 'right', fontSize: 12 }}>total: {data?.total}</span>\n </div>\n </div>\n );\n};",Nn="import React from 'react';\nimport useUrlState from '@ahooksjs/use-url-state';\n\nexport default () => {\n const [state, setState] = useUrlState({ count: '1' });\n\n return (\n <>\n <button\n style={{ marginRight: 8 }}\n type=\"button\"\n onClick={() => setState({ count: Number(state.count || 0) + 1 })}\n >\n add\n </button>\n <button type=\"button\" onClick={() => setState({ count: undefined })}>\n clear\n </button>\n <div>state: {state?.count}</div>\n </>\n );\n};",Dn="import React from 'react';\nimport useUrlState from '@ahooksjs/use-url-state';\n\nexport default () => {\n const [state, setState] = useUrlState(\n { page: '1', pageSize: '10' },\n {\n navigateMode: 'push',\n },\n );\n\n return (\n <>\n <div>\n page: {state.page}\n <span style={{ paddingLeft: 8 }}>\n <button\n onClick={() => {\n setState((s) => ({ page: Number(s.page) + 1 }));\n }}\n >\n +\n </button>\n <button\n onClick={() => {\n setState((s) => ({ page: Number(s.page) - 1 }));\n }}\n style={{ margin: '0 8px' }}\n >\n -\n </button>\n <button\n onClick={() => {\n setState({ page: 1 });\n }}\n >\n reset\n </button>\n </span>\n </div>\n <br />\n <div>\n pageSize: {state.pageSize}\n <span style={{ paddingLeft: 8 }}>\n <button\n onClick={() => {\n setState((s) => ({ pageSize: Number(s.pageSize) + 1 }));\n }}\n >\n +\n </button>\n <button\n onClick={() => {\n setState((s) => ({ pageSize: Number(s.pageSize) - 1 }));\n }}\n style={{ margin: '0 8px' }}\n >\n -\n </button>\n <button\n onClick={() => {\n setState({ pageSize: 10 });\n }}\n >\n reset\n </button>\n </span>\n </div>\n </>\n );\n};";n["default"]={"useantdtable-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"pW5W"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:i}},dependencies:{antd:{version:"4.15.3",css:"antd/dist/antd.css"},react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"},"react-dom":{version:">=16.9.0"}},title:"Form and Table data binding","title.zh-CN":"Form \u4e0e Table \u8054\u52a8",description:'<div class="markdown"><p>useAntdTable returns a search object after receiving a form instance. This is an example of antd v3, see <a href="https://github.com/alibaba/hooks/blob/master/packages/hooks/src/useAntdTable/demo/demo3.tsx" target="_blank">link<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="__dumi-default-external-link-icon"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> for an example of antd v4.</p></div>',"description.zh-CN":'<div class="markdown"><p>useAntdTable \u63a5\u6536 form \u5b9e\u4f8b\u540e\uff0c\u4f1a\u8fd4\u56de search \u5bf9\u8c61\u3002\u8fd9\u662f\u4e00\u4e2a antd v3 \u793a\u4f8b\uff0cantd v4 \u793a\u4f8b\u89c1 <a href="https://github.com/alibaba/hooks/blob/master/packages/hooks/src/useAntdTable/demo/demo3.tsx" target="_blank">\u94fe\u63a5<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="__dumi-default-external-link-icon"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>\u3002</p></div>',identifier:"useantdtable-demo1"}},"useantdtable-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"Esvp"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:u}},dependencies:{antd:{version:"4.15.3",css:"antd/dist/antd.css"},react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"},"react-dom":{version:">=16.9.0"}},title:"Data caching","title.zh-CN":"\u6570\u636e\u7f13\u5b58",description:'<div class="markdown"><p>Form and Table data cache through cacheKey. This is an example of antd v3, see <a href="https://github.com/alibaba/hooks/blob/master/packages/hooks/src/useAntdTable/demo/demo4.tsx" target="_blank">link<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="__dumi-default-external-link-icon"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> for an example of antd v4.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u901a\u8fc7 cacheKey \u53ef\u4ee5\u5b9e\u73b0 Form \u548c Table \u6570\u636e\u7f13\u5b58\u3002\u8fd9\u662f\u4e00\u4e2a antd v3 \u793a\u4f8b\uff0cantd v4 \u793a\u4f8b\u89c1 <a href="https://github.com/alibaba/hooks/blob/master/packages/hooks/src/useAntdTable/demo/demo4.tsx" target="_blank">\u94fe\u63a5<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="__dumi-default-external-link-icon"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>\u3002</p></div>',identifier:"useantdtable-demo2"}},"useantdtable-demo5":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"rDNO"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:c}},dependencies:{antd:{version:"4.15.3",css:"antd/dist/antd.css"},react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"},"react-dom":{version:">=16.9.0"}},title:"Use DefaultParams","title.zh-CN":"\u4f7f\u7528 defaultParams",description:'<div class="markdown"><p>useAntdTable sets the initial value through defaultParams, defaultParams is an array, the first value is the paging related parameter, and the second value is the form related data. If there is a second value, we will help you initialize the form! <br /> It should be noted that the initial form data can be filled with simple and advance form data. We will help you select the form data in the currently activated type.</p></div>',"description.zh-CN":'<div class="markdown"><p>useAntdTable \u901a\u8fc7 defaultParams \u8bbe\u7f6e\u521d\u59cb\u5316\u503c\uff0cdefaultParams \u662f\u4e00\u4e2a\u6570\u7ec4\uff0c\u7b2c\u4e00\u4e2a\u503c\u4e3a\u5206\u9875\u76f8\u5173\u53c2\u6570\uff0c\u7b2c\u4e8c\u4e2a\u503c\u4e3a\u8868\u5355\u76f8\u5173\u6570\u636e\u3002\u5982\u679c\u6709\u7b2c\u4e8c\u4e2a\u503c\uff0c\u6211\u4eec\u4f1a\u5e2e\u60a8\u521d\u59cb\u5316\u8868\u5355\uff01 <br /> \u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u521d\u59cb\u5316\u7684\u8868\u5355\u6570\u636e\u53ef\u4ee5\u586b\u5199 simple \u548c advance \u5168\u91cf\u7684\u8868\u5355\u6570\u636e\uff0c\u6211\u4eec\u4f1a\u5e2e\u60a8\u6311\u9009\u5f53\u524d\u6fc0\u6d3b\u7684\u7c7b\u578b\u4e2d\u7684\u8868\u5355\u6570\u636e\u3002</p></div>',identifier:"useantdtable-demo5"}},"useantdtable-demo6":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"fu/Q"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:l}},dependencies:{antd:{version:"4.15.3",css:"antd/dist/antd.css"},react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"},"react-dom":{version:">=16.9.0"}},title:"Form Validate","title.zh-CN":"\u8868\u5355\u9a8c\u8bc1",description:'<div class="markdown"><p>It will stop submit when validate error.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u8868\u5355\u9a8c\u8bc1\u5931\u8d25\uff0c\u4e0d\u4f1a\u53d1\u9001\u8bf7\u6c42</p></div>',identifier:"useantdtable-demo6"}},"useboolean-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"yoie"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:d}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Default as a switch function, or accept a parameter to change state.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u9ed8\u8ba4\u5207\u6362\u5e03\u5c14\u503c\u72b6\u6001\uff0c\u4e5f\u53ef\u4ee5\u63a5\u6536\u4e00\u4e2a\u53c2\u6570\u4f5c\u4e3a\u65b0\u7684\u503c\u3002</p></div>',identifier:"useboolean-demo1"}},"useclickaway-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"vcd/"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:p}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Please click button or outside of button to show effects.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u8bf7\u70b9\u51fb\u6309\u94ae\u6216\u6309\u94ae\u5916\u67e5\u770b\u6548\u679c\u3002</p></div>',identifier:"useclickaway-demo1"}},"useclickaway-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"uE0/"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:m}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Custom DOM","title.zh-CN":"\u81ea\u5b9a\u4e49 DOM",description:'<div class="markdown"><p>Support pass in a DOM element directly or a function that returns the DOM element.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u652f\u6301\u76f4\u63a5\u4f20\u5165 DOM \u5bf9\u8c61\u6216\u901a\u8fc7 function \u8fd4\u56de\u4e00\u4e2a\u5bf9\u8c61\u7684\u65b9\u5f0f\u5f15\u5165\u3002</p></div>',identifier:"useclickaway-demo2"}},"useclickaway-demo3":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"Uilj"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:f}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Support multiple DOM","title.zh-CN":"\u652f\u6301\u591a\u4e2a DOM \u5bf9\u8c61",description:'<div class="markdown"><p>Support pass multiple DOM elements, or functions which returns the DOM element.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u652f\u6301\u4f20\u5165\u591a\u4e2a\u76ee\u6807\u5bf9\u8c61\u3002</p></div>',identifier:"useclickaway-demo3"}},"useclickaway-demo4":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"OUOK"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:v}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Listen to other events","title.zh-CN":"\u76d1\u542c\u5176\u5b83\u4e8b\u4ef6",description:'<div class="markdown"><p>By setting eventName, you can specify the event to be listened. Try click the right mouse.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u901a\u8fc7\u8bbe\u7f6e eventName\uff0c\u53ef\u4ee5\u6307\u5b9a\u9700\u8981\u76d1\u542c\u7684\u4e8b\u4ef6\u3002\u8bd5\u8bd5\u70b9\u51fb\u9f20\u6807\u53f3\u952e\u3002</p></div>',identifier:"useclickaway-demo4"}},"usecontrollablevalue-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"fAhZ"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:h}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Uncontrolled component","title.zh-CN":"\u975e\u53d7\u63a7\u7ec4\u4ef6",description:'<div class="markdown"><p>If there is no value in props, the component use self-contained state</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5982\u679c props \u4e2d\u6ca1\u6709 value\uff0c\u5219\u7ec4\u4ef6\u5185\u90e8\u81ea\u7406 state</p></div>',identifier:"usecontrollablevalue-demo1"}},"usecontrollablevalue-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"lAIz"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:b}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Controlled component","title.zh-CN":"\u53d7\u63a7\u7ec4\u4ef6",description:'<div class="markdown"><p>If props has the value field, then the state is controlled by it\'s parent</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5982\u679c props \u6709 value \u5b57\u6bb5\uff0c\u5219\u7531\u7236\u7ea7\u63a5\u7ba1\u63a7\u5236 state</p></div>',identifier:"usecontrollablevalue-demo2"}},"usecontrollablevalue-demo3":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"PLDQ"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:g}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"No value, have onChange component","title.zh-CN":"\u65e0 value\uff0c\u6709 onChange \u7684\u7ec4\u4ef6",description:'<div class="markdown"><p>As long as there is an onChange field in props, the onChange function will be fired when state changes</p></div>',"description.zh-CN":'<div class="markdown"><p>\u53ea\u8981 props \u4e2d\u6709 onChange \u5b57\u6bb5\uff0c\u5219\u5728 state \u53d8\u5316\u65f6\uff0c\u5c31\u4f1a\u89e6\u53d1 onChange \u51fd\u6570</p></div>',identifier:"usecontrollablevalue-demo3"}},"usecookiestate-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"VoNs"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:y}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Store state into cookie","title.zh-CN":"\u5c06 state \u5b58\u50a8\u5728 cookie \u4e2d",description:'<div class="markdown"><p>Refresh this page and you will find the value of input box get restored from cookie.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5237\u65b0\u9875\u9762\u540e\uff0c\u53ef\u4ee5\u770b\u5230\u8f93\u5165\u6846\u4e2d\u7684\u5185\u5bb9\u88ab\u4ece cookie \u4e2d\u6062\u590d\u4e86\u3002</p></div>',identifier:"usecookiestate-demo1"}},"usecookiestate-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"b2g7"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:w}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"SetState can receive function","title.zh-CN":"setState \u53ef\u4ee5\u63a5\u6536\u51fd\u6570",description:'<div class="markdown"><p>Function updater is also acceptable with useCookieState\'s setState\uff0clinke useState.</p></div>',"description.zh-CN":'<div class="markdown"><p>useCookieState \u7684 setState \u53ef\u4ee5\u63a5\u6536 function updater\uff0c\u5c31\u50cf useState \u90a3\u6837\u3002</p></div>',identifier:"usecookiestate-demo2"}},"usecookiestate-demo3":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"aQ7k"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:k}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Use the option property to configure cookie","title.zh-CN":"\u4f7f\u7528 option \u914d\u7f6e cookie",description:'<div class="markdown"><p>Can be configured defaultValue\u3001expires\u3001path\u3001domain\u3001secure\u3001sameSite</p></div>',"description.zh-CN":'<div class="markdown"><p>\u53ef\u914d\u7f6e\u5c5e\u6027\uff1a\u9ed8\u8ba4\u503c\u3001\u6709\u6548\u65f6\u95f4\u3001\u8def\u5f84\u3001\u57df\u540d\u3001\u534f\u8bae\u3001\u8de8\u57df\u7b49\uff0c\u8be6\u89c1 Options</p></div>',identifier:"usecookiestate-demo3"}},"usecountdown-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"YZc4"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:x}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Basic Usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Basic countdown management.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u57fa\u7840\u7684\u5012\u8ba1\u65f6\u7ba1\u7406\u3002</p></div>',identifier:"usecountdown-demo1"}},"usecountdown-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"1AJf"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:C}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Adcanved Uasge","title.zh-CN":"\u8fdb\u9636\u4f7f\u7528",description:'<div class="markdown"><p>Controll countdown and interval status manually</p></div>',"description.zh-CN":'<div class="markdown"><p>\u624b\u52a8\u542f\u7528\u5e76\u63a7\u5236\u8ba1\u65f6\u5668\u72b6\u6001, \u9002\u7528\u4e8e\u9a8c\u8bc1\u7801\u6216\u7c7b\u4f3c\u573a\u666f; \u65f6\u95f4\u7ed3\u675f\u540e\u89e6\u53d1onEnd\u56de\u8c03</p></div>',identifier:"usecountdown-demo2"}},"usecounter-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"z3EG"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:S}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Simple count management example.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u7b80\u5355\u7684 count \u7ba1\u7406\u793a\u4f8b\u3002</p></div>',identifier:"usecounter-demo1"}},"usecreation-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"5/1s"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:P}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Make sure only one instance is created","title.zh-CN":"\u786e\u4fdd\u5b9e\u4f8b\u4e0d\u4f1a\u88ab\u91cd\u590d\u521b\u5efa",description:'<div class="markdown"><p>You can click the "Rerender" button and trigger the update of this component. But the instance of Foo will keep unchanged.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u70b9\u51fb "Rerender" \u6309\u94ae\uff0c\u89e6\u53d1\u7ec4\u4ef6\u7684\u66f4\u65b0\uff0c\u4f46 Foo \u7684\u5b9e\u4f8b\u4f1a\u4fdd\u6301\u4e0d\u53d8</p></div>',identifier:"usecreation-demo1"}},"usedebounce-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"eWij"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:R}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>DebouncedValue will change after the input ends 500ms.</p></div>',"description.zh-CN":'<div class="markdown"><p>DebouncedValue \u53ea\u4f1a\u5728\u8f93\u5165\u7ed3\u675f 500ms \u540e\u53d8\u5316\u3002</p></div>',identifier:"usedebounce-demo1"}},"usedebounceeffect-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"kE1l"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:O},"index.ts":{import:"../",content:j},"useDebounceFn/index.ts":{import:"../useDebounceFn",content:I},"useCreation/index.ts":{import:"../useCreation",content:T},"useUnmount/index.ts":{import:"../useUnmount",content:z},"usePersistFn/index.ts":{import:"../usePersistFn",content:F},"utils/index.ts":{import:"../utils",content:N},"useUpdateEffect/index.ts":{import:"../useUpdateEffect",content:D}},dependencies:{react:{version:"16.14.0"},"lodash.debounce":{version:"4.0.8"}},identifier:"usedebounceeffect-demo1"}},"usedebouncefn-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"tHpm"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:E}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Frequent calls run, but the function is executed only after all the clicks have completed 500ms.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u9891\u7e41\u8c03\u7528 run\uff0c\u4f46\u53ea\u4f1a\u5728\u6240\u6709\u70b9\u51fb\u5b8c\u6210 500ms \u540e\u6267\u884c\u4e00\u6b21\u76f8\u5173\u51fd\u6570</p></div>',identifier:"usedebouncefn-demo1"}},"usedocumentvisibility-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"vqnj"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:q}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Listen to document visibility change.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u76d1\u542c document \u7684\u53ef\u89c1\u72b6\u6001</p></div>',identifier:"usedocumentvisibility-demo1"}},"usedrop-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"rlxq"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:A}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>The drop area can accept files, uri, text or one of the boxes below.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u62d6\u62fd\u533a\u57df\u53ef\u4ee5\u63a5\u53d7\u6587\u4ef6\uff0c\u94fe\u63a5\uff0c\u6587\u5b57\uff0c\u548c\u4e0b\u65b9\u7684 box \u8282\u70b9\u3002</p></div>',identifier:"usedrop-demo1"}},"usedynamiclist-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"HPQz"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:L}},dependencies:{antd:{version:"4.15.3",css:"antd/dist/antd.css"},react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"},"react-dom":{version:">=16.9.0"}},title:"Default usage","title.zh-CN":"\u52a8\u6001\u5217\u8868",description:'<div class="markdown"><p>a form that can add/remove fields dynamically.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u53ef\u589e\u5220\u7684\u4e0d\u5b9a\u6761\u6570\u8868\u5355</p></div>',identifier:"usedynamiclist-demo1"}},"usedynamiclist-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"66gF"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:M}},dependencies:{antd:{version:"4.15.3",css:"antd/dist/antd.css"},react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"},"react-dom":{version:">=16.9.0"}},title:"Nesting forms","title.zh-CN":"\u5d4c\u5957\u8868\u5355",description:'<div class="markdown"><p>nesting dynamic forms in a set of form groups.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u52a8\u6001\u8868\u5355\u5185\u90e8\u5d4c\u5957\u52a8\u6001\u8868\u5355</p></div>',identifier:"usedynamiclist-demo2"}},"usedynamiclist-demo3":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"7cCY"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:B}},dependencies:{antd:{version:"4.15.3",css:"antd/dist/antd.css"},react:{version:"^16.8.6 || ^17.0"},"react-drag-listview":{version:"0.1.8"},ahooks:{version:"2.10.2"},"react-dom":{version:">=16.9.0"}},title:"Dyanmic table(draggable)","title.zh-CN":"\u52a8\u6001\u8868\u683c(\u53ef\u62d6\u62fd)",description:'<div class="markdown"><p>using antd table to build dynamic table form.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u4f7f\u7528 antd table \u6784\u5efa\u52a8\u6001\u8868\u683c</p></div>',identifier:"usedynamiclist-demo3"}},"useeventemitter-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"Y5K8"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:_}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Parent component shares a event","title.zh-CN":"\u7236\u7ec4\u4ef6\u5411\u5b50\u7ec4\u4ef6\u5171\u4eab\u4e8b\u4ef6",description:'<div class="markdown"><p>The parent component creates a <code>focus$</code> event emitter, and passes it to its children. When calling <code>focus$.emit</code> in MessageBox, InputBox will get notified.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u7236\u7ec4\u4ef6\u521b\u5efa\u4e86\u4e00\u4e2a <code>focus$</code> \u4e8b\u4ef6\uff0c\u5e76\u4e14\u5c06\u5b83\u4f20\u9012\u7ed9\u4e86\u4e24\u4e2a\u5b50\u7ec4\u4ef6\u3002\u5728 MessageBox \u4e2d\u8c03\u7528 <code>focus$.emit</code> \uff0cInputBox \u7ec4\u4ef6\u5c31\u53ef\u4ee5\u6536\u5230\u901a\u77e5\u3002</p></div>',identifier:"useeventemitter-demo1"}},"useeventlistener-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"zz4/"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:U}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Click the button to preview.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u70b9\u51fb\u6309\u94ae\u67e5\u770b\u6548\u679c\u3002</p></div>',identifier:"useeventlistener-demo1"}},"useeventlistener-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"1FF9"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:V}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Listen keydown","title.zh-CN":"\u76d1\u542c keydown \u4e8b\u4ef6",description:'<div class="markdown"><p>Press any key to preview.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u6309\u4e0b\u952e\u76d8\u67e5\u770b\u6548\u679c\u3002</p></div>',identifier:"useeventlistener-demo2"}},"useeventtarget-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"rmvJ"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:$}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Basic usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Controlled Input component with initial value and reset functionality</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5e26\u521d\u59cb\u5316\u503c\u8ddf\u91cd\u7f6e\u7684\u53d7\u63a7 Input \u7ec4\u4ef6</p></div>',identifier:"useeventtarget-demo1"}},"useeventtarget-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"gmst"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:K}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Custom transformer function","title.zh-CN":"\u81ea\u5b9a\u4e49\u8f6c\u6362\u51fd\u6570",description:'<div class="markdown"><p>Controlled Input component with number input only</p></div>',"description.zh-CN":'<div class="markdown"><p>\u53ea\u80fd\u8f93\u5165\u6570\u5b57\u7684\u53d7\u63a7Input\u7ec4\u4ef6</p></div>',identifier:"useeventtarget-demo2"}},"useexternal-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"/nfp"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:H}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Load a javascript file to your page such as <a href="/useExternal/test-external-script.js">test-external-script.js</a></p></div>',"description.zh-CN":'<div class="markdown"><p>\u9875\u9762\u4e0a\u52a0\u8f7d\u5916\u90e8 javascript \u6587\u4ef6\uff0c\u4f8b\u5982\u5f15\u5165 <a href="/useExternal/test-external-script.js">test-external-script.js</a></p></div>',identifier:"useexternal-demo1"}},"useexternal-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"kti0"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:W}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Load style dynamically","title.zh-CN":"\u52a8\u6001\u52a0\u8f7d\u6837\u5f0f",description:'<div class="markdown"><p>Load a css file to your page such as <a href="/useExternal/bootstrap-badge.css">bootstrap-badge.css</a></p></div>',"description.zh-CN":'<div class="markdown"><p>\u9875\u9762\u4e0a\u52a0\u8f7d\u5916\u90e8 css \u6587\u4ef6\uff0c\u4f8b\u5982\u5f15\u5165 <a href="/useExternal/bootstrap-badge.css">bootstrap-badge.css</a></p></div>',identifier:"useexternal-demo2"}},"useexternal-demo3":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"W+j0"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:J}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Load image","title.zh-CN":"\u52a0\u8f7d\u56fe\u7247\u6587\u4ef6",description:'<div class="markdown"><p>Load a static image as external resources to page.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u52a0\u8f7d\u4e00\u4e2a\u9759\u6001\u56fe\u7247\u4f5c\u4e3a\u5916\u90e8\u8d44\u6e90\u5f15\u5165\u9875\u9762</p></div>',identifier:"useexternal-demo3"}},"useexternal-demo4":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"HDme"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Y}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Input a variable","title.zh-CN":"\u4f20\u5165\u4e00\u4e2a\u53d8\u91cf",description:'<div class="markdown"><p>Randomly generate the URL address and input the useExternal</p></div>',"description.zh-CN":'<div class="markdown"><p>\u968f\u673a\u751f\u6210 url \u5730\u5740\u5e76\u4f20\u5165 useExternal</p></div>',identifier:"useexternal-demo4"}},"usefavicon-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"v1Bi"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:G}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Basic usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Page favicon setup and toggle</p></div>',"description.zh-CN":'<div class="markdown"><p>\u9875\u9762\u6807\u8bc6 favicon \u8bbe\u7f6e\u4e0e\u5207\u6362</p></div>',identifier:"usefavicon-demo1"}},"usefullscreen-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"9o0L"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Z}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Use ref to set elements that need full screen</p></div>',"description.zh-CN":'<div class="markdown"><p>\u4f7f\u7528 ref \u8bbe\u7f6e\u9700\u8981\u5168\u5c4f\u7684\u5143\u7d20</p></div>',identifier:"usefullscreen-demo1"}},"usefullscreen-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"N3R6"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Q}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Picture full screen","title.zh-CN":"\u56fe\u7247\u5168\u5c4f",description:'<div class="markdown"><p>Picture full screen</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5168\u5c4f\u56fe\u7247</p></div>',identifier:"usefullscreen-demo2"}},"usefusiontable-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"60nX"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:X}},dependencies:{"@alifd/next":{version:"1.22.23",css:"@alifd/next/dist/next.css"},react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"},"@alifd/meet-react":{version:"^2.0.0"},moment:{version:"^2.22.1"},"react-dom":{version:"^16.0.0"}},title:"Form and Table data binding","title.zh-CN":"Form \u4e0e Table \u8054\u52a8",description:'<div class="markdown"><p>useFusionTable returns a search object after receiving a field instance. This is an example of Fusion Design.</p></div>',"description.zh-CN":'<div class="markdown"><p>useFusionTable \u63a5\u6536 field \u5b9e\u4f8b\u540e\uff0c\u4f1a\u8fd4\u56de search \u5bf9\u8c61\u3002\u8fd9\u662f\u4e00\u4e2a Fusion Design \u7684\u793a\u4f8b\u3002</p></div>',identifier:"usefusiontable-demo1"}},"usefusiontable-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"hN7j"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:ee}},dependencies:{"@alifd/next":{version:"1.22.23",css:"@alifd/next/dist/next.css"},react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"},"@alifd/meet-react":{version:"^2.0.0"},moment:{version:"^2.22.1"},"react-dom":{version:"^16.0.0"}},title:"Data caching","title.zh-CN":"\u6570\u636e\u7f13\u5b58",description:'<div class="markdown"><p>Form and Table data cache through cacheKey.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u901a\u8fc7 cacheKey \u53ef\u4ee5\u5b9e\u73b0 Form \u548c Table \u6570\u636e\u7f13\u5b58\u3002</p></div>',identifier:"usefusiontable-demo2"}},"usefusiontable-demo3":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"8Bzz"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:ne}},dependencies:{"@alifd/next":{version:"1.22.23",css:"@alifd/next/dist/next.css"},react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"},"@alifd/meet-react":{version:"^2.0.0"},moment:{version:"^2.22.1"},"react-dom":{version:"^16.0.0"}},title:"Use DefaultParams","title.zh-CN":"\u4f7f\u7528 defaultParams",description:'<div class="markdown"><p>useFusionTable sets the initial value through defaultParams, defaultParams is an array, the first value is the paging related parameter, and the second value is the form related data. If there is a second value, we will help you initialize the form! <br /> It should be noted that the initial form data can be filled with simple and advance form data. We will help you select the form data in the currently activated type.</p></div>',"description.zh-CN":'<div class="markdown"><p>useFusionTable \u901a\u8fc7 defaultParams \u8bbe\u7f6e\u521d\u59cb\u5316\u503c\uff0cdefaultParams \u662f\u4e00\u4e2a\u6570\u7ec4\uff0c\u7b2c\u4e00\u4e2a\u503c\u4e3a\u5206\u9875\u76f8\u5173\u53c2\u6570\uff0c\u7b2c\u4e8c\u4e2a\u503c\u4e3a\u8868\u5355\u76f8\u5173\u6570\u636e\u3002\u5982\u679c\u6709\u7b2c\u4e8c\u4e2a\u503c\uff0c\u6211\u4eec\u4f1a\u5e2e\u60a8\u521d\u59cb\u5316\u8868\u5355\uff01<br /> \u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u521d\u59cb\u5316\u7684\u8868\u5355\u6570\u636e\u53ef\u4ee5\u586b\u5199 simple \u548c advance \u5168\u91cf\u7684\u8868\u5355\u6570\u636e\uff0c\u6211\u4eec\u4f1a\u5e2e\u60a8\u6311\u9009\u5f53\u524d\u6fc0\u6d3b\u7684\u7c7b\u578b\u4e2d\u7684\u8868\u5355\u6570\u636e\u3002</p></div>',identifier:"usefusiontable-demo3"}},"usefusiontable-demo4":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"CAi/"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:te}},dependencies:{"@alifd/next":{version:"1.22.23",css:"@alifd/next/dist/next.css"},react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"},"@alifd/meet-react":{version:"^2.0.0"},moment:{version:"^2.22.1"},"react-dom":{version:"^16.0.0"}},title:"Form Validate","title.zh-CN":"\u8868\u5355\u9a8c\u8bc1",description:'<div class="markdown"><p>It will stop submit when validate error.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u8868\u5355\u9a8c\u8bc1\u5931\u8d25\uff0c\u4e0d\u4f1a\u53d1\u9001\u8bf7\u6c42</p></div>',identifier:"usefusiontable-demo4"}},"usehistorytravel-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"SQdT"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:re}},dependencies:{ahooks:{version:"2.10.2"},react:{version:"^16.8.6 || ^17.0"}},title:"Basic usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>redo and undo operations\uff0cclick back and forward after input something.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u64a4\u9500\u8ddf\u91cd\u505a\u64cd\u4f5c\uff0c\u8f93\u5165\u5185\u5bb9\u540e\uff0c\u70b9\u51fb back \u548c forward\u3002</p></div>',identifier:"usehistorytravel-demo1"}},"usehistorytravel-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"I8IQ"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:oe}},dependencies:{ahooks:{version:"2.10.2"},react:{version:"^16.8.6 || ^17.0"}},title:"TodoList","title.zh-CN":"\u53ef\u64a4\u9500\u6062\u590d\u7684 Todo List",description:'<div class="markdown"><p>redo and undo operations</p></div>',"description.zh":'<div class="markdown"><p>\u53ef\u4ee5\u5b9e\u73b0\u64a4\u9500\u6062\u590d\u7b49\u64cd\u4f5c\u3002</p></div>',identifier:"usehistorytravel-demo2"}},"usehover-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"Zrun"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:ae}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Use ref to set elements that need listen dom.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u4f7f\u7528 ref \u8bbe\u7f6e\u9700\u8981\u9700\u8981\u76d1\u542c\u7684\u5143\u7d20\u3002</p></div>',identifier:"usehover-demo1"}},"usehover-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"finQ"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:se}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Pass in DOM element","title.zh-CN":"\u4f20\u5165 DOM \u5143\u7d20",description:'<div class="markdown"><p>Pass in a function that returns the DOM element.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u4f20\u5165 function \u5e76\u8fd4\u56de\u4e00\u4e2a dom \u5143\u7d20\u3002</p></div>',identifier:"usehover-demo2"}},"useinviewport-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"Rp5T"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:ie}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Using ref to listen to visibility change.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u4f7f\u7528 ref \u76d1\u542c\u8282\u70b9\u5728\u89c6\u56fe\u53d8\u5316\u6216\u8005\u6eda\u52a8\u65f6\u662f\u5426\u5728\u53ef\u89c6\u8303\u56f4\u4e4b\u5185</p></div>',identifier:"useinviewport-demo1"}},"useinviewport-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"1QK1"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:ue}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Pass in DOM element","title.zh-CN":"\u4f20\u5165 DOM \u5143\u7d20",description:'<div class="markdown"><p>Pass in a function that returns the DOM element.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u4f20\u5165 function \u5e76\u8fd4\u56de\u4e00\u4e2a dom \u5143\u7d20</p></div>',identifier:"useinviewport-demo2"}},"useinterval-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"tT/4"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:ce}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Every 1000ms, execute once</p></div>',"description.zh-CN":'<div class="markdown"><p>\u6bcf1000ms\uff0c\u6267\u884c\u4e00\u6b21</p></div>',identifier:"useinterval-demo1"}},"useinterval-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"bOsA"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:le}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Advanced usage","title.zh-CN":"\u8fdb\u9636\u4f7f\u7528",description:'<div class="markdown"><p>Immediate interval reset\u3001delay increase\u3001clear</p></div>',"description.zh-CN":'<div class="markdown"><p>\u7acb\u5373\u6267\u884c\u5b9a\u65f6\u5668\u7684\u91cd\u542f\u3001\u95f4\u9694\u65f6\u95f4\u589e\u52a0\u3001\u6e05\u9664\u7684\u4f7f\u7528\u3002</p></div>',identifier:"useinterval-demo2"}},"usekeypress-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"gWi9"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:de}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Basic usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Supported Key and keyCode in keyboard events, pressing ArrowUp or ArrowDown to show effect.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u652f\u6301\u952e\u76d8\u4e8b\u4ef6\u4e2d\u7684 key \u548c keyCode\uff0c\u8bf7\u6309 ArrowUp \u6216 ArrowDown \u952e\u8fdb\u884c\u6f14\u793a\u3002</p></div>',identifier:"usekeypress-demo1"}},"usekeypress-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"unVz"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:pe}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Use key aliases","title.zh-CN":"\u4f7f\u7528\u522b\u540d",description:'<div class="markdown"><p>Support using key aliases. Please refer to the <a href="#remarks">document</a> below.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u652f\u6301\u4f7f\u7528\u522b\u540d\uff0c\u66f4\u591a\u5185\u5bb9\u8bf7<a href="#remarks">\u67e5\u770b\u5907\u6ce8</a>\u3002</p></div>',identifier:"usekeypress-demo2"}},"usekeypress-demo3":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"rBzm"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:me}},dependencies:{antd:{version:"4.15.3",css:"antd/dist/antd.css"},react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"},"react-dom":{version:">=16.9.0"}},title:"Compound mode","title.zh-CN":"\u7ec4\u5408\u65b9\u5f0f",description:'<div class="markdown"><p>Support for receiving a set of input keys or passing parameters as a combination of keys.</p>\n<p>Attention\uff1aKey combination only supports the use of modified key + key alias + key in keyboard events, <a href="#remarks">See detail</a></p></div>',"description.zh-CN":'<div class="markdown"><p>\u652f\u6301\u63a5\u6536\u4e00\u7ec4\u8f93\u5165\u952e\uff0c\u6216\u4ee5\u7ec4\u5408\u952e\u7684\u65b9\u5f0f\u4f20\u9012\u53c2\u6570\u3002</p>\n<p>\u8bf7\u6ce8\u610f\uff1a\u7ec4\u5408\u952e\u65b9\u5f0f\u53ea\u652f\u6301\u4f7f\u7528\u4fee\u9970\u952e + \u952e\u4f4d\u522b\u540d + \u952e\u76d8\u4e8b\u4ef6\u4e2d\u7684 key \u8fdb\u884c\u7ec4\u5408\uff0c\u66f4\u591a\u5185\u5bb9\u8bf7<a href="#%E5%A4%87%E6%B3%A8">\u67e5\u770b\u5907\u6ce8</a>\u3002</p></div>',identifier:"usekeypress-demo3"}},"usekeypress-demo4":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"EZOW"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:fe}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Advanced","title.zh-CN":"\u8fdb\u9636\u4f7f\u7528",description:'<div class="markdown"><p>Supports receiving a Boolean callback function to handle preprocessing operations.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u652f\u6301\u63a5\u6536\u4e00\u4e2a\u8fd4\u56de boolean \u7684\u56de\u8c03\u51fd\u6570\uff0c\u5904\u7406\u9884\u5904\u7406\u64cd\u4f5c\u3002</p></div>',identifier:"usekeypress-demo4"}},"usekeypress-demo5":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"5jx5"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:ve}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Custom DOM","title.zh-CN":"\u81ea\u5b9a\u4e49 DOM",description:'<div class="markdown"><p>By default, you listen for events that are mounted on the window. You can also pass in a DOM object or return an object via function.</p>\n<p>Supports multiple DOM callbacks, such as the common listening for input box events.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u9ed8\u8ba4\u76d1\u542c\u6302\u8f7d\u5728 window \u4e0a\u7684\u4e8b\u4ef6\uff0c\u4f60\u4e5f\u53ef\u4ee5\u4f20\u5165 DOM \u5bf9\u8c61\u6216\u901a\u8fc7 function \u8fd4\u56de\u4e00\u4e2a\u5bf9\u8c61\u7684\u65b9\u5f0f\u5f15\u5165\u3002</p>\n<p>\u5982\u5e38\u89c1\u7684\u76d1\u542c\u8f93\u5165\u6846\u4e8b\u4ef6\uff0c\u652f\u6301\u591a\u79cd DOM \u56de\u8c03\u3002</p></div>',identifier:"usekeypress-demo5"}},"uselocalstoragestate-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"VaEu"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:he}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Persist state into localStorage","title.zh-CN":"\u5c06 state \u6301\u4e45\u5316\u5728 localStorage \u4e2d",description:'<div class="markdown"><p>Refresh this page and you will find the value of input box get restored from localStorage.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5237\u65b0\u9875\u9762\u540e\uff0c\u53ef\u4ee5\u770b\u5230\u8f93\u5165\u6846\u4e2d\u7684\u5185\u5bb9\u88ab\u4ece localStorage \u4e2d\u6062\u590d\u4e86\u3002</p></div>',identifier:"uselocalstoragestate-demo1"}},"uselocalstoragestate-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"pd+N"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:be}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Store complex types such as arrays or objects","title.zh-CN":"\u5b58\u50a8\u6570\u7ec4\u6216\u5bf9\u8c61\u7b49\u590d\u6742\u7c7b\u578b",description:'<div class="markdown"><p>useLocalStorageState will do the serialization and deserialization work automatically.</p></div>',"description.zh-CN":'<div class="markdown"><p>useLocalStorageState \u4f1a\u81ea\u52a8\u5904\u7406\u5e8f\u5217\u5316\u548c\u53cd\u5e8f\u5217\u5316\u7684\u64cd\u4f5c\u3002</p></div>',identifier:"uselocalstoragestate-demo2"}},"uselocalstoragestate-demo3":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"3lnb"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:ge}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Persist objects with function updater","title.zh-CN":"\u4f7f\u7528 function updater \u5b58\u50a8",description:'<div class="markdown"><p>function updater is also acceptable with useLocalStorageState.</p></div>',"description.zh-CN":'<div class="markdown"><p>useLocalStorageState \u91cc\u4e5f\u53ef\u4ee5\u7528 function updater\uff0c\u5c31\u50cf useState \u90a3\u6837\u3002</p></div>',identifier:"uselocalstoragestate-demo3"}},"uselockfn-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"Yz4d"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:ye}},dependencies:{antd:{version:"4.15.3",css:"antd/dist/antd.css"},react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"},"react-dom":{version:">=16.9.0"}},title:"Prevent duplicated submits","title.zh-CN":"\u9632\u6b62\u91cd\u590d\u63d0\u4ea4",description:'<div class="markdown"><p>Before the <code>submit</code> function finishes, the other click actions will be ignored.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5728 <code>submit</code> \u51fd\u6570\u6267\u884c\u5b8c\u6210\u524d\uff0c\u5176\u4f59\u7684\u70b9\u51fb\u52a8\u4f5c\u90fd\u4f1a\u88ab\u5ffd\u7565\u3002</p></div>',identifier:"uselockfn-demo1"}},"usemap-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"BQeK"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:we}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Pass in a Map acceptable parameter.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u4f20\u5165\u4e00\u4e2a Map \u53ef\u63a5\u53d7\u7684\u53c2\u6570\u3002</p></div>',identifier:"usemap-demo1"}},"usemount-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"G/gl"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:ke}},dependencies:{antd:{version:"4.15.3",css:"antd/dist/antd.css"},react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"},"react-dom":{version:">=16.9.0"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>The function is called right after the component mount.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5728\u7ec4\u4ef6\u9996\u6b21\u6e32\u67d3\u65f6\uff0c\u6267\u884c\u65b9\u6cd5\u3002</p></div>',identifier:"usemount-demo1"}},"usemouse-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"pPhr"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:xe}},dependencies:{ahooks:{version:"2.10.2"},react:{version:"^16.8.6 || ^17.0"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Tracking cursor position.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u83b7\u53d6\u9f20\u6807\u4f4d\u7f6e\u3002</p></div>',identifier:"usemouse-demo1"}},"usenetwork-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"92NG"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Ce}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>return network status</p></div>',"description.zh-CN":'<div class="markdown"><p>\u8fd4\u56de\u7f51\u7edc\u72b6\u6001\u4fe1\u606f</p></div>',identifier:"usenetwork-demo1"}},"usepersistfn-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"5Jzm"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Se}},dependencies:{antd:{version:"4.15.3",css:"antd/dist/antd.css"},react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"},"react-dom":{version:">=16.9.0"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>With usePersistFn, function references never change. In the example, <code>showCountPersistFn</code> will not change, <code>showCountCommon</code> will change when count changes.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u901a\u8fc7 usePersistFn\uff0c\u51fd\u6570\u5f15\u7528\u6c38\u8fdc\u4e0d\u4f1a\u53d8\u5316\uff0c\u793a\u4f8b\u4e2d <code>showCountPersistFn</code> \u662f\u4e0d\u4f1a\u53d8\u5316\u7684\uff0c<code>showCountCommon</code> \u5728 count \u53d8\u5316\u65f6\u53d8\u5316\u3002</p></div>',identifier:"usepersistfn-demo1"}},"useprevious-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"ynmm"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Pe}},dependencies:{ahooks:{version:"2.10.2"},react:{version:"^16.8.6 || ^17.0"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Store the previous value.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u8bb0\u5f55\u4e0a\u6b21\u7684 count \u503c</p></div>',identifier:"useprevious-demo1"}},"useprevious-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"HgnT"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Re}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Using compare function","title.zh-CN":"\u4f7f\u7528 compare function",description:'<div class="markdown"><p>The stored previous value update only when the compare function returns true.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u53ea\u6709 compare function \u8fd4\u56de true \u65f6\uff0c\u624d\u4f1a\u8bb0\u5f55\u503c\u7684\u53d8\u5316</p></div>',identifier:"useprevious-demo2"}},"usereactive-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"zWhO"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Oe}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},identifier:"usereactive-demo1"}},"usereactive-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"zpWB"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:je}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},identifier:"usereactive-demo2"}},"usereactive-demo3":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"jllS"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Ie}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},identifier:"usereactive-demo3"}},"usereactive-demo4":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"tf72"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Te}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},description:'<div class="markdown"><p><code>useReactive</code>\u4ea7\u751f\u53ef\u64cd\u4f5c\u7684\u4ee3\u7406\u5bf9\u8c61\u4e00\u76f4\u90fd\u662f\u540c\u4e00\u4e2a\u5f15\u7528\uff0c<code>useEffect</code> , <code>useMemo</code> ,<code>useCallback</code> ,<code>\u5b50\u7ec4\u4ef6\u5c5e\u6027\u4f20\u9012</code> \u7b49\u5982\u679c\u4f9d\u8d56\u7684\u662f\u8fd9\u4e2a\u4ee3\u7406\u5bf9\u8c61\u662f<strong>\u4e0d\u4f1a</strong>\u5f15\u8d77\u91cd\u65b0\u6267\u884c\u3002</p></div>',identifier:"usereactive-demo4"}},"useresponsive-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"rbNq"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:ze}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Get responsive info in components","title.zh-CN":"\u5728\u7ec4\u4ef6\u4e2d\u83b7\u53d6\u54cd\u5e94\u5f0f\u4fe1\u606f",description:'<div class="markdown"><p>By calling useResponsive in components, you can retrieve the responsive infomation of the browser page and subscribe to it at the same time.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5728\u7ec4\u4ef6\u4e2d\u8c03\u7528 useResponsive \u53ef\u4ee5\u83b7\u53d6\u5e76\u8ba2\u9605\u6d4f\u89c8\u5668\u7a97\u53e3\u7684\u54cd\u5e94\u5f0f\u4fe1\u606f\u3002</p></div>',identifier:"useresponsive-demo1"}},"usesafestate-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"KQwp"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Fe},"index.ts":{import:"../index",content:Ne},"useUnmountedRef/index.ts":{import:"../useUnmountedRef",content:De}},dependencies:{react:{version:"16.14.0"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",identifier:"usesafestate-demo1"}},"usescroll-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"4J0Z"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Ee}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Basic Usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Try to scroll the box below.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5c1d\u8bd5\u6eda\u52a8\u4e00\u4e0b\u6587\u5b57\u5185\u5bb9\u3002</p></div>',identifier:"usescroll-demo1"}},"usescroll-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"/Xzp"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:qe}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Detect Whole Page Scroll","title.zh-CN":"\u76d1\u6d4b\u6574\u9875\u7684\u6eda\u52a8",description:'<div class="markdown"><p>Try to scroll this webpage.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5c1d\u8bd5\u6eda\u52a8\u4e00\u4e0b\u9875\u9762\u3002</p></div>',identifier:"usescroll-demo2"}},"usescroll-demo3":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"JkiO"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Ae}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Controll listen on scroll status","title.zh-CN":"\u63a7\u5236\u6eda\u52a8\u72b6\u6001\u7684\u76d1\u542c",description:'<div class="markdown"><p>listen on scroll event between 100px ~ 200px in vertical direction</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5728\u5782\u76f4\u65b9\u5411 100px \u5230 200px \u7684\u6eda\u52a8\u8303\u56f4\u5185\u76d1\u542c</p></div>',identifier:"usescroll-demo3"}},"useselections-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"yikz"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Le}},dependencies:{antd:{version:"4.15.3",css:"antd/dist/antd.css"},react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"},"react-dom":{version:">=16.9.0"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Checkbox group.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5e38\u89c1\u7684 checkbox \u8054\u52a8</p></div>',identifier:"useselections-demo1"}},"usesessionstoragestate-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"lZDW"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Me}},dependencies:{ahooks:{version:"2.10.2"},react:{version:"^16.8.6 || ^17.0"}},title:"Persist state into sessionStorage","title.zh-CN":"\u5c06 state \u6301\u4e45\u5316\u5728 sessionStorage \u4e2d",description:'<div class="markdown"><p>Refresh this page and you will find the value of input box get restored from sessionStorage.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5237\u65b0\u9875\u9762\u540e\uff0c\u53ef\u4ee5\u770b\u5230\u8f93\u5165\u6846\u4e2d\u7684\u5185\u5bb9\u88ab\u4ece sessionStorage \u4e2d\u6062\u590d\u4e86\u3002</p></div>',identifier:"usesessionstoragestate-demo1"}},"usesessionstoragestate-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"VUjs"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Be}},dependencies:{ahooks:{version:"2.10.2"},react:{version:"^16.8.6 || ^17.0"}},title:"Persist objects","title.zh-CN":"\u5b58\u50a8\u5bf9\u8c61",description:'<div class="markdown"><p>useSessionStorageState will do the serialization and deserialization work automatically.</p></div>',"description.zh-CN":'<div class="markdown"><p>useSessionStorageState \u4f1a\u81ea\u52a8\u5904\u7406\u5e8f\u5217\u5316\u548c\u53cd\u5e8f\u5217\u5316\u7684\u64cd\u4f5c\u3002</p></div>',identifier:"usesessionstoragestate-demo2"}},"usesessionstoragestate-demo3":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"bqTf"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:_e}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Persist objects with function updater","title.zh-CN":"\u4f7f\u7528 function updater \u5b58\u50a8",description:'<div class="markdown"><p>function updater is also acceptable with useSessionStorageState.</p></div>',"description.zh-CN":'<div class="markdown"><p>useSessionStorageState \u91cc\u4e5f\u53ef\u4ee5\u7528 function updater\uff0c\u5c31\u50cf useState \u90a3\u6837\u3002</p></div>',identifier:"usesessionstoragestate-demo3"}},"useset-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"Tt9S"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Ue}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Pass in a Set acceptable parameter.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u4f20\u5165\u4e00\u4e2a Set \u53ef\u63a5\u53d7\u7684\u53c2\u6570\u3002</p></div>',identifier:"useset-demo1"}},"usesetstate-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"h17I"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Ve}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",identifier:"usesetstate-demo1"}},"usesize-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"8PEa"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:$e}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>using ref to listen to size change</p></div>',"description.zh-CN":'<div class="markdown"><p>\u4f7f\u7528 ref \u76d1\u542c\u8282\u70b9\u5c3a\u5bf8\u53d8\u5316</p></div>',identifier:"usesize-demo1"}},"usesize-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"XFJ9"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Ke}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"pass in the DOM element","title.zh-CN":"\u4f20\u5165 DOM \u5143\u7d20",description:'<div class="markdown"><p>Pass in a function that returns the DOM element.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u4f20\u5165 function \u5e76\u8fd4\u56de\u4e00\u4e2a dom \u5143\u7d20\u3002</p></div>',identifier:"usesize-demo2"}},"usetextselection-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"kfU+"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:He}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Tracking content of user text selection</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5b9e\u65f6\u83b7\u53d6\u9875\u9762\u4e0a\u9009\u62e9\u7684\u6587\u672c</p></div>',identifier:"usetextselection-demo1"}},"usetextselection-demo3":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"VNrD"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:We}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Listen specified area","title.zh-CN":"\u76d1\u542c\u7279\u5b9a\u533a\u57df\u6587\u672c\u9009\u62e9",description:'<div class="markdown"><p>useTextSelection can receive dom or ref, for listen specified area.</p></div>',"description.zh-CN":'<div class="markdown"><p>useTextSelection \u53ef\u4ee5\u63a5\u6536 dom \u6216 ref\uff0c\u6307\u5b9a\u76d1\u542c\u533a\u57df\u3002</p></div>',identifier:"usetextselection-demo3"}},"usetextselection-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"ACt2"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Je}},dependencies:{antd:{version:"4.15.3",css:"antd/dist/antd.css"},ahooks:{version:"2.10.2"},react:{version:">=16.9.0"},"react-dom":{version:">=16.9.0"}},title:"Translate user text selection","title.zh-CN":"\u5212\u8bcd\u7ffb\u8bd1",description:'<div class="markdown"><p>Use Antd.Popover to translate user text selection</p></div>',"description.zh-CN":'<div class="markdown"><p>\u914d\u5408 Popover \u505a\u5212\u8bcd\u7ffb\u8bd1</p></div>',identifier:"usetextselection-demo2"}},"usethrottle-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"aFWa"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Ye}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>ThrottledValue will change every 500ms.</p></div>',"description.zh-CN":'<div class="markdown"><p>ThrottledValue \u6bcf\u9694 500ms \u53d8\u5316\u4e00\u6b21\u3002</p></div>',identifier:"usethrottle-demo1"}},"usethrottleeffect-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"H0o/"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Ge}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},identifier:"usethrottleeffect-demo1"}},"usethrottlefn-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"rXjo"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Ze}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Frequent calls run, but the function is only executed every 500ms.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u9891\u7e41\u8c03\u7528 run\uff0c\u4f46\u53ea\u4f1a\u6bcf\u9694 500ms \u6267\u884c\u4e00\u6b21\u76f8\u5173\u51fd\u6570\u3002</p></div>',identifier:"usethrottlefn-demo1"}},"usetimeout-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"6sIe"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Qe}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Execute once after 3000ms</p></div>',"description.zh-CN":'<div class="markdown"><p>3000ms\u540e\u6267\u884c\u4e00\u6b21</p></div>',identifier:"usetimeout-demo1"}},"usetitle-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"dA01"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Xe}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>sets title of the page.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u8bbe\u7f6e\u9875\u9762\u6807\u9898</p></div>',identifier:"usetitle-demo1"}},"usetoggle-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"82LI"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:en}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>use boolean value as default\uff0cuse it as same as useBoolean.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u9ed8\u8ba4\u4e3a boolean \u5207\u6362\uff0c\u57fa\u7840\u7528\u6cd5\u4e0e useBoolean \u4e00\u81f4\u3002</p></div>',identifier:"usetoggle-demo1"}},"usetoggle-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"Dr+N"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:nn}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Switch between any two values","title.zh-CN":"\u5728\u4efb\u610f\u4e24\u4e2a\u503c\u4e4b\u95f4\u5207\u6362",description:'<div class="markdown"><p>Accept two parameters, switch between them.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u63a5\u53d7\u4e24\u4e2a\u53c2\u6570\uff0c\u5728\u53c2\u6570\u95f4\u8fdb\u884c\u5207\u6362\u3002</p></div>',identifier:"usetoggle-demo2"}},"usetrackedeffect-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"Tus0"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:tn}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Display the changed deps when effect function is executed.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u67e5\u770b\u6bcf\u6b21 effect \u6267\u884c\u65f6\u53d1\u751f\u53d8\u5316\u7684\u4f9d\u8d56\u9879</p></div>',identifier:"usetrackedeffect-demo1"}},"useunmount-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"y7Gi"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:rn}},dependencies:{antd:{version:"4.15.3",css:"antd/dist/antd.css"},ahooks:{version:"2.10.2"},react:{version:">=16.9.0"},"react-dom":{version:">=16.9.0"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>The function is called right before the component unmount.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5728\u7ec4\u4ef6\u5378\u8f7d\u65f6\uff0c\u6267\u884c\u65b9\u6cd5\u3002</p></div>',identifier:"useunmount-demo1"}},"useunmountedref-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"gT5F"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:on}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:"<div class=\"markdown\"><p>The function is called when the component is first rendered, and the returned object has a property named 'current' which indicates whether the current component has been unmounted</p></div>","description.zh-CN":'<div class="markdown"><p>\u5728\u7ec4\u4ef6\u9996\u6b21\u6e32\u67d3\u65f6\u6267\u884c\u65b9\u6cd5\uff0c\u8fd4\u56de\u4e00\u4e2a\u542b\u6709current\u5c5e\u6027\u7684ref\u5bf9\u8c61\uff0ccurrent\u8868\u793a\u5f53\u524d\u7ec4\u4ef6\u662f\u5426\u5df2\u88ab\u5378\u8f7d</p></div>',identifier:"useunmountedref-demo1"}},"useupdate-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"INwW"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:an}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},identifier:"useupdate-demo1"}},"useupdateeffect-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"vcr8"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:sn}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Basic usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>This hook is exactly the same as useEffect, except it omits the first render and only runs when dependencies update.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u4f7f\u7528\u4e0a\u4e0e useEffect \u5b8c\u5168\u76f8\u540c\uff0c\u53ea\u662f\u5b83\u5ffd\u7565\u4e86\u9996\u6b21\u6e32\u67d3\uff0c\u4e14\u53ea\u5728\u4f9d\u8d56\u9879\u66f4\u65b0\u65f6\u8fd0\u884c\u3002</p></div>',identifier:"useupdateeffect-demo1"}},"useupdatelayouteffect-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"Tl2l"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:un}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Basic usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>This hook is exactly the same as useLayoutEffect, except it omits the first render and only runs when dependencies update.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u4f7f\u7528\u4e0a\u4e0e useLayoutEffect \u5b8c\u5168\u76f8\u540c\uff0c\u53ea\u662f\u5b83\u5ffd\u7565\u4e86\u9996\u6b21\u6e32\u67d3\uff0c\u4e14\u53ea\u5728\u4f9d\u8d56\u9879\u66f4\u65b0\u65f6\u8fd0\u884c\u3002</p></div>',identifier:"useupdatelayouteffect-demo1"}},"usevirtuallist-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"7F18"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:cn}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>render 100,000 items in a list.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u6e32\u67d3\u5927\u91cf\u6570\u636e</p></div>',identifier:"usevirtuallist-demo1"}},"usevirtuallist-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"YukU"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:ln}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Dynamic item height","title.zh-CN":"\u52a8\u6001\u5143\u7d20\u9ad8\u5ea6",description:'<div class="markdown"><p>specify item height dynamically.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u52a8\u6001\u6307\u5b9a\u6bcf\u4e2a\u5143\u7d20\u7684\u9ad8\u5ea6</p></div>',identifier:"usevirtuallist-demo2"}},"usewebsocket-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"tags"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:dn}},dependencies:{react:{version:"^16.8.6 || ^17.0"},ahooks:{version:"2.10.2"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>WebSocket hooks used.</p></div>',"description.zh-CN":'<div class="markdown"><p>webSocket hooks \u4f7f\u7528</p></div>',identifier:"usewebsocket-demo1"}},"usewhydidyouupdate-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(147),t.e(5),t.e(9)]).then(t.bind(null,"A0Zk"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:pn}},dependencies:{ahooks:{version:"2.10.2"},react:{version:"^16.8.6 || ^17.0"}},title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",description:'<div class="markdown"><p>Update state or props, you can see the output in the console</p></div>',"description.zh-CN":'<div class="markdown"><p>\u66f4\u65b0 state \u6216 props\uff0c\u53ef\u4ee5\u5728\u63a7\u5236\u53f0\u770b\u5230\u8f93\u51fa</p></div>',identifier:"usewhydidyouupdate-demo1"}},"use-request-default":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(148),t.e(5),t.e(10)]).then(t.bind(null,"HZTY"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:mn}},dependencies:{ahooks:{version:"2.10.2"},mockjs:{version:"1.1.0"},react:{version:"^16.8.6 || ^17.0"}},componentName:"use-request",title:"Default Request","title.zh-CN":"\u9ed8\u8ba4\u8bf7\u6c42",description:'<div class="markdown"><p>In this example, useRequest receives an asynchronous function <code>getUsername</code>, which is automatically triggered when the component mounted. At the same time, useRequest will automatically manage the status of <code>loading</code>, <code>data</code>, and <code>error</code> of asynchronous requests.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c useRequest \u63a5\u6536\u4e86\u4e00\u4e2a\u5f02\u6b65\u51fd\u6570 <code>getUsername</code> \uff0c\u5728\u7ec4\u4ef6\u521d\u6b21\u52a0\u8f7d\u65f6\uff0c \u81ea\u52a8\u89e6\u53d1\u8be5\u51fd\u6570\u6267\u884c\u3002\u540c\u65f6 useRequest \u4f1a\u81ea\u52a8\u7ba1\u7406\u5f02\u6b65\u8bf7\u6c42\u7684 <code>loading</code> , <code>data</code> , <code>error</code> \u7b49\u72b6\u6001\u3002</p></div>',identifier:"use-request-default"}},"use-request-manual":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(148),t.e(5),t.e(10)]).then(t.bind(null,"gwZz"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:fn}},dependencies:{antd:{version:"4.15.3",css:"antd/dist/antd.css"},ahooks:{version:"2.10.2"},react:{version:">=16.9.0"},"react-dom":{version:">=16.9.0"}},componentName:"use-request",title:"Manual trigger","title.zh-CN":"\u624b\u52a8\u89e6\u53d1",description:'<div class="markdown"><p>If <code>options.manual</code> is set, the async function will only be executed when the <code>run</code> function is called.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u901a\u8fc7\u8bbe\u7f6e <code>options.manual = true</code> , \u5219\u9700\u8981\u624b\u52a8\u8c03\u7528 <code>run</code> \u65f6\u624d\u4f1a\u89e6\u53d1\u6267\u884c\u5f02\u6b65\u51fd\u6570\u3002</p></div>',identifier:"use-request-manual"}},"use-request-polling":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(148),t.e(5),t.e(10)]).then(t.bind(null,"my6v"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:vn}},dependencies:{ahooks:{version:"2.10.2"},react:{version:"^16.8.6 || ^17.0"},mockjs:{version:"1.1.0"}},componentName:"use-request",title:"Polling","title.zh-CN":"\u8f6e\u8be2",description:'<div class="markdown"><p>If <code>options.pollingInterval</code> is set, Polling can be turned on.</p>\n<ul>\n<li>You can set <code>options.pollingWhenHidden=false</code> to temporarily suspend the scheduled task when the screen is not visible.</li>\n<li>Use <code>run</code> / <code>cancel</code> to start / stop polling.</li>\n<li>When <code>options.manual=true</code>, you need to call the <code>run</code> function to start the polling.</li>\n</ul></div>',"description.zh-CN":'<div class="markdown"><p>\u901a\u8fc7\u8bbe\u7f6e <code>options.pollingInterval</code> \uff0c\u8fdb\u5165\u8f6e\u8be2\u6a21\u5f0f\uff0c\u5b9a\u65f6\u89e6\u53d1\u51fd\u6570\u6267\u884c\u3002</p>\n<ul>\n<li>\u901a\u8fc7\u8bbe\u7f6e <code>options.pollingWhenHidden=false</code> \uff0c\u5728\u5c4f\u5e55\u4e0d\u53ef\u89c1\u65f6\uff0c\u6682\u65f6\u6682\u505c\u5b9a\u65f6\u4efb\u52a1\u3002</li>\n<li>\u901a\u8fc7 <code>run</code> / <code>cancel</code> \u6765 \u5f00\u542f/\u505c\u6b62 \u8f6e\u8be2\u3002</li>\n<li>\u5728 <code>options.manual=true</code> \u65f6\uff0c\u9700\u8981\u7b2c\u4e00\u6b21\u6267\u884c <code>run</code> \u540e\uff0c\u624d\u5f00\u59cb\u8f6e\u8be2\u3002</li>\n</ul></div>',identifier:"use-request-polling"}},"use-request-concurrent":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(148),t.e(5),t.e(10)]).then(t.bind(null,"tm4u"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:hn}},dependencies:{antd:{version:"4.15.3",css:"antd/dist/antd.css"},ahooks:{version:"2.10.2"},react:{version:">=16.9.0"},"react-dom":{version:">=16.9.0"}},componentName:"use-request",title:"refreshOnWindowFocus","title.zh-CN":"\u5e76\u884c\u8bf7\u6c42",description:'<div class="markdown"><p>Through <code>options.fetchKey</code>, you can categorize requests. Each type of request has an independent status. You can find all requests in<code> fetches</code>.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u901a\u8fc7 <code>options.fetchKey</code> \uff0c\u53ef\u4ee5\u5c06\u8bf7\u6c42\u8fdb\u884c\u5206\u7c7b\uff0c\u6bcf\u4e00\u7c7b\u7684\u8bf7\u6c42\u90fd\u6709\u72ec\u7acb\u7684\u72b6\u6001\uff0c\u4f60\u53ef\u4ee5\u5728 <code>fetches</code> \u4e2d\u627e\u5230\u6240\u6709\u7684\u8bf7\u6c42\u3002</p></div>',identifier:"use-request-concurrent"}},"use-request-ready":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(148),t.e(5),t.e(10)]).then(t.bind(null,"MGx+"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:bn}},dependencies:{ahooks:{version:"2.10.2"},mockjs:{version:"1.1.0"},react:{version:"^16.8.6 || ^17.0"}},componentName:"use-request",title:"Dependent Request","title.zh-CN":"\u4f9d\u8d56\u8bf7\u6c42",description:'<div class="markdown"><p>Only when <code>options.ready</code> becomes true, will the request be initiated. Based on this feature, dependent requests can be implemented.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u53ea\u6709\u5f53 <code>options.ready</code> \u53d8\u4e3a true \u65f6, \u624d\u4f1a\u53d1\u8d77\u8bf7\u6c42\uff0c\u57fa\u4e8e\u8be5\u7279\u6027\u53ef\u4ee5\u5b9e\u73b0\u4e32\u884c\u8bf7\u6c42\uff0c\u4f9d\u8d56\u8bf7\u6c42\u7b49\u3002</p></div>',identifier:"use-request-ready"}},"use-request-debounce":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(148),t.e(5),t.e(10)]).then(t.bind(null,"xCmd"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:gn}},dependencies:{ahooks:{version:"2.10.2"},mockjs:{version:"1.1.0"},react:{version:"^16.8.6 || ^17.0"}},componentName:"use-request",title:"Debounce","title.zh-CN":"\u9632\u6296",description:'<div class="markdown"><p>If <code>options.debounceInterval</code> is set, requests except for the last one within the debounce interval will be dropped.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u901a\u8fc7\u8bbe\u7f6e <code>options.debounceInterval</code> \uff0c\u5219\u8fdb\u5165\u9632\u6296\u6a21\u5f0f\u3002\u6b64\u65f6\u5982\u679c\u9891\u7e41\u89e6\u53d1 <code>run</code> \uff0c\u5219\u4f1a\u4ee5\u9632\u6296\u7b56\u7565\u8fdb\u884c\u8bf7\u6c42\u3002</p></div>',identifier:"use-request-debounce"}},"use-request-throttle":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(148),t.e(5),t.e(10)]).then(t.bind(null,"vYAf"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:yn}},dependencies:{ahooks:{version:"2.10.2"},mockjs:{version:"1.1.0"},react:{version:"^16.8.6 || ^17.0"}},componentName:"use-request",title:"Throttle","title.zh-CN":"\u8282\u6d41",description:'<div class="markdown"><p>If <code>options.throttleInterval</code> is set, the request will be triggered once maximum within the throttle interval.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u901a\u8fc7\u8bbe\u7f6e <code>options.throttleInterval</code> \uff0c\u5219\u8fdb\u5165\u8282\u6d41\u6a21\u5f0f\u3002\u6b64\u65f6\u5982\u679c\u9891\u7e41\u89e6\u53d1 <code>run</code> \uff0c\u5219\u4f1a\u4ee5\u8282\u6d41\u7b56\u7565\u8fdb\u884c\u8bf7\u6c42\u3002</p></div>',identifier:"use-request-throttle"}},"use-request-cachekey":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(148),t.e(5),t.e(10)]).then(t.bind(null,"tHul"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:wn}},dependencies:{ahooks:{version:"2.10.2"},mockjs:{version:"1.1.0"},react:{version:"^16.8.6 || ^17.0"}},componentName:"use-request",title:"Cache & SWR","title.zh-CN":"\u7f13\u5b58 & SWR",description:'<div class="markdown"><p>If <code>options.cacheKey</code> is set, useRequest will cache the data of the previous request, and use it as the initial value while the next request is not returned, like SWR. You can set the cache data collected time through <code>cacheTime</code>, and you can set the data freshness time through <code>staleTime</code>.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5982\u679c\u8bbe\u7f6e\u4e86 <code>options.cacheKey</code> \uff0c useRequest \u4f1a\u5c06\u5f53\u524d\u8bf7\u6c42\u7ed3\u675f\u6570\u636e\u7f13\u5b58\u8d77\u6765\u3002\u4e0b\u6b21\u7ec4\u4ef6\u521d\u59cb\u5316\u65f6\uff0c\u5982\u679c\u6709\u7f13\u5b58\u6570\u636e\uff0c\u6211\u4eec\u4f1a\u4f18\u5148\u8fd4\u56de\u7f13\u5b58\u6570\u636e\uff0c\u7136\u540e\u5728\u80cc\u540e\u53d1\u9001\u65b0\u8bf7\u6c42\uff0c\u4e5f\u5c31\u662f SWR \u7684\u80fd\u529b\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7 <code>cacheTime</code> \u8bbe\u7f6e\u7f13\u5b58\u6570\u636e\u56de\u6536\u65f6\u95f4\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7 <code>staleTime</code> \u8bbe\u7f6e\u6570\u636e\u4fdd\u6301\u65b0\u9c9c\u65f6\u95f4\u3002</p></div>',identifier:"use-request-cachekey"}},"use-request-preload":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(148),t.e(5),t.e(10)]).then(t.bind(null,"3qZu"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:kn}},dependencies:{ahooks:{version:"2.10.2"},mockjs:{version:"1.1.0"},react:{version:"^16.8.6 || ^17.0"}},componentName:"use-request",title:"Preload","title.zh-CN":"\u9884\u52a0\u8f7d",description:'<div class="markdown"><p>Requests for the same <code>cacheKey</code> are shared globally, which means that you can load data in advance. With this feature, preloading can be easily implemented..</p></div>',"description.zh-CN":'<div class="markdown"><p>\u540c\u4e00\u4e2a <code>cacheKey</code> \u7684\u8bf7\u6c42\uff0c\u662f\u5168\u5c40\u5171\u4eab\u7684\uff0c\u4e5f\u5c31\u662f\u4f60\u53ef\u4ee5\u63d0\u524d\u52a0\u8f7d\u6570\u636e\u3002\u5229\u7528\u8be5\u7279\u6027\uff0c\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u5b9e\u73b0\u9884\u52a0\u8f7d\u3002</p></div>',identifier:"use-request-preload"}},"use-request-refreshonwindowfocus":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(148),t.e(5),t.e(10)]).then(t.bind(null,"Miin"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:xn}},dependencies:{antd:{version:"4.15.3",css:"antd/dist/antd.css"},ahooks:{version:"2.10.2"},react:{version:">=16.9.0"},mockjs:{version:"1.1.0"},"react-dom":{version:">=16.9.0"}},componentName:"use-request",title:"refreshOnWindowFocus","title.zh-CN":"\u5c4f\u5e55\u805a\u7126\u91cd\u65b0\u8bf7\u6c42",description:'<div class="markdown"><p>If <code>options.refreshOnWindowFocus</code> is set, useRequest will reRequest in the browser refocus or revisible. On next component load. You can set the request interval by setting <code>options.focusTimespan</code>. The default is 5000ms.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5982\u679c\u4f60\u8bbe\u7f6e\u4e86 <code>options.refreshOnWindowFocus = true</code> \uff0c\u5219\u5728\u6d4f\u89c8\u5668\u7a97\u53e3 <code>refocus</code> \u548c <code>revisible</code> \u65f6\uff0c\u4f1a\u91cd\u65b0\u53d1\u8d77\u8bf7\u6c42\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e <code>options.focusTimespan</code> \u6765\u8bbe\u7f6e\u8bf7\u6c42\u95f4\u9694\uff0c\u9ed8\u8ba4\u4e3a <code>5000ms</code> \u3002</p></div>',identifier:"use-request-refreshonwindowfocus"}},"use-request-mutate":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(148),t.e(5),t.e(10)]).then(t.bind(null,"wQD0"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Cn}},dependencies:{ahooks:{version:"2.10.2"},mockjs:{version:"1.1.0"},react:{version:"^16.8.6 || ^17.0"}},componentName:"use-request",title:"Mutate","title.zh-CN":"\u7a81\u53d8",description:'<div class="markdown"><p>You can use <code>mutate</code> to modify <code>data</code>. <code>mutate</code> parameters can be<code> newData</code> or <code>(oldData) => newData</code></p></div>',"description.zh-CN":'<div class="markdown"><p>\u4f60\u53ef\u4ee5\u901a\u8fc7 <code>mutate</code> \uff0c\u76f4\u63a5\u4fee\u6539 <code>data</code> \u3002 <code>mutate</code> \u51fd\u6570\u53c2\u6570\u53ef\u4ee5\u4e3a <code>newData</code> \u6216 <code>(oldData)=> newData</code> \u3002</p></div>',identifier:"use-request-mutate"}},"use-request-loadingdelay":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(148),t.e(5),t.e(10)]).then(t.bind(null,"deP+"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Sn}},dependencies:{ahooks:{version:"2.10.2"},react:{version:"^16.8.6 || ^17.0"}},componentName:"use-request",title:"Loading Delay","title.zh-CN":"Loading Delay",description:'<div class="markdown"><p>Setting <code>options.loadingDelay</code> can specifies a delay in milliseconds for loading (prevent flush).</p></div>',"description.zh-CN":'<div class="markdown"><p>\u901a\u8fc7\u8bbe\u7f6e <code>options.loadingDelay</code> \uff0c\u53ef\u4ee5\u5ef6\u8fdf <code>loading</code> \u53d8\u6210 <code>true</code> \u7684\u65f6\u95f4\uff0c\u6709\u6548\u9632\u6b62\u95ea\u70c1\u3002</p></div>',identifier:"use-request-loadingdelay"}},"use-request-refreshdeps":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(148),t.e(5),t.e(10)]).then(t.bind(null,"FUtD"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Pn}},dependencies:{ahooks:{version:"2.10.2"},react:{version:"^16.8.6 || ^17.0"}},componentName:"use-request",title:"refreshDeps","title.zh-CN":"refreshDeps",description:'<div class="markdown"><p>When <code>options.refreshDeps</code> changes, useRequest will execute the service with previous params.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5f53 <code>options.refreshDeps</code> \u53d8\u5316\u65f6\uff0cuseRequest \u4f1a\u4f7f\u7528\u4e4b\u524d\u7684\u53c2\u6570\u91cd\u65b0\u6267\u884c service\u3002</p></div>',identifier:"use-request-refreshdeps"}},"use-request-fetch":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(148),t.e(5),t.e(10)]).then(t.bind(null,"qJMn"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Rn}},dependencies:{ahooks:{version:"2.10.2"},react:{version:"^16.8.6 || ^17.0"}},componentName:"use-request",title:"Use default fetch","title.zh-CN":"\u4f7f\u7528\u9ed8\u8ba4\u7684 fetch",description:'<div class="markdown"><p>If the first parameter of useRequest is <code>string</code>\u3001<code>object</code> or <code>()=> string|object</code>, the network request will be sent by fetch.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5982\u679c useRequest \u7b2c\u4e00\u4e2a\u53c2\u6570\u662f <code>string</code>\u3001<code>object</code> \u6216 <code>()=> string|object</code>\uff0c\u5219\u9ed8\u8ba4\u4f7f\u7528 fetch \u53d1\u9001\u7f51\u7edc\u8bf7\u6c42</p></div>',identifier:"use-request-fetch"}},"use-request-axios":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(148),t.e(5),t.e(10)]).then(t.bind(null,"NgPO"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:On}},dependencies:{ahooks:{version:"2.10.2"},react:{version:"^16.8.6 || ^17.0"},axios:{version:"0.21.1"}},componentName:"use-request",title:"Use axios","title.zh-CN":"\u4f7f\u7528 axios",description:'<div class="markdown"><p>By setting <code>requstMethod</code>, you can use your own request library.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u901a\u8fc7\u8bbe\u7f6e <code>requstMethod</code>, \u53ef\u4ee5\u4f7f\u7528\u81ea\u5df1\u7684\u8bf7\u6c42\u5e93\u3002</p></div>',identifier:"use-request-axios"}},"use-request-pagination-1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(148),t.e(5),t.e(10)]).then(t.bind(null,"G/D3"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:jn}},dependencies:{antd:{version:"4.15.3",css:"antd/dist/antd.css"},ahooks:{version:"2.10.2"},react:{version:">=16.9.0"},mockjs:{version:"1.1.0"},"react-dom":{version:">=16.9.0"}},componentName:"use-request",title:"Default pagination","title.zh-CN":"\u666e\u901a\u5206\u9875",description:'<div class="markdown"><p>For normal paging scenarios, useRequest will manage <code>current</code> and <code>pageSize</code> automaticlly.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u666e\u901a\u7684\u5206\u9875\u573a\u666f\uff0c\u6211\u4eec\u4f1a\u81ea\u52a8\u7ba1\u7406 <code>current</code> \u548c <code>pageSize</code>\u3002</p></div>',identifier:"use-request-pagination-1"}},"use-request-pagination-antd":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(148),t.e(5),t.e(10)]).then(t.bind(null,"kX6S"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:In}},dependencies:{antd:{version:"4.15.3",css:"antd/dist/antd.css"},ahooks:{version:"2.10.2"},react:{version:">=16.9.0"},mockjs:{version:"1.1.0"},"react-dom":{version:">=16.9.0"}},componentName:"use-request",title:"antd Table","title.zh-CN":"antd Table",description:'<div class="markdown"><p>Since antd [Table] (<a href="https://ant.design/components/table-cn/" target="_blank">https://ant.design/components/table-cn/<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="__dumi-default-external-link-icon"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a>) is widely used, we especially support the paging format required by antd Table, and <code>sorter</code>,<code> filters</code>, etc. You can access these properties via <code>result.tableProps</code>, <code>result.params[0]?.filters</code>, <code>result.params[0]?.sorter</code>.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u7531\u4e8e antd <a href="https://ant.design/components/table-cn/" target="_blank">Table<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="__dumi-default-external-link-icon"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg></a> \u4f7f\u7528\u6bd4\u8f83\u5e7f\u6cdb\uff0c\u6211\u4eec\u7279\u522b\u652f\u6301\u4e86 antd Table \u9700\u8981\u7684\u5206\u9875\u683c\u5f0f\uff0c\u53ca <code>sorter</code> \u3001 <code>filters</code> \u7b49\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7 <code>result.tableProps</code> \uff0c <code>result.params[0]?.filters</code> \uff0c <code>result.params[0]?.sorter</code> \u8bbf\u95ee\u5230\u8fd9\u4e9b\u5c5e\u6027\u3002</p></div>',identifier:"use-request-pagination-antd"}},"use-request-pagination-cache":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(148),t.e(5),t.e(10)]).then(t.bind(null,"SVLP"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Tn}},dependencies:{antd:{version:"4.15.3",css:"antd/dist/antd.css"},ahooks:{version:"2.10.2"},mockjs:{version:"1.1.0"},react:{version:">=16.9.0"},"react-dom":{version:">=16.9.0"}},componentName:"use-request",title:"With Cache","title.zh-CN":"\u5e26\u7f13\u5b58\u7684 Pagination",description:'<div class="markdown"><p>In the scenario where <code>cacheKey</code> is set, the <code>params</code> of <code>run</code> can be cached. Using this feature, we can implement caching of pagination-related conditions.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5728 <code>cacheKey</code> \u573a\u666f\u4e0b\uff0c <code>run</code> \u7684\u53c2\u6570 <code>params</code> \u662f\u53ef\u4ee5\u7f13\u5b58\u7684\uff0c\u5229\u7528\u8fd9\u4e2a\u7279\u70b9\uff0c\u6211\u4eec\u53ef\u4ee5\u5b9e\u73b0 pagination \u76f8\u5173\u6761\u4ef6\u7684\u7f13\u5b58\u3002</p></div>',identifier:"use-request-pagination-cache"}},"use-request-loadmore-1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(148),t.e(5),t.e(10)]).then(t.bind(null,"jNcR"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:zn}},dependencies:{ahooks:{version:"2.10.2"},react:{version:"^16.8.6 || ^17.0"}},componentName:"use-request",title:"LoadMore default useage","title.zh-CN":"\u52a0\u8f7d\u66f4\u591a\u57fa\u672c\u7528\u6cd5",description:'<div class="markdown"><p>If <code>options.cacheKey</code> is set, the data will be cached.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u901a\u8fc7\u8bbe\u7f6e cacheKey\uff0c\u53ef\u4ee5\u7f13\u5b58\u6240\u6709 list \u6570\u636e\u3002</p></div>',identifier:"use-request-loadmore-1"}},"use-request-loadmore-2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.e(2),t.e(6),t.e(148),t.e(5),t.e(10)]).then(t.bind(null,"37VS"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Fn}},dependencies:{ahooks:{version:"2.10.2"},react:{version:"^16.8.6 || ^17.0"}},componentName:"use-request",title:"Pull up to load more","title.zh-CN":"\u4e0a\u62c9\u52a0\u8f7d\u66f4\u591a",description:'<div class="markdown"><p>If <code>options.ref</code> is set, loadMore is automatically triggered when scrolling to the bottom. Of course you must set <code>isNoMore</code> at this time so that <code>useRequest</code> will know when to stop.</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5982\u679c options \u4e2d\u5b58\u5728 <code>ref</code>\uff0c\u5219\u5728\u6eda\u52a8\u5230\u5e95\u90e8\u65f6\uff0c\u81ea\u52a8\u89e6\u53d1 loadMore\u3002\u5f53\u7136\u6b64\u65f6\u4f60\u5fc5\u987b\u8bbe\u7f6e <code>isNoMore</code>, \u4ee5\u4fbf\u8ba9 <code>useRequest</code> \u77e5\u9053\u4f55\u65f6\u505c\u6b62\u3002</p></div>',identifier:"use-request-loadmore-2"}},"use-url-state-demo1":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,t.e(7).then(t.bind(null,"bS7p"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Nn}},dependencies:{react:{version:"^16.8.6"},"@ahooksjs/use-url-state":{version:"2.5.6"},"react-router":{version:"^5.0.0"}},componentName:"use-url-state",title:"Default usage","title.zh-CN":"\u57fa\u7840\u7528\u6cd5",hideActions:["CSB"],description:'<div class="markdown"><p>store the state into url query parameter</p></div>',"description.zh-CN":'<div class="markdown"><p>\u5c06\u72b6\u6001\u540c\u6b65\u5230 url query \u4e2d</p></div>',identifier:"use-url-state-demo1"}},"use-url-state-demo2":{component:Object(s["dynamic"])({loader:function(){var e=Object(r["a"])(a.a.mark((function e(){return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,t.e(7).then(t.bind(null,"Gemd"));case 2:return e.abrupt("return",e.sent.default);case 3:case"end":return e.stop()}}),e)})));function n(){return e.apply(this,arguments)}return n}()}),previewerProps:{sources:{_:{tsx:Dn}},dependencies:{react:{version:"^16.8.6"},"@ahooksjs/use-url-state":{version:"2.5.6"},"react-router":{version:"^5.0.0"}},componentName:"use-url-state",title:"Multi-state management","title.zh-CN":"\u591a\u72b6\u6001\u7ba1\u7406",hideActions:["CSB"],description:'<div class="markdown"><p>useUrlState can manage multiple states at the same time</p></div>',"description.zh-CN":'<div class="markdown"><p>useUrlState \u53ef\u4ee5\u540c\u65f6\u7ba1\u7406\u591a\u4e2a\u72b6\u6001</p></div>',identifier:"use-url-state-demo2"}}}},MZF8:function(e,n,t){"use strict";var r=t("ogwx");t.d(n,"a",(function(){return r["b"]}));var o=t("VCU9");t.d(n,"b",(function(){return o["a"]}))},Zs1V:function(e){e.exports=JSON.parse("{}")},"n5/e":function(e,n,t){"use strict";t.r(n);var r=t("q1tI"),o=t.n(r),a=t("dEAq"),s=t("0zqC"),i=t("ZpkN"),u=t("JjdP"),c=o.a.memo(u["default"]["usekeypress-demo1"].component),l=o.a.memo(u["default"]["usekeypress-demo2"].component),d=o.a.memo(u["default"]["usekeypress-demo3"].component),p=o.a.memo(u["default"]["usekeypress-demo4"].component),m=o.a.memo(u["default"]["usekeypress-demo5"].component);n["default"]=()=>(o.a.useEffect((()=>{window.location.hash&&a["AnchorLink"].scrollToAnchor(decodeURIComponent(window.location.hash.slice(1)))}),[]),o.a.createElement(o.a.Fragment,null,o.a.createElement(o.a.Fragment,null,o.a.createElement("div",{className:"markdown"},o.a.createElement("h1",{id:"usekeypress"},o.a.createElement(a["AnchorLink"],{to:"#usekeypress","aria-hidden":"true",tabIndex:-1},o.a.createElement("span",{className:"icon icon-link"})),"useKeyPress"),o.a.createElement("p",null,"\u4e00\u4e2a\u4f18\u96c5\u7684\u7ba1\u7406 keyup \u548c keydown \u952e\u76d8\u4e8b\u4ef6\u7684 Hook\uff0c\u652f\u6301\u952e\u76d8\u7ec4\u5408\u952e\uff0c\u5b9a\u4e49\u952e\u76d8\u4e8b\u4ef6\u7684 key \u548c keyCode \u522b\u540d\u8f93\u5165 \u3002"),o.a.createElement("h2",{id:"\u4ee3\u7801\u6f14\u793a"},o.a.createElement(a["AnchorLink"],{to:"#\u4ee3\u7801\u6f14\u793a","aria-hidden":"true",tabIndex:-1},o.a.createElement("span",{className:"icon icon-link"})),"\u4ee3\u7801\u6f14\u793a"),o.a.createElement("h3",{id:"\u57fa\u7840\u7528\u6cd5"},o.a.createElement(a["AnchorLink"],{to:"#\u57fa\u7840\u7528\u6cd5","aria-hidden":"true",tabIndex:-1},o.a.createElement("span",{className:"icon icon-link"})),"\u57fa\u7840\u7528\u6cd5")),o.a.createElement(s["default"],u["default"]["usekeypress-demo1"].previewerProps,o.a.createElement(c,null)),o.a.createElement("div",{className:"markdown"},o.a.createElement("h3",{id:"\u4f7f\u7528\u522b\u540d"},o.a.createElement(a["AnchorLink"],{to:"#\u4f7f\u7528\u522b\u540d","aria-hidden":"true",tabIndex:-1},o.a.createElement("span",{className:"icon icon-link"})),"\u4f7f\u7528\u522b\u540d")),o.a.createElement(s["default"],u["default"]["usekeypress-demo2"].previewerProps,o.a.createElement(l,null)),o.a.createElement("div",{className:"markdown"},o.a.createElement("h3",{id:"\u7ec4\u5408\u65b9\u5f0f"},o.a.createElement(a["AnchorLink"],{to:"#\u7ec4\u5408\u65b9\u5f0f","aria-hidden":"true",tabIndex:-1},o.a.createElement("span",{className:"icon icon-link"})),"\u7ec4\u5408\u65b9\u5f0f")),o.a.createElement(s["default"],u["default"]["usekeypress-demo3"].previewerProps,o.a.createElement(d,null)),o.a.createElement("div",{className:"markdown"},o.a.createElement("h3",{id:"\u8fdb\u9636\u4f7f\u7528"},o.a.createElement(a["AnchorLink"],{to:"#\u8fdb\u9636\u4f7f\u7528","aria-hidden":"true",tabIndex:-1},o.a.createElement("span",{className:"icon icon-link"})),"\u8fdb\u9636\u4f7f\u7528")),o.a.createElement(s["default"],u["default"]["usekeypress-demo4"].previewerProps,o.a.createElement(p,null)),o.a.createElement("div",{className:"markdown"},o.a.createElement("h3",{id:"\u81ea\u5b9a\u4e49-dom"},o.a.createElement(a["AnchorLink"],{to:"#\u81ea\u5b9a\u4e49-dom","aria-hidden":"true",tabIndex:-1},o.a.createElement("span",{className:"icon icon-link"})),"\u81ea\u5b9a\u4e49 DOM")),o.a.createElement(s["default"],u["default"]["usekeypress-demo5"].previewerProps,o.a.createElement(m,null)),o.a.createElement("div",{className:"markdown"},o.a.createElement("h2",{id:"api"},o.a.createElement(a["AnchorLink"],{to:"#api","aria-hidden":"true",tabIndex:-1},o.a.createElement("span",{className:"icon icon-link"})),"API"),o.a.createElement(i["a"],{code:"useKeyPress(\n keyFilter: KeyFilter, \n eventHandler: EventHandler = noop, \n options?: Options\n)",lang:"typescript"}),o.a.createElement("h3",{id:"params"},o.a.createElement(a["AnchorLink"],{to:"#params","aria-hidden":"true",tabIndex:-1},o.a.createElement("span",{className:"icon icon-link"})),"Params"),o.a.createElement("blockquote",null,o.a.createElement("p",null,"Tips: keyType \u4e3a\u952e\u76d8\u4e8b\u4ef6\u4e2d\u7684 key \u548c keyCode")),o.a.createElement("table",null,o.a.createElement("thead",null,o.a.createElement("tr",null,o.a.createElement("th",null,"\u53c2\u6570"),o.a.createElement("th",null,"\u8bf4\u660e"),o.a.createElement("th",null,"\u7c7b\u578b"),o.a.createElement("th",null,"\u9ed8\u8ba4\u503c"))),o.a.createElement("tbody",null,o.a.createElement("tr",null,o.a.createElement("td",null,"keyFilter"),o.a.createElement("td",null,"\u652f\u6301\u952e\u76d8\u4e8b\u4ef6\u4e2d\u7684 key \u548c keyCode\uff0c\u652f\u6301\u56de\u8c03\u65b9\u5f0f\u8fd4\u56de boolean \u5224\u65ad\uff0c\u652f\u6301\u522b\u540d\u4f7f\u7528"),o.a.createElement("td",null,o.a.createElement("code",null,"keyType")," | ",o.a.createElement("code",null,"Array<keyType>")," | ",o.a.createElement("code",null,"(event: KeyboardEvent) => boolean")),o.a.createElement("td",null,"-")),o.a.createElement("tr",null,o.a.createElement("td",null,"eventHandler"),o.a.createElement("td",null,"\u4e8b\u4ef6\u56de\u8c03\u51fd\u6570"),o.a.createElement("td",null,o.a.createElement("code",null,"(event: KeyboardEvent) => void")),o.a.createElement("td",null,"-")),o.a.createElement("tr",null,o.a.createElement("td",null,"options"),o.a.createElement("td",null,"\u53ef\u9009\u914d\u7f6e\u9879\uff0c\u89c1 Options"),o.a.createElement("td",null,o.a.createElement("code",null,"Options")),o.a.createElement("td",null,"-")))),o.a.createElement("h3",{id:"options"},o.a.createElement(a["AnchorLink"],{to:"#options","aria-hidden":"true",tabIndex:-1},o.a.createElement("span",{className:"icon icon-link"})),"Options"),o.a.createElement("table",null,o.a.createElement("thead",null,o.a.createElement("tr",null,o.a.createElement("th",null,"\u53c2\u6570"),o.a.createElement("th",null,"\u8bf4\u660e"),o.a.createElement("th",null,"\u7c7b\u578b"),o.a.createElement("th",null,"\u9ed8\u8ba4\u503c"))),o.a.createElement("tbody",null,o.a.createElement("tr",null,o.a.createElement("td",null,"events"),o.a.createElement("td",null,"\u89e6\u53d1\u4e8b\u4ef6"),o.a.createElement("td",null,"Array<keydown | keyup>"),o.a.createElement("td",null,o.a.createElement("code",null,"['keydown']"))),o.a.createElement("tr",null,o.a.createElement("td",null,"target"),o.a.createElement("td",null,"DOM \u8282\u70b9\u6216\u8005 Ref \u5bf9\u8c61"),o.a.createElement("td",null,o.a.createElement("code",null,"() => HTMLElement")," | ",o.a.createElement("code",null,"HTMLElement")," | ",o.a.createElement("code",null,"React.MutableRefObject")),o.a.createElement("td",null,"-")))),o.a.createElement("h2",{id:"remarks"},o.a.createElement(a["AnchorLink"],{to:"#remarks","aria-hidden":"true",tabIndex:-1},o.a.createElement("span",{className:"icon icon-link"})),"Remarks"),o.a.createElement("p",null,"1.\u5168\u90e8\u7684\u6309\u952e\u522b\u540d"),o.a.createElement(i["a"],{code:"enter\ntab\ndelete (\u6355\u83b7\u201c\u5220\u9664\u201d\u548c\u201c\u9000\u683c\u201d\u952e)\nesc\nspace\nup\ndown\nleft\nright",lang:"javascript"}),o.a.createElement("p",null,"2.\u4fee\u9970\u952e"),o.a.createElement(i["a"],{code:"ctrl\nalt\nshift\nmeta",lang:"javascript"})))))}}]);
|
module.exports = {
extends: ['./shared/core.js', './shared/typescript.js', './shared/prettier.js'],
plugins: ['node'],
env: { node: true },
rules: {
'no-buffer-constructor': 'warn',
'node/no-path-concat': 'warn',
},
};
|
// TODO: Test drag-and-drop in the layout
import {
DIMENSION_ID_DATA,
DIMENSION_ID_PERIOD,
DIMENSION_ID_ASSIGNED_CATEGORIES,
AXIS_ID_COLUMNS,
AXIS_ID_FILTERS,
getFixedDimensions,
getDynamicDimensions,
} from '@dhis2/analytics'
import {
expectDimensionModalToBeVisible,
clickDimensionModalHideButton,
expectDimensionModalToNotBeVisible,
} from '../elements/dimensionModal'
import {
openDimension,
openContextMenu,
clickContextMenuAdd,
clickContextMenuRemove,
clickContextMenuMove,
expectDimensionToHaveSelectedStyle,
clickContextMenuDimSubMenu,
expectAxisToHaveDimension,
expectAxisToNotHaveDimension,
expectLayoutToNotHaveDimension,
} from '../elements/layout'
import { goToStartPage } from '../elements/startScreen'
const TEST_FIXED_DIMS = Object.values(getFixedDimensions())
const TEST_DYNAMIC_DIMS = Object.values(getDynamicDimensions())
describe('interacting with the layout', () => {
it('navigates to the start page', () => {
goToStartPage()
})
describe('opening items by clicking them', () => {
TEST_FIXED_DIMS.forEach(dim => {
it(`opens and closes ${dim.name}`, () => {
openDimension(dim.id)
expectDimensionModalToBeVisible(dim.id)
clickDimensionModalHideButton()
expectDimensionModalToNotBeVisible()
})
})
})
describe('moving items by using the context menu', () => {
const TEST_AXIS = AXIS_ID_FILTERS
const TEST_DIM = TEST_FIXED_DIMS.find(
dim => dim.id === DIMENSION_ID_DATA
)
it(`moves ${TEST_DIM.name} to ${TEST_AXIS}`, () => {
openContextMenu(TEST_DIM.id)
clickContextMenuMove(TEST_DIM.id, TEST_AXIS)
expectAxisToHaveDimension(TEST_AXIS, TEST_DIM.id)
})
})
describe('removing item by using the context menu', () => {
const TEST_DIM = TEST_FIXED_DIMS.find(
dim => dim.id === DIMENSION_ID_PERIOD
)
it(`removes ${TEST_DIM.name}`, () => {
openContextMenu(TEST_DIM.id)
clickContextMenuRemove(TEST_DIM.id)
expectLayoutToNotHaveDimension(TEST_DIM.id)
})
})
describe('handling AC by using the Data item context menu', () => {
const TEST_DIM = TEST_DYNAMIC_DIMS.find(
dim => dim.id === DIMENSION_ID_ASSIGNED_CATEGORIES
)
const TEST_AXIS = AXIS_ID_COLUMNS
it(`adds and removes ${TEST_DIM.name}`, () => {
// add
openContextMenu(DIMENSION_ID_DATA)
clickContextMenuDimSubMenu(TEST_DIM.id)
clickContextMenuAdd(TEST_DIM.id, TEST_AXIS)
expectDimensionToHaveSelectedStyle(TEST_DIM.id)
expectAxisToHaveDimension(TEST_AXIS, TEST_DIM.id)
// remove
openContextMenu(DIMENSION_ID_DATA)
clickContextMenuRemove(TEST_DIM.id)
expectAxisToNotHaveDimension(TEST_AXIS, TEST_DIM.id)
})
})
})
|
import {Linking} from 'react-native';
import moment from 'moment';
import _ from 'underscore';
import lodashGet from 'lodash/get';
import ExpensiMark from 'expensify-common/lib/ExpensiMark';
import Str from 'expensify-common/lib/str';
import Onyx from 'react-native-onyx';
import ONYXKEYS from '../../ONYXKEYS';
import * as Pusher from '../Pusher/pusher';
import LocalNotification from '../Notification/LocalNotification';
import PushNotification from '../Notification/PushNotification';
import * as PersonalDetails from './PersonalDetails';
import * as User from './User';
import Navigation from '../Navigation/Navigation';
import * as ActiveClientManager from '../ActiveClientManager';
import Visibility from '../Visibility';
import ROUTES from '../../ROUTES';
import NetworkConnection from '../NetworkConnection';
import Timing from './Timing';
import * as DeprecatedAPI from '../deprecatedAPI';
import CONFIG from '../../CONFIG';
import CONST from '../../CONST';
import Log from '../Log';
import * as LoginUtils from '../LoginUtils';
import * as ReportUtils from '../ReportUtils';
import Timers from '../Timers';
import * as ReportActions from './ReportActions';
import Growl from '../Growl';
import * as Localize from '../Localize';
let currentUserEmail;
let currentUserAccountID;
Onyx.connect({
key: ONYXKEYS.SESSION,
callback: (val) => {
// When signed out, val is undefined
if (!val) {
return;
}
currentUserEmail = val.email;
currentUserAccountID = val.accountID;
},
});
let lastViewedReportID;
Onyx.connect({
key: ONYXKEYS.CURRENTLY_VIEWED_REPORTID,
callback: val => lastViewedReportID = val ? Number(val) : null,
});
let myPersonalDetails;
Onyx.connect({
key: ONYXKEYS.MY_PERSONAL_DETAILS,
callback: val => myPersonalDetails = val,
});
const allReports = {};
let conciergeChatReportID;
const typingWatchTimers = {};
/**
* Map of the most recent sequenceNumber for a reports_* key in Onyx by reportID.
*
* There are several sources that can set the most recent reportAction's sequenceNumber for a report:
*
* - Fetching the report object
* - Fetching the report history
* - Optimistically creating a report action
* - Handling a report action via Pusher
*
* Those values are stored in reportMaxSequenceNumbers and treated as the main source of truth for each report's max
* sequenceNumber.
*/
const reportMaxSequenceNumbers = {};
// Keeps track of the last read for each report
const lastReadSequenceNumbers = {};
// Map of optimistic report action IDs. These should be cleared when replaced by a recent fetch of report history
// since we will then be up to date and any optimistic actions that are still waiting to be replaced can be removed.
const optimisticReportActionIDs = {};
// Boolean to indicate if report data is loading from the API or not.
let isReportDataLoading = true;
Onyx.connect({
key: ONYXKEYS.IS_LOADING_REPORT_DATA,
callback: val => isReportDataLoading = val,
});
/**
* Checks the report to see if there are any unread action items
*
* @param {Object} report
* @returns {Boolean}
*/
function getUnreadActionCount(report) {
const lastReadSequenceNumber = lodashGet(report, [
'reportNameValuePairs',
`lastRead_${currentUserAccountID}`,
'sequenceNumber',
]);
// Save the lastReadActionID locally so we can access this later
lastReadSequenceNumbers[report.reportID] = lastReadSequenceNumber;
if (report.reportActionCount === 0) {
return 0;
}
if (!lastReadSequenceNumber) {
return report.reportActionCount;
}
// There are unread items if the last one the user has read is less
// than the highest sequence number we have
const unreadActionCount = report.reportActionCount - lastReadSequenceNumber - ReportActions.getDeletedCommentsCount(report.reportID, lastReadSequenceNumber);
return Math.max(0, unreadActionCount);
}
/**
* @param {Object} report
* @return {String[]}
*/
function getParticipantEmailsFromReport({sharedReportList, reportNameValuePairs, ownerEmail}) {
const emailArray = _.map(sharedReportList, participant => participant.email);
if (ReportUtils.isChatRoom(reportNameValuePairs)) {
return emailArray;
}
if (ReportUtils.isPolicyExpenseChat(reportNameValuePairs)) {
// The owner of the policyExpenseChat isn't in the sharedReportsList so they need to be explicitly included.
return [ownerEmail, ...emailArray];
}
// The current user is excluded from the participants array in DMs/Group DMs because their participation is implied
// by the chat being shared to them. This also prevents the user's own avatar from being a part of the chat avatar.
return _.without(emailArray, currentUserEmail);
}
/**
* Returns the title for a default room, a policy room or generates one based on the participants
*
* @param {Object} fullReport
* @param {String} chatType
* @param {String} oldPolicyName
* @return {String}
*/
function getChatReportName(fullReport, chatType, oldPolicyName) {
const isArchivedRoom = ReportUtils.isArchivedRoom({
chatType,
stateNum: fullReport.state,
statusNum: fullReport.status,
});
if (ReportUtils.isDefaultRoom({chatType})) {
return `#${fullReport.reportName}${isArchivedRoom ? ` (${Localize.translateLocal('common.deleted')})` : ''}`;
}
// For a basic policy room, return its original name
if (ReportUtils.isUserCreatedPolicyRoom({chatType})) {
return LoginUtils.getEmailWithoutMergedAccountPrefix(fullReport.reportName);
}
if (ReportUtils.isPolicyExpenseChat({chatType})) {
const name = (isArchivedRoom && fullReport.isOwnPolicyExpenseChat)
? oldPolicyName
: LoginUtils.getEmailWithoutMergedAccountPrefix(lodashGet(fullReport, ['reportName'], ''));
return `${name}${isArchivedRoom ? ` (${Localize.translateLocal('common.archived')})` : ''}`;
}
const {sharedReportList} = fullReport;
return _.chain(sharedReportList)
.map(participant => participant.email)
.filter(participant => participant !== currentUserEmail)
.map(participant => PersonalDetails.getDisplayName(participant))
.value()
.join(', ');
}
/**
* Only store the minimal amount of data in Onyx that needs to be stored
* because space is limited
*
* @param {Object} report
* @param {Number} report.reportID
* @param {String} report.reportName
* @param {Object} report.reportNameValuePairs
* @returns {Object}
*/
function getSimplifiedReportObject(report) {
const createTimestamp = lodashGet(report, 'lastActionCreated', 0);
const lastMessageTimestamp = moment.utc(createTimestamp).unix();
const lastActionMessage = lodashGet(report, ['lastActionMessage', 'html'], '');
const isLastMessageAttachment = new RegExp(`<img|a\\s[^>]*${CONST.ATTACHMENT_SOURCE_ATTRIBUTE}\\s*=\\s*"[^"]*"[^>]*>`, 'gi').test(lastActionMessage);
const chatType = lodashGet(report, ['reportNameValuePairs', 'chatType'], '');
let lastMessageText = null;
if (report.reportActionCount > 0) {
// We are removing any html tags from the message html since we cannot access the text version of any comments as
// the report only has the raw reportActionList and not the processed version returned by Report_GetHistory
// We convert the line-breaks in html to space ' ' before striping the tags
lastMessageText = lastActionMessage
.replace(/((<br[^>]*>)+)/gi, ' ')
.replace(/(<([^>]+)>)/gi, '');
lastMessageText = ReportUtils.formatReportLastMessageText(lastMessageText);
}
// Used for archived rooms, will store the policy name that the room used to belong to.
const oldPolicyName = lodashGet(report, ['reportNameValuePairs', 'oldPolicyName'], '');
const reportName = lodashGet(report, ['reportNameValuePairs', 'type']) === 'chat'
? getChatReportName(report, chatType, oldPolicyName)
: report.reportName;
const lastActorEmail = lodashGet(report, 'lastActionActorEmail', '');
const notificationPreference = ReportUtils.isChatRoom({chatType})
? lodashGet(report, ['reportNameValuePairs', 'notificationPreferences', currentUserAccountID], 'daily')
: '';
// Used for User Created Policy Rooms, will denote how access to a chat room is given among workspace members
const visibility = lodashGet(report, ['reportNameValuePairs', 'visibility']);
return {
reportID: report.reportID,
reportName,
chatType,
ownerEmail: LoginUtils.getEmailWithoutMergedAccountPrefix(lodashGet(report, ['ownerEmail'], '')),
policyID: lodashGet(report, ['reportNameValuePairs', 'expensify_policyID'], ''),
unreadActionCount: getUnreadActionCount(report),
maxSequenceNumber: lodashGet(report, 'reportActionCount', 0),
participants: getParticipantEmailsFromReport(report),
isPinned: report.isPinned,
lastVisitedTimestamp: lodashGet(report, [
'reportNameValuePairs',
`lastRead_${currentUserAccountID}`,
'timestamp',
], 0),
lastMessageTimestamp,
lastMessageText: isLastMessageAttachment ? '[Attachment]' : lastMessageText,
lastActorEmail,
hasOutstandingIOU: false,
notificationPreference,
stateNum: report.state,
statusNum: report.status,
oldPolicyName,
visibility,
isOwnPolicyExpenseChat: lodashGet(report, ['isOwnPolicyExpenseChat'], false),
lastMessageHtml: lastActionMessage,
};
}
/**
* Get a simplified version of an IOU report
*
* @param {Object} reportData
* @param {String} reportData.transactionID
* @param {Number} reportData.amount
* @param {String} reportData.currency
* @param {String} reportData.created
* @param {String} reportData.comment
* @param {Object[]} reportData.transactionList
* @param {String} reportData.ownerEmail
* @param {String} reportData.managerEmail
* @param {Number} reportData.reportID
* @param {Number|String} chatReportID
* @returns {Object}
*/
function getSimplifiedIOUReport(reportData, chatReportID) {
return {
reportID: reportData.reportID,
ownerEmail: reportData.ownerEmail,
managerEmail: reportData.managerEmail,
currency: reportData.currency,
chatReportID: Number(chatReportID),
state: reportData.state,
cachedTotal: reportData.cachedTotal,
total: reportData.total,
status: reportData.status,
stateNum: reportData.stateNum,
submitterPayPalMeAddress: reportData.submitterPayPalMeAddress,
submitterPhoneNumbers: reportData.submitterPhoneNumbers,
hasOutstandingIOU: reportData.stateNum === CONST.REPORT.STATE_NUM.PROCESSING && reportData.total !== 0,
};
}
/**
* Given IOU and chat report ID fetches most recent IOU data from DeprecatedAPI.
*
* @param {Number} iouReportID
* @param {Number} chatReportID
* @returns {Promise}
*/
function fetchIOUReport(iouReportID, chatReportID) {
return DeprecatedAPI.Get({
returnValueList: 'reportStuff',
reportIDList: iouReportID,
shouldLoadOptionalKeys: true,
includePinnedReports: true,
}).then((response) => {
if (!response) {
return;
}
if (response.jsonCode !== 200) {
console.error(response.message);
return;
}
const iouReportData = response.reports[iouReportID];
if (!iouReportData) {
// IOU data for a report will be missing when the IOU report has already been paid.
// This is expected and we return early as no further processing can be done.
return;
}
return getSimplifiedIOUReport(iouReportData, chatReportID);
}).catch((error) => {
Log.hmmm('[Report] Failed to populate IOU Collection:', error.message);
});
}
/**
* Given debtorEmail finds active IOU report ID via GetIOUReport API call
*
* @param {String} debtorEmail
* @returns {Promise}
*/
function fetchIOUReportID(debtorEmail) {
return DeprecatedAPI.GetIOUReport({
debtorEmail,
}).then((response) => {
const iouReportID = response.reportID || 0;
if (response.jsonCode !== 200) {
console.error(response.message);
return;
}
if (iouReportID === 0) {
// If there is no IOU report for this user then we will assume it has been paid and do nothing here.
// All reports are initialized with hasOutstandingIOU: false. Since the IOU report we were looking for has
// been settled then there's nothing more to do.
Log.info('GetIOUReport returned a reportID of 0, not fetching IOU report data');
return;
}
return iouReportID;
});
}
/**
* Fetches chat reports when provided a list of chat report IDs.
* If the shouldRedirectIfInaccessible flag is set, we redirect to the Concierge chat
* when we find an inaccessible chat
* @param {Array} chatList
* @param {Boolean} shouldRedirectIfInaccessible
* @returns {Promise<Object[]>} only used internally when fetchAllReports() is called
*/
function fetchChatReportsByIDs(chatList, shouldRedirectIfInaccessible = false) {
let fetchedReports;
const simplifiedReports = {};
return DeprecatedAPI.GetReportSummaryList({reportIDList: chatList.join(',')})
.then(({reportSummaryList, jsonCode}) => {
Log.info('[Report] successfully fetched report data', false, {chatList});
fetchedReports = reportSummaryList;
// If we receive a 404 response while fetching a single report, treat that report as inaccessible.
if (jsonCode === 404 && shouldRedirectIfInaccessible) {
throw new Error(CONST.REPORT.ERROR.INACCESSIBLE_REPORT);
}
return Promise.all(_.map(fetchedReports, (chatReport) => {
// If there aren't any IOU actions, we don't need to fetch any additional data
if (!chatReport.hasIOUAction) {
return;
}
// Group chat reports cannot and should not be associated with a specific IOU report
const participants = getParticipantEmailsFromReport(chatReport);
if (participants.length > 1) {
return;
}
if (participants.length === 0) {
Log.alert('[Report] Report with IOU action but does not have any participant.', {
reportID: chatReport.reportID,
participants,
});
return;
}
return fetchIOUReportID(participants[0])
.then((iouReportID) => {
if (!iouReportID) {
return Promise.resolve();
}
return fetchIOUReport(iouReportID, chatReport.reportID);
});
}));
})
.then((iouReportObjects) => {
// Process the reports and store them in Onyx. At the same time we'll save the simplified reports in this
// variable called simplifiedReports which hold the participants (minus the current user) for each report.
// Using this simplifiedReport we can call PersonalDetails.getFromReportParticipants to get the
// personal details of all the participants and even link up their avatars to report icons.
const reportIOUData = {};
_.each(fetchedReports, (report) => {
const simplifiedReport = getSimplifiedReportObject(report);
simplifiedReports[`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`] = simplifiedReport;
});
_.each(iouReportObjects, (iouReportObject) => {
if (!iouReportObject) {
return;
}
const iouReportKey = `${ONYXKEYS.COLLECTION.REPORT_IOUS}${iouReportObject.reportID}`;
const reportKey = `${ONYXKEYS.COLLECTION.REPORT}${iouReportObject.chatReportID}`;
reportIOUData[iouReportKey] = iouReportObject;
simplifiedReports[reportKey].iouReportID = iouReportObject.reportID;
simplifiedReports[reportKey].hasOutstandingIOU = iouReportObject.stateNum
=== CONST.REPORT.STATE_NUM.PROCESSING && iouReportObject.total !== 0;
});
// We use mergeCollection such that it updates the collection in one go.
// Any withOnyx subscribers to this key will also receive the complete updated props just once
// than updating props for each report and re-rendering had merge been used.
Onyx.mergeCollection(ONYXKEYS.COLLECTION.REPORT_IOUS, reportIOUData);
Onyx.mergeCollection(ONYXKEYS.COLLECTION.REPORT, simplifiedReports);
// Fetch the personal details if there are any
PersonalDetails.getFromReportParticipants(_.values(simplifiedReports));
return simplifiedReports;
})
.catch((err) => {
if (err.message !== CONST.REPORT.ERROR.INACCESSIBLE_REPORT) {
return;
}
// eslint-disable-next-line no-use-before-define
handleInaccessibleReport();
});
}
/**
* Given IOU object, save the data to Onyx.
*
* @param {Object} iouReportObject
* @param {Number} iouReportObject.stateNum
* @param {Number} iouReportObject.total
* @param {Number} iouReportObject.reportID
*/
function setLocalIOUReportData(iouReportObject) {
const iouReportKey = `${ONYXKEYS.COLLECTION.REPORT_IOUS}${iouReportObject.reportID}`;
Onyx.merge(iouReportKey, iouReportObject);
}
/**
* Update the lastRead actionID and timestamp in local memory and Onyx
*
* @param {Number} reportID
* @param {Number} lastReadSequenceNumber
*/
function setLocalLastRead(reportID, lastReadSequenceNumber) {
lastReadSequenceNumbers[reportID] = lastReadSequenceNumber;
const reportMaxSequenceNumber = reportMaxSequenceNumbers[reportID];
// Determine the number of unread actions by deducting the last read sequence from the total. If, for some reason,
// the last read sequence is higher than the actual last sequence, let's just assume all actions are read
const unreadActionCount = Math.max(reportMaxSequenceNumber - lastReadSequenceNumber - ReportActions.getDeletedCommentsCount(reportID, lastReadSequenceNumber), 0);
// Update the report optimistically.
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {
unreadActionCount,
lastVisitedTimestamp: Date.now(),
});
}
/**
* Remove all optimistic actions from report actions and reset the optimisticReportActionsIDs array. We do this
* to clear any stuck optimistic actions that have not be updated for whatever reason.
*
* @param {Number} reportID
*/
function removeOptimisticActions(reportID) {
const actionIDs = optimisticReportActionIDs[reportID] || [];
const actionsToRemove = _.reduce(actionIDs, (actions, actionID) => ({
...actions,
[actionID]: null,
}), {});
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, actionsToRemove);
// Reset the optimistic report action IDs to an empty array
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {
optimisticReportActionIDs: [],
});
}
/**
* Fetch the iouReport and persist the data to Onyx.
*
* @param {Number} iouReportID - ID of the report we are fetching
* @param {Number} chatReportID - associated chatReportID, set as an iouReport field
* @param {Boolean} [shouldRedirectIfEmpty=false] - Whether to redirect to Active Report Screen if IOUReport is empty
* @returns {Promise}
*/
function fetchIOUReportByID(iouReportID, chatReportID, shouldRedirectIfEmpty = false) {
return fetchIOUReport(iouReportID, chatReportID)
.then((iouReportObject) => {
if (!iouReportObject && shouldRedirectIfEmpty) {
Growl.error(Localize.translateLocal('notFound.iouReportNotFound'));
Navigation.navigate(ROUTES.REPORT);
return;
}
setLocalIOUReportData(iouReportObject);
return iouReportObject;
});
}
/**
* If an iouReport is open (has an IOU, but is not yet paid) then we sync the reportIDs of both chatReport and
* iouReport in Onyx, simplifying IOU data retrieval and reducing necessary API calls when displaying IOU components:
* - chatReport: {id: 123, iouReportID: 987, ...}
* - iouReport: {id: 987, chatReportID: 123, ...}
*
* The reports must remain in sync when the iouReport is modified. This function ensures that we sync reportIds after
* fetching the iouReport and therefore should only be called if we are certain that the fetched iouReport is currently
* open - else we would overwrite the existing open iouReportID with a closed iouReportID.
*
* Examples of correct usage include 'receieving a push notification', or 'paying an IOU', because both of these cases can only
* occur for an iouReport that is currently open (notifications are not sent for closed iouReports, and you cannot pay a closed
* IOU). Send Money is an incorrect use case, because these IOUReports are never associated with the chatReport and this would
* prevent outstanding IOUs from showing.
*
* @param {Number} iouReportID - ID of the report we are fetching
* @param {Number} chatReportID - associated chatReportID, used to sync the reports
*/
function fetchIOUReportByIDAndUpdateChatReport(iouReportID, chatReportID) {
fetchIOUReportByID(iouReportID, chatReportID)
.then((iouReportObject) => {
// Now sync the chatReport data to ensure it has a reference to the updated iouReportID
const chatReportObject = {
hasOutstandingIOU: iouReportObject.stateNum === CONST.REPORT.STATE_NUM.PROCESSING
&& iouReportObject.total !== 0,
iouReportID: iouReportObject.reportID,
};
if (!chatReportObject.hasOutstandingIOU) {
chatReportObject.iouReportID = null;
}
const reportKey = `${ONYXKEYS.COLLECTION.REPORT}${chatReportID}`;
Onyx.merge(reportKey, chatReportObject);
});
}
/**
* @param {Number} reportID
* @param {Number} sequenceNumber
*/
function setNewMarkerPosition(reportID, sequenceNumber) {
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {
newMarkerSequenceNumber: sequenceNumber,
});
}
/**
* Updates a report action's message to be a new value.
*
* @param {Number} reportID
* @param {Number} sequenceNumber
* @param {Object} message
*/
function updateReportActionMessage(reportID, sequenceNumber, message) {
const actionToMerge = {};
actionToMerge[sequenceNumber] = {message: [message]};
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, actionToMerge).then(() => {
// If the message is deleted, update the last read message and the unread counter
if (!message.html) {
setLocalLastRead(reportID, lastReadSequenceNumbers[reportID]);
}
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {
lastMessageText: ReportActions.getLastVisibleMessageText(reportID),
});
});
}
/**
* Updates a report in the store with a new report action
*
* @param {Number} reportID
* @param {Object} reportAction
* @param {String} [notificationPreference] On what cadence the user would like to be notified
*/
function updateReportWithNewAction(
reportID,
reportAction,
notificationPreference = CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS,
) {
const newMaxSequenceNumber = reportAction.sequenceNumber;
const isFromCurrentUser = reportAction.actorAccountID === currentUserAccountID;
const initialLastReadSequenceNumber = lastReadSequenceNumbers[reportID] || 0;
// When handling an action from the current users we can assume that their
// last read actionID has been updated in the server but not necessarily reflected
// locally so we must first update it and then calculate the unread (which should be 0)
if (isFromCurrentUser) {
setLocalLastRead(reportID, newMaxSequenceNumber);
}
let messageText = lodashGet(reportAction, ['message', 0, 'text'], '');
if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.RENAMED) {
messageText = lodashGet(reportAction, 'originalMessage.html', '');
}
// Always merge the reportID into Onyx
// If the report doesn't exist in Onyx yet, then all the rest of the data will be filled out
// by handleReportChanged
const updatedReportObject = {
reportID,
// Use updated lastReadSequenceNumber, value may have been modified by setLocalLastRead
// Here deletedComments count does not include the new action being added. We can safely assume that newly received action is not deleted.
unreadActionCount: newMaxSequenceNumber - (lastReadSequenceNumbers[reportID] || 0) - ReportActions.getDeletedCommentsCount(reportID, lastReadSequenceNumbers[reportID] || 0),
maxSequenceNumber: reportAction.sequenceNumber,
};
// If the report action from pusher is a higher sequence number than we know about (meaning it has come from
// a chat participant in another application), then the last message text and author needs to be updated as well
if (newMaxSequenceNumber > initialLastReadSequenceNumber) {
updatedReportObject.lastMessageTimestamp = reportAction.timestamp;
updatedReportObject.lastMessageText = ReportUtils.formatReportLastMessageText(messageText);
updatedReportObject.lastActorEmail = reportAction.actorEmail;
}
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, updatedReportObject);
const reportActionsToMerge = {};
if (reportAction.clientID) {
// Remove the optimistic action from the report since we are about to replace it
// with the real one (which has the true sequenceNumber)
reportActionsToMerge[reportAction.clientID] = null;
}
// Add the action into Onyx
reportActionsToMerge[reportAction.sequenceNumber] = {
...reportAction,
isAttachment: ReportUtils.isReportMessageAttachment(lodashGet(reportAction, ['message', 0], {})),
loading: false,
};
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, reportActionsToMerge);
// If chat report receives an action with IOU and we have an IOUReportID, update IOU object
if (reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && reportAction.originalMessage.IOUReportID) {
const iouReportID = reportAction.originalMessage.IOUReportID;
// If the IOUDetails object exists we are in the Send Money flow, and we should not fetch and update the chatReport
// as this would overwrite any existing IOUs. For all other cases we must update the chatReport with the iouReportID as
// if we don't, new IOUs would not be displayed and paid IOUs would still show as unpaid.
if (reportAction.originalMessage.IOUDetails === undefined) {
fetchIOUReportByIDAndUpdateChatReport(iouReportID, reportID);
}
}
if (!ActiveClientManager.isClientTheLeader()) {
Log.info('[LOCAL_NOTIFICATION] Skipping notification because this client is not the leader');
return;
}
// We don't want to send a local notification if the user preference is daily or mute
if (notificationPreference === 'mute' || notificationPreference === 'daily') {
// eslint-disable-next-line max-len
Log.info(`[LOCAL_NOTIFICATION] No notification because user preference is to be notified: ${notificationPreference}`);
return;
}
// If this comment is from the current user we don't want to parrot whatever they wrote back to them.
if (isFromCurrentUser) {
Log.info('[LOCAL_NOTIFICATION] No notification because comment is from the currently logged in user');
return;
}
// If we are currently viewing this report do not show a notification.
if (reportID === lastViewedReportID && Visibility.isVisible()) {
Log.info('[LOCAL_NOTIFICATION] No notification because it was a comment for the current report');
return;
}
// If the comment came from Concierge let's not show a notification since we already show one for expensify.com
if (lodashGet(reportAction, 'actorEmail') === CONST.EMAIL.CONCIERGE) {
return;
}
// When a new message comes in, if the New marker is not already set (newMarkerSequenceNumber === 0), set the
// marker above the incoming message.
if (lodashGet(allReports, [reportID, 'newMarkerSequenceNumber'], 0) === 0
&& updatedReportObject.unreadActionCount > 0) {
const oldestUnreadSeq = (updatedReportObject.maxSequenceNumber - updatedReportObject.unreadActionCount) + 1;
setNewMarkerPosition(reportID, oldestUnreadSeq);
}
Log.info('[LOCAL_NOTIFICATION] Creating notification');
LocalNotification.showCommentNotification({
reportAction,
onClick: () => {
// Navigate to this report onClick
Navigation.navigate(ROUTES.getReportRoute(reportID));
},
});
}
/**
* Updates a report in Onyx with a new pinned state.
*
* @param {Number} reportID
* @param {Boolean} isPinned
*/
function updateReportPinnedState(reportID, isPinned) {
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {isPinned});
}
/**
* Get the private pusher channel name for a Report.
*
* @param {Number} reportID
* @returns {String}
*/
function getReportChannelName(reportID) {
return `private-report-reportID-${reportID}${CONFIG.PUSHER.SUFFIX}`;
}
/**
* Abstraction around subscribing to private user channel events. Handles all logs and errors automatically.
*
* @param {String} eventName
* @param {Function} onEvent
*/
function subscribeToPrivateUserChannelEvent(eventName, onEvent) {
const pusherChannelName = `private-encrypted-user-accountID-${currentUserAccountID}${CONFIG.PUSHER.SUFFIX}`;
/**
* @param {Object} pushJSON
*/
function logPusherEvent(pushJSON) {
Log.info(`[Report] Handled ${eventName} event sent by Pusher`, false, {reportID: pushJSON.reportID, reportActionID: pushJSON.reportActionID});
}
function onPusherResubscribeToPrivateUserChannel() {
NetworkConnection.triggerReconnectionCallbacks('Pusher re-subscribed to private user channel');
}
/**
* @param {*} pushJSON
*/
function onEventPush(pushJSON) {
logPusherEvent(pushJSON);
onEvent(pushJSON);
}
/**
* @param {*} error
*/
function onSubscriptionFailed(error) {
Log.hmmm('[Report] Failed to subscribe to Pusher channel', false, {error, pusherChannelName, eventName});
}
Pusher.subscribe(pusherChannelName, eventName, onEventPush, onPusherResubscribeToPrivateUserChannel)
.catch(onSubscriptionFailed);
}
/**
* Initialize our pusher subscriptions to listen for new report comments and pin toggles
*/
function subscribeToUserEvents() {
// If we don't have the user's accountID yet we can't subscribe so return early
if (!currentUserAccountID) {
return;
}
const pusherChannelName = `private-encrypted-user-accountID-${currentUserAccountID}${CONFIG.PUSHER.SUFFIX}`;
if (Pusher.isSubscribed(pusherChannelName) || Pusher.isAlreadySubscribing(pusherChannelName)) {
return;
}
// Live-update a report's actions when a 'report comment' event is received.
subscribeToPrivateUserChannelEvent(Pusher.TYPE.REPORT_COMMENT, pushJSON => updateReportWithNewAction(pushJSON.reportID, pushJSON.reportAction, pushJSON.notificationPreference));
// Live-update a report's actions when a 'chunked report comment' event is received.
subscribeToPrivateUserChannelEvent(Pusher.TYPE.REPORT_COMMENT_CHUNK, pushJSON => updateReportWithNewAction(pushJSON.reportID, pushJSON.reportAction, pushJSON.notificationPreference));
// Live-update a report's actions when an 'edit comment' event is received.
subscribeToPrivateUserChannelEvent(Pusher.TYPE.REPORT_COMMENT_EDIT, pushJSON => updateReportActionMessage(pushJSON.reportID, pushJSON.sequenceNumber, pushJSON.message));
// Live-update a report's actions when an 'edit comment chunk' event is received.
subscribeToPrivateUserChannelEvent(Pusher.TYPE.REPORT_COMMENT_EDIT_CHUNK, pushJSON => updateReportActionMessage(pushJSON.reportID, pushJSON.sequenceNumber, pushJSON.message));
// Live-update a report's pinned state when a 'report toggle pinned' event is received.
subscribeToPrivateUserChannelEvent(Pusher.TYPE.REPORT_TOGGLE_PINNED, pushJSON => updateReportPinnedState(pushJSON.reportID, pushJSON.isPinned));
}
/**
* Setup reportComment push notification callbacks.
*/
function subscribeToReportCommentPushNotifications() {
PushNotification.onReceived(PushNotification.TYPE.REPORT_COMMENT, ({reportID, reportAction}) => {
Log.info('[Report] Handled event sent by Airship', false, {reportID});
updateReportWithNewAction(reportID, reportAction);
});
// Open correct report when push notification is clicked
PushNotification.onSelected(PushNotification.TYPE.REPORT_COMMENT, ({reportID}) => {
if (Navigation.canNavigate('navigate')) {
// If a chat is visible other than the one we are trying to navigate to, then we need to navigate back
if (Navigation.getActiveRoute().slice(1, 2) === ROUTES.REPORT && !Navigation.isActiveRoute(`r/${reportID}`)) {
Navigation.goBack();
}
Navigation.navigate(ROUTES.getReportRoute(reportID));
} else {
// Navigation container is not yet ready, use deeplinking to open to correct report instead
Navigation.setDidTapNotification();
Linking.openURL(`${CONST.DEEPLINK_BASE_URL}${ROUTES.getReportRoute(reportID)}`);
}
});
}
/**
* There are 2 possibilities that we can receive via pusher for a user's typing status:
* 1. The "new" way from New Expensify is passed as {[login]: Boolean} (e.g. {yuwen@expensify.com: true}), where the value
* is whether the user with that login is typing on the report or not.
* 2. The "old" way from e.com which is passed as {userLogin: login} (e.g. {userLogin: bstites@expensify.com})
*
* This method makes sure that no matter which we get, we return the "new" format
*
* @param {Object} typingStatus
* @returns {Object}
*/
function getNormalizedTypingStatus(typingStatus) {
let normalizedTypingStatus = typingStatus;
if (_.first(_.keys(typingStatus)) === 'userLogin') {
normalizedTypingStatus = {[typingStatus.userLogin]: true};
}
return normalizedTypingStatus;
}
/**
* Initialize our pusher subscriptions to listen for someone typing in a report.
*
* @param {Number} reportID
*/
function subscribeToReportTypingEvents(reportID) {
if (!reportID) {
return;
}
// Make sure we have a clean Typing indicator before subscribing to typing events
Onyx.set(`${ONYXKEYS.COLLECTION.REPORT_USER_IS_TYPING}${reportID}`, {});
const pusherChannelName = getReportChannelName(reportID);
Pusher.subscribe(pusherChannelName, 'client-userIsTyping', (typingStatus) => {
const normalizedTypingStatus = getNormalizedTypingStatus(typingStatus);
const login = _.first(_.keys(normalizedTypingStatus));
if (!login) {
return;
}
// Don't show the typing indicator if a user is typing on another platform
if (login === currentUserEmail) {
return;
}
// Use a combo of the reportID and the login as a key for holding our timers.
const reportUserIdentifier = `${reportID}-${login}`;
clearTimeout(typingWatchTimers[reportUserIdentifier]);
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_USER_IS_TYPING}${reportID}`, normalizedTypingStatus);
// Wait for 1.5s of no additional typing events before setting the status back to false.
typingWatchTimers[reportUserIdentifier] = setTimeout(() => {
const typingStoppedStatus = {};
typingStoppedStatus[login] = false;
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_USER_IS_TYPING}${reportID}`, typingStoppedStatus);
delete typingWatchTimers[reportUserIdentifier];
}, 1500);
})
.catch((error) => {
Log.hmmm('[Report] Failed to initially subscribe to Pusher channel', false, {errorType: error.type, pusherChannelName});
});
}
/**
* Remove our pusher subscriptions to listen for someone typing in a report.
*
* @param {Number} reportID
*/
function unsubscribeFromReportChannel(reportID) {
if (!reportID) {
return;
}
const pusherChannelName = getReportChannelName(reportID);
Onyx.set(`${ONYXKEYS.COLLECTION.REPORT_USER_IS_TYPING}${reportID}`, {});
Pusher.unsubscribe(pusherChannelName);
}
/**
* Get the report ID for a chat report for a specific
* set of participants and navigate to it if wanted.
*
* @param {String[]} participants
* @param {Boolean} shouldNavigate
* @returns {Promise<Object[]>}
*/
function fetchOrCreateChatReport(participants, shouldNavigate = true) {
if (participants.length < 2) {
throw new Error('fetchOrCreateChatReport() must have at least two participants.');
}
return DeprecatedAPI.CreateChatReport({
emailList: participants.join(','),
})
.then((data) => {
if (data.jsonCode !== 200) {
console.error(data.message);
Growl.error(data.message);
return;
}
// Merge report into Onyx
const simplifiedReportObject = getSimplifiedReportObject(data);
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${data.reportID}`, simplifiedReportObject);
if (shouldNavigate) {
// Redirect the logged in person to the new report
Navigation.navigate(ROUTES.getReportRoute(data.reportID));
}
// We are returning an array with a report object here since fetchAllReports calls this method or
// fetchChatReportsByIDs which returns an array of report objects.
return [simplifiedReportObject];
});
}
/**
* Get the actions of a report
*
* @param {Number} reportID
* @param {Number} [offset]
* @returns {Promise}
*/
function fetchActions(reportID, offset) {
const reportActionsOffset = !_.isUndefined(offset) ? offset : -1;
if (!_.isNumber(reportActionsOffset)) {
Log.alert('[Report] Offset provided is not a number', {
offset,
reportActionsOffset,
});
return;
}
return DeprecatedAPI.Report_GetHistory({
reportID,
reportActionsOffset,
reportActionsLimit: CONST.REPORT.ACTIONS.LIMIT,
})
.then((data) => {
// We must remove all optimistic actions so there will not be any stuck comments. At this point, we should
// be caught up and no longer need any optimistic comments.
removeOptimisticActions(reportID);
const indexedData = _.indexBy(data.history, 'sequenceNumber');
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, indexedData);
});
}
/**
* Get the actions of a report
*
* @param {Number} reportID
* @param {Number} [offset]
*/
function fetchActionsWithLoadingState(reportID, offset) {
Onyx.set(ONYXKEYS.IS_LOADING_REPORT_ACTIONS, true);
fetchActions(reportID, offset)
.finally(() => Onyx.set(ONYXKEYS.IS_LOADING_REPORT_ACTIONS, false));
}
/**
* Get all of our reports
*
* @param {Boolean} shouldRecordHomePageTiming whether or not performance timing should be measured
* @param {Boolean} shouldDelayActionsFetch when the app loads we want to delay the fetching of additional actions
* @returns {Promise}
*/
function fetchAllReports(
shouldRecordHomePageTiming = false,
shouldDelayActionsFetch = false,
) {
Onyx.set(ONYXKEYS.IS_LOADING_REPORT_DATA, true);
return DeprecatedAPI.Get({
returnValueList: 'chatList',
})
.then((response) => {
if (response.jsonCode !== 200) {
return;
}
// The cast here is necessary as Get rvl='chatList' may return an int or Array
const reportIDs = _.filter(String(response.chatList).split(','), _.identity);
// Get all the chat reports if they have any, otherwise create one with concierge
if (reportIDs.length > 0) {
return fetchChatReportsByIDs(reportIDs);
}
return fetchOrCreateChatReport([currentUserEmail, CONST.EMAIL.CONCIERGE], false);
})
.then((returnedReports) => {
Onyx.set(ONYXKEYS.INITIAL_REPORT_DATA_LOADED, true);
Onyx.set(ONYXKEYS.IS_LOADING_REPORT_DATA, false);
// If at this point the user still doesn't have a Concierge report, create it for them.
// This means they were a participant in reports before their account was created (e.g. default rooms)
const hasConciergeChat = _.some(returnedReports, report => ReportUtils.isConciergeChatReport(report));
if (!hasConciergeChat) {
fetchOrCreateChatReport([currentUserEmail, CONST.EMAIL.CONCIERGE], false);
}
if (shouldRecordHomePageTiming) {
Timing.end(CONST.TIMING.HOMEPAGE_REPORTS_LOADED);
}
// Delay fetching report history as it significantly increases sign in to interactive time.
// Register the timer so we can clean it up if the user quickly logs out after logging in. If we don't
// cancel the timer we'll make unnecessary API requests from the sign in page.
Timers.register(setTimeout(() => {
// Filter reports to see which ones have actions we need to fetch so we can preload Onyx with new
// content and improve chat switching experience by only downloading content we don't have yet.
// This improves performance significantly when reconnecting by limiting API requests and unnecessary
// data processing by Onyx.
const reportIDsWithMissingActions = _.chain(returnedReports)
.map(report => report.reportID)
.filter(reportID => ReportActions.isReportMissingActions(reportID, reportMaxSequenceNumbers[reportID]))
.value();
// Once we have the reports that are missing actions we will find the intersection between the most
// recently accessed reports and reports missing actions. Then we'll fetch the history for a small
// set to avoid making too many network requests at once.
const reportIDsToFetchActions = _.chain(ReportUtils.sortReportsByLastVisited(allReports))
.map(report => report.reportID)
.reverse()
.intersection(reportIDsWithMissingActions)
.slice(0, 10)
.value();
if (_.isEmpty(reportIDsToFetchActions)) {
Log.info('[Report] Local reportActions up to date. Not fetching additional actions.');
return;
}
Log.info('[Report] Fetching reportActions for reportIDs: ', false, {
reportIDs: reportIDsToFetchActions,
});
_.each(reportIDsToFetchActions, (reportID) => {
const offset = ReportActions.dangerouslyGetReportActionsMaxSequenceNumber(reportID, false);
fetchActions(reportID, offset);
});
// We are waiting a set amount of time to allow the UI to finish loading before bogging it down with
// more requests and operations. Startup delay is longer since there is a lot more work done to build
// up the UI when the app first initializes.
}, shouldDelayActionsFetch ? CONST.FETCH_ACTIONS_DELAY.STARTUP : CONST.FETCH_ACTIONS_DELAY.RECONNECT));
});
}
/**
* Add an action item to a report
*
* @param {Number} reportID
* @param {String} text
* @param {File} [file]
*/
function addAction(reportID, text, file) {
// For comments shorter than 10k chars, convert the comment from MD into HTML because that's how it is stored in the database
// For longer comments, skip parsing and display plaintext for performance reasons. It takes over 40s to parse a 100k long string!!
const parser = new ExpensiMark();
const commentText = text.length < 10000 ? parser.replace(text) : text;
const isAttachment = _.isEmpty(text) && file !== undefined;
const attachmentInfo = isAttachment ? file : {};
// The new sequence number will be one higher than the highest
const highestSequenceNumber = reportMaxSequenceNumbers[reportID] || 0;
const newSequenceNumber = highestSequenceNumber + 1;
const htmlForNewComment = isAttachment ? 'Uploading Attachment...' : commentText;
// Remove HTML from text when applying optimistic offline comment
const textForNewComment = isAttachment ? '[Attachment]'
: htmlForNewComment.replace(/((<br[^>]*>)+)/gi, ' ').replace(/<[^>]*>?/gm, '');
// Update the report in Onyx to have the new sequence number
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {
maxSequenceNumber: newSequenceNumber,
lastMessageTimestamp: moment().unix(),
lastMessageText: ReportUtils.formatReportLastMessageText(textForNewComment),
lastActorEmail: currentUserEmail,
});
// Generate a clientID so we can save the optimistic action to storage with the clientID as key. Later, we will
// remove the optimistic action when we add the real action created in the server. We do this because it's not
// safe to assume that this will use the very next sequenceNumber. An action created by another can overwrite that
// sequenceNumber if it is created before this one. We use a combination of current epoch timestamp (milliseconds)
// and a random number so that the probability of someone else having the same optimisticReportActionID is
// extremely low even if they left the comment at the same moment as another user on the same report. The random
// number is 3 digits because if we go any higher JS will convert the digits after the 16th position to 0's in
// optimisticReportActionID.
const randomNumber = Math.floor((Math.random() * (999 - 100)) + 100);
const optimisticReportActionID = parseInt(`${Date.now()}${randomNumber}`, 10);
// Store the optimistic action ID on the report the comment was added to. It will be removed later when refetching
// report actions in order to clear out any stuck actions (i.e. actions where the client never received a Pusher
// event, for whatever reason, from the server with the new action data
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {
optimisticReportActionIDs: [...(optimisticReportActionIDs[reportID] || []), optimisticReportActionID],
});
// Optimistically add the new comment to the store before waiting to save it to the server
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, {
[optimisticReportActionID]: {
actionName: CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT,
actorEmail: currentUserEmail,
actorAccountID: currentUserAccountID,
person: [
{
style: 'strong',
text: myPersonalDetails.displayName || currentUserEmail,
type: 'TEXT',
},
],
automatic: false,
// Use the client generated ID as a optimistic action ID so we can remove it later
sequenceNumber: optimisticReportActionID,
clientID: optimisticReportActionID,
avatar: myPersonalDetails.avatar,
timestamp: moment().unix(),
message: [
{
type: CONST.REPORT.MESSAGE.TYPE.COMMENT,
html: htmlForNewComment,
text: textForNewComment,
},
],
isFirstItem: false,
isAttachment,
attachmentInfo,
loading: true,
shouldShow: true,
},
});
DeprecatedAPI.Report_AddComment({
reportID,
file,
reportComment: commentText,
clientID: optimisticReportActionID,
persist: true,
})
.then((response) => {
if (response.jsonCode === 408) {
Growl.error(Localize.translateLocal('reportActionCompose.fileUploadFailed'));
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, {
[optimisticReportActionID]: null,
});
console.error(response.message);
return;
}
if (response.jsonCode === 666 && reportID === conciergeChatReportID) {
Growl.error(Localize.translateLocal('reportActionCompose.blockedFromConcierge'));
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, {
[optimisticReportActionID]: null,
});
// The fact that the API is returning this error means the BLOCKED_FROM_CONCIERGE nvp in the user details has changed since the last time we checked, so let's update
User.getUserDetails();
return;
}
updateReportWithNewAction(reportID, response.reportAction);
});
}
/**
* Get the last read sequence number for a report
* @param {String|Number} reportID
* @return {Number}
*/
function getLastReadSequenceNumber(reportID) {
return lastReadSequenceNumbers[reportID];
}
/**
* Deletes a comment from the report, basically sets it as empty string
*
* @param {Number} reportID
* @param {Object} reportAction
*/
function deleteReportComment(reportID, reportAction) {
// Optimistic Response
const sequenceNumber = reportAction.sequenceNumber;
const reportActionsToMerge = {};
const oldMessage = {...reportAction.message};
reportActionsToMerge[sequenceNumber] = {
...reportAction,
message: [
{
type: CONST.REPORT.MESSAGE.TYPE.COMMENT,
html: '',
text: '',
},
],
};
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, reportActionsToMerge).then(() => {
setLocalLastRead(reportID, getLastReadSequenceNumber(reportID));
});
// Try to delete the comment by calling the API
DeprecatedAPI.Report_EditComment({
reportID,
reportActionID: reportAction.reportActionID,
reportComment: '',
sequenceNumber,
})
.then((response) => {
if (response.jsonCode === 200) {
return;
}
// Reverse Optimistic Response
reportActionsToMerge[sequenceNumber] = {
...reportAction,
message: oldMessage,
};
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, reportActionsToMerge).then(() => {
setLocalLastRead(reportID, getLastReadSequenceNumber(reportID));
});
});
}
/**
* Updates the last read action ID on the report. It optimistically makes the change to the store, and then let's the
* network layer handle the delayed write.
*
* @param {Number} reportID
* @param {Number} [sequenceNumber] This can be used to set the last read actionID to a specific
* @param {Boolean} [manuallyMarked] If the user manually marked this as unread, we need to tell the API
* spot (eg. mark-as-unread). Otherwise, when this param is omitted, the highest sequence number becomes the one that
* is last read (meaning that the entire report history has been read)
*/
function updateLastReadActionID(reportID, sequenceNumber, manuallyMarked = false) {
// If report data is loading, we can't update the last read sequence number because it is obsolete
if (isReportDataLoading) {
return;
}
// If we aren't specifying a sequenceNumber and have no valid maxSequenceNumber for this report then we should not
// update the last read. Most likely, we have just created the report and it has no comments. But we should err on
// the side of caution and do nothing in this case.
if (_.isUndefined(sequenceNumber)
&& (!reportMaxSequenceNumbers[reportID] && reportMaxSequenceNumbers[reportID] !== 0)) {
return;
}
// Need to subtract 1 from sequenceNumber so that the "New" marker appears in the right spot (the last read
// action). If 1 isn't subtracted then the "New" marker appears one row below the action (the first unread action)
// Note: sequenceNumber can be 1 for the first message, so we can't use
// (sequenceNumber - 1) || reportMaxSequenceNumbers[reportID] because the first expression results in 0 which is falsy.
const lastReadSequenceNumber = _.isNumber(sequenceNumber) ? (sequenceNumber - 1) : reportMaxSequenceNumbers[reportID];
setLocalLastRead(reportID, lastReadSequenceNumber);
// Mark the report as not having any unread items
DeprecatedAPI.Report_UpdateLastRead({
reportID,
sequenceNumber: lastReadSequenceNumber,
markAsUnread: manuallyMarked,
});
}
/**
* Toggles the pinned state of the report.
*
* @param {Object} report
*/
function togglePinnedState(report) {
const pinnedValue = !report.isPinned;
updateReportPinnedState(report.reportID, pinnedValue);
DeprecatedAPI.Report_TogglePinned({
reportID: report.reportID,
pinnedValue,
});
}
/**
* Saves the comment left by the user as they are typing. By saving this data the user can switch between chats, close
* tab, refresh etc without worrying about loosing what they typed out.
*
* @param {Number} reportID
* @param {String} comment
*/
function saveReportComment(reportID, comment) {
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${reportID}`, comment);
}
/**
* Immediate indication whether the report has a draft comment.
*
* @param {String} reportID
* @param {Boolean} hasDraft
* @returns {Promise}
*/
function setReportWithDraft(reportID, hasDraft) {
return Onyx.merge(`${ONYXKEYS.COLLECTION.REPORTS_WITH_DRAFT}${reportID}`, hasDraft);
}
/**
* Broadcasts whether or not a user is typing on a report over the report's private pusher channel.
*
* @param {Number} reportID
*/
function broadcastUserIsTyping(reportID) {
const privateReportChannelName = getReportChannelName(reportID);
const typingStatus = {};
typingStatus[currentUserEmail] = true;
Pusher.sendEvent(privateReportChannelName, 'client-userIsTyping', typingStatus);
}
/**
* When a report changes in Onyx, this fetches the report from the API if the report doesn't have a name
* and it keeps track of the max sequence number on the report actions.
*
* @param {Object} report
*/
function handleReportChanged(report) {
if (!report) {
return;
}
if (report && report.reportID) {
allReports[report.reportID] = report;
if (ReportUtils.isConciergeChatReport(report)) {
conciergeChatReportID = report.reportID;
}
}
// A report can be missing a name if a comment is received via pusher event
// and the report does not yet exist in Onyx (eg. a new DM created with the logged in person)
if (report.reportID && report.reportName === undefined) {
fetchChatReportsByIDs([report.reportID]);
}
// Store the max sequence number for each report
reportMaxSequenceNumbers[report.reportID] = report.maxSequenceNumber;
// Store optimistic actions IDs for each report
optimisticReportActionIDs[report.reportID] = report.optimisticReportActionIDs;
}
/**
* @param {Number} reportID
*/
function updateCurrentlyViewedReportID(reportID) {
Onyx.merge(ONYXKEYS.CURRENTLY_VIEWED_REPORTID, String(reportID));
}
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT,
callback: handleReportChanged,
});
/**
* Saves a new message for a comment. Marks the comment as edited, which will be reflected in the UI.
*
* @param {Number} reportID
* @param {Object} originalReportAction
* @param {String} textForNewComment
*/
function editReportComment(reportID, originalReportAction, textForNewComment) {
const parser = new ExpensiMark();
const htmlForNewComment = parser.replace(textForNewComment);
// Delete the comment if it's empty
if (_.isEmpty(htmlForNewComment)) {
deleteReportComment(reportID, originalReportAction);
return;
}
// Skip the Edit if message is not changed
if (originalReportAction.message[0].html === htmlForNewComment.trim()) {
return;
}
// Optimistically update the report action with the new message
const sequenceNumber = originalReportAction.sequenceNumber;
const newReportAction = {...originalReportAction};
const actionToMerge = {};
newReportAction.message[0].isEdited = true;
newReportAction.message[0].html = htmlForNewComment;
newReportAction.message[0].text = Str.stripHTML(htmlForNewComment.replace(/((<br[^>]*>)+)/gi, ' '));
actionToMerge[sequenceNumber] = newReportAction;
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, actionToMerge);
// Persist the updated report comment
DeprecatedAPI.Report_EditComment({
reportID,
reportActionID: originalReportAction.reportActionID,
reportComment: htmlForNewComment,
sequenceNumber,
})
.then((response) => {
if (response.jsonCode === 200) {
return;
}
// If it fails, reset Onyx
actionToMerge[sequenceNumber] = originalReportAction;
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, actionToMerge);
});
}
/**
* Saves the draft for a comment report action. This will put the comment into "edit mode"
*
* @param {Number} reportID
* @param {Number} reportActionID
* @param {String} draftMessage
*/
function saveReportActionDraft(reportID, reportActionID, draftMessage) {
Onyx.set(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${reportID}_${reportActionID}`, draftMessage);
}
/**
* Syncs up a chat report and an IOU report in Onyx after an IOU transaction has been made
* by setting the iouReportID and hasOutstandingIOU for the chat report.
* Even though both reports are updated in the back-end, the API doesn't handle syncing their reportIDs.
* If we didn't sync these reportIDs, the paid IOU would still be shown to users as unpaid.
* The iouReport being fetched here must be open, because only an open iouReport can be paid.
*
* @param {Object} chatReport
* @param {Object} iouReport
*/
function syncChatAndIOUReports(chatReport, iouReport) {
// Return early in case there's a back-end issue preventing the IOU command from returning the report objects.
if (!chatReport || !iouReport) {
return;
}
const simplifiedIouReport = {};
const simplifiedReport = {};
const chatReportKey = `${ONYXKEYS.COLLECTION.REPORT}${chatReport.reportID}`;
const iouReportKey = `${ONYXKEYS.COLLECTION.REPORT_IOUS}${iouReport.reportID}`;
// We don't want to sync an iou report that's already been reimbursed with its chat report.
if (!iouReport.stateNum === CONST.REPORT.STATE_NUM.SUBMITTED) {
simplifiedReport[chatReportKey].iouReportID = iouReport.reportID;
}
simplifiedReport[chatReportKey] = getSimplifiedReportObject(chatReport);
simplifiedReport[chatReportKey].hasOutstandingIOU = iouReport.stateNum
=== (CONST.REPORT.STATE_NUM.PROCESSING && iouReport.total !== 0);
simplifiedIouReport[iouReportKey] = getSimplifiedIOUReport(iouReport, chatReport.reportID);
Onyx.mergeCollection(ONYXKEYS.COLLECTION.REPORT_IOUS, simplifiedIouReport);
Onyx.mergeCollection(ONYXKEYS.COLLECTION.REPORT, simplifiedReport);
}
/**
* Updates a user's notification preferences for a chat room
*
* @param {Number} reportID
* @param {String} notificationPreference
*/
function updateNotificationPreference(reportID, notificationPreference) {
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {notificationPreference});
DeprecatedAPI.Report_UpdateNotificationPreference({reportID, notificationPreference});
}
/**
* Navigates to the 1:1 report with Concierge
*/
function navigateToConciergeChat() {
// If we don't have a chat with Concierge then create it
if (!conciergeChatReportID) {
fetchOrCreateChatReport([currentUserEmail, CONST.EMAIL.CONCIERGE], true);
return;
}
Navigation.navigate(ROUTES.getReportRoute(conciergeChatReportID));
}
/**
* Handle the navigation when report is inaccessible
*/
function handleInaccessibleReport() {
Growl.error(Localize.translateLocal('notFound.chatYouLookingForCannotBeFound'));
navigateToConciergeChat();
}
/**
* Creates a policy room, fetches it, and navigates to it.
* @param {String} policyID
* @param {String} reportName
* @param {String} visibility
* @return {Promise}
*/
function createPolicyRoom(policyID, reportName, visibility) {
Onyx.set(ONYXKEYS.IS_LOADING_CREATE_POLICY_ROOM, true);
return DeprecatedAPI.CreatePolicyRoom({policyID, reportName, visibility})
.then((response) => {
if (response.jsonCode === CONST.JSON_CODE.UNABLE_TO_RETRY) {
Growl.error(Localize.translateLocal('newRoomPage.growlMessageOnError'));
return;
}
if (response.jsonCode !== CONST.JSON_CODE.SUCCESS) {
Growl.error(response.message);
return;
}
return fetchChatReportsByIDs([response.reportID]);
})
.then((chatReports) => {
const reportID = lodashGet(_.first(_.values(chatReports)), 'reportID', '');
if (!reportID) {
Log.error('Unable to grab policy room after creation', reportID);
return;
}
Navigation.navigate(ROUTES.getReportRoute(reportID));
})
.finally(() => Onyx.set(ONYXKEYS.IS_LOADING_CREATE_POLICY_ROOM, false));
}
/**
* Renames a user created Policy Room.
* @param {String} reportID
* @param {String} reportName
*/
function renameReport(reportID, reportName) {
Onyx.set(ONYXKEYS.IS_LOADING_RENAME_POLICY_ROOM, true);
DeprecatedAPI.RenameReport({reportID, reportName})
.then((response) => {
if (response.jsonCode === CONST.JSON_CODE.UNABLE_TO_RETRY) {
Growl.error(Localize.translateLocal('newRoomPage.growlMessageOnRenameError'));
return;
}
if (response.jsonCode !== CONST.JSON_CODE.SUCCESS) {
Growl.error(response.message);
return;
}
Growl.success(Localize.translateLocal('newRoomPage.policyRoomRenamed'));
// Update the report name so that the LHN and header display the updated name
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {reportName});
})
.finally(() => Onyx.set(ONYXKEYS.IS_LOADING_RENAME_POLICY_ROOM, false));
}
export {
fetchAllReports,
fetchActions,
fetchOrCreateChatReport,
fetchChatReportsByIDs,
fetchIOUReportByID,
fetchIOUReportByIDAndUpdateChatReport,
addAction,
updateLastReadActionID,
updateNotificationPreference,
setNewMarkerPosition,
subscribeToReportTypingEvents,
subscribeToUserEvents,
subscribeToReportCommentPushNotifications,
unsubscribeFromReportChannel,
saveReportComment,
broadcastUserIsTyping,
togglePinnedState,
updateCurrentlyViewedReportID,
editReportComment,
saveReportActionDraft,
deleteReportComment,
getSimplifiedIOUReport,
syncChatAndIOUReports,
navigateToConciergeChat,
handleInaccessibleReport,
setReportWithDraft,
fetchActionsWithLoadingState,
createPolicyRoom,
renameReport,
getLastReadSequenceNumber,
};
|
/* jshint indent: 2 */
import DataTypes from 'sequelize';
import Model from '../sequelize';
const Mess_Option = Model.define('mess_option', {
login_id: {
type: DataTypes.STRING(50),
allowNull: false,
defaultValue: '',
},
month: {
type: DataTypes.STRING(20),
allowNull: false,
defaultValue: '',
},
mess: {
type: DataTypes.STRING(20),
allowNull: false,
defaultValue: '',
},
index_: {
type: DataTypes.INTEGER(11).UNSIGNED,
allowNull: false,
primaryKey: true,
autoIncrement: true,
},
}, {
tableName: 'mess_option',
});
export default Mess_Option;
|
/* *
*
* (c) 2010-2019 Paweł Dalek
*
* Volume By Price (VBP) indicator for Highstock
*
* License: www.highcharts.com/license
*
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
*
* */
'use strict';
import H from '../parts/Globals.js';
import U from '../parts/Utilities.js';
var arrayMax = U.arrayMax, arrayMin = U.arrayMin, extend = U.extend, isArray = U.isArray;
/* eslint-disable require-jsdoc */
// Utils
function arrayExtremesOHLC(data) {
var dataLength = data.length, min = data[0][3], max = min, i = 1, currentPoint;
for (; i < dataLength; i++) {
currentPoint = data[i][3];
if (currentPoint < min) {
min = currentPoint;
}
if (currentPoint > max) {
max = currentPoint;
}
}
return {
min: min,
max: max
};
}
/* eslint-enable require-jsdoc */
var abs = Math.abs, noop = H.noop, addEvent = H.addEvent, correctFloat = H.correctFloat, seriesType = H.seriesType, columnPrototype = H.seriesTypes.column.prototype;
/**
* The Volume By Price (VBP) series type.
*
* @private
* @class
* @name Highcharts.seriesTypes.vbp
*
* @augments Highcharts.Series
*/
seriesType('vbp', 'sma',
/**
* Volume By Price indicator.
*
* This series requires `linkedTo` option to be set.
*
* @sample stock/indicators/volume-by-price
* Volume By Price indicator
*
* @extends plotOptions.sma
* @since 6.0.0
* @product highstock
* @requires stock/indicators/indicators
* @requires stock/indicators/volume-by-price
* @optionparent plotOptions.vbp
*/
{
/**
* @excluding index, period
*/
params: {
/**
* The number of price zones.
*/
ranges: 12,
/**
* The id of volume series which is mandatory. For example using
* OHLC data, volumeSeriesID='volume' means the indicator will be
* calculated using OHLC and volume values.
*/
volumeSeriesID: 'volume'
},
/**
* The styles for lines which determine price zones.
*/
zoneLines: {
/**
* Enable/disable zone lines.
*/
enabled: true,
/**
* Specify the style of zone lines.
*
* @type {Highcharts.CSSObject}
* @default {"color": "#0A9AC9", "dashStyle": "LongDash", "lineWidth": 1}
*/
styles: {
/** @ignore-options */
color: '#0A9AC9',
/** @ignore-options */
dashStyle: 'LongDash',
/** @ignore-options */
lineWidth: 1
}
},
/**
* The styles for bars when volume is divided into positive/negative.
*/
volumeDivision: {
/**
* Option to control if volume is divided.
*/
enabled: true,
styles: {
/**
* Color of positive volume bars.
*
* @type {Highcharts.ColorString}
*/
positiveColor: 'rgba(144, 237, 125, 0.8)',
/**
* Color of negative volume bars.
*
* @type {Highcharts.ColorString}
*/
negativeColor: 'rgba(244, 91, 91, 0.8)'
}
},
// To enable series animation; must be animationLimit > pointCount
animationLimit: 1000,
enableMouseTracking: false,
pointPadding: 0,
zIndex: -1,
crisp: true,
dataGrouping: {
enabled: false
},
dataLabels: {
/** @ignore-option */
allowOverlap: true,
/** @ignore-option */
enabled: true,
/** @ignore-option */
format: 'P: {point.volumePos:.2f} | N: {point.volumeNeg:.2f}',
/** @ignore-option */
padding: 0,
/** @ignore-option */
style: {
fontSize: '7px'
},
/** @ignore-option */
verticalAlign: 'top'
}
},
/**
* @lends Highcharts.Series#
*/
{
nameBase: 'Volume by Price',
bindTo: {
series: false,
eventName: 'afterSetExtremes'
},
calculateOn: 'render',
markerAttribs: noop,
drawGraph: noop,
getColumnMetrics: columnPrototype.getColumnMetrics,
crispCol: columnPrototype.crispCol,
init: function (chart) {
var indicator = this, params, baseSeries, volumeSeries;
H.seriesTypes.sma.prototype.init.apply(indicator, arguments);
params = indicator.options.params;
baseSeries = indicator.linkedParent;
volumeSeries = chart.get(params.volumeSeriesID);
indicator.addCustomEvents(baseSeries, volumeSeries);
return indicator;
},
// Adds events related with removing series
addCustomEvents: function (baseSeries, volumeSeries) {
var indicator = this;
/* eslint-disable require-jsdoc */
function toEmptyIndicator() {
indicator.chart.redraw();
indicator.setData([]);
indicator.zoneStarts = [];
if (indicator.zoneLinesSVG) {
indicator.zoneLinesSVG.destroy();
delete indicator.zoneLinesSVG;
}
}
/* eslint-enable require-jsdoc */
// If base series is deleted, indicator series data is filled with
// an empty array
indicator.dataEventsToUnbind.push(addEvent(baseSeries, 'remove', function () {
toEmptyIndicator();
}));
// If volume series is deleted, indicator series data is filled with
// an empty array
if (volumeSeries) {
indicator.dataEventsToUnbind.push(addEvent(volumeSeries, 'remove', function () {
toEmptyIndicator();
}));
}
return indicator;
},
// Initial animation
animate: function (init) {
var series = this, attr = {};
if (H.svg && !init) {
attr.translateX = series.yAxis.pos;
series.group.animate(attr, extend(H.animObject(series.options.animation), {
step: function (val, fx) {
series.group.attr({
scaleX: Math.max(0.001, fx.pos)
});
}
}));
// Delete this function to allow it only once
series.animate = null;
}
},
drawPoints: function () {
var indicator = this;
if (indicator.options.volumeDivision.enabled) {
indicator.posNegVolume(true, true);
columnPrototype.drawPoints.apply(indicator, arguments);
indicator.posNegVolume(false, false);
}
columnPrototype.drawPoints.apply(indicator, arguments);
},
// Function responsible for dividing volume into positive and negative
posNegVolume: function (initVol, pos) {
var indicator = this, signOrder = pos ?
['positive', 'negative'] :
['negative', 'positive'], volumeDivision = indicator.options.volumeDivision, pointLength = indicator.points.length, posWidths = [], negWidths = [], i = 0, pointWidth, priceZone, wholeVol, point;
if (initVol) {
indicator.posWidths = posWidths;
indicator.negWidths = negWidths;
}
else {
posWidths = indicator.posWidths;
negWidths = indicator.negWidths;
}
for (; i < pointLength; i++) {
point = indicator.points[i];
point[signOrder[0] + 'Graphic'] = point.graphic;
point.graphic = point[signOrder[1] + 'Graphic'];
if (initVol) {
pointWidth = point.shapeArgs.width;
priceZone = indicator.priceZones[i];
wholeVol = priceZone.wholeVolumeData;
if (wholeVol) {
posWidths.push(pointWidth / wholeVol * priceZone.positiveVolumeData);
negWidths.push(pointWidth / wholeVol * priceZone.negativeVolumeData);
}
else {
posWidths.push(0);
negWidths.push(0);
}
}
point.color = pos ?
volumeDivision.styles.positiveColor :
volumeDivision.styles.negativeColor;
point.shapeArgs.width = pos ?
indicator.posWidths[i] :
indicator.negWidths[i];
point.shapeArgs.x = pos ?
point.shapeArgs.x :
indicator.posWidths[i];
}
},
translate: function () {
var indicator = this, options = indicator.options, chart = indicator.chart, yAxis = indicator.yAxis, yAxisMin = yAxis.min, zoneLinesOptions = indicator.options.zoneLines, priceZones = (indicator.priceZones), yBarOffset = 0, indicatorPoints, volumeDataArray, maxVolume, primalBarWidth, barHeight, barHeightP, oldBarHeight, barWidth, pointPadding, chartPlotTop, barX, barY;
columnPrototype.translate.apply(indicator);
indicatorPoints = indicator.points;
// Do translate operation when points exist
if (indicatorPoints.length) {
pointPadding = options.pointPadding < 0.5 ?
options.pointPadding :
0.1;
volumeDataArray = indicator.volumeDataArray;
maxVolume = arrayMax(volumeDataArray);
primalBarWidth = chart.plotWidth / 2;
chartPlotTop = chart.plotTop;
barHeight = abs(yAxis.toPixels(yAxisMin) -
yAxis.toPixels(yAxisMin + indicator.rangeStep));
oldBarHeight = abs(yAxis.toPixels(yAxisMin) -
yAxis.toPixels(yAxisMin + indicator.rangeStep));
if (pointPadding) {
barHeightP = abs(barHeight * (1 - 2 * pointPadding));
yBarOffset = abs((barHeight - barHeightP) / 2);
barHeight = abs(barHeightP);
}
indicatorPoints.forEach(function (point, index) {
barX = point.barX = point.plotX = 0;
barY = point.plotY = (yAxis.toPixels(priceZones[index].start) -
chartPlotTop -
(yAxis.reversed ?
(barHeight - oldBarHeight) :
barHeight) -
yBarOffset);
barWidth = correctFloat(primalBarWidth *
priceZones[index].wholeVolumeData / maxVolume);
point.pointWidth = barWidth;
point.shapeArgs = indicator.crispCol.apply(// eslint-disable-line no-useless-call
indicator, [barX, barY, barWidth, barHeight]);
point.volumeNeg = priceZones[index].negativeVolumeData;
point.volumePos = priceZones[index].positiveVolumeData;
point.volumeAll = priceZones[index].wholeVolumeData;
});
if (zoneLinesOptions.enabled) {
indicator.drawZones(chart, yAxis, indicator.zoneStarts, zoneLinesOptions.styles);
}
}
},
getValues: function (series, params) {
var indicator = this, xValues = series.processedXData, yValues = series.processedYData, chart = indicator.chart, ranges = params.ranges, VBP = [], xData = [], yData = [], isOHLC, volumeSeries, priceZones;
// Checks if base series exists
if (!series.chart) {
return H.error('Base series not found! In case it has been removed, add ' +
'a new one.', true, chart);
}
// Checks if volume series exists
if (!(volumeSeries = (chart.get(params.volumeSeriesID)))) {
return H.error('Series ' +
params.volumeSeriesID +
' not found! Check `volumeSeriesID`.', true, chart);
}
// Checks if series data fits the OHLC format
isOHLC = isArray(yValues[0]);
if (isOHLC && yValues[0].length !== 4) {
return H.error('Type of ' +
series.name +
' series is different than line, OHLC or candlestick.', true, chart);
}
// Price zones contains all the information about the zones (index,
// start, end, volumes, etc.)
priceZones = indicator.priceZones = indicator.specifyZones(isOHLC, xValues, yValues, ranges, volumeSeries);
priceZones.forEach(function (zone, index) {
VBP.push([zone.x, zone.end]);
xData.push(VBP[index][0]);
yData.push(VBP[index][1]);
});
return {
values: VBP,
xData: xData,
yData: yData
};
},
// Specifing where each zone should start ans end
specifyZones: function (isOHLC, xValues, yValues, ranges, volumeSeries) {
var indicator = this, rangeExtremes = (isOHLC ? arrayExtremesOHLC(yValues) : false), lowRange = rangeExtremes ?
rangeExtremes.min :
arrayMin(yValues), highRange = rangeExtremes ?
rangeExtremes.max :
arrayMax(yValues), zoneStarts = indicator.zoneStarts = [], priceZones = [], i = 0, j = 1, rangeStep, zoneStartsLength;
if (!lowRange || !highRange) {
if (this.points.length) {
this.setData([]);
this.zoneStarts = [];
this.zoneLinesSVG.destroy();
}
return [];
}
rangeStep = indicator.rangeStep =
correctFloat(highRange - lowRange) / ranges;
zoneStarts.push(lowRange);
for (; i < ranges - 1; i++) {
zoneStarts.push(correctFloat(zoneStarts[i] + rangeStep));
}
zoneStarts.push(highRange);
zoneStartsLength = zoneStarts.length;
// Creating zones
for (; j < zoneStartsLength; j++) {
priceZones.push({
index: j - 1,
x: xValues[0],
start: zoneStarts[j - 1],
end: zoneStarts[j]
});
}
return indicator.volumePerZone(isOHLC, priceZones, volumeSeries, xValues, yValues);
},
// Calculating sum of volume values for a specific zone
volumePerZone: function (isOHLC, priceZones, volumeSeries, xValues, yValues) {
var indicator = this, volumeXData = volumeSeries.processedXData, volumeYData = volumeSeries.processedYData, lastZoneIndex = priceZones.length - 1, baseSeriesLength = yValues.length, volumeSeriesLength = volumeYData.length, previousValue, startFlag, endFlag, value, i;
// Checks if each point has a corresponding volume value
if (abs(baseSeriesLength - volumeSeriesLength)) {
// If the first point don't have volume, add 0 value at the
// beggining of the volume array
if (xValues[0] !== volumeXData[0]) {
volumeYData.unshift(0);
}
// If the last point don't have volume, add 0 value at the end
// of the volume array
if (xValues[baseSeriesLength - 1] !==
volumeXData[volumeSeriesLength - 1]) {
volumeYData.push(0);
}
}
indicator.volumeDataArray = [];
priceZones.forEach(function (zone) {
zone.wholeVolumeData = 0;
zone.positiveVolumeData = 0;
zone.negativeVolumeData = 0;
for (i = 0; i < baseSeriesLength; i++) {
startFlag = false;
endFlag = false;
value = isOHLC ? yValues[i][3] : yValues[i];
previousValue = i ?
(isOHLC ?
yValues[i - 1][3] :
yValues[i - 1]) :
value;
// Checks if this is the point with the
// lowest close value and if so, adds it calculations
if (value <= zone.start && zone.index === 0) {
startFlag = true;
}
// Checks if this is the point with the highest
// close value and if so, adds it calculations
if (value >= zone.end && zone.index === lastZoneIndex) {
endFlag = true;
}
if ((value > zone.start || startFlag) &&
(value < zone.end || endFlag)) {
zone.wholeVolumeData += volumeYData[i];
if (previousValue > value) {
zone.negativeVolumeData += volumeYData[i];
}
else {
zone.positiveVolumeData += volumeYData[i];
}
}
}
indicator.volumeDataArray.push(zone.wholeVolumeData);
});
return priceZones;
},
// Function responsoble for drawing additional lines indicating zones
drawZones: function (chart, yAxis, zonesValues, zonesStyles) {
var indicator = this, renderer = chart.renderer, zoneLinesSVG = indicator.zoneLinesSVG, zoneLinesPath = [], leftLinePos = 0, rightLinePos = chart.plotWidth, verticalOffset = chart.plotTop, verticalLinePos;
zonesValues.forEach(function (value) {
verticalLinePos = yAxis.toPixels(value) - verticalOffset;
zoneLinesPath = zoneLinesPath.concat(chart.renderer.crispLine([
'M',
leftLinePos,
verticalLinePos,
'L',
rightLinePos,
verticalLinePos
], zonesStyles.lineWidth));
});
// Create zone lines one path or update it while animating
if (zoneLinesSVG) {
zoneLinesSVG.animate({
d: zoneLinesPath
});
}
else {
zoneLinesSVG = indicator.zoneLinesSVG =
renderer.path(zoneLinesPath).attr({
'stroke-width': zonesStyles.lineWidth,
'stroke': zonesStyles.color,
'dashstyle': zonesStyles.dashStyle,
'zIndex': indicator.group.zIndex + 0.1
})
.add(indicator.group);
}
}
},
/**
* @lends Highcharts.Point#
*/
{
// Required for destroying negative part of volume
destroy: function () {
// @todo: this.negativeGraphic doesn't seem to be used anywhere
if (this.negativeGraphic) {
this.negativeGraphic = this.negativeGraphic.destroy();
}
return H.Point.prototype.destroy.apply(this, arguments);
}
});
/**
* A `Volume By Price (VBP)` series. If the [type](#series.vbp.type) option is
* not specified, it is inherited from [chart.type](#chart.type).
*
* @extends series,plotOptions.vbp
* @since 6.0.0
* @product highstock
* @excluding dataParser, dataURL
* @requires stock/indicators/indicators
* @requires stock/indicators/volume-by-price
* @apioption series.vbp
*/
''; // to include the above in the js output
|
import Vue from 'vue'
import Vuetify from 'vuetify'
import 'vuetify/dist/vuetify.min.css'
Vue.use(Vuetify)
const opts = {
icons: {
iconfont: 'mdi', // default - only for display purposes
},
theme: {
themes: {
light: {
primary: '#b7131c',
secondary: '#700809',
accent: '#a54b54',
error: '#f44336',
warning: '#ff9800',
info: '#00bcd4',
success: '#4caf50',
},
dark: {
primary: '#b7131c',
secondary: '#700809',
accent: '#a54b54',
error: '#f44336',
warning: '#ff9800',
info: '#00bcd4',
success: '#4caf50',
},
},
},
}
export default new Vuetify(opts)
|
var searchData=
[
['gender',['Gender',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#af90c47dbff13aa2ea62d189f4445896ba019ec3132cdf8ee0f2e2a75cf5d3e459',1,'HP::HPTRIM::SDK']]],
['gendersalutation',['GenderSalutation',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#af90c47dbff13aa2ea62d189f4445896badefcab608c8024d0247ef1a17c837c7a',1,'HP::HPTRIM::SDK']]],
['general',['General',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a456a0d43ae717b77d2ec2748aa220fa1a0db377921f4ce762c62526131097968f',1,'HP::HPTRIM::SDK']]],
['generalaccess',['GeneralAccess',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#af90c47dbff13aa2ea62d189f4445896ba8337a828c005eb5b40f0c07b51d901f7',1,'HP::HPTRIM::SDK']]],
['generalexceptionhandling',['GeneralExceptionHandling',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#af90c47dbff13aa2ea62d189f4445896ba134ec97b5de9e41d2356f404507060f7',1,'HP::HPTRIM::SDK']]],
['generateevents',['GenerateEvents',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a49ac42e8e87bbb5cac5c6a8d5ed5f937a931ac23fbd7733d4a8d738a666cc0d3f',1,'HP::HPTRIM::SDK']]],
['generatestats',['GenerateStats',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a49ac42e8e87bbb5cac5c6a8d5ed5f937a98206399b0da2568e542effe3e4a16a6',1,'HP::HPTRIM::SDK']]],
['genericpermissions',['GenericPermissions',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#af90c47dbff13aa2ea62d189f4445896bab22acde1b56774aadcc3bdfecc3304f0',1,'HP::HPTRIM::SDK']]],
['genericpurposes',['GenericPurposes',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#af90c47dbff13aa2ea62d189f4445896ba950f4aa25d2e00e5c5bc681b1e90af1f',1,'HP::HPTRIM::SDK']]],
['genericremovefrom',['GenericRemoveFrom',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a456a0d43ae717b77d2ec2748aa220fa1a0bf790d6ae1807e4897f12de8cef2d9b',1,'HP::HPTRIM::SDK']]],
['genericsearch',['GenericSearch',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a456a0d43ae717b77d2ec2748aa220fa1a70bb2e35925eacad47ead61861782fe1',1,'HP::HPTRIM::SDK']]],
['genericsecurity',['GenericSecurity',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a456a0d43ae717b77d2ec2748aa220fa1aa336596e9b57af051c83501af1d2fa1f',1,'HP::HPTRIM::SDK']]],
['genericsendto',['GenericSendTo',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a456a0d43ae717b77d2ec2748aa220fa1a1ff8f39aa38ae2078bc22fbaf0b3027f',1,'HP::HPTRIM::SDK']]],
['geography',['Geography',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33a84352d0cf230738e4ee298790e4b5265',1,'HP.HPTRIM.SDK.Geography()'],['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a4c83d4ffc5d200c76797626eb8ec1492a84352d0cf230738e4ee298790e4b5265',1,'HP.HPTRIM.SDK.Geography()'],['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a85bbf4b049c587cb082d999f4b5cb679a84352d0cf230738e4ee298790e4b5265',1,'HP.HPTRIM.SDK.Geography()'],['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a97b2037f0b3c55c44184ba2c705b9e7fa84352d0cf230738e4ee298790e4b5265',1,'HP.HPTRIM.SDK.Geography()'],['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#aa1297d5761569bb0e5b4ffa4532467fea84352d0cf230738e4ee298790e4b5265',1,'HP.HPTRIM.SDK.Geography()']]],
['geographydistanceunit',['GeographyDistanceUnit',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#af90c47dbff13aa2ea62d189f4445896bacd56b67f988601f147ccd05757b9ef94',1,'HP::HPTRIM::SDK']]],
['geographysearchtype',['GeographySearchType',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#af90c47dbff13aa2ea62d189f4445896ba6a3fd2e851cb310e8fcb91ea329c4412',1,'HP::HPTRIM::SDK']]],
['geolocations',['GeoLocations',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a7afb044c3619fb460177ad3a60fc5f6ca6315326add5403ae8043fc9987e53048',1,'HP::HPTRIM::SDK']]],
['german',['German',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a661735b511a9c8a1bc9343ef5e674018a86bc3115eb4e9873ac96904a4a68e19e',1,'HP::HPTRIM::SDK']]],
['gigabytes',['Gigabytes',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#ae8e18e4e9c04b7e93a485bac91442b5caf6f7ad0fd5914138fb449b9011c8de7a',1,'HP::HPTRIM::SDK']]],
['gisdata',['GisData',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a6dda6869443c7d9ace4604d70cb2f800a9692081ba469cbf511a927bf6f1afca3',1,'HP::HPTRIM::SDK']]],
['gisdatauseroptionsdisplaygisinwebbrowser',['GisDataUserOptionsDisplayGISinWebBrowser',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a42b30f289efa9bf64150279dbb479586abadbad058a92368f4642911bb16723c4',1,'HP::HPTRIM::SDK']]],
['gisdatauseroptionsseachpreference',['GisDataUserOptionsSeachPreference',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a42b30f289efa9bf64150279dbb479586a645c161287349227d2678bed43d77e10',1,'HP::HPTRIM::SDK']]],
['gisdatauseroptionsstartpoint',['GisDataUserOptionsStartPoint',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a42b30f289efa9bf64150279dbb479586a681fecc2f069afdfa9f150108fcf242e',1,'HP::HPTRIM::SDK']]],
['gishtml',['GisHtml',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a1c07ec76466baafd768a8926aad00aeba633a9716ff5f06d547e76c6b66abae5b',1,'HP::HPTRIM::SDK']]],
['gisinterfacefile',['GisInterfaceFile',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a44dddeeeb56e30e5705dedcec68b4822ada8f21b782bdae62345e252df3c8f2f1',1,'HP::HPTRIM::SDK']]],
['globalverssettings',['GlobalVersSettings',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a1c07ec76466baafd768a8926aad00aebaa721419c7d4f988d9dc0bbe0ff979e06',1,'HP::HPTRIM::SDK']]],
['goback',['GoBack',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a49ac42e8e87bbb5cac5c6a8d5ed5f937abfa92ebb57de142e10ded734dac3161a',1,'HP.HPTRIM.SDK.GoBack()'],['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33abfa92ebb57de142e10ded734dac3161a',1,'HP.HPTRIM.SDK.GoBack()']]],
['goforward',['GoForward',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a49ac42e8e87bbb5cac5c6a8d5ed5f937acfba81d154dc32d815f85c6a929f52a6',1,'HP.HPTRIM.SDK.GoForward()'],['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33acfba81d154dc32d815f85c6a929f52a6',1,'HP.HPTRIM.SDK.GoForward()']]],
['google',['Google',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a3770d9b29a51f113016553152b095be4a8b36e9207c24c76e6719268e49201d94',1,'HP::HPTRIM::SDK']]],
['googleapps',['GoogleApps',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#abf74415a35fce91010b5c79976a6270cab7c739d20fe713aae9b4b00fd53c1e71',1,'HP::HPTRIM::SDK']]],
['gpssearch',['GpsSearch',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a507f5c953270798aac583b4722fd2756a281ef9e5f79912b61c255dfaa2a24e4a',1,'HP.HPTRIM.SDK.GpsSearch()'],['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#af57fc055b8a60734f55b6a295aec747da281ef9e5f79912b61c255dfaa2a24e4a',1,'HP.HPTRIM.SDK.GpsSearch()'],['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#abc266139c7edef050dbc0f1c5fe4680aa281ef9e5f79912b61c255dfaa2a24e4a',1,'HP.HPTRIM.SDK.GpsSearch()']]],
['graphic',['Graphic',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33aaabf434277385d39ebb16ef7ad6b0e7a',1,'HP::HPTRIM::SDK']]],
['greaterthan',['GreaterThan',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#aa024d7afe6dfee901ee5a414ffd09eecaf6d044fe1f01fb0c956b80099e2a3072',1,'HP::HPTRIM::SDK']]],
['greaterthanorequalto',['GreaterThanOrEqualTo',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#aa024d7afe6dfee901ee5a414ffd09eeca96b5d5dce523a30ceae47db080d8af48',1,'HP::HPTRIM::SDK']]],
['greenbook',['GreenBook',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33ada86bef2bf73d588cf52a600ff6726d5',1,'HP::HPTRIM::SDK']]],
['greenbox',['GreenBox',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33a818d111ea0765009c346539feef9162f',1,'HP::HPTRIM::SDK']]],
['greendoc',['GreenDoc',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33a12e97e7740b17a5b6b714b30b8ae5dc5',1,'HP::HPTRIM::SDK']]],
['greenfile',['GreenFile',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33a33e6010dffe7757031cb3dfbff77bc3d',1,'HP::HPTRIM::SDK']]],
['greybook',['GreyBook',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33abe63fab76901d5af02054f1e4fe3f358',1,'HP::HPTRIM::SDK']]],
['greybox',['GreyBox',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33a53eee12c73be1383913deff8ef3b6159',1,'HP::HPTRIM::SDK']]],
['greydoc',['GreyDoc',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33ab81ce229378b0321a338d57669bbe102',1,'HP::HPTRIM::SDK']]],
['greyfile',['GreyFile',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33a18bb0661da26ea4f3b408bc9d5ce9717',1,'HP::HPTRIM::SDK']]],
['grm_5faddnewclassification',['grm_addNewClassification',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca28d97890f34ce9579d9ad92e0ddcdd26',1,'HP::HPTRIM::SDK']]],
['grm_5faddworkgroup',['grm_addWorkgroup',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccae117534421c1c68d1c7331eca4a0182f',1,'HP::HPTRIM::SDK']]],
['grm_5fadminusernotfound_5ferror',['grm_AdminUserNotFound_error',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca1c058d1156974cf42b30881efb7a7063',1,'HP::HPTRIM::SDK']]],
['grm_5fapproveallfps',['grm_approveAllFPs',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca4e9bbb567ac2a181520d2f245bfc825f',1,'HP::HPTRIM::SDK']]],
['grm_5fapprovefileplan',['grm_approveFilePlan',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca331417def5edb3182419ebfb7956cc6a',1,'HP::HPTRIM::SDK']]],
['grm_5fbadlinemanager',['grm_badLineManager',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccacdef6c7d768cb2304dbd04d6efaa72cb',1,'HP::HPTRIM::SDK']]],
['grm_5fbadrfp',['grm_badRFP',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca5ddcb74605589785b3baeb958a7e19ad',1,'HP::HPTRIM::SDK']]],
['grm_5fblankbrm',['grm_blankBRM',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccac0128ae56c811b6a605ff30c650b688f',1,'HP::HPTRIM::SDK']]],
['grm_5fblanklinemanager',['grm_blankLineManager',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccaa9c564a6f17e82d1fdcc9c45ebfecca7',1,'HP::HPTRIM::SDK']]],
['grm_5fblanklm',['grm_blankLM',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccab2ae8f0ccc839c32213acbb8c2813c8d',1,'HP::HPTRIM::SDK']]],
['grm_5fblankreviewer',['grm_blankReviewer',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca8695dd1c06c2d128d6c58cddf15497f8',1,'HP::HPTRIM::SDK']]],
['grm_5fblankrfp',['grm_blankRFP',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccafec69fb3ba9b174c46892bb49aff1a0b',1,'HP::HPTRIM::SDK']]],
['grm_5fblankrfpinnewwkg',['grm_blankRFPInNewWkg',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca9763a476e8e220ac6002c974fd95cf7d',1,'HP::HPTRIM::SDK']]],
['grm_5fbrmnotperson',['grm_BRMNotPerson',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca6d96dcf5d6e62d243705d2fdfbdefcb7',1,'HP::HPTRIM::SDK']]],
['grm_5fbusfunbkank',['grm_busFunBkank',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca5986a0c414be056d4024a5c753d11353',1,'HP::HPTRIM::SDK']]],
['grm_5fbusfunnotunit',['grm_BusFunNotUnit',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca17bdb4fb48bd537732e50fb9f60b5cea',1,'HP::HPTRIM::SDK']]],
['grm_5fcanceledmcaclsetup',['grm_canceledMCACLSetup',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccac4d6726e68080a0a1d725c8b802061c2',1,'HP::HPTRIM::SDK']]],
['grm_5fcancelledbyuser',['grm_cancelledByUser',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca0c00767c95ea3183fd1bc62e8eff265b',1,'HP::HPTRIM::SDK']]],
['grm_5fcannotimporttowkg',['grm_cannotImportToWkg',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccadde31fa4029375f3fdb917395e0d5c45',1,'HP::HPTRIM::SDK']]],
['grm_5fcannotmaintainfileplan',['grm_cannotMainTainFileplan',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca11df46bd51d4c1eee0b40d83dc46609f',1,'HP::HPTRIM::SDK']]],
['grm_5fcannotrelocatetosamefp',['grm_cannotRelocateToSameFP',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca3b2710a9cd1656b5e4a7d5e2564bbd3f',1,'HP::HPTRIM::SDK']]],
['grm_5fchoosetargetfp',['grm_chooseTargetFP',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca2c96b75a9c9a5e3bf360416f7eebc219',1,'HP::HPTRIM::SDK']]],
['grm_5fconvertrcrecords',['grm_convertRCRecords',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca46ebff1561c77c62fb6a771a138edd2c',1,'HP::HPTRIM::SDK']]],
['grm_5fcorruptlinemanager',['grm_corruptLineManager',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccaf7387064e30b536c59035c8010ff9600',1,'HP::HPTRIM::SDK']]],
['grm_5fcorruptlm',['grm_corruptLM',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca368cce5f7b76b31553ab29600c90de2d',1,'HP::HPTRIM::SDK']]],
['grm_5fcorruptmanagerindestworkgroup',['grm_corruptManagerInDestWorkgroup',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccac44bee764b5d933c06d515958eb15dc8',1,'HP::HPTRIM::SDK']]],
['grm_5fcorruptrfp',['grm_corruptRFP',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca7869697a4df97dc553a5e8d08ba4adc3',1,'HP::HPTRIM::SDK']]],
['grm_5fcountrynotassigned',['grm_countryNotAssigned',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccad10c2446f818ff47b816668b023454e2',1,'HP::HPTRIM::SDK']]],
['grm_5fdataconversioninfo',['grm_dataConversionInfo',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccac47c3c49f7abe2b45210e2093a64bade',1,'HP::HPTRIM::SDK']]],
['grm_5fdcmsg',['grm_DCMsg',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccacde2f1abf1bbb431ba811c5681424904',1,'HP::HPTRIM::SDK']]],
['grm_5fdroppedonunsupported',['grm_droppedOnUnsupported',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccac3ef3070f42bdfdcfe77add56aa9c4b8',1,'HP::HPTRIM::SDK']]],
['grm_5feditobject',['grm_editObject',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca50cddf6c8a4b8b0229d52df2c805453a',1,'HP::HPTRIM::SDK']]],
['grm_5ferroringetfileattributes',['grm_errorInGetFileAttributes',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca1469611dec6c9d1e6ce80388b3b30b56',1,'HP::HPTRIM::SDK']]],
['grm_5ffileplanalreadyapproved',['grm_filePlanAlreadyApproved',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca9ccedfb1ddde27748f7797b7c72d0420',1,'HP::HPTRIM::SDK']]],
['grm_5ffpdoesnothaverty',['grm_fpDoesNotHaveRty',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccad633118d52b70b3bec8d25ff56893d31',1,'HP::HPTRIM::SDK']]],
['grm_5fimportcomplete',['grm_importComplete',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca947b34970f5636d347b9f9e06ed37242',1,'HP::HPTRIM::SDK']]],
['grm_5fimportfailnomembership',['grm_importFailNoMembership',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccab9a02858ae09e0b30bdd4d2d08b7a75a',1,'HP::HPTRIM::SDK']]],
['grm_5fimportmsg',['grm_importMsg',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca4a61fc39de14a59aa32365bd2ddf44fa',1,'HP::HPTRIM::SDK']]],
['grm_5finvalidlm',['grm_invalidLM',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccae2f903d5a56038124125bc7f08b79db6',1,'HP::HPTRIM::SDK']]],
['grm_5finvalidrfp',['grm_invalidRFP',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca33916dd4509a44978823c77369815533',1,'HP::HPTRIM::SDK']]],
['grm_5flegalentitynotassigned',['grm_legalEntityNotAssigned',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccae7a57e083d7c4a66b36ebcd93b1f0c4e',1,'HP::HPTRIM::SDK']]],
['grm_5flinemanagerinvalid',['grm_lineManagerInvalid',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca86edfc2bd947944efb525ba8b082abda',1,'HP::HPTRIM::SDK']]],
['grm_5flmnotperson',['grm_LMNotPerson',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccacc64032b055ff2367acbcdca2dbe200c',1,'HP::HPTRIM::SDK']]],
['grm_5floadinguserfields',['grm_loadingUserFields',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca433292fcc0f7722c80c30adbe8e02084',1,'HP::HPTRIM::SDK']]],
['grm_5flocnotworkgroup',['grm_locNotWorkgroup',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca8c112c43618aa28214a6b5e315207e45',1,'HP::HPTRIM::SDK']]],
['grm_5flogdcdone',['grm_logDCDone',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccad09d8a7afe83dcc374dbc6ab47bb46e6',1,'HP::HPTRIM::SDK']]],
['grm_5flogdcend',['grm_logDCEnd',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccafa273c9d3ea6d98d7411aa710d2af5af',1,'HP::HPTRIM::SDK']]],
['grm_5flogdcerror',['grm_logDCError',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca8562005d0e5ef7480052aae5e4116d4d',1,'HP::HPTRIM::SDK']]],
['grm_5flogdcerrors',['grm_logDCErrors',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccad1125c41b5622afa037fd0e8e9065368',1,'HP::HPTRIM::SDK']]],
['grm_5flogdcerrorsdetected',['grm_logDCErrorsDetected',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca7ac27ea23b92646eb07ecccc28eb2c65',1,'HP::HPTRIM::SDK']]],
['grm_5flogdcheader',['grm_logDCHeader',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca8ae2ce5bfe6f9d05331bb531abcbaa65',1,'HP::HPTRIM::SDK']]],
['grm_5flogdcrecord',['grm_logDCRecord',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccaa72085d84de94648873785981de886f6',1,'HP::HPTRIM::SDK']]],
['grm_5flogdcrecorddone',['grm_logDCRecordDone',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca0f4c9419bad0fef116afa1ca221f3b7c',1,'HP::HPTRIM::SDK']]],
['grm_5flogdcrecorderror',['grm_logDCRecordError',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccac471ac2f6a7678b20dc10e62bb5ff515',1,'HP::HPTRIM::SDK']]],
['grm_5flogdcupdatedcount',['grm_logDCUpdatedCount',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca230632721e89582627653b5d768f104b',1,'HP::HPTRIM::SDK']]],
['grm_5flogfilebad',['grm_logFileBad',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca4eb53e461613609afc775f34af3e6f6e',1,'HP::HPTRIM::SDK']]],
['grm_5flogwcconvertwg',['grm_logWCConvertWg',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccad672c5ef6b0827e830d96128576f37a7',1,'HP::HPTRIM::SDK']]],
['grm_5flogwcconvertwgmsg',['grm_logWCConvertWgMsg',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca6bcf817b0c8e061477b5f8d197967122',1,'HP::HPTRIM::SDK']]],
['grm_5flogwcdone',['grm_logWCDone',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca2034d80dc9463c903fa3bd41a7d9f94f',1,'HP::HPTRIM::SDK']]],
['grm_5flogwcdoneremoveunit',['grm_logWCDoneRemoveUnit',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccae8dd1741031a22ccfa575d79d6fb0033',1,'HP::HPTRIM::SDK']]],
['grm_5flogwcerror',['grm_logWCError',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca05573473178d027bff2565e80c5d8708',1,'HP::HPTRIM::SDK']]],
['grm_5flogwcerrors',['grm_logWCErrors',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca5b382ac8838ca4e3952c278df1bc947f',1,'HP::HPTRIM::SDK']]],
['grm_5flogwcerrorsdetected',['grm_logWCErrorsDetected',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca900268884f1b030f550b06b7a862dba9',1,'HP::HPTRIM::SDK']]],
['grm_5flogwcfailremoveunit',['grm_logWCFailRemoveUnit',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccafbd5d94e49c868f18a7e0c5008c8e539',1,'HP::HPTRIM::SDK']]],
['grm_5flogwcheader',['grm_logWCHeader',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca39a599e767b9765cbed86f22d4f6cb0c',1,'HP::HPTRIM::SDK']]],
['grm_5flogwcinfo',['grm_logWCInfo',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca5b4991402da785d494833c77677ab916',1,'HP::HPTRIM::SDK']]],
['grm_5flogwcprogress',['grm_logWCProgress',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca288356ebb91d47f44427db69118d60c5',1,'HP::HPTRIM::SDK']]],
['grm_5flogwcremovingunit',['grm_logWCRemovingUnit',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca47195174628e9ac086ea84fa078b717f',1,'HP::HPTRIM::SDK']]],
['grm_5flogwctesting',['grm_logWCTesting',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca44f5edbc4f570a263cc2a32c77ed40d5',1,'HP::HPTRIM::SDK']]],
['grm_5flogwcwgupdated',['grm_logWCWgUpdated',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccae7ce33f0b1bed7bf17c4c20e2e6c0b71',1,'HP::HPTRIM::SDK']]],
['grm_5fmanyfileplansapproved',['grm_manyFilePlansApproved',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccac20e3ea82cc484da19a5757b26c3c2d0',1,'HP::HPTRIM::SDK']]],
['grm_5fmismatchedbrackets',['grm_mismatchedBrackets',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca062f998cc62f7a20ad97f11a552c0af6',1,'HP::HPTRIM::SDK']]],
['grm_5fmissingarchiveboxrty',['grm_missingArchiveBoxRty',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccad34c0ce948975cf5e0fab50e536eb2ca',1,'HP::HPTRIM::SDK']]],
['grm_5fmusthaveadminfptoberfp',['grm_MustHaveAdminFPToBeRFP',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca65fddfcc14f634a9c59295039acf73f1',1,'HP::HPTRIM::SDK']]],
['grm_5fmusthaveapprovefptobelm',['grm_mustHaveApproveFPToBeLM',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca69d05c508d60afccc0fe89f02e411d83',1,'HP::HPTRIM::SDK']]],
['grm_5fmusthavesamerentioncode',['grm_mustHaveSameRentionCode',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccaa9572ed7b91d2d2c0bfed18a4390ad38',1,'HP::HPTRIM::SDK']]],
['grm_5fnewfpmetatemplateblank',['grm_newFPMetaTemplateBlank',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca198b84e84d945bbc0f1acba7cb329496',1,'HP::HPTRIM::SDK']]],
['grm_5fnewfpnameblank',['grm_newFPNameBlank',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca86983e4f9ed9e181dcc1cae81526299d',1,'HP::HPTRIM::SDK']]],
['grm_5fnewfpnotwkg',['grm_newFPNotWkg',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca9f3f30c68c7d6bd0d083bcbabf4fbbf2',1,'HP::HPTRIM::SDK']]],
['grm_5fnewfpwkgblank',['grm_newFPWkgBlank',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca3bb26597db2e1baaffce948d15963f12',1,'HP::HPTRIM::SDK']]],
['grm_5fnodatatemplate',['grm_noDataTemplate',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccaf4272b73d2d3e72e3d9193d5d179a08d',1,'HP::HPTRIM::SDK']]],
['grm_5fnodefaultaccessrtyfound',['grm_noDefaultAccessRtyFound',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca18c54622ed9b0aa0e475938a35f4c28c',1,'HP::HPTRIM::SDK']]],
['grm_5fnofpstaggedforimport',['grm_noFPSTaggedforImport',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccabc2837dc9ee3a9f5cde517cff77d2532',1,'HP::HPTRIM::SDK']]],
['grm_5fnofpstaggedforrelocate',['grm_noFPSTaggedforRelocate',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca8801bbc3091ce59c656049499fca2ea2',1,'HP::HPTRIM::SDK']]],
['grm_5fnofpstoimport',['grm_noFPstoImport',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca7b3fff882ff0285aa6490e433e4d2835',1,'HP::HPTRIM::SDK']]],
['grm_5fnofptoimport',['grm_noFPtoImport',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca5a6144aac56221abe2a8080d045d575b',1,'HP::HPTRIM::SDK']]],
['grm_5fnofptorelocate',['grm_noFPtoRelocate',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccab910557b72761e1631249c9cc4737e6b',1,'HP::HPTRIM::SDK']]],
['grm_5fnorecstaggedforrelocate',['grm_noRecsTaggedforRelocate',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccaa1dd9b69efdfeeabf60781da625c5d44',1,'HP::HPTRIM::SDK']]],
['grm_5fnorecstorelocate',['grm_noRecsToRelocate',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca0059353f4c1d5377d305bb0bf3a5e22c',1,'HP::HPTRIM::SDK']]],
['grm_5fnoschedule',['grm_noSchedule',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca9611559a181a8b86d48ec004319ab46e',1,'HP::HPTRIM::SDK']]],
['grm_5fnotallowedtoapprove',['grm_notAllowedToApprove',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca867ab5e3842a761e2b90908bb8da452b',1,'HP::HPTRIM::SDK']]],
['grm_5fnotmemberofworkgroup',['grm_notMemberofWorkgroup',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca09d6dc6caea57b2be13f1d48f168131c',1,'HP::HPTRIM::SDK']]],
['grm_5fnoworkgroupforclassification',['grm_noWorkgroupForClassification',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca60007475e89e0092230a0307fbcb2360',1,'HP::HPTRIM::SDK']]],
['grm_5fonefileplanapproved',['grm_oneFilePlanApproved',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccaef5f171df9df20289de282c0cc56a53a',1,'HP::HPTRIM::SDK']]],
['grm_5fphysicalrtymismatcherror',['grm_physicalRTYMismatchError',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca36b398898f5e43340bc64fe81cc86285',1,'HP::HPTRIM::SDK']]],
['grm_5fprobinfileplanname',['grm_probInFileplanName',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccaa95101167c9eb891e1f729cba9cbb8b0',1,'HP::HPTRIM::SDK']]],
['grm_5frecordhasbadfileplan',['grm_recordHasBadFileplan',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccadaad3d35dfc6aee944d6ce903508ab90',1,'HP::HPTRIM::SDK']]],
['grm_5frecordhasbadworkgroup',['grm_recordHasBadWorkgroup',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca75232717bb924d33bd0125c4f2c8ec8a',1,'HP::HPTRIM::SDK']]],
['grm_5frelocatedfpnote',['grm_relocatedFPNote',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccaf45b3d6169df3daf28640238fd558beb',1,'HP::HPTRIM::SDK']]],
['grm_5frelocatefp',['grm_relocateFP',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca26481965b75badd4ababbf2aed462536',1,'HP::HPTRIM::SDK']]],
['grm_5frelocatefpscomplete',['grm_relocateFPsComplete',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccab08785aadd4a3c73ffa61e8ff8bff239',1,'HP::HPTRIM::SDK']]],
['grm_5frelocatefrom1fp',['grm_relocateFrom1FP',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccab952fd8254062f06933f4ed23949b954',1,'HP::HPTRIM::SDK']]],
['grm_5frelocateingrecsmsg',['grm_relocateingRecsMsg',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca95818cf5514706a798d90d7eb46f78fe',1,'HP::HPTRIM::SDK']]],
['grm_5frelocaterecmsg',['grm_relocateRecMsg',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccafe3331c5f9196e68868bc481b73e2ee1',1,'HP::HPTRIM::SDK']]],
['grm_5frelocaterecnote',['grm_relocateRecNote',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccaa29bd6710dc268eab7d2c4f61b970996',1,'HP::HPTRIM::SDK']]],
['grm_5frelocaterecordnotallowed',['grm_relocateRecordNotAllowed',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca30b0d15735472dc95d6c831d97424840',1,'HP::HPTRIM::SDK']]],
['grm_5frelocaterecscomplete',['grm_relocateRecsComplete',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca66d19c691ea7ad64c6e7a944981ffda6',1,'HP::HPTRIM::SDK']]],
['grm_5frelocationgfps',['grm_relocationgFPs',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca721af0cbe2c415b313ba55ebcfc785e9',1,'HP::HPTRIM::SDK']]],
['grm_5freportcompleted',['grm_reportCompleted',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccab861ac13b91656b1a877ff07d03f7e6d',1,'HP::HPTRIM::SDK']]],
['grm_5freviewernotperson',['grm_ReviewerNotPerson',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca5d4e0f242e1b735e6d878d4347027931',1,'HP::HPTRIM::SDK']]],
['grm_5frfpnotperson',['grm_RFPNotPerson',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca4a535d6aa35f7de10c783ed011d68717',1,'HP::HPTRIM::SDK']]],
['grm_5fupdatefp',['grm_updateFP',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccaaedb392a1e77def9b99936807c707320',1,'HP::HPTRIM::SDK']]],
['grm_5fupdatefpaclproblems',['grm_updateFPACLProblems',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca3ad63b650c244a093aa9c8951c096c87',1,'HP::HPTRIM::SDK']]],
['grm_5fupdatefps',['grm_updateFPs',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccaedf5013bc8e0d172b7c029ed018cc083',1,'HP::HPTRIM::SDK']]],
['grm_5fupdatefpsproblems',['grm_updateFPsProblems',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccaa03e81299baf59abc0c97196daf3026b',1,'HP::HPTRIM::SDK']]],
['grm_5fupdaterecacl',['grm_updateRecACL',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccad093aa22711c1192d71ab083975536e6',1,'HP::HPTRIM::SDK']]],
['grm_5fupdaterecs',['grm_updateRecs',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccaa263099b5ccdb6d08a76b9200c228102',1,'HP::HPTRIM::SDK']]],
['grm_5fupdatingrec',['grm_updatingRec',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccaa84ddbc50773d1af97c727cea9e54601',1,'HP::HPTRIM::SDK']]],
['grm_5fvalidateuserfields',['grm_validateUserFields',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca2fccda5af26c39cd6f3da7b2c1a845ed',1,'HP::HPTRIM::SDK']]],
['grm_5fvalidateuserfieldsmsg',['grm_validateUserFieldsMsg',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca566da4d15a8eab547a002b91f9ef8f5c',1,'HP::HPTRIM::SDK']]],
['grm_5fwkgnameblank',['grm_wkgNameBlank',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccae4a0531093a5df0d0e9f45561cabaf2f',1,'HP::HPTRIM::SDK']]],
['grm_5fwkgneedsuniquename',['grm_wkgNeedsUniqueName',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccadf03bdb5f5d3c273ebe0bdba0602318f',1,'HP::HPTRIM::SDK']]],
['grm_5fwkguniquenameblank',['grm_wkgUniqueNameBlank',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccac2b826102a533be401ffe2f00a2c3adc',1,'HP::HPTRIM::SDK']]],
['grm_5fworkgroupadmin',['grm_workgroupAdmin',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7cca751c2466fa79a6c148a3102de158fc2d',1,'HP::HPTRIM::SDK']]],
['grm_5fwrongsecclass',['grm_wrongSecClass',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccab043ba48d6c3b88f4d0e823984fb2900',1,'HP::HPTRIM::SDK']]],
['grm_5fyouarenotamember',['grm_youAreNotAMember',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a9de967b2ebe579684d69bd0e5853b7ccadfc607d045c237ed9cc3fb8011981016',1,'HP::HPTRIM::SDK']]],
['grmclosecompoundrecord',['GrmCloseCompoundRecord',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33afed850b89dbe587d16666e34b1e3c596',1,'HP::HPTRIM::SDK']]],
['grmdropzone',['GrmDropzone',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33a503f59b395c77f91fbc76a8ab031fa49',1,'HP.HPTRIM.SDK.GrmDropzone()'],['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#ac7ec4bac3ac3aef6c942b1f556b15865ad6bf5f800390567eff97f417b24f66cf',1,'HP.HPTRIM.SDK.GrmDropZone()']]],
['grmextractdocument',['GrmExtractDocument',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33afe01348a3a846da2dc879945e5a8fa5e',1,'HP::HPTRIM::SDK']]],
['grmimportshellrecordtype',['GrmImportShellRecordType',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33afc930809605fa1f1a95ca991776203d5',1,'HP::HPTRIM::SDK']]],
['grmmodworkgroupmembers',['GrmModWorkgroupMembers',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33a060f13546e8e005201233a30a7586a90',1,'HP::HPTRIM::SDK']]],
['grmnewcompoundrecord',['GrmNewCompoundRecord',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33a3bd1a723bfd5e15a2344324a4dc5959d',1,'HP::HPTRIM::SDK']]],
['grmnewshellrecordtype',['GrmNewShellRecordType',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33aad47dff14f8bc1a425c8e5e544b58298',1,'HP::HPTRIM::SDK']]],
['grmnewworkgroup',['GrmNewWorkgroup',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33ac4922f6f6aa92cc985ae88c1729858d9',1,'HP::HPTRIM::SDK']]],
['grmpendingapproval',['GrmPendingApproval',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33a1decf76e7c44809017a16a353ef70bc9',1,'HP::HPTRIM::SDK']]],
['grmpropertiestask',['GrmPropertiesTask',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33a4772bc6c89eb6c10bc436b4c3e1c8313',1,'HP::HPTRIM::SDK']]],
['grmselectworkgroup',['GrmSelectWorkgroup',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33ad98f63e68452a1070263c43e09579dd0',1,'HP::HPTRIM::SDK']]],
['grmshowglobalview',['GrmShowGlobalView',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a88829ac01c8adfd2c4f22183e9bf1d33ad5a1e601c7a0695f515d76297b84c731',1,'HP::HPTRIM::SDK']]],
['group',['Group',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a1048baf7c2cf703958815eb79c72ae87a03937134cedab9078be39a77ee3a48a0',1,'HP.HPTRIM.SDK.Group()'],['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#aa8a81e5bbcd47b5bd180500d46cea797a03937134cedab9078be39a77ee3a48a0',1,'HP.HPTRIM.SDK.Group()']]],
['groupmaintenance',['GroupMaintenance',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#a0657a2218a0b406bf2f0f44f85f9c909a8b4f2a240c24fc438afdf47e26df8d9c',1,'HP::HPTRIM::SDK']]],
['groupwisemailbox',['GroupwiseMailbox',['../namespace_h_p_1_1_h_p_t_r_i_m_1_1_s_d_k.html#aaefd03572732c56d38011c7876f1e1baafedb974c316230b2ae8cde60df6cf464',1,'HP::HPTRIM::SDK']]]
];
|
/**
* Created by jiachenpan on 16/11/18.
*/
export function isvalidUsername(str) {
const valid_map = ['admin', 'editor']
return valid_map.indexOf(str.trim()) >= 0
}
/* 合法uri*/
export function validateURL(textval) {
const urlregex = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
return urlregex.test(textval)
}
/* 小写字母*/
export function validateLowerCase(str) {
const reg = /^[a-z]+$/
return reg.test(str)
}
/* 大写字母*/
export function validateUpperCase(str) {
const reg = /^[A-Z]+$/
return reg.test(str)
}
/* 大小写字母*/
export function validatAlphabets(str) {
const reg = /^[A-Za-z]+$/
return reg.test(str)
}
/* 手机号码 */
export function validateMobile(str) {
const reg = /^(((13[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/
return reg.test(str)
}
export function validateCode(str) {
const reg = /^[\d]{6}$/i
return reg.test(str)
}
export function validateEmail(str) {
const reg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/
return reg.test(str)
}
/* 金额校验 */
export function validateAmount(str) {
const reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/
return reg.test(str)
}
/* 校验银行卡卡号 */
export function validateBankCard(bankno) {
if (bankno.length > 19 && bankno.length < 25) {
const reg = /.[0-9]{4}[0-9]{4}[0-9]{4}[0-9]{7}|.[0-9]{4}[0-9]{4}[0-9]{4}[0-9]{7}|.[0-9]{4}[0-9]{4}[0-9]{4}[0-9]{7}|.[0-9]{4}[0-9]{4}[0-9]{4}[0-9]{7}/
if (reg.test(bankno)) {
return true
} else {
return false
}
}
if (bankno.length < 16 || bankno.length > 19) {
return false
}
var num = /^\d*$/
if (!num.exec(bankno)) {
return false
}
/* 开头6位 */
var strBin = '10,18,30,35,37,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,58,60,62,65,68,69,84,87,88,94,95,98,99'
if (strBin.indexOf(bankno.substring(0, 2)) === -1) {
return false
}
var lastNum = bankno.substr(bankno.length - 1, 1) /* 取出最后一位(与luhm进行比较)*/
lastNum = parseInt(lastNum)
var first15Num = bankno.substr(0, bankno.length - 1) /* 前15或18位 */
var newArr = []
for (var i = first15Num.length - 1; i > -1; i--) { /* 前15或18位倒序存进数组 */
newArr.push(first15Num.substr(i, 1))
}
var arrJiShu = [] /* 奇数位*2的积 <9 */
var arrJiShu2 = [] /* 奇数位*2的积 >9 */
var arrOuShu = [] /* 偶数位数组 */
for (var j = 0; j < newArr.length; j++) {
if ((j + 1) % 2 === 1) { /* 奇数位 */
if (parseInt(newArr[j]) * 2 < 9) {
arrJiShu.push(parseInt(newArr[j]) * 2)
} else {
arrJiShu2.push(parseInt(newArr[j]) * 2)
}
} else { /* 偶数位 */
arrOuShu.push(newArr[j])
}
}
var jishu_child1 = [] /* 奇数位*2 >9 的分割之后的数组个位数 */
var jishu_child2 = [] /* 奇数位*2 >9 的分割之后的数组十位数 */
for (var h = 0; h < arrJiShu2.length; h++) {
jishu_child1.push(parseInt(arrJiShu2[h]) % 10)
jishu_child2.push(parseInt(arrJiShu2[h]) / 10)
}
var sumJiShu = 0 /* 奇数位*2 < 9 的数组之和 */
var sumOuShu = 0 /* 偶数位数组之和 */
var sumJiShuChild1 = 0 /* 奇数位*2 >9 的分割之后的数组个位数之和 */
var sumJiShuChild2 = 0 /* 奇数位*2 >9 的分割之后的数组十位数之和 */
var sumTotal = 0
for (var m = 0; m < arrJiShu.length; m++) {
sumJiShu = sumJiShu + parseInt(arrJiShu[m])
}
for (var n = 0; n < arrOuShu.length; n++) {
sumOuShu = sumOuShu + parseInt(arrOuShu[n])
}
for (var p = 0; p < jishu_child1.length; p++) {
sumJiShuChild1 = sumJiShuChild1 + parseInt(jishu_child1[p])
sumJiShuChild2 = sumJiShuChild2 + parseInt(jishu_child2[p])
}
/* 计算总和 */
sumTotal = parseInt(sumJiShu) + parseInt(sumOuShu) + parseInt(sumJiShuChild1) + parseInt(sumJiShuChild2)
/* 计算Luhm值 */
var k = parseInt(sumTotal) % 10 === 0 ? 10 : parseInt(sumTotal) % 10
var luhm = 10 - k
if (lastNum === luhm) {
return true
} else {
return false
}
}
/* 校验身法证号码 */
export function validateIdCard(idcard) {
var vcity = { 11: '北京', 12: '天津', 13: '河北', 14: '山西', 15: '内蒙古',
21: '辽宁', 22: '吉林', 23: '黑龙江', 31: '上海', 32: '江苏', 33: '浙江',
34: '安徽', 35: '福建', 36: '江西', 37: '山东', 41: '河南', 42: '湖北',
43: '湖南', 44: '广东', 45: '广西', 46: '海南', 50: '重庆', 51: '四川',
52: '贵州', 53: '云南', 54: '西藏', 61: '陕西', 62: '甘肃', 63: '青海',
64: '宁夏', 65: '新疆', 71: '台湾', 81: '香港', 82: '澳门', 91: '国外'
}
if (idcard === '' || idcard === 'undefined') {
return false
}
var reg = /(^\d{15}$)|(^\d{17}(\d|X)$)/
if (reg.test(idcard) === false) {
return false
}
var province = idcard.substr(0, 2)
if (vcity[province] === undefined) {
return false
}
var len = idcard.length
if (len === 15) {
var re_fifteen = /^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/
var arr_data = idcard.match(re_fifteen)
var year = arr_data[2]
var month = arr_data[3]
var day = arr_data[4]
var birthday = new Date('19' + year + '/' + month + '/' + day)
year = '19' + year
var now = new Date()
var now_year = now.getFullYear()
if (birthday.getFullYear() === year && (birthday.getMonth() + 1) === month && birthday.getDate() === day) {
var time = now_year - year
if (time < 3 && time > 100) {
return false
}
}
}
if (len === 18) {
var re_eighteen = /^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/
var arr_data1 = idcard.match(re_eighteen)
var year1 = arr_data1[2]
var month1 = arr_data1[3]
var day1 = arr_data1[4]
var birthday1 = new Date(year1 + '/' + month1 + '/' + day1)
var now1 = new Date()
var now_year1 = now1.getFullYear()
if (birthday1.getFullYear() === year1 && (birthday1.getMonth() + 1) === month1 && birthday1.getDate() === day1) {
var time1 = now_year1 - year1
if (time1 < 3 && time1 > 100) {
return false
}
}
}
var arrInt = []
var arrCh = []
var cardTemp = []
if (len === 15) {
arrInt = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
arrCh = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2']
cardTemp = 0
idcard = idcard.substr(0, 6) + '19' + idcard.substr(6, idcard.length - 6)
for (var i = 0; i < 17; i++) {
cardTemp += idcard.substr(i, 1) * arrInt[i]
}
idcard += arrCh[cardTemp % 11]
}
len = idcard.length
if (len === 18) {
arrInt = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
arrCh = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2']
var temp = 0
var valnum = 0
for (var j = 0; j < 17; j++) {
temp += parseInt(idcard.substr(j, 1)) * parseInt(arrInt[j])
}
valnum = arrCh[temp % 11]
if (valnum === idcard.substr(17, 1)) {
return true
}
return false
}
return false
}
|
var webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
module.exports = {
entry: {
'budget-tool': __dirname + '/lib/index.js',
'budget-tool.min': __dirname + '/lib/index.js'
},
output: {
filename: '[name].js',
path: __dirname + '/dist'
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/,
minimize: true,
compress: {
warnings: false
}
}),
new ExtractTextPlugin('budget-tool.css'),
new OptimizeCssAssetsPlugin({
assetNameRegExp: /\.min\.css$/,
cssProcessor: require('cssnano'),
cssProcessorOptions: { discardComments: { removeAll: true } }
})
],
module: {
rules: [
{
test: /\.js$/,
use: 'babel-loader',
exclude: ['/node_modules/', '/tests/']
},
{
test: /\.s?css$/,
use: ExtractTextPlugin.extract({ use: ['css-loader', 'sass-loader'] })
}
]
}
};
|
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
// Export all exports so that they're available in tests.
// We can't use export * from in Flow for some reason.
export {
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
createPortal,
createRoot,
hydrateRoot,
findDOMNode,
flushSync,
hydrate,
render,
unmountComponentAtNode,
unstable_batchedUpdates,
unstable_createEventHandle,
unstable_flushControlled,
unstable_isNewReconciler,
unstable_renderSubtreeIntoContainer,
unstable_runWithPriority, // DO NOT USE: Temporarily exposed to migrate off of Scheduler.runWithPriority.
unstable_scheduleHydration,
version,
} from './src/client/ReactDOM';
|
const modify = require('modifyjs')
/**
* ReactiveCollection is a reactive collection. Each updates
* made on its content triggers a notification.
* Notifications are sent through a subscription mecanism.
*
* @class ReactiveCollection
*/
class ReactiveCollection {
constructor (name) {
this._name = name
this._content = []
this._watchers = new Map()
this._lastId = 0
this._changesToNotify = []
}
/**
* When one or many documents of the collection is created, updated or removed `callback` will be called with `watcher` as its `this`.
* **NOTE:** A collection can have many watchers. A watcher can subscribe to many collection. A watcher can subscribe only once to a collection (only the latest subscription will be retain).
*
* @param {Object} watcher
* @param {Function} callback
* @memberof ReactiveCollection
*
* @example
* collection.subscribe(this, changes => {
* console.log(`${changes.length} documents have been created, updated or removed.`)
*
* changes.forEach(change => {
* console.log(`[${change.collection}] The document _id "${change._id}" is marked with operation type "${change.operationType}".`) // [superheroes] The document _id "1" is marked with operation type "insert".
* if (change.fullDocument !== undefined) {
* // fullDocument only for "insert" or "update" operationType.
* console.log(`New content: ${change.fullDocument}`)
* }
* })
* })
*/
subscribe (watcher, callback) {
if (watcher && callback) {
this._watchers.set(watcher, callback)
} else {
throw new Error('No watcher or callback has been specified')
}
}
/**
* Remove `watcher` fore the collections watchers.
*
* @param {Any} watcher
* @memberof ReactiveCollection
*/
unsubscribe (watcher) {
if (this._watchers.has(watcher)) {
this._watchers.delete(watcher)
} else {
throw new Error('No watcher has been specified')
}
}
/**
* Returns a promise that resolves to the number of documents inside the collection.
*
* @returns Promise<Number>
* @memberof ReactiveCollection
*/
count () {
return Promise.resolve(this._content.length)
}
/**
* Insert one or many documents in the collection.
* Use the same syntax as `collection.insertOne()` or `collection.insertMany()`.
* Once done, the promise is resolve.
*
* @param {(Object|Object[])} data
* @returns Promise
* @memberof ReactiveCollection
*/
insert (data) {
return new Promise((resolve, reject) => {
if (typeof data !== 'object') { // array is typeof 'object' !
return reject(new Error('"data" is not of type object or array'))
}
if (!Array.isArray(data)) {
data = [data]
}
let badId = null
data.forEach(obj => {
if (obj._id === undefined) {
obj._id = this._objectId()
} else if (this._content.findIndex(el => obj._id === el._id) >= 0) {
badId = obj._id
}
})
if (badId !== null) {
return reject(new Error(`An object with _id ${badId} already exist in this collection`))
}
this._content = [...this._content, ...data]
this._notifyChangesForIds(data.map(el => el._id), 'insert')
return resolve()
})
}
/**
* Insert one document in the collection. Once done, the promise is resolve.
*
* @param {Object} data
* @returns Promise
* @memberof ReactiveCollection
* @example
* collection.insertOne({
* firstname: 'Peter',
* lastname: 'PARKER',
* age: 25,
* hasSuperPower: true
* })
*/
insertOne (data) {
if (typeof data !== 'object') { // array is typeof 'object' !
return Promise.reject(new Error('"data" is not of type object'))
} else if (Array.isArray(data)) {
return Promise.reject(new Error('"data" can\'t be an array'))
}
return this.insert(data)
}
/**
* Insert many documents in the collection. Once done, the promise is resolve.
*
* @param {Object[]} data
* @returns Promise
* @memberof ReactiveCollection
* @example
* collection.insertMany([
* {
* firstname: 'Tony',
* lastname: 'STARK',
* hasSuperPower: false
* },
* {
* firstname: 'Bruce',
* lastname: 'BANNER',
* hasSuperPower: true
* }
* ])
*/
insertMany (data) {
return new Promise((resolve, reject) => {
if (!Array.isArray(data)) {
return reject(new Error('"data" must be an array'))
}
this.insert(data).then(resolve).catch(reject)
})
}
/**
* Find all documents matching a query.
* Query can use some of MongoDB query operations :
* `$lte`, `$lt`, `$gte`, `$gt`, `$ne` and `$exists`.
*
* @param {Object} [query={}]
* @param {Object} [projection=undefined]
* @param {Object} [options=undefined]
* @returns Promise<Object[]>
* @memberof ReactiveCollection
* @example
* // find all documents
* collection.find()
*
* // find all documents for Tony STARK
* collection.find({ firstname: 'Tony', lastname: 'STARK' })
*
* // find all firstnames, in descending order. Results limited to 2nd - 11th
* collection.find({}, { _id: 0, firstname}, { sort: { firstname: -1 }, limit: 10, skip: 1 })
*/
find (query = {}, projection = undefined, options = undefined) {
if (typeof query !== 'object' && !Array.isArray(query)) {
return Promise.reject(new Error('"query" must be an object'))
}
options = options || {}
return Promise.resolve(this._content.filter(el => {
return this._elementIsValidForQuery(el, query)
}))
.then(results => {
const keys = Object.keys(options.sort || {})
if (keys.length === 0) {
return results
}
results = results.sort((a, b) => {
return this._orderByManyProperties(a, b, options.sort, keys, 0)
})
return results
})
.then(results => options.skip > 0 ? results.splice(options.skip) : results)
.then(results => options.limit > 0 ? results.splice(0, options.limit) : results)
.then(results => {
if (projection) {
const projectionKeys = Object.keys(projection)
return results.map(el => {
const retVal = {
_id: el._id,
...projectionKeys.reduce((final, current) => {
if (projection[current]) {
final[current] = el[current]
}
return final
}, {})
}
if (Object.prototype.hasOwnProperty.call(projection, '_id')) {
if (!projection._id) {
delete retVal._id
}
}
return retVal
})
} else {
return results
}
})
}
/**
* Same as `collection.find()` but the promise resolve to
* the first document matching the `query`
* with the specified `projection` and `options`.
*
* @param {Object} [query={}]
* @param {Object} [projection=undefined]
* @param {Object} [options=undefined]
* @returns Promise<Object[]>
* @memberof ReactiveCollection
*/
findOne (query = {}, projection = undefined, options = undefined) {
return this.find(query, projection, { ...options, limit: 1 })
.then(results => {
return results[0]
})
}
/**
* Find all documents matching a query and modify their content.
*
* @param {Object} query Specifies selection filter using query operator
* @param {Object} replace Specifies the modifications to apply.
* Can be a document or a set of of update operators.
* See [modifyjs](https://github.com/lgandecki/modifyjs) for more infos.
* @param {Object} [options=undefined] Optional. `limit`, `sort`, `skip` will be applied to search documents.
* If the `upsert` option is used, create the document if no match is found.
* @returns Promise
* @memberof ReactiveCollection
* @example
* // Modify all documents containing {hasSuperPower: true}, to add a property "isLuckyGuy" set to "true"
* collection.update({
* hasSuperPower: false
* }, {
* $set: {
* isLuckyGuy: true
* }
* })
*
* // If no Bruce BANNER, create a document containing :
* // { firstname: 'Bruce', lastname: 'BANNER', hasSuperPower: true }
* collection.update({
* firstname: 'Bruce',
* lastname: 'BANNER',
* }, {
* hasSuperPower: true
* }, {
* upsert: true
* })
*/
update (query, replace, options = undefined) {
return new Promise((resolve, reject) => {
if (typeof replace !== 'object' && !Array.isArray(replace)) {
return reject(new Error('"query" must be an object'))
}
options = options || {}
this.find(query, undefined, options)
.then(results => {
if (results.length === 0) {
if (options.upsert) {
return this.insertOne(modify(query, replace))
}
return resolve()
} else {
results.forEach((result, idx) => {
// Get modified result
const modified = modify(result, replace)
// then apply modifications to reference object
// (delete old properties then add new ones)
Object.keys(result).forEach(key => {
if (key !== '_id') { // Keep _id
delete result[key]
}
})
Object.keys(modified).forEach(key => {
if (key !== '_id') { // Keep _id
result[key] = modified[key]
}
})
})
}
this._notifyChangesForIds(results.map(el => el._id), 'update')
})
.then(() => {
return resolve()
})
})
}
/**
* Same as `collection.update()` but only the first matching document will be updated.
*
* @param {Object} query Specifies selection filter using query operator
* @param {Object} replace Specifies the modifications to apply.
* Can be a document or a set of of update operators.
* See [modifyjs](https://github.com/lgandecki/modifyjs) for more infos.
* @param {Object} [options=undefined] Optional. `limit`, `sort`, `skip` will be applied to search documents.
* If the `upsert` option is used, create the document if no match is found.
* @returns Promise
* @memberof ReactiveCollection
*/
updateOne (query, replace, options = undefined) {
return this.update(query, replace, { ...options, limit: 1 })
}
/**
* Same as `collection.update()`
*
* @param {Object} [query={}] Specifies selection filter using query operator
* @param {Object} replace Specifies the modifications to apply.
* Can be a document or a set of of update operators.
* See [modifyjs](https://github.com/lgandecki/modifyjs) for more infos.
* @param {Object} [options=undefined] Optional. `limit`, `sort`, `skip` will be applied to search documents.
* If the `upsert` option is used, create the document if no match is found.
* @returns Promise
* @memberof ReactiveCollection
*/
updateMany (query, replace, options = undefined) {
return this.update(query, replace, options)
}
/**
* Remove each documents matching `query`.
*
* @param {Object} [query={}] Specifies selection filter using query operator.
* @param {Object} [options={}] Optional. Use `{justOne: true}` to remove just one document.
* @returns Promise
* @memberof ReactiveCollection
*/
remove (query = {}, options = {}) {
return this.find(query, undefined, options.justOne ? { limit: 1 } : undefined)
.then(results => {
const ids = []
results.forEach(result => {
const index = this._content.findIndex(el => el._id === result._id)
if (index >= 0) {
ids.push(result._id)
this._content.splice(index, 1)
}
})
this._notifyChangesForIds(ids, 'remove')
})
}
/**
* This method generate a unique id (in the current collection) for the document.
*
* @returns String
* @memberof ReactiveCollection
*/
_objectId () {
return `${this._lastId++}`
}
/**
*
*
* @param {String[]} ids
* @param {String} operationType
* @memberof ReactiveCollection
*/
_notifyChangesForIds (ids, operationType) {
if (this._notifyTimeout) {
clearTimeout(this._notifyTimeout)
this._notifyTimeout = null
}
const data = ids.reduce((final, current) => {
const updated = this._content.find(el => (el || {})._id === current)
if (updated) {
final.push({
collection: this._name,
_id: current,
operationType,
fullDocument: updated
})
} else {
final.push({
collection: this._name,
_id: current,
operationType
})
}
return final
}, [])
this._changesToNotify = [
...this._changesToNotify.filter(el => ids.indexOf(el._id) < 0),
...data
]
this._notifyTimeout = setTimeout(() => {
this._watchers.forEach((callback, watcher) => {
callback.call(watcher, this._changesToNotify)
})
this._changesToNotify = []
}, 200)
}
_elementIsValidForQuery (elementToTest, query) {
// Instead of verifying that every element is matching,
// we search if one is not matching
const queryDoNotMatch = Object.keys(query).some(attribute => {
const currentSubQuery = query[attribute]
// Do not match if currentSubQuery isn't null
// and current element to test hasn't the searched property
if (currentSubQuery && !Object.prototype.hasOwnProperty.call(elementToTest, attribute)) {
return true
}
if (currentSubQuery && typeof currentSubQuery === 'object') {
// Instead of verifying that every element is matching,
// we search if one is not matching
const subQueryDoNotMatch = Object.keys(currentSubQuery).some(subAttribute => {
switch (subAttribute) {
case '$lte':
return elementToTest[attribute] > currentSubQuery[subAttribute]
case '$lt':
return elementToTest[attribute] >= currentSubQuery[subAttribute]
case '$gte':
return elementToTest[attribute] < currentSubQuery[subAttribute]
case '$gt':
return elementToTest[attribute] <= currentSubQuery[subAttribute]
case '$ne':
return elementToTest[attribute] === currentSubQuery[subAttribute]
case '$eq':
return elementToTest[attribute] !== currentSubQuery[subAttribute]
case '$in':
return currentSubQuery[subAttribute].indexOf(elementToTest[attribute]) < 0
case '$nin':
return currentSubQuery[subAttribute].indexOf(elementToTest[attribute]) >= 0
case '$exists':
if (currentSubQuery[subAttribute]) {
return elementToTest[attribute] === undefined
} else {
return elementToTest[attribute] !== undefined
}
default:
return !this._elementIsValidForQuery(elementToTest[attribute], currentSubQuery)
}
})
return subQueryDoNotMatch
}
return elementToTest[attribute] !== currentSubQuery
})
return !queryDoNotMatch
}
_orderByManyProperties (a, b, sort, keys, keyIndex) {
const currentKey = keys[keyIndex]
if (a[currentKey] > b[currentKey]) {
return sort[currentKey] > 0 ? 1 : -1
} else if (a[currentKey] < b[currentKey]) {
return sort[currentKey] < 0 ? 1 : -1
} else if (keyIndex >= keys.length) {
return 0
} else {
return this._orderByManyProperties(a, b, sort, keys, keyIndex + 1)
}
}
}
module.exports = ReactiveCollection
|
import React from 'react'
import styled from 'styled-components'
import { space, color } from 'styled-system'
const Icon = ({
size,
...props
}) => (
<svg
{...props}
viewBox='0 0 24 24'
width={size}
height={size}
fill='currentcolor'
>
<path d='M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z' />
</svg>
)
const NotificationsIcon = styled(Icon)([], space, color)
NotificationsIcon.displayName = 'NotificationsIcon'
NotificationsIcon.defaultProps = {
size: 24
}
export default NotificationsIcon
|
/*! jQuery v1.11.2 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.2",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b=a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=hb(),z=hb(),A=hb(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),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("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},eb=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fb){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function gb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+rb(o[l]);w=ab.test(a)&&pb(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function hb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ib(a){return a[u]=!0,a}function jb(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function kb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function lb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function nb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function ob(a){return ib(function(b){return b=+b,ib(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pb(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=gb.support={},f=gb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=gb.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",eb,!1):e.attachEvent&&e.attachEvent("onunload",eb)),p=!f(g),c.attributes=jb(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=jb(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=jb(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(jb(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),jb(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&jb(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return lb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?lb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},gb.matches=function(a,b){return gb(a,null,null,b)},gb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return gb(b,n,null,[a]).length>0},gb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},gb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},gb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},gb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=gb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=gb.selectors={cacheLength:50,createPseudo:ib,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||gb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&gb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=gb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||gb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ib(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ib(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ib(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ib(function(a){return function(b){return gb(a,b).length>0}}),contains:ib(function(a){return a=a.replace(cb,db),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ib(function(a){return W.test(a||"")||gb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:ob(function(){return[0]}),last:ob(function(a,b){return[b-1]}),eq:ob(function(a,b,c){return[0>c?c+b:c]}),even:ob(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:ob(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:ob(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:ob(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=mb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=nb(b);function qb(){}qb.prototype=d.filters=d.pseudos,d.setFilters=new qb,g=gb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?gb.error(a):z(a,i).slice(0)};function rb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function tb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ub(a,b,c){for(var d=0,e=b.length;e>d;d++)gb(a,b[d],c);return c}function vb(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wb(a,b,c,d,e,f){return d&&!d[u]&&(d=wb(d)),e&&!e[u]&&(e=wb(e,f)),ib(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ub(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:vb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=vb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=vb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sb(function(a){return a===b},h,!0),l=sb(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sb(tb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wb(i>1&&tb(m),i>1&&rb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xb(a.slice(i,e)),f>e&&xb(a=a.slice(e)),f>e&&rb(a))}m.push(c)}return tb(m)}function yb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=vb(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&gb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ib(f):f}return h=gb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,yb(e,d)),f.selector=a}return f},i=gb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&pb(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&rb(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&pb(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=jb(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),jb(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||kb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&jb(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||kb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),jb(function(a){return null==a.getAttribute("disabled")})||kb(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),gb}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;
return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==cb()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===cb()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ab:bb):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:bb,isPropagationStopped:bb,isImmediatePropagationStopped:bb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ab,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ab,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ab,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=bb;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=bb),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function db(a){var b=eb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var eb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fb=/ jQuery\d+="(?:null|\d+)"/g,gb=new RegExp("<(?:"+eb+")[\\s/>]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/<tbody/i,lb=/<|&#?\w+;/,mb=/<(?:script|style|link)/i,nb=/checked\s*(?:[^=]|=\s*.checked.)/i,ob=/^$|\/(?:java|ecma)script/i,pb=/^true\/(.*)/,qb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,rb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?"<table>"!==l[1]||kb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ub(p,"input"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),"script"),g&&zb(h),c)){e=0;while(f=h[e++])ob.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ub(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ub(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&nb.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ub(i,"script"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qb,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Cb,Db={};function Eb(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),"none"!==c&&c||(Cb=(Cb||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Cb[0].contentWindow||Cb[0].contentDocument).document,b.write(),b.close(),c=Eb(a,b),Cb.detach()),Db[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Gb=/^margin/,Hb=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ib,Jb,Kb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ib=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Hb.test(g)&&Gb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ib=function(a){return a.currentStyle},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Hb.test(g)&&!Kb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Lb(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight),b.removeChild(i)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Mb=/alpha\([^)]*\)/i,Nb=/opacity\s*=\s*([^)]*)/,Ob=/^(none|table(?!-c[ea]).+)/,Pb=new RegExp("^("+S+")(.*)$","i"),Qb=new RegExp("^([+-])=("+S+")","i"),Rb={position:"absolute",visibility:"hidden",display:"block"},Sb={letterSpacing:"0",fontWeight:"400"},Tb=["Webkit","O","Moz","ms"];function Ub(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Tb.length;while(e--)if(b=Tb[e]+c,b in a)return b;return d}function Vb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fb(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wb(a,b,c){var d=Pb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Yb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ib(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Jb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Hb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xb(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Jb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ub(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ub(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Jb(a,b,d)),"normal"===f&&b in Sb&&(f=Sb[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Ob.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Rb,function(){return Yb(a,b,d)}):Yb(a,b,d):void 0},set:function(a,c,d){var e=d&&Ib(a);return Wb(a,c,d?Xb(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Nb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Mb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Mb.test(f)?f.replace(Mb,e):f+" "+e)}}),m.cssHooks.marginRight=Lb(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Jb,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Gb.test(a)||(m.cssHooks[a+b].set=Wb)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ib(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Vb(this,!0)},hide:function(){return Vb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Zb(a,b,c,d,e){return new Zb.prototype.init(a,b,c,d,e)
}m.Tween=Zb,Zb.prototype={constructor:Zb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")},cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this):Zb.propHooks._default.get(this)},run:function(a){var b,c=Zb.propHooks[this.prop];return this.pos=b=this.options.duration?m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Zb.propHooks._default.set(this),this}},Zb.prototype.init.prototype=Zb.prototype,Zb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Zb.propHooks.scrollTop=Zb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Zb.prototype.init,m.fx.step={};var $b,_b,ac=/^(?:toggle|show|hide)$/,bc=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cc=/queueHooks$/,dc=[ic],ec={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bc.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bc.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fc(){return setTimeout(function(){$b=void 0}),$b=m.now()}function gc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hc(a,b,c){for(var d,e=(ec[b]||[]).concat(ec["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ic(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fb(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fb(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ac.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fb(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hc(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jc(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kc(a,b,c){var d,e,f=0,g=dc.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$b||fc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$b||fc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jc(k,j.opts.specialEasing);g>f;f++)if(d=dc[f].call(j,a,k,j.opts))return d;return m.map(k,hc,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kc,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],ec[c]=ec[c]||[],ec[c].unshift(b)},prefilter:function(a,b){b?dc.unshift(a):dc.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kc(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cc.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gc(b,!0),a,d,e)}}),m.each({slideDown:gc("show"),slideUp:gc("hide"),slideToggle:gc("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($b=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$b=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_b||(_b=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_b),_b=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lc=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lc,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mc,nc,oc=m.expr.attrHandle,pc=/^(?:checked|selected)$/i,qc=k.getSetAttribute,rc=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nc:mc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rc&&qc||!pc.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qc?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nc={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rc&&qc||!pc.test(c)?a.setAttribute(!qc&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=oc[b]||m.find.attr;oc[b]=rc&&qc||!pc.test(b)?function(a,b,d){var e,f;return d||(f=oc[b],oc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,oc[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rc&&qc||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mc&&mc.set(a,b,c)}}),qc||(mc={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},oc.id=oc.name=oc.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mc.set},m.attrHooks.contenteditable={set:function(a,b,c){mc.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sc=/^(?:input|select|textarea|button|object)$/i,tc=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sc.test(a.nodeName)||tc.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var uc=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(uc," ").indexOf(b)>=0)return!0;return!1}}),m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vc=m.now(),wc=/\?/,xc=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xc,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yc,zc,Ac=/#.*$/,Bc=/([?&])_=[^&]*/,Cc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Dc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ec=/^(?:GET|HEAD)$/,Fc=/^\/\//,Gc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hc={},Ic={},Jc="*/".concat("*");try{zc=location.href}catch(Kc){zc=y.createElement("a"),zc.href="",zc=zc.href}yc=Gc.exec(zc.toLowerCase())||[];function Lc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mc(a,b,c,d){var e={},f=a===Ic;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nc(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Oc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zc,type:"GET",isLocal:Dc.test(yc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nc(Nc(a,m.ajaxSettings),b):Nc(m.ajaxSettings,a)},ajaxPrefilter:Lc(Hc),ajaxTransport:Lc(Ic),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cc.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zc)+"").replace(Ac,"").replace(Fc,yc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yc[1]&&c[2]===yc[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yc[3]||("http:"===yc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mc(Hc,k,b,v),2===t)return v;h=m.event&&k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Ec.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wc.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bc.test(e)?e.replace(Bc,"$1_="+vc++):e+(wc.test(e)?"&":"?")+"_="+vc++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jc+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mc(Ic,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Oc(k,v,c)),u=Pc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qc=/%20/g,Rc=/\[\]$/,Sc=/\r?\n/g,Tc=/^(?:submit|button|image|reset|file)$/i,Uc=/^(?:input|select|textarea|keygen)/i;function Vc(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rc.test(a)?d(a,e):Vc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vc(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vc(c,a[c],b,e);return d.join("&").replace(Qc,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Uc.test(this.nodeName)&&!Tc.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sc,"\r\n")}}):{name:b.name,value:c.replace(Sc,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zc()||$c()}:Zc;var Wc=0,Xc={},Yc=m.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Xc)Xc[a](void 0,!0)}),k.cors=!!Yc&&"withCredentials"in Yc,Yc=k.ajax=!!Yc,Yc&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xc[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zc(){try{return new a.XMLHttpRequest}catch(b){}}function $c(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _c=[],ad=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_c.pop()||m.expando+"_"+vc++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ad.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ad.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ad,"$1"+e):b.jsonp!==!1&&(b.url+=(wc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_c.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bd=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bd)return bd.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cd=a.document.documentElement;function dd(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dd(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cd;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cd})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dd(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=Lb(k.pixelPosition,function(a,c){return c?(c=Jb(a,b),Hb.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ed=a.jQuery,fd=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fd),b&&a.jQuery===m&&(a.jQuery=ed),m},typeof b===K&&(a.jQuery=a.$=m),m});/*! jQuery UI - v1.11.2 - 2014-12-21
* 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(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){function t(t,s){var n,a,o,r=t.nodeName.toLowerCase();return"area"===r?(n=t.parentNode,a=n.name,t.href&&a&&"map"===n.nodeName.toLowerCase()?(o=e("img[usemap='#"+a+"']")[0],!!o&&i(o)):!1):(/input|select|textarea|button|object/.test(r)?!t.disabled:"a"===r?t.href||s:s)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}function s(e){for(var t,i;e.length&&e[0]!==document;){if(t=e.css("position"),("absolute"===t||"relative"===t||"fixed"===t)&&(i=parseInt(e.css("zIndex"),10),!isNaN(i)&&0!==i))return i;e=e.parent()}return 0}function n(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[""]),this.regional.en=e.extend(!0,{},this.regional[""]),this.regional["en-US"]=e.extend(!0,{},this.regional.en),this.dpDiv=a(e("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function a(t){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(i,"mouseout",function(){e(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",o)}function o(){e.datepicker._isDisabledDatepicker(v.inline?v.dpDiv.parent()[0]:v.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover"))}function r(t,i){e.extend(t,i);for(var s in i)null==i[s]&&(t[s]=i[s]);return t}function h(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.2",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}}),e.fn.extend({scrollParent:function(t){var i=this.css("position"),s="absolute"===i,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,a=this.parents().filter(function(){var t=e(this);return s&&"static"===t.css("position")?!1:n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==i&&a.length?a:e(this[0].ownerDocument||document)},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(i){return t(i,!isNaN(e.attr(i,"tabindex")))},tabbable:function(i){var s=e.attr(i,"tabindex"),n=isNaN(s);return(n||s>=0)&&t(i,!n)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(t,i){function s(t,i,s,a){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],a=i.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(t){return void 0===t?o["inner"+i].call(this):this.each(function(){e(this).css(a,s(this,t)+"px")})},e.fn["outer"+i]=function(t,n){return"number"!=typeof t?o["outer"+i].call(this,t):this.each(function(){e(this).css(a,s(this,t,!0,n)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var i,s,n=e(this[0]);n.length&&n[0]!==document;){if(i=n.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(s=parseInt(n.css("zIndex"),10),!isNaN(s)&&0!==s))return s;n=n.parent()}return 0}}),e.ui.plugin={add:function(t,i,s){var n,a=e.ui[t].prototype;for(n in s)a.plugins[n]=a.plugins[n]||[],a.plugins[n].push([i,s[n]])},call:function(e,t,i,s){var n,a=e.plugins[t];if(a&&(s||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(n=0;a.length>n;n++)e.options[a[n][0]]&&a[n][1].apply(e.element,i)}};var l=0,u=Array.prototype.slice;e.cleanData=function(t){return function(i){var s,n,a;for(a=0;null!=(n=i[a]);a++)try{s=e._data(n,"events"),s&&s.remove&&e(n).triggerHandler("remove")}catch(o){}t(i)}}(e.cleanData),e.widget=function(t,i,s){var n,a,o,r,h={},l=t.split(".")[0];return t=t.split(".")[1],n=l+"-"+t,s||(s=i,i=e.Widget),e.expr[":"][n.toLowerCase()]=function(t){return!!e.data(t,n)},e[l]=e[l]||{},a=e[l][t],o=e[l][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new o(e,t)},e.extend(o,a,{version:s.version,_proto:e.extend({},s),_childConstructors:[]}),r=new i,r.options=e.widget.extend({},r.options),e.each(s,function(t,s){return e.isFunction(s)?(h[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},n=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,a=this._superApply;return this._super=e,this._superApply=n,t=s.apply(this,arguments),this._super=i,this._superApply=a,t}}(),void 0):(h[t]=s,void 0)}),o.prototype=e.widget.extend(r,{widgetEventPrefix:a?r.widgetEventPrefix||t:t},h,{constructor:o,namespace:l,widgetName:t,widgetFullName:n}),a?(e.each(a._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete a._childConstructors):i._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var i,s,n=u.call(arguments,1),a=0,o=n.length;o>a;a++)for(i in n[a])s=n[a][i],n[a].hasOwnProperty(i)&&void 0!==s&&(t[i]=e.isPlainObject(s)?e.isPlainObject(t[i])?e.widget.extend({},t[i],s):e.widget.extend({},s):s);return t},e.widget.bridge=function(t,i){var s=i.prototype.widgetFullName||t;e.fn[t]=function(n){var a="string"==typeof n,o=u.call(arguments,1),r=this;return n=!a&&o.length?e.widget.extend.apply(null,[n].concat(o)):n,a?this.each(function(){var i,a=e.data(this,s);return"instance"===n?(r=a,!1):a?e.isFunction(a[n])&&"_"!==n.charAt(0)?(i=a[n].apply(a,o),i!==a&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0):e.error("no such method '"+n+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; "+"attempted to call method '"+n+"'")}):this.each(function(){var t=e.data(this,s);t?(t.option(n||{}),t._init&&t._init()):e.data(this,s,new i(n,this))}),r}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=l++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,i){var s,n,a,o=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(o={},s=t.split("."),t=s.shift(),s.length){for(n=o[t]=e.widget.extend({},this.options[t]),a=0;s.length-1>a;a++)n[s[a]]=n[s[a]]||{},n=n[s[a]];if(t=s.pop(),1===arguments.length)return void 0===n[t]?null:n[t];n[t]=i}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=i}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,i,s){var n,a=this;"boolean"!=typeof t&&(s=i,i=t,t=!1),s?(i=n=e(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),e.each(s,function(s,o){function r(){return t||a.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?a[o]:o).apply(a,arguments):void 0}"string"!=typeof o&&(r.guid=o.guid=o.guid||r.guid||e.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+a.eventNamespace,u=h[2];u?n.delegate(u,l,r):i.bind(l,r)})},_off:function(t,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(i).undelegate(i),this.bindings=e(this.bindings.not(t).get()),this.focusable=e(this.focusable.not(t).get()),this.hoverable=e(this.hoverable.not(t).get())},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,o=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(o)&&o.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var o,r=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),o=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),o&&e.effects&&e.effects.effect[r]?s[t](n):r!==t&&s[r]?s[r](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i()})}}),e.widget;var d=!1;e(document).mouseup(function(){d=!1}),e.widget("ui.mouse",{version:"1.11.2",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!d){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var i=this,s=1===t.which,n="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return i._mouseMove(e)},this._mouseUpDelegate=function(e){return i._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),d=!0,!0)):!0}},_mouseMove:function(t){if(this._mouseMoved){if(e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button)return this._mouseUp(t);if(!t.which)return this._mouseUp(t)}return(t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),d=!1,!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),function(){function t(e,t,i){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?i/100:1)]}function i(t,i){return parseInt(e.css(t,i),10)||0}function s(t){var i=t[0];return 9===i.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(i)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var n,a,o=Math.max,r=Math.abs,h=Math.round,l=/left|center|right/,u=/top|center|bottom/,d=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,p=/%$/,f=e.fn.position;e.position={scrollbarWidth:function(){if(void 0!==n)return n;var t,i,s=e("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),a=s.children()[0];return e("body").append(s),t=a.offsetWidth,s.css("overflow","scroll"),i=a.offsetWidth,t===i&&(i=s[0].clientWidth),s.remove(),n=t-i},getScrollInfo:function(t){var i=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),s=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),n="scroll"===i||"auto"===i&&t.width<t.element[0].scrollWidth,a="scroll"===s||"auto"===s&&t.height<t.element[0].scrollHeight;return{width:a?e.position.scrollbarWidth():0,height:n?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var i=e(t||window),s=e.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType;return{element:i,isWindow:s,isDocument:n,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:s||n?i.width():i.outerWidth(),height:s||n?i.height():i.outerHeight()}}},e.fn.position=function(n){if(!n||!n.of)return f.apply(this,arguments);n=e.extend({},n);var p,m,g,v,y,b,_=e(n.of),x=e.position.getWithinInfo(n.within),w=e.position.getScrollInfo(x),k=(n.collision||"flip").split(" "),T={};return b=s(_),_[0].preventDefault&&(n.at="left top"),m=b.width,g=b.height,v=b.offset,y=e.extend({},v),e.each(["my","at"],function(){var e,t,i=(n[this]||"").split(" ");1===i.length&&(i=l.test(i[0])?i.concat(["center"]):u.test(i[0])?["center"].concat(i):["center","center"]),i[0]=l.test(i[0])?i[0]:"center",i[1]=u.test(i[1])?i[1]:"center",e=d.exec(i[0]),t=d.exec(i[1]),T[this]=[e?e[0]:0,t?t[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===k.length&&(k[1]=k[0]),"right"===n.at[0]?y.left+=m:"center"===n.at[0]&&(y.left+=m/2),"bottom"===n.at[1]?y.top+=g:"center"===n.at[1]&&(y.top+=g/2),p=t(T.at,m,g),y.left+=p[0],y.top+=p[1],this.each(function(){var s,l,u=e(this),d=u.outerWidth(),c=u.outerHeight(),f=i(this,"marginLeft"),b=i(this,"marginTop"),D=d+f+i(this,"marginRight")+w.width,S=c+b+i(this,"marginBottom")+w.height,M=e.extend({},y),C=t(T.my,u.outerWidth(),u.outerHeight());"right"===n.my[0]?M.left-=d:"center"===n.my[0]&&(M.left-=d/2),"bottom"===n.my[1]?M.top-=c:"center"===n.my[1]&&(M.top-=c/2),M.left+=C[0],M.top+=C[1],a||(M.left=h(M.left),M.top=h(M.top)),s={marginLeft:f,marginTop:b},e.each(["left","top"],function(t,i){e.ui.position[k[t]]&&e.ui.position[k[t]][i](M,{targetWidth:m,targetHeight:g,elemWidth:d,elemHeight:c,collisionPosition:s,collisionWidth:D,collisionHeight:S,offset:[p[0]+C[0],p[1]+C[1]],my:n.my,at:n.at,within:x,elem:u})}),n.using&&(l=function(e){var t=v.left-M.left,i=t+m-d,s=v.top-M.top,a=s+g-c,h={target:{element:_,left:v.left,top:v.top,width:m,height:g},element:{element:u,left:M.left,top:M.top,width:d,height:c},horizontal:0>i?"left":t>0?"right":"center",vertical:0>a?"top":s>0?"bottom":"middle"};d>m&&m>r(t+i)&&(h.horizontal="center"),c>g&&g>r(s+a)&&(h.vertical="middle"),h.important=o(r(t),r(i))>o(r(s),r(a))?"horizontal":"vertical",n.using.call(this,e,h)}),u.offset(e.extend(M,{using:l}))})},e.ui.position={fit:{left:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=e.left-t.collisionPosition.marginLeft,h=n-r,l=r+t.collisionWidth-a-n;t.collisionWidth>a?h>0&&0>=l?(i=e.left+h+t.collisionWidth-a-n,e.left+=h-i):e.left=l>0&&0>=h?n:h>l?n+a-t.collisionWidth:n:h>0?e.left+=h:l>0?e.left-=l:e.left=o(e.left-r,e.left)},top:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollTop:s.offset.top,a=t.within.height,r=e.top-t.collisionPosition.marginTop,h=n-r,l=r+t.collisionHeight-a-n;t.collisionHeight>a?h>0&&0>=l?(i=e.top+h+t.collisionHeight-a-n,e.top+=h-i):e.top=l>0&&0>=h?n:h>l?n+a-t.collisionHeight:n:h>0?e.top+=h:l>0?e.top-=l:e.top=o(e.top-r,e.top)}},flip:{left:function(e,t){var i,s,n=t.within,a=n.offset.left+n.scrollLeft,o=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=e.left-t.collisionPosition.marginLeft,u=l-h,d=l+t.collisionWidth-o-h,c="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,f=-2*t.offset[0];0>u?(i=e.left+c+p+f+t.collisionWidth-o-a,(0>i||r(u)>i)&&(e.left+=c+p+f)):d>0&&(s=e.left-t.collisionPosition.marginLeft+c+p+f-h,(s>0||d>r(s))&&(e.left+=c+p+f))},top:function(e,t){var i,s,n=t.within,a=n.offset.top+n.scrollTop,o=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=e.top-t.collisionPosition.marginTop,u=l-h,d=l+t.collisionHeight-o-h,c="top"===t.my[1],p=c?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,m=-2*t.offset[1];0>u?(s=e.top+p+f+m+t.collisionHeight-o-a,e.top+p+f+m>u&&(0>s||r(u)>s)&&(e.top+=p+f+m)):d>0&&(i=e.top-t.collisionPosition.marginTop+p+f+m-h,e.top+p+f+m>d&&(i>0||d>r(i))&&(e.top+=p+f+m))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,i,s,n,o,r=document.getElementsByTagName("body")[0],h=document.createElement("div");t=document.createElement(r?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},r&&e.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(o in s)t.style[o]=s[o];t.appendChild(h),i=r||document.documentElement,i.insertBefore(t,i.firstChild),h.style.cssText="position: absolute; left: 10.7432222px;",n=e(h).offset().left,a=n>10&&11>n,t.innerHTML="",i.removeChild(t)}()}(),e.ui.position,e.widget("ui.draggable",e.ui.mouse,{version:"1.11.2",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(e,t){this._super(e,t),"handle"===e&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(t){var i=this.options;return this._blurActiveElement(t),this.helper||i.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=e(this);return e("<div>").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var i=this.document[0];if(this.handleElement.is(t.target))try{i.activeElement&&"body"!==i.activeElement.nodeName.toLowerCase()&&e(i.activeElement).blur()}catch(s){}},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===e(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._normalizeRightBottom(),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(e){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:e.pageX-this.offset.left,top:e.pageY-this.offset.top}},_mouseDrag:function(t,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",t,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,s=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(s=e.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.focus(),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_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(t){var i=this.options,s=e.isFunction(i.helper),n=s?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(e){return/(html|body)/i.test(e.tagName)||e===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var e=this.element.position(),t=this._isRootNode(this.scrollParent[0]);return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+(t?0:this.scrollParent.scrollTop()),left:e.left-(parseInt(this.helper.css("left"),10)||0)+(t?0:this.scrollParent.scrollLeft())}},_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 t,i,s,n=this.options,a=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,e(a).width()-this.helperProportions.width-this.margins.left,(e(a).height()||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=e(n.containment),s=i[0],s&&(t=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(e,t){t||(t=this.position);var i="absolute"===e?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:t.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:t.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(e,t){var i,s,n,a,o=this.options,r=this._isRootNode(this.scrollParent[0]),h=e.pageX,l=e.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),t&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,e.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),e.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),e.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),o.grid&&(n=o.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-o.grid[1]:n+o.grid[1]:n,a=o.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,h=i?a-this.offset.click.left>=i[0]||a-this.offset.click.left>i[2]?a:a-this.offset.click.left>=i[0]?a-o.grid[0]:a+o.grid[0]:a),"y"===o.axis&&(h=this.originalPageX),"x"===o.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}
},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(t,i,s){return s=s||this._uiHash(),e.ui.plugin.call(this,t,[i,s,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),e.Widget.prototype._trigger.call(this,t,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i,s){var n=e.extend({},i,{item:s.element});s.sortables=[],e(s.options.connectToSortable).each(function(){var i=e(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",t,n))})},stop:function(t,i,s){var n=e.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,e.each(s.sortables,function(){var e=this;e.isOver?(e.isOver=0,s.cancelHelperRemoval=!0,e.cancelHelperRemoval=!1,e._storedCSS={position:e.placeholder.css("position"),top:e.placeholder.css("top"),left:e.placeholder.css("left")},e._mouseStop(t),e.options.helper=e.options._helper):(e.cancelHelperRemoval=!0,e._trigger("deactivate",t,n))})},drag:function(t,i,s){e.each(s.sortables,function(){var n=!1,a=this;a.positionAbs=s.positionAbs,a.helperProportions=s.helperProportions,a.offset.click=s.offset.click,a._intersectsWith(a.containerCache)&&(n=!0,e.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==a&&this._intersectsWith(this.containerCache)&&e.contains(a.element[0],this.element[0])&&(n=!1),n})),n?(a.isOver||(a.isOver=1,a.currentItem=i.helper.appendTo(a.element).data("ui-sortable-item",!0),a.options._helper=a.options.helper,a.options.helper=function(){return i.helper[0]},t.target=a.currentItem[0],a._mouseCapture(t,!0),a._mouseStart(t,!0,!0),a.offset.click.top=s.offset.click.top,a.offset.click.left=s.offset.click.left,a.offset.parent.left-=s.offset.parent.left-a.offset.parent.left,a.offset.parent.top-=s.offset.parent.top-a.offset.parent.top,s._trigger("toSortable",t),s.dropped=a.element,e.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,a.fromOutside=s),a.currentItem&&(a._mouseDrag(t),i.position=a.position)):a.isOver&&(a.isOver=0,a.cancelHelperRemoval=!0,a.options._revert=a.options.revert,a.options.revert=!1,a._trigger("out",t,a._uiHash(a)),a._mouseStop(t,!0),a.options.revert=a.options._revert,a.options.helper=a.options._helper,a.placeholder&&a.placeholder.remove(),s._refreshOffsets(t),i.position=s._generatePosition(t,!0),s._trigger("fromSortable",t),s.dropped=!1,e.each(s.sortables,function(){this.refreshPositions()}))})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,i,s){var n=e("body"),a=s.options;n.css("cursor")&&(a._cursor=n.css("cursor")),n.css("cursor",a.cursor)},stop:function(t,i,s){var n=s.options;n._cursor&&e("body").css("cursor",n._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("opacity")&&(a._opacity=n.css("opacity")),n.css("opacity",a.opacity)},stop:function(t,i,s){var n=s.options;n._opacity&&e(i.helper).css("opacity",n._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(e,t,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(t,i,s){var n=s.options,a=!1,o=s.scrollParentNotHidden[0],r=s.document[0];o!==r&&"HTML"!==o.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+o.offsetHeight-t.pageY<n.scrollSensitivity?o.scrollTop=a=o.scrollTop+n.scrollSpeed:t.pageY-s.overflowOffset.top<n.scrollSensitivity&&(o.scrollTop=a=o.scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(s.overflowOffset.left+o.offsetWidth-t.pageX<n.scrollSensitivity?o.scrollLeft=a=o.scrollLeft+n.scrollSpeed:t.pageX-s.overflowOffset.left<n.scrollSensitivity&&(o.scrollLeft=a=o.scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(t.pageY-e(r).scrollTop()<n.scrollSensitivity?a=e(r).scrollTop(e(r).scrollTop()-n.scrollSpeed):e(window).height()-(t.pageY-e(r).scrollTop())<n.scrollSensitivity&&(a=e(r).scrollTop(e(r).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(t.pageX-e(r).scrollLeft()<n.scrollSensitivity?a=e(r).scrollLeft(e(r).scrollLeft()-n.scrollSpeed):e(window).width()-(t.pageX-e(r).scrollLeft())<n.scrollSensitivity&&(a=e(r).scrollLeft(e(r).scrollLeft()+n.scrollSpeed)))),a!==!1&&e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(s,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,i,s){var n=s.options;s.snapElements=[],e(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function(){var t=e(this),i=t.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:i.top,left:i.left})})},drag:function(t,i,s){var n,a,o,r,h,l,u,d,c,p,f=s.options,m=f.snapTolerance,g=i.offset.left,v=g+s.helperProportions.width,y=i.offset.top,b=y+s.helperProportions.height;for(c=s.snapElements.length-1;c>=0;c--)h=s.snapElements[c].left-s.margins.left,l=h+s.snapElements[c].width,u=s.snapElements[c].top-s.margins.top,d=u+s.snapElements[c].height,h-m>v||g>l+m||u-m>b||y>d+m||!e.contains(s.snapElements[c].item.ownerDocument,s.snapElements[c].item)?(s.snapElements[c].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=!1):("inner"!==f.snapMode&&(n=m>=Math.abs(u-b),a=m>=Math.abs(d-y),o=m>=Math.abs(h-v),r=m>=Math.abs(l-g),n&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d,left:0}).top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left)),p=n||a||o||r,"outer"!==f.snapMode&&(n=m>=Math.abs(u-y),a=m>=Math.abs(d-b),o=m>=Math.abs(h-g),r=m>=Math.abs(l-v),n&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.top=s._convertPositionTo("relative",{top:d-s.helperProportions.height,left:0}).top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left)),!s.snapElements[c].snapping&&(n||a||o||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=n||a||o||r||p)}}),e.ui.plugin.add("draggable","stack",{start:function(t,i,s){var n,a=s.options,o=e.makeArray(e(a.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});o.length&&(n=parseInt(e(o[0]).css("zIndex"),10)||0,e(o).each(function(t){e(this).css("zIndex",n+t)}),this.css("zIndex",n+o.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("zIndex")&&(a._zIndex=n.css("zIndex")),n.css("zIndex",a.zIndex)},stop:function(t,i,s){var n=s.options;n._zIndex&&e(i.helper).css("zIndex",n._zIndex)}}),e.ui.draggable,e.widget("ui.droppable",{version:"1.11.2",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(s)?s:function(e){return e.is(s)},this.proportions=function(){return arguments.length?(t=arguments[0],void 0):t?t:t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(t){e.ui.ddmanager.droppables[t]=e.ui.ddmanager.droppables[t]||[],e.ui.ddmanager.droppables[t].push(this)},_splice:function(e){for(var t=0;e.length>t;t++)e[t]===this&&e.splice(t,1)},_destroy:function(){var t=e.ui.ddmanager.droppables[this.options.scope];this._splice(t),this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){if("accept"===t)this.accept=e.isFunction(i)?i:function(e){return e.is(i)};else if("scope"===t){var s=e.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(t,i)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var s=i||e.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=e(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===s.options.scope&&i.accept.call(i.element[0],s.currentItem||s.element)&&e.ui.intersect(s,e.extend(i,{offset:i.element.offset()}),i.options.tolerance,t)?(n=!0,!1):void 0}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(s)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(){function e(e,t,i){return e>=t&&t+i>e}return function(t,i,s,n){if(!i.offset)return!1;var a=(t.positionAbs||t.position.absolute).left+t.margins.left,o=(t.positionAbs||t.position.absolute).top+t.margins.top,r=a+t.helperProportions.width,h=o+t.helperProportions.height,l=i.offset.left,u=i.offset.top,d=l+i.proportions().width,c=u+i.proportions().height;switch(s){case"fit":return a>=l&&d>=r&&o>=u&&c>=h;case"intersect":return a+t.helperProportions.width/2>l&&d>r-t.helperProportions.width/2&&o+t.helperProportions.height/2>u&&c>h-t.helperProportions.height/2;case"pointer":return e(n.pageY,u,i.proportions().height)&&e(n.pageX,l,i.proportions().width);case"touch":return(o>=u&&c>=o||h>=u&&c>=h||u>o&&h>c)&&(a>=l&&d>=a||r>=l&&d>=r||l>a&&r>d);default:return!1}}}(),e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var s,n,a=e.ui.ddmanager.droppables[t.options.scope]||[],o=i?i.type:null,r=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(s=0;a.length>s;s++)if(!(a[s].options.disabled||t&&!a[s].accept.call(a[s].element[0],t.currentItem||t.element))){for(n=0;r.length>n;n++)if(r[n]===a[s].element[0]){a[s].proportions().height=0;continue e}a[s].visible="none"!==a[s].element.css("display"),a[s].visible&&("mousedown"===o&&a[s]._activate.call(a[s],i),a[s].offset=a[s].element.offset(),a[s].proportions({width:a[s].element[0].offsetWidth,height:a[s].element[0].offsetHeight}))}},drop:function(t,i){var s=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,a,o=e.ui.intersect(t,this,this.options.tolerance,i),r=!o&&this.isover?"isout":o&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,a=this.element.parents(":data(ui-droppable)").filter(function(){return e(this).droppable("instance").options.scope===n}),a.length&&(s=e(a[0]).droppable("instance"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}},e.ui.droppable,e.widget("ui.resizable",e.ui.mouse,{version:"1.11.2",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(e){return parseInt(e,10)||0},_isNumber:function(e){return!isNaN(parseInt(e,10))},_hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return t[s]>0?!0:(t[s]=1,n=t[s]>0,t[s]=0,n)},_create:function(){var t,i,s,n,a,o=this,r=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!r.aspectRatio,aspectRatio:r.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(e("<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=!0,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}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=r.handles||(e(".ui-resizable-handle",this.element).length?{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"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},i=0;t.length>i;i++)s=e.trim(t[i]),a="ui-resizable-"+s,n=e("<div class='ui-resizable-handle "+a+"'></div>"),n.css({zIndex:r.zIndex}),"se"===s&&n.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(n);this._renderAxis=function(t){var i,s,n,a;t=t||this.element;for(i in this.handles)this.handles[i].constructor===String&&(this.handles[i]=this.element.children(this.handles[i]).first().show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(s=e(this.handles[i],this.element),a=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),t.css(n,a),this._proportionallyResize()),e(this.handles[i]).length},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=n&&n[1]?n[1]:"se")}),r.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){r.disabled||(e(this).removeClass("ui-resizable-autohide"),o._handles.show())}).mouseleave(function(){r.disabled||o.resizing||(e(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,i=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(t){var i,s,n=!1;for(i in this.handles)s=e(this.handles[i])[0],(s===t.target||e.contains(s,t.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(t){var i,s,n,a=this.options,o=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),a.containment&&(i+=e(a.containment).scrollLeft()||0,s+=e(a.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:o.width(),height:o.height()},this.originalSize=this._helper?{width:o.outerWidth(),height:o.outerHeight()}:{width:o.width(),height:o.height()},this.sizeDiff={width:o.outerWidth()-o.width(),height:o.outerHeight()-o.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof a.aspectRatio?a.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===n?this.axis+"-resize":n),o.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var i,s,n=this.originalMousePosition,a=this.axis,o=t.pageX-n.left||0,r=t.pageY-n.top||0,h=this._change[a];return this._updatePrevProperties(),h?(i=h.apply(this,[t,o,r]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(t){this.resizing=!1;var i,s,n,a,o,r,h,l=this.options,u=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:u.sizeDiff.height,a=s?0:u.sizeDiff.width,o={width:u.helper.width()-a,height:u.helper.height()-n},r=parseInt(u.element.css("left"),10)+(u.position.left-u.originalPosition.left)||null,h=parseInt(u.element.css("top"),10)+(u.position.top-u.originalPosition.top)||null,l.animate||this.element.css(e.extend(o,{top:h,left:r})),u.helper.height(u.size.height),u.helper.width(u.size.width),this._helper&&!l.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_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 e={};return this.position.top!==this.prevPosition.top&&(e.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(e.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(e.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(e.height=this.size.height+"px"),this.helper.css(e),e},_updateVirtualBoundaries:function(e){var t,i,s,n,a,o=this.options;a={minWidth:this._isNumber(o.minWidth)?o.minWidth:0,maxWidth:this._isNumber(o.maxWidth)?o.maxWidth:1/0,minHeight:this._isNumber(o.minHeight)?o.minHeight:0,maxHeight:this._isNumber(o.maxHeight)?o.maxHeight:1/0},(this._aspectRatio||e)&&(t=a.minHeight*this.aspectRatio,s=a.minWidth/this.aspectRatio,i=a.maxHeight*this.aspectRatio,n=a.maxWidth/this.aspectRatio,t>a.minWidth&&(a.minWidth=t),s>a.minHeight&&(a.minHeight=s),a.maxWidth>i&&(a.maxWidth=i),a.maxHeight>n&&(a.maxHeight=n)),this._vBoundaries=a},_updateCache:function(e){this.offset=this.helper.offset(),this._isNumber(e.left)&&(this.position.left=e.left),this._isNumber(e.top)&&(this.position.top=e.top),this._isNumber(e.height)&&(this.size.height=e.height),this._isNumber(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,i=this.size,s=this.axis;return this._isNumber(e.height)?e.width=e.height*this.aspectRatio:this._isNumber(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===s&&(e.left=t.left+(i.width-e.width),e.top=null),"nw"===s&&(e.top=t.top+(i.height-e.height),e.left=t.left+(i.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,i=this.axis,s=this._isNumber(e.width)&&t.maxWidth&&t.maxWidth<e.width,n=this._isNumber(e.height)&&t.maxHeight&&t.maxHeight<e.height,a=this._isNumber(e.width)&&t.minWidth&&t.minWidth>e.width,o=this._isNumber(e.height)&&t.minHeight&&t.minHeight>e.height,r=this.originalPosition.left+this.originalSize.width,h=this.position.top+this.size.height,l=/sw|nw|w/.test(i),u=/nw|ne|n/.test(i);return a&&(e.width=t.minWidth),o&&(e.height=t.minHeight),s&&(e.width=t.maxWidth),n&&(e.height=t.maxHeight),a&&l&&(e.left=r-t.minWidth),s&&l&&(e.left=r-t.maxWidth),o&&u&&(e.top=h-t.minHeight),n&&u&&(e.top=h-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_getPaddingPlusBorderDimensions:function(e){for(var t=0,i=[],s=[e.css("borderTopWidth"),e.css("borderRightWidth"),e.css("borderBottomWidth"),e.css("borderLeftWidth")],n=[e.css("paddingTop"),e.css("paddingRight"),e.css("paddingBottom"),e.css("paddingLeft")];4>t;t++)i[t]=parseInt(s[t],10)||0,i[t]+=parseInt(n[t],10)||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var e,t=0,i=this.helper||this.element;this._proportionallyResizeElements.length>t;t++)e=this._proportionallyResizeElements[t],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(e)),e.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var t=this.element,i=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<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:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var i=this.originalSize,s=this.originalPosition;return{left:s.left+t,width:i.width-t}},n:function(e,t,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(e,t,i){return{height:this.originalSize.height+i}},se:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},sw:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,s]))},ne:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},nw:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,s]))}},_propagate:function(t,i){e.ui.plugin.call(this,t,[i,this.ui()]),"resize"!==t&&this._trigger(t,i,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}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var i=e(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,a=n.length&&/textarea/i.test(n[0].nodeName),o=a&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=a?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-o},l=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,u=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(e.extend(h,u&&l?{top:u,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};n&&n.length&&e(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var t,i,s,n,a,o,r,h=e(this).resizable("instance"),l=h.options,u=h.element,d=l.containment,c=d instanceof e?d.get(0):/parent/.test(d)?u.parent().get(0):d;c&&(h.containerElement=e(c),/document/.test(d)||d===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(t=e(c),i=[],e(["Top","Right","Left","Bottom"]).each(function(e,s){i[e]=h._num(t.css("padding"+s))}),h.containerOffset=t.offset(),h.containerPosition=t.position(),h.containerSize={height:t.innerHeight()-i[3],width:t.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,a=h.containerSize.width,o=h._hasScroll(c,"left")?c.scrollWidth:a,r=h._hasScroll(c)?c.scrollHeight:n,h.parentData={element:c,left:s.left,top:s.top,width:o,height:r}))},resize:function(t){var i,s,n,a,o=e(this).resizable("instance"),r=o.options,h=o.containerOffset,l=o.position,u=o._aspectRatio||t.shiftKey,d={top:0,left:0},c=o.containerElement,p=!0;c[0]!==document&&/static/.test(c.css("position"))&&(d=h),l.left<(o._helper?h.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-h.left:o.position.left-d.left),u&&(o.size.height=o.size.width/o.aspectRatio,p=!1),o.position.left=r.helper?h.left:0),l.top<(o._helper?h.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-h.top:o.position.top),u&&(o.size.width=o.size.height*o.aspectRatio,p=!1),o.position.top=o._helper?h.top:0),n=o.containerElement.get(0)===o.element.parent().get(0),a=/relative|absolute/.test(o.containerElement.css("position")),n&&a?(o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top):(o.offset.left=o.element.offset().left,o.offset.top=o.element.offset().top),i=Math.abs(o.sizeDiff.width+(o._helper?o.offset.left-d.left:o.offset.left-h.left)),s=Math.abs(o.sizeDiff.height+(o._helper?o.offset.top-d.top:o.offset.top-h.top)),i+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-i,u&&(o.size.height=o.size.width/o.aspectRatio,p=!1)),s+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-s,u&&(o.size.width=o.size.height*o.aspectRatio,p=!1)),p||(o.position.left=o.prevPosition.left,o.position.top=o.prevPosition.top,o.size.width=o.prevSize.width,o.size.height=o.prevSize.height)},stop:function(){var t=e(this).resizable("instance"),i=t.options,s=t.containerOffset,n=t.containerPosition,a=t.containerElement,o=e(t.helper),r=o.offset(),h=o.outerWidth()-t.sizeDiff.width,l=o.outerHeight()-t.sizeDiff.height;t._helper&&!i.animate&&/relative/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l}),t._helper&&!i.animate&&/static/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).resizable("instance"),i=t.options,s=function(t){e(t).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})};"object"!=typeof i.alsoResize||i.alsoResize.parentNode?s(i.alsoResize):i.alsoResize.length?(i.alsoResize=i.alsoResize[0],s(i.alsoResize)):e.each(i.alsoResize,function(e){s(e)})},resize:function(t,i){var s=e(this).resizable("instance"),n=s.options,a=s.originalSize,o=s.originalPosition,r={height:s.size.height-a.height||0,width:s.size.width-a.width||0,top:s.position.top-o.top||0,left:s.position.left-o.left||0},h=function(t,s){e(t).each(function(){var t=e(this),n=e(this).data("ui-resizable-alsoresize"),a={},o=s&&s.length?s:t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(o,function(e,t){var i=(n[t]||0)+(r[t]||0);i&&i>=0&&(a[t]=i||null)}),t.css(a)})};"object"!=typeof n.alsoResize||n.alsoResize.nodeType?h(n.alsoResize):e.each(n.alsoResize,function(e,t){h(e,t)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).resizable("instance"),i=t.options,s=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t,i=e(this).resizable("instance"),s=i.options,n=i.size,a=i.originalSize,o=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,u=h[1]||1,d=Math.round((n.width-a.width)/l)*l,c=Math.round((n.height-a.height)/u)*u,p=a.width+d,f=a.height+c,m=s.maxWidth&&p>s.maxWidth,g=s.maxHeight&&f>s.maxHeight,v=s.minWidth&&s.minWidth>p,y=s.minHeight&&s.minHeight>f;s.grid=h,v&&(p+=l),y&&(f+=u),m&&(p-=l),g&&(f-=u),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=o.top-c):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=o.left-d):((0>=f-u||0>=p-l)&&(t=i._getPaddingPlusBorderDimensions(this)),f-u>0?(i.size.height=f,i.position.top=o.top-c):(f=u-t.height,i.size.height=f,i.position.top=o.top+a.height-f),p-l>0?(i.size.width=p,i.position.left=o.left-d):(p=u-t.height,i.size.width=p,i.position.left=o.left+a.width-p))}}),e.ui.resizable,e.widget("ui.selectable",e.ui.mouse,{version:"1.11.2",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,i=this;
this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<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(t){var i=this,s=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(s.filter,this.element[0]),this._trigger("start",t),e(s.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=e.data(this,"selectable-item");s.startselected=!0,t.metaKey||t.ctrlKey||(s.$element.removeClass("ui-selected"),s.selected=!1,s.$element.addClass("ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",t,{unselecting:s.element}))}),e(t.target).parents().addBack().each(function(){var s,n=e.data(this,"selectable-item");return n?(s=!t.metaKey&&!t.ctrlKey||!n.$element.hasClass("ui-selected"),n.$element.removeClass(s?"ui-unselecting":"ui-selected").addClass(s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",t,{selecting:n.element}):i._trigger("unselecting",t,{unselecting:n.element}),!1):void 0}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,a=this.opos[0],o=this.opos[1],r=t.pageX,h=t.pageY;return a>r&&(i=r,r=a,a=i),o>h&&(i=h,h=o,o=i),this.helper.css({left:a,top:o,width:r-a,height:h-o}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),l=!1;i&&i.element!==s.element[0]&&("touch"===n.tolerance?l=!(i.left>r||a>i.right||i.top>h||o>i.bottom):"fit"===n.tolerance&&(l=i.left>a&&r>i.right&&i.top>o&&h>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,s._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",t,{unselected:s.element})}),e(".ui-selecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-selecting").addClass("ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",t,{selected:s.element})}),this._trigger("stop",t),this.helper.remove(),!1}}),e.widget("ui.sortable",e.ui.mouse,{version:"1.11.2",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,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(e,t,i){return e>=t&&t+i>e},_isFloating:function(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))},_create:function(){var e=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===e.axis||this._isFloating(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(e,t){this._super(e,t),"handle"===e&&this._setHandleClassName()},_setHandleClassName:function(){this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"),e.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 e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,i){var s=null,n=!1,a=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(t),e(t.target).parents().each(function(){return e.data(this,a.widgetName+"-item")===a?(s=e(this),!1):void 0}),e.data(t.target,a.widgetName+"-item")===a&&(s=e(t.target)),s?!this.options.handle||i||(e(this.options.handle,s).find("*").addBack().each(function(){this===t.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(t,i,s){var n,a,o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(a=this.document.find("body"),this.storedCursor=a.css("cursor"),a.css("cursor",o.cursor),this.storedStylesheet=e("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(a)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",t,this._uiHash(this));return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var i,s,n,a,o=this.options,r=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+o.scrollSpeed:t.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+o.scrollSpeed:t.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(t.pageY-e(document).scrollTop()<o.scrollSensitivity?r=e(document).scrollTop(e(document).scrollTop()-o.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<o.scrollSensitivity&&(r=e(document).scrollTop(e(document).scrollTop()+o.scrollSpeed)),t.pageX-e(document).scrollLeft()<o.scrollSensitivity?r=e(document).scrollLeft(e(document).scrollLeft()-o.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<o.scrollSensitivity&&(r=e(document).scrollLeft(e(document).scrollLeft()+o.scrollSpeed))),r!==!1&&e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],n=s.item[0],a=this._intersectsWithPointer(s),a&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===a?"next":"prev"]()[0]!==n&&!e.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],n):!0)){if(this.direction=1===a?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(t,s),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,i){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var s=this,n=this.placeholder.offset(),a=this.options.axis,o={};a&&"x"!==a||(o.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),a&&"y"!==a||(o.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,e(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){s._clear(t)})}else this._clear(t,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},e(i).each(function(){var i=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);i&&s.push((t.key||i[1]+"[]")+"="+(t.key&&t.expression?i[1]:i[2]))}),!s.length&&t.key&&s.push(t.key+"="),s.join("&")},toArray:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},i.each(function(){s.push(e(t.item||this).attr(t.attribute||"id")||"")}),s},_intersectsWith:function(e){var t=this.positionAbs.left,i=t+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,a=e.left,o=a+e.width,r=e.top,h=r+e.height,l=this.offset.click.top,u=this.offset.click.left,d="x"===this.options.axis||s+l>r&&h>s+l,c="y"===this.options.axis||t+u>a&&o>t+u,p=d&&c;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?p:t+this.helperProportions.width/2>a&&o>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(e){var t="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top,e.height),i="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left,e.width),s=t&&i,n=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return s?this.floating?a&&"right"===a||"down"===n?2:1:n&&("down"===n?2:1):!1},_intersectsWithSides:function(e){var t=this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&t||"up"===s&&!t)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){function i(){r.push(this)}var s,n,a,o,r=[],h=[],l=this._connectWith();if(l&&t)for(s=l.length-1;s>=0;s--)for(a=e(l[s]),n=a.length-1;n>=0;n--)o=e.data(a[n],this.widgetFullName),o&&o!==this&&!o.options.disabled&&h.push([e.isFunction(o.options.items)?o.options.items.call(o.element):e(o.options.items,o.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),o]);for(h.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=h.length-1;s>=0;s--)h[s][0].each(i);return e(r)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var i=0;t.length>i;i++)if(t[i]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var i,s,n,a,o,r,h,l,u=this.items,d=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],c=this._connectWith();if(c&&this.ready)for(i=c.length-1;i>=0;i--)for(n=e(c[i]),s=n.length-1;s>=0;s--)a=e.data(n[s],this.widgetFullName),a&&a!==this&&!a.options.disabled&&(d.push([e.isFunction(a.options.items)?a.options.items.call(a.element[0],t,{item:this.currentItem}):e(a.options.items,a.element),a]),this.containers.push(a));for(i=d.length-1;i>=0;i--)for(o=d[i][1],r=d[i][0],s=0,l=r.length;l>s;s++)h=e(r[s]),h.data(this.widgetName+"-item",o),u.push({item:h,instance:o,width:0,height:0,left:0,top:0})},refreshPositions:function(t){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,a;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?e(this.options.toleranceElement,s.item):s.item,t||(s.width=n.outerWidth(),s.height=n.outerHeight()),a=n.offset(),s.left=a.left,s.top=a.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--)a=this.containers[i].element.offset(),this.containers[i].containerCache.left=a.left,this.containers[i].containerCache.top=a.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(t){t=t||this;var i,s=t.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=t.currentItem[0].nodeName.toLowerCase(),n=e("<"+s+">",t.document[0]).addClass(i||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===s?t.currentItem.children().each(function(){e("<td> </td>",t.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(n)}):"img"===s&&n.attr("src",t.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(e,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(s.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),s.placeholder.update(t,t.placeholder)},_contactContainers:function(t){var i,s,n,a,o,r,h,l,u,d,c=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!e.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(c&&e.contains(this.containers[i].element[0],c.element[0]))continue;c=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",t,this._uiHash(this)),this.containers[i].containerCache.over=0);if(c)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,a=null,u=c.floating||this._isFloating(this.currentItem),o=u?"left":"top",r=u?"width":"height",d=u?"clientX":"clientY",s=this.items.length-1;s>=0;s--)e.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(h=this.items[s].item.offset()[o],l=!1,t[d]-h>this.items[s][r]/2&&(l=!0),n>Math.abs(t[d]-h)&&(n=Math.abs(t[d]-h),a=this.items[s],this.direction=l?"up":"down"));if(!a&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;a?this._rearrange(t,a,null,!0):this._rearrange(t,null,this.containers[p].element,!0),this._trigger("change",t,this._uiHash()),this.containers[p]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||e("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[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")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}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 t,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,e("document"===n.containment?document:window).width()-this.helperProportions.width-this.margins.left,(e("document"===n.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(t=e(n.containment)[0],i=e(n.containment).offset(),s="hidden"!==e(t).css("overflow"),this.containment=[i.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,i){i||(i=this.position);var s="absolute"===t?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():a?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():a?0:n.scrollLeft())*s}},_generatePosition:function(t){var i,s,n=this.options,a=t.pageX,o=t.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(a=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(o=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(a=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1],o=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((a-this.originalPageX)/n.grid[0])*n.grid[0],a=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(e,t,i,s){i?i[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(e,t){function i(e,t,i){return function(s){i._trigger(e,s,t._uiHash(t))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&n.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||t||n.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(n.push(function(e){this._trigger("remove",e,this._uiHash())}),n.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)t||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!t){for(s=0;n.length>s;s++)n[s].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}}),e.widget("ui.accordion",{version:"1.11.2",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},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 t=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||t.active!==!1&&null!=t.active||(t.active=0),this._processPanels(),0>t.active&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),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(),e=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(),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||this.options.active!==!1||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons()),"disabled"===e&&(this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t)),void 0)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var i=e.ui.keyCode,s=this.headers.length,n=this.headers.index(t.target),a=!1;switch(t.keyCode){case i.RIGHT:case i.DOWN:a=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:a=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(t);break;case i.HOME:a=this.headers[0];break;case i.END:a=this.headers[s-1]}a&&(e(t.target).attr("tabIndex",-1),e(a).attr("tabIndex",0),a.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),t.active===!1&&t.collapsible===!0||!this.headers.length?(t.active=!1,this.active=e()):t.active===!1?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var e=this.headers,t=this.panels;this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-state-default ui-corner-all"),this.panels=this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide(),t&&(this._off(e.not(this.headers)),this._off(t.not(this.panels)))},_refresh:function(){var t,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.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 t=e(this),i=t.uniqueId().attr("id"),s=t.next(),n=s.uniqueId().attr("id");
t.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(t=n.height(),this.element.siblings(":visible").each(function(){var i=e(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(t-=i.outerHeight(!0))}),this.headers.each(function(){t-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,t-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===s&&(t=0,this.headers.next().each(function(){t=Math.max(t,e(this).css("height","").height())}).height(t))},_activate:function(t){var i=this._findActive(t)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var i=this.options,s=this.active,n=e(t.currentTarget),a=n[0]===s[0],o=a&&i.collapsible,r=o?e():n.next(),h=s.next(),l={oldHeader:s,oldPanel:h,newHeader:o?e():n,newPanel:r};t.preventDefault(),a&&!i.collapsible||this._trigger("beforeActivate",t,l)===!1||(i.active=o?!1:this.headers.index(n),this.active=a?e():n,this._toggle(l),s.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&s.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),a||(n.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&n.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),n.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var i=t.newPanel,s=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,t):(s.hide(),i.show(),this._toggleComplete(t)),s.attr({"aria-hidden":"true"}),s.prev().attr("aria-selected","false"),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true",tabIndex:0,"aria-expanded":"true"})},_animate:function(e,t,i){var s,n,a,o=this,r=0,h=e.length&&(!t.length||e.index()<t.index()),l=this.options.animate||{},u=h&&l.down||l,d=function(){o._toggleComplete(i)};return"number"==typeof u&&(a=u),"string"==typeof u&&(n=u),n=n||u.easing||l.easing,a=a||u.duration||l.duration,t.length?e.length?(s=e.show().outerHeight(),t.animate(this.hideProps,{duration:a,easing:n,step:function(e,t){t.now=Math.round(e)}}),e.hide().animate(this.showProps,{duration:a,easing:n,complete:d,step:function(e,i){i.now=Math.round(e),"height"!==i.prop?r+=i.now:"content"!==o.options.heightStyle&&(i.now=Math.round(s-t.outerHeight()-r),r=0)}}),void 0):t.animate(this.hideProps,a,n,d):e.animate(this.showProps,a,n,d)},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent()[0].className=t.parent()[0].className),this._trigger("activate",null,e)}}),e.widget("ui.menu",{version:"1.11.2",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",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,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}),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item":function(e){e.preventDefault()},"click .ui-menu-item":function(t){var i=e(t.target);!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&e(this.document[0].activeElement).closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){if(!this.previousFilter){var i=e(t.currentTarget);i.siblings(".ui-state-active").removeClass("ui-state-active"),this.focus(t,i)}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var i=this.active||this.element.find(this.options.items).eq(0);t||this.focus(e,i)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){this._closeOnDocumentClick(e)&&this.collapseAll(e),this.mouseHandled=!1}})},_destroy:function(){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(),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 t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){var i,s,n,a,o=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:o=!1,s=this.previousFilter||"",n=String.fromCharCode(t.keyCode),a=!1,clearTimeout(this.filterTimer),n===s?a=!0:n=s+n,i=this._filterMenuItems(n),i=a&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(t.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(t,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}o&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.is("[aria-haspopup='true']")?this.expand(e):this.select(e))},refresh:function(){var t,i,s=this,n=this.options.icons.submenu,a=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),a.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 t=e(this),i=t.parent(),s=e("<span>").addClass("ui-menu-icon ui-icon "+n).data("ui-menu-submenu-carat",!0);i.attr("aria-haspopup","true").prepend(s),t.attr("aria-labelledby",i.attr("id"))}),t=a.add(this.element),i=t.find(this.options.items),i.not(".ui-menu-item").each(function(){var t=e(this);s._isDivider(t)&&t.addClass("ui-widget-content ui-menu-divider")}),i.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){"icons"===e&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(t.submenu),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},focus:function(e,t){var i,s;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),s=this.active.addClass("ui-state-focus").removeClass("ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),this.active.parent().closest(".ui-menu-item").addClass("ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=t.children(".ui-menu"),i.length&&e&&/^mouse/.test(e.type)&&this._startOpening(i),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var i,s,n,a,o,r;this._hasScroll()&&(i=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,n=t.offset().top-this.activeMenu.offset().top-i-s,a=this.activeMenu.scrollTop(),o=this.activeMenu.height(),r=t.outerHeight(),0>n?this.activeMenu.scrollTop(a+n):n+r>o&&this.activeMenu.scrollTop(a+n-o+r))},blur:function(e,t){t||clearTimeout(this.timer),this.active&&(this.active.removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active}))},_startOpening:function(e){clearTimeout(this.timer),"true"===e.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(e)},this.delay))},_open:function(t){var i=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(t,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(t),this.activeMenu=s},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.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(t){return!e(t.target).closest(".ui-menu").length},_isDivider:function(e){return!/[^\-\u2014\u2013\s]/.test(e.text())},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},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(e,t,i){var s;this.active&&(s="first"===e||"last"===e?this.active["first"===e?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[e+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[t]()),this.focus(i,s)},nextPage:function(t){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=e(this),0>i.offset().top-s-n}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(t),void 0)},previousPage:function(t){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=e(this),i.offset().top-s+n>0}),this.focus(t,i)):this.focus(t,this.activeMenu.find(this.options.items).first())),void 0):(this.next(t),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||e(t.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,i)},_filterMenuItems:function(t){var i=t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),s=RegExp("^"+i,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return s.test(e.trim(e(this).text()))})}}),e.widget("ui.autocomplete",{version:"1.11.2",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var t,i,s,n=this.element[0].nodeName.toLowerCase(),a="textarea"===n,o="input"===n;this.isMultiLine=a?!0:o?!1:this.element.prop("isContentEditable"),this.valueMethod=this.element[a||o?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return t=!0,s=!0,i=!0,void 0;t=!1,s=!1,i=!1;var a=e.ui.keyCode;switch(n.keyCode){case a.PAGE_UP:t=!0,this._move("previousPage",n);break;case a.PAGE_DOWN:t=!0,this._move("nextPage",n);break;case a.UP:t=!0,this._keyEvent("previous",n);break;case a.DOWN:t=!0,this._keyEvent("next",n);break;case a.ENTER:this.menu.active&&(t=!0,n.preventDefault(),this.menu.select(n));break;case a.TAB:this.menu.active&&this.menu.select(n);break;case a.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(t)return t=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=e.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(e){return s?(s=!1,e.preventDefault(),void 0):(this._searchTimeout(e),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(e),this._change(e),void 0)}}),this._initSource(),this.menu=e("<ul>").addClass("ui-autocomplete ui-front").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var i=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(s){s.target===t.element[0]||s.target===i||e.contains(i,s.target)||t.close()})})},menufocus:function(t,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:n})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&e.trim(s).length&&(this.liveRegion.children().hide(),e("<div>").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,t){var i=t.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",e,{item:i})&&this._value(i.value),this.term=this._value(),this.close(e),this.selectedItem=i}}),this.liveRegion=e("<span>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body),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(e,t){this._super(e,t),"source"===e&&this._initSource(),"appendTo"===e&&this.menu.element.appendTo(this._appendTo()),"disabled"===e&&t&&this.xhr&&this.xhr.abort()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_initSource:function(){var t,i,s=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(i,s){s(e.ui.autocomplete.filter(t,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(t,n){s.xhr&&s.xhr.abort(),s.xhr=e.ajax({url:i,data:t,dataType:"json",success:function(e){n(e)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),i=this.menu.element.is(":visible"),s=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;(!t||t&&!i&&!s)&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){return e=null!=e?e:this._value(),this.term=this._value(),e.length<this.options.minLength?this.close(t):this._trigger("search",t)!==!1?this._search(e):void 0},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response())},_response:function(){var t=++this.requestIndex;return e.proxy(function(e){t===this.requestIndex&&this.__response(e),this.pending--,this.pending||this.element.removeClass("ui-autocomplete-loading")},this)},__response:function(e){e&&(e=this._normalize(e)),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close()},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return"string"==typeof t?{label:t,value:t}:e.extend({},t,{label:t.label||t.value,value:t.value||t.label})})},_suggest:function(t){var i=this.menu.element.empty();this._renderMenu(i,t),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(t,i){var s=this;e.each(i,function(e,i){s._renderItemData(t,i)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,i){return e("<li>").text(i.label).appendTo(t)},_move:function(e,t){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[e](t),void 0):(this.search(null,t),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(e,t),t.preventDefault())}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,i){var s=RegExp(e.ui.autocomplete.escapeRegex(i),"i");return e.grep(t,function(e){return s.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,this.liveRegion.children().hide(),e("<div>").text(i).appendTo(this.liveRegion))}}),e.ui.autocomplete;var c,p="ui-button ui-widget ui-state-default ui-corner-all",f="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",m=function(){var t=e(this);setTimeout(function(){t.find(":ui-button").button("refresh")},1)},g=function(t){var i=t.name,s=t.form,n=e([]);return i&&(i=i.replace(/'/g,"\\'"),n=s?e(s).find("[name='"+i+"'][type=radio]"):e("[name='"+i+"'][type=radio]",t.ownerDocument).filter(function(){return!this.form})),n};e.widget("ui.button",{version:"1.11.2",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,m),"boolean"!=typeof this.options.disabled?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var t=this,i=this.options,s="checkbox"===this.type||"radio"===this.type,n=s?"":"ui-state-active";null===i.label&&(i.label="input"===this.type?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(p).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){i.disabled||this===c&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){i.disabled||e(this).removeClass(n)}).bind("click"+this.eventNamespace,function(e){i.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this._on({focus:function(){this.buttonElement.addClass("ui-state-focus")},blur:function(){this.buttonElement.removeClass("ui-state-focus")}}),s&&this.element.bind("change"+this.eventNamespace,function(){t.refresh()}),"checkbox"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){return i.disabled?!1:void 0}):"radio"===this.type?this.buttonElement.bind("click"+this.eventNamespace,function(){if(i.disabled)return!1;e(this).addClass("ui-state-active"),t.buttonElement.attr("aria-pressed","true");var s=t.element[0];g(s).not(s).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){return i.disabled?!1:(e(this).addClass("ui-state-active"),c=this,t.document.one("mouseup",function(){c=null}),void 0)}).bind("mouseup"+this.eventNamespace,function(){return i.disabled?!1:(e(this).removeClass("ui-state-active"),void 0)}).bind("keydown"+this.eventNamespace,function(t){return i.disabled?!1:((t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active"),void 0)}).bind("keyup"+this.eventNamespace+" blur"+this.eventNamespace,function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",i.disabled),this._resetButton()},_determineButtonType:function(){var e,t,i;this.type=this.element.is("[type=checkbox]")?"checkbox":this.element.is("[type=radio]")?"radio":this.element.is("input")?"input":"button","checkbox"===this.type||"radio"===this.type?(e=this.element.parents().last(),t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),i=this.element.is(":checked"),i&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",i)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(p+" ui-state-active "+f).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){return this._super(e,t),"disabled"===e?(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),t&&("checkbox"===this.type||"radio"===this.type?this.buttonElement.removeClass("ui-state-focus"):this.buttonElement.removeClass("ui-state-focus ui-state-active")),void 0):(this._resetButton(),void 0)},refresh:function(){var t=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),"radio"===this.type?g(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):"checkbox"===this.type&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if("input"===this.type)return this.options.label&&this.element.val(this.options.label),void 0;var t=this.buttonElement.removeClass(f),i=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),s=this.options.icons,n=s.primary&&s.secondary,a=[];s.primary||s.secondary?(this.options.text&&a.push("ui-button-text-icon"+(n?"s":s.primary?"-primary":"-secondary")),s.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+s.primary+"'></span>"),s.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+s.secondary+"'></span>"),this.options.text||(a.push(n?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(i)))):a.push("ui-button-text-only"),t.addClass(a.join(" "))}}),e.widget("ui.buttonset",{version:"1.11.2",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(e,t){"disabled"===e&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function(){var t="rtl"===this.element.css("direction"),i=this.element.find(this.options.items),s=i.filter(":ui-button");i.not(":ui-button").button(),s.button("refresh"),this.buttons=i.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}}),e.ui.button,e.extend(e.ui,{datepicker:{version:"1.11.2"}});var v;e.extend(n.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return r(this._defaults,e||{}),this},_attachDatepicker:function(t,i){var s,n,a;s=t.nodeName.toLowerCase(),n="div"===s||"span"===s,t.id||(this.uuid+=1,t.id="dp"+this.uuid),a=this._newInst(e(t),n),a.settings=e.extend({},i||{}),"input"===s?this._connectDatepicker(t,a):n&&this._inlineDatepicker(t,a)},_newInst:function(t,i){var s=t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?a(e("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,i){var s=e(t);i.append=e([]),i.trigger=e([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),e.data(t,"datepicker",i),i.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,i){var s,n,a,o=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),o&&(i.append=e("<span class='"+this._appendClass+"'>"+o+"</span>"),t[r?"before":"after"](i.append)),t.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&t.focus(this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),a=this._get(i,"buttonImage"),i.trigger=e(this._get(i,"buttonImageOnly")?e("<img/>").addClass(this._triggerClass).attr({src:a,alt:n,title:n}):e("<button type='button'></button>").addClass(this._triggerClass).html(a?e("<img/>").attr({src:a,alt:n,title:n}):n)),t[r?"before":"after"](i.trigger),i.trigger.click(function(){return e.datepicker._datepickerShowing&&e.datepicker._lastInput===t[0]?e.datepicker._hideDatepicker():e.datepicker._datepickerShowing&&e.datepicker._lastInput!==t[0]?(e.datepicker._hideDatepicker(),e.datepicker._showDatepicker(t[0])):e.datepicker._showDatepicker(t[0]),!1}))},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t,i,s,n,a=new Date(2009,11,20),o=this._get(e,"dateFormat");o.match(/[DM]/)&&(t=function(e){for(i=0,s=0,n=0;e.length>n;n++)e[n].length>i&&(i=e[n].length,s=n);return s},a.setMonth(t(this._get(e,o.match(/MM/)?"monthNames":"monthNamesShort"))),a.setDate(t(this._get(e,o.match(/DD/)?"dayNames":"dayNamesShort"))+20-a.getDay())),e.input.attr("size",this._formatDate(e,a).length)}},_inlineDatepicker:function(t,i){var s=e(t);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),e.data(t,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(t),i.dpDiv.css("display","block"))},_dialogDatepicker:function(t,i,s,n,a){var o,h,l,u,d,c=this._dialogInst;return c||(this.uuid+=1,o="dp"+this.uuid,this._dialogInput=e("<input type='text' id='"+o+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),e("body").append(this._dialogInput),c=this._dialogInst=this._newInst(this._dialogInput,!1),c.settings={},e.data(this._dialogInput[0],"datepicker",c)),r(c.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(c,i):i,this._dialogInput.val(i),this._pos=a?a.length?a:[a.pageX,a.pageY]:null,this._pos||(h=document.documentElement.clientWidth,l=document.documentElement.clientHeight,u=document.documentElement.scrollLeft||document.body.scrollLeft,d=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[h/2-100+u,l/2-150+d]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),c.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),e.blockUI&&e.blockUI(this.dpDiv),e.data(this._dialogInput[0],"datepicker",c),this},_destroyDatepicker:function(t){var i,s=e(t),n=e.data(t,"datepicker");s.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),e.removeData(t,"datepicker"),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty())
},_enableDatepicker:function(t){var i,s,n=e(t),a=e.data(t,"datepicker");n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!1,a.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}))},_disableDatepicker:function(t){var i,s,n=e(t),a=e.data(t,"datepicker");n.hasClass(this.markerClassName)&&(i=t.nodeName.toLowerCase(),"input"===i?(t.disabled=!0,a.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=e.map(this._disabledInputs,function(e){return e===t?null:e}),this._disabledInputs[this._disabledInputs.length]=t)},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;this._disabledInputs.length>t;t++)if(this._disabledInputs[t]===e)return!0;return!1},_getInst:function(t){try{return e.data(t,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(t,i,s){var n,a,o,h,l=this._getInst(t);return 2===arguments.length&&"string"==typeof i?"defaults"===i?e.extend({},e.datepicker._defaults):l?"all"===i?e.extend({},l.settings):this._get(l,i):null:(n=i||{},"string"==typeof i&&(n={},n[i]=s),l&&(this._curInst===l&&this._hideDatepicker(),a=this._getDateDatepicker(t,!0),o=this._getMinMaxDate(l,"min"),h=this._getMinMaxDate(l,"max"),r(l.settings,n),null!==o&&void 0!==n.dateFormat&&void 0===n.minDate&&(l.settings.minDate=this._formatDate(l,o)),null!==h&&void 0!==n.dateFormat&&void 0===n.maxDate&&(l.settings.maxDate=this._formatDate(l,h)),"disabled"in n&&(n.disabled?this._disableDatepicker(t):this._enableDatepicker(t)),this._attachments(e(t),l),this._autoSize(l),this._setDate(l,a),this._updateAlternate(l),this._updateDatepicker(l)),void 0)},_changeDatepicker:function(e,t,i){this._optionDatepicker(e,t,i)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var i=this._getInst(e);i&&(this._setDate(i,t),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(e,t){var i=this._getInst(e);return i&&!i.inline&&this._setDateFromField(i,t),i?this._getDate(i):null},_doKeyDown:function(t){var i,s,n,a=e.datepicker._getInst(t.target),o=!0,r=a.dpDiv.is(".ui-datepicker-rtl");if(a._keyEvent=!0,e.datepicker._datepickerShowing)switch(t.keyCode){case 9:e.datepicker._hideDatepicker(),o=!1;break;case 13:return n=e("td."+e.datepicker._dayOverClass+":not(."+e.datepicker._currentClass+")",a.dpDiv),n[0]&&e.datepicker._selectDay(t.target,a.selectedMonth,a.selectedYear,n[0]),i=e.datepicker._get(a,"onSelect"),i?(s=e.datepicker._formatDate(a),i.apply(a.input?a.input[0]:null,[s,a])):e.datepicker._hideDatepicker(),!1;case 27:e.datepicker._hideDatepicker();break;case 33:e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(a,"stepBigMonths"):-e.datepicker._get(a,"stepMonths"),"M");break;case 34:e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(a,"stepBigMonths"):+e.datepicker._get(a,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&e.datepicker._clearDate(t.target),o=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&e.datepicker._gotoToday(t.target),o=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,r?1:-1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?-e.datepicker._get(a,"stepBigMonths"):-e.datepicker._get(a,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,-7,"D"),o=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,r?-1:1,"D"),o=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&e.datepicker._adjustDate(t.target,t.ctrlKey?+e.datepicker._get(a,"stepBigMonths"):+e.datepicker._get(a,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&e.datepicker._adjustDate(t.target,7,"D"),o=t.ctrlKey||t.metaKey;break;default:o=!1}else 36===t.keyCode&&t.ctrlKey?e.datepicker._showDatepicker(this):o=!1;o&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(t){var i,s,n=e.datepicker._getInst(t.target);return e.datepicker._get(n,"constrainInput")?(i=e.datepicker._possibleChars(e.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0},_doKeyUp:function(t){var i,s=e.datepicker._getInst(t.target);if(s.input.val()!==s.lastVal)try{i=e.datepicker.parseDate(e.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,e.datepicker._getFormatConfig(s)),i&&(e.datepicker._setDateFromField(s),e.datepicker._updateAlternate(s),e.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(t){if(t=t.target||t,"input"!==t.nodeName.toLowerCase()&&(t=e("input",t.parentNode)[0]),!e.datepicker._isDisabledDatepicker(t)&&e.datepicker._lastInput!==t){var i,n,a,o,h,l,u;i=e.datepicker._getInst(t),e.datepicker._curInst&&e.datepicker._curInst!==i&&(e.datepicker._curInst.dpDiv.stop(!0,!0),i&&e.datepicker._datepickerShowing&&e.datepicker._hideDatepicker(e.datepicker._curInst.input[0])),n=e.datepicker._get(i,"beforeShow"),a=n?n.apply(t,[t,i]):{},a!==!1&&(r(i.settings,a),i.lastVal=null,e.datepicker._lastInput=t,e.datepicker._setDateFromField(i),e.datepicker._inDialog&&(t.value=""),e.datepicker._pos||(e.datepicker._pos=e.datepicker._findPos(t),e.datepicker._pos[1]+=t.offsetHeight),o=!1,e(t).parents().each(function(){return o|="fixed"===e(this).css("position"),!o}),h={left:e.datepicker._pos[0],top:e.datepicker._pos[1]},e.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),e.datepicker._updateDatepicker(i),h=e.datepicker._checkOffset(i,h,o),i.dpDiv.css({position:e.datepicker._inDialog&&e.blockUI?"static":o?"fixed":"absolute",display:"none",left:h.left+"px",top:h.top+"px"}),i.inline||(l=e.datepicker._get(i,"showAnim"),u=e.datepicker._get(i,"duration"),i.dpDiv.css("z-index",s(e(t))+1),e.datepicker._datepickerShowing=!0,e.effects&&e.effects.effect[l]?i.dpDiv.show(l,e.datepicker._get(i,"showOptions"),u):i.dpDiv[l||"show"](l?u:null),e.datepicker._shouldFocusInput(i)&&i.input.focus(),e.datepicker._curInst=i))}},_updateDatepicker:function(t){this.maxRows=4,v=t,t.dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t);var i,s=this._getNumberOfMonths(t),n=s[1],a=17,r=t.dpDiv.find("."+this._dayOverClass+" a");r.length>0&&o.apply(r.get(0)),t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&t.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",a*n+"em"),t.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===e.datepicker._curInst&&e.datepicker._datepickerShowing&&e.datepicker._shouldFocusInput(t)&&t.input.focus(),t.yearshtml&&(i=t.yearshtml,setTimeout(function(){i===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year:first").replaceWith(t.yearshtml),i=t.yearshtml=null},0))},_shouldFocusInput:function(e){return e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&!e.input.is(":focus")},_checkOffset:function(t,i,s){var n=t.dpDiv.outerWidth(),a=t.dpDiv.outerHeight(),o=t.input?t.input.outerWidth():0,r=t.input?t.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:e(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:e(document).scrollTop());return i.left-=this._get(t,"isRTL")?n-o:0,i.left-=s&&i.left===t.input.offset().left?e(document).scrollLeft():0,i.top-=s&&i.top===t.input.offset().top+r?e(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>h&&h>n?Math.abs(i.left+n-h):0),i.top-=Math.min(i.top,i.top+a>l&&l>a?Math.abs(a+r):0),i},_findPos:function(t){for(var i,s=this._getInst(t),n=this._get(s,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||e.expr.filters.hidden(t));)t=t[n?"previousSibling":"nextSibling"];return i=e(t).offset(),[i.left,i.top]},_hideDatepicker:function(t){var i,s,n,a,o=this._curInst;!o||t&&o!==e.data(t,"datepicker")||this._datepickerShowing&&(i=this._get(o,"showAnim"),s=this._get(o,"duration"),n=function(){e.datepicker._tidyDialog(o)},e.effects&&(e.effects.effect[i]||e.effects[i])?o.dpDiv.hide(i,e.datepicker._get(o,"showOptions"),s,n):o.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,a=this._get(o,"onClose"),a&&a.apply(o.input?o.input[0]:null,[o.input?o.input.val():"",o]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),e.blockUI&&(e.unblockUI(),e("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(t){if(e.datepicker._curInst){var i=e(t.target),s=e.datepicker._getInst(i[0]);(i[0].id!==e.datepicker._mainDivId&&0===i.parents("#"+e.datepicker._mainDivId).length&&!i.hasClass(e.datepicker.markerClassName)&&!i.closest("."+e.datepicker._triggerClass).length&&e.datepicker._datepickerShowing&&(!e.datepicker._inDialog||!e.blockUI)||i.hasClass(e.datepicker.markerClassName)&&e.datepicker._curInst!==s)&&e.datepicker._hideDatepicker()}},_adjustDate:function(t,i,s){var n=e(t),a=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(a,i+("M"===s?this._get(a,"showCurrentAtPos"):0),s),this._updateDatepicker(a))},_gotoToday:function(t){var i,s=e(t),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(t,i,s){var n=e(t),a=this._getInst(n[0]);a["selected"+("M"===s?"Month":"Year")]=a["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(a),this._adjustDate(n)},_selectDay:function(t,i,s,n){var a,o=e(t);e(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(o[0])||(a=this._getInst(o[0]),a.selectedDay=a.currentDay=e("a",n).html(),a.selectedMonth=a.currentMonth=i,a.selectedYear=a.currentYear=s,this._selectDate(t,this._formatDate(a,a.currentDay,a.currentMonth,a.currentYear)))},_clearDate:function(t){var i=e(t);this._selectDate(i,"")},_selectDate:function(t,i){var s,n=e(t),a=this._getInst(n[0]);i=null!=i?i:this._formatDate(a),a.input&&a.input.val(i),this._updateAlternate(a),s=this._get(a,"onSelect"),s?s.apply(a.input?a.input[0]:null,[i,a]):a.input&&a.input.trigger("change"),a.inline?this._updateDatepicker(a):(this._hideDatepicker(),this._lastInput=a.input[0],"object"!=typeof a.input[0]&&a.input.focus(),this._lastInput=null)},_updateAlternate:function(t){var i,s,n,a=this._get(t,"altField");a&&(i=this._get(t,"altFormat")||this._get(t,"dateFormat"),s=this._getDate(t),n=this.formatDate(i,s,this._getFormatConfig(t)),e(a).each(function(){e(this).val(n)}))},noWeekends:function(e){var t=e.getDay();return[t>0&&6>t,""]},iso8601Week:function(e){var t,i=new Date(e.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),t=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((t-i)/864e5)/7)+1},parseDate:function(t,i,s){if(null==t||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var n,a,o,r,h=0,l=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof l?l:(new Date).getFullYear()%100+parseInt(l,10),d=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,c=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,m=-1,g=-1,v=-1,y=-1,b=!1,_=function(e){var i=t.length>n+1&&t.charAt(n+1)===e;return i&&n++,i},x=function(e){var t=_(e),s="@"===e?14:"!"===e?20:"y"===e&&t?4:"o"===e?3:2,n="y"===e?s:1,a=RegExp("^\\d{"+n+","+s+"}"),o=i.substring(h).match(a);if(!o)throw"Missing number at position "+h;return h+=o[0].length,parseInt(o[0],10)},w=function(t,s,n){var a=-1,o=e.map(_(t)?n:s,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)});if(e.each(o,function(e,t){var s=t[1];return i.substr(h,s.length).toLowerCase()===s.toLowerCase()?(a=t[0],h+=s.length,!1):void 0}),-1!==a)return a+1;throw"Unknown name at position "+h},k=function(){if(i.charAt(h)!==t.charAt(n))throw"Unexpected literal at position "+h;h++};for(n=0;t.length>n;n++)if(b)"'"!==t.charAt(n)||_("'")?k():b=!1;else switch(t.charAt(n)){case"d":v=x("d");break;case"D":w("D",d,c);break;case"o":y=x("o");break;case"m":g=x("m");break;case"M":g=w("M",p,f);break;case"y":m=x("y");break;case"@":r=new Date(x("@")),m=r.getFullYear(),g=r.getMonth()+1,v=r.getDate();break;case"!":r=new Date((x("!")-this._ticksTo1970)/1e4),m=r.getFullYear(),g=r.getMonth()+1,v=r.getDate();break;case"'":_("'")?k():b=!0;break;default:k()}if(i.length>h&&(o=i.substr(h),!/^\s+/.test(o)))throw"Extra/unparsed characters found in date: "+o;if(-1===m?m=(new Date).getFullYear():100>m&&(m+=(new Date).getFullYear()-(new Date).getFullYear()%100+(u>=m?0:-100)),y>-1)for(g=1,v=y;;){if(a=this._getDaysInMonth(m,g-1),a>=v)break;g++,v-=a}if(r=this._daylightSavingAdjust(new Date(m,g-1,v)),r.getFullYear()!==m||r.getMonth()+1!==g||r.getDate()!==v)throw"Invalid date";return r},ATOM:"yy-mm-dd",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",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(e,t,i){if(!t)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,a=(i?i.dayNames:null)||this._defaults.dayNames,o=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,h=function(t){var i=e.length>s+1&&e.charAt(s+1)===t;return i&&s++,i},l=function(e,t,i){var s=""+t;if(h(e))for(;i>s.length;)s="0"+s;return s},u=function(e,t,i,s){return h(e)?s[t]:i[t]},d="",c=!1;if(t)for(s=0;e.length>s;s++)if(c)"'"!==e.charAt(s)||h("'")?d+=e.charAt(s):c=!1;else switch(e.charAt(s)){case"d":d+=l("d",t.getDate(),2);break;case"D":d+=u("D",t.getDay(),n,a);break;case"o":d+=l("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":d+=l("m",t.getMonth()+1,2);break;case"M":d+=u("M",t.getMonth(),o,r);break;case"y":d+=h("y")?t.getFullYear():(10>t.getYear()%100?"0":"")+t.getYear()%100;break;case"@":d+=t.getTime();break;case"!":d+=1e4*t.getTime()+this._ticksTo1970;break;case"'":h("'")?d+="'":c=!0;break;default:d+=e.charAt(s)}return d},_possibleChars:function(e){var t,i="",s=!1,n=function(i){var s=e.length>t+1&&e.charAt(t+1)===i;return s&&t++,s};for(t=0;e.length>t;t++)if(s)"'"!==e.charAt(t)||n("'")?i+=e.charAt(t):s=!1;else switch(e.charAt(t)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=e.charAt(t)}return i},_get:function(e,t){return void 0!==e.settings[t]?e.settings[t]:this._defaults[t]},_setDateFromField:function(e,t){if(e.input.val()!==e.lastVal){var i=this._get(e,"dateFormat"),s=e.lastVal=e.input?e.input.val():null,n=this._getDefaultDate(e),a=n,o=this._getFormatConfig(e);try{a=this.parseDate(i,s,o)||n}catch(r){s=t?"":s}e.selectedDay=a.getDate(),e.drawMonth=e.selectedMonth=a.getMonth(),e.drawYear=e.selectedYear=a.getFullYear(),e.currentDay=s?a.getDate():0,e.currentMonth=s?a.getMonth():0,e.currentYear=s?a.getFullYear():0,this._adjustInstDate(e)}},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(t,i,s){var n=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},a=function(i){try{return e.datepicker.parseDate(e.datepicker._get(t,"dateFormat"),i,e.datepicker._getFormatConfig(t))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?e.datepicker._getDate(t):null)||new Date,a=n.getFullYear(),o=n.getMonth(),r=n.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":r+=parseInt(l[1],10);break;case"w":case"W":r+=7*parseInt(l[1],10);break;case"m":case"M":o+=parseInt(l[1],10),r=Math.min(r,e.datepicker._getDaysInMonth(a,o));break;case"y":case"Y":a+=parseInt(l[1],10),r=Math.min(r,e.datepicker._getDaysInMonth(a,o))}l=h.exec(i)}return new Date(a,o,r)},o=null==i||""===i?s:"string"==typeof i?a(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return o=o&&"Invalid Date"==""+o?s:o,o&&(o.setHours(0),o.setMinutes(0),o.setSeconds(0),o.setMilliseconds(0)),this._daylightSavingAdjust(o)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,i){var s=!t,n=e.selectedMonth,a=e.selectedYear,o=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=o.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=o.getMonth(),e.drawYear=e.selectedYear=e.currentYear=o.getFullYear(),n===e.selectedMonth&&a===e.selectedYear||i||this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(s?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&""===e.input.val()?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(t){var i=this._get(t,"stepMonths"),s="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){e.datepicker._adjustDate(s,-i,"M")},next:function(){e.datepicker._adjustDate(s,+i,"M")},hide:function(){e.datepicker._hideDatepicker()},today:function(){e.datepicker._gotoToday(s)},selectDay:function(){return e.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return e.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return e.datepicker._selectMonthYear(s,this,"Y"),!1}};e(this).bind(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t,i,s,n,a,o,r,h,l,u,d,c,p,f,m,g,v,y,b,_,x,w,k,T,D,S,M,C,N,A,P,I,z,H,F,E,O,j,W,L=new Date,R=this._daylightSavingAdjust(new Date(L.getFullYear(),L.getMonth(),L.getDate())),Y=this._get(e,"isRTL"),B=this._get(e,"showButtonPanel"),J=this._get(e,"hideIfNoPrevNext"),q=this._get(e,"navigationAsDateFormat"),K=this._getNumberOfMonths(e),V=this._get(e,"showCurrentAtPos"),U=this._get(e,"stepMonths"),Q=1!==K[0]||1!==K[1],G=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),X=this._getMinMaxDate(e,"min"),$=this._getMinMaxDate(e,"max"),Z=e.drawMonth-V,et=e.drawYear;if(0>Z&&(Z+=12,et--),$)for(t=this._daylightSavingAdjust(new Date($.getFullYear(),$.getMonth()-K[0]*K[1]+1,$.getDate())),t=X&&X>t?X:t;this._daylightSavingAdjust(new Date(et,Z,1))>t;)Z--,0>Z&&(Z=11,et--);for(e.drawMonth=Z,e.drawYear=et,i=this._get(e,"prevText"),i=q?this.formatDate(i,this._daylightSavingAdjust(new Date(et,Z-U,1)),this._getFormatConfig(e)):i,s=this._canAdjustMonth(e,-1,et,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>":J?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"e":"w")+"'>"+i+"</span></a>",n=this._get(e,"nextText"),n=q?this.formatDate(n,this._daylightSavingAdjust(new Date(et,Z+U,1)),this._getFormatConfig(e)):n,a=this._canAdjustMonth(e,1,et,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>":J?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(Y?"w":"e")+"'>"+n+"</span></a>",o=this._get(e,"currentText"),r=this._get(e,"gotoCurrent")&&e.currentDay?G:R,o=q?this.formatDate(o,r,this._getFormatConfig(e)):o,h=e.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(e,"closeText")+"</button>",l=B?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(Y?h:"")+(this._isInRange(e,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+o+"</button>":"")+(Y?"":h)+"</div>":"",u=parseInt(this._get(e,"firstDay"),10),u=isNaN(u)?0:u,d=this._get(e,"showWeek"),c=this._get(e,"dayNames"),p=this._get(e,"dayNamesMin"),f=this._get(e,"monthNames"),m=this._get(e,"monthNamesShort"),g=this._get(e,"beforeShowDay"),v=this._get(e,"showOtherMonths"),y=this._get(e,"selectOtherMonths"),b=this._getDefaultDate(e),_="",w=0;K[0]>w;w++){for(k="",this.maxRows=4,T=0;K[1]>T;T++){if(D=this._daylightSavingAdjust(new Date(et,Z,e.selectedDay)),S=" ui-corner-all",M="",Q){if(M+="<div class='ui-datepicker-group",K[1]>1)switch(T){case 0:M+=" ui-datepicker-group-first",S=" ui-corner-"+(Y?"right":"left");break;case K[1]-1:M+=" ui-datepicker-group-last",S=" ui-corner-"+(Y?"left":"right");break;default:M+=" ui-datepicker-group-middle",S=""}M+="'>"}for(M+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+S+"'>"+(/all|left/.test(S)&&0===w?Y?a:s:"")+(/all|right/.test(S)&&0===w?Y?s:a:"")+this._generateMonthYearHeader(e,Z,et,X,$,w>0||T>0,f,m)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",C=d?"<th class='ui-datepicker-week-col'>"+this._get(e,"weekHeader")+"</th>":"",x=0;7>x;x++)N=(x+u)%7,C+="<th scope='col'"+((x+u+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+c[N]+"'>"+p[N]+"</span></th>";for(M+=C+"</tr></thead><tbody>",A=this._getDaysInMonth(et,Z),et===e.selectedYear&&Z===e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,A)),P=(this._getFirstDayOfMonth(et,Z)-u+7)%7,I=Math.ceil((P+A)/7),z=Q?this.maxRows>I?this.maxRows:I:I,this.maxRows=z,H=this._daylightSavingAdjust(new Date(et,Z,1-P)),F=0;z>F;F++){for(M+="<tr>",E=d?"<td class='ui-datepicker-week-col'>"+this._get(e,"calculateWeek")(H)+"</td>":"",x=0;7>x;x++)O=g?g.apply(e.input?e.input[0]:null,[H]):[!0,""],j=H.getMonth()!==Z,W=j&&!y||!O[0]||X&&X>H||$&&H>$,E+="<td class='"+((x+u+6)%7>=5?" ui-datepicker-week-end":"")+(j?" ui-datepicker-other-month":"")+(H.getTime()===D.getTime()&&Z===e.selectedMonth&&e._keyEvent||b.getTime()===H.getTime()&&b.getTime()===D.getTime()?" "+this._dayOverClass:"")+(W?" "+this._unselectableClass+" ui-state-disabled":"")+(j&&!v?"":" "+O[1]+(H.getTime()===G.getTime()?" "+this._currentClass:"")+(H.getTime()===R.getTime()?" ui-datepicker-today":""))+"'"+(j&&!v||!O[2]?"":" title='"+O[2].replace(/'/g,"'")+"'")+(W?"":" data-handler='selectDay' data-event='click' data-month='"+H.getMonth()+"' data-year='"+H.getFullYear()+"'")+">"+(j&&!v?" ":W?"<span class='ui-state-default'>"+H.getDate()+"</span>":"<a class='ui-state-default"+(H.getTime()===R.getTime()?" ui-state-highlight":"")+(H.getTime()===G.getTime()?" ui-state-active":"")+(j?" ui-priority-secondary":"")+"' href='#'>"+H.getDate()+"</a>")+"</td>",H.setDate(H.getDate()+1),H=this._daylightSavingAdjust(H);M+=E+"</tr>"}Z++,Z>11&&(Z=0,et++),M+="</tbody></table>"+(Q?"</div>"+(K[0]>0&&T===K[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),k+=M}_+=k}return _+=l,e._keyEvent=!1,_},_generateMonthYearHeader:function(e,t,i,s,n,a,o,r){var h,l,u,d,c,p,f,m,g=this._get(e,"changeMonth"),v=this._get(e,"changeYear"),y=this._get(e,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",_="";if(a||!g)_+="<span class='ui-datepicker-month'>"+o[t]+"</span>";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,_+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",u=0;12>u;u++)(!h||u>=s.getMonth())&&(!l||n.getMonth()>=u)&&(_+="<option value='"+u+"'"+(u===t?" selected='selected'":"")+">"+r[u]+"</option>");_+="</select>"}if(y||(b+=_+(!a&&g&&v?"":" ")),!e.yearshtml)if(e.yearshtml="",a||!v)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(d=this._get(e,"yearRange").split(":"),c=(new Date).getFullYear(),p=function(e){var t=e.match(/c[+\-].*/)?i+parseInt(e.substring(1),10):e.match(/[+\-].*/)?c+parseInt(e,10):parseInt(e,10);return isNaN(t)?c:t},f=p(d[0]),m=Math.max(f,p(d[1]||"")),f=s?Math.max(f,s.getFullYear()):f,m=n?Math.min(m,n.getFullYear()):m,e.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";m>=f;f++)e.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";e.yearshtml+="</select>",b+=e.yearshtml,e.yearshtml=null}return b+=this._get(e,"yearSuffix"),y&&(b+=(!a&&g&&v?"":" ")+_),b+="</div>"},_adjustInstDate:function(e,t,i){var s=e.drawYear+("Y"===i?t:0),n=e.drawMonth+("M"===i?t:0),a=Math.min(e.selectedDay,this._getDaysInMonth(s,n))+("D"===i?t:0),o=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(s,n,a)));e.selectedDay=o.getDate(),e.drawMonth=e.selectedMonth=o.getMonth(),e.drawYear=e.selectedYear=o.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(e)},_restrictMinMax:function(e,t){var i=this._getMinMaxDate(e,"min"),s=this._getMinMaxDate(e,"max"),n=i&&i>t?i:t;return s&&n>s?s:n},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return new Date(e,t,1).getDay()},_canAdjustMonth:function(e,t,i,s){var n=this._getNumberOfMonths(e),a=this._daylightSavingAdjust(new Date(i,s+(0>t?t:n[0]*n[1]),1));return 0>t&&a.setDate(this._getDaysInMonth(a.getFullYear(),a.getMonth())),this._isInRange(e,a)},_isInRange:function(e,t){var i,s,n=this._getMinMaxDate(e,"min"),a=this._getMinMaxDate(e,"max"),o=null,r=null,h=this._get(e,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),o=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(o+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||t.getTime()>=n.getTime())&&(!a||t.getTime()<=a.getTime())&&(!o||t.getFullYear()>=o)&&(!r||r>=t.getFullYear())},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t="string"!=typeof t?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,i,s){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var n=t?"object"==typeof t?t:this._daylightSavingAdjust(new Date(s,i,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),n,this._getFormatConfig(e))}}),e.fn.datepicker=function(t){if(!this.length)return this;e.datepicker.initialized||(e(document).mousedown(e.datepicker._checkExternalClick),e.datepicker.initialized=!0),0===e("#"+e.datepicker._mainDivId).length&&e("body").append(e.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof t||"isDisabled"!==t&&"getDate"!==t&&"widget"!==t?"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof t?e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this].concat(i)):e.datepicker._attachDatepicker(this,t)}):e.datepicker["_"+t+"Datepicker"].apply(e.datepicker,[this[0]].concat(i))},e.datepicker=new n,e.datepicker.initialized=!1,e.datepicker.uuid=(new Date).getTime(),e.datepicker.version="1.11.2",e.datepicker,e.widget("ui.dialog",{version:"1.11.2",options:{appendTo:"body",autoOpen:!0,buttons:[],closeOnEscape:!0,closeText:"Close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var i=e(this).css(t).offset().top;0>i&&e(this).css("top",t.top-i)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_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(),this.options.draggable&&e.fn.draggable&&this._makeDraggable(),this.options.resizable&&e.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?e(t):this.document.find(t||"body").eq(0)},_destroy:function(){var e,t=this.originalPosition;this._destroyOverlay(),this.element.removeUniqueId().removeClass("ui-dialog-content ui-widget-content").css(this.originalCss).detach(),this.uiDialog.stop(!0,!0).remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},disable:e.noop,enable:e.noop,close:function(t){var i,s=this;if(this._isOpen&&this._trigger("beforeClose",t)!==!1){if(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),!this.opener.filter(":focusable").focus().length)try{i=this.document[0].activeElement,i&&"body"!==i.nodeName.toLowerCase()&&e(i).blur()}catch(n){}this._hide(this.uiDialog,this.options.hide,function(){s._trigger("close",t)})}},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,i){var s=!1,n=this.uiDialog.siblings(".ui-front:visible").map(function(){return+e(this).css("z-index")}).get(),a=Math.max.apply(null,n);return a>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",a+1),s=!0),s&&!i&&this._trigger("focus",t),s},open:function(){var t=this;return this._isOpen?(this._moveToTop()&&this._focusTabbable(),void 0):(this._isOpen=!0,this.opener=e(this.document[0].activeElement),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"),void 0)},_focusTabbable:function(){var e=this._focusedElement;
e||(e=this.element.find("[autofocus]")),e.length||(e=this.element.find(":tabbable")),e.length||(e=this.uiDialogButtonPane.find(":tabbable")),e.length||(e=this.uiDialogTitlebarClose.filter(":tabbable")),e.length||(e=this.uiDialog),e.eq(0).focus()},_keepFocus:function(t){function i(){var t=this.document[0].activeElement,i=this.uiDialog[0]===t||e.contains(this.uiDialog[0],t);i||this._focusTabbable()}t.preventDefault(),i.call(this),this._delay(i)},_createWrapper:function(){this.uiDialog=e("<div>").addClass("ui-dialog ui-widget ui-widget-content ui-corner-all ui-front "+this.options.dialogClass).hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===e.ui.keyCode.ESCAPE)return t.preventDefault(),this.close(t),void 0;if(t.keyCode===e.ui.keyCode.TAB&&!t.isDefaultPrevented()){var i=this.uiDialog.find(":tabbable"),s=i.filter(":first"),n=i.filter(":last");t.target!==n[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==s[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(this._delay(function(){n.focus()}),t.preventDefault()):(this._delay(function(){s.focus()}),t.preventDefault())}},mousedown:function(e){this._moveToTop(e)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=e("<div>").addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(this.uiDialog),this._on(this.uiDialogTitlebar,{mousedown:function(t){e(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.focus()}}),this.uiDialogTitlebarClose=e("<button type='button'></button>").button({label:this.options.closeText,icons:{primary:"ui-icon-closethick"},text:!1}).addClass("ui-dialog-titlebar-close").appendTo(this.uiDialogTitlebar),this._on(this.uiDialogTitlebarClose,{click:function(e){e.preventDefault(),this.close(e)}}),t=e("<span>").uniqueId().addClass("ui-dialog-title").prependTo(this.uiDialogTitlebar),this._title(t),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(e){this.options.title||e.html(" "),e.text(this.options.title)},_createButtonPane:function(){this.uiDialogButtonPane=e("<div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),this.uiButtonSet=e("<div>").addClass("ui-dialog-buttonset").appendTo(this.uiDialogButtonPane),this._createButtons()},_createButtons:function(){var t=this,i=this.options.buttons;return this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),e.isEmptyObject(i)||e.isArray(i)&&!i.length?(this.uiDialog.removeClass("ui-dialog-buttons"),void 0):(e.each(i,function(i,s){var n,a;s=e.isFunction(s)?{click:s,text:i}:s,s=e.extend({type:"button"},s),n=s.click,s.click=function(){n.apply(t.element[0],arguments)},a={icons:s.icons,text:s.showText},delete s.icons,delete s.showText,e("<button></button>",s).button(a).appendTo(t.uiButtonSet)}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog),void 0)},_makeDraggable:function(){function t(e){return{position:e.position,offset:e.offset}}var i=this,s=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(s,n){e(this).addClass("ui-dialog-dragging"),i._blockFrames(),i._trigger("dragStart",s,t(n))},drag:function(e,s){i._trigger("drag",e,t(s))},stop:function(n,a){var o=a.offset.left-i.document.scrollLeft(),r=a.offset.top-i.document.scrollTop();s.position={my:"left top",at:"left"+(o>=0?"+":"")+o+" "+"top"+(r>=0?"+":"")+r,of:i.window},e(this).removeClass("ui-dialog-dragging"),i._unblockFrames(),i._trigger("dragStop",n,t(a))}})},_makeResizable:function(){function t(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}var i=this,s=this.options,n=s.resizable,a=this.uiDialog.css("position"),o="string"==typeof n?n:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:s.maxWidth,maxHeight:s.maxHeight,minWidth:s.minWidth,minHeight:this._minHeight(),handles:o,start:function(s,n){e(this).addClass("ui-dialog-resizing"),i._blockFrames(),i._trigger("resizeStart",s,t(n))},resize:function(e,s){i._trigger("resize",e,t(s))},stop:function(n,a){var o=i.uiDialog.offset(),r=o.left-i.document.scrollLeft(),h=o.top-i.document.scrollTop();s.height=i.uiDialog.height(),s.width=i.uiDialog.width(),s.position={my:"left top",at:"left"+(r>=0?"+":"")+r+" "+"top"+(h>=0?"+":"")+h,of:i.window},e(this).removeClass("ui-dialog-resizing"),i._unblockFrames(),i._trigger("resizeStop",n,t(a))}}).css("position",a)},_trackFocus:function(){this._on(this.widget(),{focusin:function(t){this._makeFocusTarget(),this._focusedElement=e(t.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var t=this._trackingInstances(),i=e.inArray(this,t);-1!==i&&t.splice(i,1)},_trackingInstances:function(){var e=this.document.data("ui-dialog-instances");return e||(e=[],this.document.data("ui-dialog-instances",e)),e},_minHeight:function(){var e=this.options;return"auto"===e.height?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(){var e=this.uiDialog.is(":visible");e||this.uiDialog.show(),this.uiDialog.position(this.options.position),e||this.uiDialog.hide()},_setOptions:function(t){var i=this,s=!1,n={};e.each(t,function(e,t){i._setOption(e,t),e in i.sizeRelatedOptions&&(s=!0),e in i.resizableRelatedOptions&&(n[e]=t)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(e,t){var i,s,n=this.uiDialog;"dialogClass"===e&&n.removeClass(this.options.dialogClass).addClass(t),"disabled"!==e&&(this._super(e,t),"appendTo"===e&&this.uiDialog.appendTo(this._appendTo()),"buttons"===e&&this._createButtons(),"closeText"===e&&this.uiDialogTitlebarClose.button({label:""+t}),"draggable"===e&&(i=n.is(":data(ui-draggable)"),i&&!t&&n.draggable("destroy"),!i&&t&&this._makeDraggable()),"position"===e&&this._position(),"resizable"===e&&(s=n.is(":data(ui-resizable)"),s&&!t&&n.resizable("destroy"),s&&"string"==typeof t&&n.resizable("option","handles",t),s||t===!1||this._makeResizable()),"title"===e&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var e,t,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),e=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),t=Math.max(0,s.minHeight-e),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-e):"none","auto"===s.height?this.element.css({minHeight:t,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-e)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=e(this);return e("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return e(t.target).closest(".ui-dialog").length?!0:!!e(t.target).closest(".ui-datepicker").length},_createOverlay:function(){if(this.options.modal){var t=!0;this._delay(function(){t=!1}),this.document.data("ui-dialog-overlays")||this._on(this.document,{focusin:function(e){t||this._allowInteraction(e)||(e.preventDefault(),this._trackingInstances()[0]._focusTabbable())}}),this.overlay=e("<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&&this.overlay){var e=this.document.data("ui-dialog-overlays")-1;e?this.document.data("ui-dialog-overlays",e):this.document.unbind("focusin").removeData("ui-dialog-overlays"),this.overlay.remove(),this.overlay=null}}}),e.widget("ui.progressbar",{version:"1.11.2",options:{max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min}),this.valueDiv=e("<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(e){return void 0===e?this.options.value:(this.options.value=this._constrainedValue(e),this._refreshValue(),void 0)},_constrainedValue:function(e){return void 0===e&&(e=this.options.value),this.indeterminate=e===!1,"number"!=typeof e&&(e=0),this.indeterminate?!1:Math.min(this.options.max,Math.max(this.min,e))},_setOptions:function(e){var t=e.value;delete e.value,this._super(e),this.options.value=this._constrainedValue(t),this._refreshValue()},_setOption:function(e,t){"max"===e&&(t=Math.max(this.min,t)),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,i=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).toggleClass("ui-corner-right",t===this.options.max).width(i.toFixed(0)+"%"),this.element.toggleClass("ui-progressbar-indeterminate",this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=e("<div class='ui-progressbar-overlay'></div>").appendTo(this.valueDiv))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}}),e.widget("ui.selectmenu",{version:"1.11.2",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,change:null,close:null,focus:null,open:null,select:null},_create:function(){var e=this.element.uniqueId().attr("id");this.ids={element:e,button:e+"-button",menu:e+"-menu"},this._drawButton(),this._drawMenu(),this.options.disabled&&this.disable()},_drawButton:function(){var t=this,i=this.element.attr("tabindex");this.label=e("label[for='"+this.ids.element+"']").attr("for",this.ids.button),this._on(this.label,{click:function(e){this.button.focus(),e.preventDefault()}}),this.element.hide(),this.button=e("<span>",{"class":"ui-selectmenu-button ui-widget ui-state-default ui-corner-all",tabindex:i||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),e("<span>",{"class":"ui-icon "+this.options.icons.button}).prependTo(this.button),this.buttonText=e("<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(){t.menuItems||t._refreshMenu()}),this._hoverable(this.button),this._focusable(this.button)},_drawMenu:function(){var t=this;this.menu=e("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=e("<div>",{"class":"ui-selectmenu-menu ui-front"}).append(this.menu).appendTo(this._appendTo()),this.menuInstance=this.menu.menu({role:"listbox",select:function(e,i){e.preventDefault(),t._setSelection(),t._select(i.item.data("ui-selectmenu-item"),e)},focus:function(e,i){var s=i.item.data("ui-selectmenu-item");null!=t.focusIndex&&s.index!==t.focusIndex&&(t._trigger("focus",e,{item:s}),t.isOpen||t._select(s,e)),t.focusIndex=s.index,t.button.attr("aria-activedescendant",t.menuItems.eq(s.index).attr("id"))}}).menu("instance"),this.menu.addClass("ui-corner-bottom").removeClass("ui-corner-all"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this._setText(this.buttonText,this._getSelectedItem().text()),this.options.width||this._resizeButton()},_refreshMenu:function(){this.menu.empty();var e,t=this.element.find("option");t.length&&(this._parseOptions(t),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup"),e=this._getSelectedItem(),this.menuInstance.focus(null,e),this._setAria(e.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(e){this.options.disabled||(this.menuItems?(this.menu.find(".ui-state-focus").removeClass("ui-state-focus"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",e))},_position:function(){this.menuWrap.position(e.extend({of:this.button},this.options.position))},close:function(e){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",e))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderMenu:function(t,i){var s=this,n="";e.each(i,function(i,a){a.optgroup!==n&&(e("<li>",{"class":"ui-selectmenu-optgroup ui-menu-divider"+(a.element.parent("optgroup").prop("disabled")?" ui-state-disabled":""),text:a.optgroup}).appendTo(t),n=a.optgroup),s._renderItemData(t,a)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-selectmenu-item",t)},_renderItem:function(t,i){var s=e("<li>");return i.disabled&&s.addClass("ui-state-disabled"),this._setText(s,i.label),s.appendTo(t)},_setText:function(e,t){t?e.text(t):e.html(" ")},_move:function(e,t){var i,s,n=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex):(i=this.menuItems.eq(this.element[0].selectedIndex),n+=":not(.ui-state-disabled)"),s="first"===e||"last"===e?i["first"===e?"prevAll":"nextAll"](n).eq(-1):i[e+"All"](n).eq(0),s.length&&this.menuInstance.focus(t,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex)},_toggle:function(e){this[this.isOpen?"close":"open"](e)},_setSelection:function(){var e;this.range&&(window.getSelection?(e=window.getSelection(),e.removeAllRanges(),e.addRange(this.range)):this.range.select(),this.button.focus())},_documentClick:{mousedown:function(t){this.isOpen&&(e(t.target).closest(".ui-selectmenu-menu, #"+this.ids.button).length||this.close(t))}},_buttonEvents:{mousedown:function(){var e;window.getSelection?(e=window.getSelection(),e.rangeCount&&(this.range=e.getRangeAt(0))):this.range=document.selection.createRange()},click:function(e){this._setSelection(),this._toggle(e)},keydown:function(t){var i=!0;switch(t.keyCode){case e.ui.keyCode.TAB:case e.ui.keyCode.ESCAPE:this.close(t),i=!1;break;case e.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(t);break;case e.ui.keyCode.UP:t.altKey?this._toggle(t):this._move("prev",t);break;case e.ui.keyCode.DOWN:t.altKey?this._toggle(t):this._move("next",t);break;case e.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(t):this._toggle(t);break;case e.ui.keyCode.LEFT:this._move("prev",t);break;case e.ui.keyCode.RIGHT:this._move("next",t);break;case e.ui.keyCode.HOME:case e.ui.keyCode.PAGE_UP:this._move("first",t);break;case e.ui.keyCode.END:case e.ui.keyCode.PAGE_DOWN:this._move("last",t);break;default:this.menu.trigger(t),i=!1}i&&t.preventDefault()}},_selectFocusedItem:function(e){var t=this.menuItems.eq(this.focusIndex);t.hasClass("ui-state-disabled")||this._select(t.data("ui-selectmenu-item"),e)},_select:function(e,t){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=e.index,this._setText(this.buttonText,e.label),this._setAria(e),this._trigger("select",t,{item:e}),e.index!==i&&this._trigger("change",t,{item:e}),this.close(t)},_setAria:function(e){var t=this.menuItems.eq(e.index).attr("id");this.button.attr({"aria-labelledby":t,"aria-activedescendant":t}),this.menu.attr("aria-activedescendant",t)},_setOption:function(e,t){"icons"===e&&this.button.find("span.ui-icon").removeClass(this.options.icons.button).addClass(t.button),this._super(e,t),"appendTo"===e&&this.menuWrap.appendTo(this._appendTo()),"disabled"===e&&(this.menuInstance.option("disabled",t),this.button.toggleClass("ui-state-disabled",t).attr("aria-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)),"width"===e&&this._resizeButton()},_appendTo:function(){var t=this.options.appendTo;return t&&(t=t.jquery||t.nodeType?e(t):this.document.find(t).eq(0)),t&&t[0]||(t=this.element.closest(".ui-front")),t.length||(t=this.document[0].body),t},_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 e=this.options.width;e||(e=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(e)},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){return{disabled:this.element.prop("disabled")}},_parseOptions:function(t){var i=[];t.each(function(t,s){var n=e(s),a=n.parent("optgroup");i.push({element:n,index:t,value:n.attr("value"),label:n.text(),optgroup:a.attr("label")||"",disabled:a.prop("disabled")||n.prop("disabled")})}),this.items=i},_destroy:function(){this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.label.attr("for",this.ids.element)}}),e.widget("ui.slider",e.ui.mouse,{version:"1.11.2",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),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=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,i,s=this.options,n=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),a="<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",o=[];for(i=s.values&&s.values.length||1,n.length>i&&(n.slice(i).remove(),n=n.slice(0,i)),t=n.length;i>t;t++)o.push(a);this.handles=n.add(e(o.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(t){e(this).data("ui-slider-handle-index",t)})},_createRange:function(){var t=this.options,i="";t.range?(t.range===!0&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:e.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=e("<div></div>").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===t.range||"max"===t.range?" ui-slider-range-"+t.range:""))):(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(),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(t){var i,s,n,a,o,r,h,l,u=this,d=this.options;return d.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:t.pageX,y:t.pageY},s=this._normValueFromMouse(i),n=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var i=Math.abs(s-u.values(t));(n>i||n===i&&(t===u._lastChangedValue||u.values(t)===d.min))&&(n=i,a=e(this),o=t)}),r=this._start(t,o),r===!1?!1:(this._mouseSliding=!0,this._handleIndex=o,a.addClass("ui-state-active").focus(),h=a.offset(),l=!e(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=l?{left:0,top:0}:{left:t.pageX-h.left-a.width()/2,top:t.pageY-h.top-a.height()/2-(parseInt(a.css("borderTopWidth"),10)||0)-(parseInt(a.css("borderBottomWidth"),10)||0)+(parseInt(a.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,o,s),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,i),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,i,s,n,a;return"horizontal"===this.orientation?(t=this.elementSize.width,i=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,i=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),s=i/t,s>1&&(s=1),0>s&&(s=0),"vertical"===this.orientation&&(s=1-s),n=this._valueMax()-this._valueMin(),a=this._valueMin()+s*n,this._trimAlignValue(a)},_start:function(e,t){var i={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("start",e,i)},_slide:function(e,t,i){var s,n,a;this.options.values&&this.options.values.length?(s=this.values(t?0:1),2===this.options.values.length&&this.options.range===!0&&(0===t&&i>s||1===t&&s>i)&&(i=s),i!==this.values(t)&&(n=this.values(),n[t]=i,a=this._trigger("slide",e,{handle:this.handles[t],value:i,values:n}),s=this.values(t?0:1),a!==!1&&this.values(t,i))):i!==this.value()&&(a=this._trigger("slide",e,{handle:this.handles[t],value:i}),a!==!1&&this.value(i))},_stop:function(e,t){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._trigger("stop",e,i)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(t),i.values=this.values()),this._lastChangedValue=t,this._trigger("change",e,i)}},value:function(e){return arguments.length?(this.options.value=this._trimAlignValue(e),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(t,i){var s,n,a;if(arguments.length>1)return this.options.values[t]=this._trimAlignValue(i),this._refreshValue(),this._change(null,t),void 0;if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();for(s=this.options.values,n=arguments[0],a=0;s.length>a;a+=1)s[a]=this._trimAlignValue(n[a]),this._change(null,a);this._refreshValue()},_setOption:function(t,i){var s,n=0;switch("range"===t&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),e.isArray(this.options.values)&&(n=this.options.values.length),"disabled"===t&&this.element.toggleClass("ui-state-disabled",!!i),this._super(t,i),t){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue(),this.handles.css("horizontal"===i?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),s=0;n>s;s+=1)this._change(null,s);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var e=this.options.value;return e=this._trimAlignValue(e)},_values:function(e){var t,i,s;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),s=0;i.length>s;s+=1)i[s]=this._trimAlignValue(i[s]);return i}return[]},_trimAlignValue:function(e){if(this._valueMin()>=e)return this._valueMin();if(e>=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,i=(e-this._valueMin())%t,s=e-i;return 2*Math.abs(i)>=t&&(s+=i>0?t:-t),parseFloat(s.toFixed(5))},_calculateNewMax:function(){var e=(this.options.max-this._valueMin())%this.options.step;this.max=this.options.max-e},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshValue:function(){var t,i,s,n,a,o=this.options.range,r=this.options,h=this,l=this._animateOff?!1:r.animate,u={};this.options.values&&this.options.values.length?this.handles.each(function(s){i=100*((h.values(s)-h._valueMin())/(h._valueMax()-h._valueMin())),u["horizontal"===h.orientation?"left":"bottom"]=i+"%",e(this).stop(1,1)[l?"animate":"css"](u,r.animate),h.options.range===!0&&("horizontal"===h.orientation?(0===s&&h.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:r.animate})):(0===s&&h.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},r.animate),1===s&&h.range[l?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:r.animate}))),t=i}):(s=this.value(),n=this._valueMin(),a=this._valueMax(),i=a!==n?100*((s-n)/(a-n)):0,u["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](u,r.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},r.animate),"max"===o&&"horizontal"===this.orientation&&this.range[l?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:r.animate}),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},r.animate),"max"===o&&"vertical"===this.orientation&&this.range[l?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:r.animate}))},_handleEvents:{keydown:function(t){var i,s,n,a,o=e(t.target).data("ui-slider-handle-index");switch(t.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(t.preventDefault(),!this._keySliding&&(this._keySliding=!0,e(t.target).addClass("ui-state-active"),i=this._start(t,o),i===!1))return}switch(a=this.options.step,s=n=this.options.values&&this.options.values.length?this.values(o):this.value(),t.keyCode){case e.ui.keyCode.HOME:n=this._valueMin();break;case e.ui.keyCode.END:n=this._valueMax();break;case e.ui.keyCode.PAGE_UP:n=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.PAGE_DOWN:n=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/this.numPages);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(s===this._valueMax())return;n=this._trimAlignValue(s+a);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(s===this._valueMin())return;n=this._trimAlignValue(s-a)}this._slide(t,o,n)},keyup:function(t){var i=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,i),this._change(t,i),e(t.target).removeClass("ui-state-active"))}}}),e.widget("ui.spinner",{version:"1.11.2",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var t={},i=this.element;return e.each(["min","max","step"],function(e,s){var n=i.attr(s);void 0!==n&&n.length&&(t[s]=n)}),t},_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(e){return this.cancelBlur?(delete this.cancelBlur,void 0):(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",e),void 0)},mousewheel:function(e,t){if(t){if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(e)},100),e.preventDefault()}},"mousedown .ui-spinner-button":function(t){function i(){var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus(),this.previous=s,this._delay(function(){this.previous=s}))}var s;s=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),this._start(t)!==!1&&this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){return e(t.currentTarget).hasClass("ui-state-active")?this._start(t)===!1?!1:(this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t),void 0):void 0},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(.5*e.height())&&e.height()>0&&e.height(e.height()),this.options.disabled&&this.disable()},_keydown:function(t){var i=this.options,s=e.ui.keyCode;switch(t.keyCode){case s.UP:return this._repeat(null,1,t),!0;case s.DOWN:return this._repeat(null,-1,t),!0;case s.PAGE_UP:return this._repeat(null,i.page,t),!0;case s.PAGE_DOWN:return this._repeat(null,-i.page,t),!0}return!1},_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+"'>▲</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>▼</span>"+"</a>"
},_start:function(e){return this.spinning||this._trigger("start",e)!==!1?(this.counter||(this.counter=1),this.spinning=!0,!0):!1},_repeat:function(e,t,i){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,i)},e),this._spin(t*this.options.step,i)},_spin:function(e,t){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+e*this._increment(this.counter)),this.spinning&&this._trigger("spin",t,{value:i})===!1||(this._value(i),this.counter++)},_increment:function(t){var i=this.options.incremental;return i?e.isFunction(i)?i(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var e=this._precisionOf(this.options.step);return null!==this.options.min&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=""+e,i=t.indexOf(".");return-1===i?0:t.length-i-1},_adjustValue:function(e){var t,i,s=this.options;return t=null!==s.min?s.min:0,i=e-t,i=Math.round(i/s.step)*s.step,e=t+i,e=parseFloat(e.toFixed(this._precision())),null!==s.max&&e>s.max?s.max:null!==s.min&&s.min>e?s.min:e},_stop:function(e){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",e))},_setOption:function(e,t){if("culture"===e||"numberFormat"===e){var i=this._parse(this.element.val());return this.options[e]=t,this.element.val(this._format(i)),void 0}("max"===e||"min"===e||"step"===e)&&"string"==typeof t&&(t=this._parse(t)),"icons"===e&&(this.buttons.first().find(".ui-icon").removeClass(this.options.icons.up).addClass(t.up),this.buttons.last().find(".ui-icon").removeClass(this.options.icons.down).addClass(t.down)),this._super(e,t),"disabled"===e&&(this.widget().toggleClass("ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable"))},_setOptions:h(function(e){this._super(e)}),_parse:function(e){return"string"==typeof e&&""!==e&&(e=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(e,10,this.options.culture):+e),""===e||isNaN(e)?null:e},_format:function(e){return""===e?"":window.Globalize&&this.options.numberFormat?Globalize.format(e,this.options.numberFormat,this.options.culture):e},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var e=this.value();return null===e?!1:e===this._adjustValue(e)},_value:function(e,t){var i;""!==e&&(i=this._parse(e),null!==i&&(t||(i=this._adjustValue(i)),e=this._format(i))),this.element.val(e),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:h(function(e){this._stepUp(e)}),_stepUp:function(e){this._start()&&(this._spin((e||1)*this.options.step),this._stop())},stepDown:h(function(e){this._stepDown(e)}),_stepDown:function(e){this._start()&&(this._spin((e||1)*-this.options.step),this._stop())},pageUp:h(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:h(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){return arguments.length?(h(this._value).call(this,e),void 0):this._parse(this.element.val())},widget:function(){return this.uiSpinner}}),e.widget("ui.tabs",{version:"1.11.2",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var e=/#.*$/;return function(t){var i,s;t=t.cloneNode(!1),i=t.href.replace(e,""),s=location.href.replace(e,"");try{i=decodeURIComponent(i)}catch(n){}try{s=decodeURIComponent(s)}catch(n){}return t.hash.length>1&&i===s}}(),_create:function(){var t=this,i=this.options;this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",i.collapsible),this._processTabs(),i.active=this._initialActive(),e.isArray(i.disabled)&&(i.disabled=e.unique(i.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.active=this.options.active!==!1&&this.anchors.length?this._findActive(i.active):e(),this._refresh(),this.active.length&&this.load(i.active)},_initialActive:function(){var t=this.options.active,i=this.options.collapsible,s=location.hash.substring(1);return null===t&&(s&&this.tabs.each(function(i,n){return e(n).attr("aria-controls")===s?(t=i,!1):void 0}),null===t&&(t=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),(null===t||-1===t)&&(t=this.tabs.length?0:!1)),t!==!1&&(t=this.tabs.index(this.tabs.eq(t)),-1===t&&(t=i?!1:0)),!i&&t===!1&&this.anchors.length&&(t=0),t},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(t){var i=e(this.document[0].activeElement).closest("li"),s=this.tabs.index(i),n=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:s++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:n=!1,s--;break;case e.ui.keyCode.END:s=this.anchors.length-1;break;case e.ui.keyCode.HOME:s=0;break;case e.ui.keyCode.SPACE:return t.preventDefault(),clearTimeout(this.activating),this._activate(s),void 0;case e.ui.keyCode.ENTER:return t.preventDefault(),clearTimeout(this.activating),this._activate(s===this.options.active?!1:s),void 0;default:return}t.preventDefault(),clearTimeout(this.activating),s=this._focusNextTab(s,n),t.ctrlKey||(i.attr("aria-selected","false"),this.tabs.eq(s).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",s)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(t){return t.altKey&&t.keyCode===e.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===e.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,i){function s(){return t>n&&(t=0),0>t&&(t=n),t}for(var n=this.tabs.length-1;-1!==e.inArray(s(),this.options.disabled);)t=i?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):"disabled"===e?(this._setupDisabled(t),void 0):(this._super(e,t),"collapsible"===e&&(this.element.toggleClass("ui-tabs-collapsible",t),t||this.options.active!==!1||this._activate(0)),"event"===e&&this._setupEvents(t),"heightStyle"===e&&this._setupHeightStyle(t),void 0)},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,i=this.tablist.children(":has(a[href])");t.disabled=e.map(i.filter(".ui-state-disabled"),function(e){return i.index(e)}),this._processTabs(),t.active!==!1&&this.anchors.length?this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=e()),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"}),this.active.length?(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"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this,i=this.tabs,s=this.anchors,n=this.panels;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist").delegate("> li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(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 e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(i,s){var n,a,o,r=e(s).uniqueId().attr("id"),h=e(s).closest("li"),l=h.attr("aria-controls");t._isLocal(s)?(n=s.hash,o=n.substring(1),a=t.element.find(t._sanitizeSelector(n))):(o=h.attr("aria-controls")||e({}).uniqueId()[0].id,n="#"+o,a=t.element.find(n),a.length||(a=t._createPanel(o),a.insertAfter(t.panels[i-1]||t.tablist)),a.attr("aria-live","polite")),a.length&&(t.panels=t.panels.add(a)),l&&h.data("ui-tabs-aria-controls",l),h.attr({"aria-controls":o,"aria-labelledby":r}),a.attr("aria-labelledby",r)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel"),i&&(this._off(i.not(this.tabs)),this._off(s.not(this.anchors)),this._off(n.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e("<div>").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var i,s=0;i=this.tabs[s];s++)t===!0||-1!==e.inArray(s,t)?e(i).addClass("ui-state-disabled").attr("aria-disabled","true"):e(i).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var i={};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(e){e.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,s=this.element.parent();"fill"===t?(i=s.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=e(this),s=t.css("position");"absolute"!==s&&"fixed"!==s&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,i-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,e(this).height("").height())}).height(i))},_eventHandler:function(t){var i=this.options,s=this.active,n=e(t.currentTarget),a=n.closest("li"),o=a[0]===s[0],r=o&&i.collapsible,h=r?e():this._getPanelForTab(a),l=s.length?this._getPanelForTab(s):e(),u={oldTab:s,oldPanel:l,newTab:r?e():a,newPanel:h};t.preventDefault(),a.hasClass("ui-state-disabled")||a.hasClass("ui-tabs-loading")||this.running||o&&!i.collapsible||this._trigger("beforeActivate",t,u)===!1||(i.active=r?!1:this.tabs.index(a),this.active=o?e():a,this.xhr&&this.xhr.abort(),l.length||h.length||e.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(a),t),this._toggle(t,u))},_toggle:function(t,i){function s(){a.running=!1,a._trigger("activate",t,i)}function n(){i.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),o.length&&a.options.show?a._show(o,a.options.show,s):(o.show(),s())}var a=this,o=i.newPanel,r=i.oldPanel;this.running=!0,r.length&&this.options.hide?this._hide(r,this.options.hide,function(){i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),n()}):(i.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),r.hide(),n()),r.attr("aria-hidden","true"),i.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),o.length&&r.length?i.oldTab.attr("tabIndex",-1):o.length&&this.tabs.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),o.attr("aria-hidden","false"),i.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var i,s=this._findActive(t);s[0]!==this.active[0]&&(s.length||(s=this.active),i=s.find(".ui-tabs-anchor")[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return"string"==typeof e&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){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(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(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 t=e(this),i=t.data("ui-tabs-aria-controls");i?t.attr("aria-controls",i).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(t){var i=this.options.disabled;i!==!1&&(void 0===t?i=!1:(t=this._getIndex(t),i=e.isArray(i)?e.map(i,function(e){return e!==t?e:null}):e.map(this.tabs,function(e,i){return i!==t?i:null})),this._setupDisabled(i))},disable:function(t){var i=this.options.disabled;if(i!==!0){if(void 0===t)i=!0;else{if(t=this._getIndex(t),-1!==e.inArray(t,i))return;i=e.isArray(i)?e.merge([t],i).sort():[t]}this._setupDisabled(i)}},load:function(t,i){t=this._getIndex(t);var s=this,n=this.tabs.eq(t),a=n.find(".ui-tabs-anchor"),o=this._getPanelForTab(n),r={tab:n,panel:o};this._isLocal(a[0])||(this.xhr=e.ajax(this._ajaxSettings(a,i,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(n.addClass("ui-tabs-loading"),o.attr("aria-busy","true"),this.xhr.success(function(e){setTimeout(function(){o.html(e),s._trigger("load",i,r)},1)}).complete(function(e,t){setTimeout(function(){"abort"===t&&s.panels.stop(!1,!0),n.removeClass("ui-tabs-loading"),o.removeAttr("aria-busy"),e===s.xhr&&delete s.xhr},1)})))},_ajaxSettings:function(t,i,s){var n=this;return{url:t.attr("href"),beforeSend:function(t,a){return n._trigger("beforeLoad",i,e.extend({jqXHR:t,ajaxSettings:a},s))}}},_getPanelForTab:function(t){var i=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+i))}}),e.widget("ui.tooltip",{version:"1.11.2",options:{content:function(){var t=e(this).attr("title")||"";return e("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_addDescribedBy:function(t,i){var s=(t.attr("aria-describedby")||"").split(/\s+/);s.push(i),t.data("ui-tooltip-id",i).attr("aria-describedby",e.trim(s.join(" ")))},_removeDescribedBy:function(t){var i=t.data("ui-tooltip-id"),s=(t.attr("aria-describedby")||"").split(/\s+/),n=e.inArray(i,s);-1!==n&&s.splice(n,1),t.removeData("ui-tooltip-id"),s=e.trim(s.join(" ")),s?t.attr("aria-describedby",s):t.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable(),this.liveRegion=e("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).addClass("ui-helper-hidden-accessible").appendTo(this.document[0].body)},_setOption:function(t,i){var s=this;return"disabled"===t?(this[i?"_disable":"_enable"](),this.options[t]=i,void 0):(this._super(t,i),"content"===t&&e.each(this.tooltips,function(e,t){s._updateContent(t.element)}),void 0)},_disable:function(){var t=this;e.each(this.tooltips,function(i,s){var n=e.Event("blur");n.target=n.currentTarget=s.element[0],t.close(n,!0)}),this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")})},_enable:function(){this.element.find(this.options.items).addBack().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var i=this,s=e(t?t.target:this.element).closest(this.options.items);s.length&&!s.data("ui-tooltip-id")&&(s.attr("title")&&s.data("ui-tooltip-title",s.attr("title")),s.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&s.parents().each(function(){var t,s=e(this);s.data("ui-tooltip-open")&&(t=e.Event("blur"),t.target=t.currentTarget=this,i.close(t,!0)),s.attr("title")&&(s.uniqueId(),i.parents[this.id]={element:this,title:s.attr("title")},s.attr("title",""))}),this._updateContent(s,t))},_updateContent:function(e,t){var i,s=this.options.content,n=this,a=t?t.type:null;return"string"==typeof s?this._open(t,e,s):(i=s.call(e[0],function(i){e.data("ui-tooltip-open")&&n._delay(function(){t&&(t.type=a),this._open(t,e,i)})}),i&&this._open(t,e,i),void 0)},_open:function(t,i,s){function n(e){u.of=e,o.is(":hidden")||o.position(u)}var a,o,r,h,l,u=e.extend({},this.options.position);if(s){if(a=this._find(i))return a.tooltip.find(".ui-tooltip-content").html(s),void 0;i.is("[title]")&&(t&&"mouseover"===t.type?i.attr("title",""):i.removeAttr("title")),a=this._tooltip(i),o=a.tooltip,this._addDescribedBy(i,o.attr("id")),o.find(".ui-tooltip-content").html(s),this.liveRegion.children().hide(),s.clone?(l=s.clone(),l.removeAttr("id").find("[id]").removeAttr("id")):l=s,e("<div>").html(l).appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:n}),n(t)):o.position(e.extend({of:i},this.options.position)),o.hide(),this._show(o,this.options.show),this.options.show&&this.options.show.delay&&(h=this.delayedShow=setInterval(function(){o.is(":visible")&&(n(u.of),clearInterval(h))},e.fx.interval)),this._trigger("open",t,{tooltip:o}),r={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var s=e.Event(t);s.currentTarget=i[0],this.close(s,!0)}}},i[0]!==this.element[0]&&(r.remove=function(){this._removeTooltip(o)}),t&&"mouseover"!==t.type||(r.mouseleave="close"),t&&"focusin"!==t.type||(r.focusout="close"),this._on(!0,i,r)}},close:function(t){var i,s=this,n=e(t?t.currentTarget:this.element),a=this._find(n);a&&(i=a.tooltip,a.closing||(clearInterval(this.delayedShow),n.data("ui-tooltip-title")&&!n.attr("title")&&n.attr("title",n.data("ui-tooltip-title")),this._removeDescribedBy(n),a.hiding=!0,i.stop(!0),this._hide(i,this.options.hide,function(){s._removeTooltip(e(this))}),n.removeData("ui-tooltip-open"),this._off(n,"mouseleave focusout keyup"),n[0]!==this.element[0]&&this._off(n,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&e.each(this.parents,function(t,i){e(i.element).attr("title",i.title),delete s.parents[t]}),a.closing=!0,this._trigger("close",t,{tooltip:i}),a.hiding||(a.closing=!1)))},_tooltip:function(t){var i=e("<div>").attr("role","tooltip").addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||"")),s=i.uniqueId().attr("id");return e("<div>").addClass("ui-tooltip-content").appendTo(i),i.appendTo(this.document[0].body),this.tooltips[s]={element:t,tooltip:i}},_find:function(e){var t=e.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(i,s){var n=e.Event("blur"),a=s.element;n.target=n.currentTarget=a[0],t.close(n,!0),e("#"+i).remove(),a.data("ui-tooltip-title")&&(a.attr("title")||a.attr("title",a.data("ui-tooltip-title")),a.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}});var y="ui-effects-",b=e;e.effects={effect:{}},function(e,t){function i(e,t,i){var s=d[t.type]||{};return null==e?i||!t.def?null:t.def:(e=s.floor?~~e:parseFloat(e),isNaN(e)?t.def:s.mod?(e+s.mod)%s.mod:0>e?0:e>s.max?s.max:e)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(e,a){var o,r=a.re.exec(i),h=r&&a.parse(r),l=a.space||"rgba";return h?(o=s[l](h),s[u[l].cache]=o[u[l].cache],n=s._rgba=o._rgba,!1):t}),n.length?("0,0,0,0"===n.join()&&e.extend(n,a.transparent),s):a[i]}function n(e,t,i){return i=(i+1)%1,1>6*i?e+6*(t-e)*i:1>2*i?t:2>3*i?e+6*(t-e)*(2/3-i):e}var a,o="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],l=e.Color=function(t,i,s,n){return new e.Color.fn.parse(t,i,s,n)},u={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"}}}},d={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},c=l.support={},p=e("<p>")[0],f=e.each;p.style.cssText="background-color:rgba(1,1,1,.5)",c.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),l.fn=e.extend(l.prototype,{parse:function(n,o,r,h){if(n===t)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=e(n).css(o),o=t);var d=this,c=e.type(n),p=this._rgba=[];return o!==t&&(n=[n,o,r,h],c="array"),"string"===c?this.parse(s(n)||a._default):"array"===c?(f(u.rgba.props,function(e,t){p[t.idx]=i(n[t.idx],t)}),this):"object"===c?(n instanceof l?f(u,function(e,t){n[t.cache]&&(d[t.cache]=n[t.cache].slice())}):f(u,function(t,s){var a=s.cache;f(s.props,function(e,t){if(!d[a]&&s.to){if("alpha"===e||null==n[e])return;d[a]=s.to(d._rgba)}d[a][t.idx]=i(n[e],t,!0)}),d[a]&&0>e.inArray(null,d[a].slice(0,3))&&(d[a][3]=1,s.from&&(d._rgba=s.from(d[a])))}),this):t},is:function(e){var i=l(e),s=!0,n=this;return f(u,function(e,a){var o,r=i[a.cache];return r&&(o=n[a.cache]||a.to&&a.to(n._rgba)||[],f(a.props,function(e,i){return null!=r[i.idx]?s=r[i.idx]===o[i.idx]:t})),s}),s},_space:function(){var e=[],t=this;return f(u,function(i,s){t[s.cache]&&e.push(i)}),e.pop()},transition:function(e,t){var s=l(e),n=s._space(),a=u[n],o=0===this.alpha()?l("transparent"):this,r=o[a.cache]||a.to(o._rgba),h=r.slice();return s=s[a.cache],f(a.props,function(e,n){var a=n.idx,o=r[a],l=s[a],u=d[n.type]||{};null!==l&&(null===o?h[a]=l:(u.mod&&(l-o>u.mod/2?o+=u.mod:o-l>u.mod/2&&(o-=u.mod)),h[a]=i((l-o)*t+o,n)))}),this[n](h)},blend:function(t){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(t)._rgba;return l(e.map(i,function(e,t){return(1-s)*n[t]+s*e}))},toRgbaString:function(){var t="rgba(",i=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===i[3]&&(i.pop(),t="rgb("),t+i.join()+")"},toHslaString:function(){var t="hsla(",i=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===i[3]&&(i.pop(),t="hsl("),t+i.join()+")"},toHexString:function(t){var i=this._rgba.slice(),s=i.pop();return t&&i.push(~~(255*s)),"#"+e.map(i,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,u.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,i,s=e[0]/255,n=e[1]/255,a=e[2]/255,o=e[3],r=Math.max(s,n,a),h=Math.min(s,n,a),l=r-h,u=r+h,d=.5*u;return t=h===r?0:s===r?60*(n-a)/l+360:n===r?60*(a-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=d?l/u:l/(2-u),[Math.round(t)%360,i,d,null==o?1:o]},u.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,i=e[1],s=e[2],a=e[3],o=.5>=s?s*(1+i):s+i-s*i,r=2*s-o;return[Math.round(255*n(r,o,t+1/3)),Math.round(255*n(r,o,t)),Math.round(255*n(r,o,t-1/3)),a]},f(u,function(s,n){var a=n.props,o=n.cache,h=n.to,u=n.from;l.fn[s]=function(s){if(h&&!this[o]&&(this[o]=h(this._rgba)),s===t)return this[o].slice();var n,r=e.type(s),d="array"===r||"object"===r?s:arguments,c=this[o].slice();return f(a,function(e,t){var s=d["object"===r?e:t.idx];null==s&&(s=c[t.idx]),c[t.idx]=i(s,t)}),u?(n=l(u(c)),n[o]=c,n):l(c)},f(a,function(t,i){l.fn[t]||(l.fn[t]=function(n){var a,o=e.type(n),h="alpha"===t?this._hsla?"hsla":"rgba":s,l=this[h](),u=l[i.idx];return"undefined"===o?u:("function"===o&&(n=n.call(this,u),o=e.type(n)),null==n&&i.empty?this:("string"===o&&(a=r.exec(n),a&&(n=u+parseFloat(a[2])*("+"===a[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(t){var i=t.split(" ");f(i,function(t,i){e.cssHooks[i]={set:function(t,n){var a,o,r="";if("transparent"!==n&&("string"!==e.type(n)||(a=s(n)))){if(n=l(a||n),!c.rgba&&1!==n._rgba[3]){for(o="backgroundColor"===i?t.parentNode:t;(""===r||"transparent"===r)&&o&&o.style;)try{r=e.css(o,"backgroundColor"),o=o.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{t.style[i]=n}catch(h){}}},e.fx.step[i]=function(t){t.colorInit||(t.start=l(t.elem,i),t.end=l(t.end),t.colorInit=!0),e.cssHooks[i].set(t.elem,t.start.transition(t.end,t.pos))}})},l.hook(o),e.cssHooks.borderColor={expand:function(e){var t={};return f(["Top","Right","Bottom","Left"],function(i,s){t["border"+s+"Color"]=e}),t}},a=e.Color.names={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",transparent:[null,null,null,0],_default:"#ffffff"}}(b),function(){function t(t){var i,s,n=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,a={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(a[e.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(a[i]=n[i]);return a}function i(t,i){var s,a,o={};for(s in i)a=i[s],t[s]!==a&&(n[s]||(e.fx.step[s]||!isNaN(parseFloat(a)))&&(o[s]=a));return o}var s=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,i){e.fx.step[i]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(b.style(e.elem,i,e.end),e.setAttr=!0)}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(n,a,o,r){var h=e.speed(a,o,r);return this.queue(function(){var a,o=e(this),r=o.attr("class")||"",l=h.children?o.find("*").addBack():o;l=l.map(function(){var i=e(this);return{el:i,start:t(this)}}),a=function(){e.each(s,function(e,t){n[t]&&o[t+"Class"](n[t])})},a(),l=l.map(function(){return this.end=t(this.el[0]),this.diff=i(this.start,this.end),this}),o.attr("class",r),l=l.map(function(){var t=this,i=e.Deferred(),s=e.extend({},h,{queue:!1,complete:function(){i.resolve(t)}});return this.el.animate(this.diff,s),i.promise()}),e.when.apply(e,l.get()).done(function(){a(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),h.complete.call(o[0])})})},e.fn.extend({addClass:function(t){return function(i,s,n,a){return s?e.effects.animateClass.call(this,{add:i},s,n,a):t.apply(this,arguments)}}(e.fn.addClass),removeClass:function(t){return function(i,s,n,a){return arguments.length>1?e.effects.animateClass.call(this,{remove:i},s,n,a):t.apply(this,arguments)}}(e.fn.removeClass),toggleClass:function(t){return function(i,s,n,a,o){return"boolean"==typeof s||void 0===s?n?e.effects.animateClass.call(this,s?{add:i}:{remove:i},n,a,o):t.apply(this,arguments):e.effects.animateClass.call(this,{toggle:i},s,n,a)}}(e.fn.toggleClass),switchClass:function(t,i,s,n,a){return e.effects.animateClass.call(this,{add:i,remove:t},s,n,a)}})}(),function(){function t(t,i,s,n){return e.isPlainObject(t)&&(i=t,t=t.effect),t={effect:t},null==i&&(i={}),e.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||e.fx.speeds[i])&&(n=s,s=i,i={}),e.isFunction(s)&&(n=s,s=null),i&&e.extend(t,i),s=s||i.duration,t.duration=e.fx.off?0:"number"==typeof s?s:s in e.fx.speeds?e.fx.speeds[s]:e.fx.speeds._default,t.complete=n||i.complete,t}function i(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"!=typeof t||e.effects.effect[t]?e.isFunction(t)?!0:"object"!=typeof t||t.effect?!1:!0:!0}e.extend(e.effects,{version:"1.11.2",save:function(e,t){for(var i=0;t.length>i;i++)null!==t[i]&&e.data(y+t[i],e[0].style[t[i]])},restore:function(e,t){var i,s;for(s=0;t.length>s;s++)null!==t[s]&&(i=e.data(y+t[s]),void 0===i&&(i=""),e.css(t[s],i))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var i,s;switch(e[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=e[0]/t.height}switch(e[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=e[1]/t.width}return{x:s,y:i}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var i={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},s=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:t.width(),height:t.height()},a=document.activeElement;try{a.id}catch(o){a=document.body}return t.wrap(s),(t[0]===a||e.contains(t[0],a))&&e(a).focus(),s=t.parent(),"static"===t.css("position")?(s.css({position:"relative"}),t.css({position:"relative"})):(e.extend(i,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,s){i[s]=t.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(n),s.css(i).show()},removeWrapper:function(t){var i=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===i||e.contains(t[0],i))&&e(i).focus()),t},setTransition:function(t,i,s,n){return n=n||{},e.each(i,function(e,i){var a=t.cssUnit(i);a[0]>0&&(n[i]=a[0]*s+a[1])}),n}}),e.fn.extend({effect:function(){function i(t){function i(){e.isFunction(a)&&a.call(n[0]),e.isFunction(t)&&t()}var n=e(this),a=s.complete,r=s.mode;(n.is(":hidden")?"hide"===r:"show"===r)?(n[r](),i()):o.call(n[0],s,i)}var s=t.apply(this,arguments),n=s.mode,a=s.queue,o=e.effects.effect[s.effect];return e.fx.off||!o?n?this[n](s.duration,s.complete):this.each(function(){s.complete&&s.complete.call(this)}):a===!1?this.each(i):this.queue(a||"fx",i)},show:function(e){return function(s){if(i(s))return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="show",this.effect.call(this,n)}}(e.fn.show),hide:function(e){return function(s){if(i(s))return e.apply(this,arguments);
var n=t.apply(this,arguments);return n.mode="hide",this.effect.call(this,n)}}(e.fn.hide),toggle:function(e){return function(s){if(i(s)||"boolean"==typeof s)return e.apply(this,arguments);var n=t.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)}}(e.fn.toggle),cssUnit:function(t){var i=this.css(t),s=[];return e.each(["em","px","%","pt"],function(e,t){i.indexOf(t)>0&&(s=[parseFloat(i),t])}),s}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,i){t[i]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,i=4;((t=Math.pow(2,--i))-1)/11>e;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,i){e.easing["easeIn"+t]=i,e.easing["easeOut"+t]=function(e){return 1-i(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?i(2*e)/2:1-i(-2*e+2)/2}})}(),e.effects,e.effects.effect.blind=function(t,i){var s,n,a,o=e(this),r=/up|down|vertical/,h=/up|left|vertical|horizontal/,l=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(o,t.mode||"hide"),d=t.direction||"up",c=r.test(d),p=c?"height":"width",f=c?"top":"left",m=h.test(d),g={},v="show"===u;o.parent().is(".ui-effects-wrapper")?e.effects.save(o.parent(),l):e.effects.save(o,l),o.show(),s=e.effects.createWrapper(o).css({overflow:"hidden"}),n=s[p](),a=parseFloat(s.css(f))||0,g[p]=v?n:0,m||(o.css(c?"bottom":"right",0).css(c?"top":"left","auto").css({position:"absolute"}),g[f]=v?a:n+a),v&&(s.css(p,0),m||s.css(f,a+n)),s.animate(g,{duration:t.duration,easing:t.easing,queue:!1,complete:function(){"hide"===u&&o.hide(),e.effects.restore(o,l),e.effects.removeWrapper(o),i()}})},e.effects.effect.bounce=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(o,t.mode||"effect"),l="hide"===h,u="show"===h,d=t.direction||"up",c=t.distance,p=t.times||5,f=2*p+(u||l?1:0),m=t.duration/f,g=t.easing,v="up"===d||"down"===d?"top":"left",y="up"===d||"left"===d,b=o.queue(),_=b.length;for((u||l)&&r.push("opacity"),e.effects.save(o,r),o.show(),e.effects.createWrapper(o),c||(c=o["top"===v?"outerHeight":"outerWidth"]()/3),u&&(a={opacity:1},a[v]=0,o.css("opacity",0).css(v,y?2*-c:2*c).animate(a,m,g)),l&&(c/=Math.pow(2,p-1)),a={},a[v]=0,s=0;p>s;s++)n={},n[v]=(y?"-=":"+=")+c,o.animate(n,m,g).animate(a,m,g),c=l?2*c:c/2;l&&(n={opacity:0},n[v]=(y?"-=":"+=")+c,o.animate(n,m,g)),o.queue(function(){l&&o.hide(),e.effects.restore(o,r),e.effects.removeWrapper(o),i()}),_>1&&b.splice.apply(b,[1,0].concat(b.splice(_,f+1))),o.dequeue()},e.effects.effect.clip=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","height","width"],h=e.effects.setMode(o,t.mode||"hide"),l="show"===h,u=t.direction||"vertical",d="vertical"===u,c=d?"height":"width",p=d?"top":"left",f={};e.effects.save(o,r),o.show(),s=e.effects.createWrapper(o).css({overflow:"hidden"}),n="IMG"===o[0].tagName?s:o,a=n[c](),l&&(n.css(c,0),n.css(p,a/2)),f[c]=l?a:0,f[p]=l?0:a/2,n.animate(f,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){l||o.hide(),e.effects.restore(o,r),e.effects.removeWrapper(o),i()}})},e.effects.effect.drop=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","opacity","height","width"],o=e.effects.setMode(n,t.mode||"hide"),r="show"===o,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h?"pos":"neg",d={opacity:r?1:0};e.effects.save(n,a),n.show(),e.effects.createWrapper(n),s=t.distance||n["top"===l?"outerHeight":"outerWidth"](!0)/2,r&&n.css("opacity",0).css(l,"pos"===u?-s:s),d[l]=(r?"pos"===u?"+=":"-=":"pos"===u?"-=":"+=")+s,n.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}})},e.effects.effect.explode=function(t,i){function s(){b.push(this),b.length===d*c&&n()}function n(){p.css({visibility:"visible"}),e(b).remove(),m||p.hide(),i()}var a,o,r,h,l,u,d=t.pieces?Math.round(Math.sqrt(t.pieces)):3,c=d,p=e(this),f=e.effects.setMode(p,t.mode||"hide"),m="show"===f,g=p.show().css("visibility","hidden").offset(),v=Math.ceil(p.outerWidth()/c),y=Math.ceil(p.outerHeight()/d),b=[];for(a=0;d>a;a++)for(h=g.top+a*y,u=a-(d-1)/2,o=0;c>o;o++)r=g.left+o*v,l=o-(c-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-o*v,top:-a*y}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:v,height:y,left:r+(m?l*v:0),top:h+(m?u*y:0),opacity:m?0:1}).animate({left:r+(m?0:l*v),top:h+(m?0:u*y),opacity:m?1:0},t.duration||500,t.easing,s)},e.effects.effect.fade=function(t,i){var s=e(this),n=e.effects.setMode(s,t.mode||"toggle");s.animate({opacity:n},{queue:!1,duration:t.duration,easing:t.easing,complete:i})},e.effects.effect.fold=function(t,i){var s,n,a=e(this),o=["position","top","bottom","left","right","height","width"],r=e.effects.setMode(a,t.mode||"hide"),h="show"===r,l="hide"===r,u=t.size||15,d=/([0-9]+)%/.exec(u),c=!!t.horizFirst,p=h!==c,f=p?["width","height"]:["height","width"],m=t.duration/2,g={},v={};e.effects.save(a,o),a.show(),s=e.effects.createWrapper(a).css({overflow:"hidden"}),n=p?[s.width(),s.height()]:[s.height(),s.width()],d&&(u=parseInt(d[1],10)/100*n[l?0:1]),h&&s.css(c?{height:0,width:u}:{height:u,width:0}),g[f[0]]=h?n[0]:u,v[f[1]]=h?n[1]:0,s.animate(g,m,t.easing).animate(v,m,t.easing,function(){l&&a.hide(),e.effects.restore(a,o),e.effects.removeWrapper(a),i()})},e.effects.effect.highlight=function(t,i){var s=e(this),n=["backgroundImage","backgroundColor","opacity"],a=e.effects.setMode(s,t.mode||"show"),o={backgroundColor:s.css("backgroundColor")};"hide"===a&&(o.opacity=0),e.effects.save(s,n),s.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(o,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===a&&s.hide(),e.effects.restore(s,n),i()}})},e.effects.effect.size=function(t,i){var s,n,a,o=e(this),r=["position","top","bottom","left","right","width","height","overflow","opacity"],h=["position","top","bottom","left","right","overflow","opacity"],l=["width","height","overflow"],u=["fontSize"],d=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],c=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(o,t.mode||"effect"),f=t.restore||"effect"!==p,m=t.scale||"both",g=t.origin||["middle","center"],v=o.css("position"),y=f?r:h,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&o.show(),s={height:o.height(),width:o.width(),outerHeight:o.outerHeight(),outerWidth:o.outerWidth()},"toggle"===t.mode&&"show"===p?(o.from=t.to||b,o.to=t.from||s):(o.from=t.from||("show"===p?b:s),o.to=t.to||("hide"===p?b:s)),a={from:{y:o.from.height/s.height,x:o.from.width/s.width},to:{y:o.to.height/s.height,x:o.to.width/s.width}},("box"===m||"both"===m)&&(a.from.y!==a.to.y&&(y=y.concat(d),o.from=e.effects.setTransition(o,d,a.from.y,o.from),o.to=e.effects.setTransition(o,d,a.to.y,o.to)),a.from.x!==a.to.x&&(y=y.concat(c),o.from=e.effects.setTransition(o,c,a.from.x,o.from),o.to=e.effects.setTransition(o,c,a.to.x,o.to))),("content"===m||"both"===m)&&a.from.y!==a.to.y&&(y=y.concat(u).concat(l),o.from=e.effects.setTransition(o,u,a.from.y,o.from),o.to=e.effects.setTransition(o,u,a.to.y,o.to)),e.effects.save(o,y),o.show(),e.effects.createWrapper(o),o.css("overflow","hidden").css(o.from),g&&(n=e.effects.getBaseline(g,s),o.from.top=(s.outerHeight-o.outerHeight())*n.y,o.from.left=(s.outerWidth-o.outerWidth())*n.x,o.to.top=(s.outerHeight-o.to.outerHeight)*n.y,o.to.left=(s.outerWidth-o.to.outerWidth)*n.x),o.css(o.from),("content"===m||"both"===m)&&(d=d.concat(["marginTop","marginBottom"]).concat(u),c=c.concat(["marginLeft","marginRight"]),l=r.concat(d).concat(c),o.find("*[width]").each(function(){var i=e(this),s={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};f&&e.effects.save(i,l),i.from={height:s.height*a.from.y,width:s.width*a.from.x,outerHeight:s.outerHeight*a.from.y,outerWidth:s.outerWidth*a.from.x},i.to={height:s.height*a.to.y,width:s.width*a.to.x,outerHeight:s.height*a.to.y,outerWidth:s.width*a.to.x},a.from.y!==a.to.y&&(i.from=e.effects.setTransition(i,d,a.from.y,i.from),i.to=e.effects.setTransition(i,d,a.to.y,i.to)),a.from.x!==a.to.x&&(i.from=e.effects.setTransition(i,c,a.from.x,i.from),i.to=e.effects.setTransition(i,c,a.to.x,i.to)),i.css(i.from),i.animate(i.to,t.duration,t.easing,function(){f&&e.effects.restore(i,l)})})),o.animate(o.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){0===o.to.opacity&&o.css("opacity",o.from.opacity),"hide"===p&&o.hide(),e.effects.restore(o,y),f||("static"===v?o.css({position:"relative",top:o.to.top,left:o.to.left}):e.each(["top","left"],function(e,t){o.css(t,function(t,i){var s=parseInt(i,10),n=e?o.to.left:o.to.top;return"auto"===i?n+"px":s+n+"px"})})),e.effects.removeWrapper(o),i()}})},e.effects.effect.scale=function(t,i){var s=e(this),n=e.extend(!0,{},t),a=e.effects.setMode(s,t.mode||"effect"),o=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===a?0:100),r=t.direction||"both",h=t.origin,l={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()},u={y:"horizontal"!==r?o/100:1,x:"vertical"!==r?o/100:1};n.effect="size",n.queue=!1,n.complete=i,"effect"!==a&&(n.origin=h||["middle","center"],n.restore=!0),n.from=t.from||("show"===a?{height:0,width:0,outerHeight:0,outerWidth:0}:l),n.to={height:l.height*u.y,width:l.width*u.x,outerHeight:l.outerHeight*u.y,outerWidth:l.outerWidth*u.x},n.fade&&("show"===a&&(n.from.opacity=0,n.to.opacity=1),"hide"===a&&(n.from.opacity=1,n.to.opacity=0)),s.effect(n)},e.effects.effect.puff=function(t,i){var s=e(this),n=e.effects.setMode(s,t.mode||"hide"),a="hide"===n,o=parseInt(t.percent,10)||150,r=o/100,h={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:n,complete:i,percent:a?o:100,from:a?h:{height:h.height*r,width:h.width*r,outerHeight:h.outerHeight*r,outerWidth:h.outerWidth*r}}),s.effect(t)},e.effects.effect.pulsate=function(t,i){var s,n=e(this),a=e.effects.setMode(n,t.mode||"show"),o="show"===a,r="hide"===a,h=o||"hide"===a,l=2*(t.times||5)+(h?1:0),u=t.duration/l,d=0,c=n.queue(),p=c.length;for((o||!n.is(":visible"))&&(n.css("opacity",0).show(),d=1),s=1;l>s;s++)n.animate({opacity:d},u,t.easing),d=1-d;n.animate({opacity:d},u,t.easing),n.queue(function(){r&&n.hide(),i()}),p>1&&c.splice.apply(c,[1,0].concat(c.splice(p,l+1))),n.dequeue()},e.effects.effect.shake=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","height","width"],o=e.effects.setMode(n,t.mode||"effect"),r=t.direction||"left",h=t.distance||20,l=t.times||3,u=2*l+1,d=Math.round(t.duration/u),c="up"===r||"down"===r?"top":"left",p="up"===r||"left"===r,f={},m={},g={},v=n.queue(),y=v.length;for(e.effects.save(n,a),n.show(),e.effects.createWrapper(n),f[c]=(p?"-=":"+=")+h,m[c]=(p?"+=":"-=")+2*h,g[c]=(p?"-=":"+=")+2*h,n.animate(f,d,t.easing),s=1;l>s;s++)n.animate(m,d,t.easing).animate(g,d,t.easing);n.animate(m,d,t.easing).animate(f,d/2,t.easing).queue(function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}),y>1&&v.splice.apply(v,[1,0].concat(v.splice(y,u+1))),n.dequeue()},e.effects.effect.slide=function(t,i){var s,n=e(this),a=["position","top","bottom","left","right","width","height"],o=e.effects.setMode(n,t.mode||"show"),r="show"===o,h=t.direction||"left",l="up"===h||"down"===h?"top":"left",u="up"===h||"left"===h,d={};e.effects.save(n,a),n.show(),s=t.distance||n["top"===l?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(n).css({overflow:"hidden"}),r&&n.css(l,u?isNaN(s)?"-"+s:-s:s),d[l]=(r?u?"+=":"-=":u?"-=":"+=")+s,n.animate(d,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===o&&n.hide(),e.effects.restore(n,a),e.effects.removeWrapper(n),i()}})},e.effects.effect.transfer=function(t,i){var s=e(this),n=e(t.to),a="fixed"===n.css("position"),o=e("body"),r=a?o.scrollTop():0,h=a?o.scrollLeft():0,l=n.offset(),u={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},d=s.offset(),c=e("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(t.className).css({top:d.top-r,left:d.left-h,height:s.innerHeight(),width:s.innerWidth(),position:a?"fixed":"absolute"}).animate(u,t.duration,t.easing,function(){c.remove(),i()})}});!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(c){return a.returnExportsGlobal=b(c)}):"object"==typeof exports?module.exports=b(require("jquery")):b(jQuery)}(this,function(){var a,b,c,d,e,f,g,h,i,j=[].slice,k={}.hasOwnProperty,l=function(a,b){function c(){this.constructor=a}for(var d in b)k.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};b=function(){function a(a){this.currentFlag=null,this.controllers={},this.aliasMaps={},this.$inputor=$(a),this.setupRootElement(),this.listen()}return a.prototype.createContainer=function(a){var b;return null!=(b=this.$el)&&b.remove(),$(a.body).append(this.$el=$("<div class='atwho-container'></div>"))},a.prototype.setupRootElement=function(a,b){var c;if(null==b&&(b=!1),a)this.window=a.contentWindow,this.document=a.contentDocument||this.window.document,this.iframe=a;else{this.document=this.$inputor[0].ownerDocument,this.window=this.document.defaultView||this.document.parentWindow;try{this.iframe=this.window.frameElement}catch(d){throw c=d,this.iframe=null,new Error("iframe auto-discovery is failed.\nPlease use `serIframe` to set the target iframe manually.")}}return this.createContainer((this.iframeAsRoot=b)?this.document:document)},a.prototype.controller=function(a){var b,c,d,e;if(this.aliasMaps[a])c=this.controllers[this.aliasMaps[a]];else{e=this.controllers;for(d in e)if(b=e[d],d===a){c=b;break}}return c?c:this.controllers[this.currentFlag]},a.prototype.setContextFor=function(a){return this.currentFlag=a,this},a.prototype.reg=function(a,b){var c,d;return c=(d=this.controllers)[a]||(d[a]=this.$inputor.is("[contentEditable]")?new e(this,a):new h(this,a)),b.alias&&(this.aliasMaps[b.alias]=a),c.init(b),this},a.prototype.listen=function(){return this.$inputor.on("compositionstart",function(a){return function(){var b;return null!=(b=a.controller())&&b.view.hide(),a.isComposing=!0}}(this)).on("compositionend",function(a){return function(){return a.isComposing=!1}}(this)).on("keyup.atwhoInner",function(a){return function(b){return a.onKeyup(b)}}(this)).on("keydown.atwhoInner",function(a){return function(b){return a.onKeydown(b)}}(this)).on("scroll.atwhoInner",function(a){return function(b){var c;return null!=(c=a.controller())?c.view.hide(b):void 0}}(this)).on("blur.atwhoInner",function(a){return function(b){var c;return(c=a.controller())?c.view.hide(b,c.getOpt("displayTimeout")):void 0}}(this)).on("click.atwhoInner",function(a){return function(b){return a.dispatch(b)}}(this))},a.prototype.shutdown=function(){var a,b,c;c=this.controllers;for(b in c)a=c[b],a.destroy(),delete this.controllers[b];return this.$inputor.off(".atwhoInner"),this.$el.remove()},a.prototype.dispatch=function(a){return $.map(this.controllers,function(b){return function(c){var d;return(d=c.getOpt("delay"))?(clearTimeout(b.delayedCallback),b.delayedCallback=setTimeout(function(){return c.lookUp(a)?b.setContextFor(c.at):void 0},d)):c.lookUp(a)?b.setContextFor(c.at):void 0}}(this))},a.prototype.onKeyup=function(a){var b;switch(a.keyCode){case f.ESC:a.preventDefault(),null!=(b=this.controller())&&b.view.hide();break;case f.DOWN:case f.UP:case f.CTRL:$.noop();break;case f.P:case f.N:a.ctrlKey||this.dispatch(a);break;default:this.dispatch(a)}},a.prototype.onKeydown=function(a){var b,c;if(b=null!=(c=this.controller())?c.view:void 0,b&&b.visible())switch(a.keyCode){case f.ESC:a.preventDefault(),b.hide(a);break;case f.UP:a.preventDefault(),b.prev();break;case f.DOWN:a.preventDefault(),b.next();break;case f.P:if(!a.ctrlKey)return;a.preventDefault(),b.prev();break;case f.N:if(!a.ctrlKey)return;a.preventDefault(),b.next();break;case f.TAB:case f.ENTER:case f.SPACE:if(!b.visible())return;if(!this.controller().getOpt("spaceSelectsMatch")&&a.keyCode===f.SPACE)return;a.preventDefault(),b.choose(a);break;default:$.noop()}},a}(),c=function(){function a(a,b){this.app=a,this.at=b,this.$inputor=this.app.$inputor,this.id=this.$inputor[0].id||this.uid(),this.setting=null,this.query=null,this.pos=0,this.range=null,0===(this.$el=$("#atwho-ground-"+this.id,this.app.$el)).length&&this.app.$el.append(this.$el=$("<div id='atwho-ground-"+this.id+"'></div>")),this.model=new g(this),this.view=new i(this)}return a.prototype.uid=function(){return(Math.random().toString(16)+"000000000").substr(2,8)+(new Date).getTime()},a.prototype.init=function(a){return this.setting=$.extend({},this.setting||$.fn.atwho["default"],a),this.view.init(),this.model.reload(this.setting.data)},a.prototype.destroy=function(){return this.trigger("beforeDestroy"),this.model.destroy(),this.view.destroy(),this.$el.remove()},a.prototype.callDefault=function(){var a,b,c;c=arguments[0],a=2<=arguments.length?j.call(arguments,1):[];try{return d[c].apply(this,a)}catch(e){return b=e,$.error(""+b+" Or maybe At.js doesn't have function "+c)}},a.prototype.trigger=function(a,b){var c,d;return null==b&&(b=[]),b.push(this),c=this.getOpt("alias"),d=c?""+a+"-"+c+".atwho":""+a+".atwho",this.$inputor.trigger(d,b)},a.prototype.callbacks=function(a){return this.getOpt("callbacks")[a]||d[a]},a.prototype.getOpt=function(a){var b;try{return this.setting[a]}catch(c){return b=c,null}},a.prototype.insertContentFor=function(a){var b,c;return c=this.getOpt("insertTpl"),b=$.extend({},a.data("item-data"),{"atwho-at":this.at}),this.callbacks("tplEval").call(this,c,b)},a.prototype.renderView=function(a){var b;return b=this.getOpt("searchKey"),a=this.callbacks("sorter").call(this,this.query.text,a.slice(0,1001),b),this.view.render(a.slice(0,this.getOpt("limit")))},a.arrayToDefaultHash=function(a){var b,c,d,e;if(!$.isArray(a))return a;for(e=[],c=0,d=a.length;d>c;c++)b=a[c],e.push($.isPlainObject(b)?b:{name:b});return e},a.prototype.lookUp=function(a){var b,c;if(b=this.catchQuery(a))return c=function(a){return a&&a.length>0?this.renderView(this.constructor.arrayToDefaultHash(a)):this.view.hide()},this.model.query(b.text,$.proxy(c,this)),b},a}(),h=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return l(b,a),b.prototype.catchQuery=function(){var a,b,c,d,e,f;return b=this.$inputor.val(),a=this.$inputor.caret("pos",{iframe:this.app.iframe}),f=b.slice(0,a),d=this.callbacks("matcher").call(this,this.at,f,this.getOpt("startWithSpace")),"string"==typeof d&&d.length<=this.getOpt("maxLen",20)?(e=a-d.length,c=e+d.length,this.pos=e,d={text:d,headPos:e,endPos:c},this.trigger("matched",[this.at,d.text])):(d=null,this.view.hide()),this.query=d},b.prototype.rect=function(){var a,b,c;if(a=this.$inputor.caret("offset",this.pos-1,{iframe:this.app.iframe}))return this.app.iframe&&!this.app.iframeAsRoot&&(b=$(this.app.iframe).offset(),a.left+=b.left,a.top+=b.top),c=this.app.document.selection?0:2,{left:a.left,top:a.top,bottom:a.top+a.height+c}},b.prototype.insert=function(a){var b,c,d,e,f;return b=this.$inputor,c=b.val(),d=c.slice(0,Math.max(this.query.headPos-this.at.length,0)),e=""===(e=this.getOpt("suffix"))?e:e||" ",a+=e,f=""+d+a+c.slice(this.query.endPos||0),b.val(f),b.caret("pos",d.length+a.length,{iframe:this.app.iframe}),b.is(":focus")||b.focus(),b.change()},b}(c),e=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return l(b,a),b.prototype._getRange=function(){var a;return a=this.app.window.getSelection(),a.rangeCount>0?a.getRangeAt(0):void 0},b.prototype._setRange=function(a,b,c){return null==c&&(c=this._getRange()),c?(b=$(b)[0],"after"===a?(c.setEndAfter(b),c.setStartAfter(b)):(c.setEndBefore(b),c.setStartBefore(b)),c.collapse(!1),this._clearRange(c)):void 0},b.prototype._clearRange=function(a){var b;return null==a&&(a=this._getRange()),b=this.app.window.getSelection(),b.removeAllRanges(),b.addRange(a)},b.prototype._movingEvent=function(a){var b;return"click"===a.type||(b=a.which)===f.RIGHT||b===f.LEFT||b===f.UP||b===f.DOWN},b.prototype._unwrap=function(a){var b;return a=$(a).unwrap().get(0),(b=a.nextSibling)&&b.nodeValue&&(a.nodeValue+=b.nodeValue,$(b).remove()),a},b.prototype.catchQuery=function(a){var b,c,d,e,g,h,i,j,k,l;if(!this.app.isComposing&&(k=this._getRange())){if(a.which===f.ENTER)return(c=$(k.startContainer).closest(".atwho-query")).contents().unwrap(),c.is(":empty")&&c.remove(),(c=$(".atwho-query",this.app.document)).text(c.text()).contents().last().unwrap(),void this._clearRange();if(/firefox/i.test(navigator.userAgent)){if($(k.startContainer).is(this.$inputor))return void this._clearRange();a.which===f.BACKSPACE&&k.startContainer.nodeType===document.ELEMENT_NODE&&(i=k.startOffset-1)>=0?(l=k.cloneRange(),l.setStart(k.startContainer,i),$(l.cloneContents()).contents().last().is(".atwho-inserted")&&(e=$(k.startContainer).contents().get(i),this._setRange("after",$(e).contents().last()))):a.which===f.LEFT&&k.startContainer.nodeType===document.TEXT_NODE&&(b=$(k.startContainer.previousSibling),b.is(".atwho-inserted")&&0===k.startOffset&&this._setRange("after",b.contents().last()))}return $(k.startContainer).closest(".atwho-inserted").addClass("atwho-query").siblings().removeClass("atwho-query"),(c=$(".atwho-query",this.app.document)).length>0&&c.is(":empty")&&0===c.text().length&&c.remove(),this._movingEvent(a)||c.removeClass("atwho-inserted"),l=k.cloneRange(),l.setStart(k.startContainer,0),h=this.callbacks("matcher").call(this,this.at,l.toString(),this.getOpt("startWithSpace")),0===c.length&&"string"==typeof h&&(d=k.startOffset-this.at.length-h.length)>=0&&(k.setStart(k.startContainer,d),c=$("<span/>",this.app.document).attr(this.getOpt("editableAtwhoQueryAttrs")).addClass("atwho-query"),k.surroundContents(c.get(0)),g=c.contents().last().get(0),/firefox/i.test(navigator.userAgent)?(k.setStart(g,g.length),k.setEnd(g,g.length),this._clearRange(k)):this._setRange("after",g,k)),"string"==typeof h&&h.length<=this.getOpt("maxLen",20)?(j={text:h,el:c},this.trigger("matched",[this.at,j.text]),this.query=j):(this.view.hide(),this.query={el:c},c.text().indexOf(this.at)>=0&&(this._movingEvent(a)&&c.hasClass("atwho-inserted")?c.removeClass("atwho-query"):!1!==this.callbacks("afterMatchFailed").call(this,this.at,c)&&this._setRange("after",this._unwrap(c.text(c.text()).contents().first()))),null)}},b.prototype.rect=function(){var a,b,c;return c=this.query.el.offset(),this.app.iframe&&!this.app.iframeAsRoot&&(b=(a=$(this.app.iframe)).offset(),c.left+=b.left-this.$inputor.scrollLeft(),c.top+=b.top-this.$inputor.scrollTop()),c.bottom=c.top+this.query.el.height(),c},b.prototype.insert=function(a){var b,c,d;return c=(c=this.getOpt("suffix"))?c:c||" ",this.query.el.removeClass("atwho-query").addClass("atwho-inserted").html(a),(b=this._getRange())&&(b.setEndAfter(this.query.el[0]),b.collapse(!1),b.insertNode(d=this.app.document.createTextNode(c)),this._setRange("after",d,b)),this.$inputor.is(":focus")||this.$inputor.focus(),this.$inputor.change()},b}(c),g=function(){function a(a){this.context=a,this.at=this.context.at,this.storage=this.context.$inputor}return a.prototype.destroy=function(){return this.storage.data(this.at,null)},a.prototype.saved=function(){return this.fetch()>0},a.prototype.query=function(a,b){var c,d,e;return c=this.fetch(),d=this.context.getOpt("searchKey"),c=this.context.callbacks("filter").call(this.context,a,c,d)||[],e=this.context.callbacks("remoteFilter"),c.length>0||!e&&0===c.length?b(c):e.call(this.context,a,b)},a.prototype.fetch=function(){return this.storage.data(this.at)||[]},a.prototype.save=function(a){return this.storage.data(this.at,this.context.callbacks("beforeSave").call(this.context,a||[]))},a.prototype.load=function(a){return!this.saved()&&a?this._load(a):void 0},a.prototype.reload=function(a){return this._load(a)},a.prototype._load=function(a){return"string"==typeof a?$.ajax(a,{dataType:"json"}).done(function(a){return function(b){return a.save(b)}}(this)):this.save(a)},a}(),i=function(){function a(a){this.context=a,this.$el=$("<div class='atwho-view'><ul class='atwho-view-ul'></ul></div>"),this.timeoutID=null,this.context.$el.append(this.$el),this.bindEvent()}return a.prototype.init=function(){var a;return a=this.context.getOpt("alias")||this.context.at.charCodeAt(0),this.$el.attr({id:"at-view-"+a})},a.prototype.destroy=function(){return this.$el.remove()},a.prototype.bindEvent=function(){var a;return a=this.$el.find("ul"),a.on("mouseenter.atwho-view","li",function(b){return a.find(".cur").removeClass("cur"),$(b.currentTarget).addClass("cur")}).on("click.atwho-view","li",function(b){return function(c){return a.find(".cur").removeClass("cur"),$(c.currentTarget).addClass("cur"),b.choose(c),c.preventDefault()}}(this))},a.prototype.visible=function(){return this.$el.is(":visible")},a.prototype.choose=function(a){var b,c;return(b=this.$el.find(".cur")).length&&(c=this.context.insertContentFor(b),this.context.insert(this.context.callbacks("beforeInsert").call(this.context,c,b),b),this.context.trigger("inserted",[b,a]),this.hide(a)),this.context.getOpt("hideWithoutSuffix")?this.stopShowing=!0:void 0},a.prototype.reposition=function(a){var b,c,d,e;return e=this.context.app.iframeAsRoot?this.context.app.window:window,a.bottom+this.$el.height()-$(e).scrollTop()>$(e).height()&&(a.bottom=a.top-this.$el.height()),a.left>(c=$(e).width()-this.$el.width()-5)&&(a.left=c),b={left:a.left,top:a.bottom},null!=(d=this.context.callbacks("beforeReposition"))&&d.call(this.context,b),this.$el.offset(b),this.context.trigger("reposition",[b])},a.prototype.next=function(){var a,b;return a=this.$el.find(".cur").removeClass("cur"),b=a.next(),b.length||(b=this.$el.find("li:first")),b.addClass("cur"),this.$el.animate({scrollTop:Math.max(0,a.innerHeight()*(b.index()+2)-this.$el.height())},150)},a.prototype.prev=function(){var a,b;return a=this.$el.find(".cur").removeClass("cur"),b=a.prev(),b.length||(b=this.$el.find("li:last")),b.addClass("cur"),this.$el.animate({scrollTop:Math.max(0,a.innerHeight()*(b.index()+2)-this.$el.height())},150)},a.prototype.show=function(){var a;return this.stopShowing?void(this.stopShowing=!1):(this.visible()||(this.$el.show(),this.$el.scrollTop(0),this.context.trigger("shown")),(a=this.context.rect())?this.reposition(a):void 0)},a.prototype.hide=function(a,b){var c;if(this.visible())return isNaN(b)?(this.$el.hide(),this.context.trigger("hidden",[a])):(c=function(a){return function(){return a.hide()}}(this),clearTimeout(this.timeoutID),this.timeoutID=setTimeout(c,b))},a.prototype.render=function(a){var b,c,d,e,f,g,h;if(!($.isArray(a)&&a.length>0))return void this.hide();for(this.$el.find("ul").empty(),c=this.$el.find("ul"),f=this.context.getOpt("displayTpl"),g=0,h=a.length;h>g;g++)d=a[g],d=$.extend({},d,{"atwho-at":this.context.at}),e=this.context.callbacks("tplEval").call(this.context,f,d),b=$(this.context.callbacks("highlighter").call(this.context,e,this.context.query.text)),b.data("item-data",d),c.append(b);return this.show(),this.context.getOpt("highlightFirst")?c.find("li:first").addClass("cur"):void 0},a}(),f={DOWN:40,UP:38,ESC:27,TAB:9,ENTER:13,CTRL:17,P:80,N:78,LEFT:37,UP:38,RIGHT:39,DOWN:40,BACKSPACE:8,SPACE:32},d={beforeSave:function(a){return c.arrayToDefaultHash(a)},matcher:function(a,b,c){var d,e,f,g;return a=a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),c&&(a="(?:^|\\s)"+a),f=decodeURI("%C3%80"),g=decodeURI("%C3%BF"),e=new RegExp(""+a+"([A-Za-z"+f+"-"+g+"0-9_.+-]*)$|"+a+"([^\\x00-\\xff]*)$","gi"),d=e.exec(b),d?d[2]||d[1]:null},filter:function(a,b,c){var d,e,f,g;for(g=[],e=0,f=b.length;f>e;e++)d=b[e],~new String(d[c]).toLowerCase().indexOf(a.toLowerCase())&&g.push(d);return g},remoteFilter:null,sorter:function(a,b,c){var d,e,f,g;if(!a)return b;for(g=[],e=0,f=b.length;f>e;e++)d=b[e],d.atwho_order=new String(d[c]).toLowerCase().indexOf(a.toLowerCase()),d.atwho_order>-1&&g.push(d);return g.sort(function(a,b){return a.atwho_order-b.atwho_order})},tplEval:function(a,b){var c;try{return a.replace(/\$\{([^\}]*)\}/g,function(a,c){return b[c]})}catch(d){return c=d,""}},highlighter:function(a,b){var c;return b?(c=new RegExp(">\\s*(\\w*?)("+b.replace("+","\\+")+")(\\w*)\\s*<","ig"),a.replace(c,function(a,b,c,d){return"> "+b+"<strong>"+c+"</strong>"+d+" <"})):a},beforeInsert:function(a){return a},beforeReposition:function(a){return a},afterMatchFailed:function(){}},a={load:function(a,b){var c;return(c=this.controller(a))?c.model.load(b):void 0},isSelecting:function(){var a;return null!=(a=this.controller())?a.view.visible():void 0},setIframe:function(a,b){return this.setupRootElement(a,b),null},run:function(){return this.dispatch()},destroy:function(){return this.shutdown(),this.$inputor.data("atwho",null)}},$.fn.atwho=function(c){var d,e;return e=arguments,d=null,this.filter('textarea, input, [contenteditable=""], [contenteditable=true]').each(function(){var f,g;return(g=(f=$(this)).data("atwho"))||f.data("atwho",g=new b(this)),"object"!=typeof c&&c?a[c]&&g?d=a[c].apply(g,Array.prototype.slice.call(e,1)):$.error("Method "+c+" does not exist on jQuery.caret"):g.reg(c.at,c)}),d||this},$.fn.atwho["default"]={at:void 0,alias:void 0,data:null,displayTpl:"<li>${name}</li>",insertTpl:"${atwho-at}${name}",callbacks:d,searchKey:"name",suffix:void 0,hideWithoutSuffix:!1,startWithSpace:!0,highlightFirst:!0,limit:5,maxLen:20,displayTimeout:300,delay:null,spaceSelectsMatch:!1,editableAtwhoQueryAttrs:{}}});/*!
Autosize 1.18.18
license: MIT
http://www.jacklmoore.com/autosize
*/
!function(e){var t,o={className:"autosizejs",id:"autosizejs",append:"\n",callback:!1,resizeDelay:10,placeholder:!0},i=["fontFamily","fontSize","fontWeight","fontStyle","letterSpacing","textTransform","wordSpacing","textIndent","whiteSpace"],a=e('<textarea tabindex="-1"/>').data("autosize",!0)[0];a.style.cssText="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; padding: 0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden; transition:none; -webkit-transition:none; -moz-transition:none;",a.style.lineHeight="99px","99px"===e(a).css("lineHeight")&&i.push("lineHeight"),a.style.lineHeight="",e.fn.autosize=function(n){return this.length?(n=e.extend({},o,n||{}),a.parentNode!==document.body&&e(document.body).append(a),this.each(function(){function o(){var t,o=window.getComputedStyle?window.getComputedStyle(u,null):null;o?(t=parseFloat(o.width),("border-box"===o.boxSizing||"border-box"===o.webkitBoxSizing||"border-box"===o.mozBoxSizing)&&e.each(["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"],function(e,i){t-=parseFloat(o[i])})):t=p.width(),a.style.width=Math.max(t,0)+"px"}function s(){var s={};if(t=u,a.className=n.className,a.id=n.id,d=parseFloat(p.css("maxHeight")),e.each(i,function(e,t){s[t]=p.css(t)}),e(a).css(s).attr("wrap",p.attr("wrap")),o(),window.chrome){var r=u.style.width;u.style.width="0px";{u.offsetWidth}u.style.width=r}}function r(){var e,i;t!==u?s():o(),a.value=!u.value&&n.placeholder?p.attr("placeholder")||"":u.value,a.value+=n.append||"",a.style.overflowY=u.style.overflowY,i=parseFloat(u.style.height)||0,a.scrollTop=0,a.scrollTop=9e4,e=a.scrollTop,d&&e>d?(u.style.overflowY="scroll",e=d):(u.style.overflowY="hidden",c>e&&(e=c)),e+=z,Math.abs(i-e)>.01&&(u.style.height=e+"px",a.className=a.className,w&&n.callback.call(u,u),p.trigger("autosize.resized"))}function l(){clearTimeout(h),h=setTimeout(function(){var e=p.width();e!==b&&(b=e,r())},parseInt(n.resizeDelay,10))}var d,c,h,u=this,p=e(u),z=0,w=e.isFunction(n.callback),f={height:u.style.height,overflow:u.style.overflow,overflowY:u.style.overflowY,wordWrap:u.style.wordWrap,resize:u.style.resize},b=p.width(),g=p.css("resize");p.data("autosize")||(p.data("autosize",!0),("border-box"===p.css("box-sizing")||"border-box"===p.css("-moz-box-sizing")||"border-box"===p.css("-webkit-box-sizing"))&&(z=p.outerHeight()-p.height()),c=Math.max(parseFloat(p.css("minHeight"))-z||0,p.height()),p.css({overflow:"hidden",overflowY:"hidden",wordWrap:"break-word"}),"vertical"===g?p.css("resize","none"):"both"===g&&p.css("resize","horizontal"),"onpropertychange"in u?"oninput"in u?p.on("input.autosize keyup.autosize",r):p.on("propertychange.autosize",function(){"value"===event.propertyName&&r()}):p.on("input.autosize",r),n.resizeDelay!==!1&&e(window).on("resize.autosize",l),p.on("autosize.resize",r),p.on("autosize.resizeIncludeStyle",function(){t=null,r()}),p.on("autosize.destroy",function(){t=null,clearTimeout(h),e(window).off("resize",l),p.off("autosize").off(".autosize").css(f).removeData("autosize")}),r())})):this}}(jQuery||$);/*! jquery.caret 2015-02-01 */
!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(c){return a.returnExportsGlobal=b(c)}):"object"==typeof exports?module.exports=b(require("jquery")):b(jQuery)}(this,function(a){"use strict";var b,c,d,e,f,g,h,i,j,k,l;k="caret",b=function(){function b(a){this.$inputor=a,this.domInputor=this.$inputor[0]}return b.prototype.setPos=function(){return this.domInputor},b.prototype.getIEPosition=function(){return this.getPosition()},b.prototype.getPosition=function(){var a,b;return b=this.getOffset(),a=this.$inputor.offset(),b.left-=a.left,b.top-=a.top,b},b.prototype.getOldIEPos=function(){var a,b;return b=h.selection.createRange(),a=h.body.createTextRange(),a.moveToElementText(this.domInputor),a.setEndPoint("EndToEnd",b),a.text.length},b.prototype.getPos=function(){var a,b,c;return(c=this.range())?(a=c.cloneRange(),a.selectNodeContents(this.domInputor),a.setEnd(c.endContainer,c.endOffset),b=a.toString().length,a.detach(),b):h.selection?this.getOldIEPos():void 0},b.prototype.getOldIEOffset=function(){var a,b;return a=h.selection.createRange().duplicate(),a.moveStart("character",-1),b=a.getBoundingClientRect(),{height:b.bottom-b.top,left:b.left,top:b.top}},b.prototype.getOffset=function(){var b,c,d,e,f;return j.getSelection&&(d=this.range())?(d.endOffset-1>0&&d.endContainer===!this.domInputor&&(b=d.cloneRange(),b.setStart(d.endContainer,d.endOffset-1),b.setEnd(d.endContainer,d.endOffset),e=b.getBoundingClientRect(),c={height:e.height,left:e.left+e.width,top:e.top},b.detach()),c&&0!==(null!=c?c.height:void 0)||(b=d.cloneRange(),f=a(h.createTextNode("|")),b.insertNode(f[0]),b.selectNode(f[0]),e=b.getBoundingClientRect(),c={height:e.height,left:e.left,top:e.top},f.remove(),b.detach())):h.selection&&(c=this.getOldIEOffset()),c&&(c.top+=a(j).scrollTop(),c.left+=a(j).scrollLeft()),c},b.prototype.range=function(){var a;if(j.getSelection)return a=j.getSelection(),a.rangeCount>0?a.getRangeAt(0):null},b}(),c=function(){function b(a){this.$inputor=a,this.domInputor=this.$inputor[0]}return b.prototype.getIEPos=function(){var a,b,c,d,e,f,g;return b=this.domInputor,f=h.selection.createRange(),e=0,f&&f.parentElement()===b&&(d=b.value.replace(/\r\n/g,"\n"),c=d.length,g=b.createTextRange(),g.moveToBookmark(f.getBookmark()),a=b.createTextRange(),a.collapse(!1),e=g.compareEndPoints("StartToEnd",a)>-1?c:-g.moveStart("character",-c)),e},b.prototype.getPos=function(){return h.selection?this.getIEPos():this.domInputor.selectionStart},b.prototype.setPos=function(a){var b,c;return b=this.domInputor,h.selection?(c=b.createTextRange(),c.move("character",a),c.select()):b.setSelectionRange&&b.setSelectionRange(a,a),b},b.prototype.getIEOffset=function(a){var b,c,d,e;return c=this.domInputor.createTextRange(),a||(a=this.getPos()),c.move("character",a),d=c.boundingLeft,e=c.boundingTop,b=c.boundingHeight,{left:d,top:e,height:b}},b.prototype.getOffset=function(b){var c,d,e;return c=this.$inputor,h.selection?(d=this.getIEOffset(b),d.top+=a(j).scrollTop()+c.scrollTop(),d.left+=a(j).scrollLeft()+c.scrollLeft(),d):(d=c.offset(),e=this.getPosition(b),d={left:d.left+e.left-c.scrollLeft(),top:d.top+e.top-c.scrollTop(),height:e.height})},b.prototype.getPosition=function(b){var c,e,f,g,h,i,j;return c=this.$inputor,g=function(b){return a("<div></div>").text(b).html().replace(/\r\n|\r|\n/g,"<br/>").replace(/\s/g," ")},void 0===b&&(b=this.getPos()),j=c.val().slice(0,b),f=c.val().slice(b),h="<span style='position: relative; display: inline;'>"+g(j)+"</span>",h+="<span id='caret' style='position: relative; display: inline;'>|</span>",h+="<span style='position: relative; display: inline;'>"+g(f)+"</span>",i=new d(c),e=i.create(h).rect()},b.prototype.getIEPosition=function(a){var b,c,d,e,f;return d=this.getIEOffset(a),c=this.$inputor.offset(),e=d.left-c.left,f=d.top-c.top,b=d.height,{left:e,top:f,height:b}},b}(),d=function(){function b(a){this.$inputor=a}return b.prototype.css_attr=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle","borderTopWidth","boxSizing","fontFamily","fontSize","fontWeight","height","letterSpacing","lineHeight","marginBottom","marginLeft","marginRight","marginTop","outlineWidth","overflow","overflowX","overflowY","paddingBottom","paddingLeft","paddingRight","paddingTop","textAlign","textOverflow","textTransform","wordBreak","wordWrap"],b.prototype.mirrorCss=function(){var b,c=this;return b={position:"absolute",left:-9999,top:0,zIndex:-2e4,whiteSpace:"pre-wrap"},"TEXTAREA"===this.$inputor.prop("tagName")&&this.css_attr.push("width"),a.each(this.css_attr,function(a,d){return b[d]=c.$inputor.css(d)}),b},b.prototype.create=function(b){return this.$mirror=a("<div></div>"),this.$mirror.css(this.mirrorCss()),this.$mirror.html(b),this.$inputor.after(this.$mirror),this},b.prototype.rect=function(){var a,b,c;return a=this.$mirror.find("#caret"),b=a.position(),c={left:b.left,top:b.top,height:a.height()},this.$mirror.remove(),c},b}(),e={contentEditable:function(a){return!(!a[0].contentEditable||"true"!==a[0].contentEditable)}},g={pos:function(a){return a||0===a?this.setPos(a):this.getPos()},position:function(a){return h.selection?this.getIEPosition(a):this.getPosition(a)},offset:function(a){var b;return b=this.getOffset(a)}},h=null,j=null,i=null,l=function(a){var b;return(b=null!=a?a.iframe:void 0)?(i=b,j=b.contentWindow,h=b.contentDocument||j.document):(i=void 0,j=window,h=document)},f=function(a){var b;h=a[0].ownerDocument,j=h.defaultView||h.parentWindow;try{return i=j.frameElement}catch(c){b=c}},a.fn.caret=function(d,f,h){var i;return g[d]?(a.isPlainObject(f)?(l(f),f=void 0):l(h),i=e.contentEditable(this)?new b(this):new c(this),g[d].apply(i,[f])):a.error("Method "+d+" does not exist on jQuery.caret")},a.fn.caret.EditableCaret=b,a.fn.caret.InputCaret=c,a.fn.caret.Utils=e,a.fn.caret.apis=g});/*!
* jQuery Cookie Plugin v1.4.0
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2013 Klaus Hartl
* Released under the MIT license
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as anonymous module.
define(['jquery'], factory);
} else {
// Browser globals.
factory(jQuery);
}
}(function ($) {
var pluses = /\+/g;
function encode(s) {
return config.raw ? s : encodeURIComponent(s);
}
function decode(s) {
return config.raw ? s : decodeURIComponent(s);
}
function stringifyCookieValue(value) {
return encode(config.json ? JSON.stringify(value) : String(value));
}
function parseCookieValue(s) {
if (s.indexOf('"') === 0) {
// This is a quoted cookie as according to RFC2068, unescape...
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
}
try {
// Replace server-side written pluses with spaces.
// If we can't decode the cookie, ignore it, it's unusable.
// If we can't parse the cookie, ignore it, it's unusable.
s = decodeURIComponent(s.replace(pluses, ' '));
return config.json ? JSON.parse(s) : s;
} catch(e) {}
}
function read(s, converter) {
var value = config.raw ? s : parseCookieValue(s);
return $.isFunction(converter) ? converter(value) : value;
}
var config = $.cookie = function (key, value, options) {
// Write
if (value !== undefined && !$.isFunction(value)) {
options = $.extend({}, config.defaults, options);
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setTime(+t + days * 864e+5);
}
return (document.cookie = [
encode(key), '=', stringifyCookieValue(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// Read
var result = key ? undefined : {};
// To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all. Also prevents odd result when
// calling $.cookie().
var cookies = document.cookie ? document.cookie.split('; ') : [];
for (var i = 0, l = cookies.length; i < l; i++) {
var parts = cookies[i].split('=');
var name = decode(parts.shift());
var cookie = parts.join('=');
if (key && key === name) {
// If second argument (value) is a function it's a converter...
result = read(cookie, value);
break;
}
// Prevent storing a cookie that we couldn't decode.
if (!key && (cookie = read(cookie)) !== undefined) {
result[name] = cookie;
}
}
return result;
};
config.defaults = {};
$.removeCookie = function (key, options) {
if ($.cookie(key) === undefined) {
return false;
}
// Must not alter options, thus extending a fresh object...
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
return !$.cookie(key);
};
}));
/*
* jQuery throttle / debounce - v1.1 - 3/7/2010
* http://benalman.com/projects/jquery-throttle-debounce-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this);/***********************************************************************
| Devblocks(tm) developed by Webgroup Media, LLC.
|-----------------------------------------------------------------------
| All source code & content (c) Copyright 2002-2019, Webgroup Media LLC
| unless specifically noted otherwise.
|
| This source code is released under the Devblocks Public License.
| The latest version of this license can be found here:
| http://cerb.ai/license
|
| By using this software, you acknowledge having read this license
| and agree to be bound thereby.
| ______________________________________________________________________
| http://cerb.ai http://webgroup.media
***********************************************************************/
$.fn.extend({
devblocksCharts : function(type, options) {
var getMousePositionFromEvent = function(e) {
var pos = { x: 0, y: 0 };
if(undefined != e.offsetX) {
pos.x = e.offsetX;
pos.y = e.offsetY;
} else if(undefined != e.layerX) {
pos.x = e.layerX;
pos.y = e.layerY;
} else if(null != e.originalEvent && undefined != e.originalEvent.layerX) {
pos.x = e.originalEvent.layerX;
pos.y = e.originalEvent.layerY;
}
return pos;
}
var drawGauge = function($canvas, options) {
var canvas = $canvas.get(0);
var context = canvas.getContext('2d');
var chart_height = canvas.height;
var chart_width = canvas.width;
if(null == options.threshold_colors)
options.threshold_colors = ['#6BA81E', '#F9B326', '#D23E2E'];
if(null == options.radius)
options.radius = 90;
if(null == options.legend)
options.legend = true;
if(null == options.metric)
options.metric = 0;
if(null == options.metric_label)
options.metric_label = options.metric;
if(null == options.threshold_values)
options.threshold_values = [33, 66, 100];
if(null == options.threshold_labels)
options.threshold_labels = options.threshold_values;
var metric_min = options.metric_min ? options.metric_min : 0;
var metric_max = options.threshold_values[options.threshold_values.length-1];
if(options.metric < metric_min)
options.metric = metric_min;
if(options.metric > metric_max)
options.metric = metric_max;
if(null != options.metric_compare && options.metric_compare > metric_max)
options.metric_compare = metric_max;
// Dial
var piecenter_x = options.radius + 10;
var piecenter_y = options.radius + 5;
var angle_start = Math.PI;
var range = metric_max - metric_min;
var value_last = metric_min;
for(var idx in options.threshold_values) {
context.beginPath();
context.moveTo(piecenter_x, piecenter_y);
context.fillStyle = options.threshold_colors[idx];
var value = parseFloat(options.threshold_values[idx]);
var angle_wedge = (Math.abs(value_last - value)/range * Math.PI);
context.arc(piecenter_x, piecenter_y, options.radius, angle_start, angle_start + angle_wedge, false);
angle_start += angle_wedge;
value_last = value;
context.lineTo(piecenter_x, piecenter_y);
context.fill();
//context.stroke();
}
// White out the inside of the gauge
context.beginPath();
context.moveTo(piecenter_x, piecenter_y);
context.fillStyle = '#FFFFFF';
context.arc(piecenter_x, piecenter_y, options.radius * 0.75, Math.PI, 2 * Math.PI, false);
context.lineTo(piecenter_x, piecenter_y);
context.fill();
// Label the min
if(options.metric_label_min) {
context.font = '10px Verdana';
context.fillStyle = 'gray';
context.textBaseline = 'top';
var measure = context.measureText(options.metric_label_min);
context.fillText(options.metric_label_min, 10, piecenter_y+3);
}
// Label the max
if(options.metric_label_max) {
context.font = '10px Verdana';
context.fillStyle = 'gray';
context.textBaseline = 'top';
var measure = context.measureText(options.metric_label_max);
context.fillText(options.metric_label_max, chart_width-10-measure.width, piecenter_y+3);
}
// Legend
if(options.legend) {
context.font = 'bold 12px Verdana';
context.textBaseline = 'top';
legend_x = (options.radius * 2) + 35;
legend_y = 10;
for(idx in options.threshold_values) {
context.fillStyle = options.threshold_colors[idx];
context.fillRect(legend_x,legend_y,20,20);
legend_x += 25;
label = options.threshold_labels[idx];
context.fillStyle = 'black';
context.fillText(label, legend_x, legend_y);
legend_y += 25;
legend_x -= 25;
}
}
// Comparison Needle
if(null != options.metric_compare) {
context.save();
context.translate(piecenter_x, piecenter_y);
theta = (Math.PI/metric_max) * options.metric_compare;
context.rotate(theta);
context.beginPath();
context.strokeStyle = '#F9B326';
context.lineWidth = 5;
context.moveTo(-1 * options.radius * 0.9,0);
context.lineTo(-1 * options.radius * 1.1,0);
context.stroke();
context.restore();
}
// Knob
context.beginPath();
context.fillStyle = 'black';
context.arc(piecenter_x, piecenter_y, 8, 0, 2 * Math.PI, false);
context.fill();
context.save();
// Needle
context.translate(piecenter_x, piecenter_y);
var theta = (Math.PI/range) * Math.abs(metric_min - options.metric);
context.rotate(theta);
context.beginPath();
context.fillStyle = 'black';
context.moveTo(3,4);
context.lineTo(3,-4);
context.lineTo(-1 * (options.radius * 1.1),0);
context.fill();
// Accent
context.beginPath();
context.strokeStyle = '#383838';
context.moveTo(0,0);
context.lineWidth = 1;
context.lineTo(-1 * (options.radius * 1.1),0);
context.stroke();
context.restore();
// Metric
context.font = 'bold 15px Verdana';
context.fillStyle = 'black';
context.textBaseline = 'top';
var measure = context.measureText(options.metric_label);
context.fillText(options.metric_label, piecenter_x-(measure.width/2), piecenter_y+12);
};
var drawPieChart = function($canvas, options) {
$canvas
.data('model', options)
.each(function(e) {
var $canvas = $(this);
var canvas = $canvas.get(0);
var context = canvas.getContext('2d');
var options = $canvas.data('model');
var chart_height = canvas.height;
var chart_width = canvas.width;
var arclen = 2 * Math.PI;
var piecenter_x = Math.floor(chart_width/2);
var piecenter_y = Math.floor(chart_height/2);
$canvas.data('piecenter_x', piecenter_x);
$canvas.data('piecenter_y', piecenter_y);
// Cache: Plots chart coords
var area_sum = 0;
for(idx in options.wedge_values) {
area_sum += options.wedge_values[idx];
}
var wedges = [];
var arclen = 0;
var partlen = 0;
for(idx in options.wedge_values) {
area_used += options.wedge_values[idx];
var area = options.wedge_values[idx];
var partlen = 2 * Math.PI * (options.wedge_values[idx]/area_sum);
wedges[wedges.length] = {
'index': idx,
'value': area,
'ratio': area / area_sum,
'start': arclen,
'part_length': partlen,
'length': arclen + partlen
}
arclen += partlen;
}
$canvas.data('wedges', wedges);
})
;
var canvas = $canvas.get(0);
var context = canvas.getContext('2d');
var chart_width = canvas.width;
var chart_height = canvas.height;
if(null == options.wedge_colors)
options.wedge_colors = [
'#57970A',
'#007CBD',
'#7047BA',
'#8B0F98',
'#CF2C1D',
'#E97514',
'#FFA100',
'#3E6D07',
'#345C05',
'#005988',
'#004B73',
'#503386',
'#442B71',
'#640A6D',
'#55085C',
'#951F14',
'#7E1A11',
'#A8540E',
'#8E470B',
'#B87400',
'#9C6200',
'#CCCCCC',
];
if(null == options.radius)
options.radius = 90;
// Wedges
var arclen = 2 * Math.PI;
var piecenter_x = Math.floor(chart_width/2);
var piecenter_y = Math.floor(chart_height/2);
var area_sum = 0;
var area_used = 0;
for(idx in options.wedge_values) {
area_sum += options.wedge_values[idx];
}
for(idx in options.wedge_values) {
context.beginPath();
context.moveTo(piecenter_x, piecenter_y);
context.fillStyle = options.wedge_colors[idx];
context.strokeStyle = options.wedge_colors[idx];
context.lineWidth = 1;
context.lineCap = 'square';
partlen = 2 * Math.PI * (options.wedge_values[idx]/area_sum);
area_used += options.wedge_values[idx];
context.arc(piecenter_x, piecenter_y, options.radius, arclen, arclen + partlen, false);
context.lineTo(piecenter_x, piecenter_y);
context.fill();
context.stroke();
arclen += partlen;
}
$canvas.on('mousemove click', function(e) {
var canvas = $(this).get(0);
var context = canvas.getContext('2d');
var chart_height = canvas.height;
var chart_width = canvas.width;
var options = $(this).data('model');
var wedges = $(this).data('wedges');
var piecenter_x = $(this).data('piecenter_x');
var piecenter_y = $(this).data('piecenter_y');
var radius = options.radius || 90;
var mouse_pos = getMousePositionFromEvent(e);
var new_radius = Math.sqrt(Math.pow(piecenter_x - mouse_pos.x, 2) + Math.pow(piecenter_y - mouse_pos.y, 2));
var origin = { 'x': piecenter_x, 'y': piecenter_y - new_radius };
var angle = Math.atan2(mouse_pos.y - origin.y, mouse_pos.x - origin.x) * 2;
var scaled_point = {
'x': Math.floor(piecenter_x + Math.sin(Math.PI - angle) * radius),
'y': Math.floor(piecenter_y + Math.cos(Math.PI - angle) * radius)
};
var area_sum = 0;
var closest_dist = 100;
var closest_point = null;
var closest_wedge = null;
var me = Math.atan2(scaled_point.y - piecenter_y, scaled_point.x - piecenter_x);
if(me < 0)
me = 2 * Math.PI + me;
for(idx in wedges) {
var angle = Math.PI - ((area_sum * Math.PI * 2) + (Math.PI/2));
var position = {
'x': Math.floor(piecenter_x + radius * Math.sin(angle)),
'y': Math.floor(piecenter_y + radius * Math.cos(angle))
};
var it = Math.atan2(position.y - piecenter_y, position.x - piecenter_x);
if(it < 0)
it = 2 * Math.PI + it;
var dist = me - it;
if(dist > 0 && dist < closest_dist) {
closest_dist = dist;
closest_point = position;
closest_wedge = wedges[idx];
}
area_sum += wedges[idx].ratio;
}
if(null == closest_wedge)
return;
// Trigger the event
var event = new jQuery.Event('devblocks-chart-' + e.type, {
'closest': closest_wedge
});
$(this).trigger(event);
});
};
var drawLineChart = function($canvas, params) {
$canvas
.data('model', params)
// [TODO] This could be handled on the main pass through below
.each(function(e) {
canvas = $(this).get(0);
context = canvas.getContext('2d');
options = $(this).data('model');
var margin = 5;
var chart_width = canvas.width;
var chart_height = canvas.height - (2 * margin);
var max_value = 0;
var min_value = 0;
// Cache: Find the max y-value across every series
for(series_idx in options.series) {
for(idx in options.series[series_idx].data) {
value = options.series[series_idx].data[idx].y;
max_value = Math.max(value, max_value);
min_value = Math.min(value, min_value);
}
}
var range = Math.abs(max_value - min_value);
var zero_ypos = Math.floor(chart_height * (max_value/range)) + margin - (0 == margin % 2 ? 0 : 0.5);
// Cache: Plots chart coords
plots = [];
for(series_idx in options.series) {
series = options.series[series_idx];
if(null == series.data)
continue;
plots[series_idx] = [];
count = series.data.length;
xtick_width = chart_width / (count-1);
ytick_height = chart_height / range;
for(idx in series.data) {
point = series.data[idx];
chart_x = idx * xtick_width;
value_yheight = Math.floor(ytick_height * Math.abs(point.y));
if(point.y >= 0) {
chart_y = zero_ypos - value_yheight;
} else {
chart_y = zero_ypos + value_yheight;
}
len = plots[series_idx].length;
plots[series_idx][len] = {
'chart_x': chart_x,
'chart_y': chart_y,
'data': point
};
}
}
$(this).data('plots', plots);
})
;
var canvas = $canvas.get(0);
var context = canvas.getContext('2d');
var margin = 5;
var chart_width = canvas.width;
var chart_height = canvas.height - (2 * margin);
var max_value = 0;
var min_value = 0;
// Find the max y-value across every series
for(series_idx in params.series) {
for(idx in params.series[series_idx].data) {
value = params.series[series_idx].data[idx].y;
max_value = Math.max(value, max_value);
min_value = Math.min(value, min_value);
}
}
var range = Math.abs(max_value - min_value);
// Find the y-zero line (it may not be the bottom if we have negative values)
var zero_ypos = Math.floor(chart_height * (max_value/range)) + margin - (0 == margin % 2 ? 0 : 0.5);
context.lineWidth = 1;
var default_line_colors = [
'rgba(87, 151, 10, 1)',
'rgba(0, 124, 189, 1)',
'rgba(112, 71, 186, 1)',
'rgba(139, 15, 152, 1)',
'rgba(207, 44, 29, 1)',
'rgba(233, 117, 20, 1)',
'rgba(255, 161, 0, 1)',
'rgba(62, 109, 7, 1)',
'rgba(52, 92, 5, 1)',
'rgba(0, 89, 136, 1)',
'rgba(0, 75, 115, 1)',
'rgba(80, 51, 134, 1)',
'rgba(68, 43, 113, 1)',
'rgba(100, 10, 109, 1)',
'rgba(85, 8, 92, 1)',
'rgba(149, 31, 20, 1)',
'rgba(126, 26, 17, 1)',
'rgba(168, 84, 14, 1)',
'rgba(142, 71, 11, 1)',
'rgba(184, 116, 0, 1)',
'rgba(156, 98, 0, 1)',
'rgba(204, 204, 204, 1)'
];
var default_fill_colors = [
'rgba(87, 151, 10, 0.35)',
'rgba(0, 124, 189, 0.35)',
'rgba(112, 71, 186, 0.35)',
'rgba(139, 15, 152, 0.35)',
'rgba(207, 44, 29, 0.35)',
'rgba(233, 117, 20, 0.35)',
'rgba(255, 161, 0, 0.35)',
'rgba(62, 109, 7, 0.35)',
'rgba(52, 92, 5, 0.35)',
'rgba(0, 89, 136, 0.35)',
'rgba(0, 75, 115, 0.35)',
'rgba(80, 51, 134, 0.35)',
'rgba(68, 43, 113, 0.35)',
'rgba(100, 10, 109, 0.35)',
'rgba(85, 8, 92, 0.35)',
'rgba(149, 31, 20, 0.35)',
'rgba(126, 26, 17, 0.35)',
'rgba(168, 84, 14, 0.35)',
'rgba(142, 71, 11, 0.35)',
'rgba(184, 116, 0, 0.35)',
'rgba(156, 98, 0, 0.35)',
'rgba(204, 204, 204, 0.35)'
];
// Loop through multiple series
for(series_idx in params.series) {
var series = params.series[series_idx];
if(null == series.data)
continue;
if(null == series.options.line || series.options.line) {
if(null != series.options.line_color)
params.series[series_idx].options.line_color = series.options.line_color;
else if(null != default_line_colors[series_idx])
params.series[series_idx].options.line_color = default_line_colors[series_idx];
else
params.series[series_idx].options.line_color = 'rgba(5,141,199,1)';
}
if(null == series.options.fill || series.options.fill) {
if(null != series.options.fill_color)
params.series[series_idx].options.fill_color = series.options.fill_color;
else if(null != default_fill_colors[series_idx])
params.series[series_idx].options.fill_color = default_fill_colors[series_idx];
else
params.series[series_idx].options.fill_color = 'rgba(5,141,199,0.15)';
}
context.beginPath();
x = 0;
y = 0;
tick = 0;
count = series.data.length;
xtick_width = chart_width / (count-1);
ytick_height = chart_height / range;
// Fill
if(null != series.options.fill_color) {
context.moveTo(0, zero_ypos);
for(idx in series.data) {
value = series.data[idx].y;
x = tick;
value_yheight = Math.floor(ytick_height * Math.abs(value));
if(value >= 0) {
y = zero_ypos - value_yheight;
} else {
y = zero_ypos + value_yheight;
}
context.lineTo(x, y);
tick += xtick_width;
}
context.lineTo(x, zero_ypos);
context.fillStyle = series.options.fill_color;
context.fill();
}
// Stroke
if(series.options.line_color) {
context.beginPath();
context.strokeStyle = series.options.line_color;
context.lineJoin = 'round';
context.lineWidth = 3;
tick = 0;
for(idx in series.data) {
value = series.data[idx].y;
x = tick;
value_yheight = Math.floor(ytick_height * Math.abs(value));
if(value >= 0) {
y = zero_ypos - value_yheight;
} else {
y = zero_ypos + value_yheight;
}
context.lineTo(x, y);
tick += xtick_width;
}
context.stroke();
}
} // end series
$canvas.on('mousemove click', function(e) {
var options = $(this).data('model');
var plots = $(this).data('plots');
var mouse_pos = getMousePositionFromEvent(e);
var closest = {
'dist': 1000,
'chart_x': 0,
'chart_y': 0,
'data': [],
'series_idx': null
};
for(series_idx in plots) {
var count = plots[series_idx].length;
var series = options.series[series_idx];
for(idx in plots[series_idx]) {
var plot = plots[series_idx][idx];
var dist = 0;
if(plots.length == 1) {
dist = Math.abs(mouse_pos.x-plot.chart_x);
} else {
dist = Math.sqrt(Math.pow(mouse_pos.x-plot.chart_x,2) + Math.pow(mouse_pos.y-plot.chart_y,2));
}
if(dist < closest.dist) {
closest.dist = dist;
closest.data = plot.data;
closest.chart_x = plot.chart_x;
closest.chart_y = plot.chart_y;
closest.series_idx = series_idx;
}
}
}
// Trigger the event
var event = new jQuery.Event('devblocks-chart-' + e.type, {
'closest': closest
});
$(this).trigger(event);
});
};
var drawBarChart = function($canvas, params) {
$canvas
.data('model', params)
// [TODO] This could be handled on the main pass through below
.each(function(e) {
var canvas = $(this).get(0);
var context = canvas.getContext('2d');
var options = $(this).data('model');
var chart_height = canvas.height;
var chart_width = canvas.width;
// Cache: Plots chart coords
var plots = [];
var series_idx = 0;
var series = options.series[series_idx];
if(null == series.data)
return;
plots[series_idx] = [];
// [TODO] This should make sure all series are the same length
var count = series.data.length;
var xtick_width = Math.floor(chart_width / count);
$(this).data('xtick_width', xtick_width);
var chart_x = 0;
for(idx in series.data) {
var point = series.data[idx];
plots[plots.length] = {
'chart_x': chart_x,
'index': idx
};
chart_x = Math.floor(chart_x + xtick_width);
}
$(this).data('plots', plots);
})
;
try {
var canvas = $canvas.get(0);
var context = canvas.getContext('2d');
var default_colors = ['#57970A', '#007CBD', '#7047BA', '#8B0F98', '#CF2C1D', '#E97514', '#FFA100', '#3E6D07', '#345C05', '#005988', '#004B73', '#503386', '#442B71', '#640A6D', '#55085C', '#951F14', '#7E1A11', '#A8540E', '#8E470B', '#B87400', '#9C6200', '#CCCCCC'];
if(null == options.series[0].data)
return;
// [TODO] This should make sure all series are the same length
var count = options.series[0].data.length;
var chart_width = canvas.width;
var chart_height = canvas.height - 1;
var stack_data = [];
var highest_stack = 0;
var lowest_stack = 0;
// Build the series metadata
for(idx=0; idx < count; idx++) {
stack_data[idx] = { total: 0, pos: 0, neg: 0, pos_drawn: 0, neg_drawn: 0 };
for(series_idx in params.series) {
var series = params.series[series_idx];
if(null == series.data || 0 == series.data.length)
continue;
var val = series.data[idx].y;
stack_data[idx].total += val;
if(val >= 0)
stack_data[idx].pos += val;
else
stack_data[idx].neg += val;
}
// Find max height across all series
highest_stack = Math.max(stack_data[idx].total, highest_stack);
lowest_stack = Math.min(stack_data[idx].total, lowest_stack);
}
xtick_width = Math.floor(chart_width / count);
yrange = (highest_stack-lowest_stack);
ytick_height = chart_height / yrange;
// Find the zero y-position by using a proportion of highest stack to range
zero_ypos = Math.floor(chart_height * (highest_stack/yrange));
context.lineWidth = 1;
context.beginPath();
context.moveTo(0, zero_ypos);
context.lineTo(0, zero_ypos+1);
context.lineTo(chart_width, zero_ypos+1);
context.lineTo(chart_width, zero_ypos);
context.fillStyle = '#BBBBBB';
context.fill();
for(series_idx in params.series) {
var series = params.series[series_idx];
if(null == series.data || 0 == series.data.length)
continue;
if(null != series.options.color)
params.series[series_idx].options.color = series.options.color;
else if(null != default_colors[series_idx])
params.series[series_idx].options.color = default_colors[series_idx];
else
params.series[series_idx].options.color = '#455460';
var x = 0;
for(idx in series.data) {
try {
context.fillStyle = params.series[series_idx].options.color;
value = series.data[idx].y;
if(0 == value) {
x = Math.floor(x + xtick_width);
continue;
}
// [TODO] This gives a rounding error in bar heights w/ diff stacks of same total
// We need to level the bars before getting to this point
stack_yheight = Math.round(ytick_height * Math.abs(value));
// Always draw at least one pixel of height
stack_yheight = Math.max(stack_yheight, 1);
// Above the zero line
if(value >= 0) {
y = zero_ypos - stack_data[idx].pos_drawn - stack_yheight;
stack_data[idx].pos_drawn += stack_yheight;
// Below the zero line
} else {
y = zero_ypos + 1 + stack_data[idx].neg_drawn;
stack_data[idx].neg_drawn += stack_yheight;
}
context.beginPath();
context.moveTo(x, y);
context.lineTo(x, y + stack_yheight);
x = Math.floor(x + xtick_width);
context.lineTo(x-1, y + stack_yheight);
context.lineTo(x-1, y);
context.fill();
} catch(e) {
//console.log(e);
}
}
}
$canvas.on('mousemove click', function(e) {
var canvas = $(this).get(0);
var context = canvas.getContext('2d');
var chart_height = canvas.height;
var chart_width = canvas.width;
var options = $(this).data('model');
var plots = $(this).data('plots');
var xtick_width = $(this).data('xtick_width');
var mouse_pos = getMousePositionFromEvent(e);
var closest = {
'dist': 1000,
'data': null,
};
for(idx in plots) {
var plot = plots[idx];
var dist = Math.abs(mouse_pos.x-(plot.chart_x+(xtick_width/2)));
if(dist < closest.dist) {
closest.dist = dist;
closest.data = plot;
}
}
if(null == closest.data)
return;
// Trigger the event
var event = new jQuery.Event('devblocks-chart-' + e.type, {
'closest': closest
});
$(this).trigger(event);
});
} catch(e) {
//console.log(e);
}
};
var drawScatterPlot = function($canvas, options) {
$canvas
.data('model', options)
.each(function(e) {
var $canvas = $(this);
var canvas = $canvas.get(0);
var context = canvas.getContext('2d');
var options = $canvas.data('model');
// Cache
var margin = 5;
var chart_width = canvas.width - (2 * margin);
var chart_height = canvas.height - (2 * margin);
// Stats for the entire dataset
var stats = {
x_min: Number.MAX_VALUE,
x_max: Number.MIN_VALUE,
y_min: Number.MAX_VALUE,
y_max: Number.MIN_VALUE,
x_range: 0,
y_range: 0
}
for(series_idx in options.series) {
var series = options.series[series_idx];
if(null == series.data)
continue;
for(idx in series.data) {
var data = series.data[idx];
var x = data.x;
var y = data.y;
stats.x_min = Math.min(stats.x_min,x);
stats.x_max = Math.max(stats.x_max,x);
stats.y_min = Math.min(stats.y_min,y);
stats.y_max = Math.max(stats.y_max,y);
}
}
stats.x_range = Math.abs(stats.x_max - stats.x_min);
stats.y_range = Math.abs(stats.y_max - stats.y_min);
// Stats for each series
var series_stats = [];
for(series_idx in options.series) {
var series = options.series[series_idx];
if(null == series.data)
continue;
var minmax = {
x_min: Number.MAX_VALUE,
x_max: Number.MIN_VALUE,
y_min: Number.MAX_VALUE,
y_max: Number.MIN_VALUE,
x_range: 0,
y_range: 0
}
for(idx in series.data) {
var data = series.data[idx];
var x = data.x;
var y = data.y;
minmax.x_min = Math.min(minmax.x_min, x);
minmax.x_max = Math.max(minmax.x_max, x);
minmax.y_min = Math.min(minmax.y_min, y);
minmax.y_max = Math.max(minmax.y_max, y);
}
minmax.x_range = Math.abs(minmax.x_max - minmax.x_min);
minmax.y_range = Math.abs(minmax.y_max - minmax.y_min);
series_stats[series_idx] = minmax;
}
// Cache: Plots chart coords
var plots = [];
for(series_idx in options.series) {
var series = options.series[series_idx];
if(options.axes_independent) {
stat = series_stats[series_idx];
} else {
stat = stats;
}
if(null == series || null == series.data)
continue;
var xaxis_tick = (stat.x_range != 0) ? (chart_width / stat.x_range) : chart_width;
var yaxis_tick = (stat.y_range != 0) ? (chart_height / stat.y_range) : chart_height;
plots[series_idx] = [];
for(idx in series.data) {
var data = series.data[idx];
var x = data.x - stat.x_min;
var y = data.y - stat.y_min;
var chart_x = (xaxis_tick * x) + margin;
var chart_y = chart_height - (yaxis_tick * y) + margin;
plots[series_idx][idx] = {
'chart_x': chart_x,
'chart_y': chart_y,
'data': data
};
}
}
$canvas.data('plots', plots);
});
var canvas = $canvas.get(0);
var context = canvas.getContext('2d');
var margin = 5;
var chart_width = canvas.width - (2 * margin);
var chart_height = canvas.height - (2 * margin);
// Stats for the entire dataset
var stats = {
x_min: Number.MAX_VALUE,
x_max: Number.MIN_VALUE,
y_min: Number.MAX_VALUE,
y_max: Number.MIN_VALUE,
x_range: 0,
y_range: 0
}
for(series_idx in options.series) {
var series = options.series[series_idx];
if(null == series.data)
continue;
for(idx in series.data) {
var data = series.data[idx];
var x = data.x;
var y = data.y;
stats.x_min = Math.min(stats.x_min,x);
stats.x_max = Math.max(stats.x_max,x);
stats.y_min = Math.min(stats.y_min,y);
stats.y_max = Math.max(stats.y_max,y);
}
}
stats.x_range = Math.abs(stats.x_max - stats.x_min);
stats.y_range = Math.abs(stats.y_max - stats.y_min);
// Stats for each series
var series_stats = [];
for(series_idx in options.series) {
var series = options.series[series_idx];
if(null == series.data)
continue;
var minmax = {
x_min: Number.MAX_VALUE,
x_max: Number.MIN_VALUE,
y_min: Number.MAX_VALUE,
y_max: Number.MIN_VALUE,
x_range: 0,
y_range: 0
}
for(idx in series.data) {
var data = series.data[idx];
var x = data.x;
var y = data.y;
minmax.x_min = Math.min(minmax.x_min, x);
minmax.x_max = Math.max(minmax.x_max, x);
minmax.y_min = Math.min(minmax.y_min, y);
minmax.y_max = Math.max(minmax.y_max, y);
}
minmax.x_range = Math.abs(minmax.x_max - minmax.x_min);
minmax.y_range = Math.abs(minmax.y_max - minmax.y_min);
series_stats[series_idx] = minmax;
}
// [TODO] If we're not using independent axes, find the biggest/smallest values
// among all the series
var default_colors = [
'rgba(87, 151, 10, 1)',
'rgba(0, 124, 189, 1)',
'rgba(112, 71, 186, 1)',
'rgba(139, 15, 152, 1)',
'rgba(207, 44, 29, 1)',
'rgba(233, 117, 20, 1)',
'rgba(255, 161, 0, 1)',
'rgba(62, 109, 7, 1)',
'rgba(52, 92, 5, 1)',
'rgba(0, 89, 136, 1)',
'rgba(0, 75, 115, 1)',
'rgba(80, 51, 134, 1)',
'rgba(68, 43, 113, 1)',
'rgba(100, 10, 109, 1)',
'rgba(85, 8, 92, 1)',
'rgba(149, 31, 20, 1)',
'rgba(126, 26, 17, 1)',
'rgba(168, 84, 14, 1)',
'rgba(142, 71, 11, 1)',
'rgba(184, 116, 0, 1)',
'rgba(156, 98, 0, 1)',
'rgba(204, 204, 204, 1)'
];
var is_zeroline_drawn = false;
// Plot
for(series_idx in options.series) {
var series = options.series[series_idx];
if(series.data == null)
continue;
if(options.axes_independent) {
stat = series_stats[series_idx];
} else {
stat = stats;
}
var xaxis_tick = (stat.x_range != 0) ? (chart_width / stat.x_range) : chart_width;
var yaxis_tick = (stat.y_range != 0) ? (chart_height / stat.y_range) : chart_height;
// Draw a zero line if we have dependent axes
if(options.y_line_zero && !options.axes_independent && !is_zeroline_drawn) {
var zero_ypos = Math.floor(chart_height * (stats.y_max/stats.y_range)) + margin + 2 - (0 == margin % 2 ? 0 : 0.5);
context.lineWidth = 1;
context.beginPath();
context.moveTo(0, zero_ypos);
context.lineTo(0, zero_ypos-1);
context.lineTo(canvas.width, zero_ypos-1);
context.lineTo(canvas.width, zero_ypos);
context.strokeStyle = '#BBBBBB';
context.stroke();
}
if(series.options.color)
options.series[series_idx].options.color = series.options.color;
else if(null != default_colors[series_idx])
options.series[series_idx].options.color = default_colors[series_idx];
else
options.series[series_idx].options.color = 'rgba(75,75,75,1)';
context.fillStyle = options.series[series_idx].options.color;
context.strokeStyle = options.series[series_idx].options.color;
for(idx in series.data) {
var data = series.data[idx];
var x = data.x - stat.x_min;
var y = data.y - stat.y_min;
var chart_x = (xaxis_tick * x) + margin;
var chart_y = chart_height - (yaxis_tick * y) + margin;
/*
// [TODO] Make this configurable
if(series_idx == 1) {
label = '+';
} else if(series_idx == 2) {
label = 'x';
} else if(series_idx == 3) {
label = '*';
} else {
label = 'o';
}
*/
label = 'o';
context.font = '12px Courier';
var measure = context.measureText(label);
context.beginPath();
context.fillText(label, chart_x-measure.width/2, chart_y+measure.width/2);
context.fill();
}
}
$canvas.on('mousemove click', function(e) {
var options = $(this).data('model');
var plots = $(this).data('plots');
var mouse_pos = getMousePositionFromEvent(e);
var closest = {
'dist': 1000,
'chart_x': 0,
'chart_y': 0,
'data': [],
'series_idx': null
};
for(series_idx in plots) {
var count = plots[series_idx].length;
var series = options.series[series_idx];
for(idx in plots[series_idx]) {
var plot = plots[series_idx][idx];
var dist = Math.sqrt(Math.pow(mouse_pos.x-plot.chart_x,2) + Math.pow(mouse_pos.y-plot.chart_y,2));
if(dist < closest.dist) {
closest.dist = dist;
closest.data = plot.data;
closest.chart_x = plot.chart_x;
closest.chart_y = plot.chart_y;
closest.series_idx = series_idx;
}
}
}
if(closest.data == [])
return;
// Trigger the event
var event = new jQuery.Event('devblocks-chart-' + e.type, {
'closest': closest
});
$(this).trigger(event);
});
};
this.each(function() {
if($(this)[0].tagName.toLowerCase() !== 'canvas')
return;
var $canvas = $(this);
switch(type) {
case 'gauge':
drawGauge($canvas, options);
break;
case 'pie':
drawPieChart($canvas, options);
break;
case 'line':
drawLineChart($canvas, options);
break;
case 'bar':
drawBarChart($canvas, options);
break;
case 'scatterplot':
drawScatterPlot($canvas, options);
break;
}
});
return $(this);
}
});
/*jslint browser: true*/
/*jslint jquery: true*/
/*
* jQuery Hotkeys Plugin
* Copyright 2010, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* Based upon the plugin by Tzury Bar Yochay:
* https://github.com/tzuryby/jquery.hotkeys
*
* Original idea by:
* Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/
*/
/*
* One small change is: now keys are passed by object { keys: '...' }
* Might be useful, when you want to pass some other data to your handler
*/
(function(jQuery) {
jQuery.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": ")",
"-": "_",
"=": "+",
";": ": ",
"'": "\"",
",": "<",
".": ">",
"/": "?",
"\\": "|"
},
// excludes: button, checkbox, file, hidden, image, password, radio, reset, search, submit, url
textAcceptingInputTypes: [
"text", "password", "number", "email", "url", "range", "date", "month", "week", "time", "datetime",
"datetime-local", "search", "color", "tel"],
// default input types not to bind to unless bound directly
textInputTypes: /textarea|input|select/i,
options: {
filterInputAcceptingElements: true,
filterTextInputs: true,
filterContentEditable: true
}
};
function keyHandler(handleObj) {
if (typeof handleObj.data === "string") {
handleObj.data = {
keys: handleObj.data
};
}
// Only care when a possible input has been specified
if (!handleObj.data || !handleObj.data.keys || typeof handleObj.data.keys !== "string") {
return;
}
var origHandler = handleObj.handler,
keys = handleObj.data.keys.toLowerCase().split(" ");
handleObj.handler = function(event) {
// Don't fire in text-accepting inputs that we didn't directly bind to
if (this !== event.target &&
(jQuery.hotkeys.options.filterInputAcceptingElements &&
jQuery.hotkeys.textInputTypes.test(event.target.nodeName) ||
(jQuery.hotkeys.options.filterContentEditable && jQuery(event.target).attr('contenteditable')) ||
(jQuery.hotkeys.options.filterTextInputs &&
jQuery.inArray(event.target.type, jQuery.hotkeys.textAcceptingInputTypes) > -1))) {
return;
}
var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[event.which],
character = String.fromCharCode(event.which).toLowerCase(),
modif = "",
possible = {};
jQuery.each(["alt", "ctrl", "shift"], function(index, specialKey) {
if (event[specialKey + 'Key'] && special !== specialKey) {
modif += specialKey + '+';
}
});
// metaKey is triggered off ctrlKey erronously
if (event.metaKey && !event.ctrlKey && special !== "meta") {
modif += "meta+";
}
if (event.metaKey && special !== "meta" && modif.indexOf("alt+ctrl+shift+") > -1) {
modif = modif.replace("alt+ctrl+shift+", "hyper+");
}
if (special) {
possible[modif + special] = true;
}
else {
possible[modif + character] = true;
possible[modif + jQuery.hotkeys.shiftNums[character]] = true;
// "$" can be triggered as "Shift+4" or "Shift+$" or just "$"
if (modif === "shift+") {
possible[jQuery.hotkeys.shiftNums[character]] = true;
}
}
for (var i = 0, l = keys.length; i < l; i++) {
if (possible[keys[i]]) {
return origHandler.apply(this, arguments);
}
}
};
}
jQuery.each(["keydown", "keyup", "keypress"], function() {
jQuery.event.special[this] = {
add: keyHandler
};
});
})(jQuery || this.jQuery || window.jQuery);
/*!
* hoverIntent v1.8.1 // 2014.08.11 // jQuery v1.9.1+
* http://cherne.net/brian/resources/jquery.hoverIntent.html
*
* You may use hoverIntent under the terms of the MIT license. Basically that
* means you are free to use hoverIntent as long as this header is left intact.
* Copyright 2007, 2014 Brian Cherne
*/
/* hoverIntent is similar to jQuery's built-in "hover" method except that
* instead of firing the handlerIn function immediately, hoverIntent checks
* to see if the user's mouse has slowed down (beneath the sensitivity
* threshold) before firing the event. The handlerOut function is only
* called after a matching handlerIn.
*
* // basic usage ... just like .hover()
* .hoverIntent( handlerIn, handlerOut )
* .hoverIntent( handlerInOut )
*
* // basic usage ... with event delegation!
* .hoverIntent( handlerIn, handlerOut, selector )
* .hoverIntent( handlerInOut, selector )
*
* // using a basic configuration object
* .hoverIntent( config )
*
* @param handlerIn function OR configuration object
* @param handlerOut function OR selector for delegation OR undefined
* @param selector selector OR undefined
* @author Brian Cherne <brian(at)cherne(dot)net>
*/
(function($) {
$.fn.hoverIntent = function(handlerIn,handlerOut,selector) {
// default configuration values
var cfg = {
interval: 100,
sensitivity: 6,
timeout: 0
};
if ( typeof handlerIn === "object" ) {
cfg = $.extend(cfg, handlerIn );
} else if ($.isFunction(handlerOut)) {
cfg = $.extend(cfg, { over: handlerIn, out: handlerOut, selector: selector } );
} else {
cfg = $.extend(cfg, { over: handlerIn, out: handlerIn, selector: handlerOut } );
}
// instantiate variables
// cX, cY = current X and Y position of mouse, updated by mousemove event
// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
var cX, cY, pX, pY;
// A private function for getting mouse position
var track = function(ev) {
cX = ev.pageX;
cY = ev.pageY;
};
// A private function for comparing current and previous mouse position
var compare = function(ev,ob) {
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
// compare mouse positions to see if they've crossed the threshold
if ( Math.sqrt( (pX-cX)*(pX-cX) + (pY-cY)*(pY-cY) ) < cfg.sensitivity ) {
$(ob).off("mousemove.hoverIntent",track);
// set hoverIntent state to true (so mouseOut can be called)
ob.hoverIntent_s = true;
return cfg.over.apply(ob,[ev]);
} else {
// set previous coordinates for next time
pX = cX; pY = cY;
// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
}
};
// A private function for delaying the mouseOut function
var delay = function(ev,ob) {
ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
ob.hoverIntent_s = false;
return cfg.out.apply(ob,[ev]);
};
// A private function for handling mouse 'hovering'
var handleHover = function(e) {
// copy objects to be passed into t (required for event object to be passed in IE)
var ev = $.extend({},e);
var ob = this;
// cancel hoverIntent timer if it exists
if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
// if e.type === "mouseenter"
if (e.type === "mouseenter") {
// set "previous" X and Y position based on initial entry point
pX = ev.pageX; pY = ev.pageY;
// update "current" X and Y position based on mousemove
$(ob).on("mousemove.hoverIntent",track);
// start polling interval (self-calling timeout) to compare mouse coordinates over time
if (!ob.hoverIntent_s) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
// else e.type == "mouseleave"
} else {
// unbind expensive mousemove event
$(ob).off("mousemove.hoverIntent",track);
// if hoverIntent state is true, then call the mouseOut function after the specified delay
if (ob.hoverIntent_s) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
}
};
// listen for mouseenter and mouseleave
return this.on({'mouseenter.hoverIntent':handleHover,'mouseleave.hoverIntent':handleHover}, cfg.selector);
};
})(jQuery);$.fn.extend({
insertAtCursor: function (myValue) {
this.each(function () {
var $this = $(this).focus();
var txt = $this.val();
var pos = $this.caret('pos');
var newTxt = '';
var cursorPos = pos;
newTxt = txt.substring(0, pos);
newTxt += myValue;
$this.val(newTxt);
// Move the cursor to the end
cursorPos = $this.val().length;
// Scroll down all the way
this.scrollTop = this.scrollHeight;
// Append the rest of the content
newTxt += txt.substring(pos);
$this.val(newTxt);
// Trigger a resize (if used)
$this.trigger('autosize.resize');
$this.caret('pos', cursorPos);
$this.focus();
});
return this;
}
});
/*
* jQuery MD5 Plugin 1.2.1
* https://github.com/blueimp/jQuery-MD5
*
* Copyright 2010, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://creativecommons.org/licenses/MIT/
*
* Based on
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.
* Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for more info.
*/
/*jslint bitwise: true */
/*global unescape, jQuery */
(function ($) {
'use strict';
/*
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
* to work around bugs in some JS interpreters.
*/
function safe_add(x, y) {
var lsw = (x & 0xFFFF) + (y & 0xFFFF),
msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
}
/*
* Bitwise rotate a 32-bit number to the left.
*/
function bit_rol(num, cnt) {
return (num << cnt) | (num >>> (32 - cnt));
}
/*
* These functions implement the four basic operations the algorithm uses.
*/
function md5_cmn(q, a, b, x, s, t) {
return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b);
}
function md5_ff(a, b, c, d, x, s, t) {
return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
}
function md5_gg(a, b, c, d, x, s, t) {
return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
}
function md5_hh(a, b, c, d, x, s, t) {
return md5_cmn(b ^ c ^ d, a, b, x, s, t);
}
function md5_ii(a, b, c, d, x, s, t) {
return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
}
/*
* Calculate the MD5 of an array of little-endian words, and a bit length.
*/
function binl_md5(x, len) {
/* append padding */
x[len >> 5] |= 0x80 << ((len) % 32);
x[(((len + 64) >>> 9) << 4) + 14] = len;
var i, olda, oldb, oldc, oldd,
a = 1732584193,
b = -271733879,
c = -1732584194,
d = 271733878;
for (i = 0; i < x.length; i += 16) {
olda = a;
oldb = b;
oldc = c;
oldd = d;
a = md5_ff(a, b, c, d, x[i], 7, -680876936);
d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
c = md5_ff(c, d, a, b, x[i + 10], 17, -42063);
b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
b = md5_gg(b, c, d, a, x[i], 20, -373897302);
a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
a = md5_hh(a, b, c, d, x[i + 5], 4, -378558);
d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
d = md5_hh(d, a, b, c, x[i], 11, -358537222);
c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
a = md5_ii(a, b, c, d, x[i], 6, -198630844);
d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
a = safe_add(a, olda);
b = safe_add(b, oldb);
c = safe_add(c, oldc);
d = safe_add(d, oldd);
}
return [a, b, c, d];
}
/*
* Convert an array of little-endian words to a string
*/
function binl2rstr(input) {
var i,
output = '';
for (i = 0; i < input.length * 32; i += 8) {
output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xFF);
}
return output;
}
/*
* Convert a raw string to an array of little-endian words
* Characters >255 have their high-byte silently ignored.
*/
function rstr2binl(input) {
var i,
output = [];
output[(input.length >> 2) - 1] = undefined;
for (i = 0; i < output.length; i += 1) {
output[i] = 0;
}
for (i = 0; i < input.length * 8; i += 8) {
output[i >> 5] |= (input.charCodeAt(i / 8) & 0xFF) << (i % 32);
}
return output;
}
/*
* Calculate the MD5 of a raw string
*/
function rstr_md5(s) {
return binl2rstr(binl_md5(rstr2binl(s), s.length * 8));
}
/*
* Calculate the HMAC-MD5, of a key and some data (raw strings)
*/
function rstr_hmac_md5(key, data) {
var i,
bkey = rstr2binl(key),
ipad = [],
opad = [],
hash;
ipad[15] = opad[15] = undefined;
if (bkey.length > 16) {
bkey = binl_md5(bkey, key.length * 8);
}
for (i = 0; i < 16; i += 1) {
ipad[i] = bkey[i] ^ 0x36363636;
opad[i] = bkey[i] ^ 0x5C5C5C5C;
}
hash = binl_md5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
return binl2rstr(binl_md5(opad.concat(hash), 512 + 128));
}
/*
* Convert a raw string to a hex string
*/
function rstr2hex(input) {
var hex_tab = '0123456789abcdef',
output = '',
x,
i;
for (i = 0; i < input.length; i += 1) {
x = input.charCodeAt(i);
output += hex_tab.charAt((x >>> 4) & 0x0F) +
hex_tab.charAt(x & 0x0F);
}
return output;
}
/*
* Encode a string as utf-8
*/
function str2rstr_utf8(input) {
return unescape(encodeURIComponent(input));
}
/*
* Take string arguments and return either raw or hex encoded strings
*/
function raw_md5(s) {
return rstr_md5(str2rstr_utf8(s));
}
function hex_md5(s) {
return rstr2hex(raw_md5(s));
}
function raw_hmac_md5(k, d) {
return rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d));
}
function hex_hmac_md5(k, d) {
return rstr2hex(raw_hmac_md5(k, d));
}
$.md5 = function (string, key, raw) {
if (!key) {
if (!raw) {
return hex_md5(string);
} else {
return raw_md5(string);
}
}
if (!raw) {
return hex_hmac_md5(key, string);
} else {
return raw_hmac_md5(key, string);
}
};
}(typeof jQuery === 'function' ? jQuery : this));/*
* Metadata - jQuery plugin for parsing metadata from elements
*
* Copyright (c) 2006 John Resig, Yehuda Katz, Jörn Zaefferer, Paul McLanahan
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
/**
* Sets the type of metadata to use. Metadata is encoded in JSON, and each property
* in the JSON will become a property of the element itself.
*
* There are three supported types of metadata storage:
*
* attr: Inside an attribute. The name parameter indicates *which* attribute.
*
* class: Inside the class attribute, wrapped in curly braces: { }
*
* elem: Inside a child element (e.g. a script tag). The
* name parameter indicates *which* element.
*
* The metadata for an element is loaded the first time the element is accessed via jQuery.
*
* As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
* matched by expr, then redefine the metadata type and run another $(expr) for other elements.
*
* @name $.metadata.setType
*
* @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
* @before $.metadata.setType("class")
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
* @desc Reads metadata from the class attribute
*
* @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
* @before $.metadata.setType("attr", "data")
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
* @desc Reads metadata from a "data" attribute
*
* @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
* @before $.metadata.setType("elem", "script")
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
* @desc Reads metadata from a nested script element
*
* @param String type The encoding type
* @param String name The name of the attribute to be used to get metadata (optional)
* @cat Plugins/Metadata
* @descr Sets the type of encoding to be used when loading metadata for the first time
* @type undefined
* @see metadata()
*/
(function($) {
$.extend({
metadata : {
defaults : {
type: 'class',
name: 'metadata',
cre: /({.*})/,
single: 'metadata'
},
setType: function( type, name ){
this.defaults.type = type;
this.defaults.name = name;
},
get: function( elem, opts ){
var settings = $.extend({},this.defaults,opts);
// check for empty string in single property
if ( !settings.single.length ) settings.single = 'metadata';
var data = $.data(elem, settings.single);
// returned cached data if it already exists
if ( data ) return data;
data = "{}";
if ( settings.type == "class" ) {
var m = settings.cre.exec( elem.className );
if ( m )
data = m[1];
} else if ( settings.type == "elem" ) {
if( !elem.getElementsByTagName )
return undefined;
var e = elem.getElementsByTagName(settings.name);
if ( e.length )
data = $.trim(e[0].innerHTML);
} else if ( elem.getAttribute != undefined ) {
var attr = elem.getAttribute( settings.name );
if ( attr )
data = attr;
}
if ( data.indexOf( '{' ) <0 )
data = "{" + data + "}";
data = eval("(" + data + ")");
$.data( elem, settings.single, data );
return data;
}
}
});
/**
* Returns the metadata object for the first member of the jQuery object.
*
* @name metadata
* @descr Returns element's metadata object
* @param Object opts An object contianing settings to override the defaults
* @type jQuery
* @cat Plugins/Metadata
*/
$.fn.metadata = function( opts ){
return $.metadata.get( this[0], opts );
};
})(jQuery);
//
// jQuery MiniColors: A tiny color picker built on jQuery
//
// Developed by Cory LaViska for A Beautiful Site, LLC
//
// Licensed under the MIT license: http://opensource.org/licenses/MIT
//
!function(i){"function"==typeof define&&define.amd?define(["jquery"],i):"object"==typeof exports?module.exports=i(require("jquery")):i(jQuery)}(function(i){"use strict";function t(t,o){var s,a,n,e,r,l=i('<div class="minicolors" />'),h=i.minicolors.defaults;if(!t.data("minicolors-initialized")){if(o=i.extend(!0,{},h,o),l.addClass("minicolors-theme-"+o.theme).toggleClass("minicolors-with-opacity",o.opacity),void 0!==o.position&&i.each(o.position.split(" "),function(){l.addClass("minicolors-position-"+this)}),s="rgb"===o.format?o.opacity?"25":"20":o.keywords?"11":"7",t.addClass("minicolors-input").data("minicolors-initialized",!1).data("minicolors-settings",o).prop("size",s).wrap(l).after('<div class="minicolors-panel minicolors-slider-'+o.control+'"><div class="minicolors-slider minicolors-sprite"><div class="minicolors-picker"></div></div><div class="minicolors-opacity-slider minicolors-sprite"><div class="minicolors-picker"></div></div><div class="minicolors-grid minicolors-sprite"><div class="minicolors-grid-inner"></div><div class="minicolors-picker"><div></div></div></div></div>'),o.inline||(t.after('<span class="minicolors-swatch minicolors-sprite minicolors-input-swatch"><span class="minicolors-swatch-color"></span></span>'),t.next(".minicolors-input-swatch").on("click",function(i){i.preventDefault(),t.focus()})),e=t.parent().find(".minicolors-panel"),e.on("selectstart",function(){return!1}).end(),o.swatches&&0!==o.swatches.length)for(e.addClass("minicolors-with-swatches"),a=i('<ul class="minicolors-swatches"></ul>').appendTo(e),r=0;r<o.swatches.length;++r)n=o.swatches[r],n=v(n)?g(n,!0):I(u(n,!0)),i('<li class="minicolors-swatch minicolors-sprite"><span class="minicolors-swatch-color"></span></li>').appendTo(a).data("swatch-color",o.swatches[r]).find(".minicolors-swatch-color").css({backgroundColor:C(n),opacity:n.a}),o.swatches[r]=n;o.inline&&t.parent().addClass("minicolors-inline"),c(t,!1),t.data("minicolors-initialized",!0)}}function o(i){var t=i.parent();i.removeData("minicolors-initialized").removeData("minicolors-settings").removeProp("size").removeClass("minicolors-input"),t.before(i).remove()}function s(i){var t=i.parent(),o=t.find(".minicolors-panel"),s=i.data("minicolors-settings");!i.data("minicolors-initialized")||i.prop("disabled")||t.hasClass("minicolors-inline")||t.hasClass("minicolors-focus")||(a(),t.addClass("minicolors-focus"),o.stop(!0,!0).fadeIn(s.showSpeed,function(){s.show&&s.show.call(i.get(0))}))}function a(){i(".minicolors-focus").each(function(){var t=i(this),o=t.find(".minicolors-input"),s=t.find(".minicolors-panel"),a=o.data("minicolors-settings");s.fadeOut(a.hideSpeed,function(){a.hide&&a.hide.call(o.get(0)),t.removeClass("minicolors-focus")})})}function n(i,t,o){var s,a,n,r,c=i.parents(".minicolors").find(".minicolors-input"),l=c.data("minicolors-settings"),h=i.find("[class$=-picker]"),d=i.offset().left,p=i.offset().top,u=Math.round(t.pageX-d),g=Math.round(t.pageY-p),m=o?l.animationSpeed:0;t.originalEvent.changedTouches&&(u=t.originalEvent.changedTouches[0].pageX-d,g=t.originalEvent.changedTouches[0].pageY-p),u<0&&(u=0),g<0&&(g=0),u>i.width()&&(u=i.width()),g>i.height()&&(g=i.height()),i.parent().is(".minicolors-slider-wheel")&&h.parent().is(".minicolors-grid")&&(s=75-u,a=75-g,n=Math.sqrt(s*s+a*a),r=Math.atan2(a,s),r<0&&(r+=2*Math.PI),n>75&&(n=75,u=75-75*Math.cos(r),g=75-75*Math.sin(r)),u=Math.round(u),g=Math.round(g)),i.is(".minicolors-grid")?h.stop(!0).animate({top:g+"px",left:u+"px"},m,l.animationEasing,function(){e(c,i)}):h.stop(!0).animate({top:g+"px"},m,l.animationEasing,function(){e(c,i)})}function e(i,t){function o(i,t){var o,s;return i.length&&t?(o=i.offset().left,s=i.offset().top,{x:o-t.offset().left+i.outerWidth()/2,y:s-t.offset().top+i.outerHeight()/2}):null}var s,a,n,e,c,h,d,p=i.val(),u=i.attr("data-opacity"),g=i.parent(),m=i.data("minicolors-settings"),v=g.find(".minicolors-input-swatch"),b=g.find(".minicolors-grid"),w=g.find(".minicolors-slider"),y=g.find(".minicolors-opacity-slider"),C=b.find("[class$=-picker]"),M=w.find("[class$=-picker]"),x=y.find("[class$=-picker]"),I=o(C,b),S=o(M,w),z=o(x,y);if(t.is(".minicolors-grid, .minicolors-slider, .minicolors-opacity-slider")){switch(m.control){case"wheel":e=b.width()/2-I.x,c=b.height()/2-I.y,h=Math.sqrt(e*e+c*c),d=Math.atan2(c,e),d<0&&(d+=2*Math.PI),h>75&&(h=75,I.x=69-75*Math.cos(d),I.y=69-75*Math.sin(d)),a=f(h/.75,0,100),s=f(180*d/Math.PI,0,360),n=f(100-Math.floor(S.y*(100/w.height())),0,100),p=k({h:s,s:a,b:n}),w.css("backgroundColor",k({h:s,s:a,b:100}));break;case"saturation":s=f(parseInt(I.x*(360/b.width()),10),0,360),a=f(100-Math.floor(S.y*(100/w.height())),0,100),n=f(100-Math.floor(I.y*(100/b.height())),0,100),p=k({h:s,s:a,b:n}),w.css("backgroundColor",k({h:s,s:100,b:n})),g.find(".minicolors-grid-inner").css("opacity",a/100);break;case"brightness":s=f(parseInt(I.x*(360/b.width()),10),0,360),a=f(100-Math.floor(I.y*(100/b.height())),0,100),n=f(100-Math.floor(S.y*(100/w.height())),0,100),p=k({h:s,s:a,b:n}),w.css("backgroundColor",k({h:s,s:a,b:100})),g.find(".minicolors-grid-inner").css("opacity",1-n/100);break;default:s=f(360-parseInt(S.y*(360/w.height()),10),0,360),a=f(Math.floor(I.x*(100/b.width())),0,100),n=f(100-Math.floor(I.y*(100/b.height())),0,100),p=k({h:s,s:a,b:n}),b.css("backgroundColor",k({h:s,s:100,b:100}))}u=m.opacity?parseFloat(1-z.y/y.height()).toFixed(2):1,r(i,p,u)}else v.find("span").css({backgroundColor:p,opacity:u}),l(i,p,u)}function r(i,t,o){var s,a=i.parent(),n=i.data("minicolors-settings"),e=a.find(".minicolors-input-swatch");n.opacity&&i.attr("data-opacity",o),"rgb"===n.format?(s=v(t)?g(t,!0):I(u(t,!0)),o=""===i.attr("data-opacity")?1:f(parseFloat(i.attr("data-opacity")).toFixed(2),0,1),!isNaN(o)&&n.opacity||(o=1),t=i.minicolors("rgbObject").a<=1&&s&&n.opacity?"rgba("+s.r+", "+s.g+", "+s.b+", "+parseFloat(o)+")":"rgb("+s.r+", "+s.g+", "+s.b+")"):(v(t)&&(t=y(t)),t=p(t,n.letterCase)),i.val(t),e.find("span").css({backgroundColor:t,opacity:o}),l(i,t,o)}function c(t,o){var s,a,n,e,r,c,h,d,w,C,x=t.parent(),I=t.data("minicolors-settings"),S=x.find(".minicolors-input-swatch"),z=x.find(".minicolors-grid"),F=x.find(".minicolors-slider"),T=x.find(".minicolors-opacity-slider"),D=z.find("[class$=-picker]"),j=F.find("[class$=-picker]"),q=T.find("[class$=-picker]");switch(v(t.val())?(s=y(t.val()),r=f(parseFloat(b(t.val())).toFixed(2),0,1),r&&t.attr("data-opacity",r)):s=p(u(t.val(),!0),I.letterCase),s||(s=p(m(I.defaultValue,!0),I.letterCase)),a=M(s),e=I.keywords?i.map(I.keywords.split(","),function(t){return i.trim(t.toLowerCase())}):[],c=""!==t.val()&&i.inArray(t.val().toLowerCase(),e)>-1?p(t.val()):v(t.val())?g(t.val()):s,o||t.val(c),I.opacity&&(n=""===t.attr("data-opacity")?1:f(parseFloat(t.attr("data-opacity")).toFixed(2),0,1),isNaN(n)&&(n=1),t.attr("data-opacity",n),S.find("span").css("opacity",n),d=f(T.height()-T.height()*n,0,T.height()),q.css("top",d+"px")),"transparent"===t.val().toLowerCase()&&S.find("span").css("opacity",0),S.find("span").css("backgroundColor",s),I.control){case"wheel":w=f(Math.ceil(.75*a.s),0,z.height()/2),C=a.h*Math.PI/180,h=f(75-Math.cos(C)*w,0,z.width()),d=f(75-Math.sin(C)*w,0,z.height()),D.css({top:d+"px",left:h+"px"}),d=150-a.b/(100/z.height()),""===s&&(d=0),j.css("top",d+"px"),F.css("backgroundColor",k({h:a.h,s:a.s,b:100}));break;case"saturation":h=f(5*a.h/12,0,150),d=f(z.height()-Math.ceil(a.b/(100/z.height())),0,z.height()),D.css({top:d+"px",left:h+"px"}),d=f(F.height()-a.s*(F.height()/100),0,F.height()),j.css("top",d+"px"),F.css("backgroundColor",k({h:a.h,s:100,b:a.b})),x.find(".minicolors-grid-inner").css("opacity",a.s/100);break;case"brightness":h=f(5*a.h/12,0,150),d=f(z.height()-Math.ceil(a.s/(100/z.height())),0,z.height()),D.css({top:d+"px",left:h+"px"}),d=f(F.height()-a.b*(F.height()/100),0,F.height()),j.css("top",d+"px"),F.css("backgroundColor",k({h:a.h,s:a.s,b:100})),x.find(".minicolors-grid-inner").css("opacity",1-a.b/100);break;default:h=f(Math.ceil(a.s/(100/z.width())),0,z.width()),d=f(z.height()-Math.ceil(a.b/(100/z.height())),0,z.height()),D.css({top:d+"px",left:h+"px"}),d=f(F.height()-a.h/(360/F.height()),0,F.height()),j.css("top",d+"px"),z.css("backgroundColor",k({h:a.h,s:100,b:100}))}t.data("minicolors-initialized")&&l(t,c,n)}function l(i,t,o){var s,a,n,e=i.data("minicolors-settings"),r=i.data("minicolors-lastChange");if(!r||r.value!==t||r.opacity!==o){if(i.data("minicolors-lastChange",{value:t,opacity:o}),e.swatches&&0!==e.swatches.length){for(s=v(t)?g(t,!0):I(t),a=-1,n=0;n<e.swatches.length;++n)if(s.r===e.swatches[n].r&&s.g===e.swatches[n].g&&s.b===e.swatches[n].b&&s.a===e.swatches[n].a){a=n;break}i.parent().find(".minicolors-swatches .minicolors-swatch").removeClass("selected"),a!==-1&&i.parent().find(".minicolors-swatches .minicolors-swatch").eq(n).addClass("selected")}e.change&&(e.changeDelay?(clearTimeout(i.data("minicolors-changeTimeout")),i.data("minicolors-changeTimeout",setTimeout(function(){e.change.call(i.get(0),t,o)},e.changeDelay))):e.change.call(i.get(0),t,o)),i.trigger("change").trigger("input")}}function h(t){var o,s=i(t).attr("data-opacity");if(v(i(t).val()))o=g(i(t).val(),!0);else{var a=u(i(t).val(),!0);o=I(a)}return o?(void 0!==s&&i.extend(o,{a:parseFloat(s)}),o):null}function d(t,o){var s,a=i(t).attr("data-opacity");if(v(i(t).val()))s=g(i(t).val(),!0);else{var n=u(i(t).val(),!0);s=I(n)}return s?(void 0===a&&(a=1),o?"rgba("+s.r+", "+s.g+", "+s.b+", "+parseFloat(a)+")":"rgb("+s.r+", "+s.g+", "+s.b+")"):null}function p(i,t){return"uppercase"===t?i.toUpperCase():i.toLowerCase()}function u(i,t){return i=i.replace(/^#/g,""),i.match(/^[A-F0-9]{3,6}/gi)?3!==i.length&&6!==i.length?"":(3===i.length&&t&&(i=i[0]+i[0]+i[1]+i[1]+i[2]+i[2]),"#"+i):""}function g(i,t){var o=i.replace(/[^\d,.]/g,""),s=o.split(",");return s[0]=f(parseInt(s[0],10),0,255),s[1]=f(parseInt(s[1],10),0,255),s[2]=f(parseInt(s[2],10),0,255),s[3]&&(s[3]=f(parseFloat(s[3],10),0,1)),t?s[3]?{r:s[0],g:s[1],b:s[2],a:s[3]}:{r:s[0],g:s[1],b:s[2]}:"undefined"!=typeof s[3]&&s[3]<=1?"rgba("+s[0]+", "+s[1]+", "+s[2]+", "+s[3]+")":"rgb("+s[0]+", "+s[1]+", "+s[2]+")"}function m(i,t){return v(i)?g(i):u(i,t)}function f(i,t,o){return i<t&&(i=t),i>o&&(i=o),i}function v(i){var t=i.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);return!(!t||4!==t.length)}function b(i){return i=i.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+(\.\d{1,2})?|\.\d{1,2})[\s+]?/i),i&&6===i.length?i[4]:"1"}function w(i){var t={},o=Math.round(i.h),s=Math.round(255*i.s/100),a=Math.round(255*i.b/100);if(0===s)t.r=t.g=t.b=a;else{var n=a,e=(255-s)*a/255,r=(n-e)*(o%60)/60;360===o&&(o=0),o<60?(t.r=n,t.b=e,t.g=e+r):o<120?(t.g=n,t.b=e,t.r=n-r):o<180?(t.g=n,t.r=e,t.b=e+r):o<240?(t.b=n,t.r=e,t.g=n-r):o<300?(t.b=n,t.g=e,t.r=e+r):o<360?(t.r=n,t.g=e,t.b=n-r):(t.r=0,t.g=0,t.b=0)}return{r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)}}function y(i){return i=i.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i),i&&4===i.length?"#"+("0"+parseInt(i[1],10).toString(16)).slice(-2)+("0"+parseInt(i[2],10).toString(16)).slice(-2)+("0"+parseInt(i[3],10).toString(16)).slice(-2):""}function C(t){var o=[t.r.toString(16),t.g.toString(16),t.b.toString(16)];return i.each(o,function(i,t){1===t.length&&(o[i]="0"+t)}),"#"+o.join("")}function k(i){return C(w(i))}function M(i){var t=x(I(i));return 0===t.s&&(t.h=360),t}function x(i){var t={h:0,s:0,b:0},o=Math.min(i.r,i.g,i.b),s=Math.max(i.r,i.g,i.b),a=s-o;return t.b=s,t.s=0!==s?255*a/s:0,0!==t.s?i.r===s?t.h=(i.g-i.b)/a:i.g===s?t.h=2+(i.b-i.r)/a:t.h=4+(i.r-i.g)/a:t.h=-1,t.h*=60,t.h<0&&(t.h+=360),t.s*=100/255,t.b*=100/255,t}function I(i){return i=parseInt(i.indexOf("#")>-1?i.substring(1):i,16),{r:i>>16,g:(65280&i)>>8,b:255&i}}i.minicolors={defaults:{animationSpeed:50,animationEasing:"swing",change:null,changeDelay:0,control:"hue",defaultValue:"",format:"hex",hide:null,hideSpeed:100,inline:!1,keywords:"",letterCase:"lowercase",opacity:!1,position:"bottom left",show:null,showSpeed:100,theme:"default",swatches:[]}},i.extend(i.fn,{minicolors:function(n,e){switch(n){case"destroy":return i(this).each(function(){o(i(this))}),i(this);case"hide":return a(),i(this);case"opacity":return void 0===e?i(this).attr("data-opacity"):(i(this).each(function(){c(i(this).attr("data-opacity",e))}),i(this));case"rgbObject":return h(i(this),"rgbaObject"===n);case"rgbString":case"rgbaString":return d(i(this),"rgbaString"===n);case"settings":return void 0===e?i(this).data("minicolors-settings"):(i(this).each(function(){var t=i(this).data("minicolors-settings")||{};o(i(this)),i(this).minicolors(i.extend(!0,t,e))}),i(this));case"show":return s(i(this).eq(0)),i(this);case"value":return void 0===e?i(this).val():(i(this).each(function(){"object"==typeof e&&"null"!==e?(e.opacity&&i(this).attr("data-opacity",f(e.opacity,0,1)),e.color&&i(this).val(e.color)):i(this).val(e),c(i(this))}),i(this));default:return"create"!==n&&(e=n),i(this).each(function(){t(i(this),e)}),i(this)}}}),i([document,top.document]).on("mousedown.minicolors touchstart.minicolors",function(t){i(t.target).parents().add(t.target).hasClass("minicolors")||a()}).on("mousedown.minicolors touchstart.minicolors",".minicolors-grid, .minicolors-slider, .minicolors-opacity-slider",function(t){var o=i(this);t.preventDefault(),i(t.delegateTarget).data("minicolors-target",o),n(o,t,!0)}).on("mousemove.minicolors touchmove.minicolors",function(t){var o=i(t.delegateTarget).data("minicolors-target");o&&n(o,t)}).on("mouseup.minicolors touchend.minicolors",function(){i(this).removeData("minicolors-target")}).on("click.minicolors",".minicolors-swatches li",function(t){t.preventDefault();var o=i(this),s=o.parents(".minicolors").find(".minicolors-input"),a=o.data("swatch-color");r(s,a,b(a)),c(s)}).on("mousedown.minicolors touchstart.minicolors",".minicolors-input-swatch",function(t){var o=i(this).parent().find(".minicolors-input");t.preventDefault(),s(o)}).on("focus.minicolors",".minicolors-input",function(){var t=i(this);t.data("minicolors-initialized")&&s(t)}).on("blur.minicolors",".minicolors-input",function(){var t,o,s,a,n,e=i(this),r=e.data("minicolors-settings");e.data("minicolors-initialized")&&(t=r.keywords?i.map(r.keywords.split(","),function(t){return i.trim(t.toLowerCase())}):[],""!==e.val()&&i.inArray(e.val().toLowerCase(),t)>-1?n=e.val():(v(e.val())?s=g(e.val(),!0):(o=u(e.val(),!0),s=o?I(o):null),n=null===s?r.defaultValue:"rgb"===r.format?g(r.opacity?"rgba("+s.r+","+s.g+","+s.b+","+e.attr("data-opacity")+")":"rgb("+s.r+","+s.g+","+s.b+")"):C(s)),a=r.opacity?e.attr("data-opacity"):1,"transparent"===n.toLowerCase()&&(a=0),e.closest(".minicolors").find(".minicolors-input-swatch > span").css("opacity",a),e.val(n),""===e.val()&&e.val(m(r.defaultValue,!0)),e.val(p(e.val(),r.letterCase)))}).on("keydown.minicolors",".minicolors-input",function(t){var o=i(this);if(o.data("minicolors-initialized"))switch(t.keyCode){case 9:a();break;case 13:case 27:a(),o.blur()}}).on("keyup.minicolors",".minicolors-input",function(){var t=i(this);t.data("minicolors-initialized")&&c(t,!0)}).on("paste.minicolors",".minicolors-input",function(){var t=i(this);t.data("minicolors-initialized")&&setTimeout(function(){c(t,!0)},1)})});(function(r){r.fn.qrcode=function(h){var s;function u(a){this.mode=s;this.data=a}function o(a,c){this.typeNumber=a;this.errorCorrectLevel=c;this.modules=null;this.moduleCount=0;this.dataCache=null;this.dataList=[]}function q(a,c){if(void 0==a.length)throw Error(a.length+"/"+c);for(var d=0;d<a.length&&0==a[d];)d++;this.num=Array(a.length-d+c);for(var b=0;b<a.length-d;b++)this.num[b]=a[b+d]}function p(a,c){this.totalCount=a;this.dataCount=c}function t(){this.buffer=[];this.length=0}u.prototype={getLength:function(){return this.data.length},
write:function(a){for(var c=0;c<this.data.length;c++)a.put(this.data.charCodeAt(c),8)}};o.prototype={addData:function(a){this.dataList.push(new u(a));this.dataCache=null},isDark:function(a,c){if(0>a||this.moduleCount<=a||0>c||this.moduleCount<=c)throw Error(a+","+c);return this.modules[a][c]},getModuleCount:function(){return this.moduleCount},make:function(){if(1>this.typeNumber){for(var a=1,a=1;40>a;a++){for(var c=p.getRSBlocks(a,this.errorCorrectLevel),d=new t,b=0,e=0;e<c.length;e++)b+=c[e].dataCount;
for(e=0;e<this.dataList.length;e++)c=this.dataList[e],d.put(c.mode,4),d.put(c.getLength(),j.getLengthInBits(c.mode,a)),c.write(d);if(d.getLengthInBits()<=8*b)break}this.typeNumber=a}this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(a,c){this.moduleCount=4*this.typeNumber+17;this.modules=Array(this.moduleCount);for(var d=0;d<this.moduleCount;d++){this.modules[d]=Array(this.moduleCount);for(var b=0;b<this.moduleCount;b++)this.modules[d][b]=null}this.setupPositionProbePattern(0,0);this.setupPositionProbePattern(this.moduleCount-
7,0);this.setupPositionProbePattern(0,this.moduleCount-7);this.setupPositionAdjustPattern();this.setupTimingPattern();this.setupTypeInfo(a,c);7<=this.typeNumber&&this.setupTypeNumber(a);null==this.dataCache&&(this.dataCache=o.createData(this.typeNumber,this.errorCorrectLevel,this.dataList));this.mapData(this.dataCache,c)},setupPositionProbePattern:function(a,c){for(var d=-1;7>=d;d++)if(!(-1>=a+d||this.moduleCount<=a+d))for(var b=-1;7>=b;b++)-1>=c+b||this.moduleCount<=c+b||(this.modules[a+d][c+b]=
0<=d&&6>=d&&(0==b||6==b)||0<=b&&6>=b&&(0==d||6==d)||2<=d&&4>=d&&2<=b&&4>=b?!0:!1)},getBestMaskPattern:function(){for(var a=0,c=0,d=0;8>d;d++){this.makeImpl(!0,d);var b=j.getLostPoint(this);if(0==d||a>b)a=b,c=d}return c},createMovieClip:function(a,c,d){a=a.createEmptyMovieClip(c,d);this.make();for(c=0;c<this.modules.length;c++)for(var d=1*c,b=0;b<this.modules[c].length;b++){var e=1*b;this.modules[c][b]&&(a.beginFill(0,100),a.moveTo(e,d),a.lineTo(e+1,d),a.lineTo(e+1,d+1),a.lineTo(e,d+1),a.endFill())}return a},
setupTimingPattern:function(){for(var a=8;a<this.moduleCount-8;a++)null==this.modules[a][6]&&(this.modules[a][6]=0==a%2);for(a=8;a<this.moduleCount-8;a++)null==this.modules[6][a]&&(this.modules[6][a]=0==a%2)},setupPositionAdjustPattern:function(){for(var a=j.getPatternPosition(this.typeNumber),c=0;c<a.length;c++)for(var d=0;d<a.length;d++){var b=a[c],e=a[d];if(null==this.modules[b][e])for(var f=-2;2>=f;f++)for(var i=-2;2>=i;i++)this.modules[b+f][e+i]=-2==f||2==f||-2==i||2==i||0==f&&0==i?!0:!1}},setupTypeNumber:function(a){for(var c=
j.getBCHTypeNumber(this.typeNumber),d=0;18>d;d++){var b=!a&&1==(c>>d&1);this.modules[Math.floor(d/3)][d%3+this.moduleCount-8-3]=b}for(d=0;18>d;d++)b=!a&&1==(c>>d&1),this.modules[d%3+this.moduleCount-8-3][Math.floor(d/3)]=b},setupTypeInfo:function(a,c){for(var d=j.getBCHTypeInfo(this.errorCorrectLevel<<3|c),b=0;15>b;b++){var e=!a&&1==(d>>b&1);6>b?this.modules[b][8]=e:8>b?this.modules[b+1][8]=e:this.modules[this.moduleCount-15+b][8]=e}for(b=0;15>b;b++)e=!a&&1==(d>>b&1),8>b?this.modules[8][this.moduleCount-
b-1]=e:9>b?this.modules[8][15-b-1+1]=e:this.modules[8][15-b-1]=e;this.modules[this.moduleCount-8][8]=!a},mapData:function(a,c){for(var d=-1,b=this.moduleCount-1,e=7,f=0,i=this.moduleCount-1;0<i;i-=2)for(6==i&&i--;;){for(var g=0;2>g;g++)if(null==this.modules[b][i-g]){var n=!1;f<a.length&&(n=1==(a[f]>>>e&1));j.getMask(c,b,i-g)&&(n=!n);this.modules[b][i-g]=n;e--; -1==e&&(f++,e=7)}b+=d;if(0>b||this.moduleCount<=b){b-=d;d=-d;break}}}};o.PAD0=236;o.PAD1=17;o.createData=function(a,c,d){for(var c=p.getRSBlocks(a,
c),b=new t,e=0;e<d.length;e++){var f=d[e];b.put(f.mode,4);b.put(f.getLength(),j.getLengthInBits(f.mode,a));f.write(b)}for(e=a=0;e<c.length;e++)a+=c[e].dataCount;if(b.getLengthInBits()>8*a)throw Error("code length overflow. ("+b.getLengthInBits()+">"+8*a+")");for(b.getLengthInBits()+4<=8*a&&b.put(0,4);0!=b.getLengthInBits()%8;)b.putBit(!1);for(;!(b.getLengthInBits()>=8*a);){b.put(o.PAD0,8);if(b.getLengthInBits()>=8*a)break;b.put(o.PAD1,8)}return o.createBytes(b,c)};o.createBytes=function(a,c){for(var d=
0,b=0,e=0,f=Array(c.length),i=Array(c.length),g=0;g<c.length;g++){var n=c[g].dataCount,h=c[g].totalCount-n,b=Math.max(b,n),e=Math.max(e,h);f[g]=Array(n);for(var k=0;k<f[g].length;k++)f[g][k]=255&a.buffer[k+d];d+=n;k=j.getErrorCorrectPolynomial(h);n=(new q(f[g],k.getLength()-1)).mod(k);i[g]=Array(k.getLength()-1);for(k=0;k<i[g].length;k++)h=k+n.getLength()-i[g].length,i[g][k]=0<=h?n.get(h):0}for(k=g=0;k<c.length;k++)g+=c[k].totalCount;d=Array(g);for(k=n=0;k<b;k++)for(g=0;g<c.length;g++)k<f[g].length&&
(d[n++]=f[g][k]);for(k=0;k<e;k++)for(g=0;g<c.length;g++)k<i[g].length&&(d[n++]=i[g][k]);return d};s=4;for(var j={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,
78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(a){for(var c=a<<10;0<=j.getBCHDigit(c)-j.getBCHDigit(j.G15);)c^=j.G15<<j.getBCHDigit(c)-j.getBCHDigit(j.G15);return(a<<10|c)^j.G15_MASK},getBCHTypeNumber:function(a){for(var c=a<<12;0<=j.getBCHDigit(c)-
j.getBCHDigit(j.G18);)c^=j.G18<<j.getBCHDigit(c)-j.getBCHDigit(j.G18);return a<<12|c},getBCHDigit:function(a){for(var c=0;0!=a;)c++,a>>>=1;return c},getPatternPosition:function(a){return j.PATTERN_POSITION_TABLE[a-1]},getMask:function(a,c,d){switch(a){case 0:return 0==(c+d)%2;case 1:return 0==c%2;case 2:return 0==d%3;case 3:return 0==(c+d)%3;case 4:return 0==(Math.floor(c/2)+Math.floor(d/3))%2;case 5:return 0==c*d%2+c*d%3;case 6:return 0==(c*d%2+c*d%3)%2;case 7:return 0==(c*d%3+(c+d)%2)%2;default:throw Error("bad maskPattern:"+
a);}},getErrorCorrectPolynomial:function(a){for(var c=new q([1],0),d=0;d<a;d++)c=c.multiply(new q([1,l.gexp(d)],0));return c},getLengthInBits:function(a,c){if(1<=c&&10>c)switch(a){case 1:return 10;case 2:return 9;case s:return 8;case 8:return 8;default:throw Error("mode:"+a);}else if(27>c)switch(a){case 1:return 12;case 2:return 11;case s:return 16;case 8:return 10;default:throw Error("mode:"+a);}else if(41>c)switch(a){case 1:return 14;case 2:return 13;case s:return 16;case 8:return 12;default:throw Error("mode:"+
a);}else throw Error("type:"+c);},getLostPoint:function(a){for(var c=a.getModuleCount(),d=0,b=0;b<c;b++)for(var e=0;e<c;e++){for(var f=0,i=a.isDark(b,e),g=-1;1>=g;g++)if(!(0>b+g||c<=b+g))for(var h=-1;1>=h;h++)0>e+h||c<=e+h||0==g&&0==h||i==a.isDark(b+g,e+h)&&f++;5<f&&(d+=3+f-5)}for(b=0;b<c-1;b++)for(e=0;e<c-1;e++)if(f=0,a.isDark(b,e)&&f++,a.isDark(b+1,e)&&f++,a.isDark(b,e+1)&&f++,a.isDark(b+1,e+1)&&f++,0==f||4==f)d+=3;for(b=0;b<c;b++)for(e=0;e<c-6;e++)a.isDark(b,e)&&!a.isDark(b,e+1)&&a.isDark(b,e+
2)&&a.isDark(b,e+3)&&a.isDark(b,e+4)&&!a.isDark(b,e+5)&&a.isDark(b,e+6)&&(d+=40);for(e=0;e<c;e++)for(b=0;b<c-6;b++)a.isDark(b,e)&&!a.isDark(b+1,e)&&a.isDark(b+2,e)&&a.isDark(b+3,e)&&a.isDark(b+4,e)&&!a.isDark(b+5,e)&&a.isDark(b+6,e)&&(d+=40);for(e=f=0;e<c;e++)for(b=0;b<c;b++)a.isDark(b,e)&&f++;a=Math.abs(100*f/c/c-50)/5;return d+10*a}},l={glog:function(a){if(1>a)throw Error("glog("+a+")");return l.LOG_TABLE[a]},gexp:function(a){for(;0>a;)a+=255;for(;256<=a;)a-=255;return l.EXP_TABLE[a]},EXP_TABLE:Array(256),
LOG_TABLE:Array(256)},m=0;8>m;m++)l.EXP_TABLE[m]=1<<m;for(m=8;256>m;m++)l.EXP_TABLE[m]=l.EXP_TABLE[m-4]^l.EXP_TABLE[m-5]^l.EXP_TABLE[m-6]^l.EXP_TABLE[m-8];for(m=0;255>m;m++)l.LOG_TABLE[l.EXP_TABLE[m]]=m;q.prototype={get:function(a){return this.num[a]},getLength:function(){return this.num.length},multiply:function(a){for(var c=Array(this.getLength()+a.getLength()-1),d=0;d<this.getLength();d++)for(var b=0;b<a.getLength();b++)c[d+b]^=l.gexp(l.glog(this.get(d))+l.glog(a.get(b)));return new q(c,0)},mod:function(a){if(0>
this.getLength()-a.getLength())return this;for(var c=l.glog(this.get(0))-l.glog(a.get(0)),d=Array(this.getLength()),b=0;b<this.getLength();b++)d[b]=this.get(b);for(b=0;b<a.getLength();b++)d[b]^=l.gexp(l.glog(a.get(b))+c);return(new q(d,0)).mod(a)}};p.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],
[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,
116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,
43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,
3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,
55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,
45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];p.getRSBlocks=function(a,c){var d=p.getRsBlockTable(a,c);if(void 0==d)throw Error("bad rs block @ typeNumber:"+a+"/errorCorrectLevel:"+c);for(var b=d.length/3,e=[],f=0;f<b;f++)for(var h=d[3*f+0],g=d[3*f+1],j=d[3*f+2],l=0;l<h;l++)e.push(new p(g,j));return e};p.getRsBlockTable=function(a,c){switch(c){case 1:return p.RS_BLOCK_TABLE[4*(a-1)+0];case 0:return p.RS_BLOCK_TABLE[4*(a-1)+1];case 3:return p.RS_BLOCK_TABLE[4*
(a-1)+2];case 2:return p.RS_BLOCK_TABLE[4*(a-1)+3]}};t.prototype={get:function(a){return 1==(this.buffer[Math.floor(a/8)]>>>7-a%8&1)},put:function(a,c){for(var d=0;d<c;d++)this.putBit(1==(a>>>c-d-1&1))},getLengthInBits:function(){return this.length},putBit:function(a){var c=Math.floor(this.length/8);this.buffer.length<=c&&this.buffer.push(0);a&&(this.buffer[c]|=128>>>this.length%8);this.length++}};"string"===typeof h&&(h={text:h});h=r.extend({},{render:"canvas",width:256,height:256,typeNumber:-1,
correctLevel:2,background:"#ffffff",foreground:"#000000"},h);return this.each(function(){var a;if("canvas"==h.render){a=new o(h.typeNumber,h.correctLevel);a.addData(h.text);a.make();var c=document.createElement("canvas");c.width=h.width;c.height=h.height;for(var d=c.getContext("2d"),b=h.width/a.getModuleCount(),e=h.height/a.getModuleCount(),f=0;f<a.getModuleCount();f++)for(var i=0;i<a.getModuleCount();i++){d.fillStyle=a.isDark(f,i)?h.foreground:h.background;var g=Math.ceil((i+1)*b)-Math.floor(i*b),
j=Math.ceil((f+1)*b)-Math.floor(f*b);d.fillRect(Math.round(i*b),Math.round(f*e),g,j)}}else{a=new o(h.typeNumber,h.correctLevel);a.addData(h.text);a.make();c=r("<table></table>").css("width",h.width+"px").css("height",h.height+"px").css("border","0px").css("border-collapse","collapse").css("background-color",h.background);d=h.width/a.getModuleCount();b=h.height/a.getModuleCount();for(e=0;e<a.getModuleCount();e++){f=r("<tr></tr>").css("height",b+"px").appendTo(c);for(i=0;i<a.getModuleCount();i++)r("<td></td>").css("width",
d+"px").css("background-color",a.isDark(e,i)?h.foreground:h.background).appendTo(f)}}a=c;jQuery(a).appendTo(this)})}})(jQuery);
/*!
* jQuery.selection - jQuery Plugin
*
* Copyright (c) 2010-2014 IWASAKI Koji (@madapaja).
* http://blog.madapaja.net/
* Under The MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
(function($, win, doc) {
/**
* get caret status of the selection of the element
*
* @param {Element} element target DOM element
* @return {Object} return
* @return {String} return.text selected text
* @return {Number} return.start start position of the selection
* @return {Number} return.end end position of the selection
*/
var _getCaretInfo = function(element){
var res = {
text: '',
start: 0,
end: 0
};
if (!element.value) {
/* no value or empty string */
return res;
}
try {
if (win.getSelection) {
/* except IE */
res.start = element.selectionStart;
res.end = element.selectionEnd;
res.text = element.value.slice(res.start, res.end);
} else if (doc.selection) {
/* for IE */
element.focus();
var range = doc.selection.createRange(),
range2 = doc.body.createTextRange(),
tmpLength;
res.text = range.text;
try {
range2.moveToElementText(element);
range2.setEndPoint('StartToStart', range);
} catch (e) {
range2 = element.createTextRange();
range2.setEndPoint('StartToStart', range);
}
res.start = element.value.length - range2.text.length;
res.end = res.start + range.text.length;
}
} catch (e) {
/* give up */
}
return res;
};
/**
* caret operation for the element
* @type {Object}
*/
var _CaretOperation = {
/**
* get caret position
*
* @param {Element} element target element
* @return {Object} return
* @return {Number} return.start start position for the selection
* @return {Number} return.end end position for the selection
*/
getPos: function(element) {
var tmp = _getCaretInfo(element);
return {start: tmp.start, end: tmp.end};
},
/**
* set caret position
*
* @param {Element} element target element
* @param {Object} toRange caret position
* @param {Number} toRange.start start position for the selection
* @param {Number} toRange.end end position for the selection
* @param {String} caret caret mode: any of the following: "keep" | "start" | "end"
*/
setPos: function(element, toRange, caret) {
caret = this._caretMode(caret);
if (caret == 'start') {
toRange.end = toRange.start;
} else if (caret == 'end') {
toRange.start = toRange.end;
}
element.focus();
try {
if (element.createTextRange) {
var range = element.createTextRange();
if (win.navigator.userAgent.toLowerCase().indexOf("msie") >= 0) {
toRange.start = element.value.substr(0, toRange.start).replace(/\r/g, '').length;
toRange.end = element.value.substr(0, toRange.end).replace(/\r/g, '').length;
}
range.collapse(true);
range.moveStart('character', toRange.start);
range.moveEnd('character', toRange.end - toRange.start);
range.select();
} else if (element.setSelectionRange) {
element.setSelectionRange(toRange.start, toRange.end);
}
} catch (e) {
/* give up */
}
},
/**
* get selected text
*
* @param {Element} element target element
* @return {String} return selected text
*/
getText: function(element) {
return _getCaretInfo(element).text;
},
/**
* get caret mode
*
* @param {String} caret caret mode
* @return {String} return any of the following: "keep" | "start" | "end"
*/
_caretMode: function(caret) {
caret = caret || "keep";
if (caret === false) {
caret = 'end';
}
switch (caret) {
case 'keep':
case 'start':
case 'end':
break;
default:
caret = 'keep';
}
return caret;
},
/**
* replace selected text
*
* @param {Element} element target element
* @param {String} text replacement text
* @param {String} caret caret mode: any of the following: "keep" | "start" | "end"
*/
replace: function(element, text, caret) {
var tmp = _getCaretInfo(element),
orig = element.value,
pos = $(element).scrollTop(),
range = {start: tmp.start, end: tmp.start + text.length};
element.value = orig.substr(0, tmp.start) + text + orig.substr(tmp.end);
$(element).scrollTop(pos);
this.setPos(element, range, caret);
},
/**
* insert before the selected text
*
* @param {Element} element target element
* @param {String} text insertion text
* @param {String} caret caret mode: any of the following: "keep" | "start" | "end"
*/
insertBefore: function(element, text, caret) {
var tmp = _getCaretInfo(element),
orig = element.value,
pos = $(element).scrollTop(),
range = {start: tmp.start + text.length, end: tmp.end + text.length};
element.value = orig.substr(0, tmp.start) + text + orig.substr(tmp.start);
$(element).scrollTop(pos);
this.setPos(element, range, caret);
},
/**
* insert after the selected text
*
* @param {Element} element target element
* @param {String} text insertion text
* @param {String} caret caret mode: any of the following: "keep" | "start" | "end"
*/
insertAfter: function(element, text, caret) {
var tmp = _getCaretInfo(element),
orig = element.value,
pos = $(element).scrollTop(),
range = {start: tmp.start, end: tmp.end};
element.value = orig.substr(0, tmp.end) + text + orig.substr(tmp.end);
$(element).scrollTop(pos);
this.setPos(element, range, caret);
}
};
/* add jQuery.selection */
$.extend({
/**
* get selected text on the window
*
* @param {String} mode selection mode: any of the following: "text" | "html"
* @return {String} return
*/
selection: function(mode) {
var getText = ((mode || 'text').toLowerCase() == 'text');
try {
if (win.getSelection) {
if (getText) {
// get text
return win.getSelection().toString();
} else {
// get html
var sel = win.getSelection(), range;
if (sel.getRangeAt) {
range = sel.getRangeAt(0);
} else {
range = doc.createRange();
range.setStart(sel.anchorNode, sel.anchorOffset);
range.setEnd(sel.focusNode, sel.focusOffset);
}
return $('<div></div>').append(range.cloneContents()).html();
}
} else if (doc.selection) {
if (getText) {
// get text
return doc.selection.createRange().text;
} else {
// get html
return doc.selection.createRange().htmlText;
}
}
} catch (e) {
/* give up */
}
return '';
}
});
/* add selection */
$.fn.extend({
selection: function(mode, opts) {
opts = opts || {};
switch (mode) {
/**
* selection('getPos')
* get caret position
*
* @return {Object} return
* @return {Number} return.start start position for the selection
* @return {Number} return.end end position for the selection
*/
case 'getPos':
return _CaretOperation.getPos(this[0]);
/**
* selection('setPos', opts)
* set caret position
*
* @param {Number} opts.start start position for the selection
* @param {Number} opts.end end position for the selection
*/
case 'setPos':
return this.each(function() {
_CaretOperation.setPos(this, opts);
});
/**
* selection('replace', opts)
* replace the selected text
*
* @param {String} opts.text replacement text
* @param {String} opts.caret caret mode: any of the following: "keep" | "start" | "end"
*/
case 'replace':
return this.each(function() {
_CaretOperation.replace(this, opts.text, opts.caret);
});
/**
* selection('insert', opts)
* insert before/after the selected text
*
* @param {String} opts.text insertion text
* @param {String} opts.caret caret mode: any of the following: "keep" | "start" | "end"
* @param {String} opts.mode insertion mode: any of the following: "before" | "after"
*/
case 'insert':
return this.each(function() {
if (opts.mode == 'before') {
_CaretOperation.insertBefore(this, opts.text, opts.caret);
} else {
_CaretOperation.insertAfter(this, opts.text, opts.caret);
}
});
/**
* selection('get')
* get selected text
*
* @return {String} return
*/
case 'get':
/* falls through */
default:
return _CaretOperation.getText(this[0]);
}
return this;
}
});
})(jQuery, window, window.document);$.fn.setCursorLocation = function(loc) {
return this.each(function() {
if (this.setSelectionRange) {
this.focus();
this.setSelectionRange(loc, loc);
} else if (this.createTextRange) {
var range = this.createTextRange();
range.collapse(true);
range.moveEnd('character', loc);
range.moveStart('character', loc);
range.select();
}
});
};
/*!
* jQuery UI Touch Punch 0.2.3
*
* Copyright 2011–2014, Dave Furfero
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* Depends:
* jquery.ui.widget.js
* jquery.ui.mouse.js
*/
!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);
/*! jQuery Validation Plugin - v1.11.1 - 3/22/2013\n* https://github.com/jzaefferer/jquery-validation
* Copyright (c) 2013 Jörn Zaefferer; Licensed MIT */(function(t){t.extend(t.fn,{validate:function(e){if(!this.length)return e&&e.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."),void 0;var i=t.data(this[0],"validator");return i?i:(this.attr("novalidate","novalidate"),i=new t.validator(e,this[0]),t.data(this[0],"validator",i),i.settings.onsubmit&&(this.validateDelegate(":submit","click",function(e){i.settings.submitHandler&&(i.submitButton=e.target),t(e.target).hasClass("cancel")&&(i.cancelSubmit=!0),void 0!==t(e.target).attr("formnovalidate")&&(i.cancelSubmit=!0)}),this.submit(function(e){function s(){var s;return i.settings.submitHandler?(i.submitButton&&(s=t("<input type='hidden'/>").attr("name",i.submitButton.name).val(t(i.submitButton).val()).appendTo(i.currentForm)),i.settings.submitHandler.call(i,i.currentForm,e),i.submitButton&&s.remove(),!1):!0}return i.settings.debug&&e.preventDefault(),i.cancelSubmit?(i.cancelSubmit=!1,s()):i.form()?i.pendingRequest?(i.formSubmitted=!0,!1):s():(i.focusInvalid(),!1)})),i)},valid:function(){if(t(this[0]).is("form"))return this.validate().form();var e=!0,i=t(this[0].form).validate();return this.each(function(){e=e&&i.element(this)}),e},removeAttrs:function(e){var i={},s=this;return t.each(e.split(/\s/),function(t,e){i[e]=s.attr(e),s.removeAttr(e)}),i},rules:function(e,i){var s=this[0];if(e){var r=t.data(s.form,"validator").settings,n=r.rules,a=t.validator.staticRules(s);switch(e){case"add":t.extend(a,t.validator.normalizeRule(i)),delete a.messages,n[s.name]=a,i.messages&&(r.messages[s.name]=t.extend(r.messages[s.name],i.messages));break;case"remove":if(!i)return delete n[s.name],a;var u={};return t.each(i.split(/\s/),function(t,e){u[e]=a[e],delete a[e]}),u}}var o=t.validator.normalizeRules(t.extend({},t.validator.classRules(s),t.validator.attributeRules(s),t.validator.dataRules(s),t.validator.staticRules(s)),s);if(o.required){var l=o.required;delete o.required,o=t.extend({required:l},o)}return o}}),t.extend(t.expr[":"],{blank:function(e){return!t.trim(""+t(e).val())},filled:function(e){return!!t.trim(""+t(e).val())},unchecked:function(e){return!t(e).prop("checked")}}),t.validator=function(e,i){this.settings=t.extend(!0,{},t.validator.defaults,e),this.currentForm=i,this.init()},t.validator.format=function(e,i){return 1===arguments.length?function(){var i=t.makeArray(arguments);return i.unshift(e),t.validator.format.apply(this,i)}:(arguments.length>2&&i.constructor!==Array&&(i=t.makeArray(arguments).slice(1)),i.constructor!==Array&&(i=[i]),t.each(i,function(t,i){e=e.replace(RegExp("\\{"+t+"\\}","g"),function(){return i})}),e)},t.extend(t.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:t([]),errorLabelContainer:t([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(t){this.lastActive=t,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,t,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(t)).hide())},onfocusout:function(t){this.checkable(t)||!(t.name in this.submitted)&&this.optional(t)||this.element(t)},onkeyup:function(t,e){(9!==e.which||""!==this.elementValue(t))&&(t.name in this.submitted||t===this.lastElement)&&this.element(t)},onclick:function(t){t.name in this.submitted?this.element(t):t.parentNode.name in this.submitted&&this.element(t.parentNode)},highlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).addClass(i).removeClass(s):t(e).addClass(i).removeClass(s)},unhighlight:function(e,i,s){"radio"===e.type?this.findByName(e.name).removeClass(i).addClass(s):t(e).removeClass(i).addClass(s)}},setDefaults:function(e){t.extend(t.validator.defaults,e)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:t.validator.format("Please enter no more than {0} characters."),minlength:t.validator.format("Please enter at least {0} characters."),rangelength:t.validator.format("Please enter a value between {0} and {1} characters long."),range:t.validator.format("Please enter a value between {0} and {1}."),max:t.validator.format("Please enter a value less than or equal to {0}."),min:t.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function e(e){var i=t.data(this[0].form,"validator"),s="on"+e.type.replace(/^validate/,"");i.settings[s]&&i.settings[s].call(i,this[0],e)}this.labelContainer=t(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||t(this.currentForm),this.containers=t(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var i=this.groups={};t.each(this.settings.groups,function(e,s){"string"==typeof s&&(s=s.split(/\s/)),t.each(s,function(t,s){i[s]=e})});var s=this.settings.rules;t.each(s,function(e,i){s[e]=t.validator.normalizeRule(i)}),t(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",e).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",e),this.settings.invalidHandler&&t(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),t.extend(this.submitted,this.errorMap),this.invalid=t.extend({},this.errorMap),this.valid()||t(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var t=0,e=this.currentElements=this.elements();e[t];t++)this.check(e[t]);return this.valid()},element:function(e){e=this.validationTargetFor(this.clean(e)),this.lastElement=e,this.prepareElement(e),this.currentElements=t(e);var i=this.check(e)!==!1;return i?delete this.invalid[e.name]:this.invalid[e.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),i},showErrors:function(e){if(e){t.extend(this.errorMap,e),this.errorList=[];for(var i in e)this.errorList.push({message:e[i],element:this.findByName(i)[0]});this.successList=t.grep(this.successList,function(t){return!(t.name in e)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){t.fn.resetForm&&t(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(t){var e=0;for(var i in t)e++;return e},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{t(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(e){}},findLastActive:function(){var e=this.lastActive;return e&&1===t.grep(this.errorList,function(t){return t.element.name===e.name}).length&&e},elements:function(){var e=this,i={};return t(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&e.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in i||!e.objectLength(t(this).rules())?!1:(i[this.name]=!0,!0)})},clean:function(e){return t(e)[0]},errors:function(){var e=this.settings.errorClass.replace(" ",".");return t(this.settings.errorElement+"."+e,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=t([]),this.toHide=t([]),this.currentElements=t([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(t){this.reset(),this.toHide=this.errorsFor(t)},elementValue:function(e){var i=t(e).attr("type"),s=t(e).val();return"radio"===i||"checkbox"===i?t("input[name='"+t(e).attr("name")+"']:checked").val():"string"==typeof s?s.replace(/\r/g,""):s},check:function(e){e=this.validationTargetFor(this.clean(e));var i,s=t(e).rules(),r=!1,n=this.elementValue(e);for(var a in s){var u={method:a,parameters:s[a]};try{if(i=t.validator.methods[a].call(this,n,e,u.parameters),"dependency-mismatch"===i){r=!0;continue}if(r=!1,"pending"===i)return this.toHide=this.toHide.not(this.errorsFor(e)),void 0;if(!i)return this.formatAndAdd(e,u),!1}catch(o){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+e.id+", check the '"+u.method+"' method.",o),o}}return r?void 0:(this.objectLength(s)&&this.successList.push(e),!0)},customDataMessage:function(e,i){return t(e).data("msg-"+i.toLowerCase())||e.attributes&&t(e).attr("data-msg-"+i.toLowerCase())},customMessage:function(t,e){var i=this.settings.messages[t];return i&&(i.constructor===String?i:i[e])},findDefined:function(){for(var t=0;arguments.length>t;t++)if(void 0!==arguments[t])return arguments[t];return void 0},defaultMessage:function(e,i){return this.findDefined(this.customMessage(e.name,i),this.customDataMessage(e,i),!this.settings.ignoreTitle&&e.title||void 0,t.validator.messages[i],"<strong>Warning: No message defined for "+e.name+"</strong>")},formatAndAdd:function(e,i){var s=this.defaultMessage(e,i.method),r=/\$?\{(\d+)\}/g;"function"==typeof s?s=s.call(this,i.parameters,e):r.test(s)&&(s=t.validator.format(s.replace(r,"{$1}"),i.parameters)),this.errorList.push({message:s,element:e}),this.errorMap[e.name]=s,this.submitted[e.name]=s},addWrapper:function(t){return this.settings.wrapper&&(t=t.add(t.parent(this.settings.wrapper))),t},defaultShowErrors:function(){var t,e;for(t=0;this.errorList[t];t++){var i=this.errorList[t];this.settings.highlight&&this.settings.highlight.call(this,i.element,this.settings.errorClass,this.settings.validClass),this.showLabel(i.element,i.message)}if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(t=0;this.successList[t];t++)this.showLabel(this.successList[t]);if(this.settings.unhighlight)for(t=0,e=this.validElements();e[t];t++)this.settings.unhighlight.call(this,e[t],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return t(this.errorList).map(function(){return this.element})},showLabel:function(e,i){var s=this.errorsFor(e);s.length?(s.removeClass(this.settings.validClass).addClass(this.settings.errorClass),s.html(i)):(s=t("<"+this.settings.errorElement+">").attr("for",this.idOrName(e)).addClass(this.settings.errorClass).html(i||""),this.settings.wrapper&&(s=s.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(s).length||(this.settings.errorPlacement?this.settings.errorPlacement(s,t(e)):s.insertAfter(e))),!i&&this.settings.success&&(s.text(""),"string"==typeof this.settings.success?s.addClass(this.settings.success):this.settings.success(s,e)),this.toShow=this.toShow.add(s)},errorsFor:function(e){var i=this.idOrName(e);return this.errors().filter(function(){return t(this).attr("for")===i})},idOrName:function(t){return this.groups[t.name]||(this.checkable(t)?t.name:t.id||t.name)},validationTargetFor:function(t){return this.checkable(t)&&(t=this.findByName(t.name).not(this.settings.ignore)[0]),t},checkable:function(t){return/radio|checkbox/i.test(t.type)},findByName:function(e){return t(this.currentForm).find("[name='"+e+"']")},getLength:function(e,i){switch(i.nodeName.toLowerCase()){case"select":return t("option:selected",i).length;case"input":if(this.checkable(i))return this.findByName(i.name).filter(":checked").length}return e.length},depend:function(t,e){return this.dependTypes[typeof t]?this.dependTypes[typeof t](t,e):!0},dependTypes:{"boolean":function(t){return t},string:function(e,i){return!!t(e,i.form).length},"function":function(t,e){return t(e)}},optional:function(e){var i=this.elementValue(e);return!t.validator.methods.required.call(this,i,e)&&"dependency-mismatch"},startRequest:function(t){this.pending[t.name]||(this.pendingRequest++,this.pending[t.name]=!0)},stopRequest:function(e,i){this.pendingRequest--,0>this.pendingRequest&&(this.pendingRequest=0),delete this.pending[e.name],i&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(t(this.currentForm).submit(),this.formSubmitted=!1):!i&&0===this.pendingRequest&&this.formSubmitted&&(t(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(e){return t.data(e,"previousValue")||t.data(e,"previousValue",{old:null,valid:!0,message:this.defaultMessage(e,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(e,i){e.constructor===String?this.classRuleSettings[e]=i:t.extend(this.classRuleSettings,e)},classRules:function(e){var i={},s=t(e).attr("class");return s&&t.each(s.split(" "),function(){this in t.validator.classRuleSettings&&t.extend(i,t.validator.classRuleSettings[this])}),i},attributeRules:function(e){var i={},s=t(e),r=s[0].getAttribute("type");for(var n in t.validator.methods){var a;"required"===n?(a=s.get(0).getAttribute(n),""===a&&(a=!0),a=!!a):a=s.attr(n),/min|max/.test(n)&&(null===r||/number|range|text/.test(r))&&(a=Number(a)),a?i[n]=a:r===n&&"range"!==r&&(i[n]=!0)}return i.maxlength&&/-1|2147483647|524288/.test(i.maxlength)&&delete i.maxlength,i},dataRules:function(e){var i,s,r={},n=t(e);for(i in t.validator.methods)s=n.data("rule-"+i.toLowerCase()),void 0!==s&&(r[i]=s);return r},staticRules:function(e){var i={},s=t.data(e.form,"validator");return s.settings.rules&&(i=t.validator.normalizeRule(s.settings.rules[e.name])||{}),i},normalizeRules:function(e,i){return t.each(e,function(s,r){if(r===!1)return delete e[s],void 0;if(r.param||r.depends){var n=!0;switch(typeof r.depends){case"string":n=!!t(r.depends,i.form).length;break;case"function":n=r.depends.call(i,i)}n?e[s]=void 0!==r.param?r.param:!0:delete e[s]}}),t.each(e,function(s,r){e[s]=t.isFunction(r)?r(i):r}),t.each(["minlength","maxlength"],function(){e[this]&&(e[this]=Number(e[this]))}),t.each(["rangelength","range"],function(){var i;e[this]&&(t.isArray(e[this])?e[this]=[Number(e[this][0]),Number(e[this][1])]:"string"==typeof e[this]&&(i=e[this].split(/[\s,]+/),e[this]=[Number(i[0]),Number(i[1])]))}),t.validator.autoCreateRanges&&(e.min&&e.max&&(e.range=[e.min,e.max],delete e.min,delete e.max),e.minlength&&e.maxlength&&(e.rangelength=[e.minlength,e.maxlength],delete e.minlength,delete e.maxlength)),e},normalizeRule:function(e){if("string"==typeof e){var i={};t.each(e.split(/\s/),function(){i[this]=!0}),e=i}return e},addMethod:function(e,i,s){t.validator.methods[e]=i,t.validator.messages[e]=void 0!==s?s:t.validator.messages[e],3>i.length&&t.validator.addClassRules(e,t.validator.normalizeRule(e))},methods:{required:function(e,i,s){if(!this.depend(s,i))return"dependency-mismatch";if("select"===i.nodeName.toLowerCase()){var r=t(i).val();return r&&r.length>0}return this.checkable(i)?this.getLength(e,i)>0:t.trim(e).length>0},email:function(t,e){return this.optional(e)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(t)},url:function(t,e){return this.optional(e)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(t)},date:function(t,e){return this.optional(e)||!/Invalid|NaN/.test(""+new Date(t))},dateISO:function(t,e){return this.optional(e)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(t)},number:function(t,e){return this.optional(e)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(t)},digits:function(t,e){return this.optional(e)||/^\d+$/.test(t)},creditcard:function(t,e){if(this.optional(e))return"dependency-mismatch";if(/[^0-9 \-]+/.test(t))return!1;var i=0,s=0,r=!1;t=t.replace(/\D/g,"");for(var n=t.length-1;n>=0;n--){var a=t.charAt(n);s=parseInt(a,10),r&&(s*=2)>9&&(s-=9),i+=s,r=!r}return 0===i%10},minlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r>=s},maxlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||s>=r},rangelength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r>=s[0]&&s[1]>=r},min:function(t,e,i){return this.optional(e)||t>=i},max:function(t,e,i){return this.optional(e)||i>=t},range:function(t,e,i){return this.optional(e)||t>=i[0]&&i[1]>=t},equalTo:function(e,i,s){var r=t(s);return this.settings.onfocusout&&r.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){t(i).valid()}),e===r.val()},remote:function(e,i,s){if(this.optional(i))return"dependency-mismatch";var r=this.previousValue(i);if(this.settings.messages[i.name]||(this.settings.messages[i.name]={}),r.originalMessage=this.settings.messages[i.name].remote,this.settings.messages[i.name].remote=r.message,s="string"==typeof s&&{url:s}||s,r.old===e)return r.valid;r.old=e;var n=this;this.startRequest(i);var a={};return a[i.name]=e,t.ajax(t.extend(!0,{url:s,mode:"abort",port:"validate"+i.name,dataType:"json",data:a,success:function(s){n.settings.messages[i.name].remote=r.originalMessage;var a=s===!0||"true"===s;if(a){var u=n.formSubmitted;n.prepareElement(i),n.formSubmitted=u,n.successList.push(i),delete n.invalid[i.name],n.showErrors()}else{var o={},l=s||n.defaultMessage(i,"remote");o[i.name]=r.message=t.isFunction(l)?l(e):l,n.invalid[i.name]=!0,n.showErrors(o)}r.valid=a,n.stopRequest(i,a)}},s)),"pending"}}}),t.format=t.validator.format})(jQuery),function(t){var e={};if(t.ajaxPrefilter)t.ajaxPrefilter(function(t,i,s){var r=t.port;"abort"===t.mode&&(e[r]&&e[r].abort(),e[r]=s)});else{var i=t.ajax;t.ajax=function(s){var r=("mode"in s?s:t.ajaxSettings).mode,n=("port"in s?s:t.ajaxSettings).port;return"abort"===r?(e[n]&&e[n].abort(),e[n]=i.apply(this,arguments),e[n]):i.apply(this,arguments)}}}(jQuery),function(t){t.extend(t.fn,{validateDelegate:function(e,i,s){return this.bind(i,function(i){var r=t(i.target);return r.is(e)?s.apply(r,arguments):void 0})}})}(jQuery);
/* https://github.com/customd/jquery-visible */
!function(t){var i=t(window);t.fn.visible=function(t,e,o){if(!(this.length<1)){var r=this.length>1?this.eq(0):this,n=r.get(0),f=i.width(),h=i.height(),o=o?o:"both",l=e===!0?n.offsetWidth*n.offsetHeight:!0;if("function"==typeof n.getBoundingClientRect){var g=n.getBoundingClientRect(),u=g.top>=0&&g.top<h,s=g.bottom>0&&g.bottom<=h,c=g.left>=0&&g.left<f,a=g.right>0&&g.right<=f,v=t?u||s:u&&s,b=t?c||a:c&&a;if("both"===o)return l&&v&&b;if("vertical"===o)return l&&v;if("horizontal"===o)return l&&b}else{var d=i.scrollTop(),p=d+h,w=i.scrollLeft(),m=w+f,y=r.offset(),z=y.top,B=z+r.height(),C=y.left,R=C+r.width(),j=t===!0?B:z,q=t===!0?z:B,H=t===!0?R:C,L=t===!0?C:R;if("both"===o)return!!l&&p>=q&&j>=d&&m>=L&&H>=w;if("vertical"===o)return!!l&&p>=q&&j>=d;if("horizontal"===o)return!!l&&m>=L&&H>=w}}}}(jQuery);
|
const mergeTwoLists = require('../../problems/linked_list/0021_merge_two_sorted_lists')
function ListNode(val, next) {
this.val = val === undefined ? 0 : val
this.next = next === undefined ? null : next
}
test('0021 mergeTwoLists test 01', () => {
// todo
})
test('0021 mergeTwoLists test 02', () => {
// todo
})
test('0021 mergeTwoLists test 03', () => {
// todo
})
|
/**
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
*/
var t = readline();
while (t--) {
var n = readline();
var a = readline().split(' ').map(Number);
var o = 0, e = 0;
for (var i = 0; i < n; i++)
if (i % 2 !== a[i] % 2)
i % 2 ? o++ : e++;
print(o !== e ? -1 : o);
}
|
/*
* Copyright 2018 Cognitive Scale, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the “License”);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an “AS IS” BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const fs = require('fs');
const uuid = require('uuid/v4');
const debug = require('debug')('cortex:cli');
const {loadProfile} = require('../config');
const Actions = require('../client/actions');
const {printSuccess, printError, filterObject, parseObject, printTable} = require('./utils');
module.exports.ListActionsCommand = class {
constructor(program) {
this.program = program;
}
execute(options) {
const profile = loadProfile(options.profile);
debug('%s.executeListActions()', profile.name);
const actions = new Actions(profile.url);
actions.listActions(profile.token)
.then((response) => {
if (response.success) {
let result = response.actions;
if (options.query)
result = filterObject(result, options);
if (options.json) {
printSuccess(JSON.stringify(result, null, 2), options);
}
else {
const tableSpec = [
{column: 'Name', field: 'name', width: 50},
{column: 'Image', field: 'image', width: 50},
{column: 'Kind', field: 'kind', width: 25},
{column: 'Created On', field: 'createdAt', width: 26}
];
printTable(tableSpec, result);
}
}
else {
printError(`Failed to list actions: ${response.status} ${response.message}`, options);
}
})
.catch((err) => {
printError(`Failed to list actions: ${err.status} ${err.message}`, options);
});
}
};
module.exports.DescribeActionCommand = class {
constructor(program) {
this.program = program;
}
execute(actionName, options) {
const profile = loadProfile(options.profile);
debug('%s.executeDescribeAction(%s)', profile.name, actionName);
const actions = new Actions(profile.url);
actions.describeAction(profile.token, actionName)
.then((response) => {
if (response.success) {
let result = filterObject(response.action, options);
printSuccess(JSON.stringify(result, null, 2), options);
}
else {
printError(`Failed to describe action: ${response.status} ${response.message}`, options);
}
})
.catch((err) => {
printError(`Failed to describe action: ${err.status} ${err.message}`, options);
});
}
};
module.exports.DeployActionCommand = class {
constructor(program) {
this.program = program;
}
execute(actionName, options) {
const profile = loadProfile(options.profile);
debug('%s.deployAction(%s)', profile.name, actionName);
const kind = options.kind;
const dockerImage = options.docker;
const code = options.code;
const memory = parseInt(options.memory);
const vcpus = parseInt(options.vcpus);
const actionType = options.actionType;
const cmd = options.cmd;
const port = options.port;
const environment = options.environment;
const environmentVariables = options.environmentVariables;
const pushDocker = options.pushDocker;
const actions = new Actions(profile.url);
actions.deployAction(profile.token, actionName, dockerImage, kind, code, memory, vcpus, actionType, cmd, port, environment, environmentVariables, pushDocker)
.then((response) => {
if (response.success) {
printSuccess(JSON.stringify(response.message, null, 2), options);
}
else {
printError(`Action deployment failed: ${response.status} ${response.message}`, options);
}
})
.catch((err) => {
printError(`Failed to deploy action: ${err.status} ${err.message}`, options);
});
}
};
module.exports.InvokeActionCommand = class {
constructor(program) {
this.program = program;
}
execute(actionName, options) {
const profile = loadProfile(options.profile);
debug('%s.executeInvokeAction(%s)', profile.name, actionName);
let params = {};
if (options.params) {
params = parseObject(options.params, options);
}
else if (options.paramsFile) {
const paramsStr = fs.readFileSync(options.paramsFile);
params = parseObject(paramsStr, options);
}
const actionType = options.actionType;
params.properties = params.properties || {};
if (options.method)
params.properties['daemon.method'] = options.method;
if (options.path)
params.properties['daemon.path'] = options.path;
if (options.memory)
params.properties['memory'] =parseInt(options.memory);
if (options.vcpus)
params.properties['vcpus'] =parseInt(options.vcpus);
// Set the API Endpoint and Token if not specified
if (!params.apiEndpoint) params.apiEndpoint = profile.url;
if (!params.token) params.token = profile.token;
debug('params: %o', params);
const actions = new Actions(profile.url);
actions.invokeAction(profile.token, actionName, params, actionType)
.then((response) => {
if (response.success) {
let result = filterObject(response.result, options);
printSuccess(JSON.stringify(result, null, 2), options);
}
else {
printError(`Action invocation failed: ${response.status} ${response.message}`, options);
}
})
.catch((err) => {
printError(`Failed to invoke action: ${err.status} ${err.message}`, options);
});
}
};
module.exports.DeleteActionCommand = class {
constructor(program) {
this.program = program;
}
execute(actionName, options) {
const profile = loadProfile(options.profile);
debug('%s.executeDeleteAction(%s)', profile.name, actionName);
const actionType = options.actionType;
const actions = new Actions(profile.url);
actions.deleteAction(profile.token, actionName, actionType)
.then((response) => {
if (response.success) {
let result = filterObject(response, options);
printSuccess(JSON.stringify(result, null, 2), options);
}
else {
printError(`Action deletion failed: ${response.status} ${response.message}`, options);
}
})
.catch((err) => {
printError(`Failed to delete action: ${err.status} ${err.message}`, options);
});
}
};
module.exports.TaskLogsActionCommand = class {
constructor(program) {
this.program = program;
}
execute(jobId, taskId, options) {
const profile = loadProfile(options.profile);
debug('%s.taskLogsActions (%s, %s)', profile.name, jobId, taskId);
const actions = new Actions(profile.url);
actions.taskLogs(profile.token, jobId, taskId)
.then((response) => {
if (response.success) {
const result = filterObject(response, options);
printSuccess(JSON.stringify(result, null, 2), options);
}
else {
printError(`Action task logs failed: ${response.status} ${response.message}`, options);
}
})
}
};
module.exports.TaskCancelActionCommand = class {
constructor(program) {
this.program = program;
}
execute(jobId, taskId, options) {
const profile = loadProfile(options.profile);
debug('%s.taskCancelActions (%s, %s)', profile.name, jobId, taskId);
const actions = new Actions(profile.url);
actions.taskCancel(profile.token, jobId, taskId)
.then((response) => {
if (response.success) {
const result = filterObject(response, options);
printSuccess(JSON.stringify(result, null, 2), options);
}
else {
printError(`Action cancel task failed: ${response.status} ${response.message}`, options);
}
})
}
};
module.exports.TaskStatusActionCommand = class {
constructor(program) {
this.program = program;
}
execute(jobId, taskId, options) {
const profile = loadProfile(options.profile);
debug('%s.taskStatusActions (%s, %s)', profile.name, jobId, taskId);
const actions = new Actions(profile.url);
actions.taskStatus(profile.token, jobId, taskId)
.then((response) => {
if (response.success) {
const result = filterObject(response, options);
printSuccess(JSON.stringify(result, null, 2), options);
}
else {
printError(`Action task logs failed: ${response.status} ${response.message}`, options);
}
})
}
};
module.exports.JobTaskListActionCommand = class {
constructor(program) {
this.program = program;
}
execute(jobId, options) {
const profile = loadProfile(options.profile);
debug('%s.jobTaskListActions (%s, %s)', profile.name, jobId);
const actions = new Actions(profile.url);
actions.jobListTasks(profile.token, jobId)
.then((response) => {
if (response.success) {
const result = filterObject(response, options);
printSuccess(JSON.stringify(result, null, 2), options);
}
else {
printError(`Action list job\'s tasks failed: ${response.status} ${response.message}`, options);
}
})
}
};
module.exports.TaskStatsActionCommand = class {
constructor(program) {
this.program = program;
}
execute(jobId, options) {
const profile = loadProfile(options.profile);
debug('%s.taskStatsActions (%s, %s)', profile.name, jobId);
const actions = new Actions(profile.url);
actions.taskStats(profile.token, jobId)
.then((response) => {
if (response.success) {
const result = filterObject(response, options);
printSuccess(JSON.stringify(result, null, 2), options);
}
else {
printError(`Action get Job tasks stats failed: ${response.status} ${response.message}`, options);
}
})
}
};
module.exports.ListTaskByActivation = class {
constructor(program) {
this.program = program;
}
execute(activationId, options) {
const profile = loadProfile(options.profile);
debug('%s.listTasksByActivation (%s, %s)', profile.name, activationId);
const actions = new Actions(profile.url);
actions.listTasksByActivation(profile.token, activationId)
.then((response) => {
if (response.success) {
const result = filterObject(response, options);
printSuccess(JSON.stringify(result, null, 2), options);
}
else {
printError(`Agent task list by activation failed: ${response.status} ${response.message}`, options);
}
})
}
};
|
import React, { Component } from "react";
import { Link } from "react-router-dom";
import { Container, Header, AsideContainer, Main } from "./styles";
import SideBar from "../../components/sideBar/sideBar";
import EquipCateg from "../../components/equipCateg/equipCateg";
class ListarEquipamentos extends Component {
render() {
return (
<Container>
<AsideContainer>
<SideBar />
</AsideContainer>
<Header>
<h1>Listagem de Equipamentos</h1>
</Header>
<Main>
<EquipCateg />
</Main>
</Container>
);
}
}
export default ListarEquipamentos;
|
//! moment.js locale configuration
;(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined'
&& typeof require === 'function' ? factory(require('../moment')) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment);
}(this, (function (moment) {
'use strict';
var months = 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'),
monthsShort = 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_');
function plural(n) {
return (n > 1) && (n < 5);
}
function translate(number, withoutSuffix, key, isFuture) {
var result = number + ' ';
switch (key) {
case 's': // a few seconds / in a few seconds / a few seconds ago
return (withoutSuffix || isFuture) ? 'pár sekúnd' : 'pár sekundami';
case 'ss': // 9 seconds / in 9 seconds / 9 seconds ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'sekundy' : 'sekúnd');
} else {
return result + 'sekundami';
}
break;
case 'm': // a minute / in a minute / a minute ago
return withoutSuffix ? 'minúta' : (isFuture ? 'minútu' : 'minútou');
case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'minúty' : 'minút');
} else {
return result + 'minútami';
}
break;
case 'h': // an hour / in an hour / an hour ago
return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou');
case 'hh': // 9 hours / in 9 hours / 9 hours ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'hodiny' : 'hodín');
} else {
return result + 'hodinami';
}
break;
case 'd': // a day / in a day / a day ago
return (withoutSuffix || isFuture) ? 'deň' : 'dňom';
case 'dd': // 9 days / in 9 days / 9 days ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'dni' : 'dní');
} else {
return result + 'dňami';
}
break;
case 'M': // a month / in a month / a month ago
return (withoutSuffix || isFuture) ? 'mesiac' : 'mesiacom';
case 'MM': // 9 months / in 9 months / 9 months ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'mesiace' : 'mesiacov');
} else {
return result + 'mesiacmi';
}
break;
case 'y': // a year / in a year / a year ago
return (withoutSuffix || isFuture) ? 'rok' : 'rokom';
case 'yy': // 9 years / in 9 years / 9 years ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'roky' : 'rokov');
} else {
return result + 'rokmi';
}
break;
}
}
var sk = moment.defineLocale('sk', {
months: months,
monthsShort: monthsShort,
weekdays: 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'),
weekdaysShort: 'ne_po_ut_st_št_pi_so'.split('_'),
weekdaysMin: 'ne_po_ut_st_št_pi_so'.split('_'),
longDateFormat: {
LT: 'H:mm',
LTS: 'H:mm:ss',
L: 'DD.MM.YYYY',
LL: 'D. MMMM YYYY',
LLL: 'D. MMMM YYYY H:mm',
LLLL: 'dddd D. MMMM YYYY H:mm'
},
calendar: {
sameDay: '[dnes o] LT',
nextDay: '[zajtra o] LT',
nextWeek: function () {
switch (this.day()) {
case 0:
return '[v nedeľu o] LT';
case 1:
case 2:
return '[v] dddd [o] LT';
case 3:
return '[v stredu o] LT';
case 4:
return '[vo štvrtok o] LT';
case 5:
return '[v piatok o] LT';
case 6:
return '[v sobotu o] LT';
}
},
lastDay: '[včera o] LT',
lastWeek: function () {
switch (this.day()) {
case 0:
return '[minulú nedeľu o] LT';
case 1:
case 2:
return '[minulý] dddd [o] LT';
case 3:
return '[minulú stredu o] LT';
case 4:
case 5:
return '[minulý] dddd [o] LT';
case 6:
return '[minulú sobotu o] LT';
}
},
sameElse: 'L'
},
relativeTime: {
future: 'za %s',
past: 'pred %s',
s: translate,
ss: translate,
m: translate,
mm: translate,
h: translate,
hh: translate,
d: translate,
dd: translate,
M: translate,
MM: translate,
y: translate,
yy: translate
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal: '%d.',
week: {
dow: 1, // Monday is the first day of the week.
doy: 4 // The week that contains Jan 4th is the first week of the year.
}
});
return sk;
})));
|
/*!
Material Components for the Web
Copyright (c) 2018 Google Inc.
License: Apache-2.0
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["ripple"] = factory();
else
root["mdc"] = root["mdc"] || {}, root["mdc"]["ripple"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 4);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* @license
* Copyright 2016 Google Inc.
*
* 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.
*/
/**
* @template A
*/
var MDCFoundation = function () {
_createClass(MDCFoundation, null, [{
key: "cssClasses",
/** @return enum{cssClasses} */
get: function get() {
// Classes extending MDCFoundation should implement this method to return an object which exports every
// CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}
return {};
}
/** @return enum{strings} */
}, {
key: "strings",
get: function get() {
// Classes extending MDCFoundation should implement this method to return an object which exports all
// semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
return {};
}
/** @return enum{numbers} */
}, {
key: "numbers",
get: function get() {
// Classes extending MDCFoundation should implement this method to return an object which exports all
// of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}
return {};
}
/** @return {!Object} */
}, {
key: "defaultAdapter",
get: function get() {
// Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient
// way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter
// validation.
return {};
}
/**
* @param {A=} adapter
*/
}]);
function MDCFoundation() {
var adapter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
_classCallCheck(this, MDCFoundation);
/** @protected {!A} */
this.adapter_ = adapter;
}
_createClass(MDCFoundation, [{
key: "init",
value: function init() {
// Subclasses should override this method to perform initialization routines (registering events, etc.)
}
}, {
key: "destroy",
value: function destroy() {
// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
}
}]);
return MDCFoundation;
}();
/* harmony default export */ __webpack_exports__["a"] = (MDCFoundation);
/***/ }),
/* 1 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__foundation__ = __webpack_require__(0);
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* @license
* Copyright 2016 Google Inc.
*
* 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.
*/
/**
* @template F
*/
var MDCComponent = function () {
_createClass(MDCComponent, null, [{
key: 'attachTo',
/**
* @param {!Element} root
* @return {!MDCComponent}
*/
value: function attachTo(root) {
// Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and
// returns an instantiated component with its root set to that element. Also note that in the cases of
// subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized
// from getDefaultFoundation().
return new MDCComponent(root, new __WEBPACK_IMPORTED_MODULE_0__foundation__["a" /* default */]());
}
/**
* @param {!Element} root
* @param {F=} foundation
* @param {...?} args
*/
}]);
function MDCComponent(root) {
var foundation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
_classCallCheck(this, MDCComponent);
/** @protected {!Element} */
this.root_ = root;
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
this.initialize.apply(this, args);
// Note that we initialize foundation here and not within the constructor's default param so that
// this.root_ is defined and can be used within the foundation class.
/** @protected {!F} */
this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation;
this.foundation_.init();
this.initialSyncWithDOM();
}
_createClass(MDCComponent, [{
key: 'initialize',
value: function initialize() /* ...args */{}
// Subclasses can override this to do any additional setup work that would be considered part of a
// "constructor". Essentially, it is a hook into the parent constructor before the foundation is
// initialized. Any additional arguments besides root and foundation will be passed in here.
/**
* @return {!F} foundation
*/
}, {
key: 'getDefaultFoundation',
value: function getDefaultFoundation() {
// Subclasses must override this method to return a properly configured foundation class for the
// component.
throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class');
}
}, {
key: 'initialSyncWithDOM',
value: function initialSyncWithDOM() {
// Subclasses should override this method if they need to perform work to synchronize with a host DOM
// object. An example of this would be a form control wrapper that needs to synchronize its internal state
// to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM
// reads/writes that would cause layout / paint, as this is called synchronously from within the constructor.
}
}, {
key: 'destroy',
value: function destroy() {
// Subclasses may implement this method to release any resources / deregister any listeners they have
// attached. An example of this might be deregistering a resize event from the window object.
this.foundation_.destroy();
}
/**
* Wrapper method to add an event listener to the component's root element. This is most useful when
* listening for custom events.
* @param {string} evtType
* @param {!Function} handler
*/
}, {
key: 'listen',
value: function listen(evtType, handler) {
this.root_.addEventListener(evtType, handler);
}
/**
* Wrapper method to remove an event listener to the component's root element. This is most useful when
* unlistening for custom events.
* @param {string} evtType
* @param {!Function} handler
*/
}, {
key: 'unlisten',
value: function unlisten(evtType, handler) {
this.root_.removeEventListener(evtType, handler);
}
/**
* Fires a cross-browser-compatible custom event from the component root of the given type,
* with the given data.
* @param {string} evtType
* @param {!Object} evtData
* @param {boolean=} shouldBubble
*/
}, {
key: 'emit',
value: function emit(evtType, evtData) {
var shouldBubble = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var evt = void 0;
if (typeof CustomEvent === 'function') {
evt = new CustomEvent(evtType, {
detail: evtData,
bubbles: shouldBubble
});
} else {
evt = document.createEvent('CustomEvent');
evt.initCustomEvent(evtType, shouldBubble, false, evtData);
}
this.root_.dispatchEvent(evt);
}
}]);
return MDCComponent;
}();
/* harmony default export */ __webpack_exports__["a"] = (MDCComponent);
/***/ }),
/* 2 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "supportsCssVariables", function() { return supportsCssVariables; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "applyPassive", function() { return applyPassive; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMatchesProperty", function() { return getMatchesProperty; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNormalizedEventCoords", function() { return getNormalizedEventCoords; });
/**
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Stores result from supportsCssVariables to avoid redundant processing to detect CSS custom variable support.
* @private {boolean|undefined}
*/
var supportsCssVariables_ = void 0;
/**
* Stores result from applyPassive to avoid redundant processing to detect passive event listener support.
* @private {boolean|undefined}
*/
var supportsPassive_ = void 0;
/**
* @param {!Window} windowObj
* @return {boolean}
*/
function detectEdgePseudoVarBug(windowObj) {
// Detect versions of Edge with buggy var() support
// See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/
var document = windowObj.document;
var node = document.createElement('div');
node.className = 'mdc-ripple-surface--test-edge-var-bug';
document.body.appendChild(node);
// The bug exists if ::before style ends up propagating to the parent element.
// Additionally, getComputedStyle returns null in iframes with display: "none" in Firefox,
// but Firefox is known to support CSS custom properties correctly.
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397
var computedStyle = windowObj.getComputedStyle(node);
var hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid';
node.remove();
return hasPseudoVarBug;
}
/**
* @param {!Window} windowObj
* @param {boolean=} forceRefresh
* @return {boolean|undefined}
*/
function supportsCssVariables(windowObj) {
var forceRefresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var supportsCssVariables = supportsCssVariables_;
if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
return supportsCssVariables;
}
var supportsFunctionPresent = windowObj.CSS && typeof windowObj.CSS.supports === 'function';
if (!supportsFunctionPresent) {
return;
}
var explicitlySupportsCssVars = windowObj.CSS.supports('--css-vars', 'yes');
// See: https://bugs.webkit.org/show_bug.cgi?id=154669
// See: README section on Safari
var weAreFeatureDetectingSafari10plus = windowObj.CSS.supports('(--css-vars: yes)') && windowObj.CSS.supports('color', '#00000000');
if (explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus) {
supportsCssVariables = !detectEdgePseudoVarBug(windowObj);
} else {
supportsCssVariables = false;
}
if (!forceRefresh) {
supportsCssVariables_ = supportsCssVariables;
}
return supportsCssVariables;
}
//
/**
* Determine whether the current browser supports passive event listeners, and if so, use them.
* @param {!Window=} globalObj
* @param {boolean=} forceRefresh
* @return {boolean|{passive: boolean}}
*/
function applyPassive() {
var globalObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
var forceRefresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (supportsPassive_ === undefined || forceRefresh) {
var isSupported = false;
try {
globalObj.document.addEventListener('test', null, { get passive() {
isSupported = true;
} });
} catch (e) {}
supportsPassive_ = isSupported;
}
return supportsPassive_ ? { passive: true } : false;
}
/**
* @param {!Object} HTMLElementPrototype
* @return {!Array<string>}
*/
function getMatchesProperty(HTMLElementPrototype) {
return ['webkitMatchesSelector', 'msMatchesSelector', 'matches'].filter(function (p) {
return p in HTMLElementPrototype;
}).pop();
}
/**
* @param {!Event} ev
* @param {{x: number, y: number}} pageOffset
* @param {!ClientRect} clientRect
* @return {{x: number, y: number}}
*/
function getNormalizedEventCoords(ev, pageOffset, clientRect) {
var x = pageOffset.x,
y = pageOffset.y;
var documentX = x + clientRect.left;
var documentY = y + clientRect.top;
var normalizedX = void 0;
var normalizedY = void 0;
// Determine touch point relative to the ripple container.
if (ev.type === 'touchstart') {
normalizedX = ev.changedTouches[0].pageX - documentX;
normalizedY = ev.changedTouches[0].pageY - documentY;
} else {
normalizedX = ev.pageX - documentX;
normalizedY = ev.pageY - documentY;
}
return { x: normalizedX, y: normalizedY };
}
/***/ }),
/* 3 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint no-unused-vars: [2, {"args": "none"}] */
/**
* Adapter for MDC Ripple. Provides an interface for managing
* - classes
* - dom
* - CSS variables
* - position
* - dimensions
* - scroll position
* - event handlers
* - unbounded, active and disabled states
*
* Additionally, provides type information for the adapter to the Closure
* compiler.
*
* Implement this adapter for your framework of choice to delegate updates to
* the component in your framework of choice. See architecture documentation
* for more details.
* https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
*
* @record
*/
var MDCRippleAdapter = function () {
function MDCRippleAdapter() {
_classCallCheck(this, MDCRippleAdapter);
}
_createClass(MDCRippleAdapter, [{
key: "browserSupportsCssVars",
/** @return {boolean} */
value: function browserSupportsCssVars() {}
/** @return {boolean} */
}, {
key: "isUnbounded",
value: function isUnbounded() {}
/** @return {boolean} */
}, {
key: "isSurfaceActive",
value: function isSurfaceActive() {}
/** @return {boolean} */
}, {
key: "isSurfaceDisabled",
value: function isSurfaceDisabled() {}
/** @param {string} className */
}, {
key: "addClass",
value: function addClass(className) {}
/** @param {string} className */
}, {
key: "removeClass",
value: function removeClass(className) {}
/** @param {!EventTarget} target */
}, {
key: "containsEventTarget",
value: function containsEventTarget(target) {}
/**
* @param {string} evtType
* @param {!Function} handler
*/
}, {
key: "registerInteractionHandler",
value: function registerInteractionHandler(evtType, handler) {}
/**
* @param {string} evtType
* @param {!Function} handler
*/
}, {
key: "deregisterInteractionHandler",
value: function deregisterInteractionHandler(evtType, handler) {}
/**
* @param {string} evtType
* @param {!Function} handler
*/
}, {
key: "registerDocumentInteractionHandler",
value: function registerDocumentInteractionHandler(evtType, handler) {}
/**
* @param {string} evtType
* @param {!Function} handler
*/
}, {
key: "deregisterDocumentInteractionHandler",
value: function deregisterDocumentInteractionHandler(evtType, handler) {}
/**
* @param {!Function} handler
*/
}, {
key: "registerResizeHandler",
value: function registerResizeHandler(handler) {}
/**
* @param {!Function} handler
*/
}, {
key: "deregisterResizeHandler",
value: function deregisterResizeHandler(handler) {}
/**
* @param {string} varName
* @param {?number|string} value
*/
}, {
key: "updateCssVariable",
value: function updateCssVariable(varName, value) {}
/** @return {!ClientRect} */
}, {
key: "computeBoundingRect",
value: function computeBoundingRect() {}
/** @return {{x: number, y: number}} */
}, {
key: "getWindowPageOffset",
value: function getWindowPageOffset() {}
}]);
return MDCRippleAdapter;
}();
/* unused harmony default export */ var _unused_webpack_default_export = (MDCRippleAdapter);
/***/ }),
/* 4 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCRipple", function() { return MDCRipple; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RippleCapableSurface", function() { return RippleCapableSurface; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__material_base_component__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__adapter__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util__ = __webpack_require__(2);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MDCRippleFoundation", function() { return __WEBPACK_IMPORTED_MODULE_2__foundation__["a"]; });
/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "util", function() { return __WEBPACK_IMPORTED_MODULE_3__util__; });
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @extends MDCComponent<!MDCRippleFoundation>
*/
var MDCRipple = function (_MDCComponent) {
_inherits(MDCRipple, _MDCComponent);
/** @param {...?} args */
function MDCRipple() {
var _ref;
_classCallCheck(this, MDCRipple);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
/** @type {boolean} */
var _this = _possibleConstructorReturn(this, (_ref = MDCRipple.__proto__ || Object.getPrototypeOf(MDCRipple)).call.apply(_ref, [this].concat(args)));
_this.disabled = false;
/** @private {boolean} */
_this.unbounded_;
return _this;
}
/**
* @param {!Element} root
* @param {{isUnbounded: (boolean|undefined)}=} options
* @return {!MDCRipple}
*/
_createClass(MDCRipple, [{
key: 'setUnbounded_',
/**
* Closure Compiler throws an access control error when directly accessing a
* protected or private property inside a getter/setter, like unbounded above.
* By accessing the protected property inside a method, we solve that problem.
* That's why this function exists.
* @private
*/
value: function setUnbounded_() {
this.foundation_.setUnbounded(this.unbounded_);
}
}, {
key: 'activate',
value: function activate() {
this.foundation_.activate();
}
}, {
key: 'deactivate',
value: function deactivate() {
this.foundation_.deactivate();
}
}, {
key: 'layout',
value: function layout() {
this.foundation_.layout();
}
/**
* @return {!MDCRippleFoundation}
* @override
*/
}, {
key: 'getDefaultFoundation',
value: function getDefaultFoundation() {
return new __WEBPACK_IMPORTED_MODULE_2__foundation__["a" /* default */](MDCRipple.createAdapter(this));
}
/** @override */
}, {
key: 'initialSyncWithDOM',
value: function initialSyncWithDOM() {
this.unbounded = 'mdcRippleIsUnbounded' in this.root_.dataset;
}
}, {
key: 'unbounded',
/** @return {boolean} */
get: function get() {
return this.unbounded_;
}
/** @param {boolean} unbounded */
,
set: function set(unbounded) {
this.unbounded_ = Boolean(unbounded);
this.setUnbounded_();
}
}], [{
key: 'attachTo',
value: function attachTo(root) {
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref2$isUnbounded = _ref2.isUnbounded,
isUnbounded = _ref2$isUnbounded === undefined ? undefined : _ref2$isUnbounded;
var ripple = new MDCRipple(root);
// Only override unbounded behavior if option is explicitly specified
if (isUnbounded !== undefined) {
ripple.unbounded = /** @type {boolean} */isUnbounded;
}
return ripple;
}
/**
* @param {!RippleCapableSurface} instance
* @return {!MDCRippleAdapter}
*/
}, {
key: 'createAdapter',
value: function createAdapter(instance) {
var MATCHES = __WEBPACK_IMPORTED_MODULE_3__util__["getMatchesProperty"](HTMLElement.prototype);
return {
browserSupportsCssVars: function browserSupportsCssVars() {
return __WEBPACK_IMPORTED_MODULE_3__util__["supportsCssVariables"](window);
},
isUnbounded: function isUnbounded() {
return instance.unbounded;
},
isSurfaceActive: function isSurfaceActive() {
return instance.root_[MATCHES](':active');
},
isSurfaceDisabled: function isSurfaceDisabled() {
return instance.disabled;
},
addClass: function addClass(className) {
return instance.root_.classList.add(className);
},
removeClass: function removeClass(className) {
return instance.root_.classList.remove(className);
},
containsEventTarget: function containsEventTarget(target) {
return instance.root_.contains(target);
},
registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
return instance.root_.addEventListener(evtType, handler, __WEBPACK_IMPORTED_MODULE_3__util__["applyPassive"]());
},
deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
return instance.root_.removeEventListener(evtType, handler, __WEBPACK_IMPORTED_MODULE_3__util__["applyPassive"]());
},
registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) {
return document.documentElement.addEventListener(evtType, handler, __WEBPACK_IMPORTED_MODULE_3__util__["applyPassive"]());
},
deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) {
return document.documentElement.removeEventListener(evtType, handler, __WEBPACK_IMPORTED_MODULE_3__util__["applyPassive"]());
},
registerResizeHandler: function registerResizeHandler(handler) {
return window.addEventListener('resize', handler);
},
deregisterResizeHandler: function deregisterResizeHandler(handler) {
return window.removeEventListener('resize', handler);
},
updateCssVariable: function updateCssVariable(varName, value) {
return instance.root_.style.setProperty(varName, value);
},
computeBoundingRect: function computeBoundingRect() {
return instance.root_.getBoundingClientRect();
},
getWindowPageOffset: function getWindowPageOffset() {
return { x: window.pageXOffset, y: window.pageYOffset };
}
};
}
}]);
return MDCRipple;
}(__WEBPACK_IMPORTED_MODULE_0__material_base_component__["a" /* default */]);
/**
* See Material Design spec for more details on when to use ripples.
* https://material.io/guidelines/motion/choreography.html#choreography-creation
* @record
*/
var RippleCapableSurface = function RippleCapableSurface() {
_classCallCheck(this, RippleCapableSurface);
};
/** @protected {!Element} */
RippleCapableSurface.prototype.root_;
/**
* Whether or not the ripple bleeds out of the bounds of the element.
* @type {boolean|undefined}
*/
RippleCapableSurface.prototype.unbounded;
/**
* Whether or not the ripple is attached to a disabled component.
* @type {boolean|undefined}
*/
RippleCapableSurface.prototype.disabled;
/***/ }),
/* 5 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__material_base_foundation__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__adapter__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constants__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util__ = __webpack_require__(2);
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @typedef {{
* isActivated: (boolean|undefined),
* hasDeactivationUXRun: (boolean|undefined),
* wasActivatedByPointer: (boolean|undefined),
* wasElementMadeActive: (boolean|undefined),
* activationEvent: Event,
* isProgrammatic: (boolean|undefined)
* }}
*/
var ActivationStateType = void 0;
/**
* @typedef {{
* activate: (string|undefined),
* deactivate: (string|undefined),
* focus: (string|undefined),
* blur: (string|undefined)
* }}
*/
var ListenerInfoType = void 0;
/**
* @typedef {{
* activate: function(!Event),
* deactivate: function(!Event),
* focus: function(),
* blur: function()
* }}
*/
var ListenersType = void 0;
/**
* @typedef {{
* x: number,
* y: number
* }}
*/
var PointType = void 0;
// Activation events registered on the root element of each instance for activation
var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown'];
// Deactivation events registered on documentElement when a pointer-related down event occurs
var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup'];
// Tracks activations that have occurred on the current frame, to avoid simultaneous nested activations
/** @type {!Array<!EventTarget>} */
var activatedTargets = [];
/**
* @extends {MDCFoundation<!MDCRippleAdapter>}
*/
var MDCRippleFoundation = function (_MDCFoundation) {
_inherits(MDCRippleFoundation, _MDCFoundation);
_createClass(MDCRippleFoundation, null, [{
key: 'cssClasses',
get: function get() {
return __WEBPACK_IMPORTED_MODULE_2__constants__["a" /* cssClasses */];
}
}, {
key: 'strings',
get: function get() {
return __WEBPACK_IMPORTED_MODULE_2__constants__["c" /* strings */];
}
}, {
key: 'numbers',
get: function get() {
return __WEBPACK_IMPORTED_MODULE_2__constants__["b" /* numbers */];
}
}, {
key: 'defaultAdapter',
get: function get() {
return {
browserSupportsCssVars: function browserSupportsCssVars() /* boolean - cached */{},
isUnbounded: function isUnbounded() /* boolean */{},
isSurfaceActive: function isSurfaceActive() /* boolean */{},
isSurfaceDisabled: function isSurfaceDisabled() /* boolean */{},
addClass: function addClass() /* className: string */{},
removeClass: function removeClass() /* className: string */{},
containsEventTarget: function containsEventTarget() /* target: !EventTarget */{},
registerInteractionHandler: function registerInteractionHandler() /* evtType: string, handler: EventListener */{},
deregisterInteractionHandler: function deregisterInteractionHandler() /* evtType: string, handler: EventListener */{},
registerDocumentInteractionHandler: function registerDocumentInteractionHandler() /* evtType: string, handler: EventListener */{},
deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() /* evtType: string, handler: EventListener */{},
registerResizeHandler: function registerResizeHandler() /* handler: EventListener */{},
deregisterResizeHandler: function deregisterResizeHandler() /* handler: EventListener */{},
updateCssVariable: function updateCssVariable() /* varName: string, value: string */{},
computeBoundingRect: function computeBoundingRect() /* ClientRect */{},
getWindowPageOffset: function getWindowPageOffset() /* {x: number, y: number} */{}
};
}
}]);
function MDCRippleFoundation(adapter) {
_classCallCheck(this, MDCRippleFoundation);
/** @private {number} */
var _this = _possibleConstructorReturn(this, (MDCRippleFoundation.__proto__ || Object.getPrototypeOf(MDCRippleFoundation)).call(this, _extends(MDCRippleFoundation.defaultAdapter, adapter)));
_this.layoutFrame_ = 0;
/** @private {!ClientRect} */
_this.frame_ = /** @type {!ClientRect} */{ width: 0, height: 0 };
/** @private {!ActivationStateType} */
_this.activationState_ = _this.defaultActivationState_();
/** @private {number} */
_this.initialSize_ = 0;
/** @private {number} */
_this.maxRadius_ = 0;
/** @private {function(!Event)} */
_this.activateHandler_ = function (e) {
return _this.activate_(e);
};
/** @private {function(!Event)} */
_this.deactivateHandler_ = function (e) {
return _this.deactivate_(e);
};
/** @private {function(?Event=)} */
_this.focusHandler_ = function () {
return _this.handleFocus();
};
/** @private {function(?Event=)} */
_this.blurHandler_ = function () {
return _this.handleBlur();
};
/** @private {!Function} */
_this.resizeHandler_ = function () {
return _this.layout();
};
/** @private {{left: number, top:number}} */
_this.unboundedCoords_ = {
left: 0,
top: 0
};
/** @private {number} */
_this.fgScale_ = 0;
/** @private {number} */
_this.activationTimer_ = 0;
/** @private {number} */
_this.fgDeactivationRemovalTimer_ = 0;
/** @private {boolean} */
_this.activationAnimationHasEnded_ = false;
/** @private {!Function} */
_this.activationTimerCallback_ = function () {
_this.activationAnimationHasEnded_ = true;
_this.runDeactivationUXLogicIfReady_();
};
/** @private {?Event} */
_this.previousActivationEvent_ = null;
return _this;
}
/**
* We compute this property so that we are not querying information about the client
* until the point in time where the foundation requests it. This prevents scenarios where
* client-side feature-detection may happen too early, such as when components are rendered on the server
* and then initialized at mount time on the client.
* @return {boolean}
* @private
*/
_createClass(MDCRippleFoundation, [{
key: 'supportsPressRipple_',
value: function supportsPressRipple_() {
return this.adapter_.browserSupportsCssVars();
}
/**
* @return {!ActivationStateType}
*/
}, {
key: 'defaultActivationState_',
value: function defaultActivationState_() {
return {
isActivated: false,
hasDeactivationUXRun: false,
wasActivatedByPointer: false,
wasElementMadeActive: false,
activationEvent: null,
isProgrammatic: false
};
}
/** @override */
}, {
key: 'init',
value: function init() {
var _this2 = this;
var supportsPressRipple = this.supportsPressRipple_();
this.registerRootHandlers_(supportsPressRipple);
if (supportsPressRipple) {
var _MDCRippleFoundation$ = MDCRippleFoundation.cssClasses,
ROOT = _MDCRippleFoundation$.ROOT,
UNBOUNDED = _MDCRippleFoundation$.UNBOUNDED;
requestAnimationFrame(function () {
_this2.adapter_.addClass(ROOT);
if (_this2.adapter_.isUnbounded()) {
_this2.adapter_.addClass(UNBOUNDED);
// Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple
_this2.layoutInternal_();
}
});
}
}
/** @override */
}, {
key: 'destroy',
value: function destroy() {
var _this3 = this;
if (this.supportsPressRipple_()) {
if (this.activationTimer_) {
clearTimeout(this.activationTimer_);
this.activationTimer_ = 0;
var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
this.adapter_.removeClass(FG_ACTIVATION);
}
var _MDCRippleFoundation$2 = MDCRippleFoundation.cssClasses,
ROOT = _MDCRippleFoundation$2.ROOT,
UNBOUNDED = _MDCRippleFoundation$2.UNBOUNDED;
requestAnimationFrame(function () {
_this3.adapter_.removeClass(ROOT);
_this3.adapter_.removeClass(UNBOUNDED);
_this3.removeCssVars_();
});
}
this.deregisterRootHandlers_();
this.deregisterDeactivationHandlers_();
}
/**
* @param {boolean} supportsPressRipple Passed from init to save a redundant function call
* @private
*/
}, {
key: 'registerRootHandlers_',
value: function registerRootHandlers_(supportsPressRipple) {
var _this4 = this;
if (supportsPressRipple) {
ACTIVATION_EVENT_TYPES.forEach(function (type) {
_this4.adapter_.registerInteractionHandler(type, _this4.activateHandler_);
});
if (this.adapter_.isUnbounded()) {
this.adapter_.registerResizeHandler(this.resizeHandler_);
}
}
this.adapter_.registerInteractionHandler('focus', this.focusHandler_);
this.adapter_.registerInteractionHandler('blur', this.blurHandler_);
}
/**
* @param {!Event} e
* @private
*/
}, {
key: 'registerDeactivationHandlers_',
value: function registerDeactivationHandlers_(e) {
var _this5 = this;
if (e.type === 'keydown') {
this.adapter_.registerInteractionHandler('keyup', this.deactivateHandler_);
} else {
POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (type) {
_this5.adapter_.registerDocumentInteractionHandler(type, _this5.deactivateHandler_);
});
}
}
/** @private */
}, {
key: 'deregisterRootHandlers_',
value: function deregisterRootHandlers_() {
var _this6 = this;
ACTIVATION_EVENT_TYPES.forEach(function (type) {
_this6.adapter_.deregisterInteractionHandler(type, _this6.activateHandler_);
});
this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_);
this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_);
if (this.adapter_.isUnbounded()) {
this.adapter_.deregisterResizeHandler(this.resizeHandler_);
}
}
/** @private */
}, {
key: 'deregisterDeactivationHandlers_',
value: function deregisterDeactivationHandlers_() {
var _this7 = this;
this.adapter_.deregisterInteractionHandler('keyup', this.deactivateHandler_);
POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (type) {
_this7.adapter_.deregisterDocumentInteractionHandler(type, _this7.deactivateHandler_);
});
}
/** @private */
}, {
key: 'removeCssVars_',
value: function removeCssVars_() {
var _this8 = this;
var strings = MDCRippleFoundation.strings;
Object.keys(strings).forEach(function (k) {
if (k.indexOf('VAR_') === 0) {
_this8.adapter_.updateCssVariable(strings[k], null);
}
});
}
/**
* @param {?Event} e
* @private
*/
}, {
key: 'activate_',
value: function activate_(e) {
var _this9 = this;
if (this.adapter_.isSurfaceDisabled()) {
return;
}
var activationState = this.activationState_;
if (activationState.isActivated) {
return;
}
// Avoid reacting to follow-on events fired by touch device after an already-processed user interaction
var previousActivationEvent = this.previousActivationEvent_;
var isSameInteraction = previousActivationEvent && e && previousActivationEvent.type !== e.type;
if (isSameInteraction) {
return;
}
activationState.isActivated = true;
activationState.isProgrammatic = e === null;
activationState.activationEvent = e;
activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : e.type === 'mousedown' || e.type === 'touchstart' || e.type === 'pointerdown';
var hasActivatedChild = e && activatedTargets.length > 0 && activatedTargets.some(function (target) {
return _this9.adapter_.containsEventTarget(target);
});
if (hasActivatedChild) {
// Immediately reset activation state, while preserving logic that prevents touch follow-on events
this.resetActivationState_();
return;
}
if (e) {
activatedTargets.push( /** @type {!EventTarget} */e.target);
this.registerDeactivationHandlers_(e);
}
activationState.wasElementMadeActive = this.checkElementMadeActive_(e);
if (activationState.wasElementMadeActive) {
this.animateActivation_();
}
requestAnimationFrame(function () {
// Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples
activatedTargets = [];
if (!activationState.wasElementMadeActive && (e.key === ' ' || e.keyCode === 32)) {
// If space was pressed, try again within an rAF call to detect :active, because different UAs report
// active states inconsistently when they're called within event handling code:
// - https://bugs.chromium.org/p/chromium/issues/detail?id=635971
// - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741
// We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS
// variable is set within a rAF callback for a submit button interaction (#2241).
activationState.wasElementMadeActive = _this9.checkElementMadeActive_(e);
if (activationState.wasElementMadeActive) {
_this9.animateActivation_();
}
}
if (!activationState.wasElementMadeActive) {
// Reset activation state immediately if element was not made active.
_this9.activationState_ = _this9.defaultActivationState_();
}
});
}
/**
* @param {?Event} e
* @private
*/
}, {
key: 'checkElementMadeActive_',
value: function checkElementMadeActive_(e) {
return e && e.type === 'keydown' ? this.adapter_.isSurfaceActive() : true;
}
/**
* @param {?Event=} event Optional event containing position information.
*/
}, {
key: 'activate',
value: function activate() {
var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
this.activate_(event);
}
/** @private */
}, {
key: 'animateActivation_',
value: function animateActivation_() {
var _this10 = this;
var _MDCRippleFoundation$3 = MDCRippleFoundation.strings,
VAR_FG_TRANSLATE_START = _MDCRippleFoundation$3.VAR_FG_TRANSLATE_START,
VAR_FG_TRANSLATE_END = _MDCRippleFoundation$3.VAR_FG_TRANSLATE_END;
var _MDCRippleFoundation$4 = MDCRippleFoundation.cssClasses,
FG_DEACTIVATION = _MDCRippleFoundation$4.FG_DEACTIVATION,
FG_ACTIVATION = _MDCRippleFoundation$4.FG_ACTIVATION;
var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
this.layoutInternal_();
var translateStart = '';
var translateEnd = '';
if (!this.adapter_.isUnbounded()) {
var _getFgTranslationCoor = this.getFgTranslationCoordinates_(),
startPoint = _getFgTranslationCoor.startPoint,
endPoint = _getFgTranslationCoor.endPoint;
translateStart = startPoint.x + 'px, ' + startPoint.y + 'px';
translateEnd = endPoint.x + 'px, ' + endPoint.y + 'px';
}
this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
// Cancel any ongoing activation/deactivation animations
clearTimeout(this.activationTimer_);
clearTimeout(this.fgDeactivationRemovalTimer_);
this.rmBoundedActivationClasses_();
this.adapter_.removeClass(FG_DEACTIVATION);
// Force layout in order to re-trigger the animation.
this.adapter_.computeBoundingRect();
this.adapter_.addClass(FG_ACTIVATION);
this.activationTimer_ = setTimeout(function () {
return _this10.activationTimerCallback_();
}, DEACTIVATION_TIMEOUT_MS);
}
/**
* @private
* @return {{startPoint: PointType, endPoint: PointType}}
*/
}, {
key: 'getFgTranslationCoordinates_',
value: function getFgTranslationCoordinates_() {
var _activationState_ = this.activationState_,
activationEvent = _activationState_.activationEvent,
wasActivatedByPointer = _activationState_.wasActivatedByPointer;
var startPoint = void 0;
if (wasActivatedByPointer) {
startPoint = Object(__WEBPACK_IMPORTED_MODULE_3__util__["getNormalizedEventCoords"])(
/** @type {!Event} */activationEvent, this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect());
} else {
startPoint = {
x: this.frame_.width / 2,
y: this.frame_.height / 2
};
}
// Center the element around the start point.
startPoint = {
x: startPoint.x - this.initialSize_ / 2,
y: startPoint.y - this.initialSize_ / 2
};
var endPoint = {
x: this.frame_.width / 2 - this.initialSize_ / 2,
y: this.frame_.height / 2 - this.initialSize_ / 2
};
return { startPoint: startPoint, endPoint: endPoint };
}
/** @private */
}, {
key: 'runDeactivationUXLogicIfReady_',
value: function runDeactivationUXLogicIfReady_() {
var _this11 = this;
// This method is called both when a pointing device is released, and when the activation animation ends.
// The deactivation animation should only run after both of those occur.
var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
var _activationState_2 = this.activationState_,
hasDeactivationUXRun = _activationState_2.hasDeactivationUXRun,
isActivated = _activationState_2.isActivated;
var activationHasEnded = hasDeactivationUXRun || !isActivated;
if (activationHasEnded && this.activationAnimationHasEnded_) {
this.rmBoundedActivationClasses_();
this.adapter_.addClass(FG_DEACTIVATION);
this.fgDeactivationRemovalTimer_ = setTimeout(function () {
_this11.adapter_.removeClass(FG_DEACTIVATION);
}, __WEBPACK_IMPORTED_MODULE_2__constants__["b" /* numbers */].FG_DEACTIVATION_MS);
}
}
/** @private */
}, {
key: 'rmBoundedActivationClasses_',
value: function rmBoundedActivationClasses_() {
var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
this.adapter_.removeClass(FG_ACTIVATION);
this.activationAnimationHasEnded_ = false;
this.adapter_.computeBoundingRect();
}
}, {
key: 'resetActivationState_',
value: function resetActivationState_() {
var _this12 = this;
this.previousActivationEvent_ = this.activationState_.activationEvent;
this.activationState_ = this.defaultActivationState_();
// Touch devices may fire additional events for the same interaction within a short time.
// Store the previous event until it's safe to assume that subsequent events are for new interactions.
setTimeout(function () {
return _this12.previousActivationEvent_ = null;
}, MDCRippleFoundation.numbers.TAP_DELAY_MS);
}
/**
* @param {?Event} e
* @private
*/
}, {
key: 'deactivate_',
value: function deactivate_(e) {
var _this13 = this;
var activationState = this.activationState_;
// This can happen in scenarios such as when you have a keyup event that blurs the element.
if (!activationState.isActivated) {
return;
}
var state = /** @type {!ActivationStateType} */_extends({}, activationState);
if (activationState.isProgrammatic) {
var evtObject = null;
requestAnimationFrame(function () {
return _this13.animateDeactivation_(evtObject, state);
});
this.resetActivationState_();
} else {
this.deregisterDeactivationHandlers_();
requestAnimationFrame(function () {
_this13.activationState_.hasDeactivationUXRun = true;
_this13.animateDeactivation_(e, state);
_this13.resetActivationState_();
});
}
}
/**
* @param {?Event=} event Optional event containing position information.
*/
}, {
key: 'deactivate',
value: function deactivate() {
var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
this.deactivate_(event);
}
/**
* @param {Event} e
* @param {!ActivationStateType} options
* @private
*/
}, {
key: 'animateDeactivation_',
value: function animateDeactivation_(e, _ref) {
var wasActivatedByPointer = _ref.wasActivatedByPointer,
wasElementMadeActive = _ref.wasElementMadeActive;
if (wasActivatedByPointer || wasElementMadeActive) {
this.runDeactivationUXLogicIfReady_();
}
}
}, {
key: 'layout',
value: function layout() {
var _this14 = this;
if (this.layoutFrame_) {
cancelAnimationFrame(this.layoutFrame_);
}
this.layoutFrame_ = requestAnimationFrame(function () {
_this14.layoutInternal_();
_this14.layoutFrame_ = 0;
});
}
/** @private */
}, {
key: 'layoutInternal_',
value: function layoutInternal_() {
var _this15 = this;
this.frame_ = this.adapter_.computeBoundingRect();
var maxDim = Math.max(this.frame_.height, this.frame_.width);
// Surface diameter is treated differently for unbounded vs. bounded ripples.
// Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately
// to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically
// square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter
// (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via
// `overflow: hidden`.
var getBoundedRadius = function getBoundedRadius() {
var hypotenuse = Math.sqrt(Math.pow(_this15.frame_.width, 2) + Math.pow(_this15.frame_.height, 2));
return hypotenuse + MDCRippleFoundation.numbers.PADDING;
};
this.maxRadius_ = this.adapter_.isUnbounded() ? maxDim : getBoundedRadius();
// Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform
this.initialSize_ = maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE;
this.fgScale_ = this.maxRadius_ / this.initialSize_;
this.updateLayoutCssVars_();
}
/** @private */
}, {
key: 'updateLayoutCssVars_',
value: function updateLayoutCssVars_() {
var _MDCRippleFoundation$5 = MDCRippleFoundation.strings,
VAR_FG_SIZE = _MDCRippleFoundation$5.VAR_FG_SIZE,
VAR_LEFT = _MDCRippleFoundation$5.VAR_LEFT,
VAR_TOP = _MDCRippleFoundation$5.VAR_TOP,
VAR_FG_SCALE = _MDCRippleFoundation$5.VAR_FG_SCALE;
this.adapter_.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + 'px');
this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_);
if (this.adapter_.isUnbounded()) {
this.unboundedCoords_ = {
left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2),
top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2)
};
this.adapter_.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + 'px');
this.adapter_.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + 'px');
}
}
/** @param {boolean} unbounded */
}, {
key: 'setUnbounded',
value: function setUnbounded(unbounded) {
var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
if (unbounded) {
this.adapter_.addClass(UNBOUNDED);
} else {
this.adapter_.removeClass(UNBOUNDED);
}
}
}, {
key: 'handleFocus',
value: function handleFocus() {
var _this16 = this;
requestAnimationFrame(function () {
return _this16.adapter_.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
});
}
}, {
key: 'handleBlur',
value: function handleBlur() {
var _this17 = this;
requestAnimationFrame(function () {
return _this17.adapter_.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
});
}
}]);
return MDCRippleFoundation;
}(__WEBPACK_IMPORTED_MODULE_0__material_base_foundation__["a" /* default */]);
/* harmony default export */ __webpack_exports__["a"] = (MDCRippleFoundation);
/***/ }),
/* 6 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return cssClasses; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return strings; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return numbers; });
/**
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var cssClasses = {
// Ripple is a special case where the "root" component is really a "mixin" of sorts,
// given that it's an 'upgrade' to an existing component. That being said it is the root
// CSS class that all other CSS classes derive from.
ROOT: 'mdc-ripple-upgraded',
UNBOUNDED: 'mdc-ripple-upgraded--unbounded',
BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation'
};
var strings = {
VAR_LEFT: '--mdc-ripple-left',
VAR_TOP: '--mdc-ripple-top',
VAR_FG_SIZE: '--mdc-ripple-fg-size',
VAR_FG_SCALE: '--mdc-ripple-fg-scale',
VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end'
};
var numbers = {
PADDING: 10,
INITIAL_ORIGIN_SCALE: 0.6,
DEACTIVATION_TIMEOUT_MS: 225, // Corresponds to $mdc-ripple-translate-duration (i.e. activation animation duration)
FG_DEACTIVATION_MS: 150, // Corresponds to $mdc-ripple-fade-out-duration (i.e. deactivation animation duration)
TAP_DELAY_MS: 300 };
/***/ })
/******/ ]);
});
//# sourceMappingURL=mdc.ripple.js.map
|
'use strict'
/**
* Enumeration of module instrumentation types.
*
* @private
* @readonly
* @enum {string}
*/
var MODULE_TYPE = {
/** Utility/generic module, such as pooling libraries. */
GENERIC: 'generic',
/** Database module, such as the MongoDB or MySQL drivers. */
DATASTORE: 'datastore',
/** Messaging module, such as AMQP */
MESSAGE: 'message',
/** Web server framework module, such as Express or Restify. */
WEB_FRAMEWORK: 'web-framework'
}
exports.MODULE_TYPE = MODULE_TYPE
|
import Path from 'path';
import StringHelper from '../utils/string-helper';
import ExtensionConfig from './extension-config';
import timeSequence from '../utils/time-sequence';
import SearchScore from '../utils/search-score';
import PinYin from '../utils/pinyin';
import Store from '../utils/store';
export const TYPES = {
app: 'app',
theme: 'theme',
plugin: 'plugin',
};
const MATCH_SCORE_MAP = [
{name: 'name', equal: 100, include: 50},
{name: 'displayName', equal: 100, include: 50},
{name: 'pinyinNames', equal: 50, include: 25, array: true},
{name: 'description', include: 25},
{name: 'keywords', equal: 50, include: 10, array: true},
{name: 'type', equal: 100, prefix: '#'},
{name: 'author', equal: 100, prefix: '@'},
{name: 'publisher', equal: 100, prefix: '@'},
{name: 'homepage', include: 25},
];
export default class Extension {
static TYPES = TYPES;
constructor(pkgData, data) {
this.initPkg(pkgData);
this._config = new ExtensionConfig(this.name, this.configurations);
this._data = Object.assign({}, data);
}
initPkg(pkgData) {
const pkg = Object.assign({}, pkgData, pkgData.xext);
if (pkg.xext) {
delete pkg.xext;
}
this._type = TYPES[pkg.type];
if (!this._type) {
this._type = TYPES.plugin;
this.addError('type', `Unknown extension type (${pkg.type}), set to ‘${this._type}’ temporarily.`);
}
this._name = pkg.name;
if (StringHelper.isEmpty(pkg.name) || !(/[A-Za-z0-9_-]+/.test(pkg.name))) {
this._safeName = `extension-${timeSequence()}`;
this.addError('name', `Extension name(${pkg.name}) is not valid, use random name '${this._safeName}'.`);
}
if (StringHelper.isEmpty(pkg.version)) {
this.addError('version', 'Extension version not set.');
}
this._pkg = pkg;
}
addError(name, error) {
if (!error) {
error = name;
name = '_';
}
if (!this._errors) {
this._errors = [];
}
if (DEBUG) {
console.color(`Extension.${this.name}`, 'greenBg', name, 'greenPale', error, 'red');
}
this._errors.push({name, error});
}
get errors() {
return this._errors;
}
get hasError() {
return this._errors && this._errors.length;
}
get pinyinNames() {
if (!this._pinyinName) {
this._pinyinName = PinYin(this.displayName, 'default', false);
}
return this._pinyinName;
}
get config() {
return this._config;
}
get displayName() {
return StringHelper.ifEmptyThen(this._pkg.displayName, this._name);
}
get type() {
return this._type;
}
get name() {
return this._safeName || this._name;
}
get isTheme() {
return this._type === TYPES.theme;
}
get isPlugin() {
return this._type === TYPES.plugin;
}
get isApp() {
return this._type === TYPES.app;
}
get buildIn() {
return this._pkg.buildIn;
}
get configurations() {
return this._pkg.configurations || [];
}
get pkg() {return this._pkg;}
get description() {return this._pkg.description;}
get version() {return this._pkg.version;}
get author() {return this._pkg.author;}
get publisher() {return this._pkg.publisher;}
get license() {return this._pkg.license;}
get homepage() {return this._pkg.homepage;}
get keywords() {return this._pkg.keywords;}
get engines() {return this._pkg.engines;}
get repository() {return this._pkg.repository;}
get bugs() {return this._pkg.bugs;}
get hot() {return !!this._pkg.hot;}
get entryUrl() {return this._pkg.entryUrl;}
get entryID() {return this._pkg.entryID;}
getEntryUrl(referer = '') {
if (global.ExtsRuntime) {
const {getEntryVisitUrl} = global.ExtsRuntime;
if (getEntryVisitUrl) {
return getEntryVisitUrl(this, referer);
}
}
return Promise.resolve(this.entryUrl);
}
get hasServerEntry() {
return this.entryID || this._pkg.entry;
}
get download() {return this._pkg.download;}
get isRemote() {return this._data.remote;}
get isRemoteLoaded() {return this._data.remoteLoaded;}
get md5() {return this._pkg.md5;}
get user() {return this._data.user;}
get remoteCachePath() {return this._data.remoteCachePath;}
get loadRemoteFailed() {return this._data.loadRemoteFailed;}
get downloadProgress() {
if (this.isRemoteLoaded) {
return 1;
}
if (!this._data.downloadProgress) {
return 0;
}
return this._data.downloadProgress;
}
set downloadProgress(progress) {
this._data.downloadProgress = progress;
}
setLoadRemoteResult(result, error) {
this._data.loadRemoteFailed = !result;
this._data.remoteLoaded = !!result;
if (error) {
this.addError(error);
}
}
get accentColor() {
return this._pkg.accentColor || '#f50057';
}
get mainFile() {
if (!this._mainFile) {
const {buildIn} = this;
if (buildIn && buildIn.module) {
this._mainFile = 'BUILD-IN';
} else if (this.pkg.main) {
this._mainFile = Path.join(this.localPath, this.pkg.main);
}
}
return this._mainFile;
}
get icon() {
const {icon} = this._pkg;
if (icon && !this._icon) {
if (icon.length > 1 && !icon.startsWith('http://') && !icon.startsWith('https://') && !icon.startsWith('mdi-') && !icon.startsWith('icon')) {
this._icon = Path.join(this.localPath, icon);
} else {
this._icon = icon;
}
}
return this._icon || 'mdi-cube';
}
get authorName() {
const {author} = this;
return author && (author.name || author);
}
get storeData() {
return {
data: this._data,
pkg: this._pkg
};
}
get data() {
return this._data;
}
get installTime() {
return this._data.installTime;
}
set installTime(time) {
this._data.installTime = time;
this.updateTime = time;
}
get disabled() {
return this._data.disabled === true;
}
set disabled(disabled) {
if (this._data.disabled !== disabled && !this.hot) {
this._needRestart = true;
}
this._data.disabled = disabled;
}
get avaliable() {
return !this.disabled && !this.needRestart && (!this.isRemote || this.isRemoteLoaded);
}
get updateTime() {
return this._data.updateTime;
}
set updateTime(time) {
this._data.updateTime = time;
}
get localPath() {
return this._data.localPath;
}
set localPath(localPath) {
this._data.localPath = localPath;
}
get isDev() {
return this._data.isDev;
}
set isDev(flag) {
this._data.isDev = flag;
}
get hasModule() {
return this.mainFile;
}
getConfig(key) {
if (!this._config) {
this._config = Store.get(`EXTENSION::${this.id}::config`, {});
}
return key === undefined ? this._config : this._config[key];
}
setConfig(key, value) {
const config = this.getConfig();
if (typeof key === 'object') {
Object.assign(config, key);
} else {
config[key] = value;
}
this._config = config;
Store.set(`EXTENSION::${this.id}::config`, this._config);
}
getUserConfig(key, defualtValue) {
if (Extension.user) {
return Extension.user.config.getForExtension(this.name, key, defualtValue);
} else if (DEBUG) {
console.warn('Cannot set user config for the exteions, because current user is not logined.', this);
}
}
setUserConfig(key, value) {
if (Extension.user) {
return Extension.user.config.setForExtension(this.name, key, value);
} else if (DEBUG) {
console.warn('Cannot set user config for the exteions, because current user is not logined.', this);
}
}
/**
* 重新载入扩展
*/
loadModule() {
if (this.disabled) {
if (DEBUG) {
console.warn('The extension has been disbaled.', this);
}
return null;
}
const {mainFile} = this;
if (mainFile) {
const start = new Date().getTime();
if (mainFile === 'BUILD-IN') {
this._module = this.buildIn.module;
} else {
try {
this._module = __non_webpack_require__(this.mainFile); // eslint-disable-line
} catch (err) {
if (DEBUG) {
console.collapse('Extension Attach', 'greenBg', this.name, 'redPale', 'load module error', 'red');
console.error('error', err);
console.log('extension', this);
console.groupEnd();
}
this._module = {};
}
}
if (this._module) {
this.callModuleMethod('onAttach', this);
}
this._loadTime = new Date().getTime() - start;
this._loaded = true;
if (DEBUG) {
console.collapse('Extension Attach', 'greenBg', this.name, 'greenPale', `spend time: ${this._loadTime}ms`, 'orange');
console.trace('extension', this);
console.log('module', this._module);
console.groupEnd();
}
}
return this._module;
}
get isModuleLoaded() {
return this._loaded;
}
get needRestart() {
return this._needRestart || (!this.disabled && this.hasModule && !this._loaded && !this.hot);
}
attach() {
if (!this.disabled && !this._loaded && this.hasModule) {
this.loadModule();
return true;
}
}
hotAttach() {
if (this.hot && this.attach()) {
this.callModuleMethod('onReady', this);
return true;
}
return false;
}
detach() {
if (this._module && this._loaded) {
this.callModuleMethod('onDetach', this);
}
const {mainFile} = this;
if (mainFile && mainFile !== 'BUILD-IN' && __non_webpack_require__.cache) {
delete __non_webpack_require__.cache[mainFile]; // eslint-disable-line
}
this._module = null;
this._loaded = false;
if (DEBUG) {
console.collapse('Extension Detach', 'greenBg', this.name, 'greenPale');
console.trace('extension', this);
console.groupEnd();
}
}
get hasReplaceViews() {
if (this.disabled) {
if (DEBUG) {
console.warn('The extension has been disbaled.', this);
}
return false;
}
const extModule = this.module;
return extModule && extModule.replaceViews;
}
get replaceViews() {
if (this.disabled) {
if (DEBUG) {
console.warn('The extension has been disbaled.', this);
}
return null;
}
const extModule = this.module;
return extModule && extModule.replaceViews;
}
/**
* 获取上次加载此扩展所花费的时间,单位为毫秒
*/
get loadTime() {
return this._loadTime;
}
get module() {
if (this.disabled) {
if (DEBUG) {
console.warn('The extension has been disbaled.', this);
}
return false;
}
return this._module || this.loadModule();
}
callModuleMethod(methodName, ...params) {
if (this.disabled) {
if (DEBUG) {
console.warn('The extension has been disbaled.', this);
}
return false;
}
const extModule = this._module;
if (extModule && extModule[methodName]) {
try {
return extModule[methodName].apply(this, params);
} catch (err) {
if (DEBUG) {
console.collapse('Extension Attach', 'greenBg', this.name, 'redPale', `call module method '${methodName}' error`, 'red');
console.log('methodName', methodName);
console.log('params', params);
console.log('error', err);
console.log('extension', this);
console.groupEnd();
}
}
}
}
get commands() {
if (this.disabled) {
if (DEBUG) {
console.warn('The extension has been disbaled.', this);
}
return null;
}
const extModule = this.module;
return extModule && extModule.commands;
}
getCommand(commandName) {
const {commands} = this;
let command = commands && commands[commandName];
if (command) {
if (typeof command === 'function') {
command = {func: command, name: commandName};
}
}
command.name = `extension/${commandName}`;
return command;
}
getUrlInspector(url, type = 'inspect') {
if (this.disabled) {
if (DEBUG) {
console.warn('The extension has been disbaled.', this);
}
return null;
}
const extModule = this.module;
let urlInspectors = extModule && extModule.urlInspectors;
if (urlInspectors) {
const urlObj = new URL(url);
if (!Array.isArray(urlInspectors)) {
urlInspectors = [urlInspectors];
}
const urlInspector = urlInspectors.find(x => {
if (!x[type]) {
return false;
}
if (typeof x.test === 'function') {
return x.test(url, urlObj);
}
if (Array.isArray(x.test)) {
x.test = new Set(x.test);
} else if (typeof x.test === 'string') {
x.test = new RegExp(x.test, 'i');
}
if (x.test instanceof Set) {
return x.test.has(urlObj.host);
}
return x.test.test(url);
});
if (urlInspector && !urlInspector.provider) {
urlInspector.provider = {
icon: this.icon,
name: this.name,
label: this.displayName,
url: `!showExtensionDialog/${this.name}`
};
}
return urlInspector;
}
return null;
}
getUrlOpener(url) {
return this.getUrlInspector(url, 'open');
}
formatContextMenuItem(menuItem, urlFormatObject) {
urlFormatObject = Object.assign({}, urlFormatObject, {EXTENSION: `extension/${this.name}`});
menuItem = Object.assign({}, menuItem);
if (menuItem.url) {
menuItem.url = StringHelper.format(menuItem.url, urlFormatObject);
}
menuItem.label = `${this.displayName}: ${menuItem.label || menuItem.url}`;
if (!menuItem.icon) {
menuItem.icon = this.icon;
}
return menuItem;
}
getContextMenuCreators() {
const creators = this._pkg.contextMenuCreators || [];
const extModule = this.module;
if (extModule && extModule.contextMenuCreators) {
creators.push(...extModule.contextMenuCreators);
}
return creators;
}
getMatchScore(keys) {
return SearchScore.matchScore(MATCH_SCORE_MAP, this, keys);
}
}
|
class IpLoadBalancerTaskPreviewCtrl {
constructor ($uibModalInstance, task) {
this.$uibModalInstance = $uibModalInstance;
this.task = task;
}
dismiss () {
this.$uibModalInstance.dismiss();
}
}
angular.module("managerApp").controller("IpLoadBalancerTaskPreviewCtrl", IpLoadBalancerTaskPreviewCtrl);
|
//>>built
define("gridx/tests/support/data/TestData",[],function(){
var _1=9973;
var _2=function(_3){
var a=8887;
var c=9643;
var m=8677;
_1=(a*_1+c)%m;
var _4=Math.floor(_1/m*_3);
return _4;
};
var _5="0,1,2,3, ,4,5,6,7, ,8,9,a,b, ,c,d,e,f, ,g,h,i,j, ,k,l,m,n, ,k,o,p,q, ,r,s,t,u, ,v,w,x,y, ,z".split(",");
var _6=function(){
var _7=_2(50),i,_8=[];
for(i=0;i<_7;++i){
_8.push(_5[_2(_5.length)]);
}
return _8.join("");
};
var _9=function(){
return new Date(_2(10000000000000));
};
var _a=function(_b){
return {id:_b+1,number:_2(100),string:_6(),date:_9().toDateString(),time:_9().toTimeString().split(" ")[0],bool:_2(10)<5,order:_b+1};
};
return {resetSeed:function(){
_1=9973;
},getData:function(_c){
_c=_c===undefined?100:_c;
var _d={identifier:"id",label:"id",items:[]};
for(var i=0;i<_c;++i){
_d.items.push(_a(i));
}
return _d;
},layouts:[[{id:"id",field:"id",name:"Identity"},{id:"number",field:"number",name:"Number"}],[{id:"id",field:"id",name:"Identity"},{id:"number",field:"number",name:"Number"},{id:"string",field:"string",name:"String"}],[{field:"id",name:"Identity",width:"20px"},{field:"number",name:"Number",width:"10em"},{field:"string",name:"String",width:"200px"},{field:"date",name:"Date",width:"10%"},{field:"time",name:"Time",width:"20%"},{field:"bool",name:"Boolean",width:"30%"}],[{id:"id",field:"id",name:"Identity",dataType:"number"},{id:"number",field:"number",name:"Number",dataType:"number"},{id:"string",field:"string",name:"String",dataType:"string"},{id:"date",field:"date",name:"Date",dataType:"date"},{id:"time",field:"time",name:"Time",dataType:"time"},{id:"bool",field:"bool",name:"Boolean",dataType:"boolean"}],[{id:"number",field:"number",name:"Number"},{id:"string",field:"string",name:"String"},{id:"date",field:"date",name:"Date"},{id:"time",field:"time",name:"Time"},{id:"bool",field:"bool",name:"Boolean"}],[{id:"id",field:"id",name:"Identity",width:"200px"},{id:"number",field:"number",name:"Number",width:"200px"},{id:"string",field:"string",name:"String",width:"200px"},{id:"date",field:"date",name:"Date",width:"200px"}],[{id:"id",field:"id",name:"Identity",dataType:"number"},{id:"number",field:"number",name:"Number",dataType:"number"},{id:"date",field:"date",name:"Date",dataType:"date"},{id:"time",field:"time",name:"Time",dataType:"time"},{id:"bool",field:"bool",name:"Boolean",dataType:"boolean"}]]};
});
|
/**
* @author mrdoob / http://mrdoob.com/
* @author alteredq / http://alteredqualia.com/
*
* parameters = {
* color: <hex>,
* emissive: <hex>,
* opacity: <float>,
*
* map: new THREE.Texture( <Image> ),
*
* specularMap: new THREE.Texture( <Image> ),
*
* alphaMap: new THREE.Texture( <Image> ),
*
* envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
* combine: THREE.Multiply,
* reflectivity: <float>,
* refractionRatio: <float>,
*
* blending: THREE.NormalBlending,
* depthTest: <bool>,
* depthWrite: <bool>,
*
* wireframe: <boolean>,
* wireframeLinewidth: <float>,
*
* vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors,
*
* skinning: <bool>,
* morphTargets: <bool>,
* morphNormals: <bool>,
*
* fog: <bool>
* }
*/
THREE.MeshLambertMaterial = function ( parameters ) {
THREE.Material.call( this );
this.type = 'MeshLambertMaterial';
this.color = new THREE.Color( 0xffffff ); // diffuse
this.emissive = new THREE.Color( 0x000000 );
this.map = null;
this.specularMap = null;
this.alphaMap = null;
this.envMap = null;
this.combine = THREE.MultiplyOperation;
this.reflectivity = 1;
this.refractionRatio = 0.98;
this.fog = true;
this.wireframe = false;
this.wireframeLinewidth = 1;
this.wireframeLinecap = 'round';
this.wireframeLinejoin = 'round';
this.vertexColors = THREE.NoColors;
this.skinning = false;
this.morphTargets = false;
this.morphNormals = false;
this.setValues( parameters );
};
THREE.MeshLambertMaterial.prototype = Object.create( THREE.Material.prototype );
THREE.MeshLambertMaterial.prototype.constructor = THREE.MeshLambertMaterial;
THREE.MeshLambertMaterial.prototype.copy = function ( source ) {
THREE.Material.prototype.copy.call( this, source );
this.color.copy( source.color );
this.emissive.copy( source.emissive );
this.map = source.map;
this.specularMap = source.specularMap;
this.alphaMap = source.alphaMap;
this.envMap = source.envMap;
this.combine = source.combine;
this.reflectivity = source.reflectivity;
this.refractionRatio = source.refractionRatio;
this.fog = source.fog;
this.wireframe = source.wireframe;
this.wireframeLinewidth = source.wireframeLinewidth;
this.wireframeLinecap = source.wireframeLinecap;
this.wireframeLinejoin = source.wireframeLinejoin;
this.vertexColors = source.vertexColors;
this.skinning = source.skinning;
this.morphTargets = source.morphTargets;
this.morphNormals = source.morphNormals;
return this;
};
|
const express = require('express');
const connectDB = require('./config/db');
const app = express();
// Connect Database
connectDB();
app.get('/',(req,res) => res.send('API Running'));
// Init Middleware
app.use(express.json({extended: false}));
// Define Routes
app.use('/api/users',require('./routes/api/users'));
app.use('/api/auth',require('./routes/api/auth'));
app.use('/api/profile',require('./routes/api/profile'));
app.use('/api/posts',require('./routes/api/posts'));
const PORT = process.env.PORT || 5000;
app.listen(PORT, () => console.log(`Server started on port ${PORT}`));
|
// Copyright (c) TotalSoft.
// This source code is licensed under the MIT license.
const { messagingHost } = require('./messagingHost')
const {
correlation,
dispatcher,
exceptionHandling,
} = require('./middleware')
const { SubscriptionOptions } = require('@totalsoft/message-bus')
module.exports = {
messagingHost,
correlation,
dispatcher,
exceptionHandling,
SubscriptionOptions,
}
|
const X=1<<0;
const Y=1<<1;
const LOCATIONS=[
{
name:['Vaniville Town','Bourg Croquis','Escissia','Borgo Bozzetto','Pueblo Boceto'],encounters:[
[650,,'trade'],
[653,,'trade'],
[656,,'trade']
]
},{
name:['Aquacorde Town','Quarellis','Aquarellia','Rio Acquerello','Pueblo Acuarela'],encounters:[
[650,,'starter'],
[653,,'starter'],
[656,,'starter']
]
},{
name:['Route 2',,,'Percorso 2','Ruta 2'],encounters:[
[10,Y,'grass',11],
[13,X,'grass',11],
[16,,'grass',14],
[263,,'grass',15],
[661,,'grass',20],
[659,,'grass',20],
[664,,'grass',20]
]
},{
name:['Santalune Forest','Forêt de Neuvartault','Nouvaria-Wald','Bosco Novartopoli','Bosque de Novarte'],encounters:[
[10,Y,'grass',20],
[10,X,'grass',10],
[11,Y,'grass',4],
[13,X,'grass',20],
[13,Y,'grass',10],
[14,X,'grass',4],
[25,,'grass',6],
[511,,'grass',10],
[513,,'grass',10],
[515,,'grass',10],
[661,,'grass',10],
[664,,'grass',20]
]
},{
name:['Route 3',,,'Percorso 3','Ruta 3'],encounters:[
[16,,'grass',10],
[25,,'grass',5],
[206,,'grass',5],
[298,,'grass',10],
[399,,'grass',20],
[412,,'grass',10],
[659,,'grass',20],
[661,,'grass',20],
[183,,'surf',34],
[284,,'surf',66],
[129,,'fish_old',100],
[118,,'fish_good',65],
[341,,'fish_good',35],
[119,,'fish_super',35],
[130,,'fish_super',60],
[342,,'fish_super',5]
]
},{
name:['Santalune City','Neuvartault','Nouvaria City','Novartopoli','Ciudad Novarte'],encounters:[
[83,,['trade',659]]
]
},{
name:['Route 4',,,'Percorso 4','Ruta 4'],encounters:[
[165,,'flowers_yellow',10],
[280,,'flowers_yellow',5],
[300,,'flowers_yellow',10],
[406,,'flowers_yellow',10],
[415,,'flowers_yellow',30],
[alternateForm(669,2),,'flowers_yellow',4],
[alternateForm(669,4),,'flowers_yellow',1],
[alternateForm(669,1),,'flowers_yellow',30],
[165,,'flowers_red',30],
[280,,'flowers_red',5],
[300,,'flowers_red',10],
[406,,'flowers_red',10],
[415,,'flowers_red',10],
[alternateForm(669,2),,'flowers_red',4],
[alternateForm(669,0),,'flowers_red',30],
[alternateForm(669,4),,'flowers_red',1]
]
},{
name:['Centrico Plaza','Place Centrale','Zentral-Plaza','Piazza Centrale','Plaza Central'],encounters:[
[1,,'gift'],
[4,,'gift'],
[7,,'gift'],
[280,,'trade']
]
},{
name:['Route 5',,,'Percorso 5','Ruta 5'],encounters:[
[63,,'grass',5],
[84,,'grass',10],
[311,X,'grass',5],
[312,Y,'grass',5],
[316,,'grass',10],
[659,,'grass',30],
[672,,'grass',10],
[674,,'grass',10],
[676,,'grass',20],
[63,,'flowers_purple',5],
[84,,'flowers_purple',10],
[311,X,'flowers_purple',5],
[312,Y,'flowers_purple',5],
[316,,'flowers_purple',10],
[659,,'flowers_purple',10],
[672,,'flowers_purple',30],
[674,,'flowers_purple',20],
[676,,'flowers_purple',10],
[311,,['horde_with',312],5],
[312,,['horde_with',311],5],
[316,,'horde',60],
[559,,'horde',35]
]
},{
name:['Camphrier Town','Fort-Vanitas','Vanitéa','Castel Vanità','Pueblo Vánitas'],encounters:[
[129,,['trade',130]],
[133,,'trade']
]
},{
name:['Route 7',,,'Percorso 7','Ruta 7'],encounters:[
[235,,'grass',10],
[313,,'grass',10],
[314,,'grass',10],
[315,,'grass',10],
[453,,'grass',35],
[580,,'grass',10],
[alternateForm(669,2),,'grass',4],
[alternateForm(669,4),,'grass',1],
[682,Y,'grass',10],
[684,X,'grass',10],
[235,,'flowers_yellow',10],
[313,,'flowers_yellow',10],
[314,,'flowers_yellow',10],
[315,,'flowers_yellow',10],
[453,,'flowers_yellow',5],
[580,,'flowers_yellow',10],
[alternateForm(669,2),,'flowers_yellow',4],
[alternateForm(669,4),,'flowers_yellow',1],
[alternateForm(669,1),,'flowers_yellow',30],
[682,Y,'flowers_yellow',10],
[684,X,'flowers_yellow',10],
[235,,'flowers_purple',10],
[313,,'flowers_purple',10],
[314,,'flowers_purple',10],
[315,,'flowers_purple',10],
[453,,'flowers_purple',5],
[580,,'flowers_purple',10],
[alternateForm(669,3),,'flowers_purple',30],
[alternateForm(669,2),,'flowers_purple',4],
[alternateForm(669,4),,'flowers_purple',1],
[682,Y,'flowers_purple',10],
[684,X,'flowers_purple',10],
[54,,'horde',35],
[187,,'horde',60],
[315,,'horde',5],
[143,,'interact']
]
},{
name:['Berry fields','Champ de Baies','Beerenfeld','Orto delle bacche','Huerto de bayas'],encounters:[
[165,,['berry_tree_red'],100],
[313,,['berry_tree_blue'],100],
[314,,['berry_tree_purple'],100],
[412,,['berry_tree_green'],100],
[415,,['berry_tree_yellow'],100],
[665,,['berry_tree_pink'],100]
]
},{
name:['Route 6',,,'Percorso 6','Ruta 6'],encounters:[
[43,,'grass_tall',30],
[161,,'grass_tall',20],
[290,,'grass_tall',10],
[352,,'grass_tall',5],
[677,,'grass_tall',20],
[679,,'grass_tall',15],
[543,,'bush',80],
[531,,'bush',20]
]
},{
name:['Parfum Palace','Palais Chaydeuvre','Magnum-Opus-Palast','Reggia Aurea','Palacio Cénit'],encounters:[
[129,,'fish_old',100],
[118,,'fish_good',65],
[341,,'fish_good',35],
[119,,'fish_super',35],
[130,,'fish_super',60],
[342,,'fish_super',5]
]
},{
name:['Connecting Cave','Antre Nosferapti','Zubat-Nest','Tana degli Zubat','Escondrijo Zubat'],encounters:[
[41,,'cave',30],
[293,,'cave',30],
[307,,'cave',30],
[610,,'cave',10],
[41,,'horde',35],
[293,,'horde',60],
[610,,'horde',5]
]
},{
name:['Route 8',,,'Percorso 8','Ruta 8'],encounters:[
[325,,'grass',20],
[335,X,'grass',10],
[336,Y,'grass',10],
[359,,'grass',10],
[371,,'grass',5],
[425,,'grass',30],
[619,,'grass',10],
[686,,'grass',15],
[325,,'flowers_yellow',10],
[335,X,'flowers_yellow',10],
[336,Y,'flowers_yellow',10],
[359,,'flowers_yellow',20],
[371,,'flowers_yellow',5],
[425,,'flowers_yellow',10],
[619,,'flowers_yellow',30],
[686,,'flowers_yellow',15],
[276,,'horde',5],
[278,,'horde',60],
[335,,['horde_with',336],35],
[336,,['horde_with',335],35],
[557,,'rock_smash',66],
[688,,'rock_smash',34],
[72,,'surf',69],
[320,,'surf',31],
[370,,'fish_old',100],
[90,Y,'fish_good',35],
[120,X,'fish_good',35],
[690,Y,'fish_good',65],
[692,X,'fish_good',65],
[91,Y,'fish_super',5],
[121,X,'fish_super',5],
[211,,'fish_super',60],
[691,Y,'fish_super',35],
[693,X,'fish_super',35]
]
},{
name:['Ambrette Town','Roche-sur-Gliffe','Petrophia','Petroglifari','Pueblo Petroglifo'],encounters:[
[557,,'rock_smash',66],
[688,,'rock_smash',34],
[72,,'surf',69],
[320,,'surf',31],
[370,,'fish_old',100],
[116,,'fish_good',35],
[690,Y,'fish_good',65],
[692,X,'fish_good',65],
[117,,'fish_super',5],
[369,,'fish_super',60],
[691,Y,'fish_super',35],
[693,X,'fish_super',35],
[138,,'revive_fossil'],
[140,,'revive_fossil'],
[142,,'revive_fossil'],
[345,,'revive_fossil'],
[347,,'revive_fossil'],
[408,,'revive_fossil'],
[410,,'revive_fossil'],
[564,,'revive_fossil'],
[566,,'revive_fossil'],
[696,,'revive_fossil'],
[698,,'revive_fossil'],
[129,,['trade',130]],
[133,,'trade']
]
},{
name:['Route 9',,,'Percorso 9','Ruta 9'],encounters:[
[449,,'walk',40],
[551,,'walk',40],
[694,,'walk',20]
]
},{
name:['Glittering Cave','Grotte Étincelante','Leuchthöhle','Grotta dei Bagliori','Cueva Brillante'],encounters:[
[66,,'cave',30],
[95,,'cave',10],
[104,,'cave',20],
[111,,'cave',10],
[115,,'cave',5],
[303,,'cave',5],
[337,,'cave',10],
[338,,'cave',10],
[527,,'ceiling',85],
[597,,'ceiling',15],
[95,,'rock_smash',35],
[557,,'rock_smash',65]
]
},{
name:['Cyllage City','Relifac-le-Haut','Relievera City','Altoripoli','Ciudad Relieve'],encounters:[
[95,X,'rock_smash',35],
[557,X,'rock_smash',65],
[557,Y,'rock_smash',66],
[688,Y,'rock_smash',34],
[72,,'surf',69],
[320,,'surf',31],
[370,,'fish_old',100],
[116,,'fish_good',35],
[690,Y,'fish_good',65],
[692,X,'fish_good',65],
[117,,'fish_super',5],
[369,,'fish_super',60],
[691,Y,'fish_super',35],
[693,X,'fish_super',35],
[208,,['trade',370]],
[129,,['trade',130]],
[133,,'trade']
]
},{
name:['Route 10',,,'Percorso 10','Ruta 10'],encounters:[
[133,,'grass',5],
[209,,'grass',10],
[228,X,'grass',10],
[309,Y,'grass',10],
[561,,'grass',20],
[587,,'grass',5],
[622,,'grass',30],
[701,,'grass',20],
[133,,'flowers_yellow',20],
[209,,'flowers_yellow',30],
[228,X,'flowers_yellow',20],
[309,Y,'flowers_yellow',20],
[561,,'flowers_yellow',10],
[587,,'flowers_yellow',5],
[622,,'flowers_yellow',10],
[701,,'flowers_yellow',5],
[193,,'horde',35],
[228,X,'horde',5],
[299,,'horde',60],
[309,Y,'horde',5]
]
},{
name:['Geosenge Town','Cromlac\'h','Cromlexia','Cromleburgo','Pueblo Crómlech'],encounters:[
[129,,['trade',130]],
[133,,'trade']
]
},{
name:['Route 11',,,'Percorso 11','Ruta 11'],encounters:[
[30,,'grass',5],
[33,,'grass',10],
[297,,'grass',20],
[397,,'grass',20],
[433,,'grass',10],
[434,,'grass',10],
[538,Y,'grass',20],
[539,X,'grass',20],
[702,,'grass',5],
[29,,['horde_with',32],60],
[32,,['horde_with',29],60],
[396,,'horde',5],
[434,,'horde',35]
]
},{
name:['Reflection Cave','Grotte Miroitante','Spiegelhöhle','Grotta dei Riflessi','Cueva Reflejos'],encounters:[
[122,,'cave',20],
[202,,'cave',10],
[302,,'cave',5],
[433,,'cave',15],
[524,,'cave',20],
[577,,'cave',20],
[703,,'cave',10],
[439,,'horde',60],
[524,,'horde',35],
[524,,['horde_with',703],5],
[703,,['horde_with',524],5],
[527,,'ceiling',80],
[597,,'ceiling',20]
]
},{
name:['Shalour City','Yantreizh','Yantara City','Yantaropoli','Ciudad Yantra'],encounters:[
[72,,'surf',84],
[458,,'surf',16],
[370,,'fish_old',100],
[170,,'fish_good',35],
[223,,'fish_good',65],
[171,,'fish_super',5],
[224,,'fish_super',35],
[594,,'fish_super',60]
]
},{
name:['Tower of Mastery','Tour Maîtrise','Turm der Erkenntnis','Torre Maestra','Torre Maestra'],encounters:[
[448,,'gift']
]
},{
name:['Route 12',,,'Percorso 12','Ruta 12'],encounters:[
[79,,'grass',30],
[102,,'grass',10],
[127,X,'grass',5],
[128,,'grass',10],
[214,Y,'grass',5],
[241,,'grass',10],
[417,,'grass',5],
[441,,'grass',30],
[79,,'flowers_yellow',10],
[102,,'flowers_yellow',10],
[127,X,'flowers_yellow',5],
[128,,'flowers_yellow',30],
[214,Y,'flowers_yellow',5],
[241,,'flowers_yellow',30],
[417,,'flowers_yellow',5],
[441,,'flowers_yellow',10],
[128,,['horde_with',241],5],
[179,,'horde',35],
[241,,['horde_with',128],5],
[278,,'horde',60],
[72,,'surf',84],
[131,,'surf',1],
[458,,'surf',15],
[370,,'fish_old',100],
[223,,'fish_good',65],
[366,,'fish_good',35],
[222,,'fish_super',60],
[224,,'fish_super',35],
[367,X,'fish_super',5],
[368,Y,'fish_super',5],
[557,,'rock_smash',66],
[688,,'rock_smash',34],
[131,,'gift']
]
},{
name:['Azure Bay','Baie Azur','Azurbucht','Baia Azzurra','Bahía Azul'],encounters:[
[79,,'grass',40],
[102,,'grass',10],
[441,,'grass',35],
[686,,'grass',15],
[79,,'horde',35],
[102,,'horde',5],
[278,,'horde',60],
[72,,'surf',84],
[131,,'surf',1],
[458,,'surf',15],
[370,,'fish_old',100],
[170,,'fish_good',35],
[223,,'fish_good',65],
[171,,'fish_super',5],
[224,,'fish_super',35],
[594,,'fish_super',60],
[557,,'rock_smash',66],
[688,,'rock_smash',34]
]
},{
name:['Coumarine City','Port Tempères','Tempera City','Temperopoli','Ciudad Témpera'],encounters:[
[129,,['trade',130]],
[133,,'trade']
]
},{
name:['Route 13',,,'Percorso 13','Ruta 13'],magneticField:true,encounters:[
[51,,'dust_cloud',40],
[328,,'dust_cloud',40],
[443,,'dust_cloud',20],
[75,,'rock_smash',66],
[218,,'rock_smash',34]
]
},{
name:['Route 14',,,'Percorso 14','Ruta 14'],encounters:[
[70,,'grass',20],
[93,,'grass',5],
[195,,'grass',10],
[451,,'grass',20],
[455,,'grass',15],
[588,,'grass',10],
[616,,'grass',10],
[704,,'grass',10],
[23,,'horde',5],
[69,,'horde',60],
[451,,'horde',35],
[93,,'swamp',5],
[195,,'swamp',30],
[455,,'swamp',5],
[588,,'swamp',10],
[616,,'swamp',10],
[618,,'swamp',20],
[704,,'swamp',20],
[195,,'surf',50],
[618,,'surf',35],
[704,,'surf',15],
[60,,'fish_old',100],
[61,,'fish_good',35],
[339,,'fish_good',65],
[61,,'fish_super',65],
[340,,'fish_super',35]
]
},{
name:['Laverre City','Romant-sous-Bois','Romantia City','Romantopoli','Ciudad Romantis'],encounters:[
[60,,'fish_old',100],
[61,,'fish_good',35],
[550,,'fish_good',65],
[61,,'fish_super',65],
[550,,'fish_super',35]
]
},{
name:['Route 15',,,'Percorso 15','Ruta 15'],encounters:[
[262,X,'grass',30],
[451,,'grass',20],
[505,,'grass',10],
[510,Y,'grass',30],
[590,,'grass',20],
[624,,'grass',10],
[707,,'grass',10],
[262,X,'flowers_red',10],
[451,,'flowers_red',10],
[505,,'flowers_red',30],
[510,Y,'flowers_red',10],
[590,,'flowers_red',20],
[624,,'flowers_red',20],
[707,,'flowers_red',10],
[198,,'horde',60],
[590,,'horde',35],
[707,,'horde',5],
[271,,'surf',66],
[419,,'surf',34],
[60,,'fish_old',100],
[61,,'fish_good',35],
[550,,'fish_good',65],
[61,,'fish_super',65],
[550,,'fish_super',35]
]
},{
name:['Lost Hotel','Hôtel Désolation','Hotelruine','Albergo Diroccato','Hotel Desolación'],encounters:[
[82,,'walk',20],
[101,,'walk',20],
[607,,'walk',20],
[624,,'walk',20],
[707,,'walk',20],
[568,,'interact'],
[569,,'interact'],
[479,,['interact','tuesday']],
[alternateForm(479,1),,['interact','tuesday'],'rare'],
[alternateForm(479,2),,['interact','tuesday'],'rare'],
[alternateForm(479,3),,['interact','tuesday'],'rare'],
[alternateForm(479,4),,['interact','tuesday'],'rare'],
[alternateForm(479,5),,['interact','tuesday'],'rare']
]
},{
name:['Route 16',,,'Percorso 16','Ruta 16'],encounters:[
[590,,'grass_tall',20],
[707,,'grass_tall',9],
[708,,'grass_tall',10],
[710,,'grass_tall',61],
[70,,'flowers_yellow',20],
[419,,'flowers_yellow',20],
[451,,'flowers_yellow',20],
[590,,'flowers_yellow',20],
[707,,'flowers_yellow',10],
[708,,'flowers_yellow',10],
[198,,'horde',60],
[590,,'horde',35],
[707,,'horde',5],
[271,,'surf',66],
[419,,'surf',34],
[60,,'fish_old',100],
[61,,'fish_good',35],
[550,,'fish_good',65],
[61,,'fish_super',65],
[550,,'fish_super',35]
]
},{
name:['Frost Cavern','Caverne Gelée','Frosthöhle','Caverna Gelata','Gruta Helada'],iceRock:true,encounters:[
[124,,'cave',20],
[221,,'cave',20],
[614,,'cave',20],
[712,,'cave',20],
[238,,'horde',5],
[582,,'horde',60],
[613,,'horde',35],
[61,,'surf',66],
[419,,'surf',34],
[60,,'fish_old',100],
[61,,'fish_good',35],
[550,,'fish_good',65],
[61,,'fish_super',65],
[550,,'fish_super',35],
{group:['1F/2F Ice Rock room/3F',,,,'P1/P2 Sala Roca Helada/P3'],encounters:[
[93,,'cave',16],
[615,,'cave',4]
]},
{group:['2F main area',,,,'P2 area principal'],encounters:[
[93,X,'cave',16],
[93,Y,'cave',20],
[615,X,'cave',4]
]}
]
},{
name:['Route 17',,,'Percorso 17','Ruta 17'],encounters:[
[215,,'snow',29],
[225,,'snow',40],
[459,,'snow',30],
[460,,'snow',1]
]
},{
name:['Team Flare Secret HQ','Repaire Team Flare','Flare-Geheimbasis','Covo del Team Flare','Guarida Team Flare'],encounters:[
[716,X,'interact'],
[717,Y,'interact']
]
},{
name:['Route 18',,,'Percorso 18','Ruta 18'],encounters:[
[28,,'grass',10],
[75,,'grass',15],
[247,Y,'grass',10],
[305,X,'grass',10],
[324,,'grass',20],
[533,,'grass',30],
[631,,'grass',5],
[632,,'grass',10],
[28,,'flowers_red',20],
[75,,'flowers_red',15],
[247,Y,'flowers_red',30],
[305,X,'flowers_red',30],
[324,,'flowers_red',10],
[533,,'flowers_red',10],
[631,,'flowers_red',5],
[632,,'flowers_red',10],
[74,,'horde',60],
[631,,['horde_with',632],5],
[632,,'horde',35],
[632,,['horde_with',631],5],
[632,,'bush',90],
[631,,'bush',10],
[75,,'rock_smash',95],
[213,,'rock_smash',5]
]
},{
name:['Couriway Town','Mozheim','Mosaia','Ponte Mosaico','Pueblo Mosaico'],encounters:[
[271,,'surf',66],
[419,,'surf',34],
[60,,'fish_old',100],
[61,,'fish_good',35],
[550,,'fish_good',65],
[61,,'fish_super',65],
[550,,'fish_super',35],
[129,,['trade',130]],
[133,,'trade']
]
},{
name:['Route 19',,,'Percorso 19','Ruta 19'],encounters:[
[70,,'flowers_purple',20],
[93,,'flowers_purple',5],
[195,,'flowers_purple',10],
[452,,'flowers_purple',30],
[455,,'flowers_purple',5],
[588,,'flowers_purple',10],
[616,,'flowers_purple',10],
[705,,'flowers_purple',10],
[70,,'flowers_yellow',10],
[93,,'flowers_yellow',5],
[195,,'flowers_yellow',30],
[452,,'flowers_yellow',10],
[455,,'flowers_yellow',5],
[588,,'flowers_yellow',10],
[616,,'flowers_yellow',10],
[705,,'flowers_yellow',20],
[24,,'horde',5],
[70,,'horde',60],
[207,,'horde',35],
[93,,'swamp',5],
[195,,'swamp',30],
[455,,'swamp',5],
[588,,'swamp',10],
[616,,'swamp',10],
[618,,'swamp',20],
[705,,'swamp',20],
[195,,'surf',50],
[618,,'surf',34],
[705,,'surf',16],
[60,,'fish_old',100],
[61,,'fish_good',35],
[339,,'fish_good',65],
[61,,'fish_super',60],
[186,,'fish_super',5],
[340,,'fish_super',35]
]
},{
name:['Snowbelle City','Auffrac-les-Congères','Fractalia City','Fractalopoli','Ciudad Fractal'],encounters:[
[625,,['trade',39]]
]
},{
name:['Route 20',,,'Percorso 20','Ruta 20'],mossRock:true,encounters:[
[39,,'grass',20],
[164,,'grass',30],
[571,,'grass',5],
[575,,'grass',10],
[591,,'grass',25],
[709,,'grass',10],
[39,,'flowers_red',10],
[164,,'flowers_red',10],
[571,,'flowers_red',5],
[575,,'flowers_red',30],
[591,,'flowers_red',25],
[709,,'flowers_red',20],
[185,,['horde_with',709],5],
[590,,'horde',60],
[709,,'horde',35],
[709,,['horde_with',185],5]
]
},{
name:['Pokémon Village','Village Pokémon','Pokémon-Dorf','Valle dei Pokémon','Villa Pokémon'],encounters:[
[39,,'flowers_yellow',10],
[132,,'flowers_yellow',20],
[164,,'flowers_yellow',10],
[571,,'flowers_yellow',10],
[575,,'flowers_yellow',30],
[591,,'flowers_yellow',20],
[39,,'flowers_purple',20],
[132,,'flowers_purple',10],
[164,,'flowers_purple',30],
[571,,'flowers_purple',10],
[575,,'flowers_purple',10],
[591,,'flowers_purple',20],
[60,,'horde',35],
[271,,'horde',5],
[590,,'horde',60],
[61,,'surf',34],
[271,,'surf',66],
[60,,'fish_old',100],
[61,,'fish_good',35],
[550,,'fish_good',65],
[61,,'fish_super',65],
[550,,'fish_super',35],
[569,,'interact',100],
[354,,['interact','thursday'],100]
]
},{
name:['Route 21',,,'Percorso 21','Ruta 21'],encounters:[
[123,,'flowers_purple',10],
[217,,'flowers_purple',10],
[327,,'flowers_purple',20],
[334,,'flowers_purple',20],
[419,,'flowers_purple',40],
[123,,'flowers_red',10],
[217,,'flowers_red',40],
[327,,'flowers_red',20],
[334,,'flowers_red',20],
[419,,'flowers_red',10],
[123,,'horde',5],
[327,,'horde',60],
[333,,'horde',35],
[271,,'surf',66],
[419,,'surf',34],
[60,,'fish_old',100],
[61,,'fish_good',35],
[147,,'fish_good',5],
[550,,'fish_good',60],
[61,,'fish_super',60],
[148,,'fish_super',5],
[550,,'fish_super',35]
]
},{
name:['Route 22',,,'Percorso 22','Ruta 22'],encounters:[
[54,,'grass',10],
[83,,'grass',10],
[206,,'grass',5],
[298,,'grass',20],
[399,,'grass',10],
[447,,'grass',5],
[659,,'grass',20],
[667,,'grass',20],
[54,,'flowers_yellow',20],
[83,,'flowers_yellow',10],
[184,,'flowers_yellow',20],
[206,,'flowers_yellow',5],
[400,,'flowers_yellow',20],
[447,,'flowers_yellow',5],
[660,,'flowers_yellow',10],
[667,,'flowers_yellow',10],
[54,,'surf',95],
[184,,'surf',5],
[129,,'fish_old',100],
[118,,'fish_good',65],
[318,,'fish_good',35],
[119,,'fish_super',35],
[130,,'fish_super',60],
[319,,'fish_super',5]
]
},{
name:['Victory Road','Route Victoire','Siegesstraße','Via Vittoria','Calle Victoria'],encounters:[
[75,,'cave',20],
[93,,'cave',10],
[108,,'cave',15],
[533,,'cave',30],
[621,,'cave',20],
[634,,'cave',5],
[75,,'rock_smash',95],
[213,,'rock_smash',5],
[75,,'ceiling',45],
[168,,'ceiling',33],
[714,,'ceiling',22],
[22,,'from_sky',77],
[227,,'from_sky',18],
[635,,'from_sky',5],
[60,,'fish_old',100],
[61,,'fish_good',35],
[550,,'fish_good',65],
[550,,'fish_super',35],
{group:['Caves 1/4',,,,'Cuevas 1/4'],encounters:[
[74,,'horde',60],
[108,,'horde',5],
[419,,'horde',35]
]},
{group:['Caves 2/3',,,,'Cuevas 2/3'],encounters:[
[74,,'horde',60],
[75,,'horde',35],
[108,,'horde',5]
]},
{group:'outside',encounters:[
[271,,'surf',66],
[419,,'surf',34]
]},
{group:'inside',encounters:[
[61,,'surf',66],
[419,,'surf',34]
]},
{group:['Outside/Caves 1-3',,,,'Exterior/Cuevas 1-3'],encounters:[
[61,,'fish_super',65],
]},
{group:['Cave 4',,,,'Cueva 4'],encounters:[
[61,,'fish_super',60],
[62,,'fish_super',5]
]}
]
},{
name:['Friend Safari','Safari des Amis','Kontaktsafari','Safari Amici','Safari Amistad'],encounters:[
{group:['Normal type',,,,'Tipo normal'],showAsGrid:true,encounters:[
[190,,'grass','friend_safari_1'],
[206,,'grass','friend_safari_1'],
[216,,'grass','friend_safari_1'],
[506,,'grass','friend_safari_1'],
[294,,'grass','friend_safari_2'],
[352,,'grass','friend_safari_2'],
[531,,'grass','friend_safari_2'],
[572,,'grass','friend_safari_2'],
[113,,'grass','friend_safari_3'],
[132,,'grass','friend_safari_3'],
[133,,'grass','friend_safari_3'],
[235,,'grass','friend_safari_3']
]},
{group:['Fighting type',,,,'Tipo lucha'],showAsGrid:true,encounters:[
[56,,'grass','friend_safari_1'],
[67,,'grass','friend_safari_1'],
[307,,'grass','friend_safari_1'],
[619,,'grass','friend_safari_1'],
[538,,'grass','friend_safari_2'],
[539,,'grass','friend_safari_2'],
[674,,'grass','friend_safari_2'],
[236,,'grass','friend_safari_3'],
[286,,'grass','friend_safari_3'],
[297,,'grass','friend_safari_3'],
[447,,'grass','friend_safari_3']
]},
{group:['Flying type',,,,'Tipo volador'],showAsGrid:true,encounters:[
[16,,'grass','friend_safari_1'],
[21,,'grass','friend_safari_1'],
[83,,'grass','friend_safari_1'],
[84,,'grass','friend_safari_1'],
[163,,'grass','friend_safari_2'],
[520,,'grass','friend_safari_2'],
[527,,'grass','friend_safari_2'],
[581,,'grass','friend_safari_2'],
[357,,'grass','friend_safari_3'],
[627,,'grass','friend_safari_3'],
[662,,'grass','friend_safari_3'],
[701,,'grass','friend_safari_3']
]},
{group:['Poison type',,,,'Tipo veneno'],showAsGrid:true,encounters:[
[14,,'grass','friend_safari_1'],
[44,,'grass','friend_safari_1'],
[268,,'grass','friend_safari_1'],
[336,,'grass','friend_safari_1'],
[49,,'grass','friend_safari_2'],
[168,,'grass','friend_safari_2'],
[317,,'grass','friend_safari_2'],
[569,,'grass','friend_safari_2'],
[89,,'grass','friend_safari_3'],
[452,,'grass','friend_safari_3'],
[454,,'grass','friend_safari_3'],
[544,,'grass','friend_safari_3']
]},
{group:['Ground type',,,,'Tipo tierra'],showAsGrid:true,encounters:[
[27,,'grass','friend_safari_1'],
[194,,'grass','friend_safari_1'],
[231,,'grass','friend_safari_1'],
[328,,'grass','friend_safari_1'],
[51,,'grass','friend_safari_2'],
[105,,'grass','friend_safari_2'],
[290,,'grass','friend_safari_2'],
[323,,'grass','friend_safari_2'],
[423,,'grass','friend_safari_3'],
[536,,'grass','friend_safari_3'],
[660,,'grass','friend_safari_3']
]},
{group:['Rock type',,,,'Tipo roca'],showAsGrid:true,encounters:[
[299,,'grass','friend_safari_1'],
[525,,'grass','friend_safari_1'],
[557,,'grass','friend_safari_1'],
[95,,'grass','friend_safari_2'],
[219,,'grass','friend_safari_2'],
[222,,'grass','friend_safari_2'],
[247,,'grass','friend_safari_2'],
[112,,'grass','friend_safari_3'],
[213,,'grass','friend_safari_3'],
[689,,'grass','friend_safari_3']
]},
{group:['Bug type',,,,'Tipo bicho'],showAsGrid:true,encounters:[
[12,,'grass','friend_safari_1'],
[46,,'grass','friend_safari_1'],
[165,,'grass','friend_safari_1'],
[415,,'grass','friend_safari_1'],
[267,,'grass','friend_safari_2'],
[284,,'grass','friend_safari_2'],
[313,,'grass','friend_safari_2'],
[314,,'grass','friend_safari_2'],
[49,,'grass','friend_safari_3'],
[127,,'grass','friend_safari_3'],
[214,,'grass','friend_safari_3'],
[666,,'grass','friend_safari_3']
]},
{group:['Ghost type',,,,'Tipo fantasma'],showAsGrid:true,encounters:[
[353,,'grass','friend_safari_1'],
[608,,'grass','friend_safari_1'],
[708,,'grass','friend_safari_2'],
[710,,'grass','friend_safari_2'],
[356,,'grass','friend_safari_3'],
[426,,'grass','friend_safari_3'],
[442,,'grass','friend_safari_3'],
[623,,'grass','friend_safari_3']
]},
{group:['Steel type',,,,'Tipo acero'],showAsGrid:true,encounters:[
[82,,'grass','friend_safari_1'],
[303,,'grass','friend_safari_1'],
[597,,'grass','friend_safari_1'],
[205,,'grass','friend_safari_2'],
[227,,'grass','friend_safari_2'],
[375,,'grass','friend_safari_2'],
[600,,'grass','friend_safari_2'],
[437,,'grass','friend_safari_3'],
[530,,'grass','friend_safari_3'],
[707,,'grass','friend_safari_3']
]},
{group:['Fire type',,,,'Tipo fuego'],showAsGrid:true,encounters:[
[58,,'grass','friend_safari_1'],
[77,,'grass','friend_safari_1'],
[126,,'grass','friend_safari_1'],
[513,,'grass','friend_safari_1'],
[5,,'grass','friend_safari_2'],
[218,,'grass','friend_safari_2'],
[636,,'grass','friend_safari_2'],
[668,,'grass','friend_safari_2'],
[38,,'grass','friend_safari_3'],
[654,,'grass','friend_safari_3'],
[662,,'grass','friend_safari_3']
]},
{group:['Water type',,,,'Tipo agua'],showAsGrid:true,encounters:[
[98,,'grass','friend_safari_1'],
[224,,'grass','friend_safari_1'],
[400,,'grass','friend_safari_1'],
[515,,'grass','friend_safari_1'],
[8,,'grass','friend_safari_2'],
[130,,'grass','friend_safari_2'],
[195,,'grass','friend_safari_2'],
[419,,'grass','friend_safari_2'],
[61,,'grass','friend_safari_3'],
[184,,'grass','friend_safari_3'],
[657,,'grass','friend_safari_3']
]},
{group:['Grass type',,,,'Tipo planta'],showAsGrid:true,encounters:[
[43,,'grass','friend_safari_1'],
[114,,'grass','friend_safari_1'],
[191,,'grass','friend_safari_1'],
[511,,'grass','friend_safari_1'],
[2,,'grass','friend_safari_2'],
[541,,'grass','friend_safari_2'],
[548,,'grass','friend_safari_2'],
[586,,'grass','friend_safari_2'],
[556,,'grass','friend_safari_3'],
[651,,'grass','friend_safari_3'],
[673,,'grass','friend_safari_3']
]},
{group:['Electric type',,,,'Tipo eléctrico'],showAsGrid:true,encounters:[
[101,,'grass','friend_safari_1'],
[417,,'grass','friend_safari_1'],
[587,,'grass','friend_safari_1'],
[702,,'grass','friend_safari_1'],
[25,,'grass','friend_safari_2'],
[125,,'grass','friend_safari_2'],
[618,,'grass','friend_safari_2'],
[694,,'grass','friend_safari_2'],
[310,,'grass','friend_safari_3'],
[404,,'grass','friend_safari_3'],
[523,,'grass','friend_safari_3'],
[596,,'grass','friend_safari_3']
]},
{group:['Psychic type',,,,'Tipo psíquico'],showAsGrid:true,encounters:[
[63,,'grass','friend_safari_1'],
[96,,'grass','friend_safari_1'],
[326,,'grass','friend_safari_1'],
[517,,'grass','friend_safari_1'],
[202,,'grass','friend_safari_2'],
[561,,'grass','friend_safari_2'],
[677,,'grass','friend_safari_2'],
[178,,'grass','friend_safari_3'],
[203,,'grass','friend_safari_3'],
[575,,'grass','friend_safari_3'],
[578,,'grass','friend_safari_3']
]},
{group:['Ice type',,,,'Tipo hielo'],showAsGrid:true,encounters:[
[225,,'grass','friend_safari_1'],
[361,,'grass','friend_safari_1'],
[363,,'grass','friend_safari_1'],
[459,,'grass','friend_safari_1'],
[215,,'grass','friend_safari_2'],
[614,,'grass','friend_safari_2'],
[712,,'grass','friend_safari_2'],
[87,,'grass','friend_safari_3'],
[91,,'grass','friend_safari_3'],
[131,,'grass','friend_safari_3'],
[221,,'grass','friend_safari_3']
]},
{group:['Dragon type',,,,'Tipo dragón'],showAsGrid:true,encounters:[
[444,,'grass','friend_safari_1'],
[611,,'grass','friend_safari_1'],
[148,,'grass','friend_safari_2'],
[372,,'grass','friend_safari_2'],
[714,,'grass','friend_safari_2'],
[621,,'grass','friend_safari_3'],
[705,,'grass','friend_safari_3']
]},
{group:['Dark type',,,,'Tipo siniestro'],showAsGrid:true,encounters:[
[262,,'grass','friend_safari_1'],
[274,,'grass','friend_safari_1'],
[624,,'grass','friend_safari_1'],
[629,,'grass','friend_safari_1'],
[215,,'grass','friend_safari_2'],
[332,,'grass','friend_safari_2'],
[342,,'grass','friend_safari_2'],
[551,,'grass','friend_safari_2'],
[302,,'grass','friend_safari_3'],
[359,,'grass','friend_safari_3'],
[510,,'grass','friend_safari_3'],
[686,,'grass','friend_safari_3']
]},
{group:['Fairy type',,,,'Tipo hada'],showAsGrid:true,encounters:[
[175,,'grass','friend_safari_1'],
[209,,'grass','friend_safari_1'],
[281,,'grass','friend_safari_1'],
[702,,'grass','friend_safari_1'],
[39,,'grass','friend_safari_2'],
[303,,'grass','friend_safari_2'],
[682,,'grass','friend_safari_2'],
[684,,'grass','friend_safari_2'],
[35,,'grass','friend_safari_3'],
[670,,'grass','friend_safari_3']
]}
]
},{
name:['Sea Spirit\'s Den','Antre Néréen','Meerestitanenhöhle','Antro Talassico','Cueva Talasia'],encounters:[
[144,,'interact'],
[145,,'interact'],
[146,,'interact']
]
},{
name:['Roaming Kalos'],encounters:[
[144,,['roaming','if_starter_grass']],
[145,,['roaming','if_starter_fire']],
[146,,['roaming','if_starter_water']]
]
},{
name:['Unknown Dungeon','Grotte Inconnue','Geheimdungeon','Grotta Ignota','Mazmorra Rara'],encounters:[
[150,,'interact']
]
},{
name:['Terminus Cave','Grotte Coda','Omega-Höhle','Grotta Climax','Cueva Desenlace'],encounters:[
[28,,'cave',20],
[75,,'cave',20],
[247,Y,'cave',20],
[305,X,'cave',20],
[632,,'cave',40],
[74,,'horde',35],
[246,Y,'horde',5],
[304,X,'horde',5],
[632,,'horde',60],
[75,,'rock_smash',95],
[213,,'rock_smash',5],
[168,,'ceiling',80],
[714,,'ceiling',20],
[718,,'interact']
]
}
];
|
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("omi"));
else if(typeof define === 'function' && define.amd)
define(["omi"], factory);
else if(typeof exports === 'object')
exports["label-off"] = factory(require("omi"));
else
root["label-off"] = factory(root["Omi"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_omi__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./esm/label-off.js");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./esm/label-off.js":
/*!**************************!*\
!*** ./esm/label-off.js ***!
\**************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar omi_1 = __webpack_require__(/*! omi */ \"omi\");\nvar createSvgIcon_1 = __webpack_require__(/*! ./utils/createSvgIcon */ \"./esm/utils/createSvgIcon.js\");\nexports.default = createSvgIcon_1.default(omi_1.h(\"path\", {\n d: \"M3.25 2.75l17 17L19 21l-2-2H5c-1.1 0-2-.9-2-2V7c0-.55.23-1.05.59-1.41L2 4l1.25-1.25zM22 12l-4.37-6.16C17.27 5.33 16.67 5 16 5H8l11 11 3-4z\"\n}), 'LabelOff');\n\n\n//# sourceURL=webpack://%5Bname%5D/./esm/label-off.js?");
/***/ }),
/***/ "./esm/utils/createSvgIcon.js":
/*!************************************!*\
!*** ./esm/utils/createSvgIcon.js ***!
\************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
eval("\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar omi_1 = __webpack_require__(/*! omi */ \"omi\");\nvar hyphenateRE = /\\B([A-Z])/g;\nvar hyphenate = function (str) {\n return str.replace(hyphenateRE, '-$1').toLowerCase();\n};\nfunction createSvgIcon(path, displayName) {\n var _a;\n omi_1.define(hyphenate('OIcon' + displayName), (_a = /** @class */ (function (_super) {\n __extends(class_1, _super);\n function class_1() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n class_1.prototype.render = function () {\n return omi_1.h('svg', {\n viewBox: '0 0 24 24',\n }, path);\n };\n return class_1;\n }(omi_1.WeElement)),\n _a.css = \":host {\\n fill: currentColor;\\n width: 1em;\\n height: 1em;\\n display: inline-block;\\n vertical-align: -0.125em;\\n transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\\n flex-shrink: 0;\\n user-select: none;\\n}\",\n _a));\n}\nexports.default = createSvgIcon;\n\n\n//# sourceURL=webpack://%5Bname%5D/./esm/utils/createSvgIcon.js?");
/***/ }),
/***/ "omi":
/*!******************************************************************************!*\
!*** external {"commonjs":"omi","commonjs2":"omi","amd":"omi","root":"Omi"} ***!
\******************************************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("module.exports = __WEBPACK_EXTERNAL_MODULE_omi__;\n\n//# sourceURL=webpack://%5Bname%5D/external_%7B%22commonjs%22:%22omi%22,%22commonjs2%22:%22omi%22,%22amd%22:%22omi%22,%22root%22:%22Omi%22%7D?");
/***/ })
/******/ })["default"];
});
|
import React from "react";
import { NavLink } from "react-router-dom";
import routes from "../../routes";
import s from "./Navigation.module.css";
const Navigation = () => {
return (
<header className={s.header}>
<nav>
<NavLink to={routes.home} className={s.link_home}>
HOME
</NavLink>
<NavLink to={routes.movies} className={s.link_movie}>
MOVIES
</NavLink>
</nav>
</header>
);
};
export default Navigation;
|
import styled from "styled-components/macro";
import {useEffect} from "react";
import Sphere from "./Sphere.js"
export default function NewQuoteButton({getNewQuote, color}) {
useEffect(() => {
document.getElementById("new-quote").style.background = color;
},);
const getNewQuoteAndColorChange = () => {
document.getElementById("new-quote").style.background = color;
getNewQuote();
};
return (<div>
<Sphere>
<Button id="new-quote" onClick={getNewQuoteAndColorChange}>Get New Quote</Button>
</Sphere>
</div>
)
}
const Button = styled.button`
border: 0;
padding: 30px 50px;
border-radius: 50%;
`
|
import test from "ava";
import problem092 from "../problems/092.js";
test("Problem 92", (t) => t.is(problem092(), "Problem 92 solution is: 8581146"));
|
/*
* Button component. It provides interfaces for all types
* of the buttons.
*/
import React from "react";
import styled from "styled-components";
import { bool, string } from "prop-types";
const Button = ({ as, label, children, ...props }) => {
const isIcon = children?.type?.displayName === "Icon";
return (
<StyledButton as={as} isIcon={isIcon} {...props}>
{label ? label : children}
</StyledButton>
);
};
const StyledButton = styled.button`
display: inline-flex;
align-items: center;
justify-content: center;
cursor: pointer;
outline: none;
box-sizing: border-box;
line-height: 24px;
position: relative;
user-select: none;
text-decoration: none;
border-width: 0;
border-style: solid;
border-radius: 1rem;
padding: ${({ isIcon }) => (isIcon ? "12px" : "16px")};
background-color: ${({ color }) => color};
opacity: ${({ disabled }) => (disabled ? 0.6 : 1)};
color: rgba(255, 255, 255, 1);
font-size: 14px;
font-weight: 700;
width: ${(p) => (p.isStretched ? "100%" : null)};
${({ isOutline }) =>
isOutline &&
`border-width: 1px;
border-color: rgba(221, 227, 235, 1);
background-color: transparent;
color: rgba(12, 17, 24, 1);
`};
${({ isBorderless }) =>
isBorderless &&
`
background-color: transparent;
color: rgba(241, 82, 35, 1);
padding: 0;
`};
`;
Button.propTypes = {
label: string,
disabled: bool,
isStretched: bool,
isOutline: bool,
isBorderless: bool,
color: string,
};
Button.defaultProps = {
color: "rgba(241, 82, 35, 1)",
};
export default Button;
|
const composeAPI = require( '@helixnetwork/core').composeAPI;
const prepareForTangleWithLocalPow = require('@helixnetwork/pow').prepareForTangleWithLocalPow
let m = require('@helixnetwork/converter').asciiToTxHex
const { provider } = require('./conf-env.js')
const helix = composeAPI({
provider
})
// Depth or how far to go for tip selection entry point
const depth = 2
// Difficulty of Proof-of-Work required to attach transaction to tangle
// Minimum value on testnet is currently 2.
const minWeightMagnitude = 2
const getBalance = async (addrs) => {
let balances = await helix.getBalances([addrs], 100)
console.log(balances);
return balances;
}
const send = async function(seed, snd, rcv, val) {
let transfers = [{
address: rcv,
value: val, // 1Kh
tag: m('loot'), // optional tag in hexString
message: m("Enjoy free lunch")}
]
let inputs = [
{
address: snd,
security: 2,
}
];
try {
const txs = await helix.prepareTransfers(seed, transfers, {"security":2})
//console.log(`Tranasactinos: ${txs}`);
const bundle = await helix.sendTransactionStrings(txs, depth, minWeightMagnitude)
console.log(`Sent bundle: ${JSON.stringify(bundle)}`);
return {
bundle: bundle[0].bundle,
txs: bundle.map(b => b.hash),
values: bundle.map(b => b.value)
};
} catch (err) {
console.error(`Failed to send: ${err}`);
throw err;
}
}
const nodeInfo = async (url) => {
let provider = composeAPI({
provider: url
})
let info = await provider.getNodeInfo();
console.log(info);
return {
url,
latestSolidRoundIndex: info.latestSolidRoundIndex,
currentRoundIndex: info.currentRoundIndex,
time: info.time,
features: info.features
}
}
const getConfimationStatus = async (txHash) => {
return await helix.getInclusionStates([txHash]);
}
module.exports = {
send, getBalance, nodeInfo, getConfimationStatus
}
|
"use strict";
const { Managers, Utils } = require("@arkecosystem/crypto");
const utils = require("./utils");
const testUtils = require("../../../../lib/utils/test-utils");
const { delegates } = require("../../../../lib/utils/testnet");
const { TransactionFactory } = require('../../../../../helpers/transaction-factory');
/**
* Creates a transaction to a new wallet
* @param {Object} options = { }
* @return {void}
*/
module.exports = async options => {
Managers.configManager.setFromPreset("testnet");
const senderWallet = delegates[7]; // better use a different delegate for each scenario initial transfer
let transaction1 = TransactionFactory.transfer(utils.htlcSender.address, 1000 * Math.pow(10, 5), "send coins to htlc sender")
.withFee(0.1 * Math.pow(10, 5))
.withNonce(Utils.BigNumber.make(2))
.withPassphrase(senderWallet.passphrase)
.withVersion(2)
.createOne();
await testUtils.POST("transactions", {
transactions: [transaction1],
});
};
|
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you 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.
*/
/**
* @name SearchSource
*
* @description A promise-based stream of search results that can inherit from other search sources.
*
* Because filters/queries in Kibana have different levels of persistence and come from different
* places, it is important to keep track of where filters come from for when they are saved back to
* the savedObject store in the Kibana index. To do this, we create trees of searchSource objects
* that can have associated query parameters (index, query, filter, etc) which can also inherit from
* other searchSource objects.
*
* At query time, all of the searchSource objects that have subscribers are "flattened", at which
* point the query params from the searchSource are collected while traversing up the inheritance
* chain. At each link in the chain a decision about how to merge the query params is made until a
* single set of query parameters is created for each active searchSource (a searchSource with
* subscribers).
*
* That set of query parameters is then sent to elasticsearch. This is how the filter hierarchy
* works in Kibana.
*
* Visualize, starting from a new search:
*
* - the `savedVis.searchSource` is set as the `appSearchSource`.
* - The `savedVis.searchSource` would normally inherit from the `appSearchSource`, but now it is
* upgraded to inherit from the `rootSearchSource`.
* - Any interaction with the visualization will still apply filters to the `appSearchSource`, so
* they will be stored directly on the `savedVis.searchSource`.
* - Any interaction with the time filter will be written to the `rootSearchSource`, so those
* filters will not be saved by the `savedVis`.
* - When the `savedVis` is saved to elasticsearch, it takes with it all the filters that are
* defined on it directly, but none of the ones that it inherits from other places.
*
* Visualize, starting from an existing search:
*
* - The `savedVis` loads the `savedSearch` on which it is built.
* - The `savedVis.searchSource` is set to inherit from the `saveSearch.searchSource` and set as
* the `appSearchSource`.
* - The `savedSearch.searchSource`, is set to inherit from the `rootSearchSource`.
* - Then the `savedVis` is written to elasticsearch it will be flattened and only include the
* filters created in the visualize application and will reconnect the filters from the
* `savedSearch` at runtime to prevent losing the relationship
*
* Dashboard search sources:
*
* - Each panel in a dashboard has a search source.
* - The `savedDashboard` also has a searchsource, and it is set as the `appSearchSource`.
* - Each panel's search source inherits from the `appSearchSource`, meaning that they inherit from
* the dashboard search source.
* - When a filter is added to the search box, or via a visualization, it is written to the
* `appSearchSource`.
*/
import _ from 'lodash';
import angular from 'angular';
import { buildEsQuery, getEsQueryConfig, filterMatchesIndex } from '@kbn/es-query';
import '../../promises';
import { NormalizeSortRequestProvider } from './_normalize_sort_request';
import { SearchRequestProvider } from '../fetch/request';
import { searchRequestQueue } from '../search_request_queue';
import { FetchSoonProvider } from '../fetch';
import { FieldWildcardProvider } from '../../field_wildcard';
import { getHighlightRequest } from '../../../../core_plugins/kibana/common/highlight';
import { KbnError, OutdatedKuerySyntaxError } from '../../errors';
const FIELDS = [
'type',
'query',
'filter',
'sort',
'highlight',
'highlightAll',
'aggs',
'from',
'searchAfter',
'size',
'source',
'version',
'fields',
'index',
];
function parseInitialFields(initialFields) {
if (!initialFields) {
return {};
}
return typeof initialFields === 'string' ?
JSON.parse(initialFields)
: _.cloneDeep(initialFields);
}
function isIndexPattern(val) {
return Boolean(val && typeof val.toIndexList === 'function');
}
export function SearchSourceProvider(Promise, Private, config) {
const SearchRequest = Private(SearchRequestProvider);
const normalizeSortRequest = Private(NormalizeSortRequestProvider);
const fetchSoon = Private(FetchSoonProvider);
const { fieldWildcardFilter } = Private(FieldWildcardProvider);
const getConfig = (...args) => config.get(...args);
const forIp = Symbol('for which index pattern?');
class SearchSource {
constructor(initialFields) {
this._id = _.uniqueId('data_source');
this._searchStrategyId = undefined;
this._fields = parseInitialFields(initialFields);
this._parent = undefined;
this.history = [];
this._requestStartHandlers = [];
this._inheritOptions = {};
this._filterPredicates = [
(filter) => {
// remove null/undefined filters
return filter;
},
(filter) => {
const disabled = _.get(filter, 'meta.disabled');
return disabled === undefined || disabled === false;
},
(filter, data) => {
const index = data.index || this.getField('index');
return !config.get('courier:ignoreFilterIfFieldNotInIndex') || filterMatchesIndex(filter, index);
}
];
}
/*****
* PUBLIC API
*****/
setPreferredSearchStrategyId(searchStrategyId) {
this._searchStrategyId = searchStrategyId;
}
getPreferredSearchStrategyId() {
return this._searchStrategyId;
}
setFields(newFields) {
this._fields = newFields;
return this;
}
setField = (field, value) => {
if (!FIELDS.includes(field)) {
throw new Error(`Can't set field '${field}' on SearchSource. Acceptable fields are: ${FIELDS.join(', ')}.`);
}
if (field === 'index') {
const fields = this._fields;
const hasSource = fields.source;
const sourceCameFromIp = hasSource && fields.source.hasOwnProperty(forIp);
const sourceIsForOurIp = sourceCameFromIp && fields.source[forIp] === fields.index;
if (sourceIsForOurIp) {
delete fields.source;
}
if (value === null || value === undefined) {
delete fields.index;
return this;
}
if (!isIndexPattern(value)) {
throw new TypeError('expected indexPattern to be an IndexPattern duck.');
}
fields[field] = value;
if (!fields.source) {
// imply source filtering based on the index pattern, but allow overriding
// it by simply setting another field for "source". When index is changed
fields.source = function () {
return value.getSourceFiltering();
};
fields.source[forIp] = value;
}
return this;
}
if (value == null) {
delete this._fields[field];
return this;
}
this._fields[field] = value;
return this;
};
getId() {
return this._id;
}
getFields() {
return _.clone(this._fields);
}
/**
* Get fields from the fields
*/
getField = field => {
if (!FIELDS.includes(field)) {
throw new Error(`Can't get field '${field}' from SearchSource. Acceptable fields are: ${FIELDS.join(', ')}.`);
}
let searchSource = this;
while (searchSource) {
const value = searchSource._fields[field];
if (value !== void 0) {
return value;
}
searchSource = searchSource.getParent();
}
};
/**
* Get the field from our own fields, don't traverse up the chain
*/
getOwnField(field) {
if (!FIELDS.includes(field)) {
throw new Error(`Can't get field '${field}' from SearchSource. Acceptable fields are: ${FIELDS.join(', ')}.`);
}
const value = this._fields[field];
if (value !== void 0) {
return value;
}
}
create() {
return new SearchSource();
}
createCopy() {
const json = angular.toJson(this._fields);
const newSearchSource = new SearchSource(json);
// when serializing the internal fields we lose the internal classes used in the index
// pattern, so we have to set it again to workaround this behavior
newSearchSource.setField('index', this.getField('index'));
newSearchSource.setParent(this.getParent());
return newSearchSource;
}
createChild(options = {}) {
const childSearchSource = new SearchSource();
childSearchSource.setParent(this, options);
return childSearchSource;
}
/**
* Set a searchSource that this source should inherit from
* @param {SearchSource} searchSource - the parent searchSource
* @return {this} - chainable
*/
setParent(parent, options = {}) {
this._parent = parent;
this._inheritOptions = options;
return this;
}
/**
* Get the parent of this SearchSource
* @return {undefined|searchSource}
*/
getParent() {
return this._parent || undefined;
}
/**
* Fetch this source and reject the returned Promise on error
*
* @async
*/
fetch() {
const self = this;
let req = _.first(self._myStartableQueued());
if (!req) {
const errorHandler = (request, error) => {
request.defer.reject(error);
request.abort();
};
req = self._createRequest({ errorHandler });
}
fetchSoon.fetchSearchRequests([req]);
return req.getCompletePromise();
}
/**
* Fetch all pending requests for this source ASAP
* @async
*/
fetchQueued() {
return fetchSoon.fetchSearchRequests(this._myStartableQueued());
}
/**
* Cancel all pending requests for this searchSource
* @return {undefined}
*/
cancelQueued() {
searchRequestQueue.getAll()
.filter(req => req.source === this)
.forEach(req => req.abort());
}
/**
* Add a handler that will be notified whenever requests start
* @param {Function} handler
* @return {undefined}
*/
onRequestStart(handler) {
this._requestStartHandlers.push(handler);
}
/**
* Called by requests of this search source when they are started
* @param {Courier.Request} request
* @return {Promise<undefined>}
*/
requestIsStarting(request) {
this.activeFetchCount = (this.activeFetchCount || 0) + 1;
this.history = [request];
const handlers = [...this._requestStartHandlers];
// If callparentStartHandlers has been set to true, we also call all
// handlers of parent search sources.
if (this._inheritOptions.callParentStartHandlers) {
let searchSource = this.getParent();
while (searchSource) {
handlers.push(...searchSource._requestStartHandlers);
searchSource = searchSource.getParent();
}
}
return Promise
.map(handlers, fn => fn(this, request))
.then(_.noop);
}
/**
* Put a request in to the courier that this Source should
* be fetched on the next run of the courier
* @return {Promise}
*/
onResults() {
const self = this;
return new Promise(function (resolve, reject) {
const defer = Promise.defer();
defer.promise.then(resolve, reject);
const errorHandler = (request, error) => {
reject(error);
request.abort();
};
self._createRequest({ defer, errorHandler });
});
}
async getSearchRequestBody() {
const searchRequest = await this._flatten();
return searchRequest.body;
}
/**
* Called by requests of this search source when they are done
* @param {Courier.Request} request
* @return {undefined}
*/
requestIsStopped() {
this.activeFetchCount -= 1;
}
/**
* Completely destroy the SearchSource.
* @return {undefined}
*/
destroy() {
this.cancelQueued();
this._requestStartHandlers.length = 0;
}
/******
* PRIVATE APIS
******/
_myStartableQueued() {
return searchRequestQueue
.getStartable()
.filter(req => req.source === this);
}
/**
* Create a common search request object, which should
* be put into the pending request queue, for this search
* source
*
* @param {Deferred} defer - the deferred object that should be resolved
* when the request is complete
* @return {SearchRequest}
*/
_createRequest({ defer, errorHandler }) {
return new SearchRequest({ source: this, defer, errorHandler });
}
/**
* Used to merge properties into the data within ._flatten().
* The data is passed in and modified by the function
*
* @param {object} data - the current merged data
* @param {*} val - the value at `key`
* @param {*} key - The key of `val`
* @return {undefined}
*/
_mergeProp(data, val, key) {
if (typeof val === 'function') {
const source = this;
return Promise.cast(val(this))
.then(function (newVal) {
return source._mergeProp(data, newVal, key);
});
}
if (val == null || !key || !_.isString(key)) return;
switch (key) {
case 'filter':
let filters = Array.isArray(val) ? val : [val];
filters = filters.filter(filter => {
return this._filterPredicates.every(predicate => predicate(filter, data));
});
data.filters = [...(data.filters || []), ...filters];
return;
case 'index':
case 'type':
case 'id':
case 'highlightAll':
if (key && data[key] == null) {
data[key] = val;
}
return;
case 'searchAfter':
key = 'search_after';
addToBody();
break;
case 'source':
key = '_source';
addToBody();
break;
case 'sort':
val = normalizeSortRequest(val, this.getField('index'));
addToBody();
break;
case 'query':
data.query = (data.query || []).concat(val);
break;
case 'fields':
data[key] = _.uniq([...(data[key] || []), ...val]);
break;
default:
addToBody();
}
/**
* Add the key and val to the body of the request
*/
function addToBody() {
data.body = data.body || {};
// ignore if we already have a value
if (data.body[key] == null) {
data.body[key] = val;
}
}
}
/**
* Walk the inheritance chain of a source and return it's
* flat representation (taking into account merging rules)
* @returns {Promise}
* @resolved {Object|null} - the flat data of the SearchSource
*/
_flatten() {
// the merged data of this dataSource and it's ancestors
const flatData = {};
// function used to write each property from each data object in the chain to flat data
const root = this;
// start the chain at this source
let current = this;
// call the ittr and return it's promise
return (function ittr() {
// iterate the _fields object (not array) and
// pass each key:value pair to source._mergeProp. if _mergeProp
// returns a promise, then wait for it to complete and call _mergeProp again
return Promise.all(_.map(current._fields, function ittr(value, key) {
if (Promise.is(value)) {
return value.then(function (value) {
return ittr(value, key);
});
}
const prom = root._mergeProp(flatData, value, key);
return Promise.is(prom) ? prom : null;
}))
.then(function () {
// move to this sources parent
const parent = current.getParent();
// keep calling until we reach the top parent
if (parent) {
current = parent;
return ittr();
}
});
}())
.then(function () {
// This is down here to prevent the circular dependency
flatData.body = flatData.body || {};
const computedFields = flatData.index.getComputedFields();
flatData.body.stored_fields = computedFields.storedFields;
flatData.body.script_fields = flatData.body.script_fields || {};
flatData.body.docvalue_fields = flatData.body.docvalue_fields || [];
_.extend(flatData.body.script_fields, computedFields.scriptFields);
flatData.body.docvalue_fields = _.union(flatData.body.docvalue_fields, computedFields.docvalueFields);
if (flatData.body._source) {
// exclude source fields for this index pattern specified by the user
const filter = fieldWildcardFilter(flatData.body._source.excludes);
flatData.body.docvalue_fields = flatData.body.docvalue_fields.filter(
docvalueField => filter(docvalueField.field)
);
}
// if we only want to search for certain fields
const fields = flatData.fields;
if (fields) {
// filter out the docvalue_fields, and script_fields to only include those that we are concerned with
flatData.body.docvalue_fields = _.intersection(flatData.body.docvalue_fields, fields);
flatData.body.script_fields = _.pick(flatData.body.script_fields, fields);
// request the remaining fields from both stored_fields and _source
const remainingFields = _.difference(fields, _.keys(flatData.body.script_fields));
flatData.body.stored_fields = remainingFields;
_.set(flatData.body, '_source.includes', remainingFields);
}
try {
const esQueryConfigs = getEsQueryConfig(config);
flatData.body.query = buildEsQuery(flatData.index, flatData.query, flatData.filters, esQueryConfigs);
} catch (e) {
if (e.message === 'OutdatedKuerySyntaxError') {
throw new OutdatedKuerySyntaxError();
}
throw new KbnError(e.message, KbnError);
}
if (flatData.highlightAll != null) {
if (flatData.highlightAll && flatData.body.query) {
flatData.body.highlight = getHighlightRequest(flatData.body.query, getConfig);
}
delete flatData.highlightAll;
}
/**
* Translate a filter into a query to support es 3+
* @param {Object} filter - The filter to translate
* @return {Object} the query version of that filter
*/
const translateToQuery = function (filter) {
if (!filter) return;
if (filter.query) {
return filter.query;
}
return filter;
};
// re-write filters within filter aggregations
(function recurse(aggBranch) {
if (!aggBranch) return;
Object.keys(aggBranch).forEach(function (id) {
const agg = aggBranch[id];
if (agg.filters) {
// translate filters aggregations
const filters = agg.filters.filters;
Object.keys(filters).forEach(function (filterId) {
filters[filterId] = translateToQuery(filters[filterId]);
});
}
recurse(agg.aggs || agg.aggregations);
});
}(flatData.body.aggs || flatData.body.aggregations));
return flatData;
});
}
}
return SearchSource;
}
|
//penggunaan barcode -----------------------------------
//sensus.filterRenderAfter : function(){
// barcodeSensus.loading();
// },
// declare jzebra di penatausahaan.php genToolbarAtas()
var BarcodeCls = function(params_){
this.params=params_;
this.onscan = 0;
this.name = '';//barcode';
this.kode = '';
//this.elinputname = this.name+'_input';
//this.elreadymsg = this.name+'_msg';
this.setInputReady = function(){
if(document.getElementById(this.elinputname)){
document.getElementById(this.elinputname).readOnly=false;
document.getElementById(this.elinputname).value='';
document.getElementById(this.elinputname).focus();
}
}
this.cekBarcode = function(){
var me = this;
//console.info('cek '+ me.onscan+' name:'+me.name);
//console.info('cek el'+ document.getElementById(this.elinputname));
if (this.onscan==0){
if (document.getElementById(this.elinputname)){
//cek focus
$("#"+this.elinputname).blur(function () {
document.getElementById(me.elreadymsg).innerHTML = //'Not Ready!';
"<a style='color:red;' href=\"javascript:"+me.name+".setInputReady()\">Not Ready! (click for ready)</a>";
});
$("#"+this.elinputname).focus(function () {
document.getElementById(me.elreadymsg).innerHTML = 'Ready';
});
//cek str length
var e = document.getElementById(this.elinputname);
var str = e.value;
//console.info('str.length '+ str.length);
if (str.length>=32){
//trigger input barcode to filter
//alert(str);
me.onscan = 1;
e.readOnly = true;
//console.info('request'+this.onscan);
this.kode = str;
//this.setInputReady();
//console.info('cek '+ me.onscan+' name:'+me.name);
this.execBarcode(); //Penatausaha.refreshList(true);
}
//console.info('cek '+ this.onscan);
}
}
}
this.execBarcode=function(){
//Penatausaha.refreshList(true);
}
this.loading = function(){
var me= this;
this.reset();
//cekinput barcode
/*setInterval(
function(){
if (this.onscan==0){
if (document.getElementById(this.elinputname)){
barcode.inputBarcode();
}
}
},1000
);
*/
//setInterval(function(){barcode.cekBarcode()},1000);
setInterval(function(){
eval(me.name+'.cekBarcode()')
},
1000
);
}
this.reset = function(){
if(document.getElementById(this.elinputname)){
this.onscan = 0;
document.getElementById(this.elinputname).readOnly=false;
document.getElementById(this.elinputname).focus();
document.getElementById(this.elreadymsg).innerHTML = 'Ready';
//console.info('succses'+this.onscan);
if (document.getElementById(this.elinputname)) {
document.getElementById(this.elinputname).value='';
}
}
}
this.printlabel = function(jmlcetak,jnslabel,nmbidang,nmopd,nmbiro,nmbarang,kode) {
//console.log('masuk');
var applet = document.jzebra;
//console.log(applet);
if (applet != null) {
//kode = '11 10 00 04 04 08 04 02 03 01 01 01 0001';
// 12 28 01 01 01 00 01 001 01 01 11 01 004 0002
// 12 28 01 01 01 00 01 001 03 11 01 01 001 0001
// KIB C 12280101010001001031101010010001
// kib A
kode1 = kode.substr(0,2)+'.'+ kode.substr(2,2)+'.'+ kode.substr(4,2)+'.'+
kode.substr(6,2)+'.'+kode.substr(8,2)+'.'+kode.substr(10,2)+'.'+
kode.substr(12,2)+'.'+
kode.substr(14,3);//'11.10.00.04.04.08.04';
kode2 =
' '+kode.substr(17,2)+'.'+ kode.substr(19,2)+'.'+ kode.substr(21,2)+'.'+
kode.substr(23,2)+'.'+kode.substr(25,3)+'.'+kode.substr(28,4);//' 02.03.01.01.01.0001';
//alert(jnslabel+' - '+kode1+' '+kode2);
for(var i=0;i<jmlcetak;i++){
switch(jnslabel){
case '1':
applet.append("^XA");
applet.append("^MMT");
applet.append("^PW799");
applet.append("^LL0400");
applet.append("^LS0");
applet.append("^FT20,170^A0N,28,26^FH\^FD"+nmopd+"^FS");
applet.append("^FT20,205^A0N,20,16^FH\^FD"+nmbiro+"^FS");
applet.append("^FT510,170^A0N,30,32^FH\^FD"+kode1+"^FS");
applet.append("^FT510,207^A0N,30,32^FH\^FD"+kode2+"^FS");
applet.append("^BY4,3,85^FT20,328^BCN,,N,N");
applet.append("^FD>;"+kode+"^FS");
applet.append("^FT20,369^A0N,26,20^FH\^FD"+nmbarang+"^FS");
applet.append("^PQ1,0,1,Y^XZ");
//applet.print();
break;
case '2':
applet.append("^XA");
applet.append("^MMT");
applet.append("^PR5");
applet.append("^PW718");
applet.append("^LL1200");
applet.append("^LS0");
applet.append("^FT410,60^A0R,56,55^FH\^FD"+nmopd+"^FS");
applet.append("^FT340,60^A0R,34,33^FH\^FD"+nmbiro+"^FS");
applet.append("^FT410,740^A0R,56,55^FH\^FD"+kode1+"^FS");
applet.append("^FT330,740^A0R,56,55^FH\^FD"+kode2+"^FS");
applet.append("^BY6,3,160^FT260,1200^BCB,,N,N");
applet.append("^FD>;"+kode+"^FS");
applet.append("^FT40,60^A0R,42,40^FH\^FD"+nmbarang+"^FS");
applet.append("^PQ1,0,1,Y^XZ");
//applet.print();
break;
case '3':
applet.append("^XA");
applet.append("^MMT");
applet.append("^PW719");
applet.append("^LL1600");
applet.append("^LS0");
applet.append("^FT350,30^A0R,68,67^FH\^FD"+nmopd+"^FS");
applet.append("^FT280,30^A0R,45,45^FH\^FD"+nmbiro+"^FS");
applet.append("^FT350,1092^A0R,56,55^FH\^FD"+kode1+"^FS");
applet.append("^FT280,1092^A0R,56,55^FH\^FD"+kode2+"^FS");
applet.append("^BY8,3,160^FT260,1545^BCB,,N,N");
applet.append("^FD>;"+kode+"^FS");
applet.append("^FT40,30^A0R,51,50^FH\^FD"+nmbarang+"^FS");
applet.append("^PQ1,0,1,Y^XZ");
//applet.print();
break;
case '4':
applet.append("^XA");
applet.append("^MMT");
applet.append("^PW480");
applet.append("^LL0300");
applet.append("^LS0");
applet.append("^FT14,118^A0N,20,19^FH\^FD"+nmopd+"^FS");
applet.append("^FT14,135^A0N,11,12^FH\^FD"+nmbiro+"^FS");
applet.append("^FT260,115^A0N,17,16^FH\^FD"+kode1+"^FS"); //21-320
applet.append("^FT260,135^A0N,17,16^FH\^FD"+kode2+"^FS"); //21-320
applet.append("^BY2,3,40^FT17,180^BCN,,N,N");
applet.append("^FD>;"+kode+"^FS");
applet.append("^FT14,195^A0N,14,14^FH\^FD"+nmbarang+"^FS");
applet.append("^PQ1,0,1,Y^XZ");
//applet.print();
break;
case '5':
applet.append("^XA");
applet.append("^MMT");
applet.append("^PW480");
applet.append("^LL0300");
applet.append("^LS0");
applet.append("^FT87,135^A0N,17,16^FH\^FD"+kode1+ kode2+"^FS");
applet.append("^BY2,3,40^FT92,180^BCN,,N,N");
applet.append("^FD>;"+kode+"^FS");
applet.append("^FT87,195^A0N,14,14^FH\^FD"+nmbiro+"^FS");
applet.append("^FT290,195^A0N,14,14^FH\^FD"+nmbarang+"^FS");
applet.append("^PQ1,0,1,Y^XZ");
//applet.print();
break;
}
}
applet.print();
//*/
}else{
alert('Java Aplet Gagal!');
}
}
/*
this.cetak_ = function(){ //tombol cetak
var me= this;
var jnslabel = document.getElementById('jnslabel').value;
var jmlcetak = document.getElementById('jmlcetak').value;
var err = '';
if(err=='' && jnslabel =='' ) err = 'Jenis Label Belum Dipilih'
if(err == ''){
document.body.style.overflow='hidden';
addCoverPage('coverpage',100);
$.ajax({
type:'POST',
url: 'pages.php?Pg=genxmlbar',
data:$('#adminForm').serialize()+'&jnslabel='+jnslabel+'&jmlcetak='+jmlcetak,
success: function(response) {
var resp = eval('(' + response + ')');
document.body.style.overflow='auto';
delElem('coverpage');
if(resp.err != ''){
alert(resp.err);
}else{
me.Close();
}
}
});
}else{
alert('Jenis Label Belum Dipilih!');
}
}
*/
this.cetaklabelcbx_ = function(cbno){
var cb = document.getElementById('cb'+cbno.toString());
if(cb.checked){
var kode = cb.getAttribute('kode');
var nmbarang = cb.getAttribute('nmbarang');
var nmbidang = cb.getAttribute('bidang');
var nmopd = cb.getAttribute('opd');
var nmseksi = cb.getAttribute('seksi');
//console.log//alert('kode='+kode+' barang='+nmbarang+' bidang='+nmbidang+' opd='+nmopd);
this.printlabel(jmlcetak,jnslabel,nmbidang,nmopd,nmbarang,kode)
}
}
this.cetak_ = function(){ //tombol cetak
var me= this;
var jnslabel = document.getElementById('jnslabel').value;
var jmlcetak = document.getElementById('jmlcetak').value;
var err = '';
var applet = document.qz;
// applet.findPrinter("printer barcode");
if(err=='' && jnslabel =='' ) err = 'Jenis Label Belum Dipilih!';
if(err=='' && applet == null) err = 'Java Applet Gagal!';
if(err == ''){
if(document.getElementById('jmPerHal')){
var jmPerHal = document.getElementById('jmPerHal').value;
}else{
var jmPerHal = 25;
}
for (var i=0;i<jmPerHal;i++){
//this.cetaklabelcbx_(i);
//*
var cb = document.getElementById('cb'+i.toString());
if (cb){
if(cb.checked){
var kode = cb.getAttribute('kode');
var nmbarang = cb.getAttribute('nmbarang');
var nmbidang = cb.getAttribute('bidang');
var nmopd = cb.getAttribute('opd');
var nmbiro = cb.getAttribute('biro');
var nmseksi = cb.getAttribute('seksi');
var nm_gedung = cb.getAttribute('nm_gedung');
var nm_ruang = cb.getAttribute('nm_ruang');
var thn_perolehan = cb.getAttribute('thn_perolehan');
var str = "SKPD : "+nmopd+",UNIT : "+nmbiro+",SUBUNIT : "+nmseksi+",GEDUNG : "+nm_gedung+",RUANG : "+nm_ruang+",KODE : "+kode+",NAMA BARANG : "+nmbarang+",THN PEROLEHAN : "+thn_perolehan;
var jml_str = str.length;
var sisa_str = 480-jml_str;
var i=0;
var space ='';
for (i = 0; i < sisa_str; i++) {
space+=' ';
}
//alert('text='+str_);
//console.log
// alert('kode='+kode+' barang='+nmbarang+' bidang='+nmbidang+' opd='+nmopd);
//this.printlabel(jmlcetak,jnslabel,nmbidang,nmopd,nmbarang,kode)
//--------------------------------
//console.log(applet);
//if (applet != null) {
//kode = '1110000404080402030101010001';
// 12 28 01 01 01 00 01 001 03 11 01 01 001 0001
kode1 = kode.substr(0,2)+'.'+ kode.substr(2,2)+'.'+ kode.substr(4,2)+'.'+
kode.substr(6,2)+'.'+kode.substr(8,2)+'.'+kode.substr(10,2)+'.'+
kode.substr(12,2)+'.'+
kode.substr(14,3);//'11.10.00.04.04.08.004';
kode2 =
' '+kode.substr(17,2)+'.'+ kode.substr(19,2)+'.'+ kode.substr(21,2)+'.'+
kode.substr(23,2)+'.'+kode.substr(25,3)+'.'+kode.substr(28,4);//' 02.03.01.01.01.0001';
//alert(jnslabel+' - '+kode1+' '+kode2);
//alert(jnslabel+' - '+kode1+' '+kode2);
nmgedang=nm_gedung+' - '+nm_ruang;
for(var j=0;j<jmlcetak;j++){
switch(jnslabel){
case '1': //9*5
/* applet.append("^XA");
applet.append("^MMT");
applet.append("^PW799");
applet.append("^LL0400");
applet.append("^LS0");
applet.append("^FT20,170^A0N,28,26^FH\^FD"+nmopd+"^FS");
applet.append("^FT20,205^A0N,20,16^FH\^FD"+nmseksi+"^FS");
applet.append("^FT510,170^A0N,30,32^FH\^FD"+kode1+"^FS");
applet.append("^FT510,207^A0N,30,32^FH\^FD"+kode2+"^FS");
applet.append("^BY4,3,85^FT20,328^BCN,,N,N");
applet.append("^FD>;"+kode+"^FS");
applet.append("^FT20,369^A0N,26,20^FH\^FD"+nmbarang+"^FS");
applet.append("^PQ1,0,1,Y^XZ");
*/
applet.append("^XA");
applet.append("^MMT");
applet.append("^PW799");
applet.append("^LL0400");
applet.append("^LS0");
applet.append("^FT15,190^A0N,28,26^FH\^FD"+nmopd+"^FS");
applet.append("^FT15,215^A0N,20,16^FH\^FD"+nmseksi+"^FS");
applet.append("^FT455,210^A0N,30,32^FH\^FD"+kode1+"^FS");
applet.append("^FT495,240^A0N,30,32^FH\^FD"+kode2+"^FS");
applet.append("^FT15,235^A0N,20,16^FH\^FD"+nmgedang+"^FS");
applet.append("^BY3,3,80^FT15,338^BCN,,N,N");
applet.append("^FD>;"+kode+"^FS");
applet.append("^FT15,375^A0N,26,20^FH\^FD"+nmbarang+"^FS");
applet.append("^PQ1,0,1,Y^XZ");
//applet.print();
break;
case '2':
applet.append("^XA");
applet.append("^MMT");
applet.append("^PR5");
applet.append("^PW718");
applet.append("^LL1200");
applet.append("^LS0");
applet.append("^FT390,40^A0R,56,55^FH\^FD"+nmopd+"^FS");
applet.append("^FT330,40^A0R,34,33^FH\^FD"+nmseksi+"^FS");
applet.append("^FT380,840^A0R,34,33^FH\^FD"+kode1+"^FS");
applet.append("^FT320,880^A0R,34,33^FH\^FD"+kode2+"^FS");
applet.append("^FT290,40^A0R,34,33^FH\^FD"+nmgedang+"^FS");
applet.append("^BY4,3,160^FT260,890^BCB,,N,N");
applet.append("^FD>;"+kode+"^FS");
applet.append("^FT40,40^A0R,42,40^FH\^FD"+nmbarang+"^FS");
applet.append("^PQ1,0,1,Y^XZ");
//applet.print();
break;
case '3':
/* applet.append("^XA");
applet.append("^MMT");
applet.append("^PW719");
applet.append("^LL1600");
applet.append("^LS0");
applet.append("^FT350,30^A0R,68,67^FH\^FD"+nmopd+"^FS");
applet.append("^FT280,30^A0R,45,45^FH\^FD"+nmseksi+"^FS");
applet.append("^FT350,1092^A0R,56,55^FH\^FD"+kode1+"^FS");
applet.append("^FT280,1092^A0R,56,55^FH\^FD"+kode2+"^FS");
applet.append("^BY8,3,160^FT260,1545^BCB,,N,N"); 1485
applet.append("^FD>;"+kode+"^FS");
applet.append("^FT40,30^A0R,51,50^FH\^FD"+nmbarang+"^FS");
applet.append("^PQ1,0,1,Y^XZ");
*/
applet.append("^XA");
applet.append("^MMT");
applet.append("^PW719");
applet.append("^LL1600");
applet.append("^LS0");
applet.append("^FT380,80^A0R,55,54^FH\^FD"+nmopd+"^FS");
applet.append("^FT330,80^A0R,35,35^FH\^FD"+nmseksi+"^FS");
applet.append("^FT380,1150^A0R,35,35^FH\^FD"+kode1+"^FS");
applet.append("^FT330,1190^A0R,35,35^FH\^FD"+kode2+"^FS");
applet.append("^FT280,80^A0R,35,35^FH\^FD"+nmgedang+"^FS");
applet.append("^BY4,3,160^FT260,925^BCB,,N,N");
applet.append("^FD>;"+kode+"^FS");
applet.append("^FT40,80^A0R,51,50^FH\^FD"+nmbarang+"^FS");
applet.append("^PQ1,0,1,Y^XZ");
//applet.print();
break;
case '4':
applet.append("^XA");
applet.append("^MMT");
applet.append("^PW480");
applet.append("^LL0300");
applet.append("^LS0");
applet.append("^FT14,118^A0N,20,19^FH\^FD"+nmopd+"^FS");
applet.append("^FT14,135^A0N,11,12^FH\^FD"+nmseksi+"^FS");
applet.append("^FT290,115^A0N,17,16^FH\^FD"+kode1+"^FS");
applet.append("^FT310,135^A0N,17,16^FH\^FD"+kode2+"^FS");
applet.append("^BY2,3,40^FT17,180^BCN,,N,N");
applet.append("^FD>;"+kode+"^FS");
applet.append("^FT14,195^A0N,14,14^FH\^FD"+nmbarang+"^FS");
applet.append("^PQ1,0,1,Y^XZ");
//applet.print();
break;
case '5':
applet.append("^XA");
applet.append("^MMT");
applet.append("^PW480");
applet.append("^LL0300");
applet.append("^LS0");
applet.append("^FT87,135^A0N,17,16^FH\^FD"+kode1+ kode2+"^FS");
applet.append("^BY2,3,40^FT92,180^BCN,,N,N");
applet.append("^FD>;"+kode+"^FS");
applet.append("^FT87,195^A0N,14,14^FH\^FD"+nmseksi+"^FS");
applet.append("^FT290,195^A0N,14,14^FH\^FD"+nmbarang+"^FS");
applet.append("^PQ1,0,1,Y^XZ");
//applet.print();
break;
case '6': //8*4
/*applet.append("^XA");
applet.append("^MMT");
applet.append("^PW799");
applet.append("^LL0400");
applet.append("^LS0");
applet.append("^FT50,165^A0N,28,26^FH\^FD"+nmopd+"^FS"); //FT kiri, atas
applet.append("^FT50,200^A0N,20,16^FH\^FD"+nmseksi+"^FS");
applet.append("^FT400,165^A0N,30,32^FH\^FD"+kode1+"^FS");
applet.append("^FT435,200^A0N,30,32^FH\^FD"+kode2+"^FS");
applet.append("^BY3,3,85^FT20,328^BCN,,N,N");
applet.append("^FD>;"+kode+"^FS");
applet.append("^FT20,369^A0N,26,20^FH\^FD"+nmbarang+"^FS");
applet.append("^PQ1,0,1,Y^XZ");*/
applet.append("^XA"); //start new label format
applet.append("^MMT"); //print mode T (tear-off))
//applet.append("^PW480");
applet.append("^PW580"); //print width
applet.append("^LL0300"); //label length?
applet.append("^LS0"); //label shift
//applet.append("^FT14,118^A0N,20,19^FH\^FD"+nmopd+"^FS");//FT kiri, atas
//applet.append("^FT14,135^A0N,11,12^FH\^FD"+nmseksi+"^FS");
//applet.append("^FT290,115^A0N,17,16^FH\^FD"+kode1+"^FS");
//applet.append("^FT310,135^A0N,17,16^FH\^FD"+kode2+"^FS");
applet.append("^FT-5,160^A0N,20,19^FH\^FD"+nmopd+"^FS");//FT kiri, atas ,
applet.append("^FT5,180^A0N,15,14^FH\^FD"+nmseksi+"^FS");
applet.append("^FT405,160^A0N,17,16^FH\^FD"+kode1+"^FS");
applet.append("^FT425,180^A0N,17,16^FH\^FD"+kode2+"^FS");
applet.append("^FT5,200^A0N,15,14^FH\^FD"+nmgedang+"^FS");
//applet.append("^BY2,3,70^FT25,250^BCN,,N,N"); //BY width, ratio, height barcode
//applet.append("^BY2,3,40^FT92,180^BCN,,N,N");
applet.append("^BY2,3,40^FT5,250^BCN,,N,N");
applet.append("^FD>;"+kode+"^FS");
applet.append("^FT5,280^A0N,14,14^FH\^FD"+nmbarang+"^FS");
applet.append("^PQ1,0,1,Y^XZ");
break;
/*case '7' :
applet.append("^XA");
applet.append("^MMT");
applet.append("^PW799"); //print width
applet.append("^LL0900"); //label length?
applet.append("^FO170,47");
applet.append("^GFA,3173,3173,19,S0QFE,P03VF8,O03XFC,N0gGFE,L01MFC001981DOF,K03KFC06C42D9DBDC3DMF,K0JFC4692563C9D7CE9C937KF,J01IFB926D2772C9CF8E9CD36CJF,J01FE3B92692770C1CF8E98DBI67FF,K0F17B92685372E5C78E38CB67643F,K0FAF18268C372F1C7863A48C7359F,K0FAF18269D37371D3263860C735DF,J01F9F19269BB7319D9769260C311FF8,J01F9E59A6998309D8070976493419F8,J01F8EC9218BOFC224B3459F8,J01F86C07UFD13659F8,J01FB0C3XF0649F8,J01F11gHFE1F8,J01MFEB8O07BMF8,J01LFV07KF8,J01JF8X01JF8,J01IF8J0EO018K0IF8,J01FFK03EK06I074L07F8,J01FK06FCK0EI0463L0F8,J01FJ01EF8J01EI0CFF8K0F8,J01FJ01DEK03EI05E1L0F8,J01FJ03D8K07CI04E188J0F8,J01FJ03818J07CI07DFFEJ0F8,J01FJ03878J07CI018F82J0F8,J01FJ038FK0FCJ0CF02J0F8,J01FI0219EK0FCJ07F36J0F8,J01FI03198K0FCK0F3DEI0F8,J01FI0398L0FCK02783I0F8,J01FI03884K0FCK01F83I0F8,J01FI03C1CK0FCL0732I0F8,J01FI01C38K0FCL023EI0F8,J01F0019E38K0FCL033F800F8,J01F001CC2L0FCL01E7600F8,J01F001EC6CK0FCM0E0600F8,J01F001E458K0FCM0C8C00F8,J01F001F838K0FCL010FC00F8,J01FI0F878K0FCM08FC00F8,J01FI07CF8K0FCM0CFC00F8,J01F00C397L0FCM07B800F8,J01F00E194L0F8L01F1800F8,J01F0070918K0F8L0301C00F8,J01F0078B3808I0F8L0218600F8,J01F007C27808I0F8L0330600F8,J01F003E0F808I0F8L01FCC00F8,J01F001E4F008I0F8L01E7800F8,J01F00424E608I0F8L03C3I0F8,J01F007845C08I0F8L0C01I0F8,J01F003C21C08I0F8L0C01C00F8,J01F001F23C08I0F8L0610600F8,J01F001F83C0CI0F8L06F0600F8,J01FI0793808I0F8K01F10400F8,J01F001983088I0F8K0330E80078,J01F021E423CCI0F8K0200FI078,J01F010F0278CI0FI04006007I078,J01F008F82F84I0FI0E00200180078,J01F004790F34I0F0071001FC180078,J01FI07E8E76007FE001809383I078,J01F0023E8CF200FFE02083E186I078,J01F0030340F3I0F80208601FCI078,J01F0013C41F1I0F00318401F8I078,J01FI0FF21CD800FI0E06001J078,J01FI0DF819C800FI09F7F81J078,J01FI04F81BC800F00491CF83J078,J01FI027E93CC00F006900786J078,J01FI020047C800F00A1007B8J078,J01FI031FA78800FC41B007FK078,J01FI011FE71800FE00BFC7EK078,J01FI010FFE1I0FF003F81CK078,J01FI0183EE1I0FE20BF81L078,J01FJ081FE1I0781F3F8601J078,J01FJ0C00F9L0A3F8C3FJ078,J01FJ071IFL081FF801J078,J01FJ03FC03K0103FF002J078,J01FN01CJ010E7808K078,J01FO07J027808003J078,J01FO03CI03C0FC06K078,J01FP0F803F158429CJ078,J01FP03F3F802078L078,J01FO07JF00303M078,J01FO03JFEI04M078,J01FO03F81FE00F8M078,J01FO02J04Q078,J01FgL078,J01F03F87F03F83F83F81FC1FC1FC078,J01F07F87F03F83F83F81FC1FC1FC078,:J01F3gJF878,::::J01FgL078,J01FI0EC00EC007C003E003E007F078,J01F1FFCFFECOF7FFDJF078,J01FI0FC00FC0278003C001A001C078,J01F1FF03FE81FF87FF83FFE7FFE3078,J01FI0FC007C003C003E183C081C078,J01F0FFCF7ECFFDIFDFF67FFE7FF078,J01F0387C387C383838387E007EI078,K0F1FFC7FEC7FFEIFE7FFE7FFE7878,K0F078007800380038003E003EI07,K0FgL07,K0F030040040900C0402004098030F8,K0F9A02C06C0D06C243206C0D01A0F,K0F8E018038060381C1C0380700C0F,K0F9E0380780E0783C1C0780F01C0F,I07FF8gK0F,007IFCgK0F,01JFC0201200204C2212K04I01IF8,03JFC36012016068161A02406C0D81IFE,03JFC1C00E00C0301C0E03C0380781JF,07FFBFE1C01C00C0781C1C0180380303JF8,07FF9FE1C01C01CI01C1C03C0380F03FBFFC,07FF1FFgJ03F3FFC,1FD84FFS01P03F0FFC,3FC0E7FK0804C0C80900903301207FE3FC,7FE647F84C0480280780F00F01E00E07FF8FF8FFE70FF8280300180700600700E00E0FC007F8MF8380700300700E00201E01C0F81IF8MFC3gG01FA3IF8IF800FEP0198O03FFC3FF8IFD91FEJ013006C0D01900100883IF3FF8JFD3FF02600A00280F00F00900D07C077FF87IFC7BF01C00E00380E00600E00707E00IF87IF0F9F81C01E00300E00E00E0070FF24IF87FBF9F8FC3CT08I01FF8JF83C1F9F0FEg01FFCJF83C0FFC9FET0D801303E363F9F83C07E19DF00C8013J0D807800A07CE67F0781C07F398FC07001A02407007I0E07DC0FE0781C03FBB3FE07I0E02C0700F001E0F9F9FE0780C01FF87FF07I0C0180FM01F9FDFC07,0400FF180F8L038O03ECFBF807,J0FF31F7EI08P0100FCE33F002,J07FF3F3F0078P0B01FA707E002,J03FF7F3FC038P0607FF3FFC,J01FF3D6FF0700481301B00E1FC7BFFC,K0FFBCE7FC500780E00E00A3F800FF8,K07FC861FFI0300E006I0FFE407F,K03FE38EFF800701E01E007IF7FFE,K01IF803FFP01FF1F9FFC,L0IF0FBFFCO0IF87C7F8,L07FC6FFDFFN07FF3A3CFF,L03FE6FF9FFCL0BFFC780FFE,M0FFCFE1IFEJ0IFC738C7F8,M07FC7CBE1NFC0FBBDFF,M03FF309F0NF0CF99FFE,N0FF821F7LF87CE7D9FF8,N07FF79E7KFC23CE3DIF,N01IF1EFFC040773EF31FFC,O07FF9CFFEE67737E787FF8,O03IF0FFEE66F07B7JF,P0IFC27C0E0FB3C7IFC,P03IF8FC7E7F984JF,Q0KFCFE7B8KFC,Q01JF87C037JFE,R07SF,S0RFC,S01PFC,U0NFE,V05KFC,,^FS");
applet.append("^FT115,247^A0N,25,25^FH\^FDBARANG MILIK DAERAH^FS");
applet.append("^FT175,277^A0N,25,25^FH\^FDPEMERINTAH^FS");
applet.append("^FT115,307^A0N,25,25^FH\^FDKABUPATEN KARAWANG^FS");
applet.append("^FO475,53");
applet.append("^BQN,2,4");
//applet.append("^FH_^FDMM,Aabcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi ^FS");
applet.append("^FH_^FDMM,ASKPD : "+nmopd+",B0002_0d_0a,AUNIT : "+nmbiro+",B0002_0d_0a,ASUBUNIT : "+nmseksi+",B0002_0d_0a,AGEDUNG : "+nm_gedung+",B0002_0d_0a,ARUANG : "+nm_ruang+",B0002_0d_0a,AKODE : "+kode+",B0002_0d_0a,ANAMA BARANG : "+nmbarang+",B0002_0d_0a,ATHN PEROLEHAN : "+thn_perolehan+""+space+"^FS");
applet.append("^BY2,3,40^FT30,357^BCN,,N,N");
applet.append("^FD>;"+kode+"^FS");
applet.append("^FT30,377^A0N,15,15^FH\^FD"+nmbarang+"^FS");
//applet.append("^FT235,350^A0N,15,15^FH\^FD"+kode+"^FS");
applet.append("^PQ1,0,1,Y^XZ");
applet.append("^XZ");
break;
*/
case '7' :
applet.append("^XA");
applet.append("^MMT");
//applet.append("^PW580"); //print width
//applet.append("^LL0300"); //label length?
//applet.append("^LS0"); //label shift
applet.append("^FO450,50");
applet.append("^BQN,2,5");
applet.append("^FH_^FDMM,ASKPD : "+nmopd+",B0002_0d_0a,AUNIT : "+nmbiro+",B0002_0d_0a,ASUBUNIT : "+nmseksi+",B0002_0d_0a,AGEDUNG : "+nm_gedung+",B0002_0d_0a,ARUANG : "+nm_ruang+",B0002_0d_0a,AKODE : "+kode+",B0002_0d_0a,ANAMA BARANG : "+nmbarang+",B0002_0d_0a,ATHN PEROLEHAN : "+thn_perolehan+""+space+"^FS");
applet.append("^XZ");
break;
}
/*case '8' :
applet.append("^XA");
applet.append("^MMT");
applet.append("^PW799"); //print width
applet.append("^LL0900"); //label length?
applet.append("^FO470,53");
applet.append("^BQN,2,4");
//applet.append("^FH_^FDMM,Aabcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi abcdefghi ^FS");
applet.append("^FH_^FDMM,ASKPD : "+nmopd+",B0002_0d_0a,AUNIT : "+nmbiro+",B0002_0d_0a,ASUBUNIT : "+nmseksi+",B0002_0d_0a,AGEDUNG : "+nm_gedung+",B0002_0d_0a,ARUANG : "+nm_ruang+",B0002_0d_0a,AKODE : "+kode+",B0002_0d_0a,ANAMA BARANG : "+nmbarang+",B0002_0d_0a,ATHN PEROLEHAN : "+thn_perolehan+""+space+"^FS");
applet.append("^BY2,3,40^FT25,357^BCN,,N,N");
applet.append("^FD>;"+kode+"^FS");
applet.append("^FT25,377^A0N,15,15^FH\^FD"+nmbarang+"^FS");
//applet.append("^FT235,350^A0N,15,15^FH\^FD"+kode+"^FS");
applet.append("^PQ1,0,1,Y^XZ");
applet.append("^XZ");
break;
}*/
case '8' :
applet.append("^XA");
applet.append("^MMT");
//applet.append("^PW580"); //print width
//applet.append("^LL0300"); //label length?
//applet.append("^LS0"); //label shift
applet.append("^FO450,50");
applet.append("^BQN,2,5");
applet.append("^FH_^FDMM,ASKPD : "+nmopd+",B0002_0d_0a,AUNIT : "+nmbiro+",B0002_0d_0a,ASUBUNIT : "+nmseksi+",B0002_0d_0a,AGEDUNG : "+nm_gedung+",B0002_0d_0a,ARUANG : "+nm_ruang+",B0002_0d_0a,AKODE : "+kode+",B0002_0d_0a,ANAMA BARANG : "+nmbarang+",B0002_0d_0a,ATHN PEROLEHAN : "+thn_perolehan+""+space+"^FS");
applet.append("^XZ");
break;
}
}
//applet.print();
//*/
//}else{
// alert('Java Aplet Gagal!');
//}
//--------------------------------------
}
//*/
}
}
//alert(nmbiro);
applet.print();
this.Close();
}else{
//alert('Jenis Label Belum Dipilih!');
alert(err);
}
}
this.cetak = function(){
//this.setFormCetak();
if (adminForm.boxchecked.value >0 ){
if(confirm('Yakin '+adminForm.boxchecked.value+' barcode akan di cetak?')){
this.setFormCetak();
}
}
}
this.Close= function(){
delElem('barcode_formCetakCover');
}
this.setFormCetak= function(){
var form_judul = 'Cetak Label Barcode';
var form_width = '400';
var form_height = '150';
var cover ='barcode_formCetakCover';
//document.body.style.overflow='hidden';
addCoverPage2(cover,999,true,false);
var form_menu =
"<div style='padding: 0 8 9 8;height:22; '>"+
"<div style='float:right;'>"+
"<input type='button' value='Cetak' onclick='barcode.cetak_()'>"+
"<input type='button' value='Batal' onclick='barcode.Close()'>"+
"<input type='hidden' id='Sensus_idplh' name='Sensus_idplh' value='109'><input type='hidden' id='Sensus_fmST' name='Sensus_fmST' value='1'>"+
"<input type='hidden' id='sesi' name='sesi' value=''>"+
"</div>"+
"</div>";
var content =
"<div id='Sensus_form_div' style='margin:9 8 8 8; overflow:auto; border:1px solid #E5E5E5;width:"+(form_width-20)+";height:"+(form_height-80)+";'>"+
"<table style='width:100%' class='tblform'><tr><td style='padding:4'>"+
"<table style='width:100%:height:100%'>"+
"<tr>"+
"<td style='width:100'>Jenis Label</td>"+
"<td style='width:10'>:</td>"+
"<td>"+
"<select name='jnslabel' id='jnslabel'>"+
"<option value=''>Pilih</option>"+
"<option selected value='1'>Label 1 (9 x 5 cm)</option>"+
"<option value='2'>Label 2 (16 x 9 cm)</option>"+
"<option value='3'>Label 3 (20 x 9 cm)</option>"+
"<option value='4'>Label 4 (6 x 2,6 cm)</option>"+
"<option value='5'>Label 5 (6 x 1,38 cm)</option>"+
"<option value='6'>Label 6 (8 x 4 cm)</option>"+
"<option value='7'>Label 7 (QR code)</option>"+
"<option value='8'>Label 8 (QR code)No Logo</option>"+
"</select>"+
"</td>"+
"</tr>"+
"<tr>"+
"<td style='width:100'>Jumlah Cetak</td>"+
"<td style='width:10'>:</td>"+
"<td><input type='text' id='jmlcetak' name='jmlcetak' style='width:100;' value=1></td>"+
"</tr>"+
"</table>"+
"</td></tr></table>"+
"</div>";
document.getElementById(cover).innerHTML=
"<table width='100%' height='100%'><tbody><tr><td align='center'>"+
//"rtera"+
"<div id='div_border' style='width:"+form_width+";height:"+form_height+"; background-color:white; border-color: rgba(0, 0, 0, 0.3); border-style: solid; border-width:1; box-shadow: 6px 6px 5px rgba(0, 0, 0, 0.3);'>"+
"<table class='' width='100%' cellspacing='0' cellpadding='0' border='0'><tbody><tr><td style='padding:0'>"+
"<div class='menuBar2' style='height:20'>"+
"<span style='cursor:default;position:relative;left:6;top:2;color:White;font-size:12;font-weight:bold'>"+form_judul+"</span>"+
"</div>"+
"</td></tr></tbody></table>"+
content+
form_menu+
"</div>"+
"</td></tr>"+
"</table>";
}
this.initial = function(){
//change param default
for (var name in this.params) {
eval( 'if(this.params.'+name+' != null) this.'+name+'= this.params.'+name+'; ');
}
this.elinputname = this.name+'_input';
this.elreadymsg = this.name+'_msg';
}
this.initial();
}
var barcode = new BarcodeCls({
name:'barcode',
execBarcode : function(){
Penatausaha.refreshList(true);
}
});
var barcodeSensus = new BarcodeCls({
name:'barcodeSensus',
execBarcode : function(){
//alert('tes');
Sensus.refreshList(true);
//this.reset();
/*var me = this;
var kode = this.kode;
var cover = 'coverinsertbarcode';
addCoverPage(cover,100);
$.ajax({
type:'POST',
url: 'pages.php?Pg=sensus&tipe=insertsensus&kode='+kode,
data:$('#Sensus_form').serialize(),
success: function(response) {
var resp = eval('(' + response + ')');
delElem('coverinsertbarcode');
if(resp.err != ''){
}else{
}
me.reset();
Sensus.refreshList(true);
}
});*/
}
});
var barcodeSensusBaru = new BarcodeCls({
name : 'barcodeSensusBaru',
execBarcode : function(){
var me = this;
var kode = this.kode;
var cover = 'coverinsertbarcode';
addCoverPage(cover,100);
$.ajax({
type:'POST',
url: 'pages.php?Pg=sensustmp&tipe=insertsensus&kode='+kode,
data:$('#Sensus_form').serialize(),
success: function(response) {
var resp = eval('(' + response + ')');
delElem('coverinsertbarcode');
if(resp.err != ''){
}else{
}
me.reset();
SensusTmp.refreshList(true);
}
});
}
});
var barcodeCariBarang = new BarcodeCls({
name:'barcodeCariBarang',
execBarcode : function(){
Penatausaha.refreshList(true);
}
});
barcodeCariBarang.loading();
var barcodeUsulanHapusBA = new BarcodeCls({
name:'barcodeUsulanHapusBA',
execBarcode : function(){
UsulanHapusbadetail.refreshList(true);
}
});
barcodeUsulanHapusBA.loading();
|
(window["aioseopjsonp"]=window["aioseopjsonp"]||[]).push([["settings-WebmasterTools-vue"],{c1c8:function(t,i,e){},e57a:function(t,i,e){"use strict";e("c1c8")},ead6:function(t,i,e){"use strict";e.r(i);var s=function(){var t=this,i=t.$createElement,e=t._self._c||i;return e("div",{staticClass:"aioseo-webmaster-tools"},[e("core-card",{attrs:{slug:"webmasterTools","header-text":t.strings.webmasterToolsVerification}},[e("div",{staticClass:"webmaster-tools-description"},[t._v(" Enter your verification codes below to activate webmaster tools. ")]),e("grid-row",{staticClass:"webmaster-tools-toggles"},[t._l(t.tools,(function(i,s){return e("grid-column",{key:"toggle_"+s,staticClass:"tool-toggle",style:{order:t.getOrder(i)},attrs:{sm:"6",md:"4",lg:"3"}},[e("div",{class:[{active:i.slug===t.activeTool},{connected:t.isConnected(i)}],on:{click:function(e){return t.toggleActiveTool(i.slug)}}},[e(i.svg,{tag:"component",staticClass:"logo-svg"}),e("div",{domProps:{innerHTML:t._s(i.name)}}),t.isConnected(i)?e("svg-circle-check-solid"):t._e()],1)])})),t._l(t.tools,(function(i,s){return e("transition-slide",{key:"content_"+s,staticClass:"tool-settings-slide",style:{order:t.getOrder(i,!0)},attrs:{active:i.slug===t.activeTool},on:{"open-start":function(i){t.heightOkay=t.activeTool},"close-end":function(i){t.heightOkay=t.activeTool}}},[e("grid-column",{staticClass:"tool-settings"},["googleAnalytics"!==i.slug||t.notGaActivated&&t.showMiPromo&&!t.gaDeprecated?[t._l(i.settings,(function(s,o){return[t.heightOkay===i.slug&&t.shouldDisplaySetting(s)?e("div",{key:o},[e("core-settings-row",{attrs:{noSideMargin:"","align-small":""},scopedSlots:t._u([{key:"name",fn:function(){return[t._v(" "+t._s(s.label)+" ")]},proxy:!0},{key:"content",fn:function(){return[e("div",{staticClass:"d-flex"},[s.parent?t._e():[e("base-input",{attrs:{size:"small"},on:{blur:function(i){return t.maybeUpdateId(s.option)}},model:{value:t.options.webmasterTools[s.option],callback:function(i){t.$set(t.options.webmasterTools,s.option,i)},expression:"options.webmasterTools[setting.option]"}})],!s.parent||s.pro&&t.isUnlicensed?t._e():["input"!==s.type&&s.type?t._e():e("base-input",{attrs:{size:"small",placeholder:s.placeholder,disabled:t.isUnlicensed&&s.pro},model:{value:t.options.deprecated.webmasterTools[s.parent][s.option],callback:function(i){t.$set(t.options.deprecated.webmasterTools[s.parent],s.option,i)},expression:"options.deprecated.webmasterTools[setting.parent][setting.option]"}}),"toggle"===s.type?e("base-toggle",{attrs:{disabled:t.isUnlicensed&&s.pro},model:{value:t.options.deprecated.webmasterTools[s.parent][s.option],callback:function(i){t.$set(t.options.deprecated.webmasterTools[s.parent],s.option,i)},expression:"options.deprecated.webmasterTools[setting.parent][setting.option]"}}):t._e(),"radio-toggle"===s.type?e("base-radio-toggle",{attrs:{name:s.option,options:s.options,disabled:t.isUnlicensed&&s.pro},model:{value:t.options.deprecated.webmasterTools[s.parent][s.option],callback:function(i){t.$set(t.options.deprecated.webmasterTools[s.parent],s.option,i)},expression:"options.deprecated.webmasterTools[setting.parent][setting.option]"}}):t._e(),"textarea"===s.type?e("base-textarea",{attrs:{"min-height":100,disabled:t.isUnlicensed&&s.pro},model:{value:t.options.deprecated.webmasterTools[s.parent][s.option],callback:function(i){t.$set(t.options.deprecated.webmasterTools[s.parent],s.option,i)},expression:"options.deprecated.webmasterTools[setting.parent][setting.option]"}}):t._e(),"multicheck"===s.type?e("grid-row",t._l(s.options,(function(i,o){return e("grid-column",{key:o,attrs:{md:"4"}},[e("base-checkbox",{attrs:{size:"medium",value:t.getValue(s,i)},on:{input:function(e){return t.updateValue(e,s,i)}}},[t._v(" "+t._s(i.label)+" ")])],1)})),1):t._e()]],2),e("p",{staticClass:"aioseo-description",domProps:{innerHTML:t._s(s.description)}}),e("br"),s.showMiPromo&&t.showMiPromo?e("core-alert",{attrs:{type:"blue"}},[t.prefersEm?e("div",{domProps:{innerHTML:t._s(t.emPromo)}}):e("div",{domProps:{innerHTML:t._s(t.miPromo)}}),e("br"),t.$aioseo.plugins.miLite.canInstall?t._e():e("base-button",{attrs:{type:"blue",size:"medium",tag:"a",target:"_blank",href:t.$aioseo.plugins.miLite.wpLink}},[e("svg-external"),t._v(" "+t._s(t.strings.installMi)+" ")],1),t.$aioseo.plugins.miLite.canInstall?e("base-button",{attrs:{loading:t.installingPlugin,type:t.miInstalled?"green":"blue",size:"medium"},on:{click:t.installMi}},[t.miInstalled?e("span",[t._v(t._s(t.strings.miInstalled))]):t._e(),t.miInstalled?t._e():e("span",[t._v(t._s(t.strings.installMi))])]):t._e()],1):t._e()]},proxy:!0}],null,!0)})],1):t._e()]}))]:t._e(),"googleAnalytics"!==i.slug||!t.gaActivated&&t.showMiPromo&&!t.gaDeprecated?t._e():[e("div",{staticClass:"mi-alert"},[e("core-alert",{attrs:{type:"blue"}},[t.$aioseo.plugins.miLite.activated||t.$aioseo.plugins.miPro.activated?e("div",[t._v(t._s(t.strings.miHandlesGa))]):t._e(),t.$aioseo.plugins.emLite.activated||t.$aioseo.plugins.emPro.activated?e("div",[t._v(t._s(t.strings.emHandlesGa))]):t._e(),t.gaDeprecated&&!t.gaActivated&&t.prefersEm?e("div",{domProps:{innerHTML:t._s(t.emPromo)}}):t._e(),!t.gaDeprecated||t.gaActivated||t.prefersEm?t._e():e("div",{domProps:{innerHTML:t._s(t.miPromo)}}),e("br"),e("base-button",{attrs:{type:"blue",size:"medium",tag:"a",href:t.$aioseo.urls.aio.monsterinsights}},[t.gaActivated||!t.showMiPromo?[t._v(" "+t._s(t.strings.manageGa)+" ")]:[t._v(" "+t._s(t.strings.startGa)+" ")]],2)],1)],1)]],2)],1)}))],2),e("grid-row",{staticClass:"webmaster-tools-spacer"},[e("grid-column",[e("div")])],1),e("core-settings-row",{attrs:{name:t.strings.miscellaneousVerification,align:""},scopedSlots:t._u([{key:"content",fn:function(){return[e("core-alert-unfiltered-html"),e("base-editor",{attrs:{disabled:!t.$aioseo.user.unfilteredHtml,"line-numbers":"",monospace:""},model:{value:t.options.webmasterTools.miscellaneousVerification,callback:function(i){t.$set(t.options.webmasterTools,"miscellaneousVerification",i)},expression:"options.webmasterTools.miscellaneousVerification"}}),e("p",{staticClass:"aioseo-description",domProps:{innerHTML:t._s(t.strings.miscellaneousVerificationDescription)}})]},proxy:!0}])})],1)],1)},o=[],n=e("5530"),a=(e("caad"),e("2532"),e("d81d"),e("b64b"),e("c740"),e("2ca0"),e("ac1f"),e("5319"),e("159b"),e("2f62")),l=e("9c0e"),r={mixins:[l["h"]],data:function(){return{showMiPromo:!0,installingPlugin:!1,miInstalled:!1,heightOkay:!1,activeTool:null,columnsPerRow:4,strings:{miscellaneousVerification:this.$t.__("Miscellaneous Verification",this.$td),miscellaneousVerificationDescription:this.$t.sprintf(this.$t.__("The code above will be added between the %1$s tags on every page on your website.",this.$td),"<em><head> </head></em>"),webmasterToolsVerification:this.$t.__("Webmaster Tools Verification",this.$td),miLink:this.$t.sprintf("<strong>%1$s</strong>",this.$t.__("Click here",this.$td)),installMi:this.$t.sprintf(this.$t.__("Install %1$s",this.$td),"MonsterInsights"),miInstalled:this.$t.__("Success!",this.$td),miHandlesGa:this.$t.sprintf(this.$t.__("Google Analytics is now handled by %1$s.",this.$td),"MonsterInsights"),emHandlesGa:this.$t.sprintf(this.$t.__("Google Analytics is now handled by %1$s.",this.$td),"ExactMetrics"),manageGa:this.$t.__("Manage Google Analytics",this.$td),startGa:this.$t.__("Get Started",this.$td),unfilteredHtmlError:this.$t.sprintf(this.$t.__("Your user account role does not have access to edit this field. %1$s",this.$td),this.$links.getDocLink(this.$constants.GLOBAL_STRINGS.learnMore,"unfilteredHtml",!0))}}},computed:Object(n["a"])(Object(n["a"])(Object(n["a"])({},Object(a["c"])(["isUnlicensed"])),Object(a["e"])(["options","internalOptions"])),{},{miPromo:function(){return this.$t.sprintf(this.$t.__("We recommend using the %1$sFree MonsterInsights%2$s plugin to get the most out of Google Analytics.",this.$td),"<strong>","</strong>")},emPromo:function(){return this.$t.sprintf(this.$t.__("We recommend using the %1$sFree ExactMetrics%2$s plugin to get the most out of Google Analytics.",this.$td),"<strong>","</strong>")},notGaActivated:function(){return!this.$aioseo.plugins.miLite.activated&&!this.$aioseo.plugins.emLite.activated&&!this.$aioseo.plugins.miPro.activated&&!this.$aioseo.plugins.emPro.activated},gaActivated:function(){return this.$aioseo.plugins.miLite.activated||this.$aioseo.plugins.emLite.activated||this.$aioseo.plugins.miPro.activated||this.$aioseo.plugins.emPro.activated},gaDeprecated:function(){return!this.$aioseo.internalOptions.internal.deprecatedOptions.includes("googleAnalytics")&&!this.$aioseo.options.deprecated.webmasterTools.googleAnalytics.id&&!this.$aioseo.options.deprecated.webmasterTools.googleAnalytics.gtmContainerId},prefersEm:function(){return(this.$aioseo.plugins.emLite.installed||this.$aioseo.plugins.emPro.installed)&&!this.$aioseo.plugins.miLite.installed&&!this.$aioseo.plugins.miPro.installed},tools:function(){var t=this;return[{slug:"googleSearchConsole",name:this.$t.__("Google Search Console",this.$td),svg:"svg-logo-google",settings:[{option:"google",label:this.$t.__("Google Verification Code",this.$td),description:this.$t.sprintf(this.$t.__("Get your Google verification code in %1$s.",this.$td),this.$links.getDocLink(this.$t.__("Google Search Console",this.$td),"googleSearchConsole"))}]},{slug:"bing",name:this.$t.__("Bing Webmaster Tools",this.$td),svg:"svg-logo-microsoft-bing",settings:[{option:"bing",label:this.$t.__("Bing Verification Code",this.$td),description:this.$t.sprintf(this.$t.__("Get your Bing verification code in %1$s.",this.$td),this.$links.getDocLink(this.$t.__("Bing Webmaster Tools",this.$td),"bingWebmasterVerification"))}]},{slug:"yandex",name:this.$t.__("Yandex Webmaster Tools",this.$td),svg:"svg-logo-yandex",settings:[{option:"yandex",label:this.$t.__("Yandex Verification Code",this.$td),description:this.$t.sprintf(this.$t.__("Get your Yandex verification code in %1$s.",this.$td),this.$links.getDocLink(this.$t.__("Yandex Webmaster Tools",this.$td),"yandexWebmasterVerification"))}]},{slug:"baidu",name:this.$t.__("Baidu Webmaster Tools",this.$td),svg:"svg-logo-baidu",settings:[{option:"baidu",label:this.$t.__("Baidu Verification Code",this.$td),description:this.$t.sprintf(this.$t.__("Get your Baidu verification code in %1$s.",this.$td),this.$links.getDocLink(this.$t.__("Baidu Webmaster Tools",this.$td),"baiduWebmasterVerification"))}]},{slug:"pinterest",name:this.$t.__("Pinterest Site Verification",this.$td),svg:"svg-logo-pinterest",settings:[{option:"pinterest",label:this.$t.__("Pinterest Verification Code",this.$td),description:this.$t.sprintf(this.$t.__("Get your Pinterest verification code in your %1$s.",this.$td),this.$links.getDocLink(this.$t.__("Pinterest account",this.$td),"pinterestSiteVerification"))}]},{slug:"googleAnalytics",name:this.$t.__("Google Analytics",this.$td),svg:"svg-logo-google-analytics",settings:[{parent:"googleAnalytics",option:"id",placeholder:"UA-XXXXXXXX-X",label:this.$t.__("Google Analytics ID",this.$td),description:this.$t.sprintf(this.$t.__("Get your Google Analytics ID in your %1$s.",this.$td),this.$links.getDocLink(this.$t.__("Google Analytics account",this.$td),"googleAnalytics")),showMiPromo:!0},{parent:"googleAnalytics",option:"advanced",label:this.$t.__("Enable Advanced Analytics Options",this.$td),type:"toggle",displayIf:["id"],description:this.$t.sprintf(this.$t.__("This enables Advanced Google Analytics options.%1$s%2$s",this.$td),"<br>",this.$links.getDocLink(this.$constants.GLOBAL_STRINGS.learnMore,"advancedGoogleAnalytics",!0))},{parent:"googleAnalytics",option:"trackingDomain",label:this.$t.__("Tracking Domain",this.$td),displayIf:["id","advanced"],description:this.$t.sprintf(this.$t.__("Enter your domain name without the %1$s to set your cookie domain.%2$s%3$s",this.$td),"http://","<br>",this.$links.getDocLink(this.$constants.GLOBAL_STRINGS.learnMore,"trackingDomain",!0))},{parent:"googleAnalytics",option:"multipleDomains",label:this.$t.__("Track Multiple Domains",this.$td),type:"radio-toggle",options:[{label:this.$constants.GLOBAL_STRINGS.no,value:!1,activeClass:"dark"},{label:this.$constants.GLOBAL_STRINGS.yes,value:!0}],displayIf:["id","advanced"],description:this.$t.sprintf(this.$t.__("Use this option to enable tracking of multiple or additional domains.%1$s%2$s",this.$td),"<br>",this.$links.getDocLink(this.$constants.GLOBAL_STRINGS.learnMore,"trackMultipleDomains",!0))},{parent:"googleAnalytics",option:"additionalDomains",label:this.$t.__("Additional Domains",this.$td),type:"textarea",displayIf:["id","advanced","multipleDomains"],description:this.$t.sprintf(this.$t.__("Add a list of additional domains to track here. Enter one domain name per line without the http://.%1$s%2$s",this.$td),"<br>",this.$links.getDocLink(this.$constants.GLOBAL_STRINGS.learnMore,"additionalDomains",!0))},{parent:"googleAnalytics",option:"anonymizeIp",label:this.$t.__("Anonymize IP Addresses",this.$td),type:"radio-toggle",options:[{label:this.$constants.GLOBAL_STRINGS.no,value:!1,activeClass:"dark"},{label:this.$constants.GLOBAL_STRINGS.yes,value:!0}],displayIf:["id","advanced"],description:this.$t.sprintf(this.$t.__("This enables support for IP Anonymization in Google Analytics.%1$s%2$s",this.$td),"<br>",this.$links.getDocLink(this.$constants.GLOBAL_STRINGS.learnMore,"anonymizeIps",!0))},{parent:"googleAnalytics",option:"displayAdvertiserTracking",label:this.$t.__("Display Advertiser Tracking",this.$td),type:"radio-toggle",options:[{label:this.$constants.GLOBAL_STRINGS.no,value:!1,activeClass:"dark"},{label:this.$constants.GLOBAL_STRINGS.yes,value:!0}],displayIf:["id","advanced"],description:this.$t.sprintf(this.$t.__("This enables support for the Display Advertiser Features in Google Analytics.%1$s%2$s",this.$td),"<br>",this.$links.getDocLink(this.$constants.GLOBAL_STRINGS.learnMore,"displayAdvertiserTracking",!0))},{parent:"googleAnalytics",option:"excludeUsers",label:this.$t.__("Exclude Users from Tracking",this.$td),type:"multicheck",options:Object.keys(this.$aioseo.user.roles).map((function(i){var e=t.$aioseo.user.roles[i];return{value:i,label:e}})),displayIf:["id","advanced"],description:this.$t.sprintf(this.$t.__("Exclude logged-in users from Google Analytics tracking by role.%1$s%2$s",this.$td),"<br>",this.$links.getDocLink(this.$constants.GLOBAL_STRINGS.learnMore,"excludeUsers",!0))},{parent:"googleAnalytics",option:"enhancedLinkAttribution",label:this.$t.__("Enhanced Link Attribution",this.$td),type:"radio-toggle",options:[{label:this.$constants.GLOBAL_STRINGS.no,value:!1,activeClass:"dark"},{label:this.$constants.GLOBAL_STRINGS.yes,value:!0}],displayIf:["id","advanced"],description:this.$t.sprintf(this.$t.__("This enables support for the Enhanced Link Attribution in Google Analytics.%1$s%2$s",this.$td),"<br>",this.$links.getDocLink(this.$constants.GLOBAL_STRINGS.learnMore,"enhancedLinkAttribution",!0))},{parent:"googleAnalytics",option:"trackOutboundLinks",label:this.$t.__("Track Outbound Links",this.$td),type:"radio-toggle",options:[{label:this.$constants.GLOBAL_STRINGS.no,value:!1,activeClass:"dark"},{label:this.$constants.GLOBAL_STRINGS.yes,value:!0}],displayIf:["id","advanced","!gtmContainerId"],description:this.$t.sprintf(this.$t.__("This enables tracking outbound links with Google Analytics.%1$s%2$s",this.$td),"<br>",this.$links.getDocLink(this.$constants.GLOBAL_STRINGS.learnMore,"trackOutboundLinks",!0))},{parent:"googleAnalytics",option:"enhancedEcommerce",label:this.$t.__("Enhanced Ecommerce",this.$td),type:"radio-toggle",options:[{label:this.$constants.GLOBAL_STRINGS.no,value:!1,activeClass:"dark"},{label:this.$constants.GLOBAL_STRINGS.yes,value:!0}],displayIf:["id","advanced","!gtmContainerId"],description:this.$t.sprintf(this.$t.__("This enables support for the Enhanced Ecommerce in Google Analytics.%1$s%2$s",this.$td),"<br>",this.$links.getDocLink(this.$constants.GLOBAL_STRINGS.learnMore,"enhancedEcommerce",!0))},{parent:"googleAnalytics",option:"trackOutboundForms",label:this.$t.__("Track Outbound Forms",this.$td),pro:!0,type:"radio-toggle",options:[{label:this.$constants.GLOBAL_STRINGS.no,value:!1,activeClass:"dark"},{label:this.$constants.GLOBAL_STRINGS.yes,value:!0}],displayIf:["id","advanced","!gtmContainerId"],description:this.$t.sprintf(this.$t.__("This enables tracking outbound forms with Google Analytics.%1$s%2$s",this.$tdPro),"<br>",this.$links.getDocLink(this.$constants.GLOBAL_STRINGS.learnMore,"trackOutboundForms",!0))},{parent:"googleAnalytics",option:"trackEvents",label:this.$t.__("Track Events",this.$td),pro:!0,type:"radio-toggle",options:[{label:this.$constants.GLOBAL_STRINGS.no,value:!1,activeClass:"dark"},{label:this.$constants.GLOBAL_STRINGS.yes,value:!0}],displayIf:["id","advanced","!gtmContainerId"],description:this.$t.sprintf(this.$t.__("This enables tracking events with Google Analytics.%1$s%2$s",this.$tdPro),"<br>",this.$links.getDocLink(this.$constants.GLOBAL_STRINGS.learnMore,"trackEvents",!0))},{parent:"googleAnalytics",option:"trackUrlChanges",label:this.$t.__("Track URL Changes",this.$td),pro:!0,type:"radio-toggle",options:[{label:this.$constants.GLOBAL_STRINGS.no,value:!1,activeClass:"dark"},{label:this.$constants.GLOBAL_STRINGS.yes,value:!0}],displayIf:["id","advanced","!gtmContainerId"],description:this.$t.sprintf(this.$t.__("This enables tracking URL changes for single pages with Google Analytics.%1$s%2$s",this.$tdPro),"<br>",this.$links.getDocLink(this.$constants.GLOBAL_STRINGS.learnMore,"trackUrlChanges",!0))},{parent:"googleAnalytics",option:"trackVisibility",label:this.$t.__("Track Page Visibility",this.$td),pro:!0,type:"radio-toggle",options:[{label:this.$constants.GLOBAL_STRINGS.no,value:!1,activeClass:"dark"},{label:this.$constants.GLOBAL_STRINGS.yes,value:!0}],displayIf:["id","advanced","!gtmContainerId"],description:this.$t.sprintf(this.$t.__("This enables tracking how long pages are in visible state with Google Analytics.%1$s%2$s",this.$tdPro),"<br>",this.$links.getDocLink(this.$constants.GLOBAL_STRINGS.learnMore,"trackVisibility",!0))},{parent:"googleAnalytics",option:"trackMediaQueries",label:this.$t.__("Track Media Queries",this.$td),pro:!0,type:"radio-toggle",options:[{label:this.$constants.GLOBAL_STRINGS.no,value:!1,activeClass:"dark"},{label:this.$constants.GLOBAL_STRINGS.yes,value:!0}],displayIf:["id","advanced","!gtmContainerId"],description:this.$t.sprintf(this.$t.__("This enables tracking media queries with Google Analytics.%1$s%2$s",this.$tdPro),"<br>",this.$links.getDocLink(this.$constants.GLOBAL_STRINGS.learnMore,"trackMediaQueries",!0))},{parent:"googleAnalytics",option:"trackImpressions",label:this.$t.__("Track Elements Visibility",this.$td),pro:!0,type:"radio-toggle",options:[{label:this.$constants.GLOBAL_STRINGS.no,value:!1,activeClass:"dark"},{label:this.$constants.GLOBAL_STRINGS.yes,value:!0}],displayIf:["id","advanced","!gtmContainerId"],description:this.$t.sprintf(this.$t.__("This enables tracking when elements are visible within the viewport with Google Analytics.%1$s%2$s",this.$tdPro),"<br>",this.$links.getDocLink(this.$constants.GLOBAL_STRINGS.learnMore,"trackImpressions",!0))},{parent:"googleAnalytics",option:"trackScrollbar",label:this.$t.__("Track Page Scrolling",this.$td),pro:!0,type:"radio-toggle",options:[{label:this.$constants.GLOBAL_STRINGS.no,value:!1,activeClass:"dark"},{label:this.$constants.GLOBAL_STRINGS.yes,value:!0}],displayIf:["id","advanced","!gtmContainerId"],description:this.$t.sprintf(this.$t.__("This enables tracking how far down a user scrolls a page with Google Analytics.%1$s%2$s",this.$tdPro),"<br>",this.$links.getDocLink(this.$constants.GLOBAL_STRINGS.learnMore,"trackScrollbar",!0))},{parent:"googleAnalytics",option:"trackSocial",label:this.$t.__("Track Facebook and Twitter",this.$td),pro:!0,type:"radio-toggle",options:[{label:this.$constants.GLOBAL_STRINGS.no,value:!1,activeClass:"dark"},{label:this.$constants.GLOBAL_STRINGS.yes,value:!0}],displayIf:["id","advanced","!gtmContainerId"],description:this.$t.sprintf(this.$t.__("This enables tracking interactions with the official Facebook and Twitter widgets with Google Analytics.%1$s%2$s",this.$tdPro),"<br>",this.$links.getDocLink(this.$constants.GLOBAL_STRINGS.learnMore,"trackSocial",!0))},{parent:"googleAnalytics",option:"trackCleanUrl",label:this.$t.__("Ensure URL Consistency",this.$td),pro:!0,type:"radio-toggle",options:[{label:this.$constants.GLOBAL_STRINGS.no,value:!1,activeClass:"dark"},{label:this.$constants.GLOBAL_STRINGS.yes,value:!0}],displayIf:["id","advanced","!gtmContainerId"],description:this.$t.sprintf(this.$t.__("This ensures consistency in URL paths reported to Google Analytics.%1$s%2$s",this.$tdPro),"<br>",this.$links.getDocLink(this.$constants.GLOBAL_STRINGS.learnMore,"trackCleanUrl",!0))},{parent:"googleAnalytics",option:"gtmContainerId",label:this.$t.__("Google Tag Manager Container ID",this.$td),pro:!0,placeholder:"GTM-XXXXXX",description:this.$t.sprintf(this.$t.__("Get your Google Tag Manager ID in your %1$s.",this.$td),this.$links.getDocLink(this.$t.__("Google Tag Manager account",this.$tdPro),"gtmContainerId"))}]}]}}),methods:Object(n["a"])(Object(n["a"])({},Object(a["b"])(["installPlugins"])),{},{updateValue:function(t,i,e){if(t){var s=this.options.deprecated.webmasterTools[i.parent][i.option];return s.push(e.value),void this.$set(this.options.deprecated.webmasterTools[i.parent],i.option,s)}var o=this.options.deprecated.webmasterTools[i.parent][i.option].findIndex((function(t){return t===e.value}));-1!==o&&this.$delete(this.options.deprecated.webmasterTools[i.parent][i.option],o)},getValue:function(t,i){return this.options.deprecated.webmasterTools[t.parent][t.option].includes(i.value)},installMi:function(){var t=this;this.installingPlugin=!0,this.installPlugins([{plugin:"miLite",type:"plugin"}]).then((function(i){t.installingPlugin=!1,i.body.failed.length?t.miInstalledFailed=!0:(t.miInstalled=!0,setTimeout((function(){t.showMiPromo=!1,t.$aioseo.plugins.miLite.activated=!0,window.aioseo.plugins.miLite.activated=!0}),3e3))})).catch((function(t){console.error(t)}))},getLinkWrapper:function(t,i){return this.$t.sprintf('<a href="%1$s" target="_blank">%2$s</a>',t,i)},getOrder:function(t){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],e=this.tools.findIndex((function(i){return i.slug===t.slug}));return i?this.getRow(this.columnsPerRow-1,e):e},getRow:function(t,i){return i-1<t?t:this.getRow(t+this.columnsPerRow,i)},toggleActiveTool:function(t){this.activeTool!==t?this.activeTool=t:this.activeTool=null},maybeChangeColumnsPerRow:function(){window.matchMedia("(max-width: 600px)").matches&&(this.columnsPerRow=1),window.matchMedia("(min-width: 600px) and (max-width: 912px)").matches&&(this.columnsPerRow=2),window.matchMedia("(min-width: 912px) and (max-width: 1042px)").matches&&(this.columnsPerRow=3),window.matchMedia("(min-width: 1042px)").matches&&(this.columnsPerRow=4)},isConnected:function(t){return t.settings[0].parent?this.options.deprecated.webmasterTools[t.settings[0].parent][t.settings[0].option]&&!this.$aioseo.plugins.miLite.activated:this.options.webmasterTools[t.settings[0].option]},shouldDisplaySetting:function(t){var i=this;if(this.isUnlicensed&&t.pro)return!1;if(!t.displayIf)return!0;if("string"===typeof t.displayIf)return t.displayIf.startsWith("!")?!this.options.deprecated.webmasterTools[t.parent][t.displayIf.replace("!","")]:this.options.deprecated.webmasterTools[t.parent][t.displayIf];if(Array.isArray(t.displayIf)){var e=[];return t.displayIf.forEach((function(s){e.push(s.startsWith("!")?!i.options.deprecated.webmasterTools[t.parent][s.replace("!","")]:i.options.deprecated.webmasterTools[t.parent][s])})),e.every((function(t){return t}))}return!1}}),beforeDestroy:function(){window.removeEventListener("resize",this.maybeChangeColumnsPerRow)},mounted:function(){var t=this;this.maybeChangeColumnsPerRow(),this.$nextTick((function(){return t.tools.forEach((function(i){t.getOrder(i),t.getOrder(i,!0)}))})),window.addEventListener("resize",this.maybeChangeColumnsPerRow)}},c=r,d=(e("e57a"),e("2877")),h=Object(d["a"])(c,s,o,!1,null,null,null);i["default"]=h.exports}}]);
|
import { DrawMode } from "../../base/PolyList";
import PolyListRenderer from "../PolyListRenderer";
import VertexBuffer, { BufferTarget } from "./VertexBuffer";
export default class WebGLPolyListRenderer extends PolyListRenderer {
constructor(renderer,polyList) {
super(renderer,polyList);
}
init() {
this._vertexBuffer = null;
this._indexBuffer = null;
this._indexArrayFormat = null;
}
get valid() {
return this._vertexBuffer !== null && this._indexArrayFormat !== null && this._indexBuffer !== null;
}
refresh() {
const getVector = (items, current, stride) => items.length && (stride === 3 ?
[items[current * stride], items[current * stride + 1], items[current * stride + 2]] :
stride === 2 ? [items[current * stride], items[current * stride + 1]] || null :
[items[current * stride], items[current * stride + 1], items[current * stride + 2], items[current * stride + 3]])
const numElements = this.polyList.vertex.length / 3;
const result = [];
for (let i = 0; i < numElements; ++i) {
const v = getVector(this.polyList.vertex, i, 3);
const n = getVector(this.polyList.normal, i, 3);
const t0 = getVector(this.polyList.texCoord0, i, 2);
const t1 = getVector(this.polyList.texCoord1, i, 2);
const t2 = getVector(this.polyList.texCoord2, i, 2);
const c = getVector(this.polyList.color, i, 4);
const t = getVector(this.polyList.tangent, i, 3);
result.push(...v);
if (n) {
result.push(...n);
}
if (t0) {
result.push(...t0);
}
if (t1) {
result.push(...t1);
}
if (t2) {
result.push(...t2);
}
if (c) {
result.push(...c);
}
if (t) {
result.push(...t);
}
}
this._stride = 3;
const vertex = 0;
const normal = 3;
let texCoord0 = 3;
let texCoord1 = 3;
let texCoord2 = 3;
let color = 3;
let tangent = 3;
if (this.hasNormal) {
this._stride += 3;
texCoord0 += 3;
texCoord1 += 3;
texCoord2 += 3;
color += 3;
tangent += 3;
}
if (this.hasTexCoord0) {
this._stride += 2;
texCoord1 += 2;
texCoord2 += 2;
color += 2;
tangent += 2;
}
if (this.hasTexCoord1) {
this._stride += 2;
texCoord2 += 2;
color += 2;
tangent += 2;
}
if (this.hasTexCoord2) {
this._stride += 2;
color += 2;
tangent += 2;
}
if (this.hasColor) {
this._stride += 4;
tangent += 4;
}
if (this.hasTangent) {
this._stride += 3;
}
this._offsets = { vertex, normal, texCoord0, texCoord1, texCoord2, color, tangent };
this._vertexBuffer = VertexBuffer.CreateArrayBuffer(this.renderer.gl, new Float32Array(result));
const indexArray = this.polyList.index.length < 65535 ? new Uint16Array(this.polyList.index) : new Uint32Array(this.polyList.index);
this._indexBuffer = VertexBuffer.CreateElementArrayBuffer(this.renderer.gl, indexArray);
this._indexArrayFormat = indexArray instanceof Uint16Array ? this.renderer.gl.UNSIGNED_SHORT : this.renderer.gl.UNSIGNED_INT;
}
get hasNormal() {
return this._polyList.normal.length > 0;
}
get hasTexCoord0() {
return this._polyList.texCoord0.length > 0;
}
get hasTexCoord1() {
return this._polyList.texCoord1.length > 0;
}
get hasTexCoord2() {
return this._polyList.texCoord2.length > 0;
}
get hasColor() {
return this._polyList.color.length > 0;
}
get hasTangent() {
return this._polyList.tangent.length > 0;
}
positionAttribParams(name) {
return { name, stride: this._stride, size: 3, offset: 0, enable: true }
}
normalAttribParams(name) {
return { name, stride: this._stride, size: 3, offset: this._offsets.normal, enable: true }
}
texCoord0AttribParams(name) {
return { name, stride: this._stride, size: 2, offset: this._offsets.texCoord0, enable: true }
}
texCoord1AttribParams(name) {
return { name, stride: this._stride, size: 2, offset: this._offsets.texCoord1, enable: true }
}
texCoord2AttribParams(name) {
return { name, stride: this._stride, size: 2, offset: this._offsets.texCoord2, enable: true }
}
colorAttribParams(name) {
return { name, stride: this._stride, size: 4, offset: this._offsets.color, enable: true }
}
tangentAttribParams(name) {
return { name, stride: this._stride, size: 3, offset: this._offsets.tangent, enable: true }
}
draw() {
const { gl } = this.renderer;
this._vertexBuffer.bind(BufferTarget.ARRAY_BUFFER);
this._indexBuffer.bind(BufferTarget.ELEMENT_ARRAY_BUFFER);
let mode = 0;
switch (this._polyList.drawMode) {
case DrawMode.POINTS:
mode = gl.POINTS;
break;
case DrawMode.TRIANGLES:
mode = gl.TRIANGLES;
break;
case DrawMode.TRIANGLE_FAN:
mode = gl.TRIANGLE_FAN
break;
case DrawMode.TRIANGLE_STRIP:
mode = gl.TRIANGLE_STRIP;
break;
case DrawMode.LINES:
mode = gl.LINES;
break;
case DrawMode.LINE_STRIP:
mode = gl.LINE_STRIP;
break;
}
gl.drawElements(mode, this.polyList.index.length, this._indexArrayFormat, 0);
}
destroy() {
VertexBuffer.Delete(this._vertexBuffer);
VertexBuffer.Delete(this._indexBuffer);
}
}
|
import React from 'react';
import { shallow } from 'enzyme';
describe('(Component) Nav', function() {
it('should exist', function() {
});
});
|
/**
* Jasmine
*
* Includes: jasmine-html
*/
define(['jquery', 'jasmine_boot'],
function($, jasmine) {
window.jasmine.onJasmineLoad = window.onload;
window.onload = null;
return window.jasmine;
});
|
const http = require('http');
const app = require('./app');
const port = process.env.PORT || 8080;
const server = http.createServer(app);
server.listen(port, () => {
console.log(`Listening on: http://localhost:${port}/api/v1`);
});
|
/*
Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
CKEDITOR.plugins.setLang( 'font', 'bn', {
fontSize: {
label: 'সাইজ',
voiceLabel: 'Font Size',
panelTitle: 'সাইজ'
},
label: 'ফন্ট',
panelTitle: 'ফন্ট',
voiceLabel: 'ফন্ট'
} );
|
/**
* @memberof gdjs
* @class fileSystem
* @static
* @private
*/
gdjs.fileSystem = {};
/**
* Get the path to 'Desktop' folder.
* @param {gdjs.RuntimeScene} runtimeScene The current scene
* @return {string} The path to the desktop folder
*/
gdjs.fileSystem.getDesktopPath = function(runtimeScene) {
const electron = runtimeScene
.getGame()
.getRenderer()
.getElectron();
if (electron) {
return electron.remote.app.getPath('desktop') || '';
} else {
return '';
}
};
/**
* Get the path to 'Documents' folder.
* @param {gdjs.RuntimeScene} runtimeScene The current scene
* @return {string} The path to the documents folder
*/
gdjs.fileSystem.getDocumentsPath = function(runtimeScene) {
const electron = runtimeScene
.getGame()
.getRenderer()
.getElectron();
if (electron) {
return electron.remote.app.getPath('documents') || '';
} else {
return '';
}
};
/**
* Get the path to 'Pictures' folder.
* @param {gdjs.RuntimeScene} runtimeScene The current scene
* @return {string} The path to the pictures folder
*/
gdjs.fileSystem.getPicturesPath = function(runtimeScene) {
const electron = runtimeScene
.getGame()
.getRenderer()
.getElectron();
if (electron) {
return electron.remote.app.getPath('pictures') || '';
} else {
return '';
}
};
/**
* Get the path to this application 'Executable' folder.
* @param {gdjs.RuntimeScene} runtimeScene The current scene
* @return {string} The path to this applications executable folder
*/
gdjs.fileSystem.getExecutablePath = function(runtimeScene) {
const electron = runtimeScene
.getGame()
.getRenderer()
.getElectron();
if (electron) {
return electron.remote.app.getPath('exe') || '';
} else {
return '';
}
};
/**
* Get the path to 'UserData' folder.
* @param {gdjs.RuntimeScene} runtimeScene The current scene
* @return {string} The path to userdata folder
*/
gdjs.fileSystem.getUserdataPath = function(runtimeScene) {
const electron = runtimeScene
.getGame()
.getRenderer()
.getElectron();
if (electron) {
return electron.remote.app.getPath('userData') || '';
} else {
return '';
}
};
/**
* Get the path to 'Temp' folder.
* @param {gdjs.RuntimeScene} runtimeScene The current scene
* @return {string} The path to temp folder
*/
gdjs.fileSystem.getTempPath = function(runtimeScene) {
const electron = runtimeScene
.getGame()
.getRenderer()
.getElectron();
if (electron) {
return electron.remote.app.getPath('temp') || '';
} else {
return '';
}
};
/**
* Get the path delimiter specific to the operating system.
* @return {string} The path delimiter
*/
gdjs.fileSystem.getPathDelimiter = function() {
const path = typeof require !== 'undefined' ? require('path') : null;
if (path) {
return path.sep || '/';
} else {
return '/';
}
};
/**
* Create a new directory at the given path.
* @param {string} directory The path to create a new directory
* @param {gdjs.Variable} resultVar The variable where to store the result of the operation
*/
gdjs.fileSystem.makeDirectory = function(directory, resultVar) {
const fileSystem = typeof require !== 'undefined' ? require('fs') : null;
let result = 'error';
if (fileSystem) {
try {
fileSystem.mkdirSync(directory);
result = 'ok';
} catch (err) {
console.error(
"Unable to create directory at: '" + directory + "': ",
err
);
}
}
resultVar.setString(result);
};
/**
* Save a string into a file, asynchronously.
* @param {string} text The string to be saved
* @param {string} savePath Path to the file
* @param {gdjs.Variable} resultVar The variable where to store the result of the operation
*/
gdjs.fileSystem.saveStringToFileAsync = function(text, savePath, resultVar) {
const fileSystem = typeof require !== 'undefined' ? require('fs') : null;
if (fileSystem) {
fileSystem.writeFile(savePath, text, 'utf8', err => {
resultVar.setString('ok');
if (err) {
console.error(
"Unable to save the text to path: '" + savePath + "': ",
err
);
resultVar.setString('error');
}
});
}
};
/**
* Save a string into a file.
* @param {string} text The string to be saved
* @param {string} savePath Path to the file
* @param {gdjs.Variable} resultVar The variable where to store the result of the operation
*/
gdjs.fileSystem.saveStringToFile = function(text, savePath, resultVar) {
const fileSystem = typeof require !== 'undefined' ? require('fs') : null;
let result = 'error';
if (fileSystem) {
try {
fileSystem.writeFileSync(savePath, text, 'utf8');
result = 'ok';
} catch (err) {
console.error(
"Unable to save the text to path: '" + savePath + "': ",
err
);
}
}
resultVar.setString(result);
};
/**
* Save a variable into a file in JSON format.
* @param {gdjs.Variable} variable The variable to be saved
* @param {string} savePath Path to the file
* @param {gdjs.Variable} resultVar The variable where to store the result of the operation
*/
gdjs.fileSystem.saveVariableToJSONFile = function(
variable,
savePath,
resultVar
) {
const fileSystem = typeof require !== 'undefined' ? require('fs') : null;
const network = gdjs.evtTools.network;
let result = 'error';
if (fileSystem && network) {
try {
fileSystem.writeFileSync(
savePath,
network.variableStructureToJSON(variable),
'utf8'
);
result = 'ok';
} catch (err) {
console.error(
"Unable to save the variable to path: '" + savePath + "': ",
err
);
}
}
resultVar.setString(result);
};
/**
* Save a variable into a file in JSON format, asynchronously.
* @param {string} text The variable to be saved
* @param {string} savePath Path to the file
* @param {gdjs.Variable} resultVar The variable where to store the result of the operation
*/
gdjs.fileSystem.saveVariableToJSONFileAsync = function(
variable,
savePath,
resultVar
) {
const fileSystem = typeof require !== 'undefined' ? require('fs') : null;
const network = gdjs.evtTools.network;
if (fileSystem && network) {
fileSystem.writeFile(
savePath,
network.variableStructureToJSON(variable),
'utf8',
err => {
resultVar.setString('ok');
if (err) {
console.error(
"Unable to save the variable to path: '" + savePath + "': ",
err
);
resultVar.setString('error');
}
}
);
}
};
/**
* Load a string from a file into a scene variable.
* @param {gdjs.Variable} stringVar Variable where to store the content
* @param {string} loadPath Path to the file
* @param {gdjs.Variable} resultVar The variable where to store the result of the operation
*/
gdjs.fileSystem.loadStringFromFile = function(stringVar, loadPath, resultVar) {
const fileSystem = typeof require !== 'undefined' ? require('fs') : null;
let result = 'error';
if (fileSystem) {
try {
const data = fileSystem.readFileSync(loadPath, 'utf8');
if (data) {
stringVar.setString(data);
result = 'ok';
}
} catch (err) {
console.error(
"Unable to load the file at path: '" + loadPath + "': ",
err
);
}
}
resultVar.setString(result);
};
/**
* Load a JSON file and convert it into a variable.
* @param {gdjs.Variable} variable Variable to store the variable
* @param {string} loadPath Path to the file
* @param {gdjs.Variable} resultVar The variable where to store the result of the operation
*/
gdjs.fileSystem.loadVariableFromJSONFile = function(
variable,
loadPath,
resultVar
) {
const fileSystem = typeof require !== 'undefined' ? require('fs') : null;
const network = gdjs.evtTools.network;
let result = 'error';
if (fileSystem && network) {
try {
const data = fileSystem.readFileSync(loadPath, 'utf8');
if (data) {
network.jsonToVariableStructure(data, variable);
result = 'ok';
}
} catch (err) {
console.error(
"Unable to load variable from the file at path: '" + loadPath + "': ",
err
);
}
}
resultVar.setString(result);
};
/**
* Load a JSON file and convert it into a variable, asynchronously.
* @param {gdjs.Variable} variable Variable to store the variable
* @param {string} loadPath Path to the file
* @param {gdjs.Variable} resultVar The variable where to store the result of the operation
*/
gdjs.fileSystem.loadVariableFromJSONFileAsync = function(
variable,
loadPath,
resultVar
) {
const fileSystem = typeof require !== 'undefined' ? require('fs') : null;
const network = gdjs.evtTools.network;
if (fileSystem && network) {
fileSystem.readFile(loadPath, 'utf8', (err, data) => {
if (data) {
network.jsonToVariableStructure(data, variable);
resultVar.setString('ok');
}
if (err) {
console.error(
"Unable to load variable from the file at path: '" + loadPath + "': ",
err
);
resultVar.setString('error');
}
});
}
};
/**
* Load a string from a file into a scene variable, asynchronously.
* @param {gdjs.Variable} stringVar Variable where to store the content
* @param {string} loadPath Path to the file
* @param {gdjs.Variable} resultVar The variable where to store the result of the operation
*/
gdjs.fileSystem.loadStringFromFileAsync = function(
stringVar,
loadPath,
resultVar
) {
const fileSystem = typeof require !== 'undefined' ? require('fs') : null;
if (fileSystem) {
fileSystem.readFile(loadPath, 'utf8', (err, data) => {
if (data) {
stringVar.setString(data);
resultVar.setString('ok');
}
if (err) {
console.error(
"Unable to load the file at path: '" + loadPath + "': ",
err
);
resultVar.setString('error');
}
});
}
};
/**
* Delete a file from the filesystem.
* @param {string} filePath Path to the file
* @param {gdjs.Variable} resultVar The variable where to store the result of the operation
*/
gdjs.fileSystem.deleteFile = function(filePath, resultVar) {
const fileSystem = typeof require !== 'undefined' ? require('fs') : null;
let result = 'error';
if (fileSystem) {
try {
fileSystem.unlinkSync(filePath);
result = 'ok';
} catch (err) {
console.error("Unable to delete the file: '" + filePath + "': ", err);
result = 'error';
}
}
resultVar.setString(result);
};
/**
* Delete a file from the filesystem, asynchronously.
* @param {string} filePath Path to the file
* @param {gdjs.Variable} resultVar The variable where to store the result of the operation
*/
gdjs.fileSystem.deleteFileAsync = function(filePath, resultVar) {
const fileSystem = typeof require !== 'undefined' ? require('fs') : null;
if (fileSystem) {
fileSystem.unlink(filePath, err => {
resultVar.setString('ok');
if (err) {
console.error("Unable to delete the file: '" + filePath + "': ", err);
resultVar.setString('error');
}
});
}
};
/**
* Check if the file or directory exists.
* @param {string} filePath The path to the file or directory
* @return {boolean} true if fhe file or directory exists
*/
gdjs.fileSystem.pathExists = function(filePath) {
const fileSystem = typeof require !== 'undefined' ? require('fs') : null;
if (fileSystem) {
return fileSystem.existsSync(filePath);
} else {
return false;
}
};
|
import React, { useState } from "react";
import "./authenticate.css";
import { addUser } from "../services/user.service";
import { withRouter, Redirect } from "react-router-dom";
import SignIn from "../components/sign-in/login";
import SignUp from "../components/sign-up/register";
// Authenticate
const Authenticate = (props) => {
const [login, setLogin] = useState(true);
const [redirectToReferrer, setRedirectToReferrer] = useState(false);
const { from } = props.location.state || { from: { pathname: "/" } };
const loginSuccess = (data) => {
addUser(data);
setRedirectToReferrer(true);
};
const changeLoginMode = () => {
setLogin(!login);
};
if (redirectToReferrer === true) {
return <Redirect to={from} />;
}
return (
<div className="auth-container">
{login ? (
<SignIn changeMode={changeLoginMode} success={loginSuccess} />
) : (
<SignUp changeMode={changeLoginMode} success={loginSuccess} />
)}
</div>
);
};
export default withRouter(Authenticate);
|
var gecoRegistryControllers = angular.module("gecoRegistryControllers",[]);
/*****
REGISTRY
***/
gecoRegistryControllers.controller('CompanyCtrl',["$scope","$http",'LoginFactory',function($scope,$http,LoginFactory){
$scope.loginuser = LoginFactory.checklogin();
GECO_validator.startupvalidator();
$scope.companysaved = true;
$http.get('rest/registry/company').success(function(data){
$scope.company = data;
if ($scope.company == null ){
$scope.company = {idCompany:0};
}
});
$scope.saveCompany = function(){
$.ajax({
url:"rest/registry/company",
type:"PUT",
data:"companys="+JSON.stringify($scope.company),
success:function(data){
/*$http.get('rest/basic/payment').success(function(data){
$scope.payments= data;
$scope.paymentsaved = true;
$scope.modifyid = 0;
});*/
$scope.confirmSaved();
}
})
}
}]);
gecoRegistryControllers.controller('BankListCtrl',["$scope","$http",'LoginFactory',function($scope,$http,LoginFactory){
$scope.loginuser = LoginFactory.checklogin();
$http.get('rest/registry/bank').success(function(data){
$scope.banks= data;
});
$scope.deleteElement = function(id){
for(var i=0;i<$scope.banks.length;i++){
if (id == $scope.banks[i].idBank){
$scope.deletebank = $scope.banks[i];
$.ajax({
url:"rest/registry/bank/",
type:"DELETE",
data:"bankobj="+JSON.stringify($scope.deletebank),
success:function(data){
alert("Utente eliminato con successo");
$http.get('rest/registry/bank').success(function(data){
$scope.banks= data;
});
}
})
}
}
}
$scope.printElements = function(){
$http.get('rest/print').success(function(data){
window.open(data, '_blank');
});
}
}]);
gecoRegistryControllers.controller('BankDetailCtrl',["$scope","$http","$routeParams",'LoginFactory',function($scope,$http,$routeParams,LoginFactory){
LoginFactory.checklogin();
GECO_validator.startupvalidator();
$scope.idbank= $routeParams.idbank ;
$http.get('rest/registry/bank/'+$scope.idbank).success(function(data){
$scope.bank= data;
});
$scope.saveBank = function(){
//if (GECO_validator.requiredFields()== true && GECO_validator.emailFields()==true){
$.ajax({
url:"rest/registry/bank",
type:"PUT",
data:"banks="+JSON.stringify($scope.bank),
success:function(data){
$scope.confirmSaved();
}
})
//}
} ;
}]);
gecoRegistryControllers.controller('ProductListCtrl',["$scope","$rootScope","$http","ScopeFactory","$location",'LoginFactory',function($scope,$rootScope,$http,ScopeFactory,$location,LoginFactory){
$("#maincontainer_productlist").focus();
$scope.loginuser = LoginFactory.checklogin();
$(document).unbind("keydown");
$(document).keydown(function(e){
if(e.altKey && e.keyCode == 78 ){
$location.path("/product/0");
$scope.$apply();
}
if(e.altKey && e.keyCode == 80 ){
$scope.printElements();
$scope.$apply();
}
});
if ($scope.pagesize == null ){
$scope.pagesize = 99;
}else{
//$scope.pagesize = ScopeFactory.factory.productList.pagesize
}
$scope.pageArray = [];
if ($scope.showFilter == null){
$scope.showFilter = false;
}
if ($scope.filter == null){
$scope.filter = {"pagefilter":{}};
$scope.currentGroup = {};
$scope.currentBrand = {};
$scope.currentCategory = {};
$scope.currentSubCategory = {};
$scope.currentSupplier = {};
}else{
$scope.currentGroup = $scope.filter.group;
$scope.currentBrand = $scope.filter.brand;
$scope.currentCategory = $scope.filter.category;
$scope.currentSubCategory = $scope.filter.subcategory;
$scope.currentSupplier = $scope.filter.supplier;
}
$scope.products = [];
$scope.updateProd = {};
$http.get('rest/basic/categoryproduct').success(function(data){
$scope.categorys= data;
for (var i=0;i<$scope.categorys.length;i++){
if ($scope.currentCategory.idCategoryProduct == $scope.categorys[i].idCategoryProduct){
$scope.currentCategory = $scope.categorys[i];
$scope.subcategories = $scope.currentCategory.subcategories
if ($scope.filter.subcategory != null){
for (var y=0;y<$scope.subcategories.length;y++){
if ($scope.currentSubCategory.idSubCategoryProduct == $scope.subcategories[i].idSubCategoryProduct){
$scope.currentSubCategory = $scope.subcategories[i];
}
}
}else{
$scope.currentSubCategory = null;
}
}
}
});
$http.get('rest/basic/brand').success(function(data){
$scope.brands= data;
for (var i=0;i<$scope.brands.length;i++){
if ($scope.currentBrand.idBrand == $scope.brands[i].idBrand){
$scope.currentBrand = $scope.brands[i];
}
}
});
$http.get('rest/registry/supplier').success(function(data){
$scope.suppliers= data;
for (var i=0;i<$scope.suppliers.length;i++){
if ($scope.currentSupplier.idSupplier == $scope.suppliers[i].idSupplier){
$scope.currentSupplier = $scope.suppliers[i];
}
}
});
$http.get('rest/basic/groupproduct').success(function(data){
$scope.groups= data;
for (var i=0;i<$scope.groups.length;i++){
if ($scope.currentGroup.idGroupProduct == $scope.groups[i].idGroupProduct){
$scope.currentGroup = $scope.groups[i];
}
}
});
$scope.getProducts = function(page){
$(".pag").removeClass("selected");
$("#pag"+page).addClass("selected");
$scope.filter.pagefilter.startelement = (page - 1 ) * $scope.pagesize;
$scope.filter.pagefilter.pageSize = $scope.pagesize;
$rootScope.filter = $scope.filter
$.ajax({
url:"rest/registry/products",
type:"POST",
data:"filter="+JSON.stringify($scope.filter),
success:function(data){
result = JSON.parse(data);
if (result.type == "success"){
$scope.products = result.success;
$scope.$apply();
$("#maincontainer_productlist").focus();
}else{
alert("Errore: "+result.errorName+" Messaggio:"+result.errorMessage);
}
}
});
}
$scope.getProductsNumber = function(){
$rootScope.pagesize = $scope.pagesize;
if ($scope.products.length != $scope.pagesize){
$scope.pages = [];
$scope.pageArray = [];
$.ajax({
url:"rest/registry/product/pages/"+$scope.pagesize,
type:"GET",
success:function(data){
$scope.pages= JSON.parse(data);
for (var i=0;i<$scope.pages;i++){
$scope.pageArray.push(i+1);
}
$scope.$apply();
$scope.getProducts(1);
$("#maincontainer_productlist").focus();
}
})
}
}
$scope.getProductsNumber();
$scope.deleteElement = function(id){
for(var i=0;i<$scope.products.length;i++){
if (id == $scope.products[i].idProduct){
$scope.deleteproduct = $scope.products[i];
$.ajax({
url:"rest/registry/product/",
type:"DELETE",
data:"productobj="+JSON.stringify($scope.deleteproduct),
success:function(data){
alert("Utente eliminato con successo");
$http.get('rest/registry/product').success(function(data){
$scope.products= data;
});
}
})
}
}
}
$scope.printElements = function(){
$.ajax({
url:"rest/print/products/",
type:"POST",
data:"filter="+JSON.stringify($scope.filter),
success:function(data){
//alert("Utente eliminato con successo");
window.open(JSON.parse(data), '_blank');
}
})
}
$scope.openIncrement = function(){
if ($scope.showIncrement == true){
$scope.showIncrement = false;
$scope.showFilter = false;
}else{
$scope.showIncrement = true;
$scope.showFilter = true;
}
$rootScope.showFilter = $scope.showFilter;
$rootScope.showIncrement = $scope.showIncrement;
}
$scope.incrementPrices = function(){
$.ajax({
url:"rest/registry/product/increment/",
type:"POST",
data:"filter="+JSON.stringify($scope.filter),
success:function(data){
result = JSON.parse(data);
if (result.type == "success"){
$scope.getProductsNumber();
}else{
alert("Errore: "+result.errorName+" Messaggio:"+result.errorMessage);
}
}
});
}
$scope.changeCategory = function(){
$scope.filter.category = $scope.currentCategory;
$scope.subcategories = $scope.currentCategory.subcategories
$scope.currentSubCategory = null;
}
}]);
gecoRegistryControllers.controller('ProductDetailCtrl',["$scope","$http","$routeParams","$location","$rootScope",'LoginFactory',function($scope,$http,$routeParams,$location,$rootScope,LoginFactory){
LoginFactory.checklogin();
GECO_validator.startupvalidator();
$("#maincontainer_productdetail").focus();
$scope.currentBrand = {};
$scope.currentSupplier = {};
$scope.currentGroup = {};
$scope.currentTaxRate = {};
$(document).unbind("keydown");
$(document).keydown(function(e){
if(e.altKey && e.keyCode == 81 ){
$scope.saveProduct();
$scope.$apply();
}
if(e.altKey && e.keyCode == 78 ){
$location.path("/product/0");
$scope.$apply();
}
if(e.altKey && e.keyCode == 69 ){
$location.path("/product");
$scope.$apply();
}
if(e.altKey && e.keyCode == 85 ){
$scope.product.ums.push({idUnitMeasureProduct:0});
$scope.umpid = $scope.product.ums.length-1;
$scope.$apply();
}
});
$scope.idproduct= $routeParams.idproduct;
$scope.isNew = false
if ($scope.idproduct == 0){
$scope.isNew = true;
$scope.umpid = 0;
}else{
$scope.isNew = false;
}
$http.get('rest/basic/unitmeasure').success(function(data){
$scope.ums= data;
$http.get('rest/registry/product/'+$scope.idproduct).success(function(data){
$scope.product= data;
if ($rootScope.newProductToAdd != null)
$scope.product.code = $rootScope.newProductToAdd;
if ($scope.product.idProduct == 0){
$scope.product.ums = [];
$scope.product.ums.push({idUnitMeasureProduct:0,preference:true,um:$scope.ums[0],conversion:1});
}
$http.get('rest/basic/groupproduct').success(function(data){
$scope.groups= data;
if($scope.product.group){
for (var i=0;i<$scope.groups.length;i++){
if ($scope.product.group.idGroupProduct == $scope.groups[i].idGroupProduct){
$scope.currentGroup = $scope.groups[i];
}
}
}
});
$http.get('rest/registry/supplier').success(function(data){
$scope.suppliers= data;
if($scope.product.supplier != null){
for (var i=0;i<$scope.suppliers.length;i++){
if ($scope.product.supplier.idSupplier == $scope.suppliers[i].idSupplier){
$scope.currentSupplier = $scope.suppliers[i];
}
}
}
});
$http.get('rest/basic/taxrate').success(function(data){
$scope.taxrates= data;
for (var itx=0;itx<$scope.taxrates.length;itx++){
if($scope.product.taxrate){
if ($scope.product.taxrate.idtaxrate == $scope.taxrates[itx].idtaxrate){
$scope.currentTaxRate = $scope.taxrates[itx];
}
}
}
});
$http.get('rest/basic/categoryproduct').success(function(data){
$scope.categorys= data;
if($scope.product.category){
for (var ig=0;ig<$scope.categorys.length;ig++){
if ($scope.product.category.idCategoryProduct == $scope.categorys[ig].idCategoryProduct){
$scope.currentCategory = $scope.categorys[ig];
$scope.subcategories = $scope.currentCategory.subcategories
$scope.currentSubCategory = null;
}
}
for (var igs=0;igs<$scope.subcategories.length;igs++){
if ($scope.product.subcategory == null){
$scope.product.subcategory = {};
}
if ($scope.product.subcategory.idSubCategoryProduct == $scope.subcategories[igs].idSubCategoryProduct){
$scope.currentSubCategory = $scope.subcategories[igs];
}
}
}
});
$http.get('rest/basic/brand').success(function(data){
$scope.brands= data;
for (var itx=0;itx<$scope.brands.length;itx++){
if ($scope.product != null && $scope.product.brand != null && $scope.brands != null){
if ($scope.product.brand.idBrand == $scope.brands[itx].idBrand){
$scope.currentBrand = $scope.brands[itx];
}
}
}
//$("#selbrand").trigger("chosen:updated");
});
//$(".combobox").trigger("chosen:updated");
});
});
$scope.changeCategory = function(){
$scope.subcategories = $scope.currentCategory.subcategories
$scope.currentSubCategory = null;
}
$scope.addUMElement = function(product){
product.ums.push({idUnitMeasureProduct:0});
$scope.umpid = product.ums.length-1 ;
}
$scope.changeUMElement = function(ump){
/*if (ump.um != null){
for(var i=0;i<$scope.ums.length;i++){
if (ump.um.idUnitMeasure == $scope.ums[i].idUnitMeasure){
$scope.currentUMP = $scope.ums[i];
}
}
}*/
$scope.umpid = ump; //ump.idUnitMeasureProduct
}
$scope.saveProduct = function(){
$scope.product.group = $scope.currentGroup;
$scope.product.taxrate = $scope.currentTaxRate;
$scope.product.category = $scope.currentCategory;
$scope.product.brand = $scope.currentBrand;
$scope.product.subcategory = $scope.currentSubCategory;
$scope.product.supplier = $scope.currentSupplier;
//if (GECO_validator.requiredFields()== true && GECO_validator.emailFields()==true){
$.ajax({
url:"rest/registry/product",
type:"PUT",
data:"products="+JSON.stringify($scope.product),
success:function(data){
result = JSON.parse(data);
if (result.type == "success"){
$scope.product.idProduct = result.success;
$scope.idproduct = result.success;
$scope.$apply();
if ($rootScope.headScope != null){
$rootScope.newProductToAdd = $scope.product.code;
$scope.isNew = false;
$scope.confirmSaved();
window.history.back();
}else{
$scope.isNew = false;
$http.get('rest/registry/product/'+$scope.idproduct).success(function(data){
$scope.product.idProduct= data.idProduct;
$location.path("/product/"+$scope.product.idProduct);
});
$scope.confirmSaved();
}
}else{
alert("Errore: "+result.errorName+" Messaggio:"+result.errorMessage);
}
}
})
//}
} ;
$rootScope.setSaveControl($scope.saveProduct);
$scope.newProduct = function(){
$location.path("/product/0");
}
$scope.mainPage = function(){
$location.path("/product");
}
$scope.calculatePrices = function(type){
$scope.basicPrices = {};
$scope.basicPrices.sellprice = $scope.product.sellprice;
$scope.basicPrices.percentage = $scope.product.percentage;
$scope.basicPrices.purchaseprice = $scope.product.purchaseprice;
$.ajax({
url:"rest/util/prodbasicprice/"+type,
type:"POST",
data:"prices="+JSON.stringify($scope.basicPrices),
success:function(data){
result = JSON.parse(data);
if (result.type == "success"){
$scope.product.sellprice = result.success.sellprice;
$scope.product.percentage = result.success.percentage;
$scope.product.purchaseprice = result.success.purchaseprice;
$scope.$apply();
}else{
alert("Errore: "+result.errorName+" Messaggio:"+result.errorMessage);
}
}
})
}
}]);
/***
LIST
*/
gecoRegistryControllers.controller('ListListCtrl',["$scope","$http",'LoginFactory',function($scope,$http,LoginFactory){
$scope.loginuser = LoginFactory.checklogin();
$http.get('rest/registry/list').success(function(data){
$scope.lists= data;
});
$scope.deleteElement = function(id){
for(var i=0;i<$scope.lists.length;i++){
if (id == $scope.lists[i].idList){
$scope.deletelist = $scope.lists[i];
$.ajax({
url:"rest/registry/list/",
type:"DELETE",
data:"listobj="+JSON.stringify($scope.deletelist),
success:function(data){
alert("Utente eliminato con successo");
$http.get('rest/registry/list').success(function(data){
$scope.lists= data;
});
}
})
}
}
}
$scope.printElement = function(id){
$.ajax({
url:"rest/print/list/"+id,
type:"POST",
success:function(data){
//alert("Utente eliminato con successo");
window.open(JSON.parse(data), '_blank');
}
})
}
$scope.dateSortFunction = function(list) {
var date = list.startdate.split("/");
return date[2]+date[1]+date[0];
};
}]);
gecoRegistryControllers.controller('ListDetailCtrl',["$scope","$http","$routeParams","ScopeFactory",'LoginFactory',function($scope,$http,$routeParams,ScopeFactory,LoginFactory){
LoginFactory.checklogin();
GECO_validator.startupvalidator();
$scope.newList = {isPercentage:false};
$(".datepicker").datepicker({ dateFormat: "dd/mm/yy" });
$scope.idlist= $routeParams.idlist;
$http.get('rest/registry/product').success(function(data){
$scope.products= data;
$http.get('rest/registry/list/'+$scope.idlist).success(function(data){
$scope.list= data;
});
});
$scope.addProdElement = function(list){
$scope.prodid = 0
list.listproduct.push({idListProduct:0});
}
$scope.changeProdElement = function(ump){
if (ump.product != null){
for(var i=0;i<$scope.products.length;i++){
if (ump.product.idProduct == $scope.products[i].idProduct){
$scope.currentProd = $scope.products[i];
}
}
}
$scope.prodid = ump.idListProduct
}
$scope.saveProduct = function(){
//if (GECO_validator.requiredFields()== true && GECO_validator.emailFields()==true){
$scope.newList.list = $scope.list;
$scope.value = 0;
$.ajax({
url:"rest/registry/list",
type:"PUT",
data:"lists="+JSON.stringify($scope.newList),
success:function(data){
result = JSON.parse(data);
if (result.type == "success"){
$scope.list.idList = result.success;
$scope.idlist = result.success;
alert("success");
$http.get('rest/registry/list/'+$scope.idlist).success(function(data){
$scope.list= data;
});
}else{
alert("Errore: "+result.errorName+" Messaggio:"+result.errorMessage);
}
}
})
//}
} ;
}]);
/****
CUSTOMER
**/
gecoRegistryControllers.controller('CustomerListCtrl',["$scope","$http","$rootScope","KeyDown",'LoginFactory',function($scope,$http,$rootScope,KeyDown,LoginFactory){
LoginFactory.checklogin();
KeyDown.setupList("/customer/0",$scope.printElements);
if ($scope.pagesize == null ){
$scope.pagesize = 99;
//ScopeFactory.factory.productList.pagesize = 100;
}else{
//$scope.pagesize = ScopeFactory.factory.productList.pagesize
}
$scope.pageArray = [];
if ($scope.showFilter == null){
$scope.showFilter = false;
}
if ($scope.filterCustomer == null){
$scope.filterCustomer = {"pagefilter":{}};
$scope.currentCustomerGroup = {};
$scope.currentBrand = {};
$scope.currentCategory = {};
$scope.currentSubCategory = {};
$scope.currentSupplier = {};
}else{
$scope.currentCustomerGroup = $scope.filterCustomer.group;
$scope.currentBrand = $scope.filterCustomer.brand;
$scope.currentCategory = $scope.filterCustomer.category;
$scope.currentSubCategory = $scope.filterCustomer.subcategory;
$scope.currentSupplier = $scope.filterCustomer.supplier;
}
$http.get('rest/basic/groupcustomer').success(function(data){
$scope.groups= data;
if ($scope.currentCustomerGroup != null && $scope.currentCustomerGroup != undefined){
for (var i=0;i<$scope.groups.length;i++){
if ($scope.currentCustomerGroup.idGroupCustomer == $scope.groups[i].idGroupCustomer){
$scope.currentCustomerGroup = $scope.groups[i];
}
}
}
});
$http.get('rest/basic/categorycustomer').success(function(data){
$scope.categorys= data;
if ($scope.currentCategory != null && $scope.currentCategory != undefined){
for (var i=0;i<$scope.categorys.length;i++){
if ($scope.currentCategory.idCategoryCustomer == $scope.categorys[i].idCategoryCustomer){
$scope.currentCategory = $scope.categorys[i];
}
}
}
});
$scope.getCustomers = function(){
$scope.filterCustomer.pagefilter.startelement = (1 - 1 ) * $scope.pagesize;
$scope.filterCustomer.pagefilter.pageSize = $scope.pagesize;
$rootScope.filterCustomer = $scope.filterCustomer
$.ajax({
url:"rest/registry/customer/",
type:"POST",
data:"filter="+JSON.stringify($scope.filterCustomer),
success:function(data){
$scope.customers= JSON.parse(data);
$scope.$apply();
}
})
}
$scope.getCustomers();
/*$http.get('rest/registry/customer').success(function(data){
$scope.customers= data;
});
*/
$scope.deleteElement = function(id){
for(var i=0;i<$scope.customers.length;i++){
if (id == $scope.customers[i].idCustomer){
$scope.deletecustomer = $scope.customers[i];
$.ajax({
url:"rest/registry/customer/",
type:"DELETE",
data:"customerobj="+JSON.stringify($scope.deletecustomer),
success:function(data){
alert("Utente eliminato con successo");
$http.get('rest/registry/customer').success(function(data){
$scope.customers= data;
});
}
})
}
}
}
$scope.printElements = function(){
$http.get('rest/print').success(function(data){
window.open(data, '_blank');
});
}
}]);
gecoRegistryControllers.controller('CustomerDetailCtrl',["$scope","$http","$routeParams","KeyDown","$rootScope","$location",'LoginFactory',function($scope,$http,$routeParams,KeyDown,$rootScope,$location,LoginFactory){
LoginFactory.checklogin();
GECO_validator.startupvalidator();
$scope.listsections = ["Dettagli [ALT +1]","Listini [ALT +2]","Destinazioni [ALT +3]"];
$scope.selectedSection = $scope.listsections[0];
$scope.idcustomer= $routeParams.idcustomer;
$http.get('rest/registry/list').success(function(data){
$scope.lists= data;
});
$http.get('rest/basic/payment').success(function(data){
$scope.payments= data;
$scope.fillPayment();
});
$http.get('rest/basic/categorycustomer').success(function(data){
$scope.categorys= data;
$scope.fillCategory();
});
$http.get('rest/basic/groupcustomer').success(function(data){
$scope.groups= data;
$scope.fillGroups();
});
$http.get('rest/registry/transporter').success(function(data){
$scope.transporters= data;
$scope.fillTransporter();
});
$scope.fillTransporter = function(){
if ($scope.transporters !== null && $scope.transporters != undefined && $scope.customer.transporter !== null && $scope.customer.transporter !== undefined ){
for (var ig=0;ig<$scope.transporters.length;ig++){
if ($scope.customer.transporter != null){
if ($scope.customer.transporter.idTransporter == $scope.transporters[ig].idTransporter){
$scope.currentTransporter = $scope.transporters[ig];
}
}else{
$scope.customer.transporter = {};
}
}
}
}
$scope.getTransporterLabel = function(transporter){
return transporter.transportername + " " +transporter.transportersurname;
}
$scope.fillCategory = function(){
if ($scope.categorys !== null && $scope.categorys != undefined && $scope.customer !== null && $scope.customer !== undefined ){
for (var ig=0;ig<$scope.categorys.length;ig++){
if ($scope.customer.category != null){
if ($scope.customer.category.idCategoryCustomer == $scope.categorys[ig].idCategoryCustomer){
$scope.currentCategory = $scope.categorys[ig];
}
}else{
$scope.customer.category = {};
}
}
}
}
$scope.fillGroups = function(){
if ($scope.groups !== null && $scope.groups != undefined && $scope.customer !== null && $scope.customer !== undefined ){
for (var i=0;i<$scope.groups.length;i++){
if ($scope.customer.group != null){
if ($scope.customer.group.idGroupCustomer == $scope.groups[i].idGroupCustomer){
$scope.currentGroup = $scope.groups[i];
}
}else{
$scope.customer.group = {}
}
}
}
}
$scope.fillPayment = function(){
if ($scope.payments !== null && $scope.payments != undefined && $scope.customer !== null && $scope.customer !== undefined ){
if ($scope.payments != null && $scope.customer.payment != null){
for(var i=0;i<$scope.payments.length;i++ ){
if ($scope.customer.payment.idPayment == $scope.payments[i].idPayment){
$scope.currentPayment = $scope.payments[i];
}
}
}
}
}
$http.get('rest/registry/customer/'+$scope.idcustomer).success(function(data){
$scope.customer= data;
$scope.fillGroups();
$scope.fillCategory();
$scope.fillPayment();
$scope.fillTransporter();
});
$scope.getListName = function(list){
return list.code + ' '+ list.description + ' '+ list.startdate;
}
$scope.addListElement = function(customer){
customer.lists.push({idListCustomer:0});
}
$scope.changeListElement = function(list){
if (list.list != null){
for(var i=0;i<$scope.lists.length;i++){
if (list.list.idList == $scope.lists[i].idList){
$scope.currentList = $scope.lists[i];
}
}
}
$scope.listid = list.idListCustomer
}
$scope.saveCustomer = function(){
$scope.customer.group = $scope.currentGroup;
$scope.customer.category = $scope.currentCategory;
//if (GECO_validator.requiredFields()== true && GECO_validator.emailFields()==true){
$.ajax({
url:"rest/registry/customer",
type:"PUT",
data:"customers="+JSON.stringify($scope.customer),
success:function(data){
result = JSON.parse(data);
if (result.type == "success"){
$scope.customer.idCustomer = result.success;
$scope.idcustomer = result.success;
$scope.confirmSaved();
$location.path("/customer/"+$scope.idcustomer);
$scope.$apply();
}else{
$rootScope.errorMessage("Errore: "+result.errorName+" Messaggio:"+result.errorMessage);
}
}
})
//}
} ;
KeyDown.setupDetail("/customer/0",$scope.saveCustomer,"/customer");
$(document).keydown(function(e){
//ALT +1
if(e.altKey && e.keyCode == 49 ){
$scope.selectedSection = $scope.listsections[0];
$scope.$apply();
}
//ALT +2
if(e.altKey && e.keyCode == 50 ){
$scope.selectedSection = $scope.listsections[1];
$scope.$apply();
}
//ALT +3
if(e.altKey && e.keyCode == 51 ){
$scope.selectedSection = $scope.listsections[2];
$scope.$apply();
}
});
}]);
/****
DESTINATION
**/
gecoRegistryControllers.controller('DestinationListCtrl',["$scope","$http",'LoginFactory',function($scope,$http,LoginFactory){
$scope.loginuser = LoginFactory.checklogin();
$http.get('rest/registry/destination').success(function(data){
$scope.destinations= data;
});
$scope.deleteElement = function(id){
for(var i=0;i<$scope.destinations.length;i++){
if (id == $scope.destinations[i].idDestination){
$scope.deletedestination = $scope.destinations[i];
$.ajax({
url:"rest/registry/destination/",
type:"DELETE",
data:"destinationobj="+JSON.stringify($scope.deletedestination),
success:function(data){
alert("Utente eliminato con successo");
$http.get('rest/registry/destination').success(function(data){
$scope.destinations= data;
});
}
})
}
}
}
$scope.printElements = function(){
$http.get('rest/print').success(function(data){
window.open(data, '_blank');
});
}
}]);
gecoRegistryControllers.controller('DestinationDetailCtrl',["$scope","$http","$routeParams",'LoginFactory',function($scope,$http,$routeParams,LoginFactory){
//LoginFactory.checklogin();
GECO_validator.startupvalidator();
$scope.iddestination= $routeParams.iddestination;
$http.get('rest/registry/customer').success(function(data){
$scope.customers= data;
if ($scope.destination != null ){
for (var i=0;i< $scope.customers.length;i++){
if ($scope.customers[i].idCustomer == $scope.destination.customer.idCustomer){
$scope.currentCustomer = $scope.customers[i];
break;
}
}
}
});
$http.get('rest/registry/destination/'+$scope.iddestination).success(function(data){
$scope.destination= data;
if ($scope.destination.customer != null && $scope.customers != null ){
for (var i=0;i< $scope.customers.length;i++){
if ($scope.customers[i].idCustomer == $scope.destination.customer.idCustomer){
$scope.currentCustomer = $scope.customers[i];
break;
}
}
}
$scope.fillTransporter();
});
$http.get('rest/registry/transporter').success(function(data){
$scope.transporters= data;
$scope.fillTransporter();
});
$scope.fillTransporter = function(){
if ($scope.transporters !== null && $scope.transporters != undefined && $scope.destination.transporter !== null && $scope.destination.transporter !== undefined ){
for (var ig=0;ig<$scope.transporters.length;ig++){
if ($scope.destination.transporter != null){
if ($scope.destination.transporter.idTransporter == $scope.transporters[ig].idTransporter){
$scope.currentTransporter = $scope.transporters[ig];
}
}else{
$scope.destination.transporter = {};
}
}
}
}
$scope.getTransporterLabel = function(transporter){
return transporter.transportername + " " +transporter.transportersurname;
}
$scope.saveDestination = function(){
$scope.destination.customer = $scope.currentCustomer;
//if (GECO_validator.requiredFields()== true && GECO_validator.emailFields()==true){
$.ajax({
url:"rest/registry/destination",
type:"PUT",
data:"destinations="+JSON.stringify($scope.destination),
success:function(data){
result = JSON.parse(data);
if (result.type == "success"){
$scope.destination.idDestination = result.success;
$scope.iddestination = result.success;
$scope.confirmSaved();
$scope.$apply();
}else{
alert("Errore: "+result.errorName+" Messaggio:"+result.errorMessage);
}
}
})
//}
} ;
}]);
/****
SUPPLIER
**/
gecoRegistryControllers.controller('SupplierListCtrl',["$scope","$http","$rootScope",'LoginFactory',function($scope,$http,$rootScope,LoginFactory){
//$scope.loginuser = LoginFactory.checklogin();
if ($scope.pagesize == null ){
$scope.pagesize = 99;
//ScopeFactory.factory.productList.pagesize = 100;
}else{
//$scope.pagesize = ScopeFactory.factory.productList.pagesize
}
$scope.pageArray = [];
if ($scope.showFilter == null){
$scope.showFilter = false;
}
if ($scope.filterSupplier == null){
$scope.filterSupplier = {"pagefilter":{}};
$scope.currentGroup = {};
$scope.currentBrand = {};
$scope.currentCategory = {};
$scope.currentSubCategory = {};
$scope.currentSupplier = {};
}else{
$scope.currentGroup = $scope.filterSupplier.group;
$scope.currentBrand = $scope.filterSupplier.brand;
$scope.currentCategory = $scope.filterSupplier.category;
$scope.currentSubCategory = $scope.filterSupplier.subcategory;
$scope.currentSupplier = $scope.filterSupplier.supplier;
}
$http.get('rest/basic/groupsupplier').success(function(data){
$scope.groups= data;
for (var i=0;i<$scope.groups.length;i++){
if ($scope.currentGroup.idGroupSupplier == $scope.groups[i].idGroupSupplier){
$scope.currentGroup = $scope.groups[i];
}
}
});
$http.get('rest/basic/categorysupplier').success(function(data){
$scope.categorys= data;
for (var i=0;i<$scope.categorys.length;i++){
if ($scope.currentCategory.idCategorySupplier == $scope.categorys[i].idCategorySupplier){
$scope.currentCategory = $scope.categorys[i];
}
}
});
$scope.getSuppliers = function(){
$scope.filterSupplier.pagefilter.startelement = (1 - 1 ) * $scope.pagesize;
$scope.filterSupplier.pagefilter.pageSize = $scope.pagesize;
$rootScope.filterSupplier = $scope.filterSupplier
$.ajax({
url:"rest/registry/supplier/",
type:"POST",
data:"filter="+JSON.stringify($scope.filterSupplier),
success:function(data){
$scope.suppliers= JSON.parse(data);
$scope.$apply();
}
})
}
$scope.getSuppliers();
/*$http.get('rest/registry/supplier').success(function(data){
$scope.suppliers= data;
});*/
$scope.deleteElement = function(id){
for(var i=0;i<$scope.suppliers.length;i++){
if (id == $scope.suppliers[i].idSupplier){
$scope.deletesupplier = $scope.suppliers[i];
$.ajax({
url:"rest/registry/supplier/",
type:"DELETE",
data:"supplierobj="+JSON.stringify($scope.deletesupplier),
success:function(data){
alert("Utente eliminato con successo");
$http.get('rest/registry/supplier').success(function(data){
$scope.suppliers= data;
});
}
})
}
}
}
$scope.printElements = function(){
$http.get('rest/print').success(function(data){
window.open(data, '_blank');
});
}
}]);
gecoRegistryControllers.controller('SupplierDetailCtrl',["$scope","$http","$routeParams",'LoginFactory',function($scope,$http,$routeParams,LoginFactory){
//LoginFactory.checklogin();
$scope.listsections = ["Dettagli","Listini","Destinazioni"];
$scope.selectedSection = $scope.listsections[0];
GECO_validator.startupvalidator();
$scope.idsupplier= $routeParams.idsupplier;
$http.get('rest/basic/payment').success(function(data){
$scope.payments= data;
if ($scope.supplier != null && $scope.supplier.payment != null){
for(var i=0;i<$scope.payments.length;i++ ){
if ($scope.supplier.payment.idPayment == $scope.payments[i].idPayment){
$scope.currentPayment = $scope.payments[i];
}
}
}
});
$http.get('rest/basic/groupsupplier').success(function(data){
$scope.groups= data;
});
$http.get('rest/registry/list').success(function(data){
$scope.lists= data;
});
$http.get('rest/registry/supplier/'+$scope.idsupplier).success(function(data){
$scope.supplier= data;
if ($scope.payments != null && $scope.supplier.payment != null){
for(var i=0;i<$scope.payments.length;i++ ){
if ($scope.supplier.payment.idPayment == $scope.payments[i].idPayment){
$scope.currentPayment = $scope.payments[i];
}
}
}
for (var i=0;i<$scope.groups.length;i++){
if ($scope.supplier.group != null){
if ($scope.supplier.group.idGroupSupplier == $scope.groups[i].idGroupSupplier){
$scope.currentGroup = $scope.groups[i];
}
}else{
$scope.supplier.group = {}
}
}
$http.get('rest/basic/categorysupplier').success(function(data){
$scope.categorys= data;
for (var ig=0;ig<$scope.categorys.length;ig++){
if ($scope.supplier.category != null){
if ($scope.supplier.category.idCategorySupplier == $scope.categorys[ig].idCategorySupplier){
$scope.currentCategory = $scope.categorys[ig];
}
}else{
$scope.supplier.category = {};
}
}
});
});
$scope.getListName = function(list){
return list.code + ' '+ list.description + ' '+ list.startdate;
}
$scope.addListElement = function(supplier){
supplier.lists.push({idListSupplier:0});
}
$scope.changeListElement = function(list){
if (list.list != null){
for(var i=0;i<$scope.lists.length;i++){
if (list.list.idListMeasure == $scope.lists[i].idListMeasure){
$scope.currentList = $scope.lists[i];
}
}
}
$scope.listid = list.idListSupplier
}
$scope.saveSupplier = function(){
$scope.supplier.group = $scope.currentGroup;
$scope.supplier.category = $scope.currentCategory;
//if (GECO_validator.requiredFields()== true && GECO_validator.emailFields()==true){
$.ajax({
url:"rest/registry/supplier",
type:"PUT",
data:"suppliers="+JSON.stringify($scope.supplier),
success:function(data){
result = JSON.parse(data);
if (result.type == "success"){
$scope.supplier.idSupplier = result.success;
$scope.idsupplier = result.success;
alert("success");
$scope.$apply();
}else{
alert("Errore: "+result.errorName+" Messaggio:"+result.errorMessage);
}
}
})
//}
} ;
}]);
/****
TRANSPORTER
**/
gecoRegistryControllers.controller('TransporterListCtrl',["$scope","$http",'LoginFactory',function($scope,$http,LoginFactory){
//$scope.loginuser = LoginFactory.checklogin();
$http.get('rest/registry/transporter').success(function(data){
$scope.transporters= data;
});
$scope.deleteElement = function(id){
for(var i=0;i<$scope.transporters.length;i++){
if (id == $scope.transporters[i].idTransporter){
$scope.deletetransporter = $scope.transporters[i];
$.ajax({
url:"rest/registry/transporter/",
type:"DELETE",
data:"transporterobj="+JSON.stringify($scope.deletetransporter),
success:function(data){
alert("Utente eliminato con successo");
$http.get('rest/registry/transporter').success(function(data){
$scope.transporters= data;
});
}
})
}
}
}
$scope.printElements = function(){
$http.get('rest/print').success(function(data){
window.open(data, '_blank');
});
}
}]);
gecoRegistryControllers.controller('TransporterDetailCtrl',["$scope","$http","$routeParams",'LoginFactory',function($scope,$http,$routeParams,LoginFactory){
//LoginFactory.checklogin();
$scope.listsections = ["Dettagli","Listini","Destinazioni"];
$scope.selectedSection = $scope.listsections[0];
GECO_validator.startupvalidator();
$scope.idtransporter= $routeParams.idtransporter;
$http.get('rest/registry/list').success(function(data){
$scope.lists= data;
});
$http.get('rest/registry/transporter/'+$scope.idtransporter).success(function(data){
$scope.transporter= data;
});
$scope.getListName = function(list){
return list.code + ' '+ list.description + ' '+ list.startdate;
}
$scope.addListElement = function(transporter){
transporter.lists.push({idListTransporter:0});
}
$scope.changeListElement = function(list){
if (list.list != null){
for(var i=0;i<$scope.lists.length;i++){
if (list.list.idListMeasure == $scope.lists[i].idListMeasure){
$scope.currentList = $scope.lists[i];
}
}
}
$scope.listid = list.idListTransporter
}
$scope.saveTransporter = function(){
//if (GECO_validator.requiredFields()== true && GECO_validator.emailFields()==true){
$.ajax({
url:"rest/registry/transporter",
type:"PUT",
data:"transporters="+JSON.stringify($scope.transporter),
success:function(data){
result = JSON.parse(data);
if (result.type == "success"){
$scope.transporter.idTransporter = result.success;
$scope.idtransporter = result.success;
alert("success");
$scope.$apply();
}else{
alert("Errore: "+result.errorName+" Messaggio:"+result.errorMessage);
}
}
})
//}
} ;
}]);
|
const {
GraphQLString,
GraphQLList,
GraphQLNonNull,
GraphQLInputObjectType,
} = require('graphql');
const CodeScalar = require('../scalars/code.scalar.js');
const UriScalar = require('../scalars/uri.scalar.js');
/**
* @name exports
* @summary Subscriptionchannel Input Schema
*/
module.exports = new GraphQLInputObjectType({
name: 'Subscriptionchannel_Input',
description: '',
fields: () => ({
_id: {
type: require('./element.input.js'),
description:
'unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.',
},
id: {
type: GraphQLString,
description:
'unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.',
},
extension: {
type: new GraphQLList(require('./extension.input.js')),
description:
'May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.',
},
modifierExtension: {
type: new GraphQLList(require('./extension.input.js')),
description:
'May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.',
},
_type: {
type: require('./element.input.js'),
description: 'The type of channel to send notifications on.',
},
// valueSetReference: http://hl7.org/fhir/ValueSet/subscription-channel-type
type: {
type: new GraphQLNonNull(CodeScalar),
description: 'The type of channel to send notifications on.',
},
_endpoint: {
type: require('./element.input.js'),
description:
'The uri that describes the actual end-point to send messages to.',
},
endpoint: {
type: UriScalar,
description:
'The uri that describes the actual end-point to send messages to.',
},
_payload: {
type: require('./element.input.js'),
description:
'The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification.',
},
payload: {
type: GraphQLString,
description:
'The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification.',
},
_header: {
type: require('./element.input.js'),
description:
'Additional headers / information to send as part of the notification.',
},
header: {
type: new GraphQLList(GraphQLString),
description:
'Additional headers / information to send as part of the notification.',
},
}),
});
|
async function loginFormHandler(event) {
event.preventDefault();
const username = document.querySelector('#login-username-input').value.trim();
const password = document.querySelector('#login-password-input').value.trim();
console.log("clicked the button");
if (username && password) {
const response = await fetch('/api/users/login', {
method: 'post',
body: JSON.stringify({
username,
password
}),
headers: { 'Content-Type': 'application/json' }
});
if (response.ok) {
document.location.replace('/home');
} else {
alert('Invalid Login, Please check the Username and Password!');
}
}
}
document.querySelector('#loginModalBtn').addEventListener('click', loginFormHandler);
|
var ghpages = require('gh-pages');
ghpages.publish('build', {
remote: 'my',
repo: 'git@github.com:wangchungeng/walletconnect-example.git',
}, function(err) {
console.log('deploy:', err)
});
|
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Position } from '../../core/position.js';
import { Range } from '../../core/range.js';
import { FindMatch } from '../../model.js';
import { SENTINEL, TreeNode, fixInsert, leftest, rbDelete, righttest, updateTreeMetadata } from './rbTreeBase.js';
import { Searcher, createFindMatch, isValidMatch } from '../textModelSearch.js';
// const lfRegex = new RegExp(/\r\n|\r|\n/g);
export const AverageBufferSize = 65535;
export function createUintArray(arr) {
let r;
if (arr[arr.length - 1] < 65536) {
r = new Uint16Array(arr.length);
}
else {
r = new Uint32Array(arr.length);
}
r.set(arr, 0);
return r;
}
export class LineStarts {
constructor(lineStarts, cr, lf, crlf, isBasicASCII) {
this.lineStarts = lineStarts;
this.cr = cr;
this.lf = lf;
this.crlf = crlf;
this.isBasicASCII = isBasicASCII;
}
}
export function createLineStartsFast(str, readonly = true) {
let r = [0], rLength = 1;
for (let i = 0, len = str.length; i < len; i++) {
const chr = str.charCodeAt(i);
if (chr === 13 /* CarriageReturn */) {
if (i + 1 < len && str.charCodeAt(i + 1) === 10 /* LineFeed */) {
// \r\n... case
r[rLength++] = i + 2;
i++; // skip \n
}
else {
// \r... case
r[rLength++] = i + 1;
}
}
else if (chr === 10 /* LineFeed */) {
r[rLength++] = i + 1;
}
}
if (readonly) {
return createUintArray(r);
}
else {
return r;
}
}
export function createLineStarts(r, str) {
r.length = 0;
r[0] = 0;
let rLength = 1;
let cr = 0, lf = 0, crlf = 0;
let isBasicASCII = true;
for (let i = 0, len = str.length; i < len; i++) {
const chr = str.charCodeAt(i);
if (chr === 13 /* CarriageReturn */) {
if (i + 1 < len && str.charCodeAt(i + 1) === 10 /* LineFeed */) {
// \r\n... case
crlf++;
r[rLength++] = i + 2;
i++; // skip \n
}
else {
cr++;
// \r... case
r[rLength++] = i + 1;
}
}
else if (chr === 10 /* LineFeed */) {
lf++;
r[rLength++] = i + 1;
}
else {
if (isBasicASCII) {
if (chr !== 9 /* Tab */ && (chr < 32 || chr > 126)) {
isBasicASCII = false;
}
}
}
}
const result = new LineStarts(createUintArray(r), cr, lf, crlf, isBasicASCII);
r.length = 0;
return result;
}
export class Piece {
constructor(bufferIndex, start, end, lineFeedCnt, length) {
this.bufferIndex = bufferIndex;
this.start = start;
this.end = end;
this.lineFeedCnt = lineFeedCnt;
this.length = length;
}
}
export class StringBuffer {
constructor(buffer, lineStarts) {
this.buffer = buffer;
this.lineStarts = lineStarts;
}
}
/**
* Readonly snapshot for piece tree.
* In a real multiple thread environment, to make snapshot reading always work correctly, we need to
* 1. Make TreeNode.piece immutable, then reading and writing can run in parallel.
* 2. TreeNode/Buffers normalization should not happen during snapshot reading.
*/
class PieceTreeSnapshot {
constructor(tree, BOM) {
this._pieces = [];
this._tree = tree;
this._BOM = BOM;
this._index = 0;
if (tree.root !== SENTINEL) {
tree.iterate(tree.root, node => {
if (node !== SENTINEL) {
this._pieces.push(node.piece);
}
return true;
});
}
}
read() {
if (this._pieces.length === 0) {
if (this._index === 0) {
this._index++;
return this._BOM;
}
else {
return null;
}
}
if (this._index > this._pieces.length - 1) {
return null;
}
if (this._index === 0) {
return this._BOM + this._tree.getPieceContent(this._pieces[this._index++]);
}
return this._tree.getPieceContent(this._pieces[this._index++]);
}
}
class PieceTreeSearchCache {
constructor(limit) {
this._limit = limit;
this._cache = [];
}
get(offset) {
for (let i = this._cache.length - 1; i >= 0; i--) {
let nodePos = this._cache[i];
if (nodePos.nodeStartOffset <= offset && nodePos.nodeStartOffset + nodePos.node.piece.length >= offset) {
return nodePos;
}
}
return null;
}
get2(lineNumber) {
for (let i = this._cache.length - 1; i >= 0; i--) {
let nodePos = this._cache[i];
if (nodePos.nodeStartLineNumber && nodePos.nodeStartLineNumber < lineNumber && nodePos.nodeStartLineNumber + nodePos.node.piece.lineFeedCnt >= lineNumber) {
return nodePos;
}
}
return null;
}
set(nodePosition) {
if (this._cache.length >= this._limit) {
this._cache.shift();
}
this._cache.push(nodePosition);
}
validate(offset) {
let hasInvalidVal = false;
let tmp = this._cache;
for (let i = 0; i < tmp.length; i++) {
let nodePos = tmp[i];
if (nodePos.node.parent === null || nodePos.nodeStartOffset >= offset) {
tmp[i] = null;
hasInvalidVal = true;
continue;
}
}
if (hasInvalidVal) {
let newArr = [];
for (const entry of tmp) {
if (entry !== null) {
newArr.push(entry);
}
}
this._cache = newArr;
}
}
}
export class PieceTreeBase {
constructor(chunks, eol, eolNormalized) {
this.create(chunks, eol, eolNormalized);
}
create(chunks, eol, eolNormalized) {
this._buffers = [
new StringBuffer('', [0])
];
this._lastChangeBufferPos = { line: 0, column: 0 };
this.root = SENTINEL;
this._lineCnt = 1;
this._length = 0;
this._EOL = eol;
this._EOLLength = eol.length;
this._EOLNormalized = eolNormalized;
let lastNode = null;
for (let i = 0, len = chunks.length; i < len; i++) {
if (chunks[i].buffer.length > 0) {
if (!chunks[i].lineStarts) {
chunks[i].lineStarts = createLineStartsFast(chunks[i].buffer);
}
let piece = new Piece(i + 1, { line: 0, column: 0 }, { line: chunks[i].lineStarts.length - 1, column: chunks[i].buffer.length - chunks[i].lineStarts[chunks[i].lineStarts.length - 1] }, chunks[i].lineStarts.length - 1, chunks[i].buffer.length);
this._buffers.push(chunks[i]);
lastNode = this.rbInsertRight(lastNode, piece);
}
}
this._searchCache = new PieceTreeSearchCache(1);
this._lastVisitedLine = { lineNumber: 0, value: '' };
this.computeBufferMetadata();
}
normalizeEOL(eol) {
let averageBufferSize = AverageBufferSize;
let min = averageBufferSize - Math.floor(averageBufferSize / 3);
let max = min * 2;
let tempChunk = '';
let tempChunkLen = 0;
let chunks = [];
this.iterate(this.root, node => {
let str = this.getNodeContent(node);
let len = str.length;
if (tempChunkLen <= min || tempChunkLen + len < max) {
tempChunk += str;
tempChunkLen += len;
return true;
}
// flush anyways
let text = tempChunk.replace(/\r\n|\r|\n/g, eol);
chunks.push(new StringBuffer(text, createLineStartsFast(text)));
tempChunk = str;
tempChunkLen = len;
return true;
});
if (tempChunkLen > 0) {
let text = tempChunk.replace(/\r\n|\r|\n/g, eol);
chunks.push(new StringBuffer(text, createLineStartsFast(text)));
}
this.create(chunks, eol, true);
}
// #region Buffer API
getEOL() {
return this._EOL;
}
setEOL(newEOL) {
this._EOL = newEOL;
this._EOLLength = this._EOL.length;
this.normalizeEOL(newEOL);
}
createSnapshot(BOM) {
return new PieceTreeSnapshot(this, BOM);
}
getOffsetAt(lineNumber, column) {
let leftLen = 0; // inorder
let x = this.root;
while (x !== SENTINEL) {
if (x.left !== SENTINEL && x.lf_left + 1 >= lineNumber) {
x = x.left;
}
else if (x.lf_left + x.piece.lineFeedCnt + 1 >= lineNumber) {
leftLen += x.size_left;
// lineNumber >= 2
let accumualtedValInCurrentIndex = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);
return leftLen += accumualtedValInCurrentIndex + column - 1;
}
else {
lineNumber -= x.lf_left + x.piece.lineFeedCnt;
leftLen += x.size_left + x.piece.length;
x = x.right;
}
}
return leftLen;
}
getPositionAt(offset) {
offset = Math.floor(offset);
offset = Math.max(0, offset);
let x = this.root;
let lfCnt = 0;
let originalOffset = offset;
while (x !== SENTINEL) {
if (x.size_left !== 0 && x.size_left >= offset) {
x = x.left;
}
else if (x.size_left + x.piece.length >= offset) {
let out = this.getIndexOf(x, offset - x.size_left);
lfCnt += x.lf_left + out.index;
if (out.index === 0) {
let lineStartOffset = this.getOffsetAt(lfCnt + 1, 1);
let column = originalOffset - lineStartOffset;
return new Position(lfCnt + 1, column + 1);
}
return new Position(lfCnt + 1, out.remainder + 1);
}
else {
offset -= x.size_left + x.piece.length;
lfCnt += x.lf_left + x.piece.lineFeedCnt;
if (x.right === SENTINEL) {
// last node
let lineStartOffset = this.getOffsetAt(lfCnt + 1, 1);
let column = originalOffset - offset - lineStartOffset;
return new Position(lfCnt + 1, column + 1);
}
else {
x = x.right;
}
}
}
return new Position(1, 1);
}
getValueInRange(range, eol) {
if (range.startLineNumber === range.endLineNumber && range.startColumn === range.endColumn) {
return '';
}
let startPosition = this.nodeAt2(range.startLineNumber, range.startColumn);
let endPosition = this.nodeAt2(range.endLineNumber, range.endColumn);
let value = this.getValueInRange2(startPosition, endPosition);
if (eol) {
if (eol !== this._EOL || !this._EOLNormalized) {
return value.replace(/\r\n|\r|\n/g, eol);
}
if (eol === this.getEOL() && this._EOLNormalized) {
if (eol === '\r\n') {
}
return value;
}
return value.replace(/\r\n|\r|\n/g, eol);
}
return value;
}
getValueInRange2(startPosition, endPosition) {
if (startPosition.node === endPosition.node) {
let node = startPosition.node;
let buffer = this._buffers[node.piece.bufferIndex].buffer;
let startOffset = this.offsetInBuffer(node.piece.bufferIndex, node.piece.start);
return buffer.substring(startOffset + startPosition.remainder, startOffset + endPosition.remainder);
}
let x = startPosition.node;
let buffer = this._buffers[x.piece.bufferIndex].buffer;
let startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
let ret = buffer.substring(startOffset + startPosition.remainder, startOffset + x.piece.length);
x = x.next();
while (x !== SENTINEL) {
let buffer = this._buffers[x.piece.bufferIndex].buffer;
let startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
if (x === endPosition.node) {
ret += buffer.substring(startOffset, startOffset + endPosition.remainder);
break;
}
else {
ret += buffer.substr(startOffset, x.piece.length);
}
x = x.next();
}
return ret;
}
getLinesContent() {
let lines = [];
let linesLength = 0;
let currentLine = '';
let danglingCR = false;
this.iterate(this.root, node => {
if (node === SENTINEL) {
return true;
}
const piece = node.piece;
let pieceLength = piece.length;
if (pieceLength === 0) {
return true;
}
const buffer = this._buffers[piece.bufferIndex].buffer;
const lineStarts = this._buffers[piece.bufferIndex].lineStarts;
const pieceStartLine = piece.start.line;
const pieceEndLine = piece.end.line;
let pieceStartOffset = lineStarts[pieceStartLine] + piece.start.column;
if (danglingCR) {
if (buffer.charCodeAt(pieceStartOffset) === 10 /* LineFeed */) {
// pretend the \n was in the previous piece..
pieceStartOffset++;
pieceLength--;
}
lines[linesLength++] = currentLine;
currentLine = '';
danglingCR = false;
if (pieceLength === 0) {
return true;
}
}
if (pieceStartLine === pieceEndLine) {
// this piece has no new lines
if (!this._EOLNormalized && buffer.charCodeAt(pieceStartOffset + pieceLength - 1) === 13 /* CarriageReturn */) {
danglingCR = true;
currentLine += buffer.substr(pieceStartOffset, pieceLength - 1);
}
else {
currentLine += buffer.substr(pieceStartOffset, pieceLength);
}
return true;
}
// add the text before the first line start in this piece
currentLine += (this._EOLNormalized
? buffer.substring(pieceStartOffset, Math.max(pieceStartOffset, lineStarts[pieceStartLine + 1] - this._EOLLength))
: buffer.substring(pieceStartOffset, lineStarts[pieceStartLine + 1]).replace(/(\r\n|\r|\n)$/, ''));
lines[linesLength++] = currentLine;
for (let line = pieceStartLine + 1; line < pieceEndLine; line++) {
currentLine = (this._EOLNormalized
? buffer.substring(lineStarts[line], lineStarts[line + 1] - this._EOLLength)
: buffer.substring(lineStarts[line], lineStarts[line + 1]).replace(/(\r\n|\r|\n)$/, ''));
lines[linesLength++] = currentLine;
}
if (!this._EOLNormalized && buffer.charCodeAt(lineStarts[pieceEndLine] + piece.end.column - 1) === 13 /* CarriageReturn */) {
danglingCR = true;
if (piece.end.column === 0) {
// The last line ended with a \r, let's undo the push, it will be pushed by next iteration
linesLength--;
}
else {
currentLine = buffer.substr(lineStarts[pieceEndLine], piece.end.column - 1);
}
}
else {
currentLine = buffer.substr(lineStarts[pieceEndLine], piece.end.column);
}
return true;
});
if (danglingCR) {
lines[linesLength++] = currentLine;
currentLine = '';
}
lines[linesLength++] = currentLine;
return lines;
}
getLength() {
return this._length;
}
getLineCount() {
return this._lineCnt;
}
getLineContent(lineNumber) {
if (this._lastVisitedLine.lineNumber === lineNumber) {
return this._lastVisitedLine.value;
}
this._lastVisitedLine.lineNumber = lineNumber;
if (lineNumber === this._lineCnt) {
this._lastVisitedLine.value = this.getLineRawContent(lineNumber);
}
else if (this._EOLNormalized) {
this._lastVisitedLine.value = this.getLineRawContent(lineNumber, this._EOLLength);
}
else {
this._lastVisitedLine.value = this.getLineRawContent(lineNumber).replace(/(\r\n|\r|\n)$/, '');
}
return this._lastVisitedLine.value;
}
_getCharCode(nodePos) {
if (nodePos.remainder === nodePos.node.piece.length) {
// the char we want to fetch is at the head of next node.
let matchingNode = nodePos.node.next();
if (!matchingNode) {
return 0;
}
let buffer = this._buffers[matchingNode.piece.bufferIndex];
let startOffset = this.offsetInBuffer(matchingNode.piece.bufferIndex, matchingNode.piece.start);
return buffer.buffer.charCodeAt(startOffset);
}
else {
let buffer = this._buffers[nodePos.node.piece.bufferIndex];
let startOffset = this.offsetInBuffer(nodePos.node.piece.bufferIndex, nodePos.node.piece.start);
let targetOffset = startOffset + nodePos.remainder;
return buffer.buffer.charCodeAt(targetOffset);
}
}
getLineCharCode(lineNumber, index) {
let nodePos = this.nodeAt2(lineNumber, index + 1);
return this._getCharCode(nodePos);
}
getLineLength(lineNumber) {
if (lineNumber === this.getLineCount()) {
let startOffset = this.getOffsetAt(lineNumber, 1);
return this.getLength() - startOffset;
}
return this.getOffsetAt(lineNumber + 1, 1) - this.getOffsetAt(lineNumber, 1) - this._EOLLength;
}
findMatchesInNode(node, searcher, startLineNumber, startColumn, startCursor, endCursor, searchData, captureMatches, limitResultCount, resultLen, result) {
let buffer = this._buffers[node.piece.bufferIndex];
let startOffsetInBuffer = this.offsetInBuffer(node.piece.bufferIndex, node.piece.start);
let start = this.offsetInBuffer(node.piece.bufferIndex, startCursor);
let end = this.offsetInBuffer(node.piece.bufferIndex, endCursor);
let m;
// Reset regex to search from the beginning
let ret = { line: 0, column: 0 };
let searchText;
let offsetInBuffer;
if (searcher._wordSeparators) {
searchText = buffer.buffer.substring(start, end);
offsetInBuffer = (offset) => offset + start;
searcher.reset(0);
}
else {
searchText = buffer.buffer;
offsetInBuffer = (offset) => offset;
searcher.reset(start);
}
do {
m = searcher.next(searchText);
if (m) {
if (offsetInBuffer(m.index) >= end) {
return resultLen;
}
this.positionInBuffer(node, offsetInBuffer(m.index) - startOffsetInBuffer, ret);
let lineFeedCnt = this.getLineFeedCnt(node.piece.bufferIndex, startCursor, ret);
let retStartColumn = ret.line === startCursor.line ? ret.column - startCursor.column + startColumn : ret.column + 1;
let retEndColumn = retStartColumn + m[0].length;
result[resultLen++] = createFindMatch(new Range(startLineNumber + lineFeedCnt, retStartColumn, startLineNumber + lineFeedCnt, retEndColumn), m, captureMatches);
if (offsetInBuffer(m.index) + m[0].length >= end) {
return resultLen;
}
if (resultLen >= limitResultCount) {
return resultLen;
}
}
} while (m);
return resultLen;
}
findMatchesLineByLine(searchRange, searchData, captureMatches, limitResultCount) {
const result = [];
let resultLen = 0;
const searcher = new Searcher(searchData.wordSeparators, searchData.regex);
let startPosition = this.nodeAt2(searchRange.startLineNumber, searchRange.startColumn);
if (startPosition === null) {
return [];
}
let endPosition = this.nodeAt2(searchRange.endLineNumber, searchRange.endColumn);
if (endPosition === null) {
return [];
}
let start = this.positionInBuffer(startPosition.node, startPosition.remainder);
let end = this.positionInBuffer(endPosition.node, endPosition.remainder);
if (startPosition.node === endPosition.node) {
this.findMatchesInNode(startPosition.node, searcher, searchRange.startLineNumber, searchRange.startColumn, start, end, searchData, captureMatches, limitResultCount, resultLen, result);
return result;
}
let startLineNumber = searchRange.startLineNumber;
let currentNode = startPosition.node;
while (currentNode !== endPosition.node) {
let lineBreakCnt = this.getLineFeedCnt(currentNode.piece.bufferIndex, start, currentNode.piece.end);
if (lineBreakCnt >= 1) {
// last line break position
let lineStarts = this._buffers[currentNode.piece.bufferIndex].lineStarts;
let startOffsetInBuffer = this.offsetInBuffer(currentNode.piece.bufferIndex, currentNode.piece.start);
let nextLineStartOffset = lineStarts[start.line + lineBreakCnt];
let startColumn = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn : 1;
resultLen = this.findMatchesInNode(currentNode, searcher, startLineNumber, startColumn, start, this.positionInBuffer(currentNode, nextLineStartOffset - startOffsetInBuffer), searchData, captureMatches, limitResultCount, resultLen, result);
if (resultLen >= limitResultCount) {
return result;
}
startLineNumber += lineBreakCnt;
}
let startColumn = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn - 1 : 0;
// search for the remaining content
if (startLineNumber === searchRange.endLineNumber) {
const text = this.getLineContent(startLineNumber).substring(startColumn, searchRange.endColumn - 1);
resultLen = this._findMatchesInLine(searchData, searcher, text, searchRange.endLineNumber, startColumn, resultLen, result, captureMatches, limitResultCount);
return result;
}
resultLen = this._findMatchesInLine(searchData, searcher, this.getLineContent(startLineNumber).substr(startColumn), startLineNumber, startColumn, resultLen, result, captureMatches, limitResultCount);
if (resultLen >= limitResultCount) {
return result;
}
startLineNumber++;
startPosition = this.nodeAt2(startLineNumber, 1);
currentNode = startPosition.node;
start = this.positionInBuffer(startPosition.node, startPosition.remainder);
}
if (startLineNumber === searchRange.endLineNumber) {
let startColumn = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn - 1 : 0;
const text = this.getLineContent(startLineNumber).substring(startColumn, searchRange.endColumn - 1);
resultLen = this._findMatchesInLine(searchData, searcher, text, searchRange.endLineNumber, startColumn, resultLen, result, captureMatches, limitResultCount);
return result;
}
let startColumn = startLineNumber === searchRange.startLineNumber ? searchRange.startColumn : 1;
resultLen = this.findMatchesInNode(endPosition.node, searcher, startLineNumber, startColumn, start, end, searchData, captureMatches, limitResultCount, resultLen, result);
return result;
}
_findMatchesInLine(searchData, searcher, text, lineNumber, deltaOffset, resultLen, result, captureMatches, limitResultCount) {
const wordSeparators = searchData.wordSeparators;
if (!captureMatches && searchData.simpleSearch) {
const searchString = searchData.simpleSearch;
const searchStringLen = searchString.length;
const textLength = text.length;
let lastMatchIndex = -searchStringLen;
while ((lastMatchIndex = text.indexOf(searchString, lastMatchIndex + searchStringLen)) !== -1) {
if (!wordSeparators || isValidMatch(wordSeparators, text, textLength, lastMatchIndex, searchStringLen)) {
result[resultLen++] = new FindMatch(new Range(lineNumber, lastMatchIndex + 1 + deltaOffset, lineNumber, lastMatchIndex + 1 + searchStringLen + deltaOffset), null);
if (resultLen >= limitResultCount) {
return resultLen;
}
}
}
return resultLen;
}
let m;
// Reset regex to search from the beginning
searcher.reset(0);
do {
m = searcher.next(text);
if (m) {
result[resultLen++] = createFindMatch(new Range(lineNumber, m.index + 1 + deltaOffset, lineNumber, m.index + 1 + m[0].length + deltaOffset), m, captureMatches);
if (resultLen >= limitResultCount) {
return resultLen;
}
}
} while (m);
return resultLen;
}
// #endregion
// #region Piece Table
insert(offset, value, eolNormalized = false) {
this._EOLNormalized = this._EOLNormalized && eolNormalized;
this._lastVisitedLine.lineNumber = 0;
this._lastVisitedLine.value = '';
if (this.root !== SENTINEL) {
let { node, remainder, nodeStartOffset } = this.nodeAt(offset);
let piece = node.piece;
let bufferIndex = piece.bufferIndex;
let insertPosInBuffer = this.positionInBuffer(node, remainder);
if (node.piece.bufferIndex === 0 &&
piece.end.line === this._lastChangeBufferPos.line &&
piece.end.column === this._lastChangeBufferPos.column &&
(nodeStartOffset + piece.length === offset) &&
value.length < AverageBufferSize) {
// changed buffer
this.appendToNode(node, value);
this.computeBufferMetadata();
return;
}
if (nodeStartOffset === offset) {
this.insertContentToNodeLeft(value, node);
this._searchCache.validate(offset);
}
else if (nodeStartOffset + node.piece.length > offset) {
// we are inserting into the middle of a node.
let nodesToDel = [];
let newRightPiece = new Piece(piece.bufferIndex, insertPosInBuffer, piece.end, this.getLineFeedCnt(piece.bufferIndex, insertPosInBuffer, piece.end), this.offsetInBuffer(bufferIndex, piece.end) - this.offsetInBuffer(bufferIndex, insertPosInBuffer));
if (this.shouldCheckCRLF() && this.endWithCR(value)) {
let headOfRight = this.nodeCharCodeAt(node, remainder);
if (headOfRight === 10 /** \n */) {
let newStart = { line: newRightPiece.start.line + 1, column: 0 };
newRightPiece = new Piece(newRightPiece.bufferIndex, newStart, newRightPiece.end, this.getLineFeedCnt(newRightPiece.bufferIndex, newStart, newRightPiece.end), newRightPiece.length - 1);
value += '\n';
}
}
// reuse node for content before insertion point.
if (this.shouldCheckCRLF() && this.startWithLF(value)) {
let tailOfLeft = this.nodeCharCodeAt(node, remainder - 1);
if (tailOfLeft === 13 /** \r */) {
let previousPos = this.positionInBuffer(node, remainder - 1);
this.deleteNodeTail(node, previousPos);
value = '\r' + value;
if (node.piece.length === 0) {
nodesToDel.push(node);
}
}
else {
this.deleteNodeTail(node, insertPosInBuffer);
}
}
else {
this.deleteNodeTail(node, insertPosInBuffer);
}
let newPieces = this.createNewPieces(value);
if (newRightPiece.length > 0) {
this.rbInsertRight(node, newRightPiece);
}
let tmpNode = node;
for (let k = 0; k < newPieces.length; k++) {
tmpNode = this.rbInsertRight(tmpNode, newPieces[k]);
}
this.deleteNodes(nodesToDel);
}
else {
this.insertContentToNodeRight(value, node);
}
}
else {
// insert new node
let pieces = this.createNewPieces(value);
let node = this.rbInsertLeft(null, pieces[0]);
for (let k = 1; k < pieces.length; k++) {
node = this.rbInsertRight(node, pieces[k]);
}
}
// todo, this is too brutal. Total line feed count should be updated the same way as lf_left.
this.computeBufferMetadata();
}
delete(offset, cnt) {
this._lastVisitedLine.lineNumber = 0;
this._lastVisitedLine.value = '';
if (cnt <= 0 || this.root === SENTINEL) {
return;
}
let startPosition = this.nodeAt(offset);
let endPosition = this.nodeAt(offset + cnt);
let startNode = startPosition.node;
let endNode = endPosition.node;
if (startNode === endNode) {
let startSplitPosInBuffer = this.positionInBuffer(startNode, startPosition.remainder);
let endSplitPosInBuffer = this.positionInBuffer(startNode, endPosition.remainder);
if (startPosition.nodeStartOffset === offset) {
if (cnt === startNode.piece.length) { // delete node
let next = startNode.next();
rbDelete(this, startNode);
this.validateCRLFWithPrevNode(next);
this.computeBufferMetadata();
return;
}
this.deleteNodeHead(startNode, endSplitPosInBuffer);
this._searchCache.validate(offset);
this.validateCRLFWithPrevNode(startNode);
this.computeBufferMetadata();
return;
}
if (startPosition.nodeStartOffset + startNode.piece.length === offset + cnt) {
this.deleteNodeTail(startNode, startSplitPosInBuffer);
this.validateCRLFWithNextNode(startNode);
this.computeBufferMetadata();
return;
}
// delete content in the middle, this node will be splitted to nodes
this.shrinkNode(startNode, startSplitPosInBuffer, endSplitPosInBuffer);
this.computeBufferMetadata();
return;
}
let nodesToDel = [];
let startSplitPosInBuffer = this.positionInBuffer(startNode, startPosition.remainder);
this.deleteNodeTail(startNode, startSplitPosInBuffer);
this._searchCache.validate(offset);
if (startNode.piece.length === 0) {
nodesToDel.push(startNode);
}
// update last touched node
let endSplitPosInBuffer = this.positionInBuffer(endNode, endPosition.remainder);
this.deleteNodeHead(endNode, endSplitPosInBuffer);
if (endNode.piece.length === 0) {
nodesToDel.push(endNode);
}
// delete nodes in between
let secondNode = startNode.next();
for (let node = secondNode; node !== SENTINEL && node !== endNode; node = node.next()) {
nodesToDel.push(node);
}
let prev = startNode.piece.length === 0 ? startNode.prev() : startNode;
this.deleteNodes(nodesToDel);
this.validateCRLFWithNextNode(prev);
this.computeBufferMetadata();
}
insertContentToNodeLeft(value, node) {
// we are inserting content to the beginning of node
let nodesToDel = [];
if (this.shouldCheckCRLF() && this.endWithCR(value) && this.startWithLF(node)) {
// move `\n` to new node.
let piece = node.piece;
let newStart = { line: piece.start.line + 1, column: 0 };
let nPiece = new Piece(piece.bufferIndex, newStart, piece.end, this.getLineFeedCnt(piece.bufferIndex, newStart, piece.end), piece.length - 1);
node.piece = nPiece;
value += '\n';
updateTreeMetadata(this, node, -1, -1);
if (node.piece.length === 0) {
nodesToDel.push(node);
}
}
let newPieces = this.createNewPieces(value);
let newNode = this.rbInsertLeft(node, newPieces[newPieces.length - 1]);
for (let k = newPieces.length - 2; k >= 0; k--) {
newNode = this.rbInsertLeft(newNode, newPieces[k]);
}
this.validateCRLFWithPrevNode(newNode);
this.deleteNodes(nodesToDel);
}
insertContentToNodeRight(value, node) {
// we are inserting to the right of this node.
if (this.adjustCarriageReturnFromNext(value, node)) {
// move \n to the new node.
value += '\n';
}
let newPieces = this.createNewPieces(value);
let newNode = this.rbInsertRight(node, newPieces[0]);
let tmpNode = newNode;
for (let k = 1; k < newPieces.length; k++) {
tmpNode = this.rbInsertRight(tmpNode, newPieces[k]);
}
this.validateCRLFWithPrevNode(newNode);
}
positionInBuffer(node, remainder, ret) {
let piece = node.piece;
let bufferIndex = node.piece.bufferIndex;
let lineStarts = this._buffers[bufferIndex].lineStarts;
let startOffset = lineStarts[piece.start.line] + piece.start.column;
let offset = startOffset + remainder;
// binary search offset between startOffset and endOffset
let low = piece.start.line;
let high = piece.end.line;
let mid = 0;
let midStop = 0;
let midStart = 0;
while (low <= high) {
mid = low + ((high - low) / 2) | 0;
midStart = lineStarts[mid];
if (mid === high) {
break;
}
midStop = lineStarts[mid + 1];
if (offset < midStart) {
high = mid - 1;
}
else if (offset >= midStop) {
low = mid + 1;
}
else {
break;
}
}
if (ret) {
ret.line = mid;
ret.column = offset - midStart;
return null;
}
return {
line: mid,
column: offset - midStart
};
}
getLineFeedCnt(bufferIndex, start, end) {
// we don't need to worry about start: abc\r|\n, or abc|\r, or abc|\n, or abc|\r\n doesn't change the fact that, there is one line break after start.
// now let's take care of end: abc\r|\n, if end is in between \r and \n, we need to add line feed count by 1
if (end.column === 0) {
return end.line - start.line;
}
let lineStarts = this._buffers[bufferIndex].lineStarts;
if (end.line === lineStarts.length - 1) { // it means, there is no \n after end, otherwise, there will be one more lineStart.
return end.line - start.line;
}
let nextLineStartOffset = lineStarts[end.line + 1];
let endOffset = lineStarts[end.line] + end.column;
if (nextLineStartOffset > endOffset + 1) { // there are more than 1 character after end, which means it can't be \n
return end.line - start.line;
}
// endOffset + 1 === nextLineStartOffset
// character at endOffset is \n, so we check the character before first
// if character at endOffset is \r, end.column is 0 and we can't get here.
let previousCharOffset = endOffset - 1; // end.column > 0 so it's okay.
let buffer = this._buffers[bufferIndex].buffer;
if (buffer.charCodeAt(previousCharOffset) === 13) {
return end.line - start.line + 1;
}
else {
return end.line - start.line;
}
}
offsetInBuffer(bufferIndex, cursor) {
let lineStarts = this._buffers[bufferIndex].lineStarts;
return lineStarts[cursor.line] + cursor.column;
}
deleteNodes(nodes) {
for (let i = 0; i < nodes.length; i++) {
rbDelete(this, nodes[i]);
}
}
createNewPieces(text) {
if (text.length > AverageBufferSize) {
// the content is large, operations like substring, charCode becomes slow
// so here we split it into smaller chunks, just like what we did for CR/LF normalization
let newPieces = [];
while (text.length > AverageBufferSize) {
const lastChar = text.charCodeAt(AverageBufferSize - 1);
let splitText;
if (lastChar === 13 /* CarriageReturn */ || (lastChar >= 0xD800 && lastChar <= 0xDBFF)) {
// last character is \r or a high surrogate => keep it back
splitText = text.substring(0, AverageBufferSize - 1);
text = text.substring(AverageBufferSize - 1);
}
else {
splitText = text.substring(0, AverageBufferSize);
text = text.substring(AverageBufferSize);
}
let lineStarts = createLineStartsFast(splitText);
newPieces.push(new Piece(this._buffers.length, /* buffer index */ { line: 0, column: 0 }, { line: lineStarts.length - 1, column: splitText.length - lineStarts[lineStarts.length - 1] }, lineStarts.length - 1, splitText.length));
this._buffers.push(new StringBuffer(splitText, lineStarts));
}
let lineStarts = createLineStartsFast(text);
newPieces.push(new Piece(this._buffers.length, /* buffer index */ { line: 0, column: 0 }, { line: lineStarts.length - 1, column: text.length - lineStarts[lineStarts.length - 1] }, lineStarts.length - 1, text.length));
this._buffers.push(new StringBuffer(text, lineStarts));
return newPieces;
}
let startOffset = this._buffers[0].buffer.length;
const lineStarts = createLineStartsFast(text, false);
let start = this._lastChangeBufferPos;
if (this._buffers[0].lineStarts[this._buffers[0].lineStarts.length - 1] === startOffset
&& startOffset !== 0
&& this.startWithLF(text)
&& this.endWithCR(this._buffers[0].buffer) // todo, we can check this._lastChangeBufferPos's column as it's the last one
) {
this._lastChangeBufferPos = { line: this._lastChangeBufferPos.line, column: this._lastChangeBufferPos.column + 1 };
start = this._lastChangeBufferPos;
for (let i = 0; i < lineStarts.length; i++) {
lineStarts[i] += startOffset + 1;
}
this._buffers[0].lineStarts = this._buffers[0].lineStarts.concat(lineStarts.slice(1));
this._buffers[0].buffer += '_' + text;
startOffset += 1;
}
else {
if (startOffset !== 0) {
for (let i = 0; i < lineStarts.length; i++) {
lineStarts[i] += startOffset;
}
}
this._buffers[0].lineStarts = this._buffers[0].lineStarts.concat(lineStarts.slice(1));
this._buffers[0].buffer += text;
}
const endOffset = this._buffers[0].buffer.length;
let endIndex = this._buffers[0].lineStarts.length - 1;
let endColumn = endOffset - this._buffers[0].lineStarts[endIndex];
let endPos = { line: endIndex, column: endColumn };
let newPiece = new Piece(0, /** todo@peng */ start, endPos, this.getLineFeedCnt(0, start, endPos), endOffset - startOffset);
this._lastChangeBufferPos = endPos;
return [newPiece];
}
getLineRawContent(lineNumber, endOffset = 0) {
let x = this.root;
let ret = '';
let cache = this._searchCache.get2(lineNumber);
if (cache) {
x = cache.node;
let prevAccumulatedValue = this.getAccumulatedValue(x, lineNumber - cache.nodeStartLineNumber - 1);
let buffer = this._buffers[x.piece.bufferIndex].buffer;
let startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
if (cache.nodeStartLineNumber + x.piece.lineFeedCnt === lineNumber) {
ret = buffer.substring(startOffset + prevAccumulatedValue, startOffset + x.piece.length);
}
else {
let accumulatedValue = this.getAccumulatedValue(x, lineNumber - cache.nodeStartLineNumber);
return buffer.substring(startOffset + prevAccumulatedValue, startOffset + accumulatedValue - endOffset);
}
}
else {
let nodeStartOffset = 0;
const originalLineNumber = lineNumber;
while (x !== SENTINEL) {
if (x.left !== SENTINEL && x.lf_left >= lineNumber - 1) {
x = x.left;
}
else if (x.lf_left + x.piece.lineFeedCnt > lineNumber - 1) {
let prevAccumulatedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);
let accumulatedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 1);
let buffer = this._buffers[x.piece.bufferIndex].buffer;
let startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
nodeStartOffset += x.size_left;
this._searchCache.set({
node: x,
nodeStartOffset,
nodeStartLineNumber: originalLineNumber - (lineNumber - 1 - x.lf_left)
});
return buffer.substring(startOffset + prevAccumulatedValue, startOffset + accumulatedValue - endOffset);
}
else if (x.lf_left + x.piece.lineFeedCnt === lineNumber - 1) {
let prevAccumulatedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);
let buffer = this._buffers[x.piece.bufferIndex].buffer;
let startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
ret = buffer.substring(startOffset + prevAccumulatedValue, startOffset + x.piece.length);
break;
}
else {
lineNumber -= x.lf_left + x.piece.lineFeedCnt;
nodeStartOffset += x.size_left + x.piece.length;
x = x.right;
}
}
}
// search in order, to find the node contains end column
x = x.next();
while (x !== SENTINEL) {
let buffer = this._buffers[x.piece.bufferIndex].buffer;
if (x.piece.lineFeedCnt > 0) {
let accumulatedValue = this.getAccumulatedValue(x, 0);
let startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
ret += buffer.substring(startOffset, startOffset + accumulatedValue - endOffset);
return ret;
}
else {
let startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
ret += buffer.substr(startOffset, x.piece.length);
}
x = x.next();
}
return ret;
}
computeBufferMetadata() {
let x = this.root;
let lfCnt = 1;
let len = 0;
while (x !== SENTINEL) {
lfCnt += x.lf_left + x.piece.lineFeedCnt;
len += x.size_left + x.piece.length;
x = x.right;
}
this._lineCnt = lfCnt;
this._length = len;
this._searchCache.validate(this._length);
}
// #region node operations
getIndexOf(node, accumulatedValue) {
let piece = node.piece;
let pos = this.positionInBuffer(node, accumulatedValue);
let lineCnt = pos.line - piece.start.line;
if (this.offsetInBuffer(piece.bufferIndex, piece.end) - this.offsetInBuffer(piece.bufferIndex, piece.start) === accumulatedValue) {
// we are checking the end of this node, so a CRLF check is necessary.
let realLineCnt = this.getLineFeedCnt(node.piece.bufferIndex, piece.start, pos);
if (realLineCnt !== lineCnt) {
// aha yes, CRLF
return { index: realLineCnt, remainder: 0 };
}
}
return { index: lineCnt, remainder: pos.column };
}
getAccumulatedValue(node, index) {
if (index < 0) {
return 0;
}
let piece = node.piece;
let lineStarts = this._buffers[piece.bufferIndex].lineStarts;
let expectedLineStartIndex = piece.start.line + index + 1;
if (expectedLineStartIndex > piece.end.line) {
return lineStarts[piece.end.line] + piece.end.column - lineStarts[piece.start.line] - piece.start.column;
}
else {
return lineStarts[expectedLineStartIndex] - lineStarts[piece.start.line] - piece.start.column;
}
}
deleteNodeTail(node, pos) {
const piece = node.piece;
const originalLFCnt = piece.lineFeedCnt;
const originalEndOffset = this.offsetInBuffer(piece.bufferIndex, piece.end);
const newEnd = pos;
const newEndOffset = this.offsetInBuffer(piece.bufferIndex, newEnd);
const newLineFeedCnt = this.getLineFeedCnt(piece.bufferIndex, piece.start, newEnd);
const lf_delta = newLineFeedCnt - originalLFCnt;
const size_delta = newEndOffset - originalEndOffset;
const newLength = piece.length + size_delta;
node.piece = new Piece(piece.bufferIndex, piece.start, newEnd, newLineFeedCnt, newLength);
updateTreeMetadata(this, node, size_delta, lf_delta);
}
deleteNodeHead(node, pos) {
const piece = node.piece;
const originalLFCnt = piece.lineFeedCnt;
const originalStartOffset = this.offsetInBuffer(piece.bufferIndex, piece.start);
const newStart = pos;
const newLineFeedCnt = this.getLineFeedCnt(piece.bufferIndex, newStart, piece.end);
const newStartOffset = this.offsetInBuffer(piece.bufferIndex, newStart);
const lf_delta = newLineFeedCnt - originalLFCnt;
const size_delta = originalStartOffset - newStartOffset;
const newLength = piece.length + size_delta;
node.piece = new Piece(piece.bufferIndex, newStart, piece.end, newLineFeedCnt, newLength);
updateTreeMetadata(this, node, size_delta, lf_delta);
}
shrinkNode(node, start, end) {
const piece = node.piece;
const originalStartPos = piece.start;
const originalEndPos = piece.end;
// old piece, originalStartPos, start
const oldLength = piece.length;
const oldLFCnt = piece.lineFeedCnt;
const newEnd = start;
const newLineFeedCnt = this.getLineFeedCnt(piece.bufferIndex, piece.start, newEnd);
const newLength = this.offsetInBuffer(piece.bufferIndex, start) - this.offsetInBuffer(piece.bufferIndex, originalStartPos);
node.piece = new Piece(piece.bufferIndex, piece.start, newEnd, newLineFeedCnt, newLength);
updateTreeMetadata(this, node, newLength - oldLength, newLineFeedCnt - oldLFCnt);
// new right piece, end, originalEndPos
let newPiece = new Piece(piece.bufferIndex, end, originalEndPos, this.getLineFeedCnt(piece.bufferIndex, end, originalEndPos), this.offsetInBuffer(piece.bufferIndex, originalEndPos) - this.offsetInBuffer(piece.bufferIndex, end));
let newNode = this.rbInsertRight(node, newPiece);
this.validateCRLFWithPrevNode(newNode);
}
appendToNode(node, value) {
if (this.adjustCarriageReturnFromNext(value, node)) {
value += '\n';
}
const hitCRLF = this.shouldCheckCRLF() && this.startWithLF(value) && this.endWithCR(node);
const startOffset = this._buffers[0].buffer.length;
this._buffers[0].buffer += value;
const lineStarts = createLineStartsFast(value, false);
for (let i = 0; i < lineStarts.length; i++) {
lineStarts[i] += startOffset;
}
if (hitCRLF) {
let prevStartOffset = this._buffers[0].lineStarts[this._buffers[0].lineStarts.length - 2];
this._buffers[0].lineStarts.pop();
// _lastChangeBufferPos is already wrong
this._lastChangeBufferPos = { line: this._lastChangeBufferPos.line - 1, column: startOffset - prevStartOffset };
}
this._buffers[0].lineStarts = this._buffers[0].lineStarts.concat(lineStarts.slice(1));
const endIndex = this._buffers[0].lineStarts.length - 1;
const endColumn = this._buffers[0].buffer.length - this._buffers[0].lineStarts[endIndex];
const newEnd = { line: endIndex, column: endColumn };
const newLength = node.piece.length + value.length;
const oldLineFeedCnt = node.piece.lineFeedCnt;
const newLineFeedCnt = this.getLineFeedCnt(0, node.piece.start, newEnd);
const lf_delta = newLineFeedCnt - oldLineFeedCnt;
node.piece = new Piece(node.piece.bufferIndex, node.piece.start, newEnd, newLineFeedCnt, newLength);
this._lastChangeBufferPos = newEnd;
updateTreeMetadata(this, node, value.length, lf_delta);
}
nodeAt(offset) {
let x = this.root;
let cache = this._searchCache.get(offset);
if (cache) {
return {
node: cache.node,
nodeStartOffset: cache.nodeStartOffset,
remainder: offset - cache.nodeStartOffset
};
}
let nodeStartOffset = 0;
while (x !== SENTINEL) {
if (x.size_left > offset) {
x = x.left;
}
else if (x.size_left + x.piece.length >= offset) {
nodeStartOffset += x.size_left;
let ret = {
node: x,
remainder: offset - x.size_left,
nodeStartOffset
};
this._searchCache.set(ret);
return ret;
}
else {
offset -= x.size_left + x.piece.length;
nodeStartOffset += x.size_left + x.piece.length;
x = x.right;
}
}
return null;
}
nodeAt2(lineNumber, column) {
let x = this.root;
let nodeStartOffset = 0;
while (x !== SENTINEL) {
if (x.left !== SENTINEL && x.lf_left >= lineNumber - 1) {
x = x.left;
}
else if (x.lf_left + x.piece.lineFeedCnt > lineNumber - 1) {
let prevAccumualtedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);
let accumulatedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 1);
nodeStartOffset += x.size_left;
return {
node: x,
remainder: Math.min(prevAccumualtedValue + column - 1, accumulatedValue),
nodeStartOffset
};
}
else if (x.lf_left + x.piece.lineFeedCnt === lineNumber - 1) {
let prevAccumualtedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);
if (prevAccumualtedValue + column - 1 <= x.piece.length) {
return {
node: x,
remainder: prevAccumualtedValue + column - 1,
nodeStartOffset
};
}
else {
column -= x.piece.length - prevAccumualtedValue;
break;
}
}
else {
lineNumber -= x.lf_left + x.piece.lineFeedCnt;
nodeStartOffset += x.size_left + x.piece.length;
x = x.right;
}
}
// search in order, to find the node contains position.column
x = x.next();
while (x !== SENTINEL) {
if (x.piece.lineFeedCnt > 0) {
let accumulatedValue = this.getAccumulatedValue(x, 0);
let nodeStartOffset = this.offsetOfNode(x);
return {
node: x,
remainder: Math.min(column - 1, accumulatedValue),
nodeStartOffset
};
}
else {
if (x.piece.length >= column - 1) {
let nodeStartOffset = this.offsetOfNode(x);
return {
node: x,
remainder: column - 1,
nodeStartOffset
};
}
else {
column -= x.piece.length;
}
}
x = x.next();
}
return null;
}
nodeCharCodeAt(node, offset) {
if (node.piece.lineFeedCnt < 1) {
return -1;
}
let buffer = this._buffers[node.piece.bufferIndex];
let newOffset = this.offsetInBuffer(node.piece.bufferIndex, node.piece.start) + offset;
return buffer.buffer.charCodeAt(newOffset);
}
offsetOfNode(node) {
if (!node) {
return 0;
}
let pos = node.size_left;
while (node !== this.root) {
if (node.parent.right === node) {
pos += node.parent.size_left + node.parent.piece.length;
}
node = node.parent;
}
return pos;
}
// #endregion
// #region CRLF
shouldCheckCRLF() {
return !(this._EOLNormalized && this._EOL === '\n');
}
startWithLF(val) {
if (typeof val === 'string') {
return val.charCodeAt(0) === 10;
}
if (val === SENTINEL || val.piece.lineFeedCnt === 0) {
return false;
}
let piece = val.piece;
let lineStarts = this._buffers[piece.bufferIndex].lineStarts;
let line = piece.start.line;
let startOffset = lineStarts[line] + piece.start.column;
if (line === lineStarts.length - 1) {
// last line, so there is no line feed at the end of this line
return false;
}
let nextLineOffset = lineStarts[line + 1];
if (nextLineOffset > startOffset + 1) {
return false;
}
return this._buffers[piece.bufferIndex].buffer.charCodeAt(startOffset) === 10;
}
endWithCR(val) {
if (typeof val === 'string') {
return val.charCodeAt(val.length - 1) === 13;
}
if (val === SENTINEL || val.piece.lineFeedCnt === 0) {
return false;
}
return this.nodeCharCodeAt(val, val.piece.length - 1) === 13;
}
validateCRLFWithPrevNode(nextNode) {
if (this.shouldCheckCRLF() && this.startWithLF(nextNode)) {
let node = nextNode.prev();
if (this.endWithCR(node)) {
this.fixCRLF(node, nextNode);
}
}
}
validateCRLFWithNextNode(node) {
if (this.shouldCheckCRLF() && this.endWithCR(node)) {
let nextNode = node.next();
if (this.startWithLF(nextNode)) {
this.fixCRLF(node, nextNode);
}
}
}
fixCRLF(prev, next) {
let nodesToDel = [];
// update node
let lineStarts = this._buffers[prev.piece.bufferIndex].lineStarts;
let newEnd;
if (prev.piece.end.column === 0) {
// it means, last line ends with \r, not \r\n
newEnd = { line: prev.piece.end.line - 1, column: lineStarts[prev.piece.end.line] - lineStarts[prev.piece.end.line - 1] - 1 };
}
else {
// \r\n
newEnd = { line: prev.piece.end.line, column: prev.piece.end.column - 1 };
}
const prevNewLength = prev.piece.length - 1;
const prevNewLFCnt = prev.piece.lineFeedCnt - 1;
prev.piece = new Piece(prev.piece.bufferIndex, prev.piece.start, newEnd, prevNewLFCnt, prevNewLength);
updateTreeMetadata(this, prev, -1, -1);
if (prev.piece.length === 0) {
nodesToDel.push(prev);
}
// update nextNode
let newStart = { line: next.piece.start.line + 1, column: 0 };
const newLength = next.piece.length - 1;
const newLineFeedCnt = this.getLineFeedCnt(next.piece.bufferIndex, newStart, next.piece.end);
next.piece = new Piece(next.piece.bufferIndex, newStart, next.piece.end, newLineFeedCnt, newLength);
updateTreeMetadata(this, next, -1, -1);
if (next.piece.length === 0) {
nodesToDel.push(next);
}
// create new piece which contains \r\n
let pieces = this.createNewPieces('\r\n');
this.rbInsertRight(prev, pieces[0]);
// delete empty nodes
for (let i = 0; i < nodesToDel.length; i++) {
rbDelete(this, nodesToDel[i]);
}
}
adjustCarriageReturnFromNext(value, node) {
if (this.shouldCheckCRLF() && this.endWithCR(value)) {
let nextNode = node.next();
if (this.startWithLF(nextNode)) {
// move `\n` forward
value += '\n';
if (nextNode.piece.length === 1) {
rbDelete(this, nextNode);
}
else {
const piece = nextNode.piece;
const newStart = { line: piece.start.line + 1, column: 0 };
const newLength = piece.length - 1;
const newLineFeedCnt = this.getLineFeedCnt(piece.bufferIndex, newStart, piece.end);
nextNode.piece = new Piece(piece.bufferIndex, newStart, piece.end, newLineFeedCnt, newLength);
updateTreeMetadata(this, nextNode, -1, -1);
}
return true;
}
}
return false;
}
// #endregion
// #endregion
// #region Tree operations
iterate(node, callback) {
if (node === SENTINEL) {
return callback(SENTINEL);
}
let leftRet = this.iterate(node.left, callback);
if (!leftRet) {
return leftRet;
}
return callback(node) && this.iterate(node.right, callback);
}
getNodeContent(node) {
if (node === SENTINEL) {
return '';
}
let buffer = this._buffers[node.piece.bufferIndex];
let currentContent;
let piece = node.piece;
let startOffset = this.offsetInBuffer(piece.bufferIndex, piece.start);
let endOffset = this.offsetInBuffer(piece.bufferIndex, piece.end);
currentContent = buffer.buffer.substring(startOffset, endOffset);
return currentContent;
}
getPieceContent(piece) {
let buffer = this._buffers[piece.bufferIndex];
let startOffset = this.offsetInBuffer(piece.bufferIndex, piece.start);
let endOffset = this.offsetInBuffer(piece.bufferIndex, piece.end);
let currentContent = buffer.buffer.substring(startOffset, endOffset);
return currentContent;
}
/**
* node node
* / \ / \
* a b <---- a b
* /
* z
*/
rbInsertRight(node, p) {
let z = new TreeNode(p, 1 /* Red */);
z.left = SENTINEL;
z.right = SENTINEL;
z.parent = SENTINEL;
z.size_left = 0;
z.lf_left = 0;
let x = this.root;
if (x === SENTINEL) {
this.root = z;
z.color = 0 /* Black */;
}
else if (node.right === SENTINEL) {
node.right = z;
z.parent = node;
}
else {
let nextNode = leftest(node.right);
nextNode.left = z;
z.parent = nextNode;
}
fixInsert(this, z);
return z;
}
/**
* node node
* / \ / \
* a b ----> a b
* \
* z
*/
rbInsertLeft(node, p) {
let z = new TreeNode(p, 1 /* Red */);
z.left = SENTINEL;
z.right = SENTINEL;
z.parent = SENTINEL;
z.size_left = 0;
z.lf_left = 0;
if (this.root === SENTINEL) {
this.root = z;
z.color = 0 /* Black */;
}
else if (node.left === SENTINEL) {
node.left = z;
z.parent = node;
}
else {
let prevNode = righttest(node.left); // a
prevNode.right = z;
z.parent = prevNode;
}
fixInsert(this, z);
return z;
}
}
|
!function(e){function t(t){for(var n,o,s=t[0],u=t[1],i=t[2],l=0,p=[];l<s.length;l++)o=s[l],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&p.push(a[o][0]),a[o]=0;for(n in u)Object.prototype.hasOwnProperty.call(u,n)&&(e[n]=u[n]);for(f&&f(t);p.length;)p.shift()();return c.push.apply(c,i||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],n=!0,o=1;o<r.length;o++){var u=r[o];0!==a[u]&&(n=!1)}n&&(c.splice(t--,1),e=s(s.s=r[0]))}return e}var n={},o={8:0},a={8:0},c=[];function s(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,s),r.l=!0,r.exports}s.e=function(e){var t=[];o[e]?t.push(o[e]):0!==o[e]&&{1:1}[e]&&t.push(o[e]=new Promise((function(t,r){for(var n=({0:"bfc3b393f484e8017a4ce6b216c744361b202e15",1:"styles",3:"component---cache-caches-gatsby-plugin-offline-app-shell-js",4:"component---src-pages-404-js",5:"component---src-pages-index-js",6:"component---src-pages-page-2-js"}[e]||e)+"."+{0:"31d6cfe0d16ae931b73c",1:"961d2f2a1eab13dadbba",3:"31d6cfe0d16ae931b73c",4:"31d6cfe0d16ae931b73c",5:"31d6cfe0d16ae931b73c",6:"31d6cfe0d16ae931b73c"}[e]+".css",a=s.p+n,c=document.getElementsByTagName("link"),u=0;u<c.length;u++){var i=(f=c[u]).getAttribute("data-href")||f.getAttribute("href");if("stylesheet"===f.rel&&(i===n||i===a))return t()}var l=document.getElementsByTagName("style");for(u=0;u<l.length;u++){var f;if((i=(f=l[u]).getAttribute("data-href"))===n||i===a)return t()}var p=document.createElement("link");p.rel="stylesheet",p.type="text/css",p.onload=t,p.onerror=function(t){var n=t&&t.target&&t.target.src||a,c=new Error("Loading CSS chunk "+e+" failed.\n("+n+")");c.code="CSS_CHUNK_LOAD_FAILED",c.request=n,delete o[e],p.parentNode.removeChild(p),r(c)},p.href=a,document.getElementsByTagName("head")[0].appendChild(p)})).then((function(){o[e]=0})));var r=a[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=a[e]=[t,n]}));t.push(r[2]=n);var c,u=document.createElement("script");u.charset="utf-8",u.timeout=120,s.nc&&u.setAttribute("nonce",s.nc),u.src=function(e){return s.p+""+({0:"bfc3b393f484e8017a4ce6b216c744361b202e15",1:"styles",3:"component---cache-caches-gatsby-plugin-offline-app-shell-js",4:"component---src-pages-404-js",5:"component---src-pages-index-js",6:"component---src-pages-page-2-js"}[e]||e)+"-"+{0:"46f1a26c48754a807d67",1:"c2fe8482057191dca484",3:"7c31e2436cade51cbcda",4:"7888895e042e1961de33",5:"1a7661600b6b4491aacc",6:"ce12a973c8f5602aa219"}[e]+".js"}(e);var i=new Error;c=function(t){u.onerror=u.onload=null,clearTimeout(l);var r=a[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",i.name="ChunkLoadError",i.type=n,i.request=o,r[1](i)}a[e]=void 0}};var l=setTimeout((function(){c({type:"timeout",target:u})}),12e4);u.onerror=u.onload=c,document.head.appendChild(u)}return Promise.all(t)},s.m=e,s.c=n,s.d=function(e,t,r){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(s.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)s.d(r,n,function(t){return e[t]}.bind(null,n));return r},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="/",s.oe=function(e){throw console.error(e),e};var u=window.webpackJsonp=window.webpackJsonp||[],i=u.push.bind(u);u.push=t,u=u.slice();for(var l=0;l<u.length;l++)t(u[l]);var f=i;r()}([]);
//# sourceMappingURL=webpack-runtime-0266d70e246725562dc2.js.map
|
/* This file is generated by createIcons.js any changes will be lost. */
import createIcon from '../createIcon';
const MailBulkIcon = createIcon({
name: 'MailBulkIcon',
height: 512,
width: 576,
svgPath: 'M160 448c-25.6 0-51.2-22.4-64-32-64-44.8-83.2-60.8-96-70.4V480c0 17.67 14.33 32 32 32h256c17.67 0 32-14.33 32-32V345.6c-12.8 9.6-32 25.6-96 70.4-12.8 9.6-38.4 32-64 32zm128-192H32c-17.67 0-32 14.33-32 32v16c25.6 19.2 22.4 19.2 115.2 86.4 9.6 6.4 28.8 25.6 44.8 25.6s35.2-19.2 44.8-22.4c92.8-67.2 89.6-67.2 115.2-86.4V288c0-17.67-14.33-32-32-32zm256-96H224c-17.67 0-32 14.33-32 32v32h96c33.21 0 60.59 25.42 63.71 57.82l.29-.22V416h192c17.67 0 32-14.33 32-32V192c0-17.67-14.33-32-32-32zm-32 128h-64v-64h64v64zm-352-96c0-35.29 28.71-64 64-64h224V32c0-17.67-14.33-32-32-32H96C78.33 0 64 14.33 64 32v192h96v-32z',
yOffset: '',
xOffset: '',
transform: ''
});
export default MailBulkIcon;
|
/**
* PixelNode_Input_WebSocket_Client
*
* Ported fadecandy example
*
* --------------------------------------------------------------------------------------------------------------------
*
* @author Amely Kling <mail@dwi.sk>
*
*/
/* Includes
* ==================================================================================================================== */
var util = require("util");
var _ = require('underscore');
/* Class Constructor
* ==================================================================================================================== */
// extending Effect
PixelNode_Input = require('pixelnode-input');
// define the Student class
function PixelNode_Input_WebSocket_Client(options,pixelData) {
var self = this;
PixelNode_Input_WebSocket_Client.super_.call(self, options, pixelData);
this.className = "PixelNode_Input_WebSocket_Client";
}
// class inheritance
util.inherits(PixelNode_Input_WebSocket_Client, PixelNode_Input);
// module export
module.exports = PixelNode_Input_WebSocket_Client;
/* Variables
* ==================================================================================================================== */
PixelNode_Input_WebSocket_Client.prototype.default_options = {
server: 'http://beaglebone.local:3001'
};
PixelNode_Input_WebSocket_Client.prototype.sockets = [];
PixelNode_Input_WebSocket_Client.prototype.status_interval = 0;
/* Overridden Methods
* ==================================================================================================================== */
// init effect – override
PixelNode_Input_WebSocket_Client.prototype.init = function() {
// start
console.log("Init Input WebSocket Client".grey);
this.initSockets();
}
/* Methods
* ==================================================================================================================== */
PixelNode_Input_WebSocket_Client.prototype.initSockets = function() {
var self = this;
// Connect to server
var io = require('socket.io-client')
var socket = require("socket.io-client")(self.options.server); // This is a client connecting to the SERVER 2
// event listener for connection
socket.on("connect",function(){
console.log('WebSocket Connected!'.green);
});
// event listener for initialization
socket.on('data_init', function (data) {
console.log("Websocket Init");
// save data
global.pixelNode.data.replace(_.extend(data.data,{clockSet: data.timestamp}));
// emit success
socket.emit('data_client_inited', {success:true});
});
// event listener for new data
socket.on('data_changed', function (data) {
//console.log("Websocket: data changed", data.path, data.data);
global.pixelNode.data.set(data.path, data.data, true);
// replace data
//global.pixelNode.data.replace(data);
});
}
|
const mongoose = require('mongoose');
const mongoosePaginate = require('mongoose-paginate-v2');
const additionalReportSchema = new mongoose.Schema(
{
content: {
type: String,
required: true,
},
},
{
timestamps: true,
}
);
const emergencySchema = new mongoose.Schema(
{
creator: {
type: mongoose.Types.ObjectId,
required: true,
ref: 'User',
},
additionalReport: [additionalReportSchema],
active: {
type: Boolean,
default: true,
},
deleted: {
type: Boolean,
default: false,
select: false,
},
},
{
timestamps: true,
toJSON: {
transform(doc, ret) {
delete ret.password;
return ret;
},
versionKey: false,
},
}
);
emergencySchema.plugin(mongoosePaginate);
module.exports = mongoose.model('Emergency', emergencySchema);
|
import React from "react";
import AvatarLinks from "./AvatarLinks";
import { Link } from "gatsby";
import siteConfig from "../../../data/SiteConfig";
import logo from "../../../data/logo.png";
/** @jsx jsx */
import { Styled, jsx } from "theme-ui";
const BigAvatar = props => {
const { avatar } = siteConfig;
return (
<>
<div sx={{ textAlign: `center` }}>
<img src= { logo }/>
<Styled.h1 sx={{ color: `text` }}>
Ola, I'm{" "}
<Styled
as={Link}
to={"/about"}
sx={{
display: `inline`,
borderBottom: `solid 4px`,
fontSize: 32,
color: `primary`,
textDecoration: `none`,
":hover": {
bg: `muted`,
p: 1,
borderRadius: `5px`
}
}}
>
Tiago
</Styled>
</Styled.h1>
</div>
<AvatarLinks />
<Styled.p>{avatar.description}</Styled.p>
</>
);
};
export default BigAvatar;
|
const Dev = require("../models/Dev");
const parseStringAsArray = require("../utils/parseStringAsArray");
module.exports = {
async index(request, response) {
const { latitude, longitude, techs } = request.query;
const techsLinted = parseStringAsArray(techs);
let devs = await Dev.find({
techs: {
$in: techsLinted
},
location: {
$near: {
$geometry: {
type: 'Point',
coordinates: [longitude, latitude]
},
$maxDistance: 10000, // 10 meters
}
}
})
return response.json({ devs });
}
}
|
'use strict';
const assert = require('assert');
it('throws after timeout', () => {
setTimeout(() => {
throw new Error('Exception in delayed function');
}, 10);
});
|
/**
* @format
*/
import {AppRegistry} from 'react-native';
import FetchExample from './App';
import {name as appName} from './app.json';
AppRegistry.registerComponent(appName, () => FetchExample);
|
(function(angular){
'use strict';
var module = angular.module('certification');
module.controller('CourseClassesController', ['$scope', '$window', 'Evaluation', 'CourseClassesService',
function($scope, $window, Evaluation, CourseClassesService) {
// Handle Certification:
// If class has certification, show the evaluation link
$scope.errors = {};
$scope.course_klasses = CourseClassesService.getClasses();
console.log($scope.course_klasses);
}
]);
module.controller('CertificateCtrl', ['$scope', 'ClassIdGetter', 'Course', 'CourseCertification', 'CertificateTemplate',
function($scope, ClassIdGetter, Course, CourseCertification, CertificateTemplate){
console.log(ClassIdGetter.certificateData());
$scope.certificate = CourseCertification.get({'link_hash' : ClassIdGetter.certificateData()}, function(certificate) {
// $scope.certificate = data;
$scope.course = Course.get({'id' : certificate.course});
$scope.cert_template = CertificateTemplate.get({'course' : certificate.course });
return certificate;
});
}
]);
module.controller('CertificateTemplateCtrl', ['$scope', 'FormUpload', 'ClassIdGetter', 'Course', 'CertificateTemplate',
function($scope, FormUpload, ClassIdGetter, Course, CertificateTemplate){
$scope.course_id = ClassIdGetter.courseSettings();
Course.get({'id' : $scope.course_id}, function(data) {
$scope.course = data;
});
CertificateTemplate.get({'course' : $scope.course_id}, function(data) {
$scope.ct = data;
}, function(error){
if(error.status == 404){
var ct = new CertificateTemplate();
ct.course = $scope.course_id;
ct.$save({}, function(template){
$scope.ct = template;
}, function(error){
console.log(error);
});
}
});
$scope.saveTemplate = function () {
$scope.ct.$update({'course' : $scope.course_id}, function(updated){
saveImageData();
$scope.alert.success('Opções salvas com sucesso!');
})
}
$scope.images = {};
var saveImageData = function(){
var fu = new FormUpload();
if($scope.images.cert_logo){
fu.addField('cert_logo', $scope.images.cert_logo);
}
if($scope.images.base_logo){
fu.addField('base_logo', $scope.images.base_logo);
}
fu.addField('course', $scope.course_id);
// return a new promise that file will be uploaded
return fu.sendTo('/api/certificate_template_images/' + $scope.course_id);
}
}
]);
module.controller('ClassEvaluationsController',
['$scope', '$uibModal', '$window', '$routeParams', 'CertificationProcess', 'Evaluation', 'Class', 'ClassIdGetter',
function($scope, $uibModal, $window, $routeParams, CertificationProcess, Evaluation, Class, ClassIdGetter) {
$scope.errors = {};
$scope.evaluations = [];
$scope.stats = {
has_certificate : 0,
user_can_certificate : 0,
user_can_attend : 0,
upcoming : 0
};
$scope.switches = {
can_certificate : false,
}
// FIXME this controller is being used in more than one view with different parameters
if($routeParams['klassId']) {
$scope.klass_id = $routeParams['klassId'];
} else {
$scope.klass_id = ClassIdGetter.classEditView();
}
Class.get({'id' : $scope.klass_id}, function(klass){
$scope.klass = klass;
$scope.class_students = klass.students;
$scope.switches.can_certificate = klass.user_can_certificate;
$scope.class_evaluations = klass.evaluations;
if($scope.class_evaluations.length > 0) {
var now = new Date().getTime();
var next_week = now + 7*24*60*60*1000;
for(var i = 0; i < $scope.class_evaluations.length; i++) {
evaluation = $scope.class_evaluations[i];
var e_date = new Date(evaluation.date).getTime();
if ((e_date > now) && (e_date <= next_week)) {
$scope.stats.upcoming++;
}
}
$scope.evaluation = $scope.class_evaluations[0];
}
$scope.certification_processes = klass.processes;
for(var i = 0; i < $scope.certification_processes.length; i++){
var proc = $scope.certification_processes[i];
if(proc.course_certification){
$scope.stats.user_can_certificate++;
if(!proc.evaluation){
$scope.stats.user_can_attend++;
}
}
if(proc.approved){
$scope.stats.has_certificate++;
}
}
});
$scope.toggleClassCertifiable = function (){
$scope.switches.can_certificate = false;
$scope.klass.$update(function(klass){
$scope.switches.can_certificate = klass.user_can_certificate;
})
}
$scope.addStudentEvaluation = function () {
var modalInstance = $uibModal.open(
{
animation: true,
templateUrl: 'addStudentModal.html',
controller: ['$scope', '$uibModalInstance', 'processes', 'evaluation', 'students', AddStudentModalCtrl],
resolve: {
processes: function () {
return $scope.certification_processes;
},
evaluation: function() {
return $scope.evaluation;
},
students: function() {
return $scope.class_students;
}
}
}
);
modalInstance.result.then(function (class_students) {
$scope.user_can_attend = class_students;
for(var i = 0; i < $scope.user_can_attend.length; i++){
var proc = $scope.user_can_attend[i];
if(proc.selected){
proc.selected = false;
proc.evaluation = $scope.evaluation.id;
if(proc.student.id){
proc.student = proc.student.id;
}
proc = new CertificationProcess(proc);
proc.$update({}, function(process, data){
$scope.evaluation.processes.push(process.id);
$scope.certification_processes.filter(function(s){return s.id == process.id;})[0] = process;
$scope.stats.user_can_attend--;
});
}
}
});
};
var AddStudentModalCtrl = function ($scope, $uibModalInstance, processes, evaluation, students) {
$scope.certification_processes = processes;
$scope.class_students = students;
$scope.evaluation = evaluation;
$scope.selectAll = function (select){
for(var i = 0; i < $scope.certification_processes.length; i++){
if(!$scope.certification_processes[i].evaluation
&& $scope.certification_processes[i].course_certification)
$scope.certification_processes[i].selected = select;
}
}
$scope.cancel = function () {
$uibModalInstance.dismiss();
};
$scope.save = function(){
$uibModalInstance.close($scope.certification_processes);
}
}
$scope.createEvaluation = function (isEdit) {
var modalInstance = $uibModal.open(
{
animation: true,
templateUrl: 'createEvaluationModal.html',
controller: ['$scope', '$uibModalInstance', 'klass_id', 'evaluation', CreateUpdateEvaluationModalCtrl],
resolve: {
klass_id: function () {
return $scope.klass_id;
},
evaluation: function() {
if(isEdit){
return $scope.evaluation;
} else {
return undefined;
}
}
}
}
);
modalInstance.result.then(function (evaluation) {
if(evaluation.id){
evaluation.$update({}, function(updated_eval){
// console.log(updated_eval);
});
} else {
evaluation.$save({}, function (new_eval) {
$scope.class_evaluations.push(new_eval);
});
}
});
};
$scope.changeEvaluation = function ($event, $index) {
$event.preventDefault();
$scope.evaluation = $scope.class_evaluations[$index];
};
var CreateUpdateEvaluationModalCtrl = function ($scope, $uibModalInstance, klass_id, evaluation) {
if(!evaluation){
$scope.evaluation = new Evaluation();
} else {
$scope.evaluation = evaluation;
}
$scope.cancel = function () {
$uibModalInstance.dismiss();
};
$scope.openCalendar = function(e, b){
e.preventDefault();
e.stopPropagation();
$scope.calendar[b] = true;
}
$scope.calendar = {
'eval_date' : false,
'eval_results_date' : false
}
$scope.save = function(){
// Write validation
$scope.evaluation.klass = klass_id;
$uibModalInstance.close($scope.evaluation);
}
}
$scope.isCurrent = function(evaluation_id){
return evaluation_id == $scope.evaluation.id;
}
var evaluation = function($index){
return $index >= 0 ? $scope.class_evaluations[$index] : false;
}
var class_students = function(){
return $scope.class_students;
}
}
]);
})(angular);
|
import { createRequire } from 'module'
import { validateYear } from '../lib/validation/year.js'
const require = createRequire(import.meta.url)
const assert = require('assert')
describe('Year validation', () => {
it('should not return anything for non-integer input', () => {
// arrange
const yearArgument = 'One'
const expectedOutput = null
// act
const actualOutput = validateYear(yearArgument, true)
// assert
assert.equal(expectedOutput, actualOutput)
})
it('should return an integer for an integer greater than or equal to 2020 and less than or equal to 2100', () => {
// arrange
const yearArgument = 2021
const expectedOutput = 2021
// act
const actualOutput = validateYear(yearArgument, true)
// assert
assert.equal(expectedOutput, actualOutput)
})
it('should not return anything for a value less than 2020', () => {
// arrange
const yearArgument = 2019
const expectedOutput = null
// act
const actualOutput = validateYear(yearArgument, true)
// assert
assert.equal(expectedOutput, actualOutput)
})
it('should not return anything for a value greater than 2100', () => {
// arrange
const yearArgument = 2101
const expectedOutput = null
// act
const actualOutput = validateYear(yearArgument, true)
// assert
assert.equal(expectedOutput, actualOutput)
})
})
|
// NOTES - follows first-first highlight method, block is locked after highlight, different from SyntaxHl
Prism.languages.autohotkey = {
'comment': [
{
pattern: /(^|\s);.*/,
lookbehind: true
},
{
pattern: /(^\s*)\/\*[^\r\n]*(?:[\r\n](?![ \t]*\*\/)|[^\r\n])*(?:[\r\n][ \t]*\*\/)?/m,
lookbehind: true,
greedy: true
}
],
'string': /"(?:[^"\n\r]|"")*"/m,
'tag': /^[ \t]*[^\s:]+?(?=:(?:[^:]|$))/m, //labels
'variable': /%\w+%/,
'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee]-?\d+)?/,
'operator': /\?|\/\/?=?|:=|\|[=|]?|&[=&]?|\+[=+]?|-[=-]?|\*[=*]?|<(?:<=?|>|=)?|>>?=?|[.^!=~]=?|\b(?:AND|NOT|OR)\b/,
'boolean': /\b(?:true|false)\b/,
'selector': /\b(?:AutoTrim|BlockInput|Break|Click|ClipWait|Continue|Control|ControlClick|ControlFocus|ControlGet|ControlGetFocus|ControlGetPos|ControlGetText|ControlMove|ControlSend|ControlSendRaw|ControlSetText|CoordMode|Critical|DetectHiddenText|DetectHiddenWindows|Drive|DriveGet|DriveSpaceFree|EnvAdd|EnvDiv|EnvGet|EnvMult|EnvSet|EnvSub|EnvUpdate|Exit|ExitApp|FileAppend|FileCopy|FileCopyDir|FileCreateDir|FileCreateShortcut|FileDelete|FileEncoding|FileGetAttrib|FileGetShortcut|FileGetSize|FileGetTime|FileGetVersion|FileInstall|FileMove|FileMoveDir|FileRead|FileReadLine|FileRecycle|FileRecycleEmpty|FileRemoveDir|FileSelectFile|FileSelectFolder|FileSetAttrib|FileSetTime|FormatTime|GetKeyState|Gosub|Goto|GroupActivate|GroupAdd|GroupClose|GroupDeactivate|Gui|GuiControl|GuiControlGet|Hotkey|ImageSearch|IniDelete|IniRead|IniWrite|Input|InputBox|KeyWait|ListHotkeys|ListLines|ListVars|Loop|Menu|MouseClick|MouseClickDrag|MouseGetPos|MouseMove|MsgBox|OnExit|OutputDebug|Pause|PixelGetColor|PixelSearch|PostMessage|Process|Progress|Random|RegDelete|RegRead|RegWrite|Reload|Repeat|Return|Run|RunAs|RunWait|Send|SendEvent|SendInput|SendMessage|SendMode|SendPlay|SendRaw|SetBatchLines|SetCapslockState|SetControlDelay|SetDefaultMouseSpeed|SetEnv|SetFormat|SetKeyDelay|SetMouseDelay|SetNumlockState|SetRegView|SetScrollLockState|SetStoreCapslockMode|SetTimer|SetTitleMatchMode|SetWinDelay|SetWorkingDir|Shutdown|Sleep|Sort|SoundBeep|SoundGet|SoundGetWaveVolume|SoundPlay|SoundSet|SoundSetWaveVolume|SplashImage|SplashTextOff|SplashTextOn|SplitPath|StatusBarGetText|StatusBarWait|StringCaseSense|StringGetPos|StringLeft|StringLen|StringLower|StringMid|StringReplace|StringRight|StringSplit|StringTrimLeft|StringTrimRight|StringUpper|Suspend|SysGet|Thread|ToolTip|Transform|TrayTip|URLDownloadToFile|WinActivate|WinActivateBottom|WinClose|WinGet|WinGetActiveStats|WinGetActiveTitle|WinGetClass|WinGetPos|WinGetText|WinGetTitle|WinHide|WinKill|WinMaximize|WinMenuSelectItem|WinMinimize|WinMinimizeAll|WinMinimizeAllUndo|WinMove|WinRestore|WinSet|WinSetTitle|WinShow|WinWait|WinWaitActive|WinWaitClose|WinWaitNotActive)\b/i,
'constant': /\b(?:a_ahkpath|a_ahkversion|a_appdata|a_appdatacommon|a_autotrim|a_batchlines|a_caretx|a_carety|a_computername|a_controldelay|a_cursor|a_dd|a_ddd|a_dddd|a_defaultmousespeed|a_desktop|a_desktopcommon|a_detecthiddentext|a_detecthiddenwindows|a_endchar|a_eventinfo|a_exitreason|a_fileencoding|a_formatfloat|a_formatinteger|a_gui|a_guievent|a_guicontrol|a_guicontrolevent|a_guiheight|a_guiwidth|a_guix|a_guiy|a_hour|a_iconfile|a_iconhidden|a_iconnumber|a_icontip|a_index|a_ipaddress1|a_ipaddress2|a_ipaddress3|a_ipaddress4|a_is64bitos|a_isadmin|a_iscompiled|a_iscritical|a_ispaused|a_issuspended|a_isunicode|a_keydelay|a_language|a_lasterror|a_linefile|a_linenumber|a_loopfield|a_loopfileattrib|a_loopfiledir|a_loopfileext|a_loopfilefullpath|a_loopfilelongpath|a_loopfilename|a_loopfileshortname|a_loopfileshortpath|a_loopfilesize|a_loopfilesizekb|a_loopfilesizemb|a_loopfiletimeaccessed|a_loopfiletimecreated|a_loopfiletimemodified|a_loopreadline|a_loopregkey|a_loopregname|a_loopregsubkey|a_loopregtimemodified|a_loopregtype|a_mday|a_min|a_mm|a_mmm|a_mmmm|a_mon|a_mousedelay|a_msec|a_mydocuments|a_now|a_nowutc|a_numbatchlines|a_ostype|a_osversion|a_priorhotkey|a_priorkey|programfiles|a_programfiles|a_programs|a_programscommon|a_ptrsize|a_regview|a_screendpi|a_screenheight|a_screenwidth|a_scriptdir|a_scriptfullpath|a_scripthwnd|a_scriptname|a_sec|a_space|a_startmenu|a_startmenucommon|a_startup|a_startupcommon|a_stringcasesense|a_tab|a_temp|a_thisfunc|a_thishotkey|a_thislabel|a_thismenu|a_thismenuitem|a_thismenuitempos|a_tickcount|a_timeidle|a_timeidlephysical|a_timesincepriorhotkey|a_timesincethishotkey|a_titlematchmode|a_titlematchmodespeed|a_username|a_wday|a_windelay|a_windir|a_workingdir|a_yday|a_year|a_yweek|a_yyyy|clipboard|clipboardall|comspec|errorlevel)\b/i,
'builtin': /\b(?:abs|acos|asc|asin|atan|ceil|chr|class|comobjactive|comobjarray|comobjconnect|comobjcreate|comobjerror|comobjflags|comobjget|comobjquery|comobjtype|comobjvalue|cos|dllcall|exp|fileexist|Fileopen|floor|format|il_add|il_create|il_destroy|instr|substr|isfunc|islabel|IsObject|ln|log|lv_add|lv_delete|lv_deletecol|lv_getcount|lv_getnext|lv_gettext|lv_insert|lv_insertcol|lv_modify|lv_modifycol|lv_setimagelist|ltrim|rtrim|mod|onmessage|numget|numput|registercallback|regexmatch|regexreplace|round|sin|tan|sqrt|strlen|strreplace|sb_seticon|sb_setparts|sb_settext|strsplit|tv_add|tv_delete|tv_getchild|tv_getcount|tv_getnext|tv_get|tv_getparent|tv_getprev|tv_getselection|tv_gettext|tv_modify|varsetcapacity|winactive|winexist|__New|__Call|__Get|__Set)\b/i,
'symbol': /\b(?:alt|altdown|altup|appskey|backspace|browser_back|browser_favorites|browser_forward|browser_home|browser_refresh|browser_search|browser_stop|bs|capslock|ctrl|ctrlbreak|ctrldown|ctrlup|del|delete|down|end|enter|esc|escape|f1|f10|f11|f12|f13|f14|f15|f16|f17|f18|f19|f2|f20|f21|f22|f23|f24|f3|f4|f5|f6|f7|f8|f9|home|ins|insert|joy1|joy10|joy11|joy12|joy13|joy14|joy15|joy16|joy17|joy18|joy19|joy2|joy20|joy21|joy22|joy23|joy24|joy25|joy26|joy27|joy28|joy29|joy3|joy30|joy31|joy32|joy4|joy5|joy6|joy7|joy8|joy9|joyaxes|joybuttons|joyinfo|joyname|joypov|joyr|joyu|joyv|joyx|joyy|joyz|lalt|launch_app1|launch_app2|launch_mail|launch_media|lbutton|lcontrol|lctrl|left|lshift|lwin|lwindown|lwinup|mbutton|media_next|media_play_pause|media_prev|media_stop|numlock|numpad0|numpad1|numpad2|numpad3|numpad4|numpad5|numpad6|numpad7|numpad8|numpad9|numpadadd|numpadclear|numpaddel|numpaddiv|numpaddot|numpaddown|numpadend|numpadenter|numpadhome|numpadins|numpadleft|numpadmult|numpadpgdn|numpadpgup|numpadright|numpadsub|numpadup|pgdn|pgup|printscreen|ralt|rbutton|rcontrol|rctrl|right|rshift|rwin|rwindown|rwinup|scrolllock|shift|shiftdown|shiftup|space|tab|up|volume_down|volume_mute|volume_up|wheeldown|wheelleft|wheelright|wheelup|xbutton1|xbutton2)\b/i,
'important': /#\b(?:AllowSameLineComments|ClipboardTimeout|CommentFlag|DerefChar|ErrorStdOut|EscapeChar|HotkeyInterval|HotkeyModifierTimeout|Hotstring|If|IfTimeout|IfWinActive|IfWinExist|IfWinNotActive|IfWinNotExist|Include|IncludeAgain|InputLevel|InstallKeybdHook|InstallMouseHook|KeyHistory|MaxHotkeysPerInterval|MaxMem|MaxThreads|MaxThreadsBuffer|MaxThreadsPerHotkey|MenuMaskKey|NoEnv|NoTrayIcon|Persistent|SingleInstance|UseHook|Warn|WinActivateForce)\b/i,
'keyword': /\b(?:Abort|AboveNormal|Add|ahk_class|ahk_exe|ahk_group|ahk_id|ahk_pid|All|Alnum|Alpha|AltSubmit|AltTab|AltTabAndMenu|AltTabMenu|AltTabMenuDismiss|AlwaysOnTop|AutoSize|Background|BackgroundTrans|BelowNormal|between|BitAnd|BitNot|BitOr|BitShiftLeft|BitShiftRight|BitXOr|Bold|Border|Button|ByRef|Checkbox|Checked|CheckedGray|Choose|ChooseString|Close|Color|ComboBox|Contains|ControlList|Count|Date|DateTime|Days|DDL|Default|DeleteAll|Delimiter|Deref|Destroy|Digit|Disable|Disabled|DropDownList|Edit|Eject|Else|Enable|Enabled|Error|Exist|Expand|ExStyle|FileSystem|First|Flash|Float|FloatFast|Focus|Font|for|global|Grid|Group|GroupBox|GuiClose|GuiContextMenu|GuiDropFiles|GuiEscape|GuiSize|Hdr|Hidden|Hide|High|HKCC|HKCR|HKCU|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_LOCAL_MACHINE|HKEY_USERS|HKLM|HKU|Hours|HScroll|Icon|IconSmall|ID|IDLast|If|IfEqual|IfExist|IfGreater|IfGreaterOrEqual|IfInString|IfLess|IfLessOrEqual|IfMsgBox|IfNotEqual|IfNotExist|IfNotInString|IfWinActive|IfWinExist|IfWinNotActive|IfWinNotExist|Ignore|ImageList|in|Integer|IntegerFast|Interrupt|is|italic|Join|Label|LastFound|LastFoundExist|Limit|Lines|List|ListBox|ListView|local|Lock|Logoff|Low|Lower|Lowercase|MainWindow|Margin|Maximize|MaximizeBox|MaxSize|Minimize|MinimizeBox|MinMax|MinSize|Minutes|MonthCal|Mouse|Move|Multi|NA|No|NoActivate|NoDefault|NoHide|NoIcon|NoMainWindow|norm|Normal|NoSort|NoSortHdr|NoStandard|Not|NoTab|NoTimers|Number|Off|Ok|On|OwnDialogs|Owner|Parse|Password|Picture|Pixel|Pos|Pow|Priority|ProcessName|Radio|Range|Read|ReadOnly|Realtime|Redraw|REG_BINARY|REG_DWORD|REG_EXPAND_SZ|REG_MULTI_SZ|REG_SZ|Region|Relative|Rename|Report|Resize|Restore|Retry|RGB|Screen|Seconds|Section|Serial|SetLabel|ShiftAltTab|Show|Single|Slider|SortDesc|Standard|static|Status|StatusBar|StatusCD|strike|Style|Submit|SysMenu|Tab2|TabStop|Text|Theme|Tile|ToggleCheck|ToggleEnable|ToolWindow|Top|Topmost|TransColor|Transparent|Tray|TreeView|TryAgain|Throw|Try|Catch|Finally|Type|UnCheck|underline|Unicode|Unlock|Until|UpDown|Upper|Uppercase|UseErrorLevel|Vis|VisFirst|Visible|VScroll|Wait|WaitClose|WantCtrlA|WantF2|WantReturn|While|Wrap|Xdigit|xm|xp|xs|Yes|ym|yp|ys)\b/i,
'function': /[^(); \t,\n+*\-=?>:\\\/<&%\[\]]+?(?=\()/m,
'punctuation': /[{}[\]():,]/
};
|
/*!
* Enable double-click-to-edit functionality.
*/
( function () {
if ( Number( mw.user.options.get( 'editondblclick' ) ) !== 1 ) {
// Support both 1 or "1" (T54542)
return;
}
if ( mw.config.get( 'wgAction' ) !== 'view' ) {
// Only trigger during view action.
return;
}
$( function () {
$( '#mw-content-text' ).on( 'dblclick', function ( e ) {
// Trigger native HTMLElement click instead of opening URL (T45052)
var $a = $( '#ca-edit a' );
// Not every page has an edit link (T59713)
if ( $a.length ) {
e.preventDefault();
$a.get( 0 ).click();
}
} );
} );
}() );
|
'use strict';
import { Mat4 } from '../math/Mat4.js';
function planeNormalize(plane) {
var t = 1.0 / Math.sqrt(plane[0] * plane[0] + plane[1] * plane[1] + plane[2] * plane[2]);
plane[0] *= t;
plane[1] *= t;
plane[2] *= t;
plane[3] *= t;
}
/**
* Frustum object, part of the camera object.
* @class
*/
class Frustum {
constructor(options = {}) {
/**
* Frustum planes.
* @private
* @type {Array.<Array.<number>>}
*/
this._f = new Array(6);
for (var i = 0; i < 6; i++) {
this._f[i] = new Array(4);
}
/**
* Camera projection matrix.
* @protected
* @type {og.Mat4}
*/
this._projectionMatrix = new Mat4();
/**
* Product of projection and view matrices.
* @protected
* @type {og.Mat4}
*/
this._projectionViewMatrix = new Mat4();
/**
* Inverse projectionView Matrix.
* @protected
* @type {og.Mat4}
*/
this._inverseProjectionViewMatrix = new Mat4();
/**
* Projection frustum left value.
* @public
*/
this.left = 0.0;
/**
* Projection frustum right value.
* @public
*/
this.right = 0.0;
/**
* Projection frustum bottom value.
* @public
*/
this.bottom = 0.0;
/**
* Projection frustum top value.
* @public
*/
this.top = 0.0;
/**
* Projection frustum near value.
* @public
*/
this.near = 0.0;
/**
* Projection frustum far value.
* @public
*/
this.far = 0.0;
this.setProjectionMatrix(
options.fov || 30.0,
options.aspect || 1.0,
options.near || 1.0,
options.far || 1000.0
);
}
getRightPlane() {
return this._f[0];
}
getLeftPlane() {
return this._f[1];
}
getBottomPlane() {
return this._f[2];
}
getTopPlane() {
return this._f[3];
}
getBackwardPlane() {
return this._f[4];
}
getForwardPlane() {
return this._f[5];
}
getProjectionViewMatrix() {
return this._projectionViewMatrix._m;
}
getProjectionMatrix() {
return this._projectionMatrix._m;
}
/**
* Sets up camera projection matrix.
* @public
* @param {nnumber} angle - Camera's view angle.
* @param {number} aspect - Screen aspect ration.
* @param {number} near - Near camera distance.
* @param {number} far - Far camera distance.
*/
setProjectionMatrix(angle, aspect, near, far) {
this.top = near * Math.tan(angle * Math.PI / 360);
this.bottom = -this.top;
this.right = this.top * aspect;
this.left = -this.right;
this.near = near;
this.far = far;
this._projectionMatrix.setPerspective(this.left, this.right, this.bottom, this.top, near, far);
}
/**
* Camera's projection matrix values.
* @public
* @param {Mat4} projectionView - projectionView matrix.
*/
setViewMatrix(viewMatrix) {
this._projectionViewMatrix = this._projectionMatrix.mul(viewMatrix);
this._inverseProjectionViewMatrix = this._projectionViewMatrix.inverseTo();
let m = this._projectionViewMatrix._m;
/* Right */
this._f[0][0] = m[3] - m[0];
this._f[0][1] = m[7] - m[4];
this._f[0][2] = m[11] - m[8];
this._f[0][3] = m[15] - m[12];
planeNormalize(this._f[0]);
/* Left */
this._f[1][0] = m[3] + m[0];
this._f[1][1] = m[7] + m[4];
this._f[1][2] = m[11] + m[8];
this._f[1][3] = m[15] + m[12];
planeNormalize(this._f[1]);
/* Bottom */
this._f[2][0] = m[3] + m[1];
this._f[2][1] = m[7] + m[5];
this._f[2][2] = m[11] + m[9];
this._f[2][3] = m[15] + m[13];
planeNormalize(this._f[2]);
/* Top */
this._f[3][0] = m[3] - m[1];
this._f[3][1] = m[7] - m[5];
this._f[3][2] = m[11] - m[9];
this._f[3][3] = m[15] - m[13];
planeNormalize(this._f[3]);
/* Backward */
this._f[4][0] = m[3] - m[2];
this._f[4][1] = m[7] - m[6];
this._f[4][2] = m[11] - m[10];
this._f[4][3] = m[15] - m[14];
planeNormalize(this._f[4]);
/* Forward */
this._f[5][0] = m[3] + m[2];
this._f[5][1] = m[7] + m[6];
this._f[5][2] = m[11] + m[10];
this._f[5][3] = m[15] + m[14];
planeNormalize(this._f[5]);
}
/**
* Returns true if a point in the frustum.
* @public
* @param {og.Vec3} point - Cartesian point.
* @returns {boolean} -
*/
containsPoint(point) {
var d;
for (var p = 0; p < 6; p++) {
d = point.dotArr(this._f[p]) + this._f[p][3];
if (d <= 0) {
return false;
}
}
return true;
}
/**
* Returns true if the frustum contains a bonding sphere, but bottom plane exclude.
* @public
* @param {og.bv.Sphere} sphere - Bounding sphere.
* @returns {boolean} -
*/
containsSphereBottomExc(sphere) {
var r = -sphere.radius,
f = this._f;
if (sphere.center.dotArr(f[0]) + f[0][3] <= r) return false;
if (sphere.center.dotArr(f[1]) + f[1][3] <= r) return false;
if (sphere.center.dotArr(f[3]) + f[3][3] <= r) return false;
if (sphere.center.dotArr(f[4]) + f[4][3] <= r) return false;
if (sphere.center.dotArr(f[5]) + f[5][3] <= r) return false;
return true;
}
containsSphereButtom(sphere) {
var r = -sphere.radius,
f = this._f;
if (sphere.center.dotArr(f[2]) + f[2][3] <= r) return false;
return true;
}
/**
* Returns true if the frustum contains a bonding sphere.
* @public
* @param {og.bv.Sphere} sphere - Bounding sphere.
* @returns {boolean} -
*/
containsSphere(sphere) {
var r = -sphere.radius,
f = this._f;
if (sphere.center.dotArr(f[0]) + f[0][3] <= r) return false;
if (sphere.center.dotArr(f[1]) + f[1][3] <= r) return false;
if (sphere.center.dotArr(f[2]) + f[2][3] <= r) return false;
if (sphere.center.dotArr(f[3]) + f[3][3] <= r) return false;
if (sphere.center.dotArr(f[4]) + f[4][3] <= r) return false;
if (sphere.center.dotArr(f[5]) + f[5][3] <= r) return false;
return true;
}
/**
* Returns true if the frustum contains a bonding sphere.
* @public
* @param {Vec3} center - Sphere center.
* @param {number} radius - Sphere radius.
* @returns {boolean} -
*/
containsSphere2(center, radius) {
var r = -radius;
if (center.dotArr(this._f[0]) + this._f[0][3] <= r) return false;
if (center.dotArr(this._f[1]) + this._f[1][3] <= r) return false;
if (center.dotArr(this._f[2]) + this._f[2][3] <= r) return false;
if (center.dotArr(this._f[3]) + this._f[3][3] <= r) return false;
if (center.dotArr(this._f[4]) + this._f[4][3] <= r) return false;
if (center.dotArr(this._f[5]) + this._f[5][3] <= r) return false;
return true;
}
/**
* Returns true if the frustum contains a bounding box.
* @public
* @param {og.bv.Box} box - Bounding box.
* @returns {boolean} -
*/
containsBox(box) {
var result = true, cout, cin;
for (var i = 0; i < 6; i++) {
cout = 0; cin = 0;
for (var k = 0; k < 8 && (cin === 0 || cout === 0); k++) {
var d = box.vertices[k].dotArr(this._f[i]) + this._f[i][3];
if (d < 0) {
cout++;
} else {
cin++;
}
}
if (cin === 0) {
return false;
} else if (cout > 0) {
result = true;
}
}
return result;
}
};
export { Frustum };
|
import React, { Component } from 'react';
import { Text, View, TouchableWithoutFeedback } from 'react-native';
import PropTypes from 'prop-types';
import Icon from '../Icon/Icon';
import Ripple from '../Ripple/Ripple';
import withTheme from '../../Theme/withTheme';
import styles from './Checkbox.styles';
class Checkbox extends Component {
static propTypes = {
checked: PropTypes.bool,
disabled: PropTypes.bool,
onPress: PropTypes.func,
rippleColor: PropTypes.string,
checkboxColor: PropTypes.string,
unCheckedColor: PropTypes.string,
style: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
checkboxStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
theme: PropTypes.object,
rippleMatchesCheckbox: PropTypes.bool,
indeterminate: PropTypes.bool,
label: PropTypes.string,
labelStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
labelPos: PropTypes.string,
icon: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
checkedIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
ios: PropTypes.bool,
error: PropTypes.bool,
testID: PropTypes.string,
};
static defaultProps = {
unCheckedColor: 'rgba(0,0,0,.5)',
rippleColor: 'rgba(0,0,0,.8)',
icon: 'check-box-outline-blank',
checkedIcon: 'check-box',
labelPos: 'right',
};
_getRippleColor() {
const { rippleColor, rippleMatchesCheckbox, error, theme } = this.props;
const checkboxColor = this._getCheckBoxColor();
let rippleColorApplied = rippleColor;
if (rippleMatchesCheckbox) rippleColorApplied = checkboxColor;
if (error) rippleColorApplied = theme.error.main;
return rippleColorApplied;
}
_getCheckBoxColor() {
const { disabled, checkboxColor, theme, error } = this.props;
let checkboxColorApplied = checkboxColor
? checkboxColor
: theme.primary.main;
if (error) checkboxColorApplied = theme.error.main;
if (disabled) checkboxColorApplied = 'rgba(0,0,0,.5)';
return checkboxColorApplied;
}
_renderLabel() {
const { label, labelStyle, onPress } = this.props;
if (!label) return null;
return (
<TouchableWithoutFeedback onPress={onPress}>
<View style={styles.labelContainer}>
<Text style={[styles.label, labelStyle]}>{label}</Text>
</View>
</TouchableWithoutFeedback>
);
}
_renderIconContainer() {
const { disabled, onPress, checkboxStyle } = this.props;
const rippleColor = this._getRippleColor();
return (
<Ripple
onPress={onPress}
disabled={disabled}
style={[styles.checkBoxRipple, checkboxStyle]}
rippleCentered={true}
rippleColor={rippleColor}
rippleContainerBorderRadius={18}>
{this._renderIcon()}
</Ripple>
);
}
_renderIcon() {
const {
icon,
checkedIcon,
unCheckedColor,
indeterminate,
checked,
ios,
theme,
error,
} = this.props;
const checkboxColor = this._getCheckBoxColor();
if (icon && icon.props && icon.props.name && !checked) {
return React.cloneElement(icon, {
size: icon.props.size ? icon.props.size : 24,
color: checkboxColor,
});
} else if (
checkedIcon &&
checkedIcon.props &&
checkedIcon.props.name &&
checked
) {
return React.cloneElement(checkedIcon, {
size: icon.props.size ? icon.props.size : 24,
color: checkboxColor,
});
}
let iconName = indeterminate ? 'indeterminate-check-box' : checkedIcon;
let opacity = 1;
if (ios && !indeterminate && checked) iconName = 'done';
if (!checked) iconName = icon;
if (!checked && ios) opacity = 0;
let unCheckedColorApplied = unCheckedColor;
if (error) unCheckedColorApplied = theme.error.main;
return (
<Icon
name={iconName}
size={24}
color={checked ? checkboxColor : unCheckedColorApplied}
style={{ opacity }}
/>
);
}
render() {
const { style, labelPos, testID } = this.props;
return (
<View style={[styles.container, style]} testID={testID}>
{labelPos === 'left' ? this._renderLabel() : null}
{this._renderIconContainer()}
{labelPos === 'right' ? this._renderLabel() : null}
</View>
);
}
}
export default withTheme(Checkbox);
|
/*
Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'elementspath', 'hu', {
eleLabel: 'Elem utak',
eleTitle: '%1 elem'
} );
|
/*
Copyright 2020 Adobe. All rights reserved.
This file is licensed to you 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 REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
export default (settings) => {
const { secrets } = settings;
['development', 'staging', 'production'].forEach((stage) => {
if (secrets[stage] && !secrets[stage].id) {
delete secrets[stage];
}
});
if (
secrets &&
Object.keys(secrets).length === 0 &&
secrets.constructor === Object
) {
delete settings.secrets;
}
return settings;
};
|
require('dotenv').config()
let PORT = process.env.PORT
let MONGODB_URI = process.env.MONGODB_URI
if (process.env.NODE_ENV === 'test') {
MONGODB_URI = process.env.TEST_MONGODB_URI
}
module.exports = {
PORT,
MONGODB_URI,
}
|
'use strict';
jest.mock('@mapbox/polyline', () => {
return {
encode: jest.fn(() => 'mock polyline')
};
});
const polyline = require('@mapbox/polyline');
const staticService = require('../static');
const tu = require('../../test/test-utils');
let service;
beforeEach(() => {
var client = tu.mockClient();
client.origin = 'https://api.mapbox.com';
client.accessToken = 'pk.xxx';
service = staticService(client);
});
describe('getStaticImage', () => {
test('minimal options', () => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: {
coordinates: [12, 13],
zoom: 4
}
});
expect(tu.requestConfig(service)).toEqual({
method: 'GET',
path: '/styles/v1/:ownerId/:styleId/static/12,13,4/200x300',
query: {},
params: { ownerId: 'mapbox', styleId: 'streets-v10' },
encoding: 'binary'
});
});
test('bearing and pitch', () => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: {
coordinates: [12, 13],
zoom: 3,
bearing: 80,
pitch: 30
}
});
expect(tu.requestConfig(service)).toEqual({
method: 'GET',
path: '/styles/v1/:ownerId/:styleId/static/12,13,3,80,30/200x300',
query: {},
params: { ownerId: 'mapbox', styleId: 'streets-v10' },
encoding: 'binary'
});
});
test('auto position', () => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: 'auto'
});
expect(tu.requestConfig(service)).toEqual({
method: 'GET',
path: '/styles/v1/:ownerId/:styleId/static/auto/200x300',
query: {},
params: { ownerId: 'mapbox', styleId: 'streets-v10' },
encoding: 'binary'
});
});
test('highRes', () => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: {
coordinates: [12, 13],
zoom: 3
},
highRes: true
});
expect(tu.requestConfig(service)).toEqual({
method: 'GET',
path: '/styles/v1/:ownerId/:styleId/static/12,13,3/200x300@2x',
query: {},
params: { ownerId: 'mapbox', styleId: 'streets-v10' },
encoding: 'binary'
});
});
test('without attribution and logo', () => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: {
coordinates: [12, 13],
zoom: 3
},
attribution: false,
logo: false
});
expect(tu.requestConfig(service)).toEqual({
method: 'GET',
path: '/styles/v1/:ownerId/:styleId/static/12,13,3/200x300',
query: { attribution: 'false', logo: 'false' },
params: { ownerId: 'mapbox', styleId: 'streets-v10' },
encoding: 'binary'
});
});
test('with marker overlays', () => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: {
coordinates: [12, 13],
zoom: 3
},
overlays: [
// Simple markers.
{
marker: {
coordinates: [12.2, 12.8]
}
},
{
marker: {
size: 'large',
coordinates: [14, 13.2],
label: 'm',
color: '#000'
}
},
{
marker: {
coordinates: [15, 15.2],
label: 'airport',
color: '#ff0000'
}
},
// Custom marker
{
marker: {
coordinates: [10, 11],
url:
'https://upload.wikimedia.org/wikipedia/commons/6/6f/0xff_timetracker.png'
}
}
]
});
expect(tu.requestConfig(service)).toEqual({
method: 'GET',
path:
'/styles/v1/:ownerId/:styleId/static/pin-s(12.2,12.8),pin-l-m+000(14,13.2),pin-s-airport+ff0000(15,15.2),url-https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2F6%2F6f%2F0xff_timetracker.png(10,11)/12,13,3/200x300',
query: {},
params: { ownerId: 'mapbox', styleId: 'streets-v10' },
encoding: 'binary'
});
});
test('with a marker before a layer', () => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: {
coordinates: [12, 13],
zoom: 3
},
overlays: [
{
marker: {
coordinates: [12.2, 12.8]
}
}
],
before_layer: 'national_park'
});
expect(tu.requestConfig(service)).toEqual({
method: 'GET',
path:
'/styles/v1/:ownerId/:styleId/static/pin-s(12.2,12.8)/12,13,3/200x300',
query: { before_layer: 'national_park' },
params: { ownerId: 'mapbox', styleId: 'streets-v10' },
encoding: 'binary'
});
});
test('with GeoJSON line overlay that includes longitude <-180', () => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: {
coordinates: [12, 13],
zoom: 3
},
overlays: [
{
geoJson: {
type: 'Feature',
properties: {},
geometry: {
type: 'LineString',
coordinates: [
[11.09619140625, 13.132979019087472],
[-190.11767578125, 14.392118083661728]
]
}
}
}
]
});
expect(tu.requestConfig(service)).toEqual({
method: 'GET',
path:
'/styles/v1/:ownerId/:styleId/static/geojson(%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%7D%2C%22geometry%22%3A%7B%22type%22%3A%22LineString%22%2C%22coordinates%22%3A%5B%5B11.09619140625%2C13.132979019087472%5D%2C%5B-190.11767578125%2C14.392118083661728%5D%5D%7D%7D)/12,13,3/200x300',
query: {},
params: { ownerId: 'mapbox', styleId: 'streets-v10' },
encoding: 'binary'
});
});
test('with GeoJSON FeatureCollection overlay', () => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: {
coordinates: [12, 13],
zoom: 3
},
overlays: [
{
geoJson: {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
properties: {},
geometry: {
type: 'Polygon',
coordinates: [
[
[11.129150390625, 13.742053062720384],
[11.05224609375, 13.047372256948787],
[12.205810546875, 13.036669323115246],
[12.095947265625, 13.69936179848486],
[11.129150390625, 13.742053062720384]
]
]
}
}
]
}
}
]
});
expect(tu.requestConfig(service)).toEqual({
method: 'GET',
path:
'/styles/v1/:ownerId/:styleId/static/geojson(%7B%22type%22%3A%22FeatureCollection%22%2C%22features%22%3A%5B%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Polygon%22%2C%22coordinates%22%3A%5B%5B%5B11.129150390625%2C13.742053062720384%5D%2C%5B11.05224609375%2C13.047372256948787%5D%2C%5B12.205810546875%2C13.036669323115246%5D%2C%5B12.095947265625%2C13.69936179848486%5D%2C%5B11.129150390625%2C13.742053062720384%5D%5D%5D%7D%7D%5D%7D)/12,13,3/200x300',
query: {},
params: { ownerId: 'mapbox', styleId: 'streets-v10' },
encoding: 'binary'
});
});
test('with simple polyline overlay', () => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: {
coordinates: [12, 13],
zoom: 3
},
overlays: [
{
path: {
coordinates: [
[8.1298828125, 10.098670120603392],
[9.4921875, 15.792253570362446]
]
}
}
]
});
expect(tu.requestConfig(service)).toEqual({
method: 'GET',
path:
'/styles/v1/:ownerId/:styleId/static/path(mock%20polyline)/12,13,3/200x300',
query: {},
params: { ownerId: 'mapbox', styleId: 'streets-v10' },
encoding: 'binary'
});
expect(polyline.encode).toHaveBeenCalledWith([
[10.098670120603392, 8.1298828125],
[15.792253570362446, 9.4921875]
]);
});
test('with fancy polyline overlay', () => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: {
coordinates: [12, 13],
zoom: 3
},
overlays: [
{
path: {
coordinates: [
[8.1298828125, 10.098670120603392],
[9.4921875, 15.792253570362446],
[11.77734375, 14.179186142354181],
[11.513671874999998, 11.6522364041154]
],
strokeColor: 'ff0000',
strokeWidth: 10,
strokeOpacity: 0.4,
fillColor: '000',
fillOpacity: 0.75
}
}
]
});
expect(tu.requestConfig(service)).toEqual({
method: 'GET',
path:
'/styles/v1/:ownerId/:styleId/static/path-10+ff0000-0.4+000-0.75(mock%20polyline)/12,13,3/200x300',
query: {},
params: { ownerId: 'mapbox', styleId: 'streets-v10' },
encoding: 'binary'
});
expect(polyline.encode).toHaveBeenCalledWith([
[10.098670120603392, 8.1298828125],
[15.792253570362446, 9.4921875],
[14.179186142354181, 11.77734375],
[11.6522364041154, 11.513671874999998]
]);
});
test('catches bad polylines', () => {
expect(() => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: 'auto',
overlays: [
{
path: {
coordinates: [
[8.1298828125, 10.098670120603392],
[9.4921875, 15.792253570362446]
],
strokeOpacity: 0.4
}
}
]
});
}).toThrow(/strokeOpacity requires strokeColor/);
expect(() => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: 'auto',
overlays: [
{
path: {
coordinates: [
[8.1298828125, 10.098670120603392],
[9.4921875, 15.792253570362446]
],
fillColor: '000'
}
}
]
});
}).toThrow(/fillColor requires strokeColor/);
expect(() => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: 'auto',
overlays: [
{
path: {
coordinates: [
[8.1298828125, 10.098670120603392],
[9.4921875, 15.792253570362446]
],
strokeColor: 'ff0000',
fillOpacity: 0.75
}
}
]
});
}).toThrow(/fillOpacity requires fillColor/);
});
test('setfilter', () => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: {
coordinates: [12, 13],
zoom: 3
},
setfilter: ['>', 'height', 300],
layer_id: 'building'
});
expect(tu.requestConfig(service)).toEqual({
method: 'GET',
path: '/styles/v1/:ownerId/:styleId/static/12,13,3/200x300',
query: {
setfilter: '[">","height",300]',
layer_id: 'building'
},
params: { ownerId: 'mapbox', styleId: 'streets-v10' },
encoding: 'binary'
});
});
test('Must include layer_id in setfilter request', () => {
expect(() => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: {
coordinates: [12, 13],
zoom: 3
},
setfilter: ['in', 'code', 'CA']
});
}).toThrow(/Must include layer_id in setfilter request/);
});
test('Auto extent cannot be used with style parameters and no overlay', () => {
expect(() => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: 'auto',
setfilter: ['in', 'code', 'CA'],
layer_id: 'tunnel-street-minor-low'
});
}).toThrow(
/Auto extent cannot be used with style parameters and no overlay/
);
});
test('Auto extent can be used with setfilter when overlays are defined', () => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: 'auto',
overlays: [
{
marker: {
coordinates: [12.2, 12.8]
}
}
],
setfilter: ['in', 'code', 'CA'],
layer_id: 'tunnel-street-minor-low'
});
expect(tu.requestConfig(service)).toEqual({
method: 'GET',
path: '/styles/v1/:ownerId/:styleId/static/pin-s(12.2,12.8)/auto/200x300',
query: {
setfilter: '["in","code","CA"]',
layer_id: 'tunnel-street-minor-low'
},
params: { ownerId: 'mapbox', styleId: 'streets-v10' },
encoding: 'binary'
});
});
test('addlayer', () => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: {
coordinates: [12, 13],
zoom: 3
},
addlayer: {
id: 'tall-buildings',
type: 'fill',
source: 'composite',
'source-layer': 'building',
filter: [
'all',
['>=', ['get', 'height'], 150],
['match', ['get', 'underground'], ['false'], true, false]
],
paint: { 'fill-color': '%235E8DFF', 'fill-opacity': 0.5 }
},
before_layer: 'tunnel-street-minor-low'
});
expect(tu.requestConfig(service)).toEqual({
method: 'GET',
path: '/styles/v1/:ownerId/:styleId/static/12,13,3/200x300',
query: {
addlayer:
'{"id":"tall-buildings","type":"fill","source":"composite","source-layer":"building","filter":["all",[">=",["get","height"],150],["match",["get","underground"],["false"],true,false]],"paint":{"fill-color":"%235E8DFF","fill-opacity":0.5}}',
before_layer: 'tunnel-street-minor-low'
},
params: { ownerId: 'mapbox', styleId: 'streets-v10' },
encoding: 'binary'
});
});
test('Auto extent cannot be used with style parameters and no overlay', () => {
expect(() => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: 'auto',
addlayer: {
id: 'tall-buildings',
type: 'fill',
source: 'composite',
'source-layer': 'building',
filter: [
'all',
['>=', ['get', 'height'], 150],
['match', ['get', 'underground'], ['false'], true, false]
],
paint: { 'fill-color': '%235E8DFF', 'fill-opacity': 0.5 }
},
before_layer: 'tunnel-street-minor-low'
});
}).toThrow(
/Auto extent cannot be used with style parameters and no overlay/
);
});
test('Auto extent can be used with addlayer when overlays are defined', () => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: 'auto',
overlays: [
{
marker: {
coordinates: [12.2, 12.8]
}
}
],
addlayer: {
id: 'tall-buildings',
type: 'fill',
source: 'composite',
'source-layer': 'building',
filter: [
'all',
['>=', ['get', 'height'], 150],
['match', ['get', 'underground'], ['false'], true, false]
],
paint: { 'fill-color': '%235E8DFF', 'fill-opacity': 0.5 }
},
before_layer: 'tunnel-street-minor-low'
});
expect(tu.requestConfig(service)).toEqual({
method: 'GET',
path: '/styles/v1/:ownerId/:styleId/static/pin-s(12.2,12.8)/auto/200x300',
query: {
addlayer:
'{"id":"tall-buildings","type":"fill","source":"composite","source-layer":"building","filter":["all",[">=",["get","height"],150],["match",["get","underground"],["false"],true,false]],"paint":{"fill-color":"%235E8DFF","fill-opacity":0.5}}',
before_layer: 'tunnel-street-minor-low'
},
params: { ownerId: 'mapbox', styleId: 'streets-v10' },
encoding: 'binary'
});
});
test('addlayer and setfilter cannot be used in the same request', () => {
expect(() => {
service.getStaticImage({
ownerId: 'mapbox',
styleId: 'streets-v10',
width: 200,
height: 300,
position: {
coordinates: [12, 13],
zoom: 3
},
addlayer: {
id: 'tall-buildings',
type: 'fill',
source: 'composite',
'source-layer': 'building',
filter: [
'all',
['>=', ['get', 'height'], 150],
['match', ['get', 'underground'], ['false'], true, false]
],
paint: { 'fill-color': '%235E8DFF', 'fill-opacity': 0.5 }
},
before_layer: 'tunnel-street-minor-low',
setfilter: ['in', 'code', 'CA'],
layer_id: 'tunnel-street-minor-low'
});
}).toThrow(/addlayer and setfilter cannot be used in the same request/);
});
});
|
/*
Copyright © 2001-2004 World Wide Web Consortium,
(Massachusetts Institute of Technology, European Research Consortium
for Informatics and Mathematics, Keio University). All
Rights Reserved. This work is distributed under the W3C® Software License [1] in the
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
*/
// expose test function names
function exposeTestFunctionNames()
{
return ['XPathResult_resultType'];
}
var docsLoaded = -1000000;
var builder = null;
//
// This function is called by the testing framework before
// running the test suite.
//
// If there are no configuration exceptions, asynchronous
// document loading is started. Otherwise, the status
// is set to complete and the exception is immediately
// raised when entering the body of the test.
//
function setUpPage() {
setUpPageStatus = 'running';
try {
//
// creates test document builder, may throw exception
//
builder = createConfiguredBuilder();
docsLoaded = 0;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
docsLoaded += preload(docRef, "doc", "staff");
if (docsLoaded == 1) {
setUpPageStatus = 'complete';
}
} catch(ex) {
catchInitializationError(builder, ex);
setUpPageStatus = 'complete';
}
}
//
// This method is called on the completion of
// each asychronous load started in setUpTests.
//
// When every synchronous loaded document has completed,
// the page status is changed which allows the
// body of the test to be executed.
function loadComplete() {
if (++docsLoaded == 1) {
setUpPageStatus = 'complete';
}
}
/**
*
Create an XPathResult for the expression /staff/employee
for each type of XPathResultType, checking that the resultType
of the XPathResult matches the requested type.
* @author Bob Clary
* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResultType
* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult
* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvaluator-createNSResolver
* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvaluator-evaluate
* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult-resultType
* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathException
*/
function XPathResult_resultType() {
var success;
if(checkInitialization(builder, "XPathResult_resultType") != null) return;
var doc;
var resolver;
var evaluator;
var expression = "/staff/employee";
var contextNode;
var inresult = null;
var outresult = null;
var inNodeType;
var outNodeType;
var ANY_TYPE = 0;
var NUMBER_TYPE = 1;
var STRING_TYPE = 2;
var BOOLEAN_TYPE = 3;
var UNORDERED_NODE_ITERATOR_TYPE = 4;
var ORDERED_NODE_ITERATOR_TYPE = 5;
var UNORDERED_NODE_SNAPSHOT_TYPE = 6;
var ORDERED_NODE_SNAPSHOT_TYPE = 7;
var ANY_UNORDERED_NODE_TYPE = 8;
var FIRST_ORDERED_NODE_TYPE = 9;
var isTypeEqual;
nodeTypeList = new Array();
nodeTypeList[0] = 0;
nodeTypeList[1] = 1;
nodeTypeList[2] = 2;
nodeTypeList[3] = 3;
nodeTypeList[4] = 4;
nodeTypeList[5] = 5;
nodeTypeList[6] = 6;
nodeTypeList[7] = 7;
nodeTypeList[8] = 8;
nodeTypeList[9] = 9;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
doc = load(docRef, "doc", "staff");
evaluator = createXPathEvaluator(doc);
resolver = evaluator.createNSResolver(doc);
contextNode = doc;
for(var indexN65737 = 0;indexN65737 < nodeTypeList.length; indexN65737++) {
inNodeType = nodeTypeList[indexN65737];
outresult = evaluator.evaluate(expression,contextNode,resolver,inNodeType,inresult);
outNodeType = outresult.resultType;
if(
(inNodeType == ANY_TYPE)
) {
assertEquals("ANY_TYPE_resulttype",UNORDERED_NODE_ITERATOR_TYPE,outNodeType);
}
if(
(inNodeType == NUMBER_TYPE)
) {
assertEquals("NUMBER_TYPE_resulttype",NUMBER_TYPE,outNodeType);
}
if(
(inNodeType == STRING_TYPE)
) {
assertEquals("STRING_TYPE_resulttype",STRING_TYPE,outNodeType);
}
if(
(inNodeType == BOOLEAN_TYPE)
) {
assertEquals("BOOLEAN_TYPE_resulttype",BOOLEAN_TYPE,outNodeType);
}
if(
(inNodeType == UNORDERED_NODE_ITERATOR_TYPE)
) {
assertEquals("UNORDERED_NODE_ITERATOR_TYPE_resulttype",UNORDERED_NODE_ITERATOR_TYPE,outNodeType);
}
if(
(inNodeType == ORDERED_NODE_ITERATOR_TYPE)
) {
assertEquals("ORDERED_NODE_ITERATOR_TYPE_resulttype",ORDERED_NODE_ITERATOR_TYPE,outNodeType);
}
if(
(inNodeType == UNORDERED_NODE_SNAPSHOT_TYPE)
) {
assertEquals("UNORDERED_NODE_SNAPSHOT_TYPE_resulttype",UNORDERED_NODE_SNAPSHOT_TYPE,outNodeType);
}
if(
(inNodeType == ORDERED_NODE_SNAPSHOT_TYPE)
) {
assertEquals("ORDERED_NODE_SNAPSHOT_TYPE_resulttype",ORDERED_NODE_SNAPSHOT_TYPE,outNodeType);
}
if(
(inNodeType == ANY_UNORDERED_NODE_TYPE)
) {
assertEquals("ANY_UNORDERED_NODE_TYPE_resulttype",ANY_UNORDERED_NODE_TYPE,outNodeType);
}
if(
(inNodeType == FIRST_ORDERED_NODE_TYPE)
) {
assertEquals("FIRST_ORDERED_NODE_TYPE_resulttype",FIRST_ORDERED_NODE_TYPE,outNodeType);
}
}
}
function runTest() {
XPathResult_resultType();
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.