text
stringlengths 3
1.05M
|
---|
$(document).ready(function()
{ var url = "/marketrate";
var table = $('#myTable').DataTable({
responsive: true,
processing: true,
serverSide: true,
ajax: dataurl,
columns: [
{data: 'strCityDesc', name: 'strCityDesc'},
{data: 'dtmDateAsOf', name: 'dtmDateAsOf'},
{data: 'rate', name: 'rate'},
{data: 'action', name: 'action', orderable: false, searchable: false}
]
});
//display modal form for task editing
$(document).on('hidden.bs.modal','#myModal', function ()
{
$('#myForm').parsley().destroy();
$("#myForm").trigger("reset");
});
$('#myList').on('click', '.open-modal',function()
{
console.log($(this).val());
var myId = $(this).val();
$.get(url + '/' + myId + '/edit', function (data)
{
//success data
console.log(data);
$('#lblHeader').replaceWith("<p id='lblHeader'>Update</p>");
$('#myId').val(myId);
$('#txtRate').val(data.rate);
$('#myModal').modal('show');
$('#btnSave').val('Save');
})
});
//create new task / update existing task
$('#btnSave').on('click',function(e)
{
if($('#myForm').parsley().isValid())
{
$.ajaxSetup(
{
headers: {
'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
}
})
e.preventDefault();
var my_url = url;
var type="POST";
myId=$('#myId').val();
var formData = $('#myForm').serialize();
//for updating existing resource
console.log(formData);
$.ajax({
type: type,
url: my_url,
data: formData,
dataType: 'json',
success: function (data) {
console.log(data);
rate=data.rate;
date=data.dtmDateAsOf;
if(parseInt(data.rate)==0)
{
rate="not set";
date="n/a"
}
table.draw();
successPrompt();
$('#myModal').modal('hide');
},
error: function (data) {
console.log('Error:', data);
}
});
}}
);
function successPrompt(){
title="Record Successfully Updated!";
$.notify(title, "success");
}
}
);
|
const KEY_OFFSET = 1000
export const keyify = line => line.split('')
.reduce((acc, char, index) => acc + char.charCodeAt(0) + (index * KEY_OFFSET))
export default [keyify]
|
import React from 'react'
import Icon from 'react-icon-base'
const MdDeveloperMode = props => (
<Icon viewBox="0 0 40 40" {...props}>
<g><path d="m28.4 31.6v-3.2h3.2v6.6c0 1.8-1.4 3.4-3.2 3.4h-16.8c-1.8 0-3.2-1.6-3.2-3.4v-6.6h3.2v3.2h16.8z m-11.8-6.3l-2.3 2.4-7.7-7.7 7.7-7.7 2.3 2.4-5.2 5.3z m9.1 2.4l-2.3-2.4 5.2-5.3-5.2-5.3 2.3-2.4 7.7 7.7z m-14.1-19.3v3.2h-3.2v-6.6c0-1.8 1.4-3.4 3.2-3.4l16.8 0.1c1.8 0 3.2 1.5 3.2 3.3v6.6h-3.2v-3.2h-16.8z"/></g>
</Icon>
)
export default MdDeveloperMode
|
export default addAndRemoveRepostioryCollaborator;
import env from "../../../lib/env.js";
import getTemporaryRepository from "../../../lib/temporary-repository.js";
// - As user A, invite user B as collaborator to repository "octokit-fixture-org/hello-world"
// - As user A, list invitations
// - As user B, accept invitation
// - As user A, list collaborators (now includes user B)
// - As user A, remove user B as collaborator from repository
// - As user A, list collaborators (no longer includes user B)
async function addAndRemoveRepostioryCollaborator(state) {
// create a temporary repository
const temporaryRepository = getTemporaryRepository({
request: state.request,
token: env.FIXTURES_USER_A_TOKEN_FULL_ACCESS,
org: "octokit-fixture-org",
name: "add-and-remove-repository-collaborator",
});
await temporaryRepository.create();
// https://developer.github.com/v3/repos/collaborators/#add-user-as-a-collaborator
await state.request({
method: "put",
url: `/repos/octokit-fixture-org/${temporaryRepository.name}/collaborators/octokit-fixture-user-b`,
headers: {
Accept: "application/vnd.github.v3+json",
Authorization: `token ${env.FIXTURES_USER_A_TOKEN_FULL_ACCESS}`,
},
});
// https://developer.github.com/v3/repos/invitations/
const invitationsResponse = await state.request({
method: "get",
url: `/repos/octokit-fixture-org/${temporaryRepository.name}/invitations`,
headers: {
Accept: "application/vnd.github.v3+json",
Authorization: `token ${env.FIXTURES_USER_A_TOKEN_FULL_ACCESS}`,
},
});
// https://developer.github.com/v3/repos/invitations/#accept-a-repository-invitation
await state.request({
method: "patch",
url: `/user/repository_invitations/${invitationsResponse.data[0].id}`,
headers: {
Accept: "application/vnd.github.v3+json",
Authorization: `token ${env.FIXTURES_USER_B_TOKEN_FULL_ACCESS}`,
},
});
// wait for 1000ms as there seems to be a race condition on GitHub’s API
await new Promise((resolve) => setTimeout(resolve, 1000));
// https://developer.github.com/v3/repos/collaborators/#list-collaborators
await state.request({
method: "get",
url: `/repos/octokit-fixture-org/${temporaryRepository.name}/collaborators`,
headers: {
Accept: "application/vnd.github.v3+json",
Authorization: `token ${env.FIXTURES_USER_A_TOKEN_FULL_ACCESS}`,
},
});
// https://developer.github.com/v3/repos/collaborators/#remove-user-as-a-collaborator
await state.request({
method: "delete",
url: `/repos/octokit-fixture-org/${temporaryRepository.name}/collaborators/octokit-fixture-user-b`,
headers: {
Accept: "application/vnd.github.v3+json",
Authorization: `token ${env.FIXTURES_USER_A_TOKEN_FULL_ACCESS}`,
},
});
// https://developer.github.com/v3/repos/collaborators/#list-collaborators
await state.request({
method: "get",
url: `/repos/octokit-fixture-org/${temporaryRepository.name}/collaborators`,
headers: {
Accept: "application/vnd.github.v3+json",
Authorization: `token ${env.FIXTURES_USER_A_TOKEN_FULL_ACCESS}`,
},
});
await temporaryRepository.delete();
}
|
var $ = require('jquery');
var cdb = require('cartodb.js');
cdb.admin = require('cdb.admin');
var Visualizations = require('../../../../../../javascripts/cartodb/explore/feed_collection');
describe('explore/feed_collection', function() {
beforeEach(function() {
this.collection = new Visualizations();
});
it('should generate a query', function() {
var query = 'WITH m As (SELECT max(visualization_likes) As max_likes, max(visualization_mapviews) As max_views FROM visualizations) SELECT user_avatar_url AS avatar_url,user_username AS username,visualization_geometry_types AS geom_types,visualization_id AS id,visualization_likes AS likes,visualization_mapviews AS mapviews,visualization_mapviews::numeric / (1.0 + (now()::date - visualization_created_at::date)::numeric)^2 * 100.0 / m.max_views As mapviews_trend,visualization_likes::numeric / (1.0 + (now()::date - visualization_created_at::date)::numeric)^2 * 100.0 / m.max_likes As likes_trend,visualization_name AS name,visualization_map_datasets AS map_datasets,visualization_table_rows AS rows,visualization_table_size AS table_size,visualization_tags AS tags,visualization_title AS title,visualization_type AS type,visualization_created_at AS created_at,visualization_updated_at AS updated_at FROM visualizations, m ORDER BY likes_trend DESC, created_at DESC, visualization_id DESC LIMIT 8 OFFSET 0';
expect(this.collection._generateQuery(null, 'likes', 0, 8)).toEqual(query);
});
it('should generate a query depending on the type', function() {
var query = 'WITH m As (SELECT max(visualization_likes) As max_likes, max(visualization_mapviews) As max_views FROM visualizations) SELECT user_avatar_url AS avatar_url,user_username AS username,visualization_geometry_types AS geom_types,visualization_id AS id,visualization_likes AS likes,visualization_mapviews AS mapviews,visualization_mapviews::numeric / (1.0 + (now()::date - visualization_created_at::date)::numeric)^2 * 100.0 / m.max_views As mapviews_trend,visualization_likes::numeric / (1.0 + (now()::date - visualization_created_at::date)::numeric)^2 * 100.0 / m.max_likes As likes_trend,visualization_name AS name,visualization_map_datasets AS map_datasets,visualization_table_rows AS rows,visualization_table_size AS table_size,visualization_tags AS tags,visualization_title AS title,visualization_type AS type,visualization_created_at AS created_at,visualization_updated_at AS updated_at FROM visualizations, m WHERE visualization_type = \'datasets\' ORDER BY mapviews_trend DESC, created_at DESC, visualization_id DESC LIMIT 8 OFFSET 8';
expect(this.collection._generateQuery('datasets', 'mapviews', 1, 8)).toEqual(query);
});
});
|
// SVGPathCommander v0.1.25 | thednp © 2022 | MIT-License
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).SVGPathCommander=e()}(this,(function(){"use strict";var t={origin:[0,0,0],round:4},e={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function r(t){var r=t.pathValue[t.segmentStart],n=r.toLowerCase(),a=t.data;for("m"===n&&a.length>2&&(t.segments.push([r,a[0],a[1]]),a=a.slice(2),n="l",r="m"===r?"l":"L");a.length>=e[n]&&(t.segments.push([r].concat(a.splice(0,e[n]))),e[n]););}function n(t){var e=t.index,r=t.pathValue.charCodeAt(e);return 48===r?(t.param=0,void(t.index+=1)):49===r?(t.param=1,void(t.index+=1)):void(t.err='Invalid path value: invalid Arc flag "'+r+'", expecting 0 or 1 at index '+e)}function a(t){return t>=48&&t<=57}function i(t){var e,r=t.max,n=t.pathValue,i=t.index,o=i,s=!1,u=!1,c=!1,m=!1;if(o>=r)t.err="Invalid path value at "+o+": missing param "+n[o];else if(43!==(e=n.charCodeAt(o))&&45!==e||(e=(o+=1)<r?n.charCodeAt(o):0),a(e)||46===e){if(46!==e){if(s=48===e,e=(o+=1)<r?n.charCodeAt(o):0,s&&o<r&&e&&a(e))return void(t.err="Invalid path value at index "+i+": "+n[i]+" illegal number");for(;o<r&&a(n.charCodeAt(o));)o+=1,u=!0;e=o<r?n.charCodeAt(o):0}if(46===e){for(m=!0,o+=1;a(n.charCodeAt(o));)o+=1,c=!0;e=o<r?n.charCodeAt(o):0}if(101===e||69===e){if(m&&!u&&!c)return void(t.err="Invalid path value at index "+o+": "+n[o]+" invalid float exponent");if(43!==(e=(o+=1)<r?n.charCodeAt(o):0)&&45!==e||(o+=1),!(o<r&&a(n.charCodeAt(o))))return void(t.err="Invalid path value at index "+o+": "+n[o]+" invalid float exponent");for(;o<r&&a(n.charCodeAt(o));)o+=1}t.index=o,t.param=+t.pathValue.slice(i,o)}else t.err="Invalid path value at index "+o+": "+n[o]+" is not a number"}function o(t){for(var e,r=t.pathValue,n=t.max;t.index<n&&(10===(e=r.charCodeAt(t.index))||13===e||8232===e||8233===e||32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e));)t.index+=1}function s(t){return t>=48&&t<=57||43===t||45===t||46===t}function u(t){var a=t.max,u=t.pathValue,c=t.index,m=u.charCodeAt(c),f=e[u[c].toLowerCase()];if(t.segmentStart=c,function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}}(m))if(t.index+=1,o(t),t.data=[],f){for(;;){for(var h=f;h>0;h-=1){if(97!=(32|m)||3!==h&&4!==h?i(t):n(t),t.err.length)return;t.data.push(t.param),o(t),t.index<a&&44===u.charCodeAt(t.index)&&(t.index+=1,o(t))}if(t.index>=t.max)break;if(!s(u.charCodeAt(t.index)))break}r(t)}else r(t);else t.err="Invalid path value: "+u[c]+" not a path command"}function c(t){return t.map((function(t){return Array.isArray(t)?[].concat(t):t}))}function m(t){this.segments=[],this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}function f(t){return Array.isArray(t)&&t.every((function(t){var r=t[0].toLowerCase();return e[r]===t.length-1&&"achlmqstvz".includes(r)}))}function h(t){if(f(t))return c(t);var e=new m(t);for(o(e);e.index<e.max&&!e.err.length;)u(e);return e.err.length?e.segments=[]:e.segments.length&&("mM".includes(e.segments[0][0])?e.segments[0][0]="M":(e.err="Invalid path value: missing M/m",e.segments=[])),e.segments}function l(t){return f(t)&&t.every((function(t){return t[0]===t[0].toUpperCase()}))}function p(t){if(l(t))return c(t);var e=h(t),r=0,n=0,a=0,i=0;return e.map((function(t){var e,o=t.slice(1).map(Number),s=t[0],u=s.toUpperCase();if("M"===s)return r=(e=o)[0],n=e[1],a=r,i=n,["M",r,n];var c=[];if(s!==u)switch(u){case"A":c=[u,o[0],o[1],o[2],o[3],o[4],o[5]+r,o[6]+n];break;case"V":c=[u,o[0]+n];break;case"H":c=[u,o[0]+r];break;default:var m=o.map((function(t,e){return t+(e%2?n:r)}));c=[u].concat(m)}else c=[u].concat(o);var f=c.length;switch(u){case"Z":r=a,n=i;break;case"H":r=c[1];break;case"V":n=c[1];break;default:r=c[f-2],n=c[f-1],"M"===u&&(a=r,i=n)}return c}))}function y(t){return f(t)&&t.slice(1).every((function(t){return t[0]===t[0].toLowerCase()}))}function v(t){if(y(t))return c(t);var e=h(t),r=0,n=0,a=0,i=0;return e.map((function(t){var e,o,s=t.slice(1).map(Number),u=t[0],c=u.toLowerCase();if("M"===u)return r=(e=s)[0],n=e[1],a=r,i=n,["M",r,n];var m=[];if(u!==c)switch(c){case"a":m=[c,s[0],s[1],s[2],s[3],s[4],s[5]-r,s[6]-n];break;case"v":m=[c,s[0]-n];break;case"h":m=[c,s[0]-r];break;default:var f=s.map((function(t,e){return t-(e%2?n:r)}));m=[c].concat(f),"m"===c&&(r=(o=s)[0],n=o[1],a=r,i=n)}else"m"===u&&(a=s[0]+r,i=s[1]+n),m=[c].concat(s);var h=m.length;switch(c){case"z":r=a,n=i;break;case"h":r+=m[1];break;case"v":n+=m[1];break;default:r+=m[h-2],n+=m[h-1]}return m}))}function x(t,e,r){if(t[r].length>7){t[r].shift();for(var n=t[r],a=r;n.length;)e[r]="A",t.splice(a+=1,0,["C"].concat(n.splice(0,6)));t.splice(r,1)}}function d(t,e,r){var n=t[0],a=e.x1,i=e.y1,o=e.x2,s=e.y2,u=t.slice(1).map(Number),c=t;if("TQ".includes(n)||(e.qx=null,e.qy=null),"H"===n)c=["L",t[1],i];else if("V"===n)c=["L",a,t[1]];else if("S"===n){var m=function(t,e,r,n,a){return"CS".includes(a)?{x1:2*t-r,y1:2*e-n}:{x1:t,y1:e}}(a,i,o,s,r),f=m.x1,h=m.y1;e.x1=f,e.y1=h,c=["C",f,h].concat(u)}else if("T"===n){var l=function(t,e,r,n,a){return"QT".includes(a)?{qx:2*t-r,qy:2*e-n}:{qx:t,qy:e}}(a,i,e.qx,e.qy,r),p=l.qx,y=l.qy;e.qx=p,e.qy=y,c=["Q",p,y].concat(u)}else if("Q"===n){var v=u[0],x=u[1];e.qx=v,e.qy=x}return c}function g(t){return l(t)&&t.every((function(t){return"ACLMQZ".includes(t[0])}))}var M={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function b(t){if(g(t))return c(t);for(var e=p(t),r=Object.assign({},M),n=[],a=e.length,i="",o="",s=0;s<a;s+=1){i=e[s][0],n[s]=i,s&&(o=n[s-1]),e[s]=d(e[s],r,o);var u=e[s],m=u.length;r.x1=+u[m-2],r.y1=+u[m-1],r.x2=+u[m-4]||r.x1,r.y2=+u[m-3]||r.y1}return e}function w(t){var e=h(t),r=b(e),n=e.length,a="Z"===r.slice(-1)[0][0],i=a?n-2:n-1,o=r[0].slice(1),s=o[0],u=o[1],c=r[i].slice(-2),m=c[0],f=c[1];return a&&s===m&&u===f?e.slice(0,-1):e}function N(t){return f(t)&&t.every((function(t){return"MC".includes(t[0])}))}function A(t,e,r){return{x:t*Math.cos(r)-e*Math.sin(r),y:t*Math.sin(r)+e*Math.cos(r)}}function C(t,e,r,n,a,i,o,s,u,c){var m,f,h,l,p,y,v=t,x=e,d=r,g=n,M=s,b=u,w=120*Math.PI/180,N=Math.PI/180*(+a||0),S=[];if(c)h=(m=c)[0],l=m[1],p=m[2],y=m[3];else{v=(f=A(v,x,-N)).x,x=f.y;var k=(v-(M=(f=A(M,b,-N)).x))/2,P=(x-(b=f.y))/2,q=k*k/(d*d)+P*P/(g*g);q>1&&(d*=q=Math.sqrt(q),g*=q);var I=d*d,T=g*g,j=(i===o?-1:1)*Math.sqrt(Math.abs((I*T-I*P*P-T*k*k)/(I*P*P+T*k*k)));p=j*d*P/g+(v+M)/2,y=j*-g*k/d+(x+b)/2,h=(Math.asin((x-y)/g)*Math.pow(10,9)>>0)/Math.pow(10,9),l=(Math.asin((b-y)/g)*Math.pow(10,9)>>0)/Math.pow(10,9),h=v<p?Math.PI-h:h,l=M<p?Math.PI-l:l,h<0&&(h=2*Math.PI+h),l<0&&(l=2*Math.PI+l),o&&h>l&&(h-=2*Math.PI),!o&&l>h&&(l-=2*Math.PI)}var L=l-h;if(Math.abs(L)>w){var V=l,z=M,O=b;l=h+w*(o&&l>h?1:-1),S=C(M=p+d*Math.cos(l),b=y+g*Math.sin(l),d,g,a,0,o,z,O,[l,V,p,y])}L=l-h;var E=Math.cos(h),Z=Math.sin(h),Q=Math.cos(l),D=Math.sin(l),X=Math.tan(L/4),H=4/3*d*X,Y=4/3*g*X,F=[v,x],R=[v+H*Z,x-Y*E],B=[M+H*D,b-Y*Q],G=[M,b];if(R[0]=2*F[0]-R[0],R[1]=2*F[1]-R[1],c)return R.concat(B,G,S);for(var J=[],U=0,$=(S=R.concat(B,G,S)).length;U<$;U+=1)J[U]=U%2?A(S[U-1],S[U],N).y:A(S[U],S[U+1],N).x;return J}function S(t,e,r,n,a,i){return[1/3*t+2/3*r,1/3*e+2/3*n,1/3*a+2/3*r,1/3*i+2/3*n,a,i]}function k(t,e,r){var n=t[0],a=t[1];return[n+(e[0]-n)*r,a+(e[1]-a)*r]}function P(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}function q(t,e,r,n,a){var i=P([t,e],[r,n]);if("number"==typeof a){if(a<.001)return{x:t,y:e};if(a>i)return{x:r,y:n};var o=k([t,e],[r,n],a/i);return{x:o[0],y:o[1]}}return i}function I(t,e,r,n){var a=.5,i=[t,e],o=[r,n],s=k(i,o,a),u=k(o,s,a),c=k(s,u,a),m=k(u,c,a),f=k(c,m,a),h=i.concat(s,c,f,[a]),l=q.apply(void 0,h),p=f.concat(m,u,o,[0]),y=q.apply(void 0,p);return[l.x,l.y,y.x,y.y,r,n]}function T(t,e){var r,n=t[0],a=t.slice(1).map((function(t){return+t})),i=a[0],o=a[1],s=e.x1,u=e.y1,c=e.x,m=e.y;switch("TQ".includes(n)||(e.qx=null,e.qy=null),n){case"M":return e.x=i,e.y=o,t;case"A":return r=[s,u].concat(a),["C"].concat(C.apply(void 0,r));case"Q":return e.qx=i,e.qy=o,r=[s,u].concat(a),["C"].concat(S.apply(void 0,r));case"L":return["C"].concat(I(s,u,i,o));case"Z":return["C"].concat(I(s,u,c,m))}return t}function j(t){if(N(t))return c(t);for(var e=w(b(t)),r=Object.assign({},M),n=[],a="",i=e.length,o=0;o<i;o+=1){a=e[o][0],n[o]=a,e[o]=T(e[o],r),x(e,n,o),i=e.length;var s=e[o],u=s.length;r.x1=+s[u-2],r.y1=+s[u-1],r.x2=+s[u-4]||r.x1,r.y2=+s[u-3]||r.y1}return e}function L(e,r){var n=t.round;if(!1===r||!1===n)return c(e);var a=(n=r>=1?r:n)>=1?Math.pow(10,n):1;return e.map((function(t){var e=t.slice(1).map(Number).map((function(t){return t%1==0?t:Math.round(t*a)/a}));return[t[0]].concat(e)}))}function V(t,e){return L(t,e).map((function(t){return t[0]+t.slice(1).join(" ")})).join("")}function z(t){var e=p(t),r="Z"===e.slice(-1)[0][0],n=b(e).map((function(t,r){var n=t.slice(-2).map(Number),a=n[0],i=n[1];return{seg:e[r],n:t,c:e[r][0],x:a,y:i}})).map((function(t,e,n){var a=t.seg,i=t.n,o=e&&n[e-1],s=n[e+1]&&n[e+1],u=t.c,c=n.length,m=e?n[e-1].x:n[c-1].x,f=e?n[e-1].y:n[c-1].y,h=[];switch(u){case"M":h=r?["Z"]:[u,m,f];break;case"A":h=[u].concat(a.slice(1,-3),[1===a[5]?0:1],[m],[f]);break;case"C":h=s&&"S"===s.c?["S",a[1],a[2],m,f]:[u,a[3],a[4],a[1],a[2],m,f];break;case"S":h=o&&"CS".includes(o.c)&&(!s||s&&"S"!==s.c)?["C",i[3],i[4],i[1],i[2],m,f]:[u,i[1],i[2],m,f];break;case"Q":h=s&&"T"===s.c?["T",m,f]:[u].concat(a.slice(1,-2),[m],[f]);break;case"T":h=o&&"QT".includes(o.c)&&(!s||s&&"T"!==s.c)?["Q",i[1],i[2],m,f]:[u,m,f];break;case"Z":h=["M",m,f];break;case"H":h=[u,m];break;case"V":h=[u,f];break;default:h=[u].concat(a.slice(1,-2),[m],[f])}return h}));return r?n.reverse():[n[0]].concat(n.slice(1).reverse())}function O(t){return V(p(t),0).replace(/(m|M)/g,"|$1").split("|").map((function(t){return t.trim()})).filter((function(t){return t}))}function E(t,e,r,n){var a=t[0],i=function(t){return Math.round(t*Math.pow(10,4))/Math.pow(10,4)},o=t.slice(1).map((function(t){return+t})),s=e.slice(1).map((function(t){return+t})),u=r.x1,c=r.y1,m=r.x2,f=r.y2,h=r.x,l=r.y,p=t,y=s.slice(-2),v=y[0],x=y[1];if("TQ".includes(a)||(r.qx=null,r.qy=null),["V","H","S","T","Z"].includes(a))p=[a].concat(o);else if("L"===a)i(h)===i(v)?p=["V",x]:i(l)===i(x)&&(p=["H",v]);else if("C"===a){var d=s[0],g=s[1];"CS".includes(n)&&i(d)===i(2*u-m)&&i(g)===i(2*c-f)&&(p=["S"].concat(s.slice(-4))),r.x1=d,r.y1=g}else if("Q"===a){var M=s[0],b=s[1];r.qx=M,r.qy=b,"QT".includes(n)&&i(M)===i(2*u-m)&&i(b)===i(2*c-f)&&(p=["T"].concat(s.slice(-2)))}return p}function Z(t,e){for(var r,n=p(t),a=b(n),i=Object.assign({},M),o=[],s=n.length,u="",c="",m=0,f=0,h=0,l=0,y=0;y<s;y+=1){u=n[y][0],o[y]=u,y&&(c=o[y-1]),n[y]=E(n[y],a[y],i,c);var x=n[y],d=x.length;switch(i.x1=+x[d-2],i.y1=+x[d-1],i.x2=+x[d-4]||i.x1,i.y2=+x[d-3]||i.y1,u){case"Z":m=h,f=l;break;case"H":m=x[1];break;case"V":f=x[1];break;default:m=(r=x.slice(-2).map(Number))[0],f=r[1],"M"===u&&(h=m,l=f)}i.x=m,i.y=f}var g=L(n,e),w=L(v(n),e);return g.map((function(t,e){return e?t.join("").length<w[e].join("").length?t:w[e]:t}))}function Q(t){var e=new U,r=Array.from(t);if(!r.every((function(t){return!Number.isNaN(t)})))throw TypeError('CSSMatrix: "'+t+'" must only have numbers.');if(16===r.length){var n=r[0],a=r[1],i=r[2],o=r[3],s=r[4],u=r[5],c=r[6],m=r[7],f=r[8],h=r[9],l=r[10],p=r[11],y=r[12],v=r[13],x=r[14],d=r[15];e.m11=n,e.a=n,e.m21=s,e.c=s,e.m31=f,e.m41=y,e.e=y,e.m12=a,e.b=a,e.m22=u,e.d=u,e.m32=h,e.m42=v,e.f=v,e.m13=i,e.m23=c,e.m33=l,e.m43=x,e.m14=o,e.m24=m,e.m34=p,e.m44=d}else{if(6!==r.length)throw new TypeError("CSSMatrix: expecting an Array of 6/16 values.");var g=r[0],M=r[1],b=r[2],w=r[3],N=r[4],A=r[5];e.m11=g,e.a=g,e.m12=M,e.b=M,e.m21=b,e.c=b,e.m22=w,e.d=w,e.m41=N,e.e=N,e.m42=A,e.f=A}return e}function D(t){var e=Object.keys(new U);if("object"==typeof t&&e.every((function(e){return e in t})))return Q([t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]);throw TypeError('CSSMatrix: "'+t+'" is not a DOMMatrix / CSSMatrix / JSON compatible object.')}function X(t){if("string"!=typeof t)throw TypeError('CSSMatrix: "'+t+'" is not a string.');var e=String(t).replace(/\s/g,""),r=new U,n='CSSMatrix: invalid transform string "'+t+'"';return e.split(")").filter((function(t){return t})).forEach((function(t){var e=t.split("("),a=e[0],i=e[1];if(!i)throw TypeError(n);var o=i.split(",").map((function(t){return t.includes("rad")?parseFloat(t)*(180/Math.PI):parseFloat(t)})),s=o[0],u=o[1],c=o[2],m=o[3],f=[s,u,c],h=[s,u,c,m];if("perspective"===a&&s&&[u,c].every((function(t){return void 0===t})))r.m34=-1/s;else if(a.includes("matrix")&&[6,16].includes(o.length)&&o.every((function(t){return!Number.isNaN(+t)}))){var l=o.map((function(t){return Math.abs(t)<1e-6?0:t}));r=r.multiply(Q(l))}else if("translate3d"===a&&f.every((function(t){return!Number.isNaN(+t)})))r=r.translate(s,u,c);else if("translate"===a&&s&&void 0===c)r=r.translate(s,u||0,0);else if("rotate3d"===a&&h.every((function(t){return!Number.isNaN(+t)}))&&m)r=r.rotateAxisAngle(s,u,c,m);else if("rotate"===a&&s&&[u,c].every((function(t){return void 0===t})))r=r.rotate(0,0,s);else if("scale3d"===a&&f.every((function(t){return!Number.isNaN(+t)}))&&f.some((function(t){return 1!==t})))r=r.scale(s,u,c);else if("scale"!==a||Number.isNaN(s)||1===s||void 0!==c)if("skew"===a&&s&&void 0===c)r=r.skewX(s),r=u?r.skewY(u):r;else{if(!(/[XYZ]/.test(a)&&s&&[u,c].every((function(t){return void 0===t}))&&["translate","rotate","scale","skew"].some((function(t){return a.includes(t)}))))throw TypeError(n);if(["skewX","skewY"].includes(a))r=r[a](s);else{var p=a.replace(/[XYZ]/,""),y=a.replace(p,""),v=["X","Y","Z"].indexOf(y),x=[0===v?s:0,1===v?s:0,2===v?s:0];r=r[p].apply(r,x)}}else{var d=Number.isNaN(+u)?s:u;r=r.scale(s,d,1)}})),r}function H(t,e,r){var n=new U;return n.m41=t,n.e=t,n.m42=e,n.f=e,n.m43=r,n}function Y(t,e,r){var n=new U,a=Math.PI/180,i=t*a,o=e*a,s=r*a,u=Math.cos(i),c=-Math.sin(i),m=Math.cos(o),f=-Math.sin(o),h=Math.cos(s),l=-Math.sin(s),p=m*h,y=-m*l;n.m11=p,n.a=p,n.m12=y,n.b=y,n.m13=f;var v=c*f*h+u*l;n.m21=v,n.c=v;var x=u*h-c*f*l;return n.m22=x,n.d=x,n.m23=-c*m,n.m31=c*l-u*f*h,n.m32=c*h+u*f*l,n.m33=u*m,n}function F(t,e,r,n){var a=new U,i=n*(Math.PI/360),o=Math.sin(i),s=Math.cos(i),u=o*o,c=Math.sqrt(t*t+e*e+r*r),m=t,f=e,h=r;0===c?(m=0,f=0,h=1):(m/=c,f/=c,h/=c);var l=m*m,p=f*f,y=h*h,v=1-2*(p+y)*u;a.m11=v,a.a=v;var x=2*(m*f*u+h*o*s);a.m12=x,a.b=x,a.m13=2*(m*h*u-f*o*s);var d=2*(f*m*u-h*o*s);a.m21=d,a.c=d;var g=1-2*(y+l)*u;return a.m22=g,a.d=g,a.m23=2*(f*h*u+m*o*s),a.m31=2*(h*m*u+f*o*s),a.m32=2*(h*f*u-m*o*s),a.m33=1-2*(l+p)*u,a}function R(t,e,r){var n=new U;return n.m11=t,n.a=t,n.m22=e,n.d=e,n.m33=r,n}function B(t){var e=new U,r=t*Math.PI/180,n=Math.tan(r);return e.m21=n,e.c=n,e}function G(t){var e=new U,r=t*Math.PI/180,n=Math.tan(r);return e.m12=n,e.b=n,e}function J(t,e){return Q([e.m11*t.m11+e.m12*t.m21+e.m13*t.m31+e.m14*t.m41,e.m11*t.m12+e.m12*t.m22+e.m13*t.m32+e.m14*t.m42,e.m11*t.m13+e.m12*t.m23+e.m13*t.m33+e.m14*t.m43,e.m11*t.m14+e.m12*t.m24+e.m13*t.m34+e.m14*t.m44,e.m21*t.m11+e.m22*t.m21+e.m23*t.m31+e.m24*t.m41,e.m21*t.m12+e.m22*t.m22+e.m23*t.m32+e.m24*t.m42,e.m21*t.m13+e.m22*t.m23+e.m23*t.m33+e.m24*t.m43,e.m21*t.m14+e.m22*t.m24+e.m23*t.m34+e.m24*t.m44,e.m31*t.m11+e.m32*t.m21+e.m33*t.m31+e.m34*t.m41,e.m31*t.m12+e.m32*t.m22+e.m33*t.m32+e.m34*t.m42,e.m31*t.m13+e.m32*t.m23+e.m33*t.m33+e.m34*t.m43,e.m31*t.m14+e.m32*t.m24+e.m33*t.m34+e.m34*t.m44,e.m41*t.m11+e.m42*t.m21+e.m43*t.m31+e.m44*t.m41,e.m41*t.m12+e.m42*t.m22+e.m43*t.m32+e.m44*t.m42,e.m41*t.m13+e.m42*t.m23+e.m43*t.m33+e.m44*t.m43,e.m41*t.m14+e.m42*t.m24+e.m43*t.m34+e.m44*t.m44])}var U=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=this;if(r.a=1,r.b=0,r.c=0,r.d=1,r.e=0,r.f=0,r.m11=1,r.m12=0,r.m13=0,r.m14=0,r.m21=0,r.m22=1,r.m23=0,r.m24=0,r.m31=0,r.m32=0,r.m33=1,r.m34=0,r.m41=0,r.m42=0,r.m43=0,r.m44=1,t&&t.length){var n=[16,6].some((function(e){return e===t.length}))?t:t[0];return r.setMatrixValue(n)}return r},$={isIdentity:{configurable:!0},is2D:{configurable:!0}};$.isIdentity.set=function(t){this.isIdentity=t},$.isIdentity.get=function(){var t=this;return 1===t.m11&&0===t.m12&&0===t.m13&&0===t.m14&&0===t.m21&&1===t.m22&&0===t.m23&&0===t.m24&&0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m41&&0===t.m42&&0===t.m43&&1===t.m44},$.is2D.get=function(){var t=this;return 0===t.m31&&0===t.m32&&1===t.m33&&0===t.m34&&0===t.m43&&1===t.m44},$.is2D.set=function(t){this.is2D=t},U.prototype.setMatrixValue=function(t){return[Array,Float64Array,Float32Array].some((function(e){return t instanceof e}))?Q(t):"string"==typeof t&&t.length&&"none"!==t?X(t):"object"==typeof t?D(t):this},U.prototype.toArray=function(){var t=this,e=Math.pow(10,6);return(t.is2D?[t.a,t.b,t.c,t.d,t.e,t.f]:[t.m11,t.m12,t.m13,t.m14,t.m21,t.m22,t.m23,t.m24,t.m31,t.m32,t.m33,t.m34,t.m41,t.m42,t.m43,t.m44]).map((function(t){return Math.abs(t)<1e-6?0:(t*e>>0)/e}))},U.prototype.toString=function(){var t=this.toArray();return(this.is2D?"matrix":"matrix3d")+"("+t+")"},U.prototype.toJSON=function(){var t=this,e=t.is2D,r=t.isIdentity;return Object.assign({},t,{is2D:e,isIdentity:r})},U.prototype.multiply=function(t){return J(this,t)},U.prototype.translate=function(t,e,r){var n=e,a=r;return void 0===a&&(a=0),void 0===n&&(n=0),J(this,H(t,n,a))},U.prototype.scale=function(t,e,r){var n=e,a=r;return void 0===n&&(n=t),void 0===a&&(a=1),J(this,R(t,n,a))},U.prototype.rotate=function(t,e,r){var n=t,a=e,i=r;return void 0===a&&(a=0),void 0===i&&(i=n,n=0),J(this,Y(n,a,i))},U.prototype.rotateAxisAngle=function(t,e,r,n){if([t,e,r,n].some((function(t){return Number.isNaN(t)})))throw new TypeError("CSSMatrix: expecting 4 values");return J(this,F(t,e,r,n))},U.prototype.skewX=function(t){return J(this,B(t))},U.prototype.skewY=function(t){return J(this,G(t))},U.prototype.transformPoint=function(t){var e=H(t.x,t.y,t.z);return e.m44=t.w||1,{x:(e=this.multiply(e)).m41,y:e.m42,z:e.m43,w:e.m44}},U.prototype.transform=function(t){var e=this,r=e.m11*t.x+e.m12*t.y+e.m13*t.z+e.m14*t.w,n=e.m21*t.x+e.m22*t.y+e.m23*t.z+e.m24*t.w,a=e.m31*t.x+e.m32*t.y+e.m33*t.z+e.m34*t.w,i=e.m41*t.x+e.m42*t.y+e.m43*t.z+e.m44*t.w;return{x:r/i,y:n/i,z:a/i,w:i}},Object.defineProperties(U.prototype,$),Object.assign(U,{Translate:H,Rotate:Y,RotateAxisAngle:F,Scale:R,SkewX:B,SkewY:G,Multiply:J,fromArray:Q,fromMatrix:D,fromString:X});function K(t,e,r){var n=e[0],a=e[1],i=r[0],o=r[1],s=r[2],u=t.transformPoint({x:n,y:a,z:0,w:1}),c=u.x-i,m=u.y-o,f=u.z-s;return[c*(Math.abs(s)/Math.abs(f))+i,m*(Math.abs(s)/Math.abs(f))+o]}function W(t,e){var r,n,a,i,o,s,u,m=0,f=0,h=p(t),l=b(h),y=function(t){var e=new U,r=t.origin,n=r[0],a=r[1],i=t.translate,o=t.rotate,s=t.skew,u=t.scale;return Array.isArray(i)&&i.every((function(t){return!Number.isNaN(+t)}))&&i.some((function(t){return 0!==t}))?e=e.translate(i[0]||0,i[1]||0,i[2]||0):"number"!=typeof i||Number.isNaN(+i)||(e=e.translate(i||0,0,0)),(o||s||u)&&(e=e.translate(n,a),Array.isArray(o)&&o.every((function(t){return!Number.isNaN(+t)}))&&o.some((function(t){return 0!==t}))?e=e.rotate(o[0],o[1],o[2]):"number"!=typeof o||Number.isNaN(+o)||(e=e.rotate(0,0,o)),Array.isArray(s)&&s.every((function(t){return!Number.isNaN(+t)}))&&s.some((function(t){return 0!==t}))?(e=s[0]?e.skewX(s[0]):e,e=s[1]?e.skewY(s[1]):e):"number"!=typeof s||Number.isNaN(+s)||(e=e.skewX(s||0)),Array.isArray(u)&&u.every((function(t){return!Number.isNaN(+t)}))&&u.some((function(t){return 1!==t}))?e=e.scale(u[0],u[1],u[2]):"number"!=typeof u||Number.isNaN(+u)||(e=e.scale(u||1,u||1,u||1)),e=e.translate(-n,-a)),e}(e),v=Object.keys(e),d=e.origin,g=[y.a,y.b,y.c,y.d,y.e,y.f],w=Object.assign({},M),N=[],A=0,C="",S=[],k=[];if(!y.isIdentity){for(r=0,a=h.length;r<a;r+=1){N=h[r],h[r]&&(C=N[0]),k[r]=C,"A"!==C||y.is2D&&["skewX","skewY"].find((function(t){return v.includes(t)}))||(N=T(l[r],w),h[r]=T(l[r],w),x(h,k,r),l[r]=T(l[r],w),x(l,k,r),a=Math.max(h.length,l.length)),A=(N=l[r]).length,w.x1=+N[A-2],w.y1=+N[A-1],w.x2=+N[A-4]||w.x1,w.y2=+N[A-3]||w.y1;var P={s:h[r],c:h[r][0],x:w.x1,y:w.y1};S=S.concat([P])}return S.map((function(t){var e,r,a;switch(C=t.c,N=t.s,C){case"A":return u=function(t,e,r,n){var a=Math.cos(n*Math.PI/180),i=Math.sin(n*Math.PI/180),o=[e*(t[0]*a+t[2]*i),e*(t[1]*a+t[3]*i),r*(-t[0]*i+t[2]*a),r*(-t[1]*i+t[3]*a)],s=o[0]*o[0]+o[2]*o[2],u=o[1]*o[1]+o[3]*o[3],c=((o[0]-o[3])*(o[0]-o[3])+(o[2]+o[1])*(o[2]+o[1]))*((o[0]+o[3])*(o[0]+o[3])+(o[2]-o[1])*(o[2]-o[1])),m=(s+u)/2;if(c<1e-9*m){var f=Math.sqrt(m);return{rx:f,ry:f,ax:0}}var h,l,p=o[0]*o[1]+o[2]*o[3],y=m+(c=Math.sqrt(c))/2,v=m-c/2,x=Math.abs(p)<1e-9&&Math.abs(y-u)<1e-9?90:Math.atan(Math.abs(p)>Math.abs(y-u)?(y-s)/p:p/(y-u)*180)/Math.PI;return x>=0?(h=Math.sqrt(y),l=Math.sqrt(v)):(x+=90,h=Math.sqrt(v),l=Math.sqrt(y)),{rx:h,ry:l,ax:x}}(g,N[1],N[2],N[3]),g[0]*g[3]-g[1]*g[2]<0&&(N[5]=N[5]?0:1),e=K(y,[+N[6],+N[7]],d),o=e[0],s=e[1],N=m===o&&f===s||u.rx<1e-9*u.ry||u.ry<1e-9*u.rx?["L",o,s]:[C,u.rx,u.ry,u.ax,N[4],N[5],o,s],m=o,f=s,N;case"L":case"H":case"V":return r=K(y,[t.x,t.y],d),o=r[0],s=r[1],m!==o&&f!==s?N=["L",o,s]:f===s?N=["H",o]:m===o&&(N=["V",s]),m=o,f=s,N;default:for(n=1,i=N.length;n<i;n+=2)a=K(y,[+N[n],+N[n+1]],d),m=a[0],f=a[1],N[n]=m,N[n+1]=f;return N}}))}return c(h)}function _(t,e,r,n,a,i,o,s,u){var c=1-u;return{x:Math.pow(c,3)*t+3*Math.pow(c,2)*u*r+3*c*Math.pow(u,2)*a+Math.pow(u,3)*o,y:Math.pow(c,3)*e+3*Math.pow(c,2)*u*n+3*c*Math.pow(u,2)*i+Math.pow(u,3)*s}}function tt(t,e,r,n,a,i,o,s,u){var c,m="number"==typeof u,f=t,h=e,l=0,p=[t,e,l],y=[t,e];if(m&&u<.001)return{x:f,y:h};for(var v=0;v<=100;v+=1){if(l+=P(y,[f=(c=_(t,e,r,n,a,i,o,s,v/100)).x,h=c.y]),y=[f,h],m&&l>=u){var x=(l-u)/(l-p[2]);return{x:y[0]*(1-x)+p[0]*x,y:y[1]*(1-x)+p[1]*x}}p=[f,h,l]}return m&&u>=l?{x:o,y:s}:l}function et(t,e,r,n,a,i,o,s){var u,c,m,f,h=a-2*r+t-(o-2*a+r),l=2*(r-t)-2*(a-r),p=t-r,y=(-l+Math.sqrt(l*l-4*h*p))/2/h,v=(-l-Math.sqrt(l*l-4*h*p))/2/h,x=[t,o],d=[e,s],g=0,M=0;return Math.abs(y)>1e12&&(y=.5),Math.abs(v)>1e12&&(v=.5),y>0&&y<1&&(g=(u=tt(t,e,r,n,a,i,o,s,y)).x,M=u.y,x.push(g),d.push(M)),v>0&&v<1&&(g=(c=tt(t,e,r,n,a,i,o,s,v)).x,M=c.y,x.push(g),d.push(M)),h=i-2*n+e-(s-2*i+n),p=e-n,y=(-(l=2*(n-e)-2*(i-n))+Math.sqrt(l*l-4*h*p))/2/h,v=(-l-Math.sqrt(l*l-4*h*p))/2/h,Math.abs(y)>1e12&&(y=.5),Math.abs(v)>1e12&&(v=.5),y>0&&y<1&&(g=(m=tt(t,e,r,n,a,i,o,s,y)).x,M=m.y,x.push(g),d.push(M)),v>0&&v<1&&(g=(f=tt(t,e,r,n,a,i,o,s,v)).x,M=f.y,x.push(g),d.push(M)),{min:{x:Math.min.apply(Math,x),y:Math.min.apply(Math,d)},max:{x:Math.max.apply(Math,x),y:Math.max.apply(Math,d)}}}function rt(t){if(!t)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var e=j(t),r=0,n=0,a=[],i=[];e.forEach((function(t){var e=t.slice(-2).map(Number),o=e[0],s=e[1];if("M"===t[0])r=o,n=s,a.push(o),i.push(s);else{var u=[r,n].concat(t.slice(1)),c=et.apply(void 0,u);a=a.concat([c.min.x],[c.max.x]),i=i.concat([c.min.y],[c.max.y]),r=o,n=s}}));var o=Math.min.apply(Math,a),s=Math.min.apply(Math,i),u=Math.max.apply(Math,a),c=Math.max.apply(Math,i),m=u-o,f=c-s;return{width:m,height:f,x:o,y:s,x2:u,y2:c,cx:o+m/2,cy:s+f/2,cz:Math.max(m,f)+Math.min(m,f)/2}}Object.assign(U,{Version:"0.0.24"});var nt=function(e,r){var n=r||{};this.segments=h(e);var a=rt(this.segments),i=a.width,o=a.height,s=a.cx,u=a.cy,c=a.cz,m=t.round,f=t.origin,l=n.round,p=n.origin;if("auto"===l){var y=(""+Math.floor(Math.max(i,o))).length;m=y>=4?0:4-y}else(Number.isInteger(l)&&l>=1||!1===l)&&(m=l);if(Array.isArray(p)&&p.length>=2){var v=p.map(Number),x=v[0],d=v[1],g=v[2];f=[Number.isNaN(x)?s:x,Number.isNaN(d)?u:d,g||c]}else f=[s,u,c];return this.round=m,this.origin=f,this};function at(t,e,r,n,a,i,o,s){return 3*((s-e)*(r+a)-(o-t)*(n+i)+n*(t-a)-r*(e-i)+s*(a+t/3)-o*(i+e/3))/20}function it(t){var e=0,r=0,n=0;return j(t).map((function(t){var a,i;switch(t[0]){case"M":return e=(a=t)[1],r=a[2],0;default:return n=at.apply(void 0,[e,r].concat(t.slice(1))),i=t.slice(-2),e=i[0],r=i[1],n}})).reduce((function(t,e){return t+e}),0)}function ot(t,e,r,n,a,i,o,s,u,c){var m,f=C(t,e,r,n,a,i,o,s,u),h="number"==typeof c,l=[t,e],p=l[0],y=l[1],v=0,x=[],d=[],g=0;if(h&&c<.001)return{x:p,y:y};for(var M=0,b=f.length;M<b;M+=6){if(x=f.slice(M,M+6),d=[p,y].concat(x),g=tt.apply(void 0,d),h&&v+g>=c)return tt.apply(void 0,d.concat([c-v]));v+=g,p=(m=x.slice(-2))[0],y=m[1]}return h&&c>=v?{x:s,y:u}:v}function st(t,e,r,n,a,i,o){var s=1-o;return{x:Math.pow(s,2)*t+2*s*o*r+Math.pow(o,2)*a,y:Math.pow(s,2)*e+2*s*o*n+Math.pow(o,2)*i}}function ut(t,e,r,n,a,i,o){var s,u="number"==typeof o,c=t,m=e,f=0,h=[t,e,f],l=[t,e];if(u&&o<.001)return{x:c,y:m};for(var p=0;p<=100;p+=1){if(f+=P(l,[c=(s=st(t,e,r,n,a,i,p/100)).x,m=s.y]),l=[c,m],u&&f>=o){var y=(f-o)/(f-h[2]);return{x:l[0]*(1-y)+h[0]*y,y:l[1]*(1-y)+h[1]*y}}h=[c,m,f]}return u&&o>=f?{x:a,y:i}:f}function ct(t,e){for(var r,n,a,i=w(b(t)),o="number"==typeof e,s=0,u=!0,c=[],m="M",f=0,h=0,l=0,p=0,y=0,v=0,x=i.length;v<x;v+=1){if(c=(u="M"===(m=(a=i[v])[0]))?c:[h,l].concat(a.slice(1)),u){if(p=(r=a)[1],y=r[2],o&&e<.001)return{x:p,y:y}}else if("L"===m){if(f=q.apply(void 0,c),o&&s+f>=e)return q.apply(void 0,c.concat([e-s]));s+=f}else if("A"===m){if(f=ot.apply(void 0,c),o&&s+f>=e)return ot.apply(void 0,c.concat([e-s]));s+=f}else if("C"===m){if(f=tt.apply(void 0,c),o&&s+f>=e)return tt.apply(void 0,c.concat([e-s]));s+=f}else if("Q"===m){if(f=ut.apply(void 0,c),o&&s+f>=e)return ut.apply(void 0,c.concat([e-s]));s+=f}else if("Z"===m){if(c=[h,l,p,y],f=q.apply(void 0,c),o&&s+f>=e)return q.apply(void 0,c.concat([e-s]));s+=f}h=(n="Z"!==m?a.slice(-2):[p,y])[0],l=n[1]}return o&&e>=s?{x:h,y:l}:s}function mt(t){return ct(t)}function ft(t,e){return ct(t,e)}function ht(t,e){var r=h(t),n=[],a=[].concat(r),i=mt(a),o=a.length-1,s=0,u=0,c=r[0],m=c.slice(-2),f={x:m[0],y:m[1]};if(o<=0||!e||!Number.isFinite(e))return{segment:c,index:0,length:u,point:f,lengthAtSegment:s};if(e>=i)return u=i-(s=mt(a=r.slice(0,-1))),{segment:r[o],index:o,length:u,lengthAtSegment:s};for(;o>0;)c=a[o],u=i-(s=mt(a=a.slice(0,-1))),i=s,n.push({segment:c,index:o,length:u,lengthAtSegment:s}),o-=1;return n.find((function(t){return t.lengthAtSegment<=e}))}function lt(t,e){for(var r=w(h(t)),n=b(r),a=mt(r),i=function(t){var r=t.x-e.x,n=t.y-e.y;return r*r+n*n},o=8,s={x:0,y:0},u=0,c=s,m=0,f=1/0,l=0;l<=a;l+=o)(u=i(s=ft(n,l)))<f&&(c=s,m=l,f=u);o/=2;for(var p={x:0,y:0},y=p,v=0,x=0,d=0,g=0;o>.5;)d=i(p=ft(n,v=m-o)),g=i(y=ft(n,x=m+o)),v>=0&&d<f?(c=p,m=v,f=d):x<=a&&g<f?(c=y,m=x,f=g):o/=2;var M=ht(r,m);return{closest:c,distance:Math.sqrt(f),segment:M}}nt.prototype.toAbsolute=function(){var t=this.segments;return this.segments=p(t),this},nt.prototype.toRelative=function(){var t=this.segments;return this.segments=v(t),this},nt.prototype.toCurve=function(){var t=this.segments;return this.segments=j(t),this},nt.prototype.reverse=function(t){this.toAbsolute();var e=this.segments,r=O(this.toString()),n=r.length>1?r:0,a=n&&c(n).map((function(e,r){return t?r?z(e):h(e):z(e)})),i=[];return i=n?a.flat(1):t?e:z(e),this.segments=c(i),this},nt.prototype.normalize=function(){var t=this.segments;return this.segments=b(t),this},nt.prototype.optimize=function(){var t=this.segments;return this.segments=Z(t,this.round),this},nt.prototype.transform=function(t){if(!t||"object"!=typeof t||"object"==typeof t&&!["translate","rotate","skew","scale"].some((function(e){return e in t})))return this;var e={};Object.keys(t).forEach((function(r){e[r]=Array.isArray(t[r])?[].concat(t[r]):Number(t[r])}));var r=this.segments,n=e.origin;if(n&&n.length>=2){var a=n.map(Number),i=a[0],o=a[1],s=a[2],u=this.origin,c=u[0],m=u[1],f=u[2];e.origin=[Number.isNaN(i)?c:i,Number.isNaN(o)?m:o,s||f]}else e.origin=Object.assign({},this.origin);return this.segments=W(r,e),this},nt.prototype.flipX=function(){return this.transform({rotate:[180,0,0]}),this},nt.prototype.flipY=function(){return this.transform({rotate:[0,180,0]}),this},nt.prototype.toString=function(){return V(this.segments,this.round)};var pt={circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],rect:["width","height","x","y","rx","ry"],polygon:["points"],polyline:["points"],glyph:[]};var yt={CSSMatrix:U,parsePathString:h,isPathArray:f,isCurveArray:N,isAbsoluteArray:l,isRelativeArray:y,isNormalizedArray:g,isValidPath:function(t){if("string"!=typeof t)return!1;var e=new m(t);for(o(e);e.index<e.max&&!e.err.length;)u(e);return!e.err.length&&"mM".includes(e.segments[0][0])},pathToAbsolute:p,pathToRelative:v,pathToCurve:j,pathToString:V,getDrawDirection:function(t){return it(j(t))>=0},getPathArea:it,getPathBBox:rt,getTotalLength:mt,getPathLength:function(t){var e=0;return j(t).forEach((function(t,r,n){var a="M"!==t[0]?n[r-1].slice(-2).concat(t.slice(1)):[];e+="M"===t[0]?0:tt.apply(void 0,a)})),e},getPointAtLength:ft,getPointAtPathLength:function(t,e){return ft(t,e)},getClosestPoint:function(t,e){return lt(t,e).closest},getSegmentOfPoint:function(t,e){var r=lt(t,e).segment;return void 0!==r?r.segment:null},getPropertiesAtPoint:lt,getPropertiesAtLength:ht,getSegmentAtLength:function(t,e){var r=ht(t,e);return(void 0!==r?r:{segment:null}).segment},isPointInStroke:function(t,e){var r=lt(t,e).distance;return Math.abs(r)<.01},clonePath:c,splitPath:O,fixPath:w,roundPath:L,optimizePath:Z,reverseCurve:function(t){var e=t.slice(1).map((function(e,r,n){return r?n[r-1].slice(-2).concat(e.slice(1)):t[0].slice(1).concat(e.slice(1))})).map((function(t){return t.map((function(e,r){return t[t.length-r-2*(1-r%2)]}))})).reverse();return[["M"].concat(e[0].slice(0,2))].concat(e.map((function(t){return["C"].concat(t.slice(2))})))},reversePath:z,normalizePath:b,transformPath:W,shapeToPath:function(e,r){var n=Object.keys(pt),a=e instanceof Element;if(a&&!n.some((function(t){return e.tagName===t})))throw TypeError('shapeToPath: "'+e+'" is not SVGElement');var i,o=document.createElementNS("http://www.w3.org/2000/svg","path"),s=a?e.tagName:e.type,u={};if(u.type=s,a){var c=pt[s];c.forEach((function(t){u[t]=e.getAttribute(t)})),Object.values(e.attributes).forEach((function(t){var e=t.name,r=t.value;c.includes(e)||o.setAttribute(e,r)}))}else Object.assign(u,e);var m,f,h,l,p=t.round;return"circle"===s?i=V((f=(m=u).cx,h=m.cy,l=m.r,[["M",f-l,h],["a",l,l,0,1,0,2*l,0],["a",l,l,0,1,0,-2*l,0]]),p):"ellipse"===s?i=V(function(t){var e=t.cx,r=t.cy,n=t.rx,a=t.ry;return[["M",e-n,r],["a",n,a,0,1,0,2*n,0],["a",n,a,0,1,0,-2*n,0]]}(u),p):["polyline","polygon"].includes(s)?i=V(function(t){for(var e=[],r=t.points.trim().split(/[\s|,]/).map(Number),n=0;n<r.length;)e.push([n?"L":"M",r[n],r[n+1]]),n+=2;return"polygon"===t.type?e.concat([["z"]]):e}(u),p):"rect"===s?i=V(function(t){var e=+t.x||0,r=+t.y||0,n=+t.width,a=+t.height,i=+t.rx,o=+t.ry;return i||o?(i=i||o,o=o||i,2*i>n&&(i-=(2*i-n)/2),2*o>a&&(o-=(2*o-a)/2),[["M",e+i,r],["h",n-2*i],["s",i,0,i,o],["v",a-2*o],["s",0,o,-i,o],["h",2*i-n],["s",-i,0,-i,-o],["v",2*o-a],["s",0,-o,i,-o]]):[["M",e,r],["h",n],["v",a],["H",e],["Z"]]}(u),p):"line"===s?i=V(function(t){return[["M",t.x1,t.y1],["L",t.x2,t.y2]]}(u),p):"glyph"===s&&(i=a?e.getAttribute("d"):e.type),!!i&&(o.setAttribute("d",i),r&&a&&(e.before(o,e),e.remove()),o)},options:t};return Object.assign(nt,yt,{Version:"0.1.25"}),nt}));
|
import { container } from "assets/jss/material-kit-react.js";
const carouselStyle = {
section: {
padding: "20px 0"
},
container,
marginAuto: {
marginLeft: "auto !important",
marginRight: "auto !important"
}
};
export default carouselStyle;
|
/**
*
* Asynchronously loads the component for Authentication
*
*/
import loadable from 'loadable-components';
export default loadable(() => import('./index'));
|
# Licensed under a 3 - clause BSD style license - see LICENSE.rst
from collections import OrderedDict
import logging
from ..utils.random import get_random_state
from ..utils.energy import EnergyBounds
from .utils import CountsPredictor
from .core import PHACountsSpectrum
from .observation import SpectrumObservation, SpectrumObservationList
__all__ = ["SpectrumSimulation"]
log = logging.getLogger(__name__)
class SpectrumSimulation:
"""Simulate `~gammapy.spectrum.SpectrumObservation`.
For a usage example see :gp-notebook:`spectrum_simulation`
Parameters
----------
livetime : `~astropy.units.Quantity`
Livetime
source_model : `~gammapy.spectrum.models.SpectralModel`
Source model
aeff : `~gammapy.irf.EffectiveAreaTable`, optional
Effective Area
edisp : `~gammapy.irf.EnergyDispersion`, optional
Energy Dispersion
e_true : `~astropy.units.Quantity`, optional
Desired energy axis of the prediced counts vector if no IRFs are given
background_model : `~gammapy.spectrum.models.SpectralModel`, optional
Background model
alpha : float, optional
Exposure ratio between source and background
"""
def __init__(
self,
livetime,
source_model,
aeff=None,
edisp=None,
e_true=None,
background_model=None,
alpha=None,
):
self.livetime = livetime
self.source_model = source_model
self.aeff = aeff
self.edisp = edisp
self.e_true = e_true
self.background_model = background_model
self.alpha = alpha
self.on_vector = None
self.off_vector = None
self.obs = None
self.result = SpectrumObservationList()
@property
def npred_source(self):
"""Predicted source `~gammapy.spectrum.CountsSpectrum`.
Calls :func:`gammapy.spectrum.utils.CountsPredictor`.
"""
predictor = CountsPredictor(
livetime=self.livetime,
aeff=self.aeff,
edisp=self.edisp,
e_true=self.e_true,
model=self.source_model,
)
predictor.run()
return predictor.npred
@property
def npred_background(self):
"""Predicted background (`~gammapy.spectrum.CountsSpectrum`).
Calls :func:`gammapy.spectrum.utils.CountsPredictor`.
"""
predictor = CountsPredictor(
livetime=self.livetime,
aeff=self.aeff,
edisp=self.edisp,
e_true=self.e_true,
model=self.background_model,
)
predictor.run()
return predictor.npred
@property
def e_reco(self):
"""Reconstructed energy binning."""
if self.edisp is not None:
temp = self.edisp.e_reco.bins
else:
if self.aeff is not None:
temp = self.aeff.energy.bins
else:
temp = self.e_true
return EnergyBounds(temp)
def run(self, seed):
"""Simulate `~gammapy.spectrum.SpectrumObservationList`.
The seeds will be set as observation ID.
Previously produced results will be overwritten.
Parameters
----------
seed : array of ints
Random number generator seeds
"""
self.reset()
n_obs = len(seed)
log.info("Simulating {} observations".format(n_obs))
for counter, current_seed in enumerate(seed):
progress = ((counter + 1) / n_obs) * 100
if progress % 10 == 0:
log.info("Progress : {} %".format(progress))
self.simulate_obs(seed=current_seed, obs_id=current_seed)
self.result.append(self.obs)
def reset(self):
"""Clear all results."""
self.result = SpectrumObservationList()
self.obs = None
self.on_vector = None
self.off_vector = None
def simulate_obs(self, obs_id, seed="random-seed"):
"""Simulate one `~gammapy.spectrum.SpectrumObservation`.
The result is stored as ``obs`` attribute
Parameters
----------
obs_id : int
Observation identifier
seed : {int, 'random-seed', 'global-rng', `~numpy.random.RandomState`}
see :func:~`gammapy.utils.random.get_random_state`
"""
random_state = get_random_state(seed)
self.simulate_source_counts(random_state)
if self.background_model is not None:
self.simulate_background_counts(random_state)
obs = SpectrumObservation(
on_vector=self.on_vector,
off_vector=self.off_vector,
aeff=self.aeff,
edisp=self.edisp,
)
obs.obs_id = obs_id
self.obs = obs
def simulate_source_counts(self, rand):
"""Simulate source `~gammapy.spectrum.PHACountsSpectrum`.
Source counts are added to the on vector.
Parameters
----------
rand : `~numpy.random.RandomState`
random state
"""
on_counts = rand.poisson(self.npred_source.data.data.value)
on_vector = PHACountsSpectrum(
energy_lo=self.e_reco.lower_bounds,
energy_hi=self.e_reco.upper_bounds,
data=on_counts,
backscal=1,
meta=self._get_meta(),
)
on_vector.livetime = self.livetime
self.on_vector = on_vector
def simulate_background_counts(self, rand):
"""Simulate background `~gammapy.spectrum.PHACountsSpectrum`.
Background counts are added to the on vector.
Furthermore background counts divided by alpha are added to the off vector.
TODO: At the moment the source IRFs are used.
Make it possible to pass dedicated background IRFs.
Parameters
----------
rand : `~numpy.random.RandomState`
random state
"""
bkg_counts = rand.poisson(self.npred_background.data.data.value)
off_counts = rand.poisson(self.npred_background.data.data.value / self.alpha)
# Add background to on_vector
self.on_vector.data.data += bkg_counts
# Create off vector
off_vector = PHACountsSpectrum(
energy_lo=self.e_reco.lower_bounds,
energy_hi=self.e_reco.upper_bounds,
data=off_counts,
backscal=1.0 / self.alpha,
is_bkg=True,
meta=self._get_meta(),
)
off_vector.livetime = self.livetime
self.off_vector = off_vector
def _get_meta(self):
return OrderedDict([("CREATOR", self.__class__.__name__)])
|
from .env_config import *
from .maze_env import * |
#!/usr/bin/python
'''
Atomix project, genstatestxt.py, (TODO: summary)
Copyright (c) 2015 Stanford University
Released under the Apache License v2.0. See the LICENSE file for details.
Author(s): Manu Bansal
'''
####################
def printAxns(app, f):
axnlist = {}
atoms = app.getAtoms();
for atom in atoms:
if(atom.atomType is "decision_t"):
continue
coreid = atom.coreID
stateid = atom.stateID
if((stateid, coreid) not in axnlist.keys()):
axnlist[(stateid, coreid)] = []
axnlist[(stateid, coreid)].append(atom.atomName)
axnlistkeys = axnlist.keys()
axnlistkeys.sort() # Check if this is even possible
for key in axnlistkeys:
f.write("\naction: axn_%d_%d: "%(key[0], key[1])),
val = axnlist[key]
# val is the list of atoms
for atName in val:
f.write("%s;"%atName),
f.write("\n")
f.write("#\n")
return axnlist
#####################
def printStates(app, f):
states = app.getStates()
for state in states:
f.write("state : %s\n"%state.stateName)
f.write("#\n")
#######################
def printStateps(app, axnlist, hwMgr, f):
states = app.getStates()
numCores = hwMgr.getNumCores()
for state in states:
ruleBlock = state.getRule()
ruleAtom = app.atomList[(ruleBlock.IDval, state.IDval)];
for coreid in range(1, numCores+1):
if((state.IDval, coreid) in axnlist.keys()):
f.write("statep: %s: %d: axn_%d_%d: "%(state.stateName, coreid, state.IDval, coreid)),
if(ruleAtom.coreID == coreid):
f.write("%s;"%ruleAtom.atomName),
else:
f.write("\t"),
f.write("cp_%d_%d;" %(state.IDval, coreid)),
f.write("tr_%d_%d;\n" %(state.IDval, coreid))
else:
f.write("statep: %s: %d: noaxn :\t\t tr_%d_%d;\n" %(state.stateName, coreid, state.IDval, coreid))
f.write("#\n")
def printInitState(app, f):
states = app.getStates()
for state in states:
if(state.isInitState == True):
print("\n")
def genStatesTxt(app, hwMgr):
f = open("states.txt","w")
axnlist = printAxns(app, f)
printStates(app, f)
printStateps(app, axnlist, hwMgr, f)
printInitState(app, f)
f.close()
|
/******/ (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 = "./shim/gh-pages.js");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./shim/gh-pages.js":
/*!**************************!*\
!*** ./shim/gh-pages.js ***!
\**************************/
/*! no static exports found */
/***/ (function(module, exports) {
eval("// intentionally left empty\n\n\n//# sourceURL=webpack:///./shim/gh-pages.js?");
/***/ })
/******/ }); |
# convert numpy array to ply files
import sys
import numpy as np
class PLYWriter:
def __init__(self,
num_vertices: int,
num_faces=0,
face_type="tri",
comment="created by PLYWriter"):
assert num_vertices > 0, "num_vertices should be greater than 0"
assert num_faces >= 0, "num_faces shouldn't be less than 0"
assert face_type == "tri" or face_type == "quad", "Only tri and quad faces are supported for now"
self.ply_supported_types = [
'char', 'uchar', 'short', 'ushort', 'int', 'uint', 'float',
'double'
]
self.corresponding_numpy_types = [
np.int8, np.uint8, np.int16, np.uint16, np.int32, np.uint32,
np.float32, np.float64
]
self.type_map = {}
for i, ply_type in enumerate(self.ply_supported_types):
self.type_map[ply_type] = self.corresponding_numpy_types[i]
self.num_vertices = num_vertices
self.num_vertex_channels = 0
self.vertex_channels = []
self.vertex_data_type = []
self.vertex_data = []
self.num_faces = num_faces
self.num_face_channels = 0
self.face_channels = []
self.face_data_type = []
self.face_data = []
self.face_type = face_type
if face_type == "tri":
self.face_indices = -np.ones((self.num_faces, 3), dtype=np.int32)
elif face_type == "quad":
self.face_indices = -np.ones((self.num_faces, 4), dtype=np.int32)
self.comment = comment
def add_vertex_channel(self, key: str, data_type: str, data: np.array):
if data_type not in self.ply_supported_types:
print("Unknown type " + data_type +
" detected, skipping this channel")
return
if data.ndim == 1:
assert data.size == self.num_vertices, "The dimension of the vertex channel is not correct"
self.num_vertex_channels += 1
if key in self.vertex_channels:
print("WARNING: duplicate key " + key + " detected")
self.vertex_channels.append(key)
self.vertex_data_type.append(data_type)
self.vertex_data.append(self.type_map[data_type](data))
else:
num_col = data.size // self.num_vertices
assert data.ndim == 2 and data.size == num_col * \
self.num_vertices, "The dimension of the vertex channel is not correct"
data.shape = (self.num_vertices, num_col)
self.num_vertex_channels += num_col
for i in range(num_col):
item_key = key + "_" + str(i + 1)
if item_key in self.vertex_channels:
print("WARNING: duplicate key " + item_key + " detected")
self.vertex_channels.append(item_key)
self.vertex_data_type.append(data_type)
self.vertex_data.append(self.type_map[data_type](data[:, i]))
def add_vertex_pos(self, x: np.array, y: np.array, z: np.array):
self.add_vertex_channel("x", "float", x)
self.add_vertex_channel("y", "float", y)
self.add_vertex_channel("z", "float", z)
# TODO active and refactor later if user feedback indicates the necessity for a compact the input list
# pass ti vector/matrix field directly
# def add_vertex_pos(self, pos):
# assert isinstance(pos, (np.ndarray, ti.Matrix))
# if not isinstance(pos, np.ndarray):
# pos = pos.to_numpy()
# dim = pos.shape[pos.ndim-1]
# assert dim == 2 or dim == 3, "Only 2D and 3D positions are supported"
# n = pos.size // dim
# assert n == self.num_vertices, "Size of the input is not correct"
# pos = np.reshape(pos, (n, dim))
# self.add_vertex_channel("x", "float", pos[:, 0])
# self.add_vertex_channel("y", "float", pos[:, 1])
# if(dim == 3):
# self.add_vertex_channel("z", "float", pos[:, 2])
# if(dim == 2):
# self.add_vertex_channel("z", "float", np.zeros(n))
def add_vertex_normal(self, nx: np.array, ny: np.array, nz: np.array):
self.add_vertex_channel("nx", "float", nx)
self.add_vertex_channel("ny", "float", ny)
self.add_vertex_channel("nz", "float", nz)
# TODO active and refactor later if user feedback indicates the necessity for a compact the input list
# pass ti vector/matrix field directly
# def add_vertex_normal(self, normal):
# assert isinstance(normal, (np.ndarray, ti.Matrix))
# if not isinstance(normal, np.ndarray):
# normal = normal.to_numpy()
# dim = normal.shape[normal.ndim-1]
# assert dim == 3, "Only 3D normal is supported"
# n = normal.size // dim
# assert n == self.num_vertices, "Size of the input is not correct"
# normal = np.reshape(normal, (n, dim))
# self.add_vertex_channel("nx", "float", normal[:, 0])
# self.add_vertex_channel("ny", "float", normal[:, 1])
# self.add_vertex_channel("nz", "float", normal[:, 2])
def add_vertex_color(self, r: np.array, g: np.array, b: np.array):
self.add_vertex_channel("red", "float", r)
self.add_vertex_channel("green", "float", g)
self.add_vertex_channel("blue", "float", b)
def add_vertex_alpha(self, alpha: np.array):
self.add_vertex_channel("Alpha", "float", alpha)
def add_vertex_rgba(self, r: np.array, g: np.array, b: np.array,
a: np.array):
self.add_vertex_channel("red", "float", r)
self.add_vertex_channel("green", "float", g)
self.add_vertex_channel("blue", "float", b)
self.add_vertex_channel("Alpha", "float", a)
# TODO active and refactor later if user feedback indicates the necessity for a compact the input list
# pass ti vector/matrix field directly
# def add_vertex_color(self, color):
# assert isinstance(color, (np.ndarray, ti.Matrix))
# if not isinstance(color, np.ndarray):
# color = color.to_numpy()
# channels = color.shape[color.ndim-1]
# assert channels == 3 or channels == 4, "The dimension for color should be either be 3 (rgb) or 4 (rgba)"
# n = color.size // channels
# assert n == self.num_vertices, "Size of the input is not correct"
# color = np.reshape(color, (n, channels))
# self.add_vertex_channel("red", "float", color[:, 0])
# self.add_vertex_channel("green", "float", color[:, 1])
# self.add_vertex_channel("blue", "float", color[:, 2])
# if channels == 4:
# self.add_vertex_channel("Alpha", "float", color[:, 3])
def add_vertex_id(self):
self.add_vertex_channel("id", "int", np.arange(self.num_vertices))
def add_vertex_piece(self, piece: np.array):
self.add_vertex_channel("piece", "int", piece)
def add_faces(self, indices: np.array):
if self.face_type == "tri":
vert_per_face = 3
else:
vert_per_face = 4
assert vert_per_face * \
self.num_faces == indices.size, "The dimension of the face vertices is not correct"
self.face_indices = np.reshape(indices,
(self.num_faces, vert_per_face))
self.face_indices = self.face_indices.astype(np.int32)
def add_face_channel(self, key: str, data_type: str, data: np.array):
if data_type not in self.ply_supported_types:
print("Unknown type " + data_type +
" detected, skipping this channel")
return
if data.ndim == 1:
assert data.size == self.num_faces, "The dimension of the face channel is not correct"
self.num_face_channels += 1
if key in self.face_channels:
print("WARNING: duplicate key " + key + " detected")
self.face_channels.append(key)
self.face_data_type.append(data_type)
self.face_data.append(self.type_map[data_type](data))
else:
num_col = data.size // self.num_faces
assert data.ndim == 2 and data.size == num_col * \
self.num_faces, "The dimension of the face channel is not correct"
data.shape = (self.num_faces, num_col)
self.num_face_channels += num_col
for i in range(num_col):
item_key = key + "_" + str(i + 1)
if item_key in self.face_channels:
print("WARNING: duplicate key " + item_key + " detected")
self.face_channels.append(item_key)
self.face_data_type.append(data_type)
self.face_data.append(self.type_map[data_type](data[:, i]))
def add_face_id(self):
self.add_face_channel("id", "int", np.arange(self.num_faces))
def add_face_piece(self, piece: np.array):
self.add_face_channel("piece", "int", piece)
def sanity_check(self):
assert "x" in self.vertex_channels, "The vertex pos channel is missing"
assert "y" in self.vertex_channels, "The vertex pos channel is missing"
assert "z" in self.vertex_channels, "The vertex pos channel is missing"
if self.num_faces > 0:
for idx in self.face_indices.flatten():
assert idx >= 0 and idx < self.num_vertices, "The face indices are invalid"
def print_header(self, path: str, _format: str):
with open(path, "w") as f:
f.writelines([
"ply\n", "format " + _format + " 1.0\n",
"comment " + self.comment + "\n"
])
f.write("element vertex " + str(self.num_vertices) + "\n")
for i in range(self.num_vertex_channels):
f.write("property " + self.vertex_data_type[i] + " " +
self.vertex_channels[i] + "\n")
if (self.num_faces != 0):
f.write("element face " + str(self.num_faces) + "\n")
f.write("property list uchar int vertex_indices\n")
for i in range(self.num_face_channels):
f.write("property " + self.face_data_type[i] + " " +
self.face_channels[i] + "\n")
f.write("end_header\n")
def export(self, path):
self.sanity_check()
self.print_header(path, "binary_" + sys.byteorder + "_endian")
with open(path, "ab") as f:
for i in range(self.num_vertices):
for j in range(self.num_vertex_channels):
f.write(self.vertex_data[j][i])
if self.face_type == "tri":
vert_per_face = np.uint8(3)
else:
vert_per_face = np.uint8(4)
for i in range(self.num_faces):
f.write(vert_per_face)
for j in range(vert_per_face):
f.write(self.face_indices[i, j])
for j in range(self.num_face_channels):
f.write(self.face_data[j][i])
def export_ascii(self, path):
self.sanity_check()
self.print_header(path, "ascii")
with open(path, "a") as f:
for i in range(self.num_vertices):
for j in range(self.num_vertex_channels):
f.write(str(self.vertex_data[j][i]) + " ")
f.write("\n")
if self.face_type == "tri":
vert_per_face = 3
else:
vert_per_face = 4
for i in range(self.num_faces):
f.writelines([
str(vert_per_face) + " ",
" ".join(map(str, self.face_indices[i, :])), " "
])
for j in range(self.num_face_channels):
f.write(str(self.face_data[j][i]) + " ")
f.write("\n")
def export_frame_ascii(self, series_num: int, path: str):
# if path has ply ending
last_4_char = path[-4:]
if last_4_char == ".ply":
path = path[:-4]
real_path = path + "_" + f"{series_num:0=6d}" + ".ply"
self.export_ascii(real_path)
def export_frame(self, series_num: int, path: str):
# if path has ply ending
last_4_char = path[-4:]
if last_4_char == ".ply":
path = path[:-4]
real_path = path + "_" + f"{series_num:0=6d}" + ".ply"
self.export(real_path)
|
/*!
* Ext JS Connect
* Copyright(c) 2010 Sencha Inc.
* MIT Licensed
*/
/**
* Module dependencies.
*/
var qs = require('qs');
/**
* Extract the mime type from the given request's
* _Content-Type_ header.
*
* @param {IncomingMessage} req
* @return {String}
* @api private
*/
function mime(req) {
var str = req.headers['content-type'] || '';
return str.split(';')[0];
}
/**
* Decode request bodies.
*
* @return {Function}
* @api public
*/
exports = module.exports = function bodyDecoder(){
return function bodyDecoder(req, res, next) {
var decoder = exports.decode[mime(req)];
if (decoder && !req.body) {
var data = '';
req.setEncoding('utf8');
req.addListener('data', function(chunk) { data += chunk; });
req.addListener('end', function() {
req.rawBody = data;
try {
req.body = data
? decoder(data)
: {};
} catch (err) {
return next(err);
}
next();
});
} else {
next();
}
}
};
/**
* Supported decoders.
*
* - application/x-www-form-urlencoded
* - application/json
*/
exports.decode = {
'application/x-www-form-urlencoded': qs.parse
, 'application/json': JSON.parse
}; |
import functools
import re
from dataclasses import dataclass
import common.input_data as input_data
ContainedBag = tuple[int, str]
@dataclass(frozen=True)
class BagRule:
color: str
contains: tuple[ContainedBag, ...]
def get_number_of_bags_able_to_hold_bag(bag_rules: tuple[BagRule, ...], color: str) -> int:
return len([bag_rule for bag_rule in bag_rules
if can_hold(bag_rule, color, bag_rules)])
@functools.cache
def get_number_of_bags_inside(bag_rules: tuple[BagRule, ...], color: str) -> int:
bag = find_rule(bag_rules, color)
return sum([num + num * get_number_of_bags_inside(bag_rules, color)
for num, color in bag.contains])
@functools.cache
def can_hold(bag_rule: BagRule, bag: str, rules: tuple[BagRule, ...]) -> bool:
if any(color == bag for _, color in bag_rule.contains):
return True
return any(can_hold(find_rule(rules, color), bag, rules) for _, color in bag_rule.contains)
def find_rule(rules: tuple[BagRule, ...], color: str) -> BagRule:
return next(r for r in rules if r.color == color)
def to_bag_rules(data: str) -> BagRule:
color, *contains = re.split(r"(?: bags contain | bags, | bags.| bag, | bag.)", data)
return BagRule(color, parse_containing(contains))
def parse_containing(contains: list[str]) -> tuple[ContainedBag, ...]:
if contains[0] == "no other":
return tuple()
return tuple(to_contained_bag(bag) for bag in contains if bag)
def to_contained_bag(contains: str) -> tuple[int, str]:
num, bag = contains.split(" ", maxsplit=1)
return int(num), bag
BAG_RULES = tuple(input_data.read("input/input7.txt", to_bag_rules))
if __name__ == "__main__":
print("Number of bags that can contain a gold bag: "
f"{get_number_of_bags_able_to_hold_bag(BAG_RULES, 'shiny gold')}")
print("Number bags inside a shiny gold bag: "
f"{get_number_of_bags_inside(BAG_RULES, 'shiny gold')}")
|
var util = require('util'),
AbstractGeocoder = require('./abstractgeocoder');
/**
* Constructor
* @param <object> httpAdapter Http Adapter
* @param <object> options Options (appId, appCode, language, politicalView, country, state)
*/
var HereGeocoder = function HereGeocoder(httpAdapter, options) {
this.options = ['appId', 'appCode', 'language', 'politicalView', 'country', 'state'];
HereGeocoder.super_.call(this, httpAdapter, options);
if (!this.options.appId || !this.options.appCode) {
throw new Error('You must specify appId and appCode to use Here Geocoder');
}
};
util.inherits(HereGeocoder, AbstractGeocoder);
// Here geocoding API endpoint
HereGeocoder.prototype._geocodeEndpoint = 'https://geocoder.cit.api.here.com/6.2/geocode.json';
// Here reverse geocoding API endpoint
HereGeocoder.prototype._reverseEndpoint = 'https://reverse.geocoder.api.here.com/6.2/reversegeocode.json';
/**
* Geocode
* @param <string> value Value ton geocode (Address)
* @param <function> callback Callback method
*/
HereGeocoder.prototype._geocode = function (value, callback) {
var _this = this;
var params = this._prepareQueryString();
if (value.address) {
if (value.language) {
params.language = value.language;
}
if (value.politicalView) {
params.politicalview = value.politicalView;
}
if (value.country) {
params.country = value.country;
if (value.state) {
params.state = value.state;
} else {
delete params.state;
}
}
if (value.zipcode) {
params.postalcode = value.zipcode;
}
params.searchtext = value.address;
} else {
params.searchtext = value;
}
this.httpAdapter.get(this._geocodeEndpoint, params, function (err, result) {
var results = [];
results.raw = result;
if (err) {
return callback(err, results);
} else {
var view = result.Response.View[0];
if (!view) {
return callback(false, results);
}
// Format each geocoding result
results = view.Result.map(_this._formatResult);
results.raw = result;
callback(false, results);
}
});
};
HereGeocoder.prototype._prepareQueryString = function () {
var params = {
'additionaldata': 'Country2,true',
'gen': 8
};
if (this.options.appId) {
params.app_id = this.options.appId;
}
if (this.options.appCode) {
params.app_code = this.options.appCode;
}
if (this.options.language) {
params.language = this.options.language;
}
if (this.options.politicalView) {
params.politicalview = this.options.politicalView;
}
if (this.options.country) {
params.country = this.options.country;
}
if (this.options.state) {
params.state = this.options.state;
}
return params;
};
HereGeocoder.prototype._formatResult = function (result) {
var location = result.Location || {};
var address = location.Address || {};
var i;
var extractedObj = {
formattedAddress: address.Label || null,
latitude: location.DisplayPosition.Latitude,
longitude: location.DisplayPosition.Longitude,
country: null,
countryCode: address.Country || null,
state: address.State || null,
stateCode: address.State || null,
county: address.County || null,
city: address.City || null,
zipcode: address.PostalCode || null,
district: address.District || null,
streetName: address.Street || null,
streetNumber: address.HouseNumber || null,
building: address.Building || null,
extra: {
herePlaceId: location.LocationId || null,
confidence: result.Relevance || 0
},
administrativeLevels: {}
};
for (i = 0; i < address.AdditionalData.length; i++) {
var additionalData = address.AdditionalData[i];
switch (additionalData.key) {
//Country 2-digit code
case 'Country2':
extractedObj.countryCode = additionalData.value;
break;
//Country name
case 'CountryName':
extractedObj.country = additionalData.value;
break;
//State name
case 'StateName':
extractedObj.administrativeLevels.level1long = additionalData.value;
extractedObj.state = additionalData.value;
break;
//County name
case 'CountyName':
extractedObj.administrativeLevels.level2long = additionalData.value;
extractedObj.county = additionalData.value;
}
}
return extractedObj;
};
/**
* Reverse geocoding
* @param {lat:<number>,lon:<number>} lat: Latitude, lon: Longitude
* @param <function> callback Callback method
*/
HereGeocoder.prototype._reverse = function (query, callback) {
var lat = query.lat;
var lng = query.lon;
var _this = this;
var params = this._prepareQueryString();
params.pos = lat + ',' + lng;
params.mode = 'trackPosition';
this.httpAdapter.get(this._reverseEndpoint, params, function (err, result) {
var results = [];
results.raw = result;
if (err) {
return callback(err, results);
} else {
var view = result.Response.View[0];
if (!view) {
return callback(false, results);
}
// Format each geocoding result
results = view.Result.map(_this._formatResult);
results.raw = result;
callback(false, results);
}
});
};
module.exports = HereGeocoder;
|
(window["webpackJsonpmy-app"]=window["webpackJsonpmy-app"]||[]).push([[0],[,,,function(e,a,n){e.exports=n.p+"static/media/logo.5d5d9eef.svg"},function(e,a,n){e.exports=n(11)},,,,,function(e,a,n){},function(e,a,n){},function(e,a,n){"use strict";n.r(a);var t=n(0),o=n.n(t),r=n(2),c=n.n(r),l=(n(9),n(3)),s=n.n(l);n(10);var i=function(){return o.a.createElement("div",{className:"App"},o.a.createElement("header",{className:"App-header"},o.a.createElement("img",{src:s.a,className:"App-logo",alt:"logo"}),o.a.createElement("p",null,"Edit ",o.a.createElement("code",null,"src/App.js")," and save to reload."),o.a.createElement("a",{className:"App-link",href:"https://reactjs.org",target:"_blank",rel:"noopener noreferrer"},"Learn React")))};Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));c.a.render(o.a.createElement(i,null),document.getElementById("root")),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then(function(e){e.unregister()})}],[[4,1,2]]]);
//# sourceMappingURL=main.ce617786.chunk.js.map |
# pylint: disable=invalid-name, line-too-long, unused-variable, too-many-locals
"""Shortcut in python"""
import numpy as np
def shortcut_python(a_np1, a_np2):
"""Reorg operator
Parameters
----------
a_np1 : numpy.ndarray
4-D with shape [batch1, in_channel1, in_height1, in_width1]
a_np2 : numpy.ndarray
4-D with shape [batch2, in_channel2, in_height2, in_width2]
Returns
-------
b_np : np.ndarray
4-D with shape [batch1, out_channel1, out_height1, out_width1]
"""
batch1, in_channel1, in_height1, in_width1 = a_np1.shape
batch2, in_channel2, in_height2, in_width2 = a_np2.shape
a_np1_temp = np.reshape(a_np1, batch1*in_channel1*in_height1*in_width1)
a_np2_temp = np.reshape(a_np2, batch2*in_channel2*in_height2*in_width2)
b_np = np.zeros(batch1*in_channel1*in_height1*in_width1)
stride = int(in_width1/in_width2)
sample = int(in_width2/in_width1)
if stride < 1:
stride = 1
if sample < 1:
sample = 1
minw = min(in_width1, in_width2)
minh = min(in_height1, in_height2)
minc = min(in_channel1, in_channel2)
for i in range((batch1*in_channel1*in_height1*in_width1)):
b_np[i] = a_np1_temp[i]
for b in range(batch1):
for k in range(minc):
for j in range(minh):
for i in range(minw):
out_index = i*sample + in_width2*(j*sample + in_height2*(k + in_channel2*b))
add_index = i*stride + in_width1*(j*stride + in_height1*(k + in_channel1*b))
b_np[out_index] = a_np1_temp[out_index] + a_np2_temp[add_index]
b_np = np.reshape(b_np, (batch1, in_channel1, in_height1, in_width1))
return b_np
|
/*
* Backpack - Skyscanner's Design System
*
* Copyright 2018 Skyscanner Ltd
*
* 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.
*/
/* @flow */
import React from 'react';
import PropTypes from 'prop-types';
import {
type Element,
Platform,
TouchableNativeFeedback,
ViewPropTypes,
} from 'react-native';
type Props = {
children: Element,
borderlessBackground: boolean,
color: ?string,
style: ?(Object | Array<Object>),
};
const BpkTouchableNativeFeedback = (props: Props) => {
const { children, style, borderlessBackground, color, ...rest } = props;
const preLollipop = Platform.Version < 21;
let background = TouchableNativeFeedback.SelectableBackground();
if (!preLollipop && borderlessBackground) {
if (color) {
background = TouchableNativeFeedback.Ripple(color, true);
} else {
background = TouchableNativeFeedback.SelectableBackgroundBorderless();
}
}
return (
// eslint-disable-next-line backpack/use-components
<TouchableNativeFeedback style={style} background={background} {...rest}>
{React.Children.only(children)}
</TouchableNativeFeedback>
);
};
BpkTouchableNativeFeedback.propTypes = {
children: PropTypes.element.isRequired,
borderlessBackground: PropTypes.bool,
color: PropTypes.string,
style: ViewPropTypes.style,
};
BpkTouchableNativeFeedback.defaultProps = {
borderlessBackground: true,
color: null,
style: null,
};
export default BpkTouchableNativeFeedback;
|
var searchData=
[
['class_20adapter',['Class Adapter',['../md__d_1__g_i_t__practice__design_patterns__adapter__class_adapter__r_e_a_d_m_e.html',1,'']]],
['chain_20of_20responsibility',['Chain Of Responsibility',['../md__d_1__g_i_t__practice__design_patterns__chain_of_responsibility__r_e_a_d_m_e.html',1,'']]],
['command',['Command',['../md__d_1__g_i_t__practice__design_patterns__command__r_e_a_d_m_e.html',1,'']]],
['composite',['Composite',['../md__d_1__g_i_t__practice__design_patterns__composite__r_e_a_d_m_e.html',1,'']]]
];
|
var gulp = require('../..');
gulp.task('foo', async ()=> console.log('Out:Foo'));
gulp.task('bar', async ()=> console.log('Out:Bar'));
gulp.task('baz', gulp.series('foo', 'bar', async ()=> console.log('Out:Baz')));
|
from __future__ import unicode_literals, division, absolute_import
import logging
from datetime import datetime
from sqlalchemy import Column, String, Integer, DateTime, Unicode, desc
from flexget import options, plugin
from flexget.event import event
from flexget.logger import console
from flexget.manager import Base, Session
log = logging.getLogger('history')
class History(Base):
__tablename__ = 'history'
id = Column(Integer, primary_key=True)
task = Column('feed', String)
filename = Column(String)
url = Column(String)
title = Column(Unicode)
time = Column(DateTime)
details = Column(String)
def __init__(self):
self.time = datetime.now()
def __str__(self):
return '<History(filename=%s,task=%s)>' % (self.filename, self.task)
class PluginHistory(object):
"""Records all accepted entries for later lookup"""
schema = {'type': 'boolean'}
def on_task_learn(self, task, config):
"""Add accepted entries to history"""
if config is False:
return # Explicitly disabled with configuration
for entry in task.accepted:
item = History()
item.task = task.name
item.filename = entry.get('output', None)
item.title = entry['title']
item.url = entry['url']
reason = ''
if 'reason' in entry:
reason = ' (reason: %s)' % entry['reason']
item.details = 'Accepted by %s%s' % (entry.get('accepted_by', '<unknown>'), reason)
task.session.add(item)
def do_cli(manager, options):
session = Session()
try:
console('-- History: ' + '-' * 67)
query = session.query(History)
if options.search:
search_term = options.search.replace(' ', '%').replace('.', '%')
query = query.filter(History.title.like('%' + search_term + '%'))
query = query.order_by(desc(History.time)).limit(options.limit)
for item in reversed(query.all()):
console(' Task : %s' % item.task)
console(' Title : %s' % item.title)
console(' Url : %s' % item.url)
if item.filename:
console(' Stored : %s' % item.filename)
console(' Time : %s' % item.time.strftime("%c"))
console(' Details : %s' % item.details)
console('-' * 79)
finally:
session.close()
@event('options.register')
def register_parser_arguments():
parser = options.register_command('history', do_cli, help='view the history of entries that FlexGet has accepted')
parser.add_argument('--limit', action='store', type=int, metavar='NUM', default=50,
help='limit to %(metavar)s results')
parser.add_argument('--search', action='store', metavar='TERM', help='limit to results that contain %(metavar)s')
@event('plugin.register')
def register_plugin():
plugin.register(PluginHistory, 'history', builtin=True, api_ver=2)
|
/*****************************************************************************************************************************************************
* Copyright 2015 France Labs
*
* 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.
****************************************************************************************************************************************************/
AjaxFranceLabs.SliderWidget = AjaxFranceLabs.AbstractFacetWidget.extend({
// Variables
name : null,
field : null,
type : 'slider',
elm : null,
range : false,
currentFilter : '',
min : -100,
max : 100,
unit : 'YEAR',
fieldType : 'date',
defaultValue : 0,
step : 1,
comparator : 'greater',
// Methods
buildWidget : function() {
var endAnimationEvents = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend';
var animation = 'animated rotateIn';
var self = this, elm = $(this.elm);
elm.hide();
elm.addClass('facet').addClass('tableWidget').addClass('widget').attr('widgetId', this.id);
elm.append('<ul></ul>');
var ul = elm.find('ul');
if (this.range) {
ul.append('<li><div id="fromDiv">' + window.i18n.msgStore['fromLabel'] + ': <span id="from"></span></div></li>');
ul.append('<li><div id ="toDiv">' + window.i18n.msgStore['toLabel'] + ': <span id="to"></span></div></li>');
} else {
ul.append('<li><div id="currentFilter"></div></li>');
}
ul.append('<li><div id="' + this.id + '" class="slider"></div></li>');
if (this.name != null) {
elm.prepend('<div class="facetName">').find('.facetName').append('<i class="fas fa-chevron-down"></i>').append('<span class="label la"></span>')
.find('.label.la').append(this.name);
elm.find('.facetName').toggle(function() {
$("#" + self.id).hide();
elm.find(".facetName i").removeClass('fa-chevron-down').addClass('fa-chevron-up ' + animation).on(endAnimationEvents, function() {
$(this).removeClass(animation);
});
}, function() {
$("#" + self.id).show();
elm.find(".facetName i").removeClass('fa-chevron-up').addClass(animation + ' fa-chevron-down').on(endAnimationEvents, function() {
$(this).removeClass(animation);
});
});
}
$("#" + this.id).slider({
range : self.range,
change : function(event, ui) {
self.sliderChanged();
},
min : self.min,
max : self.max,
step : self.step,
slide : function(event, ui) {
self.changeFilterValue(ui, true);
}
});
if (this.range) {
$("#" + self.id).slider("option", "values", [ this.min, this.max ]);
} else {
$("#" + self.id).slider("option", "value", this.defaultValue);
}
},
update : function() {
var self = this, elm = $(this.elm);
elm.show(); // show the widget
},
changeFilterValue : function(slider, slide) {
if (this.range) {
var selectedMin;
var selectedMax;
if (!slide) {
selectedMin = slider.slider("values", 0);
selectedMax = slider.slider("values", 1);
} else {
selectedMin = slider.values[0];
selectedMax = slider.values[1];
}
var sentenceMin = selectedMin;
var sentenceMax = selectedMax;
if (this.fieldType == "date") {
sentenceMin = "NOW " + this.getSign(selectedMin) + selectedMin + " " + this.unit + this.getPlurial(selectedMin);
sentenceMax = "NOW " + this.getSign(selectedMax) + selectedMax + " " + this.unit + this.getPlurial(selectedMax);
}
this.elm.find("#from").html(sentenceMin);
this.elm.find("#to").html(sentenceMax);
} else {
var value;
if (!slide) {
value = slider.slider("value");
} else {
value = slider.value;
}
if (this.fieldType == "date") {
if (this.comparator == "greater") {
this.elm.find("#currentFilter").html("Greater than NOW " + this.getSign(value) + value + " " + this.unit + this.getPlurial(value));
} else {
this.elm.find("#currentFilter").html("Less than NOW " + this.getSign(value) + value + " " + this.unit + this.getPlurial(value));
}
} else {
if (this.comparator == "greater") {
this.elm.find("#currentFilter").html("Greater than " + value);
} else {
this.elm.find("#currentFilter").html("Less than " + value);
}
}
}
},
getFilter : function() {
this.changeFilterValue($("#" + this.id), false);
if (this.range) {
var selectedMin = $("#" + this.id).slider("values", 0);
var selectedMax = $("#" + this.id).slider("values", 1);
if (this.fieldType == "date") {
return this.getDateRangeFilter(selectedMin, selectedMax);
} else {
return this.getNormalRangeFilter(selectedMin, selectedMax);
}
} else {
var selectedValue = $("#" + this.id).slider("value");
if (this.fieldType == "date") {
return this.getDateFilter(selectedValue);
} else {
return this.getNormalFilter(selectedValue);
}
}
},
getDateFilter : function(value) {
var filter;
var sign = this.getSign(value);
if (this.comparator == "greater") {
filter = this.field + ":[NOW" + sign + value + this.unit + " TO *]";
} else {
filter = this.field + ":[* TO NOW" + sign + value + this.unit + "]";
}
return filter;
},
getNormalFilter : function(value) {
var filter;
if (this.comparator == "greater") {
filter = this.field + ":[" + value + " TO *]";
} else {
filter = this.field + ":[* TO " + value + "]";
}
return filter;
},
getDateRangeFilter : function(minValue, maxValue) {
var filter;
var minSign = this.getSign(minValue);
var maxSign = this.getSign(maxValue);
filter = this.field + ":[NOW" + minSign + minValue + this.unit + " TO NOW" + maxSign + maxValue + this.unit + "]";
return filter;
},
getNormalRangeFilter : function(minValue, maxValue) {
var filter;
var minSign = this.getSign(minValue);
var maxSign = this.getSign(maxValue);
filter = this.field + ":[" + minValue + " TO " + maxValue + "]";
return filter;
},
sliderChanged : function() {
var filter = this.getFilter();
if (this.currentFilter != '') {
this.manager.store.removeByValue("fq", this.currentFilter);
}
this.manager.store.addByValue("fq", filter);
this.currentFilter = filter;
var testSelect = document.getElementById("mySelect");
// Statement needed to detect if we are in the buildWidget function
// If testSelect is undefined so we are in the buildWidget function and we don't need to force a makeRequest as it will be automatically triggered
// Plus if we are in the buildWidget function, the makeRequest will trigger an error and the searchView will not work
if (testSelect != undefined) {
this.manager.makeRequest();
}
},
getSign : function(value) {
if (value < 0) {
return "";
} else {
return "+";
}
},
getPlurial : function(value) {
var plurial = "";
if (value < -1 || value > 1) {
plurial = "S";
}
return plurial;
},
clickHandler : function() {
},
afterRequest : function() {
this.update();
}
});
|
import Joi from '../../utils/joi.js';
export const resolveResource = {
options: {
validate: {
options: {
allowUnknown: true,
stripUnknown: true
},
query: Joi.object().keys({
path: Joi.string().required(),
recursive: Joi.boolean().default(true),
cidBase: Joi.string().default('base58btc'),
timeout: Joi.timeout()
}).rename('arg', 'path', {
override: true,
ignoreUndefined: true
}).rename('cid-base', 'cidBase', {
override: true,
ignoreUndefined: true
})
}
},
async handler(request, h) {
const {
app: {signal},
server: {
app: {ipfs}
},
query: {path, recursive, cidBase, timeout}
} = request;
const res = await ipfs.resolve(path, {
recursive,
cidBase,
signal,
timeout
});
return h.response({ Path: res });
}
}; |
# encoding: utf-8
"""
@version: v1.0
@author: Richard
@license: Apache Licence
@contact: [email protected]
@site:
@software: PyCharm
@time: 2019/11/10 11:13
"""
import unittest
from utils.tree.btree_utils import TreeUtils as TU
from utils.tree.btree_node import TreeNode
class TestTree(unittest.TestCase):
def setUp(self): pass
def tearDown(self): pass
def test_traverse_1(self):
r = TreeNode(0)
pre_order, in_order, post_order = [0], [0], [0]
act_pre, act_in, act_post = TU.pre_order(r), TU.in_order_iter(
r), TU.post_order(r)
self.assertEqual(pre_order, act_pre)
self.assertEqual(in_order, act_in)
self.assertEqual(post_order, act_post)
def test_traverse_2(self):
r = TreeNode(0)
r.left = TreeNode(1)
pre_order, in_order, post_order = [0, 1], [1, 0], [1, 0]
act_pre, act_in, act_post = TU.pre_order(r), TU.in_order_iter(r), \
TU.post_order(r)
self.assertEqual(pre_order, act_pre)
self.assertEqual(in_order, act_in)
self.assertEqual(post_order, act_post)
def test_traverse_3(self):
r = TreeNode(0)
r.right = TreeNode(1)
pre_order, in_order, post_order = [0, 1], [0, 1], [1, 0]
act_pre, act_in, act_post = TU.pre_order(r), TU.in_order_iter(
r), TU.post_order(r)
self.assertEqual(pre_order, act_pre)
self.assertEqual(in_order, act_in)
self.assertEqual(post_order, act_post)
def test_traverse_4(self):
r = TreeNode(0)
r.left = TreeNode(1)
r.right = TreeNode(2)
pre_order, in_order, post_order = [0, 1, 2], [1, 0, 2], [1, 2, 0]
act_pre, act_in, act_post = TU.pre_order(r), TU.in_order_iter(
r), TU.post_order(r)
self.assertEqual(pre_order, act_pre)
self.assertEqual(in_order, act_in)
self.assertEqual(post_order, act_post)
def test_traverse_5(self):
r = TreeNode(0)
r.left = TreeNode(1)
r.right = TreeNode(2)
r.left.left = TreeNode(3)
r.left.right = TreeNode(4)
r.right.right = TreeNode(6)
pre_order, in_order, post_order = ([0, 1, 3, 4, 2, 6],
[3, 1, 4, 0, 2, 6],
[3, 4, 1, 6, 2, 0])
act_pre, act_in, act_post = TU.pre_order(r), TU.in_order_iter(
r), TU.post_order(r)
self.assertEqual(pre_order, act_pre)
self.assertEqual(in_order, act_in)
self.assertEqual(post_order, act_post)
def test_traverse_6(self):
root = TreeNode(0)
root.left = TreeNode(1)
root.right = TreeNode(2)
root.left.left = TreeNode(3)
root.left.right = TreeNode(4)
root.left.left.right = TreeNode(5)
root.right.right = TreeNode(6)
root.right.right.left = TreeNode(7)
pre_order, in_order, post_order = ([0, 1, 3, 5, 4, 2, 6, 7],
[3, 5, 1, 4, 0, 2, 7, 6],
[5, 3, 4, 1, 7, 6, 2, 0])
act_pre, act_in, act_post = \
TU.pre_order(root), TU.in_order_iter(root), TU.post_order(root)
self.assertEqual(pre_order, act_pre)
self.assertEqual(in_order, act_in)
self.assertEqual(post_order, act_post)
def test_equal_0(self):
root1 = TreeNode(0)
root2 = None
self.assertFalse(TU.is_equal_trees(root1, root2))
def test_equal_1(self):
root1 = TreeNode(0)
self.assertTrue(TU.is_equal_trees(root1, root1))
def test_equal_2(self):
r1 = TreeNode(0)
r2 = TreeNode(0)
self.assertTrue(TU.is_equal_trees(r1, r2))
def test_equal_3(self):
r1 = TreeNode(0)
r1.left = TreeNode(1)
r1.right = TreeNode(2)
r2 = TreeNode(0)
r2.left = TreeNode(1)
r2.right = TreeNode(2)
self.assertTrue(TU.is_equal_trees(r1, r2))
def test_equal_4(self):
r1 = TreeNode(0)
r1.left = TreeNode(1)
r1.right = TreeNode(2)
r2 = TreeNode(0)
r2.left = TreeNode(1)
r2.right = TreeNode(1)
self.assertFalse(TU.is_equal_trees(r1, r2))
def test_equal_5(self):
r1 = TreeNode(0)
r1.left = TreeNode(1)
r1.right = TreeNode(2)
r1.left.left = TreeNode(3)
r1.right.right = TreeNode(0)
r2 = TreeNode(0)
r2.left = TreeNode(1)
r2.left.left = TreeNode(3)
r2.right = TreeNode(2)
r2.right.right = TreeNode(0)
self.assertTrue(TU.is_equal_trees(r1, r2))
def test_btree_lvl_order_1(self):
r1 = None
exp = []
act = TU.lvl_order(r1)
self.assertEqual(exp, act)
def test_btree_lvl_order_2(self):
r1 = TreeNode(0)
exp = [0]
act = TU.lvl_order(r1)
self.assertEqual(exp, act)
def test_btree_lvl_order_3(self):
r1 = TreeNode(0)
r1.left = TreeNode(1)
exp = [0, 1]
act = TU.lvl_order(r1)
self.assertEqual(exp, act)
def test_btree_lvl_order_4(self):
r1 = TreeNode(0)
r1.right = TreeNode(1)
exp = [0, 1]
act = TU.lvl_order(r1)
self.assertEqual(exp, act)
def test_btree_lvl_order_5(self):
r1 = TreeNode(0)
r1.left = TreeNode(1)
r1.right = TreeNode(2)
exp = [0, 1, 2]
act = TU.lvl_order(r1)
self.assertEqual(exp, act)
def test_btree_lvl_order_6(self):
r1 = TreeNode(0)
r1.left = TreeNode(1)
r1.right = TreeNode(2)
r1.left.left = TreeNode(3)
r1.left.left.right = TreeNode(4)
r1.right.left = TreeNode(5)
exp = [0, 1, 2, 3, 5, 4]
act = TU.lvl_order(r1)
self.assertEqual(exp, act)
def test_btree_lvl_order_7(self):
r1 = TreeNode(0)
r1.left = TreeNode(1)
r1.right = TreeNode(2)
r1.left.left = TreeNode(3)
r1.left.right = TreeNode(5)
r1.left.left.right = TreeNode(7)
r1.right.right = TreeNode(4)
r1.right.right.left = TreeNode(8)
exp = [0, 1, 2, 3, 5, 4, 7, 8]
act = TU.lvl_order(r1)
self.assertEqual(exp, act)
def test_btree_to_string_8(self):
r1 = TreeNode(0)
r1.left = TreeNode(1)
r1.right = TreeNode(2)
r1.left.left = TreeNode(3)
r1.left.right = TreeNode(5)
r1.left.left.right = TreeNode(7)
r1.right.right = TreeNode(4)
r1.right.right.left = TreeNode(8)
act = TU.to_string(r1)
print(act)
|
from math import log
from pandas import DataFrame
from BaseBanditAlgorithm import BaseBanditAlgorithm
class UCB1(BaseBanditAlgorithm):
"""
Implementation of the UCB1 algorithm for multi-armed bandit testing.
"""
def __init__(self, counts=[], values=[]):
"""
Algorithm requires no control parameters.
Inputs:
counts: List[int] -- Initial counts for each arm
values: List[float] -- Initial average reward for each arm
"""
self.arms = DataFrame({'Iteration':counts, 'Reward':values})
self.arms.index.name = 'Arm'
return
def initialize(self, n_arms):
self.arms = DataFrame({'Iteration':[0], 'Reward':[0.0]}, range(n_arms))
self.arms.index.name = 'Arm'
return
def select_arm(self):
if self.arms['Iteration'].min() == 0:
return self.arms['Iteration'].idxmin()
total_count = self.arms['Iteration'].sum()
ucb_values = 2 * log(total_count)/self.arms['Iteration']
ucb_values **= 0.5
ucb_values += self.arms['Reward']
return ucb_values.idxmax()
def update(self, chosen_arm, reward):
arm = int(chosen_arm)
n = self.arms.ix[arm, 'Iteration'] + 1
self.arms.ix[arm, 'Iteration'] = n
self.arms.ix[arm, 'Reward'] *= (n-1)/float(n)
self.arms.ix[arm, 'Reward'] += reward/float(n)
return
|
from django.urls import path
from .views import (
ActivityListCreateAPIView,
ActivityDetailsAPIView,
CommentListCreateAPIView,
CommentDetailsAPIView,
TaskListCreateAPIView,
TaskDetailsAPIView,
)
urlpatterns = [
path("activities/", ActivityListCreateAPIView.as_view(), name="activitie-listcreate"),
path("activities/<id>/", ActivityDetailsAPIView.as_view(), name="activitie-details"),
path("comments/", CommentListCreateAPIView.as_view(), name="activitie-listcreate"),
path("comments/<id>/", CommentDetailsAPIView.as_view(), name="activitie-details"),
path("tasks/", TaskListCreateAPIView.as_view(), name="activitie-listcreate"),
path("tasks/<id>/", TaskDetailsAPIView.as_view(), name="activitie-details"),
]
|
module.exports={A:{A:{"2":"I D E F gB","6308":"A","6436":"B"},B:{"1":"R S T U V W X P Y Z G a","6436":"C J K L M N O"},C:{"1":"MB NB OB PB QB RB SB TB ZB aB bB R S T iB U V W X P Y Z G a","2":"hB WB H b I D E F A B C J K L M N O c d e f g h i j k l m n o p q r s t u v jB kB","2052":"0 1 2 3 4 5 6 7 8 9 w x y z AB BB CB DB EB FB XB GB YB Q HB IB JB KB LB"},D:{"1":"NB OB PB QB RB SB TB ZB aB bB R S T U V W X P Y Z G a lB mB nB","2":"0 1 2 3 4 5 6 7 8 9 H b I D E F A B C J K L M N O c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB XB GB YB Q HB IB JB","8258":"KB LB MB"},E:{"1":"B C J K UB VB tB uB vB","2":"H b I D E oB cB pB qB rB","3108":"F A sB dB"},F:{"1":"IB JB KB LB MB NB OB PB QB RB SB TB","2":"0 1 2 3 4 5 6 7 8 9 F B C L M N O c d e f g h i j k l m n o p q r s t u v w x y z AB wB xB yB zB UB eB 0B VB","8258":"BB CB DB EB FB GB Q HB"},G:{"1":"AC BC CC DC EC FC GC HC IC JC","2":"E cB 1B fB 2B 3B 4B 5B","3108":"6B 7B 8B 9B"},H:{"2":"KC"},I:{"1":"G","2":"WB H LC MC NC OC fB PC QC"},J:{"2":"D A"},K:{"2":"A B C Q UB eB VB"},L:{"1":"G"},M:{"1":"P"},N:{"2":"A B"},O:{"2":"RC"},P:{"1":"dB XC YC ZC aC","2":"H SC TC UC VC WC"},Q:{"2":"bC"},R:{"2":"cC"},S:{"2052":"dC"}},B:4,C:"CSS Scroll Snap"};
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayFundCouponWufuCardQueryModel(object):
def __init__(self):
self._scene = None
self._user_id = None
@property
def scene(self):
return self._scene
@scene.setter
def scene(self, value):
self._scene = value
@property
def user_id(self):
return self._user_id
@user_id.setter
def user_id(self, value):
self._user_id = value
def to_alipay_dict(self):
params = dict()
if self.scene:
if hasattr(self.scene, 'to_alipay_dict'):
params['scene'] = self.scene.to_alipay_dict()
else:
params['scene'] = self.scene
if self.user_id:
if hasattr(self.user_id, 'to_alipay_dict'):
params['user_id'] = self.user_id.to_alipay_dict()
else:
params['user_id'] = self.user_id
return params
@staticmethod
def from_alipay_dict(d):
if not d:
return None
o = AlipayFundCouponWufuCardQueryModel()
if 'scene' in d:
o.scene = d['scene']
if 'user_id' in d:
o.user_id = d['user_id']
return o
|
"""
Original EmailParser Code by Ian Lewis:
http://www.ianlewis.org/en/parsing-email-attachments-python
Licensed under MIT
"""
from collections import namedtuple
from io import BytesIO
import base64
import re
from email.parser import BytesParser as Parser
import imaplib
from django.conf import settings
from django.utils import timezone
from django.utils.functional import cached_property
from .text_utils import convert_html_to_text
from .email_parsing import (
parse_email_body, parse_main_headers, parse_date, get_bounce_headers
)
AUTO_REPLY_SUBJECT_REGEX = settings.FROIDE_CONFIG.get(
'auto_reply_subject_regex', None)
AUTO_REPLY_EMAIL_REGEX = settings.FROIDE_CONFIG.get(
'auto_reply_email_regex', None)
AUTO_REPLY_HEADERS = (
('X-Autoreply', None),
('X-Autorespond', None),
('Auto-Submitted', 'auto-replied'),
)
BOUNCE_STATUS_RE = re.compile(r'(\d\.\d+\.\d+)', re.IGNORECASE)
BOUNCE_DIAGNOSTIC_STATUS_RE = re.compile(r'smtp; (\d{3})')
BOUNCE_TEXT = re.compile(r'''5\d{2}\ Requested\ action\ not\ taken |
5\.\d\.\d |
RESOLVER\.ADR\.RecipNotFound |
mailbox\ unavailable |
RCPT\ TO\ command |
permanent\ error |
SMTP\ error |
original\ message |
Return-Path:\ # If headers are given in verbose
''', re.X | re.I)
BOUNCE_TEXT_THRESHOLD = 3 # At least three occurences of above patterns
DsnStatus = namedtuple('DsnStatus', 'class_ subject detail')
BounceResult = namedtuple('BounceResult', 'status is_bounce bounce_type diagnostic_code timestamp')
GENERIC_ERROR = DsnStatus(5, 0, 0)
MAILBOX_FULL = DsnStatus(5, 2, 2)
# Restrict to max 3 consecutive newlines in email body
MULTI_NL_RE = re.compile('((?:\r?\n){,3})(?:\r?\n)*')
def get_unread_mails(host, port, user, password, ssl=True):
klass = imaplib.IMAP4
if ssl:
klass = imaplib.IMAP4_SSL
mail = klass(host, port)
mail.login(user, password)
try:
status, count = mail.select('Inbox')
typ, data = mail.search(None, 'UNSEEN')
for num in data[0].split():
status, data = mail.fetch(num, '(RFC822)')
yield data[0][1]
finally:
mail.close()
mail.logout()
def make_address(email, name=None):
if name:
return '"%s" <%s>' % (name.replace('"', ''), email)
return email
class UnsupportedMailFormat(Exception):
pass
def find_bounce_status(headers, body=None):
for v in headers.get('Status', []):
match = BOUNCE_STATUS_RE.match(v.strip())
if match is not None:
return DsnStatus(*[int(x) for x in match.group(1).split('.')])
if body is not None:
bounce_matches = len(BOUNCE_TEXT.findall(body))
if bounce_matches >= BOUNCE_TEXT_THRESHOLD:
# Declare a DSN status of 5.5.0
return DsnStatus(5, 5, 0)
return None
def find_status_from_diagnostic(message):
if not message:
return
match = BOUNCE_DIAGNOSTIC_STATUS_RE.search(message)
if match is None:
match = BOUNCE_STATUS_RE.search(message)
if match is None:
return
return DsnStatus(*[int(x) for x in match.group(1).split('.')])
return DsnStatus(*[int(x) for x in match.group(1)])
def classify_bounce_status(status):
if status is None:
return
if status.class_ == 2:
return
if status.class_ == 4:
return 'soft'
# Mailbox full should be treated as a temporary problem
if status == MAILBOX_FULL:
return 'soft'
if status.class_ == 5:
return 'hard'
class ParsedEmail(object):
message_id = None
date = None
def __init__(self, msgobj, **kwargs):
self.msgobj = msgobj
for k, v in kwargs.items():
setattr(self, k, v)
@cached_property
def bounce_info(self):
return self.get_bounce_info()
def get_bounce_info(self):
headers = {}
if self.msgobj is not None:
headers = get_bounce_headers(self.msgobj)
status = find_bounce_status(headers, self.body)
diagnostic_code = headers.get('Diagnostic-Code', [None])[0]
diagnostic_status = find_status_from_diagnostic(diagnostic_code)
if status == GENERIC_ERROR and diagnostic_status != status:
status = diagnostic_status
bounce_type = classify_bounce_status(status)
return BounceResult(
status=status,
bounce_type=bounce_type,
is_bounce=bool(bounce_type),
diagnostic_code=diagnostic_code,
timestamp=self.date or timezone.now()
)
@cached_property
def is_auto_reply(self):
return self.detect_auto_reply()
def detect_auto_reply(self):
msgobj = self.msgobj
if msgobj:
for header, val in AUTO_REPLY_HEADERS:
header_val = msgobj.get(header, None)
if header_val is None:
continue
if val is None or val in header_val:
return True
from_field = self.from_
if from_field and AUTO_REPLY_EMAIL_REGEX is not None:
if AUTO_REPLY_EMAIL_REGEX.search(from_field[0]):
return True
subject = self.subject
if subject and AUTO_REPLY_SUBJECT_REGEX is not None:
if AUTO_REPLY_SUBJECT_REGEX.search(subject) is not None:
return True
return False
def is_direct_recipient(self, email_address):
return any(
email.lower() == email_address.lower() for name, email in self.to
)
def fix_email_body(body):
return MULTI_NL_RE.sub('\\1', body)
class EmailParser(object):
def parse(self, bytesfile):
p = Parser()
msgobj = p.parse(bytesfile)
body, html, attachments = parse_email_body(msgobj)
body = '\n'.join(body).strip()
html = '\n'.join(html).strip()
if not body and html:
body = convert_html_to_text(html)
body = fix_email_body(body)
email_info = parse_main_headers(msgobj)
email_info.update({
'body': body,
'html': html,
'attachments': attachments
})
return ParsedEmail(msgobj, **email_info)
def parse_postmark(self, obj):
from_field = (obj['FromFull']['Name'], obj['FromFull']['Email'])
tos = [(o['Name'], o['Email']) for o in obj['ToFull']]
ccs = [(o['Name'], o['Email']) for o in obj['CcFull']]
attachments = []
for a in obj['Attachments']:
attachment = BytesIO(base64.b64decode(a['Content']))
attachment.content_type = a['ContentType']
attachment.size = a['ContentLength']
attachment.name = a['Name']
attachment.create_date = None
attachment.mod_date = None
attachment.read_date = None
attachments.append(attachment)
return ParsedEmail(None, **{
'postmark_msgobj': obj,
'date': parse_date(obj['Date']),
'subject': obj['Subject'],
'body': obj['TextBody'],
'html': obj['HtmlBody'],
'from_': from_field,
'to': tos,
'cc': ccs,
'resent_to': [],
'resent_cc': [],
'attachments': attachments
})
|
from __future__ import print_function, division
import torch
import torch.nn as nn
from torch.autograd import Variable
import torchvision.models as models
import torch.nn.functional as F
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
from .apply_model import new_structure_2,SpatialAttention,ChannelAttention
model_pretrained_path = {
'resnet18': '/home/czd-2019/model_pretrained/resnet18-5c106cde.pth',
'resnet34': "/home/czd-2019/model_pretrained/resnet34-333f7ec4.pth",
'googlenet': "/home/czd-2019/model_pretrained/inception_v3_google-1a9a5a14.pth"
}
class StructureCheck(nn.Module):
'''
Just for test.
'''
def __init__(self,isPretrained=False):
super(StructureCheck, self).__init__()
self.net = new_structure_2()
# self.net = nn.Sequential(*list(self.net.children())[:-2])
if isPretrained:
init_pretrained_weights(self.net, model_pretrained_path['resnet18'])
# self.subTask = SubStructureCheck(10)
# #for the first exp of structure2 with 640 dims output.
# self.HairPart = SubStructureCheck(10,input_dims=640)
# self.EyesPart = SubStructureCheck(5,input_dims=640)
# self.NosePart = SubStructureCheck(2,input_dims=640)
# self.CheekPart = SubStructureCheck(4,input_dims=640)
# self.MouthPart = SubStructureCheck(5,input_dims=640)
# self.ChinPart = SubStructureCheck(3,input_dims=640)
# self.NeckPart = SubStructureCheck(2,input_dims=640)
# self.HolisticPart = SubStructureCheck(9,input_dims=640)
self.HairPart = SubStructureCheck(10)
self.EyesPart = SubStructureCheck(5)
self.NosePart = SubStructureCheck(2)
self.CheekPart = SubStructureCheck(4)
self.MouthPart = SubStructureCheck(5)
self.ChinPart = SubStructureCheck(3)
self.NeckPart = SubStructureCheck(2)
self.HolisticPart = SubStructureCheck(9)
def forward(self, x):
x = self.net(x)
hair = self.HairPart(x)
eyes = self.EyesPart(x)
nose = self.NosePart(x)
cheek = self.CheekPart(x)
mouth = self.MouthPart(x)
chin = self.ChinPart(x)
neck = self.NeckPart(x)
holistic = self.HolisticPart(x)
return hair, eyes, nose, cheek, mouth, chin, neck, holistic
class SubStructureCheck(nn.Module):
def __init__(self,output_dims,input_dims=512):
super(SubStructureCheck, self).__init__()
self.ca = ChannelAttention(input_dims)
self.sa = SpatialAttention(3)
self.relu = nn.ReLU(inplace=True)
self.aap = nn.AdaptiveAvgPool2d((1,1))
self.fc = nn.Sequential(
nn.Linear(input_dims, 512),
nn.ReLU(True),
nn.Dropout(p=0.5),
nn.Linear(512, 128),
nn.ReLU(True),
nn.Dropout(p=0.5),
nn.Linear(128, output_dims),
)
def forward(self, x):
residual = x
x = self.ca(x)*x
x = self.sa(x)*x
x += residual
x = self.relu(x)
x = self.aap(x)
x = torch.flatten(x, 1)
x = self.fc(x)
return x
def init_pretrained_weights(model, pretrain_dict_path):
"""
Initialize model with pretrained weights.
Layers that don't match with pretrained layers in name or size are kept unchanged.
"""
pretrain_dict = torch.load(pretrain_dict_path)
model_dict = model.state_dict()
pretrain_dict = {k: v for k, v in pretrain_dict.items() if k in model_dict and model_dict[k].size() == v.size()}
model_dict.update(pretrain_dict)
model.load_state_dict(model_dict)
print("Initialized model with pretrained weights from {}".format(pretrain_dict_path))
|
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath('../../'))
# -- Project information -----------------------------------------------------
project = 'Electrical Energy Measurement Processing Library'
author = 'David Waster'
copyright = f'2021, {author}'
# The full version, including alpha/beta/rc tags
release = '1.0.0'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinxcontrib.napoleon',
'sphinx.ext.autodoc',
'sphinx_rtd_theme',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'es'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
# html_theme = 'alabaster'
html_theme = 'sphinx_rtd_theme'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Napoleon settings
napoleon_custom_sections = [
('Argumentos', 'Arguments'),
('Retorno', 'Returns'),
]
autoclass_content = 'both' |
import React, { Component } from 'react';
import json from 'format-json';
import Textarea from 'react-textarea-autosize';
import PropTypes from 'prop-types';
const styles = {
label: {
display: 'table-cell',
boxSizing: 'border-box',
verticalAlign: 'top',
paddingRight: '5px',
paddingTop: '7px',
textAlign: 'right',
width: '100px',
fontSize: '12px',
color: 'rgb(68, 68, 68)',
fontWeight: '600',
},
button: {
display: 'table-cell',
textTransform: 'uppercase',
letterSpacing: '3.5px',
fontSize: 12,
fontWeight: 'bolder',
color: 'rgb(130, 130, 130)',
border: '1px solid rgb(193, 193, 193)',
textAlign: 'center',
borderRadius: 2,
padding: 5,
cursor: 'pointer',
paddingLeft: 8,
margin: '0 0 0 5px',
backgroundColor: 'inherit',
verticalAlign: 'top',
outline: 0,
},
textArea: {
flex: '1 0 0',
boxSizing: 'border-box',
margin: '0 0 0 5px',
verticalAlign: 'top',
outline: 'none',
border: '1px solid #c7c7c7',
borderRadius: 2,
fontSize: 13,
padding: '8px 5px 7px 8px',
color: 'rgb(51, 51, 51)',
fontFamily: 'Arial, sans-serif',
minHeight: '32px',
resize: 'vertical',
},
item: {
display: 'flex',
padding: '5px',
alignItems: 'flex-start',
boxSizing: 'border-box',
width: '100%',
},
hidden: {
display: 'none',
},
failed: {
border: '1px solid #fadddd',
backgroundColor: '#fff5f5',
},
};
export default class Item extends Component {
static propTypes = {
name: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
onEmit: PropTypes.func.isRequired,
payload: PropTypes.any, // eslint-disable-line react/forbid-prop-types
};
static defaultProps = {
payload: {},
};
static getJSONFromString(str) {
try {
return JSON.parse(str);
} catch (e) {
return str;
}
}
state = {};
componentWillMount() {
const payloadString = json.plain(this.props.payload);
this.setState({
failed: false,
payload: Item.getJSONFromString(payloadString),
payloadString,
isTextAreaShowed: false,
});
}
onChange = ({ target: { value } }) => {
const newState = {
payloadString: value,
};
try {
newState.payload = JSON.parse(value.trim());
newState.failed = false;
} catch (err) {
newState.failed = true;
}
this.setState(newState);
};
onEmitClick = () => {
this.props.onEmit({
name: this.props.name,
payload: this.state.payload,
});
};
onToggleEditClick = () => {
this.setState(({ isTextAreaShowed }) => ({
isTextAreaShowed: !isTextAreaShowed,
}));
};
render() {
const { title, name } = this.props;
const { failed, isTextAreaShowed } = this.state;
const extraStyle = {};
Object.assign(extraStyle, isTextAreaShowed ? {} : { ...styles.hidden });
Object.assign(extraStyle, failed ? { ...styles.failed } : {});
return (
<div style={styles.item}>
<label htmlFor={`addon-event-${name}`} style={styles.label}>
{title}
</label>
<button
style={styles.button}
onClick={this.onEmitClick}
disabled={failed}
title="Submit event"
>
📢
</button>
<Textarea
id={`addon-event-${name}`}
ref={ref => {
this.input = ref;
}}
style={{ ...styles.textArea, ...extraStyle }}
value={this.state.payloadString}
onChange={this.onChange}
/>
{isTextAreaShowed ? (
<button style={styles.button} onClick={this.onToggleEditClick} title="Close editing">
❌
</button>
) : (
<button style={styles.button} onClick={this.onToggleEditClick} title="Edit event payload">
✏️
</button>
)}
</div>
);
}
}
|
"use strict";
exports.getRecurrenceProcessor = getRecurrenceProcessor;
var _errors = _interopRequireDefault(require("../../core/errors"));
var _iterator = require("../../core/utils/iterator");
var _array = require("../../core/utils/array");
var _rrule = require("rrule");
var _date = _interopRequireDefault(require("../../core/utils/date"));
var _utils = _interopRequireDefault(require("./utils.timeZone"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
var toMs = _date.default.dateToMilliseconds;
var ruleNames = ['freq', 'interval', 'byday', 'byweekno', 'byyearday', 'bymonth', 'bymonthday', 'count', 'until', 'byhour', 'byminute', 'bysecond', 'bysetpos', 'wkst'];
var freqNames = ['DAILY', 'WEEKLY', 'MONTHLY', 'YEARLY', 'SECONDLY', 'MINUTELY', 'HOURLY'];
var days = {
SU: 0,
MO: 1,
TU: 2,
WE: 3,
TH: 4,
FR: 5,
SA: 6
};
var loggedWarnings = [];
var recurrence = null;
function getRecurrenceProcessor() {
if (!recurrence) {
recurrence = new RecurrenceProcessor();
}
return recurrence;
}
var RecurrenceProcessor = /*#__PURE__*/function () {
function RecurrenceProcessor() {
this.rRule = null;
this.rRuleSet = null;
this.validator = new RecurrenceValidator();
}
var _proto = RecurrenceProcessor.prototype;
_proto.generateDates = function generateDates(options) {
var result = [];
var recurrenceRule = this.evalRecurrenceRule(options.rule);
var rule = recurrenceRule.rule;
if (!recurrenceRule.isValid || !rule.freq) {
return result;
}
var startDateUtc = _utils.default.createUTCDateWithLocalOffset(options.start);
var endDateUtc = _utils.default.createUTCDateWithLocalOffset(options.end);
var minDateUtc = _utils.default.createUTCDateWithLocalOffset(options.min);
var maxDateUtc = _utils.default.createUTCDateWithLocalOffset(options.max);
var duration = endDateUtc ? endDateUtc.getTime() - startDateUtc.getTime() : 0;
this._initializeRRule(options, startDateUtc, rule.until);
var minTime = minDateUtc.getTime();
var leftBorder = this._getLeftBorder(options, minDateUtc, duration);
this.rRuleSet.between(leftBorder, maxDateUtc, true).forEach(function (date) {
var endAppointmentTime = date.getTime() + duration;
if (endAppointmentTime >= minTime) {
var correctDate = _utils.default.createDateFromUTCWithLocalOffset(date);
result.push(correctDate);
}
});
return result;
};
_proto.hasRecurrence = function hasRecurrence(options) {
return !!this.generateDates(options).length;
};
_proto.evalRecurrenceRule = function evalRecurrenceRule(rule) {
var result = {
rule: {},
isValid: false
};
if (rule) {
result.rule = this._parseRecurrenceRule(rule);
result.isValid = this.validator.validateRRule(result.rule, rule);
}
return result;
};
_proto.isValidRecurrenceRule = function isValidRecurrenceRule(rule) {
return this.evalRecurrenceRule(rule).isValid;
};
_proto.daysFromByDayRule = function daysFromByDayRule(rule) {
var result = [];
if (rule['byday']) {
if (Array.isArray(rule['byday'])) {
result = rule['byday'];
} else {
result = rule['byday'].split(',');
}
}
return result.map(function (item) {
var match = item.match(/[A-Za-z]+/);
return !!match && match[0];
}).filter(function (item) {
return !!item;
});
};
_proto.getAsciiStringByDate = function getAsciiStringByDate(date) {
var currentOffset = date.getTimezoneOffset() * toMs('minute');
var offsetDate = new Date(date.getTime() + currentOffset);
return offsetDate.getFullYear() + ('0' + (offsetDate.getMonth() + 1)).slice(-2) + ('0' + offsetDate.getDate()).slice(-2) + 'T' + ('0' + offsetDate.getHours()).slice(-2) + ('0' + offsetDate.getMinutes()).slice(-2) + ('0' + offsetDate.getSeconds()).slice(-2) + 'Z';
};
_proto.getRecurrenceString = function getRecurrenceString(object) {
if (!object || !object.freq) {
return;
}
var result = '';
for (var field in object) {
var value = object[field];
if (field === 'interval' && value < 2) {
continue;
}
if (field === 'until') {
value = this.getAsciiStringByDate(value);
}
result += field + '=' + value + ';';
}
result = result.substring(0, result.length - 1);
return result.toUpperCase();
};
_proto._parseExceptionToRawArray = function _parseExceptionToRawArray(value) {
return value.match(/(\d{4})(\d{2})(\d{2})(T(\d{2})(\d{2})(\d{2}))?(Z)?/);
};
_proto.getDateByAsciiString = function getDateByAsciiString(exceptionText) {
if (typeof exceptionText !== 'string') {
return exceptionText;
}
var result = this._parseExceptionToRawArray(exceptionText);
if (!result) {
return null;
}
var _this$_createDateTupl = this._createDateTuple(result),
_this$_createDateTupl2 = _slicedToArray(_this$_createDateTupl, 7),
year = _this$_createDateTupl2[0],
month = _this$_createDateTupl2[1],
date = _this$_createDateTupl2[2],
hours = _this$_createDateTupl2[3],
minutes = _this$_createDateTupl2[4],
seconds = _this$_createDateTupl2[5],
isUtc = _this$_createDateTupl2[6];
if (isUtc) {
return new Date(Date.UTC(year, month, date, hours, minutes, seconds));
}
return new Date(year, month, date, hours, minutes, seconds);
};
_proto._dispose = function _dispose() {
if (this.rRuleSet) {
delete this.rRuleSet;
this.rRuleSet = null;
}
if (this.rRule) {
delete this.rRule;
this.rRule = null;
}
};
_proto._getTimeZoneOffset = function _getTimeZoneOffset() {
return new Date().getTimezoneOffset();
};
_proto._initializeRRule = function _initializeRRule(options, startDateUtc, until) {
var _this = this;
var ruleOptions = _rrule.RRule.parseString(options.rule);
var firstDayOfWeek = options.firstDayOfWeek;
ruleOptions.dtstart = startDateUtc;
if (!ruleOptions.wkst && firstDayOfWeek) {
var weekDayNumbers = [6, 0, 1, 2, 3, 4, 5];
ruleOptions.wkst = weekDayNumbers[firstDayOfWeek];
}
ruleOptions.until = _utils.default.createUTCDateWithLocalOffset(until);
this._createRRule(ruleOptions);
if (options.exception) {
var exceptionStrings = options.exception;
var exceptionDates = exceptionStrings.split(',').map(function (rule) {
return _this.getDateByAsciiString(rule);
});
exceptionDates.forEach(function (date) {
if (options.getPostProcessedException) {
date = options.getPostProcessedException(date);
}
var utcDate = _utils.default.createUTCDateWithLocalOffset(date);
_this.rRuleSet.exdate(utcDate);
});
}
};
_proto._createRRule = function _createRRule(ruleOptions) {
this._dispose();
var rRuleSet = new _rrule.RRuleSet();
this.rRuleSet = rRuleSet;
this.rRule = new _rrule.RRule(ruleOptions);
this.rRuleSet.rrule(this.rRule);
};
_proto._getLeftBorder = function _getLeftBorder(options, minDateUtc, appointmentDuration) {
if (options.end && !_utils.default.isSameAppointmentDates(options.start, options.end)) {
return new Date(minDateUtc.getTime() - appointmentDuration);
}
return minDateUtc;
};
_proto._parseRecurrenceRule = function _parseRecurrenceRule(recurrence) {
var ruleObject = {};
var ruleParts = recurrence.split(';');
for (var i = 0, len = ruleParts.length; i < len; i++) {
var rule = ruleParts[i].split('=');
var ruleName = rule[0].toLowerCase();
var ruleValue = rule[1];
ruleObject[ruleName] = ruleValue;
}
var count = parseInt(ruleObject.count);
if (!isNaN(count)) {
ruleObject.count = count;
}
if (ruleObject.interval) {
var interval = parseInt(ruleObject.interval);
if (!isNaN(interval)) {
ruleObject.interval = interval;
}
} else {
ruleObject.interval = 1;
}
if (ruleObject.freq && ruleObject.until) {
ruleObject.until = this.getDateByAsciiString(ruleObject.until);
}
return ruleObject;
};
_proto._createDateTuple = function _createDateTuple(parseResult) {
var isUtc = parseResult[8] !== undefined;
parseResult.shift();
if (parseResult[3] === undefined) {
parseResult.splice(3);
} else {
parseResult.splice(3, 1);
parseResult.splice(6);
}
parseResult[1]--;
parseResult.unshift(null);
return [parseInt(parseResult[1]), parseInt(parseResult[2]), parseInt(parseResult[3]), parseInt(parseResult[4]) || 0, parseInt(parseResult[5]) || 0, parseInt(parseResult[6]) || 0, isUtc];
};
return RecurrenceProcessor;
}();
var RecurrenceValidator = /*#__PURE__*/function () {
function RecurrenceValidator() {}
var _proto2 = RecurrenceValidator.prototype;
_proto2.validateRRule = function validateRRule(rule, recurrence) {
if (this._brokenRuleNameExists(rule) || (0, _array.inArray)(rule.freq, freqNames) === -1 || this._wrongCountRule(rule) || this._wrongIntervalRule(rule) || this._wrongDayOfWeek(rule) || this._wrongByMonthDayRule(rule) || this._wrongByMonth(rule) || this._wrongUntilRule(rule)) {
this._logBrokenRule(recurrence);
return false;
}
return true;
};
_proto2._wrongUntilRule = function _wrongUntilRule(rule) {
var wrongUntil = false;
var until = rule.until;
if (until !== undefined && !(until instanceof Date)) {
wrongUntil = true;
}
return wrongUntil;
};
_proto2._wrongCountRule = function _wrongCountRule(rule) {
var wrongCount = false;
var count = rule.count;
if (count && typeof count === 'string') {
wrongCount = true;
}
return wrongCount;
};
_proto2._wrongByMonthDayRule = function _wrongByMonthDayRule(rule) {
var wrongByMonthDay = false;
var byMonthDay = rule['bymonthday'];
if (byMonthDay && isNaN(parseInt(byMonthDay))) {
wrongByMonthDay = true;
}
return wrongByMonthDay;
};
_proto2._wrongByMonth = function _wrongByMonth(rule) {
var wrongByMonth = false;
var byMonth = rule['bymonth'];
if (byMonth && isNaN(parseInt(byMonth))) {
wrongByMonth = true;
}
return wrongByMonth;
};
_proto2._wrongIntervalRule = function _wrongIntervalRule(rule) {
var wrongInterval = false;
var interval = rule.interval;
if (interval && typeof interval === 'string') {
wrongInterval = true;
}
return wrongInterval;
};
_proto2._wrongDayOfWeek = function _wrongDayOfWeek(rule) {
var byDay = rule['byday'];
var daysByRule = getRecurrenceProcessor().daysFromByDayRule(rule);
var brokenDaysExist = false;
if (byDay === '') {
brokenDaysExist = true;
}
(0, _iterator.each)(daysByRule, function (_, day) {
if (!Object.prototype.hasOwnProperty.call(days, day)) {
brokenDaysExist = true;
return false;
}
});
return brokenDaysExist;
};
_proto2._brokenRuleNameExists = function _brokenRuleNameExists(rule) {
var brokenRuleExists = false;
(0, _iterator.each)(rule, function (ruleName) {
if ((0, _array.inArray)(ruleName, ruleNames) === -1) {
brokenRuleExists = true;
return false;
}
});
return brokenRuleExists;
};
_proto2._logBrokenRule = function _logBrokenRule(recurrence) {
if ((0, _array.inArray)(recurrence, loggedWarnings) === -1) {
_errors.default.log('W0006', recurrence);
loggedWarnings.push(recurrence);
}
};
return RecurrenceValidator;
}(); |
/*
* L.FeatureGroup extends L.LayerGroup by introducing mouse events and additional methods
* shared between a group of interactive layers (like vectors or markers).
*/
L.FeatureGroup = L.LayerGroup.extend({
includes: L.Mixin.Events,
statics: {
EVENTS: 'click dblclick mouseover mouseout mousemove contextmenu popupopen popupclose'
},
addLayer: function (layer) {
if (this.hasLayer(layer)) {
return this;
}
if ('on' in layer) {
layer.on(L.FeatureGroup.EVENTS, this._propagateEvent, this);
}
L.LayerGroup.prototype.addLayer.call(this, layer);
if (this._popupContent && layer.bindPopup) {
layer.bindPopup(this._popupContent, this._popupOptions);
}
return this.fire('layeradd', {layer: layer});
},
removeLayer: function (layer) {
if (!this.hasLayer(layer)) {
return this;
}
if (layer in this._layers) {
layer = this._layers[layer];
}
layer.off(L.FeatureGroup.EVENTS, this._propagateEvent, this);
L.LayerGroup.prototype.removeLayer.call(this, layer);
if (this._popupContent) {
this.invoke('unbindPopup');
}
return this.fire('layerremove', {layer: layer});
},
bindPopup: function (content, options) {
this._popupContent = content;
this._popupOptions = options;
return this.invoke('bindPopup', content, options);
},
openPopup: function (latlng) {
// open popup on the first layer
for (var id in this._layers) {
this._layers[id].openPopup(latlng);
break;
}
return this;
},
setStyle: function (style) {
return this.invoke('setStyle', style);
},
bringToFront: function () {
return this.invoke('bringToFront');
},
bringToBack: function () {
return this.invoke('bringToBack');
},
getBounds: function () {
var bounds = new L.LatLngBounds();
this.eachLayer(function (layer) {
bounds.extend(layer instanceof L.Marker ? layer.getLatLng() : layer.getBounds());
});
return bounds;
},
_propagateEvent: function (e) {
e = L.extend({
layer: e.target,
target: this
}, e);
this.fire(e.type, e);
}
});
L.featureGroup = function (layers) {
return new L.FeatureGroup(layers);
};
|
export const MOVIE_LIST_REQUEST = 'MOVIE_LIST_REQUEST';
export const MOVIE_LIST_SUCCESS = 'MOVIE_LIST_SUCCESS';
export const MOVIE_LIST_FAIL = 'MOVIE_LIST_FAIL';
export const MOVIE_DETAILS_REQUEST = 'MOVIE_DETAILS_REQUEST';
export const MOVIE_DETAILS_SUCCESS = 'MOVIE_DETAILS_SUCCESS';
export const MOVIE_DETAILS_FAIL = 'MOVIE_DETAILS_FAIL';
export const MOVIE_TOPRATED_DETAILS_REQUEST = 'MOVIE_TOPRATED_DETAILS_REQUEST';
export const MOVIE_TOPRATED_DETAILS_SUCCESS = 'MOVIE_TOPRATED_DETAILS_SUCCESS';
export const MOVIE_TOPRATED_DETAILS_FAIL = 'MOVIE_TOPRATED_DETAILS_FAIL';
export const MOVIE_NAME_SEARCH_REQUEST = 'MOVIE_NAME_SEARCH_REQUEST';
export const MOVIE_NAME_SEARCH_SUCCESS = 'MOVIE_NAME_SEARCH_SUCCESS';
export const MOVIE_NAME_SEARCH_FAIL = 'MOVIE_NAME_SEARCH_FAIL';
export const MOVIE_GENRE_SEARCH_REQUEST = 'MOVIE_GENRE_SEARCH_REQUEST';
export const MOVIE_GENRE_SEARCH_SUCCESS = 'MOVIE_GENRE_SEARCH_SUCCESS';
export const MOVIE_GENRE_SEARCH_FAIL = 'MOVIE_GENRE_SEARCH_FAIL';
export const MOVIE_CREATE_REQUEST = 'MOVIE_CREATE_REQUEST';
export const MOVIE_CREATE_SUCCESS = 'MOVIE_CREATE_SUCCESS';
export const MOVIE_CREATE_FAIL = 'MOVIE_CREATE_FAIL';
export const MOVIE_COMMENT_REQUEST = 'MOVIE_COMMENT_REQUEST';
export const MOVIE_COMMENT_SUCCESS = 'MOVIE_COMMENT_SUCCESS';
export const MOVIE_COMMENT_FAIL = 'MOVIE_COMMENT_FAIL';
export const MOVIE_RATE_REQUEST = 'MOVIE_RATE_REQUEST';
export const MOVIE_RATE_SUCCESS = 'MOVIE_RATE_SUCCESS';
export const MOVIE_RATE_FAIL = 'MOVIE_RATE_FAIL';
export const MOVIE_DELETE_REQUEST = 'MOVIE_DELETE_REQUEST';
export const MOVIE_DELETE_SUCCESS = 'MOVIE_DELETE_SUCCESS';
export const MOVIE_DELETE_FAIL = 'MOVIE_DELETE_FAIL';
export const MOVIE_UPDATE_REQUEST = 'MOVIE_UPDATE_REQUEST';
export const MOVIE_UPDATE_SUCCESS = 'MOVIE_UPDATE_SUCCESS';
export const MOVIE_UPDATE_FAIL = 'MOVIE_UPDATE_FAIL';
export const MOVIE_UPDATE_RESET = 'MOVIE_UPDATE_RESET';
|
#!/usr/bin/python
# coding: utf-8
# Author: LE YUAN
import xlrd
import csv
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
worksheet = xlrd.open_workbook(u"./yeast_clade.xlsx")
sheet_names = worksheet.sheet_names()
# print(sheet_names)
sheet = worksheet.sheet_by_name(sheet_names[0])
rows = sheet.nrows
# print(rows)
species_cell = list()
clade_cell = list()
for i in range(1,rows) :
cell_1 = sheet.cell_value(i,1)
species_cell.append(cell_1.lower())
clade_4 = sheet.cell_value(i,4)
clade_cell.append(clade_4)
species = species_cell[1:]
clade = clade_cell[1:]
# print(species[-3:])
# print(clade[-3:])
# print(len(species)) # 332
# print(len(clade)) # 332
species_clade = dict(zip(species,clade))
# print(species_clade)
outfile = open("./substrate_boxplot.csv", "w")
csv_writer = csv.writer(outfile)
csv_writer.writerow(["species", "expansion", "contraction", "rapidly_evolving"])
with open('substrate_results.tsv', 'r') as file :
lines = file.readlines()[1:]
for line in lines :
data = line.strip().split('\t')
csv_writer.writerow([species_clade[data[0].lower()], int(data[1]), int(data[2]), int(data[3])])
outfile.close()
alldata = pd.read_csv("./substrate_boxplot.csv")
print(alldata.head(3))
fig=plt.figure(figsize=(8,6))
hue_order = ['Lipomycetaceae', 'Trigonopsidaceae', 'Dipodascaceae/Trichomonascaceae', 'Alloascoideaceae', 'Sporopachydermia clade',
'CUG-Ala', 'Pichiaceae', 'CUG-Ser1', 'CUG-Ser2', 'Phaffomycetaceae', 'Saccharomycodaceae', 'Saccharomycetaceae']
ax = sns.boxplot(data=alldata, x="species", y="rapidly_evolving", order=hue_order,
showfliers=False, linewidth=1)
# ax = sns.stripplot(data=alldata, x="organism", y="species", hue="type", palette=palette,
# dodge=True, size=2, linewidth=0.5, alpha=0.3)
# https://stackoverflow.com/questions/58476654/how-to-remove-or-hide-x-axis-label-from-seaborn-boxplot
# plt.xlabel(None) will remove the Label, but not the ticks.
ax.set(xlabel=None)
# plt.xlabel("Organism")
for tick in ax.get_xticklabels() :
tick.set_rotation(60)
# plt.ylabel("Gene family contraction")
plt.ylabel("Rapidly evolving")
plt.xticks(fontsize=8)
plt.tight_layout()
# plt.ylim(0,450)
# plt.yticks([0,150,300,450])
# # ax.legend(ax.get_legend_handles_labels()[0], ["E", "NE"])
# handles,labels = ax.get_legend_handles_labels()
# # # specify just one legend
# l = plt.legend(handles[0:2], labels[0:2], loc=0)
# https://blog.csdn.net/weixin_38314865/article/details/88633880
plt.savefig("./rapidly_evolving_boxplot.png", dpi=400, bbox_inches='tight')
|
num_stairs = int(input("Enter the number of stair: "))
# for num in range(1,num_stairs):
# print((num_stairs-num)*" "+num*"#")
for num in range(1,num_stairs):
if num% 2 != 0:
empty_partial = int((num_stairs-num)/2) * " "
print(empty_partial+num*"#"+empty_partial)
f = 0
def someFunction():
global f
f = "f in def"
print(f)
someFunction()
print(f)
|
import Sequelize, { Model } from 'sequelize';
class DeliveryProblem extends Model {
static init(sequelize) {
super.init(
{
description: Sequelize.STRING,
},
{ sequelize }
);
return this;
}
static associate(models) {
this.belongsTo(models.Order, { foreignKey: 'delivery_id', as: 'delivery' });
}
}
export default DeliveryProblem;
|
'use strict';
const commonConfig = require('./config.common');
module.exports = exports = Object.assign(commonConfig, {
env: 'production',
db: `mongodb://mongodb-server/e-health`,
apiPort: 80
});
|
# coding: utf-8
import pprint
import six
from enum import Enum
class AbstractSubscriptionAffiliateUpdate:
swagger_types = {
'language': 'str',
'meta_data': 'dict(str, str)',
'name': 'str',
'state': 'CreationEntityState',
}
attribute_map = {
'language': 'language','meta_data': 'metaData','name': 'name','state': 'state',
}
_language = None
_meta_data = None
_name = None
_state = None
def __init__(self, **kwargs):
self.discriminator = None
self.language = kwargs.get('language', None)
self.meta_data = kwargs.get('meta_data', None)
self.name = kwargs.get('name', None)
self.state = kwargs.get('state', None)
@property
def language(self):
"""Gets the language of this AbstractSubscriptionAffiliateUpdate.
:return: The language of this AbstractSubscriptionAffiliateUpdate.
:rtype: str
"""
return self._language
@language.setter
def language(self, language):
"""Sets the language of this AbstractSubscriptionAffiliateUpdate.
:param language: The language of this AbstractSubscriptionAffiliateUpdate.
:type: str
"""
self._language = language
@property
def meta_data(self):
"""Gets the meta_data of this AbstractSubscriptionAffiliateUpdate.
Meta data allow to store additional data along the object.
:return: The meta_data of this AbstractSubscriptionAffiliateUpdate.
:rtype: dict(str, str)
"""
return self._meta_data
@meta_data.setter
def meta_data(self, meta_data):
"""Sets the meta_data of this AbstractSubscriptionAffiliateUpdate.
Meta data allow to store additional data along the object.
:param meta_data: The meta_data of this AbstractSubscriptionAffiliateUpdate.
:type: dict(str, str)
"""
self._meta_data = meta_data
@property
def name(self):
"""Gets the name of this AbstractSubscriptionAffiliateUpdate.
:return: The name of this AbstractSubscriptionAffiliateUpdate.
:rtype: str
"""
return self._name
@name.setter
def name(self, name):
"""Sets the name of this AbstractSubscriptionAffiliateUpdate.
:param name: The name of this AbstractSubscriptionAffiliateUpdate.
:type: str
"""
if name is not None and len(name) > 255:
raise ValueError("Invalid value for `name`, length must be less than or equal to `255`")
if name is not None and len(name) < 3:
raise ValueError("Invalid value for `name`, length must be greater than or equal to `3`")
self._name = name
@property
def state(self):
"""Gets the state of this AbstractSubscriptionAffiliateUpdate.
:return: The state of this AbstractSubscriptionAffiliateUpdate.
:rtype: CreationEntityState
"""
return self._state
@state.setter
def state(self, state):
"""Sets the state of this AbstractSubscriptionAffiliateUpdate.
:param state: The state of this AbstractSubscriptionAffiliateUpdate.
:type: CreationEntityState
"""
self._state = state
def to_dict(self):
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
elif isinstance(value, Enum):
result[attr] = value.value
else:
result[attr] = value
if issubclass(AbstractSubscriptionAffiliateUpdate, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
return pprint.pformat(self.to_dict())
def __repr__(self):
return self.to_str()
def __eq__(self, other):
if not isinstance(other, AbstractSubscriptionAffiliateUpdate):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
return not self == other
|
module.exports={A:{A:{"2":"J D E F A B gB"},B:{"1":"R S T U V W X Y Z P a H","2":"C K L G","260":"M N O"},C:{"1":"0 1 2 3 4 5 6 7 8 9 t u v w x y z AB BB CB DB EB FB ZB GB aB Q HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB bB R S T iB U V W X Y Z P a H","2":"hB YB I b J D E F A B C K L G M N O c d e f g h i j k l m n o p q r s jB kB"},D:{"1":"0 1 2 3 4 5 6 7 8 9 p q r s t u v w x y z AB BB CB DB EB FB ZB GB aB Q HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB bB R S T U V W X Y Z P a H lB mB nB","2":"I b J D E F A B C K L G M N O c d e f g h i j k l m n o"},E:{"1":"A B C K L G dB WB XB tB uB vB","2":"I b J D oB cB pB qB","132":"E F rB sB"},F:{"1":"0 1 2 3 4 5 6 7 8 9 c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB Q HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB","2":"F G M N O wB xB yB","33":"B C zB WB eB 0B XB"},G:{"1":"8B 9B AC BC CC DC EC FC GC HC IC JC","2":"cB 1B fB 2B 3B 4B","132":"E 5B 6B 7B"},H:{"33":"KC"},I:{"1":"H QC","2":"YB I LC MC NC OC fB PC"},J:{"2":"D A"},K:{"1":"Q","2":"A","33":"B C WB eB XB"},L:{"1":"H"},M:{"1":"P"},N:{"2":"A B"},O:{"1":"RC"},P:{"1":"I SC TC UC VC WC dB XC YC ZC aC"},Q:{"1":"bC"},R:{"1":"cC"},S:{"1":"dC"}},B:4,C:"CSS3 object-fit/object-position"};
|
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'fakeobjects', 'gl', {
anchor: 'Ancoraxe',
flash: 'Animación «Flash»',
hiddenfield: 'Campo agochado',
iframe: 'IFrame',
unknown: 'Obxecto descoñecido'
} );
|
import {
SET_USER_PURCHASES,
SET_PURCHASE_DETAIL,
SET_CART_PRODUCTS,
ADD_CART_PRODUCT,
AUTHENTICATE_USER,
} from "./types";
export function signIn({ email, password }) {
return {
type: AUTHENTICATE_USER,
payload: {
user: {
id: 0,
name: "Daniel Rod",
address: "I Lives Here 1234",
cartProducts: [],
},
},
};
}
export function setPurchaseDetail(id) {
return {
type: SET_PURCHASE_DETAIL,
payload: id,
};
}
export function addCartProduct(product) {
return {
type: ADD_CART_PRODUCT,
payload: product,
};
}
export function setCartProducts() {
return {
type: SET_CART_PRODUCTS,
payload: [
{
id: 0,
product: {
id: 0,
title: "JavaScript in the Browser",
description:
"The FitnessGram™ Pacer Test is a multistage aerobic capacity test that progressively gets more difficult as it continues. The 20 meter pacer test will begin in 30 seconds. ... The running speed starts slowly, but gets faster each minute after you hear this signal.",
price: 1.99,
belongsTo: [0, 1],
imageURL: "http://via.placeholder.com/80x80",
},
quantity: 2,
},
{
id: 1,
product: {
id: 1,
title: "Graph Database",
description:
"The FitnessGram™ Pacer Test is a multistage aerobic capacity test that progressively gets more difficult as it continues. The 20 meter pacer test will begin in 30 seconds. ... The running speed starts slowly, but gets faster each minute after you hear this signal.",
price: 1.99,
belongsTo: [0, 6],
imageURL: "http://via.placeholder.com/80x80",
},
quantity: 1,
},
],
};
}
export function fetchUserPurchases() {
return {
type: SET_USER_PURCHASES,
payload: [
{
id: 0,
amount: 8.02,
orderNumber: "A0048248343",
orderDate: new Date().toDateString(),
creditCard: "-0000",
user: {
name: "Jordan Hudgens",
shippingAddress: "1234 West State Street",
},
},
{
id: 1,
amount: 9.02,
orderNumber: "A0048248343",
orderDate: new Date().toDateString(),
creditCard: "-0000",
user: {
name: "Jordan Hudgens",
shippingAddress: "1234 West State Street",
},
},
{
id: 2,
amount: 7.02,
orderNumber: "A0048248343",
orderDate: new Date().toDateString(),
creditCard: "-0000",
user: {
name: "Jordan Hudgens",
shippingAddress: "1234 West State Street",
},
},
{
id: 3,
amount: 12.02,
orderNumber: "A0048248343",
orderDate: new Date().toDateString(),
creditCard: "-0000",
user: {
name: "Jordan Hudgens",
shippingAddress: "1234 West State Street",
},
},
{
id: 4,
amount: 4.02,
orderNumber: "A0048248343",
orderDate: new Date().toDateString(),
creditCard: "-0000",
user: {
name: "Jordan Hudgens",
shippingAddress: "1234 West State Street",
},
},
{
id: 5,
amount: 15.02,
orderNumber: "A0048248343",
orderDate: new Date().toDateString(),
creditCard: "-0000",
user: {
name: "Jordan Hudgens",
shippingAddress: "1234 West State Street",
},
},
{
id: 6,
amount: 56.02,
orderNumber: "A0048248343",
orderDate: new Date().toDateString(),
creditCard: "-0000",
user: {
name: "Jordan Hudgens",
shippingAddress: "1234 West State Street",
},
},
{
id: 7,
amount: 12.02,
orderNumber: "A0048248343",
orderDate: new Date().toDateString(),
creditCard: "-0000",
user: {
name: "Jordan Hudgens",
shippingAddress: "1234 West State Street",
},
},
],
};
}
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from 'material-ui/SvgIcon';
const SvgIconCustom = global.__MUI_SvgIcon__ || SvgIcon;
var _ref = React.createElement('path', { d: 'M7.34 6.41L.86 12.9l6.49 6.48 6.49-6.48-6.5-6.49zM3.69 12.9l3.66-3.66L11 12.9l-3.66 3.66-3.65-3.66zm15.67-6.26C17.61 4.88 15.3 4 13 4V.76L8.76 5 13 9.24V6c1.79 0 3.58.68 4.95 2.05 2.73 2.73 2.73 7.17 0 9.9C16.58 19.32 14.79 20 13 20c-.97 0-1.94-.21-2.84-.61l-1.49 1.49C10.02 21.62 11.51 22 13 22c2.3 0 4.61-.88 6.36-2.64 3.52-3.51 3.52-9.21 0-12.72z' });
let Rotate90DegreesCcw = props => React.createElement(
SvgIconCustom,
props,
_ref
);
Rotate90DegreesCcw = pure(Rotate90DegreesCcw);
Rotate90DegreesCcw.muiName = 'SvgIcon';
export default Rotate90DegreesCcw; |
import sys
# package need to be installed, pip install docker
import docker
import time
import yaml
import os
import random
import subprocess
import signal
import urllib2
import shutil
import xlwt
# package need to be installed, apt-get install python-pymongo
import pymongo
auto = False
private_registry = "202.114.10.146:9999/"
suffix = "-gearmd"
apppath = ""
# run paraments
hostPort = 8080
localVolume = "/var/lib/gear/volume"
pwd = os.path.split(os.path.realpath(__file__))[0]
runEnvironment = []
runPorts = {}
runVolumes = {}
runWorking_dir = ""
runCommand = "echo hello"
waitline = "hello"
# result
result = [["tag", "finishTime", "local data", "pull data"], ]
class Runner:
def __init__(self, images):
self.images_to_pull = images
def check(self):
# detect whether the file exists, if true, delete it
if os.path.exists("./images_run.txt"):
os.remove("./images_run.txt")
def run(self):
self.check()
client = docker.from_env()
# if don't give a tag, then all image under this registry will be pulled
repos = self.images_to_pull[0]["repo"]
for repo in repos:
tags = self.images_to_pull[1][repo]
for tag in tags:
private_repo = private_registry + repo + suffix + ":" + tag
if localVolume != "":
if os.path.exists(localVolume) == False:
os.makedirs(localVolume)
print "start running: ", private_repo
# create a random name
runName = '%d' % (random.randint(1,100000000))
# get present time
startTime = time.time()
# get present net data
cnetdata = get_net_data()
# run images
container = client.containers.create(image=private_repo, environment=runEnvironment,
ports=runPorts, volumes=runVolumes, working_dir=runWorking_dir,
command=runCommand, name=runName, detach=True)
container.start()
while True:
if waitline == "":
break
elif container.logs().find(waitline) >= 0:
break
else:
time.sleep(0.1)
pass
# print run time
finishTime = time.time() - startTime
print "finished in " , finishTime, "s"
container_path = os.path.join("/var/lib/gear/private", private_repo)
local_data = subprocess.check_output(['du','-sh', container_path]).split()[0].decode('utf-8')
print "local data: ", local_data
pull_data = get_net_data() - cnetdata
print "pull data: ", pull_data
try:
container.kill()
except:
print "kill fail!"
pass
container.remove(force=True)
# delete files under /var/lib/gear/public/
shutil.rmtree('/var/lib/gear/public/')
os.mkdir('/var/lib/gear/public/')
print "empty cache! \n"
# record the image and its Running time
result.append([tag, finishTime, local_data, pull_data])
if auto != True:
raw_input("Next?")
else:
time.sleep(5)
if localVolume != "":
shutil.rmtree(localVolume)
class Generator:
def __init__(self, profilePath=""):
self.profilePath = profilePath
def generateFromProfile(self):
if self.profilePath == "":
print "Error: profile path is null"
with open(self.profilePath, 'r') as f:
self.images = yaml.load(f)
return self.images
def get_net_data():
netCard = "/proc/net/dev"
fd = open(netCard, "r")
for line in fd.readlines():
if line.find("enp0s3") >= 0:
field = line.split()
data = float(field[1]) / 1024.0 / 1024.0
fd.close()
return data
if __name__ == "__main__":
if len(sys.argv) == 2:
auto = True
generator = Generator(os.path.split(os.path.realpath(__file__))[0]+"/image_versions.yaml")
images = generator.generateFromProfile()
runner = Runner(images)
runner.run()
# create a workbook sheet
workbook = xlwt.Workbook()
sheet = workbook.add_sheet("run_time")
for row in range(len(result)):
for column in range(len(result[row])):
sheet.write(row, column, result[row][column])
workbook.save(os.path.split(os.path.realpath(__file__))[0]+"/second_run_without_cache.xls") |
/*
* Author: Alexandre Havrileck (Oxyno-zeta)
* Date: 18/07/16
* Licence: See Readme
*/
/* ************************************* */
/* ******** REQUIRE ******** */
/* ************************************* */
const gulp = require('gulp');
const del = require('del');
const conf = require('./conf');
/* ************************************* */
/* ******** PRIVATE FUNCTIONS ******** */
/* ************************************* */
/* ************************************* */
/* ******** PUBLIC FUNCTIONS ******** */
/* ************************************* */
gulp.task('clean', ['clean:tests']);
gulp.task('clean:tests', () => del(conf.tests.resultDir));
|
from django.apps import AppConfig
class CorecodeConfig(AppConfig):
name = "apps.corecode"
def ready(self):
import apps.corecode.signals
|
from django.apps import AppConfig
class RepositoriesConfig(AppConfig):
name = 'repositories'
|
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import _ from 'lodash';
import { i18n } from '@kbn/i18n';
import { parse } from 'wellknown';
import {
DECIMAL_DEGREES_PRECISION,
ES_GEO_FIELD_TYPE,
ES_SPATIAL_RELATIONS,
GEO_JSON_TYPE,
POLYGON_COORDINATES_EXTERIOR_INDEX,
LON_INDEX,
LAT_INDEX,
} from '../constants';
import { getEsSpatialRelationLabel } from '../i18n_getters';
import { FILTERS } from '../../../../../src/plugins/data/common';
import turfCircle from '@turf/circle';
const SPATIAL_FILTER_TYPE = FILTERS.SPATIAL_FILTER;
function ensureGeoField(type) {
const expectedTypes = [ES_GEO_FIELD_TYPE.GEO_POINT, ES_GEO_FIELD_TYPE.GEO_SHAPE];
if (!expectedTypes.includes(type)) {
const errorMessage = i18n.translate(
'xpack.maps.es_geo_utils.unsupportedFieldTypeErrorMessage',
{
defaultMessage:
'Unsupported field type, expected: {expectedTypes}, you provided: {fieldType}',
values: {
fieldType: type,
expectedTypes: expectedTypes.join(','),
},
}
);
throw new Error(errorMessage);
}
}
function ensureGeometryType(type, expectedTypes) {
if (!expectedTypes.includes(type)) {
const errorMessage = i18n.translate(
'xpack.maps.es_geo_utils.unsupportedGeometryTypeErrorMessage',
{
defaultMessage:
'Unsupported geometry type, expected: {expectedTypes}, you provided: {geometryType}',
values: {
geometryType: type,
expectedTypes: expectedTypes.join(','),
},
}
);
throw new Error(errorMessage);
}
}
/**
* Converts Elasticsearch search results into GeoJson FeatureCollection
*
* @param {array} hits Elasticsearch search response hits array
* @param {function} flattenHit Method to flatten hits._source and hits.fields into properties object.
* Should just be IndexPattern.flattenHit but wanted to avoid coupling this method to IndexPattern.
* @param {string} geoFieldName Geometry field name
* @param {string} geoFieldType Geometry field type ["geo_point", "geo_shape"]
* @returns {number}
*/
export function hitsToGeoJson(hits, flattenHit, geoFieldName, geoFieldType, epochMillisFields) {
const features = [];
const tmpGeometriesAccumulator = [];
for (let i = 0; i < hits.length; i++) {
const properties = flattenHit(hits[i]);
tmpGeometriesAccumulator.length = 0; //truncate accumulator
ensureGeoField(geoFieldType);
if (geoFieldType === ES_GEO_FIELD_TYPE.GEO_POINT) {
geoPointToGeometry(properties[geoFieldName], tmpGeometriesAccumulator);
} else {
geoShapeToGeometry(properties[geoFieldName], tmpGeometriesAccumulator);
}
// There is a bug in Elasticsearch API where epoch_millis are returned as a string instead of a number
// https://github.com/elastic/elasticsearch/issues/50622
// Convert these field values to integers.
for (let i = 0; i < epochMillisFields.length; i++) {
const fieldName = epochMillisFields[i];
if (typeof properties[fieldName] === 'string') {
properties[fieldName] = parseInt(properties[fieldName]);
}
}
// don't include geometry field value in properties
delete properties[geoFieldName];
//create new geojson Feature for every individual geojson geometry.
for (let j = 0; j < tmpGeometriesAccumulator.length; j++) {
features.push({
type: 'Feature',
geometry: tmpGeometriesAccumulator[j],
// _id is not unique across Kibana index pattern. Multiple ES indices could have _id collisions
// Need to prefix with _index to guarantee uniqueness
id: `${properties._index}:${properties._id}:${j}`,
properties,
});
}
}
return {
type: 'FeatureCollection',
features: features,
};
}
// Parse geo_point docvalue_field
// Either
// 1) Array of latLon strings
// 2) latLon string
export function geoPointToGeometry(value, accumulator) {
if (!value) {
return;
}
if (Array.isArray(value)) {
for (let i = 0; i < value.length; i++) {
geoPointToGeometry(value[i], accumulator);
}
return;
}
const commaSplit = value.split(',');
const lat = parseFloat(commaSplit[0]);
const lon = parseFloat(commaSplit[1]);
accumulator.push({
type: GEO_JSON_TYPE.POINT,
coordinates: [lon, lat],
});
}
export function convertESShapeToGeojsonGeometry(value) {
const geoJson = {
type: value.type,
coordinates: value.coordinates,
};
// https://www.elastic.co/guide/en/elasticsearch/reference/current/geo-shape.html#input-structure
// For some unknown compatibility nightmarish reason, Elasticsearch types are not capitalized the same as geojson types
// For example: 'LineString' geojson type is 'linestring' in elasticsearch
// Convert feature types to geojson spec values
// Sometimes, the type in ES is capitalized correctly. Sometimes it is not. It depends on how the doc was ingested
// The below is the correction in-place.
switch (value.type) {
case 'point':
geoJson.type = GEO_JSON_TYPE.POINT;
break;
case 'linestring':
geoJson.type = GEO_JSON_TYPE.LINE_STRING;
break;
case 'polygon':
geoJson.type = GEO_JSON_TYPE.POLYGON;
break;
case 'multipoint':
geoJson.type = GEO_JSON_TYPE.MULTI_POINT;
break;
case 'multilinestring':
geoJson.type = GEO_JSON_TYPE.MULTI_LINE_STRING;
break;
case 'multipolygon':
geoJson.type = GEO_JSON_TYPE.MULTI_POLYGON;
break;
case 'geometrycollection':
geoJson.type = GEO_JSON_TYPE.GEOMETRY_COLLECTION;
break;
case 'envelope':
case 'circle':
const errorMessage = i18n.translate(
'xpack.maps.es_geo_utils.convert.unsupportedGeometryTypeErrorMessage',
{
defaultMessage: `Unable to convert {geometryType} geometry to geojson, not supported`,
values: {
geometryType: geoJson.type,
},
}
);
throw new Error(errorMessage);
}
return geoJson;
}
function convertWKTStringToGeojson(value) {
try {
return parse(value);
} catch (e) {
const errorMessage = i18n.translate('xpack.maps.es_geo_utils.wkt.invalidWKTErrorMessage', {
defaultMessage: `Unable to convert {wkt} to geojson. Valid WKT expected.`,
values: {
wkt: value,
},
});
throw new Error(errorMessage);
}
}
export function geoShapeToGeometry(value, accumulator) {
if (!value) {
return;
}
if (Array.isArray(value)) {
// value expressed as an array of values
for (let i = 0; i < value.length; i++) {
geoShapeToGeometry(value[i], accumulator);
}
return;
}
let geoJson;
if (typeof value === 'string') {
geoJson = convertWKTStringToGeojson(value);
} else {
geoJson = convertESShapeToGeojsonGeometry(value);
}
accumulator.push(geoJson);
}
export function makeESBbox({ maxLat, maxLon, minLat, minLon }) {
const bottom = clampToLatBounds(minLat);
const top = clampToLatBounds(maxLat);
let esBbox;
if (maxLon - minLon >= 360) {
esBbox = {
top_left: [-180, top],
bottom_right: [180, bottom],
};
} else {
// geo_bounding_box does not support ranges outside of -180 and 180
// When the area crosses the 180° meridian,
// the value of the lower left longitude will be greater than the value of the upper right longitude.
// http://docs.opengeospatial.org/is/12-063r5/12-063r5.html#30
//
// This ensures bbox goes West->East in the happy case,
// but will be formatted East->West in case it crosses the date-line
const newMinlon = ((minLon + 180 + 360) % 360) - 180;
const newMaxlon = ((maxLon + 180 + 360) % 360) - 180;
esBbox = {
top_left: [newMinlon, top],
bottom_right: [newMaxlon, bottom],
};
}
return esBbox;
}
function createGeoBoundBoxFilter({ maxLat, maxLon, minLat, minLon }, geoFieldName) {
const boundingBox = makeESBbox({ maxLat, maxLon, minLat, minLon });
return {
geo_bounding_box: {
[geoFieldName]: boundingBox,
},
};
}
export function createExtentFilter(mapExtent, geoFieldName, geoFieldType) {
ensureGeoField(geoFieldType);
// Extent filters are used to dynamically filter data for the current map view port.
// Continue to use geo_bounding_box queries for extent filters
// 1) geo_bounding_box queries are faster than polygon queries
// 2) geo_shape benefits of pre-indexed shapes and
// compatability across multi-indices with geo_point and geo_shape do not apply to this use case.
if (geoFieldType === ES_GEO_FIELD_TYPE.GEO_POINT) {
return createGeoBoundBoxFilter(mapExtent, geoFieldName);
}
return {
geo_shape: {
[geoFieldName]: {
shape: formatEnvelopeAsPolygon(mapExtent),
relation: ES_SPATIAL_RELATIONS.INTERSECTS,
},
},
};
}
export function createSpatialFilterWithGeometry({
preIndexedShape,
geometry,
geometryLabel,
indexPatternId,
geoFieldName,
geoFieldType,
relation = ES_SPATIAL_RELATIONS.INTERSECTS,
}) {
ensureGeoField(geoFieldType);
const isGeoPoint = geoFieldType === ES_GEO_FIELD_TYPE.GEO_POINT;
const relationLabel = isGeoPoint
? i18n.translate('xpack.maps.es_geo_utils.shapeFilter.geoPointRelationLabel', {
defaultMessage: 'in',
})
: getEsSpatialRelationLabel(relation);
const meta = {
type: SPATIAL_FILTER_TYPE,
negate: false,
index: indexPatternId,
key: geoFieldName,
alias: `${geoFieldName} ${relationLabel} ${geometryLabel}`,
};
const shapeQuery = {
// geo_shape query with geo_point field only supports intersects relation
relation: isGeoPoint ? ES_SPATIAL_RELATIONS.INTERSECTS : relation,
};
if (preIndexedShape) {
shapeQuery.indexed_shape = preIndexedShape;
} else {
shapeQuery.shape = geometry;
}
return {
meta,
geo_shape: {
ignore_unmapped: true,
[geoFieldName]: shapeQuery,
},
};
}
export function createDistanceFilterWithMeta({
alias,
distanceKm,
geoFieldName,
indexPatternId,
point,
}) {
const meta = {
type: SPATIAL_FILTER_TYPE,
negate: false,
index: indexPatternId,
key: geoFieldName,
alias: alias
? alias
: i18n.translate('xpack.maps.es_geo_utils.distanceFilterAlias', {
defaultMessage: '{geoFieldName} within {distanceKm}km of {pointLabel}',
values: {
distanceKm,
geoFieldName,
pointLabel: point.join(', '),
},
}),
};
return {
geo_distance: {
distance: `${distanceKm}km`,
[geoFieldName]: point,
},
meta,
};
}
export function roundCoordinates(coordinates) {
for (let i = 0; i < coordinates.length; i++) {
const value = coordinates[i];
if (Array.isArray(value)) {
roundCoordinates(value);
} else if (!isNaN(value)) {
coordinates[i] = _.round(value, DECIMAL_DEGREES_PRECISION);
}
}
}
/*
* returns Polygon geometry where coordinates define a bounding box that contains the input geometry
*/
export function getBoundingBoxGeometry(geometry) {
ensureGeometryType(geometry.type, [GEO_JSON_TYPE.POLYGON]);
const exterior = geometry.coordinates[POLYGON_COORDINATES_EXTERIOR_INDEX];
const extent = {
minLon: exterior[0][LON_INDEX],
minLat: exterior[0][LAT_INDEX],
maxLon: exterior[0][LON_INDEX],
maxLat: exterior[0][LAT_INDEX],
};
for (let i = 1; i < exterior.length; i++) {
extent.minLon = Math.min(exterior[i][LON_INDEX], extent.minLon);
extent.minLat = Math.min(exterior[i][LAT_INDEX], extent.minLat);
extent.maxLon = Math.max(exterior[i][LON_INDEX], extent.maxLon);
extent.maxLat = Math.max(exterior[i][LAT_INDEX], extent.maxLat);
}
return formatEnvelopeAsPolygon(extent);
}
export function formatEnvelopeAsPolygon({ maxLat, maxLon, minLat, minLon }) {
// GeoJSON mandates that the outer polygon must be counterclockwise to avoid ambiguous polygons
// when the shape crosses the dateline
const lonDelta = maxLon - minLon;
const left = lonDelta > 360 ? -180 : minLon;
const right = lonDelta > 360 ? 180 : maxLon;
const top = clampToLatBounds(maxLat);
const bottom = clampToLatBounds(minLat);
const topLeft = [left, top];
const bottomLeft = [left, bottom];
const bottomRight = [right, bottom];
const topRight = [right, top];
return {
type: GEO_JSON_TYPE.POLYGON,
coordinates: [[topLeft, bottomLeft, bottomRight, topRight, topLeft]],
};
}
export function clampToLatBounds(lat) {
return clamp(lat, -89, 89);
}
export function clampToLonBounds(lon) {
return clamp(lon, -180, 180);
}
export function clamp(val, min, max) {
if (val > max) {
return max;
} else if (val < min) {
return min;
} else {
return val;
}
}
export function extractFeaturesFromFilters(filters) {
const features = [];
filters
.filter((filter) => {
return filter.meta.key && filter.meta.type === SPATIAL_FILTER_TYPE;
})
.forEach((filter) => {
let geometry;
if (filter.geo_distance && filter.geo_distance[filter.meta.key]) {
const distanceSplit = filter.geo_distance.distance.split('km');
const distance = parseFloat(distanceSplit[0]);
const circleFeature = turfCircle(filter.geo_distance[filter.meta.key], distance);
geometry = circleFeature.geometry;
} else if (
filter.geo_shape &&
filter.geo_shape[filter.meta.key] &&
filter.geo_shape[filter.meta.key].shape
) {
geometry = filter.geo_shape[filter.meta.key].shape;
} else {
// do not know how to convert spatial filter to geometry
// this includes pre-indexed shapes
return;
}
features.push({
type: 'Feature',
geometry,
properties: {
filter: filter.meta.alias,
},
});
});
return features;
}
export function scaleBounds(bounds, scaleFactor) {
const width = bounds.maxLon - bounds.minLon;
const height = bounds.maxLat - bounds.minLat;
return {
minLon: bounds.minLon - width * scaleFactor,
minLat: bounds.minLat - height * scaleFactor,
maxLon: bounds.maxLon + width * scaleFactor,
maxLat: bounds.maxLat + height * scaleFactor,
};
}
export function turfBboxToBounds(turfBbox) {
return {
minLon: turfBbox[0],
minLat: turfBbox[1],
maxLon: turfBbox[2],
maxLat: turfBbox[3],
};
}
|
var core_1 = require('@angular/core');
var DimmerComponent = (function () {
function DimmerComponent(el) {
this.parentEle = el.nativeElement.parentElement;
this.dimmerCls = {
active: this.active
};
}
Object.defineProperty(DimmerComponent.prototype, "active", {
set: function (val) {
if (this.parentEle) {
if (val) {
this.parentEle.classList.add("dimmable");
this.parentEle.classList.add("dimmed");
}
else {
this.parentEle.classList.remove("dimmable");
this.parentEle.classList.remove("dimmed");
}
this.dimmerCls.active = val;
}
},
enumerable: true,
configurable: true
});
__decorate([
core_1.Input(),
__metadata('design:type', Boolean),
__metadata('design:paramtypes', [Boolean])
], DimmerComponent.prototype, "active", null);
DimmerComponent = __decorate([
core_1.Component({
selector: 'lsu-dimmer',
template: "\n <div class=\"ui dimmer\" [ngClass]=\"dimmerCls\">\n <div class=\"content\">\n <div class=\"center\">\n <ng-content></ng-content>\n </div>\n </div>\n </div>\n "
}),
__metadata('design:paramtypes', [core_1.ElementRef])
], DimmerComponent);
return DimmerComponent;
})();
exports.DimmerComponent = DimmerComponent;
//# sourceMappingURL=dimmer.js.map |
'use strict';
const api = require('../lib/TR064.js');
const axios = require('axios');
const parseString = require('xml2js').parseString;
class HostsHandler {
constructor (platform, config, device, devices, mainConfig) {
this.logger = platform.logger;
this.debug = platform.debug;
this.platform = platform;
this.config = config;
this.mainConfig = mainConfig;
this.device = device;
this.devices = devices;
this.activeDevices = [];
if(config.mesh){
this.generateHostsListURL();
} else {
this.initDevices();
}
}
//NO MESH
async initDevices(){
try {
let devices = [];
let hostLists = [];
let UserList = [];
for(const device of Object.keys(this.devices)){
if(this.devices[device].host && this.devices[device].port && this.devices[device].username && this.devices[device].password && this.devices[device].type)
devices.push({
name: device,
host: this.devices[device].host,
port: this.devices[device].port,
username: this.devices[device].username,
password: this.devices[device].password,
timeout: this.mainConfig.timeout * 1000,
type: this.devices[device].type
});
}
for(const config of devices){
if(!this.activeDevices[config.name]){
let dev = await this.generateApi(config);
this.activeDevices[config.name] = dev;
}
}
for(const activeDevice of Object.keys(this.activeDevices)){
let list = await this.getHosts(this.activeDevices[activeDevice]);
if(list)
hostLists.push(list);
}
for(const list in hostLists)
for(const user in hostLists[list])
UserList.push(hostLists[list][user]);
this.hosts = UserList;
} catch(error){
this.logger.error('Host List (no mesh): An error occured while fetching devices!');
if(error instanceof TypeError){
console.log(error);
} else {
this.debug(error);
}
} finally {
setTimeout(this.initDevices.bind(this), this.mainConfig.polling * 1000);
}
}
async generateApi(config){
try{
let TR064 = new api.TR064(config, this.logger);
TR064 = await TR064.initDevice();
let device = await TR064.startEncryptedCommunication();
return device;
} catch(error){
throw error;
}
}
async getHosts(device){
try {
let hosts = device.services['urn:dslforum-org:service:Hosts:1'];
hosts = await hosts.actions['X_AVM-DE_GetHostListPath']();
let list = await this.generateHostListNM(hosts['NewX_AVM-DE_HostListPath'], device);
return list;
} catch(error){
throw error;
}
}
async generateHostListNM(endpoint, device){
try {
let url = 'http://' + device.config.host + ':' + device.config.port + endpoint;
let hostArray = [];
let hostList = await axios(url);
let hostListXML = await this.xmlParser(hostList.data);
hostArray = hostArray.concat(hostListXML.List.Item);
return hostArray;
} catch(error){
if(error.response)
error = {
status: error.response.status,
message: error.response.statusText,
config: error.config,
data: error.response.data
};
throw error;
}
}
//MESH
async generateHostsListURL(){
try{
let hostsListURL = this.device.services['urn:dslforum-org:service:Hosts:1'];
hostsListURL = await hostsListURL.actions['X_AVM-DE_GetHostListPath']();
this.generateHostList(hostsListURL['NewX_AVM-DE_HostListPath']);
} catch(error){
this.logger.error('Host List: An error occured while getting hosts list endpoint!');
if(error instanceof TypeError){
console.log(error);
} else {
this.debug(error);
}
}
}
async generateHostList(endpoint){
try {
let url = 'http://' + this.config.host + ':' + this.config.port + endpoint;
let hostArray = [];
let hostList = await axios(url);
let hostListXML = await this.xmlParser(hostList.data);
hostArray = hostArray.concat(hostListXML.List.Item);
this.hosts = hostArray;
} catch(error){
if(error.response)
error = {
status: error.response.status,
message: error.response.statusText,
config: error.config,
data: error.response.data
};
this.logger.error('Host List: An error occured while generating host list!');
if(error instanceof TypeError){
console.log(error);
} else {
this.debug(error);
}
} finally {
setTimeout(this.generateHostsListURL.bind(this), this.platform.config.polling * 1000);
}
}
xmlParser(xml){
return new Promise((resolve, reject) => {
parseString(xml, (err, result) => err ? reject(err) : resolve(result) );
});
}
getHostList(){
return this.hosts||false;
}
}
module.exports = HostsHandler; |
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* Copyright 2012 Mozilla Foundation
* Copyright 2014 Harshavardhana <[email protected]>
*
* 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.
*/
/* globals PDFJS, PDFBug, FirefoxCom, Stats, Cache, ProgressBar,
DownloadManager, getFileName, scrollIntoView, getPDFFileNameFromURL,
PDFHistory, Preferences, SidebarView, ViewHistory, Stats,
PDFThumbnailViewer, URL, noContextMenuHandler, SecondaryToolbar,
PasswordPrompt, PresentationMode, HandTool, Promise,
DocumentProperties, PDFOutlineView, PDFAttachmentView,
OverlayManager, PDFFindController, PDFFindBar, getVisibleElements,
watchScroll, PDFViewer, PDFRenderingQueue, PresentationModeState,
RenderingStates, DEFAULT_SCALE, UNKNOWN_SCALE,
IGNORE_CURRENT_POSITION_ON_ZOOM: true */
'use strict';
var DEFAULT_URL = '';
var DEFAULT_SCALE_DELTA = 1.1;
var MIN_SCALE = 0.25;
var MAX_SCALE = 10.0;
var VIEW_HISTORY_MEMORY = 1;
var SCALE_SELECT_CONTAINER_PADDING = 8;
var SCALE_SELECT_PADDING = 22;
var PAGE_NUMBER_LOADING_INDICATOR = 'visiblePageIsLoading';
var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000;
PDFJS.imageResourcesPath = './images/';
PDFJS.workerSrc = 'pdf.worker.js';
PDFJS.cMapUrl = './cmaps';
PDFJS.cMapPacked = true;
var mozL10n = document.mozL10n || document.webL10n;
var CSS_UNITS = 96.0 / 72.0;
var DEFAULT_SCALE = 'page-fit';
var UNKNOWN_SCALE = 0;
var MAX_AUTO_SCALE = 1.25;
var SCROLLBAR_PADDING = 40;
var VERTICAL_PADDING = 5;
// optimised CSS custom property getter/setter
var CustomStyle = (function CustomStyleClosure() {
// As noted on: http://www.zachstronaut.com/posts/2009/02/17/
// animate-css-transforms-firefox-webkit.html
// in some versions of IE9 it is critical that ms appear in this list
// before Moz
var prefixes = ['ms', 'Moz', 'Webkit', 'O'];
var _cache = {};
function CustomStyle() {}
CustomStyle.getProp = function get(propName, element) {
// check cache only when no element is given
if (arguments.length === 1 && typeof _cache[propName] === 'string') {
return _cache[propName];
}
element = element || document.documentElement;
var style = element.style, prefixed, uPropName;
// test standard property first
if (typeof style[propName] === 'string') {
return (_cache[propName] = propName);
}
// capitalize
uPropName = propName.charAt(0).toUpperCase() + propName.slice(1);
// test vendor specific properties
for (var i = 0, l = prefixes.length; i < l; i++) {
prefixed = prefixes[i] + uPropName;
if (typeof style[prefixed] === 'string') {
return (_cache[propName] = prefixed);
}
}
//if all fails then set to undefined
return (_cache[propName] = 'undefined');
};
CustomStyle.setProp = function set(propName, element, str) {
var prop = this.getProp(propName);
if (prop !== 'undefined') {
element.style[prop] = str;
}
};
return CustomStyle;
})();
function getFileName(url) {
var anchor = url.indexOf('#');
var query = url.indexOf('?');
var end = Math.min(
anchor > 0 ? anchor : url.length,
query > 0 ? query : url.length);
return url.substring(url.lastIndexOf('/', end) + 1, end);
}
/**
* Returns scale factor for the canvas. It makes sense for the HiDPI displays.
* @return {Object} The object with horizontal (sx) and vertical (sy)
scales. The scaled property is set to false if scaling is
not required, true otherwise.
*/
function getOutputScale(ctx) {
var devicePixelRatio = window.devicePixelRatio || 1;
var backingStoreRatio = ctx.webkitBackingStorePixelRatio ||
ctx.mozBackingStorePixelRatio ||
ctx.msBackingStorePixelRatio ||
ctx.oBackingStorePixelRatio ||
ctx.backingStorePixelRatio || 1;
var pixelRatio = devicePixelRatio / backingStoreRatio;
return {
sx: pixelRatio,
sy: pixelRatio,
scaled: pixelRatio !== 1
};
}
/**
* Scrolls specified element into view of its parent.
* element {Object} The element to be visible.
* spot {Object} An object with optional top and left properties,
* specifying the offset from the top left edge.
*/
function scrollIntoView(element, spot) {
// Assuming offsetParent is available (it's not available when viewer is in
// hidden iframe or object). We have to scroll: if the offsetParent is not set
// producing the error. See also animationStartedClosure.
var parent = element.offsetParent;
var offsetY = element.offsetTop + element.clientTop;
var offsetX = element.offsetLeft + element.clientLeft;
if (!parent) {
console.error('offsetParent is not set -- cannot scroll');
return;
}
while (parent.clientHeight === parent.scrollHeight) {
if (parent.dataset._scaleY) {
offsetY /= parent.dataset._scaleY;
offsetX /= parent.dataset._scaleX;
}
offsetY += parent.offsetTop;
offsetX += parent.offsetLeft;
parent = parent.offsetParent;
if (!parent) {
return; // no need to scroll
}
}
if (spot) {
if (spot.top !== undefined) {
offsetY += spot.top;
}
if (spot.left !== undefined) {
offsetX += spot.left;
parent.scrollLeft = offsetX;
}
}
parent.scrollTop = offsetY;
}
/**
* Helper function to start monitoring the scroll event and converting them into
* PDF.js friendly one: with scroll debounce and scroll direction.
*/
function watchScroll(viewAreaElement, callback) {
var debounceScroll = function debounceScroll(evt) {
if (rAF) {
return;
}
// schedule an invocation of scroll for next animation frame.
rAF = window.requestAnimationFrame(function viewAreaElementScrolled() {
rAF = null;
var currentY = viewAreaElement.scrollTop;
var lastY = state.lastY;
if (currentY !== lastY) {
state.down = currentY > lastY;
}
state.lastY = currentY;
callback(state);
});
};
var state = {
down: true,
lastY: viewAreaElement.scrollTop,
_eventHandler: debounceScroll
};
var rAF = null;
viewAreaElement.addEventListener('scroll', debounceScroll, true);
return state;
}
/**
* Use binary search to find the index of the first item in a given array which
* passes a given condition. The items are expected to be sorted in the sense
* that if the condition is true for one item in the array, then it is also true
* for all following items.
*
* @returns {Number} Index of the first array element to pass the test,
* or |items.length| if no such element exists.
*/
function binarySearchFirstItem(items, condition) {
var minIndex = 0;
var maxIndex = items.length - 1;
if (items.length === 0 || !condition(items[maxIndex])) {
return items.length;
}
if (condition(items[minIndex])) {
return minIndex;
}
while (minIndex < maxIndex) {
var currentIndex = (minIndex + maxIndex) >> 1;
var currentItem = items[currentIndex];
if (condition(currentItem)) {
maxIndex = currentIndex;
} else {
minIndex = currentIndex + 1;
}
}
return minIndex; /* === maxIndex */
}
/**
* Generic helper to find out what elements are visible within a scroll pane.
*/
function getVisibleElements(scrollEl, views, sortByVisibility) {
var top = scrollEl.scrollTop, bottom = top + scrollEl.clientHeight;
var left = scrollEl.scrollLeft, right = left + scrollEl.clientWidth;
function isElementBottomBelowViewTop(view) {
var element = view.div;
var elementBottom =
element.offsetTop + element.clientTop + element.clientHeight;
return elementBottom > top;
}
var visible = [], view, element;
var currentHeight, viewHeight, hiddenHeight, percentHeight;
var currentWidth, viewWidth;
var firstVisibleElementInd = (views.length === 0) ? 0 :
binarySearchFirstItem(views, isElementBottomBelowViewTop);
for (var i = firstVisibleElementInd, ii = views.length; i < ii; i++) {
view = views[i];
element = view.div;
currentHeight = element.offsetTop + element.clientTop;
viewHeight = element.clientHeight;
if (currentHeight > bottom) {
break;
}
currentWidth = element.offsetLeft + element.clientLeft;
viewWidth = element.clientWidth;
if (currentWidth + viewWidth < left || currentWidth > right) {
continue;
}
hiddenHeight = Math.max(0, top - currentHeight) +
Math.max(0, currentHeight + viewHeight - bottom);
percentHeight = ((viewHeight - hiddenHeight) * 100 / viewHeight) | 0;
visible.push({
id: view.id,
x: currentWidth,
y: currentHeight,
view: view,
percent: percentHeight
});
}
var first = visible[0];
var last = visible[visible.length - 1];
if (sortByVisibility) {
visible.sort(function(a, b) {
var pc = a.percent - b.percent;
if (Math.abs(pc) > 0.001) {
return -pc;
}
return a.id - b.id; // ensure stability
});
}
return {first: first, last: last, views: visible};
}
/**
* Event handler to suppress context menu.
*/
function noContextMenuHandler(e) {
e.preventDefault();
}
/**
* Returns the filename or guessed filename from the url (see issue 3455).
* url {String} The original PDF location.
* @return {String} Guessed PDF file name.
*/
function getPDFFileNameFromURL(url) {
var reURI = /^(?:([^:]+:)?\/\/[^\/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/;
// SCHEME HOST 1.PATH 2.QUERY 3.REF
// Pattern to get last matching NAME.pdf
var reFilename = /[^\/?#=]+\.pdf\b(?!.*\.pdf\b)/i;
var splitURI = reURI.exec(url);
var suggestedFilename = reFilename.exec(splitURI[1]) ||
reFilename.exec(splitURI[2]) ||
reFilename.exec(splitURI[3]);
if (suggestedFilename) {
suggestedFilename = suggestedFilename[0];
if (suggestedFilename.indexOf('%') !== -1) {
// URL-encoded %2Fpath%2Fto%2Ffile.pdf should be file.pdf
try {
suggestedFilename =
reFilename.exec(decodeURIComponent(suggestedFilename))[0];
} catch(e) { // Possible (extremely rare) errors:
// URIError "Malformed URI", e.g. for "%AA.pdf"
// TypeError "null has no properties", e.g. for "%2F.pdf"
}
}
}
return suggestedFilename || 'document.pdf';
}
var ProgressBar = (function ProgressBarClosure() {
function clamp(v, min, max) {
return Math.min(Math.max(v, min), max);
}
function ProgressBar(id, opts) {
this.visible = true;
// Fetch the sub-elements for later.
this.div = document.querySelector(id + ' .progress');
// Get the loading bar element, so it can be resized to fit the viewer.
this.bar = this.div.parentNode;
// Get options, with sensible defaults.
this.height = opts.height || 100;
this.width = opts.width || 100;
this.units = opts.units || '%';
// Initialize heights.
this.div.style.height = this.height + this.units;
this.percent = 0;
}
ProgressBar.prototype = {
updateBar: function ProgressBar_updateBar() {
if (this._indeterminate) {
this.div.classList.add('indeterminate');
this.div.style.width = this.width + this.units;
return;
}
this.div.classList.remove('indeterminate');
var progressSize = this.width * this._percent / 100;
this.div.style.width = progressSize + this.units;
},
get percent() {
return this._percent;
},
set percent(val) {
this._indeterminate = isNaN(val);
this._percent = clamp(val, 0, 100);
this.updateBar();
},
setWidth: function ProgressBar_setWidth(viewer) {
if (viewer) {
var container = viewer.parentNode;
var scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
if (scrollbarWidth > 0) {
this.bar.setAttribute('style', 'width: calc(100% - ' +
scrollbarWidth + 'px);');
}
}
},
hide: function ProgressBar_hide() {
if (!this.visible) {
return;
}
this.visible = false;
this.bar.classList.add('hidden');
document.body.classList.remove('loadingInProgress');
},
show: function ProgressBar_show() {
if (this.visible) {
return;
}
this.visible = true;
document.body.classList.add('loadingInProgress');
this.bar.classList.remove('hidden');
}
};
return ProgressBar;
})();
var DEFAULT_PREFERENCES = {
showPreviousViewOnLoad: true,
defaultZoomValue: '',
sidebarViewOnLoad: 0,
enableHandToolOnLoad: false,
enableWebGL: false,
pdfBugEnabled: false,
disableRange: false,
disableStream: false,
disableAutoFetch: false,
disableFontFace: false,
disableTextLayer: false,
useOnlyCssZoom: false
};
var SidebarView = {
NONE: 0,
THUMBS: 1,
OUTLINE: 2,
ATTACHMENTS: 3
};
/**
* Preferences - Utility for storing persistent settings.
* Used for settings that should be applied to all opened documents,
* or every time the viewer is loaded.
*/
var Preferences = {
prefs: Object.create(DEFAULT_PREFERENCES),
isInitializedPromiseResolved: false,
initializedPromise: null,
/**
* Initialize and fetch the current preference values from storage.
* @return {Promise} A promise that is resolved when the preferences
* have been initialized.
*/
initialize: function preferencesInitialize() {
return this.initializedPromise =
this._readFromStorage(DEFAULT_PREFERENCES).then(function(prefObj) {
this.isInitializedPromiseResolved = true;
if (prefObj) {
this.prefs = prefObj;
}
}.bind(this));
},
/**
* Stub function for writing preferences to storage.
* NOTE: This should be overridden by a build-specific function defined below.
* @param {Object} prefObj The preferences that should be written to storage.
* @return {Promise} A promise that is resolved when the preference values
* have been written.
*/
_writeToStorage: function preferences_writeToStorage(prefObj) {
return Promise.resolve();
},
/**
* Stub function for reading preferences from storage.
* NOTE: This should be overridden by a build-specific function defined below.
* @param {Object} prefObj The preferences that should be read from storage.
* @return {Promise} A promise that is resolved with an {Object} containing
* the preferences that have been read.
*/
_readFromStorage: function preferences_readFromStorage(prefObj) {
return Promise.resolve();
},
/**
* Reset the preferences to their default values and update storage.
* @return {Promise} A promise that is resolved when the preference values
* have been reset.
*/
reset: function preferencesReset() {
return this.initializedPromise.then(function() {
this.prefs = Object.create(DEFAULT_PREFERENCES);
return this._writeToStorage(DEFAULT_PREFERENCES);
}.bind(this));
},
/**
* Replace the current preference values with the ones from storage.
* @return {Promise} A promise that is resolved when the preference values
* have been updated.
*/
reload: function preferencesReload() {
return this.initializedPromise.then(function () {
this._readFromStorage(DEFAULT_PREFERENCES).then(function(prefObj) {
if (prefObj) {
this.prefs = prefObj;
}
}.bind(this));
}.bind(this));
},
/**
* Set the value of a preference.
* @param {string} name The name of the preference that should be changed.
* @param {boolean|number|string} value The new value of the preference.
* @return {Promise} A promise that is resolved when the value has been set,
* provided that the preference exists and the types match.
*/
set: function preferencesSet(name, value) {
return this.initializedPromise.then(function () {
if (DEFAULT_PREFERENCES[name] === undefined) {
throw new Error('preferencesSet: \'' + name + '\' is undefined.');
} else if (value === undefined) {
throw new Error('preferencesSet: no value is specified.');
}
var valueType = typeof value;
var defaultType = typeof DEFAULT_PREFERENCES[name];
if (valueType !== defaultType) {
if (valueType === 'number' && defaultType === 'string') {
value = value.toString();
} else {
throw new Error('Preferences_set: \'' + value + '\' is a \"' +
valueType + '\", expected \"' + defaultType + '\".');
}
} else {
if (valueType === 'number' && (value | 0) !== value) {
throw new Error('Preferences_set: \'' + value +
'\' must be an \"integer\".');
}
}
this.prefs[name] = value;
return this._writeToStorage(this.prefs);
}.bind(this));
},
/**
* Get the value of a preference.
* @param {string} name The name of the preference whose value is requested.
* @return {Promise} A promise that is resolved with a {boolean|number|string}
* containing the value of the preference.
*/
get: function preferencesGet(name) {
return this.initializedPromise.then(function () {
var defaultValue = DEFAULT_PREFERENCES[name];
if (defaultValue === undefined) {
throw new Error('preferencesGet: \'' + name + '\' is undefined.');
} else {
var prefValue = this.prefs[name];
if (prefValue !== undefined) {
return prefValue;
}
}
return defaultValue;
}.bind(this));
}
};
Preferences._writeToStorage = function (prefObj) {
return new Promise(function (resolve) {
localStorage.setItem('pdfjs.preferences', JSON.stringify(prefObj));
resolve();
});
};
Preferences._readFromStorage = function (prefObj) {
return new Promise(function (resolve) {
var readPrefs = JSON.parse(localStorage.getItem('pdfjs.preferences'));
resolve(readPrefs);
});
};
(function mozPrintCallbackPolyfillClosure() {
if ('mozPrintCallback' in document.createElement('canvas')) {
return;
}
// Cause positive result on feature-detection:
HTMLCanvasElement.prototype.mozPrintCallback = undefined;
var canvases; // During print task: non-live NodeList of <canvas> elements
var index; // Index of <canvas> element that is being processed
var print = window.print;
window.print = function print() {
if (canvases) {
console.warn('Ignored window.print() because of a pending print job.');
return;
}
try {
dispatchEvent('beforeprint');
} finally {
canvases = document.querySelectorAll('canvas');
index = -1;
next();
}
};
function dispatchEvent(eventType) {
var event = document.createEvent('CustomEvent');
event.initCustomEvent(eventType, false, false, 'custom');
window.dispatchEvent(event);
}
function next() {
if (!canvases) {
return; // Print task cancelled by user (state reset in abort())
}
renderProgress();
if (++index < canvases.length) {
var canvas = canvases[index];
if (typeof canvas.mozPrintCallback === 'function') {
canvas.mozPrintCallback({
context: canvas.getContext('2d'),
abort: abort,
done: next
});
} else {
next();
}
} else {
renderProgress();
print.call(window);
setTimeout(abort, 20); // Tidy-up
}
}
function abort() {
if (canvases) {
canvases = null;
renderProgress();
dispatchEvent('afterprint');
}
}
function renderProgress() {
var progressContainer = document.getElementById('mozPrintCallback-shim');
if (canvases) {
var progress = Math.round(100 * index / canvases.length);
var progressBar = progressContainer.querySelector('progress');
var progressPerc = progressContainer.querySelector('.relative-progress');
progressBar.value = progress;
progressPerc.textContent = progress + '%';
progressContainer.removeAttribute('hidden');
progressContainer.onclick = abort;
} else {
progressContainer.setAttribute('hidden', '');
}
}
var hasAttachEvent = !!document.attachEvent;
window.addEventListener('keydown', function(event) {
// Intercept Cmd/Ctrl + P in all browsers.
// Also intercept Cmd/Ctrl + Shift + P in Chrome and Opera
if (event.keyCode === 80 /*P*/ && (event.ctrlKey || event.metaKey) &&
!event.altKey && (!event.shiftKey || window.chrome || window.opera)) {
window.print();
if (hasAttachEvent) {
// Only attachEvent can cancel Ctrl + P dialog in IE <=10
// attachEvent is gone in IE11, so the dialog will re-appear in IE11.
return;
}
event.preventDefault();
if (event.stopImmediatePropagation) {
event.stopImmediatePropagation();
} else {
event.stopPropagation();
}
return;
}
if (event.keyCode === 27 && canvases) { // Esc
abort();
}
}, true);
if (hasAttachEvent) {
document.attachEvent('onkeydown', function(event) {
event = event || window.event;
if (event.keyCode === 80 /*P*/ && event.ctrlKey) {
event.keyCode = 0;
return false;
}
});
}
if ('onbeforeprint' in window) {
// Do not propagate before/afterprint events when they are not triggered
// from within this polyfill. (FF/IE).
var stopPropagationIfNeeded = function(event) {
if (event.detail !== 'custom' && event.stopImmediatePropagation) {
event.stopImmediatePropagation();
}
};
window.addEventListener('beforeprint', stopPropagationIfNeeded, false);
window.addEventListener('afterprint', stopPropagationIfNeeded, false);
}
})();
var DownloadManager = (function DownloadManagerClosure() {
function download(blobUrl, filename) {
var a = document.createElement('a');
if (a.click) {
// Use a.click() if available. Otherwise, Chrome might show
// "Unsafe JavaScript attempt to initiate a navigation change
// for frame with URL" and not open the PDF at all.
// Supported by (not mentioned = untested):
// - Firefox 6 - 19 (4- does not support a.click, 5 ignores a.click)
// - Chrome 19 - 26 (18- does not support a.click)
// - Opera 9 - 12.15
// - Internet Explorer 6 - 10
// - Safari 6 (5.1- does not support a.click)
a.href = blobUrl;
a.target = '_parent';
// Use a.download if available. This increases the likelihood that
// the file is downloaded instead of opened by another PDF plugin.
if ('download' in a) {
a.download = filename;
}
// <a> must be in the document for IE and recent Firefox versions.
// (otherwise .click() is ignored)
(document.body || document.documentElement).appendChild(a);
a.click();
a.parentNode.removeChild(a);
} else {
if (window.top === window &&
blobUrl.split('#')[0] === window.location.href.split('#')[0]) {
// If _parent == self, then opening an identical URL with different
// location hash will only cause a navigation, not a download.
var padCharacter = blobUrl.indexOf('?') === -1 ? '?' : '&';
blobUrl = blobUrl.replace(/#|$/, padCharacter + '$&');
}
window.open(blobUrl, '_parent');
}
}
function DownloadManager() {}
DownloadManager.prototype = {
downloadUrl: function DownloadManager_downloadUrl(url, filename) {
if (!PDFJS.isValidUrl(url, true)) {
return; // restricted/invalid URL
}
download(url + '#pdfjs.action=download', filename);
},
downloadData: function DownloadManager_downloadData(data, filename,
contentType) {
if (navigator.msSaveBlob) { // IE10 and above
return navigator.msSaveBlob(new Blob([data], { type: contentType }),
filename);
}
var blobUrl = PDFJS.createObjectURL(data, contentType);
download(blobUrl, filename);
},
download: function DownloadManager_download(blob, url, filename) {
if (!URL) {
// URL.createObjectURL is not supported
this.downloadUrl(url, filename);
return;
}
if (navigator.msSaveBlob) {
// IE10 / IE11
if (!navigator.msSaveBlob(blob, filename)) {
this.downloadUrl(url, filename);
}
return;
}
var blobUrl = URL.createObjectURL(blob);
download(blobUrl, filename);
}
};
return DownloadManager;
})();
/**
* View History - This is a utility for saving various view parameters for
* recently opened files.
*
* The way that the view parameters are stored depends on how PDF.js is built,
* for 'node make <flag>' the following cases exist:
* - FIREFOX or MOZCENTRAL - uses sessionStorage.
* - B2G - uses asyncStorage.
* - GENERIC or CHROME - uses localStorage, if it is available.
*/
var ViewHistory = (function ViewHistoryClosure() {
function ViewHistory(fingerprint) {
this.fingerprint = fingerprint;
this.isInitializedPromiseResolved = false;
this.initializedPromise =
this._readFromStorage().then(function (databaseStr) {
this.isInitializedPromiseResolved = true;
var database = JSON.parse(databaseStr || '{}');
if (!('files' in database)) {
database.files = [];
}
if (database.files.length >= VIEW_HISTORY_MEMORY) {
database.files.shift();
}
var index;
for (var i = 0, length = database.files.length; i < length; i++) {
var branch = database.files[i];
if (branch.fingerprint === this.fingerprint) {
index = i;
break;
}
}
if (typeof index !== 'number') {
index = database.files.push({fingerprint: this.fingerprint}) - 1;
}
this.file = database.files[index];
this.database = database;
}.bind(this));
}
ViewHistory.prototype = {
_writeToStorage: function ViewHistory_writeToStorage() {
return new Promise(function (resolve) {
var databaseStr = JSON.stringify(this.database);
localStorage.setItem('database', databaseStr);
resolve();
}.bind(this));
},
_readFromStorage: function ViewHistory_readFromStorage() {
return new Promise(function (resolve) {
resolve(localStorage.getItem('database'));
});
},
set: function ViewHistory_set(name, val) {
if (!this.isInitializedPromiseResolved) {
return;
}
this.file[name] = val;
return this._writeToStorage();
},
setMultiple: function ViewHistory_setMultiple(properties) {
if (!this.isInitializedPromiseResolved) {
return;
}
for (var name in properties) {
this.file[name] = properties[name];
}
return this._writeToStorage();
},
get: function ViewHistory_get(name, defaultValue) {
if (!this.isInitializedPromiseResolved) {
return defaultValue;
}
return this.file[name] || defaultValue;
}
};
return ViewHistory;
})();
/**
* Creates a "search bar" given a set of DOM elements that act as controls
* for searching or for setting search preferences in the UI. This object
* also sets up the appropriate events for the controls. Actual searching
* is done by PDFFindController.
*/
var PDFFindBar = (function PDFFindBarClosure() {
function PDFFindBar(options) {
this.opened = false;
this.bar = options.bar || null;
this.toggleButton = options.toggleButton || null;
this.findField = options.findField || null;
this.highlightAll = options.highlightAllCheckbox || null;
this.caseSensitive = options.caseSensitiveCheckbox || null;
this.findMsg = options.findMsg || null;
this.findStatusIcon = options.findStatusIcon || null;
this.findPreviousButton = options.findPreviousButton || null;
this.findNextButton = options.findNextButton || null;
this.findController = options.findController || null;
if (this.findController === null) {
throw new Error('PDFFindBar cannot be used without a ' +
'PDFFindController instance.');
}
// Add event listeners to the DOM elements.
var self = this;
this.toggleButton.addEventListener('click', function() {
self.toggle();
});
this.findField.addEventListener('input', function() {
self.dispatchEvent('');
});
this.bar.addEventListener('keydown', function(evt) {
switch (evt.keyCode) {
case 13: // Enter
if (evt.target === self.findField) {
self.dispatchEvent('again', evt.shiftKey);
}
break;
case 27: // Escape
self.close();
break;
}
});
this.findPreviousButton.addEventListener('click', function() {
self.dispatchEvent('again', true);
});
this.findNextButton.addEventListener('click', function() {
self.dispatchEvent('again', false);
});
this.highlightAll.addEventListener('click', function() {
self.dispatchEvent('highlightallchange');
});
this.caseSensitive.addEventListener('click', function() {
self.dispatchEvent('casesensitivitychange');
});
}
PDFFindBar.prototype = {
dispatchEvent: function PDFFindBar_dispatchEvent(type, findPrev) {
var event = document.createEvent('CustomEvent');
event.initCustomEvent('find' + type, true, true, {
query: this.findField.value,
caseSensitive: this.caseSensitive.checked,
highlightAll: this.highlightAll.checked,
findPrevious: findPrev
});
return window.dispatchEvent(event);
},
updateUIState: function PDFFindBar_updateUIState(state, previous) {
var notFound = false;
var findMsg = '';
var status = '';
switch (state) {
case FindStates.FIND_FOUND:
break;
case FindStates.FIND_PENDING:
status = 'pending';
break;
case FindStates.FIND_NOTFOUND:
findMsg = mozL10n.get('find_not_found', null, 'Phrase not found');
notFound = true;
break;
case FindStates.FIND_WRAPPED:
if (previous) {
findMsg = mozL10n.get('find_reached_top', null,
'Reached top of document, continued from bottom');
} else {
findMsg = mozL10n.get('find_reached_bottom', null,
'Reached end of document, continued from top');
}
break;
}
if (notFound) {
this.findField.classList.add('notFound');
} else {
this.findField.classList.remove('notFound');
}
this.findField.setAttribute('data-status', status);
this.findMsg.textContent = findMsg;
},
open: function PDFFindBar_open() {
if (!this.opened) {
this.opened = true;
this.toggleButton.classList.add('toggled');
this.bar.classList.remove('hidden');
}
this.findField.select();
this.findField.focus();
},
close: function PDFFindBar_close() {
if (!this.opened) {
return;
}
this.opened = false;
this.toggleButton.classList.remove('toggled');
this.bar.classList.add('hidden');
this.findController.active = false;
},
toggle: function PDFFindBar_toggle() {
if (this.opened) {
this.close();
} else {
this.open();
}
}
};
return PDFFindBar;
})();
var FindStates = {
FIND_FOUND: 0,
FIND_NOTFOUND: 1,
FIND_WRAPPED: 2,
FIND_PENDING: 3
};
var FIND_SCROLL_OFFSET_TOP = -50;
var FIND_SCROLL_OFFSET_LEFT = -400;
/**
* Provides "search" or "find" functionality for the PDF.
* This object actually performs the search for a given string.
*/
var PDFFindController = (function PDFFindControllerClosure() {
function PDFFindController(options) {
this.startedTextExtraction = false;
this.extractTextPromises = [];
this.pendingFindMatches = {};
this.active = false; // If active, find results will be highlighted.
this.pageContents = []; // Stores the text for each page.
this.pageMatches = [];
this.selected = { // Currently selected match.
pageIdx: -1,
matchIdx: -1
};
this.offset = { // Where the find algorithm currently is in the document.
pageIdx: null,
matchIdx: null
};
this.pagesToSearch = null;
this.resumePageIdx = null;
this.state = null;
this.dirtyMatch = false;
this.findTimeout = null;
this.pdfViewer = options.pdfViewer || null;
this.integratedFind = options.integratedFind || false;
this.charactersToNormalize = {
'\u2018': '\'', // Left single quotation mark
'\u2019': '\'', // Right single quotation mark
'\u201A': '\'', // Single low-9 quotation mark
'\u201B': '\'', // Single high-reversed-9 quotation mark
'\u201C': '"', // Left double quotation mark
'\u201D': '"', // Right double quotation mark
'\u201E': '"', // Double low-9 quotation mark
'\u201F': '"', // Double high-reversed-9 quotation mark
'\u00BC': '1/4', // Vulgar fraction one quarter
'\u00BD': '1/2', // Vulgar fraction one half
'\u00BE': '3/4', // Vulgar fraction three quarters
'\u00A0': ' ' // No-break space
};
this.findBar = options.findBar || null;
// Compile the regular expression for text normalization once
var replace = Object.keys(this.charactersToNormalize).join('');
this.normalizationRegex = new RegExp('[' + replace + ']', 'g');
var events = [
'find',
'findagain',
'findhighlightallchange',
'findcasesensitivitychange'
];
this.firstPagePromise = new Promise(function (resolve) {
this.resolveFirstPage = resolve;
}.bind(this));
this.handleEvent = this.handleEvent.bind(this);
for (var i = 0, len = events.length; i < len; i++) {
window.addEventListener(events[i], this.handleEvent);
}
}
PDFFindController.prototype = {
setFindBar: function PDFFindController_setFindBar(findBar) {
this.findBar = findBar;
},
reset: function PDFFindController_reset() {
this.startedTextExtraction = false;
this.extractTextPromises = [];
this.active = false;
},
normalize: function PDFFindController_normalize(text) {
var self = this;
return text.replace(this.normalizationRegex, function (ch) {
return self.charactersToNormalize[ch];
});
},
calcFindMatch: function PDFFindController_calcFindMatch(pageIndex) {
var pageContent = this.normalize(this.pageContents[pageIndex]);
var query = this.normalize(this.state.query);
var caseSensitive = this.state.caseSensitive;
var queryLen = query.length;
if (queryLen === 0) {
return; // Do nothing: the matches should be wiped out already.
}
if (!caseSensitive) {
pageContent = pageContent.toLowerCase();
query = query.toLowerCase();
}
var matches = [];
var matchIdx = -queryLen;
while (true) {
matchIdx = pageContent.indexOf(query, matchIdx + queryLen);
if (matchIdx === -1) {
break;
}
matches.push(matchIdx);
}
this.pageMatches[pageIndex] = matches;
this.updatePage(pageIndex);
if (this.resumePageIdx === pageIndex) {
this.resumePageIdx = null;
this.nextPageMatch();
}
},
extractText: function PDFFindController_extractText() {
if (this.startedTextExtraction) {
return;
}
this.startedTextExtraction = true;
this.pageContents = [];
var extractTextPromisesResolves = [];
var numPages = this.pdfViewer.pagesCount;
for (var i = 0; i < numPages; i++) {
this.extractTextPromises.push(new Promise(function (resolve) {
extractTextPromisesResolves.push(resolve);
}));
}
var self = this;
function extractPageText(pageIndex) {
self.pdfViewer.getPageTextContent(pageIndex).then(
function textContentResolved(textContent) {
var textItems = textContent.items;
var str = [];
for (var i = 0, len = textItems.length; i < len; i++) {
str.push(textItems[i].str);
}
// Store the pageContent as a string.
self.pageContents.push(str.join(''));
extractTextPromisesResolves[pageIndex](pageIndex);
if ((pageIndex + 1) < self.pdfViewer.pagesCount) {
extractPageText(pageIndex + 1);
}
}
);
}
extractPageText(0);
},
handleEvent: function PDFFindController_handleEvent(e) {
if (this.state === null || e.type !== 'findagain') {
this.dirtyMatch = true;
}
this.state = e.detail;
this.updateUIState(FindStates.FIND_PENDING);
this.firstPagePromise.then(function() {
this.extractText();
clearTimeout(this.findTimeout);
if (e.type === 'find') {
// Only trigger the find action after 250ms of silence.
this.findTimeout = setTimeout(this.nextMatch.bind(this), 250);
} else {
this.nextMatch();
}
}.bind(this));
},
updatePage: function PDFFindController_updatePage(index) {
if (this.selected.pageIdx === index) {
// If the page is selected, scroll the page into view, which triggers
// rendering the page, which adds the textLayer. Once the textLayer is
// build, it will scroll onto the selected match.
this.pdfViewer.scrollPageIntoView(index + 1);
}
var page = this.pdfViewer.getPageView(index);
if (page.textLayer) {
page.textLayer.updateMatches();
}
},
nextMatch: function PDFFindController_nextMatch() {
var previous = this.state.findPrevious;
var currentPageIndex = this.pdfViewer.currentPageNumber - 1;
var numPages = this.pdfViewer.pagesCount;
this.active = true;
if (this.dirtyMatch) {
// Need to recalculate the matches, reset everything.
this.dirtyMatch = false;
this.selected.pageIdx = this.selected.matchIdx = -1;
this.offset.pageIdx = currentPageIndex;
this.offset.matchIdx = null;
this.hadMatch = false;
this.resumePageIdx = null;
this.pageMatches = [];
var self = this;
for (var i = 0; i < numPages; i++) {
// Wipe out any previous highlighted matches.
this.updatePage(i);
// As soon as the text is extracted start finding the matches.
if (!(i in this.pendingFindMatches)) {
this.pendingFindMatches[i] = true;
this.extractTextPromises[i].then(function(pageIdx) {
delete self.pendingFindMatches[pageIdx];
self.calcFindMatch(pageIdx);
});
}
}
}
// If there's no query there's no point in searching.
if (this.state.query === '') {
this.updateUIState(FindStates.FIND_FOUND);
return;
}
// If we're waiting on a page, we return since we can't do anything else.
if (this.resumePageIdx) {
return;
}
var offset = this.offset;
// Keep track of how many pages we should maximally iterate through.
this.pagesToSearch = numPages;
// If there's already a matchIdx that means we are iterating through a
// page's matches.
if (offset.matchIdx !== null) {
var numPageMatches = this.pageMatches[offset.pageIdx].length;
if ((!previous && offset.matchIdx + 1 < numPageMatches) ||
(previous && offset.matchIdx > 0)) {
// The simple case; we just have advance the matchIdx to select
// the next match on the page.
this.hadMatch = true;
offset.matchIdx = (previous ? offset.matchIdx - 1 :
offset.matchIdx + 1);
this.updateMatch(true);
return;
}
// We went beyond the current page's matches, so we advance to
// the next page.
this.advanceOffsetPage(previous);
}
// Start searching through the page.
this.nextPageMatch();
},
matchesReady: function PDFFindController_matchesReady(matches) {
var offset = this.offset;
var numMatches = matches.length;
var previous = this.state.findPrevious;
if (numMatches) {
// There were matches for the page, so initialize the matchIdx.
this.hadMatch = true;
offset.matchIdx = (previous ? numMatches - 1 : 0);
this.updateMatch(true);
return true;
} else {
// No matches, so attempt to search the next page.
this.advanceOffsetPage(previous);
if (offset.wrapped) {
offset.matchIdx = null;
if (this.pagesToSearch < 0) {
// No point in wrapping again, there were no matches.
this.updateMatch(false);
// while matches were not found, searching for a page
// with matches should nevertheless halt.
return true;
}
}
// Matches were not found (and searching is not done).
return false;
}
},
/**
* The method is called back from the text layer when match presentation
* is updated.
* @param {number} pageIndex - page index.
* @param {number} index - match index.
* @param {Array} elements - text layer div elements array.
* @param {number} beginIdx - start index of the div array for the match.
* @param {number} endIdx - end index of the div array for the match.
*/
updateMatchPosition: function PDFFindController_updateMatchPosition(
pageIndex, index, elements, beginIdx, endIdx) {
if (this.selected.matchIdx === index &&
this.selected.pageIdx === pageIndex) {
scrollIntoView(elements[beginIdx], {
top: FIND_SCROLL_OFFSET_TOP,
left: FIND_SCROLL_OFFSET_LEFT
});
}
},
nextPageMatch: function PDFFindController_nextPageMatch() {
if (this.resumePageIdx !== null) {
console.error('There can only be one pending page.');
}
do {
var pageIdx = this.offset.pageIdx;
var matches = this.pageMatches[pageIdx];
if (!matches) {
// The matches don't exist yet for processing by "matchesReady",
// so set a resume point for when they do exist.
this.resumePageIdx = pageIdx;
break;
}
} while (!this.matchesReady(matches));
},
advanceOffsetPage: function PDFFindController_advanceOffsetPage(previous) {
var offset = this.offset;
var numPages = this.extractTextPromises.length;
offset.pageIdx = (previous ? offset.pageIdx - 1 : offset.pageIdx + 1);
offset.matchIdx = null;
this.pagesToSearch--;
if (offset.pageIdx >= numPages || offset.pageIdx < 0) {
offset.pageIdx = (previous ? numPages - 1 : 0);
offset.wrapped = true;
}
},
updateMatch: function PDFFindController_updateMatch(found) {
var state = FindStates.FIND_NOTFOUND;
var wrapped = this.offset.wrapped;
this.offset.wrapped = false;
if (found) {
var previousPage = this.selected.pageIdx;
this.selected.pageIdx = this.offset.pageIdx;
this.selected.matchIdx = this.offset.matchIdx;
state = (wrapped ? FindStates.FIND_WRAPPED : FindStates.FIND_FOUND);
// Update the currently selected page to wipe out any selected matches.
if (previousPage !== -1 && previousPage !== this.selected.pageIdx) {
this.updatePage(previousPage);
}
}
this.updateUIState(state, this.state.findPrevious);
if (this.selected.pageIdx !== -1) {
this.updatePage(this.selected.pageIdx);
}
},
updateUIState: function PDFFindController_updateUIState(state, previous) {
if (this.integratedFind) {
FirefoxCom.request('updateFindControlState',
{ result: state, findPrevious: previous });
return;
}
if (this.findBar === null) {
throw new Error('PDFFindController is not initialized with a ' +
'PDFFindBar instance.');
}
this.findBar.updateUIState(state, previous);
}
};
return PDFFindController;
})();
var PDFHistory = {
initialized: false,
initialDestination: null,
/**
* @param {string} fingerprint
* @param {IPDFLinkService} linkService
*/
initialize: function pdfHistoryInitialize(fingerprint, linkService) {
this.initialized = true;
this.reInitialized = false;
this.allowHashChange = true;
this.historyUnlocked = true;
this.previousHash = window.location.hash.substring(1);
this.currentBookmark = '';
this.currentPage = 0;
this.updatePreviousBookmark = false;
this.previousBookmark = '';
this.previousPage = 0;
this.nextHashParam = '';
this.fingerprint = fingerprint;
this.linkService = linkService;
this.currentUid = this.uid = 0;
this.current = {};
var state = window.history.state;
if (this._isStateObjectDefined(state)) {
// This corresponds to navigating back to the document
// from another page in the browser history.
if (state.target.dest) {
this.initialDestination = state.target.dest;
} else {
linkService.setHash(state.target.hash);
}
this.currentUid = state.uid;
this.uid = state.uid + 1;
this.current = state.target;
} else {
// This corresponds to the loading of a new document.
if (state && state.fingerprint &&
this.fingerprint !== state.fingerprint) {
// Reinitialize the browsing history when a new document
// is opened in the web viewer.
this.reInitialized = true;
}
this._pushOrReplaceState({ fingerprint: this.fingerprint }, true);
}
var self = this;
window.addEventListener('popstate', function pdfHistoryPopstate(evt) {
evt.preventDefault();
evt.stopPropagation();
if (!self.historyUnlocked) {
return;
}
if (evt.state) {
// Move back/forward in the history.
self._goTo(evt.state);
} else {
// Handle the user modifying the hash of a loaded document.
self.previousHash = window.location.hash.substring(1);
// If the history is empty when the hash changes,
// update the previous entry in the browser history.
if (self.uid === 0) {
var previousParams = (self.previousHash && self.currentBookmark &&
self.previousHash !== self.currentBookmark) ?
{ hash: self.currentBookmark, page: self.currentPage } :
{ page: 1 };
self.historyUnlocked = false;
self.allowHashChange = false;
window.history.back();
self._pushToHistory(previousParams, false, true);
window.history.forward();
self.historyUnlocked = true;
}
self._pushToHistory({ hash: self.previousHash }, false, true);
self._updatePreviousBookmark();
}
}, false);
function pdfHistoryBeforeUnload() {
var previousParams = self._getPreviousParams(null, true);
if (previousParams) {
var replacePrevious = (!self.current.dest &&
self.current.hash !== self.previousHash);
self._pushToHistory(previousParams, false, replacePrevious);
self._updatePreviousBookmark();
}
// Remove the event listener when navigating away from the document,
// since 'beforeunload' prevents Firefox from caching the document.
window.removeEventListener('beforeunload', pdfHistoryBeforeUnload, false);
}
window.addEventListener('beforeunload', pdfHistoryBeforeUnload, false);
window.addEventListener('pageshow', function pdfHistoryPageShow(evt) {
// If the entire viewer (including the PDF file) is cached in the browser,
// we need to reattach the 'beforeunload' event listener since
// the 'DOMContentLoaded' event is not fired on 'pageshow'.
window.addEventListener('beforeunload', pdfHistoryBeforeUnload, false);
}, false);
},
_isStateObjectDefined: function pdfHistory_isStateObjectDefined(state) {
return (state && state.uid >= 0 &&
state.fingerprint && this.fingerprint === state.fingerprint &&
state.target && state.target.hash) ? true : false;
},
_pushOrReplaceState: function pdfHistory_pushOrReplaceState(stateObj,
replace) {
if (replace) {
window.history.replaceState(stateObj, '', document.URL);
} else {
window.history.pushState(stateObj, '', document.URL);
}
},
get isHashChangeUnlocked() {
if (!this.initialized) {
return true;
}
// If the current hash changes when moving back/forward in the history,
// this will trigger a 'popstate' event *as well* as a 'hashchange' event.
// Since the hash generally won't correspond to the exact the position
// stored in the history's state object, triggering the 'hashchange' event
// can thus corrupt the browser history.
//
// When the hash changes during a 'popstate' event, we *only* prevent the
// first 'hashchange' event and immediately reset allowHashChange.
// If it is not reset, the user would not be able to change the hash.
var temp = this.allowHashChange;
this.allowHashChange = true;
return temp;
},
_updatePreviousBookmark: function pdfHistory_updatePreviousBookmark() {
if (this.updatePreviousBookmark &&
this.currentBookmark && this.currentPage) {
this.previousBookmark = this.currentBookmark;
this.previousPage = this.currentPage;
this.updatePreviousBookmark = false;
}
},
updateCurrentBookmark: function pdfHistoryUpdateCurrentBookmark(bookmark,
pageNum) {
if (this.initialized) {
this.currentBookmark = bookmark.substring(1);
this.currentPage = pageNum | 0;
this._updatePreviousBookmark();
}
},
updateNextHashParam: function pdfHistoryUpdateNextHashParam(param) {
if (this.initialized) {
this.nextHashParam = param;
}
},
push: function pdfHistoryPush(params, isInitialBookmark) {
if (!(this.initialized && this.historyUnlocked)) {
return;
}
if (params.dest && !params.hash) {
params.hash = (this.current.hash && this.current.dest &&
this.current.dest === params.dest) ?
this.current.hash :
this.linkService.getDestinationHash(params.dest).split('#')[1];
}
if (params.page) {
params.page |= 0;
}
if (isInitialBookmark) {
var target = window.history.state.target;
if (!target) {
// Invoked when the user specifies an initial bookmark,
// thus setting initialBookmark, when the document is loaded.
this._pushToHistory(params, false);
this.previousHash = window.location.hash.substring(1);
}
this.updatePreviousBookmark = this.nextHashParam ? false : true;
if (target) {
// If the current document is reloaded,
// avoid creating duplicate entries in the history.
this._updatePreviousBookmark();
}
return;
}
if (this.nextHashParam) {
if (this.nextHashParam === params.hash) {
this.nextHashParam = null;
this.updatePreviousBookmark = true;
return;
} else {
this.nextHashParam = null;
}
}
if (params.hash) {
if (this.current.hash) {
if (this.current.hash !== params.hash) {
this._pushToHistory(params, true);
} else {
if (!this.current.page && params.page) {
this._pushToHistory(params, false, true);
}
this.updatePreviousBookmark = true;
}
} else {
this._pushToHistory(params, true);
}
} else if (this.current.page && params.page &&
this.current.page !== params.page) {
this._pushToHistory(params, true);
}
},
_getPreviousParams: function pdfHistory_getPreviousParams(onlyCheckPage,
beforeUnload) {
if (!(this.currentBookmark && this.currentPage)) {
return null;
} else if (this.updatePreviousBookmark) {
this.updatePreviousBookmark = false;
}
if (this.uid > 0 && !(this.previousBookmark && this.previousPage)) {
// Prevent the history from getting stuck in the current state,
// effectively preventing the user from going back/forward in the history.
//
// This happens if the current position in the document didn't change when
// the history was previously updated. The reasons for this are either:
// 1. The current zoom value is such that the document does not need to,
// or cannot, be scrolled to display the destination.
// 2. The previous destination is broken, and doesn't actally point to a
// position within the document.
// (This is either due to a bad PDF generator, or the user making a
// mistake when entering a destination in the hash parameters.)
return null;
}
if ((!this.current.dest && !onlyCheckPage) || beforeUnload) {
if (this.previousBookmark === this.currentBookmark) {
return null;
}
} else if (this.current.page || onlyCheckPage) {
if (this.previousPage === this.currentPage) {
return null;
}
} else {
return null;
}
var params = { hash: this.currentBookmark, page: this.currentPage };
if (PresentationMode.active) {
params.hash = null;
}
return params;
},
_stateObj: function pdfHistory_stateObj(params) {
return { fingerprint: this.fingerprint, uid: this.uid, target: params };
},
_pushToHistory: function pdfHistory_pushToHistory(params,
addPrevious, overwrite) {
if (!this.initialized) {
return;
}
if (!params.hash && params.page) {
params.hash = ('page=' + params.page);
}
if (addPrevious && !overwrite) {
var previousParams = this._getPreviousParams();
if (previousParams) {
var replacePrevious = (!this.current.dest &&
this.current.hash !== this.previousHash);
this._pushToHistory(previousParams, false, replacePrevious);
}
}
this._pushOrReplaceState(this._stateObj(params),
(overwrite || this.uid === 0));
this.currentUid = this.uid++;
this.current = params;
this.updatePreviousBookmark = true;
},
_goTo: function pdfHistory_goTo(state) {
if (!(this.initialized && this.historyUnlocked &&
this._isStateObjectDefined(state))) {
return;
}
if (!this.reInitialized && state.uid < this.currentUid) {
var previousParams = this._getPreviousParams(true);
if (previousParams) {
this._pushToHistory(this.current, false);
this._pushToHistory(previousParams, false);
this.currentUid = state.uid;
window.history.back();
return;
}
}
this.historyUnlocked = false;
if (state.target.dest) {
this.linkService.navigateTo(state.target.dest);
} else {
this.linkService.setHash(state.target.hash);
}
this.currentUid = state.uid;
if (state.uid > this.uid) {
this.uid = state.uid;
}
this.current = state.target;
this.updatePreviousBookmark = true;
var currentHash = window.location.hash.substring(1);
if (this.previousHash !== currentHash) {
this.allowHashChange = false;
}
this.previousHash = currentHash;
this.historyUnlocked = true;
},
back: function pdfHistoryBack() {
this.go(-1);
},
forward: function pdfHistoryForward() {
this.go(1);
},
go: function pdfHistoryGo(direction) {
if (this.initialized && this.historyUnlocked) {
var state = window.history.state;
if (direction === -1 && state && state.uid > 0) {
window.history.back();
} else if (direction === 1 && state && state.uid < (this.uid - 1)) {
window.history.forward();
}
}
}
};
var SecondaryToolbar = {
opened: false,
previousContainerHeight: null,
newContainerHeight: null,
initialize: function secondaryToolbarInitialize(options) {
this.toolbar = options.toolbar;
this.presentationMode = options.presentationMode;
this.documentProperties = options.documentProperties;
this.buttonContainer = this.toolbar.firstElementChild;
// Define the toolbar buttons.
this.toggleButton = options.toggleButton;
this.presentationModeButton = options.presentationModeButton;
this.openFile = options.openFile;
this.print = options.print;
this.download = options.download;
this.viewBookmark = options.viewBookmark;
this.firstPage = options.firstPage;
this.lastPage = options.lastPage;
this.pageRotateCw = options.pageRotateCw;
this.pageRotateCcw = options.pageRotateCcw;
this.documentPropertiesButton = options.documentPropertiesButton;
// Attach the event listeners.
var elements = [
// Button to toggle the visibility of the secondary toolbar:
{ element: this.toggleButton, handler: this.toggle },
// All items within the secondary toolbar
// (except for toggleHandTool, hand_tool.js is responsible for it):
{ element: this.presentationModeButton,
handler: this.presentationModeClick },
{ element: this.openFile, handler: this.openFileClick },
{ element: this.print, handler: this.printClick },
{ element: this.download, handler: this.downloadClick },
{ element: this.viewBookmark, handler: this.viewBookmarkClick },
{ element: this.firstPage, handler: this.firstPageClick },
{ element: this.lastPage, handler: this.lastPageClick },
{ element: this.pageRotateCw, handler: this.pageRotateCwClick },
{ element: this.pageRotateCcw, handler: this.pageRotateCcwClick },
{ element: this.documentPropertiesButton,
handler: this.documentPropertiesClick }
];
for (var item in elements) {
var element = elements[item].element;
if (element) {
element.addEventListener('click', elements[item].handler.bind(this));
}
}
},
// Event handling functions.
presentationModeClick: function secondaryToolbarPresentationModeClick(evt) {
this.presentationMode.request();
this.close();
},
openFileClick: function secondaryToolbarOpenFileClick(evt) {
document.getElementById('fileInput').click();
this.close();
},
printClick: function secondaryToolbarPrintClick(evt) {
window.print();
this.close();
},
downloadClick: function secondaryToolbarDownloadClick(evt) {
PDFViewerApplication.download();
this.close();
},
viewBookmarkClick: function secondaryToolbarViewBookmarkClick(evt) {
this.close();
},
firstPageClick: function secondaryToolbarFirstPageClick(evt) {
PDFViewerApplication.page = 1;
this.close();
},
lastPageClick: function secondaryToolbarLastPageClick(evt) {
if (PDFViewerApplication.pdfDocument) {
PDFViewerApplication.page = PDFViewerApplication.pagesCount;
}
this.close();
},
pageRotateCwClick: function secondaryToolbarPageRotateCwClick(evt) {
PDFViewerApplication.rotatePages(90);
},
pageRotateCcwClick: function secondaryToolbarPageRotateCcwClick(evt) {
PDFViewerApplication.rotatePages(-90);
},
documentPropertiesClick: function secondaryToolbarDocumentPropsClick(evt) {
this.documentProperties.open();
this.close();
},
// Misc. functions for interacting with the toolbar.
setMaxHeight: function secondaryToolbarSetMaxHeight(container) {
if (!container || !this.buttonContainer) {
return;
}
this.newContainerHeight = container.clientHeight;
if (this.previousContainerHeight === this.newContainerHeight) {
return;
}
this.buttonContainer.setAttribute('style',
'max-height: ' + (this.newContainerHeight - SCROLLBAR_PADDING) + 'px;');
this.previousContainerHeight = this.newContainerHeight;
},
open: function secondaryToolbarOpen() {
if (this.opened) {
return;
}
this.opened = true;
this.toggleButton.classList.add('toggled');
this.toolbar.classList.remove('hidden');
},
close: function secondaryToolbarClose(target) {
if (!this.opened) {
return;
} else if (target && !this.toolbar.contains(target)) {
return;
}
this.opened = false;
this.toolbar.classList.add('hidden');
this.toggleButton.classList.remove('toggled');
},
toggle: function secondaryToolbarToggle() {
if (this.opened) {
this.close();
} else {
this.open();
}
}
};
var DELAY_BEFORE_HIDING_CONTROLS = 3000; // in ms
var SELECTOR = 'presentationControls';
var DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS = 1000; // in ms
var PresentationMode = {
active: false,
args: null,
contextMenuOpen: false,
prevCoords: { x: null, y: null },
initialize: function presentationModeInitialize(options) {
this.container = options.container;
this.secondaryToolbar = options.secondaryToolbar;
this.viewer = this.container.firstElementChild;
this.firstPage = options.firstPage;
this.lastPage = options.lastPage;
this.pageRotateCw = options.pageRotateCw;
this.pageRotateCcw = options.pageRotateCcw;
this.firstPage.addEventListener('click', function() {
this.contextMenuOpen = false;
this.secondaryToolbar.firstPageClick();
}.bind(this));
this.lastPage.addEventListener('click', function() {
this.contextMenuOpen = false;
this.secondaryToolbar.lastPageClick();
}.bind(this));
this.pageRotateCw.addEventListener('click', function() {
this.contextMenuOpen = false;
this.secondaryToolbar.pageRotateCwClick();
}.bind(this));
this.pageRotateCcw.addEventListener('click', function() {
this.contextMenuOpen = false;
this.secondaryToolbar.pageRotateCcwClick();
}.bind(this));
},
get isFullscreen() {
return (document.fullscreenElement ||
document.mozFullScreen ||
document.webkitIsFullScreen ||
document.msFullscreenElement);
},
/**
* Initialize a timeout that is used to specify switchInProgress when the
* browser transitions to fullscreen mode. Since resize events are triggered
* multiple times during the switch to fullscreen mode, this is necessary in
* order to prevent the page from being scrolled partially, or completely,
* out of view when Presentation Mode is enabled.
* Note: This is only an issue at certain zoom levels, e.g. 'page-width'.
*/
_setSwitchInProgress: function presentationMode_setSwitchInProgress() {
if (this.switchInProgress) {
clearTimeout(this.switchInProgress);
}
this.switchInProgress = setTimeout(function switchInProgressTimeout() {
delete this.switchInProgress;
this._notifyStateChange();
}.bind(this), DELAY_BEFORE_RESETTING_SWITCH_IN_PROGRESS);
},
_resetSwitchInProgress: function presentationMode_resetSwitchInProgress() {
if (this.switchInProgress) {
clearTimeout(this.switchInProgress);
delete this.switchInProgress;
}
},
request: function presentationModeRequest() {
if (!PDFViewerApplication.supportsFullscreen || this.isFullscreen ||
!this.viewer.hasChildNodes()) {
return false;
}
this._setSwitchInProgress();
this._notifyStateChange();
if (this.container.requestFullscreen) {
this.container.requestFullscreen();
} else if (this.container.mozRequestFullScreen) {
this.container.mozRequestFullScreen();
} else if (this.container.webkitRequestFullscreen) {
this.container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
} else if (this.container.msRequestFullscreen) {
this.container.msRequestFullscreen();
} else {
return false;
}
this.args = {
page: PDFViewerApplication.page,
previousScale: PDFViewerApplication.currentScaleValue
};
return true;
},
_notifyStateChange: function presentationModeNotifyStateChange() {
var event = document.createEvent('CustomEvent');
event.initCustomEvent('presentationmodechanged', true, true, {
active: PresentationMode.active,
switchInProgress: !!PresentationMode.switchInProgress
});
window.dispatchEvent(event);
},
enter: function presentationModeEnter() {
this.active = true;
this._resetSwitchInProgress();
this._notifyStateChange();
// Ensure that the correct page is scrolled into view when entering
// Presentation Mode, by waiting until fullscreen mode in enabled.
// Note: This is only necessary in non-Mozilla browsers.
setTimeout(function enterPresentationModeTimeout() {
PDFViewerApplication.page = this.args.page;
PDFViewerApplication.setScale('page-fit', true);
}.bind(this), 0);
window.addEventListener('mousemove', this.mouseMove, false);
window.addEventListener('mousedown', this.mouseDown, false);
window.addEventListener('contextmenu', this.contextMenu, false);
this.showControls();
HandTool.enterPresentationMode();
this.contextMenuOpen = false;
this.container.setAttribute('contextmenu', 'viewerContextMenu');
// Text selection is disabled in Presentation Mode, thus it's not possible
// for the user to deselect text that is selected (e.g. with "Select all")
// when entering Presentation Mode, hence we remove any active selection.
window.getSelection().removeAllRanges();
},
exit: function presentationModeExit() {
var page = PDFViewerApplication.page;
// Ensure that the correct page is scrolled into view when exiting
// Presentation Mode, by waiting until fullscreen mode is disabled.
// Note: This is only necessary in non-Mozilla browsers.
setTimeout(function exitPresentationModeTimeout() {
this.active = false;
this._notifyStateChange();
PDFViewerApplication.setScale(this.args.previousScale, true);
PDFViewerApplication.page = page;
this.args = null;
}.bind(this), 0);
window.removeEventListener('mousemove', this.mouseMove, false);
window.removeEventListener('mousedown', this.mouseDown, false);
window.removeEventListener('contextmenu', this.contextMenu, false);
this.hideControls();
PDFViewerApplication.clearMouseScrollState();
HandTool.exitPresentationMode();
this.container.removeAttribute('contextmenu');
this.contextMenuOpen = false;
// Ensure that the thumbnail of the current page is visible
// when exiting presentation mode.
scrollIntoView(document.getElementById('thumbnailContainer' + page));
},
showControls: function presentationModeShowControls() {
if (this.controlsTimeout) {
clearTimeout(this.controlsTimeout);
} else {
this.container.classList.add(SELECTOR);
}
this.controlsTimeout = setTimeout(function hideControlsTimeout() {
this.container.classList.remove(SELECTOR);
delete this.controlsTimeout;
}.bind(this), DELAY_BEFORE_HIDING_CONTROLS);
},
hideControls: function presentationModeHideControls() {
if (!this.controlsTimeout) {
return;
}
this.container.classList.remove(SELECTOR);
clearTimeout(this.controlsTimeout);
delete this.controlsTimeout;
},
mouseMove: function presentationModeMouseMove(evt) {
// Workaround for a bug in WebKit browsers that causes the 'mousemove' event
// to be fired when the cursor is changed. For details, see:
// http://code.google.com/p/chromium/issues/detail?id=103041.
var currCoords = { x: evt.clientX, y: evt.clientY };
var prevCoords = PresentationMode.prevCoords;
PresentationMode.prevCoords = currCoords;
if (currCoords.x === prevCoords.x && currCoords.y === prevCoords.y) {
return;
}
PresentationMode.showControls();
},
mouseDown: function presentationModeMouseDown(evt) {
var self = PresentationMode;
if (self.contextMenuOpen) {
self.contextMenuOpen = false;
evt.preventDefault();
return;
}
if (evt.button === 0) {
// Enable clicking of links in presentation mode. Please note:
// Only links pointing to destinations in the current PDF document work.
var isInternalLink = (evt.target.href &&
evt.target.classList.contains('internalLink'));
if (!isInternalLink) {
// Unless an internal link was clicked, advance one page.
evt.preventDefault();
PDFViewerApplication.page += (evt.shiftKey ? -1 : 1);
}
}
},
contextMenu: function presentationModeContextMenu(evt) {
PresentationMode.contextMenuOpen = true;
}
};
(function presentationModeClosure() {
function presentationModeChange(e) {
if (PresentationMode.isFullscreen) {
PresentationMode.enter();
} else {
PresentationMode.exit();
}
}
window.addEventListener('fullscreenchange', presentationModeChange, false);
window.addEventListener('mozfullscreenchange', presentationModeChange, false);
window.addEventListener('webkitfullscreenchange', presentationModeChange,
false);
window.addEventListener('MSFullscreenChange', presentationModeChange, false);
})();
/* Copyright 2013 Rob Wu <[email protected]>
* https://github.com/Rob--W/grab-to-pan.js
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
var GrabToPan = (function GrabToPanClosure() {
/**
* Construct a GrabToPan instance for a given HTML element.
* @param options.element {Element}
* @param options.ignoreTarget {function} optional. See `ignoreTarget(node)`
* @param options.onActiveChanged {function(boolean)} optional. Called
* when grab-to-pan is (de)activated. The first argument is a boolean that
* shows whether grab-to-pan is activated.
*/
function GrabToPan(options) {
this.element = options.element;
this.document = options.element.ownerDocument;
if (typeof options.ignoreTarget === 'function') {
this.ignoreTarget = options.ignoreTarget;
}
this.onActiveChanged = options.onActiveChanged;
// Bind the contexts to ensure that `this` always points to
// the GrabToPan instance.
this.activate = this.activate.bind(this);
this.deactivate = this.deactivate.bind(this);
this.toggle = this.toggle.bind(this);
this._onmousedown = this._onmousedown.bind(this);
this._onmousemove = this._onmousemove.bind(this);
this._endPan = this._endPan.bind(this);
// This overlay will be inserted in the document when the mouse moves during
// a grab operation, to ensure that the cursor has the desired appearance.
var overlay = this.overlay = document.createElement('div');
overlay.className = 'grab-to-pan-grabbing';
}
GrabToPan.prototype = {
/**
* Class name of element which can be grabbed
*/
CSS_CLASS_GRAB: 'grab-to-pan-grab',
/**
* Bind a mousedown event to the element to enable grab-detection.
*/
activate: function GrabToPan_activate() {
if (!this.active) {
this.active = true;
this.element.addEventListener('mousedown', this._onmousedown, true);
this.element.classList.add(this.CSS_CLASS_GRAB);
if (this.onActiveChanged) {
this.onActiveChanged(true);
}
}
},
/**
* Removes all events. Any pending pan session is immediately stopped.
*/
deactivate: function GrabToPan_deactivate() {
if (this.active) {
this.active = false;
this.element.removeEventListener('mousedown', this._onmousedown, true);
this._endPan();
this.element.classList.remove(this.CSS_CLASS_GRAB);
if (this.onActiveChanged) {
this.onActiveChanged(false);
}
}
},
toggle: function GrabToPan_toggle() {
if (this.active) {
this.deactivate();
} else {
this.activate();
}
},
/**
* Whether to not pan if the target element is clicked.
* Override this method to change the default behaviour.
*
* @param node {Element} The target of the event
* @return {boolean} Whether to not react to the click event.
*/
ignoreTarget: function GrabToPan_ignoreTarget(node) {
// Use matchesSelector to check whether the clicked element
// is (a child of) an input element / link
return node[matchesSelector](
'a[href], a[href] *, input, textarea, button, button *, select, option'
);
},
/**
* @private
*/
_onmousedown: function GrabToPan__onmousedown(event) {
if (event.button !== 0 || this.ignoreTarget(event.target)) {
return;
}
if (event.originalTarget) {
try {
/* jshint expr:true */
event.originalTarget.tagName;
} catch (e) {
// Mozilla-specific: element is a scrollbar (XUL element)
return;
}
}
this.scrollLeftStart = this.element.scrollLeft;
this.scrollTopStart = this.element.scrollTop;
this.clientXStart = event.clientX;
this.clientYStart = event.clientY;
this.document.addEventListener('mousemove', this._onmousemove, true);
this.document.addEventListener('mouseup', this._endPan, true);
// When a scroll event occurs before a mousemove, assume that the user
// dragged a scrollbar (necessary for Opera Presto, Safari and IE)
// (not needed for Chrome/Firefox)
this.element.addEventListener('scroll', this._endPan, true);
event.preventDefault();
event.stopPropagation();
this.document.documentElement.classList.add(this.CSS_CLASS_GRABBING);
var focusedElement = document.activeElement;
if (focusedElement && !focusedElement.contains(event.target)) {
focusedElement.blur();
}
},
/**
* @private
*/
_onmousemove: function GrabToPan__onmousemove(event) {
this.element.removeEventListener('scroll', this._endPan, true);
if (isLeftMouseReleased(event)) {
this._endPan();
return;
}
var xDiff = event.clientX - this.clientXStart;
var yDiff = event.clientY - this.clientYStart;
this.element.scrollTop = this.scrollTopStart - yDiff;
this.element.scrollLeft = this.scrollLeftStart - xDiff;
if (!this.overlay.parentNode) {
document.body.appendChild(this.overlay);
}
},
/**
* @private
*/
_endPan: function GrabToPan__endPan() {
this.element.removeEventListener('scroll', this._endPan, true);
this.document.removeEventListener('mousemove', this._onmousemove, true);
this.document.removeEventListener('mouseup', this._endPan, true);
if (this.overlay.parentNode) {
this.overlay.parentNode.removeChild(this.overlay);
}
}
};
// Get the correct (vendor-prefixed) name of the matches method.
var matchesSelector;
['webkitM', 'mozM', 'msM', 'oM', 'm'].some(function(prefix) {
var name = prefix + 'atches';
if (name in document.documentElement) {
matchesSelector = name;
}
name += 'Selector';
if (name in document.documentElement) {
matchesSelector = name;
}
return matchesSelector; // If found, then truthy, and [].some() ends.
});
// Browser sniffing because it's impossible to feature-detect
// whether event.which for onmousemove is reliable
var isNotIEorIsIE10plus = !document.documentMode || document.documentMode > 9;
var chrome = window.chrome;
var isChrome15OrOpera15plus = chrome && (chrome.webstore || chrome.app);
// ^ Chrome 15+ ^ Opera 15+
var isSafari6plus = /Apple/.test(navigator.vendor) &&
/Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent);
/**
* Whether the left mouse is not pressed.
* @param event {MouseEvent}
* @return {boolean} True if the left mouse button is not pressed.
* False if unsure or if the left mouse button is pressed.
*/
function isLeftMouseReleased(event) {
if ('buttons' in event && isNotIEorIsIE10plus) {
// http://www.w3.org/TR/DOM-Level-3-Events/#events-MouseEvent-buttons
// Firefox 15+
// Internet Explorer 10+
return !(event.buttons | 1);
}
if (isChrome15OrOpera15plus || isSafari6plus) {
// Chrome 14+
// Opera 15+
// Safari 6.0+
return event.which === 0;
}
}
return GrabToPan;
})();
var HandTool = {
initialize: function handToolInitialize(options) {
var toggleHandTool = options.toggleHandTool;
this.handTool = new GrabToPan({
element: options.container,
onActiveChanged: function(isActive) {
if (!toggleHandTool) {
return;
}
if (isActive) {
toggleHandTool.title =
mozL10n.get('hand_tool_disable.title', null, 'Disable hand tool');
toggleHandTool.firstElementChild.textContent =
mozL10n.get('hand_tool_disable_label', null, 'Disable hand tool');
} else {
toggleHandTool.title =
mozL10n.get('hand_tool_enable.title', null, 'Enable hand tool');
toggleHandTool.firstElementChild.textContent =
mozL10n.get('hand_tool_enable_label', null, 'Enable hand tool');
}
}
});
if (toggleHandTool) {
toggleHandTool.addEventListener('click', this.toggle.bind(this), false);
window.addEventListener('localized', function (evt) {
Preferences.get('enableHandToolOnLoad').then(function resolved(value) {
if (value) {
this.handTool.activate();
}
}.bind(this), function rejected(reason) {});
}.bind(this));
}
},
toggle: function handToolToggle() {
this.handTool.toggle();
SecondaryToolbar.close();
},
enterPresentationMode: function handToolEnterPresentationMode() {
if (this.handTool.active) {
this.wasActive = true;
this.handTool.deactivate();
}
},
exitPresentationMode: function handToolExitPresentationMode() {
if (this.wasActive) {
this.wasActive = null;
this.handTool.activate();
}
}
};
var OverlayManager = {
overlays: {},
active: null,
/**
* @param {string} name The name of the overlay that is registered. This must
* be equal to the ID of the overlay's DOM element.
* @param {function} callerCloseMethod (optional) The method that, if present,
* will call OverlayManager.close from the Object
* registering the overlay. Access to this method is
* necessary in order to run cleanup code when e.g.
* the overlay is force closed. The default is null.
* @param {boolean} canForceClose (optional) Indicates if opening the overlay
* will close an active overlay. The default is false.
* @returns {Promise} A promise that is resolved when the overlay has been
* registered.
*/
register: function overlayManagerRegister(name,
callerCloseMethod, canForceClose) {
return new Promise(function (resolve) {
var element, container;
if (!name || !(element = document.getElementById(name)) ||
!(container = element.parentNode)) {
throw new Error('Not enough parameters.');
} else if (this.overlays[name]) {
throw new Error('The overlay is already registered.');
}
this.overlays[name] = { element: element,
container: container,
callerCloseMethod: (callerCloseMethod || null),
canForceClose: (canForceClose || false) };
resolve();
}.bind(this));
},
/**
* @param {string} name The name of the overlay that is unregistered.
* @returns {Promise} A promise that is resolved when the overlay has been
* unregistered.
*/
unregister: function overlayManagerUnregister(name) {
return new Promise(function (resolve) {
if (!this.overlays[name]) {
throw new Error('The overlay does not exist.');
} else if (this.active === name) {
throw new Error('The overlay cannot be removed while it is active.');
}
delete this.overlays[name];
resolve();
}.bind(this));
},
/**
* @param {string} name The name of the overlay that should be opened.
* @returns {Promise} A promise that is resolved when the overlay has been
* opened.
*/
open: function overlayManagerOpen(name) {
return new Promise(function (resolve) {
if (!this.overlays[name]) {
throw new Error('The overlay does not exist.');
} else if (this.active) {
if (this.overlays[name].canForceClose) {
this._closeThroughCaller();
} else if (this.active === name) {
throw new Error('The overlay is already active.');
} else {
throw new Error('Another overlay is currently active.');
}
}
this.active = name;
this.overlays[this.active].element.classList.remove('hidden');
this.overlays[this.active].container.classList.remove('hidden');
window.addEventListener('keydown', this._keyDown);
resolve();
}.bind(this));
},
/**
* @param {string} name The name of the overlay that should be closed.
* @returns {Promise} A promise that is resolved when the overlay has been
* closed.
*/
close: function overlayManagerClose(name) {
return new Promise(function (resolve) {
if (!this.overlays[name]) {
throw new Error('The overlay does not exist.');
} else if (!this.active) {
throw new Error('The overlay is currently not active.');
} else if (this.active !== name) {
throw new Error('Another overlay is currently active.');
}
this.overlays[this.active].container.classList.add('hidden');
this.overlays[this.active].element.classList.add('hidden');
this.active = null;
window.removeEventListener('keydown', this._keyDown);
resolve();
}.bind(this));
},
/**
* @private
*/
_keyDown: function overlayManager_keyDown(evt) {
var self = OverlayManager;
if (self.active && evt.keyCode === 27) { // Esc key.
self._closeThroughCaller();
evt.preventDefault();
}
},
/**
* @private
*/
_closeThroughCaller: function overlayManager_closeThroughCaller() {
if (this.overlays[this.active].callerCloseMethod) {
this.overlays[this.active].callerCloseMethod();
}
if (this.active) {
this.close(this.active);
}
}
};
var PasswordPrompt = {
overlayName: null,
updatePassword: null,
reason: null,
passwordField: null,
passwordText: null,
passwordSubmit: null,
passwordCancel: null,
initialize: function secondaryToolbarInitialize(options) {
this.overlayName = options.overlayName;
this.passwordField = options.passwordField;
this.passwordText = options.passwordText;
this.passwordSubmit = options.passwordSubmit;
this.passwordCancel = options.passwordCancel;
// Attach the event listeners.
this.passwordSubmit.addEventListener('click',
this.verifyPassword.bind(this));
this.passwordCancel.addEventListener('click', this.close.bind(this));
this.passwordField.addEventListener('keydown', function (e) {
if (e.keyCode === 13) { // Enter key
this.verifyPassword();
}
}.bind(this));
OverlayManager.register(this.overlayName, this.close.bind(this), true);
},
open: function passwordPromptOpen() {
OverlayManager.open(this.overlayName).then(function () {
this.passwordField.focus();
var promptString = mozL10n.get('password_label', null,
'Enter the password to open this PDF file.');
if (this.reason === PDFJS.PasswordResponses.INCORRECT_PASSWORD) {
promptString = mozL10n.get('password_invalid', null,
'Invalid password. Please try again.');
}
this.passwordText.textContent = promptString;
}.bind(this));
},
close: function passwordPromptClose() {
OverlayManager.close(this.overlayName).then(function () {
this.passwordField.value = '';
}.bind(this));
},
verifyPassword: function passwordPromptVerifyPassword() {
var password = this.passwordField.value;
if (password && password.length > 0) {
this.close();
return this.updatePassword(password);
}
}
};
var DocumentProperties = {
overlayName: null,
rawFileSize: 0,
// Document property fields (in the viewer).
fileNameField: null,
fileSizeField: null,
titleField: null,
authorField: null,
subjectField: null,
keywordsField: null,
creationDateField: null,
modificationDateField: null,
creatorField: null,
producerField: null,
versionField: null,
pageCountField: null,
url: null,
pdfDocument: null,
initialize: function documentPropertiesInitialize(options) {
this.overlayName = options.overlayName;
// Set the document property fields.
this.fileNameField = options.fileNameField;
this.fileSizeField = options.fileSizeField;
this.titleField = options.titleField;
this.authorField = options.authorField;
this.subjectField = options.subjectField;
this.keywordsField = options.keywordsField;
this.creationDateField = options.creationDateField;
this.modificationDateField = options.modificationDateField;
this.creatorField = options.creatorField;
this.producerField = options.producerField;
this.versionField = options.versionField;
this.pageCountField = options.pageCountField;
// Bind the event listener for the Close button.
if (options.closeButton) {
options.closeButton.addEventListener('click', this.close.bind(this));
}
this.dataAvailablePromise = new Promise(function (resolve) {
this.resolveDataAvailable = resolve;
}.bind(this));
OverlayManager.register(this.overlayName, this.close.bind(this));
},
getProperties: function documentPropertiesGetProperties() {
if (!OverlayManager.active) {
// If the dialog was closed before dataAvailablePromise was resolved,
// don't bother updating the properties.
return;
}
// Get the file size (if it hasn't already been set).
this.pdfDocument.getDownloadInfo().then(function(data) {
if (data.length === this.rawFileSize) {
return;
}
this.setFileSize(data.length);
this.updateUI(this.fileSizeField, this.parseFileSize());
}.bind(this));
// Get the document properties.
this.pdfDocument.getMetadata().then(function(data) {
var fields = [
{ field: this.fileNameField,
content: getPDFFileNameFromURL(this.url) },
{ field: this.fileSizeField, content: this.parseFileSize() },
{ field: this.titleField, content: data.info.Title },
{ field: this.authorField, content: data.info.Author },
{ field: this.subjectField, content: data.info.Subject },
{ field: this.keywordsField, content: data.info.Keywords },
{ field: this.creationDateField,
content: this.parseDate(data.info.CreationDate) },
{ field: this.modificationDateField,
content: this.parseDate(data.info.ModDate) },
{ field: this.creatorField, content: data.info.Creator },
{ field: this.producerField, content: data.info.Producer },
{ field: this.versionField, content: data.info.PDFFormatVersion },
{ field: this.pageCountField, content: this.pdfDocument.numPages }
];
// Show the properties in the dialog.
for (var item in fields) {
var element = fields[item];
this.updateUI(element.field, element.content);
}
}.bind(this));
},
updateUI: function documentPropertiesUpdateUI(field, content) {
if (field && content !== undefined && content !== '') {
field.textContent = content;
}
},
setFileSize: function documentPropertiesSetFileSize(fileSize) {
if (fileSize > 0) {
this.rawFileSize = fileSize;
}
},
parseFileSize: function documentPropertiesParseFileSize() {
var fileSize = this.rawFileSize, kb = fileSize / 1024;
if (!kb) {
return;
} else if (kb < 1024) {
return mozL10n.get('document_properties_kb', {
size_kb: (+kb.toPrecision(3)).toLocaleString(),
size_b: fileSize.toLocaleString()
}, '{{size_kb}} KB ({{size_b}} bytes)');
} else {
return mozL10n.get('document_properties_mb', {
size_mb: (+(kb / 1024).toPrecision(3)).toLocaleString(),
size_b: fileSize.toLocaleString()
}, '{{size_mb}} MB ({{size_b}} bytes)');
}
},
open: function documentPropertiesOpen() {
Promise.all([OverlayManager.open(this.overlayName),
this.dataAvailablePromise]).then(function () {
this.getProperties();
}.bind(this));
},
close: function documentPropertiesClose() {
OverlayManager.close(this.overlayName);
},
parseDate: function documentPropertiesParseDate(inputDate) {
// This is implemented according to the PDF specification (see
// http://www.gnupdf.org/Date for an overview), but note that
// Adobe Reader doesn't handle changing the date to universal time
// and doesn't use the user's time zone (they're effectively ignoring
// the HH' and mm' parts of the date string).
var dateToParse = inputDate;
if (dateToParse === undefined) {
return '';
}
// Remove the D: prefix if it is available.
if (dateToParse.substring(0,2) === 'D:') {
dateToParse = dateToParse.substring(2);
}
// Get all elements from the PDF date string.
// JavaScript's Date object expects the month to be between
// 0 and 11 instead of 1 and 12, so we're correcting for this.
var year = parseInt(dateToParse.substring(0,4), 10);
var month = parseInt(dateToParse.substring(4,6), 10) - 1;
var day = parseInt(dateToParse.substring(6,8), 10);
var hours = parseInt(dateToParse.substring(8,10), 10);
var minutes = parseInt(dateToParse.substring(10,12), 10);
var seconds = parseInt(dateToParse.substring(12,14), 10);
var utRel = dateToParse.substring(14,15);
var offsetHours = parseInt(dateToParse.substring(15,17), 10);
var offsetMinutes = parseInt(dateToParse.substring(18,20), 10);
// As per spec, utRel = 'Z' means equal to universal time.
// The other cases ('-' and '+') have to be handled here.
if (utRel === '-') {
hours += offsetHours;
minutes += offsetMinutes;
} else if (utRel === '+') {
hours -= offsetHours;
minutes -= offsetMinutes;
}
// Return the new date format from the user's locale.
var date = new Date(Date.UTC(year, month, day, hours, minutes, seconds));
var dateString = date.toLocaleDateString();
var timeString = date.toLocaleTimeString();
return mozL10n.get('document_properties_date_string',
{date: dateString, time: timeString},
'{{date}}, {{time}}');
}
};
var PresentationModeState = {
UNKNOWN: 0,
NORMAL: 1,
CHANGING: 2,
FULLSCREEN: 3,
};
var IGNORE_CURRENT_POSITION_ON_ZOOM = false;
var DEFAULT_CACHE_SIZE = 10;
var CLEANUP_TIMEOUT = 30000;
var RenderingStates = {
INITIAL: 0,
RUNNING: 1,
PAUSED: 2,
FINISHED: 3
};
/**
* Controls rendering of the views for pages and thumbnails.
* @class
*/
var PDFRenderingQueue = (function PDFRenderingQueueClosure() {
/**
* @constructs
*/
function PDFRenderingQueue() {
this.pdfViewer = null;
this.pdfThumbnailViewer = null;
this.onIdle = null;
this.highestPriorityPage = null;
this.idleTimeout = null;
this.printing = false;
this.isThumbnailViewEnabled = false;
}
PDFRenderingQueue.prototype = /** @lends PDFRenderingQueue.prototype */ {
/**
* @param {PDFViewer} pdfViewer
*/
setViewer: function PDFRenderingQueue_setViewer(pdfViewer) {
this.pdfViewer = pdfViewer;
},
/**
* @param {PDFThumbnailViewer} pdfThumbnailViewer
*/
setThumbnailViewer:
function PDFRenderingQueue_setThumbnailViewer(pdfThumbnailViewer) {
this.pdfThumbnailViewer = pdfThumbnailViewer;
},
/**
* @param {IRenderableView} view
* @returns {boolean}
*/
isHighestPriority: function PDFRenderingQueue_isHighestPriority(view) {
return this.highestPriorityPage === view.renderingId;
},
renderHighestPriority: function
PDFRenderingQueue_renderHighestPriority(currentlyVisiblePages) {
if (this.idleTimeout) {
clearTimeout(this.idleTimeout);
this.idleTimeout = null;
}
// Pages have a higher priority than thumbnails, so check them first.
if (this.pdfViewer.forceRendering(currentlyVisiblePages)) {
return;
}
// No pages needed rendering so check thumbnails.
if (this.pdfThumbnailViewer && this.isThumbnailViewEnabled) {
if (this.pdfThumbnailViewer.forceRendering()) {
return;
}
}
if (this.printing) {
// If printing is currently ongoing do not reschedule cleanup.
return;
}
if (this.onIdle) {
this.idleTimeout = setTimeout(this.onIdle.bind(this), CLEANUP_TIMEOUT);
}
},
getHighestPriority: function
PDFRenderingQueue_getHighestPriority(visible, views, scrolledDown) {
// The state has changed figure out which page has the highest priority to
// render next (if any).
// Priority:
// 1 visible pages
// 2 if last scrolled down page after the visible pages
// 2 if last scrolled up page before the visible pages
var visibleViews = visible.views;
var numVisible = visibleViews.length;
if (numVisible === 0) {
return false;
}
for (var i = 0; i < numVisible; ++i) {
var view = visibleViews[i].view;
if (!this.isViewFinished(view)) {
return view;
}
}
// All the visible views have rendered, try to render next/previous pages.
if (scrolledDown) {
var nextPageIndex = visible.last.id;
// ID's start at 1 so no need to add 1.
if (views[nextPageIndex] &&
!this.isViewFinished(views[nextPageIndex])) {
return views[nextPageIndex];
}
} else {
var previousPageIndex = visible.first.id - 2;
if (views[previousPageIndex] &&
!this.isViewFinished(views[previousPageIndex])) {
return views[previousPageIndex];
}
}
// Everything that needs to be rendered has been.
return null;
},
/**
* @param {IRenderableView} view
* @returns {boolean}
*/
isViewFinished: function PDFRenderingQueue_isViewFinished(view) {
return view.renderingState === RenderingStates.FINISHED;
},
/**
* Render a page or thumbnail view. This calls the appropriate function
* based on the views state. If the view is already rendered it will return
* false.
* @param {IRenderableView} view
*/
renderView: function PDFRenderingQueue_renderView(view) {
var state = view.renderingState;
switch (state) {
case RenderingStates.FINISHED:
return false;
case RenderingStates.PAUSED:
this.highestPriorityPage = view.renderingId;
view.resume();
break;
case RenderingStates.RUNNING:
this.highestPriorityPage = view.renderingId;
break;
case RenderingStates.INITIAL:
this.highestPriorityPage = view.renderingId;
var continueRendering = function () {
this.renderHighestPriority();
}.bind(this);
view.draw().then(continueRendering, continueRendering);
break;
}
return true;
},
};
return PDFRenderingQueue;
})();
var TEXT_LAYER_RENDER_DELAY = 200; // ms
/**
* @typedef {Object} PDFPageViewOptions
* @property {HTMLDivElement} container - The viewer element.
* @property {number} id - The page unique ID (normally its number).
* @property {number} scale - The page scale display.
* @property {PageViewport} defaultViewport - The page viewport.
* @property {PDFRenderingQueue} renderingQueue - The rendering queue object.
* @property {IPDFTextLayerFactory} textLayerFactory
* @property {IPDFAnnotationsLayerFactory} annotationsLayerFactory
*/
/**
* @class
* @implements {IRenderableView}
*/
var PDFPageView = (function PDFPageViewClosure() {
/**
* @constructs PDFPageView
* @param {PDFPageViewOptions} options
*/
function PDFPageView(options) {
var container = options.container;
var id = options.id;
var scale = options.scale;
var defaultViewport = options.defaultViewport;
var renderingQueue = options.renderingQueue;
var textLayerFactory = options.textLayerFactory;
var annotationsLayerFactory = options.annotationsLayerFactory;
this.id = id;
this.renderingId = 'page' + id;
this.rotation = 0;
this.scale = scale || 1.0;
this.viewport = defaultViewport;
this.pdfPageRotate = defaultViewport.rotation;
this.hasRestrictedScaling = false;
this.renderingQueue = renderingQueue;
this.textLayerFactory = textLayerFactory;
this.annotationsLayerFactory = annotationsLayerFactory;
this.renderingState = RenderingStates.INITIAL;
this.resume = null;
this.onBeforeDraw = null;
this.onAfterDraw = null;
this.textLayer = null;
this.zoomLayer = null;
this.annotationLayer = null;
var div = document.createElement('div');
div.id = 'pageContainer' + this.id;
div.className = 'page';
div.style.width = Math.floor(this.viewport.width) + 'px';
div.style.height = Math.floor(this.viewport.height) + 'px';
this.div = div;
container.appendChild(div);
}
PDFPageView.prototype = {
setPdfPage: function PDFPageView_setPdfPage(pdfPage) {
this.pdfPage = pdfPage;
this.pdfPageRotate = pdfPage.rotate;
var totalRotation = (this.rotation + this.pdfPageRotate) % 360;
this.viewport = pdfPage.getViewport(this.scale * CSS_UNITS,
totalRotation);
this.stats = pdfPage.stats;
this.reset();
},
destroy: function PDFPageView_destroy() {
this.zoomLayer = null;
this.reset();
if (this.pdfPage) {
this.pdfPage.destroy();
}
},
reset: function PDFPageView_reset(keepAnnotations) {
if (this.renderTask) {
this.renderTask.cancel();
}
this.resume = null;
this.renderingState = RenderingStates.INITIAL;
var div = this.div;
div.style.width = Math.floor(this.viewport.width) + 'px';
div.style.height = Math.floor(this.viewport.height) + 'px';
var childNodes = div.childNodes;
var currentZoomLayer = this.zoomLayer || null;
var currentAnnotationNode = (keepAnnotations && this.annotationLayer &&
this.annotationLayer.div) || null;
for (var i = childNodes.length - 1; i >= 0; i--) {
var node = childNodes[i];
if (currentZoomLayer === node || currentAnnotationNode === node) {
continue;
}
div.removeChild(node);
}
div.removeAttribute('data-loaded');
if (keepAnnotations) {
if (this.annotationLayer) {
// Hide annotationLayer until all elements are resized
// so they are not displayed on the already-resized page
this.annotationLayer.hide();
}
} else {
this.annotationLayer = null;
}
if (this.canvas) {
// Zeroing the width and height causes Firefox to release graphics
// resources immediately, which can greatly reduce memory consumption.
this.canvas.width = 0;
this.canvas.height = 0;
delete this.canvas;
}
this.loadingIconDiv = document.createElement('div');
this.loadingIconDiv.className = 'loadingIcon';
div.appendChild(this.loadingIconDiv);
},
update: function PDFPageView_update(scale, rotation) {
this.scale = scale || this.scale;
if (typeof rotation !== 'undefined') {
this.rotation = rotation;
}
var totalRotation = (this.rotation + this.pdfPageRotate) % 360;
this.viewport = this.viewport.clone({
scale: this.scale * CSS_UNITS,
rotation: totalRotation
});
var isScalingRestricted = false;
if (this.canvas && PDFJS.maxCanvasPixels > 0) {
var ctx = this.canvas.getContext('2d');
var outputScale = getOutputScale(ctx);
var pixelsInViewport = this.viewport.width * this.viewport.height;
var maxScale = Math.sqrt(PDFJS.maxCanvasPixels / pixelsInViewport);
if (((Math.floor(this.viewport.width) * outputScale.sx) | 0) *
((Math.floor(this.viewport.height) * outputScale.sy) | 0) >
PDFJS.maxCanvasPixels) {
isScalingRestricted = true;
}
}
if (this.canvas &&
(PDFJS.useOnlyCssZoom ||
(this.hasRestrictedScaling && isScalingRestricted))) {
this.cssTransform(this.canvas, true);
return;
} else if (this.canvas && !this.zoomLayer) {
this.zoomLayer = this.canvas.parentNode;
this.zoomLayer.style.position = 'absolute';
}
if (this.zoomLayer) {
this.cssTransform(this.zoomLayer.firstChild);
}
this.reset(true);
},
/**
* Called when moved in the parent's container.
*/
updatePosition: function PDFPageView_updatePosition() {
if (this.textLayer) {
this.textLayer.render(TEXT_LAYER_RENDER_DELAY);
}
},
cssTransform: function PDFPageView_transform(canvas, redrawAnnotations) {
// Scale canvas, canvas wrapper, and page container.
var width = this.viewport.width;
var height = this.viewport.height;
var div = this.div;
canvas.style.width = canvas.parentNode.style.width = div.style.width =
Math.floor(width) + 'px';
canvas.style.height = canvas.parentNode.style.height = div.style.height =
Math.floor(height) + 'px';
// The canvas may have been originally rotated, rotate relative to that.
var relativeRotation = this.viewport.rotation - canvas._viewport.rotation;
var absRotation = Math.abs(relativeRotation);
var scaleX = 1, scaleY = 1;
if (absRotation === 90 || absRotation === 270) {
// Scale x and y because of the rotation.
scaleX = height / width;
scaleY = width / height;
}
var cssTransform = 'rotate(' + relativeRotation + 'deg) ' +
'scale(' + scaleX + ',' + scaleY + ')';
CustomStyle.setProp('transform', canvas, cssTransform);
if (this.textLayer) {
// Rotating the text layer is more complicated since the divs inside the
// the text layer are rotated.
// TODO: This could probably be simplified by drawing the text layer in
// one orientation then rotating overall.
var textLayerViewport = this.textLayer.viewport;
var textRelativeRotation = this.viewport.rotation -
textLayerViewport.rotation;
var textAbsRotation = Math.abs(textRelativeRotation);
var scale = width / textLayerViewport.width;
if (textAbsRotation === 90 || textAbsRotation === 270) {
scale = width / textLayerViewport.height;
}
var textLayerDiv = this.textLayer.textLayerDiv;
var transX, transY;
switch (textAbsRotation) {
case 0:
transX = transY = 0;
break;
case 90:
transX = 0;
transY = '-' + textLayerDiv.style.height;
break;
case 180:
transX = '-' + textLayerDiv.style.width;
transY = '-' + textLayerDiv.style.height;
break;
case 270:
transX = '-' + textLayerDiv.style.width;
transY = 0;
break;
default:
console.error('Bad rotation value.');
break;
}
CustomStyle.setProp('transform', textLayerDiv,
'rotate(' + textAbsRotation + 'deg) ' +
'scale(' + scale + ', ' + scale + ') ' +
'translate(' + transX + ', ' + transY + ')');
CustomStyle.setProp('transformOrigin', textLayerDiv, '0% 0%');
}
if (redrawAnnotations && this.annotationLayer) {
this.annotationLayer.setupAnnotations(this.viewport);
}
},
get width() {
return this.viewport.width;
},
get height() {
return this.viewport.height;
},
getPagePoint: function PDFPageView_getPagePoint(x, y) {
return this.viewport.convertToPdfPoint(x, y);
},
draw: function PDFPageView_draw() {
if (this.renderingState !== RenderingStates.INITIAL) {
console.error('Must be in new state before drawing');
}
this.renderingState = RenderingStates.RUNNING;
var pdfPage = this.pdfPage;
var viewport = this.viewport;
var div = this.div;
// Wrap the canvas so if it has a css transform for highdpi the overflow
// will be hidden in FF.
var canvasWrapper = document.createElement('div');
canvasWrapper.style.width = div.style.width;
canvasWrapper.style.height = div.style.height;
canvasWrapper.classList.add('canvasWrapper');
var canvas = document.createElement('canvas');
canvas.id = 'page' + this.id;
canvasWrapper.appendChild(canvas);
if (this.annotationLayer) {
// annotationLayer needs to stay on top
div.insertBefore(canvasWrapper, this.annotationLayer.div);
} else {
div.appendChild(canvasWrapper);
}
this.canvas = canvas;
var ctx = canvas.getContext('2d');
var outputScale = getOutputScale(ctx);
if (PDFJS.useOnlyCssZoom) {
var actualSizeViewport = viewport.clone({ scale: CSS_UNITS });
// Use a scale that will make the canvas be the original intended size
// of the page.
outputScale.sx *= actualSizeViewport.width / viewport.width;
outputScale.sy *= actualSizeViewport.height / viewport.height;
outputScale.scaled = true;
}
if (PDFJS.maxCanvasPixels > 0) {
var pixelsInViewport = viewport.width * viewport.height;
var maxScale = Math.sqrt(PDFJS.maxCanvasPixels / pixelsInViewport);
if (outputScale.sx > maxScale || outputScale.sy > maxScale) {
outputScale.sx = maxScale;
outputScale.sy = maxScale;
outputScale.scaled = true;
this.hasRestrictedScaling = true;
} else {
this.hasRestrictedScaling = false;
}
}
canvas.width = (Math.floor(viewport.width) * outputScale.sx) | 0;
canvas.height = (Math.floor(viewport.height) * outputScale.sy) | 0;
canvas.style.width = Math.floor(viewport.width) + 'px';
canvas.style.height = Math.floor(viewport.height) + 'px';
// Add the viewport so it's known what it was originally drawn with.
canvas._viewport = viewport;
var textLayerDiv = null;
var textLayer = null;
if (this.textLayerFactory) {
textLayerDiv = document.createElement('div');
textLayerDiv.className = 'textLayer';
textLayerDiv.style.width = canvas.style.width;
textLayerDiv.style.height = canvas.style.height;
if (this.annotationLayer) {
// annotationLayer needs to stay on top
div.insertBefore(textLayerDiv, this.annotationLayer.div);
} else {
div.appendChild(textLayerDiv);
}
textLayer = this.textLayerFactory.createTextLayerBuilder(textLayerDiv,
this.id - 1,
this.viewport);
}
this.textLayer = textLayer;
// TODO(mack): use data attributes to store these
ctx._scaleX = outputScale.sx;
ctx._scaleY = outputScale.sy;
if (outputScale.scaled) {
ctx.scale(outputScale.sx, outputScale.sy);
}
var resolveRenderPromise, rejectRenderPromise;
var promise = new Promise(function (resolve, reject) {
resolveRenderPromise = resolve;
rejectRenderPromise = reject;
});
// Rendering area
var self = this;
function pageViewDrawCallback(error) {
// The renderTask may have been replaced by a new one, so only remove
// the reference to the renderTask if it matches the one that is
// triggering this callback.
if (renderTask === self.renderTask) {
self.renderTask = null;
}
if (error === 'cancelled') {
rejectRenderPromise(error);
return;
}
self.renderingState = RenderingStates.FINISHED;
if (self.loadingIconDiv) {
div.removeChild(self.loadingIconDiv);
delete self.loadingIconDiv;
}
if (self.zoomLayer) {
div.removeChild(self.zoomLayer);
self.zoomLayer = null;
}
self.error = error;
self.stats = pdfPage.stats;
if (self.onAfterDraw) {
self.onAfterDraw();
}
var event = document.createEvent('CustomEvent');
event.initCustomEvent('pagerendered', true, true, {
pageNumber: self.id
});
div.dispatchEvent(event);
// This custom event is deprecated, and will be removed in the future,
// please use the |pagerendered| event instead.
var deprecatedEvent = document.createEvent('CustomEvent');
deprecatedEvent.initCustomEvent('pagerender', true, true, {
pageNumber: pdfPage.pageNumber
});
div.dispatchEvent(deprecatedEvent);
if (!error) {
resolveRenderPromise(undefined);
} else {
rejectRenderPromise(error);
}
}
var renderContinueCallback = null;
if (this.renderingQueue) {
renderContinueCallback = function renderContinueCallback(cont) {
if (!self.renderingQueue.isHighestPriority(self)) {
self.renderingState = RenderingStates.PAUSED;
self.resume = function resumeCallback() {
self.renderingState = RenderingStates.RUNNING;
cont();
};
return;
}
cont();
};
}
var renderContext = {
canvasContext: ctx,
viewport: this.viewport,
// intent: 'default', // === 'display'
continueCallback: renderContinueCallback
};
var renderTask = this.renderTask = this.pdfPage.render(renderContext);
this.renderTask.promise.then(
function pdfPageRenderCallback() {
pageViewDrawCallback(null);
if (textLayer) {
self.pdfPage.getTextContent().then(
function textContentResolved(textContent) {
textLayer.setTextContent(textContent);
textLayer.render(TEXT_LAYER_RENDER_DELAY);
}
);
}
},
function pdfPageRenderError(error) {
pageViewDrawCallback(error);
}
);
if (this.annotationsLayerFactory) {
if (!this.annotationLayer) {
this.annotationLayer = this.annotationsLayerFactory.
createAnnotationsLayerBuilder(div, this.pdfPage);
}
this.annotationLayer.setupAnnotations(this.viewport);
}
div.setAttribute('data-loaded', true);
if (self.onBeforeDraw) {
self.onBeforeDraw();
}
return promise;
},
beforePrint: function PDFPageView_beforePrint() {
var pdfPage = this.pdfPage;
var viewport = pdfPage.getViewport(1);
// Use the same hack we use for high dpi displays for printing to get
// better output until bug 811002 is fixed in FF.
var PRINT_OUTPUT_SCALE = 2;
var canvas = document.createElement('canvas');
canvas.width = Math.floor(viewport.width) * PRINT_OUTPUT_SCALE;
canvas.height = Math.floor(viewport.height) * PRINT_OUTPUT_SCALE;
canvas.style.width = (PRINT_OUTPUT_SCALE * viewport.width) + 'pt';
canvas.style.height = (PRINT_OUTPUT_SCALE * viewport.height) + 'pt';
var cssScale = 'scale(' + (1 / PRINT_OUTPUT_SCALE) + ', ' +
(1 / PRINT_OUTPUT_SCALE) + ')';
CustomStyle.setProp('transform' , canvas, cssScale);
CustomStyle.setProp('transformOrigin' , canvas, '0% 0%');
var printContainer = document.getElementById('printContainer');
var canvasWrapper = document.createElement('div');
canvasWrapper.style.width = viewport.width + 'pt';
canvasWrapper.style.height = viewport.height + 'pt';
canvasWrapper.appendChild(canvas);
printContainer.appendChild(canvasWrapper);
canvas.mozPrintCallback = function(obj) {
var ctx = obj.context;
ctx.save();
ctx.fillStyle = 'rgb(255, 255, 255)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.restore();
ctx.scale(PRINT_OUTPUT_SCALE, PRINT_OUTPUT_SCALE);
var renderContext = {
canvasContext: ctx,
viewport: viewport,
intent: 'print'
};
pdfPage.render(renderContext).promise.then(function() {
// Tell the printEngine that rendering this canvas/page has finished.
obj.done();
}, function(error) {
console.error(error);
// Tell the printEngine that rendering this canvas/page has failed.
// This will make the print proces stop.
if ('abort' in obj) {
obj.abort();
} else {
obj.done();
}
});
};
},
};
return PDFPageView;
})();
var MAX_TEXT_DIVS_TO_RENDER = 100000;
var NonWhitespaceRegexp = /\S/;
function isAllWhitespace(str) {
return !NonWhitespaceRegexp.test(str);
}
/**
* @typedef {Object} TextLayerBuilderOptions
* @property {HTMLDivElement} textLayerDiv - The text layer container.
* @property {number} pageIndex - The page index.
* @property {PageViewport} viewport - The viewport of the text layer.
* @property {PDFFindController} findController
*/
/**
* TextLayerBuilder provides text-selection functionality for the PDF.
* It does this by creating overlay divs over the PDF text. These divs
* contain text that matches the PDF text they are overlaying. This object
* also provides a way to highlight text that is being searched for.
* @class
*/
var TextLayerBuilder = (function TextLayerBuilderClosure() {
function TextLayerBuilder(options) {
this.textLayerDiv = options.textLayerDiv;
this.renderingDone = false;
this.divContentDone = false;
this.pageIdx = options.pageIndex;
this.pageNumber = this.pageIdx + 1;
this.matches = [];
this.viewport = options.viewport;
this.textDivs = [];
this.findController = options.findController || null;
}
TextLayerBuilder.prototype = {
_finishRendering: function TextLayerBuilder_finishRendering() {
this.renderingDone = true;
var event = document.createEvent('CustomEvent');
event.initCustomEvent('textlayerrendered', true, true, {
pageNumber: this.pageNumber
});
this.textLayerDiv.dispatchEvent(event);
},
renderLayer: function TextLayerBuilder_renderLayer() {
var textLayerFrag = document.createDocumentFragment();
var textDivs = this.textDivs;
var textDivsLength = textDivs.length;
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
// No point in rendering many divs as it would make the browser
// unusable even after the divs are rendered.
if (textDivsLength > MAX_TEXT_DIVS_TO_RENDER) {
this._finishRendering();
return;
}
var lastFontSize;
var lastFontFamily;
for (var i = 0; i < textDivsLength; i++) {
var textDiv = textDivs[i];
if (textDiv.dataset.isWhitespace !== undefined) {
continue;
}
var fontSize = textDiv.style.fontSize;
var fontFamily = textDiv.style.fontFamily;
// Only build font string and set to context if different from last.
if (fontSize !== lastFontSize || fontFamily !== lastFontFamily) {
ctx.font = fontSize + ' ' + fontFamily;
lastFontSize = fontSize;
lastFontFamily = fontFamily;
}
var width = ctx.measureText(textDiv.textContent).width;
if (width > 0) {
textLayerFrag.appendChild(textDiv);
var transform;
if (textDiv.dataset.canvasWidth !== undefined) {
// Dataset values come of type string.
var textScale = textDiv.dataset.canvasWidth / width;
transform = 'scaleX(' + textScale + ')';
} else {
transform = '';
}
var rotation = textDiv.dataset.angle;
if (rotation) {
transform = 'rotate(' + rotation + 'deg) ' + transform;
}
if (transform) {
CustomStyle.setProp('transform' , textDiv, transform);
}
}
}
this.textLayerDiv.appendChild(textLayerFrag);
this._finishRendering();
this.updateMatches();
},
/**
* Renders the text layer.
* @param {number} timeout (optional) if specified, the rendering waits
* for specified amount of ms.
*/
render: function TextLayerBuilder_render(timeout) {
if (!this.divContentDone || this.renderingDone) {
return;
}
if (this.renderTimer) {
clearTimeout(this.renderTimer);
this.renderTimer = null;
}
if (!timeout) { // Render right away
this.renderLayer();
} else { // Schedule
var self = this;
this.renderTimer = setTimeout(function() {
self.renderLayer();
self.renderTimer = null;
}, timeout);
}
},
appendText: function TextLayerBuilder_appendText(geom, styles) {
var style = styles[geom.fontName];
var textDiv = document.createElement('div');
this.textDivs.push(textDiv);
if (isAllWhitespace(geom.str)) {
textDiv.dataset.isWhitespace = true;
return;
}
var tx = PDFJS.Util.transform(this.viewport.transform, geom.transform);
var angle = Math.atan2(tx[1], tx[0]);
if (style.vertical) {
angle += Math.PI / 2;
}
var fontHeight = Math.sqrt((tx[2] * tx[2]) + (tx[3] * tx[3]));
var fontAscent = fontHeight;
if (style.ascent) {
fontAscent = style.ascent * fontAscent;
} else if (style.descent) {
fontAscent = (1 + style.descent) * fontAscent;
}
var left;
var top;
if (angle === 0) {
left = tx[4];
top = tx[5] - fontAscent;
} else {
left = tx[4] + (fontAscent * Math.sin(angle));
top = tx[5] - (fontAscent * Math.cos(angle));
}
textDiv.style.left = left + 'px';
textDiv.style.top = top + 'px';
textDiv.style.fontSize = fontHeight + 'px';
textDiv.style.fontFamily = style.fontFamily;
textDiv.textContent = geom.str;
// |fontName| is only used by the Font Inspector. This test will succeed
// when e.g. the Font Inspector is off but the Stepper is on, but it's
// not worth the effort to do a more accurate test.
if (PDFJS.pdfBug) {
textDiv.dataset.fontName = geom.fontName;
}
// Storing into dataset will convert number into string.
if (angle !== 0) {
textDiv.dataset.angle = angle * (180 / Math.PI);
}
// We don't bother scaling single-char text divs, because it has very
// little effect on text highlighting. This makes scrolling on docs with
// lots of such divs a lot faster.
if (textDiv.textContent.length > 1) {
if (style.vertical) {
textDiv.dataset.canvasWidth = geom.height * this.viewport.scale;
} else {
textDiv.dataset.canvasWidth = geom.width * this.viewport.scale;
}
}
},
setTextContent: function TextLayerBuilder_setTextContent(textContent) {
this.textContent = textContent;
var textItems = textContent.items;
for (var i = 0, len = textItems.length; i < len; i++) {
this.appendText(textItems[i], textContent.styles);
}
this.divContentDone = true;
},
convertMatches: function TextLayerBuilder_convertMatches(matches) {
var i = 0;
var iIndex = 0;
var bidiTexts = this.textContent.items;
var end = bidiTexts.length - 1;
var queryLen = (this.findController === null ?
0 : this.findController.state.query.length);
var ret = [];
for (var m = 0, len = matches.length; m < len; m++) {
// Calculate the start position.
var matchIdx = matches[m];
// Loop over the divIdxs.
while (i !== end && matchIdx >= (iIndex + bidiTexts[i].str.length)) {
iIndex += bidiTexts[i].str.length;
i++;
}
if (i === bidiTexts.length) {
console.error('Could not find a matching mapping');
}
var match = {
begin: {
divIdx: i,
offset: matchIdx - iIndex
}
};
// Calculate the end position.
matchIdx += queryLen;
// Somewhat the same array as above, but use > instead of >= to get
// the end position right.
while (i !== end && matchIdx > (iIndex + bidiTexts[i].str.length)) {
iIndex += bidiTexts[i].str.length;
i++;
}
match.end = {
divIdx: i,
offset: matchIdx - iIndex
};
ret.push(match);
}
return ret;
},
renderMatches: function TextLayerBuilder_renderMatches(matches) {
// Early exit if there is nothing to render.
if (matches.length === 0) {
return;
}
var bidiTexts = this.textContent.items;
var textDivs = this.textDivs;
var prevEnd = null;
var pageIdx = this.pageIdx;
var isSelectedPage = (this.findController === null ?
false : (pageIdx === this.findController.selected.pageIdx));
var selectedMatchIdx = (this.findController === null ?
-1 : this.findController.selected.matchIdx);
var highlightAll = (this.findController === null ?
false : this.findController.state.highlightAll);
var infinity = {
divIdx: -1,
offset: undefined
};
function beginText(begin, className) {
var divIdx = begin.divIdx;
textDivs[divIdx].textContent = '';
appendTextToDiv(divIdx, 0, begin.offset, className);
}
function appendTextToDiv(divIdx, fromOffset, toOffset, className) {
var div = textDivs[divIdx];
var content = bidiTexts[divIdx].str.substring(fromOffset, toOffset);
var node = document.createTextNode(content);
if (className) {
var span = document.createElement('span');
span.className = className;
span.appendChild(node);
div.appendChild(span);
return;
}
div.appendChild(node);
}
var i0 = selectedMatchIdx, i1 = i0 + 1;
if (highlightAll) {
i0 = 0;
i1 = matches.length;
} else if (!isSelectedPage) {
// Not highlighting all and this isn't the selected page, so do nothing.
return;
}
for (var i = i0; i < i1; i++) {
var match = matches[i];
var begin = match.begin;
var end = match.end;
var isSelected = (isSelectedPage && i === selectedMatchIdx);
var highlightSuffix = (isSelected ? ' selected' : '');
if (this.findController) {
this.findController.updateMatchPosition(pageIdx, i, textDivs,
begin.divIdx, end.divIdx);
}
// Match inside new div.
if (!prevEnd || begin.divIdx !== prevEnd.divIdx) {
// If there was a previous div, then add the text at the end.
if (prevEnd !== null) {
appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);
}
// Clear the divs and set the content until the starting point.
beginText(begin);
} else {
appendTextToDiv(prevEnd.divIdx, prevEnd.offset, begin.offset);
}
if (begin.divIdx === end.divIdx) {
appendTextToDiv(begin.divIdx, begin.offset, end.offset,
'highlight' + highlightSuffix);
} else {
appendTextToDiv(begin.divIdx, begin.offset, infinity.offset,
'highlight begin' + highlightSuffix);
for (var n0 = begin.divIdx + 1, n1 = end.divIdx; n0 < n1; n0++) {
textDivs[n0].className = 'highlight middle' + highlightSuffix;
}
beginText(end, 'highlight end' + highlightSuffix);
}
prevEnd = end;
}
if (prevEnd) {
appendTextToDiv(prevEnd.divIdx, prevEnd.offset, infinity.offset);
}
},
updateMatches: function TextLayerBuilder_updateMatches() {
// Only show matches when all rendering is done.
if (!this.renderingDone) {
return;
}
// Clear all matches.
var matches = this.matches;
var textDivs = this.textDivs;
var bidiTexts = this.textContent.items;
var clearedUntilDivIdx = -1;
// Clear all current matches.
for (var i = 0, len = matches.length; i < len; i++) {
var match = matches[i];
var begin = Math.max(clearedUntilDivIdx, match.begin.divIdx);
for (var n = begin, end = match.end.divIdx; n <= end; n++) {
var div = textDivs[n];
div.textContent = bidiTexts[n].str;
div.className = '';
}
clearedUntilDivIdx = match.end.divIdx + 1;
}
if (this.findController === null || !this.findController.active) {
return;
}
// Convert the matches on the page controller into the match format
// used for the textLayer.
this.matches = this.convertMatches(this.findController === null ?
[] : (this.findController.pageMatches[this.pageIdx] || []));
this.renderMatches(this.matches);
}
};
return TextLayerBuilder;
})();
/**
* @constructor
* @implements IPDFTextLayerFactory
*/
function DefaultTextLayerFactory() {}
DefaultTextLayerFactory.prototype = {
/**
* @param {HTMLDivElement} textLayerDiv
* @param {number} pageIndex
* @param {PageViewport} viewport
* @returns {TextLayerBuilder}
*/
createTextLayerBuilder: function (textLayerDiv, pageIndex, viewport) {
return new TextLayerBuilder({
textLayerDiv: textLayerDiv,
pageIndex: pageIndex,
viewport: viewport
});
}
};
/**
* @typedef {Object} AnnotationsLayerBuilderOptions
* @property {HTMLDivElement} pageDiv
* @property {PDFPage} pdfPage
* @property {IPDFLinkService} linkService
*/
/**
* @class
*/
var AnnotationsLayerBuilder = (function AnnotationsLayerBuilderClosure() {
/**
* @param {AnnotationsLayerBuilderOptions} options
* @constructs AnnotationsLayerBuilder
*/
function AnnotationsLayerBuilder(options) {
this.pageDiv = options.pageDiv;
this.pdfPage = options.pdfPage;
this.linkService = options.linkService;
this.div = null;
}
AnnotationsLayerBuilder.prototype =
/** @lends AnnotationsLayerBuilder.prototype */ {
/**
* @param {PageViewport} viewport
*/
setupAnnotations:
function AnnotationsLayerBuilder_setupAnnotations(viewport) {
function bindLink(link, dest) {
link.href = linkService.getDestinationHash(dest);
link.onclick = function annotationsLayerBuilderLinksOnclick() {
if (dest) {
linkService.navigateTo(dest);
}
return false;
};
if (dest) {
link.className = 'internalLink';
}
}
function bindNamedAction(link, action) {
link.href = linkService.getAnchorUrl('');
link.onclick = function annotationsLayerBuilderNamedActionOnClick() {
linkService.executeNamedAction(action);
return false;
};
link.className = 'internalLink';
}
var linkService = this.linkService;
var pdfPage = this.pdfPage;
var self = this;
pdfPage.getAnnotations().then(function (annotationsData) {
viewport = viewport.clone({ dontFlip: true });
var transform = viewport.transform;
var transformStr = 'matrix(' + transform.join(',') + ')';
var data, element, i, ii;
if (self.div) {
// If an annotationLayer already exists, refresh its children's
// transformation matrices
for (i = 0, ii = annotationsData.length; i < ii; i++) {
data = annotationsData[i];
element = self.div.querySelector(
'[data-annotation-id="' + data.id + '"]');
if (element) {
CustomStyle.setProp('transform', element, transformStr);
}
}
// See PDFPageView.reset()
self.div.removeAttribute('hidden');
} else {
for (i = 0, ii = annotationsData.length; i < ii; i++) {
data = annotationsData[i];
if (!data || !data.hasHtml) {
continue;
}
element = PDFJS.AnnotationUtils.getHtmlElement(data,
pdfPage.commonObjs);
element.setAttribute('data-annotation-id', data.id);
if (typeof mozL10n !== 'undefined') {
mozL10n.translate(element);
}
var rect = data.rect;
var view = pdfPage.view;
rect = PDFJS.Util.normalizeRect([
rect[0],
view[3] - rect[1] + view[1],
rect[2],
view[3] - rect[3] + view[1]
]);
element.style.left = rect[0] + 'px';
element.style.top = rect[1] + 'px';
element.style.position = 'absolute';
CustomStyle.setProp('transform', element, transformStr);
var transformOriginStr = -rect[0] + 'px ' + -rect[1] + 'px';
CustomStyle.setProp('transformOrigin', element, transformOriginStr);
if (data.subtype === 'Link' && !data.url) {
var link = element.getElementsByTagName('a')[0];
if (link) {
if (data.action) {
bindNamedAction(link, data.action);
} else {
bindLink(link, ('dest' in data) ? data.dest : null);
}
}
}
if (!self.div) {
var annotationLayerDiv = document.createElement('div');
annotationLayerDiv.className = 'annotationLayer';
self.pageDiv.appendChild(annotationLayerDiv);
self.div = annotationLayerDiv;
}
self.div.appendChild(element);
}
}
});
},
hide: function () {
if (!this.div) {
return;
}
this.div.setAttribute('hidden', 'true');
}
};
return AnnotationsLayerBuilder;
})();
/**
* @constructor
* @implements IPDFAnnotationsLayerFactory
*/
function DefaultAnnotationsLayerFactory() {}
DefaultAnnotationsLayerFactory.prototype = {
/**
* @param {HTMLDivElement} pageDiv
* @param {PDFPage} pdfPage
* @returns {AnnotationsLayerBuilder}
*/
createAnnotationsLayerBuilder: function (pageDiv, pdfPage) {
return new AnnotationsLayerBuilder({
pageDiv: pageDiv,
pdfPage: pdfPage
});
}
};
/**
* @typedef {Object} PDFViewerOptions
* @property {HTMLDivElement} container - The container for the viewer element.
* @property {HTMLDivElement} viewer - (optional) The viewer element.
* @property {IPDFLinkService} linkService - The navigation/linking service.
* @property {PDFRenderingQueue} renderingQueue - (optional) The rendering
* queue object.
*/
/**
* Simple viewer control to display PDF content/pages.
* @class
* @implements {IRenderableView}
*/
var PDFViewer = (function pdfViewer() {
function PDFPageViewBuffer(size) {
var data = [];
this.push = function cachePush(view) {
var i = data.indexOf(view);
if (i >= 0) {
data.splice(i, 1);
}
data.push(view);
if (data.length > size) {
data.shift().destroy();
}
};
this.resize = function (newSize) {
size = newSize;
while (data.length > size) {
data.shift().destroy();
}
};
}
/**
* @constructs PDFViewer
* @param {PDFViewerOptions} options
*/
function PDFViewer(options) {
this.container = options.container;
this.viewer = options.viewer || options.container.firstElementChild;
this.linkService = options.linkService || new SimpleLinkService(this);
this.defaultRenderingQueue = !options.renderingQueue;
if (this.defaultRenderingQueue) {
// Custom rendering queue is not specified, using default one
this.renderingQueue = new PDFRenderingQueue();
this.renderingQueue.setViewer(this);
} else {
this.renderingQueue = options.renderingQueue;
}
this.scroll = watchScroll(this.container, this._scrollUpdate.bind(this));
this.updateInProgress = false;
this.presentationModeState = PresentationModeState.UNKNOWN;
this._resetView();
}
PDFViewer.prototype = /** @lends PDFViewer.prototype */{
get pagesCount() {
return this.pages.length;
},
getPageView: function (index) {
return this.pages[index];
},
get currentPageNumber() {
return this._currentPageNumber;
},
set currentPageNumber(val) {
if (!this.pdfDocument) {
this._currentPageNumber = val;
return;
}
var event = document.createEvent('UIEvents');
event.initUIEvent('pagechange', true, true, window, 0);
event.updateInProgress = this.updateInProgress;
if (!(0 < val && val <= this.pagesCount)) {
event.pageNumber = this._currentPageNumber;
event.previousPageNumber = val;
this.container.dispatchEvent(event);
return;
}
event.previousPageNumber = this._currentPageNumber;
this._currentPageNumber = val;
event.pageNumber = val;
this.container.dispatchEvent(event);
},
/**
* @returns {number}
*/
get currentScale() {
return this._currentScale;
},
/**
* @param {number} val - Scale of the pages in percents.
*/
set currentScale(val) {
if (isNaN(val)) {
throw new Error('Invalid numeric scale');
}
if (!this.pdfDocument) {
this._currentScale = val;
this._currentScaleValue = val.toString();
return;
}
this._setScale(val, false);
},
/**
* @returns {string}
*/
get currentScaleValue() {
return this._currentScaleValue;
},
/**
* @param val - The scale of the pages (in percent or predefined value).
*/
set currentScaleValue(val) {
if (!this.pdfDocument) {
this._currentScale = isNaN(val) ? UNKNOWN_SCALE : val;
this._currentScaleValue = val;
return;
}
this._setScale(val, false);
},
/**
* @returns {number}
*/
get pagesRotation() {
return this._pagesRotation;
},
/**
* @param {number} rotation - The rotation of the pages (0, 90, 180, 270).
*/
set pagesRotation(rotation) {
this._pagesRotation = rotation;
for (var i = 0, l = this.pages.length; i < l; i++) {
var page = this.pages[i];
page.update(page.scale, rotation);
}
this._setScale(this._currentScaleValue, true);
},
/**
* @param pdfDocument {PDFDocument}
*/
setDocument: function (pdfDocument) {
if (this.pdfDocument) {
this._resetView();
}
this.pdfDocument = pdfDocument;
if (!pdfDocument) {
return;
}
var pagesCount = pdfDocument.numPages;
document.getElementById('numPages').textContent =
mozL10n.get('page_of', {pageCount: pagesCount}, 'of {{pageCount}}');
document.getElementById('pageNumber').textContent = '1';
var pagesRefMap = this.pagesRefMap = {};
var self = this;
var resolvePagesPromise;
var pagesPromise = new Promise(function (resolve) {
resolvePagesPromise = resolve;
});
this.pagesPromise = pagesPromise;
pagesPromise.then(function () {
var event = document.createEvent('CustomEvent');
event.initCustomEvent('pagesloaded', true, true, {
pagesCount: pagesCount
});
self.container.dispatchEvent(event);
});
var isOnePageRenderedResolved = false;
var resolveOnePageRendered = null;
var onePageRendered = new Promise(function (resolve) {
resolveOnePageRendered = resolve;
});
this.onePageRendered = onePageRendered;
var bindOnAfterAndBeforeDraw = function (pageView) {
pageView.onBeforeDraw = function pdfViewLoadOnBeforeDraw() {
// Add the page to the buffer at the start of drawing. That way it can
// be evicted from the buffer and destroyed even if we pause its
// rendering.
self._buffer.push(this);
};
// when page is painted, using the image as thumbnail base
pageView.onAfterDraw = function pdfViewLoadOnAfterDraw() {
if (!isOnePageRenderedResolved) {
isOnePageRenderedResolved = true;
resolveOnePageRendered();
}
};
};
var firstPagePromise = pdfDocument.getPage(1);
this.firstPagePromise = firstPagePromise;
// Fetch a single page so we can get a viewport that will be the default
// viewport for all pages
return firstPagePromise.then(function(pdfPage) {
var scale = this._currentScale || 1.0;
var viewport = pdfPage.getViewport(scale * CSS_UNITS);
for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {
var textLayerFactory = null;
if (!PDFJS.disableTextLayer) {
textLayerFactory = this;
}
var pageView = new PDFPageView({
container: this.viewer,
id: pageNum,
scale: scale,
defaultViewport: viewport.clone(),
renderingQueue: this.renderingQueue,
textLayerFactory: textLayerFactory,
annotationsLayerFactory: this
});
bindOnAfterAndBeforeDraw(pageView);
this.pages.push(pageView);
}
// Fetch all the pages since the viewport is needed before printing
// starts to create the correct size canvas. Wait until one page is
// rendered so we don't tie up too many resources early on.
onePageRendered.then(function () {
if (!PDFJS.disableAutoFetch) {
var getPagesLeft = pagesCount;
for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {
pdfDocument.getPage(pageNum).then(function (pageNum, pdfPage) {
var pageView = self.pages[pageNum - 1];
if (!pageView.pdfPage) {
pageView.setPdfPage(pdfPage);
}
var refStr = pdfPage.ref.num + ' ' + pdfPage.ref.gen + ' R';
pagesRefMap[refStr] = pageNum;
getPagesLeft--;
if (!getPagesLeft) {
resolvePagesPromise();
}
}.bind(null, pageNum));
}
} else {
// XXX: Printing is semi-broken with auto fetch disabled.
resolvePagesPromise();
}
});
var event = document.createEvent('CustomEvent');
event.initCustomEvent('pagesinit', true, true, null);
self.container.dispatchEvent(event);
if (this.defaultRenderingQueue) {
this.update();
}
if (this.findController) {
this.findController.resolveFirstPage();
}
}.bind(this));
},
_resetView: function () {
this.pages = [];
this._currentPageNumber = 1;
this._currentScale = UNKNOWN_SCALE;
this._currentScaleValue = null;
this._buffer = new PDFPageViewBuffer(DEFAULT_CACHE_SIZE);
this.location = null;
this._pagesRotation = 0;
this._pagesRequests = [];
var container = this.viewer;
while (container.hasChildNodes()) {
container.removeChild(container.lastChild);
}
},
_scrollUpdate: function () {
if (this.pagesCount === 0) {
return;
}
this.update();
for (var i = 0, ii = this.pages.length; i < ii; i++) {
this.pages[i].updatePosition();
}
},
_setScaleDispatchEvent: function pdfViewer_setScaleDispatchEvent(
newScale, newValue, preset) {
var event = document.createEvent('UIEvents');
event.initUIEvent('scalechange', true, true, window, 0);
event.scale = newScale;
if (preset) {
event.presetValue = newValue;
}
this.container.dispatchEvent(event);
},
_setScaleUpdatePages: function pdfViewer_setScaleUpdatePages(
newScale, newValue, noScroll, preset) {
this._currentScaleValue = newValue;
if (newScale === this._currentScale) {
if (preset) {
this._setScaleDispatchEvent(newScale, newValue, true);
}
return;
}
for (var i = 0, ii = this.pages.length; i < ii; i++) {
this.pages[i].update(newScale);
}
this._currentScale = newScale;
if (!noScroll) {
var page = this._currentPageNumber, dest;
var inPresentationMode =
this.presentationModeState === PresentationModeState.CHANGING ||
this.presentationModeState === PresentationModeState.FULLSCREEN;
if (this.location && !inPresentationMode &&
!IGNORE_CURRENT_POSITION_ON_ZOOM) {
page = this.location.pageNumber;
dest = [null, { name: 'XYZ' }, this.location.left,
this.location.top, null];
}
this.scrollPageIntoView(page, dest);
}
this._setScaleDispatchEvent(newScale, newValue, preset);
},
_setScale: function pdfViewer_setScale(value, noScroll) {
if (value === 'custom') {
return;
}
var scale = parseFloat(value);
if (scale > 0) {
this._setScaleUpdatePages(scale, value, noScroll, false);
} else {
var currentPage = this.pages[this._currentPageNumber - 1];
if (!currentPage) {
return;
}
var inPresentationMode =
this.presentationModeState === PresentationModeState.FULLSCREEN;
var hPadding = inPresentationMode ? 0 : SCROLLBAR_PADDING;
var vPadding = inPresentationMode ? 0 : VERTICAL_PADDING;
var pageWidthScale = (this.container.clientWidth - hPadding) /
currentPage.width * currentPage.scale;
var pageHeightScale = (this.container.clientHeight - vPadding) /
currentPage.height * currentPage.scale;
switch (value) {
case 'page-actual':
scale = 1;
break;
case 'page-width':
scale = pageWidthScale;
break;
case 'page-height':
scale = pageHeightScale;
break;
case 'page-fit':
scale = Math.min(pageWidthScale, pageHeightScale);
break;
case 'auto':
var isLandscape = (currentPage.width > currentPage.height);
// For pages in landscape mode, fit the page height to the viewer
// *unless* the page would thus become too wide to fit horizontally.
var horizontalScale = isLandscape ?
Math.min(pageHeightScale, pageWidthScale) : pageWidthScale;
scale = Math.min(MAX_AUTO_SCALE, horizontalScale);
break;
default:
console.error('pdfViewSetScale: \'' + value +
'\' is an unknown zoom value.');
return;
}
this._setScaleUpdatePages(scale, value, noScroll, true);
}
},
/**
* Scrolls page into view.
* @param {number} pageNumber
* @param {Array} dest - (optional) original PDF destination array:
* <page-ref> </XYZ|FitXXX> <args..>
*/
scrollPageIntoView: function PDFViewer_scrollPageIntoView(pageNumber,
dest) {
var pageView = this.pages[pageNumber - 1];
if (this.presentationModeState ===
PresentationModeState.FULLSCREEN) {
if (this.linkService.page !== pageView.id) {
// Avoid breaking getVisiblePages in presentation mode.
this.linkService.page = pageView.id;
return;
}
dest = null;
// Fixes the case when PDF has different page sizes.
this._setScale(this.currentScaleValue, true);
}
if (!dest) {
scrollIntoView(pageView.div);
return;
}
var x = 0, y = 0;
var width = 0, height = 0, widthScale, heightScale;
var changeOrientation = (pageView.rotation % 180 === 0 ? false : true);
var pageWidth = (changeOrientation ? pageView.height : pageView.width) /
pageView.scale / CSS_UNITS;
var pageHeight = (changeOrientation ? pageView.width : pageView.height) /
pageView.scale / CSS_UNITS;
var scale = 0;
switch (dest[1].name) {
case 'XYZ':
x = dest[2];
y = dest[3];
scale = dest[4];
// If x and/or y coordinates are not supplied, default to
// _top_ left of the page (not the obvious bottom left,
// since aligning the bottom of the intended page with the
// top of the window is rarely helpful).
x = x !== null ? x : 0;
y = y !== null ? y : pageHeight;
break;
case 'Fit':
case 'FitB':
scale = 'page-fit';
break;
case 'FitH':
case 'FitBH':
y = dest[2];
scale = 'page-width';
break;
case 'FitV':
case 'FitBV':
x = dest[2];
width = pageWidth;
height = pageHeight;
scale = 'page-height';
break;
case 'FitR':
x = dest[2];
y = dest[3];
width = dest[4] - x;
height = dest[5] - y;
var viewerContainer = this.container;
widthScale = (viewerContainer.clientWidth - SCROLLBAR_PADDING) /
width / CSS_UNITS;
heightScale = (viewerContainer.clientHeight - SCROLLBAR_PADDING) /
height / CSS_UNITS;
scale = Math.min(Math.abs(widthScale), Math.abs(heightScale));
break;
default:
return;
}
if (scale && scale !== this.currentScale) {
this.currentScaleValue = scale;
} else if (this.currentScale === UNKNOWN_SCALE) {
this.currentScaleValue = DEFAULT_SCALE;
}
if (scale === 'page-fit' && !dest[4]) {
scrollIntoView(pageView.div);
return;
}
var boundingRect = [
pageView.viewport.convertToViewportPoint(x, y),
pageView.viewport.convertToViewportPoint(x + width, y + height)
];
var left = Math.min(boundingRect[0][0], boundingRect[1][0]);
var top = Math.min(boundingRect[0][1], boundingRect[1][1]);
scrollIntoView(pageView.div, { left: left, top: top });
},
_updateLocation: function (firstPage) {
var currentScale = this._currentScale;
var currentScaleValue = this._currentScaleValue;
var normalizedScaleValue =
parseFloat(currentScaleValue) === currentScale ?
Math.round(currentScale * 10000) / 100 : currentScaleValue;
var pageNumber = firstPage.id;
var pdfOpenParams = '#page=' + pageNumber;
pdfOpenParams += '&zoom=' + normalizedScaleValue;
var currentPageView = this.pages[pageNumber - 1];
var container = this.container;
var topLeft = currentPageView.getPagePoint(
(container.scrollLeft - firstPage.x),
(container.scrollTop - firstPage.y));
var intLeft = Math.round(topLeft[0]);
var intTop = Math.round(topLeft[1]);
pdfOpenParams += ',' + intLeft + ',' + intTop;
this.location = {
pageNumber: pageNumber,
scale: normalizedScaleValue,
top: intTop,
left: intLeft,
pdfOpenParams: pdfOpenParams
};
},
update: function () {
var visible = this._getVisiblePages();
var visiblePages = visible.views;
if (visiblePages.length === 0) {
return;
}
this.updateInProgress = true;
var suggestedCacheSize = Math.max(DEFAULT_CACHE_SIZE,
2 * visiblePages.length + 1);
this._buffer.resize(suggestedCacheSize);
this.renderingQueue.renderHighestPriority(visible);
var currentId = this.currentPageNumber;
var firstPage = visible.first;
for (var i = 0, ii = visiblePages.length, stillFullyVisible = false;
i < ii; ++i) {
var page = visiblePages[i];
if (page.percent < 100) {
break;
}
if (page.id === currentId) {
stillFullyVisible = true;
break;
}
}
if (!stillFullyVisible) {
currentId = visiblePages[0].id;
}
if (this.presentationModeState !== PresentationModeState.FULLSCREEN) {
this.currentPageNumber = currentId;
}
this._updateLocation(firstPage);
this.updateInProgress = false;
var event = document.createEvent('UIEvents');
event.initUIEvent('updateviewarea', true, true, window, 0);
this.container.dispatchEvent(event);
},
containsElement: function (element) {
return this.container.contains(element);
},
focus: function () {
this.container.focus();
},
blur: function () {
this.container.blur();
},
get isHorizontalScrollbarEnabled() {
return (this.presentationModeState === PresentationModeState.FULLSCREEN ?
false : (this.container.scrollWidth > this.container.clientWidth));
},
_getVisiblePages: function () {
if (this.presentationModeState !== PresentationModeState.FULLSCREEN) {
return getVisibleElements(this.container, this.pages, true);
} else {
// The algorithm in getVisibleElements doesn't work in all browsers and
// configurations when presentation mode is active.
var visible = [];
var currentPage = this.pages[this._currentPageNumber - 1];
visible.push({ id: currentPage.id, view: currentPage });
return { first: currentPage, last: currentPage, views: visible };
}
},
cleanup: function () {
for (var i = 0, ii = this.pages.length; i < ii; i++) {
if (this.pages[i] &&
this.pages[i].renderingState !== RenderingStates.FINISHED) {
this.pages[i].reset();
}
}
},
/**
* @param {PDFPageView} pageView
* @returns {PDFPage}
* @private
*/
_ensurePdfPageLoaded: function (pageView) {
if (pageView.pdfPage) {
return Promise.resolve(pageView.pdfPage);
}
var pageNumber = pageView.id;
if (this._pagesRequests[pageNumber]) {
return this._pagesRequests[pageNumber];
}
var promise = this.pdfDocument.getPage(pageNumber).then(
function (pdfPage) {
pageView.setPdfPage(pdfPage);
this._pagesRequests[pageNumber] = null;
return pdfPage;
}.bind(this));
this._pagesRequests[pageNumber] = promise;
return promise;
},
forceRendering: function (currentlyVisiblePages) {
var visiblePages = currentlyVisiblePages || this._getVisiblePages();
var pageView = this.renderingQueue.getHighestPriority(visiblePages,
this.pages,
this.scroll.down);
if (pageView) {
this._ensurePdfPageLoaded(pageView).then(function () {
this.renderingQueue.renderView(pageView);
}.bind(this));
return true;
}
return false;
},
getPageTextContent: function (pageIndex) {
return this.pdfDocument.getPage(pageIndex + 1).then(function (page) {
return page.getTextContent();
});
},
/**
* @param {HTMLDivElement} textLayerDiv
* @param {number} pageIndex
* @param {PageViewport} viewport
* @returns {TextLayerBuilder}
*/
createTextLayerBuilder: function (textLayerDiv, pageIndex, viewport) {
var isViewerInPresentationMode =
this.presentationModeState === PresentationModeState.FULLSCREEN;
return new TextLayerBuilder({
textLayerDiv: textLayerDiv,
pageIndex: pageIndex,
viewport: viewport,
findController: isViewerInPresentationMode ? null : this.findController
});
},
/**
* @param {HTMLDivElement} pageDiv
* @param {PDFPage} pdfPage
* @returns {AnnotationsLayerBuilder}
*/
createAnnotationsLayerBuilder: function (pageDiv, pdfPage) {
return new AnnotationsLayerBuilder({
pageDiv: pageDiv,
pdfPage: pdfPage,
linkService: this.linkService
});
},
setFindController: function (findController) {
this.findController = findController;
},
};
return PDFViewer;
})();
var SimpleLinkService = (function SimpleLinkServiceClosure() {
function SimpleLinkService(pdfViewer) {
this.pdfViewer = pdfViewer;
}
SimpleLinkService.prototype = {
/**
* @returns {number}
*/
get page() {
return this.pdfViewer.currentPageNumber;
},
/**
* @param {number} value
*/
set page(value) {
this.pdfViewer.currentPageNumber = value;
},
/**
* @param dest - The PDF destination object.
*/
navigateTo: function (dest) {},
/**
* @param dest - The PDF destination object.
* @returns {string} The hyperlink to the PDF object.
*/
getDestinationHash: function (dest) {
return '#';
},
/**
* @param hash - The PDF parameters/hash.
* @returns {string} The hyperlink to the PDF object.
*/
getAnchorUrl: function (hash) {
return '#';
},
/**
* @param {string} hash
*/
setHash: function (hash) {},
/**
* @param {string} action
*/
executeNamedAction: function (action) {},
};
return SimpleLinkService;
})();
var THUMBNAIL_SCROLL_MARGIN = -19;
var THUMBNAIL_WIDTH = 98; // px
var THUMBNAIL_CANVAS_BORDER_WIDTH = 1; // px
/**
* @typedef {Object} PDFThumbnailViewOptions
* @property {HTMLDivElement} container - The viewer element.
* @property {number} id - The thumbnail's unique ID (normally its number).
* @property {PageViewport} defaultViewport - The page viewport.
* @property {IPDFLinkService} linkService - The navigation/linking service.
* @property {PDFRenderingQueue} renderingQueue - The rendering queue object.
*/
/**
* @class
* @implements {IRenderableView}
*/
var PDFThumbnailView = (function PDFThumbnailViewClosure() {
function getTempCanvas(width, height) {
var tempCanvas = PDFThumbnailView.tempImageCache;
if (!tempCanvas) {
tempCanvas = document.createElement('canvas');
PDFThumbnailView.tempImageCache = tempCanvas;
}
tempCanvas.width = width;
tempCanvas.height = height;
// Since this is a temporary canvas, we need to fill the canvas with a white
// background ourselves. |_getPageDrawContext| uses CSS rules for this.
var ctx = tempCanvas.getContext('2d');
ctx.save();
ctx.fillStyle = 'rgb(255, 255, 255)';
ctx.fillRect(0, 0, width, height);
ctx.restore();
return tempCanvas;
}
/**
* @constructs PDFThumbnailView
* @param {PDFThumbnailViewOptions} options
*/
function PDFThumbnailView(options) {
var container = options.container;
var id = options.id;
var defaultViewport = options.defaultViewport;
var linkService = options.linkService;
var renderingQueue = options.renderingQueue;
this.id = id;
this.renderingId = 'thumbnail' + id;
this.pdfPage = null;
this.rotation = 0;
this.viewport = defaultViewport;
this.pdfPageRotate = defaultViewport.rotation;
this.linkService = linkService;
this.renderingQueue = renderingQueue;
this.hasImage = false;
this.resume = null;
this.renderingState = RenderingStates.INITIAL;
this.pageWidth = this.viewport.width;
this.pageHeight = this.viewport.height;
this.pageRatio = this.pageWidth / this.pageHeight;
this.canvasWidth = THUMBNAIL_WIDTH;
this.canvasHeight = (this.canvasWidth / this.pageRatio) | 0;
this.scale = this.canvasWidth / this.pageWidth;
var anchor = document.createElement('a');
anchor.href = linkService.getAnchorUrl('#page=' + id);
anchor.title = mozL10n.get('thumb_page_title', {page: id}, 'Page {{page}}');
anchor.onclick = function stopNavigation() {
linkService.page = id;
return false;
};
var div = document.createElement('div');
div.id = 'thumbnailContainer' + id;
div.className = 'thumbnail';
this.div = div;
if (id === 1) {
// Highlight the thumbnail of the first page when no page number is
// specified (or exists in cache) when the document is loaded.
div.classList.add('selected');
}
var ring = document.createElement('div');
ring.className = 'thumbnailSelectionRing';
var borderAdjustment = 2 * THUMBNAIL_CANVAS_BORDER_WIDTH;
ring.style.width = this.canvasWidth + borderAdjustment + 'px';
ring.style.height = this.canvasHeight + borderAdjustment + 'px';
this.ring = ring;
div.appendChild(ring);
anchor.appendChild(div);
container.appendChild(anchor);
}
PDFThumbnailView.prototype = {
setPdfPage: function PDFThumbnailView_setPdfPage(pdfPage) {
this.pdfPage = pdfPage;
this.pdfPageRotate = pdfPage.rotate;
var totalRotation = (this.rotation + this.pdfPageRotate) % 360;
this.viewport = pdfPage.getViewport(1, totalRotation);
this.reset();
},
reset: function PDFThumbnailView_reset() {
if (this.renderTask) {
this.renderTask.cancel();
}
this.hasImage = false;
this.resume = null;
this.renderingState = RenderingStates.INITIAL;
this.pageWidth = this.viewport.width;
this.pageHeight = this.viewport.height;
this.pageRatio = this.pageWidth / this.pageHeight;
this.canvasHeight = (this.canvasWidth / this.pageRatio) | 0;
this.scale = (this.canvasWidth / this.pageWidth);
this.div.removeAttribute('data-loaded');
var ring = this.ring;
var childNodes = ring.childNodes;
for (var i = childNodes.length - 1; i >= 0; i--) {
ring.removeChild(childNodes[i]);
}
var borderAdjustment = 2 * THUMBNAIL_CANVAS_BORDER_WIDTH;
ring.style.width = this.canvasWidth + borderAdjustment + 'px';
ring.style.height = this.canvasHeight + borderAdjustment + 'px';
if (this.canvas) {
// Zeroing the width and height causes Firefox to release graphics
// resources immediately, which can greatly reduce memory consumption.
this.canvas.width = 0;
this.canvas.height = 0;
delete this.canvas;
}
},
update: function PDFThumbnailView_update(rotation) {
if (typeof rotation !== 'undefined') {
this.rotation = rotation;
}
var totalRotation = (this.rotation + this.pdfPageRotate) % 360;
this.viewport = this.viewport.clone({
scale: 1,
rotation: totalRotation
});
this.reset();
},
/**
* @private
*/
_getPageDrawContext: function PDFThumbnailView_getPageDrawContext() {
var canvas = document.createElement('canvas');
canvas.id = this.renderingId;
canvas.width = this.canvasWidth;
canvas.height = this.canvasHeight;
canvas.className = 'thumbnailImage';
canvas.setAttribute('aria-label', mozL10n.get('thumb_page_canvas',
{page: this.id}, 'Thumbnail of Page {{page}}'));
this.canvas = canvas;
this.div.setAttribute('data-loaded', true);
this.ring.appendChild(canvas);
return canvas.getContext('2d');
},
draw: function PDFThumbnailView_draw() {
if (this.renderingState !== RenderingStates.INITIAL) {
console.error('Must be in new state before drawing');
}
if (this.hasImage) {
return Promise.resolve(undefined);
}
this.hasImage = true;
this.renderingState = RenderingStates.RUNNING;
var resolveRenderPromise, rejectRenderPromise;
var promise = new Promise(function (resolve, reject) {
resolveRenderPromise = resolve;
rejectRenderPromise = reject;
});
var self = this;
function thumbnailDrawCallback(error) {
// The renderTask may have been replaced by a new one, so only remove
// the reference to the renderTask if it matches the one that is
// triggering this callback.
if (renderTask === self.renderTask) {
self.renderTask = null;
}
if (error === 'cancelled') {
rejectRenderPromise(error);
return;
}
self.renderingState = RenderingStates.FINISHED;
if (!error) {
resolveRenderPromise(undefined);
} else {
rejectRenderPromise(error);
}
}
var ctx = this._getPageDrawContext();
var drawViewport = this.viewport.clone({ scale: this.scale });
var renderContinueCallback = function renderContinueCallback(cont) {
if (!self.renderingQueue.isHighestPriority(self)) {
self.renderingState = RenderingStates.PAUSED;
self.resume = function resumeCallback() {
self.renderingState = RenderingStates.RUNNING;
cont();
};
return;
}
cont();
};
var renderContext = {
canvasContext: ctx,
viewport: drawViewport,
continueCallback: renderContinueCallback
};
var renderTask = this.renderTask = this.pdfPage.render(renderContext);
renderTask.promise.then(
function pdfPageRenderCallback() {
thumbnailDrawCallback(null);
},
function pdfPageRenderError(error) {
thumbnailDrawCallback(error);
}
);
return promise;
},
setImage: function PDFThumbnailView_setImage(pageView) {
var img = pageView.canvas;
if (this.hasImage || !img) {
return;
}
if (!this.pdfPage) {
this.setPdfPage(pageView.pdfPage);
}
this.hasImage = true;
this.renderingState = RenderingStates.FINISHED;
var ctx = this._getPageDrawContext();
var canvas = ctx.canvas;
if (img.width <= 2 * canvas.width) {
ctx.drawImage(img, 0, 0, img.width, img.height,
0, 0, canvas.width, canvas.height);
return;
}
// drawImage does an awful job of rescaling the image, doing it gradually.
var MAX_NUM_SCALING_STEPS = 3;
var reducedWidth = canvas.width << MAX_NUM_SCALING_STEPS;
var reducedHeight = canvas.height << MAX_NUM_SCALING_STEPS;
var reducedImage = getTempCanvas(reducedWidth, reducedHeight);
var reducedImageCtx = reducedImage.getContext('2d');
while (reducedWidth > img.width || reducedHeight > img.height) {
reducedWidth >>= 1;
reducedHeight >>= 1;
}
reducedImageCtx.drawImage(img, 0, 0, img.width, img.height,
0, 0, reducedWidth, reducedHeight);
while (reducedWidth > 2 * canvas.width) {
reducedImageCtx.drawImage(reducedImage,
0, 0, reducedWidth, reducedHeight,
0, 0, reducedWidth >> 1, reducedHeight >> 1);
reducedWidth >>= 1;
reducedHeight >>= 1;
}
ctx.drawImage(reducedImage, 0, 0, reducedWidth, reducedHeight,
0, 0, canvas.width, canvas.height);
}
};
return PDFThumbnailView;
})();
PDFThumbnailView.tempImageCache = null;
/**
* @typedef {Object} PDFThumbnailViewerOptions
* @property {HTMLDivElement} container - The container for the thumbnail
* elements.
* @property {IPDFLinkService} linkService - The navigation/linking service.
* @property {PDFRenderingQueue} renderingQueue - The rendering queue object.
*/
/**
* Simple viewer control to display thumbnails for pages.
* @class
* @implements {IRenderableView}
*/
var PDFThumbnailViewer = (function PDFThumbnailViewerClosure() {
/**
* @constructs PDFThumbnailViewer
* @param {PDFThumbnailViewerOptions} options
*/
function PDFThumbnailViewer(options) {
this.container = options.container;
this.renderingQueue = options.renderingQueue;
this.linkService = options.linkService;
this.scroll = watchScroll(this.container, this._scrollUpdated.bind(this));
this._resetView();
}
PDFThumbnailViewer.prototype = {
/**
* @private
*/
_scrollUpdated: function PDFThumbnailViewer_scrollUpdated() {
this.renderingQueue.renderHighestPriority();
},
getThumbnail: function PDFThumbnailViewer_getThumbnail(index) {
return this.thumbnails[index];
},
/**
* @private
*/
_getVisibleThumbs: function PDFThumbnailViewer_getVisibleThumbs() {
return getVisibleElements(this.container, this.thumbnails);
},
scrollThumbnailIntoView:
function PDFThumbnailViewer_scrollThumbnailIntoView(page) {
var selected = document.querySelector('.thumbnail.selected');
if (selected) {
selected.classList.remove('selected');
}
var thumbnail = document.getElementById('thumbnailContainer' + page);
if (thumbnail) {
thumbnail.classList.add('selected');
}
var visibleThumbs = this._getVisibleThumbs();
var numVisibleThumbs = visibleThumbs.views.length;
// If the thumbnail isn't currently visible, scroll it into view.
if (numVisibleThumbs > 0) {
var first = visibleThumbs.first.id;
// Account for only one thumbnail being visible.
var last = (numVisibleThumbs > 1 ? visibleThumbs.last.id : first);
if (page <= first || page >= last) {
scrollIntoView(thumbnail, { top: THUMBNAIL_SCROLL_MARGIN });
}
}
},
get pagesRotation() {
return this._pagesRotation;
},
set pagesRotation(rotation) {
this._pagesRotation = rotation;
for (var i = 0, l = this.thumbnails.length; i < l; i++) {
var thumb = this.thumbnails[i];
thumb.update(rotation);
}
},
cleanup: function PDFThumbnailViewer_cleanup() {
var tempCanvas = PDFThumbnailView.tempImageCache;
if (tempCanvas) {
// Zeroing the width and height causes Firefox to release graphics
// resources immediately, which can greatly reduce memory consumption.
tempCanvas.width = 0;
tempCanvas.height = 0;
}
PDFThumbnailView.tempImageCache = null;
},
/**
* @private
*/
_resetView: function PDFThumbnailViewer_resetView() {
this.thumbnails = [];
this._pagesRotation = 0;
this._pagesRequests = [];
},
setDocument: function PDFThumbnailViewer_setDocument(pdfDocument) {
if (this.pdfDocument) {
// cleanup of the elements and views
var thumbsView = this.container;
while (thumbsView.hasChildNodes()) {
thumbsView.removeChild(thumbsView.lastChild);
}
this._resetView();
}
this.pdfDocument = pdfDocument;
if (!pdfDocument) {
return Promise.resolve();
}
return pdfDocument.getPage(1).then(function (firstPage) {
var pagesCount = pdfDocument.numPages;
var viewport = firstPage.getViewport(1.0);
for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {
var thumbnail = new PDFThumbnailView({
container: this.container,
id: pageNum,
defaultViewport: viewport.clone(),
linkService: this.linkService,
renderingQueue: this.renderingQueue
});
this.thumbnails.push(thumbnail);
}
}.bind(this));
},
/**
* @param {PDFPageView} pageView
* @returns {PDFPage}
* @private
*/
_ensurePdfPageLoaded:
function PDFThumbnailViewer_ensurePdfPageLoaded(thumbView) {
if (thumbView.pdfPage) {
return Promise.resolve(thumbView.pdfPage);
}
var pageNumber = thumbView.id;
if (this._pagesRequests[pageNumber]) {
return this._pagesRequests[pageNumber];
}
var promise = this.pdfDocument.getPage(pageNumber).then(
function (pdfPage) {
thumbView.setPdfPage(pdfPage);
this._pagesRequests[pageNumber] = null;
return pdfPage;
}.bind(this));
this._pagesRequests[pageNumber] = promise;
return promise;
},
ensureThumbnailVisible:
function PDFThumbnailViewer_ensureThumbnailVisible(page) {
// Ensure that the thumbnail of the current page is visible
// when switching from another view.
scrollIntoView(document.getElementById('thumbnailContainer' + page));
},
forceRendering: function () {
var visibleThumbs = this._getVisibleThumbs();
var thumbView = this.renderingQueue.getHighestPriority(visibleThumbs,
this.thumbnails,
this.scroll.down);
if (thumbView) {
this._ensurePdfPageLoaded(thumbView).then(function () {
this.renderingQueue.renderView(thumbView);
}.bind(this));
return true;
}
return false;
}
};
return PDFThumbnailViewer;
})();
/**
* @typedef {Object} PDFOutlineViewOptions
* @property {HTMLDivElement} container - The viewer element.
* @property {Array} outline - An array of outline objects.
* @property {IPDFLinkService} linkService - The navigation/linking service.
*/
/**
* @class
*/
var PDFOutlineView = (function PDFOutlineViewClosure() {
/**
* @constructs PDFOutlineView
* @param {PDFOutlineViewOptions} options
*/
function PDFOutlineView(options) {
this.container = options.container;
this.outline = options.outline;
this.linkService = options.linkService;
}
PDFOutlineView.prototype = {
reset: function PDFOutlineView_reset() {
var container = this.container;
while (container.firstChild) {
container.removeChild(container.firstChild);
}
},
/**
* @private
*/
_bindLink: function PDFOutlineView_bindLink(element, item) {
var linkService = this.linkService;
element.href = linkService.getDestinationHash(item.dest);
element.onclick = function goToDestination(e) {
linkService.navigateTo(item.dest);
return false;
};
},
render: function PDFOutlineView_render() {
var outline = this.outline;
this.reset();
if (!outline) {
return;
}
var queue = [{ parent: this.container, items: this.outline }];
while (queue.length > 0) {
var levelData = queue.shift();
for (var i = 0, len = levelData.items.length; i < len; i++) {
var item = levelData.items[i];
var div = document.createElement('div');
div.className = 'outlineItem';
var element = document.createElement('a');
this._bindLink(element, item);
element.textContent = item.title;
div.appendChild(element);
if (item.items.length > 0) {
var itemsDiv = document.createElement('div');
itemsDiv.className = 'outlineItems';
div.appendChild(itemsDiv);
queue.push({ parent: itemsDiv, items: item.items });
}
levelData.parent.appendChild(div);
}
}
}
};
return PDFOutlineView;
})();
/**
* @typedef {Object} PDFAttachmentViewOptions
* @property {HTMLDivElement} container - The viewer element.
* @property {Array} attachments - An array of attachment objects.
* @property {DownloadManager} downloadManager - The download manager.
*/
/**
* @class
*/
var PDFAttachmentView = (function PDFAttachmentViewClosure() {
/**
* @constructs PDFAttachmentView
* @param {PDFAttachmentViewOptions} options
*/
function PDFAttachmentView(options) {
this.container = options.container;
this.attachments = options.attachments;
this.downloadManager = options.downloadManager;
}
PDFAttachmentView.prototype = {
reset: function PDFAttachmentView_reset() {
var container = this.container;
while (container.firstChild) {
container.removeChild(container.firstChild);
}
},
/**
* @private
*/
_bindLink: function PDFAttachmentView_bindLink(button, content, filename) {
button.onclick = function downloadFile(e) {
this.downloadManager.downloadData(content, filename, '');
return false;
}.bind(this);
},
render: function PDFAttachmentView_render() {
var attachments = this.attachments;
this.reset();
if (!attachments) {
return;
}
var names = Object.keys(attachments).sort(function(a, b) {
return a.toLowerCase().localeCompare(b.toLowerCase());
});
for (var i = 0, len = names.length; i < len; i++) {
var item = attachments[names[i]];
var filename = getFileName(item.filename);
var div = document.createElement('div');
div.className = 'attachmentsItem';
var button = document.createElement('button');
this._bindLink(button, item.content, filename);
button.textContent = filename;
div.appendChild(button);
this.container.appendChild(div);
}
}
};
return PDFAttachmentView;
})();
var PDFViewerApplication = {
initialBookmark: document.location.hash.substring(1),
initialized: false,
fellback: false,
pdfDocument: null,
sidebarOpen: false,
printing: false,
/** @type {PDFViewer} */
pdfViewer: null,
/** @type {PDFThumbnailViewer} */
pdfThumbnailViewer: null,
/** @type {PDFRenderingQueue} */
pdfRenderingQueue: null,
pageRotation: 0,
updateScaleControls: true,
isInitialViewSet: false,
animationStartedPromise: null,
mouseScrollTimeStamp: 0,
mouseScrollDelta: 0,
preferenceSidebarViewOnLoad: SidebarView.NONE,
preferencePdfBugEnabled: false,
preferenceShowPreviousViewOnLoad: true,
isViewerEmbedded: (window.parent !== window),
url: '',
// called once when the document is loaded
initialize: function pdfViewInitialize() {
var pdfRenderingQueue = new PDFRenderingQueue();
pdfRenderingQueue.onIdle = this.cleanup.bind(this);
this.pdfRenderingQueue = pdfRenderingQueue;
var container = document.getElementById('viewerContainer');
var viewer = document.getElementById('viewer');
this.pdfViewer = new PDFViewer({
container: container,
viewer: viewer,
renderingQueue: pdfRenderingQueue,
linkService: this
});
pdfRenderingQueue.setViewer(this.pdfViewer);
var thumbnailContainer = document.getElementById('thumbnailView');
this.pdfThumbnailViewer = new PDFThumbnailViewer({
container: thumbnailContainer,
renderingQueue: pdfRenderingQueue,
linkService: this
});
pdfRenderingQueue.setThumbnailViewer(this.pdfThumbnailViewer);
Preferences.initialize();
/*
this.findController = new PDFFindController({
pdfViewer: this.pdfViewer,
integratedFind: this.supportsIntegratedFind
});
this.pdfViewer.setFindController(this.findController);
this.findBar = new PDFFindBar({
bar: document.getElementById('findbar'),
toggleButton: document.getElementById('viewFind'),
findField: document.getElementById('findInput'),
highlightAllCheckbox: document.getElementById('findHighlightAll'),
caseSensitiveCheckbox: document.getElementById('findMatchCase'),
findMsg: document.getElementById('findMsg'),
findStatusIcon: document.getElementById('findStatusIcon'),
findPreviousButton: document.getElementById('findPrevious'),
findNextButton: document.getElementById('findNext'),
findController: this.findController
});
this.findController.setFindBar(this.findBar);
*/
HandTool.initialize({
container: container,
toggleHandTool: document.getElementById('toggleHandTool')
});
SecondaryToolbar.initialize({
toolbar: document.getElementById('secondaryToolbar'),
presentationMode: PresentationMode,
toggleButton: document.getElementById('secondaryToolbarToggle'),
presentationModeButton:
document.getElementById('secondaryPresentationMode'),
openFile: document.getElementById('secondaryOpenFile'),
print: document.getElementById('secondaryPrint'),
download: document.getElementById('secondaryDownload'),
viewBookmark: document.getElementById('secondaryViewBookmark'),
firstPage: document.getElementById('firstPage'),
lastPage: document.getElementById('lastPage'),
pageRotateCw: document.getElementById('pageRotateCw'),
pageRotateCcw: document.getElementById('pageRotateCcw'),
documentProperties: DocumentProperties,
documentPropertiesButton: document.getElementById('documentProperties')
});
PresentationMode.initialize({
container: container,
secondaryToolbar: SecondaryToolbar,
firstPage: document.getElementById('contextFirstPage'),
lastPage: document.getElementById('contextLastPage'),
pageRotateCw: document.getElementById('contextPageRotateCw'),
pageRotateCcw: document.getElementById('contextPageRotateCcw')
});
PasswordPrompt.initialize({
overlayName: 'passwordOverlay',
passwordField: document.getElementById('password'),
passwordText: document.getElementById('passwordText'),
passwordSubmit: document.getElementById('passwordSubmit'),
passwordCancel: document.getElementById('passwordCancel')
});
DocumentProperties.initialize({
overlayName: 'documentPropertiesOverlay',
closeButton: document.getElementById('documentPropertiesClose'),
fileNameField: document.getElementById('fileNameField'),
fileSizeField: document.getElementById('fileSizeField'),
titleField: document.getElementById('titleField'),
authorField: document.getElementById('authorField'),
subjectField: document.getElementById('subjectField'),
keywordsField: document.getElementById('keywordsField'),
creationDateField: document.getElementById('creationDateField'),
modificationDateField: document.getElementById('modificationDateField'),
creatorField: document.getElementById('creatorField'),
producerField: document.getElementById('producerField'),
versionField: document.getElementById('versionField'),
pageCountField: document.getElementById('pageCountField')
});
var self = this;
var initializedPromise = Promise.all([
Preferences.get('enableWebGL').then(function resolved(value) {
PDFJS.disableWebGL = !value;
}),
Preferences.get('sidebarViewOnLoad').then(function resolved(value) {
self.preferenceSidebarViewOnLoad = value;
}),
Preferences.get('pdfBugEnabled').then(function resolved(value) {
self.preferencePdfBugEnabled = value;
}),
Preferences.get('showPreviousViewOnLoad').then(function resolved(value) {
self.preferenceShowPreviousViewOnLoad = value;
if (!value && window.history.state) {
window.history.replaceState(null, '');
}
}),
Preferences.get('disableTextLayer').then(function resolved(value) {
if (PDFJS.disableTextLayer === true) {
return;
}
PDFJS.disableTextLayer = value;
}),
Preferences.get('disableRange').then(function resolved(value) {
if (PDFJS.disableRange === true) {
return;
}
PDFJS.disableRange = value;
}),
Preferences.get('disableAutoFetch').then(function resolved(value) {
PDFJS.disableAutoFetch = value;
}),
Preferences.get('disableFontFace').then(function resolved(value) {
if (PDFJS.disableFontFace === true) {
return;
}
PDFJS.disableFontFace = value;
}),
Preferences.get('useOnlyCssZoom').then(function resolved(value) {
PDFJS.useOnlyCssZoom = value;
})
// TODO move more preferences and other async stuff here
]).catch(function (reason) { });
return initializedPromise.then(function () {
PDFViewerApplication.initialized = true;
});
},
zoomIn: function pdfViewZoomIn(ticks) {
var newScale = this.pdfViewer.currentScale;
do {
newScale = (newScale * DEFAULT_SCALE_DELTA).toFixed(2);
newScale = Math.ceil(newScale * 10) / 10;
newScale = Math.min(MAX_SCALE, newScale);
} while (--ticks && newScale < MAX_SCALE);
this.setScale(newScale, true);
},
zoomOut: function pdfViewZoomOut(ticks) {
var newScale = this.pdfViewer.currentScale;
do {
newScale = (newScale / DEFAULT_SCALE_DELTA).toFixed(2);
newScale = Math.floor(newScale * 10) / 10;
newScale = Math.max(MIN_SCALE, newScale);
} while (--ticks && newScale > MIN_SCALE);
this.setScale(newScale, true);
},
get currentScaleValue() {
return this.pdfViewer.currentScaleValue;
},
get pagesCount() {
if (this.pdfDocument !== null) {
return this.pdfDocument.numPages;
};
},
set page(val) {
this.pdfViewer.currentPageNumber = val;
},
get page() {
return this.pdfViewer.currentPageNumber;
},
get supportsPrinting() {
var canvas = document.createElement('canvas');
var value = 'mozPrintCallback' in canvas;
return PDFJS.shadow(this, 'supportsPrinting', value);
},
get supportsFullscreen() {
var doc = document.documentElement;
var support = doc.requestFullscreen || doc.mozRequestFullScreen ||
doc.webkitRequestFullScreen || doc.msRequestFullscreen;
if (document.fullscreenEnabled === false ||
document.mozFullScreenEnabled === false ||
document.webkitFullscreenEnabled === false ||
document.msFullscreenEnabled === false) {
support = false;
}
if (support && PDFJS.disableFullscreen === true) {
support = false;
}
return PDFJS.shadow(this, 'supportsFullscreen', support);
},
get supportsIntegratedFind() {
var support = false;
return PDFJS.shadow(this, 'supportsIntegratedFind', support);
},
get supportsDocumentFonts() {
var support = true;
return PDFJS.shadow(this, 'supportsDocumentFonts', support);
},
get supportsDocumentColors() {
var support = true;
return PDFJS.shadow(this, 'supportsDocumentColors', support);
},
get loadingBar() {
var bar = new ProgressBar('#loadingBar', {});
return PDFJS.shadow(this, 'loadingBar', bar);
},
setTitleUsingUrl: function pdfViewSetTitleUsingUrl(url) {
this.url = url;
try {
this.setTitle(decodeURIComponent(getFileName(url)) || url);
} catch (e) {
// decodeURIComponent may throw URIError,
// fall back to using the unprocessed url in that case
this.setTitle(url);
}
},
setTitle: function pdfViewSetTitle(title) {
if (this.isViewerEmbedded) {
// Embedded PDF viewers should not be changing their parent page's title.
return;
}
document.title = title;
},
close: function pdfViewClose() {
var errorWrapper = document.getElementById('errorWrapper');
errorWrapper.setAttribute('hidden', 'true');
if (!this.pdfDocument) {
return;
}
this.pdfDocument.destroy();
this.pdfDocument = null;
this.pdfThumbnailViewer.setDocument(null);
this.pdfViewer.setDocument(null);
if (typeof PDFBug !== 'undefined') {
PDFBug.cleanup();
}
},
// TODO(mack): This function signature should really be pdfViewOpen(url, args)
open: function pdfViewOpen(file, scale, password,
pdfDataRangeTransport, args) {
if (this.pdfDocument) {
// Reload the preferences if a document was previously opened.
Preferences.reload();
}
this.close();
var parameters = {password: password};
if (typeof file === 'string') { // URL
this.setTitleUsingUrl(file);
parameters.url = file;
} else if (file && 'byteLength' in file) { // ArrayBuffer
parameters.data = file;
} else if (file.url && file.originalUrl) {
this.setTitleUsingUrl(file.originalUrl);
parameters.url = file.url;
}
if (args) {
for (var prop in args) {
parameters[prop] = args[prop];
}
}
var self = this;
self.loading = true;
self.downloadComplete = false;
var passwordNeeded = function passwordNeeded(updatePassword, reason) {
PasswordPrompt.updatePassword = updatePassword;
PasswordPrompt.reason = reason;
PasswordPrompt.open();
};
function getDocumentProgress(progressData) {
self.progress(progressData.loaded / progressData.total);
}
PDFJS.getDocument(parameters, pdfDataRangeTransport, passwordNeeded,
getDocumentProgress).then(
function getDocumentCallback(pdfDocument) {
self.load(pdfDocument, scale);
self.loading = false;
},
function getDocumentError(exception) {
var message = exception && exception.message;
var loadingErrorMessage = mozL10n.get('loading_error', null,
'An error occurred while loading the PDF.');
if (exception instanceof PDFJS.InvalidPDFException) {
// change error message also for other builds
loadingErrorMessage = mozL10n.get('invalid_file_error', null,
'Invalid or corrupted PDF file.');
} else if (exception instanceof PDFJS.MissingPDFException) {
// special message for missing PDF's
loadingErrorMessage = mozL10n.get('missing_file_error', null,
'Missing PDF file.');
} else if (exception instanceof PDFJS.UnexpectedResponseException) {
loadingErrorMessage = mozL10n.get('unexpected_response_error', null,
'Unexpected server response.');
}
var moreInfo = {
message: message
};
self.error(loadingErrorMessage, moreInfo);
self.loading = false;
}
);
if (args && args.length) {
DocumentProperties.setFileSize(args.length);
}
},
download: function pdfViewDownload() {
function downloadByUrl() {
downloadManager.downloadUrl(url, filename);
}
var url = this.url.split('#')[0];
var filename = getPDFFileNameFromURL(url);
var downloadManager = new DownloadManager();
downloadManager.onerror = function (err) {
// This error won't really be helpful because it's likely the
// fallback won't work either (or is already open).
PDFViewerApplication.error('PDF failed to download.');
};
if (!this.pdfDocument) { // the PDF is not ready yet
downloadByUrl();
return;
}
if (!this.downloadComplete) { // the PDF is still downloading
downloadByUrl();
return;
}
this.pdfDocument.getData().then(
function getDataSuccess(data) {
var blob = PDFJS.createBlob(data, 'application/pdf');
downloadManager.download(blob, url, filename);
},
downloadByUrl // Error occurred try downloading with just the url.
).then(null, downloadByUrl);
},
fallback: function pdfViewFallback(featureId) {
return;
},
navigateTo: function pdfViewNavigateTo(dest) {
var destString = '';
var self = this;
var goToDestination = function(destRef) {
self.pendingRefStr = null;
// dest array looks like that: <page-ref> </XYZ|FitXXX> <args..>
var pageNumber = destRef instanceof Object ?
self.pagesRefMap[destRef.num + ' ' + destRef.gen + ' R'] :
(destRef + 1);
if (pageNumber) {
if (pageNumber > self.pagesCount) {
pageNumber = self.pagesCount;
}
self.pdfViewer.scrollPageIntoView(pageNumber, dest);
// Update the browsing history.
PDFHistory.push({ dest: dest, hash: destString, page: pageNumber });
} else {
self.pdfDocument.getPageIndex(destRef).then(function (pageIndex) {
var pageNum = pageIndex + 1;
self.pagesRefMap[destRef.num + ' ' + destRef.gen + ' R'] = pageNum;
goToDestination(destRef);
});
}
};
var destinationPromise;
if (typeof dest === 'string') {
destString = dest;
destinationPromise = this.pdfDocument.getDestination(dest);
} else {
destinationPromise = Promise.resolve(dest);
}
destinationPromise.then(function(destination) {
dest = destination;
if (!(destination instanceof Array)) {
return; // invalid destination
}
goToDestination(destination[0]);
});
},
executeNamedAction: function pdfViewExecuteNamedAction(action) {
// See PDF reference, table 8.45 - Named action
switch (action) {
case 'GoBack':
PDFHistory.back();
break;
case 'GoForward':
PDFHistory.forward();
break;
case 'Find':
if (!this.supportsIntegratedFind) {
this.findBar.toggle();
}
break;
case 'NextPage':
this.page++;
break;
case 'PrevPage':
this.page--;
break;
case 'LastPage':
this.page = this.pagesCount;
break;
case 'FirstPage':
this.page = 1;
break;
default:
break; // No action according to spec
}
},
getDestinationHash: function pdfViewGetDestinationHash(dest) {
if (typeof dest === 'string') {
return this.getAnchorUrl('#' + escape(dest));
}
if (dest instanceof Array) {
var destRef = dest[0]; // see navigateTo method for dest format
var pageNumber = destRef instanceof Object ?
this.pagesRefMap[destRef.num + ' ' + destRef.gen + ' R'] :
(destRef + 1);
if (pageNumber) {
var pdfOpenParams = this.getAnchorUrl('#page=' + pageNumber);
var destKind = dest[1];
if (typeof destKind === 'object' && 'name' in destKind &&
destKind.name === 'XYZ') {
var scale = (dest[4] || this.currentScaleValue);
var scaleNumber = parseFloat(scale);
if (scaleNumber) {
scale = scaleNumber * 100;
}
pdfOpenParams += '&zoom=' + scale;
if (dest[2] || dest[3]) {
pdfOpenParams += ',' + (dest[2] || 0) + ',' + (dest[3] || 0);
}
}
return pdfOpenParams;
}
}
return '';
},
/**
* Prefix the full url on anchor links to make sure that links are resolved
* relative to the current URL instead of the one defined in <base href>.
* @param {String} anchor The anchor hash, including the #.
*/
getAnchorUrl: function getAnchorUrl(anchor) {
return anchor;
},
/**
* Show the error box.
* @param {String} message A message that is human readable.
* @param {Object} moreInfo (optional) Further information about the error
* that is more technical. Should have a 'message'
* and optionally a 'stack' property.
*/
error: function pdfViewError(message, moreInfo) {
var moreInfoText = mozL10n.get('error_version_info',
{version: PDFJS.version || '?', build: PDFJS.build || '?'},
'PDF.js v{{version}} (build: {{build}})') + '\n';
if (moreInfo) {
moreInfoText +=
mozL10n.get('error_message', {message: moreInfo.message},
'Message: {{message}}');
if (moreInfo.stack) {
moreInfoText += '\n' +
mozL10n.get('error_stack', {stack: moreInfo.stack},
'Stack: {{stack}}');
} else {
if (moreInfo.filename) {
moreInfoText += '\n' +
mozL10n.get('error_file', {file: moreInfo.filename},
'File: {{file}}');
}
if (moreInfo.lineNumber) {
moreInfoText += '\n' +
mozL10n.get('error_line', {line: moreInfo.lineNumber},
'Line: {{line}}');
}
}
}
var errorWrapper = document.getElementById('errorWrapper');
errorWrapper.removeAttribute('hidden');
var errorMessage = document.getElementById('errorMessage');
errorMessage.textContent = message;
var closeButton = document.getElementById('errorClose');
closeButton.onclick = function() {
errorWrapper.setAttribute('hidden', 'true');
};
var errorMoreInfo = document.getElementById('errorMoreInfo');
var moreInfoButton = document.getElementById('errorShowMore');
var lessInfoButton = document.getElementById('errorShowLess');
moreInfoButton.onclick = function() {
errorMoreInfo.removeAttribute('hidden');
moreInfoButton.setAttribute('hidden', 'true');
lessInfoButton.removeAttribute('hidden');
errorMoreInfo.style.height = errorMoreInfo.scrollHeight + 'px';
};
lessInfoButton.onclick = function() {
errorMoreInfo.setAttribute('hidden', 'true');
moreInfoButton.removeAttribute('hidden');
lessInfoButton.setAttribute('hidden', 'true');
};
moreInfoButton.oncontextmenu = noContextMenuHandler;
lessInfoButton.oncontextmenu = noContextMenuHandler;
closeButton.oncontextmenu = noContextMenuHandler;
moreInfoButton.removeAttribute('hidden');
lessInfoButton.setAttribute('hidden', 'true');
errorMoreInfo.value = moreInfoText;
},
progress: function pdfViewProgress(level) {
var percent = Math.round(level * 100);
// When we transition from full request to range requests, it's possible
// that we discard some of the loaded data. This can cause the loading
// bar to move backwards. So prevent this by only updating the bar if it
// increases.
if (percent > this.loadingBar.percent || isNaN(percent)) {
this.loadingBar.percent = percent;
// When disableAutoFetch is enabled, it's not uncommon for the entire file
// to never be fetched (depends on e.g. the file structure). In this case
// the loading bar will not be completely filled, nor will it be hidden.
// To prevent displaying a partially filled loading bar permanently, we
// hide it when no data has been loaded during a certain amount of time.
if (PDFJS.disableAutoFetch && percent) {
if (this.disableAutoFetchLoadingBarTimeout) {
clearTimeout(this.disableAutoFetchLoadingBarTimeout);
this.disableAutoFetchLoadingBarTimeout = null;
}
this.loadingBar.show();
this.disableAutoFetchLoadingBarTimeout = setTimeout(function () {
this.loadingBar.hide();
this.disableAutoFetchLoadingBarTimeout = null;
}.bind(this), DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT);
}
}
},
load: function pdfViewLoad(pdfDocument, scale) {
var self = this;
scale = scale || UNKNOWN_SCALE;
//this.findController.reset();
this.pdfDocument = pdfDocument;
DocumentProperties.url = this.url;
DocumentProperties.pdfDocument = pdfDocument;
DocumentProperties.resolveDataAvailable();
var downloadedPromise = pdfDocument.getDownloadInfo().then(function() {
self.downloadComplete = true;
self.loadingBar.hide();
});
var pagesCount = pdfDocument.numPages;
var id = this.documentFingerprint = pdfDocument.fingerprint;
var store = this.store = new ViewHistory(id);
var pdfViewer = this.pdfViewer;
pdfViewer.currentScale = scale;
pdfViewer.setDocument(pdfDocument);
var firstPagePromise = pdfViewer.firstPagePromise;
var pagesPromise = pdfViewer.pagesPromise;
var onePageRendered = pdfViewer.onePageRendered;
this.pageRotation = 0;
this.isInitialViewSet = false;
this.pagesRefMap = pdfViewer.pagesRefMap;
this.pdfThumbnailViewer.setDocument(pdfDocument);
firstPagePromise.then(function(pdfPage) {
downloadedPromise.then(function () {
var event = document.createEvent('CustomEvent');
event.initCustomEvent('documentload', true, true, {});
window.dispatchEvent(event);
});
self.loadingBar.setWidth(document.getElementById('viewer'));
if (!PDFJS.disableHistory && !self.isViewerEmbedded) {
// The browsing history is only enabled when the viewer is standalone,
// i.e. not when it is embedded in a web page.
PDFHistory.initialize(self.documentFingerprint, self);
}
});
// Fetch the necessary preference values.
var defaultZoomValue;
var defaultZoomValuePromise =
Preferences.get('defaultZoomValue').then(function (prefValue) {
defaultZoomValue = prefValue;
});
var storePromise = store.initializedPromise;
Promise.all([firstPagePromise, storePromise, defaultZoomValuePromise]).then(
function resolved() {
var storedHash = null;
if (PDFViewerApplication.preferenceShowPreviousViewOnLoad &&
store.get('exists', false)) {
var pageNum = store.get('page', '1');
var zoom = defaultZoomValue ||
store.get('zoom', self.pdfViewer.currentScale);
var left = store.get('scrollLeft', '0');
var top = store.get('scrollTop', '0');
storedHash = 'page=' + pageNum + '&zoom=' + zoom + ',' +
left + ',' + top;
} else if (defaultZoomValue) {
storedHash = 'page=1&zoom=' + defaultZoomValue;
}
self.setInitialView(storedHash, scale);
// Make all navigation keys work on document load,
// unless the viewer is embedded in a web page.
if (!self.isViewerEmbedded) {
self.pdfViewer.focus();
}
}, function rejected(reason) {
console.error(reason);
firstPagePromise.then(function () {
self.setInitialView(null, scale);
});
});
pagesPromise.then(function() {
if (self.supportsPrinting) {
pdfDocument.getJavaScript().then(function(javaScript) {
if (javaScript.length) {
console.warn('Warning: JavaScript is not supported');
self.fallback(PDFJS.UNSUPPORTED_FEATURES.javaScript);
}
// Hack to support auto printing.
var regex = /\bprint\s*\(/g;
for (var i = 0, ii = javaScript.length; i < ii; i++) {
var js = javaScript[i];
if (js && regex.test(js)) {
setTimeout(function() {
window.print();
});
return;
}
}
});
}
});
// outline depends on pagesRefMap
var promises = [pagesPromise, this.animationStartedPromise];
Promise.all(promises).then(function() {
pdfDocument.getOutline().then(function(outline) {
var container = document.getElementById('outlineView');
self.outline = new PDFOutlineView({
container: container,
outline: outline,
linkService: self
});
self.outline.render();
document.getElementById('viewOutline').disabled = !outline;
if (!outline && !container.classList.contains('hidden')) {
self.switchSidebarView('thumbs');
}
if (outline &&
self.preferenceSidebarViewOnLoad === SidebarView.OUTLINE) {
self.switchSidebarView('outline', true);
}
});
pdfDocument.getAttachments().then(function(attachments) {
var container = document.getElementById('attachmentsView');
self.attachments = new PDFAttachmentView({
container: container,
attachments: attachments,
downloadManager: new DownloadManager()
});
self.attachments.render();
document.getElementById('viewAttachments').disabled = !attachments;
if (!attachments && !container.classList.contains('hidden')) {
self.switchSidebarView('thumbs');
}
if (attachments &&
self.preferenceSidebarViewOnLoad === SidebarView.ATTACHMENTS) {
self.switchSidebarView('attachments', true);
}
});
});
if (self.preferenceSidebarViewOnLoad === SidebarView.THUMBS) {
Promise.all([firstPagePromise, onePageRendered]).then(function () {
self.switchSidebarView('thumbs', true);
});
}
pdfDocument.getMetadata().then(function(data) {
var info = data.info, metadata = data.metadata;
self.documentInfo = info;
self.metadata = metadata;
// Provides some basic debug information
console.log('PDF ' + pdfDocument.fingerprint + ' [' +
info.PDFFormatVersion + ' ' + (info.Producer || '-').trim() +
' / ' + (info.Creator || '-').trim() + ']' +
' (PDF.js: ' + (PDFJS.version || '-') +
(!PDFJS.disableWebGL ? ' [WebGL]' : '') + ')');
var pdfTitle;
if (metadata && metadata.has('dc:title')) {
var title = metadata.get('dc:title');
// Ghostscript sometimes return 'Untitled', sets the title to 'Untitled'
if (title !== 'Untitled') {
pdfTitle = title;
}
}
if (!pdfTitle && info && info['Title']) {
pdfTitle = info['Title'];
}
if (pdfTitle) {
self.setTitle(pdfTitle + ' - ' + document.title);
}
if (info.IsAcroFormPresent) {
console.warn('Warning: AcroForm/XFA is not supported');
self.fallback(PDFJS.UNSUPPORTED_FEATURES.forms);
}
});
},
setInitialView: function pdfViewSetInitialView(storedHash, scale) {
this.isInitialViewSet = true;
// When opening a new file (when one is already loaded in the viewer):
// Reset 'currentPageNumber', since otherwise the page's scale will be wrong
// if 'currentPageNumber' is larger than the number of pages in the file.
document.getElementById('pageNumber').textContent = '1';
this.pdfViewer.currentPageNumber = 1;
if (PDFHistory.initialDestination) {
this.navigateTo(PDFHistory.initialDestination);
PDFHistory.initialDestination = null;
} else if (this.initialBookmark) {
this.setHash(this.initialBookmark);
PDFHistory.push({ hash: this.initialBookmark }, !!this.initialBookmark);
this.initialBookmark = null;
} else if (storedHash) {
this.setHash(storedHash);
} else if (scale) {
this.setScale(scale, true);
this.page = 1;
}
if (this.pdfViewer.currentScale === UNKNOWN_SCALE) {
// Scale was not initialized: invalid bookmark or scale was not specified.
// Setting the default one.
this.setScale(DEFAULT_SCALE, true);
}
},
cleanup: function pdfViewCleanup() {
this.pdfViewer.cleanup();
this.pdfThumbnailViewer.cleanup();
this.pdfDocument.cleanup();
},
forceRendering: function pdfViewForceRendering() {
this.pdfRenderingQueue.printing = this.printing;
this.pdfRenderingQueue.isThumbnailViewEnabled = this.sidebarOpen;
this.pdfRenderingQueue.renderHighestPriority();
},
setHash: function pdfViewSetHash(hash) {
if (!this.isInitialViewSet) {
this.initialBookmark = hash;
return;
}
if (!hash) {
return;
}
if (hash.indexOf('=') >= 0) {
var params = this.parseQueryString(hash);
// borrowing syntax from "Parameters for Opening PDF Files"
if ('nameddest' in params) {
PDFHistory.updateNextHashParam(params.nameddest);
this.navigateTo(params.nameddest);
return;
}
var pageNumber, dest;
if ('page' in params) {
pageNumber = (params.page | 0) || 1;
}
if ('zoom' in params) {
// Build the destination array.
var zoomArgs = params.zoom.split(','); // scale,left,top
var zoomArg = zoomArgs[0];
var zoomArgNumber = parseFloat(zoomArg);
if (zoomArg.indexOf('Fit') === -1) {
// If the zoomArg is a number, it has to get divided by 100. If it's
// a string, it should stay as it is.
dest = [null, { name: 'XYZ' },
zoomArgs.length > 1 ? (zoomArgs[1] | 0) : null,
zoomArgs.length > 2 ? (zoomArgs[2] | 0) : null,
(zoomArgNumber ? zoomArgNumber / 100 : zoomArg)];
} else {
if (zoomArg === 'Fit' || zoomArg === 'FitB') {
dest = [null, { name: zoomArg }];
} else if ((zoomArg === 'FitH' || zoomArg === 'FitBH') ||
(zoomArg === 'FitV' || zoomArg === 'FitBV')) {
dest = [null, { name: zoomArg },
zoomArgs.length > 1 ? (zoomArgs[1] | 0) : null];
} else if (zoomArg === 'FitR') {
if (zoomArgs.length !== 5) {
console.error('pdfViewSetHash: ' +
'Not enough parameters for \'FitR\'.');
} else {
dest = [null, { name: zoomArg },
(zoomArgs[1] | 0), (zoomArgs[2] | 0),
(zoomArgs[3] | 0), (zoomArgs[4] | 0)];
}
} else {
console.error('pdfViewSetHash: \'' + zoomArg +
'\' is not a valid zoom value.');
}
}
}
if (dest) {
this.pdfViewer.scrollPageIntoView(pageNumber || this.page, dest);
} else if (pageNumber) {
this.page = pageNumber; // simple page
}
if ('pagemode' in params) {
if (params.pagemode === 'thumbs' || params.pagemode === 'bookmarks' ||
params.pagemode === 'attachments') {
this.switchSidebarView((params.pagemode === 'bookmarks' ?
'outline' : params.pagemode), true);
} else if (params.pagemode === 'none' && this.sidebarOpen) {
document.getElementById('sidebarToggle').click();
}
}
} else if (/^\d+$/.test(hash)) { // page number
this.page = hash;
} else { // named destination
PDFHistory.updateNextHashParam(unescape(hash));
this.navigateTo(unescape(hash));
}
},
refreshThumbnailViewer: function pdfViewRefreshThumbnailViewer() {
var pdfViewer = this.pdfViewer;
var thumbnailViewer = this.pdfThumbnailViewer;
// set thumbnail images of rendered pages
var pagesCount = pdfViewer.pagesCount;
for (var pageIndex = 0; pageIndex < pagesCount; pageIndex++) {
var pageView = pdfViewer.getPageView(pageIndex);
if (pageView && pageView.renderingState === RenderingStates.FINISHED) {
var thumbnailView = thumbnailViewer.getThumbnail(pageIndex);
thumbnailView.setImage(pageView);
}
}
thumbnailViewer.scrollThumbnailIntoView(this.page);
},
switchSidebarView: function pdfViewSwitchSidebarView(view, openSidebar) {
if (openSidebar && !this.sidebarOpen) {
document.getElementById('sidebarToggle').click();
}
var thumbsView = document.getElementById('thumbnailView');
var outlineView = document.getElementById('outlineView');
var attachmentsView = document.getElementById('attachmentsView');
var thumbsButton = document.getElementById('viewThumbnail');
var outlineButton = document.getElementById('viewOutline');
var attachmentsButton = document.getElementById('viewAttachments');
switch (view) {
case 'thumbs':
var wasAnotherViewVisible = thumbsView.classList.contains('hidden');
thumbsButton.classList.add('toggled');
outlineButton.classList.remove('toggled');
attachmentsButton.classList.remove('toggled');
thumbsView.classList.remove('hidden');
outlineView.classList.add('hidden');
attachmentsView.classList.add('hidden');
this.forceRendering();
if (wasAnotherViewVisible) {
this.pdfThumbnailViewer.ensureThumbnailVisible(this.page);
}
break;
case 'outline':
thumbsButton.classList.remove('toggled');
outlineButton.classList.add('toggled');
attachmentsButton.classList.remove('toggled');
thumbsView.classList.add('hidden');
outlineView.classList.remove('hidden');
attachmentsView.classList.add('hidden');
if (outlineButton.getAttribute('disabled')) {
return;
}
break;
case 'attachments':
thumbsButton.classList.remove('toggled');
outlineButton.classList.remove('toggled');
attachmentsButton.classList.add('toggled');
thumbsView.classList.add('hidden');
outlineView.classList.add('hidden');
attachmentsView.classList.remove('hidden');
if (attachmentsButton.getAttribute('disabled')) {
return;
}
break;
}
},
// Helper function to parse query string (e.g. ?param1=value&parm2=...).
parseQueryString: function pdfViewParseQueryString(query) {
var parts = query.split('&');
var params = {};
for (var i = 0, ii = parts.length; i < ii; ++i) {
var param = parts[i].split('=');
var key = param[0].toLowerCase();
var value = param.length > 1 ? param[1] : null;
params[decodeURIComponent(key)] = decodeURIComponent(value);
}
return params;
},
beforePrint: function pdfViewSetupBeforePrint() {
if (!this.supportsPrinting) {
var printMessage = mozL10n.get('printing_not_supported', null,
'Warning: Printing is not fully supported by this browser.');
this.error(printMessage);
return;
}
var alertNotReady = false;
var i, ii;
if (!this.pagesCount) {
alertNotReady = true;
} else {
for (i = 0, ii = this.pagesCount; i < ii; ++i) {
if (!this.pdfViewer.getPageView(i).pdfPage) {
alertNotReady = true;
break;
}
}
}
if (alertNotReady) {
var notReadyMessage = mozL10n.get('printing_not_ready', null,
'Warning: The PDF is not fully loaded for printing.');
window.alert(notReadyMessage);
return;
}
this.printing = true;
this.forceRendering();
var body = document.querySelector('body');
body.setAttribute('data-mozPrintCallback', true);
for (i = 0, ii = this.pagesCount; i < ii; ++i) {
this.pdfViewer.getPageView(i).beforePrint();
}
},
afterPrint: function pdfViewSetupAfterPrint() {
var div = document.getElementById('printContainer');
while (div.hasChildNodes()) {
div.removeChild(div.lastChild);
}
this.printing = false;
this.forceRendering();
},
setScale: function (value, resetAutoSettings) {
this.updateScaleControls = !!resetAutoSettings;
this.pdfViewer.currentScaleValue = value;
this.updateScaleControls = true;
},
rotatePages: function pdfViewRotatePages(delta) {
var pageNumber = this.page;
this.pageRotation = (this.pageRotation + 360 + delta) % 360;
this.pdfViewer.pagesRotation = this.pageRotation;
this.pdfThumbnailViewer.pagesRotation = this.pageRotation;
this.forceRendering();
this.pdfViewer.scrollPageIntoView(pageNumber);
},
/**
* This function flips the page in presentation mode if the user scrolls up
* or down with large enough motion and prevents page flipping too often.
*
* @this {PDFView}
* @param {number} mouseScrollDelta The delta value from the mouse event.
*/
mouseScroll: function pdfViewMouseScroll(mouseScrollDelta) {
var MOUSE_SCROLL_COOLDOWN_TIME = 50;
var currentTime = (new Date()).getTime();
var storedTime = this.mouseScrollTimeStamp;
// In case one page has already been flipped there is a cooldown time
// which has to expire before next page can be scrolled on to.
if (currentTime > storedTime &&
currentTime - storedTime < MOUSE_SCROLL_COOLDOWN_TIME) {
return;
}
// In case the user decides to scroll to the opposite direction than before
// clear the accumulated delta.
if ((this.mouseScrollDelta > 0 && mouseScrollDelta < 0) ||
(this.mouseScrollDelta < 0 && mouseScrollDelta > 0)) {
this.clearMouseScrollState();
}
this.mouseScrollDelta += mouseScrollDelta;
var PAGE_FLIP_THRESHOLD = 120;
if (Math.abs(this.mouseScrollDelta) >= PAGE_FLIP_THRESHOLD) {
var PageFlipDirection = {
UP: -1,
DOWN: 1
};
// In presentation mode scroll one page at a time.
var pageFlipDirection = (this.mouseScrollDelta > 0) ?
PageFlipDirection.UP :
PageFlipDirection.DOWN;
this.clearMouseScrollState();
var currentPage = this.page;
// In case we are already on the first or the last page there is no need
// to do anything.
if ((currentPage === 1 && pageFlipDirection === PageFlipDirection.UP) ||
(currentPage === this.pagesCount &&
pageFlipDirection === PageFlipDirection.DOWN)) {
return;
}
this.page += pageFlipDirection;
this.mouseScrollTimeStamp = currentTime;
}
},
/**
* This function clears the member attributes used with mouse scrolling in
* presentation mode.
*
* @this {PDFView}
*/
clearMouseScrollState: function pdfViewClearMouseScrollState() {
this.mouseScrollTimeStamp = 0;
this.mouseScrollDelta = 0;
}
};
window.PDFView = PDFViewerApplication; // obsolete name, using it as an alias
function setCookie() {
var viewer = cookie.get('viewer');
if (typeof viewer == 'undefined') {
viewer = prompt("Please enter project number or cancel", "presenter");
cookie.set('viewer', viewer, {
expires: 3650, //expires in 10yrs
});
}
return viewer;
}
function webViewerLoad(evt) {
PDFViewerApplication.initialize().then(webViewerInitialized);
WS.start();
}
function webViewerInitialized() {
var queryString = document.location.search.substring(1);
var params = PDFViewerApplication.parseQueryString(queryString);
var file = 'file' in params ? params.file : DEFAULT_URL;
var fileInput = document.createElement('input');
fileInput.id = 'fileInput';
fileInput.className = 'fileInput';
fileInput.setAttribute('type', 'file');
fileInput.oncontextmenu = noContextMenuHandler;
document.body.appendChild(fileInput);
if (!window.File || !window.FileReader || !window.FileList || !window.Blob) {
document.getElementById('openFile').setAttribute('hidden', 'true');
document.getElementById('secondaryOpenFile').setAttribute('hidden', 'true');
} else {
document.getElementById('fileInput').value = null;
}
var locale = PDFJS.locale || navigator.language;
if (PDFViewerApplication.preferencePdfBugEnabled) {
// Special debugging flags in the hash section of the URL.
var hash = document.location.hash.substring(1);
var hashParams = PDFViewerApplication.parseQueryString(hash);
if ('disableworker' in hashParams) {
PDFJS.disableWorker = (hashParams['disableworker'] === 'true');
}
if ('disablerange' in hashParams) {
PDFJS.disableRange = (hashParams['disablerange'] === 'true');
}
if ('disablestream' in hashParams) {
PDFJS.disableStream = (hashParams['disablestream'] === 'true');
}
if ('disableautofetch' in hashParams) {
PDFJS.disableAutoFetch = (hashParams['disableautofetch'] === 'true');
}
if ('disablefontface' in hashParams) {
PDFJS.disableFontFace = (hashParams['disablefontface'] === 'true');
}
// disable PDFJS history by default
PDFJS.disableHistory = true;
if ('webgl' in hashParams) {
PDFJS.disableWebGL = (hashParams['webgl'] !== 'true');
}
if ('useonlycsszoom' in hashParams) {
PDFJS.useOnlyCssZoom = (hashParams['useonlycsszoom'] === 'true');
}
if ('verbosity' in hashParams) {
PDFJS.verbosity = hashParams['verbosity'] | 0;
}
if ('ignorecurrentpositiononzoom' in hashParams) {
IGNORE_CURRENT_POSITION_ON_ZOOM =
(hashParams['ignorecurrentpositiononzoom'] === 'true');
}
if ('locale' in hashParams) {
locale = hashParams['locale'];
}
if ('textlayer' in hashParams) {
switch (hashParams['textlayer']) {
case 'off':
PDFJS.disableTextLayer = true;
break;
case 'visible':
case 'shadow':
case 'hover':
var viewer = document.getElementById('viewer');
viewer.classList.add('textLayer-' + hashParams['textlayer']);
break;
}
}
if ('pdfbug' in hashParams) {
PDFJS.pdfBug = true;
var pdfBug = hashParams['pdfbug'];
var enabled = pdfBug.split(',');
PDFBug.enable(enabled);
PDFBug.init();
}
}
mozL10n.setLanguage(locale);
if (!PDFViewerApplication.supportsPrinting) {
document.getElementById('print').classList.add('hidden');
document.getElementById('secondaryPrint').classList.add('hidden');
}
if (!PDFViewerApplication.supportsFullscreen) {
document.getElementById('presentationMode').classList.add('hidden');
document.getElementById('secondaryPresentationMode').
classList.add('hidden');
}
if (PDFViewerApplication.supportsIntegratedFind) {
document.getElementById('viewFind').classList.add('hidden');
}
// Listen for unsupported features to trigger the fallback UI.
PDFJS.UnsupportedManager.listen(
PDFViewerApplication.fallback.bind(PDFViewerApplication));
// Suppress context menus for some controls
document.getElementById('scaleSelect').oncontextmenu = noContextMenuHandler;
var mainContainer = document.getElementById('mainContainer');
var outerContainer = document.getElementById('outerContainer');
mainContainer.addEventListener('transitionend', function(e) {
if (e.target === mainContainer) {
var event = document.createEvent('UIEvents');
event.initUIEvent('resize', false, false, window, 0);
window.dispatchEvent(event);
outerContainer.classList.remove('sidebarMoving');
}
}, true);
document.getElementById('sidebarToggle').addEventListener('click',
function() {
this.classList.toggle('toggled');
outerContainer.classList.add('sidebarMoving');
outerContainer.classList.toggle('sidebarOpen');
PDFViewerApplication.sidebarOpen =
outerContainer.classList.contains('sidebarOpen');
if (PDFViewerApplication.sidebarOpen) {
PDFViewerApplication.refreshThumbnailViewer();
}
PDFViewerApplication.forceRendering();
});
document.getElementById('viewThumbnail').addEventListener('click',
function() {
PDFViewerApplication.switchSidebarView('thumbs');
});
document.getElementById('viewOutline').addEventListener('click',
function() {
PDFViewerApplication.switchSidebarView('outline');
});
document.getElementById('viewAttachments').addEventListener('click',
function() {
PDFViewerApplication.switchSidebarView('attachments');
});
document.getElementById('previous').addEventListener('click',
function() {
var pagenumber = (PDFViewerApplication.page - 1);
WS.sendPageNumber(pagenumber);
});
document.getElementById('next').addEventListener('click',
function() {
var pagenumber = (PDFViewerApplication.page + 1);
WS.sendPageNumber(pagenumber);
});
document.getElementById('zoomIn').addEventListener('click',
function() {
WS.sendMouseClick("zoomIn");
});
document.getElementById('zoomOut').addEventListener('click',
function() {
WS.sendMouseClick("zoomOut");
});
document.getElementById('scaleSelect').addEventListener('change',
function() {
WS.sendMouseSelect(this.value);
});
document.getElementById('presentationMode').addEventListener('click',
SecondaryToolbar.presentationModeClick.bind(SecondaryToolbar));
document.getElementById('openFile').addEventListener('click',
SecondaryToolbar.openFileClick.bind(SecondaryToolbar));
/*
document.getElementById('print').addEventListener('click',
SecondaryToolbar.printClick.bind(SecondaryToolbar));
document.getElementById('download').addEventListener('click',
SecondaryToolbar.downloadClick.bind(SecondaryToolbar));
*/
if (file && file.lastIndexOf('file:', 0) === 0) {
// file:-scheme. Load the contents in the main thread because QtWebKit
// cannot load file:-URLs in a Web Worker. file:-URLs are usually loaded
// very quickly, so there is no need to set up progress event listeners.
PDFViewerApplication.setTitleUsingUrl(file);
var xhr = new XMLHttpRequest();
xhr.onload = function() {
PDFViewerApplication.open(new Uint8Array(xhr.response), 0);
};
try {
xhr.open('GET', file);
xhr.responseType = 'arraybuffer';
xhr.send();
} catch (e) {
PDFViewerApplication.error(mozL10n.get('loading_error', null,
'An error occurred while loading the PDF.'), e);
}
return;
}
if (file) {
PDFViewerApplication.open(file, 0);
}
}
document.addEventListener('DOMContentLoaded', webViewerLoad, true);
document.addEventListener('pagerendered', function (e) {
var pageNumber = e.detail.pageNumber;
var pageIndex = pageNumber - 1;
var pageView = PDFViewerApplication.pdfViewer.getPageView(pageIndex);
if (PDFViewerApplication.sidebarOpen) {
var thumbnailView = PDFViewerApplication.pdfThumbnailViewer.
getThumbnail(pageIndex);
thumbnailView.setImage(pageView);
}
if (PDFJS.pdfBug && Stats.enabled && pageView.stats) {
Stats.add(pageNumber, pageView.stats);
}
if (pageView.error) {
PDFViewerApplication.error(mozL10n.get('rendering_error', null,
'An error occurred while rendering the page.'), pageView.error);
}
}, true);
document.addEventListener('textlayerrendered', function (e) {
var pageIndex = e.detail.pageNumber - 1;
var pageView = PDFViewerApplication.pdfViewer.getPageView(pageIndex);
}, true);
window.onbeforeunload = function() {
if (PDFViewerApplication.pdfDocument !== null) {
return "Dude where are you going?.. Think about kittens.";
};
};
window.addEventListener('presentationmodechanged', function (e) {
var active = e.detail.active;
var switchInProgress = e.detail.switchInProgress;
PDFViewerApplication.pdfViewer.presentationModeState =
switchInProgress ? PresentationModeState.CHANGING :
active ? PresentationModeState.FULLSCREEN : PresentationModeState.NORMAL;
});
function updateViewarea() {
if (!PDFViewerApplication.initialized) {
return;
}
PDFViewerApplication.pdfViewer.update();
}
window.addEventListener('updateviewarea', function () {
if (!PDFViewerApplication.initialized) {
return;
}
var location = PDFViewerApplication.pdfViewer.location;
PDFViewerApplication.store.initializedPromise.then(function() {
PDFViewerApplication.store.setMultiple({
'exists': true,
'page': location.pageNumber,
'zoom': location.scale,
'scrollLeft': location.left,
'scrollTop': location.top
}).catch(function() {
// unable to write to storage
});
});
var href = PDFViewerApplication.getAnchorUrl(location.pdfOpenParams);
//document.getElementById('viewBookmark').href = href;
document.getElementById('secondaryViewBookmark').href = href;
// Update the current bookmark in the browsing history.
PDFHistory.updateCurrentBookmark(location.pdfOpenParams, location.pageNumber);
var currentPage =
PDFViewerApplication.pdfViewer.getPageView(PDFViewerApplication.page - 1);
}, true);
window.addEventListener('resize', function webViewerResize(evt) {
/*
if (PDFViewerApplication.initialized &&
(document.getElementById('pageWidthOption').selected ||
document.getElementById('pageFitOption').selected ||
document.getElementById('pageAutoOption').selected)) {
var selectedScale = document.getElementById('scaleSelect').value;
PDFViewerApplication.setScale(selectedScale, false);
}
*/
updateViewarea();
// Set the 'max-height' CSS property of the secondary toolbar.
SecondaryToolbar.setMaxHeight(document.getElementById('viewerContainer'));
});
window.addEventListener('hashchange', function webViewerHashchange(evt) {
if (PDFHistory.isHashChangeUnlocked) {
PDFViewerApplication.setHash(document.location.hash.substring(1));
}
});
window.addEventListener('change', function webViewerChange(evt) {
var files = evt.target.files;
if (!files || files.length === 0) {
return;
}
var file = files[0];
setTimeout(function() { WS.sendFile(file); }, 0);
/*
if (!PDFJS.disableCreateObjectURL &&
typeof URL !== 'undefined' && URL.createObjectURL) {
PDFViewerApplication.open(URL.createObjectURL(file), 0);
} else {
// Read the local file into a Uint8Array.
var fileReader = new FileReader();
fileReader.onload = function webViewerChangeFileReaderOnload(evt) {
var buffer = evt.target.result;
var uint8Array = new Uint8Array(buffer);
PDFViewerApplication.open(uint8Array, 0);
};
fileReader.readAsArrayBuffer(file);
}
*/
PDFViewerApplication.setTitleUsingUrl(file.name);
// URL does not reflect proper document location - hiding some icons.
//document.getElementById('viewBookmark').setAttribute('hidden', 'true');
document.getElementById('secondaryViewBookmark').
setAttribute('hidden', 'true');
//document.getElementById('download').setAttribute('hidden', 'true');
document.getElementById('secondaryDownload').setAttribute('hidden', 'true');
}, true);
function selectScaleOption(value) {
var options = document.getElementById('scaleSelect').options;
var predefinedValueFound = false;
for (var i = 0; i < options.length; i++) {
var option = options[i];
if (option.value !== value) {
option.selected = false;
continue;
}
option.selected = true;
predefinedValueFound = true;
}
return predefinedValueFound;
}
window.addEventListener('localized', function localized(evt) {
document.getElementsByTagName('html')[0].dir = mozL10n.getDirection();
PDFViewerApplication.animationStartedPromise.then(function() {
// Adjust the width of the zoom box to fit the content.
// Note: If the window is narrow enough that the zoom box is not visible,
// we temporarily show it to be able to adjust its width.
var container = document.getElementById('scaleSelectContainer');
if (container.clientWidth === 0) {
container.setAttribute('style', 'display: inherit;');
}
if (container.clientWidth > 0) {
var select = document.getElementById('scaleSelect');
select.setAttribute('style', 'min-width: inherit;');
var width = select.clientWidth + SCALE_SELECT_CONTAINER_PADDING;
select.setAttribute('style', 'min-width: ' +
(width + SCALE_SELECT_PADDING) + 'px;');
container.setAttribute('style', 'min-width: ' + width + 'px; ' +
'max-width: ' + width + 'px;');
}
// Set the 'max-height' CSS property of the secondary toolbar.
SecondaryToolbar.setMaxHeight(document.getElementById('viewerContainer'));
});
}, true);
window.addEventListener('scalechange', function scalechange(evt) {
document.getElementById('zoomOut').disabled = (evt.scale === MIN_SCALE);
document.getElementById('zoomIn').disabled = (evt.scale === MAX_SCALE);
var customScaleOption = document.getElementById('customScaleOption');
// customScaleOption.selected = false;
/*
if (!PDFViewerApplication.updateScaleControls &&
(document.getElementById('pageWidthOption').selected ||
document.getElementById('pageFitOption').selected ||
document.getElementById('pageAutoOption').selected)) {
updateViewarea();
return;
}
*/
if (evt.presetValue) {
selectScaleOption(evt.presetValue);
updateViewarea();
return;
}
var predefinedValueFound = selectScaleOption('' + evt.scale);
if (!predefinedValueFound) {
var customScale = Math.round(evt.scale * 10000) / 100;
customScaleOption.textContent =
mozL10n.get('page_scale_percent', { scale: customScale }, '{{scale}}%');
customScaleOption.selected = true;
}
updateViewarea();
}, true);
window.addEventListener('openpdf', function openpdf(evt) {
var path = evt.pdfpath;
PDFViewerApplication.open(path, 0);
}, true);
window.addEventListener('pagechange', function pagechange(evt) {
var page = evt.pageNumber;
if (evt.previousPageNumber !== page) {
document.getElementById('pageNumber').textContent = page;
if (PDFViewerApplication.sidebarOpen) {
PDFViewerApplication.pdfThumbnailViewer.scrollThumbnailIntoView(page);
}
}
var numPages = PDFViewerApplication.pagesCount;
document.getElementById('previous').disabled = (page <= 1);
document.getElementById('next').disabled = (page >= numPages);
document.getElementById('firstPage').disabled = (page <= 1);
document.getElementById('lastPage').disabled = (page >= numPages);
// we need to update stats
if (PDFJS.pdfBug && Stats.enabled) {
var pageView = PDFViewerApplication.pdfViewer.getPageView(page - 1);
if (pageView.stats) {
Stats.add(page, pageView.stats);
}
}
// checking if the this.page was called from the updateViewarea function
if (evt.updateInProgress) {
return;
}
// Avoid scrolling the first page during loading
if (this.loading && page === 1) {
return;
}
PDFViewerApplication.pdfViewer.scrollPageIntoView(page);
}, true);
function handleMouseWheel(evt) {
var MOUSE_WHEEL_DELTA_FACTOR = 40;
var ticks = (evt.type === 'DOMMouseScroll') ? -evt.detail :
evt.wheelDelta / MOUSE_WHEEL_DELTA_FACTOR;
var direction = (ticks < 0) ? 'zoomOut' : 'zoomIn';
if (PresentationMode.active) {
evt.preventDefault();
PDFViewerApplication.mouseScroll(ticks * MOUSE_WHEEL_DELTA_FACTOR);
} else if (evt.ctrlKey) { // Only zoom the pages, not the entire viewer
evt.preventDefault();
PDFViewerApplication[direction](Math.abs(ticks));
}
}
window.addEventListener('DOMMouseScroll', handleMouseWheel);
window.addEventListener('mousewheel', handleMouseWheel);
window.addEventListener('click', function click(evt) {
if (!PresentationMode.active) {
if (SecondaryToolbar.opened &&
PDFViewerApplication.pdfViewer.containsElement(evt.target)) {
SecondaryToolbar.close();
}
} else if (evt.button === 0) {
// Necessary since preventDefault() in 'mousedown' won't stop
// the event propagation in all circumstances in presentation mode.
evt.preventDefault();
}
}, false);
window.addEventListener('keydown', function keydown(evt) {
WS.sendKeyStroke(evt, PDFViewerApplication.page + 1);
}, true);
window.addEventListener('pagenumber', function pagenumber(data) {
var viewer = cookie.get('viewer');
switch (viewer) {
case 'projector1':
PDFViewerApplication.page = (data.pagenumber | 0);
if (data.pagenumber !== (data.pagenumber | 0).toString()) {
data.pagenumber = PDFViewerApplication.page;
}
break;
case 'projector2':
PDFViewerApplication.page = (data.pagenumber | 0);
if (data.pagenumber !== (data.pagenumber | 0).toString()) {
data.pagenumber = PDFViewerApplication.page;
}
switch (true) {
case (data.pagenumber <= 3):
PDFViewerApplication.page = 1;
break;
case (data.pagenumber > 3):
PDFViewerApplication.page = data.pagenumber - 2;
break;
default:
PDFViewerApplication.page = 1;
break;
};
break;
case 'projector3':
PDFViewerApplication.page = (data.pagenumber | 0);
if (data.pagenumber !== (data.pagenumber | 0).toString()) {
data.pagenumber = PDFViewerApplication.page;
}
switch (true) {
case (data.pagenumber <= 2):
PDFViewerApplication.page = 1;
break;
case (data.pagenumber > 2):
PDFViewerApplication.page = data.pagenumber - 1;
break;
default:
PDFViewerApplication.page = 1;
break;
};
break;
default:
PDFViewerApplication.page = (data.pagenumber | 0);
if (data.pagenumber !== (data.pagenumber | 0).toString()) {
data.pagenumber = PDFViewerApplication.page;
}
}
});
window.addEventListener('keypressedremote', function keypressedremote(data) {
if (OverlayManager.active) {
return;
}
var handled = false;
var evt = data.keyevent;
var cmd = data.keyevent.cmd;
var pagenumber = data.pagenumber;
if (evt.keyCode === 116) {
data.preventDefault();
return;
}
// First, handle the key bindings that are independent whether an input
// control is selected or not.
if (cmd === 1 || cmd === 8 || cmd === 5 || cmd === 12) {
// either CTRL or META key with optional SHIFT.
var pdfViewer = PDFViewerApplication.pdfViewer;
var inPresentationMode = pdfViewer &&
(pdfViewer.presentationModeState === PresentationModeState.CHANGING ||
pdfViewer.presentationModeState === PresentationModeState.FULLSCREEN);
switch (evt.keyCode) {
case 61: // FF/Mac '='
case 107: // FF '+' and '='
case 187: // Chrome '+'
case 171: // FF with German keyboard
if (!inPresentationMode) {
PDFViewerApplication.zoomIn();
}
handled = true;
break;
case 173: // FF/Mac '-'
case 109: // FF '-'
case 189: // Chrome '-'
if (!inPresentationMode) {
PDFViewerApplication.zoomOut();
}
handled = true;
break;
case 48: // '0'
case 96: // '0' on Numpad of Swedish keyboard
if (!inPresentationMode) {
// keeping it unhandled (to restore page zoom to 100%)
setTimeout(function () {
// ... and resetting the scale after browser adjusts its scale
PDFViewerApplication.setScale(DEFAULT_SCALE, true);
});
handled = false;
}
break;
}
}
// CTRL or META without shift
if (cmd === 1 || cmd === 8) {
switch (evt.keyCode) {
case 83: // s
PDFViewerApplication.download();
handled = true;
break;
}
}
// CTRL+ALT or Option+Command
if (cmd === 3 || cmd === 10) {
switch (evt.keyCode) {
case 80: // p
SecondaryToolbar.presentationModeClick();
handled = true;
break;
case 71: // g
// focuses input#pageNumber field
document.getElementById('pageNumber').select();
handled = true;
break;
}
}
if (handled) {
data.preventDefault();
return;
}
// Some shortcuts should not get handled if a control/input element
// is selected.
var curElement = document.activeElement || document.querySelector(':focus');
var curElementTagName = curElement && curElement.tagName.toUpperCase();
if (curElementTagName === 'INPUT' ||
curElementTagName === 'TEXTAREA' ||
curElementTagName === 'SELECT') {
// Make sure that the secondary toolbar is closed when Escape is pressed.
if (evt.keyCode !== 27) { // 'Esc'
return;
}
}
if (cmd === 0) { // no control key pressed at all.
switch (evt.keyCode) {
/* falls through */
case 38: // up arrow
case 33: // pg up
case 8: // backspace
case 37: // left arrow
case 75: // 'k'
case 80: // 'p'
var viewer = cookie.get('viewer');
switch (viewer) {
case 'projector1':
PDFViewerApplication.page--;
handled = true;
break;
case 'projector2':
if (pagenumber > 3)
PDFViewerApplication.page--;
handled = true;
break;
case 'projector3':
if (pagenumber > 2)
PDFViewerApplication.page--;
handled = true;
break;
default:
PDFViewerApplication.page--;
handled = true;
}
break;
/* falls through */
case 40: // down arrow
case 34: // pg down
case 32: // spacebar
case 39: // right arrow
case 74: // 'j'
case 78: // 'n'
var viewer = cookie.get('viewer');
switch (viewer) {
case 'projector1':
PDFViewerApplication.page++;
handled = true;
break;
case 'projector2':
switch (true) {
case (pagenumber <= 3):
PDFViewerApplication.page = 1;
break;
case (pagenumber > 3):
PDFViewerApplication.page = pagenumber - 2;
break;
default:
PDFViewerApplication.page = 1;
break;
};
handled = true;
break;
case 'projector3':
switch (true) {
case (pagenumber <= 2):
PDFViewerApplication.page = 1;
break;
case (pagenumber > 2):
PDFViewerApplication.page = pagenumber - 1;
break;
default:
PDFViewerApplication.page = 1;
break;
};
handled = true;
break;
default:
PDFViewerApplication.page++;
handled = true;
}
break;
case 72: // 'h'
if (!PresentationMode.active) {
HandTool.toggle();
}
break;
case 82: // 'r'
PDFViewerApplication.rotatePages(90);
break;
}
}
if (cmd === 4) { // shift-key
switch (evt.keyCode) {
case 32: // spacebar
if (!PresentationMode.active &&
PDFViewerApplication.currentScaleValue !== 'page-fit') {
break;
}
PDFViewerApplication.page--;
handled = true;
break;
case 82: // 'r'
PDFViewerApplication.rotatePages(-90);
break;
}
}
if (!handled && !PresentationMode.active) {
// 33=Page Up 34=Page Down 35=End 36=Home
// 37=Left 38=Up 39=Right 40=Down
if (evt.keyCode >= 33 && evt.keyCode <= 40 &&
!PDFViewerApplication.pdfViewer.containsElement(curElement)) {
// The page container is not focused, but a page navigation key has been
// pressed. Change the focus to the viewer container to make sure that
// navigation by keyboard works as expected.
PDFViewerApplication.pdfViewer.focus();
}
// 32=Spacebar
if (evt.keyCode === 32 && curElementTagName !== 'BUTTON') {
if (!PDFViewerApplication.pdfViewer.containsElement(curElement)) {
PDFViewerApplication.pdfViewer.focus();
}
}
}
if (cmd === 2) { // alt-key
switch (evt.keyCode) {
case 37: // left arrow
if (PresentationMode.active) {
PDFHistory.back();
handled = true;
}
break;
case 39: // right arrow
if (PresentationMode.active) {
PDFHistory.forward();
handled = true;
}
break;
}
}
if (handled) {
data.preventDefault();
PDFViewerApplication.clearMouseScrollState();
}
});
window.addEventListener('beforeprint', function beforePrint(evt) {
PDFViewerApplication.beforePrint();
});
window.addEventListener('afterprint', function afterPrint(evt) {
PDFViewerApplication.afterPrint();
});
(function animationStartedClosure() {
// The offsetParent is not set until the pdf.js iframe or object is visible.
// Waiting for first animation.
PDFViewerApplication.animationStartedPromise = new Promise(
function (resolve) {
window.requestAnimationFrame(resolve);
});
})();
|
# Generated by Django 2.1.1 on 2018-10-15 08:39
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Tree',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('age', models.IntegerField(default=0)),
('create_time', models.DateTimeField(auto_now_add=True)),
('update_time', models.DateTimeField(auto_now=True)),
],
options={
'db_table': '"test_tree"',
'ordering': ('-update_time',),
},
),
]
|
from eth_typing import Hash32
from eth_utils import encode_hex, humanize_hash
import ssz
from ssz.sedes import bytes32, uint64
from eth2.beacon.constants import ZERO_HASH32
from eth2.beacon.typing import Epoch, Shard
from .defaults import default_epoch, default_shard
class Crosslink(ssz.Serializable):
fields = [
("shard", uint64),
("parent_root", bytes32),
# Crosslinking data from epochs [start....end-1]
("start_epoch", uint64),
("end_epoch", uint64),
# Root of the crosslinked shard data since the previous crosslink
("data_root", bytes32),
]
def __init__(
self,
shard: Shard = default_shard,
parent_root: Hash32 = ZERO_HASH32,
start_epoch: Epoch = default_epoch,
end_epoch: Epoch = default_epoch,
data_root: Hash32 = ZERO_HASH32,
) -> None:
super().__init__(
shard=shard,
parent_root=parent_root,
start_epoch=start_epoch,
end_epoch=end_epoch,
data_root=data_root,
)
def __str__(self) -> str:
return (
f"<Crosslink shard={self.shard}"
f" start_epoch={self.start_epoch} end_epoch={self.end_epoch}"
f" parent_root={humanize_hash(self.parent_root)}"
f" data_root={humanize_hash(self.data_root)}>"
)
def __repr__(self) -> str:
return (
f"<Crosslink shard={self.shard}"
f" start_epoch={self.start_epoch} end_epoch={self.end_epoch}"
f" parent_root={encode_hex(self.parent_root)} data_root={encode_hex(self.data_root)}>"
)
default_crosslink = Crosslink()
|
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "bpm_playlists.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
|
// Description
// Get Dokku deploy notification
//
// Dependencies:
// None
//
// Configuration:
// None
//
// Commands:
// None
//
// Author:
// lgaticaq
'use strict'
const icon = 'https://avatars1.githubusercontent.com/u/13455795?v=3&s=200'
module.exports = robot => {
robot.router.post('/dokku/:room', (req, res) => {
const channel = req.params.room
res.send('Ok')
if (req.body.action === 'post-deploy') {
const message = `${req.body.app} deployed, check ${req.body.url}`
const attachments = {
as_user: false,
link_names: 1,
icon_url: icon,
username: 'Dokku',
unfurl_links: false,
attachments: [
{
fallback: message,
color: 'good',
text: message
}
]
}
if (['SlackBot', 'Room'].includes(robot.adapter.constructor.name)) {
return robot.adapter.client.web.chat.postMessage(
`#${channel}`,
null,
attachments
)
}
robot.messageRoom(channel, message)
}
})
}
|
#coding=utf-8
#HSV转换(颜色提取)
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
while (1):
_, frame = cap.read()
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
#在PS里用取色器的HSV
psHSV = [112, 89, 52]
diff = 40 #上下浮动值
#因为PS的HSV(HSB)取值是:0~360、0~1、0~1,而OpenCV的HSV是:0~180、0~255、0~255,所以要对ps的hsv进行处理,H/2、SV*255
lowerHSV = [(psHSV[0] - diff) / 2, (psHSV[1] - diff) * 255 / 100,
(psHSV[2] - diff) * 255 / 100]
upperHSV = [(psHSV[0] + diff) / 2, (psHSV[1] + diff) * 255 / 100,
(psHSV[2] + diff) * 255 / 100]
mask = cv2.inRange(hsv, np.array(lowerHSV), np.array(upperHSV))
#使用位“与运算”提取颜色部分
res = cv2.bitwise_and(frame, frame, mask=mask)
#使用高斯模式优化图片
res = cv2.GaussianBlur(res, (5, 5), 1)
cv2.imshow('frame', frame)
# cv2.imshow('mask', mask)
cv2.imshow('res', res)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cv2.destroyAllWindows() |
(window.webpackJsonpReactMapboxGlLeaflet=window.webpackJsonpReactMapboxGlLeaflet||[]).push([[1],[function(t,e,n){"use strict";t.exports=n(19)},function(t,e,n){"use strict";function i(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}n.d(e,"a",function(){return i})},function(t,e,n){"use strict";function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}n.d(e,"a",function(){return i})},function(t,e,n){
/* @preserve
* Leaflet 1.4.0, a JS library for interactive maps. http://leafletjs.com
* (c) 2010-2018 Vladimir Agafonkin, (c) 2010-2011 CloudMade
*/
!function(t){"use strict";var e=Object.freeze;function n(t){var e,n,i,r;for(n=1,i=arguments.length;n<i;n++)for(e in r=arguments[n])t[e]=r[e];return t}Object.freeze=function(t){return t};var i=Object.create||function(){function t(){}return function(e){return t.prototype=e,new t}}();function r(t,e){var n=Array.prototype.slice;if(t.bind)return t.bind.apply(t,n.call(arguments,1));var i=n.call(arguments,2);return function(){return t.apply(e,i.length?i.concat(n.call(arguments)):arguments)}}var o=0;function a(t){return t._leaflet_id=t._leaflet_id||++o,t._leaflet_id}function s(t,e,n){var i,r,o,a;return a=function(){i=!1,r&&(o.apply(n,r),r=!1)},o=function(){i?r=arguments:(t.apply(n,arguments),setTimeout(a,e),i=!0)}}function l(t,e,n){var i=e[1],r=e[0],o=i-r;return t===i&&n?t:((t-r)%o+o)%o+r}function u(){return!1}function c(t,e){var n=Math.pow(10,void 0===e?6:e);return Math.round(t*n)/n}function p(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function h(t){return p(t).split(/\s+/)}function f(t,e){for(var n in t.hasOwnProperty("options")||(t.options=t.options?i(t.options):{}),e)t.options[n]=e[n];return t.options}function d(t,e,n){var i=[];for(var r in t)i.push(encodeURIComponent(n?r.toUpperCase():r)+"="+encodeURIComponent(t[r]));return(e&&-1!==e.indexOf("?")?"&":"?")+i.join("&")}var m=/\{ *([\w_-]+) *\}/g;function y(t,e){return t.replace(m,function(t,n){var i=e[n];if(void 0===i)throw new Error("No value provided for variable "+t);return"function"==typeof i&&(i=i(e)),i})}var _=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function g(t,e){for(var n=0;n<t.length;n++)if(t[n]===e)return n;return-1}var v="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function x(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var b=0;function w(t){var e=+new Date,n=Math.max(0,16-(e-b));return b=e+n,window.setTimeout(t,n)}var E=window.requestAnimationFrame||x("RequestAnimationFrame")||w,T=window.cancelAnimationFrame||x("CancelAnimationFrame")||x("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function S(t,e,n){if(!n||E!==w)return E.call(window,r(t,e));t.call(e)}function P(t){t&&T.call(window,t)}var C=(Object.freeze||Object)({freeze:e,extend:n,create:i,bind:r,lastId:o,stamp:a,throttle:s,wrapNum:l,falseFn:u,formatNum:c,trim:p,splitWords:h,setOptions:f,getParamString:d,template:y,isArray:_,indexOf:g,emptyImageUrl:v,requestFn:E,cancelFn:T,requestAnimFrame:S,cancelAnimFrame:P});function k(){}k.extend=function(t){var e=function(){this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},r=e.__super__=this.prototype,o=i(r);for(var a in o.constructor=e,e.prototype=o,this)this.hasOwnProperty(a)&&"prototype"!==a&&"__super__"!==a&&(e[a]=this[a]);return t.statics&&(n(e,t.statics),delete t.statics),t.includes&&(function(t){if("undefined"!=typeof L&&L&&L.Mixin){t=_(t)?t:[t];for(var e=0;e<t.length;e++)t[e]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",(new Error).stack)}}(t.includes),n.apply(null,[o].concat(t.includes)),delete t.includes),o.options&&(t.options=n(i(o.options),t.options)),n(o,t),o._initHooks=[],o.callInitHooks=function(){if(!this._initHooksCalled){r.callInitHooks&&r.callInitHooks.call(this),this._initHooksCalled=!0;for(var t=0,e=o._initHooks.length;t<e;t++)o._initHooks[t].call(this)}},e},k.include=function(t){return n(this.prototype,t),this},k.mergeOptions=function(t){return n(this.prototype.options,t),this},k.addInitHook=function(t){var e=Array.prototype.slice.call(arguments,1),n="function"==typeof t?t:function(){this[t].apply(this,e)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(n),this};var A={on:function(t,e,n){if("object"==typeof t)for(var i in t)this._on(i,t[i],e);else{t=h(t);for(var r=0,o=t.length;r<o;r++)this._on(t[r],e,n)}return this},off:function(t,e,n){if(t)if("object"==typeof t)for(var i in t)this._off(i,t[i],e);else{t=h(t);for(var r=0,o=t.length;r<o;r++)this._off(t[r],e,n)}else delete this._events;return this},_on:function(t,e,n){this._events=this._events||{};var i=this._events[t];i||(i=[],this._events[t]=i),n===this&&(n=void 0);for(var r={fn:e,ctx:n},o=i,a=0,s=o.length;a<s;a++)if(o[a].fn===e&&o[a].ctx===n)return;o.push(r)},_off:function(t,e,n){var i,r,o;if(this._events&&(i=this._events[t]))if(e){if(n===this&&(n=void 0),i)for(r=0,o=i.length;r<o;r++){var a=i[r];if(a.ctx===n&&a.fn===e)return a.fn=u,this._firingCount&&(this._events[t]=i=i.slice()),void i.splice(r,1)}}else{for(r=0,o=i.length;r<o;r++)i[r].fn=u;delete this._events[t]}},fire:function(t,e,i){if(!this.listens(t,i))return this;var r=n({},e,{type:t,target:this,sourceTarget:e&&e.sourceTarget||this});if(this._events){var o=this._events[t];if(o){this._firingCount=this._firingCount+1||1;for(var a=0,s=o.length;a<s;a++){var l=o[a];l.fn.call(l.ctx||this,r)}this._firingCount--}}return i&&this._propagateEvent(r),this},listens:function(t,e){var n=this._events&&this._events[t];if(n&&n.length)return!0;if(e)for(var i in this._eventParents)if(this._eventParents[i].listens(t,e))return!0;return!1},once:function(t,e,n){if("object"==typeof t){for(var i in t)this.once(i,t[i],e);return this}var o=r(function(){this.off(t,e,n).off(t,o,n)},this);return this.on(t,e,n).on(t,o,n)},addEventParent:function(t){return this._eventParents=this._eventParents||{},this._eventParents[a(t)]=t,this},removeEventParent:function(t){return this._eventParents&&delete this._eventParents[a(t)],this},_propagateEvent:function(t){for(var e in this._eventParents)this._eventParents[e].fire(t.type,n({layer:t.target,propagatedFrom:t.target},t),!0)}};A.addEventListener=A.on,A.removeEventListener=A.clearAllEventListeners=A.off,A.addOneTimeEventListener=A.once,A.fireEvent=A.fire,A.hasEventListeners=A.listens;var z=k.extend(A);function M(t,e,n){this.x=n?Math.round(t):t,this.y=n?Math.round(e):e}var I=Math.trunc||function(t){return t>0?Math.floor(t):Math.ceil(t)};function O(t,e,n){return t instanceof M?t:_(t)?new M(t[0],t[1]):null==t?t:"object"==typeof t&&"x"in t&&"y"in t?new M(t.x,t.y):new M(t,e,n)}function D(t,e){if(t)for(var n=e?[t,e]:t,i=0,r=n.length;i<r;i++)this.extend(n[i])}function R(t,e){return!t||t instanceof D?t:new D(t,e)}function B(t,e){if(t)for(var n=e?[t,e]:t,i=0,r=n.length;i<r;i++)this.extend(n[i])}function F(t,e){return t instanceof B?t:new B(t,e)}function N(t,e,n){if(isNaN(t)||isNaN(e))throw new Error("Invalid LatLng object: ("+t+", "+e+")");this.lat=+t,this.lng=+e,void 0!==n&&(this.alt=+n)}function U(t,e,n){return t instanceof N?t:_(t)&&"object"!=typeof t[0]?3===t.length?new N(t[0],t[1],t[2]):2===t.length?new N(t[0],t[1]):null:null==t?t:"object"==typeof t&&"lat"in t?new N(t.lat,"lng"in t?t.lng:t.lon,t.alt):void 0===e?null:new N(t,e,n)}M.prototype={clone:function(){return new M(this.x,this.y)},add:function(t){return this.clone()._add(O(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(O(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},scaleBy:function(t){return new M(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new M(this.x/t.x,this.y/t.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=I(this.x),this.y=I(this.y),this},distanceTo:function(t){var e=(t=O(t)).x-this.x,n=t.y-this.y;return Math.sqrt(e*e+n*n)},equals:function(t){return(t=O(t)).x===this.x&&t.y===this.y},contains:function(t){return t=O(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+c(this.x)+", "+c(this.y)+")"}},D.prototype={extend:function(t){return t=O(t),this.min||this.max?(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(t.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(t.y,this.max.y)):(this.min=t.clone(),this.max=t.clone()),this},getCenter:function(t){return new M((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return new M(this.min.x,this.max.y)},getTopRight:function(){return new M(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(t){var e,n;return(t="number"==typeof t[0]||t instanceof M?O(t):R(t))instanceof D?(e=t.min,n=t.max):e=n=t,e.x>=this.min.x&&n.x<=this.max.x&&e.y>=this.min.y&&n.y<=this.max.y},intersects:function(t){t=R(t);var e=this.min,n=this.max,i=t.min,r=t.max,o=r.x>=e.x&&i.x<=n.x,a=r.y>=e.y&&i.y<=n.y;return o&&a},overlaps:function(t){t=R(t);var e=this.min,n=this.max,i=t.min,r=t.max,o=r.x>e.x&&i.x<n.x,a=r.y>e.y&&i.y<n.y;return o&&a},isValid:function(){return!(!this.min||!this.max)}},B.prototype={extend:function(t){var e,n,i=this._southWest,r=this._northEast;if(t instanceof N)e=t,n=t;else{if(!(t instanceof B))return t?this.extend(U(t)||F(t)):this;if(e=t._southWest,n=t._northEast,!e||!n)return this}return i||r?(i.lat=Math.min(e.lat,i.lat),i.lng=Math.min(e.lng,i.lng),r.lat=Math.max(n.lat,r.lat),r.lng=Math.max(n.lng,r.lng)):(this._southWest=new N(e.lat,e.lng),this._northEast=new N(n.lat,n.lng)),this},pad:function(t){var e=this._southWest,n=this._northEast,i=Math.abs(e.lat-n.lat)*t,r=Math.abs(e.lng-n.lng)*t;return new B(new N(e.lat-i,e.lng-r),new N(n.lat+i,n.lng+r))},getCenter:function(){return new N((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new N(this.getNorth(),this.getWest())},getSouthEast:function(){return new N(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(t){t="number"==typeof t[0]||t instanceof N||"lat"in t?U(t):F(t);var e,n,i=this._southWest,r=this._northEast;return t instanceof B?(e=t.getSouthWest(),n=t.getNorthEast()):e=n=t,e.lat>=i.lat&&n.lat<=r.lat&&e.lng>=i.lng&&n.lng<=r.lng},intersects:function(t){t=F(t);var e=this._southWest,n=this._northEast,i=t.getSouthWest(),r=t.getNorthEast(),o=r.lat>=e.lat&&i.lat<=n.lat,a=r.lng>=e.lng&&i.lng<=n.lng;return o&&a},overlaps:function(t){t=F(t);var e=this._southWest,n=this._northEast,i=t.getSouthWest(),r=t.getNorthEast(),o=r.lat>e.lat&&i.lat<n.lat,a=r.lng>e.lng&&i.lng<n.lng;return o&&a},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t,e){return!!t&&(t=F(t),this._southWest.equals(t.getSouthWest(),e)&&this._northEast.equals(t.getNorthEast(),e))},isValid:function(){return!(!this._southWest||!this._northEast)}},N.prototype={equals:function(t,e){if(!t)return!1;t=U(t);var n=Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng));return n<=(void 0===e?1e-9:e)},toString:function(t){return"LatLng("+c(this.lat,t)+", "+c(this.lng,t)+")"},distanceTo:function(t){return Z.distance(this,U(t))},wrap:function(){return Z.wrapLatLng(this)},toBounds:function(t){var e=180*t/40075017,n=e/Math.cos(Math.PI/180*this.lat);return F([this.lat-e,this.lng-n],[this.lat+e,this.lng+n])},clone:function(){return new N(this.lat,this.lng,this.alt)}};var j,V={latLngToPoint:function(t,e){var n=this.projection.project(t),i=this.scale(e);return this.transformation._transform(n,i)},pointToLatLng:function(t,e){var n=this.scale(e),i=this.transformation.untransform(t,n);return this.projection.unproject(i)},project:function(t){return this.projection.project(t)},unproject:function(t){return this.projection.unproject(t)},scale:function(t){return 256*Math.pow(2,t)},zoom:function(t){return Math.log(t/256)/Math.LN2},getProjectedBounds:function(t){if(this.infinite)return null;var e=this.projection.bounds,n=this.scale(t),i=this.transformation.transform(e.min,n),r=this.transformation.transform(e.max,n);return new D(i,r)},infinite:!1,wrapLatLng:function(t){var e=this.wrapLng?l(t.lng,this.wrapLng,!0):t.lng,n=this.wrapLat?l(t.lat,this.wrapLat,!0):t.lat,i=t.alt;return new N(n,e,i)},wrapLatLngBounds:function(t){var e=t.getCenter(),n=this.wrapLatLng(e),i=e.lat-n.lat,r=e.lng-n.lng;if(0===i&&0===r)return t;var o=t.getSouthWest(),a=t.getNorthEast(),s=new N(o.lat-i,o.lng-r),l=new N(a.lat-i,a.lng-r);return new B(s,l)}},Z=n({},V,{wrapLng:[-180,180],R:6371e3,distance:function(t,e){var n=Math.PI/180,i=t.lat*n,r=e.lat*n,o=Math.sin((e.lat-t.lat)*n/2),a=Math.sin((e.lng-t.lng)*n/2),s=o*o+Math.cos(i)*Math.cos(r)*a*a,l=2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s));return this.R*l}}),q={R:6378137,MAX_LATITUDE:85.0511287798,project:function(t){var e=Math.PI/180,n=this.MAX_LATITUDE,i=Math.max(Math.min(n,t.lat),-n),r=Math.sin(i*e);return new M(this.R*t.lng*e,this.R*Math.log((1+r)/(1-r))/2)},unproject:function(t){var e=180/Math.PI;return new N((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,t.x*e/this.R)},bounds:(j=6378137*Math.PI,new D([-j,-j],[j,j]))};function G(t,e,n,i){if(_(t))return this._a=t[0],this._b=t[1],this._c=t[2],void(this._d=t[3]);this._a=t,this._b=e,this._c=n,this._d=i}function W(t,e,n,i){return new G(t,e,n,i)}G.prototype={transform:function(t,e){return this._transform(t.clone(),e)},_transform:function(t,e){return e=e||1,t.x=e*(this._a*t.x+this._b),t.y=e*(this._c*t.y+this._d),t},untransform:function(t,e){return e=e||1,new M((t.x/e-this._b)/this._a,(t.y/e-this._d)/this._c)}};var H=n({},Z,{code:"EPSG:3857",projection:q,transformation:function(){var t=.5/(Math.PI*q.R);return W(t,.5,-t,.5)}()}),X=n({},H,{code:"EPSG:900913"});function K(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Y(t,e){var n,i,r,o,a,s,l="";for(n=0,r=t.length;n<r;n++){for(a=t[n],i=0,o=a.length;i<o;i++)s=a[i],l+=(i?"L":"M")+s.x+" "+s.y;l+=e?Ct?"z":"x":""}return l||"M0 0"}var J=document.documentElement.style,$="ActiveXObject"in window,Q=$&&!document.addEventListener,tt="msLaunchUri"in navigator&&!("documentMode"in document),et=At("webkit"),nt=At("android"),it=At("android 2")||At("android 3"),rt=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),ot=nt&&At("Google")&&rt<537&&!("AudioNode"in window),at=!!window.opera,st=At("chrome"),lt=At("gecko")&&!et&&!at&&!$,ut=!st&&At("safari"),ct=At("phantom"),pt="OTransition"in J,ht=0===navigator.platform.indexOf("Win"),ft=$&&"transition"in J,dt="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!it,mt="MozPerspective"in J,yt=!window.L_DISABLE_3D&&(ft||dt||mt)&&!pt&&!ct,_t="undefined"!=typeof orientation||At("mobile"),gt=_t&&et,vt=_t&&dt,xt=!window.PointerEvent&&window.MSPointerEvent,bt=!(!window.PointerEvent&&!xt),wt=!window.L_NO_TOUCH&&(bt||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),Et=_t&&at,Tt=_t&<,St=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,Pt=!!document.createElement("canvas").getContext,Ct=!(!document.createElementNS||!K("svg").createSVGRect),kt=!Ct&&function(){try{var t=document.createElement("div");t.innerHTML='<v:shape adj="1"/>';var e=t.firstChild;return e.style.behavior="url(#default#VML)",e&&"object"==typeof e.adj}catch(t){return!1}}();function At(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var zt=(Object.freeze||Object)({ie:$,ielt9:Q,edge:tt,webkit:et,android:nt,android23:it,androidStock:ot,opera:at,chrome:st,gecko:lt,safari:ut,phantom:ct,opera12:pt,win:ht,ie3d:ft,webkit3d:dt,gecko3d:mt,any3d:yt,mobile:_t,mobileWebkit:gt,mobileWebkit3d:vt,msPointer:xt,pointer:bt,touch:wt,mobileOpera:Et,mobileGecko:Tt,retina:St,canvas:Pt,svg:Ct,vml:kt}),Lt=xt?"MSPointerDown":"pointerdown",Mt=xt?"MSPointerMove":"pointermove",It=xt?"MSPointerUp":"pointerup",Ot=xt?"MSPointerCancel":"pointercancel",Dt=["INPUT","SELECT","OPTION"],Rt={},Bt=!1,Ft=0;function Nt(t,e,n,i){return"touchstart"===e?function(t,e,n){var i=r(function(t){if("mouse"!==t.pointerType&&t.MSPOINTER_TYPE_MOUSE&&t.pointerType!==t.MSPOINTER_TYPE_MOUSE){if(!(Dt.indexOf(t.target.tagName)<0))return;Re(t)}Zt(t,e)});t["_leaflet_touchstart"+n]=i,t.addEventListener(Lt,i,!1),Bt||(document.documentElement.addEventListener(Lt,Ut,!0),document.documentElement.addEventListener(Mt,jt,!0),document.documentElement.addEventListener(It,Vt,!0),document.documentElement.addEventListener(Ot,Vt,!0),Bt=!0)}(t,n,i):"touchmove"===e?function(t,e,n){var i=function(t){(t.pointerType!==t.MSPOINTER_TYPE_MOUSE&&"mouse"!==t.pointerType||0!==t.buttons)&&Zt(t,e)};t["_leaflet_touchmove"+n]=i,t.addEventListener(Mt,i,!1)}(t,n,i):"touchend"===e&&function(t,e,n){var i=function(t){Zt(t,e)};t["_leaflet_touchend"+n]=i,t.addEventListener(It,i,!1),t.addEventListener(Ot,i,!1)}(t,n,i),this}function Ut(t){Rt[t.pointerId]=t,Ft++}function jt(t){Rt[t.pointerId]&&(Rt[t.pointerId]=t)}function Vt(t){delete Rt[t.pointerId],Ft--}function Zt(t,e){for(var n in t.touches=[],Rt)t.touches.push(Rt[n]);t.changedTouches=[t],e(t)}var qt=xt?"MSPointerDown":bt?"pointerdown":"touchstart",Gt=xt?"MSPointerUp":bt?"pointerup":"touchend",Wt="_leaflet_";function Ht(t,e,n){var i,r,o=!1,a=250;function s(t){var e;if(bt){if(!tt||"mouse"===t.pointerType)return;e=Ft}else e=t.touches.length;if(!(e>1)){var n=Date.now(),s=n-(i||n);r=t.touches?t.touches[0]:t,o=s>0&&s<=a,i=n}}function l(t){if(o&&!r.cancelBubble){if(bt){if(!tt||"mouse"===t.pointerType)return;var n,a,s={};for(a in r)n=r[a],s[a]=n&&n.bind?n.bind(r):n;r=s}r.type="dblclick",e(r),i=null}}return t[Wt+qt+n]=s,t[Wt+Gt+n]=l,t[Wt+"dblclick"+n]=e,t.addEventListener(qt,s,!1),t.addEventListener(Gt,l,!1),t.addEventListener("dblclick",e,!1),this}function Xt(t,e){var n=t[Wt+qt+e],i=t[Wt+Gt+e],r=t[Wt+"dblclick"+e];return t.removeEventListener(qt,n,!1),t.removeEventListener(Gt,i,!1),tt||t.removeEventListener("dblclick",r,!1),this}var Kt,Yt,Jt,$t,Qt,te=ye(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),ee=ye(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),ne="webkitTransition"===ee||"OTransition"===ee?ee+"End":"transitionend";function ie(t){return"string"==typeof t?document.getElementById(t):t}function re(t,e){var n=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!n||"auto"===n)&&document.defaultView){var i=document.defaultView.getComputedStyle(t,null);n=i?i[e]:null}return"auto"===n?null:n}function oe(t,e,n){var i=document.createElement(t);return i.className=e||"",n&&n.appendChild(i),i}function ae(t){var e=t.parentNode;e&&e.removeChild(t)}function se(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function le(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function ue(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function ce(t,e){if(void 0!==t.classList)return t.classList.contains(e);var n=de(t);return n.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(n)}function pe(t,e){if(void 0!==t.classList)for(var n=h(e),i=0,r=n.length;i<r;i++)t.classList.add(n[i]);else if(!ce(t,e)){var o=de(t);fe(t,(o?o+" ":"")+e)}}function he(t,e){void 0!==t.classList?t.classList.remove(e):fe(t,p((" "+de(t)+" ").replace(" "+e+" "," ")))}function fe(t,e){void 0===t.className.baseVal?t.className=e:t.className.baseVal=e}function de(t){return t.correspondingElement&&(t=t.correspondingElement),void 0===t.className.baseVal?t.className:t.className.baseVal}function me(t,e){"opacity"in t.style?t.style.opacity=e:"filter"in t.style&&function(t,e){var n=!1,i="DXImageTransform.Microsoft.Alpha";try{n=t.filters.item(i)}catch(t){if(1===e)return}e=Math.round(100*e),n?(n.Enabled=100!==e,n.Opacity=e):t.style.filter+=" progid:"+i+"(opacity="+e+")"}(t,e)}function ye(t){for(var e=document.documentElement.style,n=0;n<t.length;n++)if(t[n]in e)return t[n];return!1}function _e(t,e,n){var i=e||new M(0,0);t.style[te]=(ft?"translate("+i.x+"px,"+i.y+"px)":"translate3d("+i.x+"px,"+i.y+"px,0)")+(n?" scale("+n+")":"")}function ge(t,e){t._leaflet_pos=e,yt?_e(t,e):(t.style.left=e.x+"px",t.style.top=e.y+"px")}function ve(t){return t._leaflet_pos||new M(0,0)}if("onselectstart"in document)Kt=function(){ke(window,"selectstart",Re)},Yt=function(){ze(window,"selectstart",Re)};else{var xe=ye(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);Kt=function(){if(xe){var t=document.documentElement.style;Jt=t[xe],t[xe]="none"}},Yt=function(){xe&&(document.documentElement.style[xe]=Jt,Jt=void 0)}}function be(){ke(window,"dragstart",Re)}function we(){ze(window,"dragstart",Re)}function Ee(t){for(;-1===t.tabIndex;)t=t.parentNode;t.style&&(Te(),$t=t,Qt=t.style.outline,t.style.outline="none",ke(window,"keydown",Te))}function Te(){$t&&($t.style.outline=Qt,$t=void 0,Qt=void 0,ze(window,"keydown",Te))}function Se(t){do{t=t.parentNode}while(!(t.offsetWidth&&t.offsetHeight||t===document.body));return t}function Pe(t){var e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}var Ce=(Object.freeze||Object)({TRANSFORM:te,TRANSITION:ee,TRANSITION_END:ne,get:ie,getStyle:re,create:oe,remove:ae,empty:se,toFront:le,toBack:ue,hasClass:ce,addClass:pe,removeClass:he,setClass:fe,getClass:de,setOpacity:me,testProp:ye,setTransform:_e,setPosition:ge,getPosition:ve,disableTextSelection:Kt,enableTextSelection:Yt,disableImageDrag:be,enableImageDrag:we,preventOutline:Ee,restoreOutline:Te,getSizedParentNode:Se,getScale:Pe});function ke(t,e,n,i){if("object"==typeof e)for(var r in e)Le(t,r,e[r],n);else{e=h(e);for(var o=0,a=e.length;o<a;o++)Le(t,e[o],n,i)}return this}var Ae="_leaflet_events";function ze(t,e,n,i){if("object"==typeof e)for(var r in e)Me(t,r,e[r],n);else if(e){e=h(e);for(var o=0,a=e.length;o<a;o++)Me(t,e[o],n,i)}else{for(var s in t[Ae])Me(t,s,t[Ae][s]);delete t[Ae]}return this}function Le(t,e,n,i){var r=e+a(n)+(i?"_"+a(i):"");if(t[Ae]&&t[Ae][r])return this;var o=function(e){return n.call(i||t,e||window.event)},s=o;bt&&0===e.indexOf("touch")?Nt(t,e,o,r):!wt||"dblclick"!==e||!Ht||bt&&st?"addEventListener"in t?"mousewheel"===e?t.addEventListener("onwheel"in t?"wheel":"mousewheel",o,!1):"mouseenter"===e||"mouseleave"===e?(o=function(e){e=e||window.event,Ge(t,e)&&s(e)},t.addEventListener("mouseenter"===e?"mouseover":"mouseout",o,!1)):("click"===e&&nt&&(o=function(t){!function(t,e){var n=t.timeStamp||t.originalEvent&&t.originalEvent.timeStamp,i=je&&n-je;i&&i>100&&i<500||t.target._simulatedClick&&!t._simulated?Be(t):(je=n,e(t))}(t,s)}),t.addEventListener(e,o,!1)):"attachEvent"in t&&t.attachEvent("on"+e,o):Ht(t,o,r),t[Ae]=t[Ae]||{},t[Ae][r]=o}function Me(t,e,n,i){var r=e+a(n)+(i?"_"+a(i):""),o=t[Ae]&&t[Ae][r];if(!o)return this;bt&&0===e.indexOf("touch")?function(t,e,n){var i=t["_leaflet_"+e+n];"touchstart"===e?t.removeEventListener(Lt,i,!1):"touchmove"===e?t.removeEventListener(Mt,i,!1):"touchend"===e&&(t.removeEventListener(It,i,!1),t.removeEventListener(Ot,i,!1))}(t,e,r):!wt||"dblclick"!==e||!Xt||bt&&st?"removeEventListener"in t?"mousewheel"===e?t.removeEventListener("onwheel"in t?"wheel":"mousewheel",o,!1):t.removeEventListener("mouseenter"===e?"mouseover":"mouseleave"===e?"mouseout":e,o,!1):"detachEvent"in t&&t.detachEvent("on"+e,o):Xt(t,r),t[Ae][r]=null}function Ie(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,qe(t),this}function Oe(t){return Le(t,"mousewheel",Ie),this}function De(t){return ke(t,"mousedown touchstart dblclick",Ie),Le(t,"click",Ze),this}function Re(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function Be(t){return Re(t),Ie(t),this}function Fe(t,e){if(!e)return new M(t.clientX,t.clientY);var n=Pe(e),i=n.boundingClientRect;return new M((t.clientX-i.left)/n.x-e.clientLeft,(t.clientY-i.top)/n.y-e.clientTop)}var Ne=ht&&st?2*window.devicePixelRatio:lt?window.devicePixelRatio:1;function Ue(t){return tt?t.wheelDeltaY/2:t.deltaY&&0===t.deltaMode?-t.deltaY/Ne:t.deltaY&&1===t.deltaMode?20*-t.deltaY:t.deltaY&&2===t.deltaMode?60*-t.deltaY:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?20*-t.detail:t.detail?t.detail/-32765*60:0}var je,Ve={};function Ze(t){Ve[t.type]=!0}function qe(t){var e=Ve[t.type];return Ve[t.type]=!1,e}function Ge(t,e){var n=e.relatedTarget;if(!n)return!0;try{for(;n&&n!==t;)n=n.parentNode}catch(t){return!1}return n!==t}var We=(Object.freeze||Object)({on:ke,off:ze,stopPropagation:Ie,disableScrollPropagation:Oe,disableClickPropagation:De,preventDefault:Re,stop:Be,getMousePosition:Fe,getWheelDelta:Ue,fakeStop:Ze,skipped:qe,isExternalTarget:Ge,addListener:ke,removeListener:ze}),He=z.extend({run:function(t,e,n,i){this.stop(),this._el=t,this._inProgress=!0,this._duration=n||.25,this._easeOutPower=1/Math.max(i||.5,.2),this._startPos=ve(t),this._offset=e.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=S(this._animate,this),this._step()},_step:function(t){var e=+new Date-this._startTime,n=1e3*this._duration;e<n?this._runFrame(this._easeOut(e/n),t):(this._runFrame(1),this._complete())},_runFrame:function(t,e){var n=this._startPos.add(this._offset.multiplyBy(t));e&&n._round(),ge(this._el,n),this.fire("step")},_complete:function(){P(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),Xe=z.extend({options:{crs:H,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(t,e){e=f(this,e),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),this._onResize=r(this._onResize,this),this._initEvents(),e.maxBounds&&this.setMaxBounds(e.maxBounds),void 0!==e.zoom&&(this._zoom=this._limitZoom(e.zoom)),e.center&&void 0!==e.zoom&&this.setView(U(e.center),e.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=ee&&yt&&!Et&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),ke(this._proxy,ne,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(t,e,i){if(e=void 0===e?this._zoom:this._limitZoom(e),t=this._limitCenter(U(t),e,this.options.maxBounds),i=i||{},this._stop(),this._loaded&&!i.reset&&!0!==i){void 0!==i.animate&&(i.zoom=n({animate:i.animate},i.zoom),i.pan=n({animate:i.animate,duration:i.duration},i.pan));var r=this._zoom!==e?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,e,i.zoom):this._tryAnimatedPan(t,i.pan);if(r)return clearTimeout(this._sizeTimer),this}return this._resetView(t,e),this},setZoom:function(t,e){return this._loaded?this.setView(this.getCenter(),t,{zoom:e}):(this._zoom=t,this)},zoomIn:function(t,e){return t=t||(yt?this.options.zoomDelta:1),this.setZoom(this._zoom+t,e)},zoomOut:function(t,e){return t=t||(yt?this.options.zoomDelta:1),this.setZoom(this._zoom-t,e)},setZoomAround:function(t,e,n){var i=this.getZoomScale(e),r=this.getSize().divideBy(2),o=t instanceof M?t:this.latLngToContainerPoint(t),a=o.subtract(r).multiplyBy(1-1/i),s=this.containerPointToLatLng(r.add(a));return this.setView(s,e,{zoom:n})},_getBoundsCenterZoom:function(t,e){e=e||{},t=t.getBounds?t.getBounds():F(t);var n=O(e.paddingTopLeft||e.padding||[0,0]),i=O(e.paddingBottomRight||e.padding||[0,0]),r=this.getBoundsZoom(t,!1,n.add(i));if((r="number"==typeof e.maxZoom?Math.min(e.maxZoom,r):r)===1/0)return{center:t.getCenter(),zoom:r};var o=i.subtract(n).divideBy(2),a=this.project(t.getSouthWest(),r),s=this.project(t.getNorthEast(),r),l=this.unproject(a.add(s).divideBy(2).add(o),r);return{center:l,zoom:r}},fitBounds:function(t,e){if(!(t=F(t)).isValid())throw new Error("Bounds are not valid.");var n=this._getBoundsCenterZoom(t,e);return this.setView(n.center,n.zoom,e)},fitWorld:function(t){return this.fitBounds([[-90,-180],[90,180]],t)},panTo:function(t,e){return this.setView(t,this._zoom,{pan:e})},panBy:function(t,e){if(t=O(t).round(),e=e||{},!t.x&&!t.y)return this.fire("moveend");if(!0!==e.animate&&!this.getSize().contains(t))return this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new He,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),e.noMoveStart||this.fire("movestart"),!1!==e.animate){pe(this._mapPane,"leaflet-pan-anim");var n=this._getMapPanePos().subtract(t).round();this._panAnim.run(this._mapPane,n,e.duration||.25,e.easeLinearity)}else this._rawPanBy(t),this.fire("move").fire("moveend");return this},flyTo:function(t,e,n){if(!1===(n=n||{}).animate||!yt)return this.setView(t,e,n);this._stop();var i=this.project(this.getCenter()),r=this.project(t),o=this.getSize(),a=this._zoom;t=U(t),e=void 0===e?a:e;var s=Math.max(o.x,o.y),l=s*this.getZoomScale(a,e),u=r.distanceTo(i)||1,c=1.42,p=c*c;function h(t){var e=t?-1:1,n=t?l:s,i=l*l-s*s+e*p*p*u*u,r=2*n*p*u,o=i/r,a=Math.sqrt(o*o+1)-o,c=a<1e-9?-18:Math.log(a);return c}function f(t){return(Math.exp(t)-Math.exp(-t))/2}function d(t){return(Math.exp(t)+Math.exp(-t))/2}var m=h(0);function y(t){return s*(d(m)*(f(e=m+c*t)/d(e))-f(m))/p;var e}var _=Date.now(),g=(h(1)-m)/c,v=n.duration?1e3*n.duration:1e3*g*.8;return this._moveStart(!0,n.noMoveStart),function n(){var o=(Date.now()-_)/v,l=function(t){return 1-Math.pow(1-t,1.5)}(o)*g;o<=1?(this._flyToFrame=S(n,this),this._move(this.unproject(i.add(r.subtract(i).multiplyBy(y(l)/u)),a),this.getScaleZoom(s/function(t){return s*(d(m)/d(m+c*t))}(l),a),{flyTo:!0})):this._move(t,e)._moveEnd(!0)}.call(this),this},flyToBounds:function(t,e){var n=this._getBoundsCenterZoom(t,e);return this.flyTo(n.center,n.zoom,e)},setMaxBounds:function(t){return(t=F(t)).isValid()?(this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this.options.maxBounds=t,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this.off("moveend",this._panInsideMaxBounds))},setMinZoom:function(t){var e=this.options.minZoom;return this.options.minZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(t):this},setMaxZoom:function(t){var e=this.options.maxZoom;return this.options.maxZoom=t,this._loaded&&e!==t&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,e){this._enforcingBounds=!0;var n=this.getCenter(),i=this._limitCenter(n,this._zoom,F(t));return n.equals(i)||this.panTo(i,e),this._enforcingBounds=!1,this},panInside:function(t,e){var n=O((e=e||{}).paddingTopLeft||e.padding||[0,0]),i=O(e.paddingBottomRight||e.padding||[0,0]),r=this.getCenter(),o=this.project(r),a=this.project(t),s=this.getPixelBounds(),l=s.getSize().divideBy(2),u=R([s.min.add(n),s.max.subtract(i)]);if(!u.contains(a)){this._enforcingBounds=!0;var c=o.subtract(a),p=O(a.x+c.x,a.y+c.y);(a.x<u.min.x||a.x>u.max.x)&&(p.x=o.x-c.x,c.x>0?p.x+=l.x-n.x:p.x-=l.x-i.x),(a.y<u.min.y||a.y>u.max.y)&&(p.y=o.y-c.y,c.y>0?p.y+=l.y-n.y:p.y-=l.y-i.y),this.panTo(this.unproject(p),e),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=n({animate:!1,pan:!0},!0===t?{animate:!0}:t);var e=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var i=this.getSize(),o=e.divideBy(2).round(),a=i.divideBy(2).round(),s=o.subtract(a);return s.x||s.y?(t.animate&&t.pan?this.panBy(s):(t.pan&&this._rawPanBy(s),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(r(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:e,newSize:i})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=n({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var e=r(this._handleGeolocationResponse,this),i=r(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(e,i,t):navigator.geolocation.getCurrentPosition(e,i,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var e=t.code,n=t.message||(1===e?"permission denied":2===e?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+n+"."})},_handleGeolocationResponse:function(t){var e=t.coords.latitude,n=t.coords.longitude,i=new N(e,n),r=i.toBounds(2*t.coords.accuracy),o=this._locateOptions;if(o.setView){var a=this.getBoundsZoom(r);this.setView(i,o.maxZoom?Math.min(a,o.maxZoom):a)}var s={latlng:i,bounds:r,timestamp:t.timestamp};for(var l in t.coords)"number"==typeof t.coords[l]&&(s[l]=t.coords[l]);this.fire("locationfound",s)},addHandler:function(t,e){if(!e)return this;var n=this[t]=new e(this);return this._handlers.push(n),this.options[t]&&n.enable(),this},remove:function(){if(this._initEvents(!0),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}var t;for(t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),ae(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(P(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)ae(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){var n="leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),i=oe("div",n,e||this._mapPane);return t&&(this._panes[t]=i),i},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter:this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds(),e=this.unproject(t.getBottomLeft()),n=this.unproject(t.getTopRight());return new B(e,n)},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,n){t=F(t),n=O(n||[0,0]);var i=this.getZoom()||0,r=this.getMinZoom(),o=this.getMaxZoom(),a=t.getNorthWest(),s=t.getSouthEast(),l=this.getSize().subtract(n),u=R(this.project(s,i),this.project(a,i)).getSize(),c=yt?this.options.zoomSnap:1,p=l.x/u.x,h=l.y/u.y,f=e?Math.max(p,h):Math.min(p,h);return i=this.getScaleZoom(f,i),c&&(i=Math.round(i/(c/100))*(c/100),i=e?Math.ceil(i/c)*c:Math.floor(i/c)*c),Math.max(r,Math.min(o,i))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new M(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){var n=this._getTopLeftPoint(t,e);return new D(n,n.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var n=this.options.crs;return e=void 0===e?this._zoom:e,n.scale(t)/n.scale(e)},getScaleZoom:function(t,e){var n=this.options.crs;e=void 0===e?this._zoom:e;var i=n.zoom(t*n.scale(e));return isNaN(i)?1/0:i},project:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.latLngToPoint(U(t),e)},unproject:function(t,e){return e=void 0===e?this._zoom:e,this.options.crs.pointToLatLng(O(t),e)},layerPointToLatLng:function(t){var e=O(t).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){var e=this.project(U(t))._round();return e._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(U(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(F(t))},distance:function(t,e){return this.options.crs.distance(U(t),U(e))},containerPointToLayerPoint:function(t){return O(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return O(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var e=this.containerPointToLayerPoint(O(t));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(U(t)))},mouseEventToContainerPoint:function(t){return Fe(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var e=this._container=ie(t);if(!e)throw new Error("Map container not found.");if(e._leaflet_id)throw new Error("Map container is already initialized.");ke(e,"scroll",this._onScroll,this),this._containerId=a(e)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&yt,pe(t,"leaflet-container"+(wt?" leaflet-touch":"")+(St?" leaflet-retina":"")+(Q?" leaflet-oldie":"")+(ut?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var e=re(t,"position");"absolute"!==e&&"relative"!==e&&"fixed"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),ge(this._mapPane,new M(0,0)),this.createPane("tilePane"),this.createPane("shadowPane"),this.createPane("overlayPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(pe(t.markerPane,"leaflet-zoom-hide"),pe(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e){ge(this._mapPane,new M(0,0));var n=!this._loaded;this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset");var i=this._zoom!==e;this._moveStart(i,!1)._move(t,e)._moveEnd(i),this.fire("viewreset"),n&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(t,e,n){void 0===e&&(e=this._zoom);var i=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),(i||n&&n.pinch)&&this.fire("zoom",n),this.fire("move",n)},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return P(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){ge(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={},this._targets[a(this._container)]=this;var e=t?ze:ke;e(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),yt&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){P(this._resizeRequest),this._resizeRequest=S(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,e){for(var n,i=[],r="mouseout"===e||"mouseover"===e,o=t.target||t.srcElement,s=!1;o;){if((n=this._targets[a(o)])&&("click"===e||"preclick"===e)&&!t._simulated&&this._draggableMoved(n)){s=!0;break}if(n&&n.listens(e,!0)){if(r&&!Ge(o,t))break;if(i.push(n),r)break}if(o===this._container)break;o=o.parentNode}return i.length||s||r||!Ge(o,t)||(i=[this]),i},_handleDOMEvent:function(t){if(this._loaded&&!qe(t)){var e=t.type;"mousedown"!==e&&"keypress"!==e||Ee(t.target||t.srcElement),this._fireDOMEvent(t,e)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,e,i){if("click"===t.type){var r=n({},t);r.type="preclick",this._fireDOMEvent(r,r.type,i)}if(!t._stopped&&(i=(i||[]).concat(this._findEventTargets(t,e))).length){var o=i[0];"contextmenu"===e&&o.listens(e,!0)&&Re(t);var a={originalEvent:t};if("keypress"!==t.type){var s=o.getLatLng&&(!o._radius||o._radius<=10);a.containerPoint=s?this.latLngToContainerPoint(o.getLatLng()):this.mouseEventToContainerPoint(t),a.layerPoint=this.containerPointToLayerPoint(a.containerPoint),a.latlng=s?o.getLatLng():this.layerPointToLatLng(a.layerPoint)}for(var l=0;l<i.length;l++)if(i[l].fire(e,a,!0),a.originalEvent._stopped||!1===i[l].options.bubblingMouseEvents&&-1!==g(this._mouseEvents,e))return}},_draggableMoved:function(t){return(t=t.dragging&&t.dragging.enabled()?t:this).dragging&&t.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var t=0,e=this._handlers.length;t<e;t++)this._handlers[t].disable()},whenReady:function(t,e){return this._loaded?t.call(e||this,{target:this}):this.on("load",t,e),this},_getMapPanePos:function(){return ve(this._mapPane)||new M(0,0)},_moved:function(){var t=this._getMapPanePos();return t&&!t.equals([0,0])},_getTopLeftPoint:function(t,e){var n=t&&void 0!==e?this._getNewPixelOrigin(t,e):this.getPixelOrigin();return n.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(t,e){var n=this.getSize()._divideBy(2);return this.project(t,e)._subtract(n)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(t,e,n){var i=this._getNewPixelOrigin(n,e);return this.project(t,e)._subtract(i)},_latLngBoundsToNewLayerBounds:function(t,e,n){var i=this._getNewPixelOrigin(n,e);return R([this.project(t.getSouthWest(),e)._subtract(i),this.project(t.getNorthWest(),e)._subtract(i),this.project(t.getSouthEast(),e)._subtract(i),this.project(t.getNorthEast(),e)._subtract(i)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())},_limitCenter:function(t,e,n){if(!n)return t;var i=this.project(t,e),r=this.getSize().divideBy(2),o=new D(i.subtract(r),i.add(r)),a=this._getBoundsOffset(o,n,e);return a.round().equals([0,0])?t:this.unproject(i.add(a),e)},_limitOffset:function(t,e){if(!e)return t;var n=this.getPixelBounds(),i=new D(n.min.add(t),n.max.add(t));return t.add(this._getBoundsOffset(i,e))},_getBoundsOffset:function(t,e,n){var i=R(this.project(e.getNorthEast(),n),this.project(e.getSouthWest(),n)),r=i.min.subtract(t.min),o=i.max.subtract(t.max),a=this._rebound(r.x,-o.x),s=this._rebound(r.y,-o.y);return new M(a,s)},_rebound:function(t,e){return t+e>0?Math.round(t-e)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(e))},_limitZoom:function(t){var e=this.getMinZoom(),n=this.getMaxZoom(),i=yt?this.options.zoomSnap:1;return i&&(t=Math.round(t/i)*i),Math.max(e,Math.min(n,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){he(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,e){var n=this._getCenterOffset(t)._trunc();return!(!0!==(e&&e.animate)&&!this.getSize().contains(n)||(this.panBy(n,e),0))},_createAnimProxy:function(){var t=this._proxy=oe("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",function(t){var e=te,n=this._proxy.style[e];_e(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),n===this._proxy.style[e]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",function(){var t=this.getCenter(),e=this.getZoom();_e(this._proxy,this.project(t,e),this.getZoomScale(e,1))},this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){ae(this._proxy),delete this._proxy},_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,e,n){if(this._animatingZoom)return!0;if(n=n||{},!this._zoomAnimated||!1===n.animate||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var i=this.getZoomScale(e),r=this._getCenterOffset(t)._divideBy(1-1/i);return!(!0!==n.animate&&!this.getSize().contains(r)||(S(function(){this._moveStart(!0,!1)._animateZoom(t,e,!0)},this),0))},_animateZoom:function(t,e,n,i){this._mapPane&&(n&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,pe(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:i}),setTimeout(r(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&he(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom),S(function(){this._moveEnd(!0)},this))}}),Ke=k.extend({options:{position:"topright"},initialize:function(t){f(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var e=this._container=this.onAdd(t),n=this.getPosition(),i=t._controlCorners[n];return pe(e,"leaflet-control"),-1!==n.indexOf("bottom")?i.insertBefore(e,i.firstChild):i.appendChild(e),this},remove:function(){return this._map?(ae(this._container),this.onRemove&&this.onRemove(this._map),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),Ye=function(t){return new Ke(t)};Xe.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var t=this._controlCorners={},e="leaflet-",n=this._controlContainer=oe("div",e+"control-container",this._container);function i(i,r){var o=e+i+" "+e+r;t[i+r]=oe("div",o,n)}i("top","left"),i("top","right"),i("bottom","left"),i("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)ae(this._controlCorners[t]);ae(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var Je=Ke.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,e,n,i){return n<i?-1:i<n?1:0}},initialize:function(t,e,n){for(var i in f(this,n),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,t)this._addLayer(t[i],i);for(i in e)this._addLayer(e[i],i,!0)},onAdd:function(t){this._initLayout(),this._update(),this._map=t,t.on("zoomend",this._checkDisabledLayers,this);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(t){return Ke.prototype.addTo.call(this,t),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(t,e){return this._addLayer(t,e),this._map?this._update():this},addOverlay:function(t,e){return this._addLayer(t,e,!0),this._map?this._update():this},removeLayer:function(t){t.off("add remove",this._onLayerChange,this);var e=this._getLayer(a(t));return e&&this._layers.splice(this._layers.indexOf(e),1),this._map?this._update():this},expand:function(){pe(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var t=this._map.getSize().y-(this._container.offsetTop+50);return t<this._section.clientHeight?(pe(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=t+"px"):he(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return he(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var t="leaflet-control-layers",e=this._container=oe("div",t),n=this.options.collapsed;e.setAttribute("aria-haspopup",!0),De(e),Oe(e);var i=this._section=oe("section",t+"-list");n&&(this._map.on("click",this.collapse,this),nt||ke(e,{mouseenter:this.expand,mouseleave:this.collapse},this));var r=this._layersLink=oe("a",t+"-toggle",e);r.href="#",r.title="Layers",wt?(ke(r,"click",Be),ke(r,"click",this.expand,this)):ke(r,"focus",this.expand,this),n||this.expand(),this._baseLayersList=oe("div",t+"-base",i),this._separator=oe("div",t+"-separator",i),this._overlaysList=oe("div",t+"-overlays",i),e.appendChild(i)},_getLayer:function(t){for(var e=0;e<this._layers.length;e++)if(this._layers[e]&&a(this._layers[e].layer)===t)return this._layers[e]},_addLayer:function(t,e,n){this._map&&t.on("add remove",this._onLayerChange,this),this._layers.push({layer:t,name:e,overlay:n}),this.options.sortLayers&&this._layers.sort(r(function(t,e){return this.options.sortFunction(t.layer,e.layer,t.name,e.name)},this)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;se(this._baseLayersList),se(this._overlaysList),this._layerControlInputs=[];var t,e,n,i,r=0;for(n=0;n<this._layers.length;n++)i=this._layers[n],this._addItem(i),e=e||i.overlay,t=t||!i.overlay,r+=i.overlay?0:1;return this.options.hideSingleBase&&(t=t&&r>1,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=e&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var e=this._getLayer(a(t.target)),n=e.overlay?"add"===t.type?"overlayadd":"overlayremove":"add"===t.type?"baselayerchange":null;n&&this._map.fire(n,e)},_createRadioElement:function(t,e){var n='<input type="radio" class="leaflet-control-layers-selector" name="'+t+'"'+(e?' checked="checked"':"")+"/>",i=document.createElement("div");return i.innerHTML=n,i.firstChild},_addItem:function(t){var e,n=document.createElement("label"),i=this._map.hasLayer(t.layer);t.overlay?((e=document.createElement("input")).type="checkbox",e.className="leaflet-control-layers-selector",e.defaultChecked=i):e=this._createRadioElement("leaflet-base-layers",i),this._layerControlInputs.push(e),e.layerId=a(t.layer),ke(e,"click",this._onInputClick,this);var r=document.createElement("span");r.innerHTML=" "+t.name;var o=document.createElement("div");n.appendChild(o),o.appendChild(e),o.appendChild(r);var s=t.overlay?this._overlaysList:this._baseLayersList;return s.appendChild(n),this._checkDisabledLayers(),n},_onInputClick:function(){var t,e,n=this._layerControlInputs,i=[],r=[];this._handlingClick=!0;for(var o=n.length-1;o>=0;o--)t=n[o],e=this._getLayer(t.layerId).layer,t.checked?i.push(e):t.checked||r.push(e);for(o=0;o<r.length;o++)this._map.hasLayer(r[o])&&this._map.removeLayer(r[o]);for(o=0;o<i.length;o++)this._map.hasLayer(i[o])||this._map.addLayer(i[o]);this._handlingClick=!1,this._refocusOnMap()},_checkDisabledLayers:function(){for(var t,e,n=this._layerControlInputs,i=this._map.getZoom(),r=n.length-1;r>=0;r--)t=n[r],e=this._getLayer(t.layerId).layer,t.disabled=void 0!==e.options.minZoom&&i<e.options.minZoom||void 0!==e.options.maxZoom&&i>e.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expand:function(){return this.expand()},_collapse:function(){return this.collapse()}}),$e=Ke.extend({options:{position:"topleft",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"−",zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",n=oe("div",e+" leaflet-bar"),i=this.options;return this._zoomInButton=this._createButton(i.zoomInText,i.zoomInTitle,e+"-in",n,this._zoomIn),this._zoomOutButton=this._createButton(i.zoomOutText,i.zoomOutTitle,e+"-out",n,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),n},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(t.shiftKey?3:1))},_zoomOut:function(t){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,e,n,i,r){var o=oe("a",n,i);return o.innerHTML=t,o.href="#",o.title=e,o.setAttribute("role","button"),o.setAttribute("aria-label",e),De(o),ke(o,"click",Be),ke(o,"click",r,this),ke(o,"click",this._refocusOnMap,this),o},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";he(this._zoomInButton,e),he(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMinZoom())&&pe(this._zoomOutButton,e),(this._disabled||t._zoom===t.getMaxZoom())&&pe(this._zoomInButton,e)}});Xe.mergeOptions({zoomControl:!0}),Xe.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new $e,this.addControl(this.zoomControl))});var Qe=Ke.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e=oe("div","leaflet-control-scale"),n=this.options;return this._addScales(n,"leaflet-control-scale-line",e),t.on(n.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),e},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,n){t.metric&&(this._mScale=oe("div",e,n)),t.imperial&&(this._iScale=oe("div",e,n))},_update:function(){var t=this._map,e=t.getSize().y/2,n=t.distance(t.containerPointToLatLng([0,e]),t.containerPointToLatLng([this.options.maxWidth,e]));this._updateScales(n)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var e=this._getRoundNum(t),n=e<1e3?e+" m":e/1e3+" km";this._updateScale(this._mScale,n,e/t)},_updateImperial:function(t){var e,n,i,r=3.2808399*t;r>5280?(e=r/5280,n=this._getRoundNum(e),this._updateScale(this._iScale,n+" mi",n/e)):(i=this._getRoundNum(r),this._updateScale(this._iScale,i+" ft",i/r))},_updateScale:function(t,e,n){t.style.width=Math.round(this.options.maxWidth*n)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),n=t/e;return e*(n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:1)}}),tn=Ke.extend({options:{position:"bottomright",prefix:'<a href="http://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>'},initialize:function(t){f(this,t),this._attributions={}},onAdd:function(t){for(var e in t.attributionControl=this,this._container=oe("div","leaflet-control-attribution"),De(this._container),t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),this._container},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):this},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):this},_update:function(){if(this._map){var t=[];for(var e in this._attributions)this._attributions[e]&&t.push(e);var n=[];this.options.prefix&&n.push(this.options.prefix),t.length&&n.push(t.join(", ")),this._container.innerHTML=n.join(" | ")}}});Xe.mergeOptions({attributionControl:!0}),Xe.addInitHook(function(){this.options.attributionControl&&(new tn).addTo(this)}),Ke.Layers=Je,Ke.Zoom=$e,Ke.Scale=Qe,Ke.Attribution=tn,Ye.layers=function(t,e,n){return new Je(t,e,n)},Ye.zoom=function(t){return new $e(t)},Ye.scale=function(t){return new Qe(t)},Ye.attribution=function(t){return new tn(t)};var en=k.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});en.addTo=function(t,e){return t.addHandler(e,this),this};var nn,rn={Events:A},on=wt?"touchstart mousedown":"mousedown",an={mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},sn={mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"},ln=z.extend({options:{clickTolerance:3},initialize:function(t,e,n,i){f(this,i),this._element=t,this._dragStartTarget=e||t,this._preventOutline=n},enable:function(){this._enabled||(ke(this._dragStartTarget,on,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(ln._dragging===this&&this.finishDrag(),ze(this._dragStartTarget,on,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(!t._simulated&&this._enabled&&(this._moved=!1,!ce(this._element,"leaflet-zoom-anim")&&!(ln._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||(ln._dragging=this,this._preventOutline&&Ee(this._element),be(),Kt(),this._moving)))){this.fire("down");var e=t.touches?t.touches[0]:t,n=Se(this._element);this._startPoint=new M(e.clientX,e.clientY),this._parentScale=Pe(n),ke(document,sn[t.type],this._onMove,this),ke(document,an[t.type],this._onUp,this)}},_onMove:function(t){if(!t._simulated&&this._enabled)if(t.touches&&t.touches.length>1)this._moved=!0;else{var e=t.touches&&1===t.touches.length?t.touches[0]:t,n=new M(e.clientX,e.clientY)._subtract(this._startPoint);(n.x||n.y)&&(Math.abs(n.x)+Math.abs(n.y)<this.options.clickTolerance||(n.x/=this._parentScale.x,n.y/=this._parentScale.y,Re(t),this._moved||(this.fire("dragstart"),this._moved=!0,this._startPos=ve(this._element).subtract(n),pe(document.body,"leaflet-dragging"),this._lastTarget=t.target||t.srcElement,window.SVGElementInstance&&this._lastTarget instanceof SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),pe(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(n),this._moving=!0,P(this._animRequest),this._lastEvent=t,this._animRequest=S(this._updatePosition,this,!0)))}},_updatePosition:function(){var t={originalEvent:this._lastEvent};this.fire("predrag",t),ge(this._element,this._newPos),this.fire("drag",t)},_onUp:function(t){!t._simulated&&this._enabled&&this.finishDrag()},finishDrag:function(){for(var t in he(document.body,"leaflet-dragging"),this._lastTarget&&(he(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),sn)ze(document,sn[t],this._onMove,this),ze(document,an[t],this._onUp,this);we(),Yt(),this._moved&&this._moving&&(P(this._animRequest),this.fire("dragend",{distance:this._newPos.distanceTo(this._startPos)})),this._moving=!1,ln._dragging=!1}});function un(t,e){if(!e||!t.length)return t.slice();var n=e*e;return t=function(t,e){var n=t.length,i=new(typeof Uint8Array!=void 0+""?Uint8Array:Array)(n);i[0]=i[n-1]=1,function t(e,n,i,r,o){var a,s,l,u=0;for(s=r+1;s<=o-1;s++)(l=dn(e[s],e[r],e[o],!0))>u&&(a=s,u=l);u>i&&(n[a]=1,t(e,n,i,r,a),t(e,n,i,a,o))}(t,i,e,0,n-1);var r,o=[];for(r=0;r<n;r++)i[r]&&o.push(t[r]);return o}(t=function(t,e){for(var n=[t[0]],i=1,r=0,o=t.length;i<o;i++)a=t[i],s=t[r],l=void 0,u=void 0,l=s.x-a.x,u=s.y-a.y,l*l+u*u>e&&(n.push(t[i]),r=i);var a,s,l,u;return r<o-1&&n.push(t[o-1]),n}(t,n),n)}function cn(t,e,n){return Math.sqrt(dn(t,e,n,!0))}function pn(t,e,n,i,r){var o,a,s,l=i?nn:fn(t,n),u=fn(e,n);for(nn=u;;){if(!(l|u))return[t,e];if(l&u)return!1;a=hn(t,e,o=l||u,n,r),s=fn(a,n),o===l?(t=a,l=s):(e=a,u=s)}}function hn(t,e,n,i,r){var o,a,s=e.x-t.x,l=e.y-t.y,u=i.min,c=i.max;return 8&n?(o=t.x+s*(c.y-t.y)/l,a=c.y):4&n?(o=t.x+s*(u.y-t.y)/l,a=u.y):2&n?(o=c.x,a=t.y+l*(c.x-t.x)/s):1&n&&(o=u.x,a=t.y+l*(u.x-t.x)/s),new M(o,a,r)}function fn(t,e){var n=0;return t.x<e.min.x?n|=1:t.x>e.max.x&&(n|=2),t.y<e.min.y?n|=4:t.y>e.max.y&&(n|=8),n}function dn(t,e,n,i){var r,o=e.x,a=e.y,s=n.x-o,l=n.y-a,u=s*s+l*l;return u>0&&((r=((t.x-o)*s+(t.y-a)*l)/u)>1?(o=n.x,a=n.y):r>0&&(o+=s*r,a+=l*r)),s=t.x-o,l=t.y-a,i?s*s+l*l:new M(o,a)}function mn(t){return!_(t[0])||"object"!=typeof t[0][0]&&void 0!==t[0][0]}function yn(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),mn(t)}var _n=(Object.freeze||Object)({simplify:un,pointToSegmentDistance:cn,closestPointOnSegment:function(t,e,n){return dn(t,e,n)},clipSegment:pn,_getEdgeIntersection:hn,_getBitCode:fn,_sqClosestPointOnSegment:dn,isFlat:mn,_flat:yn});function gn(t,e,n){var i,r,o,a,s,l,u,c,p,h=[1,4,2,8];for(r=0,u=t.length;r<u;r++)t[r]._code=fn(t[r],e);for(a=0;a<4;a++){for(c=h[a],i=[],r=0,u=t.length,o=u-1;r<u;o=r++)s=t[r],l=t[o],s._code&c?l._code&c||((p=hn(l,s,c,e,n))._code=fn(p,e),i.push(p)):(l._code&c&&((p=hn(l,s,c,e,n))._code=fn(p,e),i.push(p)),i.push(s));t=i}return t}var vn=(Object.freeze||Object)({clipPolygon:gn}),xn={project:function(t){return new M(t.lng,t.lat)},unproject:function(t){return new N(t.y,t.x)},bounds:new D([-180,-90],[180,90])},bn={R:6378137,R_MINOR:6356752.314245179,bounds:new D([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(t){var e=Math.PI/180,n=this.R,i=t.lat*e,r=this.R_MINOR/n,o=Math.sqrt(1-r*r),a=o*Math.sin(i),s=Math.tan(Math.PI/4-i/2)/Math.pow((1-a)/(1+a),o/2);return i=-n*Math.log(Math.max(s,1e-10)),new M(t.lng*e*n,i)},unproject:function(t){for(var e,n=180/Math.PI,i=this.R,r=this.R_MINOR/i,o=Math.sqrt(1-r*r),a=Math.exp(-t.y/i),s=Math.PI/2-2*Math.atan(a),l=0,u=.1;l<15&&Math.abs(u)>1e-7;l++)e=o*Math.sin(s),e=Math.pow((1-e)/(1+e),o/2),u=Math.PI/2-2*Math.atan(a*e)-s,s+=u;return new N(s*n,t.x*n/i)}},wn=(Object.freeze||Object)({LonLat:xn,Mercator:bn,SphericalMercator:q}),En=n({},Z,{code:"EPSG:3395",projection:bn,transformation:function(){var t=.5/(Math.PI*bn.R);return W(t,.5,-t,.5)}()}),Tn=n({},Z,{code:"EPSG:4326",projection:xn,transformation:W(1/180,1,-1/180,.5)}),Sn=n({},V,{projection:xn,transformation:W(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,e){var n=e.lng-t.lng,i=e.lat-t.lat;return Math.sqrt(n*n+i*i)},infinite:!0});V.Earth=Z,V.EPSG3395=En,V.EPSG3857=H,V.EPSG900913=X,V.EPSG4326=Tn,V.Simple=Sn;var Pn=z.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[a(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[a(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var e=t.target;if(e.hasLayer(this)){if(this._map=e,this._zoomAnimated=e._zoomAnimated,this.getEvents){var n=this.getEvents();e.on(n,this),this.once("remove",function(){e.off(n,this)},this)}this.onAdd(e),this.getAttribution&&e.attributionControl&&e.attributionControl.addAttribution(this.getAttribution()),this.fire("add"),e.fire("layeradd",{layer:this})}}});Xe.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var e=a(t);return this._layers[e]?this:(this._layers[e]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t),this)},removeLayer:function(t){var e=a(t);return this._layers[e]?(this._loaded&&t.onRemove(this),t.getAttribution&&this.attributionControl&&this.attributionControl.removeAttribution(t.getAttribution()),delete this._layers[e],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return!!t&&a(t)in this._layers},eachLayer:function(t,e){for(var n in this._layers)t.call(e,this._layers[n]);return this},_addLayers:function(t){t=t?_(t)?t:[t]:[];for(var e=0,n=t.length;e<n;e++)this.addLayer(t[e])},_addZoomLimit:function(t){!isNaN(t.options.maxZoom)&&isNaN(t.options.minZoom)||(this._zoomBoundLayers[a(t)]=t,this._updateZoomLevels())},_removeZoomLimit:function(t){var e=a(t);this._zoomBoundLayers[e]&&(delete this._zoomBoundLayers[e],this._updateZoomLevels())},_updateZoomLevels:function(){var t=1/0,e=-1/0,n=this._getZoomSpan();for(var i in this._zoomBoundLayers){var r=this._zoomBoundLayers[i].options;t=void 0===r.minZoom?t:Math.min(t,r.minZoom),e=void 0===r.maxZoom?e:Math.max(e,r.maxZoom)}this._layersMaxZoom=e===-1/0?void 0:e,this._layersMinZoom=t===1/0?void 0:t,n!==this._getZoomSpan()&&this.fire("zoomlevelschange"),void 0===this.options.maxZoom&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Cn=Pn.extend({initialize:function(t,e){var n,i;if(f(this,e),this._layers={},t)for(n=0,i=t.length;n<i;n++)this.addLayer(t[n])},addLayer:function(t){var e=this.getLayerId(t);return this._layers[e]=t,this._map&&this._map.addLayer(t),this},removeLayer:function(t){var e=t in this._layers?t:this.getLayerId(t);return this._map&&this._layers[e]&&this._map.removeLayer(this._layers[e]),delete this._layers[e],this},hasLayer:function(t){return!!t&&(t in this._layers||this.getLayerId(t)in this._layers)},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(t){var e,n,i=Array.prototype.slice.call(arguments,1);for(e in this._layers)(n=this._layers[e])[t]&&n[t].apply(n,i);return this},onAdd:function(t){this.eachLayer(t.addLayer,t)},onRemove:function(t){this.eachLayer(t.removeLayer,t)},eachLayer:function(t,e){for(var n in this._layers)t.call(e,this._layers[n]);return this},getLayer:function(t){return this._layers[t]},getLayers:function(){var t=[];return this.eachLayer(t.push,t),t},setZIndex:function(t){return this.invoke("setZIndex",t)},getLayerId:function(t){return a(t)}}),kn=Cn.extend({addLayer:function(t){return this.hasLayer(t)?this:(t.addEventParent(this),Cn.prototype.addLayer.call(this,t),this.fire("layeradd",{layer:t}))},removeLayer:function(t){return this.hasLayer(t)?(t in this._layers&&(t=this._layers[t]),t.removeEventParent(this),Cn.prototype.removeLayer.call(this,t),this.fire("layerremove",{layer:t})):this},setStyle:function(t){return this.invoke("setStyle",t)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var t=new B;for(var e in this._layers){var n=this._layers[e];t.extend(n.getBounds?n.getBounds():n.getLatLng())}return t}}),An=k.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0]},initialize:function(t){f(this,t)},createIcon:function(t){return this._createIcon("icon",t)},createShadow:function(t){return this._createIcon("shadow",t)},_createIcon:function(t,e){var n=this._getIconUrl(t);if(!n){if("icon"===t)throw new Error("iconUrl not set in Icon options (see the docs).");return null}var i=this._createImg(n,e&&"IMG"===e.tagName?e:null);return this._setIconStyles(i,t),i},_setIconStyles:function(t,e){var n=this.options,i=n[e+"Size"];"number"==typeof i&&(i=[i,i]);var r=O(i),o=O("shadow"===e&&n.shadowAnchor||n.iconAnchor||r&&r.divideBy(2,!0));t.className="leaflet-marker-"+e+" "+(n.className||""),o&&(t.style.marginLeft=-o.x+"px",t.style.marginTop=-o.y+"px"),r&&(t.style.width=r.x+"px",t.style.height=r.y+"px")},_createImg:function(t,e){return(e=e||document.createElement("img")).src=t,e},_getIconUrl:function(t){return St&&this.options[t+"RetinaUrl"]||this.options[t+"Url"]}}),zn=An.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(t){return zn.imagePath||(zn.imagePath=this._detectIconPath()),(this.options.imagePath||zn.imagePath)+An.prototype._getIconUrl.call(this,t)},_detectIconPath:function(){var t=oe("div","leaflet-default-icon-path",document.body),e=re(t,"background-image")||re(t,"backgroundImage");return document.body.removeChild(t),e=null===e||0!==e.indexOf("url")?"":e.replace(/^url\(["']?/,"").replace(/marker-icon\.png["']?\)$/,"")}}),Ln=en.extend({initialize:function(t){this._marker=t},addHooks:function(){var t=this._marker._icon;this._draggable||(this._draggable=new ln(t,t,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),pe(t,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&he(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(t){var e=this._marker,n=e._map,i=this._marker.options.autoPanSpeed,r=this._marker.options.autoPanPadding,o=ve(e._icon),a=n.getPixelBounds(),s=n.getPixelOrigin(),l=R(a.min._subtract(s).add(r),a.max._subtract(s).subtract(r));if(!l.contains(o)){var u=O((Math.max(l.max.x,o.x)-l.max.x)/(a.max.x-l.max.x)-(Math.min(l.min.x,o.x)-l.min.x)/(a.min.x-l.min.x),(Math.max(l.max.y,o.y)-l.max.y)/(a.max.y-l.max.y)-(Math.min(l.min.y,o.y)-l.min.y)/(a.min.y-l.min.y)).multiplyBy(i);n.panBy(u,{animate:!1}),this._draggable._newPos._add(u),this._draggable._startPos._add(u),ge(e._icon,this._draggable._newPos),this._onDrag(t),this._panRequest=S(this._adjustPan.bind(this,t))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup().fire("movestart").fire("dragstart")},_onPreDrag:function(t){this._marker.options.autoPan&&(P(this._panRequest),this._panRequest=S(this._adjustPan.bind(this,t)))},_onDrag:function(t){var e=this._marker,n=e._shadow,i=ve(e._icon),r=e._map.layerPointToLatLng(i);n&&ge(n,i),e._latlng=r,t.latlng=r,t.oldLatLng=this._oldLatLng,e.fire("move",t).fire("drag",t)},_onDragEnd:function(t){P(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",t)}}),Mn=Pn.extend({options:{icon:new zn,interactive:!0,keyboard:!0,title:"",alt:"",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",bubblingMouseEvents:!1,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(t,e){f(this,e),this._latlng=U(t)},onAdd:function(t){this._zoomAnimated=this._zoomAnimated&&t.options.markerZoomAnimation,this._zoomAnimated&&t.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(t){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&t.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(t){var e=this._latlng;return this._latlng=U(t),this.update(),this.fire("move",{oldLatLng:e,latlng:this._latlng})},setZIndexOffset:function(t){return this.options.zIndexOffset=t,this.update()},setIcon:function(t){return this.options.icon=t,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var t=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(t)}return this},_initIcon:function(){var t=this.options,e="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),n=t.icon.createIcon(this._icon),i=!1;n!==this._icon&&(this._icon&&this._removeIcon(),i=!0,t.title&&(n.title=t.title),"IMG"===n.tagName&&(n.alt=t.alt||"")),pe(n,e),t.keyboard&&(n.tabIndex="0"),this._icon=n,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex});var r=t.icon.createShadow(this._shadow),o=!1;r!==this._shadow&&(this._removeShadow(),o=!0),r&&(pe(r,e),r.alt=""),this._shadow=r,t.opacity<1&&this._updateOpacity(),i&&this.getPane().appendChild(this._icon),this._initInteraction(),r&&o&&this.getPane("shadowPane").appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),ae(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&ae(this._shadow),this._shadow=null},_setPos:function(t){ge(this._icon,t),this._shadow&&ge(this._shadow,t),this._zIndex=t.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(t){this._icon.style.zIndex=this._zIndex+t},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center).round();this._setPos(e)},_initInteraction:function(){if(this.options.interactive&&(pe(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),Ln)){var t=this.options.draggable;this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Ln(this),t&&this.dragging.enable()}},setOpacity:function(t){return this.options.opacity=t,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var t=this.options.opacity;me(this._icon,t),this._shadow&&me(this._shadow,t)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}}),In=Pn.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(t){this._renderer=t.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(t){return f(this,t),this._renderer&&this._renderer._updateStyle(this),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+this._renderer.options.tolerance}}),On=In.extend({options:{fill:!0,radius:10},initialize:function(t,e){f(this,e),this._latlng=U(t),this._radius=this.options.radius},setLatLng:function(t){return this._latlng=U(t),this.redraw(),this.fire("move",{latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(t){return this.options.radius=this._radius=t,this.redraw()},getRadius:function(){return this._radius},setStyle:function(t){var e=t&&t.radius||this._radius;return In.prototype.setStyle.call(this,t),this.setRadius(e),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var t=this._radius,e=this._radiusY||t,n=this._clickTolerance(),i=[t+n,e+n];this._pxBounds=new D(this._point.subtract(i),this._point.add(i))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(t){return t.distanceTo(this._point)<=this._radius+this._clickTolerance()}}),Dn=On.extend({initialize:function(t,e,i){if("number"==typeof e&&(e=n({},i,{radius:e})),f(this,e),this._latlng=U(t),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(t){return this._mRadius=t,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var t=[this._radius,this._radiusY||this._radius];return new B(this._map.layerPointToLatLng(this._point.subtract(t)),this._map.layerPointToLatLng(this._point.add(t)))},setStyle:In.prototype.setStyle,_project:function(){var t=this._latlng.lng,e=this._latlng.lat,n=this._map,i=n.options.crs;if(i.distance===Z.distance){var r=Math.PI/180,o=this._mRadius/Z.R/r,a=n.project([e+o,t]),s=n.project([e-o,t]),l=a.add(s).divideBy(2),u=n.unproject(l).lat,c=Math.acos((Math.cos(o*r)-Math.sin(e*r)*Math.sin(u*r))/(Math.cos(e*r)*Math.cos(u*r)))/r;(isNaN(c)||0===c)&&(c=o/Math.cos(Math.PI/180*e)),this._point=l.subtract(n.getPixelOrigin()),this._radius=isNaN(c)?0:l.x-n.project([u,t-c]).x,this._radiusY=l.y-a.y}else{var p=i.unproject(i.project(this._latlng).subtract([this._mRadius,0]));this._point=n.latLngToLayerPoint(this._latlng),this._radius=this._point.x-n.latLngToLayerPoint(p).x}this._updateBounds()}}),Rn=In.extend({options:{smoothFactor:1,noClip:!1},initialize:function(t,e){f(this,e),this._setLatLngs(t)},getLatLngs:function(){return this._latlngs},setLatLngs:function(t){return this._setLatLngs(t),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(t){for(var e,n,i=1/0,r=null,o=dn,a=0,s=this._parts.length;a<s;a++)for(var l=this._parts[a],u=1,c=l.length;u<c;u++){e=l[u-1],n=l[u];var p=o(t,e,n,!0);p<i&&(i=p,r=o(t,e,n))}return r&&(r.distance=Math.sqrt(i)),r},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,e,n,i,r,o,a,s=this._rings[0],l=s.length;if(!l)return null;for(t=0,e=0;t<l-1;t++)e+=s[t].distanceTo(s[t+1])/2;if(0===e)return this._map.layerPointToLatLng(s[0]);for(t=0,i=0;t<l-1;t++)if(r=s[t],o=s[t+1],n=r.distanceTo(o),(i+=n)>e)return a=(i-e)/n,this._map.layerPointToLatLng([o.x-a*(o.x-r.x),o.y-a*(o.y-r.y)])},getBounds:function(){return this._bounds},addLatLng:function(t,e){return e=e||this._defaultShape(),t=U(t),e.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new B,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return mn(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var e=[],n=mn(t),i=0,r=t.length;i<r;i++)n?(e[i]=U(t[i]),this._bounds.extend(e[i])):e[i]=this._convertLatLngs(t[i]);return e},_project:function(){var t=new D;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,t);var e=this._clickTolerance(),n=new M(e,e);this._bounds.isValid()&&t.isValid()&&(t.min._subtract(n),t.max._add(n),this._pxBounds=t)},_projectLatlngs:function(t,e,n){var i,r,o=t[0]instanceof N,a=t.length;if(o){for(r=[],i=0;i<a;i++)r[i]=this._map.latLngToLayerPoint(t[i]),n.extend(r[i]);e.push(r)}else for(i=0;i<a;i++)this._projectLatlngs(t[i],e,n)},_clipPoints:function(){var t=this._renderer._bounds;if(this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else{var e,n,i,r,o,a,s,l=this._parts;for(e=0,i=0,r=this._rings.length;e<r;e++)for(s=this._rings[e],n=0,o=s.length;n<o-1;n++)(a=pn(s[n],s[n+1],t,n,!0))&&(l[i]=l[i]||[],l[i].push(a[0]),a[1]===s[n+1]&&n!==o-2||(l[i].push(a[1]),i++))}},_simplifyPoints:function(){for(var t=this._parts,e=this.options.smoothFactor,n=0,i=t.length;n<i;n++)t[n]=un(t[n],e)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(t,e){var n,i,r,o,a,s,l=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(n=0,o=this._parts.length;n<o;n++)for(s=this._parts[n],i=0,a=s.length,r=a-1;i<a;r=i++)if((e||0!==i)&&cn(t,s[r],s[i])<=l)return!0;return!1}});Rn._flat=yn;var Bn=Rn.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,e,n,i,r,o,a,s,l,u=this._rings[0],c=u.length;if(!c)return null;for(o=a=s=0,t=0,e=c-1;t<c;e=t++)n=u[t],i=u[e],r=n.y*i.x-i.y*n.x,a+=(n.x+i.x)*r,s+=(n.y+i.y)*r,o+=3*r;return l=0===o?u[0]:[a/o,s/o],this._map.layerPointToLatLng(l)},_convertLatLngs:function(t){var e=Rn.prototype._convertLatLngs.call(this,t),n=e.length;return n>=2&&e[0]instanceof N&&e[0].equals(e[n-1])&&e.pop(),e},_setLatLngs:function(t){Rn.prototype._setLatLngs.call(this,t),mn(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return mn(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,e=this.options.weight,n=new M(e,e);if(t=new D(t.min.subtract(n),t.max.add(n)),this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else for(var i,r=0,o=this._rings.length;r<o;r++)(i=gn(this._rings[r],t,!0)).length&&this._parts.push(i)},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(t){var e,n,i,r,o,a,s,l,u=!1;if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(r=0,s=this._parts.length;r<s;r++)for(e=this._parts[r],o=0,l=e.length,a=l-1;o<l;a=o++)n=e[o],i=e[a],n.y>t.y!=i.y>t.y&&t.x<(i.x-n.x)*(t.y-n.y)/(i.y-n.y)+n.x&&(u=!u);return u||Rn.prototype._containsPoint.call(this,t,!0)}}),Fn=kn.extend({initialize:function(t,e){f(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e,n,i,r=_(t)?t:t.features;if(r){for(e=0,n=r.length;e<n;e++)((i=r[e]).geometries||i.geometry||i.features||i.coordinates)&&this.addData(i);return this}var o=this.options;if(o.filter&&!o.filter(t))return this;var a=Nn(t,o);return a?(a.feature=Gn(t),a.defaultOptions=a.options,this.resetStyle(a),o.onEachFeature&&o.onEachFeature(t,a),this.addLayer(a)):this},resetStyle:function(t){return t.options=n({},t.defaultOptions),this._setLayerStyle(t,this.options.style),this},setStyle:function(t){return this.eachLayer(function(e){this._setLayerStyle(e,t)},this)},_setLayerStyle:function(t,e){"function"==typeof e&&(e=e(t.feature)),t.setStyle&&t.setStyle(e)}});function Nn(t,e){var n,i,r,o,a="Feature"===t.type?t.geometry:t,s=a?a.coordinates:null,l=[],u=e&&e.pointToLayer,c=e&&e.coordsToLatLng||Un;if(!s&&!a)return null;switch(a.type){case"Point":return n=c(s),u?u(t,n):new Mn(n);case"MultiPoint":for(r=0,o=s.length;r<o;r++)n=c(s[r]),l.push(u?u(t,n):new Mn(n));return new kn(l);case"LineString":case"MultiLineString":return i=jn(s,"LineString"===a.type?0:1,c),new Rn(i,e);case"Polygon":case"MultiPolygon":return i=jn(s,"Polygon"===a.type?1:2,c),new Bn(i,e);case"GeometryCollection":for(r=0,o=a.geometries.length;r<o;r++){var p=Nn({geometry:a.geometries[r],type:"Feature",properties:t.properties},e);p&&l.push(p)}return new kn(l);default:throw new Error("Invalid GeoJSON object.")}}function Un(t){return new N(t[1],t[0],t[2])}function jn(t,e,n){for(var i,r=[],o=0,a=t.length;o<a;o++)i=e?jn(t[o],e-1,n):(n||Un)(t[o]),r.push(i);return r}function Vn(t,e){return e="number"==typeof e?e:6,void 0!==t.alt?[c(t.lng,e),c(t.lat,e),c(t.alt,e)]:[c(t.lng,e),c(t.lat,e)]}function Zn(t,e,n,i){for(var r=[],o=0,a=t.length;o<a;o++)r.push(e?Zn(t[o],e-1,n,i):Vn(t[o],i));return!e&&n&&r.push(r[0]),r}function qn(t,e){return t.feature?n({},t.feature,{geometry:e}):Gn(e)}function Gn(t){return"Feature"===t.type||"FeatureCollection"===t.type?t:{type:"Feature",properties:{},geometry:t}}var Wn={toGeoJSON:function(t){return qn(this,{type:"Point",coordinates:Vn(this.getLatLng(),t)})}};function Hn(t,e){return new Fn(t,e)}Mn.include(Wn),Dn.include(Wn),On.include(Wn),Rn.include({toGeoJSON:function(t){var e=!mn(this._latlngs),n=Zn(this._latlngs,e?1:0,!1,t);return qn(this,{type:(e?"Multi":"")+"LineString",coordinates:n})}}),Bn.include({toGeoJSON:function(t){var e=!mn(this._latlngs),n=e&&!mn(this._latlngs[0]),i=Zn(this._latlngs,n?2:e?1:0,!0,t);return e||(i=[i]),qn(this,{type:(n?"Multi":"")+"Polygon",coordinates:i})}}),Cn.include({toMultiPoint:function(t){var e=[];return this.eachLayer(function(n){e.push(n.toGeoJSON(t).geometry.coordinates)}),qn(this,{type:"MultiPoint",coordinates:e})},toGeoJSON:function(t){var e=this.feature&&this.feature.geometry&&this.feature.geometry.type;if("MultiPoint"===e)return this.toMultiPoint(t);var n="GeometryCollection"===e,i=[];return this.eachLayer(function(e){if(e.toGeoJSON){var r=e.toGeoJSON(t);if(n)i.push(r.geometry);else{var o=Gn(r);"FeatureCollection"===o.type?i.push.apply(i,o.features):i.push(o)}}}),n?qn(this,{geometries:i,type:"GeometryCollection"}):{type:"FeatureCollection",features:i}}});var Xn=Hn,Kn=Pn.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,e,n){this._url=t,this._bounds=F(e),f(this,n)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(pe(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){ae(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&le(this._image),this},bringToBack:function(){return this._map&&ue(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=F(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t="IMG"===this._url.tagName,e=this._image=t?this._url:oe("img");pe(e,"leaflet-image-layer"),this._zoomAnimated&&pe(e,"leaflet-zoom-animated"),this.options.className&&pe(e,this.options.className),e.onselectstart=u,e.onmousemove=u,e.onload=r(this.fire,this,"load"),e.onerror=r(this._overlayOnError,this,"error"),(this.options.crossOrigin||""===this.options.crossOrigin)&&(e.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t?this._url=e.src:(e.src=this._url,e.alt=this.options.alt)},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),n=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;_e(this._image,n,e)},_reset:function(){var t=this._image,e=new D(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),n=e.getSize();ge(t,e.min),t.style.width=n.x+"px",t.style.height=n.y+"px"},_updateOpacity:function(){me(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)}}),Yn=Kn.extend({options:{autoplay:!0,loop:!0},_initImage:function(){var t="VIDEO"===this._url.tagName,e=this._image=t?this._url:oe("video");if(pe(e,"leaflet-image-layer"),this._zoomAnimated&&pe(e,"leaflet-zoom-animated"),e.onselectstart=u,e.onmousemove=u,e.onloadeddata=r(this.fire,this,"load"),t){for(var n=e.getElementsByTagName("source"),i=[],o=0;o<n.length;o++)i.push(n[o].src);this._url=n.length>0?i:[e.src]}else{_(this._url)||(this._url=[this._url]),e.autoplay=!!this.options.autoplay,e.loop=!!this.options.loop;for(var a=0;a<this._url.length;a++){var s=oe("source");s.src=this._url[a],e.appendChild(s)}}}}),Jn=Pn.extend({options:{offset:[0,7],className:"",pane:"popupPane"},initialize:function(t,e){f(this,t),this._source=e},onAdd:function(t){this._zoomAnimated=t._zoomAnimated,this._container||this._initLayout(),t._fadeAnimated&&me(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),t._fadeAnimated&&me(this._container,1),this.bringToFront()},onRemove:function(t){t._fadeAnimated?(me(this._container,0),this._removeTimeout=setTimeout(r(ae,void 0,this._container),200)):ae(this._container)},getLatLng:function(){return this._latlng},setLatLng:function(t){return this._latlng=U(t),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(t){return this._content=t,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var t={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&le(this._container),this},bringToBack:function(){return this._map&&ue(this._container),this},_updateContent:function(){if(this._content){var t=this._contentNode,e="function"==typeof this._content?this._content(this._source||this):this._content;if("string"==typeof e)t.innerHTML=e;else{for(;t.hasChildNodes();)t.removeChild(t.firstChild);t.appendChild(e)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var t=this._map.latLngToLayerPoint(this._latlng),e=O(this.options.offset),n=this._getAnchor();this._zoomAnimated?ge(this._container,t.add(n)):e=e.add(t).add(n);var i=this._containerBottom=-e.y,r=this._containerLeft=-Math.round(this._containerWidth/2)+e.x;this._container.style.bottom=i+"px",this._container.style.left=r+"px"}},_getAnchor:function(){return[0,0]}}),$n=Jn.extend({options:{maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(t){return t.openPopup(this),this},onAdd:function(t){Jn.prototype.onAdd.call(this,t),t.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof In||this._source.on("preclick",Ie))},onRemove:function(t){Jn.prototype.onRemove.call(this,t),t.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof In||this._source.off("preclick",Ie))},getEvents:function(){var t=Jn.prototype.getEvents.call(this);return(void 0!==this.options.closeOnClick?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(t.preclick=this._close),this.options.keepInView&&(t.moveend=this._adjustPan),t},_close:function(){this._map&&this._map.closePopup(this)},_initLayout:function(){var t="leaflet-popup",e=this._container=oe("div",t+" "+(this.options.className||"")+" leaflet-zoom-animated"),n=this._wrapper=oe("div",t+"-content-wrapper",e);if(this._contentNode=oe("div",t+"-content",n),De(n),Oe(this._contentNode),ke(n,"contextmenu",Ie),this._tipContainer=oe("div",t+"-tip-container",e),this._tip=oe("div",t+"-tip",this._tipContainer),this.options.closeButton){var i=this._closeButton=oe("a",t+"-close-button",e);i.href="#close",i.innerHTML="×",ke(i,"click",this._onCloseButtonClick,this)}},_updateLayout:function(){var t=this._contentNode,e=t.style;e.width="",e.whiteSpace="nowrap";var n=t.offsetWidth;n=Math.min(n,this.options.maxWidth),n=Math.max(n,this.options.minWidth),e.width=n+1+"px",e.whiteSpace="",e.height="";var i=t.offsetHeight,r=this.options.maxHeight;r&&i>r?(e.height=r+"px",pe(t,"leaflet-popup-scrolled")):he(t,"leaflet-popup-scrolled"),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),n=this._getAnchor();ge(this._container,e.add(n))},_adjustPan:function(){if(this.options.autoPan){this._map._panAnim&&this._map._panAnim.stop();var t=this._map,e=parseInt(re(this._container,"marginBottom"),10)||0,n=this._container.offsetHeight+e,i=this._containerWidth,r=new M(this._containerLeft,-n-this._containerBottom);r._add(ve(this._container));var o=t.layerPointToContainerPoint(r),a=O(this.options.autoPanPadding),s=O(this.options.autoPanPaddingTopLeft||a),l=O(this.options.autoPanPaddingBottomRight||a),u=t.getSize(),c=0,p=0;o.x+i+l.x>u.x&&(c=o.x+i-u.x+l.x),o.x-c-s.x<0&&(c=o.x-s.x),o.y+n+l.y>u.y&&(p=o.y+n-u.y+l.y),o.y-p-s.y<0&&(p=o.y-s.y),(c||p)&&t.fire("autopanstart").panBy([c,p])}},_onCloseButtonClick:function(t){this._close(),Be(t)},_getAnchor:function(){return O(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}});Xe.mergeOptions({closePopupOnClick:!0}),Xe.include({openPopup:function(t,e,n){return t instanceof $n||(t=new $n(n).setContent(t)),e&&t.setLatLng(e),this.hasLayer(t)?this:(this._popup&&this._popup.options.autoClose&&this.closePopup(),this._popup=t,this.addLayer(t))},closePopup:function(t){return t&&t!==this._popup||(t=this._popup,this._popup=null),t&&this.removeLayer(t),this}}),Pn.include({bindPopup:function(t,e){return t instanceof $n?(f(t,e),this._popup=t,t._source=this):(this._popup&&!e||(this._popup=new $n(e,this)),this._popup.setContent(t)),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t,e){if(t instanceof Pn||(e=t,t=this),t instanceof kn)for(var n in this._layers){t=this._layers[n];break}return e||(e=t.getCenter?t.getCenter():t.getLatLng()),this._popup&&this._map&&(this._popup._source=t,this._popup.update(),this._map.openPopup(this._popup,e)),this},closePopup:function(){return this._popup&&this._popup._close(),this},togglePopup:function(t){return this._popup&&(this._popup._map?this.closePopup():this.openPopup(t)),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var e=t.layer||t.target;this._popup&&this._map&&(Be(t),e instanceof In?this.openPopup(t.layer||t.target,t.latlng):this._map.hasLayer(this._popup)&&this._popup._source===e?this.closePopup():this.openPopup(e,t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var Qn=Jn.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,interactive:!1,opacity:.9},onAdd:function(t){Jn.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&this._source.fire("tooltipopen",{tooltip:this},!0)},onRemove:function(t){Jn.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&this._source.fire("tooltipclose",{tooltip:this},!0)},getEvents:function(){var t=Jn.prototype.getEvents.call(this);return wt&&!this.options.permanent&&(t.preclick=this._close),t},_close:function(){this._map&&this._map.closeTooltip(this)},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=oe("div",t)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e=this._map,n=this._container,i=e.latLngToContainerPoint(e.getCenter()),r=e.layerPointToContainerPoint(t),o=this.options.direction,a=n.offsetWidth,s=n.offsetHeight,l=O(this.options.offset),u=this._getAnchor();"top"===o?t=t.add(O(-a/2+l.x,-s+l.y+u.y,!0)):"bottom"===o?t=t.subtract(O(a/2-l.x,-l.y,!0)):"center"===o?t=t.subtract(O(a/2+l.x,s/2-u.y+l.y,!0)):"right"===o||"auto"===o&&r.x<i.x?(o="right",t=t.add(O(l.x+u.x,u.y-s/2+l.y,!0))):(o="left",t=t.subtract(O(a+u.x-l.x,s/2-u.y-l.y,!0))),he(n,"leaflet-tooltip-right"),he(n,"leaflet-tooltip-left"),he(n,"leaflet-tooltip-top"),he(n,"leaflet-tooltip-bottom"),pe(n,"leaflet-tooltip-"+o),ge(n,t)},_updatePosition:function(){var t=this._map.latLngToLayerPoint(this._latlng);this._setPosition(t)},setOpacity:function(t){this.options.opacity=t,this._container&&me(this._container,t)},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center);this._setPosition(e)},_getAnchor:function(){return O(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}});Xe.include({openTooltip:function(t,e,n){return t instanceof Qn||(t=new Qn(n).setContent(t)),e&&t.setLatLng(e),this.hasLayer(t)?this:this.addLayer(t)},closeTooltip:function(t){return t&&this.removeLayer(t),this}}),Pn.include({bindTooltip:function(t,e){return t instanceof Qn?(f(t,e),this._tooltip=t,t._source=this):(this._tooltip&&!e||(this._tooltip=new Qn(e,this)),this._tooltip.setContent(t)),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(t){if(t||!this._tooltipHandlersAdded){var e=t?"off":"on",n={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?n.add=this._openTooltip:(n.mouseover=this._openTooltip,n.mouseout=this.closeTooltip,this._tooltip.options.sticky&&(n.mousemove=this._moveTooltip),wt&&(n.click=this._openTooltip)),this[e](n),this._tooltipHandlersAdded=!t}},openTooltip:function(t,e){if(t instanceof Pn||(e=t,t=this),t instanceof kn)for(var n in this._layers){t=this._layers[n];break}return e||(e=t.getCenter?t.getCenter():t.getLatLng()),this._tooltip&&this._map&&(this._tooltip._source=t,this._tooltip.update(),this._map.openTooltip(this._tooltip,e),this._tooltip.options.interactive&&this._tooltip._container&&(pe(this._tooltip._container,"leaflet-clickable"),this.addInteractiveTarget(this._tooltip._container))),this},closeTooltip:function(){return this._tooltip&&(this._tooltip._close(),this._tooltip.options.interactive&&this._tooltip._container&&(he(this._tooltip._container,"leaflet-clickable"),this.removeInteractiveTarget(this._tooltip._container))),this},toggleTooltip:function(t){return this._tooltip&&(this._tooltip._map?this.closeTooltip():this.openTooltip(t)),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(t){return this._tooltip&&this._tooltip.setContent(t),this},getTooltip:function(){return this._tooltip},_openTooltip:function(t){var e=t.layer||t.target;this._tooltip&&this._map&&this.openTooltip(e,this._tooltip.options.sticky?t.latlng:void 0)},_moveTooltip:function(t){var e,n,i=t.latlng;this._tooltip.options.sticky&&t.originalEvent&&(e=this._map.mouseEventToContainerPoint(t.originalEvent),n=this._map.containerPointToLayerPoint(e),i=this._map.layerPointToLatLng(n)),this._tooltip.setLatLng(i)}});var ti=An.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(t){var e=t&&"DIV"===t.tagName?t:document.createElement("div"),n=this.options;if(e.innerHTML=!1!==n.html?n.html:"",n.bgPos){var i=O(n.bgPos);e.style.backgroundPosition=-i.x+"px "+-i.y+"px"}return this._setIconStyles(e,"icon"),e},createShadow:function(){return null}});An.Default=zn;var ei=Pn.extend({options:{tileSize:256,opacity:1,updateWhenIdle:_t,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(t){f(this,t)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView(),this._update()},beforeAdd:function(t){t._addZoomLimit(this)},onRemove:function(t){this._removeAllTiles(),ae(this._container),t._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(le(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(ue(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(t){return this.options.opacity=t,this._updateOpacity(),this},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){return this._map&&(this._removeAllTiles(),this._update()),this},getEvents:function(){var t={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=s(this._onMoveEnd,this.options.updateInterval,this)),t.move=this._onMove),this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},createTile:function(){return document.createElement("div")},getTileSize:function(){var t=this.options.tileSize;return t instanceof M?t:new M(t,t)},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t){for(var e,n=this.getPane().children,i=-t(-1/0,1/0),r=0,o=n.length;r<o;r++)e=n[r].style.zIndex,n[r]!==this._container&&e&&(i=t(i,+e));isFinite(i)&&(this.options.zIndex=i+t(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!Q){me(this._container,this.options.opacity);var t=+new Date,e=!1,n=!1;for(var i in this._tiles){var r=this._tiles[i];if(r.current&&r.loaded){var o=Math.min(1,(t-r.loaded)/200);me(r.el,o),o<1?e=!0:(r.active?n=!0:this._onOpaqueTile(r),r.active=!0)}}n&&!this._noPrune&&this._pruneTiles(),e&&(P(this._fadeFrame),this._fadeFrame=S(this._updateOpacity,this))}},_onOpaqueTile:u,_initContainer:function(){this._container||(this._container=oe("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var t=this._tileZoom,e=this.options.maxZoom;if(void 0!==t){for(var n in this._levels)this._levels[n].el.children.length||n===t?(this._levels[n].el.style.zIndex=e-Math.abs(t-n),this._onUpdateLevel(n)):(ae(this._levels[n].el),this._removeTilesAtZoom(n),this._onRemoveLevel(n),delete this._levels[n]);var i=this._levels[t],r=this._map;return i||((i=this._levels[t]={}).el=oe("div","leaflet-tile-container leaflet-zoom-animated",this._container),i.el.style.zIndex=e,i.origin=r.project(r.unproject(r.getPixelOrigin()),t).round(),i.zoom=t,this._setZoomTransform(i,r.getCenter(),r.getZoom()),i.el.offsetWidth,this._onCreateLevel(i)),this._level=i,i}},_onUpdateLevel:u,_onRemoveLevel:u,_onCreateLevel:u,_pruneTiles:function(){if(this._map){var t,e,n=this._map.getZoom();if(n>this.options.maxZoom||n<this.options.minZoom)this._removeAllTiles();else{for(t in this._tiles)(e=this._tiles[t]).retain=e.current;for(t in this._tiles)if((e=this._tiles[t]).current&&!e.active){var i=e.coords;this._retainParent(i.x,i.y,i.z,i.z-5)||this._retainChildren(i.x,i.y,i.z,i.z+2)}for(t in this._tiles)this._tiles[t].retain||this._removeTile(t)}}},_removeTilesAtZoom:function(t){for(var e in this._tiles)this._tiles[e].coords.z===t&&this._removeTile(e)},_removeAllTiles:function(){for(var t in this._tiles)this._removeTile(t)},_invalidateAll:function(){for(var t in this._levels)ae(this._levels[t].el),this._onRemoveLevel(t),delete this._levels[t];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(t,e,n,i){var r=Math.floor(t/2),o=Math.floor(e/2),a=n-1,s=new M(+r,+o);s.z=+a;var l=this._tileCoordsToKey(s),u=this._tiles[l];return u&&u.active?(u.retain=!0,!0):(u&&u.loaded&&(u.retain=!0),a>i&&this._retainParent(r,o,a,i))},_retainChildren:function(t,e,n,i){for(var r=2*t;r<2*t+2;r++)for(var o=2*e;o<2*e+2;o++){var a=new M(r,o);a.z=n+1;var s=this._tileCoordsToKey(a),l=this._tiles[s];l&&l.active?l.retain=!0:(l&&l.loaded&&(l.retain=!0),n+1<i&&this._retainChildren(r,o,n+1,i))}},_resetView:function(t){var e=t&&(t.pinch||t.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),e,e)},_animateZoom:function(t){this._setView(t.center,t.zoom,!0,t.noUpdate)},_clampZoom:function(t){var e=this.options;return void 0!==e.minNativeZoom&&t<e.minNativeZoom?e.minNativeZoom:void 0!==e.maxNativeZoom&&e.maxNativeZoom<t?e.maxNativeZoom:t},_setView:function(t,e,n,i){var r=this._clampZoom(Math.round(e));(void 0!==this.options.maxZoom&&r>this.options.maxZoom||void 0!==this.options.minZoom&&r<this.options.minZoom)&&(r=void 0);var o=this.options.updateWhenZooming&&r!==this._tileZoom;i&&!o||(this._tileZoom=r,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),void 0!==r&&this._update(t),n||this._pruneTiles(),this._noPrune=!!n),this._setZoomTransforms(t,e)},_setZoomTransforms:function(t,e){for(var n in this._levels)this._setZoomTransform(this._levels[n],t,e)},_setZoomTransform:function(t,e,n){var i=this._map.getZoomScale(n,t.zoom),r=t.origin.multiplyBy(i).subtract(this._map._getNewPixelOrigin(e,n)).round();yt?_e(t.el,r,i):ge(t.el,r)},_resetGrid:function(){var t=this._map,e=t.options.crs,n=this._tileSize=this.getTileSize(),i=this._tileZoom,r=this._map.getPixelWorldBounds(this._tileZoom);r&&(this._globalTileRange=this._pxBoundsToTileRange(r)),this._wrapX=e.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,e.wrapLng[0]],i).x/n.x),Math.ceil(t.project([0,e.wrapLng[1]],i).x/n.y)],this._wrapY=e.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([e.wrapLat[0],0],i).y/n.x),Math.ceil(t.project([e.wrapLat[1],0],i).y/n.y)]},_onMoveEnd:function(){this._map&&!this._map._animatingZoom&&this._update()},_getTiledPixelBounds:function(t){var e=this._map,n=e._animatingZoom?Math.max(e._animateToZoom,e.getZoom()):e.getZoom(),i=e.getZoomScale(n,this._tileZoom),r=e.project(t,this._tileZoom).floor(),o=e.getSize().divideBy(2*i);return new D(r.subtract(o),r.add(o))},_update:function(t){var e=this._map;if(e){var n=this._clampZoom(e.getZoom());if(void 0===t&&(t=e.getCenter()),void 0!==this._tileZoom){var i=this._getTiledPixelBounds(t),r=this._pxBoundsToTileRange(i),o=r.getCenter(),a=[],s=this.options.keepBuffer,l=new D(r.getBottomLeft().subtract([s,-s]),r.getTopRight().add([s,-s]));if(!(isFinite(r.min.x)&&isFinite(r.min.y)&&isFinite(r.max.x)&&isFinite(r.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var u in this._tiles){var c=this._tiles[u].coords;c.z===this._tileZoom&&l.contains(new M(c.x,c.y))||(this._tiles[u].current=!1)}if(Math.abs(n-this._tileZoom)>1)this._setView(t,n);else{for(var p=r.min.y;p<=r.max.y;p++)for(var h=r.min.x;h<=r.max.x;h++){var f=new M(h,p);if(f.z=this._tileZoom,this._isValidTile(f)){var d=this._tiles[this._tileCoordsToKey(f)];d?d.current=!0:a.push(f)}}if(a.sort(function(t,e){return t.distanceTo(o)-e.distanceTo(o)}),0!==a.length){this._loading||(this._loading=!0,this.fire("loading"));var m=document.createDocumentFragment();for(h=0;h<a.length;h++)this._addTile(a[h],m);this._level.el.appendChild(m)}}}}},_isValidTile:function(t){var e=this._map.options.crs;if(!e.infinite){var n=this._globalTileRange;if(!e.wrapLng&&(t.x<n.min.x||t.x>n.max.x)||!e.wrapLat&&(t.y<n.min.y||t.y>n.max.y))return!1}if(!this.options.bounds)return!0;var i=this._tileCoordsToBounds(t);return F(this.options.bounds).overlaps(i)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,n=this.getTileSize(),i=t.scaleBy(n),r=i.add(n),o=e.unproject(i,t.z),a=e.unproject(r,t.z);return[o,a]},_tileCoordsToBounds:function(t){var e=this._tileCoordsToNwSe(t),n=new B(e[0],e[1]);return this.options.noWrap||(n=this._map.wrapLatLngBounds(n)),n},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=t.split(":"),n=new M(+e[0],+e[1]);return n.z=+e[2],n},_removeTile:function(t){var e=this._tiles[t];e&&(ae(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){pe(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=u,t.onmousemove=u,Q&&this.options.opacity<1&&me(t,this.options.opacity),nt&&!it&&(t.style.WebkitBackfaceVisibility="hidden")},_addTile:function(t,e){var n=this._getTilePos(t),i=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),r(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&S(r(this._tileReady,this,t,null,o)),ge(o,n),this._tiles[i]={el:o,coords:t,current:!0},e.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,e,n){e&&this.fire("tileerror",{error:e,tile:n,coords:t});var i=this._tileCoordsToKey(t);(n=this._tiles[i])&&(n.loaded=+new Date,this._map._fadeAnimated?(me(n.el,0),P(this._fadeFrame),this._fadeFrame=S(this._updateOpacity,this)):(n.active=!0,this._pruneTiles()),e||(pe(n.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:n.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),Q||!this._map._fadeAnimated?S(this._pruneTiles,this):setTimeout(r(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new M(this._wrapX?l(t.x,this._wrapX):t.x,this._wrapY?l(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new D(t.min.unscaleBy(e).floor(),t.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}}),ni=ei.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1},initialize:function(t,e){this._url=t,(e=f(this,e)).detectRetina&&St&&e.maxZoom>0&&(e.tileSize=Math.floor(e.tileSize/2),e.zoomReverse?(e.zoomOffset--,e.minZoom++):(e.zoomOffset++,e.maxZoom--),e.minZoom=Math.max(0,e.minZoom)),"string"==typeof e.subdomains&&(e.subdomains=e.subdomains.split("")),nt||this.on("tileunload",this._onTileRemove)},setUrl:function(t,e){return this._url===t&&void 0===e&&(e=!0),this._url=t,e||this.redraw(),this},createTile:function(t,e){var n=document.createElement("img");return ke(n,"load",r(this._tileOnLoad,this,e,n)),ke(n,"error",r(this._tileOnError,this,e,n)),(this.options.crossOrigin||""===this.options.crossOrigin)&&(n.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),n.alt="",n.setAttribute("role","presentation"),n.src=this.getTileUrl(t),n},getTileUrl:function(t){var e={r:St?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var i=this._globalTileRange.max.y-t.y;this.options.tms&&(e.y=i),e["-y"]=i}return y(this._url,n(e,this.options))},_tileOnLoad:function(t,e){Q?setTimeout(r(t,this,null,e),0):t(null,e)},_tileOnError:function(t,e,n){var i=this.options.errorTileUrl;i&&e.getAttribute("src")!==i&&(e.src=i),t(n,e)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,e=this.options.maxZoom,n=this.options.zoomReverse,i=this.options.zoomOffset;return n&&(t=e-t),t+i},_getSubdomain:function(t){var e=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[e]},_abortLoading:function(){var t,e;for(t in this._tiles)this._tiles[t].coords.z!==this._tileZoom&&((e=this._tiles[t].el).onload=u,e.onerror=u,e.complete||(e.src=v,ae(e),delete this._tiles[t]))},_removeTile:function(t){var e=this._tiles[t];if(e)return ot||e.el.setAttribute("src",v),ei.prototype._removeTile.call(this,t)},_tileReady:function(t,e,n){if(this._map&&(!n||n.getAttribute("src")!==v))return ei.prototype._tileReady.call(this,t,e,n)}});function ii(t,e){return new ni(t,e)}var ri=ni.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,e){this._url=t;var i=n({},this.defaultWmsParams);for(var r in e)r in this.options||(i[r]=e[r]);var o=(e=f(this,e)).detectRetina&&St?2:1,a=this.getTileSize();i.width=a.x*o,i.height=a.y*o,this.wmsParams=i},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var e=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[e]=this._crs.code,ni.prototype.onAdd.call(this,t)},getTileUrl:function(t){var e=this._tileCoordsToNwSe(t),n=this._crs,i=R(n.project(e[0]),n.project(e[1])),r=i.min,o=i.max,a=(this._wmsVersion>=1.3&&this._crs===Tn?[r.y,r.x,o.y,o.x]:[r.x,r.y,o.x,o.y]).join(","),s=ni.prototype.getTileUrl.call(this,t);return s+d(this.wmsParams,s,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+a},setParams:function(t,e){return n(this.wmsParams,t),e||this.redraw(),this}});ni.WMS=ri,ii.wms=function(t,e){return new ri(t,e)};var oi=Pn.extend({options:{padding:.1,tolerance:0},initialize:function(t){f(this,t),a(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),this._zoomAnimated&&pe(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,e){var n=this._map.getZoomScale(e,this._zoom),i=ve(this._container),r=this._map.getSize().multiplyBy(.5+this.options.padding),o=this._map.project(this._center,e),a=this._map.project(t,e),s=a.subtract(o),l=r.multiplyBy(-n).add(i).add(r).subtract(s);yt?_e(this._container,l,n):ge(this._container,l)},_reset:function(){for(var t in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,e=this._map.getSize(),n=this._map.containerPointToLayerPoint(e.multiplyBy(-t)).round();this._bounds=new D(n,n.add(e.multiplyBy(1+2*t)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),ai=oi.extend({getEvents:function(){var t=oi.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){oi.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");ke(t,"mousemove",s(this._onMouseMove,32,this),this),ke(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),ke(t,"mouseout",this._handleMouseOut,this),this._ctx=t.getContext("2d")},_destroyContainer:function(){P(this._redrawRequest),delete this._ctx,ae(this._container),ze(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){for(var t in this._redrawBounds=null,this._layers)this._layers[t]._update();this._redraw()}},_update:function(){if(!this._map._animatingZoom||!this._bounds){oi.prototype._update.call(this);var t=this._bounds,e=this._container,n=t.getSize(),i=St?2:1;ge(e,t.min),e.width=i*n.x,e.height=i*n.y,e.style.width=n.x+"px",e.style.height=n.y+"px",St&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){oi.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[a(t)]=t;var e=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=e),this._drawLast=e,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var e=t._order,n=e.next,i=e.prev;n?n.prev=i:this._drawLast=i,i?i.next=n:this._drawFirst=n,delete t._order,delete this._layers[a(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if("string"==typeof t.options.dashArray){var e,n,i=t.options.dashArray.split(/[, ]+/),r=[];for(n=0;n<i.length;n++){if(e=Number(i[n]),isNaN(e))return;r.push(e)}t.options._dashArray=r}else t.options._dashArray=t.options.dashArray},_requestRedraw:function(t){this._map&&(this._extendRedrawBounds(t),this._redrawRequest=this._redrawRequest||S(this._redraw,this))},_extendRedrawBounds:function(t){if(t._pxBounds){var e=(t.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new D,this._redrawBounds.extend(t._pxBounds.min.subtract([e,e])),this._redrawBounds.extend(t._pxBounds.max.add([e,e]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var t=this._redrawBounds;if(t){var e=t.getSize();this._ctx.clearRect(t.min.x,t.min.y,e.x,e.y)}else this._ctx.clearRect(0,0,this._container.width,this._container.height)},_draw:function(){var t,e=this._redrawBounds;if(this._ctx.save(),e){var n=e.getSize();this._ctx.beginPath(),this._ctx.rect(e.min.x,e.min.y,n.x,n.y),this._ctx.clip()}this._drawing=!0;for(var i=this._drawFirst;i;i=i.next)t=i.layer,(!e||t._pxBounds&&t._pxBounds.intersects(e))&&t._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(t,e){if(this._drawing){var n,i,r,o,a=t._parts,s=a.length,l=this._ctx;if(s){for(l.beginPath(),n=0;n<s;n++){for(i=0,r=a[n].length;i<r;i++)o=a[n][i],l[i?"lineTo":"moveTo"](o.x,o.y);e&&l.closePath()}this._fillStroke(l,t)}}},_updateCircle:function(t){if(this._drawing&&!t._empty()){var e=t._point,n=this._ctx,i=Math.max(Math.round(t._radius),1),r=(Math.max(Math.round(t._radiusY),1)||i)/i;1!==r&&(n.save(),n.scale(1,r)),n.beginPath(),n.arc(e.x,e.y/r,i,0,2*Math.PI,!1),1!==r&&n.restore(),this._fillStroke(n,t)}},_fillStroke:function(t,e){var n=e.options;n.fill&&(t.globalAlpha=n.fillOpacity,t.fillStyle=n.fillColor||n.color,t.fill(n.fillRule||"evenodd")),n.stroke&&0!==n.weight&&(t.setLineDash&&t.setLineDash(e.options&&e.options._dashArray||[]),t.globalAlpha=n.opacity,t.lineWidth=n.weight,t.strokeStyle=n.color,t.lineCap=n.lineCap,t.lineJoin=n.lineJoin,t.stroke())},_onClick:function(t){for(var e,n,i=this._map.mouseEventToLayerPoint(t),r=this._drawFirst;r;r=r.next)(e=r.layer).options.interactive&&e._containsPoint(i)&&!this._map._draggableMoved(e)&&(n=e);n&&(Ze(t),this._fireEvent([n],t))},_onMouseMove:function(t){if(this._map&&!this._map.dragging.moving()&&!this._map._animatingZoom){var e=this._map.mouseEventToLayerPoint(t);this._handleMouseHover(t,e)}},_handleMouseOut:function(t){var e=this._hoveredLayer;e&&(he(this._container,"leaflet-interactive"),this._fireEvent([e],t,"mouseout"),this._hoveredLayer=null)},_handleMouseHover:function(t,e){for(var n,i,r=this._drawFirst;r;r=r.next)(n=r.layer).options.interactive&&n._containsPoint(e)&&(i=n);i!==this._hoveredLayer&&(this._handleMouseOut(t),i&&(pe(this._container,"leaflet-interactive"),this._fireEvent([i],t,"mouseover"),this._hoveredLayer=i)),this._hoveredLayer&&this._fireEvent([this._hoveredLayer],t)},_fireEvent:function(t,e,n){this._map._fireDOMEvent(e,n||e.type,t)},_bringToFront:function(t){var e=t._order;if(e){var n=e.next,i=e.prev;n&&(n.prev=i,i?i.next=n:n&&(this._drawFirst=n),e.prev=this._drawLast,this._drawLast.next=e,e.next=null,this._drawLast=e,this._requestRedraw(t))}},_bringToBack:function(t){var e=t._order;if(e){var n=e.next,i=e.prev;i&&(i.next=n,n?n.prev=i:i&&(this._drawLast=i),e.prev=null,e.next=this._drawFirst,this._drawFirst.prev=e,this._drawFirst=e,this._requestRedraw(t))}}});function si(t){return Pt?new ai(t):null}var li=function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(t){return document.createElement("<lvml:"+t+' class="lvml">')}}catch(t){return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),ui={_initContainer:function(){this._container=oe("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(oi.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=li("shape");pe(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=li("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){var e=t._container;this._container.appendChild(e),t.options.interactive&&t.addInteractiveTarget(e)},_removePath:function(t){var e=t._container;ae(e),t.removeInteractiveTarget(e),delete this._layers[a(t)]},_updateStyle:function(t){var e=t._stroke,n=t._fill,i=t.options,r=t._container;r.stroked=!!i.stroke,r.filled=!!i.fill,i.stroke?(e||(e=t._stroke=li("stroke")),r.appendChild(e),e.weight=i.weight+"px",e.color=i.color,e.opacity=i.opacity,i.dashArray?e.dashStyle=_(i.dashArray)?i.dashArray.join(" "):i.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=i.lineCap.replace("butt","flat"),e.joinstyle=i.lineJoin):e&&(r.removeChild(e),t._stroke=null),i.fill?(n||(n=t._fill=li("fill")),r.appendChild(n),n.color=i.fillColor||i.color,n.opacity=i.fillOpacity):n&&(r.removeChild(n),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),n=Math.round(t._radius),i=Math.round(t._radiusY||n);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+n+","+i+" 0,23592600")},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){le(t._container)},_bringToBack:function(t){ue(t._container)}},ci=kt?li:K,pi=oi.extend({getEvents:function(){var t=oi.prototype.getEvents.call(this);return t.zoomstart=this._onZoomStart,t},_initContainer:function(){this._container=ci("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=ci("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ae(this._container),ze(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_onZoomStart:function(){this._update()},_update:function(){if(!this._map._animatingZoom||!this._bounds){oi.prototype._update.call(this);var t=this._bounds,e=t.getSize(),n=this._container;this._svgSize&&this._svgSize.equals(e)||(this._svgSize=e,n.setAttribute("width",e.x),n.setAttribute("height",e.y)),ge(n,t.min),n.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update")}},_initPath:function(t){var e=t._path=ci("path");t.options.className&&pe(e,t.options.className),t.options.interactive&&pe(e,"leaflet-interactive"),this._updateStyle(t),this._layers[a(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){ae(t._path),t.removeInteractiveTarget(t._path),delete this._layers[a(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path,n=t.options;e&&(n.stroke?(e.setAttribute("stroke",n.color),e.setAttribute("stroke-opacity",n.opacity),e.setAttribute("stroke-width",n.weight),e.setAttribute("stroke-linecap",n.lineCap),e.setAttribute("stroke-linejoin",n.lineJoin),n.dashArray?e.setAttribute("stroke-dasharray",n.dashArray):e.removeAttribute("stroke-dasharray"),n.dashOffset?e.setAttribute("stroke-dashoffset",n.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),n.fill?(e.setAttribute("fill",n.fillColor||n.color),e.setAttribute("fill-opacity",n.fillOpacity),e.setAttribute("fill-rule",n.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,Y(t._parts,e))},_updateCircle:function(t){var e=t._point,n=Math.max(Math.round(t._radius),1),i=Math.max(Math.round(t._radiusY),1)||n,r="a"+n+","+i+" 0 1,0 ",o=t._empty()?"M0 0":"M"+(e.x-n)+","+e.y+r+2*n+",0 "+r+2*-n+",0 ";this._setPath(t,o)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){le(t._path)},_bringToBack:function(t){ue(t._path)}});function hi(t){return Ct||kt?new pi(t):null}kt&&pi.include(ui),Xe.include({getRenderer:function(t){var e=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return e||(e=this._renderer=this._createRenderer()),this.hasLayer(e)||this.addLayer(e),e},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var e=this._paneRenderers[t];return void 0===e&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e},_createRenderer:function(t){return this.options.preferCanvas&&si(t)||hi(t)}});var fi=Bn.extend({initialize:function(t,e){Bn.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=F(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});pi.create=ci,pi.pointsToPath=Y,Fn.geometryToLayer=Nn,Fn.coordsToLatLng=Un,Fn.coordsToLatLngs=jn,Fn.latLngToCoords=Vn,Fn.latLngsToCoords=Zn,Fn.getFeature=qn,Fn.asFeature=Gn,Xe.mergeOptions({boxZoom:!0});var di=en.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){ke(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){ze(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ae(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),Kt(),be(),this._startPoint=this._map.mouseEventToContainerPoint(t),ke(document,{contextmenu:Be,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=oe("div","leaflet-zoom-box",this._container),pe(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=new D(this._point,this._startPoint),n=e.getSize();ge(this._box,e.min),this._box.style.width=n.x+"px",this._box.style.height=n.y+"px"},_finish:function(){this._moved&&(ae(this._box),he(this._container,"leaflet-crosshair")),Yt(),we(),ze(document,{contextmenu:Be,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(r(this._resetState,this),0);var e=new B(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(e).fire("boxzoomend",{boxZoomBounds:e})}},_onKeyDown:function(t){27===t.keyCode&&this._finish()}});Xe.addInitHook("addHandler","boxZoom",di),Xe.mergeOptions({doubleClickZoom:!0});var mi=en.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,n=e.getZoom(),i=e.options.zoomDelta,r=t.originalEvent.shiftKey?n-i:n+i;"center"===e.options.doubleClickZoom?e.setZoom(r):e.setZoomAround(t.containerPoint,r)}});Xe.addInitHook("addHandler","doubleClickZoom",mi),Xe.mergeOptions({dragging:!0,inertia:!it,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var yi=en.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new ln(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}pe(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){he(this._map._container,"leaflet-grab"),he(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var e=F(this._map.options.maxBounds);this._offsetLimit=R(this._map.latLngToContainerPoint(e.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(e.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var e=this._lastTime=+new Date,n=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(n),this._times.push(e),this._prunePositions(e)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;this._positions.length>1&&t-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),e=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=e.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,e){return t-(t-e)*this._viscosity},_onPreDragLimit:function(){if(this._viscosity&&this._offsetLimit){var t=this._draggable._newPos.subtract(this._draggable._startPos),e=this._offsetLimit;t.x<e.min.x&&(t.x=this._viscousLimit(t.x,e.min.x)),t.y<e.min.y&&(t.y=this._viscousLimit(t.y,e.min.y)),t.x>e.max.x&&(t.x=this._viscousLimit(t.x,e.max.x)),t.y>e.max.y&&(t.y=this._viscousLimit(t.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,e=Math.round(t/2),n=this._initialWorldOffset,i=this._draggable._newPos.x,r=(i-e+n)%t+e-n,o=(i+e+n)%t-e-n,a=Math.abs(r+n)<Math.abs(o+n)?r:o;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=a},_onDragEnd:function(t){var e=this._map,n=e.options,i=!n.inertia||this._times.length<2;if(e.fire("dragend",t),i)e.fire("moveend");else{this._prunePositions(+new Date);var r=this._lastPos.subtract(this._positions[0]),o=(this._lastTime-this._times[0])/1e3,a=n.easeLinearity,s=r.multiplyBy(a/o),l=s.distanceTo([0,0]),u=Math.min(n.inertiaMaxSpeed,l),c=s.multiplyBy(u/l),p=u/(n.inertiaDeceleration*a),h=c.multiplyBy(-p/2).round();h.x||h.y?(h=e._limitOffset(h,e.options.maxBounds),S(function(){e.panBy(h,{duration:p,easeLinearity:a,noMoveStart:!0,animate:!0})})):e.fire("moveend")}}});Xe.addInitHook("addHandler","dragging",yi),Xe.mergeOptions({keyboard:!0,keyboardPanDelta:80});var _i=en.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(t){this._map=t,this._setPanDelta(t.options.keyboardPanDelta),this._setZoomDelta(t.options.zoomDelta)},addHooks:function(){var t=this._map._container;t.tabIndex<=0&&(t.tabIndex="0"),ke(t,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),ze(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var t=document.body,e=document.documentElement,n=t.scrollTop||e.scrollTop,i=t.scrollLeft||e.scrollLeft;this._map._container.focus(),window.scrollTo(i,n)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(t){var e,n,i=this._panKeys={},r=this.keyCodes;for(e=0,n=r.left.length;e<n;e++)i[r.left[e]]=[-1*t,0];for(e=0,n=r.right.length;e<n;e++)i[r.right[e]]=[t,0];for(e=0,n=r.down.length;e<n;e++)i[r.down[e]]=[0,t];for(e=0,n=r.up.length;e<n;e++)i[r.up[e]]=[0,-1*t]},_setZoomDelta:function(t){var e,n,i=this._zoomKeys={},r=this.keyCodes;for(e=0,n=r.zoomIn.length;e<n;e++)i[r.zoomIn[e]]=t;for(e=0,n=r.zoomOut.length;e<n;e++)i[r.zoomOut[e]]=-t},_addHooks:function(){ke(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){ze(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e,n=t.keyCode,i=this._map;if(n in this._panKeys)i._panAnim&&i._panAnim._inProgress||(e=this._panKeys[n],t.shiftKey&&(e=O(e).multiplyBy(3)),i.panBy(e),i.options.maxBounds&&i.panInsideBounds(i.options.maxBounds));else if(n in this._zoomKeys)i.setZoom(i.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[n]);else{if(27!==n||!i._popup||!i._popup.options.closeOnEscapeKey)return;i.closePopup()}Be(t)}}});Xe.addInitHook("addHandler","keyboard",_i),Xe.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var gi=en.extend({addHooks:function(){ke(this._map._container,"mousewheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){ze(this._map._container,"mousewheel",this._onWheelScroll,this)},_onWheelScroll:function(t){var e=Ue(t),n=this._map.options.wheelDebounceTime;this._delta+=e,this._lastMousePos=this._map.mouseEventToContainerPoint(t),this._startTime||(this._startTime=+new Date);var i=Math.max(n-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(r(this._performZoom,this),i),Be(t)},_performZoom:function(){var t=this._map,e=t.getZoom(),n=this._map.options.zoomSnap||0;t._stop();var i=this._delta/(4*this._map.options.wheelPxPerZoomLevel),r=4*Math.log(2/(1+Math.exp(-Math.abs(i))))/Math.LN2,o=n?Math.ceil(r/n)*n:r,a=t._limitZoom(e+(this._delta>0?o:-o))-e;this._delta=0,this._startTime=null,a&&("center"===t.options.scrollWheelZoom?t.setZoom(e+a):t.setZoomAround(this._lastMousePos,e+a))}});Xe.addInitHook("addHandler","scrollWheelZoom",gi),Xe.mergeOptions({tap:!0,tapTolerance:15});var vi=en.extend({addHooks:function(){ke(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){ze(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(t.touches){if(Re(t),this._fireClick=!0,t.touches.length>1)return this._fireClick=!1,void clearTimeout(this._holdTimeout);var e=t.touches[0],n=e.target;this._startPos=this._newPos=new M(e.clientX,e.clientY),n.tagName&&"a"===n.tagName.toLowerCase()&&pe(n,"leaflet-active"),this._holdTimeout=setTimeout(r(function(){this._isTapValid()&&(this._fireClick=!1,this._onUp(),this._simulateEvent("contextmenu",e))},this),1e3),this._simulateEvent("mousedown",e),ke(document,{touchmove:this._onMove,touchend:this._onUp},this)}},_onUp:function(t){if(clearTimeout(this._holdTimeout),ze(document,{touchmove:this._onMove,touchend:this._onUp},this),this._fireClick&&t&&t.changedTouches){var e=t.changedTouches[0],n=e.target;n&&n.tagName&&"a"===n.tagName.toLowerCase()&&he(n,"leaflet-active"),this._simulateEvent("mouseup",e),this._isTapValid()&&this._simulateEvent("click",e)}},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_onMove:function(t){var e=t.touches[0];this._newPos=new M(e.clientX,e.clientY),this._simulateEvent("mousemove",e)},_simulateEvent:function(t,e){var n=document.createEvent("MouseEvents");n._simulated=!0,e.target._simulatedClick=!0,n.initMouseEvent(t,!0,!0,window,1,e.screenX,e.screenY,e.clientX,e.clientY,!1,!1,!1,!1,0,null),e.target.dispatchEvent(n)}});wt&&!bt&&Xe.addInitHook("addHandler","tap",vi),Xe.mergeOptions({touchZoom:wt&&!it,bounceAtZoomLimits:!0});var xi=en.extend({addHooks:function(){pe(this._map._container,"leaflet-touch-zoom"),ke(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){he(this._map._container,"leaflet-touch-zoom"),ze(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var e=this._map;if(t.touches&&2===t.touches.length&&!e._animatingZoom&&!this._zooming){var n=e.mouseEventToContainerPoint(t.touches[0]),i=e.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=e.getSize()._divideBy(2),this._startLatLng=e.containerPointToLatLng(this._centerPoint),"center"!==e.options.touchZoom&&(this._pinchStartLatLng=e.containerPointToLatLng(n.add(i)._divideBy(2))),this._startDist=n.distanceTo(i),this._startZoom=e.getZoom(),this._moved=!1,this._zooming=!0,e._stop(),ke(document,"touchmove",this._onTouchMove,this),ke(document,"touchend",this._onTouchEnd,this),Re(t)}},_onTouchMove:function(t){if(t.touches&&2===t.touches.length&&this._zooming){var e=this._map,n=e.mouseEventToContainerPoint(t.touches[0]),i=e.mouseEventToContainerPoint(t.touches[1]),o=n.distanceTo(i)/this._startDist;if(this._zoom=e.getScaleZoom(o,this._startZoom),!e.options.bounceAtZoomLimits&&(this._zoom<e.getMinZoom()&&o<1||this._zoom>e.getMaxZoom()&&o>1)&&(this._zoom=e._limitZoom(this._zoom)),"center"===e.options.touchZoom){if(this._center=this._startLatLng,1===o)return}else{var a=n._add(i)._divideBy(2)._subtract(this._centerPoint);if(1===o&&0===a.x&&0===a.y)return;this._center=e.unproject(e.project(this._pinchStartLatLng,this._zoom).subtract(a),this._zoom)}this._moved||(e._moveStart(!0,!1),this._moved=!0),P(this._animRequest);var s=r(e._move,e,this._center,this._zoom,{pinch:!0,round:!1});this._animRequest=S(s,this,!0),Re(t)}},_onTouchEnd:function(){this._moved&&this._zooming?(this._zooming=!1,P(this._animRequest),ze(document,"touchmove",this._onTouchMove),ze(document,"touchend",this._onTouchEnd),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))):this._zooming=!1}});Xe.addInitHook("addHandler","touchZoom",xi),Xe.BoxZoom=di,Xe.DoubleClickZoom=mi,Xe.Drag=yi,Xe.Keyboard=_i,Xe.ScrollWheelZoom=gi,Xe.Tap=vi,Xe.TouchZoom=xi,Object.freeze=e,t.version="1.4.0",t.Control=Ke,t.control=Ye,t.Browser=zt,t.Evented=z,t.Mixin=rn,t.Util=C,t.Class=k,t.Handler=en,t.extend=n,t.bind=r,t.stamp=a,t.setOptions=f,t.DomEvent=We,t.DomUtil=Ce,t.PosAnimation=He,t.Draggable=ln,t.LineUtil=_n,t.PolyUtil=vn,t.Point=M,t.point=O,t.Bounds=D,t.bounds=R,t.Transformation=G,t.transformation=W,t.Projection=wn,t.LatLng=N,t.latLng=U,t.LatLngBounds=B,t.latLngBounds=F,t.CRS=V,t.GeoJSON=Fn,t.geoJSON=Hn,t.geoJson=Xn,t.Layer=Pn,t.LayerGroup=Cn,t.layerGroup=function(t,e){return new Cn(t,e)},t.FeatureGroup=kn,t.featureGroup=function(t){return new kn(t)},t.ImageOverlay=Kn,t.imageOverlay=function(t,e,n){return new Kn(t,e,n)},t.VideoOverlay=Yn,t.videoOverlay=function(t,e,n){return new Yn(t,e,n)},t.DivOverlay=Jn,t.Popup=$n,t.popup=function(t,e){return new $n(t,e)},t.Tooltip=Qn,t.tooltip=function(t,e){return new Qn(t,e)},t.Icon=An,t.icon=function(t){return new An(t)},t.DivIcon=ti,t.divIcon=function(t){return new ti(t)},t.Marker=Mn,t.marker=function(t,e){return new Mn(t,e)},t.TileLayer=ni,t.tileLayer=ii,t.GridLayer=ei,t.gridLayer=function(t){return new ei(t)},t.SVG=pi,t.svg=hi,t.Renderer=oi,t.Canvas=ai,t.canvas=si,t.Path=In,t.CircleMarker=On,t.circleMarker=function(t,e){return new On(t,e)},t.Circle=Dn,t.circle=function(t,e,n){return new Dn(t,e,n)},t.Polyline=Rn,t.polyline=function(t,e){return new Rn(t,e)},t.Polygon=Bn,t.polygon=function(t,e){return new Bn(t,e)},t.Rectangle=fi,t.rectangle=function(t,e){return new fi(t,e)},t.Map=Xe,t.map=function(t,e){return new Xe(t,e)};var bi=window.L;t.noConflict=function(){return window.L=bi,this},window.L=t}(e)},function(t,e,n){"use strict";function i(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}n.d(e,"a",function(){return i})},function(t,e,n){"use strict";function i(){return(i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}n.d(e,"a",function(){return i})},function(t,e,n){t.exports=n(23)()},function(t,e,n){"use strict";n.d(e,"a",function(){return p}),n.d(e,"b",function(){return h});var i=n(5),r=n(16),o=n.n(r),a=n(0),s=n.n(a),l=Object(a.createContext)({}),u=l.Consumer,c=l.Provider,p=c,h=function(t){var e=function(e,n){return s.a.createElement(u,null,function(r){return s.a.createElement(t,Object(i.a)({},e,{leaflet:r,ref:n}))})},n=t.displayName||t.name||"Component";e.displayName="Leaflet("+n+")";var r=Object(a.forwardRef)(e);return o()(r,t),r}},function(t,e,n){"use strict";n.d(e,"a",function(){return u});var i=n(5),r=n(1),o=n(4),a=n(2),s=n(0),l=/^on(.+)$/i,u=function(t){function e(e){var n;return n=t.call(this,e)||this,Object(a.a)(Object(r.a)(n),"_leafletEvents",void 0),Object(a.a)(Object(r.a)(n),"leafletElement",void 0),n._leafletEvents=n.extractLeafletEvents(e),n}Object(o.a)(e,t);var n=e.prototype;return n.componentDidMount=function(){this.bindLeafletEvents(this._leafletEvents)},n.componentDidUpdate=function(t){this._leafletEvents=this.bindLeafletEvents(this.extractLeafletEvents(this.props),this._leafletEvents)},n.componentWillUnmount=function(){var t=this,e=this.leafletElement;e&&Object.keys(this._leafletEvents).forEach(function(n){e.off(n,t._leafletEvents[n])})},n.extractLeafletEvents=function(t){return Object.keys(t).reduce(function(e,n){l.test(n)&&(null!=t[n]&&(e[n.replace(l,function(t,e){return e.toLowerCase()})]=t[n]));return e},{})},n.bindLeafletEvents=function(t,e){void 0===t&&(t={}),void 0===e&&(e={});var n=this.leafletElement;if(null==n||null==n.on)return{};var r=Object(i.a)({},e);return Object.keys(e).forEach(function(i){null!=t[i]&&e[i]===t[i]||(delete r[i],n.off(i,e[i]))}),Object.keys(t).forEach(function(i){null!=e[i]&&t[i]===e[i]||(r[i]=t[i],n.on(i,t[i]))}),r},n.fireLeafletEvent=function(t,e){var n=this.leafletElement;n&&n.fire(t,e)},e}(s.Component)},function(t,e,n){"use strict";
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var i=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach(function(t){i[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,a,s=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),l=1;l<arguments.length;l++){for(var u in n=Object(arguments[l]))r.call(n,u)&&(s[u]=n[u]);if(i){a=i(n);for(var c=0;c<a.length;c++)o.call(n,a[c])&&(s[a[c]]=n[a[c]])}}return s}},function(t,e,n){"use strict";!function t(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(t){console.error(t)}}(),t.exports=n(20)},,function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){t.exports=function(){"use strict";var t,e,n;function i(i,r){if(t)if(e){var o="var sharedChunk = {}; ("+t+")(sharedChunk); ("+e+")(sharedChunk);",a={};t(a),(n=r(a)).workerUrl=window.URL.createObjectURL(new Blob([o],{type:"text/javascript"}))}else e=r;else t=r}return i(0,function(t){function e(t,e){return t(e={exports:{}},e.exports),e.exports}var n=i;function i(t,e,n,i){this.cx=3*t,this.bx=3*(n-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(i-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=i,this.p2x=n,this.p2y=i}i.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},i.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},i.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},i.prototype.solveCurveX=function(t,e){var n,i,r,o,a;for(void 0===e&&(e=1e-6),r=t,a=0;a<8;a++){if(o=this.sampleCurveX(r)-t,Math.abs(o)<e)return r;var s=this.sampleCurveDerivativeX(r);if(Math.abs(s)<1e-6)break;r-=o/s}if((r=t)<(n=0))return n;if(r>(i=1))return i;for(;n<i;){if(o=this.sampleCurveX(r),Math.abs(o-t)<e)return r;t>o?n=r:i=r,r=.5*(i-n)+n}return r},i.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var r=o;function o(t,e){this.x=t,this.y=e}function a(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!a(t[n],e[n]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==e){if("object"!=typeof e)return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var i in t)if(!a(t[i],e[i]))return!1;return!0}return t===e}function s(t,e,i,r){var o=new n(t,e,i,r);return function(t){return o.solve(t)}}o.prototype={clone:function(){return new o(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,n=t.y-this.y;return e*e+n*n},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,n=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=n,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),n=Math.sin(t),i=e*this.x-n*this.y,r=n*this.x+e*this.y;return this.x=i,this.y=r,this},_rotateAround:function(t,e){var n=Math.cos(t),i=Math.sin(t),r=e.x+n*(this.x-e.x)-i*(this.y-e.y),o=e.y+i*(this.x-e.x)+n*(this.y-e.y);return this.x=r,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},o.convert=function(t){return t instanceof o?t:Array.isArray(t)?new o(t[0],t[1]):t};var l=s(.25,.1,.25,1);function u(t,e,n){return Math.min(n,Math.max(e,t))}function c(t,e,n){var i=n-e,r=((t-e)%i+i)%i+e;return r===e?n:r}function p(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];for(var i=0,r=e;i<r.length;i+=1){var o=r[i];for(var a in o)t[a]=o[a]}return t}var h=1;function f(){return h++}function d(){return function t(e){return e?(e^16*Math.random()>>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function m(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function y(t,e){t.forEach(function(t){e[t]&&(e[t]=e[t].bind(e))})}function _(t,e){return-1!==t.indexOf(e,t.length-e.length)}function g(t,e,n){var i={};for(var r in t)i[r]=e.call(n||this,t[r],r,t);return i}function v(t,e,n){var i={};for(var r in t)e.call(n||this,t[r],r,t)&&(i[r]=t[r]);return i}function x(t){return Array.isArray(t)?t.map(x):"object"==typeof t&&t?g(t,x):t}var b={};function w(t){b[t]||("undefined"!=typeof console&&console.warn(t),b[t]=!0)}function E(t,e,n){return(n.y-t.y)*(e.x-t.x)>(e.y-t.y)*(n.x-t.x)}function T(t){for(var e=0,n=0,i=t.length,r=i-1,o=void 0,a=void 0;n<i;r=n++)o=t[n],e+=((a=t[r]).x-o.x)*(o.y+a.y);return e}function S(t){try{var e=self[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return!1}}var P,C,k=self.performance&&self.performance.now?self.performance.now.bind(self.performance):Date.now.bind(Date),A=self.requestAnimationFrame||self.mozRequestAnimationFrame||self.webkitRequestAnimationFrame||self.msRequestAnimationFrame,z=self.cancelAnimationFrame||self.mozCancelAnimationFrame||self.webkitCancelAnimationFrame||self.msCancelAnimationFrame,L={now:k,frame:function(t){var e=A(t);return{cancel:function(){return z(e)}}},getImageData:function(t){var e=self.document.createElement("canvas"),n=e.getContext("2d");if(!n)throw new Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,n.drawImage(t,0,0,t.width,t.height),n.getImageData(0,0,t.width,t.height)},resolveURL:function(t){var e=self.document.createElement("a");return e.href=t,e.href},hardwareConcurrency:self.navigator.hardwareConcurrency||4,get devicePixelRatio(){return self.devicePixelRatio}},M={API_URL:"https://api.mapbox.com",get EVENTS_URL(){return 0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":"https://events.mapbox.com/events/v2"},FEEDBACK_URL:"https://apps.mapbox.com/feedback",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16},I={supported:!1,testSupport:function(t){!O&&C&&(D?R(t):P=t)}},O=!1,D=!1;function R(t){var e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,C),t.isContextLost())return;I.supported=!0}catch(t){}t.deleteTexture(e),O=!0}self.document&&((C=self.document.createElement("img")).onload=function(){P&&R(P),P=null,D=!0},C.onerror=function(){O=!0,P=null},C.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var B="See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes";function F(t,e){var n=W(M.API_URL);if(t.protocol=n.protocol,t.authority=n.authority,"/"!==n.path&&(t.path=""+n.path+t.path),!M.REQUIRE_ACCESS_TOKEN)return H(t);if(!(e=e||M.ACCESS_TOKEN))throw new Error("An API access token is required to use Mapbox GL. "+B);if("s"===e[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+B);return t.params.push("access_token="+e),H(t)}function N(t){return 0===t.indexOf("mapbox:")}var U=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;function j(t){return U.test(t)}var V=/(\.(png|jpg)\d*)(?=$)/,Z=/\.[\w]+$/,q=function(t){var e=W(t);if(!e.path.match(/(^\/v4\/)/)||!e.path.match(Z))return t;var n="mapbox://tiles/";n+=e.path.replace("/v4/","");var i=e.params.filter(function(t){return!t.match(/^access_token=/)});return i.length&&(n+="?"+i.join("&")),n},G=/^(\w+):\/\/([^\/?]*)(\/[^?]+)?\??(.+)?/;function W(t){var e=t.match(G);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function H(t){var e=t.params.length?"?"+t.params.join("&"):"";return t.protocol+"://"+t.authority+t.path+e}function X(t){if(!t)return null;var e,n=t.split(".");if(!n||3!==n.length)return null;try{return JSON.parse((e=n[1],decodeURIComponent(self.atob(e).split("").map(function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)}).join(""))))}catch(t){return null}}var K=function(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null};K.prototype.getStorageKey=function(t){var e,n=X(M.ACCESS_TOKEN),i="";return n&&n.u?(e=n.u,i=self.btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(t,e){return String.fromCharCode(Number("0x"+e))}))):i=M.ACCESS_TOKEN||"",t?"mapbox.eventData."+t+":"+i:"mapbox.eventData:"+i},K.prototype.fetchEventData=function(){var t=S("localStorage"),e=this.getStorageKey(),n=this.getStorageKey("uuid");if(t)try{var i=self.localStorage.getItem(e);i&&(this.eventData=JSON.parse(i));var r=self.localStorage.getItem(n);r&&(this.anonId=r)}catch(t){w("Unable to read from LocalStorage")}},K.prototype.saveEventData=function(){var t=S("localStorage"),e=this.getStorageKey(),n=this.getStorageKey("uuid");if(t)try{self.localStorage.setItem(n,this.anonId),Object.keys(this.eventData).length>=1&&self.localStorage.setItem(e,JSON.stringify(this.eventData))}catch(t){w("Unable to write to LocalStorage")}},K.prototype.processRequests=function(){},K.prototype.postEvent=function(t,e,n){var i=this,r=W(M.EVENTS_URL);r.params.push("access_token="+(M.ACCESS_TOKEN||""));var o={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"0.53.0",userId:this.anonId},a=e?p(o,e):o,s={url:H(r),headers:{"Content-Type":"text/plain"},body:JSON.stringify([a])};this.pendingRequest=ut(s,function(t){i.pendingRequest=null,n(t),i.saveEventData(),i.processRequests()})},K.prototype.queueRequest=function(t){this.queue.push(t),this.processRequests()};var Y=function(t){function e(){t.call(this,"map.load"),this.success={}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.postMapLoadEvent=function(t,e){M.ACCESS_TOKEN&&Array.isArray(t)&&t.some(function(t){return N(t)||j(t)})&&this.queueRequest({id:e,timestamp:Date.now()})},e.prototype.processRequests=function(){var t=this;if(!this.pendingRequest&&0!==this.queue.length){var e=this.queue.shift(),n=e.id,i=e.timestamp;n&&this.success[n]||(this.anonId||this.fetchEventData(),m(this.anonId)||(this.anonId=d()),this.postEvent(i,{},function(e){e||n&&(t.success[n]=!0)}))}},e}(K),J=new(function(t){function e(){t.call(this,"appUserTurnstile")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.postTurnstileEvent=function(t){M.ACCESS_TOKEN&&Array.isArray(t)&&t.some(function(t){return N(t)||j(t)})&&this.queueRequest(Date.now())},e.prototype.processRequests=function(){var t=this;if(!this.pendingRequest&&0!==this.queue.length){this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();var e=X(M.ACCESS_TOKEN),n=e?e.u:M.ACCESS_TOKEN,i=n!==this.eventData.tokenU;m(this.anonId)||(this.anonId=d(),i=!0);var r=this.queue.shift();if(this.eventData.lastSuccess){var o=new Date(this.eventData.lastSuccess),a=new Date(r),s=(r-this.eventData.lastSuccess)/864e5;i=i||s>=1||s<-1||o.getDate()!==a.getDate()}else i=!0;if(!i)return this.processRequests();this.postEvent(r,{"enabled.telemetry":!1},function(e){e||(t.eventData.lastSuccess=r,t.eventData.tokenU=n)})}},e}(K)),$=J.postTurnstileEvent.bind(J),Q=new Y,tt=Q.postMapLoadEvent.bind(Q),et={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(et);var nt=function(t){function e(e,n,i){401===n&&j(i)&&(e+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),t.call(this,e),this.status=n,this.url=i,this.name=this.constructor.name,this.message=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.toString=function(){return this.name+": "+this.message+" ("+this.status+"): "+this.url},e}(Error);function it(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}var rt,ot,at=it()?function(){return self.worker&&self.worker.referrer}:function(){var t=self.location.origin;if(t&&"null"!==t&&"file://"!==t)return t+self.location.pathname},st=function(t,e){if(!/^file:/.test(t.url)){if(self.fetch&&self.Request&&self.AbortController)return function(t,e){var n=new self.AbortController,i=new self.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:at(),signal:n.signal});return"json"===t.type&&i.headers.set("Accept","application/json"),self.fetch(i).then(function(n){n.ok?n[t.type||"text"]().then(function(t){e(null,t,n.headers.get("Cache-Control"),n.headers.get("Expires"))}).catch(function(t){return e(new Error(t.message))}):e(new nt(n.statusText,n.status,t.url))}).catch(function(t){20!==t.code&&e(new Error(t.message))}),{cancel:function(){return n.abort()}}}(t,e);if(it()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e)}return function(t,e){var n=new self.XMLHttpRequest;for(var i in n.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(n.responseType="arraybuffer"),t.headers)n.setRequestHeader(i,t.headers[i]);return"json"===t.type&&n.setRequestHeader("Accept","application/json"),n.withCredentials="include"===t.credentials,n.onerror=function(){e(new Error(n.statusText))},n.onload=function(){if((n.status>=200&&n.status<300||0===n.status)&&null!==n.response){var i=n.response;if("json"===t.type)try{i=JSON.parse(n.response)}catch(t){return e(t)}e(null,i,n.getResponseHeader("Cache-Control"),n.getResponseHeader("Expires"))}else e(new nt(n.statusText,n.status,t.url))},n.send(t.body),{cancel:function(){return n.abort()}}}(t,e)},lt=function(t,e){return st(p(t,{type:"arrayBuffer"}),e)},ut=function(t,e){return st(p(t,{method:"POST"}),e)};rt=[],ot=0;var ct=function(t,e){if(ot>=M.MAX_PARALLEL_IMAGE_REQUESTS){var n={requestParameters:t,callback:e,cancelled:!1,cancel:function(){this.cancelled=!0}};return rt.push(n),n}ot++;var i=!1,r=function(){if(!i)for(i=!0,ot--;rt.length&&ot<M.MAX_PARALLEL_IMAGE_REQUESTS;){var t=rt.shift(),e=t.requestParameters,n=t.callback;t.cancelled||(t.cancel=ct(e,n).cancel)}},o=lt(t,function(t,n,i,o){if(r(),t)e(t);else if(n){var a=new self.Image,s=self.URL||self.webkitURL;a.onload=function(){e(null,a),s.revokeObjectURL(a.src)},a.onerror=function(){return e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))};var l=new self.Blob([new Uint8Array(n)],{type:"image/png"});a.cacheControl=i,a.expires=o,a.src=n.byteLength?s.createObjectURL(l):"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII="}});return{cancel:function(){o.cancel(),r()}}};function pt(t,e,n){n[t]&&-1!==n[t].indexOf(e)||(n[t]=n[t]||[],n[t].push(e))}function ht(t,e,n){if(n&&n[t]){var i=n[t].indexOf(e);-1!==i&&n[t].splice(i,1)}}var ft=function(t,e){void 0===e&&(e={}),p(this,e),this.type=t},dt=function(t){function e(e,n){void 0===n&&(n={}),t.call(this,"error",p({error:e},n))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(ft),mt=function(){};mt.prototype.on=function(t,e){return this._listeners=this._listeners||{},pt(t,e,this._listeners),this},mt.prototype.off=function(t,e){return ht(t,e,this._listeners),ht(t,e,this._oneTimeListeners),this},mt.prototype.once=function(t,e){return this._oneTimeListeners=this._oneTimeListeners||{},pt(t,e,this._oneTimeListeners),this},mt.prototype.fire=function(t,e){"string"==typeof t&&(t=new ft(t,e||{}));var n=t.type;if(this.listens(n)){t.target=this;for(var i=0,r=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];i<r.length;i+=1)r[i].call(this,t);for(var o=0,a=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];o<a.length;o+=1){var s=a[o];ht(n,s,this._oneTimeListeners),s.call(this,t)}var l=this._eventedParent;l&&(p(t,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),l.fire(t))}else t instanceof dt&&console.error(t.error);return this},mt.prototype.listens=function(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)},mt.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var yt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"string",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},expression_name:{type:"enum",values:{let:{group:"Variable binding"},var:{group:"Variable binding"},literal:{group:"Types"},array:{group:"Types"},at:{group:"Lookup"},case:{group:"Decision"},match:{group:"Decision"},coalesce:{group:"Decision"},step:{group:"Ramps, scales, curves"},interpolate:{group:"Ramps, scales, curves"},"interpolate-hcl":{group:"Ramps, scales, curves"},"interpolate-lab":{group:"Ramps, scales, curves"},ln2:{group:"Math"},pi:{group:"Math"},e:{group:"Math"},typeof:{group:"Types"},string:{group:"Types"},number:{group:"Types"},boolean:{group:"Types"},object:{group:"Types"},collator:{group:"Types"},format:{group:"Types"},"number-format":{group:"Types"},"to-string":{group:"Types"},"to-number":{group:"Types"},"to-boolean":{group:"Types"},"to-rgba":{group:"Color"},"to-color":{group:"Types"},rgb:{group:"Color"},rgba:{group:"Color"},get:{group:"Lookup"},has:{group:"Lookup"},length:{group:"Lookup"},properties:{group:"Feature data"},"feature-state":{group:"Feature data"},"geometry-type":{group:"Feature data"},id:{group:"Feature data"},zoom:{group:"Zoom"},"heatmap-density":{group:"Heatmap"},"line-progress":{group:"Feature data"},accumulated:{group:"Feature data"},"+":{group:"Math"},"*":{group:"Math"},"-":{group:"Math"},"/":{group:"Math"},"%":{group:"Math"},"^":{group:"Math"},sqrt:{group:"Math"},log10:{group:"Math"},ln:{group:"Math"},log2:{group:"Math"},sin:{group:"Math"},cos:{group:"Math"},tan:{group:"Math"},asin:{group:"Math"},acos:{group:"Math"},atan:{group:"Math"},min:{group:"Math"},max:{group:"Math"},round:{group:"Math"},abs:{group:"Math"},ceil:{group:"Math"},floor:{group:"Math"},"==":{group:"Decision"},"!=":{group:"Decision"},">":{group:"Decision"},"<":{group:"Decision"},">=":{group:"Decision"},"<=":{group:"Decision"},all:{group:"Decision"},any:{group:"Decision"},"!":{group:"Decision"},"is-supported-script":{group:"String"},upcase:{group:"String"},downcase:{group:"String"},concat:{group:"String"},"resolved-locale":{group:"String"}}},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"string",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"string",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"string",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"string",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}}},_t=function(t,e,n,i){this.message=(t?t+": ":"")+n,i&&(this.identifier=i),null!=e&&e.__line__&&(this.line=e.__line__)};function gt(t){var e=t.key,n=t.value;return n?[new _t(e,n,"constants have been deprecated as of v8")]:[]}function vt(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];for(var i=0,r=e;i<r.length;i+=1){var o=r[i];for(var a in o)t[a]=o[a]}return t}function xt(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function bt(t){return Array.isArray(t)?t.map(bt):xt(t)}var wt=function(t){function e(e,n){t.call(this,n),this.message=n,this.key=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),Et=function(t,e){void 0===e&&(e=[]),this.parent=t,this.bindings={};for(var n=0,i=e;n<i.length;n+=1){var r=i[n],o=r[0],a=r[1];this.bindings[o]=a}};Et.prototype.concat=function(t){return new Et(this,t)},Et.prototype.get=function(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(t+" not found in scope.")},Et.prototype.has=function(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)};var Tt={kind:"null"},St={kind:"number"},Pt={kind:"string"},Ct={kind:"boolean"},kt={kind:"color"},At={kind:"object"},zt={kind:"value"},Lt={kind:"collator"},Mt={kind:"formatted"};function It(t,e){return{kind:"array",itemType:t,N:e}}function Ot(t){if("array"===t.kind){var e=Ot(t.itemType);return"number"==typeof t.N?"array<"+e+", "+t.N+">":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var Dt=[Tt,St,Pt,Ct,kt,Mt,At,It(zt)];function Rt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Rt(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(var n=0,i=Dt;n<i.length;n+=1)if(!Rt(i[n],e))return null}return"Expected "+Ot(t)+" but found "+Ot(e)+" instead."}var Bt=e(function(t,e){var n={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function i(t){return(t=Math.round(t))<0?0:t>255?255:t}function r(t){return t<0?0:t>1?1:t}function o(t){return"%"===t[t.length-1]?i(parseFloat(t)/100*255):i(parseInt(t))}function a(t){return"%"===t[t.length-1]?r(parseFloat(t)/100):r(parseFloat(t))}function s(t,e,n){return n<0?n+=1:n>1&&(n-=1),6*n<1?t+(e-t)*n*6:2*n<1?e:3*n<2?t+(e-t)*(2/3-n)*6:t}try{e.parseCSSColor=function(t){var e,r=t.replace(/ /g,"").toLowerCase();if(r in n)return n[r].slice();if("#"===r[0])return 4===r.length?(e=parseInt(r.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===r.length&&(e=parseInt(r.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var l=r.indexOf("("),u=r.indexOf(")");if(-1!==l&&u+1===r.length){var c=r.substr(0,l),p=r.substr(l+1,u-(l+1)).split(","),h=1;switch(c){case"rgba":if(4!==p.length)return null;h=a(p.pop());case"rgb":return 3!==p.length?null:[o(p[0]),o(p[1]),o(p[2]),h];case"hsla":if(4!==p.length)return null;h=a(p.pop());case"hsl":if(3!==p.length)return null;var f=(parseFloat(p[0])%360+360)%360/360,d=a(p[1]),m=a(p[2]),y=m<=.5?m*(d+1):m+d-m*d,_=2*m-y;return[i(255*s(_,y,f+1/3)),i(255*s(_,y,f)),i(255*s(_,y,f-1/3)),h];default:return null}}return null}}catch(t){}}).parseCSSColor,Ft=function(t,e,n,i){void 0===i&&(i=1),this.r=t,this.g=e,this.b=n,this.a=i};Ft.parse=function(t){if(t){if(t instanceof Ft)return t;if("string"==typeof t){var e=Bt(t);if(e)return new Ft(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},Ft.prototype.toString=function(){var t=this.toArray(),e=t[0],n=t[1],i=t[2],r=t[3];return"rgba("+Math.round(e)+","+Math.round(n)+","+Math.round(i)+","+r+")"},Ft.prototype.toArray=function(){var t=this.r,e=this.g,n=this.b,i=this.a;return 0===i?[0,0,0,0]:[255*t/i,255*e/i,255*n/i,i]},Ft.black=new Ft(0,0,0,1),Ft.white=new Ft(1,1,1,1),Ft.transparent=new Ft(0,0,0,0),Ft.red=new Ft(1,0,0,1);var Nt=function(t,e,n){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};Nt.prototype.compare=function(t,e){return this.collator.compare(t,e)},Nt.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var Ut=function(t,e,n){this.text=t,this.scale=e,this.fontStack=n},jt=function(t){this.sections=t};function Vt(t,e,n,i){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof n&&n>=0&&n<=255?void 0===i||"number"==typeof i&&i>=0&&i<=1?null:"Invalid rgba value ["+[t,e,n,i].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof i?[t,e,n,i]:[t,e,n]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function Zt(t){if(null===t)return Tt;if("string"==typeof t)return Pt;if("boolean"==typeof t)return Ct;if("number"==typeof t)return St;if(t instanceof Ft)return kt;if(t instanceof Nt)return Lt;if(t instanceof jt)return Mt;if(Array.isArray(t)){for(var e,n=t.length,i=0,r=t;i<r.length;i+=1){var o=Zt(r[i]);if(e){if(e===o)continue;e=zt;break}e=o}return It(e||zt,n)}return At}function qt(t){var e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Ft||t instanceof jt?t.toString():JSON.stringify(t)}jt.fromString=function(t){return new jt([new Ut(t,null,null)])},jt.prototype.toString=function(){return this.sections.map(function(t){return t.text}).join("")},jt.prototype.serialize=function(){for(var t=["format"],e=0,n=this.sections;e<n.length;e+=1){var i=n[e];t.push(i.text);var r={};i.fontStack&&(r["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(r["font-scale"]=i.scale),t.push(r)}return t};var Gt=function(t,e){this.type=t,this.value=e};Gt.parse=function(t,e){if(2!==t.length)return e.error("'literal' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(!function t(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof Ft)return!0;if(e instanceof Nt)return!0;if(e instanceof jt)return!0;if(Array.isArray(e)){for(var n=0,i=e;n<i.length;n+=1)if(!t(i[n]))return!1;return!0}if("object"==typeof e){for(var r in e)if(!t(e[r]))return!1;return!0}return!1}(t[1]))return e.error("invalid value");var n=t[1],i=Zt(n),r=e.expectedType;return"array"!==i.kind||0!==i.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(i=r),new Gt(i,n)},Gt.prototype.evaluate=function(){return this.value},Gt.prototype.eachChild=function(){},Gt.prototype.possibleOutputs=function(){return[this.value]},Gt.prototype.serialize=function(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof Ft?["rgba"].concat(this.value.toArray()):this.value instanceof jt?this.value.serialize():this.value};var Wt=function(t){this.name="ExpressionEvaluationError",this.message=t};Wt.prototype.toJSON=function(){return this.message};var Ht={string:Pt,number:St,boolean:Ct,object:At},Xt=function(t,e){this.type=t,this.args=e};Xt.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var n,i=1,r=t[0];if("array"===r){var o,a;if(t.length>2){var s=t[1];if("string"!=typeof s||!(s in Ht)||"object"===s)return e.error('The item type argument of "array" must be one of string, number, boolean',1);o=Ht[s],i++}else o=zt;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);a=t[2],i++}n=It(o,a)}else n=Ht[r];for(var l=[];i<t.length;i++){var u=e.parse(t[i],i,zt);if(!u)return null;l.push(u)}return new Xt(n,l)},Xt.prototype.evaluate=function(t){for(var e=0;e<this.args.length;e++){var n=this.args[e].evaluate(t);if(!Rt(this.type,Zt(n)))return n;if(e===this.args.length-1)throw new Wt("Expected value to be of type "+Ot(this.type)+", but found "+Ot(Zt(n))+" instead.")}return null},Xt.prototype.eachChild=function(t){this.args.forEach(t)},Xt.prototype.possibleOutputs=function(){var t;return(t=[]).concat.apply(t,this.args.map(function(t){return t.possibleOutputs()}))},Xt.prototype.serialize=function(){var t=this.type,e=[t.kind];if("array"===t.kind){var n=t.itemType;if("string"===n.kind||"number"===n.kind||"boolean"===n.kind){e.push(n.kind);var i=t.N;("number"==typeof i||this.args.length>1)&&e.push(i)}}return e.concat(this.args.map(function(t){return t.serialize()}))};var Kt=function(t){this.type=Mt,this.sections=t};Kt.parse=function(t,e){if(t.length<3)return e.error("Expected at least two arguments.");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");for(var n=[],i=1;i<t.length-1;i+=2){var r=e.parse(t[i],1,zt);if(!r)return null;var o=r.type.kind;if("string"!==o&&"value"!==o&&"null"!==o)return e.error("Formatted text type must be 'string', 'value', or 'null'.");var a=t[i+1];if("object"!=typeof a||Array.isArray(a))return e.error("Format options argument must be an object.");var s=null;if(a["font-scale"]&&!(s=e.parse(a["font-scale"],1,St)))return null;var l=null;if(a["text-font"]&&!(l=e.parse(a["text-font"],1,It(Pt))))return null;n.push({text:r,scale:s,font:l})}return new Kt(n)},Kt.prototype.evaluate=function(t){return new jt(this.sections.map(function(e){return new Ut(qt(e.text.evaluate(t)),e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null)}))},Kt.prototype.eachChild=function(t){for(var e=0,n=this.sections;e<n.length;e+=1){var i=n[e];t(i.text),i.scale&&t(i.scale),i.font&&t(i.font)}},Kt.prototype.possibleOutputs=function(){return[void 0]},Kt.prototype.serialize=function(){for(var t=["format"],e=0,n=this.sections;e<n.length;e+=1){var i=n[e];t.push(i.text.serialize());var r={};i.scale&&(r["font-scale"]=i.scale.serialize()),i.font&&(r["text-font"]=i.font.serialize()),t.push(r)}return t};var Yt={"to-boolean":Ct,"to-color":kt,"to-number":St,"to-string":Pt},Jt=function(t,e){this.type=t,this.args=e};Jt.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var n=t[0];if(("to-boolean"===n||"to-string"===n)&&2!==t.length)return e.error("Expected one argument.");for(var i=Yt[n],r=[],o=1;o<t.length;o++){var a=e.parse(t[o],o,zt);if(!a)return null;r.push(a)}return new Jt(i,r)},Jt.prototype.evaluate=function(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){for(var e,n,i=0,r=this.args;i<r.length;i+=1){if(n=null,(e=r[i].evaluate(t))instanceof Ft)return e;if("string"==typeof e){var o=t.parseColor(e);if(o)return o}else if(Array.isArray(e)&&!(n=e.length<3||e.length>4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":Vt(e[0],e[1],e[2],e[3])))return new Ft(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Wt(n||"Could not parse color from value '"+("string"==typeof e?e:JSON.stringify(e))+"'")}if("number"===this.type.kind){for(var a=null,s=0,l=this.args;s<l.length;s+=1){if(null===(a=l[s].evaluate(t)))return 0;var u=Number(a);if(!isNaN(u))return u}throw new Wt("Could not convert "+JSON.stringify(a)+" to number.")}return"formatted"===this.type.kind?jt.fromString(qt(this.args[0].evaluate(t))):qt(this.args[0].evaluate(t))},Jt.prototype.eachChild=function(t){this.args.forEach(t)},Jt.prototype.possibleOutputs=function(){var t;return(t=[]).concat.apply(t,this.args.map(function(t){return t.possibleOutputs()}))},Jt.prototype.serialize=function(){if("formatted"===this.type.kind)return new Kt([{text:this.args[0],scale:null,font:null}]).serialize();var t=["to-"+this.type.kind];return this.eachChild(function(e){t.push(e.serialize())}),t};var $t=["Unknown","Point","LineString","Polygon"],Qt=function(){this.globals=null,this.feature=null,this.featureState=null,this._parseColorCache={}};Qt.prototype.id=function(){return this.feature&&"id"in this.feature?this.feature.id:null},Qt.prototype.geometryType=function(){return this.feature?"number"==typeof this.feature.type?$t[this.feature.type]:this.feature.type:null},Qt.prototype.properties=function(){return this.feature&&this.feature.properties||{}},Qt.prototype.parseColor=function(t){var e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=Ft.parse(t)),e};var te=function(t,e,n,i){this.name=t,this.type=e,this._evaluate=n,this.args=i};te.prototype.evaluate=function(t){return this._evaluate(t,this.args)},te.prototype.eachChild=function(t){this.args.forEach(t)},te.prototype.possibleOutputs=function(){return[void 0]},te.prototype.serialize=function(){return[this.name].concat(this.args.map(function(t){return t.serialize()}))},te.parse=function(t,e){var n,i=t[0],r=te.definitions[i];if(!r)return e.error('Unknown expression "'+i+'". If you wanted a literal array, use ["literal", [...]].',0);for(var o=Array.isArray(r)?r[0]:r.type,a=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,s=a.filter(function(e){var n=e[0];return!Array.isArray(n)||n.length===t.length-1}),l=null,u=0,c=s;u<c.length;u+=1){var p=c[u],h=p[0],f=p[1];l=new ae(e.registry,e.path,null,e.scope);for(var d=[],m=!1,y=1;y<t.length;y++){var _=t[y],g=Array.isArray(h)?h[y-1]:h.type,v=l.parse(_,1+d.length,g);if(!v){m=!0;break}d.push(v)}if(!m)if(Array.isArray(h)&&h.length!==d.length)l.error("Expected "+h.length+" arguments, but found "+d.length+" instead.");else{for(var x=0;x<d.length;x++){var b=Array.isArray(h)?h[x]:h.type,w=d[x];l.concat(x+1).checkSubtype(b,w.type)}if(0===l.errors.length)return new te(i,o,f,d)}}if(1===s.length)(n=e.errors).push.apply(n,l.errors);else{for(var E=(s.length?s:a).map(function(t){var e;return e=t[0],Array.isArray(e)?"("+e.map(Ot).join(", ")+")":"("+Ot(e.type)+"...)"}).join(" | "),T=[],S=1;S<t.length;S++){var P=e.parse(t[S],1+T.length);if(!P)return null;T.push(Ot(P.type))}e.error("Expected arguments of type "+E+", but found ("+T.join(", ")+") instead.")}return null},te.register=function(t,e){for(var n in te.definitions=e,e)t[n]=te};var ee=function(t,e,n){this.type=Lt,this.locale=n,this.caseSensitive=t,this.diacriticSensitive=e};function ne(t){if(t instanceof te){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}var e=!0;return t.eachChild(function(t){e&&!ne(t)&&(e=!1)}),e}function ie(t){if(t instanceof te&&"feature-state"===t.name)return!1;var e=!0;return t.eachChild(function(t){e&&!ie(t)&&(e=!1)}),e}function re(t,e){if(t instanceof te&&e.indexOf(t.name)>=0)return!1;var n=!0;return t.eachChild(function(t){n&&!re(t,e)&&(n=!1)}),n}ee.parse=function(t,e){if(2!==t.length)return e.error("Expected one argument.");var n=t[1];if("object"!=typeof n||Array.isArray(n))return e.error("Collator options argument must be an object.");var i=e.parse(void 0!==n["case-sensitive"]&&n["case-sensitive"],1,Ct);if(!i)return null;var r=e.parse(void 0!==n["diacritic-sensitive"]&&n["diacritic-sensitive"],1,Ct);if(!r)return null;var o=null;return n.locale&&!(o=e.parse(n.locale,1,Pt))?null:new ee(i,r,o)},ee.prototype.evaluate=function(t){return new Nt(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)},ee.prototype.eachChild=function(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)},ee.prototype.possibleOutputs=function(){return[void 0]},ee.prototype.serialize=function(){var t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]};var oe=function(t,e){this.type=e.type,this.name=t,this.boundExpression=e};oe.parse=function(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");var n=t[1];return e.scope.has(n)?new oe(n,e.scope.get(n)):e.error('Unknown variable "'+n+'". Make sure "'+n+'" has been bound in an enclosing "let" expression before using it.',1)},oe.prototype.evaluate=function(t){return this.boundExpression.evaluate(t)},oe.prototype.eachChild=function(){},oe.prototype.possibleOutputs=function(){return[void 0]},oe.prototype.serialize=function(){return["var",this.name]};var ae=function(t,e,n,i,r){void 0===e&&(e=[]),void 0===i&&(i=new Et),void 0===r&&(r=[]),this.registry=t,this.path=e,this.key=e.map(function(t){return"["+t+"]"}).join(""),this.scope=i,this.errors=r,this.expectedType=n};function se(t,e){for(var n,i,r=0,o=t.length-1,a=0;r<=o;){if(n=t[a=Math.floor((r+o)/2)],i=t[a+1],e===n||e>n&&e<i)return a;if(n<e)r=a+1;else{if(!(n>e))throw new Wt("Input is not a number.");o=a-1}}return Math.max(a-1,0)}ae.prototype.parse=function(t,e,n,i,r){return void 0===r&&(r={}),e?this.concat(e,n,i)._parse(t,r):this._parse(t,r)},ae.prototype._parse=function(t,e){function n(t,e,n){return"assert"===n?new Xt(e,[t]):"coerce"===n?new Jt(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var i=t[0];if("string"!=typeof i)return this.error("Expression name must be a string, but found "+typeof i+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var r=this.registry[i];if(r){var o=r.parse(t,this);if(!o)return null;if(this.expectedType){var a=this.expectedType,s=o.type;if("string"!==a.kind&&"number"!==a.kind&&"boolean"!==a.kind&&"object"!==a.kind&&"array"!==a.kind||"value"!==s.kind)if("color"!==a.kind&&"formatted"!==a.kind||"value"!==s.kind&&"string"!==s.kind){if(this.checkSubtype(a,s))return null}else o=n(o,a,e.typeAnnotation||"coerce");else o=n(o,a,e.typeAnnotation||"assert")}if(!(o instanceof Gt)&&function t(e){if(e instanceof oe)return t(e.boundExpression);if(e instanceof te&&"error"===e.name)return!1;if(e instanceof ee)return!1;var n=e instanceof Jt||e instanceof Xt,i=!0;return e.eachChild(function(e){i=n?i&&t(e):i&&e instanceof Gt}),!!i&&ne(e)&&re(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(o)){var l=new Qt;try{o=new Gt(o.type,o.evaluate(l))}catch(t){return this.error(t.message),null}}return o}return this.error('Unknown expression "'+i+'". If you wanted a literal array, use ["literal", [...]].',0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error("Expected an array, but found "+typeof t+" instead.")},ae.prototype.concat=function(t,e,n){var i="number"==typeof t?this.path.concat(t):this.path,r=n?this.scope.concat(n):this.scope;return new ae(this.registry,i,e||null,r,this.errors)},ae.prototype.error=function(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];var i=""+this.key+e.map(function(t){return"["+t+"]"}).join("");this.errors.push(new wt(i,t))},ae.prototype.checkSubtype=function(t,e){var n=Rt(t,e);return n&&this.error(n),n};var le=function(t,e,n){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var i=0,r=n;i<r.length;i+=1){var o=r[i],a=o[0],s=o[1];this.labels.push(a),this.outputs.push(s)}};function ue(t,e,n){return t*(1-n)+e*n}le.parse=function(t,e){var n=t[1],i=t.slice(2);if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(n=e.parse(n,1,St)))return null;var r=[],o=null;e.expectedType&&"value"!==e.expectedType.kind&&(o=e.expectedType),i.unshift(-1/0);for(var a=0;a<i.length;a+=2){var s=i[a],l=i[a+1],u=a+1,c=a+2;if("number"!=typeof s)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',u);if(r.length&&r[r.length-1][0]>=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);var p=e.parse(l,c,o);if(!p)return null;o=o||p.type,r.push([s,p])}return new le(o,n,r)},le.prototype.evaluate=function(t){var e=this.labels,n=this.outputs;if(1===e.length)return n[0].evaluate(t);var i=this.input.evaluate(t);if(i<=e[0])return n[0].evaluate(t);var r=e.length;return i>=e[r-1]?n[r-1].evaluate(t):n[se(e,i)].evaluate(t)},le.prototype.eachChild=function(t){t(this.input);for(var e=0,n=this.outputs;e<n.length;e+=1)t(n[e])},le.prototype.possibleOutputs=function(){var t;return(t=[]).concat.apply(t,this.outputs.map(function(t){return t.possibleOutputs()}))},le.prototype.serialize=function(){for(var t=["step",this.input.serialize()],e=0;e<this.labels.length;e++)e>0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var ce=Object.freeze({number:ue,color:function(t,e,n){return new Ft(ue(t.r,e.r,n),ue(t.g,e.g,n),ue(t.b,e.b,n),ue(t.a,e.a,n))},array:function(t,e,n){return t.map(function(t,i){return ue(t,e[i],n)})}}),pe=.95047,he=1,fe=1.08883,de=4/29,me=6/29,ye=3*me*me,_e=me*me*me,ge=Math.PI/180,ve=180/Math.PI;function xe(t){return t>_e?Math.pow(t,1/3):t/ye+de}function be(t){return t>me?t*t*t:ye*(t-de)}function we(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Ee(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Te(t){var e=Ee(t.r),n=Ee(t.g),i=Ee(t.b),r=xe((.4124564*e+.3575761*n+.1804375*i)/pe),o=xe((.2126729*e+.7151522*n+.072175*i)/he);return{l:116*o-16,a:500*(r-o),b:200*(o-xe((.0193339*e+.119192*n+.9503041*i)/fe)),alpha:t.a}}function Se(t){var e=(t.l+16)/116,n=isNaN(t.a)?e:e+t.a/500,i=isNaN(t.b)?e:e-t.b/200;return e=he*be(e),n=pe*be(n),i=fe*be(i),new Ft(we(3.2404542*n-1.5371385*e-.4985314*i),we(-.969266*n+1.8760108*e+.041556*i),we(.0556434*n-.2040259*e+1.0572252*i),t.alpha)}function Pe(t,e,n){var i=e-t;return t+n*(i>180||i<-180?i-360*Math.round(i/360):i)}var Ce={forward:Te,reverse:Se,interpolate:function(t,e,n){return{l:ue(t.l,e.l,n),a:ue(t.a,e.a,n),b:ue(t.b,e.b,n),alpha:ue(t.alpha,e.alpha,n)}}},ke={forward:function(t){var e=Te(t),n=e.l,i=e.a,r=e.b,o=Math.atan2(r,i)*ve;return{h:o<0?o+360:o,c:Math.sqrt(i*i+r*r),l:n,alpha:t.a}},reverse:function(t){var e=t.h*ge,n=t.c;return Se({l:t.l,a:Math.cos(e)*n,b:Math.sin(e)*n,alpha:t.alpha})},interpolate:function(t,e,n){return{h:Pe(t.h,e.h,n),c:ue(t.c,e.c,n),l:ue(t.l,e.l,n),alpha:ue(t.alpha,e.alpha,n)}}},Ae=Object.freeze({lab:Ce,hcl:ke}),ze=function(t,e,n,i,r){this.type=t,this.operator=e,this.interpolation=n,this.input=i,this.labels=[],this.outputs=[];for(var o=0,a=r;o<a.length;o+=1){var s=a[o],l=s[0],u=s[1];this.labels.push(l),this.outputs.push(u)}};function Le(t,e,n,i){var r=i-n,o=t-n;return 0===r?0:1===e?o/r:(Math.pow(e,o)-1)/(Math.pow(e,r)-1)}ze.interpolationFactor=function(t,e,i,r){var o=0;if("exponential"===t.name)o=Le(e,t.base,i,r);else if("linear"===t.name)o=Le(e,1,i,r);else if("cubic-bezier"===t.name){var a=t.controlPoints;o=new n(a[0],a[1],a[2],a[3]).solve(Le(e,1,i,r))}return o},ze.parse=function(t,e){var n=t[0],i=t[1],r=t[2],o=t.slice(3);if(!Array.isArray(i)||0===i.length)return e.error("Expected an interpolation type expression.",1);if("linear"===i[0])i={name:"linear"};else if("exponential"===i[0]){var a=i[1];if("number"!=typeof a)return e.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:a}}else{if("cubic-bezier"!==i[0])return e.error("Unknown interpolation type "+String(i[0]),1,0);var s=i.slice(1);if(4!==s.length||s.some(function(t){return"number"!=typeof t||t<0||t>1}))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:s}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(r=e.parse(r,2,St)))return null;var l=[],u=null;"interpolate-hcl"===n||"interpolate-lab"===n?u=kt:e.expectedType&&"value"!==e.expectedType.kind&&(u=e.expectedType);for(var c=0;c<o.length;c+=2){var p=o[c],h=o[c+1],f=c+3,d=c+4;if("number"!=typeof p)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',f);if(l.length&&l[l.length-1][0]>=p)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',f);var m=e.parse(h,d,u);if(!m)return null;u=u||m.type,l.push([p,m])}return"number"===u.kind||"color"===u.kind||"array"===u.kind&&"number"===u.itemType.kind&&"number"==typeof u.N?new ze(u,n,i,r,l):e.error("Type "+Ot(u)+" is not interpolatable.")},ze.prototype.evaluate=function(t){var e=this.labels,n=this.outputs;if(1===e.length)return n[0].evaluate(t);var i=this.input.evaluate(t);if(i<=e[0])return n[0].evaluate(t);var r=e.length;if(i>=e[r-1])return n[r-1].evaluate(t);var o=se(e,i),a=e[o],s=e[o+1],l=ze.interpolationFactor(this.interpolation,i,a,s),u=n[o].evaluate(t),c=n[o+1].evaluate(t);return"interpolate"===this.operator?ce[this.type.kind.toLowerCase()](u,c,l):"interpolate-hcl"===this.operator?ke.reverse(ke.interpolate(ke.forward(u),ke.forward(c),l)):Ce.reverse(Ce.interpolate(Ce.forward(u),Ce.forward(c),l))},ze.prototype.eachChild=function(t){t(this.input);for(var e=0,n=this.outputs;e<n.length;e+=1)t(n[e])},ze.prototype.possibleOutputs=function(){var t;return(t=[]).concat.apply(t,this.outputs.map(function(t){return t.possibleOutputs()}))},ze.prototype.serialize=function(){var t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);for(var e=[this.operator,t,this.input.serialize()],n=0;n<this.labels.length;n++)e.push(this.labels[n],this.outputs[n].serialize());return e};var Me=function(t,e){this.type=t,this.args=e};Me.parse=function(t,e){if(t.length<2)return e.error("Expectected at least one argument.");var n=null,i=e.expectedType;i&&"value"!==i.kind&&(n=i);for(var r=[],o=0,a=t.slice(1);o<a.length;o+=1){var s=a[o],l=e.parse(s,1+r.length,n,void 0,{typeAnnotation:"omit"});if(!l)return null;n=n||l.type,r.push(l)}var u=i&&r.some(function(t){return Rt(i,t.type)});return new Me(u?zt:n,r)},Me.prototype.evaluate=function(t){for(var e=null,n=0,i=this.args;n<i.length&&null===(e=i[n].evaluate(t));n+=1);return e},Me.prototype.eachChild=function(t){this.args.forEach(t)},Me.prototype.possibleOutputs=function(){var t;return(t=[]).concat.apply(t,this.args.map(function(t){return t.possibleOutputs()}))},Me.prototype.serialize=function(){var t=["coalesce"];return this.eachChild(function(e){t.push(e.serialize())}),t};var Ie=function(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e};Ie.prototype.evaluate=function(t){return this.result.evaluate(t)},Ie.prototype.eachChild=function(t){for(var e=0,n=this.bindings;e<n.length;e+=1)t(n[e][1]);t(this.result)},Ie.parse=function(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found "+(t.length-1)+" instead.");for(var n=[],i=1;i<t.length-1;i+=2){var r=t[i];if("string"!=typeof r)return e.error("Expected string, but found "+typeof r+" instead.",i);if(/[^a-zA-Z0-9_]/.test(r))return e.error("Variable names must contain only alphanumeric characters or '_'.",i);var o=e.parse(t[i+1],i+1);if(!o)return null;n.push([r,o])}var a=e.parse(t[t.length-1],t.length-1,e.expectedType,n);return a?new Ie(n,a):null},Ie.prototype.possibleOutputs=function(){return this.result.possibleOutputs()},Ie.prototype.serialize=function(){for(var t=["let"],e=0,n=this.bindings;e<n.length;e+=1){var i=n[e],r=i[0],o=i[1];t.push(r,o.serialize())}return t.push(this.result.serialize()),t};var Oe=function(t,e,n){this.type=t,this.index=e,this.input=n};Oe.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var n=e.parse(t[1],1,St),i=e.parse(t[2],2,It(e.expectedType||zt));if(!n||!i)return null;var r=i.type;return new Oe(r.itemType,n,i)},Oe.prototype.evaluate=function(t){var e=this.index.evaluate(t),n=this.input.evaluate(t);if(e<0)throw new Wt("Array index out of bounds: "+e+" < 0.");if(e>=n.length)throw new Wt("Array index out of bounds: "+e+" > "+(n.length-1)+".");if(e!==Math.floor(e))throw new Wt("Array index must be an integer, but found "+e+" instead.");return n[e]},Oe.prototype.eachChild=function(t){t(this.index),t(this.input)},Oe.prototype.possibleOutputs=function(){return[void 0]},Oe.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var De=function(t,e,n,i,r,o){this.inputType=t,this.type=e,this.input=n,this.cases=i,this.outputs=r,this.otherwise=o};De.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var n,i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(var r={},o=[],a=2;a<t.length-1;a+=2){var s=t[a],l=t[a+1];Array.isArray(s)||(s=[s]);var u=e.concat(a);if(0===s.length)return u.error("Expected at least one branch label.");for(var c=0,p=s;c<p.length;c+=1){var h=p[c];if("number"!=typeof h&&"string"!=typeof h)return u.error("Branch labels must be numbers or strings.");if("number"==typeof h&&Math.abs(h)>Number.MAX_SAFE_INTEGER)return u.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof h&&Math.floor(h)!==h)return u.error("Numeric branch labels must be integer values.");if(n){if(u.checkSubtype(n,Zt(h)))return null}else n=Zt(h);if(void 0!==r[String(h)])return u.error("Branch labels must be unique.");r[String(h)]=o.length}var f=e.parse(l,a,i);if(!f)return null;i=i||f.type,o.push(f)}var d=e.parse(t[1],1,zt);if(!d)return null;var m=e.parse(t[t.length-1],t.length-1,i);return m?"value"!==d.type.kind&&e.concat(1).checkSubtype(n,d.type)?null:new De(n,i,d,r,o,m):null},De.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(Zt(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},De.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},De.prototype.possibleOutputs=function(){var t;return(t=[]).concat.apply(t,this.outputs.map(function(t){return t.possibleOutputs()})).concat(this.otherwise.possibleOutputs())},De.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],n=[],i={},r=0,o=Object.keys(this.cases).sort();r<o.length;r+=1){var a=o[r];void 0===(p=i[this.cases[a]])?(i[this.cases[a]]=n.length,n.push([this.cases[a],[a]])):n[p][1].push(a)}for(var s=function(e){return"number"===t.inputType.kind?Number(e):e},l=0,u=n;l<u.length;l+=1){var c=u[l],p=c[0],h=c[1];1===h.length?e.push(s(h[0])):e.push(h.map(s)),e.push(this.outputs[outputIndex$1].serialize())}return e.push(this.otherwise.serialize()),e};var Re=function(t,e,n){this.type=t,this.branches=e,this.otherwise=n};function Be(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function Fe(t,e,n,i){return 0===i.compare(e,n)}function Ne(t,e,n){var i="=="!==t&&"!="!==t;return function(){function r(t,e,n){this.type=Ct,this.lhs=t,this.rhs=e,this.collator=n,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}return r.parse=function(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");var n=t[0],o=e.parse(t[1],1,zt);if(!o)return null;if(!Be(n,o.type))return e.concat(1).error('"'+n+"\" comparisons are not supported for type '"+Ot(o.type)+"'.");var a=e.parse(t[2],2,zt);if(!a)return null;if(!Be(n,a.type))return e.concat(2).error('"'+n+"\" comparisons are not supported for type '"+Ot(a.type)+"'.");if(o.type.kind!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error("Cannot compare types '"+Ot(o.type)+"' and '"+Ot(a.type)+"'.");i&&("value"===o.type.kind&&"value"!==a.type.kind?o=new Xt(a.type,[o]):"value"!==o.type.kind&&"value"===a.type.kind&&(a=new Xt(o.type,[a])));var s=null;if(4===t.length){if("string"!==o.type.kind&&"string"!==a.type.kind&&"value"!==o.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(!(s=e.parse(t[3],3,Lt)))return null}return new r(o,a,s)},r.prototype.evaluate=function(r){var o=this.lhs.evaluate(r),a=this.rhs.evaluate(r);if(i&&this.hasUntypedArgument){var s=Zt(o),l=Zt(a);if(s.kind!==l.kind||"string"!==s.kind&&"number"!==s.kind)throw new Wt('Expected arguments for "'+t+'" to be (string, string) or (number, number), but found ('+s.kind+", "+l.kind+") instead.")}if(this.collator&&!i&&this.hasUntypedArgument){var u=Zt(o),c=Zt(a);if("string"!==u.kind||"string"!==c.kind)return e(r,o,a)}return this.collator?n(r,o,a,this.collator.evaluate(r)):e(r,o,a)},r.prototype.eachChild=function(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)},r.prototype.possibleOutputs=function(){return[!0,!1]},r.prototype.serialize=function(){var e=[t];return this.eachChild(function(t){e.push(t.serialize())}),e},r}()}Re.parse=function(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found only "+(t.length-1)+".");if(t.length%2!=0)return e.error("Expected an odd number of arguments.");var n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(var i=[],r=1;r<t.length-1;r+=2){var o=e.parse(t[r],r,Ct);if(!o)return null;var a=e.parse(t[r+1],r+1,n);if(!a)return null;i.push([o,a]),n=n||a.type}var s=e.parse(t[t.length-1],t.length-1,n);return s?new Re(n,i,s):null},Re.prototype.evaluate=function(t){for(var e=0,n=this.branches;e<n.length;e+=1){var i=n[e],r=i[0],o=i[1];if(r.evaluate(t))return o.evaluate(t)}return this.otherwise.evaluate(t)},Re.prototype.eachChild=function(t){for(var e=0,n=this.branches;e<n.length;e+=1){var i=n[e],r=i[0],o=i[1];t(r),t(o)}t(this.otherwise)},Re.prototype.possibleOutputs=function(){var t;return(t=[]).concat.apply(t,this.branches.map(function(t){return t[0],t[1].possibleOutputs()})).concat(this.otherwise.possibleOutputs())},Re.prototype.serialize=function(){var t=["case"];return this.eachChild(function(e){t.push(e.serialize())}),t};var Ue=Ne("==",function(t,e,n){return e===n},Fe),je=Ne("!=",function(t,e,n){return e!==n},function(t,e,n,i){return!Fe(0,e,n,i)}),Ve=Ne("<",function(t,e,n){return e<n},function(t,e,n,i){return i.compare(e,n)<0}),Ze=Ne(">",function(t,e,n){return e>n},function(t,e,n,i){return i.compare(e,n)>0}),qe=Ne("<=",function(t,e,n){return e<=n},function(t,e,n,i){return i.compare(e,n)<=0}),Ge=Ne(">=",function(t,e,n){return e>=n},function(t,e,n,i){return i.compare(e,n)>=0}),We=function(t,e,n,i,r){this.type=Pt,this.number=t,this.locale=e,this.currency=n,this.minFractionDigits=i,this.maxFractionDigits=r};We.parse=function(t,e){if(3!==t.length)return e.error("Expected two arguments.");var n=e.parse(t[1],1,St);if(!n)return null;var i=t[2];if("object"!=typeof i||Array.isArray(i))return e.error("NumberFormat options argument must be an object.");var r=null;if(i.locale&&!(r=e.parse(i.locale,1,Pt)))return null;var o=null;if(i.currency&&!(o=e.parse(i.currency,1,Pt)))return null;var a=null;if(i["min-fraction-digits"]&&!(a=e.parse(i["min-fraction-digits"],1,St)))return null;var s=null;return i["max-fraction-digits"]&&!(s=e.parse(i["max-fraction-digits"],1,St))?null:new We(n,r,o,a,s)},We.prototype.evaluate=function(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))},We.prototype.eachChild=function(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)},We.prototype.possibleOutputs=function(){return[void 0]},We.prototype.serialize=function(){var t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]};var He=function(t){this.type=St,this.input=t};He.parse=function(t,e){if(2!==t.length)return e.error("Expected 1 argument, but found "+(t.length-1)+" instead.");var n=e.parse(t[1],1);return n?"array"!==n.type.kind&&"string"!==n.type.kind&&"value"!==n.type.kind?e.error("Expected argument of type string or array, but found "+Ot(n.type)+" instead."):new He(n):null},He.prototype.evaluate=function(t){var e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new Wt("Expected value to be of type string or array, but found "+Ot(Zt(e))+" instead.")},He.prototype.eachChild=function(t){t(this.input)},He.prototype.possibleOutputs=function(){return[void 0]},He.prototype.serialize=function(){var t=["length"];return this.eachChild(function(e){t.push(e.serialize())}),t};var Xe={"==":Ue,"!=":je,">":Ze,"<":Ve,">=":Ge,"<=":qe,array:Xt,at:Oe,boolean:Xt,case:Re,coalesce:Me,collator:ee,format:Kt,interpolate:ze,"interpolate-hcl":ze,"interpolate-lab":ze,length:He,let:Ie,literal:Gt,match:De,number:Xt,"number-format":We,object:Xt,step:le,string:Xt,"to-boolean":Jt,"to-color":Jt,"to-number":Jt,"to-string":Jt,var:oe};function Ke(t,e){var n=e[0],i=e[1],r=e[2],o=e[3];n=n.evaluate(t),i=i.evaluate(t),r=r.evaluate(t);var a=o?o.evaluate(t):1,s=Vt(n,i,r,a);if(s)throw new Wt(s);return new Ft(n/255*a,i/255*a,r/255*a,a)}function Ye(t,e){return t in e}function Je(t,e){var n=e[t];return void 0===n?null:n}function $e(t){return{type:t}}function Qe(t){return{result:"success",value:t}}function tn(t){return{result:"error",value:t}}function en(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function nn(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function rn(t){return!!t.expression&&t.expression.interpolated}function on(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function an(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function sn(t){return t}function ln(t,e,n){return void 0!==t?t:void 0!==e?e:void 0!==n?n:void 0}function un(t,e,n,i,r){return ln(typeof n===r?i[n]:void 0,t.default,e.default)}function cn(t,e,n){if("number"!==on(n))return ln(t.default,e.default);var i=t.stops.length;if(1===i)return t.stops[0][1];if(n<=t.stops[0][0])return t.stops[0][1];if(n>=t.stops[i-1][0])return t.stops[i-1][1];var r=fn(t.stops,n);return t.stops[r][1]}function pn(t,e,n){var i=void 0!==t.base?t.base:1;if("number"!==on(n))return ln(t.default,e.default);var r=t.stops.length;if(1===r)return t.stops[0][1];if(n<=t.stops[0][0])return t.stops[0][1];if(n>=t.stops[r-1][0])return t.stops[r-1][1];var o=fn(t.stops,n),a=function(t,e,n,i){var r=i-n,o=t-n;return 0===r?0:1===e?o/r:(Math.pow(e,o)-1)/(Math.pow(e,r)-1)}(n,i,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],u=ce[e.type]||sn;if(t.colorSpace&&"rgb"!==t.colorSpace){var c=Ae[t.colorSpace];u=function(t,e){return c.reverse(c.interpolate(c.forward(t),c.forward(e),a))}}return"function"==typeof s.evaluate?{evaluate:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var n=s.evaluate.apply(void 0,t),i=l.evaluate.apply(void 0,t);if(void 0!==n&&void 0!==i)return u(n,i,a)}}:u(s,l,a)}function hn(t,e,n){return"color"===e.type?n=Ft.parse(n):"formatted"===e.type?n=jt.fromString(n.toString()):on(n)===e.type||"enum"===e.type&&e.values[n]||(n=void 0),ln(n,t.default,e.default)}function fn(t,e){for(var n,i,r=0,o=t.length-1,a=0;r<=o;){if(n=t[a=Math.floor((r+o)/2)][0],i=t[a+1][0],e===n||e>n&&e<i)return a;n<e?r=a+1:n>e&&(o=a-1)}return Math.max(a-1,0)}te.register(Xe,{error:[{kind:"error"},[Pt],function(t,e){var n=e[0];throw new Wt(n.evaluate(t))}],typeof:[Pt,[zt],function(t,e){return Ot(Zt(e[0].evaluate(t)))}],"to-rgba":[It(St,4),[kt],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[kt,[St,St,St],Ke],rgba:[kt,[St,St,St,St],Ke],has:{type:Ct,overloads:[[[Pt],function(t,e){return Ye(e[0].evaluate(t),t.properties())}],[[Pt,At],function(t,e){var n=e[0],i=e[1];return Ye(n.evaluate(t),i.evaluate(t))}]]},get:{type:zt,overloads:[[[Pt],function(t,e){return Je(e[0].evaluate(t),t.properties())}],[[Pt,At],function(t,e){var n=e[0],i=e[1];return Je(n.evaluate(t),i.evaluate(t))}]]},"feature-state":[zt,[Pt],function(t,e){return Je(e[0].evaluate(t),t.featureState||{})}],properties:[At,[],function(t){return t.properties()}],"geometry-type":[Pt,[],function(t){return t.geometryType()}],id:[zt,[],function(t){return t.id()}],zoom:[St,[],function(t){return t.globals.zoom}],"heatmap-density":[St,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[St,[],function(t){return t.globals.lineProgress||0}],accumulated:[zt,[],function(t){return void 0===t.globals.accumulated?null:t.globals.accumulated}],"+":[St,$e(St),function(t,e){for(var n=0,i=0,r=e;i<r.length;i+=1)n+=r[i].evaluate(t);return n}],"*":[St,$e(St),function(t,e){for(var n=1,i=0,r=e;i<r.length;i+=1)n*=r[i].evaluate(t);return n}],"-":{type:St,overloads:[[[St,St],function(t,e){var n=e[0],i=e[1];return n.evaluate(t)-i.evaluate(t)}],[[St],function(t,e){return-e[0].evaluate(t)}]]},"/":[St,[St,St],function(t,e){var n=e[0],i=e[1];return n.evaluate(t)/i.evaluate(t)}],"%":[St,[St,St],function(t,e){var n=e[0],i=e[1];return n.evaluate(t)%i.evaluate(t)}],ln2:[St,[],function(){return Math.LN2}],pi:[St,[],function(){return Math.PI}],e:[St,[],function(){return Math.E}],"^":[St,[St,St],function(t,e){var n=e[0],i=e[1];return Math.pow(n.evaluate(t),i.evaluate(t))}],sqrt:[St,[St],function(t,e){var n=e[0];return Math.sqrt(n.evaluate(t))}],log10:[St,[St],function(t,e){var n=e[0];return Math.log(n.evaluate(t))/Math.LN10}],ln:[St,[St],function(t,e){var n=e[0];return Math.log(n.evaluate(t))}],log2:[St,[St],function(t,e){var n=e[0];return Math.log(n.evaluate(t))/Math.LN2}],sin:[St,[St],function(t,e){var n=e[0];return Math.sin(n.evaluate(t))}],cos:[St,[St],function(t,e){var n=e[0];return Math.cos(n.evaluate(t))}],tan:[St,[St],function(t,e){var n=e[0];return Math.tan(n.evaluate(t))}],asin:[St,[St],function(t,e){var n=e[0];return Math.asin(n.evaluate(t))}],acos:[St,[St],function(t,e){var n=e[0];return Math.acos(n.evaluate(t))}],atan:[St,[St],function(t,e){var n=e[0];return Math.atan(n.evaluate(t))}],min:[St,$e(St),function(t,e){return Math.min.apply(Math,e.map(function(e){return e.evaluate(t)}))}],max:[St,$e(St),function(t,e){return Math.max.apply(Math,e.map(function(e){return e.evaluate(t)}))}],abs:[St,[St],function(t,e){var n=e[0];return Math.abs(n.evaluate(t))}],round:[St,[St],function(t,e){var n=e[0].evaluate(t);return n<0?-Math.round(-n):Math.round(n)}],floor:[St,[St],function(t,e){var n=e[0];return Math.floor(n.evaluate(t))}],ceil:[St,[St],function(t,e){var n=e[0];return Math.ceil(n.evaluate(t))}],"filter-==":[Ct,[Pt,zt],function(t,e){var n=e[0],i=e[1];return t.properties()[n.value]===i.value}],"filter-id-==":[Ct,[zt],function(t,e){var n=e[0];return t.id()===n.value}],"filter-type-==":[Ct,[Pt],function(t,e){var n=e[0];return t.geometryType()===n.value}],"filter-<":[Ct,[Pt,zt],function(t,e){var n=e[0],i=e[1],r=t.properties()[n.value],o=i.value;return typeof r==typeof o&&r<o}],"filter-id-<":[Ct,[zt],function(t,e){var n=e[0],i=t.id(),r=n.value;return typeof i==typeof r&&i<r}],"filter->":[Ct,[Pt,zt],function(t,e){var n=e[0],i=e[1],r=t.properties()[n.value],o=i.value;return typeof r==typeof o&&r>o}],"filter-id->":[Ct,[zt],function(t,e){var n=e[0],i=t.id(),r=n.value;return typeof i==typeof r&&i>r}],"filter-<=":[Ct,[Pt,zt],function(t,e){var n=e[0],i=e[1],r=t.properties()[n.value],o=i.value;return typeof r==typeof o&&r<=o}],"filter-id-<=":[Ct,[zt],function(t,e){var n=e[0],i=t.id(),r=n.value;return typeof i==typeof r&&i<=r}],"filter->=":[Ct,[Pt,zt],function(t,e){var n=e[0],i=e[1],r=t.properties()[n.value],o=i.value;return typeof r==typeof o&&r>=o}],"filter-id->=":[Ct,[zt],function(t,e){var n=e[0],i=t.id(),r=n.value;return typeof i==typeof r&&i>=r}],"filter-has":[Ct,[zt],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[Ct,[],function(t){return null!==t.id()}],"filter-type-in":[Ct,[It(Pt)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[Ct,[It(zt)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[Ct,[Pt,It(zt)],function(t,e){var n=e[0];return e[1].value.indexOf(t.properties()[n.value])>=0}],"filter-in-large":[Ct,[Pt,It(zt)],function(t,e){var n=e[0],i=e[1];return function(t,e,n,i){for(;n<=i;){var r=n+i>>1;if(e[r]===t)return!0;e[r]>t?i=r-1:n=r+1}return!1}(t.properties()[n.value],i.value,0,i.value.length-1)}],all:{type:Ct,overloads:[[[Ct,Ct],function(t,e){var n=e[0],i=e[1];return n.evaluate(t)&&i.evaluate(t)}],[$e(Ct),function(t,e){for(var n=0,i=e;n<i.length;n+=1)if(!i[n].evaluate(t))return!1;return!0}]]},any:{type:Ct,overloads:[[[Ct,Ct],function(t,e){var n=e[0],i=e[1];return n.evaluate(t)||i.evaluate(t)}],[$e(Ct),function(t,e){for(var n=0,i=e;n<i.length;n+=1)if(i[n].evaluate(t))return!0;return!1}]]},"!":[Ct,[Ct],function(t,e){return!e[0].evaluate(t)}],"is-supported-script":[Ct,[Pt],function(t,e){var n=e[0],i=t.globals&&t.globals.isSupportedScript;return!i||i(n.evaluate(t))}],upcase:[Pt,[Pt],function(t,e){return e[0].evaluate(t).toUpperCase()}],downcase:[Pt,[Pt],function(t,e){return e[0].evaluate(t).toLowerCase()}],concat:[Pt,$e(zt),function(t,e){return e.map(function(e){return qt(e.evaluate(t))}).join("")}],"resolved-locale":[Pt,[Lt],function(t,e){return e[0].evaluate(t).resolvedLocale()}]});var dn=function(t,e){var n;this.expression=t,this._warningHistory={},this._evaluator=new Qt,this._defaultValue=e?"color"===(n=e).type&&an(n.default)?new Ft(0,0,0,0):"color"===n.type?Ft.parse(n.default)||null:void 0===n.default?null:n.default:null,this._enumValues=e&&"enum"===e.type?e.values:null};function mn(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in Xe}function yn(t,e){var n=new ae(Xe,[],e?function(t){var e={color:kt,string:Pt,number:St,enum:Pt,boolean:Ct,formatted:Mt};return"array"===t.type?It(e[t.value]||zt,t.length):e[t.type]}(e):void 0),i=n.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return i?Qe(new dn(i,e)):tn(n.errors)}dn.prototype.evaluateWithoutErrorHandling=function(t,e,n){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=n,this.expression.evaluate(this._evaluator)},dn.prototype.evaluate=function(t,e,n){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=n||null;try{var i=this.expression.evaluate(this._evaluator);if(null==i)return this._defaultValue;if(this._enumValues&&!(i in this._enumValues))throw new Wt("Expected value to be one of "+Object.keys(this._enumValues).map(function(t){return JSON.stringify(t)}).join(", ")+", but found "+JSON.stringify(i)+" instead.");return i}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}};var _n=function(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!ie(e.expression)};_n.prototype.evaluateWithoutErrorHandling=function(t,e,n){return this._styleExpression.evaluateWithoutErrorHandling(t,e,n)},_n.prototype.evaluate=function(t,e,n){return this._styleExpression.evaluate(t,e,n)};var gn=function(t,e,n){this.kind=t,this.zoomStops=n.labels,this._styleExpression=e,this.isStateDependent="camera"!==t&&!ie(e.expression),n instanceof ze&&(this._interpolationType=n.interpolation)};function vn(t,e){if("error"===(t=yn(t,e)).result)return t;var n=t.value.expression,i=ne(n);if(!i&&!en(e))return tn([new wt("","data expressions not supported")]);var r=re(n,["zoom"]);if(!r&&!nn(e))return tn([new wt("","zoom expressions not supported")]);var o=function t(e){var n=null;if(e instanceof Ie)n=t(e.result);else if(e instanceof Me)for(var i=0,r=e.args;i<r.length;i+=1){var o=r[i];if(n=t(o))break}else(e instanceof le||e instanceof ze)&&e.input instanceof te&&"zoom"===e.input.name&&(n=e);return n instanceof wt?n:(e.eachChild(function(e){var i=t(e);i instanceof wt?n=i:!n&&i?n=new wt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):n&&i&&n!==i&&(n=new wt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),n)}(n);return o||r?o instanceof wt?tn([o]):o instanceof ze&&!rn(e)?tn([new wt("",'"interpolate" expressions cannot be used with this property')]):Qe(o?new gn(i?"camera":"composite",t.value,o):new _n(i?"constant":"source",t.value)):tn([new wt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}gn.prototype.evaluateWithoutErrorHandling=function(t,e,n){return this._styleExpression.evaluateWithoutErrorHandling(t,e,n)},gn.prototype.evaluate=function(t,e,n){return this._styleExpression.evaluate(t,e,n)},gn.prototype.interpolationFactor=function(t,e,n){return this._interpolationType?ze.interpolationFactor(this._interpolationType,t,e,n):0};var xn=function(t,e){this._parameters=t,this._specification=e,vt(this,function t(e,n){var i,r,o,a="color"===n.type,s=e.stops&&"object"==typeof e.stops[0][0],l=s||void 0!==e.property,u=s||!l,c=e.type||(rn(n)?"exponential":"interval");if(a&&((e=vt({},e)).stops&&(e.stops=e.stops.map(function(t){return[t[0],Ft.parse(t[1])]})),e.default?e.default=Ft.parse(e.default):e.default=Ft.parse(n.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!Ae[e.colorSpace])throw new Error("Unknown color space: "+e.colorSpace);if("exponential"===c)i=pn;else if("interval"===c)i=cn;else if("categorical"===c){i=un,r=Object.create(null);for(var p=0,h=e.stops;p<h.length;p+=1){var f=h[p];r[f[0]]=f[1]}o=typeof e.stops[0][0]}else{if("identity"!==c)throw new Error('Unknown function type "'+c+'"');i=hn}if(s){for(var d={},m=[],y=0;y<e.stops.length;y++){var _=e.stops[y],g=_[0].zoom;void 0===d[g]&&(d[g]={zoom:g,type:e.type,property:e.property,default:e.default,stops:[]},m.push(g)),d[g].stops.push([_[0].value,_[1]])}for(var v=[],x=0,b=m;x<b.length;x+=1){var w=b[x];v.push([d[w].zoom,t(d[w],n)])}return{kind:"composite",interpolationFactor:ze.interpolationFactor.bind(void 0,{name:"linear"}),zoomStops:v.map(function(t){return t[0]}),evaluate:function(t,i){var r=t.zoom;return pn({stops:v,base:e.base},n,r).evaluate(r,i)}}}return u?{kind:"camera",interpolationFactor:"exponential"===c?ze.interpolationFactor.bind(void 0,{name:"exponential",base:void 0!==e.base?e.base:1}):function(){return 0},zoomStops:e.stops.map(function(t){return t[0]}),evaluate:function(t){var a=t.zoom;return i(e,n,a,r,o)}}:{kind:"source",evaluate:function(t,a){var s=a&&a.properties?a.properties[e.property]:void 0;return void 0===s?ln(e.default,n.default):i(e,n,s,r,o)}}}(this._parameters,this._specification))};function bn(t,e){if(an(t))return new xn(t,e);if(mn(t)){var n=vn(t,e);if("error"===n.result)throw new Error(n.value.map(function(t){return t.key+": "+t.message}).join(", "));return n.value}var i=t;return"string"==typeof t&&"color"===e.type&&(i=Ft.parse(t)),{kind:"constant",evaluate:function(){return i}}}function wn(t){var e=t.key,n=t.value,i=t.valueSpec||{},r=t.objectElementValidators||{},o=t.style,a=t.styleSpec,s=[],l=on(n);if("object"!==l)return[new _t(e,n,"object expected, "+l+" found")];for(var u in n){var c=u.split(".")[0],p=i[c]||i["*"],h=void 0;if(r[c])h=r[c];else if(i[c])h=Wn;else if(r["*"])h=r["*"];else{if(!i["*"]){s.push(new _t(e,n[u],'unknown property "'+u+'"'));continue}h=Wn}s=s.concat(h({key:(e?e+".":e)+u,value:n[u],valueSpec:p,style:o,styleSpec:a,object:n,objectKey:u},n))}for(var f in i)r[f]||i[f].required&&void 0===i[f].default&&void 0===n[f]&&s.push(new _t(e,n,'missing required property "'+f+'"'));return s}function En(t){var e=t.value,n=t.valueSpec,i=t.style,r=t.styleSpec,o=t.key,a=t.arrayElementValidator||Wn;if("array"!==on(e))return[new _t(o,e,"array expected, "+on(e)+" found")];if(n.length&&e.length!==n.length)return[new _t(o,e,"array length "+n.length+" expected, length "+e.length+" found")];if(n["min-length"]&&e.length<n["min-length"])return[new _t(o,e,"array length at least "+n["min-length"]+" expected, length "+e.length+" found")];var s={type:n.value};r.$version<7&&(s.function=n.function),"object"===on(n.value)&&(s=n.value);for(var l=[],u=0;u<e.length;u++)l=l.concat(a({array:e,arrayIndex:u,value:e[u],valueSpec:s,style:i,styleSpec:r,key:o+"["+u+"]"}));return l}function Tn(t){var e=t.key,n=t.value,i=t.valueSpec,r=on(n);return"number"!==r?[new _t(e,n,"number expected, "+r+" found")]:"minimum"in i&&n<i.minimum?[new _t(e,n,n+" is less than the minimum value "+i.minimum)]:"maximum"in i&&n>i.maximum?[new _t(e,n,n+" is greater than the maximum value "+i.maximum)]:[]}function Sn(t){var e,n,i,r=t.valueSpec,o=xt(t.value.type),a={},s="categorical"!==o&&void 0===t.value.property,l=!s,u="array"===on(t.value.stops)&&"array"===on(t.value.stops[0])&&"object"===on(t.value.stops[0][0]),c=wn({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===o)return[new _t(t.key,t.value,'identity function may not have a "stops" property')];var e=[],n=t.value;return e=e.concat(En({key:t.key,value:n,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:p})),"array"===on(n)&&0===n.length&&e.push(new _t(t.key,n,"array must have at least one stop")),e},default:function(t){return Wn({key:t.key,value:t.value,valueSpec:r,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===o&&s&&c.push(new _t(t.key,t.value,'missing required property "property"')),"identity"===o||t.value.stops||c.push(new _t(t.key,t.value,'missing required property "stops"')),"exponential"===o&&t.valueSpec.expression&&!rn(t.valueSpec)&&c.push(new _t(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!en(t.valueSpec)?c.push(new _t(t.key,t.value,"property functions not supported")):s&&!nn(t.valueSpec)&&c.push(new _t(t.key,t.value,"zoom functions not supported"))),"categorical"!==o&&!u||void 0!==t.value.property||c.push(new _t(t.key,t.value,'"property" property is required')),c;function p(t){var e=[],o=t.value,s=t.key;if("array"!==on(o))return[new _t(s,o,"array expected, "+on(o)+" found")];if(2!==o.length)return[new _t(s,o,"array length 2 expected, length "+o.length+" found")];if(u){if("object"!==on(o[0]))return[new _t(s,o,"object expected, "+on(o[0])+" found")];if(void 0===o[0].zoom)return[new _t(s,o,"object stop key must have zoom")];if(void 0===o[0].value)return[new _t(s,o,"object stop key must have value")];if(i&&i>xt(o[0].zoom))return[new _t(s,o[0].zoom,"stop zoom values must appear in ascending order")];xt(o[0].zoom)!==i&&(i=xt(o[0].zoom),n=void 0,a={}),e=e.concat(wn({key:s+"[0]",value:o[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:Tn,value:h}}))}else e=e.concat(h({key:s+"[0]",value:o[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},o));return mn(bt(o[1]))?e.concat([new _t(s+"[1]",o[1],"expressions are not allowed in function stops.")]):e.concat(Wn({key:s+"[1]",value:o[1],valueSpec:r,style:t.style,styleSpec:t.styleSpec}))}function h(t,i){var s=on(t.value),l=xt(t.value),u=null!==t.value?t.value:i;if(e){if(s!==e)return[new _t(t.key,u,s+" stop domain type must match previous stop domain type "+e)]}else e=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new _t(t.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==o){var c="number expected, "+s+" found";return en(r)&&void 0===o&&(c+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new _t(t.key,u,c)]}return"categorical"!==o||"number"!==s||isFinite(l)&&Math.floor(l)===l?"categorical"!==o&&"number"===s&&void 0!==n&&l<n?[new _t(t.key,u,"stop domain values must appear in ascending order")]:(n=l,"categorical"===o&&l in a?[new _t(t.key,u,"stop domain values must be unique")]:(a[l]=!0,[])):[new _t(t.key,u,"integer expected, found "+l)]}}function Pn(t){var e=("property"===t.expressionContext?vn:yn)(bt(t.value),t.valueSpec);if("error"===e.result)return e.value.map(function(e){return new _t(""+t.key+e.key,t.value,e.message)});var n=e.value.expression||e.value._styleExpression.expression;if("property"===t.expressionContext&&"text-font"===t.propertyKey&&-1!==n.possibleOutputs().indexOf(void 0))return[new _t(t.key,t.value,'Invalid data expression for "'+t.propertyKey+'". Output values must be contained as literals within the expression.')];if("property"===t.expressionContext&&"layout"===t.propertyType&&!ie(n))return[new _t(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===t.expressionContext&&!ie(n))return[new _t(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&0===t.expressionContext.indexOf("cluster")){if(!re(n,["zoom","feature-state"]))return[new _t(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===t.expressionContext&&!ne(n))return[new _t(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Cn(t){var e=t.key,n=t.value,i=t.valueSpec,r=[];return Array.isArray(i.values)?-1===i.values.indexOf(xt(n))&&r.push(new _t(e,n,"expected one of ["+i.values.join(", ")+"], "+JSON.stringify(n)+" found")):-1===Object.keys(i.values).indexOf(xt(n))&&r.push(new _t(e,n,"expected one of ["+Object.keys(i.values).join(", ")+"], "+JSON.stringify(n)+" found")),r}function kn(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(var e=0,n=t.slice(1);e<n.length;e+=1){var i=n[e];if(!kn(i)&&"boolean"!=typeof i)return!1}return!0;default:return!0}}xn.deserialize=function(t){return new xn(t._parameters,t._specification)},xn.serialize=function(t){return{_parameters:t._parameters,_specification:t._specification}};var An={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function zn(t){if(null==t)return function(){return!0};kn(t)||(t=Mn(t));var e=yn(t,An);if("error"===e.result)throw new Error(e.value.map(function(t){return t.key+": "+t.message}).join(", "));return function(t,n){return e.value.evaluate(t,n)}}function Ln(t,e){return t<e?-1:t>e?1:0}function Mn(t){if(!t)return!0;var e,n=t[0];return t.length<=1?"any"!==n:"=="===n?In(t[1],t[2],"=="):"!="===n?Rn(In(t[1],t[2],"==")):"<"===n||">"===n||"<="===n||">="===n?In(t[1],t[2],n):"any"===n?(e=t.slice(1),["any"].concat(e.map(Mn))):"all"===n?["all"].concat(t.slice(1).map(Mn)):"none"===n?["all"].concat(t.slice(1).map(Mn).map(Rn)):"in"===n?On(t[1],t.slice(2)):"!in"===n?Rn(On(t[1],t.slice(2))):"has"===n?Dn(t[1]):"!has"!==n||Rn(Dn(t[1]))}function In(t,e,n){switch(t){case"$type":return["filter-type-"+n,e];case"$id":return["filter-id-"+n,e];default:return["filter-"+n,t,e]}}function On(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(function(t){return typeof t!=typeof e[0]})?["filter-in-large",t,["literal",e.sort(Ln)]]:["filter-in-small",t,["literal",e]]}}function Dn(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Rn(t){return["!",t]}function Bn(t){return kn(bt(t.value))?Pn(vt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(e){var n=e.value,i=e.key;if("array"!==on(n))return[new _t(i,n,"array expected, "+on(n)+" found")];var r,o=e.styleSpec,a=[];if(n.length<1)return[new _t(i,n,"filter array must have at least 1 element")];switch(a=a.concat(Cn({key:i+"[0]",value:n[0],valueSpec:o.filter_operator,style:e.style,styleSpec:e.styleSpec})),xt(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&"$type"===xt(n[1])&&a.push(new _t(i,n,'"$type" cannot be use with operator "'+n[0]+'"'));case"==":case"!=":3!==n.length&&a.push(new _t(i,n,'filter array for operator "'+n[0]+'" must have 3 elements'));case"in":case"!in":n.length>=2&&"string"!==(r=on(n[1]))&&a.push(new _t(i+"[1]",n[1],"string expected, "+r+" found"));for(var s=2;s<n.length;s++)r=on(n[s]),"$type"===xt(n[1])?a=a.concat(Cn({key:i+"["+s+"]",value:n[s],valueSpec:o.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==r&&"number"!==r&&"boolean"!==r&&a.push(new _t(i+"["+s+"]",n[s],"string, number, or boolean expected, "+r+" found"));break;case"any":case"all":case"none":for(var l=1;l<n.length;l++)a=a.concat(t({key:i+"["+l+"]",value:n[l],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":r=on(n[1]),2!==n.length?a.push(new _t(i,n,'filter array for "'+n[0]+'" operator must have 2 elements')):"string"!==r&&a.push(new _t(i+"[1]",n[1],"string expected, "+r+" found"))}return a}(t)}function Fn(t,e){var n=t.key,i=t.style,r=t.styleSpec,o=t.value,a=t.objectKey,s=r[e+"_"+t.layerType];if(!s)return[];var l=a.match(/^(.*)-transition$/);if("paint"===e&&l&&s[l[1]]&&s[l[1]].transition)return Wn({key:n,value:o,valueSpec:r.transition,style:i,styleSpec:r});var u,c=t.valueSpec||s[a];if(!c)return[new _t(n,o,'unknown property "'+a+'"')];if("string"===on(o)&&en(c)&&!c.tokens&&(u=/^{([^}]+)}$/.exec(o)))return[new _t(n,o,'"'+a+'" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": '+JSON.stringify(u[1])+" }`.")];var p=[];return"symbol"===t.layerType&&("text-field"===a&&i&&!i.glyphs&&p.push(new _t(n,o,'use of "text-field" requires a style "glyphs" property')),"text-font"===a&&an(bt(o))&&"identity"===xt(o.type)&&p.push(new _t(n,o,'"text-font" does not support identity functions'))),p.concat(Wn({key:t.key,value:o,valueSpec:c,style:i,styleSpec:r,expressionContext:"property",propertyType:e,propertyKey:a}))}function Nn(t){return Fn(t,"paint")}function Un(t){return Fn(t,"layout")}function jn(t){var e=[],n=t.value,i=t.key,r=t.style,o=t.styleSpec;n.type||n.ref||e.push(new _t(i,n,'either "type" or "ref" is required'));var a,s=xt(n.type),l=xt(n.ref);if(n.id)for(var u=xt(n.id),c=0;c<t.arrayIndex;c++){var p=r.layers[c];xt(p.id)===u&&e.push(new _t(i,n.id,'duplicate layer id "'+n.id+'", previously used at line '+p.id.__line__))}if("ref"in n)["type","source","source-layer","filter","layout"].forEach(function(t){t in n&&e.push(new _t(i,n[t],'"'+t+'" is prohibited for ref layers'))}),r.layers.forEach(function(t){xt(t.id)===l&&(a=t)}),a?a.ref?e.push(new _t(i,n.ref,"ref cannot reference another ref layer")):s=xt(a.type):e.push(new _t(i,n.ref,'ref layer "'+l+'" not found'));else if("background"!==s)if(n.source){var h=r.sources&&r.sources[n.source],f=h&&xt(h.type);h?"vector"===f&&"raster"===s?e.push(new _t(i,n.source,'layer "'+n.id+'" requires a raster source')):"raster"===f&&"raster"!==s?e.push(new _t(i,n.source,'layer "'+n.id+'" requires a vector source')):"vector"!==f||n["source-layer"]?"raster-dem"===f&&"hillshade"!==s?e.push(new _t(i,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"!==s||!n.paint||!n.paint["line-gradient"]||"geojson"===f&&h.lineMetrics||e.push(new _t(i,n,'layer "'+n.id+'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.')):e.push(new _t(i,n,'layer "'+n.id+'" must specify a "source-layer"')):e.push(new _t(i,n.source,'source "'+n.source+'" not found'))}else e.push(new _t(i,n,'missing required property "source"'));return e=e.concat(wn({key:i,value:n,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(){return[]},type:function(){return Wn({key:i+".type",value:n.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,object:n,objectKey:"type"})},filter:Bn,layout:function(t){return wn({layer:n,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return Un(vt({layerType:s},t))}}})},paint:function(t){return wn({layer:n,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return Nn(vt({layerType:s},t))}}})}}}))}function Vn(t){var e=t.value,n=t.key,i=t.styleSpec,r=t.style;if(!e.type)return[new _t(n,e,'"type" is required')];var o,a=xt(e.type);switch(a){case"vector":case"raster":case"raster-dem":if(o=wn({key:n,value:e,valueSpec:i["source_"+a.replace("-","_")],style:t.style,styleSpec:i}),"url"in e)for(var s in e)["type","url","tileSize"].indexOf(s)<0&&o.push(new _t(n+"."+s,e[s],'a source with a "url" property may not include a "'+s+'" property'));return o;case"geojson":if(o=wn({key:n,value:e,valueSpec:i.source_geojson,style:r,styleSpec:i}),e.cluster)for(var l in e.clusterProperties){var u=e.clusterProperties[l],c=u[0],p=u[1],h="string"==typeof c?[c,["accumulated"],["get",l]]:c;o.push.apply(o,Pn({key:n+"."+l+".map",value:p,expressionContext:"cluster-map"})),o.push.apply(o,Pn({key:n+"."+l+".reduce",value:h,expressionContext:"cluster-reduce"}))}return o;case"video":return wn({key:n,value:e,valueSpec:i.source_video,style:r,styleSpec:i});case"image":return wn({key:n,value:e,valueSpec:i.source_image,style:r,styleSpec:i});case"canvas":return[new _t(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Cn({key:n+".type",value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:r,styleSpec:i})}}function Zn(t){var e=t.value,n=t.styleSpec,i=n.light,r=t.style,o=[],a=on(e);if(void 0===e)return o;if("object"!==a)return o.concat([new _t("light",e,"object expected, "+a+" found")]);for(var s in e){var l=s.match(/^(.*)-transition$/);o=l&&i[l[1]]&&i[l[1]].transition?o.concat(Wn({key:s,value:e[s],valueSpec:n.transition,style:r,styleSpec:n})):i[s]?o.concat(Wn({key:s,value:e[s],valueSpec:i[s],style:r,styleSpec:n})):o.concat([new _t(s,e[s],'unknown property "'+s+'"')])}return o}function qn(t){var e=t.value,n=t.key,i=on(e);return"string"!==i?[new _t(n,e,"string expected, "+i+" found")]:[]}var Gn={"*":function(){return[]},array:En,boolean:function(t){var e=t.value,n=t.key,i=on(e);return"boolean"!==i?[new _t(n,e,"boolean expected, "+i+" found")]:[]},number:Tn,color:function(t){var e=t.key,n=t.value,i=on(n);return"string"!==i?[new _t(e,n,"color expected, "+i+" found")]:null===Bt(n)?[new _t(e,n,'color expected, "'+n+'" found')]:[]},constants:gt,enum:Cn,filter:Bn,function:Sn,layer:jn,object:wn,source:Vn,light:Zn,string:qn,formatted:function(t){return 0===qn(t).length?[]:Pn(t)}};function Wn(t){var e=t.value,n=t.valueSpec,i=t.styleSpec;return n.expression&&an(xt(e))?Sn(t):n.expression&&mn(bt(e))?Pn(t):n.type&&Gn[n.type]?Gn[n.type](t):wn(vt({},t,{valueSpec:n.type?i[n.type]:n}))}function Hn(t){var e=t.value,n=t.key,i=qn(t);return i.length?i:(-1===e.indexOf("{fontstack}")&&i.push(new _t(n,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&i.push(new _t(n,e,'"glyphs" url must include a "{range}" token')),i)}function Xn(t,e){e=e||yt;var n=[];return n=n.concat(Wn({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:Hn,"*":function(){return[]}}})),t.constants&&(n=n.concat(gt({key:"constants",value:t.constants,style:t,styleSpec:e}))),Kn(n)}function Kn(t){return[].concat(t).sort(function(t,e){return t.line-e.line})}function Yn(t){return function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];return Kn(t.apply(this,e))}}Xn.source=Yn(Vn),Xn.light=Yn(Zn),Xn.layer=Yn(jn),Xn.filter=Yn(Bn),Xn.paintProperty=Yn(Nn),Xn.layoutProperty=Yn(Un);var Jn=Xn,$n=Xn.light,Qn=Xn.paintProperty,ti=Xn.layoutProperty;function ei(t,e){var n=!1;if(e&&e.length)for(var i=0,r=e;i<r.length;i+=1){var o=r[i];t.fire(new dt(new Error(o.message))),n=!0}return n}var ni=ri,ii=3;function ri(t,e,n){var i=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var r=new Int32Array(this.arrayBuffer);t=r[0],e=r[1],n=r[2],this.d=e+2*n;for(var o=0;o<this.d*this.d;o++){var a=r[ii+o],s=r[ii+o+1];i.push(a===s?null:r.subarray(a,s))}var l=r[ii+i.length],u=r[ii+i.length+1];this.keys=r.subarray(l,u),this.bboxes=r.subarray(u),this.insert=this._insertReadonly}else{this.d=e+2*n;for(var c=0;c<this.d*this.d;c++)i.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=n,this.scale=e/t,this.uid=0;var p=n/e*t;this.min=-p,this.max=t+p}ri.prototype.insert=function(t,e,n,i,r){this._forEachCell(e,n,i,r,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(n),this.bboxes.push(i),this.bboxes.push(r)},ri.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},ri.prototype._insertCell=function(t,e,n,i,r,o){this.cells[r].push(o)},ri.prototype.query=function(t,e,n,i,r){var o=this.min,a=this.max;if(t<=o&&e<=o&&a<=n&&a<=i&&!r)return Array.prototype.slice.call(this.keys);var s=[];return this._forEachCell(t,e,n,i,this._queryCell,s,{},r),s},ri.prototype._queryCell=function(t,e,n,i,r,o,a,s){var l=this.cells[r];if(null!==l)for(var u=this.keys,c=this.bboxes,p=0;p<l.length;p++){var h=l[p];if(void 0===a[h]){var f=4*h;(s?s(c[f+0],c[f+1],c[f+2],c[f+3]):t<=c[f+2]&&e<=c[f+3]&&n>=c[f+0]&&i>=c[f+1])?(a[h]=!0,o.push(u[h])):a[h]=!1}}},ri.prototype._forEachCell=function(t,e,n,i,r,o,a,s){for(var l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),c=this._convertToCellCoord(n),p=this._convertToCellCoord(i),h=l;h<=c;h++)for(var f=u;f<=p;f++){var d=this.d*f+h;if((!s||s(this._convertFromCellCoord(h),this._convertFromCellCoord(f),this._convertFromCellCoord(h+1),this._convertFromCellCoord(f+1)))&&r.call(this,t,e,n,i,d,o,a,s))return}},ri.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},ri.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},ri.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=ii+this.cells.length+1+1,n=0,i=0;i<this.cells.length;i++)n+=this.cells[i].length;var r=new Int32Array(e+n+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;for(var o=e,a=0;a<t.length;a++){var s=t[a];r[ii+a]=o,r.set(s,o),o+=s.length}return r[ii+t.length]=o,r.set(this.keys,o),o+=this.keys.length,r[ii+t.length+1]=o,r.set(this.bboxes,o),o+=this.bboxes.length,r.buffer};var oi=self.ImageData,ai={};function si(t,e,n){void 0===n&&(n={}),Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),ai[t]={klass:e,omit:n.omit||[],shallow:n.shallow||[]}}for(var li in si("Object",Object),ni.serialize=function(t,e){var n=t.toArrayBuffer();return e&&e.push(n),{buffer:n}},ni.deserialize=function(t){return new ni(t.buffer)},si("Grid",ni),si("Color",Ft),si("Error",Error),si("StylePropertyFunction",xn),si("StyleExpression",dn,{omit:["_evaluator"]}),si("ZoomDependentExpression",gn),si("ZoomConstantExpression",_n),si("CompoundExpression",te,{omit:["_evaluate"]}),Xe)Xe[li]._classRegistryKey||si("Expression_"+li,Xe[li]);function ui(t,e){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp)return t;if(t instanceof ArrayBuffer)return e&&e.push(t),t;if(ArrayBuffer.isView(t)){var n=t;return e&&e.push(n.buffer),n}if(t instanceof oi)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){for(var i=[],r=0,o=t;r<o.length;r+=1){var a=o[r];i.push(ui(a,e))}return i}if("object"==typeof t){var s=t.constructor,l=s._classRegistryKey;if(!l)throw new Error("can't serialize object of unregistered class");var u=s.serialize?s.serialize(t,e):{};if(!s.serialize){for(var c in t)if(t.hasOwnProperty(c)&&!(ai[l].omit.indexOf(c)>=0)){var p=t[c];u[c]=ai[l].shallow.indexOf(c)>=0?p:ui(p,e)}t instanceof Error&&(u.message=t.message)}if(u.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==l&&(u.$name=l),u}throw new Error("can't serialize object of type "+typeof t)}function ci(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof ArrayBuffer||ArrayBuffer.isView(t)||t instanceof oi)return t;if(Array.isArray(t))return t.map(ci);if("object"==typeof t){var e=t.$name||"Object",n=ai[e].klass;if(!n)throw new Error("can't deserialize unregistered class "+e);if(n.deserialize)return n.deserialize(t);for(var i=Object.create(n.prototype),r=0,o=Object.keys(t);r<o.length;r+=1){var a=o[r];if("$name"!==a){var s=t[a];i[a]=ai[e].shallow.indexOf(a)>=0?s:ci(s)}}return i}throw new Error("can't deserialize object of type "+typeof t)}var pi=function(){this.first=!0};pi.prototype.update=function(t,e){var n=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=n,!0))};var hi={"Latin-1 Supplement":function(t){return t>=128&&t<=255},Arabic:function(t){return t>=1536&&t<=1791},"Arabic Supplement":function(t){return t>=1872&&t<=1919},"Arabic Extended-A":function(t){return t>=2208&&t<=2303},"Hangul Jamo":function(t){return t>=4352&&t<=4607},"Unified Canadian Aboriginal Syllabics":function(t){return t>=5120&&t<=5759},Khmer:function(t){return t>=6016&&t<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(t){return t>=6320&&t<=6399},"General Punctuation":function(t){return t>=8192&&t<=8303},"Letterlike Symbols":function(t){return t>=8448&&t<=8527},"Number Forms":function(t){return t>=8528&&t<=8591},"Miscellaneous Technical":function(t){return t>=8960&&t<=9215},"Control Pictures":function(t){return t>=9216&&t<=9279},"Optical Character Recognition":function(t){return t>=9280&&t<=9311},"Enclosed Alphanumerics":function(t){return t>=9312&&t<=9471},"Geometric Shapes":function(t){return t>=9632&&t<=9727},"Miscellaneous Symbols":function(t){return t>=9728&&t<=9983},"Miscellaneous Symbols and Arrows":function(t){return t>=11008&&t<=11263},"CJK Radicals Supplement":function(t){return t>=11904&&t<=12031},"Kangxi Radicals":function(t){return t>=12032&&t<=12255},"Ideographic Description Characters":function(t){return t>=12272&&t<=12287},"CJK Symbols and Punctuation":function(t){return t>=12288&&t<=12351},Hiragana:function(t){return t>=12352&&t<=12447},Katakana:function(t){return t>=12448&&t<=12543},Bopomofo:function(t){return t>=12544&&t<=12591},"Hangul Compatibility Jamo":function(t){return t>=12592&&t<=12687},Kanbun:function(t){return t>=12688&&t<=12703},"Bopomofo Extended":function(t){return t>=12704&&t<=12735},"CJK Strokes":function(t){return t>=12736&&t<=12783},"Katakana Phonetic Extensions":function(t){return t>=12784&&t<=12799},"Enclosed CJK Letters and Months":function(t){return t>=12800&&t<=13055},"CJK Compatibility":function(t){return t>=13056&&t<=13311},"CJK Unified Ideographs Extension A":function(t){return t>=13312&&t<=19903},"Yijing Hexagram Symbols":function(t){return t>=19904&&t<=19967},"CJK Unified Ideographs":function(t){return t>=19968&&t<=40959},"Yi Syllables":function(t){return t>=40960&&t<=42127},"Yi Radicals":function(t){return t>=42128&&t<=42191},"Hangul Jamo Extended-A":function(t){return t>=43360&&t<=43391},"Hangul Syllables":function(t){return t>=44032&&t<=55215},"Hangul Jamo Extended-B":function(t){return t>=55216&&t<=55295},"Private Use Area":function(t){return t>=57344&&t<=63743},"CJK Compatibility Ideographs":function(t){return t>=63744&&t<=64255},"Arabic Presentation Forms-A":function(t){return t>=64336&&t<=65023},"Vertical Forms":function(t){return t>=65040&&t<=65055},"CJK Compatibility Forms":function(t){return t>=65072&&t<=65103},"Small Form Variants":function(t){return t>=65104&&t<=65135},"Arabic Presentation Forms-B":function(t){return t>=65136&&t<=65279},"Halfwidth and Fullwidth Forms":function(t){return t>=65280&&t<=65519}};function fi(t){for(var e=0,n=t;e<n.length;e+=1)if(mi(n[e].charCodeAt(0)))return!0;return!1}function di(t){return!(hi.Arabic(t)||hi["Arabic Supplement"](t)||hi["Arabic Extended-A"](t)||hi["Arabic Presentation Forms-A"](t)||hi["Arabic Presentation Forms-B"](t))}function mi(t){return!(746!==t&&747!==t&&(t<4352||!(hi["Bopomofo Extended"](t)||hi.Bopomofo(t)||hi["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||hi["CJK Compatibility Ideographs"](t)||hi["CJK Compatibility"](t)||hi["CJK Radicals Supplement"](t)||hi["CJK Strokes"](t)||!(!hi["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||hi["CJK Unified Ideographs Extension A"](t)||hi["CJK Unified Ideographs"](t)||hi["Enclosed CJK Letters and Months"](t)||hi["Hangul Compatibility Jamo"](t)||hi["Hangul Jamo Extended-A"](t)||hi["Hangul Jamo Extended-B"](t)||hi["Hangul Jamo"](t)||hi["Hangul Syllables"](t)||hi.Hiragana(t)||hi["Ideographic Description Characters"](t)||hi.Kanbun(t)||hi["Kangxi Radicals"](t)||hi["Katakana Phonetic Extensions"](t)||hi.Katakana(t)&&12540!==t||!(!hi["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!hi["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||hi["Unified Canadian Aboriginal Syllabics"](t)||hi["Unified Canadian Aboriginal Syllabics Extended"](t)||hi["Vertical Forms"](t)||hi["Yijing Hexagram Symbols"](t)||hi["Yi Syllables"](t)||hi["Yi Radicals"](t))))}function yi(t){return!(mi(t)||function(t){return!!(hi["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||hi["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||hi["Letterlike Symbols"](t)||hi["Number Forms"](t)||hi["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||hi["Control Pictures"](t)&&9251!==t||hi["Optical Character Recognition"](t)||hi["Enclosed Alphanumerics"](t)||hi["Geometric Shapes"](t)||hi["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||hi["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||hi["CJK Symbols and Punctuation"](t)||hi.Katakana(t)||hi["Private Use Area"](t)||hi["CJK Compatibility Forms"](t)||hi["Small Form Variants"](t)||hi["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function _i(t,e){return!(!e&&(t>=1424&&t<=2303||hi["Arabic Presentation Forms-A"](t)||hi["Arabic Presentation Forms-B"](t))||t>=2304&&t<=3583||t>=3840&&t<=4255||hi.Khmer(t))}var gi,vi=!1,xi=null,bi=!1,wi=new mt,Ei={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return bi||null!=Ei.applyArabicShaping}},Ti=function(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new pi,this.transition={})};Ti.prototype.isSupportedScript=function(t){return function(t,e){for(var n=0,i=t;n<i.length;n+=1)if(!_i(i[n].charCodeAt(0),e))return!1;return!0}(t,Ei.isLoaded())},Ti.prototype.crossFadingFactor=function(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)},Ti.prototype.getCrossfadeParameters=function(){var t=this.zoom,e=t-Math.floor(t),n=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*e}};var Si=function(t,e){this.property=t,this.value=e,this.expression=bn(void 0===e?t.specification.default:e,t.specification)};Si.prototype.isDataDriven=function(){return"source"===this.expression.kind||"composite"===this.expression.kind},Si.prototype.possiblyEvaluate=function(t){return this.property.possiblyEvaluate(this,t)};var Pi=function(t){this.property=t,this.value=new Si(t,void 0)};Pi.prototype.transitioned=function(t,e){return new ki(this.property,this.value,e,p({},t.transition,this.transition),t.now)},Pi.prototype.untransitioned=function(){return new ki(this.property,this.value,null,{},0)};var Ci=function(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)};Ci.prototype.getValue=function(t){return x(this._values[t].value.value)},Ci.prototype.setValue=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new Pi(this._values[t].property)),this._values[t].value=new Si(this._values[t].property,null===e?void 0:x(e))},Ci.prototype.getTransition=function(t){return x(this._values[t].transition)},Ci.prototype.setTransition=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new Pi(this._values[t].property)),this._values[t].transition=x(e)||void 0},Ci.prototype.serialize=function(){for(var t={},e=0,n=Object.keys(this._values);e<n.length;e+=1){var i=n[e],r=this.getValue(i);void 0!==r&&(t[i]=r);var o=this.getTransition(i);void 0!==o&&(t[i+"-transition"]=o)}return t},Ci.prototype.transitioned=function(t,e){for(var n=new Ai(this._properties),i=0,r=Object.keys(this._values);i<r.length;i+=1){var o=r[i];n._values[o]=this._values[o].transitioned(t,e._values[o])}return n},Ci.prototype.untransitioned=function(){for(var t=new Ai(this._properties),e=0,n=Object.keys(this._values);e<n.length;e+=1){var i=n[e];t._values[i]=this._values[i].untransitioned()}return t};var ki=function(t,e,n,i,r){this.property=t,this.value=e,this.begin=r+i.delay||0,this.end=this.begin+i.duration||0,t.specification.transition&&(i.delay||i.duration)&&(this.prior=n)};ki.prototype.possiblyEvaluate=function(t){var e=t.now||0,n=this.value.possiblyEvaluate(t),i=this.prior;if(i){if(e>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(e<this.begin)return i.possiblyEvaluate(t);var r=(e-this.begin)/(this.end-this.begin);return this.property.interpolate(i.possiblyEvaluate(t),n,function(t){if(r<=0)return 0;if(r>=1)return 1;var e=r*r,n=e*r;return 4*(r<.5?n:3*(r-e)+n-.75)}())}return n};var Ai=function(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)};Ai.prototype.possiblyEvaluate=function(t){for(var e=new Mi(this._properties),n=0,i=Object.keys(this._values);n<i.length;n+=1){var r=i[n];e._values[r]=this._values[r].possiblyEvaluate(t)}return e},Ai.prototype.hasTransition=function(){for(var t=0,e=Object.keys(this._values);t<e.length;t+=1){var n=e[t];if(this._values[n].prior)return!0}return!1};var zi=function(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)};zi.prototype.getValue=function(t){return x(this._values[t].value)},zi.prototype.setValue=function(t,e){this._values[t]=new Si(this._values[t].property,null===e?void 0:x(e))},zi.prototype.serialize=function(){for(var t={},e=0,n=Object.keys(this._values);e<n.length;e+=1){var i=n[e],r=this.getValue(i);void 0!==r&&(t[i]=r)}return t},zi.prototype.possiblyEvaluate=function(t){for(var e=new Mi(this._properties),n=0,i=Object.keys(this._values);n<i.length;n+=1){var r=i[n];e._values[r]=this._values[r].possiblyEvaluate(t)}return e};var Li=function(t,e,n){this.property=t,this.value=e,this.parameters=n};Li.prototype.isConstant=function(){return"constant"===this.value.kind},Li.prototype.constantOr=function(t){return"constant"===this.value.kind?this.value.value:t},Li.prototype.evaluate=function(t,e){return this.property.evaluate(this.value,this.parameters,t,e)};var Mi=function(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)};Mi.prototype.get=function(t){return this._values[t]};var Ii=function(t){this.specification=t};Ii.prototype.possiblyEvaluate=function(t,e){return t.expression.evaluate(e)},Ii.prototype.interpolate=function(t,e,n){var i=ce[this.specification.type];return i?i(t,e,n):t};var Oi=function(t){this.specification=t};Oi.prototype.possiblyEvaluate=function(t,e){return"constant"===t.expression.kind||"camera"===t.expression.kind?new Li(this,{kind:"constant",value:t.expression.evaluate(e)},e):new Li(this,t.expression,e)},Oi.prototype.interpolate=function(t,e,n){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new Li(this,{kind:"constant",value:void 0},t.parameters);var i=ce[this.specification.type];return i?new Li(this,{kind:"constant",value:i(t.value.value,e.value.value,n)},t.parameters):t},Oi.prototype.evaluate=function(t,e,n,i){return"constant"===t.kind?t.value:t.evaluate(e,n,i)};var Di=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.possiblyEvaluate=function(t,e){if(void 0===t.value)return new Li(this,{kind:"constant",value:void 0},e);if("constant"===t.expression.kind){var n=t.expression.evaluate(e),i=this._calculate(n,n,n,e);return new Li(this,{kind:"constant",value:i},e)}if("camera"===t.expression.kind){var r=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new Li(this,{kind:"constant",value:r},e)}return new Li(this,t.expression,e)},e.prototype.evaluate=function(t,e,n,i){if("source"===t.kind){var r=t.evaluate(e,n,i);return this._calculate(r,r,r,e)}return"composite"===t.kind?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},n,i),t.evaluate({zoom:Math.floor(e.zoom)},n,i),t.evaluate({zoom:Math.floor(e.zoom)+1},n,i),e):t.value},e.prototype._calculate=function(t,e,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:n,to:e}},e.prototype.interpolate=function(t){return t},e}(Oi),Ri=function(t){this.specification=t};Ri.prototype.possiblyEvaluate=function(t,e){if(void 0!==t.value){if("constant"===t.expression.kind){var n=t.expression.evaluate(e);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new Ti(Math.floor(e.zoom-1),e)),t.expression.evaluate(new Ti(Math.floor(e.zoom),e)),t.expression.evaluate(new Ti(Math.floor(e.zoom+1),e)),e)}},Ri.prototype._calculate=function(t,e,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:n,to:e}},Ri.prototype.interpolate=function(t){return t};var Bi=function(t){this.specification=t};Bi.prototype.possiblyEvaluate=function(t,e){return!!t.expression.evaluate(e)},Bi.prototype.interpolate=function(){return!1};var Fi=function(t){for(var e in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},t){var n=t[e],i=this.defaultPropertyValues[e]=new Si(n,void 0),r=this.defaultTransitionablePropertyValues[e]=new Pi(n);this.defaultTransitioningPropertyValues[e]=r.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=i.possiblyEvaluate({})}};si("DataDrivenProperty",Oi),si("DataConstantProperty",Ii),si("CrossFadedDataDrivenProperty",Di),si("CrossFadedProperty",Ri),si("ColorRampProperty",Bi);var Ni=function(t){function e(e,n){if(t.call(this),this.id=e.id,this.type=e.type,this.visibility="visible",this._featureFilter=function(){return!0},"custom"!==e.type&&(e=e,this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),n.layout&&(this._unevaluatedLayout=new zi(n.layout)),n.paint)){for(var i in this._transitionablePaint=new Ci(n.paint),e.paint)this.setPaintProperty(i,e.paint[i],{validate:!1});for(var r in e.layout)this.setLayoutProperty(r,e.layout[r],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned()}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCrossfadeParameters=function(){return this._crossfadeParameters},e.prototype.getLayoutProperty=function(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)},e.prototype.setLayoutProperty=function(t,e,n){if(void 0===n&&(n={}),null!=e){var i="layers."+this.id+".layout."+t;if(this._validate(ti,i,t,e,n))return}"visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility="none"===e?e:"visible"},e.prototype.getPaintProperty=function(t){return _(t,"-transition")?this._transitionablePaint.getTransition(t.slice(0,-"-transition".length)):this._transitionablePaint.getValue(t)},e.prototype.setPaintProperty=function(t,e,n){if(void 0===n&&(n={}),null!=e){var i="layers."+this.id+".paint."+t;if(this._validate(Qn,i,t,e,n))return!1}if(_(t,"-transition"))return this._transitionablePaint.setTransition(t.slice(0,-"-transition".length),e||void 0),!1;var r=this._transitionablePaint._values[t],o="cross-faded-data-driven"===r.property.specification["property-type"]&&!r.value.value&&e,a=this._transitionablePaint._values[t].value.isDataDriven();this._transitionablePaint.setValue(t,e);var s=this._transitionablePaint._values[t].value.isDataDriven();return this._handleSpecialPaintPropertyUpdate(t),s||a||o},e.prototype._handleSpecialPaintPropertyUpdate=function(t){},e.prototype.isHidden=function(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility},e.prototype.updateTransitions=function(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)},e.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},e.prototype.recalculate=function(t){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t)),this.paint=this._transitioningPaint.possiblyEvaluate(t)},e.prototype.serialize=function(){var t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return"none"===this.visibility&&(t.layout=t.layout||{},t.layout.visibility="none"),v(t,function(t,e){return!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)})},e.prototype._validate=function(t,e,n,i,r){return void 0===r&&(r={}),(!r||!1!==r.validate)&&ei(this,t.call(Jn,{key:e,layerType:this.type,objectKey:n,value:i,styleSpec:yt,style:{glyphs:!0,sprite:!0}}))},e.prototype.hasOffscreenPass=function(){return!1},e.prototype.resize=function(){},e.prototype.isStateDependent=function(){for(var t in this.paint._values){var e=this.paint.get(t);if(e instanceof Li&&en(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1},e}(mt),Ui={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},ji=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},Vi=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function Zi(t,e){void 0===e&&(e=1);var n=0,i=0;return{members:t.map(function(t){var r,o=(r=t.type,Ui[r].BYTES_PER_ELEMENT),a=n=qi(n,Math.max(e,o)),s=t.components||1;return i=Math.max(i,o),n+=o*s,{name:t.name,type:t.type,components:s,offset:a}}),size:qi(n,Math.max(i,e)),alignment:e}}function qi(t,e){return Math.ceil(t/e)*e}Vi.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},Vi.deserialize=function(t){var e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e},Vi.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},Vi.prototype.clear=function(){this.length=0},Vi.prototype.resize=function(t){this.reserve(t),this.length=t},Vi.prototype.reserve=function(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},Vi.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var Gi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var n=this.length;return this.resize(n+1),this.emplace(n,t,e)},e.prototype.emplace=function(t,e,n){var i=2*t;return this.int16[i+0]=e,this.int16[i+1]=n,t},e}(Vi);Gi.prototype.bytesPerElement=4,si("StructArrayLayout2i4",Gi);var Wi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,i){var r=this.length;return this.resize(r+1),this.emplace(r,t,e,n,i)},e.prototype.emplace=function(t,e,n,i,r){var o=4*t;return this.int16[o+0]=e,this.int16[o+1]=n,this.int16[o+2]=i,this.int16[o+3]=r,t},e}(Vi);Wi.prototype.bytesPerElement=8,si("StructArrayLayout4i8",Wi);var Hi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,i,r,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,n,i,r,o)},e.prototype.emplace=function(t,e,n,i,r,o,a){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=n,this.int16[s+2]=i,this.int16[s+3]=r,this.int16[s+4]=o,this.int16[s+5]=a,t},e}(Vi);Hi.prototype.bytesPerElement=12,si("StructArrayLayout2i4i12",Hi);var Xi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,i,r,o,a,s){var l=this.length;return this.resize(l+1),this.emplace(l,t,e,n,i,r,o,a,s)},e.prototype.emplace=function(t,e,n,i,r,o,a,s,l){var u=6*t,c=12*t;return this.int16[u+0]=e,this.int16[u+1]=n,this.int16[u+2]=i,this.int16[u+3]=r,this.uint8[c+8]=o,this.uint8[c+9]=a,this.uint8[c+10]=s,this.uint8[c+11]=l,t},e}(Vi);Xi.prototype.bytesPerElement=12,si("StructArrayLayout4i4ub12",Xi);var Ki=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,i,r,o,a,s){var l=this.length;return this.resize(l+1),this.emplace(l,t,e,n,i,r,o,a,s)},e.prototype.emplace=function(t,e,n,i,r,o,a,s,l){var u=8*t;return this.uint16[u+0]=e,this.uint16[u+1]=n,this.uint16[u+2]=i,this.uint16[u+3]=r,this.uint16[u+4]=o,this.uint16[u+5]=a,this.uint16[u+6]=s,this.uint16[u+7]=l,t},e}(Vi);Ki.prototype.bytesPerElement=16,si("StructArrayLayout8ui16",Ki);var Yi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,i,r,o,a,s){var l=this.length;return this.resize(l+1),this.emplace(l,t,e,n,i,r,o,a,s)},e.prototype.emplace=function(t,e,n,i,r,o,a,s,l){var u=8*t;return this.int16[u+0]=e,this.int16[u+1]=n,this.int16[u+2]=i,this.int16[u+3]=r,this.uint16[u+4]=o,this.uint16[u+5]=a,this.uint16[u+6]=s,this.uint16[u+7]=l,t},e}(Vi);Yi.prototype.bytesPerElement=16,si("StructArrayLayout4i4ui16",Yi);var Ji=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,n)},e.prototype.emplace=function(t,e,n,i){var r=3*t;return this.float32[r+0]=e,this.float32[r+1]=n,this.float32[r+2]=i,t},e}(Vi);Ji.prototype.bytesPerElement=12,si("StructArrayLayout3f12",Ji);var $i=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){var n=1*t;return this.uint32[n+0]=e,t},e}(Vi);$i.prototype.bytesPerElement=4,si("StructArrayLayout1ul4",$i);var Qi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,i,r,o,a,s,l,u,c){var p=this.length;return this.resize(p+1),this.emplace(p,t,e,n,i,r,o,a,s,l,u,c)},e.prototype.emplace=function(t,e,n,i,r,o,a,s,l,u,c,p){var h=12*t,f=6*t;return this.int16[h+0]=e,this.int16[h+1]=n,this.int16[h+2]=i,this.int16[h+3]=r,this.int16[h+4]=o,this.int16[h+5]=a,this.uint32[f+3]=s,this.uint16[h+8]=l,this.uint16[h+9]=u,this.int16[h+10]=c,this.int16[h+11]=p,t},e}(Vi);Qi.prototype.bytesPerElement=24,si("StructArrayLayout6i1ul2ui2i24",Qi);var tr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,i,r,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,n,i,r,o)},e.prototype.emplace=function(t,e,n,i,r,o,a){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=n,this.int16[s+2]=i,this.int16[s+3]=r,this.int16[s+4]=o,this.int16[s+5]=a,t},e}(Vi);tr.prototype.bytesPerElement=12,si("StructArrayLayout2i2i2i12",tr);var er=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var n=this.length;return this.resize(n+1),this.emplace(n,t,e)},e.prototype.emplace=function(t,e,n){var i=4*t;return this.uint8[i+0]=e,this.uint8[i+1]=n,t},e}(Vi);er.prototype.bytesPerElement=4,si("StructArrayLayout2ub4",er);var nr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,i,r,o,a,s,l,u,c,p,h,f){var d=this.length;return this.resize(d+1),this.emplace(d,t,e,n,i,r,o,a,s,l,u,c,p,h,f)},e.prototype.emplace=function(t,e,n,i,r,o,a,s,l,u,c,p,h,f,d){var m=20*t,y=10*t,_=40*t;return this.int16[m+0]=e,this.int16[m+1]=n,this.uint16[m+2]=i,this.uint16[m+3]=r,this.uint32[y+2]=o,this.uint32[y+3]=a,this.uint32[y+4]=s,this.uint16[m+10]=l,this.uint16[m+11]=u,this.uint16[m+12]=c,this.float32[y+7]=p,this.float32[y+8]=h,this.uint8[_+36]=f,this.uint8[_+37]=d,t},e}(Vi);nr.prototype.bytesPerElement=40,si("StructArrayLayout2i2ui3ul3ui2f2ub40",nr);var ir=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,i,r,o,a,s,l,u,c,p,h,f){var d=this.length;return this.resize(d+1),this.emplace(d,t,e,n,i,r,o,a,s,l,u,c,p,h,f)},e.prototype.emplace=function(t,e,n,i,r,o,a,s,l,u,c,p,h,f,d){var m=16*t,y=8*t;return this.int16[m+0]=e,this.int16[m+1]=n,this.int16[m+2]=i,this.int16[m+3]=r,this.uint16[m+4]=o,this.uint16[m+5]=a,this.uint16[m+6]=s,this.uint16[m+7]=l,this.uint16[m+8]=u,this.uint16[m+9]=c,this.uint16[m+10]=p,this.uint16[m+11]=h,this.uint16[m+12]=f,this.uint32[y+7]=d,t},e}(Vi);ir.prototype.bytesPerElement=32,si("StructArrayLayout4i9ui1ul32",ir);var rr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){var n=1*t;return this.float32[n+0]=e,t},e}(Vi);rr.prototype.bytesPerElement=4,si("StructArrayLayout1f4",rr);var or=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,n)},e.prototype.emplace=function(t,e,n,i){var r=3*t;return this.int16[r+0]=e,this.int16[r+1]=n,this.int16[r+2]=i,t},e}(Vi);or.prototype.bytesPerElement=6,si("StructArrayLayout3i6",or);var ar=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,n)},e.prototype.emplace=function(t,e,n,i){var r=2*t,o=4*t;return this.uint32[r+0]=e,this.uint16[o+2]=n,this.uint16[o+3]=i,t},e}(Vi);ar.prototype.bytesPerElement=8,si("StructArrayLayout1ul2ui8",ar);var sr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,n)},e.prototype.emplace=function(t,e,n,i){var r=3*t;return this.uint16[r+0]=e,this.uint16[r+1]=n,this.uint16[r+2]=i,t},e}(Vi);sr.prototype.bytesPerElement=6,si("StructArrayLayout3ui6",sr);var lr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var n=this.length;return this.resize(n+1),this.emplace(n,t,e)},e.prototype.emplace=function(t,e,n){var i=2*t;return this.uint16[i+0]=e,this.uint16[i+1]=n,t},e}(Vi);lr.prototype.bytesPerElement=4,si("StructArrayLayout2ui4",lr);var ur=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){var n=1*t;return this.uint16[n+0]=e,t},e}(Vi);ur.prototype.bytesPerElement=2,si("StructArrayLayout1ui2",ur);var cr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var n=this.length;return this.resize(n+1),this.emplace(n,t,e)},e.prototype.emplace=function(t,e,n){var i=2*t;return this.float32[i+0]=e,this.float32[i+1]=n,t},e}(Vi);cr.prototype.bytesPerElement=8,si("StructArrayLayout2f8",cr);var pr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,n,i){var r=this.length;return this.resize(r+1),this.emplace(r,t,e,n,i)},e.prototype.emplace=function(t,e,n,i,r){var o=4*t;return this.float32[o+0]=e,this.float32[o+1]=n,this.float32[o+2]=i,this.float32[o+3]=r,t},e}(Vi);pr.prototype.bytesPerElement=16,si("StructArrayLayout4f16",pr);var hr=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},radius:{configurable:!0},signedDistanceFromAnchor:{configurable:!0},anchorPoint:{configurable:!0}};return n.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},n.anchorPointX.set=function(t){this._structArray.int16[this._pos2+0]=t},n.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},n.anchorPointY.set=function(t){this._structArray.int16[this._pos2+1]=t},n.x1.get=function(){return this._structArray.int16[this._pos2+2]},n.x1.set=function(t){this._structArray.int16[this._pos2+2]=t},n.y1.get=function(){return this._structArray.int16[this._pos2+3]},n.y1.set=function(t){this._structArray.int16[this._pos2+3]=t},n.x2.get=function(){return this._structArray.int16[this._pos2+4]},n.x2.set=function(t){this._structArray.int16[this._pos2+4]=t},n.y2.get=function(){return this._structArray.int16[this._pos2+5]},n.y2.set=function(t){this._structArray.int16[this._pos2+5]=t},n.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},n.featureIndex.set=function(t){this._structArray.uint32[this._pos4+3]=t},n.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},n.sourceLayerIndex.set=function(t){this._structArray.uint16[this._pos2+8]=t},n.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},n.bucketIndex.set=function(t){this._structArray.uint16[this._pos2+9]=t},n.radius.get=function(){return this._structArray.int16[this._pos2+10]},n.radius.set=function(t){this._structArray.int16[this._pos2+10]=t},n.signedDistanceFromAnchor.get=function(){return this._structArray.int16[this._pos2+11]},n.signedDistanceFromAnchor.set=function(t){this._structArray.int16[this._pos2+11]=t},n.anchorPoint.get=function(){return new r(this.anchorPointX,this.anchorPointY)},Object.defineProperties(e.prototype,n),e}(ji);hr.prototype.size=24;var fr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return new hr(this,t)},e}(Qi);si("CollisionBoxArray",fr);var dr=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},hidden:{configurable:!0}};return n.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},n.anchorX.set=function(t){this._structArray.int16[this._pos2+0]=t},n.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},n.anchorY.set=function(t){this._structArray.int16[this._pos2+1]=t},n.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},n.glyphStartIndex.set=function(t){this._structArray.uint16[this._pos2+2]=t},n.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},n.numGlyphs.set=function(t){this._structArray.uint16[this._pos2+3]=t},n.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},n.vertexStartIndex.set=function(t){this._structArray.uint32[this._pos4+2]=t},n.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},n.lineStartIndex.set=function(t){this._structArray.uint32[this._pos4+3]=t},n.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},n.lineLength.set=function(t){this._structArray.uint32[this._pos4+4]=t},n.segment.get=function(){return this._structArray.uint16[this._pos2+10]},n.segment.set=function(t){this._structArray.uint16[this._pos2+10]=t},n.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},n.lowerSize.set=function(t){this._structArray.uint16[this._pos2+11]=t},n.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},n.upperSize.set=function(t){this._structArray.uint16[this._pos2+12]=t},n.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},n.lineOffsetX.set=function(t){this._structArray.float32[this._pos4+7]=t},n.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},n.lineOffsetY.set=function(t){this._structArray.float32[this._pos4+8]=t},n.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},n.writingMode.set=function(t){this._structArray.uint8[this._pos1+36]=t},n.hidden.get=function(){return this._structArray.uint8[this._pos1+37]},n.hidden.set=function(t){this._structArray.uint8[this._pos1+37]=t},Object.defineProperties(e.prototype,n),e}(ji);dr.prototype.size=40;var mr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return new dr(this,t)},e}(nr);si("PlacedSymbolArray",mr);var yr=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={anchorX:{configurable:!0},anchorY:{configurable:!0},horizontalPlacedTextSymbolIndex:{configurable:!0},verticalPlacedTextSymbolIndex:{configurable:!0},key:{configurable:!0},textBoxStartIndex:{configurable:!0},textBoxEndIndex:{configurable:!0},iconBoxStartIndex:{configurable:!0},iconBoxEndIndex:{configurable:!0},featureIndex:{configurable:!0},numGlyphVertices:{configurable:!0},numVerticalGlyphVertices:{configurable:!0},numIconVertices:{configurable:!0},crossTileID:{configurable:!0}};return n.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},n.anchorX.set=function(t){this._structArray.int16[this._pos2+0]=t},n.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},n.anchorY.set=function(t){this._structArray.int16[this._pos2+1]=t},n.horizontalPlacedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+2]},n.horizontalPlacedTextSymbolIndex.set=function(t){this._structArray.int16[this._pos2+2]=t},n.verticalPlacedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+3]},n.verticalPlacedTextSymbolIndex.set=function(t){this._structArray.int16[this._pos2+3]=t},n.key.get=function(){return this._structArray.uint16[this._pos2+4]},n.key.set=function(t){this._structArray.uint16[this._pos2+4]=t},n.textBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+5]},n.textBoxStartIndex.set=function(t){this._structArray.uint16[this._pos2+5]=t},n.textBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+6]},n.textBoxEndIndex.set=function(t){this._structArray.uint16[this._pos2+6]=t},n.iconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+7]},n.iconBoxStartIndex.set=function(t){this._structArray.uint16[this._pos2+7]=t},n.iconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+8]},n.iconBoxEndIndex.set=function(t){this._structArray.uint16[this._pos2+8]=t},n.featureIndex.get=function(){return this._structArray.uint16[this._pos2+9]},n.featureIndex.set=function(t){this._structArray.uint16[this._pos2+9]=t},n.numGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+10]},n.numGlyphVertices.set=function(t){this._structArray.uint16[this._pos2+10]=t},n.numVerticalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+11]},n.numVerticalGlyphVertices.set=function(t){this._structArray.uint16[this._pos2+11]=t},n.numIconVertices.get=function(){return this._structArray.uint16[this._pos2+12]},n.numIconVertices.set=function(t){this._structArray.uint16[this._pos2+12]=t},n.crossTileID.get=function(){return this._structArray.uint32[this._pos4+7]},n.crossTileID.set=function(t){this._structArray.uint32[this._pos4+7]=t},Object.defineProperties(e.prototype,n),e}(ji);yr.prototype.size=32;var _r=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return new yr(this,t)},e}(ir);si("SymbolInstanceArray",_r);var gr=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={offsetX:{configurable:!0}};return n.offsetX.get=function(){return this._structArray.float32[this._pos4+0]},n.offsetX.set=function(t){this._structArray.float32[this._pos4+0]=t},Object.defineProperties(e.prototype,n),e}(ji);gr.prototype.size=4;var vr=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getoffsetX=function(t){return this.float32[1*t+0]},e.prototype.get=function(t){return new gr(this,t)},e}(rr);si("GlyphOffsetArray",vr);var xr=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={x:{configurable:!0},y:{configurable:!0},tileUnitDistanceFromAnchor:{configurable:!0}};return n.x.get=function(){return this._structArray.int16[this._pos2+0]},n.x.set=function(t){this._structArray.int16[this._pos2+0]=t},n.y.get=function(){return this._structArray.int16[this._pos2+1]},n.y.set=function(t){this._structArray.int16[this._pos2+1]=t},n.tileUnitDistanceFromAnchor.get=function(){return this._structArray.int16[this._pos2+2]},n.tileUnitDistanceFromAnchor.set=function(t){this._structArray.int16[this._pos2+2]=t},Object.defineProperties(e.prototype,n),e}(ji);xr.prototype.size=6;var br=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getx=function(t){return this.int16[3*t+0]},e.prototype.gety=function(t){return this.int16[3*t+1]},e.prototype.gettileUnitDistanceFromAnchor=function(t){return this.int16[3*t+2]},e.prototype.get=function(t){return new xr(this,t)},e}(or);si("SymbolLineVertexArray",br);var wr=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return n.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},n.featureIndex.set=function(t){this._structArray.uint32[this._pos4+0]=t},n.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},n.sourceLayerIndex.set=function(t){this._structArray.uint16[this._pos2+2]=t},n.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},n.bucketIndex.set=function(t){this._structArray.uint16[this._pos2+3]=t},Object.defineProperties(e.prototype,n),e}(ji);wr.prototype.size=8;var Er=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return new wr(this,t)},e}(ar);si("FeatureIndexArray",Er);var Tr=Zi([{name:"a_pos",components:2,type:"Int16"}],4),Sr=Tr.members,Pr=(Tr.size,Tr.alignment,function(t){void 0===t&&(t=[]),this.segments=t});function Cr(t,e){return 256*(t=u(Math.floor(t),0,255))+u(Math.floor(e),0,255)}Pr.prototype.prepareSegment=function(t,e,n,i){var r=this.segments[this.segments.length-1];return t>Pr.MAX_VERTEX_ARRAY_LENGTH&&w("Max vertices per segment is "+Pr.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!r||r.vertexLength+t>Pr.MAX_VERTEX_ARRAY_LENGTH||r.sortKey!==i)&&(r={vertexOffset:e.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},void 0!==i&&(r.sortKey=i),this.segments.push(r)),r},Pr.prototype.get=function(){return this.segments},Pr.prototype.destroy=function(){for(var t=0,e=this.segments;t<e.length;t+=1){var n=e[t];for(var i in n.vaos)n.vaos[i].destroy()}},Pr.simpleSegment=function(t,e,n,i){return new Pr([{vertexOffset:t,primitiveOffset:e,vertexLength:n,primitiveLength:i,vaos:{},sortKey:0}])},Pr.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,si("SegmentVector",Pr);var kr=function(){this.ids=[],this.positions=[],this.indexed=!1};function Ar(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}kr.prototype.add=function(t,e,n,i){this.ids.push(t),this.positions.push(e,n,i)},kr.prototype.getPositions=function(t){for(var e=0,n=this.ids.length-1;e<n;){var i=e+n>>1;this.ids[i]>=t?n=i:e=i+1}for(var r=[];this.ids[e]===t;){var o=this.positions[3*e],a=this.positions[3*e+1],s=this.positions[3*e+2];r.push({index:o,start:a,end:s}),e++}return r},kr.serialize=function(t,e){var n=new Float64Array(t.ids),i=new Uint32Array(t.positions);return function t(e,n,i,r){if(!(i>=r)){for(var o=e[i+r>>1],a=i-1,s=r+1;;){do{a++}while(e[a]<o);do{s--}while(e[s]>o);if(a>=s)break;Ar(e,a,s),Ar(n,3*a,3*s),Ar(n,3*a+1,3*s+1),Ar(n,3*a+2,3*s+2)}t(e,n,i,s),t(e,n,s+1,r)}}(n,i,0,n.length-1),e.push(n.buffer,i.buffer),{ids:n,positions:i}},kr.deserialize=function(t){var e=new kr;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e},si("FeaturePositionMap",kr);var zr=function(t,e){this.gl=t.gl,this.location=e},Lr=function(t){function e(e,n){t.call(this,e,n),this.current=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.set=function(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))},e}(zr),Mr=function(t){function e(e,n){t.call(this,e,n),this.current=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.set=function(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))},e}(zr),Ir=function(t){function e(e,n){t.call(this,e,n),this.current=[0,0]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.set=function(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))},e}(zr),Or=function(t){function e(e,n){t.call(this,e,n),this.current=[0,0,0]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.set=function(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))},e}(zr),Dr=function(t){function e(e,n){t.call(this,e,n),this.current=[0,0,0,0]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.set=function(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))},e}(zr),Rr=function(t){function e(e,n){t.call(this,e,n),this.current=Ft.transparent}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.set=function(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))},e}(zr),Br=new Float32Array(16),Fr=function(t){function e(e,n){t.call(this,e,n),this.current=Br}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.set=function(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(var e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}},e}(zr);function Nr(t){return[Cr(255*t.r,255*t.g),Cr(255*t.b,255*t.a)]}var Ur=function(t,e,n){this.value=t,this.names=e,this.uniformNames=this.names.map(function(t){return"u_"+t}),this.type=n,this.maxValue=-1/0};Ur.prototype.defines=function(){return this.names.map(function(t){return"#define HAS_UNIFORM_u_"+t})},Ur.prototype.setConstantPatternPositions=function(){},Ur.prototype.populatePaintArray=function(){},Ur.prototype.updatePaintArray=function(){},Ur.prototype.upload=function(){},Ur.prototype.destroy=function(){},Ur.prototype.setUniforms=function(t,e,n,i){e.set(i.constantOr(this.value))},Ur.prototype.getBinding=function(t,e){return"color"===this.type?new Rr(t,e):new Mr(t,e)},Ur.serialize=function(t){var e=t.value,n=t.names,i=t.type;return{value:ui(e),names:n,type:i}},Ur.deserialize=function(t){var e=t.value,n=t.names,i=t.type;return new Ur(ci(e),n,i)};var jr=function(t,e,n){this.value=t,this.names=e,this.uniformNames=this.names.map(function(t){return"u_"+t}),this.type=n,this.maxValue=-1/0,this.patternPositions={patternTo:null,patternFrom:null}};jr.prototype.defines=function(){return this.names.map(function(t){return"#define HAS_UNIFORM_u_"+t})},jr.prototype.populatePaintArray=function(){},jr.prototype.updatePaintArray=function(){},jr.prototype.upload=function(){},jr.prototype.destroy=function(){},jr.prototype.setConstantPatternPositions=function(t,e){this.patternPositions.patternTo=t.tlbr,this.patternPositions.patternFrom=e.tlbr},jr.prototype.setUniforms=function(t,e,n,i,r){var o=this.patternPositions;"u_pattern_to"===r&&o.patternTo&&e.set(o.patternTo),"u_pattern_from"===r&&o.patternFrom&&e.set(o.patternFrom)},jr.prototype.getBinding=function(t,e){return new Dr(t,e)};var Vr=function(t,e,n,i){this.expression=t,this.names=e,this.type=n,this.uniformNames=this.names.map(function(t){return"a_"+t}),this.maxValue=-1/0,this.paintVertexAttributes=e.map(function(t){return{name:"a_"+t,type:"Float32",components:"color"===n?2:1,offset:0}}),this.paintVertexArray=new i};Vr.prototype.defines=function(){return[]},Vr.prototype.setConstantPatternPositions=function(){},Vr.prototype.populatePaintArray=function(t,e){var n=this.paintVertexArray,i=n.length;n.reserve(t);var r=this.expression.evaluate(new Ti(0),e,{});if("color"===this.type)for(var o=Nr(r),a=i;a<t;a++)n.emplaceBack(o[0],o[1]);else{for(var s=i;s<t;s++)n.emplaceBack(r);this.maxValue=Math.max(this.maxValue,r)}},Vr.prototype.updatePaintArray=function(t,e,n,i){var r=this.paintVertexArray,o=this.expression.evaluate({zoom:0},n,i);if("color"===this.type)for(var a=Nr(o),s=t;s<e;s++)r.emplace(s,a[0],a[1]);else{for(var l=t;l<e;l++)r.emplace(l,o);this.maxValue=Math.max(this.maxValue,o)}},Vr.prototype.upload=function(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))},Vr.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()},Vr.prototype.setUniforms=function(t,e){e.set(0)},Vr.prototype.getBinding=function(t,e){return new Mr(t,e)};var Zr=function(t,e,n,i,r,o){this.expression=t,this.names=e,this.uniformNames=this.names.map(function(t){return"a_"+t+"_t"}),this.type=n,this.useIntegerZoom=i,this.zoom=r,this.maxValue=-1/0;var a=o;this.paintVertexAttributes=e.map(function(t){return{name:"a_"+t,type:"Float32",components:"color"===n?4:2,offset:0}}),this.paintVertexArray=new a};Zr.prototype.defines=function(){return[]},Zr.prototype.setConstantPatternPositions=function(){},Zr.prototype.populatePaintArray=function(t,e){var n=this.paintVertexArray,i=n.length;n.reserve(t);var r=this.expression.evaluate(new Ti(this.zoom),e,{}),o=this.expression.evaluate(new Ti(this.zoom+1),e,{});if("color"===this.type)for(var a=Nr(r),s=Nr(o),l=i;l<t;l++)n.emplaceBack(a[0],a[1],s[0],s[1]);else{for(var u=i;u<t;u++)n.emplaceBack(r,o);this.maxValue=Math.max(this.maxValue,r,o)}},Zr.prototype.updatePaintArray=function(t,e,n,i){var r=this.paintVertexArray,o=this.expression.evaluate({zoom:this.zoom},n,i),a=this.expression.evaluate({zoom:this.zoom+1},n,i);if("color"===this.type)for(var s=Nr(o),l=Nr(a),u=t;u<e;u++)r.emplace(u,s[0],s[1],l[0],l[1]);else{for(var c=t;c<e;c++)r.emplace(c,o,a);this.maxValue=Math.max(this.maxValue,o,a)}},Zr.prototype.upload=function(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))},Zr.prototype.destroy=function(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()},Zr.prototype.interpolationFactor=function(t){return this.useIntegerZoom?this.expression.interpolationFactor(Math.floor(t),this.zoom,this.zoom+1):this.expression.interpolationFactor(t,this.zoom,this.zoom+1)},Zr.prototype.setUniforms=function(t,e,n){e.set(this.interpolationFactor(n.zoom))},Zr.prototype.getBinding=function(t,e){return new Mr(t,e)};var qr=function(t,e,n,i,r,o,a){this.expression=t,this.names=e,this.type=n,this.uniformNames=this.names.map(function(t){return"a_"+t+"_t"}),this.useIntegerZoom=i,this.zoom=r,this.maxValue=-1/0,this.layerId=a,this.paintVertexAttributes=e.map(function(t){return{name:"a_"+t,type:"Uint16",components:4,offset:0}}),this.zoomInPaintVertexArray=new o,this.zoomOutPaintVertexArray=new o};qr.prototype.defines=function(){return[]},qr.prototype.setConstantPatternPositions=function(){},qr.prototype.populatePaintArray=function(t,e,n){var i=this.zoomInPaintVertexArray,r=this.zoomOutPaintVertexArray,o=this.layerId,a=i.length;if(i.reserve(t),r.reserve(t),n&&e.patterns&&e.patterns[o]){var s=e.patterns[o],l=s.min,u=s.mid,c=s.max,p=n[l],h=n[u],f=n[c];if(!p||!h||!f)return;for(var d=a;d<t;d++)i.emplaceBack(h.tl[0],h.tl[1],h.br[0],h.br[1],p.tl[0],p.tl[1],p.br[0],p.br[1]),r.emplaceBack(h.tl[0],h.tl[1],h.br[0],h.br[1],f.tl[0],f.tl[1],f.br[0],f.br[1])}},qr.prototype.updatePaintArray=function(t,e,n,i,r){var o=this.zoomInPaintVertexArray,a=this.zoomOutPaintVertexArray,s=this.layerId;if(r&&n.patterns&&n.patterns[s]){var l=n.patterns[s],u=l.min,c=l.mid,p=l.max,h=r[u],f=r[c],d=r[p];if(!h||!f||!d)return;for(var m=t;m<e;m++)o.emplace(m,f.tl[0],f.tl[1],f.br[0],f.br[1],h.tl[0],h.tl[1],h.br[0],h.br[1]),a.emplace(m,f.tl[0],f.tl[1],f.br[0],f.br[1],d.tl[0],d.tl[1],d.br[0],d.br[1])}},qr.prototype.upload=function(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))},qr.prototype.destroy=function(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()},qr.prototype.setUniforms=function(t,e){e.set(0)},qr.prototype.getBinding=function(t,e){return new Mr(t,e)};var Gr=function(){this.binders={},this.cacheKey="",this._buffers=[],this._featureMap=new kr,this._bufferOffset=0};Gr.createDynamic=function(t,e,n){var i=new Gr,r=[];for(var o in t.paint._values)if(n(o)){var a=t.paint.get(o);if(a instanceof Li&&en(a.property.specification)){var s=Hr(o,t.type),l=a.property.specification.type,u=a.property.useIntegerZoom;if("cross-faded"===a.property.specification["property-type"]||"cross-faded-data-driven"===a.property.specification["property-type"])if("constant"===a.value.kind)i.binders[o]=new jr(a.value.value,s,l),r.push("/u_"+o);else{var c=Xr(o,l,"source");i.binders[o]=new qr(a.value,s,l,u,e,c,t.id),r.push("/a_"+o)}else if("constant"===a.value.kind)i.binders[o]=new Ur(a.value.value,s,l),r.push("/u_"+o);else if("source"===a.value.kind){var p=Xr(o,l,"source");i.binders[o]=new Vr(a.value,s,l,p),r.push("/a_"+o)}else{var h=Xr(o,l,"composite");i.binders[o]=new Zr(a.value,s,l,u,e,h),r.push("/z_"+o)}}}return i.cacheKey=r.sort().join(""),i},Gr.prototype.populatePaintArrays=function(t,e,n,i){for(var r in this.binders)this.binders[r].populatePaintArray(t,e,i);void 0!==e.id&&this._featureMap.add(+e.id,n,this._bufferOffset,t),this._bufferOffset=t},Gr.prototype.setConstantPatternPositions=function(t,e){for(var n in this.binders)this.binders[n].setConstantPatternPositions(t,e)},Gr.prototype.updatePaintArrays=function(t,e,n,i){var r=!1;for(var o in t)for(var a=0,s=this._featureMap.getPositions(+o);a<s.length;a+=1){var l=s[a],u=e.feature(l.index);for(var c in this.binders){var p=this.binders[c];if(!(p instanceof Ur||p instanceof jr)&&!0===p.expression.isStateDependent){var h=n.paint.get(c);p.expression=h.value,p.updatePaintArray(l.start,l.end,u,t[o],i),r=!0}}}return r},Gr.prototype.defines=function(){var t=[];for(var e in this.binders)t.push.apply(t,this.binders[e].defines());return t},Gr.prototype.getPaintVertexBuffers=function(){return this._buffers},Gr.prototype.getUniforms=function(t,e){var n={};for(var i in this.binders)for(var r=this.binders[i],o=0,a=r.uniformNames;o<a.length;o+=1){var s=a[o];n[s]=r.getBinding(t,e[s])}return n},Gr.prototype.setUniforms=function(t,e,n,i){for(var r in this.binders)for(var o=this.binders[r],a=0,s=o.uniformNames;a<s.length;a+=1){var l=s[a];o.setUniforms(t,e[l],i,n.get(r),l)}},Gr.prototype.updatePatternPaintBuffers=function(t){var e=[];for(var n in this.binders){var i=this.binders[n];if(i instanceof qr){var r=2===t.fromScale?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;r&&e.push(r)}else(i instanceof Vr||i instanceof Zr)&&i.paintVertexBuffer&&e.push(i.paintVertexBuffer)}this._buffers=e},Gr.prototype.upload=function(t){for(var e in this.binders)this.binders[e].upload(t);var n=[];for(var i in this.binders){var r=this.binders[i];(r instanceof Vr||r instanceof Zr)&&r.paintVertexBuffer&&n.push(r.paintVertexBuffer)}this._buffers=n},Gr.prototype.destroy=function(){for(var t in this.binders)this.binders[t].destroy()};var Wr=function(t,e,n,i){void 0===i&&(i=function(){return!0}),this.programConfigurations={};for(var r=0,o=e;r<o.length;r+=1){var a=o[r];this.programConfigurations[a.id]=Gr.createDynamic(a,n,i),this.programConfigurations[a.id].layoutAttributes=t}this.needsUpload=!1};function Hr(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from"],"fill-pattern":["pattern_to","pattern_from"],"fill-extrusion-pattern":["pattern_to","pattern_from"]}[t]||[t.replace(e+"-","").replace(/-/g,"_")]}function Xr(t,e,n){var i={color:{source:cr,composite:pr},number:{source:rr,composite:cr}},r=function(t){return{"line-pattern":{source:Ki,composite:Ki},"fill-pattern":{source:Ki,composite:Ki},"fill-extrusion-pattern":{source:Ki,composite:Ki}}[t]}(t);return r&&r[n]||i[e][n]}Wr.prototype.populatePaintArrays=function(t,e,n,i){for(var r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(t,e,n,i);this.needsUpload=!0},Wr.prototype.updatePaintArrays=function(t,e,n,i){for(var r=0,o=n;r<o.length;r+=1){var a=o[r];this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(t,e,a,i)||this.needsUpload}},Wr.prototype.get=function(t){return this.programConfigurations[t]},Wr.prototype.upload=function(t){if(this.needsUpload){for(var e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}},Wr.prototype.destroy=function(){for(var t in this.programConfigurations)this.programConfigurations[t].destroy()},si("ConstantBinder",Ur),si("CrossFadedConstantBinder",jr),si("SourceExpressionBinder",Vr),si("CrossFadedCompositeBinder",qr),si("CompositeExpressionBinder",Zr),si("ProgramConfiguration",Gr,{omit:["_buffers"]}),si("ProgramConfigurationSet",Wr);var Kr=8192,Yr={min:-1*Math.pow(2,15),max:Math.pow(2,15)-1};function Jr(t){for(var e=Kr/t.extent,n=t.loadGeometry(),i=0;i<n.length;i++)for(var r=n[i],o=0;o<r.length;o++){var a=r[o];a.x=Math.round(a.x*e),a.y=Math.round(a.y*e),(a.x<Yr.min||a.x>Yr.max||a.y<Yr.min||a.y>Yr.max)&&w("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return n}function $r(t,e,n,i,r){t.emplaceBack(2*e+(i+1)/2,2*n+(r+1)/2)}var Qr=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Gi,this.indexArray=new sr,this.segments=new Pr,this.programConfigurations=new Wr(Sr,t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(function(t){return t.isStateDependent()}).map(function(t){return t.id})};function to(t,e){for(var n=0;n<t.length;n++)if(uo(e,t[n]))return!0;for(var i=0;i<e.length;i++)if(uo(t,e[i]))return!0;return!!ro(t,e)}function eo(t,e,n){return!!uo(t,e)||!!ao(e,t,n)}function no(t,e){if(1===t.length)return lo(e,t[0]);for(var n=0;n<e.length;n++)for(var i=e[n],r=0;r<i.length;r++)if(uo(t,i[r]))return!0;for(var o=0;o<t.length;o++)if(lo(e,t[o]))return!0;for(var a=0;a<e.length;a++)if(ro(t,e[a]))return!0;return!1}function io(t,e,n){if(t.length>1){if(ro(t,e))return!0;for(var i=0;i<e.length;i++)if(ao(e[i],t,n))return!0}for(var r=0;r<t.length;r++)if(ao(t[r],e,n))return!0;return!1}function ro(t,e){if(0===t.length||0===e.length)return!1;for(var n=0;n<t.length-1;n++)for(var i=t[n],r=t[n+1],o=0;o<e.length-1;o++)if(oo(i,r,e[o],e[o+1]))return!0;return!1}function oo(t,e,n,i){return E(t,n,i)!==E(e,n,i)&&E(t,e,n)!==E(t,e,i)}function ao(t,e,n){var i=n*n;if(1===e.length)return t.distSqr(e[0])<i;for(var r=1;r<e.length;r++)if(so(t,e[r-1],e[r])<i)return!0;return!1}function so(t,e,n){var i=e.distSqr(n);if(0===i)return t.distSqr(e);var r=((t.x-e.x)*(n.x-e.x)+(t.y-e.y)*(n.y-e.y))/i;return r<0?t.distSqr(e):r>1?t.distSqr(n):t.distSqr(n.sub(e)._mult(r)._add(e))}function lo(t,e){for(var n,i,r,o=!1,a=0;a<t.length;a++)for(var s=0,l=(n=t[a]).length-1;s<n.length;l=s++)i=n[s],r=n[l],i.y>e.y!=r.y>e.y&&e.x<(r.x-i.x)*(e.y-i.y)/(r.y-i.y)+i.x&&(o=!o);return o}function uo(t,e){for(var n=!1,i=0,r=t.length-1;i<t.length;r=i++){var o=t[i],a=t[r];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(n=!n)}return n}function co(t,e,n){var i=n[0],r=n[2];if(t.x<i.x&&e.x<i.x||t.x>r.x&&e.x>r.x||t.y<i.y&&e.y<i.y||t.y>r.y&&e.y>r.y)return!1;var o=E(t,e,n[0]);return o!==E(t,e,n[1])||o!==E(t,e,n[2])||o!==E(t,e,n[3])}function po(t,e,n){var i=e.paint.get(t).value;return"constant"===i.kind?i.value:n.programConfigurations.get(e.id).binders[t].maxValue}function ho(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function fo(t,e,n,i,o){if(!e[0]&&!e[1])return t;var a=r.convert(e)._mult(o);"viewport"===n&&a._rotate(-i);for(var s=[],l=0;l<t.length;l++){var u=t[l];s.push(u.sub(a))}return s}Qr.prototype.populate=function(t,e){for(var n=0,i=t;n<i.length;n+=1){var r=i[n],o=r.feature,a=r.index,s=r.sourceLayerIndex;if(this.layers[0]._featureFilter(new Ti(this.zoom),o)){var l=Jr(o);this.addFeature(o,l,a),e.featureIndex.insert(o,l,a,s,this.index)}}},Qr.prototype.update=function(t,e,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,n)},Qr.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},Qr.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Qr.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Sr),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},Qr.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},Qr.prototype.addFeature=function(t,e,n){for(var i=0,r=e;i<r.length;i+=1)for(var o=0,a=r[i];o<a.length;o+=1){var s=a[o],l=s.x,u=s.y;if(!(l<0||l>=Kr||u<0||u>=Kr)){var c=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray),p=c.vertexLength;$r(this.layoutVertexArray,l,u,-1,-1),$r(this.layoutVertexArray,l,u,1,-1),$r(this.layoutVertexArray,l,u,1,1),$r(this.layoutVertexArray,l,u,-1,1),this.indexArray.emplaceBack(p,p+1,p+2),this.indexArray.emplaceBack(p,p+3,p+2),c.vertexLength+=4,c.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,{})},si("CircleBucket",Qr,{omit:["layers"]});var mo={paint:new Fi({"circle-radius":new Oi(yt.paint_circle["circle-radius"]),"circle-color":new Oi(yt.paint_circle["circle-color"]),"circle-blur":new Oi(yt.paint_circle["circle-blur"]),"circle-opacity":new Oi(yt.paint_circle["circle-opacity"]),"circle-translate":new Ii(yt.paint_circle["circle-translate"]),"circle-translate-anchor":new Ii(yt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ii(yt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ii(yt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Oi(yt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Oi(yt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Oi(yt.paint_circle["circle-stroke-opacity"])})},yo="undefined"!=typeof Float32Array?Float32Array:Array;function _o(){var t=new yo(9);return yo!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function go(){var t=new yo(3);return yo!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function vo(t,e,n){var i=new yo(3);return i[0]=t,i[1]=e,i[2]=n,i}function xo(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[3];return t[0]=n[0]*i+n[4]*r+n[8]*o+n[12]*a,t[1]=n[1]*i+n[5]*r+n[9]*o+n[13]*a,t[2]=n[2]*i+n[6]*r+n[10]*o+n[14]*a,t[3]=n[3]*i+n[7]*r+n[11]*o+n[15]*a,t}function bo(){var t=new yo(4);return yo!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}Math.PI,go(),function(){var t;t=new yo(4),yo!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}(),go(),vo(1,0,0),vo(0,1,0),bo(),bo(),_o(),function(){var t;t=new yo(2),yo!=Float32Array&&(t[0]=0,t[1]=0)}();var wo=function(t){function e(e){t.call(this,e,mo)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createBucket=function(t){return new Qr(t)},e.prototype.queryRadius=function(t){var e=t;return po("circle-radius",this,e)+po("circle-stroke-width",this,e)+ho(this.paint.get("circle-translate"))},e.prototype.queryIntersectsFeature=function(t,e,n,i,r,o,a,s){for(var l=fo(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,a),u=this.paint.get("circle-radius").evaluate(e,n)+this.paint.get("circle-stroke-width").evaluate(e,n),c="map"===this.paint.get("circle-pitch-alignment"),p=c?l:function(t,e){return l.map(function(t){return Eo(t,e)})}(0,s),h=c?u*a:u,f=0,d=i;f<d.length;f+=1)for(var m=0,y=d[f];m<y.length;m+=1){var _=y[m],g=c?_:Eo(_,s),v=h,x=xo([],[_.x,_.y,0,1],s);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?v*=x[3]/o.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(v*=o.cameraToCenterDistance/x[3]),eo(p,g,v))return!0}return!1},e}(Ni);function Eo(t,e){var n=xo([],[t.x,t.y,0,1],e);return new r(n[0]/n[3],n[1]/n[3])}var To=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Qr);function So(t,e,n,i){var r=e.width,o=e.height;if(i){if(i.length!==r*o*n)throw new RangeError("mismatched image size")}else i=new Uint8Array(r*o*n);return t.width=r,t.height=o,t.data=i,t}function Po(t,e,n){var i=e.width,r=e.height;if(i!==t.width||r!==t.height){var o=So({},{width:i,height:r},n);Co(t,o,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,i),height:Math.min(t.height,r)},n),t.width=i,t.height=r,t.data=o.data}}function Co(t,e,n,i,r,o){if(0===r.width||0===r.height)return e;if(r.width>t.width||r.height>t.height||n.x>t.width-r.width||n.y>t.height-r.height)throw new RangeError("out of range source coordinates for image copy");if(r.width>e.width||r.height>e.height||i.x>e.width-r.width||i.y>e.height-r.height)throw new RangeError("out of range destination coordinates for image copy");for(var a=t.data,s=e.data,l=0;l<r.height;l++)for(var u=((n.y+l)*t.width+n.x)*o,c=((i.y+l)*e.width+i.x)*o,p=0;p<r.width*o;p++)s[c+p]=a[u+p];return e}si("HeatmapBucket",To,{omit:["layers"]});var ko=function(t,e){So(this,t,1,e)};ko.prototype.resize=function(t){Po(this,t,1)},ko.prototype.clone=function(){return new ko({width:this.width,height:this.height},new Uint8Array(this.data))},ko.copy=function(t,e,n,i,r){Co(t,e,n,i,r,1)};var Ao=function(t,e){So(this,t,4,e)};Ao.prototype.resize=function(t){Po(this,t,4)},Ao.prototype.clone=function(){return new Ao({width:this.width,height:this.height},new Uint8Array(this.data))},Ao.copy=function(t,e,n,i,r){Co(t,e,n,i,r,4)},si("AlphaImage",ko),si("RGBAImage",Ao);var zo={paint:new Fi({"heatmap-radius":new Oi(yt.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Oi(yt.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ii(yt.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Bi(yt.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ii(yt.paint_heatmap["heatmap-opacity"])})};function Lo(t,e){for(var n=new Uint8Array(1024),i={},r=0,o=0;r<256;r++,o+=4){i[e]=r/255;var a=t.evaluate(i);n[o+0]=Math.floor(255*a.r/a.a),n[o+1]=Math.floor(255*a.g/a.a),n[o+2]=Math.floor(255*a.b/a.a),n[o+3]=Math.floor(255*a.a)}return new Ao({width:256,height:1},n)}var Mo=function(t){function e(e){t.call(this,e,zo),this._updateColorRamp()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createBucket=function(t){return new To(t)},e.prototype._handleSpecialPaintPropertyUpdate=function(t){"heatmap-color"===t&&this._updateColorRamp()},e.prototype._updateColorRamp=function(){var t=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=Lo(t,"heatmapDensity"),this.colorRampTexture=null},e.prototype.resize=function(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)},e.prototype.queryRadius=function(){return 0},e.prototype.queryIntersectsFeature=function(){return!1},e.prototype.hasOffscreenPass=function(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility},e}(Ni),Io={paint:new Fi({"hillshade-illumination-direction":new Ii(yt.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ii(yt.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ii(yt.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ii(yt.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ii(yt.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ii(yt.paint_hillshade["hillshade-accent-color"])})},Oo=function(t){function e(e){t.call(this,e,Io)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.hasOffscreenPass=function(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility},e}(Ni),Do=Zi([{name:"a_pos",components:2,type:"Int16"}],4),Ro=Do.members,Bo=(Do.size,Do.alignment,No),Fo=No;function No(t,e,n){n=n||2;var i,r,o,a,s,l,u,c=e&&e.length,p=c?e[0]*n:t.length,h=Uo(t,0,p,n,!0),f=[];if(!h||h.next===h.prev)return f;if(c&&(h=function(t,e,n,i){var r,o,a,s=[];for(r=0,o=e.length;r<o;r++)(a=Uo(t,e[r]*i,r<o-1?e[r+1]*i:t.length,i,!1))===a.next&&(a.steiner=!0),s.push(Yo(a));for(s.sort(Ho),r=0;r<s.length;r++)Xo(s[r],n),n=jo(n,n.next);return n}(t,e,h,n)),t.length>80*n){i=o=t[0],r=a=t[1];for(var d=n;d<p;d+=n)(s=t[d])<i&&(i=s),(l=t[d+1])<r&&(r=l),s>o&&(o=s),l>a&&(a=l);u=0!==(u=Math.max(o-i,a-r))?1/u:0}return Vo(h,f,n,i,r,u),f}function Uo(t,e,n,i,r){var o,a;if(r===sa(t,e,n,i)>0)for(o=e;o<n;o+=i)a=ra(o,t[o],t[o+1],a);else for(o=n-i;o>=e;o-=i)a=ra(o,t[o],t[o+1],a);return a&&ta(a,a.next)&&(oa(a),a=a.next),a}function jo(t,e){if(!t)return t;e||(e=t);var n,i=t;do{if(n=!1,i.steiner||!ta(i,i.next)&&0!==Qo(i.prev,i,i.next))i=i.next;else{if(oa(i),(i=e=i.prev)===i.next)break;n=!0}}while(n||i!==e);return e}function Vo(t,e,n,i,r,o,a){if(t){!a&&o&&function(t,e,n,i){var r=t;do{null===r.z&&(r.z=Ko(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,n,i,r,o,a,s,l,u=1;do{for(n=t,t=null,o=null,a=0;n;){for(a++,i=n,s=0,e=0;e<u&&(s++,i=i.nextZ);e++);for(l=u;s>0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),o?o.nextZ=r:t=r,r.prevZ=o,o=r;n=i}o.nextZ=null,u*=2}while(a>1)}(r)}(t,i,r,o);for(var s,l,u=t;t.prev!==t.next;)if(s=t.prev,l=t.next,o?qo(t,i,r,o):Zo(t))e.push(s.i/n),e.push(t.i/n),e.push(l.i/n),oa(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?Vo(t=Go(t,e,n),e,n,i,r,o,2):2===a&&Wo(t,e,n,i,r,o):Vo(jo(t),e,n,i,r,o,1);break}}}function Zo(t){var e=t.prev,n=t,i=t.next;if(Qo(e,n,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(Jo(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&Qo(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function qo(t,e,n,i){var r=t.prev,o=t,a=t.next;if(Qo(r,o,a)>=0)return!1;for(var s=r.x<o.x?r.x<a.x?r.x:a.x:o.x<a.x?o.x:a.x,l=r.y<o.y?r.y<a.y?r.y:a.y:o.y<a.y?o.y:a.y,u=r.x>o.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,c=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,p=Ko(s,l,e,n,i),h=Ko(u,c,e,n,i),f=t.prevZ,d=t.nextZ;f&&f.z>=p&&d&&d.z<=h;){if(f!==t.prev&&f!==t.next&&Jo(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&Qo(f.prev,f,f.next)>=0)return!1;if(f=f.prevZ,d!==t.prev&&d!==t.next&&Jo(r.x,r.y,o.x,o.y,a.x,a.y,d.x,d.y)&&Qo(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;f&&f.z>=p;){if(f!==t.prev&&f!==t.next&&Jo(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&Qo(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=h;){if(d!==t.prev&&d!==t.next&&Jo(r.x,r.y,o.x,o.y,a.x,a.y,d.x,d.y)&&Qo(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function Go(t,e,n){var i=t;do{var r=i.prev,o=i.next.next;!ta(r,o)&&ea(r,i,i.next,o)&&na(r,o)&&na(o,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(o.i/n),oa(i),oa(i.next),i=t=o),i=i.next}while(i!==t);return i}function Wo(t,e,n,i,r,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&$o(a,s)){var l=ia(a,s);return a=jo(a,a.next),l=jo(l,l.next),Vo(a,e,n,i,r,o),void Vo(l,e,n,i,r,o)}s=s.next}a=a.next}while(a!==t)}function Ho(t,e){return t.x-e.x}function Xo(t,e){if(e=function(t,e){var n,i=e,r=t.x,o=t.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>a){if(a=s,s===r){if(o===i.y)return i;if(o===i.next.y)return i.next}n=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!n)return null;if(r===a)return n.prev;var l,u=n,c=n.x,p=n.y,h=1/0;for(i=n.next;i!==u;)r>=i.x&&i.x>=c&&r!==i.x&&Jo(o<p?r:a,o,c,p,o<p?a:r,o,i.x,i.y)&&((l=Math.abs(o-i.y)/(r-i.x))<h||l===h&&i.x>n.x)&&na(i,t)&&(n=i,h=l),i=i.next;return n}(t,e)){var n=ia(e,t);jo(n,n.next)}}function Ko(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Yo(t){var e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function Jo(t,e,n,i,r,o,a,s){return(r-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(i-s)-(n-a)*(e-s)>=0&&(n-a)*(o-s)-(r-a)*(i-s)>=0}function $o(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&ea(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&na(t,e)&&na(e,t)&&function(t,e){var n=t,i=!1,r=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&r<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)}function Qo(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function ta(t,e){return t.x===e.x&&t.y===e.y}function ea(t,e,n,i){return!!(ta(t,e)&&ta(n,i)||ta(t,i)&&ta(n,e))||Qo(t,e,n)>0!=Qo(t,e,i)>0&&Qo(n,i,t)>0!=Qo(n,i,e)>0}function na(t,e){return Qo(t.prev,t,t.next)<0?Qo(t,e,t.next)>=0&&Qo(t,t.prev,e)>=0:Qo(t,e,t.prev)<0||Qo(t,t.next,e)<0}function ia(t,e){var n=new aa(t.i,t.x,t.y),i=new aa(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,o.next=i,i.prev=o,i}function ra(t,e,n,i){var r=new aa(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function oa(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function aa(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function sa(t,e,n,i){for(var r=0,o=e,a=n-i;o<n;o+=i)r+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return r}function la(t,e,n,i,r){!function t(e,n,i,r,o){for(;r>i;){if(r-i>600){var a=r-i+1,s=n-i+1,l=Math.log(a),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(a-u)/a)*(s-a/2<0?-1:1);t(e,n,Math.max(i,Math.floor(n-s*u/a+c)),Math.min(r,Math.floor(n+(a-s)*u/a+c)),o)}var p=e[n],h=i,f=r;for(ua(e,i,n),o(e[r],p)>0&&ua(e,i,r);h<f;){for(ua(e,h,f),h++,f--;o(e[h],p)<0;)h++;for(;o(e[f],p)>0;)f--}0===o(e[i],p)?ua(e,i,f):ua(e,++f,r),f<=n&&(i=f+1),n<=f&&(r=f-1)}}(t,e,n||0,i||t.length-1,r||ca)}function ua(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}function ca(t,e){return t<e?-1:t>e?1:0}function pa(t,e){var n=t.length;if(n<=1)return[t];for(var i,r,o=[],a=0;a<n;a++){var s=T(t[a]);0!==s&&(t[a].area=Math.abs(s),void 0===r&&(r=s<0),r===s<0?(i&&o.push(i),i=[t[a]]):i.push(t[a]))}if(i&&o.push(i),e>1)for(var l=0;l<o.length;l++)o[l].length<=e||(la(o[l],e,1,o[l].length-1,ha),o[l]=o[l].slice(0,e));return o}function ha(t,e){return e.area-t.area}function fa(t,e,n){for(var i=n.patternDependencies,r=!1,o=0,a=e;o<a.length;o+=1){var s=a[o].paint.get(t+"-pattern");s.isConstant()||(r=!0);var l=s.constantOr(null);l&&(r=!0,i[l.to]=!0,i[l.from]=!0)}return r}function da(t,e,n,i,r){for(var o=r.patternDependencies,a=0,s=e;a<s.length;a+=1){var l=s[a],u=l.paint.get(t+"-pattern").value;if("constant"!==u.kind){var c=u.evaluate({zoom:i-1},n,{}),p=u.evaluate({zoom:i},n,{}),h=u.evaluate({zoom:i+1},n,{});o[c]=!0,o[p]=!0,o[h]=!0,n.patterns[l.id]={min:c,mid:p,max:h}}}return n}No.deviation=function(t,e,n,i){var r=e&&e.length,o=r?e[0]*n:t.length,a=Math.abs(sa(t,0,o,n));if(r)for(var s=0,l=e.length;s<l;s++){var u=e[s]*n,c=s<l-1?e[s+1]*n:t.length;a-=Math.abs(sa(t,u,c,n))}var p=0;for(s=0;s<i.length;s+=3){var h=i[s]*n,f=i[s+1]*n,d=i[s+2]*n;p+=Math.abs((t[h]-t[d])*(t[f+1]-t[h+1])-(t[h]-t[f])*(t[d+1]-t[h+1]))}return 0===a&&0===p?0:Math.abs((p-a)/a)},No.flatten=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},i=0,r=0;r<t.length;r++){for(var o=0;o<t[r].length;o++)for(var a=0;a<e;a++)n.vertices.push(t[r][o][a]);r>0&&(i+=t[r-1].length,n.holes.push(i))}return n},Bo.default=Fo;var ma=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Gi,this.indexArray=new sr,this.indexArray2=new lr,this.programConfigurations=new Wr(Ro,t.layers,t.zoom),this.segments=new Pr,this.segments2=new Pr,this.stateDependentLayerIds=this.layers.filter(function(t){return t.isStateDependent()}).map(function(t){return t.id})};ma.prototype.populate=function(t,e){this.features=[],this.hasPattern=fa("fill",this.layers,e);for(var n=0,i=t;n<i.length;n+=1){var r=i[n],o=r.feature,a=r.index,s=r.sourceLayerIndex;if(this.layers[0]._featureFilter(new Ti(this.zoom),o)){var l=Jr(o),u={sourceLayerIndex:s,index:a,geometry:l,properties:o.properties,type:o.type,patterns:{}};void 0!==o.id&&(u.id=o.id),this.hasPattern?this.features.push(da("fill",this.layers,u,this.zoom,e)):this.addFeature(u,l,a,{}),e.featureIndex.insert(o,l,a,s,this.index)}}},ma.prototype.update=function(t,e,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,n)},ma.prototype.addFeatures=function(t,e){for(var n=0,i=this.features;n<i.length;n+=1){var r=i[n],o=r.geometry;this.addFeature(r,o,r.index,e)}},ma.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},ma.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},ma.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ro),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0},ma.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())},ma.prototype.addFeature=function(t,e,n,i){for(var r=0,o=pa(e,500);r<o.length;r+=1){for(var a=o[r],s=0,l=0,u=a;l<u.length;l+=1)s+=u[l].length;for(var c=this.segments.prepareSegment(s,this.layoutVertexArray,this.indexArray),p=c.vertexLength,h=[],f=[],d=0,m=a;d<m.length;d+=1){var y=m[d];if(0!==y.length){y!==a[0]&&f.push(h.length/2);var _=this.segments2.prepareSegment(y.length,this.layoutVertexArray,this.indexArray2),g=_.vertexLength;this.layoutVertexArray.emplaceBack(y[0].x,y[0].y),this.indexArray2.emplaceBack(g+y.length-1,g),h.push(y[0].x),h.push(y[0].y);for(var v=1;v<y.length;v++)this.layoutVertexArray.emplaceBack(y[v].x,y[v].y),this.indexArray2.emplaceBack(g+v-1,g+v),h.push(y[v].x),h.push(y[v].y);_.vertexLength+=y.length,_.primitiveLength+=y.length}}for(var x=Bo(h,f),b=0;b<x.length;b+=3)this.indexArray.emplaceBack(p+x[b],p+x[b+1],p+x[b+2]);c.vertexLength+=s,c.primitiveLength+=x.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,i)},si("FillBucket",ma,{omit:["layers","features"]});var ya={paint:new Fi({"fill-antialias":new Ii(yt.paint_fill["fill-antialias"]),"fill-opacity":new Oi(yt.paint_fill["fill-opacity"]),"fill-color":new Oi(yt.paint_fill["fill-color"]),"fill-outline-color":new Oi(yt.paint_fill["fill-outline-color"]),"fill-translate":new Ii(yt.paint_fill["fill-translate"]),"fill-translate-anchor":new Ii(yt.paint_fill["fill-translate-anchor"]),"fill-pattern":new Di(yt.paint_fill["fill-pattern"])})},_a=function(t){function e(e){t.call(this,e,ya)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.recalculate=function(e){t.prototype.recalculate.call(this,e);var n=this.paint._values["fill-outline-color"];"constant"===n.value.kind&&void 0===n.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])},e.prototype.createBucket=function(t){return new ma(t)},e.prototype.queryRadius=function(){return ho(this.paint.get("fill-translate"))},e.prototype.queryIntersectsFeature=function(t,e,n,i,r,o,a){return no(fo(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),o.angle,a),i)},e}(Ni),ga=Zi([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),va=ga.members,xa=(ga.size,ga.alignment,Math.pow(2,13));function ba(t,e,n,i,r,o,a,s){t.emplaceBack(e,n,2*Math.floor(i*xa)+a,r*xa*2,o*xa*2,Math.round(s))}var wa=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Hi,this.indexArray=new sr,this.programConfigurations=new Wr(va,t.layers,t.zoom),this.segments=new Pr,this.stateDependentLayerIds=this.layers.filter(function(t){return t.isStateDependent()}).map(function(t){return t.id})};function Ea(t,e){return t.x===e.x&&(t.x<0||t.x>Kr)||t.y===e.y&&(t.y<0||t.y>Kr)}function Ta(t){return t.every(function(t){return t.x<0})||t.every(function(t){return t.x>Kr})||t.every(function(t){return t.y<0})||t.every(function(t){return t.y>Kr})}wa.prototype.populate=function(t,e){this.features=[],this.hasPattern=fa("fill-extrusion",this.layers,e);for(var n=0,i=t;n<i.length;n+=1){var r=i[n],o=r.feature,a=r.index,s=r.sourceLayerIndex;if(this.layers[0]._featureFilter(new Ti(this.zoom),o)){var l=Jr(o),u={sourceLayerIndex:s,index:a,geometry:l,properties:o.properties,type:o.type,patterns:{}};void 0!==o.id&&(u.id=o.id),this.hasPattern?this.features.push(da("fill-extrusion",this.layers,u,this.zoom,e)):this.addFeature(u,l,a,{}),e.featureIndex.insert(o,l,a,s,this.index,!0)}}},wa.prototype.addFeatures=function(t,e){for(var n=0,i=this.features;n<i.length;n+=1){var r=i[n],o=r.geometry;this.addFeature(r,o,r.index,e)}},wa.prototype.update=function(t,e,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,n)},wa.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},wa.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},wa.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,va),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},wa.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},wa.prototype.addFeature=function(t,e,n,i){for(var r=0,o=pa(e,500);r<o.length;r+=1){for(var a=o[r],s=0,l=0,u=a;l<u.length;l+=1)s+=u[l].length;for(var c=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray),p=0,h=a;p<h.length;p+=1){var f=h[p];if(0!==f.length&&!Ta(f))for(var d=0,m=0;m<f.length;m++){var y=f[m];if(m>=1){var _=f[m-1];if(!Ea(y,_)){c.vertexLength+4>Pr.MAX_VERTEX_ARRAY_LENGTH&&(c=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var g=y.sub(_)._perp()._unit(),v=_.dist(y);d+v>32768&&(d=0),ba(this.layoutVertexArray,y.x,y.y,g.x,g.y,0,0,d),ba(this.layoutVertexArray,y.x,y.y,g.x,g.y,0,1,d),d+=v,ba(this.layoutVertexArray,_.x,_.y,g.x,g.y,0,0,d),ba(this.layoutVertexArray,_.x,_.y,g.x,g.y,0,1,d);var x=c.vertexLength;this.indexArray.emplaceBack(x,x+2,x+1),this.indexArray.emplaceBack(x+1,x+2,x+3),c.vertexLength+=4,c.primitiveLength+=2}}}}c.vertexLength+s>Pr.MAX_VERTEX_ARRAY_LENGTH&&(c=this.segments.prepareSegment(s,this.layoutVertexArray,this.indexArray));for(var b=[],w=[],E=c.vertexLength,T=0,S=a;T<S.length;T+=1){var P=S[T];if(0!==P.length){P!==a[0]&&w.push(b.length/2);for(var C=0;C<P.length;C++){var k=P[C];ba(this.layoutVertexArray,k.x,k.y,0,0,1,1,0),b.push(k.x),b.push(k.y)}}}for(var A=Bo(b,w),z=0;z<A.length;z+=3)this.indexArray.emplaceBack(E+A[z],E+A[z+2],E+A[z+1]);c.primitiveLength+=A.length/3,c.vertexLength+=s}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,i)},si("FillExtrusionBucket",wa,{omit:["layers","features"]});var Sa={paint:new Fi({"fill-extrusion-opacity":new Ii(yt["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Oi(yt["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ii(yt["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ii(yt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Di(yt["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Oi(yt["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Oi(yt["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ii(yt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})},Pa=function(t){function e(e){t.call(this,e,Sa)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createBucket=function(t){return new wa(t)},e.prototype.queryRadius=function(){return ho(this.paint.get("fill-extrusion-translate"))},e.prototype.queryIntersectsFeature=function(t,e,n,i,o,a,s,l){var u=fo(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,s),c=this.paint.get("fill-extrusion-height").evaluate(e,n),p=this.paint.get("fill-extrusion-base").evaluate(e,n),h=function(t,e,n,i){for(var o=[],a=0,s=t;a<s.length;a+=1){var l=s[a],u=[l.x,l.y,0,1];xo(u,u,e),o.push(new r(u[0]/u[3],u[1]/u[3]))}return o}(u,l),f=function(t,e,n,i){for(var o=[],a=[],s=i[8]*e,l=i[9]*e,u=i[10]*e,c=i[11]*e,p=i[8]*n,h=i[9]*n,f=i[10]*n,d=i[11]*n,m=0,y=t;m<y.length;m+=1){for(var _=[],g=[],v=0,x=y[m];v<x.length;v+=1){var b=x[v],w=b.x,E=b.y,T=i[0]*w+i[4]*E+i[12],S=i[1]*w+i[5]*E+i[13],P=i[2]*w+i[6]*E+i[14],C=i[3]*w+i[7]*E+i[15],k=P+u,A=C+c,z=T+p,L=S+h,M=P+f,I=C+d,O=new r((T+s)/A,(S+l)/A);O.z=k/A,_.push(O);var D=new r(z/I,L/I);D.z=M/I,g.push(D)}o.push(_),a.push(g)}return[o,a]}(i,p,c,l);return function(t,e,n){var i=1/0;no(n,e)&&(i=ka(n,e[0]));for(var r=0;r<e.length;r++)for(var o=e[r],a=t[r],s=0;s<o.length-1;s++){var l=o[s],u=o[s+1],c=a[s],p=[l,u,a[s+1],c,l];to(n,p)&&(i=Math.min(i,ka(n,p)))}return i!==1/0&&i}(f[0],f[1],h)},e.prototype.hasOffscreenPass=function(){return 0!==this.paint.get("fill-extrusion-opacity")&&"none"!==this.visibility},e.prototype.resize=function(){this.viewportFrame&&(this.viewportFrame.destroy(),this.viewportFrame=null)},e}(Ni);function Ca(t,e){return t.x*e.x+t.y*e.y}function ka(t,e){if(1===t.length){var n=e[0],i=e[1],r=e[3],o=t[0],a=i.sub(n),s=r.sub(n),l=o.sub(n),u=Ca(a,a),c=Ca(a,s),p=Ca(s,s),h=Ca(l,a),f=Ca(l,s),d=u*p-c*c,m=(p*h-c*f)/d,y=(u*f-c*h)/d,_=1-m-y;return n.z*_+i.z*m+r.z*y}for(var g=1/0,v=0,x=e;v<x.length;v+=1){var b=x[v];g=Math.min(g,b.z)}return g}var Aa=Zi([{name:"a_pos_normal",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),za=Aa.members,La=(Aa.size,Aa.alignment,Ma);function Ma(t,e,n,i,r){this.properties={},this.extent=n,this.type=0,this._pbf=t,this._geometry=-1,this._keys=i,this._values=r,t.readFields(Ia,this,e)}function Ia(t,e,n){1==t?e.id=n.readVarint():2==t?function(t,e){for(var n=t.readVarint()+t.pos;t.pos<n;){var i=e._keys[t.readVarint()],r=e._values[t.readVarint()];e.properties[i]=r}}(n,e):3==t?e.type=n.readVarint():4==t&&(e._geometry=n.pos)}function Oa(t){for(var e,n,i=0,r=0,o=t.length,a=o-1;r<o;a=r++)e=t[r],i+=((n=t[a]).x-e.x)*(e.y+n.y);return i}Ma.types=["Unknown","Point","LineString","Polygon"],Ma.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,n=t.readVarint()+t.pos,i=1,o=0,a=0,s=0,l=[];t.pos<n;){if(o<=0){var u=t.readVarint();i=7&u,o=u>>3}if(o--,1===i||2===i)a+=t.readSVarint(),s+=t.readSVarint(),1===i&&(e&&l.push(e),e=[]),e.push(new r(a,s));else{if(7!==i)throw new Error("unknown command "+i);e&&e.push(e[0].clone())}}return e&&l.push(e),l},Ma.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,n=1,i=0,r=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;t.pos<e;){if(i<=0){var c=t.readVarint();n=7&c,i=c>>3}if(i--,1===n||2===n)(r+=t.readSVarint())<a&&(a=r),r>s&&(s=r),(o+=t.readSVarint())<l&&(l=o),o>u&&(u=o);else if(7!==n)throw new Error("unknown command "+n)}return[a,l,s,u]},Ma.prototype.toGeoJSON=function(t,e,n){var i,r,o=this.extent*Math.pow(2,n),a=this.extent*t,s=this.extent*e,l=this.loadGeometry(),u=Ma.types[this.type];function c(t){for(var e=0;e<t.length;e++){var n=t[e],i=180-360*(n.y+s)/o;t[e]=[360*(n.x+a)/o-180,360/Math.PI*Math.atan(Math.exp(i*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(i=0;i<l.length;i++)p[i]=l[i][0];c(l=p);break;case 2:for(i=0;i<l.length;i++)c(l[i]);break;case 3:for(l=function(t){var e=t.length;if(e<=1)return[t];for(var n,i,r=[],o=0;o<e;o++){var a=Oa(t[o]);0!==a&&(void 0===i&&(i=a<0),i===a<0?(n&&r.push(n),n=[t[o]]):n.push(t[o]))}return n&&r.push(n),r}(l),i=0;i<l.length;i++)for(r=0;r<l[i].length;r++)c(l[i][r])}1===l.length?l=l[0]:u="Multi"+u;var h={type:"Feature",geometry:{type:u,coordinates:l},properties:this.properties};return"id"in this&&(h.id=this.id),h};var Da=Ra;function Ra(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Ba,this,e),this.length=this._features.length}function Ba(t,e,n){15===t?e.version=n.readVarint():1===t?e.name=n.readString():5===t?e.extent=n.readVarint():2===t?e._features.push(n.pos):3===t?e._keys.push(n.readString()):4===t&&e._values.push(function(t){for(var e=null,n=t.readVarint()+t.pos;t.pos<n;){var i=t.readVarint()>>3;e=1===i?t.readString():2===i?t.readFloat():3===i?t.readDouble():4===i?t.readVarint64():5===i?t.readVarint():6===i?t.readSVarint():7===i?t.readBoolean():null}return e}(n))}function Fa(t,e,n){if(3===t){var i=new Da(n,n.readVarint()+n.pos);i.length&&(e[i.name]=i)}}Ra.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new La(this._pbf,e,this.extent,this._keys,this._values)};var Na={VectorTile:function(t,e){this.layers=t.readFields(Fa,{},e)},VectorTileFeature:La,VectorTileLayer:Da},Ua=Na.VectorTileFeature.types,ja=63,Va=Math.cos(Math.PI/180*37.5),Za=.5,qa=Math.pow(2,14)/Za;function Ga(t,e,n,i,r,o,a){t.emplaceBack(e.x,e.y,i?1:0,r?1:-1,Math.round(ja*n.x)+128,Math.round(ja*n.y)+128,1+(0===o?0:o<0?-1:1)|(a*Za&63)<<2,a*Za>>6)}var Wa=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.features=[],this.hasPattern=!1,this.layoutVertexArray=new Xi,this.indexArray=new sr,this.programConfigurations=new Wr(za,t.layers,t.zoom),this.segments=new Pr,this.stateDependentLayerIds=this.layers.filter(function(t){return t.isStateDependent()}).map(function(t){return t.id})};function Ha(t,e){return(t/e.tileTotal*(e.end-e.start)+e.start)*(qa-1)}Wa.prototype.populate=function(t,e){this.features=[],this.hasPattern=fa("line",this.layers,e);for(var n=0,i=t;n<i.length;n+=1){var r=i[n],o=r.feature,a=r.index,s=r.sourceLayerIndex;if(this.layers[0]._featureFilter(new Ti(this.zoom),o)){var l=Jr(o),u={sourceLayerIndex:s,index:a,geometry:l,properties:o.properties,type:o.type,patterns:{}};void 0!==o.id&&(u.id=o.id),this.hasPattern?this.features.push(da("line",this.layers,u,this.zoom,e)):this.addFeature(u,l,a,{}),e.featureIndex.insert(o,l,a,s,this.index)}}},Wa.prototype.update=function(t,e,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,n)},Wa.prototype.addFeatures=function(t,e){for(var n=0,i=this.features;n<i.length;n+=1){var r=i[n],o=r.geometry;this.addFeature(r,o,r.index,e)}},Wa.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},Wa.prototype.uploadPending=function(){return!this.uploaded||this.programConfigurations.needsUpload},Wa.prototype.upload=function(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,za),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0},Wa.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())},Wa.prototype.addFeature=function(t,e,n,i){for(var r=this.layers[0].layout,o=r.get("line-join").evaluate(t,{}),a=r.get("line-cap"),s=r.get("line-miter-limit"),l=r.get("line-round-limit"),u=0,c=e;u<c.length;u+=1){var p=c[u];this.addLine(p,t,o,a,s,l,n,i)}},Wa.prototype.addLine=function(t,e,n,i,r,o,a,s){var l=null;e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end")&&(l={start:e.properties.mapbox_clip_start,end:e.properties.mapbox_clip_end,tileTotal:void 0});for(var u="Polygon"===Ua[e.type],c=t.length;c>=2&&t[c-1].equals(t[c-2]);)c--;for(var p=0;p<c-1&&t[p].equals(t[p+1]);)p++;if(!(c<(u?3:2))){l&&(l.tileTotal=function(t,e,n){for(var i,r,o=0,a=p;a<n-1;a++)i=t[a],r=t[a+1],o+=i.dist(r);return o}(t,0,c)),"bevel"===n&&(r=1.05);var h=Kr/(512*this.overscaling)*15,f=t[p],d=this.segments.prepareSegment(10*c,this.layoutVertexArray,this.indexArray);this.distance=0;var m,y,_,g=i,v=u?"butt":i,x=!0,b=void 0,w=void 0,E=void 0,T=void 0;this.e1=this.e2=this.e3=-1,u&&(m=t[c-2],T=f.sub(m)._unit()._perp());for(var S=p;S<c;S++)if(!(w=u&&S===c-1?t[p+1]:t[S+1])||!t[S].equals(w)){T&&(E=T),m&&(b=m),m=t[S],T=w?w.sub(m)._unit()._perp():E;var P=(E=E||T).add(T);0===P.x&&0===P.y||P._unit();var C=P.x*T.x+P.y*T.y,k=0!==C?1/C:1/0,A=C<Va&&b&&w;if(A&&S>p){var z=m.dist(b);if(z>2*h){var L=m.sub(m.sub(b)._mult(h/z)._round());this.distance+=L.dist(b),this.addCurrentVertex(L,this.distance,E.mult(1),0,0,!1,d,l),b=L}}var M=b&&w,I=M?n:w?g:v;if(M&&"round"===I&&(k<o?I="miter":k<=2&&(I="fakeround")),"miter"===I&&k>r&&(I="bevel"),"bevel"===I&&(k>2&&(I="flipbevel"),k<r&&(I="miter")),b&&(this.distance+=m.dist(b)),"miter"===I)P._mult(k),this.addCurrentVertex(m,this.distance,P,0,0,!1,d,l);else if("flipbevel"===I){if(k>100)P=T.clone().mult(-1);else{var O=E.x*T.y-E.y*T.x>0?-1:1,D=k*E.add(T).mag()/E.sub(T).mag();P._perp()._mult(D*O)}this.addCurrentVertex(m,this.distance,P,0,0,!1,d,l),this.addCurrentVertex(m,this.distance,P.mult(-1),0,0,!1,d,l)}else if("bevel"===I||"fakeround"===I){var R=E.x*T.y-E.y*T.x>0,B=-Math.sqrt(k*k-1);if(R?(_=0,y=B):(y=0,_=B),x||this.addCurrentVertex(m,this.distance,E,y,_,!1,d,l),"fakeround"===I){for(var F=Math.floor(8*(.5-(C-.5))),N=void 0,U=0;U<F;U++)N=T.mult((U+1)/(F+1))._add(E)._unit(),this.addPieSliceVertex(m,this.distance,N,R,d,l);this.addPieSliceVertex(m,this.distance,P,R,d,l);for(var j=F-1;j>=0;j--)N=E.mult((j+1)/(F+1))._add(T)._unit(),this.addPieSliceVertex(m,this.distance,N,R,d,l)}w&&this.addCurrentVertex(m,this.distance,T,-y,-_,!1,d,l)}else"butt"===I?(x||this.addCurrentVertex(m,this.distance,E,0,0,!1,d,l),w&&this.addCurrentVertex(m,this.distance,T,0,0,!1,d,l)):"square"===I?(x||(this.addCurrentVertex(m,this.distance,E,1,1,!1,d,l),this.e1=this.e2=-1),w&&this.addCurrentVertex(m,this.distance,T,-1,-1,!1,d,l)):"round"===I&&(x||(this.addCurrentVertex(m,this.distance,E,0,0,!1,d,l),this.addCurrentVertex(m,this.distance,E,1,1,!0,d,l),this.e1=this.e2=-1),w&&(this.addCurrentVertex(m,this.distance,T,-1,-1,!0,d,l),this.addCurrentVertex(m,this.distance,T,0,0,!1,d,l)));if(A&&S<c-1){var V=m.dist(w);if(V>2*h){var Z=m.add(w.sub(m)._mult(h/V)._round());this.distance+=Z.dist(m),this.addCurrentVertex(Z,this.distance,T.mult(1),0,0,!1,d,l),m=Z}}x=!1}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,a,s)}},Wa.prototype.addCurrentVertex=function(t,e,n,i,r,o,a,s){var l,u=this.layoutVertexArray,c=this.indexArray;s&&(e=Ha(e,s)),l=n.clone(),i&&l._sub(n.perp()._mult(i)),Ga(u,t,l,o,!1,i,e),this.e3=a.vertexLength++,this.e1>=0&&this.e2>=0&&(c.emplaceBack(this.e1,this.e2,this.e3),a.primitiveLength++),this.e1=this.e2,this.e2=this.e3,l=n.mult(-1),r&&l._sub(n.perp()._mult(r)),Ga(u,t,l,o,!0,-r,e),this.e3=a.vertexLength++,this.e1>=0&&this.e2>=0&&(c.emplaceBack(this.e1,this.e2,this.e3),a.primitiveLength++),this.e1=this.e2,this.e2=this.e3,e>qa/2&&!s&&(this.distance=0,this.addCurrentVertex(t,this.distance,n,i,r,o,a))},Wa.prototype.addPieSliceVertex=function(t,e,n,i,r,o){n=n.mult(i?-1:1);var a=this.layoutVertexArray,s=this.indexArray;o&&(e=Ha(e,o)),Ga(a,t,n,!1,i,0,e),this.e3=r.vertexLength++,this.e1>=0&&this.e2>=0&&(s.emplaceBack(this.e1,this.e2,this.e3),r.primitiveLength++),i?this.e2=this.e3:this.e1=this.e3},si("LineBucket",Wa,{omit:["layers","features"]});var Xa=new Fi({"line-cap":new Ii(yt.layout_line["line-cap"]),"line-join":new Oi(yt.layout_line["line-join"]),"line-miter-limit":new Ii(yt.layout_line["line-miter-limit"]),"line-round-limit":new Ii(yt.layout_line["line-round-limit"])}),Ka={paint:new Fi({"line-opacity":new Oi(yt.paint_line["line-opacity"]),"line-color":new Oi(yt.paint_line["line-color"]),"line-translate":new Ii(yt.paint_line["line-translate"]),"line-translate-anchor":new Ii(yt.paint_line["line-translate-anchor"]),"line-width":new Oi(yt.paint_line["line-width"]),"line-gap-width":new Oi(yt.paint_line["line-gap-width"]),"line-offset":new Oi(yt.paint_line["line-offset"]),"line-blur":new Oi(yt.paint_line["line-blur"]),"line-dasharray":new Ri(yt.paint_line["line-dasharray"]),"line-pattern":new Di(yt.paint_line["line-pattern"]),"line-gradient":new Bi(yt.paint_line["line-gradient"])}),layout:Xa},Ya=new(function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.possiblyEvaluate=function(e,n){return n=new Ti(Math.floor(n.zoom),{now:n.now,fadeDuration:n.fadeDuration,zoomHistory:n.zoomHistory,transition:n.transition}),t.prototype.possiblyEvaluate.call(this,e,n)},e.prototype.evaluate=function(e,n,i,r){return n=p({},n,{zoom:Math.floor(n.zoom)}),t.prototype.evaluate.call(this,e,n,i,r)},e}(Oi))(Ka.paint.properties["line-width"].specification);Ya.useIntegerZoom=!0;var Ja=function(t){function e(e){t.call(this,e,Ka)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype._handleSpecialPaintPropertyUpdate=function(t){"line-gradient"===t&&this._updateGradient()},e.prototype._updateGradient=function(){var t=this._transitionablePaint._values["line-gradient"].value.expression;this.gradient=Lo(t,"lineProgress"),this.gradientTexture=null},e.prototype.recalculate=function(e){t.prototype.recalculate.call(this,e),this.paint._values["line-floorwidth"]=Ya.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new Wa(t)},e.prototype.queryRadius=function(t){var e=t,n=$a(po("line-width",this,e),po("line-gap-width",this,e)),i=po("line-offset",this,e);return n/2+Math.abs(i)+ho(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,n,i,o,a,s){var l=fo(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,s),u=s/2*$a(this.paint.get("line-width").evaluate(e,n),this.paint.get("line-gap-width").evaluate(e,n)),c=this.paint.get("line-offset").evaluate(e,n);return c&&(i=function(t,e){for(var n=[],i=new r(0,0),o=0;o<t.length;o++){for(var a=t[o],s=[],l=0;l<a.length;l++){var u=a[l-1],c=a[l],p=a[l+1],h=0===l?i:c.sub(u)._unit()._perp(),f=l===a.length-1?i:p.sub(c)._unit()._perp(),d=h._add(f)._unit(),m=d.x*f.x+d.y*f.y;d._mult(1/m),s.push(d._mult(e)._add(c))}n.push(s)}return n}(i,c*s)),function(t,e,n){for(var i=0;i<e.length;i++){var r=e[i];if(t.length>=3)for(var o=0;o<r.length;o++)if(uo(t,r[o]))return!0;if(io(t,r,n))return!0}return!1}(l,i,u)},e}(Ni);function $a(t,e){return e>0?e+2*t:t}var Qa=Zi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"}]),ts=Zi([{name:"a_projected_pos",components:3,type:"Float32"}],4),es=(Zi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Zi([{name:"a_placed",components:2,type:"Uint8"}],4)),ns=(Zi([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"radius"},{type:"Int16",name:"signedDistanceFromAnchor"}]),Zi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),is=Zi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4);function rs(t,e,n){return t.sections.forEach(function(t){t.text=function(t,e,n){var i=e.layout.get("text-transform").evaluate(n,{});return"uppercase"===i?t=t.toLocaleUpperCase():"lowercase"===i&&(t=t.toLocaleLowerCase()),Ei.applyArabicShaping&&(t=Ei.applyArabicShaping(t)),t}(t.text,e,n)}),t}Zi([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"hidden"}]),Zi([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"horizontalPlacedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint32",name:"crossTileID"}]),Zi([{type:"Float32",name:"offsetX"}]),Zi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var os={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},as=function(t){function e(e,n,i,r){t.call(this,e,n),this.angle=i,void 0!==r&&(this.segment=r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.clone=function(){return new e(this.x,this.y,this.angle,this.segment)},e}(r);function ss(t,e){var n=e.expression;if("constant"===n.kind)return{functionType:"constant",layoutSize:n.evaluate(new Ti(t+1))};if("source"===n.kind)return{functionType:"source"};for(var i=n.zoomStops,r=0;r<i.length&&i[r]<=t;)r++;for(var o=r=Math.max(0,r-1);o<i.length&&i[o]<t+1;)o++;o=Math.min(i.length-1,o);var a={min:i[r],max:i[o]};return"composite"===n.kind?{functionType:"composite",zoomRange:a,propertyValue:e.value}:{functionType:"camera",layoutSize:n.evaluate(new Ti(t+1)),zoomRange:a,sizeRange:{min:n.evaluate(new Ti(a.min)),max:n.evaluate(new Ti(a.max))},propertyValue:e.value}}si("Anchor",as);var ls=Na.VectorTileFeature.types,us=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function cs(t,e,n,i,r,o,a,s){t.emplaceBack(e,n,Math.round(32*i),Math.round(32*r),o,a,s?s[0]:0,s?s[1]:0)}function ps(t,e,n){t.emplaceBack(e.x,e.y,n),t.emplaceBack(e.x,e.y,n),t.emplaceBack(e.x,e.y,n),t.emplaceBack(e.x,e.y,n)}var hs=function(t){this.layoutVertexArray=new Yi,this.indexArray=new sr,this.programConfigurations=t,this.segments=new Pr,this.dynamicLayoutVertexArray=new Ji,this.opacityVertexArray=new $i,this.placedSymbolArray=new mr};hs.prototype.upload=function(t,e,n,i){n&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Qa.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,ts.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,us,!0),this.opacityVertexBuffer.itemSize=1),(n||i)&&this.programConfigurations.upload(t)},hs.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())},si("SymbolBuffers",hs);var fs=function(t,e,n){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new n,this.segments=new Pr,this.collisionVertexArray=new er};fs.prototype.upload=function(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,es.members,!0)},fs.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())},si("CollisionBuffers",fs);var ds=function(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1;var e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ss(this.zoom,e["text-size"]),this.iconSizeData=ss(this.zoom,e["icon-size"]);var n=this.layers[0].layout,i=n.get("symbol-sort-key"),r=n.get("symbol-z-order");this.sortFeaturesByKey="viewport-y"!==r&&void 0!==i.constantOr(1);var o="viewport-y"===r||"auto"===r&&!this.sortFeaturesByKey;this.sortFeaturesByY=o&&(n.get("text-allow-overlap")||n.get("icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement")),this.stateDependentLayerIds=this.layers.filter(function(t){return t.isStateDependent()}).map(function(t){return t.id}),this.sourceID=t.sourceID};ds.prototype.createArrays=function(){this.text=new hs(new Wr(Qa.members,this.layers,this.zoom,function(t){return/^text/.test(t)})),this.icon=new hs(new Wr(Qa.members,this.layers,this.zoom,function(t){return/^icon/.test(t)})),this.collisionBox=new fs(tr,ns.members,lr),this.collisionCircle=new fs(tr,is.members,sr),this.glyphOffsetArray=new vr,this.lineVertexArray=new br,this.symbolInstances=new _r},ds.prototype.calculateGlyphDependencies=function(t,e,n,i){for(var r=0;r<t.length;r++)if(e[t.charCodeAt(r)]=!0,n&&i){var o=os[t.charAt(r)];o&&(e[o.charCodeAt(0)]=!0)}},ds.prototype.populate=function(t,e){var n=this.layers[0],i=n.layout,r=i.get("text-font"),o=i.get("text-field"),a=i.get("icon-image"),s=("constant"!==o.value.kind||o.value.value.toString().length>0)&&("constant"!==r.value.kind||r.value.value.length>0),l="constant"!==a.value.kind||a.value.value&&a.value.value.length>0,u=i.get("symbol-sort-key");if(this.features=[],s||l){for(var c=e.iconDependencies,p=e.glyphDependencies,h=new Ti(this.zoom),f=0,d=t;f<d.length;f+=1){var m=d[f],y=m.feature,_=m.index,g=m.sourceLayerIndex;if(n._featureFilter(h,y)){var v=void 0;if(s){var x=n.getValueAndResolveTokens("text-field",y);v=rs(x instanceof jt?x:jt.fromString(x),n,y)}var b=void 0;if(l&&(b=n.getValueAndResolveTokens("icon-image",y)),v||b){var w=this.sortFeaturesByKey?u.evaluate(y,{}):void 0,E={text:v,icon:b,index:_,sourceLayerIndex:g,geometry:Jr(y),properties:y.properties,type:ls[y.type],sortKey:w};if(void 0!==y.id&&(E.id=y.id),this.features.push(E),b&&(c[b]=!0),v)for(var T=r.evaluate(y,{}).join(","),S="map"===i.get("text-rotation-alignment")&&"point"!==i.get("symbol-placement"),P=0,C=v.sections;P<C.length;P+=1){var k=C[P],A=fi(v.toString()),z=k.fontStack||T,L=p[z]=p[z]||{};this.calculateGlyphDependencies(k.text,L,S,A)}}}}"line"===i.get("symbol-placement")&&(this.features=function(t){var e={},n={},i=[],r=0;function o(e){i.push(t[e]),r++}function a(t,e,r){var o=n[t];return delete n[t],n[e]=o,i[o].geometry[0].pop(),i[o].geometry[0]=i[o].geometry[0].concat(r[0]),o}function s(t,n,r){var o=e[n];return delete e[n],e[t]=o,i[o].geometry[0].shift(),i[o].geometry[0]=r[0].concat(i[o].geometry[0]),o}function l(t,e,n){var i=n?e[0][e[0].length-1]:e[0][0];return t+":"+i.x+":"+i.y}for(var u=0;u<t.length;u++){var c=t[u],p=c.geometry,h=c.text?c.text.toString():null;if(h){var f=l(h,p),d=l(h,p,!0);if(f in n&&d in e&&n[f]!==e[d]){var m=s(f,d,p),y=a(f,d,i[m].geometry);delete e[f],delete n[d],n[l(h,i[y].geometry,!0)]=y,i[m].geometry=null}else f in n?a(f,d,p):d in e?s(f,d,p):(o(u),e[f]=r-1,n[d]=r-1)}else o(u)}return i.filter(function(t){return t.geometry})}(this.features)),this.sortFeaturesByKey&&this.features.sort(function(t,e){return t.sortKey-e.sortKey})}},ds.prototype.update=function(t,e,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,n),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,n))},ds.prototype.isEmpty=function(){return 0===this.symbolInstances.length},ds.prototype.uploadPending=function(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload},ds.prototype.upload=function(t){this.uploaded||(this.collisionBox.upload(t),this.collisionCircle.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0},ds.prototype.destroy=function(){this.text.destroy(),this.icon.destroy(),this.collisionBox.destroy(),this.collisionCircle.destroy()},ds.prototype.addToLineVertexArray=function(t,e){var n=this.lineVertexArray.length;if(void 0!==t.segment){for(var i=t.dist(e[t.segment+1]),r=t.dist(e[t.segment]),o={},a=t.segment+1;a<e.length;a++)o[a]={x:e[a].x,y:e[a].y,tileUnitDistanceFromAnchor:i},a<e.length-1&&(i+=e[a+1].dist(e[a]));for(var s=t.segment||0;s>=0;s--)o[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:r},s>0&&(r+=e[s-1].dist(e[s]));for(var l=0;l<e.length;l++){var u=o[l];this.lineVertexArray.emplaceBack(u.x,u.y,u.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}},ds.prototype.addSymbols=function(t,e,n,i,r,o,a,s,l,u){for(var c=t.indexArray,p=t.layoutVertexArray,h=t.dynamicLayoutVertexArray,f=t.segments.prepareSegment(4*e.length,t.layoutVertexArray,t.indexArray,o.sortKey),d=this.glyphOffsetArray.length,m=f.vertexLength,y=0,_=e;y<_.length;y+=1){var g=_[y],v=g.tl,x=g.tr,b=g.bl,w=g.br,E=g.tex,T=f.vertexLength,S=g.glyphOffset[1];cs(p,s.x,s.y,v.x,S+v.y,E.x,E.y,n),cs(p,s.x,s.y,x.x,S+x.y,E.x+E.w,E.y,n),cs(p,s.x,s.y,b.x,S+b.y,E.x,E.y+E.h,n),cs(p,s.x,s.y,w.x,S+w.y,E.x+E.w,E.y+E.h,n),ps(h,s,0),c.emplaceBack(T,T+1,T+2),c.emplaceBack(T+1,T+2,T+3),f.vertexLength+=4,f.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(g.glyphOffset[0])}t.placedSymbolArray.emplaceBack(s.x,s.y,d,this.glyphOffsetArray.length-d,m,l,u,s.segment,n?n[0]:0,n?n[1]:0,i[0],i[1],a,!1),t.programConfigurations.populatePaintArrays(t.layoutVertexArray.length,o,o.index,{})},ds.prototype._addCollisionDebugVertex=function(t,e,n,i,r,o){return e.emplaceBack(0,0),t.emplaceBack(n.x,n.y,i,r,Math.round(o.x),Math.round(o.y))},ds.prototype.addCollisionDebugVertices=function(t,e,n,i,o,a,s,l){var u=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),c=u.vertexLength,p=o.layoutVertexArray,h=o.collisionVertexArray,f=s.anchorX,d=s.anchorY;if(this._addCollisionDebugVertex(p,h,a,f,d,new r(t,e)),this._addCollisionDebugVertex(p,h,a,f,d,new r(n,e)),this._addCollisionDebugVertex(p,h,a,f,d,new r(n,i)),this._addCollisionDebugVertex(p,h,a,f,d,new r(t,i)),u.vertexLength+=4,l){var m=o.indexArray;m.emplaceBack(c,c+1,c+2),m.emplaceBack(c,c+2,c+3),u.primitiveLength+=2}else{var y=o.indexArray;y.emplaceBack(c,c+1),y.emplaceBack(c+1,c+2),y.emplaceBack(c+2,c+3),y.emplaceBack(c+3,c),u.primitiveLength+=4}},ds.prototype.addDebugCollisionBoxes=function(t,e,n){for(var i=t;i<e;i++){var r=this.collisionBoxArray.get(i),o=r.x1,a=r.y1,s=r.x2,l=r.y2,u=r.radius>0;this.addCollisionDebugVertices(o,a,s,l,u?this.collisionCircle:this.collisionBox,r.anchorPoint,n,u)}},ds.prototype.generateCollisionDebugBuffers=function(){for(var t=0;t<this.symbolInstances.length;t++){var e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e)}},ds.prototype._deserializeCollisionBoxesForSymbol=function(t,e,n,i,r){for(var o={},a=e;a<n;a++){var s=t.get(a);if(0===s.radius){o.textBox={x1:s.x1,y1:s.y1,x2:s.x2,y2:s.y2,anchorPointX:s.anchorPointX,anchorPointY:s.anchorPointY},o.textFeatureIndex=s.featureIndex;break}o.textCircles||(o.textCircles=[],o.textFeatureIndex=s.featureIndex),o.textCircles.push(s.anchorPointX,s.anchorPointY,s.radius,s.signedDistanceFromAnchor,1)}for(var l=i;l<r;l++){var u=t.get(l);if(0===u.radius){o.iconBox={x1:u.x1,y1:u.y1,x2:u.x2,y2:u.y2,anchorPointX:u.anchorPointX,anchorPointY:u.anchorPointY},o.iconFeatureIndex=u.featureIndex;break}}return o},ds.prototype.deserializeCollisionBoxes=function(t){this.collisionArrays=[];for(var e=0;e<this.symbolInstances.length;e++){var n=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,n.textBoxStartIndex,n.textBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex))}},ds.prototype.hasTextData=function(){return this.text.segments.get().length>0},ds.prototype.hasIconData=function(){return this.icon.segments.get().length>0},ds.prototype.hasCollisionBoxData=function(){return this.collisionBox.segments.get().length>0},ds.prototype.hasCollisionCircleData=function(){return this.collisionCircle.segments.get().length>0},ds.prototype.addIndicesForPlacedTextSymbol=function(t){for(var e=this.text.placedSymbolArray.get(t),n=e.vertexStartIndex+4*e.numGlyphs,i=e.vertexStartIndex;i<n;i+=4)this.text.indexArray.emplaceBack(i,i+1,i+2),this.text.indexArray.emplaceBack(i+1,i+2,i+3)},ds.prototype.sortFeatures=function(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&(this.sortedAngle=t,!(this.text.segments.get().length>1||this.icon.segments.get().length>1))){for(var e=[],n=0;n<this.symbolInstances.length;n++)e.push(n);for(var i=Math.sin(t),r=Math.cos(t),o=[],a=[],s=0;s<this.symbolInstances.length;s++){var l=this.symbolInstances.get(s);o.push(0|Math.round(i*l.anchorX+r*l.anchorY)),a.push(l.featureIndex)}e.sort(function(t,e){return o[t]-o[e]||a[e]-a[t]}),this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(var u=0,c=e;u<c.length;u+=1){var p=c[u],h=this.symbolInstances.get(p);this.featureSortOrder.push(h.featureIndex),h.horizontalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedTextSymbol(h.horizontalPlacedTextSymbolIndex),h.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedTextSymbol(h.verticalPlacedTextSymbolIndex);var f=this.icon.placedSymbolArray.get(p);if(f.numGlyphs){var d=f.vertexStartIndex;this.icon.indexArray.emplaceBack(d,d+1,d+2),this.icon.indexArray.emplaceBack(d+1,d+2,d+3)}}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}},si("SymbolBucket",ds,{omit:["layers","collisionBoxArray","features","compareText"]}),ds.MAX_GLYPHS=65535,ds.addDynamicAttributes=ps;var ms=new Fi({"symbol-placement":new Ii(yt.layout_symbol["symbol-placement"]),"symbol-spacing":new Ii(yt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ii(yt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Oi(yt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ii(yt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ii(yt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Ii(yt.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ii(yt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ii(yt.layout_symbol["icon-rotation-alignment"]),"icon-size":new Oi(yt.layout_symbol["icon-size"]),"icon-text-fit":new Ii(yt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ii(yt.layout_symbol["icon-text-fit-padding"]),"icon-image":new Oi(yt.layout_symbol["icon-image"]),"icon-rotate":new Oi(yt.layout_symbol["icon-rotate"]),"icon-padding":new Ii(yt.layout_symbol["icon-padding"]),"icon-keep-upright":new Ii(yt.layout_symbol["icon-keep-upright"]),"icon-offset":new Oi(yt.layout_symbol["icon-offset"]),"icon-anchor":new Oi(yt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ii(yt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ii(yt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ii(yt.layout_symbol["text-rotation-alignment"]),"text-field":new Oi(yt.layout_symbol["text-field"]),"text-font":new Oi(yt.layout_symbol["text-font"]),"text-size":new Oi(yt.layout_symbol["text-size"]),"text-max-width":new Oi(yt.layout_symbol["text-max-width"]),"text-line-height":new Ii(yt.layout_symbol["text-line-height"]),"text-letter-spacing":new Oi(yt.layout_symbol["text-letter-spacing"]),"text-justify":new Oi(yt.layout_symbol["text-justify"]),"text-anchor":new Oi(yt.layout_symbol["text-anchor"]),"text-max-angle":new Ii(yt.layout_symbol["text-max-angle"]),"text-rotate":new Oi(yt.layout_symbol["text-rotate"]),"text-padding":new Ii(yt.layout_symbol["text-padding"]),"text-keep-upright":new Ii(yt.layout_symbol["text-keep-upright"]),"text-transform":new Oi(yt.layout_symbol["text-transform"]),"text-offset":new Oi(yt.layout_symbol["text-offset"]),"text-allow-overlap":new Ii(yt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Ii(yt.layout_symbol["text-ignore-placement"]),"text-optional":new Ii(yt.layout_symbol["text-optional"])}),ys={paint:new Fi({"icon-opacity":new Oi(yt.paint_symbol["icon-opacity"]),"icon-color":new Oi(yt.paint_symbol["icon-color"]),"icon-halo-color":new Oi(yt.paint_symbol["icon-halo-color"]),"icon-halo-width":new Oi(yt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Oi(yt.paint_symbol["icon-halo-blur"]),"icon-translate":new Ii(yt.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ii(yt.paint_symbol["icon-translate-anchor"]),"text-opacity":new Oi(yt.paint_symbol["text-opacity"]),"text-color":new Oi(yt.paint_symbol["text-color"]),"text-halo-color":new Oi(yt.paint_symbol["text-halo-color"]),"text-halo-width":new Oi(yt.paint_symbol["text-halo-width"]),"text-halo-blur":new Oi(yt.paint_symbol["text-halo-blur"]),"text-translate":new Ii(yt.paint_symbol["text-translate"]),"text-translate-anchor":new Ii(yt.paint_symbol["text-translate-anchor"])}),layout:ms},_s=function(t){function e(e){t.call(this,e,ys)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.recalculate=function(e){t.prototype.recalculate.call(this,e),"auto"===this.layout.get("icon-rotation-alignment")&&("point"!==this.layout.get("symbol-placement")?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),"auto"===this.layout.get("text-rotation-alignment")&&("point"!==this.layout.get("symbol-placement")?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"))},e.prototype.getValueAndResolveTokens=function(t,e){var n,i=this.layout.get(t).evaluate(e,{}),r=this._unevaluatedLayout._values[t];return r.isDataDriven()||mn(r.value)?i:(n=e.properties,i.replace(/{([^{}]+)}/g,function(t,e){return e in n?String(n[e]):""}))},e.prototype.createBucket=function(t){return new ds(t)},e.prototype.queryRadius=function(){return 0},e.prototype.queryIntersectsFeature=function(){return!1},e}(Ni),gs={paint:new Fi({"background-color":new Ii(yt.paint_background["background-color"]),"background-pattern":new Ri(yt.paint_background["background-pattern"]),"background-opacity":new Ii(yt.paint_background["background-opacity"])})},vs=function(t){function e(e){t.call(this,e,gs)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ni),xs={paint:new Fi({"raster-opacity":new Ii(yt.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ii(yt.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ii(yt.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ii(yt.paint_raster["raster-brightness-max"]),"raster-saturation":new Ii(yt.paint_raster["raster-saturation"]),"raster-contrast":new Ii(yt.paint_raster["raster-contrast"]),"raster-resampling":new Ii(yt.paint_raster["raster-resampling"]),"raster-fade-duration":new Ii(yt.paint_raster["raster-fade-duration"])})},bs=function(t){function e(e){t.call(this,e,xs)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ni),ws=function(t){function e(e){t.call(this,e,{}),this.implementation=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.hasOffscreenPass=function(){return void 0!==this.implementation.prerender||"3d"===this.implementation.renderingMode},e.prototype.recalculate=function(){},e.prototype.updateTransitions=function(){},e.prototype.hasTransition=function(){},e.prototype.serialize=function(){},e.prototype.resize=function(){this.viewportFrame&&(this.viewportFrame.destroy(),this.viewportFrame=null)},e.prototype.onAdd=function(t){this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)},e.prototype.onRemove=function(t){this.implementation.onRemove&&this.implementation.onRemove(t)},e}(Ni),Es={circle:wo,heatmap:Mo,hillshade:Oo,fill:_a,"fill-extrusion":Pa,line:Ja,symbol:_s,background:vs,raster:bs};function Ts(t){for(var e=0,n=0,i=0,r=t;i<r.length;i+=1){var o=r[i];e+=o.w*o.h,n=Math.max(n,o.w)}t.sort(function(t,e){return e.h-t.h});for(var a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),n),h:1/0}],s=0,l=0,u=0,c=t;u<c.length;u+=1)for(var p=c[u],h=a.length-1;h>=0;h--){var f=a[h];if(!(p.w>f.w||p.h>f.h)){if(p.x=f.x,p.y=f.y,l=Math.max(l,p.y+p.h),s=Math.max(s,p.x+p.w),p.w===f.w&&p.h===f.h){var d=a.pop();h<a.length&&(a[h]=d)}else p.h===f.h?(f.x+=p.w,f.w-=p.w):p.w===f.w?(f.y+=p.h,f.h-=p.h):(a.push({x:f.x+p.w,y:f.y,w:f.w-p.w,h:p.h}),f.y+=p.h,f.h-=p.h);break}}return{w:s,h:l,fill:e/(s*l)||0}}var Ss=function(t,e){var n=e.pixelRatio;this.paddedRect=t,this.pixelRatio=n},Ps={tl:{configurable:!0},br:{configurable:!0},tlbr:{configurable:!0},displaySize:{configurable:!0}};Ps.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},Ps.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},Ps.tlbr.get=function(){return this.tl.concat(this.br)},Ps.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(Ss.prototype,Ps);var Cs=function(t,e){var n={},i={},r=[];for(var o in t){var a=t[o],s={x:0,y:0,w:a.data.width+2,h:a.data.height+2};r.push(s),n[o]=new Ss(s,a)}for(var l in e){var u=e[l],c={x:0,y:0,w:u.data.width+2,h:u.data.height+2};r.push(c),i[l]=new Ss(c,u)}var p=Ts(r),h=p.w,f=p.h,d=new Ao({width:h||1,height:f||1});for(var m in t){var y=t[m],_=n[m].paddedRect;Ao.copy(y.data,d,{x:0,y:0},{x:_.x+1,y:_.y+1},y.data)}for(var g in e){var v=e[g],x=i[g].paddedRect,b=x.x+1,w=x.y+1,E=v.data.width,T=v.data.height;Ao.copy(v.data,d,{x:0,y:0},{x:b,y:w},v.data),Ao.copy(v.data,d,{x:0,y:T-1},{x:b,y:w-1},{width:E,height:1}),Ao.copy(v.data,d,{x:0,y:0},{x:b,y:w+T},{width:E,height:1}),Ao.copy(v.data,d,{x:E-1,y:0},{x:b-1,y:w},{width:1,height:T}),Ao.copy(v.data,d,{x:0,y:0},{x:b+E,y:w},{width:1,height:T})}this.image=d,this.iconPositions=n,this.patternPositions=i};si("ImagePosition",Ss),si("ImageAtlas",Cs);var ks=self.HTMLImageElement,As=self.HTMLCanvasElement,zs=self.HTMLVideoElement,Ls=self.ImageData,Ms=function(t,e,n,i){this.context=t,this.format=n,this.texture=t.gl.createTexture(),this.update(e,i)};Ms.prototype.update=function(t,e){var n=t.width,i=t.height,r=!this.size||this.size[0]!==n||this.size[1]!==i,o=this.context,a=o.gl;this.useMipmap=Boolean(e&&e.useMipmap),a.bindTexture(a.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1),o.pixelStoreUnpackPremultiplyAlpha.set(this.format===a.RGBA&&(!e||!1!==e.premultiply)),r?(this.size=[n,i],t instanceof ks||t instanceof As||t instanceof zs||t instanceof Ls?a.texImage2D(a.TEXTURE_2D,0,this.format,this.format,a.UNSIGNED_BYTE,t):a.texImage2D(a.TEXTURE_2D,0,this.format,n,i,0,this.format,a.UNSIGNED_BYTE,t.data)):t instanceof ks||t instanceof As||t instanceof zs||t instanceof Ls?a.texSubImage2D(a.TEXTURE_2D,0,0,0,a.RGBA,a.UNSIGNED_BYTE,t):a.texSubImage2D(a.TEXTURE_2D,0,0,0,n,i,a.RGBA,a.UNSIGNED_BYTE,t.data),this.useMipmap&&this.isSizePowerOfTwo()&&a.generateMipmap(a.TEXTURE_2D)},Ms.prototype.bind=function(t,e,n){var i=this.context.gl;i.bindTexture(i.TEXTURE_2D,this.texture),n!==i.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(n=i.LINEAR),t!==this.filter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,n||t),this.filter=t),e!==this.wrap&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,e),this.wrap=e)},Ms.prototype.isSizePowerOfTwo=function(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0},Ms.prototype.destroy=function(){this.context.gl.deleteTexture(this.texture),this.texture=null};var Is=function(t,e,n,i,r){var o,a,s=8*r-i-1,l=(1<<s)-1,u=l>>1,c=-7,p=n?r-1:0,h=n?-1:1,f=t[e+p];for(p+=h,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=256*o+t[e+p],p+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=i;c>0;a=256*a+t[e+p],p+=h,c-=8);if(0===o)o=1-u;else{if(o===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,i),o-=u}return(f?-1:1)*a*Math.pow(2,o-i)},Os=function(t,e,n,i,r,o){var a,s,l,u=8*o-r-1,c=(1<<u)-1,p=c>>1,h=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:o-1,d=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),(e+=a+p>=1?h/l:h*Math.pow(2,1-p))*l>=2&&(a++,l/=2),a+p>=c?(s=0,a=c):a+p>=1?(s=(e*l-1)*Math.pow(2,r),a+=p):(s=e*Math.pow(2,p-1)*Math.pow(2,r),a=0));r>=8;t[n+f]=255&s,f+=d,s/=256,r-=8);for(a=a<<r|s,u+=r;u>0;t[n+f]=255&a,f+=d,a/=256,u-=8);t[n+f-d]|=128*m},Ds=Rs;function Rs(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}function Bs(t){return t.type===Rs.Bytes?t.readVarint()+t.pos:t.pos+1}function Fs(t,e,n){return n?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Ns(t,e,n){var i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.ceil(Math.log(e)/(7*Math.LN2));n.realloc(i);for(var r=n.pos-1;r>=t;r--)n.buf[r+i]=n.buf[r]}function Us(t,e){for(var n=0;n<t.length;n++)e.writeVarint(t[n])}function js(t,e){for(var n=0;n<t.length;n++)e.writeSVarint(t[n])}function Vs(t,e){for(var n=0;n<t.length;n++)e.writeFloat(t[n])}function Zs(t,e){for(var n=0;n<t.length;n++)e.writeDouble(t[n])}function qs(t,e){for(var n=0;n<t.length;n++)e.writeBoolean(t[n])}function Gs(t,e){for(var n=0;n<t.length;n++)e.writeFixed32(t[n])}function Ws(t,e){for(var n=0;n<t.length;n++)e.writeSFixed32(t[n])}function Hs(t,e){for(var n=0;n<t.length;n++)e.writeFixed64(t[n])}function Xs(t,e){for(var n=0;n<t.length;n++)e.writeSFixed64(t[n])}function Ks(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function Ys(t,e,n){t[n]=e,t[n+1]=e>>>8,t[n+2]=e>>>16,t[n+3]=e>>>24}function Js(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}Rs.Varint=0,Rs.Fixed64=1,Rs.Bytes=2,Rs.Fixed32=5,Rs.prototype={destroy:function(){this.buf=null},readFields:function(t,e,n){for(n=n||this.length;this.pos<n;){var i=this.readVarint(),r=i>>3,o=this.pos;this.type=7&i,t(r,e,this),this.pos===o&&this.skip(i)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Ks(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Js(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Ks(this.buf,this.pos)+4294967296*Ks(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=Ks(this.buf,this.pos)+4294967296*Js(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=Is(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Is(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,n,i=this.buf;return e=127&(n=i[this.pos++]),n<128?e:(e|=(127&(n=i[this.pos++]))<<7,n<128?e:(e|=(127&(n=i[this.pos++]))<<14,n<128?e:(e|=(127&(n=i[this.pos++]))<<21,n<128?e:function(t,e,n){var i,r,o=n.buf;if(i=(112&(r=o[n.pos++]))>>4,r<128)return Fs(t,i,e);if(i|=(127&(r=o[n.pos++]))<<3,r<128)return Fs(t,i,e);if(i|=(127&(r=o[n.pos++]))<<10,r<128)return Fs(t,i,e);if(i|=(127&(r=o[n.pos++]))<<17,r<128)return Fs(t,i,e);if(i|=(127&(r=o[n.pos++]))<<24,r<128)return Fs(t,i,e);if(i|=(1&(r=o[n.pos++]))<<31,r<128)return Fs(t,i,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(n=i[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=function(t,e,n){for(var i="",r=e;r<n;){var o,a,s,l=t[r],u=null,c=l>239?4:l>223?3:l>191?2:1;if(r+c>n)break;1===c?l<128&&(u=l):2===c?128==(192&(o=t[r+1]))&&(u=(31&l)<<6|63&o)<=127&&(u=null):3===c?(o=t[r+1],a=t[r+2],128==(192&o)&&128==(192&a)&&((u=(15&l)<<12|(63&o)<<6|63&a)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(o=t[r+1],a=t[r+2],s=t[r+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&((u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,i+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),i+=String.fromCharCode(u),r+=c}return i}(this.buf,this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){var n=Bs(this);for(t=t||[];this.pos<n;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){var e=Bs(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){var e=Bs(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){var e=Bs(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){var e=Bs(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){var e=Bs(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){var e=Bs(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){var e=Bs(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){var e=Bs(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===Rs.Varint)for(;this.buf[this.pos++]>127;);else if(e===Rs.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Rs.Fixed32)this.pos+=4;else{if(e!==Rs.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var n=new Uint8Array(e);n.set(this.buf),this.buf=n,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),Ys(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Ys(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Ys(this.buf,-1&t,this.pos),Ys(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Ys(this.buf,-1&t,this.pos),Ys(this.buf,Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(t,e){var n,i;if(t>=0?(n=t%4294967296|0,i=t/4294967296|0):(i=~(-t/4294967296),4294967295^(n=~(-t%4294967296))?n=n+1|0:(n=0,i=i+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,n){n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos++]=127&t|128,t>>>=7,n.buf[n.pos]=127&t}(n,0,e),function(t,e){var n=(7&t)<<4;e.buf[e.pos++]|=n|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(i,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,n){for(var i,r,o=0;o<e.length;o++){if((i=e.charCodeAt(o))>55295&&i<57344){if(!r){i>56319||o+1===e.length?(t[n++]=239,t[n++]=191,t[n++]=189):r=i;continue}if(i<56320){t[n++]=239,t[n++]=191,t[n++]=189,r=i;continue}i=r-55296<<10|i-56320|65536,r=null}else r&&(t[n++]=239,t[n++]=191,t[n++]=189,r=null);i<128?t[n++]=i:(i<2048?t[n++]=i>>6|192:(i<65536?t[n++]=i>>12|224:(t[n++]=i>>18|240,t[n++]=i>>12&63|128),t[n++]=i>>6&63|128),t[n++]=63&i|128)}return n}(this.buf,t,this.pos);var n=this.pos-e;n>=128&&Ns(e,n,this),this.pos=e-1,this.writeVarint(n),this.pos+=n},writeFloat:function(t){this.realloc(4),Os(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Os(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var n=0;n<e;n++)this.buf[this.pos++]=t[n]},writeRawMessage:function(t,e){this.pos++;var n=this.pos;t(e,this);var i=this.pos-n;i>=128&&Ns(n,i,this),this.pos=n-1,this.writeVarint(i),this.pos+=i},writeMessage:function(t,e,n){this.writeTag(t,Rs.Bytes),this.writeRawMessage(e,n)},writePackedVarint:function(t,e){this.writeMessage(t,Us,e)},writePackedSVarint:function(t,e){this.writeMessage(t,js,e)},writePackedBoolean:function(t,e){this.writeMessage(t,qs,e)},writePackedFloat:function(t,e){this.writeMessage(t,Vs,e)},writePackedDouble:function(t,e){this.writeMessage(t,Zs,e)},writePackedFixed32:function(t,e){this.writeMessage(t,Gs,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,Ws,e)},writePackedFixed64:function(t,e){this.writeMessage(t,Hs,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,Xs,e)},writeBytesField:function(t,e){this.writeTag(t,Rs.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,Rs.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,Rs.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,Rs.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,Rs.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,Rs.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,Rs.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,Rs.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,Rs.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,Rs.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var $s=3;function Qs(t,e,n){1===t&&n.readMessage(tl,e)}function tl(t,e,n){if(3===t){var i=n.readMessage(el,{}),r=i.id,o=i.bitmap,a=i.width,s=i.height,l=i.left,u=i.top,c=i.advance;e.push({id:r,bitmap:new ko({width:a+2*$s,height:s+2*$s},o),metrics:{width:a,height:s,left:l,top:u,advance:c}})}}function el(t,e,n){1===t?e.id=n.readVarint():2===t?e.bitmap=n.readBytes():3===t?e.width=n.readVarint():4===t?e.height=n.readVarint():5===t?e.left=n.readSVarint():6===t?e.top=n.readSVarint():7===t&&(e.advance=n.readVarint())}var nl=$s,il=function(t,e,n){this.target=t,this.parent=e,this.mapId=n,this.callbacks={},this.callbackID=0,y(["receive"],this),this.target.addEventListener("message",this.receive,!1)};function rl(t,e,n){var i=2*Math.PI*6378137/256/Math.pow(2,n);return[t*i-2*Math.PI*6378137/2,e*i-2*Math.PI*6378137/2]}il.prototype.send=function(t,e,n,i){var r=this,o=n?this.mapId+":"+this.callbackID++:null;n&&(this.callbacks[o]=n);var a=[];if(this.target.postMessage({targetMapId:i,sourceMapId:this.mapId,type:t,id:String(o),data:ui(e,a)},a),n)return{cancel:function(){return r.target.postMessage({targetMapId:i,sourceMapId:r.mapId,type:"<cancel>",id:String(o)})}}},il.prototype.receive=function(t){var e,n=this,i=t.data,r=i.id;if(!i.targetMapId||this.mapId===i.targetMapId){var o=function(t,e){delete n.callbacks[r];var i=[];n.target.postMessage({sourceMapId:n.mapId,type:"<response>",id:String(r),error:t?ui(t):null,data:ui(e,i)},i)};if("<response>"===i.type||"<cancel>"===i.type)e=this.callbacks[i.id],delete this.callbacks[i.id],e&&i.error?e(ci(i.error)):e&&e(null,ci(i.data));else if(void 0!==i.id&&this.parent[i.type]){this.callbacks[i.id]=null;var a=this.parent[i.type](i.sourceMapId,ci(i.data),o);a&&null===this.callbacks[i.id]&&(this.callbacks[i.id]=a)}else if(void 0!==i.id&&this.parent.getWorkerSource){var s=i.type.split("."),l=ci(i.data);this.parent.getWorkerSource(i.sourceMapId,s[0],l.source)[s[1]](l,o)}else this.parent[i.type](ci(i.data))}},il.prototype.remove=function(){this.target.removeEventListener("message",this.receive,!1)};var ol=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};ol.prototype.setNorthEast=function(t){return this._ne=t instanceof al?new al(t.lng,t.lat):al.convert(t),this},ol.prototype.setSouthWest=function(t){return this._sw=t instanceof al?new al(t.lng,t.lat):al.convert(t),this},ol.prototype.extend=function(t){var e,n,i=this._sw,r=this._ne;if(t instanceof al)e=t,n=t;else{if(!(t instanceof ol))return Array.isArray(t)?t.every(Array.isArray)?this.extend(ol.convert(t)):this.extend(al.convert(t)):this;if(e=t._sw,n=t._ne,!e||!n)return this}return i||r?(i.lng=Math.min(e.lng,i.lng),i.lat=Math.min(e.lat,i.lat),r.lng=Math.max(n.lng,r.lng),r.lat=Math.max(n.lat,r.lat)):(this._sw=new al(e.lng,e.lat),this._ne=new al(n.lng,n.lat)),this},ol.prototype.getCenter=function(){return new al((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},ol.prototype.getSouthWest=function(){return this._sw},ol.prototype.getNorthEast=function(){return this._ne},ol.prototype.getNorthWest=function(){return new al(this.getWest(),this.getNorth())},ol.prototype.getSouthEast=function(){return new al(this.getEast(),this.getSouth())},ol.prototype.getWest=function(){return this._sw.lng},ol.prototype.getSouth=function(){return this._sw.lat},ol.prototype.getEast=function(){return this._ne.lng},ol.prototype.getNorth=function(){return this._ne.lat},ol.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},ol.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},ol.prototype.isEmpty=function(){return!(this._sw&&this._ne)},ol.convert=function(t){return!t||t instanceof ol?t:new ol(t)};var al=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};function sl(t){return 2*Math.PI*6378137*Math.cos(t*Math.PI/180)}function ll(t){return(180+t)/360}function ul(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function cl(t,e){return t/sl(e)}function pl(t){var e=180-360*t;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}al.prototype.wrap=function(){return new al(c(this.lng,-180,180),this.lat)},al.prototype.toArray=function(){return[this.lng,this.lat]},al.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},al.prototype.toBounds=function(t){void 0===t&&(t=0);var e=360*t/40075017,n=e/Math.cos(Math.PI/180*this.lat);return new ol(new al(this.lng-n,this.lat-e),new al(this.lng+n,this.lat+e))},al.convert=function(t){if(t instanceof al)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new al(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new al(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")};var hl=function(t,e,n){void 0===n&&(n=0),this.x=+t,this.y=+e,this.z=+n};hl.fromLngLat=function(t,e){void 0===e&&(e=0);var n=al.convert(t);return new hl(ll(n.lng),ul(n.lat),cl(e,n.lat))},hl.prototype.toLngLat=function(){return new al(360*this.x-180,pl(this.y))},hl.prototype.toAltitude=function(){return this.z*sl(pl(this.y))};var fl=function(t,e,n){this.z=t,this.x=e,this.y=n,this.key=yl(0,t,e,n)};fl.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},fl.prototype.url=function(t,e){var n,i,r,o,a,s=(n=this.x,i=this.y,r=this.z,o=rl(256*n,256*(i=Math.pow(2,r)-i-1),r),a=rl(256*(n+1),256*(i+1),r),o[0]+","+o[1]+","+a[0]+","+a[1]),l=function(t,e,n){for(var i,r="",o=t;o>0;o--)r+=(e&(i=1<<o-1)?1:0)+(n&i?2:0);return r}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace("{z}",String(this.z)).replace("{x}",String(this.x)).replace("{y}",String("tms"===e?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",l).replace("{bbox-epsg-3857}",s)},fl.prototype.getTilePoint=function(t){var e=Math.pow(2,this.z);return new r((t.x*e-this.x)*Kr,(t.y*e-this.y)*Kr)};var dl=function(t,e){this.wrap=t,this.canonical=e,this.key=yl(t,e.z,e.x,e.y)},ml=function(t,e,n,i,r){this.overscaledZ=t,this.wrap=e,this.canonical=new fl(n,+i,+r),this.key=yl(e,t,i,r)};function yl(t,e,n,i){(t*=2)<0&&(t=-1*t-1);var r=1<<e;return 32*(r*r*t+r*i+n)+e}ml.prototype.equals=function(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)},ml.prototype.scaledTo=function(t){var e=this.canonical.z-t;return t>this.canonical.z?new ml(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ml(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},ml.prototype.isChildOf=function(t){if(t.wrap!==this.wrap)return!1;var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e},ml.prototype.children=function(t){if(this.overscaledZ>=t)return[new ml(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,n=2*this.canonical.x,i=2*this.canonical.y;return[new ml(e,this.wrap,e,n,i),new ml(e,this.wrap,e,n+1,i),new ml(e,this.wrap,e,n,i+1),new ml(e,this.wrap,e,n+1,i+1)]},ml.prototype.isLessThan=function(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))},ml.prototype.wrapped=function(){return new ml(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)},ml.prototype.unwrapTo=function(t){return new ml(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)},ml.prototype.overscaleFactor=function(){return Math.pow(2,this.overscaledZ-this.canonical.z)},ml.prototype.toUnwrapped=function(){return new dl(this.wrap,this.canonical)},ml.prototype.toString=function(){return this.overscaledZ+"/"+this.canonical.x+"/"+this.canonical.y},ml.prototype.getTilePoint=function(t){return this.canonical.getTilePoint(new hl(t.x-this.wrap,t.y))},si("CanonicalTileID",fl),si("OverscaledTileID",ml,{omit:["posMatrix"]});var _l=function(t,e,n){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(n&&"mapbox"!==n&&"terrarium"!==n)return w('"'+n+'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".');var i=this.dim=e.height;this.stride=this.dim+2,this.data=new Int32Array(this.stride*this.stride);for(var r=e.data,o="terrarium"===n?this._unpackTerrarium:this._unpackMapbox,a=0;a<i;a++)for(var s=0;s<i;s++){var l=4*(a*i+s);this.set(s,a,o(r[l],r[l+1],r[l+2]))}for(var u=0;u<i;u++)this.set(-1,u,this.get(0,u)),this.set(i,u,this.get(i-1,u)),this.set(u,-1,this.get(u,0)),this.set(u,i,this.get(u,i-1));this.set(-1,-1,this.get(0,0)),this.set(i,-1,this.get(i-1,0)),this.set(-1,i,this.get(0,i-1)),this.set(i,i,this.get(i-1,i-1))};_l.prototype.set=function(t,e,n){this.data[this._idx(t,e)]=n+65536},_l.prototype.get=function(t,e){return this.data[this._idx(t,e)]-65536},_l.prototype._idx=function(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)},_l.prototype._unpackMapbox=function(t,e,n){return(256*t*256+256*e+n)/10-1e4},_l.prototype._unpackTerrarium=function(t,e,n){return 256*t+e+n/256-32768},_l.prototype.getPixels=function(){return new Ao({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},_l.prototype.backfillBorder=function(t,e,n){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");var i=e*this.dim,r=e*this.dim+this.dim,o=n*this.dim,a=n*this.dim+this.dim;switch(e){case-1:i=r-1;break;case 1:r=i+1}switch(n){case-1:o=a-1;break;case 1:a=o+1}for(var s=-e*this.dim,l=-n*this.dim,u=o;u<a;u++)for(var c=i;c<r;c++)this.set(c,u,t.get(c+s,u+l))},si("DEMData",_l);var gl=Zi([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),vl=function(t){this._stringToNumber={},this._numberToString=[];for(var e=0;e<t.length;e++){var n=t[e];this._stringToNumber[n]=e,this._numberToString[e]=n}};vl.prototype.encode=function(t){return this._stringToNumber[t]},vl.prototype.decode=function(t){return this._numberToString[t]};var xl=function(t,e,n,i){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=n,t._y=i,this.properties=t.properties,null!=t.id&&(this.id=t.id)},bl={geometry:{configurable:!0}};bl.geometry.get=function(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry},bl.geometry.set=function(t){this._geometry=t},xl.prototype.toJSON=function(){var t={geometry:this.geometry};for(var e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t},Object.defineProperties(xl.prototype,bl);var wl=function(){this.state={},this.stateChanges={},this.deletedStates={}};wl.prototype.updateState=function(t,e,n){var i=String(e);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][i]=this.stateChanges[t][i]||{},p(this.stateChanges[t][i],n),null===this.deletedStates[t])for(var r in this.deletedStates[t]={},this.state[t])r!==i&&(this.deletedStates[t][r]=null);else if(this.deletedStates[t]&&null===this.deletedStates[t][i])for(var o in this.deletedStates[t][i]={},this.state[t][i])n[o]||(this.deletedStates[t][i][o]=null);else for(var a in n)this.deletedStates[t]&&this.deletedStates[t][i]&&null===this.deletedStates[t][i][a]&&delete this.deletedStates[t][i][a]},wl.prototype.removeFeatureState=function(t,e,n){if(null!==this.deletedStates[t]){var i=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},n&&e)null!==this.deletedStates[t][i]&&(this.deletedStates[t][i]=this.deletedStates[t][i]||{},this.deletedStates[t][i][n]=null);else if(e)if(this.stateChanges[t]&&this.stateChanges[t][i])for(n in this.deletedStates[t][i]={},this.stateChanges[t][i])this.deletedStates[t][i][n]=null;else this.deletedStates[t][i]=null;else this.deletedStates[t]=null}},wl.prototype.getState=function(t,e){var n=String(e),i=this.state[t]||{},r=this.stateChanges[t]||{},o=p({},i[n],r[n]);if(null===this.deletedStates[t])return{};if(this.deletedStates[t]){var a=this.deletedStates[t][e];if(null===a)return{};for(var s in a)delete o[s]}return o},wl.prototype.initializeTileState=function(t,e){t.setFeatureState(this.state,e)},wl.prototype.coalesceChanges=function(t,e){var n={};for(var i in this.stateChanges){this.state[i]=this.state[i]||{};var r={};for(var o in this.stateChanges[i])this.state[i][o]||(this.state[i][o]={}),p(this.state[i][o],this.stateChanges[i][o]),r[o]=this.state[i][o];n[i]=r}for(var a in this.deletedStates){this.state[a]=this.state[a]||{};var s={};if(null===this.deletedStates[a]){for(var l in this.state[a])s[l]={};this.state[a]={}}else for(var u in this.deletedStates[a]){if(null===this.deletedStates[a][u])this.state[a][u]={};else for(var c=0,h=Object.keys(this.deletedStates[a][u]);c<h.length;c+=1){var f=h[c];delete this.state[a][u][f]}s[u]=this.state[a][u]}n[a]=n[a]||{},p(n[a],s)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(n).length)for(var d in t)t[d].setFeatureState(n,e)};var El=function(t,e,n){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=e||new ni(Kr,16,0),this.grid3D=new ni(Kr,16,0),this.featureIndexArray=n||new Er};function Tl(t){for(var e=1/0,n=1/0,i=-1/0,r=-1/0,o=0,a=t;o<a.length;o+=1){var s=a[o];e=Math.min(e,s.x),n=Math.min(n,s.y),i=Math.max(i,s.x),r=Math.max(r,s.y)}return{minX:e,minY:n,maxX:i,maxY:r}}function Sl(t,e){return e-t}El.prototype.insert=function(t,e,n,i,r,o){var a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,i,r);for(var s=o?this.grid3D:this.grid,l=0;l<e.length;l++){for(var u=e[l],c=[1/0,1/0,-1/0,-1/0],p=0;p<u.length;p++){var h=u[p];c[0]=Math.min(c[0],h.x),c[1]=Math.min(c[1],h.y),c[2]=Math.max(c[2],h.x),c[3]=Math.max(c[3],h.y)}c[0]<Kr&&c[1]<Kr&&c[2]>=0&&c[3]>=0&&s.insert(a,c[0],c[1],c[2],c[3])}},El.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new Na.VectorTile(new Ds(this.rawTileData)).layers,this.sourceLayerCoder=new vl(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},El.prototype.query=function(t,e,n){var i=this;this.loadVTLayers();for(var o=t.params||{},a=Kr/t.tileSize/t.scale,s=zn(o.filter),l=t.queryGeometry,u=t.queryPadding*a,c=Tl(l),p=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),h=Tl(t.cameraQueryGeometry),f=0,d=this.grid3D.query(h.minX-u,h.minY-u,h.maxX+u,h.maxY+u,function(e,n,i,o){return function(t,e,n,i,o){for(var a=0,s=t;a<s.length;a+=1){var l=s[a];if(e<=l.x&&n<=l.y&&i>=l.x&&o>=l.y)return!0}var u=[new r(e,n),new r(e,o),new r(i,o),new r(i,n)];if(t.length>2)for(var c=0,p=u;c<p.length;c+=1)if(uo(t,p[c]))return!0;for(var h=0;h<t.length-1;h++)if(co(t[h],t[h+1],u))return!0;return!1}(t.cameraQueryGeometry,e-u,n-u,i+u,o+u)});f<d.length;f+=1){var m=d[f];p.push(m)}p.sort(Sl);for(var y,_={},g=function(r){var u=p[r];if(u!==y){y=u;var c=i.featureIndexArray.get(u),h=null;i.loadMatchingFeature(_,c.bucketIndex,c.sourceLayerIndex,c.featureIndex,s,o.layers,e,function(e,r){h||(h=Jr(e));var o={};return e.id&&(o=n.getState(r.sourceLayer||"_geojsonTileLayer",e.id)),r.queryIntersectsFeature(l,e,o,h,i.z,t.transform,a,t.pixelPosMatrix)})}},v=0;v<p.length;v++)g(v);return _},El.prototype.loadMatchingFeature=function(t,e,n,i,r,o,a,s){var l=this.bucketLayerIDs[e];if(!o||function(t,e){for(var n=0;n<t.length;n++)if(e.indexOf(t[n])>=0)return!0;return!1}(o,l)){var u=this.sourceLayerCoder.decode(n),c=this.vtLayers[u].feature(i);if(r(new Ti(this.tileID.overscaledZ),c))for(var p=0;p<l.length;p++){var h=l[p];if(!(o&&o.indexOf(h)<0)){var f=a[h];if(f){var d=!s||s(c,f);if(d){var m=new xl(c,this.z,this.x,this.y);m.layer=f.serialize();var y=t[h];void 0===y&&(y=t[h]=[]),y.push({featureIndex:i,feature:m,intersectionZ:d})}}}}}},El.prototype.lookupSymbolFeatures=function(t,e,n,i,r,o){var a={};this.loadVTLayers();for(var s=zn(i),l=0,u=t;l<u.length;l+=1){var c=u[l];this.loadMatchingFeature(a,e,n,c,s,r,o)}return a},El.prototype.hasLayer=function(t){for(var e=0,n=this.bucketLayerIDs;e<n.length;e+=1)for(var i=0,r=n[e];i<r.length;i+=1)if(t===r[i])return!0;return!1},si("FeatureIndex",El,{omit:["rawTileData","sourceLayerCoder"]});var Pl=function(t,e){this.tileID=t,this.uid=f(),this.uses=0,this.tileSize=e,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.expiredRequestCount=0,this.state="loading"};Pl.prototype.registerFadeDuration=function(t){var e=t+this.timeAdded;e<L.now()||this.fadeEndTime&&e<this.fadeEndTime||(this.fadeEndTime=e)},Pl.prototype.wasRequested=function(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state},Pl.prototype.loadVectorData=function(t,e,n){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){for(var i in t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(t,e){var n={};if(!e)return n;for(var i=function(){var t=o[r],i=t.layerIds.map(function(t){return e.getLayer(t)}).filter(Boolean);if(0!==i.length){t.layers=i,t.stateDependentLayerIds&&(t.stateDependentLayers=t.stateDependentLayerIds.map(function(t){return i.filter(function(e){return e.id===t})[0]}));for(var a=0,s=i;a<s.length;a+=1){var l=s[a];n[l.id]=t}}},r=0,o=t;r<o.length;r+=1)i();return n}(t.buckets,e.style),this.hasSymbolBuckets=!1,this.buckets){var r=this.buckets[i];if(r instanceof ds){if(this.hasSymbolBuckets=!0,!n)break;r.justReloaded=!0}}for(var o in this.queryPadding=0,this.buckets){var a=this.buckets[o];this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(o).queryRadius(a))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new fr},Pl.prototype.unloadVectorData=function(){for(var t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"},Pl.prototype.unloadDEMData=function(){this.dem=null,this.neighboringTiles=null,this.state="unloaded"},Pl.prototype.getBucket=function(t){return this.buckets[t.id]},Pl.prototype.upload=function(t){for(var e in this.buckets){var n=this.buckets[e];n.uploadPending()&&n.upload(t)}var i=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Ms(t,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Ms(t,this.glyphAtlasImage,i.ALPHA),this.glyphAtlasImage=null)},Pl.prototype.queryRenderedFeatures=function(t,e,n,i,r,o,a,s,l){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:n,cameraQueryGeometry:i,scale:r,tileSize:this.tileSize,pixelPosMatrix:l,transform:a,params:o,queryPadding:this.queryPadding*s},t,e):{}},Pl.prototype.querySourceFeatures=function(t,e){if(this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData){var n=this.latestFeatureIndex.loadVTLayers(),i=e?e.sourceLayer:"",r=n._geojsonTileLayer||n[i];if(r)for(var o=zn(e&&e.filter),a=this.tileID.canonical,s=a.z,l=a.x,u=a.y,c={z:s,x:l,y:u},p=0;p<r.length;p++){var h=r.feature(p);if(o(new Ti(this.tileID.overscaledZ),h)){var f=new xl(h,s,l,u);f.tile=c,t.push(f)}}}},Pl.prototype.clearMask=function(){this.segments&&(this.segments.destroy(),delete this.segments),this.maskedBoundsBuffer&&(this.maskedBoundsBuffer.destroy(),delete this.maskedBoundsBuffer),this.maskedIndexBuffer&&(this.maskedIndexBuffer.destroy(),delete this.maskedIndexBuffer)},Pl.prototype.setMask=function(t,e){if(!a(this.mask,t)&&(this.mask=t,this.clearMask(),!a(t,{0:!0}))){var n=new Wi,i=new sr;this.segments=new Pr,this.segments.prepareSegment(0,n,i);for(var o=Object.keys(t),s=0;s<o.length;s++){var l=t[o[s]],u=Kr>>l.z,c=new r(l.x*u,l.y*u),p=new r(c.x+u,c.y+u),h=this.segments.prepareSegment(4,n,i);n.emplaceBack(c.x,c.y,c.x,c.y),n.emplaceBack(p.x,c.y,p.x,c.y),n.emplaceBack(c.x,p.y,c.x,p.y),n.emplaceBack(p.x,p.y,p.x,p.y);var f=h.vertexLength;i.emplaceBack(f,f+1,f+2),i.emplaceBack(f+1,f+2,f+3),h.vertexLength+=4,h.primitiveLength+=2}this.maskedBoundsBuffer=e.createVertexBuffer(n,gl.members),this.maskedIndexBuffer=e.createIndexBuffer(i)}},Pl.prototype.hasData=function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state},Pl.prototype.patternsLoaded=function(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length},Pl.prototype.setExpiryData=function(t){var e=this.expirationTime;if(t.cacheControl){var n=function(t){var e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,function(t,n,i,r){var o=i||r;return e[n]=!o||o.toLowerCase(),""}),e["max-age"]){var n=parseInt(e["max-age"],10);isNaN(n)?delete e["max-age"]:e["max-age"]=n}return e}(t.cacheControl);n["max-age"]&&(this.expirationTime=Date.now()+1e3*n["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){var i=Date.now(),r=!1;if(this.expirationTime>i)r=!1;else if(e)if(this.expirationTime<e)r=!0;else{var o=this.expirationTime-e;o?this.expirationTime=i+Math.max(o,3e4):r=!0}else r=!0;r?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}},Pl.prototype.getExpiryTimeout=function(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)},Pl.prototype.setFeatureState=function(t,e){if(this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData&&0!==Object.keys(t).length){var n=this.latestFeatureIndex.loadVTLayers();for(var i in this.buckets){var r=this.buckets[i],o=r.layers[0].sourceLayer||"_geojsonTileLayer",a=n[o],s=t[o];a&&s&&0!==Object.keys(s).length&&(r.update(s,a,this.imageAtlas&&this.imageAtlas.patternPositions||{}),e&&e.style&&(this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(i).queryRadius(r))))}}},Pl.prototype.holdingForFade=function(){return void 0!==this.symbolFadeHoldUntil},Pl.prototype.symbolFadeFinished=function(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<L.now()},Pl.prototype.clearFadeHold=function(){this.symbolFadeHoldUntil=void 0},Pl.prototype.setHoldDuration=function(t){this.symbolFadeHoldUntil=L.now()+t};var Cl={horizontal:1,vertical:2,horizontalOnly:3},kl=function(){this.text="",this.sectionIndex=[],this.sections=[]};kl.fromFeature=function(t,e){for(var n=new kl,i=0;i<t.sections.length;i++){var r=t.sections[i];n.sections.push({scale:r.scale||1,fontStack:r.fontStack||e}),n.text+=r.text;for(var o=0;o<r.text.length;o++)n.sectionIndex.push(i)}return n},kl.prototype.length=function(){return this.text.length},kl.prototype.getSection=function(t){return this.sections[this.sectionIndex[t]]},kl.prototype.getCharCode=function(t){return this.text.charCodeAt(t)},kl.prototype.verticalizePunctuation=function(){this.text=function(t){for(var e="",n=0;n<t.length;n++){var i=t.charCodeAt(n+1)||null,r=t.charCodeAt(n-1)||null;i&&yi(i)&&!os[t[n+1]]||r&&yi(r)&&!os[t[n-1]]||!os[t[n]]?e+=t[n]:e+=os[t[n]]}return e}(this.text)},kl.prototype.trim=function(){for(var t=0,e=0;e<this.text.length&&Al[this.text.charCodeAt(e)];e++)t++;for(var n=this.text.length,i=this.text.length-1;i>=0&&i>=t&&Al[this.text.charCodeAt(i)];i--)n--;this.text=this.text.substring(t,n),this.sectionIndex=this.sectionIndex.slice(t,n)},kl.prototype.substring=function(t,e){var n=new kl;return n.text=this.text.substring(t,e),n.sectionIndex=this.sectionIndex.slice(t,e),n.sections=this.sections,n},kl.prototype.toString=function(){return this.text},kl.prototype.getMaxScale=function(){var t=this;return this.sectionIndex.reduce(function(e,n){return Math.max(e,t.sections[n].scale)},0)};var Al={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},zl={};function Ll(t,e,n,i){var r=Math.pow(t-e,2);return i?t<e?r/2:2*r:r+Math.abs(n)*n}function Ml(t,e){var n=0;return 10===t&&(n-=1e4),40!==t&&65288!==t||(n+=50),41!==e&&65289!==e||(n+=50),n}function Il(t,e,n,i,r,o){for(var a=null,s=Ll(e,n,r,o),l=0,u=i;l<u.length;l+=1){var c=u[l],p=Ll(e-c.x,n,r,o)+c.badness;p<=s&&(a=c,s=p)}return{index:t,x:e,priorBreak:a,badness:s}}function Ol(t,e,n,i){if(!n)return[];if(!t)return[];for(var r,o=[],a=function(t,e,n,i){for(var r=0,o=0;o<t.length();o++){var a=t.getSection(o),s=i[a.fontStack],l=s&&s[t.getCharCode(o)];l&&(r+=l.metrics.advance*a.scale+e)}return r/Math.max(1,Math.ceil(r/n))}(t,e,n,i),s=0,l=0;l<t.length();l++){var u=t.getSection(l),c=t.getCharCode(l),p=i[u.fontStack],h=p&&p[c];h&&!Al[c]&&(s+=h.metrics.advance*u.scale+e),l<t.length()-1&&(zl[c]||!((r=c)<11904)&&(hi["Bopomofo Extended"](r)||hi.Bopomofo(r)||hi["CJK Compatibility Forms"](r)||hi["CJK Compatibility Ideographs"](r)||hi["CJK Compatibility"](r)||hi["CJK Radicals Supplement"](r)||hi["CJK Strokes"](r)||hi["CJK Symbols and Punctuation"](r)||hi["CJK Unified Ideographs Extension A"](r)||hi["CJK Unified Ideographs"](r)||hi["Enclosed CJK Letters and Months"](r)||hi["Halfwidth and Fullwidth Forms"](r)||hi.Hiragana(r)||hi["Ideographic Description Characters"](r)||hi["Kangxi Radicals"](r)||hi["Katakana Phonetic Extensions"](r)||hi.Katakana(r)||hi["Vertical Forms"](r)||hi["Yi Radicals"](r)||hi["Yi Syllables"](r)))&&o.push(Il(l+1,s,a,o,Ml(c,t.getCharCode(l+1)),!1))}return function t(e){return e?t(e.priorBreak).concat(e.index):[]}(Il(t.length(),s,a,o,0,!0))}function Dl(t){var e=.5,n=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":n=1;break;case"top":case"top-right":case"top-left":n=0}return{horizontalAlign:e,verticalAlign:n}}function Rl(t,e,n,i,r){if(r){var o=t[i],a=e[o.fontStack],s=a&&a[o.glyph];if(s)for(var l=s.metrics.advance*o.scale,u=(t[i].x+l)*r,c=n;c<=i;c++)t[c].x-=u}}zl[10]=!0,zl[32]=!0,zl[38]=!0,zl[40]=!0,zl[41]=!0,zl[43]=!0,zl[45]=!0,zl[47]=!0,zl[173]=!0,zl[183]=!0,zl[8203]=!0,zl[8208]=!0,zl[8211]=!0,zl[8231]=!0,t.createCommonjsModule=e,t.window=self,t.Point=r,t.browser=L,t.getJSON=function(t,e){return st(p(t,{type:"json"}),e)},t.normalizeSpriteURL=function(t,e,n,i){var r=W(t);return N(t)?(r.path="/styles/v1"+r.path+"/sprite"+e+n,F(r,i)):(r.path+=""+e+n,H(r))},t.ResourceType=et,t.getImage=ct,t.RGBAImage=Ao,t.ImagePosition=Ss,t.Texture=Ms,t.potpack=Ts,t.normalizeGlyphsURL=function(t,e){if(!N(t))return t;var n=W(t);return n.path="/fonts/v1"+n.path,F(n,e)},t.getArrayBuffer=lt,t.parseGlyphPBF=function(t){return new Ds(t).readFields(Qs,[])},t.asyncAll=function(t,e,n){if(!t.length)return n(null,[]);var i=t.length,r=new Array(t.length),o=null;t.forEach(function(t,a){e(t,function(t,e){t&&(o=t),r[a]=e,0==--i&&n(o,r)})})},t.isChar=hi,t.AlphaImage=ko,t.Properties=Fi,t.DataConstantProperty=Ii,t.styleSpec=yt,t.validateLight=$n,t.endsWith=_,t.emitValidationErrors=ei,t.validateStyle=Jn,t.extend=p,t.Evented=mt,t.sphericalToCartesian=function(t){var e=t[0],n=t[1],i=t[2];return n+=90,n*=Math.PI/180,i*=Math.PI/180,{x:e*Math.cos(n)*Math.sin(i),y:e*Math.sin(n)*Math.sin(i),z:e*Math.cos(i)}},t.number=ue,t.Transitionable=Ci,t.warnOnce=w,t.uniqueId=f,t.Actor=il,t.normalizeSourceURL=function(t,e){if(!N(t))return t;var n=W(t);return n.path="/v4/"+n.authority+".json",n.params.push("secure"),F(n,e)},t.pick=function(t,e){for(var n={},i=0;i<e.length;i++){var r=e[i];r in t&&(n[r]=t[r])}return n},t.canonicalizeTileset=function(t,e){if(!N(e))return t.tiles||[];for(var n=[],i=0,r=t.tiles;i<r.length;i+=1){var o=r[i],a=q(o);n.push(a)}return n},t.LngLatBounds=ol,t.mercatorXfromLng=ll,t.mercatorYfromLat=ul,t.Event=ft,t.ErrorEvent=dt,t.postTurnstileEvent=$,t.postMapLoadEvent=tt,t.normalizeTileURL=function(t,e,n){if(!e||!N(e))return t;var i=W(t),r=L.devicePixelRatio>=2||512===n?"@2x":"",o=I.supported?".webp":"$1";return i.path=i.path.replace(V,""+r+o),i.path="/v4"+i.path,F(i)},t.OverscaledTileID=ml,t.EXTENT=Kr,t.MercatorCoordinate=hl,t.CanonicalTileID=fl,t.StructArrayLayout4i8=Wi,t.rasterBoundsAttributes=gl,t.SegmentVector=Pr,t.getVideo=function(t,e){var n,i,r=self.document.createElement("video");r.muted=!0,r.onloadstart=function(){e(null,r)};for(var o=0;o<t.length;o++){var a=self.document.createElement("source");n=t[o],i=void 0,(i=self.document.createElement("a")).href=n,(i.protocol!==self.document.location.protocol||i.host!==self.document.location.host)&&(r.crossOrigin="Anonymous"),a.src=t[o],r.appendChild(a)}return{cancel:function(){}}},t.ValidationError=_t,t.bindAll=y,t.multiply=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=e[8],h=e[9],f=e[10],d=e[11],m=e[12],y=e[13],_=e[14],g=e[15],v=n[0],x=n[1],b=n[2],w=n[3];return t[0]=v*i+x*s+b*p+w*m,t[1]=v*r+x*l+b*h+w*y,t[2]=v*o+x*u+b*f+w*_,t[3]=v*a+x*c+b*d+w*g,v=n[4],x=n[5],b=n[6],w=n[7],t[4]=v*i+x*s+b*p+w*m,t[5]=v*r+x*l+b*h+w*y,t[6]=v*o+x*u+b*f+w*_,t[7]=v*a+x*c+b*d+w*g,v=n[8],x=n[9],b=n[10],w=n[11],t[8]=v*i+x*s+b*p+w*m,t[9]=v*r+x*l+b*h+w*y,t[10]=v*o+x*u+b*f+w*_,t[11]=v*a+x*c+b*d+w*g,v=n[12],x=n[13],b=n[14],w=n[15],t[12]=v*i+x*s+b*p+w*m,t[13]=v*r+x*l+b*h+w*y,t[14]=v*o+x*u+b*f+w*_,t[15]=v*a+x*c+b*d+w*g,t},t.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.translate=function(t,e,n){var i,r,o,a,s,l,u,c,p,h,f,d,m=n[0],y=n[1],_=n[2];return e===t?(t[12]=e[0]*m+e[4]*y+e[8]*_+e[12],t[13]=e[1]*m+e[5]*y+e[9]*_+e[13],t[14]=e[2]*m+e[6]*y+e[10]*_+e[14],t[15]=e[3]*m+e[7]*y+e[11]*_+e[15]):(i=e[0],r=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=e[8],h=e[9],f=e[10],d=e[11],t[0]=i,t[1]=r,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=u,t[7]=c,t[8]=p,t[9]=h,t[10]=f,t[11]=d,t[12]=i*m+s*y+p*_+e[12],t[13]=r*m+l*y+h*_+e[13],t[14]=o*m+u*y+f*_+e[14],t[15]=a*m+c*y+d*_+e[15]),t},t.scale=function(t,e,n){var i=n[0],r=n[1],o=n[2];return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.Color=Ft,t.isEqual=a,t.keysDifference=function(t,e){var n=[];for(var i in t)i in e||n.push(i);return n},t.Tile=Pl,t.SourceFeatureState=wl,t.refProperties=["type","source","source-layer","minzoom","maxzoom","filter","layout"],t.rotateZ=function(t,e,n){var i=Math.sin(n),r=Math.cos(n),o=e[0],a=e[1],s=e[2],l=e[3],u=e[4],c=e[5],p=e[6],h=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*r+u*i,t[1]=a*r+c*i,t[2]=s*r+p*i,t[3]=l*r+h*i,t[4]=u*r-o*i,t[5]=c*r-a*i,t[6]=p*r-s*i,t[7]=h*r-l*i,t},t.evaluateSizeForZoom=function(t,e,n){if("constant"===t.functionType)return{uSizeT:0,uSize:t.layoutSize};if("source"===t.functionType)return{uSizeT:0,uSize:0};if("camera"===t.functionType){var i=t.propertyValue,r=t.zoomRange,o=t.sizeRange,a=u(bn(i,n.specification).interpolationFactor(e,r.min,r.max),0,1);return{uSizeT:0,uSize:o.min+a*(o.max-o.min)}}var s=t.propertyValue,l=t.zoomRange;return{uSizeT:u(bn(s,n.specification).interpolationFactor(e,l.min,l.max),0,1),uSize:0}},t.WritingMode=Cl,t.transformMat4=xo,t.evaluateSizeForFeature=function(t,e,n){var i=e;return"source"===t.functionType?n.lowerSize/256:"composite"===t.functionType?ue(n.lowerSize/256,n.upperSize/256,i.uSizeT):i.uSize},t.addDynamicAttributes=ps,t.properties=ys,t.polygonIntersectsPolygon=to,t.isMapboxURL=N,t.normalizeStyleURL=function(t,e){if(!N(t))return t;var n=W(t);return n.path="/styles/v1"+n.path,F(n,e)},t.createStyleLayer=function(t){return"custom"===t.type?new ws(t):new Es[t.type](t)},t.clone=x,t.validateCustomStyleLayer=function(t){var e=[],n=t.id;return void 0===n&&e.push({message:"layers."+n+': missing required property "id"'}),void 0===t.render&&e.push({message:"layers."+n+': missing required method "render"'}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:"layers."+n+': property "renderingMode" must be either "2d" or "3d"'}),e},t.filterObject=v,t.mapObject=g,t.evented=wi,t.makeRequest=st,t.registerForPluginAvailability=function(t){return xi?t({pluginURL:xi,completionCallback:gi}):wi.once("pluginAvailable",t),t},t.ZoomHistory=pi,t.getReferrer=at,t.createLayout=Zi,t.UniformMatrix4f=Fr,t.Uniform3f=Or,t.Uniform1f=Mr,t.Uniform1i=Lr,t.Uniform2f=Ir,t.Uniform4f=Dr,t.create=_o,t.fromRotation=function(t,e){var n=Math.sin(e),i=Math.cos(e);return t[0]=i,t[1]=n,t[2]=0,t[3]=-n,t[4]=i,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},t.transformMat3=function(t,e,n){var i=e[0],r=e[1],o=e[2];return t[0]=i*n[0]+r*n[3]+o*n[6],t[1]=i*n[1]+r*n[4]+o*n[7],t[2]=i*n[2]+r*n[5]+o*n[8],t},t.create$1=function(){var t=new yo(16);return yo!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.ortho=function(t,e,n,i,r,o,a){var s=1/(e-n),l=1/(i-r),u=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+n)*s,t[13]=(r+i)*l,t[14]=(a+o)*u,t[15]=1,t},t.UniformColor=Rr,t.clamp=u,t.StructArrayLayout2i4=Gi,t.StructArrayLayout2ui4=lr,t.ProgramConfiguration=Gr,t.StructArrayLayout1ui2=ur,t.StructArrayLayout3ui6=sr,t.wrap=c,t.create$2=function(){var t=new yo(4);return yo!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},t.rotate=function(t,e,n){var i=e[0],r=e[1],o=e[2],a=e[3],s=Math.sin(n),l=Math.cos(n);return t[0]=i*l+o*s,t[1]=r*l+a*s,t[2]=i*-s+o*l,t[3]=r*-s+a*l,t},t.LngLat=al,t.UnwrappedTileID=dl,t.perspective=function(t,e,n,i,r){var o,a=1/Math.tan(e/2);return t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=r&&r!==1/0?(o=1/(i-r),t[10]=(r+i)*o,t[14]=2*r*i*o):(t[10]=-1,t[14]=-2*i),t},t.rotateX=function(t,e,n){var i=Math.sin(n),r=Math.cos(n),o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],p=e[10],h=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*r+u*i,t[5]=a*r+c*i,t[6]=s*r+p*i,t[7]=l*r+h*i,t[8]=u*r-o*i,t[9]=c*r-a*i,t[10]=p*r-s*i,t[11]=h*r-l*i,t},t.mercatorZfromAltitude=cl,t.invert=function(t,e){var n=e[0],i=e[1],r=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=e[9],h=e[10],f=e[11],d=e[12],m=e[13],y=e[14],_=e[15],g=n*s-i*a,v=n*l-r*a,x=n*u-o*a,b=i*l-r*s,w=i*u-o*s,E=r*u-o*l,T=c*m-p*d,S=c*y-h*d,P=c*_-f*d,C=p*y-h*m,k=p*_-f*m,A=h*_-f*y,z=g*A-v*k+x*C+b*P-w*S+E*T;return z?(z=1/z,t[0]=(s*A-l*k+u*C)*z,t[1]=(r*k-i*A-o*C)*z,t[2]=(m*E-y*w+_*b)*z,t[3]=(h*w-p*E-f*b)*z,t[4]=(l*P-a*A-u*S)*z,t[5]=(n*A-r*P+o*S)*z,t[6]=(y*x-d*E-_*v)*z,t[7]=(c*E-h*x+f*v)*z,t[8]=(a*k-s*P+u*T)*z,t[9]=(i*P-n*k-o*T)*z,t[10]=(d*w-m*x+_*g)*z,t[11]=(p*x-c*w-f*g)*z,t[12]=(s*S-a*C-l*T)*z,t[13]=(n*C-i*S+r*T)*z,t[14]=(m*v-d*b-y*g)*z,t[15]=(c*b-p*v+h*g)*z,t):null},t.ease=l,t.bezier=s,t.config=M,t.webpSupported=I,t.EvaluationParameters=Ti,t.version="0.53.0",t.setRTLTextPlugin=function(t,e){if(vi)throw new Error("setRTLTextPlugin cannot be called multiple times.");vi=!0,xi=L.resolveURL(t),gi=function(t){t?(vi=!1,xi=null,e&&e(t)):bi=!0},wi.fire(new ft("pluginAvailable",{pluginURL:xi,completionCallback:gi}))},t.featureFilter=zn,t.values=function(t){var e=[];for(var n in t)e.push(t[n]);return e},t.Anchor=as,t.GLYPH_PBF_BORDER=nl,t.distToSegmentSquared=so,t.allowsLetterSpacing=function(t){for(var e=0,n=t;e<n.length;e+=1)if(!di(n[e].charCodeAt(0)))return!1;return!0},t.shapeText=function(t,e,n,i,r,o,a,s,l,u,c){var p=kl.fromFeature(t,n);c===Cl.vertical&&p.verticalizePunctuation();var h,f=[],d={positionedGlyphs:f,text:p,top:l[1],bottom:l[1],left:l[0],right:l[0],writingMode:c},m=Ei.processBidirectionalText,y=Ei.processStyledBidirectionalText;if(m&&1===p.sections.length){h=[];for(var _=0,g=m(p.toString(),Ol(p,s,i,e));_<g.length;_+=1){var v=g[_],x=new kl;x.text=v,x.sections=p.sections;for(var b=0;b<v.length;b++)x.sectionIndex.push(0);h.push(x)}}else if(y){h=[];for(var w=0,E=y(p.text,p.sectionIndex,Ol(p,s,i,e));w<E.length;w+=1){var T=E[w],S=new kl;S.text=T[0],S.sectionIndex=T[1],S.sections=p.sections,h.push(S)}}else h=function(t,e){for(var n=[],i=t.text,r=0,o=0,a=e;o<a.length;o+=1){var s=a[o];n.push(t.substring(r,s)),r=s}return r<i.length&&n.push(t.substring(r,i.length)),n}(p,Ol(p,s,i,e));return function(t,e,n,i,r,o,a,s,l){for(var u=0,c=-17,p=0,h=t.positionedGlyphs,f="right"===o?1:"left"===o?0:.5,d=0,m=n;d<m.length;d+=1){var y=m[d];y.trim();var _=y.getMaxScale();if(y.length()){for(var g=h.length,v=0;v<y.length();v++){var x=y.getSection(v),b=y.getCharCode(v),w=24*(_-x.scale),E=e[x.fontStack],T=E&&E[b];T&&(mi(b)&&a!==Cl.horizontal?(h.push({glyph:b,x:u,y:w,vertical:!0,scale:x.scale,fontStack:x.fontStack}),u+=l*x.scale+s):(h.push({glyph:b,x:u,y:c+w,vertical:!1,scale:x.scale,fontStack:x.fontStack}),u+=T.metrics.advance*x.scale+s))}if(h.length!==g){var S=u-s;p=Math.max(S,p),Rl(h,e,g,h.length-1,f)}u=0,c+=i*_}else c+=i}var P=Dl(r),C=P.horizontalAlign,k=P.verticalAlign;!function(t,e,n,i,r,o,a){for(var s=(e-n)*r,l=(-i*a+.5)*o,u=0;u<t.length;u++)t[u].x+=s,t[u].y+=l}(h,f,C,k,p,i,n.length);var A=c- -17;t.top+=-k*A,t.bottom=t.top+A,t.left+=-C*p,t.right=t.left+p}(d,e,h,r,o,a,c,s,u),!!f.length&&(d.text=d.text.toString(),d)},t.allowsVerticalWritingMode=fi,t.shapeIcon=function(t,e,n){var i=Dl(n),r=i.horizontalAlign,o=i.verticalAlign,a=e[0],s=e[1],l=a-t.displaySize[0]*r,u=l+t.displaySize[0],c=s-t.displaySize[1]*o;return{image:t,top:c,bottom:c+t.displaySize[1],left:l,right:u}},t.classifyRings=pa,t.SIZE_PACK_FACTOR=256,t.SymbolBucket=ds,t.register=si,t.CollisionBoxArray=fr,t.DictionaryCoder=vl,t.FeatureIndex=El,t.ImageAtlas=Cs,t.LineBucket=Wa,t.FillBucket=ma,t.FillExtrusionBucket=wa,t.mvt=Na,t.Protobuf=Ds,t.DEMData=_l,t.vectorTile=Na,t.Point$1=r,t.pbf=Ds,t.createExpression=yn,t.plugin=Ei}),i(0,function(t){function e(t){var n=typeof t;if("number"===n||"boolean"===n||"string"===n||null==t)return JSON.stringify(t);if(Array.isArray(t)){for(var i="[",r=0,o=t;r<o.length;r+=1)i+=e(o[r])+",";return i+"]"}for(var a=Object.keys(t).sort(),s="{",l=0;l<a.length;l++)s+=JSON.stringify(a[l])+":"+e(t[a[l]])+",";return s+"}"}function n(n){for(var i="",r=0,o=t.refProperties;r<o.length;r+=1)i+="/"+e(n[o[r]]);return i}var i=function(t){t&&this.replace(t)};function r(t,e,n,i,r){if(void 0===e.segment)return!0;for(var o=e,a=e.segment+1,s=0;s>-n/2;){if(--a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;for(var l=[],u=0;s<n/2;){var c=t[a-1],p=t[a],h=t[a+1];if(!h)return!1;var f=c.angleTo(p)-p.angleTo(h);for(f=Math.abs((f+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:f}),u+=f;s-l[0].distance>i;)u-=l.shift().angleDelta;if(u>r)return!1;a++,s+=p.dist(h)}return!0}function o(t){for(var e=0,n=0;n<t.length-1;n++)e+=t[n].dist(t[n+1]);return e}function a(t,e,n){return t?.6*e*n:0}function s(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function l(e,n,i,l,u,c){for(var p=a(i,u,c),h=s(i,l)*c,f=0,d=o(e)/2,m=0;m<e.length-1;m++){var y=e[m],_=e[m+1],g=y.dist(_);if(f+g>d){var v=(d-f)/g,x=t.number(y.x,_.x,v),b=t.number(y.y,_.y,v),w=new t.Anchor(x,b,_.angleTo(y),m);return w._round(),!p||r(e,w,h,p,n)?w:void 0}f+=g}}function u(e,n,i,l,u,c,p,h,f){var d=a(l,c,p),m=s(l,u),y=m*p,_=0===e[0].x||e[0].x===f||0===e[0].y||e[0].y===f;return n-y<n/4&&(n=y+n/4),function e(n,i,a,s,l,u,c,p,h){for(var f=u/2,d=o(n),m=0,y=i-a,_=[],g=0;g<n.length-1;g++){for(var v=n[g],x=n[g+1],b=v.dist(x),w=x.angleTo(v);y+a<m+b;){var E=((y+=a)-m)/b,T=t.number(v.x,x.x,E),S=t.number(v.y,x.y,E);if(T>=0&&T<h&&S>=0&&S<h&&y-f>=0&&y+f<=d){var P=new t.Anchor(T,S,w,g);P._round(),s&&!r(n,P,u,s,l)||_.push(P)}}m+=b}return p||_.length||c||(_=e(n,m/2,a,s,l,u,c,!0,h)),_}(e,_?n/2*h%n:(m/2+2*c)*p*h%n,n,d,i,y,_,!1,f)}i.prototype.replace=function(t){this._layerConfigs={},this._layers={},this.update(t,[])},i.prototype.update=function(e,i){for(var r=this,o=0,a=e;o<a.length;o+=1){var s=a[o];this._layerConfigs[s.id]=s;var l=this._layers[s.id]=t.createStyleLayer(s);l._featureFilter=t.featureFilter(l.filter)}for(var u=0,c=i;u<c.length;u+=1){var p=c[u];delete this._layerConfigs[p],delete this._layers[p]}this.familiesBySource={};for(var h=0,f=function(t){for(var e={},i=0;i<t.length;i++){var r=n(t[i]),o=e[r];o||(o=e[r]=[]),o.push(t[i])}var a=[];for(var s in e)a.push(e[s]);return a}(t.values(this._layerConfigs));h<f.length;h+=1){var d=f[h].map(function(t){return r._layers[t.id]}),m=d[0];if("none"!==m.visibility){var y=m.source||"",_=this.familiesBySource[y];_||(_=this.familiesBySource[y]={});var g=m.sourceLayer||"_geojsonTileLayer",v=_[g];v||(v=_[g]=[]),v.push(d)}}};var c=function(e,n,i,r,o,a,s,l,u,c,p,h){var f=s.top*l-u,d=s.bottom*l+u,m=s.left*l-u,y=s.right*l+u;if(this.boxStartIndex=e.length,c){var _=d-f,g=y-m;_>0&&(_=Math.max(10*l,_),this._addLineCollisionCircles(e,n,i,i.segment,g,_,r,o,a,p))}else{if(h){var v=new t.Point(m,f),x=new t.Point(y,f),b=new t.Point(m,d),w=new t.Point(y,d),E=h*Math.PI/180;v._rotate(E),x._rotate(E),b._rotate(E),w._rotate(E),m=Math.min(v.x,x.x,b.x,w.x),y=Math.max(v.x,x.x,b.x,w.x),f=Math.min(v.y,x.y,b.y,w.y),d=Math.max(v.y,x.y,b.y,w.y)}e.emplaceBack(i.x,i.y,m,f,y,d,r,o,a,0,0)}this.boxEndIndex=e.length};c.prototype._addLineCollisionCircles=function(t,e,n,i,r,o,a,s,l,u){var c=o/2,p=Math.floor(r/c)||1,h=1+.4*Math.log(u)/Math.LN2,f=Math.floor(p*h/2),d=-o/2,m=n,y=i+1,_=d,g=-r/2,v=g-r/4;do{if(--y<0){if(_>g)return;y=0;break}_-=e[y].dist(m),m=e[y]}while(_>v);for(var x=e[y].dist(e[y+1]),b=-f;b<p+f;b++){var w=b*c,E=g+w;if(w<0&&(E+=w),w>r&&(E+=w-r),!(E<_)){for(;_+x<E;){if(_+=x,++y+1>=e.length)return;x=e[y].dist(e[y+1])}var T=E-_,S=e[y],P=e[y+1].sub(S)._unit()._mult(T)._add(S)._round(),C=Math.abs(E-d)<c?0:.8*(E-d);t.emplaceBack(P.x,P.y,-o/2,-o/2,o/2,o/2,a,s,l,o/2,C)}}};var p=function(t,e){if(void 0===t&&(t=[]),void 0===e&&(e=h),this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(var n=(this.length>>1)-1;n>=0;n--)this._down(n)};function h(t,e){return t<e?-1:t>e?1:0}function f(e,n,i){void 0===n&&(n=1),void 0===i&&(i=!1);for(var r=1/0,o=1/0,a=-1/0,s=-1/0,l=e[0],u=0;u<l.length;u++){var c=l[u];(!u||c.x<r)&&(r=c.x),(!u||c.y<o)&&(o=c.y),(!u||c.x>a)&&(a=c.x),(!u||c.y>s)&&(s=c.y)}var h=a-r,f=s-o,y=Math.min(h,f),_=y/2,g=new p([],d);if(0===y)return new t.Point(r,o);for(var v=r;v<a;v+=y)for(var x=o;x<s;x+=y)g.push(new m(v+_,x+_,_,e));for(var b=function(t){for(var e=0,n=0,i=0,r=t[0],o=0,a=r.length,s=a-1;o<a;s=o++){var l=r[o],u=r[s],c=l.x*u.y-u.x*l.y;n+=(l.x+u.x)*c,i+=(l.y+u.y)*c,e+=3*c}return new m(n/e,i/e,0,t)}(e),w=g.length;g.length;){var E=g.pop();(E.d>b.d||!b.d)&&(b=E,i&&console.log("found best %d after %d probes",Math.round(1e4*E.d)/1e4,w)),E.max-b.d<=n||(_=E.h/2,g.push(new m(E.p.x-_,E.p.y-_,_,e)),g.push(new m(E.p.x+_,E.p.y-_,_,e)),g.push(new m(E.p.x-_,E.p.y+_,_,e)),g.push(new m(E.p.x+_,E.p.y+_,_,e)),w+=4)}return i&&(console.log("num probes: "+w),console.log("best distance: "+b.d)),b.p}function d(t,e){return e.max-t.max}function m(e,n,i,r){this.p=new t.Point(e,n),this.h=i,this.d=function(e,n){for(var i=!1,r=1/0,o=0;o<n.length;o++)for(var a=n[o],s=0,l=a.length,u=l-1;s<l;u=s++){var c=a[s],p=a[u];c.y>e.y!=p.y>e.y&&e.x<(p.x-c.x)*(e.y-c.y)/(p.y-c.y)+c.x&&(i=!i),r=Math.min(r,t.distToSegmentSquared(e,c,p))}return(i?1:-1)*Math.sqrt(r)}(this.p,r),this.max=this.d+this.h*Math.SQRT2}p.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1)},p.prototype.pop=function(){if(0!==this.length){var t=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t}},p.prototype.peek=function(){return this.data[0]},p.prototype._up=function(t){for(var e=this.data,n=this.compare,i=e[t];t>0;){var r=t-1>>1,o=e[r];if(n(i,o)>=0)break;e[t]=o,t=r}e[t]=i},p.prototype._down=function(t){for(var e=this.data,n=this.compare,i=this.length>>1,r=e[t];t<i;){var o=1+(t<<1),a=e[o],s=o+1;if(s<this.length&&n(e[s],a)<0&&(o=s,a=e[s]),n(a,r)>=0)break;e[t]=a,t=o}e[t]=r};var y=t.createCommonjsModule(function(t){t.exports=function(t,e){var n,i,r,o,a,s,l,u;for(n=3&t.length,i=t.length-n,r=e,a=3432918353,s=461845907,u=0;u<i;)l=255&t.charCodeAt(u)|(255&t.charCodeAt(++u))<<8|(255&t.charCodeAt(++u))<<16|(255&t.charCodeAt(++u))<<24,++u,r=27492+(65535&(o=5*(65535&(r=(r^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<13|r>>>19))+((5*(r>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(l=0,n){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:r^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*s+(((l>>>16)*s&65535)<<16)&4294967295}return r^=t.length,r=2246822507*(65535&(r^=r>>>16))+((2246822507*(r>>>16)&65535)<<16)&4294967295,r=3266489909*(65535&(r^=r>>>13))+((3266489909*(r>>>16)&65535)<<16)&4294967295,(r^=r>>>16)>>>0}}),_=t.createCommonjsModule(function(t){t.exports=function(t,e){for(var n,i=t.length,r=e^i,o=0;i>=4;)n=1540483477*(65535&(n=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(n>>>16)&65535)<<16),r=1540483477*(65535&r)+((1540483477*(r>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),i-=4,++o;switch(i){case 3:r^=(255&t.charCodeAt(o+2))<<16;case 2:r^=(255&t.charCodeAt(o+1))<<8;case 1:r=1540483477*(65535&(r^=255&t.charCodeAt(o)))+((1540483477*(r>>>16)&65535)<<16)}return r=1540483477*(65535&(r^=r>>>13))+((1540483477*(r>>>16)&65535)<<16),(r^=r>>>15)>>>0}}),g=y,v=y,x=_;function b(e,n,i,r,o,a){e.createArrays();var s=512*e.overscaling;e.tilePixelRatio=t.EXTENT/s,e.compareText={},e.iconsNeedLinear=!1;var l=e.layers[0].layout,u=e.layers[0]._unevaluatedLayout._values,c={};if("composite"===e.textSizeData.functionType){var p=e.textSizeData.zoomRange,h=p.min,f=p.max;c.compositeTextSizes=[u["text-size"].possiblyEvaluate(new t.EvaluationParameters(h)),u["text-size"].possiblyEvaluate(new t.EvaluationParameters(f))]}if("composite"===e.iconSizeData.functionType){var d=e.iconSizeData.zoomRange,m=d.min,y=d.max;c.compositeIconSizes=[u["icon-size"].possiblyEvaluate(new t.EvaluationParameters(m)),u["icon-size"].possiblyEvaluate(new t.EvaluationParameters(y))]}c.layoutTextSize=u["text-size"].possiblyEvaluate(new t.EvaluationParameters(e.zoom+1)),c.layoutIconSize=u["icon-size"].possiblyEvaluate(new t.EvaluationParameters(e.zoom+1)),c.textMaxSize=u["text-size"].possiblyEvaluate(new t.EvaluationParameters(18));for(var _=24*l.get("text-line-height"),g="map"===l.get("text-rotation-alignment")&&"point"!==l.get("symbol-placement"),v=l.get("text-keep-upright"),x=0,b=e.features;x<b.length;x+=1){var E=b[x],T=l.get("text-font").evaluate(E,{}).join(","),S=i,P={},C=E.text;if(C){var k=C.toString(),A=l.get("text-offset").evaluate(E,{}).map(function(t){return 24*t}),z=24*l.get("text-letter-spacing").evaluate(E,{}),L=t.allowsLetterSpacing(k)?z:0,M=l.get("text-anchor").evaluate(E,{}),I=l.get("text-justify").evaluate(E,{}),O="point"===l.get("symbol-placement")?24*l.get("text-max-width").evaluate(E,{}):0;P.horizontal=t.shapeText(C,n,T,O,_,M,I,L,A,24,t.WritingMode.horizontal),t.allowsVerticalWritingMode(k)&&g&&v&&(P.vertical=t.shapeText(C,n,T,O,_,M,I,L,A,24,t.WritingMode.vertical))}var D=void 0;if(E.icon){var R=r[E.icon];R&&(D=t.shapeIcon(o[E.icon],l.get("icon-offset").evaluate(E,{}),l.get("icon-anchor").evaluate(E,{})),void 0===e.sdfIcons?e.sdfIcons=R.sdf:e.sdfIcons!==R.sdf&&t.warnOnce("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),R.pixelRatio!==e.pixelRatio?e.iconsNeedLinear=!0:0!==l.get("icon-rotate").constantOr(1)&&(e.iconsNeedLinear=!0))}(P.horizontal||D)&&w(e,E,P,D,S,c)}a&&e.generateCollisionDebugBuffers()}function w(e,n,i,r,o,a){var s=a.layoutTextSize.evaluate(n,{}),p=a.layoutIconSize.evaluate(n,{}),h=a.textMaxSize.evaluate(n,{});void 0===h&&(h=s);var d=e.layers[0].layout,m=d.get("text-offset").evaluate(n,{}),y=d.get("icon-offset").evaluate(n,{}),_=s/24,v=e.tilePixelRatio*_,x=e.tilePixelRatio*h/24,b=e.tilePixelRatio*p,w=e.tilePixelRatio*d.get("symbol-spacing"),P=d.get("text-padding")*e.tilePixelRatio,C=d.get("icon-padding")*e.tilePixelRatio,k=d.get("text-max-angle")/180*Math.PI,A="map"===d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),z="map"===d.get("icon-rotation-alignment")&&"point"!==d.get("symbol-placement"),L=d.get("symbol-placement"),M=w/2,I=function(s,l){l.x<0||l.x>=t.EXTENT||l.y<0||l.y>=t.EXTENT||function(e,n,i,r,o,a,s,l,u,p,h,f,d,m,y,_,v,x,b,w,S){var P,C,k=e.addToLineVertexArray(n,i),A=0,z=0,L=0,M=g(r.horizontal?r.horizontal.text:""),I=[];if(r.horizontal){var O=a.layout.get("text-rotate").evaluate(b,{});P=new c(s,i,n,l,u,p,r.horizontal,h,f,d,e.overscaling,O),z+=T(e,n,r.horizontal,a,d,b,m,k,r.vertical?t.WritingMode.horizontal:t.WritingMode.horizontalOnly,I,w,S),r.vertical&&(L+=T(e,n,r.vertical,a,d,b,m,k,t.WritingMode.vertical,I,w,S))}var D=P?P.boxStartIndex:e.collisionBoxArray.length,R=P?P.boxEndIndex:e.collisionBoxArray.length;if(o){var B=function(e,n,i,r,o,a){var s,l,u,c,p=n.image,h=i.layout,f=n.top-1/p.pixelRatio,d=n.left-1/p.pixelRatio,m=n.bottom+1/p.pixelRatio,y=n.right+1/p.pixelRatio;if("none"!==h.get("icon-text-fit")&&o){var _=y-d,g=m-f,v=h.get("text-size").evaluate(a,{})/24,x=o.left*v,b=o.right*v,w=o.top*v,E=b-x,T=o.bottom*v-w,S=h.get("icon-text-fit-padding")[0],P=h.get("icon-text-fit-padding")[1],C=h.get("icon-text-fit-padding")[2],k=h.get("icon-text-fit-padding")[3],A="width"===h.get("icon-text-fit")?.5*(T-g):0,z="height"===h.get("icon-text-fit")?.5*(E-_):0,L="width"===h.get("icon-text-fit")||"both"===h.get("icon-text-fit")?E:_,M="height"===h.get("icon-text-fit")||"both"===h.get("icon-text-fit")?T:g;s=new t.Point(x+z-k,w+A-S),l=new t.Point(x+z+P+L,w+A-S),u=new t.Point(x+z+P+L,w+A+C+M),c=new t.Point(x+z-k,w+A+C+M)}else s=new t.Point(d,f),l=new t.Point(y,f),u=new t.Point(y,m),c=new t.Point(d,m);var I=i.layout.get("icon-rotate").evaluate(a,{})*Math.PI/180;if(I){var O=Math.sin(I),D=Math.cos(I),R=[D,-O,O,D];s._matMult(R),l._matMult(R),c._matMult(R),u._matMult(R)}return[{tl:s,tr:l,bl:c,br:u,tex:p.paddedRect,writingMode:void 0,glyphOffset:[0,0]}]}(0,o,a,0,r.horizontal,b),F=a.layout.get("icon-rotate").evaluate(b,{});C=new c(s,i,n,l,u,p,o,y,_,!1,e.overscaling,F),A=4*B.length;var N=e.iconSizeData,U=null;"source"===N.functionType?(U=[t.SIZE_PACK_FACTOR*a.layout.get("icon-size").evaluate(b,{})])[0]>E&&t.warnOnce(e.layerIds[0]+': Value for "icon-size" is >= 256. Reduce your "icon-size".'):"composite"===N.functionType&&((U=[t.SIZE_PACK_FACTOR*S.compositeIconSizes[0].evaluate(b,{}),t.SIZE_PACK_FACTOR*S.compositeIconSizes[1].evaluate(b,{})])[0]>E||U[1]>E)&&t.warnOnce(e.layerIds[0]+': Value for "icon-size" is >= 256. Reduce your "icon-size".'),e.addSymbols(e.icon,B,U,x,v,b,!1,n,k.lineStartIndex,k.lineLength)}var j=C?C.boxStartIndex:e.collisionBoxArray.length,V=C?C.boxEndIndex:e.collisionBoxArray.length;e.glyphOffsetArray.length>=t.SymbolBucket.MAX_GLYPHS&&t.warnOnce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),e.symbolInstances.emplaceBack(n.x,n.y,I.length>0?I[0]:-1,I.length>1?I[1]:-1,M,D,R,j,V,l,z,L,A,0)}(e,l,s,i,r,e.layers[0],e.collisionBoxArray,n.index,n.sourceLayerIndex,e.index,v,P,A,m,b,C,z,y,n,o,a)};if("line"===L)for(var O=0,D=function(e,n,i,r,o){for(var a=[],s=0;s<e.length;s++)for(var l=e[s],u=void 0,c=0;c<l.length-1;c++){var p=l[c],h=l[c+1];p.x<0&&h.x<0||(p.x<0?p=new t.Point(0,p.y+(h.y-p.y)*((0-p.x)/(h.x-p.x)))._round():h.x<0&&(h=new t.Point(0,p.y+(h.y-p.y)*((0-p.x)/(h.x-p.x)))._round()),p.y<0&&h.y<0||(p.y<0?p=new t.Point(p.x+(h.x-p.x)*((0-p.y)/(h.y-p.y)),0)._round():h.y<0&&(h=new t.Point(p.x+(h.x-p.x)*((0-p.y)/(h.y-p.y)),0)._round()),p.x>=r&&h.x>=r||(p.x>=r?p=new t.Point(r,p.y+(h.y-p.y)*((r-p.x)/(h.x-p.x)))._round():h.x>=r&&(h=new t.Point(r,p.y+(h.y-p.y)*((r-p.x)/(h.x-p.x)))._round()),p.y>=o&&h.y>=o||(p.y>=o?p=new t.Point(p.x+(h.x-p.x)*((o-p.y)/(h.y-p.y)),o)._round():h.y>=o&&(h=new t.Point(p.x+(h.x-p.x)*((o-p.y)/(h.y-p.y)),o)._round()),u&&p.equals(u[u.length-1])||(u=[p],a.push(u)),u.push(h)))))}return a}(n.geometry,0,0,t.EXTENT,t.EXTENT);O<D.length;O+=1)for(var R=D[O],B=0,F=u(R,w,k,i.vertical||i.horizontal,r,24,x,e.overscaling,t.EXTENT);B<F.length;B+=1){var N=F[B],U=i.horizontal;U&&S(e,U.text,M,N)||I(R,N)}else if("line-center"===L)for(var j=0,V=n.geometry;j<V.length;j+=1){var Z=V[j];if(Z.length>1){var q=l(Z,k,i.vertical||i.horizontal,r,24,x);q&&I(Z,q)}}else if("Polygon"===n.type)for(var G=0,W=t.classifyRings(n.geometry,0);G<W.length;G+=1){var H=W[G],X=f(H,16);I(H[0],new t.Anchor(X.x,X.y,0))}else if("LineString"===n.type)for(var K=0,Y=n.geometry;K<Y.length;K+=1){var J=Y[K];I(J,new t.Anchor(J[0].x,J[0].y,0))}else if("Point"===n.type)for(var $=0,Q=n.geometry;$<Q.length;$+=1)for(var tt=0,et=Q[$];tt<et.length;tt+=1){var nt=et[tt];I([nt],new t.Anchor(nt.x,nt.y,0))}}g.murmur3=v,g.murmur2=x;var E=65535;function T(e,n,i,r,o,a,s,l,u,c,p,h){var f=function(e,n,i,r,o,a){for(var s=i.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,l=i.layout.get("text-offset").evaluate(o,{}).map(function(t){return 24*t}),u=n.positionedGlyphs,c=[],p=0;p<u.length;p++){var h=u[p],f=a[h.fontStack],d=f&&f[h.glyph];if(d){var m=d.rect;if(m){var y=t.GLYPH_PBF_BORDER+1,_=d.metrics.advance*h.scale/2,g=r?[h.x+_,h.y]:[0,0],v=r?[0,0]:[h.x+_+l[0],h.y+l[1]],x=(d.metrics.left-y)*h.scale-_+v[0],b=(-d.metrics.top-y)*h.scale+v[1],w=x+m.w*h.scale,E=b+m.h*h.scale,T=new t.Point(x,b),S=new t.Point(w,b),P=new t.Point(x,E),C=new t.Point(w,E);if(r&&h.vertical){var k=new t.Point(-_,_),A=-Math.PI/2,z=new t.Point(5,0);T._rotateAround(A,k)._add(z),S._rotateAround(A,k)._add(z),P._rotateAround(A,k)._add(z),C._rotateAround(A,k)._add(z)}if(s){var L=Math.sin(s),M=Math.cos(s),I=[M,-L,L,M];T._matMult(I),S._matMult(I),P._matMult(I),C._matMult(I)}c.push({tl:T,tr:S,bl:P,br:C,tex:m,writingMode:n.writingMode,glyphOffset:g})}}}return c}(0,i,r,o,a,p),d=e.textSizeData,m=null;return"source"===d.functionType?(m=[t.SIZE_PACK_FACTOR*r.layout.get("text-size").evaluate(a,{})])[0]>E&&t.warnOnce(e.layerIds[0]+': Value for "text-size" is >= 256. Reduce your "text-size".'):"composite"===d.functionType&&((m=[t.SIZE_PACK_FACTOR*h.compositeTextSizes[0].evaluate(a,{}),t.SIZE_PACK_FACTOR*h.compositeTextSizes[1].evaluate(a,{})])[0]>E||m[1]>E)&&t.warnOnce(e.layerIds[0]+': Value for "text-size" is >= 256. Reduce your "text-size".'),e.addSymbols(e.text,f,m,s,o,a,u,n,l.lineStartIndex,l.lineLength),c.push(e.text.placedSymbolArray.length-1),4*f.length}function S(t,e,n,i){var r=t.compareText;if(e in r){for(var o=r[e],a=o.length-1;a>=0;a--)if(i.dist(o[a])<n)return!0}else r[e]=[];return r[e].push(i),!1}var P=function(e){var n={},i=[];for(var r in e){var o=e[r],a=n[r]={};for(var s in o){var l=o[+s];if(l&&0!==l.bitmap.width&&0!==l.bitmap.height){var u={x:0,y:0,w:l.bitmap.width+2,h:l.bitmap.height+2};i.push(u),a[s]={rect:u,metrics:l.metrics}}}}var c=t.potpack(i),p=c.w,h=c.h,f=new t.AlphaImage({width:p||1,height:h||1});for(var d in e){var m=e[d];for(var y in m){var _=m[+y];if(_&&0!==_.bitmap.width&&0!==_.bitmap.height){var g=n[d][y].rect;t.AlphaImage.copy(_.bitmap,f,{x:0,y:0},{x:g.x+1,y:g.y+1},_.bitmap)}}}this.image=f,this.positions=n};t.register("GlyphAtlas",P);var C=function(e){this.tileID=new t.OverscaledTileID(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies};function k(e,n){for(var i=new t.EvaluationParameters(n),r=0,o=e;r<o.length;r+=1)o[r].recalculate(i)}C.prototype.parse=function(e,n,i,r){var o=this;this.status="parsing",this.data=e,this.collisionBoxArray=new t.CollisionBoxArray;var a=new t.DictionaryCoder(Object.keys(e.layers).sort()),s=new t.FeatureIndex(this.tileID);s.bucketLayerIDs=[];var l,u,c,p,h={},f={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{}},d=n.familiesBySource[this.source];for(var m in d){var y=e.layers[m];if(y){1===y.version&&t.warnOnce('Vector tile source "'+this.source+'" layer "'+m+'" does not use vector tile spec v2 and therefore may have some rendering errors.');for(var _=a.encode(m),g=[],v=0;v<y.length;v++){var x=y.feature(v);g.push({feature:x,index:v,sourceLayerIndex:_})}for(var w=0,E=d[m];w<E.length;w+=1){var T=E[w],S=T[0];S.minzoom&&this.zoom<Math.floor(S.minzoom)||S.maxzoom&&this.zoom>=S.maxzoom||"none"!==S.visibility&&(k(T,this.zoom),(h[S.id]=S.createBucket({index:s.bucketLayerIDs.length,layers:T,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:_,sourceID:this.source})).populate(g,f),s.bucketLayerIDs.push(T.map(function(t){return t.id})))}}}var C=t.mapObject(f.glyphDependencies,function(t){return Object.keys(t).map(Number)});Object.keys(C).length?i.send("getGlyphs",{uid:this.uid,stacks:C},function(t,e){l||(l=t,u=e,L.call(o))}):u={};var A=Object.keys(f.iconDependencies);A.length?i.send("getImages",{icons:A},function(t,e){l||(l=t,c=e,L.call(o))}):c={};var z=Object.keys(f.patternDependencies);function L(){if(l)return r(l);if(u&&c&&p){var e=new P(u),n=new t.ImageAtlas(c,p);for(var i in h){var o=h[i];o instanceof t.SymbolBucket?(k(o.layers,this.zoom),b(o,u,e.positions,c,n.iconPositions,this.showCollisionBoxes)):o.hasPattern&&(o instanceof t.LineBucket||o instanceof t.FillBucket||o instanceof t.FillExtrusionBucket)&&(k(o.layers,this.zoom),o.addFeatures(f,n.patternPositions))}this.status="done",r(null,{buckets:t.values(h).filter(function(t){return!t.isEmpty()}),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:n,glyphMap:this.returnDependencies?u:null,iconMap:this.returnDependencies?c:null,glyphPositions:this.returnDependencies?e.positions:null})}}z.length?i.send("getImages",{icons:z},function(t,e){l||(l=t,p=e,L.call(o))}):p={},L.call(this)};var A="undefined"!=typeof performance,z={getEntriesByName:function(t){return!!(A&&performance&&performance.getEntriesByName)&&performance.getEntriesByName(t)},mark:function(t){return!!(A&&performance&&performance.mark)&&performance.mark(t)},measure:function(t,e,n){return!!(A&&performance&&performance.measure)&&performance.measure(t,e,n)},clearMarks:function(t){return!!(A&&performance&&performance.clearMarks)&&performance.clearMarks(t)},clearMeasures:function(t){return!!(A&&performance&&performance.clearMeasures)&&performance.clearMeasures(t)}},L=function(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},z.mark(this._marks.start)};function M(e,n){var i=t.getArrayBuffer(e.request,function(e,i,r,o){e?n(e):i&&n(null,{vectorTile:new t.mvt.VectorTile(new t.Protobuf(i)),rawData:i,cacheControl:r,expires:o})});return function(){i.cancel(),n()}}L.prototype.finish=function(){z.mark(this._marks.end);var t=z.getEntriesByName(this._marks.measure);return 0===t.length&&(z.measure(this._marks.measure,this._marks.start,this._marks.end),t=z.getEntriesByName(this._marks.measure),z.clearMarks(this._marks.start),z.clearMarks(this._marks.end),z.clearMeasures(this._marks.measure)),t},z.Performance=L;var I=function(t,e,n){this.actor=t,this.layerIndex=e,this.loadVectorData=n||M,this.loading={},this.loaded={}};I.prototype.loadTile=function(e,n){var i=this,r=e.uid;this.loading||(this.loading={});var o=!!(e&&e.request&&e.request.collectResourceTiming)&&new z.Performance(e.request),a=this.loading[r]=new C(e);a.abort=this.loadVectorData(e,function(e,s){if(delete i.loading[r],e||!s)return a.status="done",i.loaded[r]=a,n(e);var l=s.rawData,u={};s.expires&&(u.expires=s.expires),s.cacheControl&&(u.cacheControl=s.cacheControl);var c={};if(o){var p=o.finish();p&&(c.resourceTiming=JSON.parse(JSON.stringify(p)))}a.vectorTile=s.vectorTile,a.parse(s.vectorTile,i.layerIndex,i.actor,function(e,i){if(e||!i)return n(e);n(null,t.extend({rawTileData:l.slice(0)},i,u,c))}),i.loaded=i.loaded||{},i.loaded[r]=a})},I.prototype.reloadTile=function(t,e){var n=this.loaded,i=t.uid,r=this;if(n&&n[i]){var o=n[i];o.showCollisionBoxes=t.showCollisionBoxes;var a=function(t,n){var i=o.reloadCallback;i&&(delete o.reloadCallback,o.parse(o.vectorTile,r.layerIndex,r.actor,i)),e(t,n)};"parsing"===o.status?o.reloadCallback=a:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.actor,a):a())}},I.prototype.abortTile=function(t,e){var n=this.loading,i=t.uid;n&&n[i]&&n[i].abort&&(n[i].abort(),delete n[i]),e()},I.prototype.removeTile=function(t,e){var n=this.loaded,i=t.uid;n&&n[i]&&delete n[i],e()};var O=function(){this.loaded={}};O.prototype.loadTile=function(e,n){var i=e.uid,r=e.encoding,o=e.rawImageData,a=new t.DEMData(i,o,r);this.loaded=this.loaded||{},this.loaded[i]=a,n(null,a)},O.prototype.removeTile=function(t){var e=this.loaded,n=t.uid;e&&e[n]&&delete e[n]};var D={RADIUS:6378137,FLATTENING:1/298.257223563,POLAR_RADIUS:6356752.3142};function R(t){var e=0;if(t&&t.length>0){e+=Math.abs(B(t[0]));for(var n=1;n<t.length;n++)e-=Math.abs(B(t[n]))}return e}function B(t){var e,n,i,r,o,a,s=0,l=t.length;if(l>2){for(a=0;a<l;a++)a===l-2?(i=l-2,r=l-1,o=0):a===l-1?(i=l-1,r=0,o=1):(i=a,r=a+1,o=a+2),e=t[i],n=t[r],s+=(F(t[o][0])-F(e[0]))*Math.sin(F(n[1]));s=s*D.RADIUS*D.RADIUS/2}return s}function F(t){return t*Math.PI/180}var N={geometry:function t(e){var n,i=0;switch(e.type){case"Polygon":return R(e.coordinates);case"MultiPolygon":for(n=0;n<e.coordinates.length;n++)i+=R(e.coordinates[n]);return i;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(n=0;n<e.geometries.length;n++)i+=t(e.geometries[n]);return i}},ring:B};function U(t,e){return function(n){return t(n,e)}}function j(t,e){e=!!e,t[0]=V(t[0],e);for(var n=1;n<t.length;n++)t[n]=V(t[n],!e);return t}function V(t,e){return function(t){return N.ring(t)>=0}(t)===e?t:t.reverse()}var Z=t.mvt.VectorTileFeature.prototype.toGeoJSON,q=function(e){this._feature=e,this.extent=t.EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))};q.prototype.loadGeometry=function(){if(1===this._feature.type){for(var e=[],n=0,i=this._feature.geometry;n<i.length;n+=1){var r=i[n];e.push([new t.Point(r[0],r[1])])}return e}for(var o=[],a=0,s=this._feature.geometry;a<s.length;a+=1){for(var l=[],u=0,c=s[a];u<c.length;u+=1){var p=c[u];l.push(new t.Point(p[0],p[1]))}o.push(l)}return o},q.prototype.toGeoJSON=function(t,e,n){return Z.call(this,t,e,n)};var G=function(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=t.EXTENT,this.length=e.length,this._features=e};G.prototype.feature=function(t){return new q(this._features[t])};var W=t.vectorTile.VectorTileFeature,H=X;function X(t,e){this.options=e||{},this.features=t,this.length=t.length}function K(t,e){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=e||4096}X.prototype.feature=function(t){return new K(this.features[t],this.options.extent)},K.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var n=0;n<e.length;n++){for(var i=e[n],r=[],o=0;o<i.length;o++)r.push(new t.Point$1(i[o][0],i[o][1]));this.geometry.push(r)}return this.geometry},K.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,n=-1/0,i=1/0,r=-1/0,o=0;o<t.length;o++)for(var a=t[o],s=0;s<a.length;s++){var l=a[s];e=Math.min(e,l.x),n=Math.max(n,l.x),i=Math.min(i,l.y),r=Math.max(r,l.y)}return[e,i,n,r]},K.prototype.toGeoJSON=W.prototype.toGeoJSON;var Y=Q,J=Q,$=H;function Q(e){var n=new t.pbf;return function(t,e){for(var n in t.layers)e.writeMessage(3,tt,t.layers[n])}(e,n),n.finish()}function tt(t,e){var n;e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var i={keys:[],values:[],keycache:{},valuecache:{}};for(n=0;n<t.length;n++)i.feature=t.feature(n),e.writeMessage(2,et,i);var r=i.keys;for(n=0;n<r.length;n++)e.writeStringField(3,r[n]);var o=i.values;for(n=0;n<o.length;n++)e.writeMessage(4,at,o[n])}function et(t,e){var n=t.feature;void 0!==n.id&&e.writeVarintField(1,n.id),e.writeMessage(2,nt,t),e.writeVarintField(3,n.type),e.writeMessage(4,ot,n)}function nt(t,e){var n=t.feature,i=t.keys,r=t.values,o=t.keycache,a=t.valuecache;for(var s in n.properties){var l=o[s];void 0===l&&(i.push(s),l=i.length-1,o[s]=l),e.writeVarint(l);var u=n.properties[s],c=typeof u;"string"!==c&&"boolean"!==c&&"number"!==c&&(u=JSON.stringify(u));var p=c+":"+u,h=a[p];void 0===h&&(r.push(u),h=r.length-1,a[p]=h),e.writeVarint(h)}}function it(t,e){return(e<<3)+(7&t)}function rt(t){return t<<1^t>>31}function ot(t,e){for(var n=t.loadGeometry(),i=t.type,r=0,o=0,a=n.length,s=0;s<a;s++){var l=n[s],u=1;1===i&&(u=l.length),e.writeVarint(it(1,u));for(var c=3===i?l.length-1:l.length,p=0;p<c;p++){1===p&&1!==i&&e.writeVarint(it(2,c-1));var h=l[p].x-r,f=l[p].y-o;e.writeVarint(rt(h)),e.writeVarint(rt(f)),r+=h,o+=f}3===i&&e.writeVarint(it(7,1))}}function at(t,e){var n=typeof t;"string"===n?e.writeStringField(1,t):"boolean"===n?e.writeBooleanField(7,t):"number"===n&&(t%1!=0?e.writeDoubleField(3,t):t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t))}function st(t,e,n,i){lt(t,n,i),lt(e,2*n,2*i),lt(e,2*n+1,2*i+1)}function lt(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}function ut(t,e,n,i){var r=t-n,o=e-i;return r*r+o*o}Y.fromVectorTileJs=J,Y.fromGeojsonVt=function(t,e){e=e||{};var n={};for(var i in t)n[i]=new H(t[i].features,e),n[i].name=i,n[i].version=e.version,n[i].extent=e.extent;return Q({layers:n})},Y.GeoJSONWrapper=$;var ct=function(t){return t[0]},pt=function(t){return t[1]},ht=function(t,e,n,i,r){void 0===e&&(e=ct),void 0===n&&(n=pt),void 0===i&&(i=64),void 0===r&&(r=Float64Array),this.nodeSize=i,this.points=t;for(var o=t.length<65536?Uint16Array:Uint32Array,a=this.ids=new o(t.length),s=this.coords=new r(2*t.length),l=0;l<t.length;l++)a[l]=l,s[2*l]=e(t[l]),s[2*l+1]=n(t[l]);!function t(e,n,i,r,o,a){if(!(o-r<=i)){var s=r+o>>1;!function t(e,n,i,r,o,a){for(;o>r;){if(o-r>600){var s=o-r+1,l=i-r+1,u=Math.log(s),c=.5*Math.exp(2*u/3),p=.5*Math.sqrt(u*c*(s-c)/s)*(l-s/2<0?-1:1);t(e,n,i,Math.max(r,Math.floor(i-l*c/s+p)),Math.min(o,Math.floor(i+(s-l)*c/s+p)),a)}var h=n[2*i+a],f=r,d=o;for(st(e,n,r,i),n[2*o+a]>h&&st(e,n,r,o);f<d;){for(st(e,n,f,d),f++,d--;n[2*f+a]<h;)f++;for(;n[2*d+a]>h;)d--}n[2*r+a]===h?st(e,n,r,d):st(e,n,++d,o),d<=i&&(r=d+1),i<=d&&(o=d-1)}}(e,n,s,r,o,a%2),t(e,n,i,r,s-1,a+1),t(e,n,i,s+1,o,a+1)}}(a,s,i,0,a.length-1,0)};ht.prototype.range=function(t,e,n,i){return function(t,e,n,i,r,o,a){for(var s,l,u=[0,t.length-1,0],c=[];u.length;){var p=u.pop(),h=u.pop(),f=u.pop();if(h-f<=a)for(var d=f;d<=h;d++)s=e[2*d],l=e[2*d+1],s>=n&&s<=r&&l>=i&&l<=o&&c.push(t[d]);else{var m=Math.floor((f+h)/2);s=e[2*m],l=e[2*m+1],s>=n&&s<=r&&l>=i&&l<=o&&c.push(t[m]);var y=(p+1)%2;(0===p?n<=s:i<=l)&&(u.push(f),u.push(m-1),u.push(y)),(0===p?r>=s:o>=l)&&(u.push(m+1),u.push(h),u.push(y))}}return c}(this.ids,this.coords,t,e,n,i,this.nodeSize)},ht.prototype.within=function(t,e,n){return function(t,e,n,i,r,o){for(var a=[0,t.length-1,0],s=[],l=r*r;a.length;){var u=a.pop(),c=a.pop(),p=a.pop();if(c-p<=o)for(var h=p;h<=c;h++)ut(e[2*h],e[2*h+1],n,i)<=l&&s.push(t[h]);else{var f=Math.floor((p+c)/2),d=e[2*f],m=e[2*f+1];ut(d,m,n,i)<=l&&s.push(t[f]);var y=(u+1)%2;(0===u?n-r<=d:i-r<=m)&&(a.push(p),a.push(f-1),a.push(y)),(0===u?n+r>=d:i+r>=m)&&(a.push(f+1),a.push(c),a.push(y))}}return s}(this.ids,this.coords,t,e,n,this.nodeSize)};var ft={minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1,reduce:null,map:function(t){return t}},dt=function(t){this.options=bt(Object.create(ft),t),this.trees=new Array(this.options.maxZoom+1)};function mt(t,e,n,i,r){return{x:t,y:e,zoom:1/0,id:n,parentId:-1,numPoints:i,properties:r}}function yt(t,e){var n=t.geometry.coordinates,i=n[0],r=n[1];return{x:vt(i),y:xt(r),zoom:1/0,index:e,parentId:-1}}function _t(t){return{type:"Feature",id:t.id,properties:gt(t),geometry:{type:"Point",coordinates:[(i=t.x,360*(i-.5)),(e=t.y,n=(180-360*e)*Math.PI/180,360*Math.atan(Math.exp(n))/Math.PI-90)]}};var e,n,i}function gt(t){var e=t.numPoints,n=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return bt(bt({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:n})}function vt(t){return t/360+.5}function xt(t){var e=Math.sin(t*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n<0?0:n>1?1:n}function bt(t,e){for(var n in e)t[n]=e[n];return t}function wt(t){return t.x}function Et(t){return t.y}function Tt(t,e,n,i,r,o){var a=r-n,s=o-i;if(0!==a||0!==s){var l=((t-n)*a+(e-i)*s)/(a*a+s*s);l>1?(n=r,i=o):l>0&&(n+=a*l,i+=s*l)}return(a=t-n)*a+(s=e-i)*s}function St(t,e,n,i){var r={id:void 0===t?null:t,type:e,geometry:n,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,n=t.type;if("Point"===n||"MultiPoint"===n||"LineString"===n)Pt(t,e);else if("Polygon"===n||"MultiLineString"===n)for(var i=0;i<e.length;i++)Pt(t,e[i]);else if("MultiPolygon"===n)for(i=0;i<e.length;i++)for(var r=0;r<e[i].length;r++)Pt(t,e[i][r])}(r),r}function Pt(t,e){for(var n=0;n<e.length;n+=3)t.minX=Math.min(t.minX,e[n]),t.minY=Math.min(t.minY,e[n+1]),t.maxX=Math.max(t.maxX,e[n]),t.maxY=Math.max(t.maxY,e[n+1])}function Ct(t,e,n,i){if(e.geometry){var r=e.geometry.coordinates,o=e.geometry.type,a=Math.pow(n.tolerance/((1<<n.maxZoom)*n.extent),2),s=[],l=e.id;if(n.promoteId?l=e.properties[n.promoteId]:n.generateId&&(l=i||0),"Point"===o)kt(r,s);else if("MultiPoint"===o)for(var u=0;u<r.length;u++)kt(r[u],s);else if("LineString"===o)At(r,s,a,!1);else if("MultiLineString"===o){if(n.lineMetrics){for(u=0;u<r.length;u++)s=[],At(r[u],s,a,!1),t.push(St(l,"LineString",s,e.properties));return}zt(r,s,a,!1)}else if("Polygon"===o)zt(r,s,a,!0);else{if("MultiPolygon"!==o){if("GeometryCollection"===o){for(u=0;u<e.geometry.geometries.length;u++)Ct(t,{id:l,geometry:e.geometry.geometries[u],properties:e.properties},n,i);return}throw new Error("Input data is not a valid GeoJSON object.")}for(u=0;u<r.length;u++){var c=[];zt(r[u],c,a,!0),s.push(c)}}t.push(St(l,o,s,e.properties))}}function kt(t,e){e.push(Lt(t[0])),e.push(Mt(t[1])),e.push(0)}function At(t,e,n,i){for(var r,o,a=0,s=0;s<t.length;s++){var l=Lt(t[s][0]),u=Mt(t[s][1]);e.push(l),e.push(u),e.push(0),s>0&&(a+=i?(r*u-l*o)/2:Math.sqrt(Math.pow(l-r,2)+Math.pow(u-o,2))),r=l,o=u}var c=e.length-3;e[2]=1,function t(e,n,i,r){for(var o,a=r,s=i-n>>1,l=i-n,u=e[n],c=e[n+1],p=e[i],h=e[i+1],f=n+3;f<i;f+=3){var d=Tt(e[f],e[f+1],u,c,p,h);if(d>a)o=f,a=d;else if(d===a){var m=Math.abs(f-s);m<l&&(o=f,l=m)}}a>r&&(o-n>3&&t(e,n,o,r),e[o+2]=a,i-o>3&&t(e,o,i,r))}(e,0,c,n),e[c+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function zt(t,e,n,i){for(var r=0;r<t.length;r++){var o=[];At(t[r],o,n,i),e.push(o)}}function Lt(t){return t/360+.5}function Mt(t){var e=Math.sin(t*Math.PI/180),n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n<0?0:n>1?1:n}function It(t,e,n,i,r,o,a,s){if(i/=e,o>=(n/=e)&&a<i)return t;if(a<n||o>=i)return null;for(var l=[],u=0;u<t.length;u++){var c=t[u],p=c.geometry,h=c.type,f=0===r?c.minX:c.minY,d=0===r?c.maxX:c.maxY;if(f>=n&&d<i)l.push(c);else if(!(d<n||f>=i)){var m=[];if("Point"===h||"MultiPoint"===h)Ot(p,m,n,i,r);else if("LineString"===h)Dt(p,m,n,i,r,!1,s.lineMetrics);else if("MultiLineString"===h)Bt(p,m,n,i,r,!1);else if("Polygon"===h)Bt(p,m,n,i,r,!0);else if("MultiPolygon"===h)for(var y=0;y<p.length;y++){var _=[];Bt(p[y],_,n,i,r,!0),_.length&&m.push(_)}if(m.length){if(s.lineMetrics&&"LineString"===h){for(y=0;y<m.length;y++)l.push(St(c.id,h,m[y],c.tags));continue}"LineString"!==h&&"MultiLineString"!==h||(1===m.length?(h="LineString",m=m[0]):h="MultiLineString"),"Point"!==h&&"MultiPoint"!==h||(h=3===m.length?"Point":"MultiPoint"),l.push(St(c.id,h,m,c.tags))}}}return l.length?l:null}function Ot(t,e,n,i,r){for(var o=0;o<t.length;o+=3){var a=t[o+r];a>=n&&a<=i&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function Dt(t,e,n,i,r,o,a){for(var s,l,u=Rt(t),c=0===r?Nt:Ut,p=t.start,h=0;h<t.length-3;h+=3){var f=t[h],d=t[h+1],m=t[h+2],y=t[h+3],_=t[h+4],g=0===r?f:d,v=0===r?y:_,x=!1;a&&(s=Math.sqrt(Math.pow(f-y,2)+Math.pow(d-_,2))),g<n?v>n&&(l=c(u,f,d,y,_,n),a&&(u.start=p+s*l)):g>i?v<i&&(l=c(u,f,d,y,_,i),a&&(u.start=p+s*l)):Ft(u,f,d,m),v<n&&g>=n&&(l=c(u,f,d,y,_,n),x=!0),v>i&&g<=i&&(l=c(u,f,d,y,_,i),x=!0),!o&&x&&(a&&(u.end=p+s*l),e.push(u),u=Rt(t)),a&&(p+=s)}var b=t.length-3;f=t[b],d=t[b+1],m=t[b+2],(g=0===r?f:d)>=n&&g<=i&&Ft(u,f,d,m),b=u.length-3,o&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&Ft(u,u[0],u[1],u[2]),u.length&&e.push(u)}function Rt(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function Bt(t,e,n,i,r,o){for(var a=0;a<t.length;a++)Dt(t[a],e,n,i,r,o,!1)}function Ft(t,e,n,i){t.push(e),t.push(n),t.push(i)}function Nt(t,e,n,i,r,o){var a=(o-e)/(i-e);return t.push(o),t.push(n+(r-n)*a),t.push(1),a}function Ut(t,e,n,i,r,o){var a=(o-n)/(r-n);return t.push(e+(i-e)*a),t.push(o),t.push(1),a}function jt(t,e){for(var n=[],i=0;i<t.length;i++){var r,o=t[i],a=o.type;if("Point"===a||"MultiPoint"===a||"LineString"===a)r=Vt(o.geometry,e);else if("MultiLineString"===a||"Polygon"===a){r=[];for(var s=0;s<o.geometry.length;s++)r.push(Vt(o.geometry[s],e))}else if("MultiPolygon"===a)for(r=[],s=0;s<o.geometry.length;s++){for(var l=[],u=0;u<o.geometry[s].length;u++)l.push(Vt(o.geometry[s][u],e));r.push(l)}n.push(St(o.id,a,r,o.tags))}return n}function Vt(t,e){var n=[];n.size=t.size,void 0!==t.start&&(n.start=t.start,n.end=t.end);for(var i=0;i<t.length;i+=3)n.push(t[i]+e,t[i+1],t[i+2]);return n}function Zt(t,e){if(t.transformed)return t;var n,i,r,o=1<<t.z,a=t.x,s=t.y;for(n=0;n<t.features.length;n++){var l=t.features[n],u=l.geometry,c=l.type;if(l.geometry=[],1===c)for(i=0;i<u.length;i+=2)l.geometry.push(qt(u[i],u[i+1],e,o,a,s));else for(i=0;i<u.length;i++){var p=[];for(r=0;r<u[i].length;r+=2)p.push(qt(u[i][r],u[i][r+1],e,o,a,s));l.geometry.push(p)}}return t.transformed=!0,t}function qt(t,e,n,i,r,o){return[Math.round(n*(t*i-r)),Math.round(n*(e*i-o))]}function Gt(t,e,n,i,r){for(var o=e===r.maxZoom?0:r.tolerance/((1<<e)*r.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:n,y:i,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<t.length;s++){a.numFeatures++,Wt(a,t[s],o,r);var l=t[s].minX,u=t[s].minY,c=t[s].maxX,p=t[s].maxY;l<a.minX&&(a.minX=l),u<a.minY&&(a.minY=u),c>a.maxX&&(a.maxX=c),p>a.maxY&&(a.maxY=p)}return a}function Wt(t,e,n,i){var r=e.geometry,o=e.type,a=[];if("Point"===o||"MultiPoint"===o)for(var s=0;s<r.length;s+=3)a.push(r[s]),a.push(r[s+1]),t.numPoints++,t.numSimplified++;else if("LineString"===o)Ht(a,r,t,n,!1,!1);else if("MultiLineString"===o||"Polygon"===o)for(s=0;s<r.length;s++)Ht(a,r[s],t,n,"Polygon"===o,0===s);else if("MultiPolygon"===o)for(var l=0;l<r.length;l++){var u=r[l];for(s=0;s<u.length;s++)Ht(a,u[s],t,n,!0,0===s)}if(a.length){var c=e.tags||null;if("LineString"===o&&i.lineMetrics){for(var p in c={},e.tags)c[p]=e.tags[p];c.mapbox_clip_start=r.start/r.size,c.mapbox_clip_end=r.end/r.size}var h={geometry:a,type:"Polygon"===o||"MultiPolygon"===o?3:"LineString"===o||"MultiLineString"===o?2:1,tags:c};null!==e.id&&(h.id=e.id),t.features.push(h)}}function Ht(t,e,n,i,r,o){var a=i*i;if(i>0&&e.size<(r?a:i))n.numPoints+=e.length/3;else{for(var s=[],l=0;l<e.length;l+=3)(0===i||e[l+2]>a)&&(n.numSimplified++,s.push(e[l]),s.push(e[l+1])),n.numPoints++;r&&function(t,e){for(var n=0,i=0,r=t.length,o=r-2;i<r;o=i,i+=2)n+=(t[i]-t[o])*(t[i+1]+t[o+1]);if(n>0===e)for(i=0,r=t.length;i<r/2;i+=2){var a=t[i],s=t[i+1];t[i]=t[r-2-i],t[i+1]=t[r-1-i],t[r-2-i]=a,t[r-1-i]=s}}(s,o),t.push(s)}}function Xt(t,e){var n=(e=this.options=function(t,e){for(var n in e)t[n]=e[n];return t}(Object.create(this.options),e)).debug;if(n&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var i=function(t,e){var n=[];if("FeatureCollection"===t.type)for(var i=0;i<t.features.length;i++)Ct(n,t.features[i],e,i);else"Feature"===t.type?Ct(n,t,e):Ct(n,{geometry:t},e);return n}(t,e);this.tiles={},this.tileCoords=[],n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(i=function(t,e){var n=e.buffer/e.extent,i=t,r=It(t,1,-1-n,n,0,-1,2,e),o=It(t,1,1-n,2+n,0,-1,2,e);return(r||o)&&(i=It(t,1,-n,1+n,0,-1,2,e)||[],r&&(i=jt(r,1).concat(i)),o&&(i=i.concat(jt(o,-1)))),i}(i,e)).length&&this.splitTile(i,0,0,0),n&&(i.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function Kt(t,e,n){return 32*((1<<t)*n+e)+t}function Yt(t,e){var n=t.tileID.canonical;if(!this._geoJSONIndex)return e(null,null);var i=this._geoJSONIndex.getTile(n.z,n.x,n.y);if(!i)return e(null,null);var r=new G(i.features),o=Y(r);0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),e(null,{vectorTile:r,rawData:o.buffer})}dt.prototype.load=function(t){var e=this.options,n=e.log,i=e.minZoom,r=e.maxZoom,o=e.nodeSize;n&&console.time("total time");var a="prepare "+t.length+" points";n&&console.time(a),this.points=t;for(var s=[],l=0;l<t.length;l++)t[l].geometry&&s.push(yt(t[l],l));this.trees[r+1]=new ht(s,wt,Et,o,Float32Array),n&&console.timeEnd(a);for(var u=r;u>=i;u--){var c=+Date.now();s=this._cluster(s,u),this.trees[u]=new ht(s,wt,Et,o,Float32Array),n&&console.log("z%d: %d clusters in %dms",u,s.length,+Date.now()-c)}return n&&console.timeEnd("total time"),this},dt.prototype.getClusters=function(t,e){var n=((t[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,t[1])),r=180===t[2]?180:((t[2]+180)%360+360)%360-180,o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)n=-180,r=180;else if(n>r){var a=this.getClusters([n,i,180,o],e),s=this.getClusters([-180,i,r,o],e);return a.concat(s)}for(var l=this.trees[this._limitZoom(e)],u=[],c=0,p=l.range(vt(n),xt(o),vt(r),xt(i));c<p.length;c+=1){var h=p[c],f=l.points[h];u.push(f.numPoints?_t(f):this.points[f.index])}return u},dt.prototype.getChildren=function(t){var e=t>>5,n=t%32,i="No cluster with the specified id.",r=this.trees[n];if(!r)throw new Error(i);var o=r.points[e];if(!o)throw new Error(i);for(var a=this.options.radius/(this.options.extent*Math.pow(2,n-1)),s=[],l=0,u=r.within(o.x,o.y,a);l<u.length;l+=1){var c=u[l],p=r.points[c];p.parentId===t&&s.push(p.numPoints?_t(p):this.points[p.index])}if(0===s.length)throw new Error(i);return s},dt.prototype.getLeaves=function(t,e,n){e=e||10,n=n||0;var i=[];return this._appendLeaves(i,t,e,n,0),i},dt.prototype.getTile=function(t,e,n){var i=this.trees[this._limitZoom(t)],r=Math.pow(2,t),o=this.options,a=o.extent,s=o.radius/a,l=(n-s)/r,u=(n+1+s)/r,c={features:[]};return this._addTileFeatures(i.range((e-s)/r,l,(e+1+s)/r,u),i.points,e,n,r,c),0===e&&this._addTileFeatures(i.range(1-s/r,l,1,u),i.points,r,n,r,c),e===r-1&&this._addTileFeatures(i.range(0,l,s/r,u),i.points,-1,n,r,c),c.features.length?c:null},dt.prototype.getClusterExpansionZoom=function(t){for(var e=t%32-1;e<=this.options.maxZoom;){var n=this.getChildren(t);if(e++,1!==n.length)break;t=n[0].properties.cluster_id}return e},dt.prototype._appendLeaves=function(t,e,n,i,r){for(var o=0,a=this.getChildren(e);o<a.length;o+=1){var s=a[o],l=s.properties;if(l&&l.cluster?r+l.point_count<=i?r+=l.point_count:r=this._appendLeaves(t,l.cluster_id,n,i,r):r<i?r++:t.push(s),t.length===n)break}return r},dt.prototype._addTileFeatures=function(t,e,n,i,r,o){for(var a=0,s=t;a<s.length;a+=1){var l=e[s[a]],u={type:1,geometry:[[Math.round(this.options.extent*(l.x*r-n)),Math.round(this.options.extent*(l.y*r-i))]],tags:l.numPoints?gt(l):this.points[l.index].properties},c=l.numPoints?l.id:this.points[l.index].id;void 0!==c&&(u.id=c),o.features.push(u)}},dt.prototype._limitZoom=function(t){return Math.max(this.options.minZoom,Math.min(t,this.options.maxZoom+1))},dt.prototype._cluster=function(t,e){for(var n=[],i=this.options,r=i.radius,o=i.extent,a=i.reduce,s=r/(o*Math.pow(2,e)),l=0;l<t.length;l++){var u=t[l];if(!(u.zoom<=e)){u.zoom=e;for(var c=this.trees[e+1],p=c.within(u.x,u.y,s),h=u.numPoints||1,f=u.x*h,d=u.y*h,m=a?this._map(u,!0):null,y=(l<<5)+(e+1),_=0,g=p;_<g.length;_+=1){var v=g[_],x=c.points[v];if(!(x.zoom<=e)){x.zoom=e;var b=x.numPoints||1;f+=x.x*b,d+=x.y*b,h+=b,x.parentId=y,a&&a(m,this._map(x))}}1===h?n.push(u):(u.parentId=y,n.push(mt(f/h,d/h,y,h,m)))}}return n},dt.prototype._map=function(t,e){if(t.numPoints)return e?bt({},t.properties):t.properties;var n=this.points[t.index].properties,i=this.options.map(n);return e&&i===n?bt({},i):i},Xt.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},Xt.prototype.splitTile=function(t,e,n,i,r,o,a){for(var s=[t,e,n,i],l=this.options,u=l.debug;s.length;){i=s.pop(),n=s.pop(),e=s.pop(),t=s.pop();var c=1<<e,p=Kt(e,n,i),h=this.tiles[p];if(!h&&(u>1&&console.time("creation"),h=this.tiles[p]=Gt(t,e,n,i,l),this.tileCoords.push({z:e,x:n,y:i}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,n,i,h.numFeatures,h.numPoints,h.numSimplified),console.timeEnd("creation"));var f="z"+e;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(h.source=t,r){if(e===l.maxZoom||e===r)continue;var d=1<<r-e;if(n!==Math.floor(o/d)||i!==Math.floor(a/d))continue}else if(e===l.indexMaxZoom||h.numPoints<=l.indexMaxPoints)continue;if(h.source=null,0!==t.length){u>1&&console.time("clipping");var m,y,_,g,v,x,b=.5*l.buffer/l.extent,w=.5-b,E=.5+b,T=1+b;m=y=_=g=null,v=It(t,c,n-b,n+E,0,h.minX,h.maxX,l),x=It(t,c,n+w,n+T,0,h.minX,h.maxX,l),t=null,v&&(m=It(v,c,i-b,i+E,1,h.minY,h.maxY,l),y=It(v,c,i+w,i+T,1,h.minY,h.maxY,l),v=null),x&&(_=It(x,c,i-b,i+E,1,h.minY,h.maxY,l),g=It(x,c,i+w,i+T,1,h.minY,h.maxY,l),x=null),u>1&&console.timeEnd("clipping"),s.push(m||[],e+1,2*n,2*i),s.push(y||[],e+1,2*n,2*i+1),s.push(_||[],e+1,2*n+1,2*i),s.push(g||[],e+1,2*n+1,2*i+1)}}},Xt.prototype.getTile=function(t,e,n){var i=this.options,r=i.extent,o=i.debug;if(t<0||t>24)return null;var a=1<<t,s=Kt(t,e=(e%a+a)%a,n);if(this.tiles[s])return Zt(this.tiles[s],r);o>1&&console.log("drilling down to z%d-%d-%d",t,e,n);for(var l,u=t,c=e,p=n;!l&&u>0;)u--,c=Math.floor(c/2),p=Math.floor(p/2),l=this.tiles[Kt(u,c,p)];return l&&l.source?(o>1&&console.log("found parent tile z%d-%d-%d",u,c,p),o>1&&console.time("drilling down"),this.splitTile(l.source,u,c,p,t,e,n),o>1&&console.timeEnd("drilling down"),this.tiles[s]?Zt(this.tiles[s],r):null):null};var Jt=function(e){function n(t,n,i){e.call(this,t,n,Yt),i&&(this.loadGeoJSON=i)}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.loadData=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=e,this._pendingLoadDataParams=t,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())},n.prototype._loadData=function(){var e=this;if(this._pendingCallback&&this._pendingLoadDataParams){var n=this._pendingCallback,i=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var r=!!(i&&i.request&&i.request.collectResourceTiming)&&new z.Performance(i.request);this.loadGeoJSON(i,function(o,a){if(o||!a)return n(o);if("object"!=typeof a)return n(new Error("Input data is not a valid GeoJSON object."));!function t(e,n){switch(e&&e.type||null){case"FeatureCollection":return e.features=e.features.map(U(t,n)),e;case"GeometryCollection":return e.geometries=e.geometries.map(U(t,n)),e;case"Feature":return e.geometry=t(e.geometry,n),e;case"Polygon":case"MultiPolygon":return function(t,e){return"Polygon"===t.type?t.coordinates=j(t.coordinates,e):"MultiPolygon"===t.type&&(t.coordinates=t.coordinates.map(U(j,e))),t}(e,n);default:return e}}(a,!0);try{e._geoJSONIndex=i.cluster?new dt(function(e){var n=e.superclusterOptions,i=e.clusterProperties;if(!i||!n)return n;for(var r={},o={},a={accumulated:null,zoom:0},s={properties:null},l=Object.keys(i),u=0,c=l;u<c.length;u+=1){var p=c[u],h=i[p],f=h[0],d=h[1],m=t.createExpression(d),y=t.createExpression("string"==typeof f?[f,["accumulated"],["get",p]]:f);r[p]=m.value,o[p]=y.value}return n.map=function(t){s.properties=t;for(var e={},n=0,i=l;n<i.length;n+=1){var o=i[n];e[o]=r[o].evaluate(a,s)}return e},n.reduce=function(t,e){s.properties=e;for(var n=0,i=l;n<i.length;n+=1){var r=i[n];a.accumulated=t[r],t[r]=o[r].evaluate(a,s)}},n}(i)).load(a.features):new Xt(a,i.geojsonVtOptions)}catch(o){return n(o)}e.loaded={};var s={};if(r){var l=r.finish();l&&(s.resourceTiming={},s.resourceTiming[i.source]=JSON.parse(JSON.stringify(l)))}n(null,s)})}},n.prototype.coalesce=function(){"Coalescing"===this._state?this._state="Idle":"NeedsLoadData"===this._state&&(this._state="Coalescing",this._loadData())},n.prototype.reloadTile=function(t,n){var i=this.loaded,r=t.uid;return i&&i[r]?e.prototype.reloadTile.call(this,t,n):this.loadTile(t,n)},n.prototype.loadGeoJSON=function(e,n){if(e.request)t.getJSON(e.request,n);else{if("string"!=typeof e.data)return n(new Error("Input data is not a valid GeoJSON object."));try{return n(null,JSON.parse(e.data))}catch(t){return n(new Error("Input data is not a valid GeoJSON object."))}}},n.prototype.removeSource=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),e()},n.prototype.getClusterExpansionZoom=function(t,e){e(null,this._geoJSONIndex.getClusterExpansionZoom(t.clusterId))},n.prototype.getClusterChildren=function(t,e){e(null,this._geoJSONIndex.getChildren(t.clusterId))},n.prototype.getClusterLeaves=function(t,e){e(null,this._geoJSONIndex.getLeaves(t.clusterId,t.limit,t.offset))},n}(I),$t=function(e){var n=this;this.self=e,this.actor=new t.Actor(e,this),this.layerIndexes={},this.workerSourceTypes={vector:I,geojson:Jt},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=function(t,e){if(n.workerSourceTypes[t])throw new Error('Worker source with name "'+t+'" already registered.');n.workerSourceTypes[t]=e},this.self.registerRTLTextPlugin=function(e){if(t.plugin.isLoaded())throw new Error("RTL text plugin already registered.");t.plugin.applyArabicShaping=e.applyArabicShaping,t.plugin.processBidirectionalText=e.processBidirectionalText,t.plugin.processStyledBidirectionalText=e.processStyledBidirectionalText}};return $t.prototype.setReferrer=function(t,e){this.referrer=e},$t.prototype.setLayers=function(t,e,n){this.getLayerIndex(t).replace(e),n()},$t.prototype.updateLayers=function(t,e,n){this.getLayerIndex(t).update(e.layers,e.removedIds),n()},$t.prototype.loadTile=function(t,e,n){this.getWorkerSource(t,e.type,e.source).loadTile(e,n)},$t.prototype.loadDEMTile=function(t,e,n){this.getDEMWorkerSource(t,e.source).loadTile(e,n)},$t.prototype.reloadTile=function(t,e,n){this.getWorkerSource(t,e.type,e.source).reloadTile(e,n)},$t.prototype.abortTile=function(t,e,n){this.getWorkerSource(t,e.type,e.source).abortTile(e,n)},$t.prototype.removeTile=function(t,e,n){this.getWorkerSource(t,e.type,e.source).removeTile(e,n)},$t.prototype.removeDEMTile=function(t,e){this.getDEMWorkerSource(t,e.source).removeTile(e)},$t.prototype.removeSource=function(t,e,n){if(this.workerSources[t]&&this.workerSources[t][e.type]&&this.workerSources[t][e.type][e.source]){var i=this.workerSources[t][e.type][e.source];delete this.workerSources[t][e.type][e.source],void 0!==i.removeSource?i.removeSource(e,n):n()}},$t.prototype.loadWorkerSource=function(t,e,n){try{this.self.importScripts(e.url),n()}catch(t){n(t.toString())}},$t.prototype.loadRTLTextPlugin=function(e,n,i){try{t.plugin.isLoaded()||(this.self.importScripts(n),i(t.plugin.isLoaded()?null:new Error("RTL Text Plugin failed to import scripts from "+n)))}catch(t){i(t.toString())}},$t.prototype.getLayerIndex=function(t){var e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new i),e},$t.prototype.getWorkerSource=function(t,e,n){var i=this;if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][e]||(this.workerSources[t][e]={}),!this.workerSources[t][e][n]){var r={send:function(e,n,r){i.actor.send(e,n,r,t)}};this.workerSources[t][e][n]=new this.workerSourceTypes[e](r,this.getLayerIndex(t))}return this.workerSources[t][e][n]},$t.prototype.getDEMWorkerSource=function(t,e){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][e]||(this.demWorkerSources[t][e]=new O),this.demWorkerSources[t][e]},"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new $t(self)),$t}),i(0,function(t){var e=t.createCommonjsModule(function(t){function e(t){return!!("undefined"!=typeof window&&"undefined"!=typeof document&&Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray&&Function.prototype&&Function.prototype.bind&&Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions&&"JSON"in window&&"parse"in JSON&&"stringify"in JSON&&function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var t,e,n=new Blob([""],{type:"text/javascript"}),i=URL.createObjectURL(n);try{e=new Worker(i),t=!0}catch(e){t=!1}return e&&e.terminate(),URL.revokeObjectURL(i),t}()&&"Uint8ClampedArray"in window&&ArrayBuffer.isView&&function(t){return void 0===n[t]&&(n[t]=function(t){var n=document.createElement("canvas"),i=Object.create(e.webGLContextAttributes);return i.failIfMajorPerformanceCaveat=t,n.probablySupportsContext?n.probablySupportsContext("webgl",i)||n.probablySupportsContext("experimental-webgl",i):n.supportsContext?n.supportsContext("webgl",i)||n.supportsContext("experimental-webgl",i):n.getContext("webgl",i)||n.getContext("experimental-webgl",i)}(t)),n[t]}(t&&t.failIfMajorPerformanceCaveat))}t.exports?t.exports=e:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=e);var n={};e.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}}),n={create:function(e,n,i){var r=t.window.document.createElement(e);return n&&(r.className=n),i&&i.appendChild(r),r},createNS:function(e,n){return t.window.document.createElementNS(e,n)}},i=t.window.document?t.window.document.documentElement.style:null;function r(t){if(!i)return null;for(var e=0;e<t.length;e++)if(t[e]in i)return t[e];return t[0]}var o,a=r(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]);n.disableDrag=function(){i&&a&&(o=i[a],i[a]="none")},n.enableDrag=function(){i&&a&&(i[a]=o)};var s=r(["transform","WebkitTransform"]);n.setTransform=function(t,e){t.style[s]=e};var l=!1;try{var u=Object.defineProperty({},"passive",{get:function(){l=!0}});t.window.addEventListener("test",u,u),t.window.removeEventListener("test",u,u)}catch(t){l=!1}n.addEventListener=function(t,e,n,i){void 0===i&&(i={}),"passive"in i&&l?t.addEventListener(e,n,i):t.addEventListener(e,n,i.capture)},n.removeEventListener=function(t,e,n,i){void 0===i&&(i={}),"passive"in i&&l?t.removeEventListener(e,n,i):t.removeEventListener(e,n,i.capture)};var c=function(e){e.preventDefault(),e.stopPropagation(),t.window.removeEventListener("click",c,!0)};n.suppressClick=function(){t.window.addEventListener("click",c,!0),t.window.setTimeout(function(){t.window.removeEventListener("click",c,!0)},0)},n.mousePos=function(e,n){var i=e.getBoundingClientRect();return n=n.touches?n.touches[0]:n,new t.Point(n.clientX-i.left-e.clientLeft,n.clientY-i.top-e.clientTop)},n.touchPos=function(e,n){for(var i=e.getBoundingClientRect(),r=[],o="touchend"===n.type?n.changedTouches:n.touches,a=0;a<o.length;a++)r.push(new t.Point(o[a].clientX-i.left-e.clientLeft,o[a].clientY-i.top-e.clientTop));return r},n.mouseButton=function(e){return void 0!==t.window.InstallTrigger&&2===e.button&&e.ctrlKey&&t.window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:e.button},n.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)};var p=function(){this.images={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0};p.prototype.isLoaded=function(){return this.loaded},p.prototype.setLoaded=function(t){if(this.loaded!==t&&(this.loaded=t,t)){for(var e=0,n=this.requestors;e<n.length;e+=1){var i=n[e],r=i.ids,o=i.callback;this._notify(r,o)}this.requestors=[]}},p.prototype.getImage=function(t){return this.images[t]},p.prototype.addImage=function(t,e){this.images[t]=e},p.prototype.removeImage=function(t){delete this.images[t],delete this.patterns[t]},p.prototype.listImages=function(){return Object.keys(this.images)},p.prototype.getImages=function(t,e){var n=!0;if(!this.isLoaded())for(var i=0,r=t;i<r.length;i+=1){var o=r[i];this.images[o]||(n=!1)}this.isLoaded()||n?this._notify(t,e):this.requestors.push({ids:t,callback:e})},p.prototype._notify=function(t,e){for(var n={},i=0,r=t;i<r.length;i+=1){var o=r[i],a=this.images[o];a&&(n[o]={data:a.data.clone(),pixelRatio:a.pixelRatio,sdf:a.sdf})}e(null,n)},p.prototype.getPixelSize=function(){var t=this.atlasImage;return{width:t.width,height:t.height}},p.prototype.getPattern=function(e){var n=this.patterns[e];if(n)return n.position;var i=this.getImage(e);if(!i)return null;var r={w:i.data.width+2,h:i.data.height+2,x:0,y:0},o=new t.ImagePosition(r,i);return this.patterns[e]={bin:r,position:o},this._updatePatternAtlas(),o},p.prototype.bind=function(e){var n=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new t.Texture(e,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)},p.prototype._updatePatternAtlas=function(){var e=[];for(var n in this.patterns)e.push(this.patterns[n].bin);var i=t.potpack(e),r=i.w,o=i.h,a=this.atlasImage;for(var s in a.resize({width:r||1,height:o||1}),this.patterns){var l=this.patterns[s].bin,u=l.x+1,c=l.y+1,p=this.images[s].data,h=p.width,f=p.height;t.RGBAImage.copy(p,a,{x:0,y:0},{x:u,y:c},{width:h,height:f}),t.RGBAImage.copy(p,a,{x:0,y:f-1},{x:u,y:c-1},{width:h,height:1}),t.RGBAImage.copy(p,a,{x:0,y:0},{x:u,y:c+f},{width:h,height:1}),t.RGBAImage.copy(p,a,{x:h-1,y:0},{x:u-1,y:c},{width:1,height:f}),t.RGBAImage.copy(p,a,{x:0,y:0},{x:u+h,y:c},{width:1,height:f})}this.dirty=!0};var h=d,f=1e20;function d(t,e,n,i,r,o){this.fontSize=t||24,this.buffer=void 0===e?3:e,this.cutoff=i||.25,this.fontFamily=r||"sans-serif",this.fontWeight=o||"normal",this.radius=n||8;var a=this.size=this.fontSize+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=a,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textBaseline="middle",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.d=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Int16Array(a),this.middle=Math.round(a/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function m(t,e,n,i,r,o,a){for(var s=0;s<e;s++){for(var l=0;l<n;l++)i[l]=t[l*e+s];for(y(i,r,o,a,n),l=0;l<n;l++)t[l*e+s]=r[l]}for(l=0;l<n;l++){for(s=0;s<e;s++)i[s]=t[l*e+s];for(y(i,r,o,a,e),s=0;s<e;s++)t[l*e+s]=Math.sqrt(r[s])}}function y(t,e,n,i,r){n[0]=0,i[0]=-f,i[1]=+f;for(var o=1,a=0;o<r;o++){for(var s=(t[o]+o*o-(t[n[a]]+n[a]*n[a]))/(2*o-2*n[a]);s<=i[a];)a--,s=(t[o]+o*o-(t[n[a]]+n[a]*n[a]))/(2*o-2*n[a]);n[++a]=o,i[a]=s,i[a+1]=+f}for(o=0,a=0;o<r;o++){for(;i[a+1]<o;)a++;e[o]=(o-n[a])*(o-n[a])+t[n[a]]}}d.prototype.draw=function(t){this.ctx.clearRect(0,0,this.size,this.size),this.ctx.fillText(t,this.buffer,this.middle);for(var e=this.ctx.getImageData(0,0,this.size,this.size),n=new Uint8ClampedArray(this.size*this.size),i=0;i<this.size*this.size;i++){var r=e.data[4*i+3]/255;this.gridOuter[i]=1===r?0:0===r?f:Math.pow(Math.max(0,.5-r),2),this.gridInner[i]=1===r?f:0===r?0:Math.pow(Math.max(0,r-.5),2)}for(m(this.gridOuter,this.size,this.size,this.f,this.d,this.v,this.z),m(this.gridInner,this.size,this.size,this.f,this.d,this.v,this.z),i=0;i<this.size*this.size;i++){var o=this.gridOuter[i]-this.gridInner[i];n[i]=Math.max(0,Math.min(255,Math.round(255-255*(o/this.radius+this.cutoff))))}return n};var _=function(t,e){this.requestTransform=t,this.localIdeographFontFamily=e,this.entries={}};_.prototype.setURL=function(t){this.url=t},_.prototype.getGlyphs=function(e,n){var i=this,r=[];for(var o in e)for(var a=0,s=e[o];a<s.length;a+=1){var l=s[a];r.push({stack:o,id:l})}t.asyncAll(r,function(t,e){var n=t.stack,r=t.id,o=i.entries[n];o||(o=i.entries[n]={glyphs:{},requests:{}});var a=o.glyphs[r];if(void 0===a)if(a=i._tinySDF(o,n,r))e(null,{stack:n,id:r,glyph:a});else{var s=Math.floor(r/256);if(256*s>65535)e(new Error("glyphs > 65535 not supported"));else{var l=o.requests[s];l||(l=o.requests[s]=[],_.loadGlyphRange(n,s,i.url,i.requestTransform,function(t,e){if(e)for(var n in e)o.glyphs[+n]=e[+n];for(var i=0,r=l;i<r.length;i+=1)(0,r[i])(t,e);delete o.requests[s]})),l.push(function(t,i){t?e(t):i&&e(null,{stack:n,id:r,glyph:i[r]||null})})}}else e(null,{stack:n,id:r,glyph:a})},function(t,e){if(t)n(t);else if(e){for(var i={},r=0,o=e;r<o.length;r+=1){var a=o[r],s=a.stack,l=a.id,u=a.glyph;(i[s]||(i[s]={}))[l]=u&&{id:u.id,bitmap:u.bitmap.clone(),metrics:u.metrics}}n(null,i)}})},_.prototype._tinySDF=function(e,n,i){var r=this.localIdeographFontFamily;if(r&&(t.isChar["CJK Unified Ideographs"](i)||t.isChar["Hangul Syllables"](i))){var o=e.tinySDF;if(!o){var a="400";/bold/i.test(n)?a="900":/medium/i.test(n)?a="500":/light/i.test(n)&&(a="200"),o=e.tinySDF=new _.TinySDF(24,3,8,.25,r,a)}return{id:i,bitmap:new t.AlphaImage({width:30,height:30},o.draw(String.fromCharCode(i))),metrics:{width:24,height:24,left:0,top:-8,advance:24}}}},_.loadGlyphRange=function(e,n,i,r,o){var a=256*n,s=a+255,l=r(t.normalizeGlyphsURL(i).replace("{fontstack}",e).replace("{range}",a+"-"+s),t.ResourceType.Glyphs);t.getArrayBuffer(l,function(e,n){if(e)o(e);else if(n){for(var i={},r=0,a=t.parseGlyphPBF(n);r<a.length;r+=1){var s=a[r];i[s.id]=s}o(null,i)}})},_.TinySDF=h;var g=function(){this.specification=t.styleSpec.light.position};g.prototype.possiblyEvaluate=function(e,n){return t.sphericalToCartesian(e.expression.evaluate(n))},g.prototype.interpolate=function(e,n,i){return{x:t.number(e.x,n.x,i),y:t.number(e.y,n.y,i),z:t.number(e.z,n.z,i)}};var v=new t.Properties({anchor:new t.DataConstantProperty(t.styleSpec.light.anchor),position:new g,color:new t.DataConstantProperty(t.styleSpec.light.color),intensity:new t.DataConstantProperty(t.styleSpec.light.intensity)}),x=function(e){function n(n){e.call(this),this._transitionable=new t.Transitionable(v),this.setLight(n),this._transitioning=this._transitionable.untransitioned()}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.getLight=function(){return this._transitionable.serialize()},n.prototype.setLight=function(e,n){if(void 0===n&&(n={}),!this._validate(t.validateLight,e,n))for(var i in e){var r=e[i];t.endsWith(i,"-transition")?this._transitionable.setTransition(i.slice(0,-"-transition".length),r):this._transitionable.setValue(i,r)}},n.prototype.updateTransitions=function(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)},n.prototype.hasTransition=function(){return this._transitioning.hasTransition()},n.prototype.recalculate=function(t){this.properties=this._transitioning.possiblyEvaluate(t)},n.prototype._validate=function(e,n,i){return(!i||!1!==i.validate)&&t.emitValidationErrors(this,e.call(t.validateStyle,t.extend({value:n,style:{glyphs:!0,sprite:!0},styleSpec:t.styleSpec})))},n}(t.Evented),b=function(t,e){this.width=t,this.height=e,this.nextRow=0,this.bytes=4,this.data=new Uint8Array(this.width*this.height*this.bytes),this.positions={}};b.prototype.getDash=function(t,e){var n=t.join(",")+String(e);return this.positions[n]||(this.positions[n]=this.addDash(t,e)),this.positions[n]},b.prototype.addDash=function(e,n){var i=n?7:0,r=2*i+1;if(this.nextRow+r>this.height)return t.warnOnce("LineAtlas out of space"),null;for(var o=0,a=0;a<e.length;a++)o+=e[a];for(var s=this.width/o,l=s/2,u=e.length%2==1,c=-i;c<=i;c++)for(var p=this.nextRow+i+c,h=this.width*p,f=u?-e[e.length-1]:0,d=e[0],m=1,y=0;y<this.width;y++){for(;d<y/s;)f=d,d+=e[m],u&&m===e.length-1&&(d+=e[0]),m++;var _=Math.abs(y-f*s),g=Math.abs(y-d*s),v=Math.min(_,g),x=m%2==1,b=void 0;if(n){var w=i?c/i*(l+1):0;if(x){var E=l-Math.abs(w);b=Math.sqrt(v*v+E*E)}else b=l-Math.sqrt(v*v+w*w)}else b=(x?1:-1)*v;this.data[3+4*(h+y)]=Math.max(0,Math.min(255,b+128))}var T={y:(this.nextRow+i+.5)/this.height,height:2*i/this.height,width:o};return this.nextRow+=r,this.dirty=!0,T},b.prototype.bind=function(t){var e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.RGBA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.width,this.height,0,e.RGBA,e.UNSIGNED_BYTE,this.data))};var w=function e(n,i){this.workerPool=n,this.actors=[],this.currentActor=0,this.id=t.uniqueId();for(var r=this.workerPool.acquire(this.id),o=0;o<r.length;o++){var a=r[o],s=new e.Actor(a,i,this.id);s.name="Worker "+o,this.actors.push(s)}};function E(e,n,i){var r=function(n,r){if(n)return i(n);if(r){var o=t.pick(r,["tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds"]);r.vector_layers&&(o.vectorLayers=r.vector_layers,o.vectorLayerIds=o.vectorLayers.map(function(t){return t.id})),e.url&&(o.tiles=t.canonicalizeTileset(o,e.url)),i(null,o)}};return e.url?t.getJSON(n(t.normalizeSourceURL(e.url),t.ResourceType.Source),r):t.browser.frame(function(){return r(null,e)})}w.prototype.broadcast=function(e,n,i){i=i||function(){},t.asyncAll(this.actors,function(t,i){t.send(e,n,i)},i)},w.prototype.send=function(t,e,n,i){return("number"!=typeof i||isNaN(i))&&(i=this.currentActor=(this.currentActor+1)%this.actors.length),this.actors[i].send(t,e,n),i},w.prototype.remove=function(){this.actors.forEach(function(t){t.remove()}),this.actors=[],this.workerPool.release(this.id)},w.Actor=t.Actor;var T=function(e,n,i){this.bounds=t.LngLatBounds.convert(this.validateBounds(e)),this.minzoom=n||0,this.maxzoom=i||24};T.prototype.validateBounds=function(t){return Array.isArray(t)&&4===t.length?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]},T.prototype.contains=function(e){var n=Math.pow(2,e.z),i=Math.floor(t.mercatorXfromLng(this.bounds.getWest())*n),r=Math.floor(t.mercatorYfromLat(this.bounds.getNorth())*n),o=Math.ceil(t.mercatorXfromLng(this.bounds.getEast())*n),a=Math.ceil(t.mercatorYfromLat(this.bounds.getSouth())*n);return e.x>=i&&e.x<o&&e.y>=r&&e.y<a};var S=function(e){function n(n,i,r,o){if(e.call(this),this.id=n,this.dispatcher=r,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,t.extend(this,t.pick(i,["url","scheme","tileSize"])),this._options=t.extend({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(o)}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.load=function(){var e=this;this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=E(this._options,this.map._transformRequest,function(n,i){e._tileJSONRequest=null,n?e.fire(new t.ErrorEvent(n)):i&&(t.extend(e,i),i.bounds&&(e.tileBounds=new T(i.bounds,e.minzoom,e.maxzoom)),t.postTurnstileEvent(i.tiles),t.postMapLoadEvent(i.tiles,e.map._getMapId()),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))})},n.prototype.hasTile=function(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)},n.prototype.onAdd=function(t){this.map=t,this.load()},n.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},n.prototype.serialize=function(){return t.extend({},this._options)},n.prototype.loadTile=function(e,n){var i=t.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),this.url),r={request:this.map._transformRequest(i,t.ResourceType.Tile),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:t.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes};function o(t,i){return e.aborted?n(null):t&&404!==t.status?n(t):(i&&i.resourceTiming&&(e.resourceTiming=i.resourceTiming),this.map._refreshExpiredTiles&&i&&e.setExpiryData(i),e.loadVectorData(i,this.map.painter),n(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)))}r.request.collectResourceTiming=this._collectResourceTiming,void 0===e.workerID||"expired"===e.state?e.workerID=this.dispatcher.send("loadTile",r,o.bind(this)):"loading"===e.state?e.reloadCallback=n:this.dispatcher.send("reloadTile",r,o.bind(this),e.workerID)},n.prototype.abortTile=function(t){this.dispatcher.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0,t.workerID)},n.prototype.unloadTile=function(t){t.unloadVectorData(),this.dispatcher.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0,t.workerID)},n.prototype.hasTransition=function(){return!1},n}(t.Evented),P=function(e){function n(n,i,r,o){e.call(this),this.id=n,this.dispatcher=r,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=t.extend({},i),t.extend(this,t.pick(i,["url","scheme","tileSize"]))}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.load=function(){var e=this;this.fire(new t.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=E(this._options,this.map._transformRequest,function(n,i){e._tileJSONRequest=null,n?e.fire(new t.ErrorEvent(n)):i&&(t.extend(e,i),i.bounds&&(e.tileBounds=new T(i.bounds,e.minzoom,e.maxzoom)),t.postTurnstileEvent(i.tiles),t.postMapLoadEvent(i.tiles,e.map._getMapId()),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})),e.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})))})},n.prototype.onAdd=function(t){this.map=t,this.load()},n.prototype.onRemove=function(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)},n.prototype.serialize=function(){return t.extend({},this._options)},n.prototype.hasTile=function(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)},n.prototype.loadTile=function(e,n){var i=this,r=t.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),this.url,this.tileSize);e.request=t.getImage(this.map._transformRequest(r,t.ResourceType.Tile),function(r,o){if(delete e.request,e.aborted)e.state="unloaded",n(null);else if(r)e.state="errored",n(r);else if(o){i.map._refreshExpiredTiles&&e.setExpiryData(o),delete o.cacheControl,delete o.expires;var a=i.map.painter.context,s=a.gl;e.texture=i.map.painter.getTileTexture(o.width),e.texture?e.texture.update(o,{useMipmap:!0}):(e.texture=new t.Texture(a,o,s.RGBA,{useMipmap:!0}),e.texture.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_NEAREST),a.extTextureFilterAnisotropic&&s.texParameterf(s.TEXTURE_2D,a.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,a.extTextureFilterAnisotropicMax)),e.state="loaded",n(null)}})},n.prototype.abortTile=function(t,e){t.request&&(t.request.cancel(),delete t.request),e()},n.prototype.unloadTile=function(t,e){t.texture&&this.map.painter.saveTileTexture(t.texture),e()},n.prototype.hasTransition=function(){return!1},n}(t.Evented),C=function(e){function n(n,i,r,o){e.call(this,n,i,r,o),this.type="raster-dem",this.maxzoom=22,this._options=t.extend({},i),this.encoding=i.encoding||"mapbox"}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.serialize=function(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}},n.prototype.loadTile=function(e,n){var i=t.normalizeTileURL(e.tileID.canonical.url(this.tiles,this.scheme),this.url,this.tileSize);e.request=t.getImage(this.map._transformRequest(i,t.ResourceType.Tile),function(i,r){if(delete e.request,e.aborted)e.state="unloaded",n(null);else if(i)e.state="errored",n(i);else if(r){this.map._refreshExpiredTiles&&e.setExpiryData(r),delete r.cacheControl,delete r.expires;var o=t.browser.getImageData(r),a={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:o,encoding:this.encoding};e.workerID&&"expired"!==e.state||(e.workerID=this.dispatcher.send("loadDEMTile",a,function(t,i){t&&(e.state="errored",n(t)),i&&(e.dem=i,e.needsHillshadePrepare=!0,e.state="loaded",n(null))}.bind(this)))}}.bind(this)),e.neighboringTiles=this._getNeighboringTiles(e.tileID)},n.prototype._getNeighboringTiles=function(e){var n=e.canonical,i=Math.pow(2,n.z),r=(n.x-1+i)%i,o=0===n.x?e.wrap-1:e.wrap,a=(n.x+1+i)%i,s=n.x+1===i?e.wrap+1:e.wrap,l={};return l[new t.OverscaledTileID(e.overscaledZ,o,n.z,r,n.y).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,n.z,a,n.y).key]={backfilled:!1},n.y>0&&(l[new t.OverscaledTileID(e.overscaledZ,o,n.z,r,n.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,n.z,a,n.y-1).key]={backfilled:!1}),n.y+1<i&&(l[new t.OverscaledTileID(e.overscaledZ,o,n.z,r,n.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,e.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},l[new t.OverscaledTileID(e.overscaledZ,s,n.z,a,n.y+1).key]={backfilled:!1}),l},n.prototype.unloadTile=function(t){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",this.dispatcher.send("removeDEMTile",{uid:t.uid,source:this.id},void 0,t.workerID)},n}(P),k=function(e){function n(n,i,r,o){e.call(this),this.id=n,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this.dispatcher=r,this.setEventedParent(o),this._data=i.data,this._options=t.extend({},i),this._collectResourceTiming=i.collectResourceTiming,this._resourceTiming=[],void 0!==i.maxzoom&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution);var a=t.EXTENT/this.tileSize;this.workerOptions=t.extend({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:(void 0!==i.buffer?i.buffer:128)*a,tolerance:(void 0!==i.tolerance?i.tolerance:.375)*a,extent:t.EXTENT,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:void 0!==i.clusterMaxZoom?Math.min(i.clusterMaxZoom,this.maxzoom-1):this.maxzoom-1,extent:t.EXTENT,radius:(i.clusterRadius||50)*a,log:!1},clusterProperties:i.clusterProperties},i.workerOptions)}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.load=function(){var e=this;this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData(function(n){if(n)e.fire(new t.ErrorEvent(n));else{var i={dataType:"source",sourceDataType:"metadata"};e._collectResourceTiming&&e._resourceTiming&&e._resourceTiming.length>0&&(i.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire(new t.Event("data",i))}})},n.prototype.onAdd=function(t){this.map=t,this.load()},n.prototype.setData=function(e){var n=this;return this._data=e,this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData(function(e){if(e)n.fire(new t.ErrorEvent(e));else{var i={dataType:"source",sourceDataType:"content"};n._collectResourceTiming&&n._resourceTiming&&n._resourceTiming.length>0&&(i.resourceTiming=n._resourceTiming,n._resourceTiming=[]),n.fire(new t.Event("data",i))}}),this},n.prototype.getClusterExpansionZoom=function(t,e){return this.dispatcher.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e,this.workerID),this},n.prototype.getClusterChildren=function(t,e){return this.dispatcher.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e,this.workerID),this},n.prototype.getClusterLeaves=function(t,e,n,i){return this.dispatcher.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:n},i,this.workerID),this},n.prototype._updateWorkerData=function(e){var n=this,i=t.extend({},this.workerOptions),r=this._data;"string"==typeof r?(i.request=this.map._transformRequest(t.browser.resolveURL(r),t.ResourceType.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(r),this.workerID=this.dispatcher.send(this.type+".loadData",i,function(t,r){n._removed||r&&r.abandoned||(n._loaded=!0,r&&r.resourceTiming&&r.resourceTiming[n.id]&&(n._resourceTiming=r.resourceTiming[n.id].slice(0)),n.dispatcher.send(n.type+".coalesce",{source:i.source},null,n.workerID),e(t))},this.workerID)},n.prototype.loadTile=function(e,n){var i=this,r=void 0===e.workerID?"loadTile":"reloadTile",o={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:t.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes};e.workerID=this.dispatcher.send(r,o,function(t,o){return e.unloadVectorData(),e.aborted?n(null):t?n(t):(e.loadVectorData(o,i.map.painter,"reloadTile"===r),n(null))},this.workerID)},n.prototype.abortTile=function(t){t.aborted=!0},n.prototype.unloadTile=function(t){t.unloadVectorData(),this.dispatcher.send("removeTile",{uid:t.uid,type:this.type,source:this.id},null,t.workerID)},n.prototype.onRemove=function(){this._removed=!0,this.dispatcher.send("removeSource",{type:this.type,source:this.id},null,this.workerID)},n.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},n.prototype.hasTransition=function(){return!1},n}(t.Evented),A=function(e){function n(t,n,i,r){e.call(this),this.id=t,this.dispatcher=i,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this.setEventedParent(r),this.options=n}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.load=function(e,n){var i=this;this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._transformRequest(this.url,t.ResourceType.Image),function(r,o){r?i.fire(new t.ErrorEvent(r)):o&&(i.image=o,e&&(i.coordinates=e),n&&n(),i._finishLoading())})},n.prototype.updateImage=function(t){var e=this;return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,function(){e.texture=null}),this):this},n.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))},n.prototype.onAdd=function(t){this.map=t,this.load()},n.prototype.setCoordinates=function(e){var n=this;this.coordinates=e;var i=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){for(var n=1/0,i=1/0,r=-1/0,o=-1/0,a=0,s=e;a<s.length;a+=1){var l=s[a];n=Math.min(n,l.x),i=Math.min(i,l.y),r=Math.max(r,l.x),o=Math.max(o,l.y)}var u=r-n,c=o-i,p=Math.max(u,c),h=Math.max(0,Math.floor(-Math.log(p)/Math.LN2)),f=Math.pow(2,h);return new t.CanonicalTileID(h,Math.floor((n+r)/2*f),Math.floor((i+o)/2*f))}(i),this.minzoom=this.maxzoom=this.tileID.z;var r=i.map(function(t){return n.tileID.getTilePoint(t)._round()});return this._boundsArray=new t.StructArrayLayout4i8,this._boundsArray.emplaceBack(r[0].x,r[0].y,0,0),this._boundsArray.emplaceBack(r[1].x,r[1].y,t.EXTENT,0),this._boundsArray.emplaceBack(r[3].x,r[3].y,0,t.EXTENT),this._boundsArray.emplaceBack(r[2].x,r[2].y,t.EXTENT,t.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"content"})),this},n.prototype.prepare=function(){if(0!==Object.keys(this.tiles).length&&this.image){var e=this.map.painter.context,n=e.gl;for(var i in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,t.rasterBoundsAttributes.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new t.Texture(e,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE)),this.tiles){var r=this.tiles[i];"loaded"!==r.state&&(r.state="loaded",r.texture=this.texture)}}},n.prototype.loadTile=function(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state="errored",e(null))},n.prototype.serialize=function(){return{type:"image",url:this.options.url,coordinates:this.coordinates}},n.prototype.hasTransition=function(){return!1},n}(t.Evented),z={vector:S,raster:P,"raster-dem":C,geojson:k,video:function(e){function n(t,n,i,r){e.call(this,t,n,i,r),this.roundZoom=!0,this.type="video",this.options=n}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.load=function(){var e=this,n=this.options;this.urls=[];for(var i=0,r=n.urls;i<r.length;i+=1){var o=r[i];this.urls.push(this.map._transformRequest(o,t.ResourceType.Source).url)}t.getVideo(this.urls,function(n,i){n?e.fire(new t.ErrorEvent(n)):i&&(e.video=i,e.video.loop=!0,e.video.addEventListener("playing",function(){e.map.triggerRepaint()}),e.map&&e.video.play(),e._finishLoading())})},n.prototype.getVideo=function(){return this.video},n.prototype.onAdd=function(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},n.prototype.prepare=function(){if(!(0===Object.keys(this.tiles).length||this.video.readyState<2)){var e=this.map.painter.context,n=e.gl;for(var i in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,t.rasterBoundsAttributes.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new t.Texture(e,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE)),this.tiles){var r=this.tiles[i];"loaded"!==r.state&&(r.state="loaded",r.texture=this.texture)}}},n.prototype.serialize=function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}},n.prototype.hasTransition=function(){return this.video&&!this.video.paused},n}(A),image:A,canvas:function(e){function n(n,i,r,o){e.call(this,n,i,r,o),i.coordinates?Array.isArray(i.coordinates)&&4===i.coordinates.length&&!i.coordinates.some(function(t){return!Array.isArray(t)||2!==t.length||t.some(function(t){return"number"!=typeof t})})||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+n,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+n,null,'missing required property "coordinates"'))),i.animate&&"boolean"!=typeof i.animate&&this.fire(new t.ErrorEvent(new t.ValidationError("sources."+n,null,'optional "animate" property must be a boolean value'))),i.canvas?"string"==typeof i.canvas||i.canvas instanceof t.window.HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+n,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+n,null,'missing required property "canvas"'))),this.options=i,this.animate=void 0===i.animate||i.animate}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.load=function(){this.canvas||(this.canvas=this.options.canvas instanceof t.window.HTMLCanvasElement?this.options.canvas:t.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing=!1},this._finishLoading())},n.prototype.getCanvas=function(){return this.canvas},n.prototype.onAdd=function(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()},n.prototype.onRemove=function(){this.pause()},n.prototype.prepare=function(){var e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),!this._hasInvalidDimensions()&&0!==Object.keys(this.tiles).length){var n=this.map.painter.context,i=n.gl;for(var r in this.boundsBuffer||(this.boundsBuffer=n.createVertexBuffer(this._boundsArray,t.rasterBoundsAttributes.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new t.Texture(n,this.canvas,i.RGBA,{premultiply:!0}),this.tiles){var o=this.tiles[r];"loaded"!==o.state&&(o.state="loaded",o.texture=this.texture)}}},n.prototype.serialize=function(){return{type:"canvas",coordinates:this.coordinates}},n.prototype.hasTransition=function(){return this._playing},n.prototype._hasInvalidDimensions=function(){for(var t=0,e=[this.canvas.width,this.canvas.height];t<e.length;t+=1){var n=e[t];if(isNaN(n)||n<=0)return!0}return!1},n}(A)},L=function(e,n,i,r){var o=new z[n.type](e,n,i,r);if(o.id!==e)throw new Error("Expected Source id to be "+e+" instead of "+o.id);return t.bindAll(["load","abort","unload","serialize","prepare"],o),o};function M(e,n){var i=t.identity([]);return t.translate(i,i,[1,1,0]),t.scale(i,i,[.5*e.width,.5*e.height,1]),t.multiply(i,i,e.calculatePosMatrix(n.toUnwrapped()))}function I(t,e,n,i,r){var o=function(t,e,n){if(t)for(var i=0,r=t;i<r.length;i+=1){var o=e[r[i]];if(o&&o.source===n&&"fill-extrusion"===o.type)return!0}else for(var a in e){var s=e[a];if(s.source===n&&"fill-extrusion"===s.type)return!0}return!1}(i&&i.layers,e,t.id),a=r.maxPitchScaleFactor(),s=t.tilesIn(n,a,o);s.sort(O);for(var l=[],u=0,c=s;u<c.length;u+=1){var p=c[u];l.push({wrappedTileID:p.tileID.wrapped().key,queryResults:p.tile.queryRenderedFeatures(e,t._state,p.queryGeometry,p.cameraQueryGeometry,p.scale,i,r,a,M(t.transform,p.tileID))})}var h=function(t){for(var e={},n={},i=0,r=t;i<r.length;i+=1){var o=r[i],a=o.queryResults,s=o.wrappedTileID,l=n[s]=n[s]||{};for(var u in a)for(var c=a[u],p=l[u]=l[u]||{},h=e[u]=e[u]||[],f=0,d=c;f<d.length;f+=1){var m=d[f];p[m.featureIndex]||(p[m.featureIndex]=!0,h.push(m))}}return e}(l);for(var f in h)h[f].forEach(function(e){var n=e.feature,i=t.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=i});return h}function O(t,e){var n=t.tileID,i=e.tileID;return n.overscaledZ-i.overscaledZ||n.canonical.y-i.canonical.y||n.wrap-i.wrap||n.canonical.x-i.canonical.x}var D=function(t,e){this.max=t,this.onRemove=e,this.reset()};D.prototype.reset=function(){for(var t in this.data)for(var e=0,n=this.data[t];e<n.length;e+=1){var i=n[e];i.timeout&&clearTimeout(i.timeout),this.onRemove(i.value)}return this.data={},this.order=[],this},D.prototype.add=function(t,e,n){var i=this,r=t.wrapped().key;void 0===this.data[r]&&(this.data[r]=[]);var o={value:e,timeout:void 0};if(void 0!==n&&(o.timeout=setTimeout(function(){i.remove(t,o)},n)),this.data[r].push(o),this.order.push(r),this.order.length>this.max){var a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this},D.prototype.has=function(t){return t.wrapped().key in this.data},D.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},D.prototype._getAndRemoveByKey=function(t){var e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value},D.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},D.prototype.remove=function(t,e){if(!this.has(t))return this;var n=t.wrapped().key,i=void 0===e?0:this.data[n].indexOf(e),r=this.data[n][i];return this.data[n].splice(i,1),r.timeout&&clearTimeout(r.timeout),0===this.data[n].length&&delete this.data[n],this.onRemove(r.value),this.order.splice(this.order.indexOf(n),1),this},D.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this};var R=function(t,e,n){this.context=t;var i=t.gl;this.buffer=i.createBuffer(),this.dynamicDraw=Boolean(n),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};R.prototype.bind=function(){this.context.bindElementBuffer.set(this.buffer)},R.prototype.updateData=function(t){var e=this.context.gl;this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)},R.prototype.destroy=function(){var t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)};var B={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},F=function(t,e,n,i){this.length=e.length,this.attributes=n,this.itemSize=e.bytesPerElement,this.dynamicDraw=i,this.context=t;var r=t.gl;this.buffer=r.createBuffer(),t.bindVertexBuffer.set(this.buffer),r.bufferData(r.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};F.prototype.bind=function(){this.context.bindVertexBuffer.set(this.buffer)},F.prototype.updateData=function(t){var e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)},F.prototype.enableAttributes=function(t,e){for(var n=0;n<this.attributes.length;n++){var i=this.attributes[n],r=e.attributes[i.name];void 0!==r&&t.enableVertexAttribArray(r)}},F.prototype.setVertexAttribPointers=function(t,e,n){for(var i=0;i<this.attributes.length;i++){var r=this.attributes[i],o=e.attributes[r.name];void 0!==o&&t.vertexAttribPointer(o,r.components,t[B[r.type]],!1,this.itemSize,r.offset+this.itemSize*(n||0))}},F.prototype.destroy=function(){var t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)};var N=function(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1};N.prototype.get=function(){return this.current},N.prototype.set=function(t){},N.prototype.getDefault=function(){return this.default},N.prototype.setDefault=function(){this.set(this.default)};var U=function(e){function n(){e.apply(this,arguments)}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.getDefault=function(){return t.Color.transparent},n.prototype.set=function(t){var e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)},n}(N),j=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return 1},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)},e}(N),V=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return 0},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)},e}(N),Z=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return[!0,!0,!0,!0]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)},e}(N),q=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return!0},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)},e}(N),G=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return 255},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)},e}(N),W=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return{func:this.gl.ALWAYS,ref:0,mask:255}},e.prototype.set=function(t){var e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)},e}(N),H=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){var t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)},e}(N),X=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}},e}(N),K=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return[0,1]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)},e}(N),Y=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}},e}(N),J=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return this.gl.LESS},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)},e}(N),$=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}},e}(N),Q=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){var t=this.gl;return[t.ONE,t.ZERO]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)},e}(N),tt=function(e){function n(){e.apply(this,arguments)}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.getDefault=function(){return t.Color.transparent},n.prototype.set=function(t){var e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)},n}(N),et=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return this.gl.FUNC_ADD},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)},e}(N),nt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}},e}(N),it=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return this.gl.BACK},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)},e}(N),rt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return this.gl.CCW},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)},e}(N),ot=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)},e}(N),at=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return this.gl.TEXTURE0},e.prototype.set=function(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)},e}(N),st=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){var t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]},e.prototype.set=function(t){var e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)},e}(N),lt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}},e}(N),ut=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}},e}(N),ct=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}},e}(N),pt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}},e}(N),ht=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){var e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1},e}(N),ft=function(t){function e(e){t.call(this,e),this.vao=e.extVertexArrayObject}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return null},e.prototype.set=function(t){this.vao&&(t!==this.current||this.dirty)&&(this.vao.bindVertexArrayOES(t),this.current=t,this.dirty=!1)},e}(N),dt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return 4},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}},e}(N),mt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}},e}(N),yt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return!1},e.prototype.set=function(t){if(t!==this.current||this.dirty){var e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}},e}(N),_t=function(t){function e(e,n){t.call(this,e),this.context=e,this.parent=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDefault=function(){return null},e}(N),gt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setDirty=function(){this.dirty=!0},e.prototype.set=function(t){if(t!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}},e}(_t),vt=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.set=function(t){if(t!==this.current||this.dirty){this.context.bindFramebuffer.set(this.parent);var e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}},e}(_t),xt=function(t,e,n){this.context=t,this.width=e,this.height=n;var i=t.gl,r=this.framebuffer=i.createFramebuffer();this.colorAttachment=new gt(t,r),this.depthAttachment=new vt(t,r)};xt.prototype.destroy=function(){var t=this.context.gl,e=this.colorAttachment.get();e&&t.deleteTexture(e);var n=this.depthAttachment.get();n&&t.deleteRenderbuffer(n),t.deleteFramebuffer(this.framebuffer)};var bt=function(t,e,n){this.func=t,this.mask=e,this.range=n};bt.ReadOnly=!1,bt.ReadWrite=!0,bt.disabled=new bt(519,bt.ReadOnly,[0,1]);var wt=function(t,e,n,i,r,o){this.test=t,this.ref=e,this.mask=n,this.fail=i,this.depthFail=r,this.pass=o};wt.disabled=new wt({func:519,mask:0},0,0,7680,7680,7680);var Et=function(t,e,n){this.blendFunction=t,this.blendColor=e,this.mask=n};Et.disabled=new Et(Et.Replace=[1,0],t.Color.transparent,[!1,!1,!1,!1]),Et.unblended=new Et(Et.Replace,t.Color.transparent,[!0,!0,!0,!0]),Et.alphaBlended=new Et([1,771],t.Color.transparent,[!0,!0,!0,!0]);var Tt=function(t,e,n){this.enable=t,this.mode=e,this.frontFace=n};Tt.disabled=new Tt(!1,1029,2305),Tt.backCCW=new Tt(!0,1029,2305);var St=function(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.clearColor=new U(this),this.clearDepth=new j(this),this.clearStencil=new V(this),this.colorMask=new Z(this),this.depthMask=new q(this),this.stencilMask=new G(this),this.stencilFunc=new W(this),this.stencilOp=new H(this),this.stencilTest=new X(this),this.depthRange=new K(this),this.depthTest=new Y(this),this.depthFunc=new J(this),this.blend=new $(this),this.blendFunc=new Q(this),this.blendColor=new tt(this),this.blendEquation=new et(this),this.cullFace=new nt(this),this.cullFaceSide=new it(this),this.frontFace=new rt(this),this.program=new ot(this),this.activeTexture=new at(this),this.viewport=new st(this),this.bindFramebuffer=new lt(this),this.bindRenderbuffer=new ut(this),this.bindTexture=new ct(this),this.bindVertexBuffer=new pt(this),this.bindElementBuffer=new ht(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new ft(this),this.pixelStoreUnpack=new dt(this),this.pixelStoreUnpackPremultiplyAlpha=new mt(this),this.pixelStoreUnpackFlipY=new yt(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&t.getExtension("OES_texture_half_float_linear")};St.prototype.setDirty=function(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.extVertexArrayObject&&(this.bindVertexArrayOES.dirty=!0),this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0},St.prototype.createIndexBuffer=function(t,e){return new R(this,t,e)},St.prototype.createVertexBuffer=function(t,e,n){return new F(this,t,e,n)},St.prototype.createRenderbuffer=function(t,e,n){var i=this.gl,r=i.createRenderbuffer();return this.bindRenderbuffer.set(r),i.renderbufferStorage(i.RENDERBUFFER,t,e,n),this.bindRenderbuffer.set(null),r},St.prototype.createFramebuffer=function(t,e){return new xt(this,t,e)},St.prototype.clear=function(t){var e=t.color,n=t.depth,i=this.gl,r=0;e&&(r|=i.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==n&&(r|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),i.clear(r)},St.prototype.setCullFace=function(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))},St.prototype.setDepthMode=function(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)},St.prototype.setStencilMode=function(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)},St.prototype.setColorMode=function(e){t.isEqual(e.blendFunction,Et.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)},St.prototype.unbindVAO=function(){this.extVertexArrayObject&&this.bindVertexArrayOES.set(null)};var Pt=function(e){function n(n,i,r){var o=this;e.call(this),this.id=n,this.dispatcher=r,this.on("data",function(t){"source"===t.dataType&&"metadata"===t.sourceDataType&&(o._sourceLoaded=!0),o._sourceLoaded&&!o._paused&&"source"===t.dataType&&"content"===t.sourceDataType&&(o.reload(),o.transform&&o.update(o.transform))}),this.on("error",function(){o._sourceErrored=!0}),this._source=L(n,i,r,this),this._tiles={},this._cache=new D(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._coveredTiles={},this._state=new t.SourceFeatureState}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.onAdd=function(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)},n.prototype.onRemove=function(t){this._source&&this._source.onRemove&&this._source.onRemove(t)},n.prototype.loaded=function(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;for(var t in this._tiles){var e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0},n.prototype.getSource=function(){return this._source},n.prototype.pause=function(){this._paused=!0},n.prototype.resume=function(){if(this._paused){var t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}},n.prototype._loadTile=function(t,e){return this._source.loadTile(t,e)},n.prototype._unloadTile=function(t){if(this._source.unloadTile)return this._source.unloadTile(t,function(){})},n.prototype._abortTile=function(t){if(this._source.abortTile)return this._source.abortTile(t,function(){})},n.prototype.serialize=function(){return this._source.serialize()},n.prototype.prepare=function(t){for(var e in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles)this._tiles[e].upload(t)},n.prototype.getIds=function(){return Object.keys(this._tiles).map(Number).sort(Ct)},n.prototype.getRenderableIds=function(e){var n=this,i=[];for(var r in this._tiles)this._isIdRenderable(+r,e)&&i.push(+r);return e?i.sort(function(e,i){var r=n._tiles[e].tileID,o=n._tiles[i].tileID,a=new t.Point(r.canonical.x,r.canonical.y)._rotate(n.transform.angle),s=new t.Point(o.canonical.x,o.canonical.y)._rotate(n.transform.angle);return r.overscaledZ-o.overscaledZ||s.y-a.y||s.x-a.x}):i.sort(Ct)},n.prototype.hasRenderableParent=function(t){var e=this.findLoadedParent(t,0);return!!e&&this._isIdRenderable(e.tileID.key)},n.prototype._isIdRenderable=function(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())},n.prototype.reload=function(){if(this._paused)this._shouldReloadOnResume=!0;else for(var t in this._cache.reset(),this._tiles)"errored"!==this._tiles[t].state&&this._reloadTile(t,"reloading")},n.prototype._reloadTile=function(t,e){var n=this._tiles[t];n&&("loading"!==n.state&&(n.state=e),this._loadTile(n,this._tileLoaded.bind(this,n,t,e)))},n.prototype._tileLoaded=function(e,n,i,r){if(r)return e.state="errored",void(404!==r.status?this._source.fire(new t.ErrorEvent(r,{tile:e})):this.update(this.transform));e.timeAdded=t.browser.now(),"expired"===i&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(n,e),"raster-dem"===this.getSource().type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),this._source.fire(new t.Event("data",{dataType:"source",tile:e,coord:e.tileID}))},n.prototype._backfillDEM=function(t){for(var e=this.getRenderableIds(),n=0;n<e.length;n++){var i=e[n];if(t.neighboringTiles&&t.neighboringTiles[i]){var r=this.getTileByID(i);o(t,r),o(r,t)}}function o(t,e){t.needsHillshadePrepare=!0;var n=e.tileID.canonical.x-t.tileID.canonical.x,i=e.tileID.canonical.y-t.tileID.canonical.y,r=Math.pow(2,t.tileID.canonical.z),o=e.tileID.key;0===n&&0===i||Math.abs(i)>1||(Math.abs(n)>1&&(1===Math.abs(n+r)?n+=r:1===Math.abs(n-r)&&(n-=r)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,n,i),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}},n.prototype.getTile=function(t){return this.getTileByID(t.key)},n.prototype.getTileByID=function(t){return this._tiles[t]},n.prototype.getZoom=function(t){return t.zoom+t.scaleZoom(t.tileSize/this._source.tileSize)},n.prototype._retainLoadedChildren=function(t,e,n,i){for(var r in this._tiles){var o=this._tiles[r];if(!(i[r]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>n)){for(var a=o.tileID;o&&o.tileID.overscaledZ>e+1;){var s=o.tileID.scaledTo(o.tileID.overscaledZ-1);(o=this._tiles[s.key])&&o.hasData()&&(a=s)}for(var l=a;l.overscaledZ>e;)if(t[(l=l.scaledTo(l.overscaledZ-1)).key]){i[a.key]=a;break}}}},n.prototype.findLoadedParent=function(t,e){for(var n=t.overscaledZ-1;n>=e;n--){var i=t.scaledTo(n);if(!i)return;var r=String(i.key),o=this._tiles[r];if(o&&o.hasData())return o;if(this._cache.has(i))return this._cache.get(i)}},n.prototype.updateCacheSize=function(t){var e=(Math.ceil(t.width/this._source.tileSize)+1)*(Math.ceil(t.height/this._source.tileSize)+1),n=Math.floor(5*e),i="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(i)},n.prototype.handleWrapJump=function(t){var e=(t-(void 0===this._prevLng?t:this._prevLng))/360,n=Math.round(e);if(this._prevLng=t,n){var i={};for(var r in this._tiles){var o=this._tiles[r];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+n),i[o.tileID.key]=o}for(var a in this._tiles=i,this._timers)clearTimeout(this._timers[a]),delete this._timers[a];for(var s in this._tiles){var l=this._tiles[s];this._setTileReloadTimer(s,l)}}},n.prototype.update=function(e){var i=this;if(this.transform=e,this._sourceLoaded&&!this._paused){var r;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?r=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(function(e){return new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)}):(r=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(r=r.filter(function(t){return i._source.hasTile(t)}))):r=[];var o=(this._source.roundZoom?Math.round:Math.floor)(this.getZoom(e)),a=Math.max(o-n.maxOverzooming,this._source.minzoom),s=Math.max(o+n.maxUnderzooming,this._source.minzoom),l=this._updateRetainedTiles(r,o);if(kt(this._source.type)){for(var u={},c={},p=0,h=Object.keys(l);p<h.length;p+=1){var f=h[p],d=l[f],m=this._tiles[f];if(m&&!(m.fadeEndTime&&m.fadeEndTime<=t.browser.now())){var y=this.findLoadedParent(d,a);y&&(this._addTile(y.tileID),u[y.tileID.key]=y.tileID),c[f]=d}}for(var _ in this._retainLoadedChildren(c,o,s,l),u)l[_]||(this._coveredTiles[_]=!0,l[_]=u[_])}for(var g in l)this._tiles[g].clearFadeHold();for(var v=0,x=t.keysDifference(this._tiles,l);v<x.length;v+=1){var b=x[v],w=this._tiles[b];w.hasSymbolBuckets&&!w.holdingForFade()?w.setHoldDuration(this.map._fadeDuration):w.hasSymbolBuckets&&!w.symbolFadeFinished()||this._removeTile(b)}}},n.prototype.releaseSymbolFadeTiles=function(){for(var t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)},n.prototype._updateRetainedTiles=function(t,e){for(var i={},r={},o=Math.max(e-n.maxOverzooming,this._source.minzoom),a=Math.max(e+n.maxUnderzooming,this._source.minzoom),s={},l=0,u=t;l<u.length;l+=1){var c=u[l],p=this._addTile(c);i[c.key]=c,p.hasData()||e<this._source.maxzoom&&(s[c.key]=c)}this._retainLoadedChildren(s,e,a,i);for(var h=0,f=t;h<f.length;h+=1){var d=f[h],m=this._tiles[d.key];if(!m.hasData()){if(e+1>this._source.maxzoom){var y=d.children(this._source.maxzoom)[0],_=this.getTile(y);if(_&&_.hasData()){i[y.key]=y;continue}}else{var g=d.children(this._source.maxzoom);if(i[g[0].key]&&i[g[1].key]&&i[g[2].key]&&i[g[3].key])continue}for(var v=m.wasRequested(),x=d.overscaledZ-1;x>=o;--x){var b=d.scaledTo(x);if(r[b.key])break;if(r[b.key]=!0,!(m=this.getTile(b))&&v&&(m=this._addTile(b)),m&&(i[b.key]=b,v=m.wasRequested(),m.hasData()))break}}}return i},n.prototype._addTile=function(e){var n=this._tiles[e.key];if(n)return n;(n=this._cache.getAndRemove(e))&&(this._setTileReloadTimer(e.key,n),n.tileID=e,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,n)));var i=Boolean(n);return i||(n=new t.Tile(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(n,this._tileLoaded.bind(this,n,e.key,n.state))),n?(n.uses++,this._tiles[e.key]=n,i||this._source.fire(new t.Event("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n):null},n.prototype._setTileReloadTimer=function(t,e){var n=this;t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);var i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout(function(){n._reloadTile(t,"expired"),delete n._timers[t]},i))},n.prototype._removeTile=function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))},n.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._cache.reset()},n.prototype.tilesIn=function(e,n,i){var r=this,o=[],a=this.transform;if(!a)return o;for(var s=i?a.getCameraQueryGeometry(e):e,l=e.map(function(t){return a.pointCoordinate(t)}),u=s.map(function(t){return a.pointCoordinate(t)}),c=this.getIds(),p=1/0,h=1/0,f=-1/0,d=-1/0,m=0,y=u;m<y.length;m+=1){var _=y[m];p=Math.min(p,_.x),h=Math.min(h,_.y),f=Math.max(f,_.x),d=Math.max(d,_.y)}for(var g=function(e){var i=r._tiles[c[e]];if(!i.holdingForFade()){var s=i.tileID,m=Math.pow(2,a.zoom-i.tileID.overscaledZ),y=n*i.queryPadding*t.EXTENT/i.tileSize/m,_=[s.getTilePoint(new t.MercatorCoordinate(p,h)),s.getTilePoint(new t.MercatorCoordinate(f,d))];if(_[0].x-y<t.EXTENT&&_[0].y-y<t.EXTENT&&_[1].x+y>=0&&_[1].y+y>=0){var g=l.map(function(t){return s.getTilePoint(t)}),v=u.map(function(t){return s.getTilePoint(t)});o.push({tile:i,tileID:s,queryGeometry:g,cameraQueryGeometry:v,scale:m})}}},v=0;v<c.length;v++)g(v);return o},n.prototype.getVisibleCoordinates=function(t){for(var e=this,n=this.getRenderableIds(t).map(function(t){return e._tiles[t].tileID}),i=0,r=n;i<r.length;i+=1){var o=r[i];o.posMatrix=this.transform.calculatePosMatrix(o.toUnwrapped())}return n},n.prototype.hasTransition=function(){if(this._source.hasTransition())return!0;if(kt(this._source.type))for(var e in this._tiles){var n=this._tiles[e];if(void 0!==n.fadeEndTime&&n.fadeEndTime>=t.browser.now())return!0}return!1},n.prototype.setFeatureState=function(t,e,n){t=t||"_geojsonTileLayer",this._state.updateState(t,e,n)},n.prototype.removeFeatureState=function(t,e,n){t=t||"_geojsonTileLayer",this._state.removeFeatureState(t,e,n)},n.prototype.getFeatureState=function(t,e){return t=t||"_geojsonTileLayer",this._state.getState(t,e)},n}(t.Evented);function Ct(t,e){return t%32-e%32||e-t}function kt(t){return"raster"===t||"image"===t||"video"===t}function At(){return new t.window.Worker(Yi.workerUrl)}Pt.maxOverzooming=10,Pt.maxUnderzooming=3;var zt=function(){this.active={}};zt.prototype.acquire=function(t){if(!this.workers)for(this.workers=[];this.workers.length<zt.workerCount;)this.workers.push(new At);return this.active[t]=!0,this.workers.slice()},zt.prototype.release=function(t){delete this.active[t],0===Object.keys(this.active).length&&(this.workers.forEach(function(t){t.terminate()}),this.workers=null)};var Lt,Mt=Math.floor(t.browser.hardwareConcurrency/2);function It(e,n){var i={};for(var r in e)"ref"!==r&&(i[r]=e[r]);return t.refProperties.forEach(function(t){t in n&&(i[t]=n[t])}),i}function Ot(t){t=t.slice();for(var e=Object.create(null),n=0;n<t.length;n++)e[t[n].id]=t[n];for(var i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=It(t[i],e[t[i].ref]));return t}zt.workerCount=Math.max(Math.min(Mt,6),1);var Dt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function Rt(t,e,n){n.push({command:Dt.addSource,args:[t,e[t]]})}function Bt(t,e,n){e.push({command:Dt.removeSource,args:[t]}),n[t]=!0}function Ft(t,e,n,i){Bt(t,n,i),Rt(t,e,n)}function Nt(e,n,i){var r;for(r in e[i])if(e[i].hasOwnProperty(r)&&"data"!==r&&!t.isEqual(e[i][r],n[i][r]))return!1;for(r in n[i])if(n[i].hasOwnProperty(r)&&"data"!==r&&!t.isEqual(e[i][r],n[i][r]))return!1;return!0}function Ut(e,n,i,r,o,a){var s;for(s in n=n||{},e=e||{})e.hasOwnProperty(s)&&(t.isEqual(e[s],n[s])||i.push({command:a,args:[r,s,n[s],o]}));for(s in n)n.hasOwnProperty(s)&&!e.hasOwnProperty(s)&&(t.isEqual(e[s],n[s])||i.push({command:a,args:[r,s,n[s],o]}))}function jt(t){return t.id}function Vt(t,e){return t[e.id]=e,t}var Zt=function(t,e,n){var i=this.boxCells=[],r=this.circleCells=[];this.xCellCount=Math.ceil(t/n),this.yCellCount=Math.ceil(e/n);for(var o=0;o<this.xCellCount*this.yCellCount;o++)i.push([]),r.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0};Zt.prototype.keysLength=function(){return this.boxKeys.length+this.circleKeys.length},Zt.prototype.insert=function(t,e,n,i,r){this._forEachCell(e,n,i,r,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(n),this.bboxes.push(i),this.bboxes.push(r)},Zt.prototype.insertCircle=function(t,e,n,i){this._forEachCell(e-i,n-i,e+i,n+i,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(n),this.circles.push(i)},Zt.prototype._insertBoxCell=function(t,e,n,i,r,o){this.boxCells[r].push(o)},Zt.prototype._insertCircleCell=function(t,e,n,i,r,o){this.circleCells[r].push(o)},Zt.prototype._query=function(t,e,n,i,r,o){if(n<0||t>this.width||i<0||e>this.height)return!r&&[];var a=[];if(t<=0&&e<=0&&this.width<=n&&this.height<=i){if(r)return!0;for(var s=0;s<this.boxKeys.length;s++)a.push({key:this.boxKeys[s],x1:this.bboxes[4*s],y1:this.bboxes[4*s+1],x2:this.bboxes[4*s+2],y2:this.bboxes[4*s+3]});for(var l=0;l<this.circleKeys.length;l++){var u=this.circles[3*l],c=this.circles[3*l+1],p=this.circles[3*l+2];a.push({key:this.circleKeys[l],x1:u-p,y1:c-p,x2:u+p,y2:c+p})}return o?a.filter(o):a}var h={hitTest:r,seenUids:{box:{},circle:{}}};return this._forEachCell(t,e,n,i,this._queryCell,a,h,o),r?a.length>0:a},Zt.prototype._queryCircle=function(t,e,n,i,r){var o=t-n,a=t+n,s=e-n,l=e+n;if(a<0||o>this.width||l<0||s>this.height)return!i&&[];var u=[],c={hitTest:i,circle:{x:t,y:e,radius:n},seenUids:{box:{},circle:{}}};return this._forEachCell(o,s,a,l,this._queryCellCircle,u,c,r),i?u.length>0:u},Zt.prototype.query=function(t,e,n,i,r){return this._query(t,e,n,i,!1,r)},Zt.prototype.hitTest=function(t,e,n,i,r){return this._query(t,e,n,i,!0,r)},Zt.prototype.hitTestCircle=function(t,e,n,i){return this._queryCircle(t,e,n,!0,i)},Zt.prototype._queryCell=function(t,e,n,i,r,o,a,s){var l=a.seenUids,u=this.boxCells[r];if(null!==u)for(var c=this.bboxes,p=0,h=u;p<h.length;p+=1){var f=h[p];if(!l.box[f]){l.box[f]=!0;var d=4*f;if(t<=c[d+2]&&e<=c[d+3]&&n>=c[d+0]&&i>=c[d+1]&&(!s||s(this.boxKeys[f]))){if(a.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[f],x1:c[d],y1:c[d+1],x2:c[d+2],y2:c[d+3]})}}}var m=this.circleCells[r];if(null!==m)for(var y=this.circles,_=0,g=m;_<g.length;_+=1){var v=g[_];if(!l.circle[v]){l.circle[v]=!0;var x=3*v;if(this._circleAndRectCollide(y[x],y[x+1],y[x+2],t,e,n,i)&&(!s||s(this.circleKeys[v]))){if(a.hitTest)return o.push(!0),!0;var b=y[x],w=y[x+1],E=y[x+2];o.push({key:this.circleKeys[v],x1:b-E,y1:w-E,x2:b+E,y2:w+E})}}}},Zt.prototype._queryCellCircle=function(t,e,n,i,r,o,a,s){var l=a.circle,u=a.seenUids,c=this.boxCells[r];if(null!==c)for(var p=this.bboxes,h=0,f=c;h<f.length;h+=1){var d=f[h];if(!u.box[d]){u.box[d]=!0;var m=4*d;if(this._circleAndRectCollide(l.x,l.y,l.radius,p[m+0],p[m+1],p[m+2],p[m+3])&&(!s||s(this.boxKeys[d])))return o.push(!0),!0}}var y=this.circleCells[r];if(null!==y)for(var _=this.circles,g=0,v=y;g<v.length;g+=1){var x=v[g];if(!u.circle[x]){u.circle[x]=!0;var b=3*x;if(this._circlesCollide(_[b],_[b+1],_[b+2],l.x,l.y,l.radius)&&(!s||s(this.circleKeys[x])))return o.push(!0),!0}}},Zt.prototype._forEachCell=function(t,e,n,i,r,o,a,s){for(var l=this._convertToXCellCoord(t),u=this._convertToYCellCoord(e),c=this._convertToXCellCoord(n),p=this._convertToYCellCoord(i),h=l;h<=c;h++)for(var f=u;f<=p;f++){var d=this.xCellCount*f+h;if(r.call(this,t,e,n,i,d,o,a,s))return}},Zt.prototype._convertToXCellCoord=function(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))},Zt.prototype._convertToYCellCoord=function(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))},Zt.prototype._circlesCollide=function(t,e,n,i,r,o){var a=i-t,s=r-e,l=n+o;return l*l>a*a+s*s},Zt.prototype._circleAndRectCollide=function(t,e,n,i,r,o,a){var s=(o-i)/2,l=Math.abs(t-(i+s));if(l>s+n)return!1;var u=(a-r)/2,c=Math.abs(e-(r+u));if(c>u+n)return!1;if(l<=s||c<=u)return!0;var p=l-s,h=c-u;return p*p+h*h<=n*n};var qt=t.properties.layout;function Gt(e,n,i,r,o){var a=t.identity(new Float32Array(16));return n?(t.identity(a),t.scale(a,a,[1/o,1/o,1]),i||t.rotateZ(a,a,r.angle)):(t.scale(a,a,[r.width/2,-r.height/2,1]),t.translate(a,a,[1,-1,0]),t.multiply(a,a,e)),a}function Wt(e,n,i,r,o){var a=t.identity(new Float32Array(16));return n?(t.multiply(a,a,e),t.scale(a,a,[o,o,1]),i||t.rotateZ(a,a,-r.angle)):(t.scale(a,a,[1,-1,1]),t.translate(a,a,[-1,-1,0]),t.scale(a,a,[2/r.width,2/r.height,1])),a}function Ht(e,n){var i=[e.x,e.y,0,1];ie(i,i,n);var r=i[3];return{point:new t.Point(i[0]/r,i[1]/r),signedDistanceFromCamera:r}}function Xt(t,e){var n=t[0]/t[3],i=t[1]/t[3];return n>=-e[0]&&n<=e[0]&&i>=-e[1]&&i<=e[1]}function Kt(e,n,i,r,o,a,s,l){var u=r?e.textSizeData:e.iconSizeData,c=t.evaluateSizeForZoom(u,i.transform.zoom,qt.properties[r?"text-size":"icon-size"]),p=[256/i.width*2+1,256/i.height*2+1],h=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;h.clear();for(var f=e.lineVertexArray,d=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,m=i.transform.width/i.transform.height,y=!1,_=0;_<d.length;_++){var g=d.get(_);if(g.hidden||g.writingMode===t.WritingMode.vertical&&!y)ne(g.numGlyphs,h);else{y=!1;var v=[g.anchorX,g.anchorY,0,1];if(t.transformMat4(v,v,n),Xt(v,p)){var x=.5+v[3]/i.transform.cameraToCenterDistance*.5,b=t.evaluateSizeForFeature(u,c,g),w=s?b*x:b/x,E=new t.Point(g.anchorX,g.anchorY),T=Ht(E,o).point,S={},P=$t(g,w,!1,l,n,o,a,e.glyphOffsetArray,f,h,T,E,S,m);y=P.useVertical,(P.notEnoughRoom||y||P.needsFlipping&&$t(g,w,!0,l,n,o,a,e.glyphOffsetArray,f,h,T,E,S,m).notEnoughRoom)&&ne(g.numGlyphs,h)}else ne(g.numGlyphs,h)}}r?e.text.dynamicLayoutVertexBuffer.updateData(h):e.icon.dynamicLayoutVertexBuffer.updateData(h)}function Yt(t,e,n,i,r,o,a,s,l,u,c,p){var h=s.glyphStartIndex+s.numGlyphs,f=s.lineStartIndex,d=s.lineStartIndex+s.lineLength,m=e.getoffsetX(s.glyphStartIndex),y=e.getoffsetX(h-1),_=te(t*m,n,i,r,o,a,s.segment,f,d,l,u,c,p);if(!_)return null;var g=te(t*y,n,i,r,o,a,s.segment,f,d,l,u,c,p);return g?{first:_,last:g}:null}function Jt(e,n,i,r){return e===t.WritingMode.horizontal&&Math.abs(i.y-n.y)>Math.abs(i.x-n.x)*r?{useVertical:!0}:(e===t.WritingMode.vertical?n.y<i.y:n.x>i.x)?{needsFlipping:!0}:null}function $t(e,n,i,r,o,a,s,l,u,c,p,h,f,d){var m,y=n/24,_=e.lineOffsetX*n,g=e.lineOffsetY*n;if(e.numGlyphs>1){var v=e.glyphStartIndex+e.numGlyphs,x=e.lineStartIndex,b=e.lineStartIndex+e.lineLength,w=Yt(y,l,_,g,i,p,h,e,u,a,f,!1);if(!w)return{notEnoughRoom:!0};var E=Ht(w.first.point,s).point,T=Ht(w.last.point,s).point;if(r&&!i){var S=Jt(e.writingMode,E,T,d);if(S)return S}m=[w.first];for(var P=e.glyphStartIndex+1;P<v-1;P++)m.push(te(y*l.getoffsetX(P),_,g,i,p,h,e.segment,x,b,u,a,f,!1));m.push(w.last)}else{if(r&&!i){var C=Ht(h,o).point,k=e.lineStartIndex+e.segment+1,A=new t.Point(u.getx(k),u.gety(k)),z=Ht(A,o),L=z.signedDistanceFromCamera>0?z.point:Qt(h,A,C,1,o),M=Jt(e.writingMode,C,L,d);if(M)return M}var I=te(y*l.getoffsetX(e.glyphStartIndex),_,g,i,p,h,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,u,a,f,!1);if(!I)return{notEnoughRoom:!0};m=[I]}for(var O=0,D=m;O<D.length;O+=1){var R=D[O];t.addDynamicAttributes(c,R.point,R.angle)}return{}}function Qt(t,e,n,i,r){var o=Ht(t.add(t.sub(e)._unit()),r).point,a=n.sub(o);return n.add(a._mult(i/a.mag()))}function te(e,n,i,r,o,a,s,l,u,c,p,h,f){var d=r?e-n:e+n,m=d>0?1:-1,y=0;r&&(m*=-1,y=Math.PI),m<0&&(y+=Math.PI);for(var _=m>0?l+s:l+s+1,g=_,v=o,x=o,b=0,w=0,E=Math.abs(d);b+w<=E;){if((_+=m)<l||_>=u)return null;if(x=v,void 0===(v=h[_])){var T=new t.Point(c.getx(_),c.gety(_)),S=Ht(T,p);if(S.signedDistanceFromCamera>0)v=h[_]=S.point;else{var P=_-m;v=Qt(0===b?a:new t.Point(c.getx(P),c.gety(P)),T,x,E-b+1,p)}}b+=w,w=x.dist(v)}var C=(E-b)/w,k=v.sub(x),A=k.mult(C)._add(x);return A._add(k._unit()._perp()._mult(i*m)),{point:A,angle:y+Math.atan2(v.y-x.y,v.x-x.x),tileDistance:f?{prevTileDistance:_-m===g?0:c.gettileUnitDistanceFromAnchor(_-m),lastSegmentViewportDistance:E-b}:null}}var ee=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ne(t,e){for(var n=0;n<t;n++){var i=e.length;e.resize(i+4),e.float32.set(ee,3*i)}}function ie(t,e,n){var i=e[0],r=e[1];return t[0]=n[0]*i+n[4]*r+n[12],t[1]=n[1]*i+n[5]*r+n[13],t[3]=n[3]*i+n[7]*r+n[15],t}var re=function(t,e,n){void 0===e&&(e=new Zt(t.width+200,t.height+200,25)),void 0===n&&(n=new Zt(t.width+200,t.height+200,25)),this.transform=t,this.grid=e,this.ignoredGrid=n,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+100,this.screenBottomBoundary=t.height+100,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200};function oe(t,e,n){t[e+4]=n?1:0}function ae(e,n,i){return n*(t.EXTENT/(e.tileSize*Math.pow(2,i-e.tileID.overscaledZ)))}re.prototype.placeCollisionBox=function(t,e,n,i,r){var o=this.projectAndGetPerspectiveRatio(i,t.anchorPointX,t.anchorPointY),a=n*o.perspectiveRatio,s=t.x1*a+o.point.x,l=t.y1*a+o.point.y,u=t.x2*a+o.point.x,c=t.y2*a+o.point.y;return!this.isInsideGrid(s,l,u,c)||!e&&this.grid.hitTest(s,l,u,c,r)?{box:[],offscreen:!1}:{box:[s,l,u,c],offscreen:this.isOffscreen(s,l,u,c)}},re.prototype.approximateTileDistance=function(t,e,n,i,r){var o=r?1:i/this.pitchfactor,a=t.lastSegmentViewportDistance*n;return t.prevTileDistance+a+(o-1)*a*Math.abs(Math.sin(e))},re.prototype.placeCollisionCircles=function(e,n,i,r,o,a,s,l,u,c,p,h,f){var d=[],m=this.projectAnchor(u,o.anchorX,o.anchorY),y=l/24,_=o.lineOffsetX*l,g=o.lineOffsetY*l,v=new t.Point(o.anchorX,o.anchorY),x=Yt(y,s,_,g,!1,Ht(v,c).point,v,o,a,c,{},!0),b=!1,w=!1,E=!0,T=m.perspectiveRatio*r,S=1/(r*i),P=0,C=0;x&&(P=this.approximateTileDistance(x.first.tileDistance,x.first.angle,S,m.cameraDistance,h),C=this.approximateTileDistance(x.last.tileDistance,x.last.angle,S,m.cameraDistance,h));for(var k=0;k<e.length;k+=5){var A=e[k],z=e[k+1],L=e[k+2],M=e[k+3];if(!x||M<-P||M>C)oe(e,k,!1);else{var I=this.projectPoint(u,A,z),O=L*T;if(d.length>0){var D=I.x-d[d.length-4],R=I.y-d[d.length-3];if(O*O*2>D*D+R*R&&k+8<e.length){var B=e[k+8];if(B>-P&&B<C){oe(e,k,!1);continue}}}var F=k/5;d.push(I.x,I.y,O,F),oe(e,k,!0);var N=I.x-O,U=I.y-O,j=I.x+O,V=I.y+O;if(E=E&&this.isOffscreen(N,U,j,V),w=w||this.isInsideGrid(N,U,j,V),!n&&this.grid.hitTestCircle(I.x,I.y,O,f)){if(!p)return{circles:[],offscreen:!1};b=!0}}}return{circles:b||!w?[]:d,offscreen:E}},re.prototype.queryRenderedSymbols=function(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};for(var n=[],i=1/0,r=1/0,o=-1/0,a=-1/0,s=0,l=e;s<l.length;s+=1){var u=l[s],c=new t.Point(u.x+100,u.y+100);i=Math.min(i,c.x),r=Math.min(r,c.y),o=Math.max(o,c.x),a=Math.max(a,c.y),n.push(c)}for(var p={},h={},f=0,d=this.grid.query(i,r,o,a).concat(this.ignoredGrid.query(i,r,o,a));f<d.length;f+=1){var m=d[f],y=m.key;if(void 0===p[y.bucketInstanceId]&&(p[y.bucketInstanceId]={}),!p[y.bucketInstanceId][y.featureIndex]){var _=[new t.Point(m.x1,m.y1),new t.Point(m.x2,m.y1),new t.Point(m.x2,m.y2),new t.Point(m.x1,m.y2)];t.polygonIntersectsPolygon(n,_)&&(p[y.bucketInstanceId][y.featureIndex]=!0,void 0===h[y.bucketInstanceId]&&(h[y.bucketInstanceId]=[]),h[y.bucketInstanceId].push(y.featureIndex))}}return h},re.prototype.insertCollisionBox=function(t,e,n,i,r){var o={bucketInstanceId:n,featureIndex:i,collisionGroupID:r};(e?this.ignoredGrid:this.grid).insert(o,t[0],t[1],t[2],t[3])},re.prototype.insertCollisionCircles=function(t,e,n,i,r){for(var o=e?this.ignoredGrid:this.grid,a={bucketInstanceId:n,featureIndex:i,collisionGroupID:r},s=0;s<t.length;s+=4)o.insertCircle(a,t[s],t[s+1],t[s+2])},re.prototype.projectAnchor=function(t,e,n){var i=[e,n,0,1];return ie(i,i,t),{perspectiveRatio:.5+this.transform.cameraToCenterDistance/i[3]*.5,cameraDistance:i[3]}},re.prototype.projectPoint=function(e,n,i){var r=[n,i,0,1];return ie(r,r,e),new t.Point((r[0]/r[3]+1)/2*this.transform.width+100,(-r[1]/r[3]+1)/2*this.transform.height+100)},re.prototype.projectAndGetPerspectiveRatio=function(e,n,i){var r=[n,i,0,1];return ie(r,r,e),{point:new t.Point((r[0]/r[3]+1)/2*this.transform.width+100,(-r[1]/r[3]+1)/2*this.transform.height+100),perspectiveRatio:.5+this.transform.cameraToCenterDistance/r[3]*.5}},re.prototype.isOffscreen=function(t,e,n,i){return n<100||t>=this.screenRightBoundary||i<100||e>this.screenBottomBoundary},re.prototype.isInsideGrid=function(t,e,n,i){return n>=0&&t<this.gridRightBoundary&&i>=0&&e<this.gridBottomBoundary};var se=function(t,e,n,i){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):i&&n?1:0,this.placed=n};se.prototype.isHidden=function(){return 0===this.opacity&&!this.placed};var le=function(t,e,n,i,r){this.text=new se(t?t.text:null,e,n,r),this.icon=new se(t?t.icon:null,e,i,r)};le.prototype.isHidden=function(){return this.text.isHidden()&&this.icon.isHidden()};var ue=function(t,e,n){this.text=t,this.icon=e,this.skipFade=n},ce=function(t,e,n,i,r){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=n,this.bucketIndex=i,this.tileID=r},pe=function(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}};pe.prototype.get=function(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){var e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:function(t){return t.collisionGroupID===e}}}return this.collisionGroups[t]};var he=function(t,e,n){this.transform=t.clone(),this.collisionIndex=new re(this.transform),this.placements={},this.opacities={},this.stale=!1,this.commitTime=0,this.fadeDuration=e,this.retainedQueryData={},this.collisionGroups=new pe(n)};function fe(t,e,n){t.emplaceBack(e?1:0,n?1:0),t.emplaceBack(e?1:0,n?1:0),t.emplaceBack(e?1:0,n?1:0),t.emplaceBack(e?1:0,n?1:0)}he.prototype.placeLayerTile=function(e,n,i,r){var o=n.getBucket(e),a=n.latestFeatureIndex;if(o&&a&&e.id===o.layerIds[0]){var s=n.collisionBoxArray,l=o.layers[0].layout,u=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),c=n.tileSize/t.EXTENT,p=this.transform.calculatePosMatrix(n.tileID.toUnwrapped()),h=Gt(p,"map"===l.get("text-pitch-alignment"),"map"===l.get("text-rotation-alignment"),this.transform,ae(n,1,this.transform.zoom)),f=Gt(p,"map"===l.get("icon-pitch-alignment"),"map"===l.get("icon-rotation-alignment"),this.transform,ae(n,1,this.transform.zoom));this.retainedQueryData[o.bucketInstanceId]=new ce(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,n.tileID),this.placeLayerBucket(o,p,h,f,u,c,i,n.holdingForFade(),r,s)}},he.prototype.placeLayerBucket=function(e,n,i,r,o,a,s,l,u,c){var p=e.layers[0].layout,h=t.evaluateSizeForZoom(e.textSizeData,this.transform.zoom,t.properties.layout.properties["text-size"]),f=p.get("text-optional"),d=p.get("icon-optional"),m=p.get("text-allow-overlap"),y=p.get("icon-allow-overlap"),_=m&&(y||!e.hasIconData()||d),g=y&&(m||!e.hasTextData()||f),v=this.collisionGroups.get(e.sourceID);!e.collisionArrays&&c&&e.deserializeCollisionBoxes(c);for(var x=0;x<e.symbolInstances.length;x++){var b=e.symbolInstances.get(x);if(!u[b.crossTileID]){if(l){this.placements[b.crossTileID]=new ue(!1,!1,!1);continue}var w=!1,E=!1,T=!0,S=null,P=null,C=null,k=0,A=0,z=e.collisionArrays[x];z.textFeatureIndex&&(k=z.textFeatureIndex),z.textBox&&(w=(S=this.collisionIndex.placeCollisionBox(z.textBox,p.get("text-allow-overlap"),a,n,v.predicate)).box.length>0,T=T&&S.offscreen);var L=z.textCircles;if(L){var M=e.text.placedSymbolArray.get(b.horizontalPlacedTextSymbolIndex),I=t.evaluateSizeForFeature(e.textSizeData,h,M);P=this.collisionIndex.placeCollisionCircles(L,p.get("text-allow-overlap"),o,a,M,e.lineVertexArray,e.glyphOffsetArray,I,n,i,s,"map"===p.get("text-pitch-alignment"),v.predicate),w=p.get("text-allow-overlap")||P.circles.length>0,T=T&&P.offscreen}z.iconFeatureIndex&&(A=z.iconFeatureIndex),z.iconBox&&(E=(C=this.collisionIndex.placeCollisionBox(z.iconBox,p.get("icon-allow-overlap"),a,n,v.predicate)).box.length>0,T=T&&C.offscreen);var O=f||0===b.numGlyphVertices&&0===b.numVerticalGlyphVertices,D=d||0===b.numIconVertices;O||D?D?O||(E=E&&w):w=E&&w:E=w=E&&w,w&&S&&this.collisionIndex.insertCollisionBox(S.box,p.get("text-ignore-placement"),e.bucketInstanceId,k,v.ID),E&&C&&this.collisionIndex.insertCollisionBox(C.box,p.get("icon-ignore-placement"),e.bucketInstanceId,A,v.ID),w&&P&&this.collisionIndex.insertCollisionCircles(P.circles,p.get("text-ignore-placement"),e.bucketInstanceId,k,v.ID),this.placements[b.crossTileID]=new ue(w||_,E||g,T||e.justReloaded),u[b.crossTileID]=!0}}e.justReloaded=!1},he.prototype.commit=function(t,e){this.commitTime=e;var n=!1,i=t&&0!==this.fadeDuration?(this.commitTime-t.commitTime)/this.fadeDuration:1,r=t?t.opacities:{};for(var o in this.placements){var a=this.placements[o],s=r[o];s?(this.opacities[o]=new le(s,i,a.text,a.icon),n=n||a.text!==s.text.placed||a.icon!==s.icon.placed):(this.opacities[o]=new le(null,i,a.text,a.icon,a.skipFade),n=n||a.text||a.icon)}for(var l in r){var u=r[l];if(!this.opacities[l]){var c=new le(u,i,!1,!1);c.isHidden()||(this.opacities[l]=c,n=n||u.text.placed||u.icon.placed)}}n?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)},he.prototype.updateLayerOpacities=function(t,e){for(var n={},i=0,r=e;i<r.length;i+=1){var o=r[i],a=o.getBucket(t);a&&o.latestFeatureIndex&&t.id===a.layerIds[0]&&this.updateBucketOpacities(a,n,o.collisionBoxArray)}},he.prototype.updateBucketOpacities=function(t,e,n){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasCollisionBoxData()&&t.collisionBox.collisionVertexArray.clear(),t.hasCollisionCircleData()&&t.collisionCircle.collisionVertexArray.clear();var i=t.layers[0].layout,r=new le(null,0,!1,!1,!0),o=i.get("text-allow-overlap"),a=i.get("icon-allow-overlap"),s=new le(null,0,o&&(a||!t.hasIconData()||i.get("icon-optional")),a&&(o||!t.hasTextData()||i.get("text-optional")),!0);!t.collisionArrays&&n&&(t.hasCollisionBoxData()||t.hasCollisionCircleData())&&t.deserializeCollisionBoxes(n);for(var l=0;l<t.symbolInstances.length;l++){var u=t.symbolInstances.get(l),c=e[u.crossTileID],p=this.opacities[u.crossTileID];c?p=r:p||(p=s,this.opacities[u.crossTileID]=p),e[u.crossTileID]=!0;var h=u.numGlyphVertices>0||u.numVerticalGlyphVertices>0,f=u.numIconVertices>0;if(h){for(var d=be(p.text),m=(u.numGlyphVertices+u.numVerticalGlyphVertices)/4,y=0;y<m;y++)t.text.opacityVertexArray.emplaceBack(d);t.text.placedSymbolArray.get(u.horizontalPlacedTextSymbolIndex).hidden=p.text.isHidden(),u.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(u.verticalPlacedTextSymbolIndex).hidden=p.text.isHidden())}if(f){for(var _=be(p.icon),g=0;g<u.numIconVertices/4;g++)t.icon.opacityVertexArray.emplaceBack(_);t.icon.placedSymbolArray.get(l).hidden=p.icon.isHidden()}if(t.hasCollisionBoxData()||t.hasCollisionCircleData()){var v=t.collisionArrays[l];if(v){v.textBox&&fe(t.collisionBox.collisionVertexArray,p.text.placed,!1),v.iconBox&&fe(t.collisionBox.collisionVertexArray,p.icon.placed,!1);var x=v.textCircles;if(x&&t.hasCollisionCircleData())for(var b=0;b<x.length;b+=5){var w=c||0===x[b+4];fe(t.collisionCircle.collisionVertexArray,p.text.placed,w)}}}}t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasCollisionBoxData()&&t.collisionBox.collisionVertexBuffer&&t.collisionBox.collisionVertexBuffer.updateData(t.collisionBox.collisionVertexArray),t.hasCollisionCircleData()&&t.collisionCircle.collisionVertexBuffer&&t.collisionCircle.collisionVertexBuffer.updateData(t.collisionCircle.collisionVertexArray)},he.prototype.symbolFadeChange=function(t){return 0===this.fadeDuration?1:(t-this.commitTime)/this.fadeDuration},he.prototype.hasTransitions=function(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration},he.prototype.stillRecent=function(t){return this.commitTime+this.fadeDuration>t},he.prototype.setStale=function(){this.stale=!0};var de=Math.pow(2,25),me=Math.pow(2,24),ye=Math.pow(2,17),_e=Math.pow(2,16),ge=Math.pow(2,9),ve=Math.pow(2,8),xe=Math.pow(2,1);function be(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;var e=t.placed?1:0,n=Math.floor(127*t.opacity);return n*de+e*me+n*ye+e*_e+n*ge+e*ve+n*xe+e}var we=function(){this._currentTileIndex=0,this._seenCrossTileIDs={}};we.prototype.continuePlacement=function(t,e,n,i,r){for(;this._currentTileIndex<t.length;){var o=t[this._currentTileIndex];if(e.placeLayerTile(i,o,n,this._seenCrossTileIDs),this._currentTileIndex++,r())return!0}};var Ee=function(t,e,n,i,r,o){this.placement=new he(t,r,o),this._currentPlacementIndex=e.length-1,this._forceFullPlacement=n,this._showCollisionBoxes=i,this._done=!1};Ee.prototype.isDone=function(){return this._done},Ee.prototype.continuePlacement=function(e,n,i){for(var r=this,o=t.browser.now(),a=function(){var e=t.browser.now()-o;return!r._forceFullPlacement&&e>2};this._currentPlacementIndex>=0;){var s=n[e[this._currentPlacementIndex]],l=this.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(this._inProgressLayer||(this._inProgressLayer=new we),this._inProgressLayer.continuePlacement(i[s.source],this.placement,this._showCollisionBoxes,s,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0},Ee.prototype.commit=function(t,e){return this.placement.commit(t,e),this.placement};var Te=512/t.EXTENT/2,Se=function(t,e,n){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=n;for(var i=0;i<e.length;i++){var r=e.get(i),o=r.key;this.indexedSymbolInstances[o]||(this.indexedSymbolInstances[o]=[]),this.indexedSymbolInstances[o].push({crossTileID:r.crossTileID,coord:this.getScaledCoordinates(r,t)})}};Se.prototype.getScaledCoordinates=function(e,n){var i=n.canonical.z-this.tileID.canonical.z,r=Te/Math.pow(2,i);return{x:Math.floor((n.canonical.x*t.EXTENT+e.anchorX)*r),y:Math.floor((n.canonical.y*t.EXTENT+e.anchorY)*r)}},Se.prototype.findMatches=function(t,e,n){for(var i=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z),r=0;r<t.length;r++){var o=t.get(r);if(!o.crossTileID){var a=this.indexedSymbolInstances[o.key];if(a)for(var s=this.getScaledCoordinates(o,e),l=0,u=a;l<u.length;l+=1){var c=u[l];if(Math.abs(c.coord.x-s.x)<=i&&Math.abs(c.coord.y-s.y)<=i&&!n[c.crossTileID]){n[c.crossTileID]=!0,o.crossTileID=c.crossTileID;break}}}}};var Pe=function(){this.maxCrossTileID=0};Pe.prototype.generate=function(){return++this.maxCrossTileID};var Ce=function(){this.indexes={},this.usedCrossTileIDs={},this.lng=0};Ce.prototype.handleWrapJump=function(t){var e=Math.round((t-this.lng)/360);if(0!==e)for(var n in this.indexes){var i=this.indexes[n],r={};for(var o in i){var a=i[o];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+e),r[a.tileID.key]=a}this.indexes[n]=r}this.lng=t},Ce.prototype.addBucket=function(t,e,n){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(var i=0;i<e.symbolInstances.length;i++)e.symbolInstances.get(i).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});var r=this.usedCrossTileIDs[t.overscaledZ];for(var o in this.indexes){var a=this.indexes[o];if(Number(o)>t.overscaledZ)for(var s in a){var l=a[s];l.tileID.isChildOf(t)&&l.findMatches(e.symbolInstances,t,r)}else{var u=a[t.scaledTo(Number(o)).key];u&&u.findMatches(e.symbolInstances,t,r)}}for(var c=0;c<e.symbolInstances.length;c++){var p=e.symbolInstances.get(c);p.crossTileID||(p.crossTileID=n.generate(),r[p.crossTileID]=!0)}return void 0===this.indexes[t.overscaledZ]&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Se(t,e.symbolInstances,e.bucketInstanceId),!0},Ce.prototype.removeBucketCrossTileIDs=function(t,e){for(var n in e.indexedSymbolInstances)for(var i=0,r=e.indexedSymbolInstances[n];i<r.length;i+=1){var o=r[i];delete this.usedCrossTileIDs[t][o.crossTileID]}},Ce.prototype.removeStaleBuckets=function(t){var e=!1;for(var n in this.indexes){var i=this.indexes[n];for(var r in i)t[i[r].bucketInstanceId]||(this.removeBucketCrossTileIDs(n,i[r]),delete i[r],e=!0)}return e};var ke=function(){this.layerIndexes={},this.crossTileIDs=new Pe,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}};ke.prototype.addLayer=function(t,e,n){var i=this.layerIndexes[t.id];void 0===i&&(i=this.layerIndexes[t.id]=new Ce);var r=!1,o={};i.handleWrapJump(n);for(var a=0,s=e;a<s.length;a+=1){var l=s[a],u=l.getBucket(t);u&&t.id===u.layerIds[0]&&(u.bucketInstanceId||(u.bucketInstanceId=++this.maxBucketInstanceId),i.addBucket(l.tileID,u,this.crossTileIDs)&&(r=!0),o[u.bucketInstanceId]=!0)}return i.removeStaleBuckets(o)&&(r=!0),r},ke.prototype.pruneUnusedLayers=function(t){var e={};for(var n in t.forEach(function(t){e[t]=!0}),this.layerIndexes)e[n]||delete this.layerIndexes[n]};var Ae=function(e,n){return t.emitValidationErrors(e,n&&n.filter(function(t){return"source.canvas"!==t.identifier}))},ze=t.pick(Dt,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),Le=t.pick(Dt,["setCenter","setZoom","setBearing","setPitch"]),Me=function(e){function n(i,r){var o=this;void 0===r&&(r={}),e.call(this),this.map=i,this.dispatcher=new w((Lt||(Lt=new zt),Lt),this),this.imageManager=new p,this.glyphManager=new _(i._transformRequest,r.localIdeographFontFamily),this.lineAtlas=new b(256,512),this.crossTileSymbolIndex=new ke,this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new t.ZoomHistory,this._loaded=!1,this._resetUpdates(),this.dispatcher.broadcast("setReferrer",t.getReferrer());var a=this;this._rtlTextPluginCallback=n.registerForPluginAvailability(function(t){for(var e in a.dispatcher.broadcast("loadRTLTextPlugin",t.pluginURL,t.completionCallback),a.sourceCaches)a.sourceCaches[e].reload()}),this.on("data",function(t){if("source"===t.dataType&&"metadata"===t.sourceDataType){var e=o.sourceCaches[t.sourceId];if(e){var n=e.getSource();if(n&&n.vectorLayerIds)for(var i in o._layers){var r=o._layers[i];r.source===n.id&&o._validateLayer(r)}}}})}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.loadURL=function(e,n){var i=this;void 0===n&&(n={}),this.fire(new t.Event("dataloading",{dataType:"style"}));var r="boolean"==typeof n.validate?n.validate:!t.isMapboxURL(e);e=t.normalizeStyleURL(e,n.accessToken);var o=this.map._transformRequest(e,t.ResourceType.Style);this._request=t.getJSON(o,function(e,n){i._request=null,e?i.fire(new t.ErrorEvent(e)):n&&i._load(n,r)})},n.prototype.loadJSON=function(e,n){var i=this;void 0===n&&(n={}),this.fire(new t.Event("dataloading",{dataType:"style"})),this._request=t.browser.frame(function(){i._request=null,i._load(e,!1!==n.validate)})},n.prototype._load=function(e,n){var i=this;if(!n||!Ae(this,t.validateStyle(e))){for(var r in this._loaded=!0,this.stylesheet=e,e.sources)this.addSource(r,e.sources[r],{validate:!1});e.sprite?this._spriteRequest=function(e,n,i){var r,o,a,s=t.browser.devicePixelRatio>1?"@2x":"",l=t.getJSON(n(t.normalizeSpriteURL(e,s,".json"),t.ResourceType.SpriteJSON),function(t,e){l=null,a||(a=t,r=e,c())}),u=t.getImage(n(t.normalizeSpriteURL(e,s,".png"),t.ResourceType.SpriteImage),function(t,e){u=null,a||(a=t,o=e,c())});function c(){if(a)i(a);else if(r&&o){var e=t.browser.getImageData(o),n={};for(var s in r){var l=r[s],u=l.width,c=l.height,p=l.x,h=l.y,f=l.sdf,d=l.pixelRatio,m=new t.RGBAImage({width:u,height:c});t.RGBAImage.copy(e,m,{x:p,y:h},{x:0,y:0},{width:u,height:c}),n[s]={data:m,pixelRatio:d,sdf:f}}i(null,n)}}return{cancel:function(){l&&(l.cancel(),l=null),u&&(u.cancel(),u=null)}}}(e.sprite,this.map._transformRequest,function(e,n){if(i._spriteRequest=null,e)i.fire(new t.ErrorEvent(e));else if(n)for(var r in n)i.imageManager.addImage(r,n[r]);i.imageManager.setLoaded(!0),i.fire(new t.Event("data",{dataType:"style"}))}):this.imageManager.setLoaded(!0),this.glyphManager.setURL(e.glyphs);var o=Ot(this.stylesheet.layers);this._order=o.map(function(t){return t.id}),this._layers={};for(var a=0,s=o;a<s.length;a+=1){var l=s[a];(l=t.createStyleLayer(l)).setEventedParent(this,{layer:{id:l.id}}),this._layers[l.id]=l}this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new x(this.stylesheet.light),this.fire(new t.Event("data",{dataType:"style"})),this.fire(new t.Event("style.load"))}},n.prototype._validateLayer=function(e){var n=this.sourceCaches[e.source];if(n){var i=e.sourceLayer;if(i){var r=n.getSource();("geojson"===r.type||r.vectorLayerIds&&-1===r.vectorLayerIds.indexOf(i))&&this.fire(new t.ErrorEvent(new Error('Source layer "'+i+'" does not exist on source "'+r.id+'" as specified by style layer "'+e.id+'"')))}}},n.prototype.loaded=function(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(var t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()},n.prototype._serializeLayers=function(t){for(var e=[],n=0,i=t;n<i.length;n+=1){var r=i[n],o=this._layers[r];"custom"!==o.type&&e.push(o.serialize())}return e},n.prototype.hasTransitions=function(){if(this.light&&this.light.hasTransition())return!0;for(var t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(var e in this._layers)if(this._layers[e].hasTransition())return!0;return!1},n.prototype._checkLoaded=function(){if(!this._loaded)throw new Error("Style is not done loading")},n.prototype.update=function(e){if(this._loaded){var n=this._changed;if(this._changed){var i=Object.keys(this._updatedLayers),r=Object.keys(this._removedLayers);for(var o in(i.length||r.length)&&this._updateWorkerLayers(i,r),this._updatedSources){var a=this._updatedSources[o];"reload"===a?this._reloadSource(o):"clear"===a&&this._clearSource(o)}for(var s in this._updatedPaintProps)this._layers[s].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}for(var l in this.sourceCaches)this.sourceCaches[l].used=!1;for(var u=0,c=this._order;u<c.length;u+=1){var p=c[u],h=this._layers[p];h.recalculate(e),!h.isHidden(e.zoom)&&h.source&&(this.sourceCaches[h.source].used=!0)}this.light.recalculate(e),this.z=e.zoom,n&&this.fire(new t.Event("data",{dataType:"style"}))}},n.prototype._updateWorkerLayers=function(t,e){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:e})},n.prototype._resetUpdates=function(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={}},n.prototype.setState=function(e){var n=this;if(this._checkLoaded(),Ae(this,t.validateStyle(e)))return!1;(e=t.clone(e)).layers=Ot(e.layers);var i=function(e,n){if(!e)return[{command:Dt.setStyle,args:[n]}];var i=[];try{if(!t.isEqual(e.version,n.version))return[{command:Dt.setStyle,args:[n]}];t.isEqual(e.center,n.center)||i.push({command:Dt.setCenter,args:[n.center]}),t.isEqual(e.zoom,n.zoom)||i.push({command:Dt.setZoom,args:[n.zoom]}),t.isEqual(e.bearing,n.bearing)||i.push({command:Dt.setBearing,args:[n.bearing]}),t.isEqual(e.pitch,n.pitch)||i.push({command:Dt.setPitch,args:[n.pitch]}),t.isEqual(e.sprite,n.sprite)||i.push({command:Dt.setSprite,args:[n.sprite]}),t.isEqual(e.glyphs,n.glyphs)||i.push({command:Dt.setGlyphs,args:[n.glyphs]}),t.isEqual(e.transition,n.transition)||i.push({command:Dt.setTransition,args:[n.transition]}),t.isEqual(e.light,n.light)||i.push({command:Dt.setLight,args:[n.light]});var r={},o=[];!function(e,n,i,r){var o;for(o in n=n||{},e=e||{})e.hasOwnProperty(o)&&(n.hasOwnProperty(o)||Bt(o,i,r));for(o in n)n.hasOwnProperty(o)&&(e.hasOwnProperty(o)?t.isEqual(e[o],n[o])||("geojson"===e[o].type&&"geojson"===n[o].type&&Nt(e,n,o)?i.push({command:Dt.setGeoJSONSourceData,args:[o,n[o].data]}):Ft(o,n,i,r)):Rt(o,n,i))}(e.sources,n.sources,o,r);var a=[];e.layers&&e.layers.forEach(function(t){r[t.source]?i.push({command:Dt.removeLayer,args:[t.id]}):a.push(t)}),i=i.concat(o),function(e,n,i){n=n||[];var r,o,a,s,l,u,c,p=(e=e||[]).map(jt),h=n.map(jt),f=e.reduce(Vt,{}),d=n.reduce(Vt,{}),m=p.slice(),y=Object.create(null);for(r=0,o=0;r<p.length;r++)a=p[r],d.hasOwnProperty(a)?o++:(i.push({command:Dt.removeLayer,args:[a]}),m.splice(m.indexOf(a,o),1));for(r=0,o=0;r<h.length;r++)a=h[h.length-1-r],m[m.length-1-r]!==a&&(f.hasOwnProperty(a)?(i.push({command:Dt.removeLayer,args:[a]}),m.splice(m.lastIndexOf(a,m.length-o),1)):o++,u=m[m.length-r],i.push({command:Dt.addLayer,args:[d[a],u]}),m.splice(m.length-r,0,a),y[a]=!0);for(r=0;r<h.length;r++)if(s=f[a=h[r]],l=d[a],!y[a]&&!t.isEqual(s,l))if(t.isEqual(s.source,l.source)&&t.isEqual(s["source-layer"],l["source-layer"])&&t.isEqual(s.type,l.type)){for(c in Ut(s.layout,l.layout,i,a,null,Dt.setLayoutProperty),Ut(s.paint,l.paint,i,a,null,Dt.setPaintProperty),t.isEqual(s.filter,l.filter)||i.push({command:Dt.setFilter,args:[a,l.filter]}),t.isEqual(s.minzoom,l.minzoom)&&t.isEqual(s.maxzoom,l.maxzoom)||i.push({command:Dt.setLayerZoomRange,args:[a,l.minzoom,l.maxzoom]}),s)s.hasOwnProperty(c)&&"layout"!==c&&"paint"!==c&&"filter"!==c&&"metadata"!==c&&"minzoom"!==c&&"maxzoom"!==c&&(0===c.indexOf("paint.")?Ut(s[c],l[c],i,a,c.slice(6),Dt.setPaintProperty):t.isEqual(s[c],l[c])||i.push({command:Dt.setLayerProperty,args:[a,c,l[c]]}));for(c in l)l.hasOwnProperty(c)&&!s.hasOwnProperty(c)&&"layout"!==c&&"paint"!==c&&"filter"!==c&&"metadata"!==c&&"minzoom"!==c&&"maxzoom"!==c&&(0===c.indexOf("paint.")?Ut(s[c],l[c],i,a,c.slice(6),Dt.setPaintProperty):t.isEqual(s[c],l[c])||i.push({command:Dt.setLayerProperty,args:[a,c,l[c]]}))}else i.push({command:Dt.removeLayer,args:[a]}),u=m[m.lastIndexOf(a)+1],i.push({command:Dt.addLayer,args:[l,u]})}(a,n.layers,i)}catch(t){console.warn("Unable to compute style diff:",t),i=[{command:Dt.setStyle,args:[n]}]}return i}(this.serialize(),e).filter(function(t){return!(t.command in Le)});if(0===i.length)return!1;var r=i.filter(function(t){return!(t.command in ze)});if(r.length>0)throw new Error("Unimplemented: "+r.map(function(t){return t.command}).join(", ")+".");return i.forEach(function(t){"setTransition"!==t.command&&n[t.command].apply(n,t.args)}),this.stylesheet=e,!0},n.prototype.addImage=function(e,n){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(e,n),this.fire(new t.Event("data",{dataType:"style"}))},n.prototype.getImage=function(t){return this.imageManager.getImage(t)},n.prototype.removeImage=function(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(e),this.fire(new t.Event("data",{dataType:"style"}))},n.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},n.prototype.addSource=function(e,n,i){var r=this;if(void 0===i&&(i={}),this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error("There is already a source with this ID");if(!n.type)throw new Error("The type property must be defined, but the only the following properties were given: "+Object.keys(n).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(t.validateStyle.source,"sources."+e,n,null,i))){this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);var o=this.sourceCaches[e]=new Pt(e,n,this.dispatcher);o.style=this,o.setEventedParent(this,function(){return{isSourceLoaded:r.loaded(),source:o.serialize(),sourceId:e}}),o.onAdd(this.map),this._changed=!0}},n.prototype.removeSource=function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(var n in this._layers)if(this._layers[n].source===e)return this.fire(new t.ErrorEvent(new Error('Source "'+e+'" cannot be removed while layer "'+n+'" is using it.')));var i=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],i.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.clearTiles(),i.onRemove&&i.onRemove(this.map),this._changed=!0},n.prototype.setGeoJSONSourceData=function(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0},n.prototype.getSource=function(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()},n.prototype.addLayer=function(e,n,i){void 0===i&&(i={}),this._checkLoaded();var r=e.id;if(this.getLayer(r))this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" already exists on this map')));else{var o;if("custom"===e.type){if(Ae(this,t.validateCustomStyleLayer(e)))return;o=t.createStyleLayer(e)}else{if("object"==typeof e.source&&(this.addSource(r,e.source),e=t.clone(e),e=t.extend(e,{source:r})),this._validate(t.validateStyle.layer,"layers."+r,e,{arrayIndex:-1},i))return;o=t.createStyleLayer(e),this._validateLayer(o),o.setEventedParent(this,{layer:{id:r}})}var a=n?this._order.indexOf(n):this._order.length;if(n&&-1===a)this.fire(new t.ErrorEvent(new Error('Layer with id "'+n+'" does not exist on this map.')));else{if(this._order.splice(a,0,r),this._layerOrderChanged=!0,this._layers[r]=o,this._removedLayers[r]&&o.source&&"custom"!==o.type){var s=this._removedLayers[r];delete this._removedLayers[r],s.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map)}}},n.prototype.moveLayer=function(e,n){if(this._checkLoaded(),this._changed=!0,this._layers[e]){if(e!==n){var i=this._order.indexOf(e);this._order.splice(i,1);var r=n?this._order.indexOf(n):this._order.length;n&&-1===r?this.fire(new t.ErrorEvent(new Error('Layer with id "'+n+'" does not exist on this map.'))):(this._order.splice(r,0,e),this._layerOrderChanged=!0)}}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be moved.")))},n.prototype.removeLayer=function(e){this._checkLoaded();var n=this._layers[e];if(n){n.setEventedParent(null);var i=this._order.indexOf(e);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=n,delete this._layers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],n.onRemove&&n.onRemove(this.map)}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be removed.")))},n.prototype.getLayer=function(t){return this._layers[t]},n.prototype.setLayerZoomRange=function(e,n,i){this._checkLoaded();var r=this.getLayer(e);r?r.minzoom===n&&r.maxzoom===i||(null!=n&&(r.minzoom=n),null!=i&&(r.maxzoom=i),this._updateLayer(r)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot have zoom extent.")))},n.prototype.setFilter=function(e,n,i){void 0===i&&(i={}),this._checkLoaded();var r=this.getLayer(e);if(r){if(!t.isEqual(r.filter,n))return null==n?(r.filter=void 0,void this._updateLayer(r)):void(this._validate(t.validateStyle.filter,"layers."+r.id+".filter",n,null,i)||(r.filter=t.clone(n),this._updateLayer(r)))}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be filtered.")))},n.prototype.getFilter=function(e){return t.clone(this.getLayer(e).filter)},n.prototype.setLayoutProperty=function(e,n,i,r){void 0===r&&(r={}),this._checkLoaded();var o=this.getLayer(e);o?t.isEqual(o.getLayoutProperty(n),i)||(o.setLayoutProperty(n,i,r),this._updateLayer(o)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},n.prototype.getLayoutProperty=function(e,n){var i=this.getLayer(e);if(i)return i.getLayoutProperty(n);this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style.")))},n.prototype.setPaintProperty=function(e,n,i,r){void 0===r&&(r={}),this._checkLoaded();var o=this.getLayer(e);o?t.isEqual(o.getPaintProperty(n),i)||(o.setPaintProperty(n,i,r)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},n.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},n.prototype.setFeatureState=function(e,n){this._checkLoaded();var i=e.source,r=e.sourceLayer,o=this.sourceCaches[i],a=parseInt(e.id,10);if(void 0!==o){var s=o.getSource().type;"geojson"===s&&r?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==s||r?isNaN(a)||a<0?this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided and non-negative."))):o.setFeatureState(r,a,n):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+i+"' does not exist in the map's style.")))},n.prototype.removeFeatureState=function(e,n){this._checkLoaded();var i=e.source,r=this.sourceCaches[i];if(void 0!==r){var o=r.getSource().type,a="vector"===o?e.sourceLayer:void 0,s=parseInt(e.id,10);"vector"!==o||a?e.id&&isNaN(s)||s<0?this.fire(new t.ErrorEvent(new Error("The feature id parameter must be non-negative."))):!n||e.id?r.removeFeatureState(a,s,n):this.fire(new t.ErrorEvent(new Error("A feature id is requred to remove its specific state property."))):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+i+"' does not exist in the map's style.")))},n.prototype.getFeatureState=function(e){this._checkLoaded();var n=e.source,i=e.sourceLayer,r=this.sourceCaches[n],o=parseInt(e.id,10);if(void 0!==r)if("vector"!==r.getSource().type||i){if(!(isNaN(o)||o<0))return r.getFeatureState(i,o);this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided and non-negative.")))}else this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));else this.fire(new t.ErrorEvent(new Error("The source '"+n+"' does not exist in the map's style.")))},n.prototype.getTransition=function(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},n.prototype.serialize=function(){return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:t.mapObject(this.sourceCaches,function(t){return t.serialize()}),layers:this._serializeLayers(this._order)},function(t){return void 0!==t})},n.prototype._updateLayer=function(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0},n.prototype._flattenAndSortRenderedFeatures=function(t){for(var e=[],n=[],i=this._order.length-1;i>=0;i--)for(var r=this._order[i],o=0,a=t;o<a.length;o+=1){var s=a[o][r];if(s)if("fill-extrusion"===this._layers[r].type)for(var l=0,u=s;l<u.length;l+=1){var c=u[l];n.push(c)}else for(var p=0,h=s;p<h.length;p+=1){var f=h[p];e.push(f.feature)}}n.sort(function(t,e){return t.intersectionZ-e.intersectionZ});for(var d=0,m=n;d<m.length;d+=1){var y=m[d];e.push(y.feature)}return e},n.prototype.queryRenderedFeatures=function(e,n,i){n&&n.filter&&this._validate(t.validateStyle.filter,"queryRenderedFeatures.filter",n.filter);var r={};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new t.ErrorEvent(new Error("parameters.layers must be an Array."))),[];for(var o=0,a=n.layers;o<a.length;o+=1){var s=a[o],l=this._layers[s];if(!l)return this.fire(new t.ErrorEvent(new Error("The layer '"+s+"' does not exist in the map's style and cannot be queried for features."))),[];r[l.source]=!0}}var u=[];for(var c in this.sourceCaches)n.layers&&!r[c]||u.push(I(this.sourceCaches[c],this._layers,e,n,i));return this.placement&&u.push(function(t,e,n,i,r,o){for(var a={},s=r.queryRenderedSymbols(n),l=[],u=0,c=Object.keys(s).map(Number);u<c.length;u+=1){var p=c[u];l.push(o[p])}l.sort(O);for(var h=function(){var e=d[f],n=e.featureIndex.lookupSymbolFeatures(s[e.bucketInstanceId],e.bucketIndex,e.sourceLayerIndex,i.filter,i.layers,t);for(var r in n){var o=a[r]=a[r]||[],l=n[r];l.sort(function(t,n){var i=e.featureSortOrder;if(i){var r=i.indexOf(t.featureIndex);return i.indexOf(n.featureIndex)-r}return n.featureIndex-t.featureIndex});for(var u=0,c=l;u<c.length;u+=1){var p=c[u];o.push(p)}}},f=0,d=l;f<d.length;f+=1)h();var m=function(n){a[n].forEach(function(i){var r=i.feature,o=t[n],a=e[o.source].getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=a})};for(var y in a)m(y);return a}(this._layers,this.sourceCaches,e,n,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(u)},n.prototype.querySourceFeatures=function(e,n){n&&n.filter&&this._validate(t.validateStyle.filter,"querySourceFeatures.filter",n.filter);var i=this.sourceCaches[e];return i?function(t,e){for(var n=t.getRenderableIds().map(function(e){return t.getTileByID(e)}),i=[],r={},o=0;o<n.length;o++){var a=n[o],s=a.tileID.canonical.key;r[s]||(r[s]=!0,a.querySourceFeatures(i,e))}return i}(i,n):[]},n.prototype.addSourceType=function(t,e,i){return n.getSourceType(t)?i(new Error('A source type called "'+t+'" already exists.')):(n.setSourceType(t,e),e.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:e.workerSourceURL},i):i(null,null))},n.prototype.getLight=function(){return this.light.getLight()},n.prototype.setLight=function(e,n){void 0===n&&(n={}),this._checkLoaded();var i=this.light.getLight(),r=!1;for(var o in e)if(!t.isEqual(e[o],i[o])){r=!0;break}if(r){var a={now:t.browser.now(),transition:t.extend({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,n),this.light.updateTransitions(a)}},n.prototype._validate=function(e,n,i,r,o){return void 0===o&&(o={}),(!o||!1!==o.validate)&&Ae(this,e.call(t.validateStyle,t.extend({key:n,style:this.serialize(),value:i,styleSpec:t.styleSpec},r)))},n.prototype._remove=function(){for(var e in this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),t.evented.off("pluginAvailable",this._rtlTextPluginCallback),this.sourceCaches)this.sourceCaches[e].clearTiles();this.dispatcher.remove()},n.prototype._clearSource=function(t){this.sourceCaches[t].clearTiles()},n.prototype._reloadSource=function(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()},n.prototype._updateSources=function(t){for(var e in this.sourceCaches)this.sourceCaches[e].update(t)},n.prototype._generateCollisionBoxes=function(){for(var t in this.sourceCaches)this._reloadSource(t)},n.prototype._updatePlacement=function(e,n,i,r){for(var o=!1,a=!1,s={},l=0,u=this._order;l<u.length;l+=1){var c=u[l],p=this._layers[c];if("symbol"===p.type){if(!s[p.source]){var h=this.sourceCaches[p.source];s[p.source]=h.getRenderableIds(!0).map(function(t){return h.getTileByID(t)}).sort(function(t,e){return e.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(e.tileID)?-1:1)})}var f=this.crossTileSymbolIndex.addLayer(p,s[p.source],e.center.lng);o=o||f}}this.crossTileSymbolIndex.pruneUnusedLayers(this._order);var d=this._layerOrderChanged||0===i;if((d||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(t.browser.now()))&&(this.pauseablePlacement=new Ee(e,this._order,d,n,i,r),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,s),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(this.placement,t.browser.now()),a=!0),o&&this.pauseablePlacement.placement.setStale()),a||o)for(var m=0,y=this._order;m<y.length;m+=1){var _=y[m],g=this._layers[_];"symbol"===g.type&&this.placement.updateLayerOpacities(g,s[g.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(t.browser.now())},n.prototype._releaseSymbolFadeTiles=function(){for(var t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()},n.prototype.getImages=function(t,e,n){this.imageManager.getImages(e.icons,n)},n.prototype.getGlyphs=function(t,e,n){this.glyphManager.getGlyphs(e.stacks,n)},n.prototype.getResource=function(e,n,i){return t.makeRequest(n,i)},n}(t.Evented);Me.getSourceType=function(t){return z[t]},Me.setSourceType=function(t,e){z[t]=e},Me.registerForPluginAvailability=t.registerForPluginAvailability;var Ie=t.createLayout([{name:"a_pos",type:"Int16",components:2}]),Oe=sn("#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif","#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}"),De=sn("uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),Re=sn("uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),Be=sn("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvarying vec3 v_data;void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvarying vec3 v_data;void main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,0,1);} else {gl_Position=u_matrix*vec4(circle_center,0,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/DEVICE_PIXEL_RATIO/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}"),Fe=sn("void main() {gl_FragColor=vec4(1.0);}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),Ne=sn("#pragma mapbox: define highp float weight\nuniform highp float u_intensity;varying vec2 v_extrude;\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nuniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;const highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}"),Ue=sn("uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),je=sn("varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=a_extrude*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),Ve=sn("uniform float u_overscale_factor;varying float v_placed;varying float v_notUsed;varying float v_radius;varying vec2 v_extrude;varying vec2 v_extrude_scale;void main() {float alpha=0.5;vec4 color=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {color=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {color*=.2;}float extrude_scale_length=length(v_extrude_scale);float extrude_length=length(v_extrude)*extrude_scale_length;float stroke_width=15.0*extrude_scale_length/u_overscale_factor;float radius=v_radius*extrude_scale_length;float distance_to_edge=abs(extrude_length-radius);float opacity_t=smoothstep(-stroke_width,0.0,-distance_to_edge);gl_FragColor=opacity_t*color;}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;varying float v_radius;varying vec2 v_extrude;varying vec2 v_extrude_scale;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);highp float padding_factor=1.2;gl_Position.xy+=a_extrude*u_extrude_scale*padding_factor*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;v_radius=abs(a_extrude.y);v_extrude=a_extrude*padding_factor;v_extrude_scale=u_extrude_scale*u_camera_to_center_distance*collision_perspective_ratio;}"),Ze=sn("uniform highp vec4 u_color;void main() {gl_FragColor=u_color;}","attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),qe=sn("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),Ge=sn("#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvarying vec2 v_pos;void main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),We=sn("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec4 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float pixelRatio=u_scale.x;float tileRatio=u_scale.y;float fromScale=u_scale.z;float toScale=u_scale.w;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=vec2((pattern_br_a.x-pattern_tl_a.x)/pixelRatio,(pattern_br_a.y-pattern_tl_a.y)/pixelRatio);vec2 display_size_b=vec2((pattern_br_b.x-pattern_tl_b.x)/pixelRatio,(pattern_br_b.y-pattern_tl_b.y)/pixelRatio);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),He=sn("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec4 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float pixelRatio=u_scale.x;float tileZoomRatio=u_scale.y;float fromScale=u_scale.z;float toScale=u_scale.w;vec2 display_size_a=vec2((pattern_br_a.x-pattern_tl_a.x)/pixelRatio,(pattern_br_a.y-pattern_tl_a.y)/pixelRatio);vec2 display_size_b=vec2((pattern_br_b.x-pattern_tl_b.x)/pixelRatio,(pattern_br_b.y-pattern_tl_b.y)/pixelRatio);gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),Xe=sn("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);}"),Ke=sn("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec4 u_scale;uniform float u_vertical_gradient;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float pixelRatio=u_scale.x;float tileRatio=u_scale.y;float fromScale=u_scale.z;float toScale=u_scale.w;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=vec2((pattern_br_a.x-pattern_tl_a.x)/pixelRatio,(pattern_br_a.y-pattern_tl_a.y)/pixelRatio);vec2 display_size_b=vec2((pattern_br_b.x-pattern_tl_b.x)/pixelRatio,(pattern_br_b.y-pattern_tl_b.y)/pixelRatio);base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));}"),Ye=sn("uniform sampler2D u_image;uniform float u_opacity;varying vec2 v_pos;void main() {gl_FragColor=texture2D(u_image,v_pos)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),Je=sn("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform float u_maxzoom;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;return (data.r+data.g*256.0+data.b*256.0*256.0)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggeration=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/ pow(2.0,(u_zoom-u_maxzoom)*exaggeration+19.2562-u_zoom);gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),$e=sn("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),Qe=sn("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvarying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/DEVICE_PIXEL_RATIO)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define ANTIALIASING 1.0/DEVICE_PIXEL_RATIO/2.0\n#define scale 0.015873016\nattribute vec4 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_gl_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nvec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=a_pos_normal.xy;mediump vec2 normal=a_pos_normal.zw;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_gl_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),tn=sn("#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nuniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp float v_lineprogress;void main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/DEVICE_PIXEL_RATIO)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,vec2(v_lineprogress,0.5));gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define MAX_LINE_DISTANCE 32767.0\n#define ANTIALIASING 1.0/DEVICE_PIXEL_RATIO/2.0\n#define scale 0.015873016\nattribute vec4 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_gl_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_lineprogress;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nvec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_lineprogress=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0/MAX_LINE_DISTANCE;vec2 pos=a_pos_normal.xy;mediump vec2 normal=a_pos_normal.zw;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_gl_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),en=sn("uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec4 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float pixelRatio=u_scale.x;float tileZoomRatio=u_scale.y;float fromScale=u_scale.z;float toScale=u_scale.w;vec2 display_size_a=vec2((pattern_br_a.x-pattern_tl_a.x)/pixelRatio,(pattern_br_a.y-pattern_tl_a.y)/pixelRatio);vec2 display_size_b=vec2((pattern_br_b.x-pattern_tl_b.x)/pixelRatio,(pattern_br_b.y-pattern_tl_b.y)/pixelRatio);vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/DEVICE_PIXEL_RATIO)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x,1.0);float x_b=mod(v_linesofar/pattern_size_b.x,1.0);float y_a=0.5+(v_normal.y*clamp(v_width2.s,0.0,(pattern_size_a.y+2.0)/2.0)/pattern_size_a.y);float y_b=0.5+(v_normal.y*clamp(v_width2.s,0.0,(pattern_size_b.y+2.0)/2.0)/pattern_size_b.y);vec2 pos_a=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,vec2(x_a,y_a));vec2 pos_b=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,vec2(x_b,y_b));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\n#define ANTIALIASING 1.0/DEVICE_PIXEL_RATIO/2.0\nattribute vec4 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_gl_units_to_pixels;uniform mediump float u_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=a_pos_normal.xy;mediump vec2 normal=a_pos_normal.zw;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_gl_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);}"),nn=sn("uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/DEVICE_PIXEL_RATIO)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\n#define ANTIALIASING 1.0/DEVICE_PIXEL_RATIO/2.0\nattribute vec4 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_gl_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nvec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=a_pos_normal.xy;mediump vec2 normal=a_pos_normal.zw;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_gl_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),rn=sn("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),on=sn("uniform sampler2D u_texture;\n#pragma mapbox: define lowp float opacity\nvarying vec2 v_tex;varying float v_fade_opacity;void main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;\n#pragma mapbox: define lowp float opacity\nuniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_gl_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;void main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size[0],a_size[1],u_size_t)/256.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size[0]/256.0;} else if (!u_is_size_zoom_constant && u_is_size_feature_constant) {size=u_size;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_gl_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}"),an=sn("#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105/DEVICE_PIXEL_RATIO\nuniform bool u_is_halo;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nuniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;void main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nuniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_gl_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;void main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size[0],a_size[1],u_size_t)/256.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size[0]/256.0;} else if (!u_is_size_zoom_constant && u_is_size_feature_constant) {size=u_size;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_gl_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=vec2(tex.x,tex.y);v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}");function sn(t,e){var n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,i={};return{fragmentSource:t=t.replace(n,function(t,e,n,r,o){return i[o]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+o+"\nvarying "+n+" "+r+" "+o+";\n#else\nuniform "+n+" "+r+" u_"+o+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+o+"\n "+n+" "+r+" "+o+" = u_"+o+";\n#endif\n"}),vertexSource:e=e.replace(n,function(t,e,n,r,o){var a="float"===r?"vec2":"vec4",s=o.match(/color/)?"color":a;return i[o]?"define"===e?"\n#ifndef HAS_UNIFORM_u_"+o+"\nuniform lowp float a_"+o+"_t;\nattribute "+n+" "+a+" a_"+o+";\nvarying "+n+" "+r+" "+o+";\n#else\nuniform "+n+" "+r+" u_"+o+";\n#endif\n":"vec4"===s?"\n#ifndef HAS_UNIFORM_u_"+o+"\n "+o+" = a_"+o+";\n#else\n "+n+" "+r+" "+o+" = u_"+o+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+o+"\n "+o+" = unpack_mix_"+s+"(a_"+o+", a_"+o+"_t);\n#else\n "+n+" "+r+" "+o+" = u_"+o+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+o+"\nuniform lowp float a_"+o+"_t;\nattribute "+n+" "+a+" a_"+o+";\n#else\nuniform "+n+" "+r+" u_"+o+";\n#endif\n":"vec4"===s?"\n#ifndef HAS_UNIFORM_u_"+o+"\n "+n+" "+r+" "+o+" = a_"+o+";\n#else\n "+n+" "+r+" "+o+" = u_"+o+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+o+"\n "+n+" "+r+" "+o+" = unpack_mix_"+s+"(a_"+o+", a_"+o+"_t);\n#else\n "+n+" "+r+" "+o+" = u_"+o+";\n#endif\n"})}}var ln=Object.freeze({prelude:Oe,background:De,backgroundPattern:Re,circle:Be,clippingMask:Fe,heatmap:Ne,heatmapTexture:Ue,collisionBox:je,collisionCircle:Ve,debug:Ze,fill:qe,fillOutline:Ge,fillOutlinePattern:We,fillPattern:He,fillExtrusion:Xe,fillExtrusionPattern:Ke,extrusionTexture:Ye,hillshadePrepare:Je,hillshade:$e,line:Qe,lineGradient:tn,linePattern:en,lineSDF:nn,raster:rn,symbolIcon:on,symbolSDF:an}),un=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};un.prototype.bind=function(t,e,n,i,r,o,a,s){this.context=t;for(var l=this.boundPaintVertexBuffers.length!==i.length,u=0;!l&&u<i.length;u++)this.boundPaintVertexBuffers[u]!==i[u]&&(l=!0);var c=!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==n||l||this.boundIndexBuffer!==r||this.boundVertexOffset!==o||this.boundDynamicVertexBuffer!==a||this.boundDynamicVertexBuffer2!==s;!t.extVertexArrayObject||c?this.freshBind(e,n,i,r,o,a,s):(t.bindVertexArrayOES.set(this.vao),a&&a.bind(),r&&r.dynamicDraw&&r.bind(),s&&s.bind())},un.prototype.freshBind=function(t,e,n,i,r,o,a){var s,l=t.numAttributes,u=this.context,c=u.gl;if(u.extVertexArrayObject)this.vao&&this.destroy(),this.vao=u.extVertexArrayObject.createVertexArrayOES(),u.bindVertexArrayOES.set(this.vao),s=0,this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=n,this.boundIndexBuffer=i,this.boundVertexOffset=r,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=a;else{s=u.currentNumAttributes||0;for(var p=l;p<s;p++)c.disableVertexAttribArray(p)}e.enableAttributes(c,t);for(var h=0,f=n;h<f.length;h+=1)f[h].enableAttributes(c,t);o&&o.enableAttributes(c,t),a&&a.enableAttributes(c,t),e.bind(),e.setVertexAttribPointers(c,t,r);for(var d=0,m=n;d<m.length;d+=1){var y=m[d];y.bind(),y.setVertexAttribPointers(c,t,r)}o&&(o.bind(),o.setVertexAttribPointers(c,t,r)),i&&i.bind(),a&&(a.bind(),a.setVertexAttribPointers(c,t,r)),u.currentNumAttributes=l},un.prototype.destroy=function(){this.vao&&(this.context.extVertexArrayObject.deleteVertexArrayOES(this.vao),this.vao=null)};var cn=function(e,n,i,r,o){var a=e.gl;this.program=a.createProgram();var s=i.defines().concat("#define DEVICE_PIXEL_RATIO "+t.browser.devicePixelRatio.toFixed(1));o&&s.push("#define OVERDRAW_INSPECTOR;");var l=s.concat(Oe.fragmentSource,n.fragmentSource).join("\n"),u=s.concat(Oe.vertexSource,n.vertexSource).join("\n"),c=a.createShader(a.FRAGMENT_SHADER);a.shaderSource(c,l),a.compileShader(c),a.attachShader(this.program,c);var p=a.createShader(a.VERTEX_SHADER);a.shaderSource(p,u),a.compileShader(p),a.attachShader(this.program,p);for(var h=i.layoutAttributes||[],f=0;f<h.length;f++)a.bindAttribLocation(this.program,f,h[f].name);a.linkProgram(this.program),this.numAttributes=a.getProgramParameter(this.program,a.ACTIVE_ATTRIBUTES),this.attributes={};for(var d={},m=0;m<this.numAttributes;m++){var y=a.getActiveAttrib(this.program,m);y&&(this.attributes[y.name]=a.getAttribLocation(this.program,y.name))}for(var _=a.getProgramParameter(this.program,a.ACTIVE_UNIFORMS),g=0;g<_;g++){var v=a.getActiveUniform(this.program,g);v&&(d[v.name]=a.getUniformLocation(this.program,v.name))}this.fixedUniforms=r(e,d),this.binderUniforms=i.getUniforms(e,d)};function pn(e,n,i){var r=1/ae(i,1,n.transform.tileZoom),o=Math.pow(2,i.tileID.overscaledZ),a=i.tileSize*Math.pow(2,n.transform.tileZoom)/o,s=a*(i.tileID.canonical.x+i.tileID.wrap*o),l=a*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[t.browser.devicePixelRatio,r,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[s>>16,l>>16],u_pixel_coord_lower:[65535&s,65535&l]}}cn.prototype.draw=function(t,e,n,i,r,o,a,s,l,u,c,p,h,f,d,m){var y,_=t.gl;for(var g in t.program.set(this.program),t.setDepthMode(n),t.setStencilMode(i),t.setColorMode(r),t.setCullFace(o),this.fixedUniforms)this.fixedUniforms[g].set(a[g]);f&&f.setUniforms(t,this.binderUniforms,p,{zoom:h});for(var v=(y={},y[_.LINES]=2,y[_.TRIANGLES]=3,y[_.LINE_STRIP]=1,y)[e],x=0,b=c.get();x<b.length;x+=1){var w=b[x],E=w.vaos||(w.vaos={});(E[s]||(E[s]=new un)).bind(t,this,l,f?f.getPaintVertexBuffers():[],u,w.vertexOffset,d,m),_.drawElements(e,w.primitiveLength*v,_.UNSIGNED_SHORT,w.primitiveOffset*v*2)}};var hn=function(e,n,i){var r=n.style.light,o=r.properties.get("position"),a=[o.x,o.y,o.z],s=t.create();"viewport"===r.properties.get("anchor")&&t.fromRotation(s,-n.transform.angle),t.transformMat3(a,a,s);var l=r.properties.get("color");return{u_matrix:e,u_lightpos:a,u_lightintensity:r.properties.get("intensity"),u_lightcolor:[l.r,l.g,l.b],u_vertical_gradient:+i}},fn=function(e,n,i,r,o,a){return t.extend(hn(e,n,i),pn(o,n,a),{u_height_factor:-Math.pow(2,r.overscaledZ)/a.tileSize/8})},dn=function(e,n,i){var r=t.create$1();t.ortho(r,0,e.width,e.height,0,0,1);var o=e.context.gl;return{u_matrix:r,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:i,u_opacity:n}},mn=function(t){return{u_matrix:t}},yn=function(e,n,i,r){return t.extend(mn(e),pn(i,n,r))},_n=function(t,e){return{u_matrix:t,u_world:e}},gn=function(e,n,i,r,o){return t.extend(yn(e,n,i,r),{u_world:o})},vn=function(t,e,n,i){var r,o,a=t.transform;if("map"===i.paint.get("circle-pitch-alignment")){var s=ae(n,1,a.zoom);r=!0,o=[s,s]}else r=!1,o=a.pixelsToGLUnits;return{u_camera_to_center_distance:a.cameraToCenterDistance,u_scale_with_map:+("map"===i.paint.get("circle-pitch-scale")),u_matrix:t.translatePosMatrix(e.posMatrix,n,i.paint.get("circle-translate"),i.paint.get("circle-translate-anchor")),u_pitch_with_map:+r,u_extrude_scale:o}},xn=function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,n.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,n.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,n.u_overscale_factor)}},bn=function(t,e,n){var i=ae(n,1,e.zoom),r=Math.pow(2,e.zoom-n.tileID.overscaledZ),o=n.tileID.overscaleFactor();return{u_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:i,u_extrude_scale:[e.pixelsToGLUnits[0]/(i*r),e.pixelsToGLUnits[1]/(i*r)],u_overscale_factor:o}},wn=function(t,e){return{u_matrix:t,u_color:e}},En=function(t){return{u_matrix:t}},Tn=function(t,e,n,i){return{u_matrix:t,u_extrude_scale:ae(e,1,n),u_intensity:i}},Sn=function(t,e,n){var i=n.paint.get("hillshade-shadow-color"),r=n.paint.get("hillshade-highlight-color"),o=n.paint.get("hillshade-accent-color"),a=n.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===n.paint.get("hillshade-illumination-anchor")&&(a-=t.transform.angle);var s=!t.options.moving;return{u_matrix:t.transform.calculatePosMatrix(e.tileID.toUnwrapped(),s),u_image:0,u_latrange:Cn(0,e.tileID),u_light:[n.paint.get("hillshade-exaggeration"),a],u_shadow:i,u_highlight:r,u_accent:o}},Pn=function(e,n){var i=e.dem.stride,r=t.create$1();return t.ortho(r,0,t.EXTENT,-t.EXTENT,0,0,1),t.translate(r,r,[0,-t.EXTENT,0]),{u_matrix:r,u_image:1,u_dimension:[i,i],u_zoom:e.tileID.overscaledZ,u_maxzoom:n}};function Cn(e,n){var i=Math.pow(2,n.canonical.z),r=n.canonical.y;return[new t.MercatorCoordinate(0,r/i).toLngLat().lat,new t.MercatorCoordinate(0,(r+1)/i).toLngLat().lat]}var kn=function(t,e,n){var i=t.transform;return{u_matrix:In(t,e,n),u_ratio:1/ae(e,1,i.zoom),u_gl_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1]]}},An=function(e,n,i){return t.extend(kn(e,n,i),{u_image:0})},zn=function(e,n,i,r){var o=e.transform,a=Mn(n,o);return{u_matrix:In(e,n,i),u_texsize:n.imageAtlasTexture.size,u_ratio:1/ae(n,1,o.zoom),u_image:0,u_scale:[t.browser.devicePixelRatio,a,r.fromScale,r.toScale],u_fade:r.t,u_gl_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Ln=function(e,n,i,r,o){var a=e.transform,s=e.lineAtlas,l=Mn(n,a),u="round"===i.layout.get("line-cap"),c=s.getDash(r.from,u),p=s.getDash(r.to,u),h=c.width*o.fromScale,f=p.width*o.toScale;return t.extend(kn(e,n,i),{u_patternscale_a:[l/h,-c.height/2],u_patternscale_b:[l/f,-p.height/2],u_sdfgamma:s.width/(256*Math.min(h,f)*t.browser.devicePixelRatio)/2,u_image:0,u_tex_y_a:c.y,u_tex_y_b:p.y,u_mix:o.t})};function Mn(t,e){return 1/ae(t,1,e.tileZoom)}function In(t,e,n){return t.translatePosMatrix(e.tileID.posMatrix,e,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}var On=function(t,e,n,i,r){return{u_matrix:t,u_tl_parent:e,u_scale_parent:n,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*r.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:r.paint.get("raster-brightness-min"),u_brightness_high:r.paint.get("raster-brightness-max"),u_saturation_factor:(a=r.paint.get("raster-saturation"),a>0?1-1/(1.001-a):-a),u_contrast_factor:(o=r.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:Dn(r.paint.get("raster-hue-rotate"))};var o,a};function Dn(t){t*=Math.PI/180;var e=Math.sin(t),n=Math.cos(t);return[(2*n+1)/3,(-Math.sqrt(3)*e-n+1)/3,(Math.sqrt(3)*e-n+1)/3]}var Rn=function(t,e,n,i,r,o,a,s,l,u){var c=r.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:c.cameraToCenterDistance,u_pitch:c.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:c.width/c.height,u_fade_change:r.options.fadeDuration?r.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:a,u_gl_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+i,u_texsize:u,u_texture:0}},Bn=function(e,n,i,r,o,a,s,l,u,c,p){var h=o.transform;return t.extend(Rn(e,n,i,r,o,a,s,l,u,c),{u_gamma_scale:r?Math.cos(h._pitch)*h.cameraToCenterDistance:1,u_is_halo:+p})},Fn=function(t,e,n){return{u_matrix:t,u_opacity:e,u_color:n}},Nn=function(e,n,i,r,o,a){return t.extend(function(t,e,n,i){var r=n.imageManager.getPattern(t.from),o=n.imageManager.getPattern(t.to),a=n.imageManager.getPixelSize(),s=a.width,l=a.height,u=Math.pow(2,i.tileID.overscaledZ),c=i.tileSize*Math.pow(2,n.transform.tileZoom)/u,p=c*(i.tileID.canonical.x+i.tileID.wrap*u),h=c*i.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:r.tl,u_pattern_br_a:r.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[s,l],u_mix:e.t,u_pattern_size_a:r.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/ae(i,1,n.transform.tileZoom),u_pixel_coord_upper:[p>>16,h>>16],u_pixel_coord_lower:[65535&p,65535&h]}}(r,a,i,o),{u_matrix:e,u_opacity:n})},Un={fillExtrusion:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_lightpos:new t.Uniform3f(e,n.u_lightpos),u_lightintensity:new t.Uniform1f(e,n.u_lightintensity),u_lightcolor:new t.Uniform3f(e,n.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,n.u_vertical_gradient)}},fillExtrusionPattern:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_lightpos:new t.Uniform3f(e,n.u_lightpos),u_lightintensity:new t.Uniform1f(e,n.u_lightintensity),u_lightcolor:new t.Uniform3f(e,n.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,n.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,n.u_height_factor),u_image:new t.Uniform1i(e,n.u_image),u_texsize:new t.Uniform2f(e,n.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,n.u_pixel_coord_lower),u_scale:new t.Uniform4f(e,n.u_scale),u_fade:new t.Uniform1f(e,n.u_fade)}},extrusionTexture:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_world:new t.Uniform2f(e,n.u_world),u_image:new t.Uniform1i(e,n.u_image),u_opacity:new t.Uniform1f(e,n.u_opacity)}},fill:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix)}},fillPattern:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_image:new t.Uniform1i(e,n.u_image),u_texsize:new t.Uniform2f(e,n.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,n.u_pixel_coord_lower),u_scale:new t.Uniform4f(e,n.u_scale),u_fade:new t.Uniform1f(e,n.u_fade)}},fillOutline:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_world:new t.Uniform2f(e,n.u_world)}},fillOutlinePattern:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_world:new t.Uniform2f(e,n.u_world),u_image:new t.Uniform1i(e,n.u_image),u_texsize:new t.Uniform2f(e,n.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,n.u_pixel_coord_lower),u_scale:new t.Uniform4f(e,n.u_scale),u_fade:new t.Uniform1f(e,n.u_fade)}},circle:function(e,n){return{u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,n.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,n.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,n.u_extrude_scale),u_matrix:new t.UniformMatrix4f(e,n.u_matrix)}},collisionBox:xn,collisionCircle:xn,debug:function(e,n){return{u_color:new t.UniformColor(e,n.u_color),u_matrix:new t.UniformMatrix4f(e,n.u_matrix)}},clippingMask:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix)}},heatmap:function(e,n){return{u_extrude_scale:new t.Uniform1f(e,n.u_extrude_scale),u_intensity:new t.Uniform1f(e,n.u_intensity),u_matrix:new t.UniformMatrix4f(e,n.u_matrix)}},heatmapTexture:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_world:new t.Uniform2f(e,n.u_world),u_image:new t.Uniform1i(e,n.u_image),u_color_ramp:new t.Uniform1i(e,n.u_color_ramp),u_opacity:new t.Uniform1f(e,n.u_opacity)}},hillshade:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_image:new t.Uniform1i(e,n.u_image),u_latrange:new t.Uniform2f(e,n.u_latrange),u_light:new t.Uniform2f(e,n.u_light),u_shadow:new t.UniformColor(e,n.u_shadow),u_highlight:new t.UniformColor(e,n.u_highlight),u_accent:new t.UniformColor(e,n.u_accent)}},hillshadePrepare:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_image:new t.Uniform1i(e,n.u_image),u_dimension:new t.Uniform2f(e,n.u_dimension),u_zoom:new t.Uniform1f(e,n.u_zoom),u_maxzoom:new t.Uniform1f(e,n.u_maxzoom)}},line:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_ratio:new t.Uniform1f(e,n.u_ratio),u_gl_units_to_pixels:new t.Uniform2f(e,n.u_gl_units_to_pixels)}},lineGradient:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_ratio:new t.Uniform1f(e,n.u_ratio),u_gl_units_to_pixels:new t.Uniform2f(e,n.u_gl_units_to_pixels),u_image:new t.Uniform1i(e,n.u_image)}},linePattern:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_texsize:new t.Uniform2f(e,n.u_texsize),u_ratio:new t.Uniform1f(e,n.u_ratio),u_image:new t.Uniform1i(e,n.u_image),u_gl_units_to_pixels:new t.Uniform2f(e,n.u_gl_units_to_pixels),u_scale:new t.Uniform4f(e,n.u_scale),u_fade:new t.Uniform1f(e,n.u_fade)}},lineSDF:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_ratio:new t.Uniform1f(e,n.u_ratio),u_gl_units_to_pixels:new t.Uniform2f(e,n.u_gl_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,n.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,n.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,n.u_sdfgamma),u_image:new t.Uniform1i(e,n.u_image),u_tex_y_a:new t.Uniform1f(e,n.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,n.u_tex_y_b),u_mix:new t.Uniform1f(e,n.u_mix)}},raster:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_tl_parent:new t.Uniform2f(e,n.u_tl_parent),u_scale_parent:new t.Uniform1f(e,n.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,n.u_buffer_scale),u_fade_t:new t.Uniform1f(e,n.u_fade_t),u_opacity:new t.Uniform1f(e,n.u_opacity),u_image0:new t.Uniform1i(e,n.u_image0),u_image1:new t.Uniform1i(e,n.u_image1),u_brightness_low:new t.Uniform1f(e,n.u_brightness_low),u_brightness_high:new t.Uniform1f(e,n.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,n.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,n.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,n.u_spin_weights)}},symbolIcon:function(e,n){return{u_is_size_zoom_constant:new t.Uniform1i(e,n.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,n.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,n.u_size_t),u_size:new t.Uniform1f(e,n.u_size),u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,n.u_pitch),u_rotate_symbol:new t.Uniform1i(e,n.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,n.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,n.u_fade_change),u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,n.u_label_plane_matrix),u_gl_coord_matrix:new t.UniformMatrix4f(e,n.u_gl_coord_matrix),u_is_text:new t.Uniform1f(e,n.u_is_text),u_pitch_with_map:new t.Uniform1i(e,n.u_pitch_with_map),u_texsize:new t.Uniform2f(e,n.u_texsize),u_texture:new t.Uniform1i(e,n.u_texture)}},symbolSDF:function(e,n){return{u_is_size_zoom_constant:new t.Uniform1i(e,n.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,n.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,n.u_size_t),u_size:new t.Uniform1f(e,n.u_size),u_camera_to_center_distance:new t.Uniform1f(e,n.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,n.u_pitch),u_rotate_symbol:new t.Uniform1i(e,n.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,n.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,n.u_fade_change),u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,n.u_label_plane_matrix),u_gl_coord_matrix:new t.UniformMatrix4f(e,n.u_gl_coord_matrix),u_is_text:new t.Uniform1f(e,n.u_is_text),u_pitch_with_map:new t.Uniform1i(e,n.u_pitch_with_map),u_texsize:new t.Uniform2f(e,n.u_texsize),u_texture:new t.Uniform1i(e,n.u_texture),u_gamma_scale:new t.Uniform1f(e,n.u_gamma_scale),u_is_halo:new t.Uniform1f(e,n.u_is_halo)}},background:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_opacity:new t.Uniform1f(e,n.u_opacity),u_color:new t.UniformColor(e,n.u_color)}},backgroundPattern:function(e,n){return{u_matrix:new t.UniformMatrix4f(e,n.u_matrix),u_opacity:new t.Uniform1f(e,n.u_opacity),u_image:new t.Uniform1i(e,n.u_image),u_pattern_tl_a:new t.Uniform2f(e,n.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,n.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,n.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,n.u_pattern_br_b),u_texsize:new t.Uniform2f(e,n.u_texsize),u_mix:new t.Uniform1f(e,n.u_mix),u_pattern_size_a:new t.Uniform2f(e,n.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,n.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,n.u_scale_a),u_scale_b:new t.Uniform1f(e,n.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,n.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,n.u_tile_units_to_pixels)}}};function jn(e,n){for(var i=e.sort(function(t,e){return t.tileID.isLessThan(e.tileID)?-1:e.tileID.isLessThan(t.tileID)?1:0}),r=0;r<i.length;r++){var o={},a=i[r],s=i.slice(r+1);Vn(a.tileID.wrapped(),a.tileID,s,new t.OverscaledTileID(0,a.tileID.wrap+1,0,0,0),o),a.setMask(o,n)}}function Vn(e,n,i,r,o){for(var a=0;a<i.length;a++){var s=i[a];if(r.isLessThan(s.tileID))break;if(n.key===s.tileID.key)return;if(s.tileID.isChildOf(n)){for(var l=n.children(1/0),u=0;u<l.length;u++)Vn(e,l[u],i.slice(a),r,o);return}}var c=n.overscaledZ-e.overscaledZ,p=new t.CanonicalTileID(c,n.canonical.x-(e.canonical.x<<c),n.canonical.y-(e.canonical.y<<c));o[p.key]=o[p.key]||p}function Zn(t,e,n,i,r){for(var o=t.context,a=o.gl,s=r?t.useProgram("collisionCircle"):t.useProgram("collisionBox"),l=0;l<i.length;l++){var u=i[l],c=e.getTile(u),p=c.getBucket(n);if(p){var h=r?p.collisionCircle:p.collisionBox;h&&s.draw(o,r?a.TRIANGLES:a.LINES,bt.disabled,wt.disabled,t.colorModeForRenderPass(),Tt.disabled,bn(u.posMatrix,t.transform,c),n.id,h.layoutVertexBuffer,h.indexBuffer,h.segments,null,t.transform.zoom,null,null,h.collisionVertexBuffer)}}}var qn=t.identity(new Float32Array(16)),Gn=t.properties.layout;function Wn(e,n,i,r,o,a,s,l,u,c,p,h){for(var f,d,m=e.context,y=m.gl,_=e.transform,g="map"===l,v="map"===u,x=g&&"point"!==i.layout.get("symbol-placement"),b=g&&!v&&!x,w=void 0!==i.layout.get("symbol-sort-key").constantOr(1),E=e.depthModeForSublayer(0,bt.ReadOnly),T=[],S=0,P=r;S<P.length;S+=1){var C=P[S],k=n.getTile(C),A=k.getBucket(i);if(A){var z=o?A.text:A.icon;if(z&&z.segments.get().length){var L=z.programConfigurations.get(i.id),M=o||A.sdfIcons,I=o?A.textSizeData:A.iconSizeData;f||(f=e.useProgram(M?"symbolSDF":"symbolIcon",L),d=t.evaluateSizeForZoom(I,_.zoom,Gn.properties[o?"text-size":"icon-size"])),m.activeTexture.set(y.TEXTURE0);var O=void 0,D=void 0,R=void 0;if(o)D=k.glyphAtlasTexture,R=y.LINEAR,O=k.glyphAtlasTexture.size;else{var B=1!==i.layout.get("icon-size").constantOr(0)||A.iconsNeedLinear,F=v||0!==_.pitch;D=k.imageAtlasTexture,R=M||e.options.rotating||e.options.zooming||B||F?y.LINEAR:y.NEAREST,O=k.imageAtlasTexture.size}var N=ae(k,1,e.transform.zoom),U=Gt(C.posMatrix,v,g,e.transform,N),j=Wt(C.posMatrix,v,g,e.transform,N);x&&Kt(A,C.posMatrix,e,o,U,j,v,c);var V=e.translatePosMatrix(C.posMatrix,k,a,s),Z=x?qn:U,q=e.translatePosMatrix(j,k,a,s,!0),G=M&&0!==i.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1),W={program:f,buffers:z,uniformValues:M?Bn(I.functionType,d,b,v,e,V,Z,q,o,O,!0):Rn(I.functionType,d,b,v,e,V,Z,q,o,O),atlasTexture:D,atlasInterpolation:R,isSDF:M,hasHalo:G};if(w)for(var H=0,X=z.segments.get();H<X.length;H+=1){var K=X[H];T.push({segments:new t.SegmentVector([K]),sortKey:K.sortKey,state:W})}else T.push({segments:z.segments,sortKey:0,state:W})}}}w&&T.sort(function(t,e){return t.sortKey-e.sortKey});for(var Y=0,J=T;Y<J.length;Y+=1){var $=J[Y],Q=$.state;if(Q.atlasTexture.bind(Q.atlasInterpolation,y.CLAMP_TO_EDGE),Q.isSDF){var tt=Q.uniformValues;Q.hasHalo&&(tt.u_is_halo=1,Hn(Q.buffers,$.segments,i,e,Q.program,E,p,h,tt)),tt.u_is_halo=0}Hn(Q.buffers,$.segments,i,e,Q.program,E,p,h,Q.uniformValues)}}function Hn(t,e,n,i,r,o,a,s,l){var u=i.context,c=u.gl;r.draw(u,c.TRIANGLES,o,a,s,Tt.disabled,l,n.id,t.layoutVertexBuffer,t.indexBuffer,e,n.paint,i.transform.zoom,t.programConfigurations.get(n.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function Xn(t,e,n,i,r,o,a){var s,l,u,c,p,h=t.context.gl,f=n.paint.get("fill-pattern"),d=f&&f.constantOr(1),m=n.getCrossfadeParameters();a?(l=d&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",s=h.LINES):(l=d?"fillPattern":"fill",s=h.TRIANGLES);for(var y=0,_=i;y<_.length;y+=1){var g=_[y],v=e.getTile(g);if(!d||v.patternsLoaded()){var x=v.getBucket(n);if(x){var b=x.programConfigurations.get(n.id),w=t.useProgram(l,b);d&&(t.context.activeTexture.set(h.TEXTURE0),v.imageAtlasTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),b.updatePatternPaintBuffers(m));var E=f.constantOr(null);if(E&&v.imageAtlas){var T=v.imageAtlas.patternPositions[E.to],S=v.imageAtlas.patternPositions[E.from];T&&S&&b.setConstantPatternPositions(T,S)}var P=t.translatePosMatrix(g.posMatrix,v,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if(a){c=x.indexBuffer2,p=x.segments2;var C=[h.drawingBufferWidth,h.drawingBufferHeight];u="fillOutlinePattern"===l&&d?gn(P,t,m,v,C):_n(P,C)}else c=x.indexBuffer,p=x.segments,u=d?yn(P,t,m,v):mn(P);w.draw(t.context,s,r,t.stencilModeForClipping(g),o,Tt.disabled,u,n.id,x.layoutVertexBuffer,c,p,n.paint,t.transform.zoom,b)}}}}function Kn(e,n){var i=e.context,r=i.gl,o=n.viewportFrame;if(e.depthRboNeedsClear&&e.setupOffscreenDepthRenderbuffer(),!o){var a=new t.Texture(i,{width:e.width,height:e.height,data:null},r.RGBA);a.bind(r.LINEAR,r.CLAMP_TO_EDGE),(o=n.viewportFrame=i.createFramebuffer(e.width,e.height)).colorAttachment.set(a.texture)}i.bindFramebuffer.set(o.framebuffer),o.depthAttachment.set(e.depthRbo),e.depthRboNeedsClear&&(i.clear({depth:1}),e.depthRboNeedsClear=!1),i.clear({color:t.Color.transparent}),i.setStencilMode(wt.disabled),i.setDepthMode(new bt(r.LEQUAL,bt.ReadWrite,[0,1])),i.setColorMode(e.colorModeForRenderPass())}function Yn(t,e,n){var i=e.viewportFrame;if(i){var r=t.context,o=r.gl;r.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,i.colorAttachment.get()),t.useProgram("extrusionTexture").draw(r,o.TRIANGLES,bt.disabled,wt.disabled,t.colorModeForRenderPass(),Tt.disabled,dn(t,n,0),e.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,e.paint,t.transform.zoom)}}function Jn(t,e,n,i,r,o){var a=t.context,s=a.gl,l=e.fbo;if(l){var u=t.useProgram("hillshade");a.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,l.colorAttachment.get());var c=Sn(t,e,n);e.maskedBoundsBuffer&&e.maskedIndexBuffer&&e.segments?u.draw(a,s.TRIANGLES,i,r,o,Tt.disabled,c,n.id,e.maskedBoundsBuffer,e.maskedIndexBuffer,e.segments):u.draw(a,s.TRIANGLES,i,r,o,Tt.disabled,c,n.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}}function $n(e,n,i,r,o,a,s){var l=e.context,u=l.gl;if(n.dem&&n.dem.data){var c=n.dem.dim,p=n.dem.stride,h=n.dem.getPixels();if(l.activeTexture.set(u.TEXTURE1),l.pixelStoreUnpackPremultiplyAlpha.set(!1),n.demTexture=n.demTexture||e.getTileTexture(p),n.demTexture){var f=n.demTexture;f.update(h,{premultiply:!1}),f.bind(u.NEAREST,u.CLAMP_TO_EDGE)}else n.demTexture=new t.Texture(l,h,u.RGBA,{premultiply:!1}),n.demTexture.bind(u.NEAREST,u.CLAMP_TO_EDGE);l.activeTexture.set(u.TEXTURE0);var d=n.fbo;if(!d){var m=new t.Texture(l,{width:c,height:c,data:null},u.RGBA);m.bind(u.LINEAR,u.CLAMP_TO_EDGE),(d=n.fbo=l.createFramebuffer(c,c)).colorAttachment.set(m.texture)}l.bindFramebuffer.set(d.framebuffer),l.viewport.set([0,0,c,c]),e.useProgram("hillshadePrepare").draw(l,u.TRIANGLES,o,a,s,Tt.disabled,Pn(n,r),i.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),n.needsHillshadePrepare=!1}}function Qn(e,n,i,r,o){var a=r.paint.get("raster-fade-duration");if(a>0){var s=t.browser.now(),l=(s-e.timeAdded)/a,u=n?(s-n.timeAdded)/a:-1,c=i.getSource(),p=o.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),h=!n||Math.abs(n.tileID.overscaledZ-p)>Math.abs(e.tileID.overscaledZ-p),f=h&&e.refreshedUponExpiration?1:t.clamp(h?l:1-u,0,1);return e.refreshedUponExpiration&&l>=1&&(e.refreshedUponExpiration=!1),n?{opacity:1,mix:1-f}:{opacity:f,mix:0}}return{opacity:1,mix:0}}function ti(e,n,i){var r=e.context,o=r.gl,a=i.posMatrix,s=e.useProgram("debug"),l=bt.disabled,u=wt.disabled,c=e.colorModeForRenderPass(),p="$debug";s.draw(r,o.LINE_STRIP,l,u,c,Tt.disabled,wn(a,t.Color.red),p,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);for(var h=function(t,e,n,i){i=i||1;var r,o,a,s,l,u,c,p,h=[];for(r=0,o=t.length;r<o;r++)if(l=ei[t[r]]){for(p=null,a=0,s=l[1].length;a<s;a+=2)-1===l[1][a]&&-1===l[1][a+1]?p=null:(u=e+l[1][a]*i,c=200-l[1][a+1]*i,p&&h.push(p.x,p.y,u,c),p={x:u,y:c});e+=l[0]*i}return h}(i.toString(),50,0,5),f=new t.StructArrayLayout2i4,d=new t.StructArrayLayout2ui4,m=0;m<h.length;m+=2)f.emplaceBack(h[m],h[m+1]),d.emplaceBack(m,m+1);for(var y=r.createVertexBuffer(f,Ie.members),_=r.createIndexBuffer(d),g=t.SegmentVector.simpleSegment(0,0,f.length/2,f.length/2),v=n.getTile(i).tileSize,x=t.EXTENT/(Math.pow(2,e.transform.zoom-i.overscaledZ)*v),b=[[-1,-1],[-1,1],[1,-1],[1,1]],w=0;w<b.length;w++){var E=b[w];s.draw(r,o.LINES,l,u,c,Tt.disabled,wn(t.translate([],a,[x*E[0],x*E[1],0]),t.Color.white),p,y,_,g)}s.draw(r,o.LINES,l,u,c,Tt.disabled,wn(a,t.Color.black),p,y,_,g)}var ei={" ":[16,[]],"!":[10,[5,21,5,7,-1,-1,5,2,4,1,5,0,6,1,5,2]],'"':[16,[4,21,4,14,-1,-1,12,21,12,14]],"#":[21,[11,25,4,-7,-1,-1,17,25,10,-7,-1,-1,4,12,18,12,-1,-1,3,6,17,6]],$:[20,[8,25,8,-4,-1,-1,12,25,12,-4,-1,-1,17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],"%":[24,[21,21,3,0,-1,-1,8,21,10,19,10,17,9,15,7,14,5,14,3,16,3,18,4,20,6,21,8,21,10,20,13,19,16,19,19,20,21,21,-1,-1,17,7,15,6,14,4,14,2,16,0,18,0,20,1,21,3,21,5,19,7,17,7]],"&":[26,[23,12,23,13,22,14,21,14,20,13,19,11,17,6,15,3,13,1,11,0,7,0,5,1,4,2,3,4,3,6,4,8,5,9,12,13,13,14,14,16,14,18,13,20,11,21,9,20,8,18,8,16,9,13,11,10,16,3,18,1,20,0,22,0,23,1,23,2]],"'":[10,[5,19,4,20,5,21,6,20,6,18,5,16,4,15]],"(":[14,[11,25,9,23,7,20,5,16,4,11,4,7,5,2,7,-2,9,-5,11,-7]],")":[14,[3,25,5,23,7,20,9,16,10,11,10,7,9,2,7,-2,5,-5,3,-7]],"*":[16,[8,21,8,9,-1,-1,3,18,13,12,-1,-1,13,18,3,12]],"+":[26,[13,18,13,0,-1,-1,4,9,22,9]],",":[10,[6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"-":[26,[4,9,22,9]],".":[10,[5,2,4,1,5,0,6,1,5,2]],"/":[22,[20,25,2,-7]],0:[20,[9,21,6,20,4,17,3,12,3,9,4,4,6,1,9,0,11,0,14,1,16,4,17,9,17,12,16,17,14,20,11,21,9,21]],1:[20,[6,17,8,18,11,21,11,0]],2:[20,[4,16,4,17,5,19,6,20,8,21,12,21,14,20,15,19,16,17,16,15,15,13,13,10,3,0,17,0]],3:[20,[5,21,16,21,10,13,13,13,15,12,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],4:[20,[13,21,3,7,18,7,-1,-1,13,21,13,0]],5:[20,[15,21,5,21,4,12,5,13,8,14,11,14,14,13,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],6:[20,[16,18,15,20,12,21,10,21,7,20,5,17,4,12,4,7,5,3,7,1,10,0,11,0,14,1,16,3,17,6,17,7,16,10,14,12,11,13,10,13,7,12,5,10,4,7]],7:[20,[17,21,7,0,-1,-1,3,21,17,21]],8:[20,[8,21,5,20,4,18,4,16,5,14,7,13,11,12,14,11,16,9,17,7,17,4,16,2,15,1,12,0,8,0,5,1,4,2,3,4,3,7,4,9,6,11,9,12,13,13,15,14,16,16,16,18,15,20,12,21,8,21]],9:[20,[16,14,15,11,13,9,10,8,9,8,6,9,4,11,3,14,3,15,4,18,6,20,9,21,10,21,13,20,15,18,16,14,16,9,15,4,13,1,10,0,8,0,5,1,4,3]],":":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,5,2,4,1,5,0,6,1,5,2]],";":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"<":[24,[20,18,4,9,20,0]],"=":[26,[4,12,22,12,-1,-1,4,6,22,6]],">":[24,[4,18,20,9,4,0]],"?":[18,[3,16,3,17,4,19,5,20,7,21,11,21,13,20,14,19,15,17,15,15,14,13,13,12,9,10,9,7,-1,-1,9,2,8,1,9,0,10,1,9,2]],"@":[27,[18,13,17,15,15,16,12,16,10,15,9,14,8,11,8,8,9,6,11,5,14,5,16,6,17,8,-1,-1,12,16,10,14,9,11,9,8,10,6,11,5,-1,-1,18,16,17,8,17,6,19,5,21,5,23,7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12,21,9,20,7,19,5,17,4,15,3,12,3,9,4,6,5,4,7,2,9,1,12,0,15,0,18,1,20,2,21,3,-1,-1,19,16,18,8,18,6,19,5]],A:[18,[9,21,1,0,-1,-1,9,21,17,0,-1,-1,4,7,14,7]],B:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,-1,-1,4,11,13,11,16,10,17,9,18,7,18,4,17,2,16,1,13,0,4,0]],C:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5]],D:[21,[4,21,4,0,-1,-1,4,21,11,21,14,20,16,18,17,16,18,13,18,8,17,5,16,3,14,1,11,0,4,0]],E:[19,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11,-1,-1,4,0,17,0]],F:[18,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11]],G:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,18,8,-1,-1,13,8,18,8]],H:[22,[4,21,4,0,-1,-1,18,21,18,0,-1,-1,4,11,18,11]],I:[8,[4,21,4,0]],J:[16,[12,21,12,5,11,2,10,1,8,0,6,0,4,1,3,2,2,5,2,7]],K:[21,[4,21,4,0,-1,-1,18,21,4,7,-1,-1,9,12,18,0]],L:[17,[4,21,4,0,-1,-1,4,0,16,0]],M:[24,[4,21,4,0,-1,-1,4,21,12,0,-1,-1,20,21,12,0,-1,-1,20,21,20,0]],N:[22,[4,21,4,0,-1,-1,4,21,18,0,-1,-1,18,21,18,0]],O:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21]],P:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13,10,4,10]],Q:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21,-1,-1,12,4,18,-2]],R:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,4,11,-1,-1,11,11,18,0]],S:[20,[17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],T:[16,[8,21,8,0,-1,-1,1,21,15,21]],U:[22,[4,21,4,6,5,3,7,1,10,0,12,0,15,1,17,3,18,6,18,21]],V:[18,[1,21,9,0,-1,-1,17,21,9,0]],W:[24,[2,21,7,0,-1,-1,12,21,7,0,-1,-1,12,21,17,0,-1,-1,22,21,17,0]],X:[20,[3,21,17,0,-1,-1,17,21,3,0]],Y:[18,[1,21,9,11,9,0,-1,-1,17,21,9,11]],Z:[20,[17,21,3,0,-1,-1,3,21,17,21,-1,-1,3,0,17,0]],"[":[14,[4,25,4,-7,-1,-1,5,25,5,-7,-1,-1,4,25,11,25,-1,-1,4,-7,11,-7]],"\\":[14,[0,21,14,-3]],"]":[14,[9,25,9,-7,-1,-1,10,25,10,-7,-1,-1,3,25,10,25,-1,-1,3,-7,10,-7]],"^":[16,[6,15,8,18,10,15,-1,-1,3,12,8,17,13,12,-1,-1,8,17,8,0]],_:[16,[0,-2,16,-2]],"`":[10,[6,21,5,20,4,18,4,16,5,15,6,16,5,17]],a:[19,[15,14,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],b:[19,[4,21,4,0,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],c:[18,[15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],d:[19,[15,21,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],e:[18,[3,8,15,8,15,10,14,12,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],f:[12,[10,21,8,21,6,20,5,17,5,0,-1,-1,2,14,9,14]],g:[19,[15,14,15,-2,14,-5,13,-6,11,-7,8,-7,6,-6,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],h:[19,[4,21,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],i:[8,[3,21,4,20,5,21,4,22,3,21,-1,-1,4,14,4,0]],j:[10,[5,21,6,20,7,21,6,22,5,21,-1,-1,6,14,6,-3,5,-6,3,-7,1,-7]],k:[17,[4,21,4,0,-1,-1,14,14,4,4,-1,-1,8,8,15,0]],l:[8,[4,21,4,0]],m:[30,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0,-1,-1,15,10,18,13,20,14,23,14,25,13,26,10,26,0]],n:[19,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],o:[19,[8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3,16,6,16,8,15,11,13,13,11,14,8,14]],p:[19,[4,14,4,-7,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],q:[19,[15,14,15,-7,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],r:[13,[4,14,4,0,-1,-1,4,8,5,11,7,13,9,14,12,14]],s:[17,[14,11,13,13,10,14,7,14,4,13,3,11,4,9,6,8,11,7,13,6,14,4,14,3,13,1,10,0,7,0,4,1,3,3]],t:[12,[5,21,5,4,6,1,8,0,10,0,-1,-1,2,14,9,14]],u:[19,[4,14,4,4,5,1,7,0,10,0,12,1,15,4,-1,-1,15,14,15,0]],v:[16,[2,14,8,0,-1,-1,14,14,8,0]],w:[22,[3,14,7,0,-1,-1,11,14,7,0,-1,-1,11,14,15,0,-1,-1,19,14,15,0]],x:[17,[3,14,14,0,-1,-1,14,14,3,0]],y:[16,[2,14,8,0,-1,-1,14,14,8,0,6,-4,4,-6,2,-7,1,-7]],z:[17,[14,14,3,0,-1,-1,3,14,14,14,-1,-1,3,0,14,0]],"{":[14,[9,25,7,24,6,23,5,21,5,19,6,17,7,16,8,14,8,12,6,10,-1,-1,7,24,6,22,6,20,7,18,8,17,9,15,9,13,8,11,4,9,8,7,9,5,9,3,8,1,7,0,6,-2,6,-4,7,-6,-1,-1,6,8,8,6,8,4,7,2,6,1,5,-1,5,-3,6,-5,7,-6,9,-7]],"|":[8,[4,25,4,-7]],"}":[14,[5,25,7,24,8,23,9,21,9,19,8,17,7,16,6,14,6,12,8,10,-1,-1,7,24,8,22,8,20,7,18,6,17,5,15,5,13,6,11,10,9,6,7,5,5,5,3,6,1,7,0,8,-2,8,-4,7,-6,-1,-1,8,8,6,6,6,4,7,2,8,1,9,-1,9,-3,8,-5,7,-6,5,-7]],"~":[24,[3,6,3,8,4,11,6,12,8,12,10,11,14,8,16,7,18,7,20,8,21,10,-1,-1,3,8,4,10,6,11,8,11,10,10,14,7,16,6,18,6,20,7,21,10,21,12]]},ni={symbol:function(t,e,n,i){if("translucent"===t.renderPass){var r=wt.disabled,o=t.colorModeForRenderPass();0!==n.paint.get("icon-opacity").constantOr(1)&&Wn(t,e,n,i,!1,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),n.layout.get("icon-rotation-alignment"),n.layout.get("icon-pitch-alignment"),n.layout.get("icon-keep-upright"),r,o),0!==n.paint.get("text-opacity").constantOr(1)&&Wn(t,e,n,i,!0,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),n.layout.get("text-keep-upright"),r,o),e.map.showCollisionBoxes&&function(t,e,n,i){Zn(t,e,n,i,!1),Zn(t,e,n,i,!0)}(t,e,n,i)}},circle:function(t,e,n,i){if("translucent"===t.renderPass){var r=n.paint.get("circle-opacity"),o=n.paint.get("circle-stroke-width"),a=n.paint.get("circle-stroke-opacity");if(0!==r.constantOr(1)||0!==o.constantOr(1)&&0!==a.constantOr(1))for(var s=t.context,l=s.gl,u=t.depthModeForSublayer(0,bt.ReadOnly),c=wt.disabled,p=t.colorModeForRenderPass(),h=0;h<i.length;h++){var f=i[h],d=e.getTile(f),m=d.getBucket(n);if(m){var y=m.programConfigurations.get(n.id);t.useProgram("circle",y).draw(s,l.TRIANGLES,u,c,p,Tt.disabled,vn(t,f,d,n),n.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,n.paint,t.transform.zoom,y)}}}},heatmap:function(e,n,i,r){if(0!==i.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){var o=e.context,a=o.gl,s=e.depthModeForSublayer(0,bt.ReadOnly),l=wt.disabled,u=new Et([a.ONE,a.ONE],t.Color.transparent,[!0,!0,!0,!0]);!function(t,e,n){var i=t.gl;t.activeTexture.set(i.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);var r=n.heatmapFbo;if(r)i.bindTexture(i.TEXTURE_2D,r.colorAttachment.get()),t.bindFramebuffer.set(r.framebuffer);else{var o=i.createTexture();i.bindTexture(i.TEXTURE_2D,o),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),r=n.heatmapFbo=t.createFramebuffer(e.width/4,e.height/4),function t(e,n,i,r){var o=e.gl;o.texImage2D(o.TEXTURE_2D,0,o.RGBA,n.width/4,n.height/4,0,o.RGBA,e.extTextureHalfFloat?e.extTextureHalfFloat.HALF_FLOAT_OES:o.UNSIGNED_BYTE,null),r.colorAttachment.set(i),e.extTextureHalfFloat&&o.checkFramebufferStatus(o.FRAMEBUFFER)!==o.FRAMEBUFFER_COMPLETE&&(e.extTextureHalfFloat=null,r.colorAttachment.setDirty(),t(e,n,i,r))}(t,e,o,r)}}(o,e,i),o.clear({color:t.Color.transparent});for(var c=0;c<r.length;c++){var p=r[c];if(!n.hasRenderableParent(p)){var h=n.getTile(p),f=h.getBucket(i);if(f){var d=f.programConfigurations.get(i.id),m=e.useProgram("heatmap",d),y=e.transform.zoom;m.draw(o,a.TRIANGLES,s,l,u,Tt.disabled,Tn(p.posMatrix,h,y,i.paint.get("heatmap-intensity")),i.id,f.layoutVertexBuffer,f.indexBuffer,f.segments,i.paint,e.transform.zoom,d)}}}o.viewport.set([0,0,e.width,e.height])}else"translucent"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),function(e,n){var i=e.context,r=i.gl,o=n.heatmapFbo;if(o){i.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,o.colorAttachment.get()),i.activeTexture.set(r.TEXTURE1);var a=n.colorRampTexture;a||(a=n.colorRampTexture=new t.Texture(i,n.colorRamp,r.RGBA)),a.bind(r.LINEAR,r.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(i,r.TRIANGLES,bt.disabled,wt.disabled,e.colorModeForRenderPass(),Tt.disabled,function(e,n,i,r){var o=t.create$1();t.ortho(o,0,e.width,e.height,0,0,1);var a=e.context.gl;return{u_matrix:o,u_world:[a.drawingBufferWidth,a.drawingBufferHeight],u_image:i,u_color_ramp:r,u_opacity:n.paint.get("heatmap-opacity")}}(e,n,0,1),n.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,n.paint,e.transform.zoom)}}(e,i))},line:function(e,n,i,r){if("translucent"===e.renderPass){var o=i.paint.get("line-opacity"),a=i.paint.get("line-width");if(0!==o.constantOr(1)&&0!==a.constantOr(1)){var s=e.depthModeForSublayer(0,bt.ReadOnly),l=e.colorModeForRenderPass(),u=i.paint.get("line-dasharray"),c=i.paint.get("line-pattern"),p=c.constantOr(1),h=i.paint.get("line-gradient"),f=i.getCrossfadeParameters(),d=u?"lineSDF":p?"linePattern":h?"lineGradient":"line",m=e.context,y=m.gl,_=!0;if(h){m.activeTexture.set(y.TEXTURE0);var g=i.gradientTexture;if(!i.gradient)return;g||(g=i.gradientTexture=new t.Texture(m,i.gradient,y.RGBA)),g.bind(y.LINEAR,y.CLAMP_TO_EDGE)}for(var v=0,x=r;v<x.length;v+=1){var b=x[v],w=n.getTile(b);if(!p||w.patternsLoaded()){var E=w.getBucket(i);if(E){var T=E.programConfigurations.get(i.id),S=e.context.program.get(),P=e.useProgram(d,T),C=_||P.program!==S,k=c.constantOr(null);if(k&&w.imageAtlas){var A=w.imageAtlas.patternPositions[k.to],z=w.imageAtlas.patternPositions[k.from];A&&z&&T.setConstantPatternPositions(A,z)}var L=u?Ln(e,w,i,u,f):p?zn(e,w,i,f):h?An(e,w,i):kn(e,w,i);u&&(C||e.lineAtlas.dirty)?(m.activeTexture.set(y.TEXTURE0),e.lineAtlas.bind(m)):p&&(m.activeTexture.set(y.TEXTURE0),w.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),T.updatePatternPaintBuffers(f)),P.draw(m,y.TRIANGLES,s,e.stencilModeForClipping(b),l,Tt.disabled,L,i.id,E.layoutVertexBuffer,E.indexBuffer,E.segments,i.paint,e.transform.zoom,T),_=!1}}}}}},fill:function(e,n,i,r){var o=i.paint.get("fill-color"),a=i.paint.get("fill-opacity");if(0!==a.constantOr(1)){var s=e.colorModeForRenderPass(),l=i.paint.get("fill-pattern").constantOr(1)||1!==o.constantOr(t.Color.transparent).a||1!==a.constantOr(0)?"translucent":"opaque";if(e.renderPass===l){var u=e.depthModeForSublayer(1,"opaque"===e.renderPass?bt.ReadWrite:bt.ReadOnly);Xn(e,n,i,r,u,s,!1)}if("translucent"===e.renderPass&&i.paint.get("fill-antialias")){var c=e.depthModeForSublayer(i.getPaintProperty("fill-outline-color")?2:0,bt.ReadOnly);Xn(e,n,i,r,c,s,!0)}}},"fill-extrusion":function(t,e,n,i){if(0!==n.paint.get("fill-extrusion-opacity"))if("offscreen"===t.renderPass){Kn(t,n);var r=new bt(t.context.gl.LEQUAL,bt.ReadWrite,[0,1]),o=wt.disabled,a=t.colorModeForRenderPass();!function(t,e,n,i,r,o,a){for(var s=t.context,l=s.gl,u=n.paint.get("fill-extrusion-pattern"),c=u.constantOr(1),p=n.getCrossfadeParameters(),h=0,f=i;h<f.length;h+=1){var d=f[h],m=e.getTile(d),y=m.getBucket(n);if(y){var _=y.programConfigurations.get(n.id),g=t.useProgram(c?"fillExtrusionPattern":"fillExtrusion",_);c&&(t.context.activeTexture.set(l.TEXTURE0),m.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),_.updatePatternPaintBuffers(p));var v=u.constantOr(null);if(v&&m.imageAtlas){var x=m.imageAtlas.patternPositions[v.to],b=m.imageAtlas.patternPositions[v.from];x&&b&&_.setConstantPatternPositions(x,b)}var w=t.translatePosMatrix(d.posMatrix,m,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),E=n.paint.get("fill-extrusion-vertical-gradient"),T=c?fn(w,t,E,d,p,m):hn(w,t,E);g.draw(s,s.gl.TRIANGLES,r,o,a,Tt.backCCW,T,n.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,n.paint,t.transform.zoom,_)}}}(t,e,n,i,r,o,a)}else"translucent"===t.renderPass&&Yn(t,n,n.paint.get("fill-extrusion-opacity"))},hillshade:function(t,e,n,i){if("offscreen"===t.renderPass||"translucent"===t.renderPass){for(var r=t.context,o=e.getSource().maxzoom,a=t.depthModeForSublayer(0,bt.ReadOnly),s=wt.disabled,l=t.colorModeForRenderPass(),u=0,c=i;u<c.length;u+=1){var p=c[u],h=e.getTile(p);h.needsHillshadePrepare&&"offscreen"===t.renderPass?$n(t,h,n,o,a,s,l):"translucent"===t.renderPass&&Jn(t,h,n,a,s,l)}r.viewport.set([0,0,t.width,t.height])}},raster:function(t,e,n,i){if("translucent"===t.renderPass&&0!==n.paint.get("raster-opacity"))for(var r=t.context,o=r.gl,a=e.getSource(),s=t.useProgram("raster"),l=wt.disabled,u=t.colorModeForRenderPass(),c=i.length&&i[0].overscaledZ,p=!t.options.moving,h=0,f=i;h<f.length;h+=1){var d=f[h],m=t.depthModeForSublayer(d.overscaledZ-c,1===n.paint.get("raster-opacity")?bt.ReadWrite:bt.ReadOnly,o.LESS),y=e.getTile(d),_=t.transform.calculatePosMatrix(d.toUnwrapped(),p);y.registerFadeDuration(n.paint.get("raster-fade-duration"));var g=e.findLoadedParent(d,0),v=Qn(y,g,e,n,t.transform),x=void 0,b=void 0,w="nearest"===n.paint.get("raster-resampling")?o.NEAREST:o.LINEAR;r.activeTexture.set(o.TEXTURE0),y.texture.bind(w,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),r.activeTexture.set(o.TEXTURE1),g?(g.texture.bind(w,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),x=Math.pow(2,g.tileID.overscaledZ-y.tileID.overscaledZ),b=[y.tileID.canonical.x*x%1,y.tileID.canonical.y*x%1]):y.texture.bind(w,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST);var E=On(_,b||[0,0],x||1,v,n);a instanceof A?s.draw(r,o.TRIANGLES,m,l,u,Tt.disabled,E,n.id,a.boundsBuffer,t.quadTriangleIndexBuffer,a.boundsSegments):y.maskedBoundsBuffer&&y.maskedIndexBuffer&&y.segments?s.draw(r,o.TRIANGLES,m,l,u,Tt.disabled,E,n.id,y.maskedBoundsBuffer,y.maskedIndexBuffer,y.segments,n.paint,t.transform.zoom):s.draw(r,o.TRIANGLES,m,l,u,Tt.disabled,E,n.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments)}},background:function(t,e,n){var i=n.paint.get("background-color"),r=n.paint.get("background-opacity");if(0!==r){var o=t.context,a=o.gl,s=t.transform,l=s.tileSize,u=n.paint.get("background-pattern");if(!t.isPatternMissing(u)){var c=u||1!==i.a||1!==r?"translucent":"opaque";if(t.renderPass===c){var p=wt.disabled,h=t.depthModeForSublayer(0,"opaque"===c?bt.ReadWrite:bt.ReadOnly),f=t.colorModeForRenderPass(),d=t.useProgram(u?"backgroundPattern":"background"),m=s.coveringTiles({tileSize:l});u&&(o.activeTexture.set(a.TEXTURE0),t.imageManager.bind(t.context));for(var y=n.getCrossfadeParameters(),_=0,g=m;_<g.length;_+=1){var v=g[_],x=t.transform.calculatePosMatrix(v.toUnwrapped()),b=u?Nn(x,r,t,u,{tileID:v,tileSize:l},y):Fn(x,r,i);d.draw(o,a.TRIANGLES,h,p,f,Tt.disabled,b,n.id,t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments)}}}}},debug:function(t,e,n){for(var i=0;i<n.length;i++)ti(t,e,n[i])},custom:function(t,e,n){var i=t.context,r=n.implementation;if("offscreen"===t.renderPass){var o=r.prerender;o&&(t.setCustomLayerDefaults(),o.call(r,i.gl,t.transform.customLayerMatrix()),i.setDirty(),t.setBaseState()),"3d"===r.renderingMode&&(t.setCustomLayerDefaults(),Kn(t,n),r.render(i.gl,t.transform.customLayerMatrix()),i.setDirty(),t.setBaseState())}else if("translucent"===t.renderPass)if("3d"===r.renderingMode)Yn(t,n,1);else{t.setCustomLayerDefaults(),i.setColorMode(t.colorModeForRenderPass()),i.setStencilMode(wt.disabled);var a=t.depthModeForSublayer(0,bt.ReadOnly);i.setDepthMode(a),r.render(i.gl,t.transform.customLayerMatrix()),i.setDirty(),t.setBaseState(),i.bindFramebuffer.set(null)}}},ii=function(e,n){this.context=new St(e),this.transform=n,this._tileTextures={},this.setup(),this.numSublayers=Pt.maxUnderzooming+Pt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.depthRboNeedsClear=!0,this.emptyProgramConfiguration=new t.ProgramConfiguration,this.crossTileSymbolIndex=new ke};function ri(t,e){if(t.y>e.y){var n=t;t=e,e=n}return{x0:t.x,y0:t.y,x1:e.x,y1:e.y,dx:e.x-t.x,dy:e.y-t.y}}function oi(t,e,n,i,r){var o=Math.max(n,Math.floor(e.y0)),a=Math.min(i,Math.ceil(e.y1));if(t.x0===e.x0&&t.y0===e.y0?t.x0+e.dy/t.dy*t.dx<e.x1:t.x1-e.dy/t.dy*t.dx<e.x0){var s=t;t=e,e=s}for(var l=t.dx/t.dy,u=e.dx/e.dy,c=t.dx>0,p=e.dx<0,h=o;h<a;h++){var f=l*Math.max(0,Math.min(t.dy,h+c-t.y0))+t.x0,d=u*Math.max(0,Math.min(e.dy,h+p-e.y0))+e.x0;r(Math.floor(d),Math.ceil(f),h)}}function ai(t,e,n,i,r,o){var a,s=ri(t,e),l=ri(e,n),u=ri(n,t);s.dy>l.dy&&(a=s,s=l,l=a),s.dy>u.dy&&(a=s,s=u,u=a),l.dy>u.dy&&(a=l,l=u,u=a),s.dy&&oi(u,s,i,r,o),l.dy&&oi(u,l,i,r,o)}ii.prototype.resize=function(e,n){var i=this.context.gl;if(this.width=e*t.browser.devicePixelRatio,this.height=n*t.browser.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(var r=0,o=this.style._order;r<o.length;r+=1){var a=o[r];this.style._layers[a].resize()}this.depthRbo&&(i.deleteRenderbuffer(this.depthRbo),this.depthRbo=null)},ii.prototype.setup=function(){var e=this.context,n=new t.StructArrayLayout2i4;n.emplaceBack(0,0),n.emplaceBack(t.EXTENT,0),n.emplaceBack(0,t.EXTENT),n.emplaceBack(t.EXTENT,t.EXTENT),this.tileExtentBuffer=e.createVertexBuffer(n,Ie.members),this.tileExtentSegments=t.SegmentVector.simpleSegment(0,0,4,2);var i=new t.StructArrayLayout2i4;i.emplaceBack(0,0),i.emplaceBack(t.EXTENT,0),i.emplaceBack(0,t.EXTENT),i.emplaceBack(t.EXTENT,t.EXTENT),this.debugBuffer=e.createVertexBuffer(i,Ie.members),this.debugSegments=t.SegmentVector.simpleSegment(0,0,4,5);var r=new t.StructArrayLayout4i8;r.emplaceBack(0,0,0,0),r.emplaceBack(t.EXTENT,0,t.EXTENT,0),r.emplaceBack(0,t.EXTENT,0,t.EXTENT),r.emplaceBack(t.EXTENT,t.EXTENT,t.EXTENT,t.EXTENT),this.rasterBoundsBuffer=e.createVertexBuffer(r,t.rasterBoundsAttributes.members),this.rasterBoundsSegments=t.SegmentVector.simpleSegment(0,0,4,2);var o=new t.StructArrayLayout2i4;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(o,Ie.members),this.viewportSegments=t.SegmentVector.simpleSegment(0,0,4,2);var a=new t.StructArrayLayout1ui2;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(a);var s=new t.StructArrayLayout3ui6;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s);var l=this.context.gl;this.stencilClearMode=new wt({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO)},ii.prototype.clearStencil=function(){var e=this.context,n=e.gl,i=t.create$1();t.ortho(i,0,this.width,this.height,0,0,1),t.scale(i,i,[n.drawingBufferWidth,n.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,n.TRIANGLES,bt.disabled,this.stencilClearMode,Et.disabled,Tt.disabled,En(i),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)},ii.prototype._renderTileClippingMasks=function(t){var e=this.context,n=e.gl;e.setColorMode(Et.disabled),e.setDepthMode(bt.disabled);var i=this.useProgram("clippingMask"),r=1;this._tileClippingMaskIDs={};for(var o=0,a=t;o<a.length;o+=1){var s=a[o],l=this._tileClippingMaskIDs[s.key]=r++;i.draw(e,n.TRIANGLES,bt.disabled,new wt({func:n.ALWAYS,mask:0},l,255,n.KEEP,n.KEEP,n.REPLACE),Et.disabled,Tt.disabled,En(s.posMatrix),"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}},ii.prototype.stencilModeForClipping=function(t){var e=this.context.gl;return new wt({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)},ii.prototype.colorModeForRenderPass=function(){var e=this.context.gl;return this._showOverdrawInspector?new Et([e.CONSTANT_COLOR,e.ONE],new t.Color(1/8,1/8,1/8,0),[!0,!0,!0,!0]):"opaque"===this.renderPass?Et.unblended:Et.alphaBlended},ii.prototype.depthModeForSublayer=function(t,e,n){var i=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new bt(n||this.context.gl.LEQUAL,e,[i,i])},ii.prototype.render=function(e,n){this.style=e,this.options=n,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(t.browser.now());var i=this.style._order,r=this.style.sourceCaches;for(var o in r){var a=r[o];a.used&&a.prepare(this.context)}var s,l={},u={},c={};for(var p in r){var h=r[p];l[p]=h.getVisibleCoordinates(),u[p]=l[p].slice().reverse(),c[p]=h.getVisibleCoordinates(!0).reverse()}for(var f in r){var d=r[f],m=d.getSource();if("raster"===m.type||"raster-dem"===m.type){for(var y=[],_=0,g=l[f];_<g.length;_+=1){var v=g[_];y.push(d.getTile(v))}jn(y,this.context)}}this.renderPass="offscreen",this.depthRboNeedsClear=!0;for(var x=0,b=i;x<b.length;x+=1){var w=b[x],E=this.style._layers[w];if(E.hasOffscreenPass()&&!E.isHidden(this.transform.zoom)){var T=u[E.source];("custom"===E.type||T.length)&&this.renderLayer(this,r[E.source],E,T)}}for(this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?t.Color.black:t.Color.transparent,depth:1}),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRange=(e._order.length+2)*this.numSublayers*this.depthEpsilon,this.renderPass="opaque",this.currentLayer=i.length-1;this.currentLayer>=0;this.currentLayer--){var S=this.style._layers[i[this.currentLayer]],P=r[S.source],C=l[S.source];S.source!==s&&P&&(this.clearStencil(),P.getSource().isTileClipped&&this._renderTileClippingMasks(C)),this.renderLayer(this,P,S,C),s=S.source}for(this.renderPass="translucent",this.currentLayer=0,s=null;this.currentLayer<i.length;this.currentLayer++){var k=this.style._layers[i[this.currentLayer]],A=r[k.source],z=("symbol"===k.type?c:u)[k.source];k.source!==s&&A&&(this.clearStencil(),A.getSource().isTileClipped&&this._renderTileClippingMasks(l[k.source])),this.renderLayer(this,A,k,z),s=k.source}if(this.options.showTileBoundaries)for(var L in r){ni.debug(this,r[L],l[L]);break}this.setCustomLayerDefaults()},ii.prototype.setupOffscreenDepthRenderbuffer=function(){var t=this.context;this.depthRbo||(this.depthRbo=t.createRenderbuffer(t.gl.DEPTH_COMPONENT16,this.width,this.height))},ii.prototype.renderLayer=function(t,e,n,i){n.isHidden(this.transform.zoom)||("background"===n.type||"custom"===n.type||i.length)&&(this.id=n.id,ni[n.type](t,e,n,i))},ii.prototype.translatePosMatrix=function(e,n,i,r,o){if(!i[0]&&!i[1])return e;var a=o?"map"===r?this.transform.angle:0:"viewport"===r?-this.transform.angle:0;if(a){var s=Math.sin(a),l=Math.cos(a);i=[i[0]*l-i[1]*s,i[0]*s+i[1]*l]}var u=[o?i[0]:ae(n,i[0],this.transform.zoom),o?i[1]:ae(n,i[1],this.transform.zoom),0],c=new Float32Array(16);return t.translate(c,e,u),c},ii.prototype.saveTileTexture=function(t){var e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]},ii.prototype.getTileTexture=function(t){var e=this._tileTextures[t];return e&&e.length>0?e.pop():null},ii.prototype.isPatternMissing=function(t){if(!t)return!1;var e=this.imageManager.getPattern(t.from),n=this.imageManager.getPattern(t.to);return!e||!n},ii.prototype.useProgram=function(t,e){void 0===e&&(e=this.emptyProgramConfiguration),this.cache=this.cache||{};var n=""+t+(e.cacheKey||"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[n]||(this.cache[n]=new cn(this.context,ln[t],e,Un[t],this._showOverdrawInspector)),this.cache[n]},ii.prototype.setCustomLayerDefaults=function(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()},ii.prototype.setBaseState=function(){var t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)};var si=function(e,n,i){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===i||i,this._minZoom=e||0,this._maxZoom=n||22,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._posMatrixCache={},this._alignedPosMatrixCache={}},li={minZoom:{configurable:!0},maxZoom:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerPoint:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},unmodified:{configurable:!0},point:{configurable:!0}};si.prototype.clone=function(){var t=new si(this._minZoom,this._maxZoom,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._calcMatrices(),t},li.minZoom.get=function(){return this._minZoom},li.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},li.maxZoom.get=function(){return this._maxZoom},li.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},li.renderWorldCopies.get=function(){return this._renderWorldCopies},li.renderWorldCopies.set=function(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t},li.worldSize.get=function(){return this.tileSize*this.scale},li.centerPoint.get=function(){return this.size._div(2)},li.size.get=function(){return new t.Point(this.width,this.height)},li.bearing.get=function(){return-this.angle/Math.PI*180},li.bearing.set=function(e){var n=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=t.create$2(),t.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},li.pitch.get=function(){return this._pitch/Math.PI*180},li.pitch.set=function(e){var n=t.clamp(e,0,60)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())},li.fov.get=function(){return this._fov/Math.PI*180},li.fov.set=function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())},li.zoom.get=function(){return this._zoom},li.zoom.set=function(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices())},li.center.get=function(){return this._center},li.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())},si.prototype.coveringZoomLevel=function(t){return(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize))},si.prototype.getVisibleUnwrappedCoordinates=function(e){var n=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies)for(var i=this.pointCoordinate(new t.Point(0,0)),r=this.pointCoordinate(new t.Point(this.width,0)),o=this.pointCoordinate(new t.Point(this.width,this.height)),a=this.pointCoordinate(new t.Point(0,this.height)),s=Math.floor(Math.min(i.x,r.x,o.x,a.x)),l=Math.floor(Math.max(i.x,r.x,o.x,a.x)),u=s-1;u<=l+1;u++)0!==u&&n.push(new t.UnwrappedTileID(u,e));return n},si.prototype.coveringTiles=function(e){var n=this.coveringZoomLevel(e),i=n;if(void 0!==e.minzoom&&n<e.minzoom)return[];void 0!==e.maxzoom&&n>e.maxzoom&&(n=e.maxzoom);var r=t.MercatorCoordinate.fromLngLat(this.center),o=Math.pow(2,n),a=new t.Point(o*r.x-.5,o*r.y-.5);return function(e,n,i,r){void 0===r&&(r=!0);var o=1<<e,a={};function s(n,s,l){var u,c,p,h;if(l>=0&&l<=o)for(u=n;u<s;u++)c=Math.floor(u/o),p=(u%o+o)%o,0!==c&&!0!==r||(h=new t.OverscaledTileID(i,c,e,p,l),a[h.key]=h)}var l=n.map(function(e){return new t.Point(e.x,e.y)._mult(o)});return ai(l[0],l[1],l[2],0,o,s),ai(l[2],l[3],l[0],0,o,s),Object.keys(a).map(function(t){return a[t]})}(n,[this.pointCoordinate(new t.Point(0,0)),this.pointCoordinate(new t.Point(this.width,0)),this.pointCoordinate(new t.Point(this.width,this.height)),this.pointCoordinate(new t.Point(0,this.height))],e.reparseOverscaled?i:n,this._renderWorldCopies).sort(function(t,e){return a.dist(t.canonical)-a.dist(e.canonical)})},si.prototype.resize=function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()},li.unmodified.get=function(){return this._unmodified},si.prototype.zoomScale=function(t){return Math.pow(2,t)},si.prototype.scaleZoom=function(t){return Math.log(t)/Math.LN2},si.prototype.project=function(e){var n=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.Point(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(n)*this.worldSize)},si.prototype.unproject=function(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()},li.point.get=function(){return this.project(this.center)},si.prototype.setLocationAtPoint=function(e,n){var i=this.pointCoordinate(n),r=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(e),a=new t.MercatorCoordinate(o.x-(i.x-r.x),o.y-(i.y-r.y));this.center=this.coordinateLocation(a),this._renderWorldCopies&&(this.center=this.center.wrap())},si.prototype.locationPoint=function(t){return this.coordinatePoint(this.locationCoordinate(t))},si.prototype.pointLocation=function(t){return this.coordinateLocation(this.pointCoordinate(t))},si.prototype.locationCoordinate=function(e){return t.MercatorCoordinate.fromLngLat(e)},si.prototype.coordinateLocation=function(t){return t.toLngLat()},si.prototype.pointCoordinate=function(e){var n=[e.x,e.y,0,1],i=[e.x,e.y,1,1];t.transformMat4(n,n,this.pixelMatrixInverse),t.transformMat4(i,i,this.pixelMatrixInverse);var r=n[3],o=i[3],a=n[0]/r,s=i[0]/o,l=n[1]/r,u=i[1]/o,c=n[2]/r,p=i[2]/o,h=c===p?0:(0-c)/(p-c);return new t.MercatorCoordinate(t.number(a,s,h)/this.worldSize,t.number(l,u,h)/this.worldSize)},si.prototype.coordinatePoint=function(e){var n=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(n,n,this.pixelMatrix),new t.Point(n[0]/n[3],n[1]/n[3])},si.prototype.getBounds=function(){return(new t.LngLatBounds).extend(this.pointLocation(new t.Point(0,0))).extend(this.pointLocation(new t.Point(this.width,0))).extend(this.pointLocation(new t.Point(this.width,this.height))).extend(this.pointLocation(new t.Point(0,this.height)))},si.prototype.getMaxBounds=function(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new t.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null},si.prototype.setMaxBounds=function(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])},si.prototype.calculatePosMatrix=function(e,n){void 0===n&&(n=!1);var i=e.key,r=n?this._alignedPosMatrixCache:this._posMatrixCache;if(r[i])return r[i];var o=e.canonical,a=this.worldSize/this.zoomScale(o.z),s=o.x+Math.pow(2,o.z)*e.wrap,l=t.identity(new Float64Array(16));return t.translate(l,l,[s*a,o.y*a,0]),t.scale(l,l,[a/t.EXTENT,a/t.EXTENT,1]),t.multiply(l,n?this.alignedProjMatrix:this.projMatrix,l),r[i]=new Float32Array(l),r[i]},si.prototype.customLayerMatrix=function(){return this.mercatorMatrix.slice()},si.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var e,n,i,r,o=-90,a=90,s=-180,l=180,u=this.size,c=this._unmodified;if(this.latRange){var p=this.latRange;o=t.mercatorYfromLat(p[1])*this.worldSize,e=(a=t.mercatorYfromLat(p[0])*this.worldSize)-o<u.y?u.y/(a-o):0}if(this.lngRange){var h=this.lngRange;s=t.mercatorXfromLng(h[0])*this.worldSize,n=(l=t.mercatorXfromLng(h[1])*this.worldSize)-s<u.x?u.x/(l-s):0}var f=this.point,d=Math.max(n||0,e||0);if(d)return this.center=this.unproject(new t.Point(n?(l+s)/2:f.x,e?(a+o)/2:f.y)),this.zoom+=this.scaleZoom(d),this._unmodified=c,void(this._constraining=!1);if(this.latRange){var m=f.y,y=u.y/2;m-y<o&&(r=o+y),m+y>a&&(r=a-y)}if(this.lngRange){var _=f.x,g=u.x/2;_-g<s&&(i=s+g),_+g>l&&(i=l-g)}void 0===i&&void 0===r||(this.center=this.unproject(new t.Point(void 0!==i?i:f.x,void 0!==r?r:f.y))),this._unmodified=c,this._constraining=!1}},si.prototype._calcMatrices=function(){if(this.height){this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var e=this._fov/2,n=Math.PI/2+this._pitch,i=Math.sin(e)*this.cameraToCenterDistance/Math.sin(Math.PI-n-e),r=this.point,o=r.x,a=r.y,s=1.01*(Math.cos(Math.PI/2-this._pitch)*i+this.cameraToCenterDistance),l=new Float64Array(16);t.perspective(l,this._fov,this.width/this.height,1,s),t.scale(l,l,[1,-1,1]),t.translate(l,l,[0,0,-this.cameraToCenterDistance]),t.rotateX(l,l,this._pitch),t.rotateZ(l,l,this.angle),t.translate(l,l,[-o,-a,0]),this.mercatorMatrix=t.scale([],l,[this.worldSize,this.worldSize,this.worldSize]),t.scale(l,l,[1,1,t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize,1]),this.projMatrix=l;var u=this.width%2/2,c=this.height%2/2,p=Math.cos(this.angle),h=Math.sin(this.angle),f=o-Math.round(o)+p*u+h*c,d=a-Math.round(a)+p*c+h*u,m=new Float64Array(l);if(t.translate(m,m,[f>.5?f-1:f,d>.5?d-1:d,0]),this.alignedProjMatrix=m,l=t.create$1(),t.scale(l,l,[this.width/2,-this.height/2,1]),t.translate(l,l,[1,-1,0]),this.pixelMatrix=t.multiply(new Float64Array(16),l,this.projMatrix),!(l=t.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=l,this._posMatrixCache={},this._alignedPosMatrixCache={}}},si.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var e=this.pointCoordinate(new t.Point(0,0)),n=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(n,n,this.pixelMatrix)[3]/this.cameraToCenterDistance},si.prototype.getCameraPoint=function(){var e=this._pitch,n=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.Point(0,n))},si.prototype.getCameraQueryGeometry=function(e){var n=this.getCameraPoint();if(1===e.length)return[e[0],n];for(var i=n.x,r=n.y,o=n.x,a=n.y,s=0,l=e;s<l.length;s+=1){var u=l[s];i=Math.min(i,u.x),r=Math.min(r,u.y),o=Math.max(o,u.x),a=Math.max(a,u.y)}return[new t.Point(i,r),new t.Point(o,r),new t.Point(o,a),new t.Point(i,a),new t.Point(i,r)]},Object.defineProperties(si.prototype,li);var ui=function(){var e,n,i,r;t.bindAll(["_onHashChange","_updateHash"],this),this._updateHash=(e=this._updateHashUnthrottled.bind(this),n=!1,i=0,r=function(){i=0,n&&(e(),i=setTimeout(r,300),n=!1)},function(){return n=!0,i||r(),i})};ui.prototype.addTo=function(e){return this._map=e,t.window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},ui.prototype.remove=function(){return t.window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this},ui.prototype.getHashString=function(t){var e=this._map.getCenter(),n=Math.round(100*this._map.getZoom())/100,i=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),r=Math.pow(10,i),o=Math.round(e.lng*r)/r,a=Math.round(e.lat*r)/r,s=this._map.getBearing(),l=this._map.getPitch(),u="";return u+=t?"#/"+o+"/"+a+"/"+n:"#"+n+"/"+a+"/"+o,(s||l)&&(u+="/"+Math.round(10*s)/10),l&&(u+="/"+Math.round(l)),u},ui.prototype._onHashChange=function(){var e=t.window.location.hash.replace("#","").split("/");return e.length>=3&&(this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:+(e[3]||0),pitch:+(e[4]||0)}),!0)},ui.prototype._updateHashUnthrottled=function(){var e=this.getHashString();try{t.window.history.replaceState(t.window.history.state,"",e)}catch(t){}};var ci=function(e){function i(i,r,o,a){void 0===a&&(a={});var s=n.mousePos(r.getCanvasContainer(),o),l=r.unproject(s);e.call(this,i,t.extend({point:s,lngLat:l,originalEvent:o},a)),this._defaultPrevented=!1,this.target=r}e&&(i.__proto__=e),i.prototype=Object.create(e&&e.prototype),i.prototype.constructor=i;var r={defaultPrevented:{configurable:!0}};return i.prototype.preventDefault=function(){this._defaultPrevented=!0},r.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(i.prototype,r),i}(t.Event),pi=function(e){function i(i,r,o){var a=n.touchPos(r.getCanvasContainer(),o),s=a.map(function(t){return r.unproject(t)}),l=a.reduce(function(t,e,n,i){return t.add(e.div(i.length))},new t.Point(0,0)),u=r.unproject(l);e.call(this,i,{points:a,point:l,lngLats:s,lngLat:u,originalEvent:o}),this._defaultPrevented=!1}e&&(i.__proto__=e),i.prototype=Object.create(e&&e.prototype),i.prototype.constructor=i;var r={defaultPrevented:{configurable:!0}};return i.prototype.preventDefault=function(){this._defaultPrevented=!0},r.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(i.prototype,r),i}(t.Event),hi=function(t){function e(e,n,i){t.call(this,e,{originalEvent:i}),this._defaultPrevented=!1}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={defaultPrevented:{configurable:!0}};return e.prototype.preventDefault=function(){this._defaultPrevented=!0},n.defaultPrevented.get=function(){return this._defaultPrevented},Object.defineProperties(e.prototype,n),e}(t.Event),fi=function(e){this._map=e,this._el=e.getCanvasContainer(),this._delta=0,t.bindAll(["_onWheel","_onTimeout","_onScrollFrame","_onScrollFinished"],this)};fi.prototype.isEnabled=function(){return!!this._enabled},fi.prototype.isActive=function(){return!!this._active},fi.prototype.isZooming=function(){return!!this._zooming},fi.prototype.enable=function(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},fi.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},fi.prototype.onWheel=function(e){if(this.isEnabled()){var n=e.deltaMode===t.window.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,i=t.browser.now(),r=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==n&&n%4.000244140625==0?this._type="wheel":0!==n&&Math.abs(n)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(r*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),e.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=e,this._delta-=n,this.isActive()||this._start(e)),e.preventDefault()}},fi.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this.isActive()||this._start(t)},fi.prototype._start=function(e){if(this._delta){this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),this._active=!0,this._zooming=!0,this._map.fire(new t.Event("movestart",{originalEvent:e})),this._map.fire(new t.Event("zoomstart",{originalEvent:e})),this._finishTimeout&&clearTimeout(this._finishTimeout);var i=n.mousePos(this._el,e);this._around=t.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(i)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=this._map._requestRenderFrame(this._onScrollFrame))}},fi.prototype._onScrollFrame=function(){var e=this;if(this._frameId=null,this.isActive()){var n=this._map.transform;if(0!==this._delta){var i="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?1/450:.01,r=2/(1+Math.exp(-Math.abs(this._delta*i)));this._delta<0&&0!==r&&(r=1/r);var o="number"==typeof this._targetZoom?n.zoomScale(this._targetZoom):n.scale;this._targetZoom=Math.min(n.maxZoom,Math.max(n.minZoom,n.scaleZoom(o*r))),"wheel"===this._type&&(this._startZoom=n.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var a="number"==typeof this._targetZoom?this._targetZoom:n.zoom,s=this._startZoom,l=this._easing,u=!1;if("wheel"===this._type&&s&&l){var c=Math.min((t.browser.now()-this._lastWheelEventTime)/200,1),p=l(c);n.zoom=t.number(s,a,p),c<1?this._frameId||(this._frameId=this._map._requestRenderFrame(this._onScrollFrame)):u=!0}else n.zoom=a,u=!0;n.setLocationAtPoint(this._around,this._aroundPoint),this._map.fire(new t.Event("move",{originalEvent:this._lastWheelEvent})),this._map.fire(new t.Event("zoom",{originalEvent:this._lastWheelEvent})),u&&(this._active=!1,this._finishTimeout=setTimeout(function(){e._zooming=!1,e._map.fire(new t.Event("zoomend",{originalEvent:e._lastWheelEvent})),e._map.fire(new t.Event("moveend",{originalEvent:e._lastWheelEvent})),delete e._targetZoom},200))}},fi.prototype._smoothOutEasing=function(e){var n=t.ease;if(this._prevEase){var i=this._prevEase,r=(t.browser.now()-i.start)/i.duration,o=i.easing(r+.01)-i.easing(r),a=.27/Math.sqrt(o*o+1e-4)*.01,s=Math.sqrt(.0729-a*a);n=t.bezier(a,s,.25,1)}return this._prevEase={start:t.browser.now(),duration:e,easing:n},n};var di=function(e,n){this._map=e,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=n.clickTolerance||1,t.bindAll(["_onMouseMove","_onMouseUp","_onKeyDown"],this)};di.prototype.isEnabled=function(){return!!this._enabled},di.prototype.isActive=function(){return!!this._active},di.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},di.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},di.prototype.onMouseDown=function(e){this.isEnabled()&&e.shiftKey&&0===e.button&&(t.window.document.addEventListener("mousemove",this._onMouseMove,!1),t.window.document.addEventListener("keydown",this._onKeyDown,!1),t.window.document.addEventListener("mouseup",this._onMouseUp,!1),n.disableDrag(),this._startPos=this._lastPos=n.mousePos(this._el,e),this._active=!0)},di.prototype._onMouseMove=function(t){var e=n.mousePos(this._el,t);if(!(this._lastPos.equals(e)||!this._box&&e.dist(this._startPos)<this._clickTolerance)){var i=this._startPos;this._lastPos=e,this._box||(this._box=n.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var r=Math.min(i.x,e.x),o=Math.max(i.x,e.x),a=Math.min(i.y,e.y),s=Math.max(i.y,e.y);n.setTransform(this._box,"translate("+r+"px,"+a+"px)"),this._box.style.width=o-r+"px",this._box.style.height=s-a+"px"}},di.prototype._onMouseUp=function(e){if(0===e.button){var i=this._startPos,r=n.mousePos(this._el,e);this._finish(),n.suppressClick(),i.x===r.x&&i.y===r.y?this._fireEvent("boxzoomcancel",e):this._map.fitScreenCoordinates(i,r,this._map.getBearing(),{linear:!0}).fire(new t.Event("boxzoomend",{originalEvent:e}))}},di.prototype._onKeyDown=function(t){27===t.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",t))},di.prototype._finish=function(){this._active=!1,t.window.document.removeEventListener("mousemove",this._onMouseMove,!1),t.window.document.removeEventListener("keydown",this._onKeyDown,!1),t.window.document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(n.remove(this._box),this._box=null),n.enableDrag(),delete this._startPos,delete this._lastPos},di.prototype._fireEvent=function(e,n){return this._map.fire(new t.Event(e,{originalEvent:n}))};var mi=t.bezier(0,0,.25,1),yi=function(e,n){this._map=e,this._el=n.element||e.getCanvasContainer(),this._state="disabled",this._button=n.button||"right",this._bearingSnap=n.bearingSnap||0,this._pitchWithRotate=!1!==n.pitchWithRotate,t.bindAll(["onMouseDown","_onMouseMove","_onMouseUp","_onBlur","_onDragFrame"],this)};yi.prototype.isEnabled=function(){return"disabled"!==this._state},yi.prototype.isActive=function(){return"active"===this._state},yi.prototype.enable=function(){this.isEnabled()||(this._state="enabled")},yi.prototype.disable=function(){if(this.isEnabled())switch(this._state){case"active":this._state="disabled",this._unbind(),this._deactivate(),this._fireEvent("rotateend"),this._pitchWithRotate&&this._fireEvent("pitchend"),this._fireEvent("moveend");break;case"pending":this._state="disabled",this._unbind();break;default:this._state="disabled"}},yi.prototype.onMouseDown=function(e){if("enabled"===this._state){if("right"===this._button){if(this._eventButton=n.mouseButton(e),this._eventButton!==(e.ctrlKey?0:2))return}else{if(e.ctrlKey||0!==n.mouseButton(e))return;this._eventButton=0}n.disableDrag(),t.window.document.addEventListener("mousemove",this._onMouseMove,{capture:!0}),t.window.document.addEventListener("mouseup",this._onMouseUp),t.window.addEventListener("blur",this._onBlur),this._state="pending",this._inertia=[[t.browser.now(),this._map.getBearing()]],this._startPos=this._lastPos=n.mousePos(this._el,e),this._center=this._map.transform.centerPoint,e.preventDefault()}},yi.prototype._onMouseMove=function(t){var e=n.mousePos(this._el,t);this._lastPos.equals(e)||(this._lastMoveEvent=t,this._lastPos=e,"pending"===this._state&&(this._state="active",this._fireEvent("rotatestart",t),this._fireEvent("movestart",t),this._pitchWithRotate&&this._fireEvent("pitchstart",t)),this._frameId||(this._frameId=this._map._requestRenderFrame(this._onDragFrame)))},yi.prototype._onDragFrame=function(){this._frameId=null;var e=this._lastMoveEvent;if(e){var n=this._map.transform,i=this._startPos,r=this._lastPos,o=.8*(i.x-r.x),a=-.5*(i.y-r.y),s=n.bearing-o,l=n.pitch-a,u=this._inertia,c=u[u.length-1];this._drainInertiaBuffer(),u.push([t.browser.now(),this._map._normalizeBearing(s,c[1])]),n.bearing=s,this._pitchWithRotate&&(this._fireEvent("pitch",e),n.pitch=l),this._fireEvent("rotate",e),this._fireEvent("move",e),delete this._lastMoveEvent,this._startPos=this._lastPos}},yi.prototype._onMouseUp=function(t){if(n.mouseButton(t)===this._eventButton)switch(this._state){case"active":this._state="enabled",n.suppressClick(),this._unbind(),this._deactivate(),this._inertialRotate(t);break;case"pending":this._state="enabled",this._unbind()}},yi.prototype._onBlur=function(t){switch(this._state){case"active":this._state="enabled",this._unbind(),this._deactivate(),this._fireEvent("rotateend",t),this._pitchWithRotate&&this._fireEvent("pitchend",t),this._fireEvent("moveend",t);break;case"pending":this._state="enabled",this._unbind()}},yi.prototype._unbind=function(){t.window.document.removeEventListener("mousemove",this._onMouseMove,{capture:!0}),t.window.document.removeEventListener("mouseup",this._onMouseUp),t.window.removeEventListener("blur",this._onBlur),n.enableDrag()},yi.prototype._deactivate=function(){this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),delete this._lastMoveEvent,delete this._startPos,delete this._lastPos},yi.prototype._inertialRotate=function(t){var e=this;this._fireEvent("rotateend",t),this._drainInertiaBuffer();var n=this._map,i=n.getBearing(),r=this._inertia,o=function(){Math.abs(i)<e._bearingSnap?n.resetNorth({noMoveStart:!0},{originalEvent:t}):e._fireEvent("moveend",t),e._pitchWithRotate&&e._fireEvent("pitchend",t)};if(r.length<2)o();else{var a=r[0],s=r[r.length-1],l=r[r.length-2],u=n._normalizeBearing(i,l[1]),c=s[1]-a[1],p=c<0?-1:1,h=(s[0]-a[0])/1e3;if(0!==c&&0!==h){var f=Math.abs(c*(.25/h));f>180&&(f=180);var d=f/180;u+=p*f*(d/2),Math.abs(n._normalizeBearing(u,0))<this._bearingSnap&&(u=n._normalizeBearing(0,u)),n.rotateTo(u,{duration:1e3*d,easing:mi,noMoveStart:!0},{originalEvent:t})}else o()}},yi.prototype._fireEvent=function(e,n){return this._map.fire(new t.Event(e,n?{originalEvent:n}:{}))},yi.prototype._drainInertiaBuffer=function(){for(var e=this._inertia,n=t.browser.now();e.length>0&&n-e[0][0]>160;)e.shift()};var _i=t.bezier(0,0,.3,1),gi=function(e,n){this._map=e,this._el=e.getCanvasContainer(),this._state="disabled",this._clickTolerance=n.clickTolerance||1,t.bindAll(["_onMove","_onMouseUp","_onTouchEnd","_onBlur","_onDragFrame"],this)};gi.prototype.isEnabled=function(){return"disabled"!==this._state},gi.prototype.isActive=function(){return"active"===this._state},gi.prototype.enable=function(){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-drag-pan"),this._state="enabled")},gi.prototype.disable=function(){if(this.isEnabled())switch(this._el.classList.remove("mapboxgl-touch-drag-pan"),this._state){case"active":this._state="disabled",this._unbind(),this._deactivate(),this._fireEvent("dragend"),this._fireEvent("moveend");break;case"pending":this._state="disabled",this._unbind();break;default:this._state="disabled"}},gi.prototype.onMouseDown=function(e){"enabled"===this._state&&(e.ctrlKey||0!==n.mouseButton(e)||(n.addEventListener(t.window.document,"mousemove",this._onMove,{capture:!0}),n.addEventListener(t.window.document,"mouseup",this._onMouseUp),this._start(e)))},gi.prototype.onTouchStart=function(e){"enabled"===this._state&&(e.touches.length>1||(n.addEventListener(t.window.document,"touchmove",this._onMove,{capture:!0,passive:!1}),n.addEventListener(t.window.document,"touchend",this._onTouchEnd),this._start(e)))},gi.prototype._start=function(e){t.window.addEventListener("blur",this._onBlur),this._state="pending",this._startPos=this._mouseDownPos=this._lastPos=n.mousePos(this._el,e),this._inertia=[[t.browser.now(),this._startPos]]},gi.prototype._onMove=function(e){e.preventDefault();var i=n.mousePos(this._el,e);this._lastPos.equals(i)||"pending"===this._state&&i.dist(this._mouseDownPos)<this._clickTolerance||(this._lastMoveEvent=e,this._lastPos=i,this._drainInertiaBuffer(),this._inertia.push([t.browser.now(),this._lastPos]),"pending"===this._state&&(this._state="active",this._fireEvent("dragstart",e),this._fireEvent("movestart",e)),this._frameId||(this._frameId=this._map._requestRenderFrame(this._onDragFrame)))},gi.prototype._onDragFrame=function(){this._frameId=null;var t=this._lastMoveEvent;if(t){var e=this._map.transform;e.setLocationAtPoint(e.pointLocation(this._startPos),this._lastPos),this._fireEvent("drag",t),this._fireEvent("move",t),this._startPos=this._lastPos,delete this._lastMoveEvent}},gi.prototype._onMouseUp=function(t){if(0===n.mouseButton(t))switch(this._state){case"active":this._state="enabled",n.suppressClick(),this._unbind(),this._deactivate(),this._inertialPan(t);break;case"pending":this._state="enabled",this._unbind()}},gi.prototype._onTouchEnd=function(t){switch(this._state){case"active":this._state="enabled",this._unbind(),this._deactivate(),this._inertialPan(t);break;case"pending":this._state="enabled",this._unbind()}},gi.prototype._onBlur=function(t){switch(this._state){case"active":this._state="enabled",this._unbind(),this._deactivate(),this._fireEvent("dragend",t),this._fireEvent("moveend",t);break;case"pending":this._state="enabled",this._unbind()}},gi.prototype._unbind=function(){n.removeEventListener(t.window.document,"touchmove",this._onMove,{capture:!0,passive:!1}),n.removeEventListener(t.window.document,"touchend",this._onTouchEnd),n.removeEventListener(t.window.document,"mousemove",this._onMove,{capture:!0}),n.removeEventListener(t.window.document,"mouseup",this._onMouseUp),n.removeEventListener(t.window,"blur",this._onBlur)},gi.prototype._deactivate=function(){this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),delete this._lastMoveEvent,delete this._startPos,delete this._mouseDownPos,delete this._lastPos},gi.prototype._inertialPan=function(t){this._fireEvent("dragend",t),this._drainInertiaBuffer();var e=this._inertia;if(e.length<2)this._fireEvent("moveend",t);else{var n=e[e.length-1],i=e[0],r=n[1].sub(i[1]),o=(n[0]-i[0])/1e3;if(0===o||n[1].equals(i[1]))this._fireEvent("moveend",t);else{var a=r.mult(.3/o),s=a.mag();s>1400&&(s=1400,a._unit()._mult(s));var l=s/750,u=a.mult(-l/2);this._map.panBy(u,{duration:1e3*l,easing:_i,noMoveStart:!0},{originalEvent:t})}}},gi.prototype._fireEvent=function(e,n){return this._map.fire(new t.Event(e,n?{originalEvent:n}:{}))},gi.prototype._drainInertiaBuffer=function(){for(var e=this._inertia,n=t.browser.now();e.length>0&&n-e[0][0]>160;)e.shift()};var vi=function(e){this._map=e,this._el=e.getCanvasContainer(),t.bindAll(["_onKeyDown"],this)};function xi(t){return t*(2-t)}vi.prototype.isEnabled=function(){return!!this._enabled},vi.prototype.enable=function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},vi.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},vi.prototype._onKeyDown=function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=0,n=0,i=0,r=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?n=-1:(t.preventDefault(),r=-1);break;case 39:t.shiftKey?n=1:(t.preventDefault(),r=1);break;case 38:t.shiftKey?i=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?i=-1:(o=1,t.preventDefault());break;default:return}var a=this._map,s=a.getZoom(),l={duration:300,delayEndEvents:500,easing:xi,zoom:e?Math.round(s)+e*(t.shiftKey?2:1):s,bearing:a.getBearing()+15*n,pitch:a.getPitch()+10*i,offset:[100*-r,100*-o],center:a.getCenter()};a.easeTo(l,{originalEvent:t})}};var bi=function(e){this._map=e,t.bindAll(["_onDblClick","_onZoomEnd"],this)};bi.prototype.isEnabled=function(){return!!this._enabled},bi.prototype.isActive=function(){return!!this._active},bi.prototype.enable=function(){this.isEnabled()||(this._enabled=!0)},bi.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},bi.prototype.onTouchStart=function(t){var e=this;this.isEnabled()&&(t.points.length>1||(this._tapped?(clearTimeout(this._tapped),this._tapped=null,this._zoom(t)):this._tapped=setTimeout(function(){e._tapped=null},300)))},bi.prototype.onDblClick=function(t){this.isEnabled()&&(t.originalEvent.preventDefault(),this._zoom(t))},bi.prototype._zoom=function(t){this._active=!0,this._map.on("zoomend",this._onZoomEnd),this._map.zoomTo(this._map.getZoom()+(t.originalEvent.shiftKey?-1:1),{around:t.lngLat},t)},bi.prototype._onZoomEnd=function(){this._active=!1,this._map.off("zoomend",this._onZoomEnd)};var wi=t.bezier(0,0,.15,1),Ei=function(e){this._map=e,this._el=e.getCanvasContainer(),t.bindAll(["_onMove","_onEnd","_onTouchFrame"],this)};Ei.prototype.isEnabled=function(){return!!this._enabled},Ei.prototype.enable=function(t){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-zoom-rotate"),this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)},Ei.prototype.disable=function(){this.isEnabled()&&(this._el.classList.remove("mapboxgl-touch-zoom-rotate"),this._enabled=!1)},Ei.prototype.disableRotation=function(){this._rotationDisabled=!0},Ei.prototype.enableRotation=function(){this._rotationDisabled=!1},Ei.prototype.onStart=function(e){if(this.isEnabled()&&2===e.touches.length){var i=n.mousePos(this._el,e.touches[0]),r=n.mousePos(this._el,e.touches[1]),o=i.add(r).div(2);this._startVec=i.sub(r),this._startAround=this._map.transform.pointLocation(o),this._gestureIntent=void 0,this._inertia=[],n.addEventListener(t.window.document,"touchmove",this._onMove,{passive:!1}),n.addEventListener(t.window.document,"touchend",this._onEnd)}},Ei.prototype._getTouchEventData=function(t){var e=n.mousePos(this._el,t.touches[0]),i=n.mousePos(this._el,t.touches[1]),r=e.sub(i);return{vec:r,center:e.add(i).div(2),scale:r.mag()/this._startVec.mag(),bearing:this._rotationDisabled?0:180*r.angleWith(this._startVec)/Math.PI}},Ei.prototype._onMove=function(e){if(2===e.touches.length){var n=this._getTouchEventData(e),i=n.vec,r=n.scale,o=n.bearing;if(!this._gestureIntent){var a=this._rotationDisabled&&1!==r||Math.abs(1-r)>.15;Math.abs(o)>10?this._gestureIntent="rotate":a&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._map.fire(new t.Event(this._gestureIntent+"start",{originalEvent:e})),this._map.fire(new t.Event("movestart",{originalEvent:e})),this._startVec=i)}this._lastTouchEvent=e,this._frameId||(this._frameId=this._map._requestRenderFrame(this._onTouchFrame)),e.preventDefault()}},Ei.prototype._onTouchFrame=function(){this._frameId=null;var e=this._gestureIntent;if(e){var n=this._map.transform;this._startScale||(this._startScale=n.scale,this._startBearing=n.bearing);var i=this._getTouchEventData(this._lastTouchEvent),r=i.center,o=i.bearing,a=i.scale,s=n.pointLocation(r),l=n.locationPoint(s);"rotate"===e&&(n.bearing=this._startBearing+o),n.zoom=n.scaleZoom(this._startScale*a),n.setLocationAtPoint(this._startAround,l),this._map.fire(new t.Event(e,{originalEvent:this._lastTouchEvent})),this._map.fire(new t.Event("move",{originalEvent:this._lastTouchEvent})),this._drainInertiaBuffer(),this._inertia.push([t.browser.now(),a,r])}},Ei.prototype._onEnd=function(e){n.removeEventListener(t.window.document,"touchmove",this._onMove,{passive:!1}),n.removeEventListener(t.window.document,"touchend",this._onEnd);var i=this._gestureIntent,r=this._startScale;if(this._frameId&&(this._map._cancelRenderFrame(this._frameId),this._frameId=null),delete this._gestureIntent,delete this._startScale,delete this._startBearing,delete this._lastTouchEvent,i){this._map.fire(new t.Event(i+"end",{originalEvent:e})),this._drainInertiaBuffer();var o=this._inertia,a=this._map;if(o.length<2)a.snapToNorth({},{originalEvent:e});else{var s=o[o.length-1],l=o[0],u=a.transform.scaleZoom(r*s[1]),c=a.transform.scaleZoom(r*l[1]),p=u-c,h=(s[0]-l[0])/1e3,f=s[2];if(0!==h&&u!==c){var d=.15*p/h;Math.abs(d)>2.5&&(d=d>0?2.5:-2.5);var m=1e3*Math.abs(d/(12*.15)),y=u+d*m/2e3;y<0&&(y=0),a.easeTo({zoom:y,duration:m,easing:wi,around:this._aroundCenter?a.getCenter():a.unproject(f),noMoveStart:!0},{originalEvent:e})}else a.snapToNorth({},{originalEvent:e})}}},Ei.prototype._drainInertiaBuffer=function(){for(var e=this._inertia,n=t.browser.now();e.length>2&&n-e[0][0]>160;)e.shift()};var Ti={scrollZoom:fi,boxZoom:di,dragRotate:yi,dragPan:gi,keyboard:vi,doubleClickZoom:bi,touchZoomRotate:Ei},Si=function(e){function n(n,i){e.call(this),this._moving=!1,this._zooming=!1,this.transform=n,this._bearingSnap=i.bearingSnap,t.bindAll(["_renderFrameCallback"],this)}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.getCenter=function(){return this.transform.center},n.prototype.setCenter=function(t,e){return this.jumpTo({center:t},e)},n.prototype.panBy=function(e,n,i){return e=t.Point.convert(e).mult(-1),this.panTo(this.transform.center,t.extend({offset:e},n),i)},n.prototype.panTo=function(e,n,i){return this.easeTo(t.extend({center:e},n),i)},n.prototype.getZoom=function(){return this.transform.zoom},n.prototype.setZoom=function(t,e){return this.jumpTo({zoom:t},e),this},n.prototype.zoomTo=function(e,n,i){return this.easeTo(t.extend({zoom:e},n),i)},n.prototype.zoomIn=function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},n.prototype.zoomOut=function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},n.prototype.getBearing=function(){return this.transform.bearing},n.prototype.setBearing=function(t,e){return this.jumpTo({bearing:t},e),this},n.prototype.rotateTo=function(e,n,i){return this.easeTo(t.extend({bearing:e},n),i)},n.prototype.resetNorth=function(e,n){return this.rotateTo(0,t.extend({duration:1e3},e),n),this},n.prototype.snapToNorth=function(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this},n.prototype.getPitch=function(){return this.transform.pitch},n.prototype.setPitch=function(t,e){return this.jumpTo({pitch:t},e),this},n.prototype.cameraForBounds=function(e,n){return e=t.LngLatBounds.convert(e),this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),0,n)},n.prototype._cameraForBoxAndBearing=function(e,n,i,r){if("number"==typeof(r=t.extend({padding:{top:0,bottom:0,right:0,left:0},offset:[0,0],maxZoom:this.transform.maxZoom},r)).padding){var o=r.padding;r.padding={top:o,bottom:o,right:o,left:o}}if(t.isEqual(Object.keys(r.padding).sort(function(t,e){return t<e?-1:t>e?1:0}),["bottom","left","right","top"])){var a=this.transform,s=a.project(t.LngLat.convert(e)),l=a.project(t.LngLat.convert(n)),u=s.rotate(-i*Math.PI/180),c=l.rotate(-i*Math.PI/180),p=new t.Point(Math.max(u.x,c.x),Math.max(u.y,c.y)),h=new t.Point(Math.min(u.x,c.x),Math.min(u.y,c.y)),f=p.sub(h),d=(a.width-r.padding.left-r.padding.right)/f.x,m=(a.height-r.padding.top-r.padding.bottom)/f.y;if(!(m<0||d<0)){var y=Math.min(a.scaleZoom(a.scale*Math.min(d,m)),r.maxZoom),_=t.Point.convert(r.offset),g=(r.padding.left-r.padding.right)/2,v=(r.padding.top-r.padding.bottom)/2,x=new t.Point(_.x+g,_.y+v).mult(a.scale/a.zoomScale(y));return{center:a.unproject(s.add(l).div(2).sub(x)),zoom:y,bearing:i}}t.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}else t.warnOnce("options.padding must be a positive number, or an Object with keys 'bottom', 'left', 'right', 'top'")},n.prototype.fitBounds=function(t,e,n){return this._fitInternal(this.cameraForBounds(t,e),e,n)},n.prototype.fitScreenCoordinates=function(e,n,i,r,o){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(t.Point.convert(e)),this.transform.pointLocation(t.Point.convert(n)),i,r),r,o)},n.prototype._fitInternal=function(e,n,i){return e?(n=t.extend(e,n)).linear?this.easeTo(n,i):this.flyTo(n,i):this},n.prototype.jumpTo=function(e,n){this.stop();var i=this.transform,r=!1,o=!1,a=!1;return"zoom"in e&&i.zoom!==+e.zoom&&(r=!0,i.zoom=+e.zoom),void 0!==e.center&&(i.center=t.LngLat.convert(e.center)),"bearing"in e&&i.bearing!==+e.bearing&&(o=!0,i.bearing=+e.bearing),"pitch"in e&&i.pitch!==+e.pitch&&(a=!0,i.pitch=+e.pitch),this.fire(new t.Event("movestart",n)).fire(new t.Event("move",n)),r&&this.fire(new t.Event("zoomstart",n)).fire(new t.Event("zoom",n)).fire(new t.Event("zoomend",n)),o&&this.fire(new t.Event("rotatestart",n)).fire(new t.Event("rotate",n)).fire(new t.Event("rotateend",n)),a&&this.fire(new t.Event("pitchstart",n)).fire(new t.Event("pitch",n)).fire(new t.Event("pitchend",n)),this.fire(new t.Event("moveend",n))},n.prototype.easeTo=function(e,n){var i=this;this.stop(),!1===(e=t.extend({offset:[0,0],duration:500,easing:t.ease},e)).animate&&(e.duration=0);var r=this.transform,o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l="zoom"in e?+e.zoom:o,u="bearing"in e?this._normalizeBearing(e.bearing,a):a,c="pitch"in e?+e.pitch:s,p=r.centerPoint.add(t.Point.convert(e.offset)),h=r.pointLocation(p),f=t.LngLat.convert(e.center||h);this._normalizeCenter(f);var d,m,y=r.project(h),_=r.project(f).sub(y),g=r.zoomScale(l-o);return e.around&&(d=t.LngLat.convert(e.around),m=r.locationPoint(d)),this._zooming=l!==o,this._rotating=a!==u,this._pitching=c!==s,this._prepareEase(n,e.noMoveStart),clearTimeout(this._easeEndTimeoutID),this._ease(function(e){if(i._zooming&&(r.zoom=t.number(o,l,e)),i._rotating&&(r.bearing=t.number(a,u,e)),i._pitching&&(r.pitch=t.number(s,c,e)),d)r.setLocationAtPoint(d,m);else{var h=r.zoomScale(r.zoom-o),f=l>o?Math.min(2,g):Math.max(.5,g),v=Math.pow(f,1-e),x=r.unproject(y.add(_.mult(e*v)).mult(h));r.setLocationAtPoint(r.renderWorldCopies?x.wrap():x,p)}i._fireMoveEvents(n)},function(){e.delayEndEvents?i._easeEndTimeoutID=setTimeout(function(){return i._afterEase(n)},e.delayEndEvents):i._afterEase(n)},e),this},n.prototype._prepareEase=function(e,n){this._moving=!0,n||this.fire(new t.Event("movestart",e)),this._zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&this.fire(new t.Event("pitchstart",e))},n.prototype._fireMoveEvents=function(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))},n.prototype._afterEase=function(e){var n=this._zooming,i=this._rotating,r=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,n&&this.fire(new t.Event("zoomend",e)),i&&this.fire(new t.Event("rotateend",e)),r&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))},n.prototype.flyTo=function(e,n){var i=this;this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);var r=this.transform,o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l="zoom"in e?t.clamp(+e.zoom,r.minZoom,r.maxZoom):o,u="bearing"in e?this._normalizeBearing(e.bearing,a):a,c="pitch"in e?+e.pitch:s,p=r.zoomScale(l-o),h=r.centerPoint.add(t.Point.convert(e.offset)),f=r.pointLocation(h),d=t.LngLat.convert(e.center||f);this._normalizeCenter(d);var m=r.project(f),y=r.project(d).sub(m),_=e.curve,g=Math.max(r.width,r.height),v=g/p,x=y.mag();if("minZoom"in e){var b=t.clamp(Math.min(e.minZoom,o,l),r.minZoom,r.maxZoom),w=g/r.zoomScale(b-o);_=Math.sqrt(w/x*2)}var E=_*_;function T(t){var e=(v*v-g*g+(t?-1:1)*E*E*x*x)/(2*(t?v:g)*E*x);return Math.log(Math.sqrt(e*e+1)-e)}function S(t){return(Math.exp(t)-Math.exp(-t))/2}function P(t){return(Math.exp(t)+Math.exp(-t))/2}var C=T(0),k=function(t){return P(C)/P(C+_*t)},A=function(t){return g*((P(C)*(S(e=C+_*t)/P(e))-S(C))/E)/x;var e},z=(T(1)-C)/_;if(Math.abs(x)<1e-6||!isFinite(z)){if(Math.abs(g-v)<1e-6)return this.easeTo(e,n);var L=v<g?-1:1;z=Math.abs(Math.log(v/g))/_,A=function(){return 0},k=function(t){return Math.exp(L*_*t)}}if("duration"in e)e.duration=+e.duration;else{var M="screenSpeed"in e?+e.screenSpeed/_:+e.speed;e.duration=1e3*z/M}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=a!==u,this._pitching=c!==s,this._prepareEase(n,!1),this._ease(function(e){var p=e*z,f=1/k(p);r.zoom=1===e?l:o+r.scaleZoom(f),i._rotating&&(r.bearing=t.number(a,u,e)),i._pitching&&(r.pitch=t.number(s,c,e));var _=1===e?d:r.unproject(m.add(y.mult(A(p))).mult(f));r.setLocationAtPoint(r.renderWorldCopies?_.wrap():_,h),i._fireMoveEvents(n)},function(){return i._afterEase(n)},e),this},n.prototype.isEasing=function(){return!!this._easeFrameId},n.prototype.stop=function(){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var t=this._onEaseEnd;delete this._onEaseEnd,t.call(this)}return this},n.prototype._ease=function(e,n,i){!1===i.animate||0===i.duration?(e(1),n()):(this._easeStart=t.browser.now(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},n.prototype._renderFrameCallback=function(){var e=Math.min((t.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},n.prototype._normalizeBearing=function(e,n){e=t.wrap(e,-180,180);var i=Math.abs(e-n);return Math.abs(e-360-n)<i&&(e-=360),Math.abs(e+360-n)<i&&(e+=360),e},n.prototype._normalizeCenter=function(t){var e=this.transform;if(e.renderWorldCopies&&!e.lngRange){var n=t.lng-e.center.lng;t.lng+=n>180?-360:n<-180?360:0}},n}(t.Evented),Pi=function(e){void 0===e&&(e={}),this.options=e,t.bindAll(["_updateEditLink","_updateData","_updateCompact"],this)};Pi.prototype.getDefaultPosition=function(){return"bottom-right"},Pi.prototype.onAdd=function(t){var e=this.options&&this.options.compact;return this._map=t,this._container=n.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._innerContainer=n.create("div","mapboxgl-ctrl-attrib-inner",this._container),e&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},Pi.prototype.onRemove=function(){n.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0},Pi.prototype._updateEditLink=function(){var e=this._editLink;e||(e=this._editLink=this._container.querySelector(".mapbox-improve-map"));var n=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:t.config.ACCESS_TOKEN}];if(e){var i=n.reduce(function(t,e,i){return e.value&&(t+=e.key+"="+e.value+(i<n.length-1?"&":"")),t},"?");e.href=t.config.FEEDBACK_URL+"/"+i+(this._map._hash?this._map._hash.getHashString(!0):"")}},Pi.prototype._updateData=function(t){!t||"metadata"!==t.sourceDataType&&"style"!==t.dataType||(this._updateAttributions(),this._updateEditLink())},Pi.prototype._updateAttributions=function(){if(this._map.style){var t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(function(t){return"string"!=typeof t?"":t})):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){var e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}var n=this._map.style.sourceCaches;for(var i in n){var r=n[i];if(r.used){var o=r.getSource();o.attribution&&t.indexOf(o.attribution)<0&&t.push(o.attribution)}}t.sort(function(t,e){return t.length-e.length}),(t=t.filter(function(e,n){for(var i=n+1;i<t.length;i++)if(t[i].indexOf(e)>=0)return!1;return!0})).length?(this._innerContainer.innerHTML=t.join(" | "),this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null}},Pi.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact")};var Ci=function(){t.bindAll(["_updateLogo"],this),t.bindAll(["_updateCompact"],this)};Ci.prototype.onAdd=function(t){this._map=t,this._container=n.create("div","mapboxgl-ctrl");var e=n.create("a","mapboxgl-ctrl-logo");return e.target="_blank",e.href="https://www.mapbox.com/",e.setAttribute("aria-label","Mapbox logo"),e.setAttribute("rel","noopener"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container},Ci.prototype.onRemove=function(){n.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},Ci.prototype.getDefaultPosition=function(){return"bottom-left"},Ci.prototype._updateLogo=function(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")},Ci.prototype._logoRequired=function(){if(this._map.style){var t=this._map.style.sourceCaches;for(var e in t)if(t[e].getSource().mapbox_logo)return!0;return!1}},Ci.prototype._updateCompact=function(){var t=this._container.children;if(t.length){var e=t[0];this._map.getCanvasContainer().offsetWidth<250?e.classList.add("mapboxgl-compact"):e.classList.remove("mapboxgl-compact")}};var ki=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};ki.prototype.add=function(t){var e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e},ki.prototype.remove=function(t){for(var e=this._currentlyRunning,n=0,i=e?this._queue.concat(e):this._queue;n<i.length;n+=1){var r=i[n];if(r.id===t)return void(r.cancelled=!0)}},ki.prototype.run=function(){var t=this._currentlyRunning=this._queue;this._queue=[];for(var e=0,n=t;e<n.length;e+=1){var i=n[e];if(!i.cancelled&&(i.callback(),this._cleared))break}this._cleared=!1,this._currentlyRunning=!1},ki.prototype.clear=function(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]};var Ai=t.window.HTMLImageElement,zi=t.window.HTMLElement,Li={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:0,maxZoom:22,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,bearingSnap:7,clickTolerance:3,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},Mi=function(i){function r(e){var r=this;if(null!=(e=t.extend({},Li,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than minZoom");var o=new si(e.minZoom,e.maxZoom,e.renderWorldCopies);i.call(this,o,e),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new ki,this._controls=[],this._mapId=t.uniqueId();var a=e.transformRequest;if(this._transformRequest=a?function(t,e){return a(t,e)||{url:t}}:function(t){return{url:t}},"string"==typeof e.container){if(this._container=t.window.document.getElementById(e.container),!this._container)throw new Error("Container '"+e.container+"' not found.")}else{if(!(e.container instanceof zi))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",function(){return r._update(!1)}),this.on("moveend",function(){return r._update(!1)}),this.on("zoom",function(){return r._update(!0)}),void 0!==t.window&&(t.window.addEventListener("online",this._onWindowOnline,!1),t.window.addEventListener("resize",this._onWindowResize,!1)),function(t,e){var i=t.getCanvasContainer(),r=null,o=!1,a=null;for(var s in Ti)t[s]=new Ti[s](t,e),e.interactive&&e[s]&&t[s].enable(e[s]);n.addEventListener(i,"mouseout",function(e){t.fire(new ci("mouseout",t,e))}),n.addEventListener(i,"mousedown",function(r){o=!0,a=n.mousePos(i,r);var s=new ci("mousedown",t,r);t.fire(s),s.defaultPrevented||(e.interactive&&!t.doubleClickZoom.isActive()&&t.stop(),t.boxZoom.onMouseDown(r),t.boxZoom.isActive()||t.dragPan.isActive()||t.dragRotate.onMouseDown(r),t.boxZoom.isActive()||t.dragRotate.isActive()||t.dragPan.onMouseDown(r))}),n.addEventListener(i,"mouseup",function(e){var n=t.dragRotate.isActive();r&&!n&&t.fire(new ci("contextmenu",t,r)),r=null,o=!1,t.fire(new ci("mouseup",t,e))}),n.addEventListener(i,"mousemove",function(e){if(!t.dragPan.isActive()&&!t.dragRotate.isActive()){for(var n=e.target;n&&n!==i;)n=n.parentNode;n===i&&t.fire(new ci("mousemove",t,e))}}),n.addEventListener(i,"mouseover",function(e){for(var n=e.target;n&&n!==i;)n=n.parentNode;n===i&&t.fire(new ci("mouseover",t,e))}),n.addEventListener(i,"touchstart",function(n){var i=new pi("touchstart",t,n);t.fire(i),i.defaultPrevented||(e.interactive&&t.stop(),t.boxZoom.isActive()||t.dragRotate.isActive()||t.dragPan.onTouchStart(n),t.touchZoomRotate.onStart(n),t.doubleClickZoom.onTouchStart(i))},{passive:!1}),n.addEventListener(i,"touchmove",function(e){t.fire(new pi("touchmove",t,e))},{passive:!1}),n.addEventListener(i,"touchend",function(e){t.fire(new pi("touchend",t,e))}),n.addEventListener(i,"touchcancel",function(e){t.fire(new pi("touchcancel",t,e))}),n.addEventListener(i,"click",function(r){var o=n.mousePos(i,r);(o.equals(a)||o.dist(a)<e.clickTolerance)&&t.fire(new ci("click",t,r))}),n.addEventListener(i,"dblclick",function(e){var n=new ci("dblclick",t,e);t.fire(n),n.defaultPrevented||t.doubleClickZoom.onDblClick(n)}),n.addEventListener(i,"contextmenu",function(e){var n=t.dragRotate.isActive();o||n?o&&(r=e):t.fire(new ci("contextmenu",t,e)),(t.dragRotate.isEnabled()||t.listens("contextmenu"))&&e.preventDefault()}),n.addEventListener(i,"wheel",function(n){e.interactive&&t.stop();var i=new hi("wheel",t,n);t.fire(i),i.defaultPrevented||t.scrollZoom.onWheel(n)},{passive:!1})}(this,e),this._hash=e.hash&&(new ui).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new Pi({customAttribution:e.customAttribution})),this.addControl(new Ci,e.logoPosition),this.on("style.load",function(){r.transform.unmodified&&r.jumpTo(r.style.stylesheet)}),this.on("data",function(e){r._update("style"===e.dataType),r.fire(new t.Event(e.dataType+"data",e))}),this.on("dataloading",function(e){r.fire(new t.Event(e.dataType+"dataloading",e))})}i&&(r.__proto__=i),r.prototype=Object.create(i&&i.prototype),r.prototype.constructor=r;var o={showTileBoundaries:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0}};return r.prototype._getMapId=function(){return this._mapId},r.prototype.addControl=function(e,n){if(void 0===n&&e.getDefaultPosition&&(n=e.getDefaultPosition()),void 0===n&&(n="top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));var i=e.onAdd(this);this._controls.push(e);var r=this._controlPositions[n];return-1!==n.indexOf("bottom")?r.insertBefore(i,r.firstChild):r.appendChild(i),this},r.prototype.removeControl=function(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));var n=this._controls.indexOf(e);return n>-1&&this._controls.splice(n,1),e.onRemove(this),this},r.prototype.resize=function(e){var n=this._containerDimensions(),i=n[0],r=n[1];return this._resizeCanvas(i,r),this.transform.resize(i,r),this.painter.resize(i,r),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e)).fire(new t.Event("resize",e)).fire(new t.Event("moveend",e)),this},r.prototype.getBounds=function(){return this.transform.getBounds()},r.prototype.getMaxBounds=function(){return this.transform.getMaxBounds()},r.prototype.setMaxBounds=function(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),this._update()},r.prototype.setMinZoom=function(t){if((t=null==t?0:t)>=0&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between 0 and the current maxZoom, inclusive")},r.prototype.getMinZoom=function(){return this.transform.minZoom},r.prototype.setMaxZoom=function(t){if((t=null==t?22:t)>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")},r.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},r.prototype.setRenderWorldCopies=function(t){return this.transform.renderWorldCopies=t,this._update()},r.prototype.getMaxZoom=function(){return this.transform.maxZoom},r.prototype.project=function(e){return this.transform.locationPoint(t.LngLat.convert(e))},r.prototype.unproject=function(e){return this.transform.pointLocation(t.Point.convert(e))},r.prototype.isMoving=function(){return this._moving||this.dragPan.isActive()||this.dragRotate.isActive()||this.scrollZoom.isActive()},r.prototype.isZooming=function(){return this._zooming||this.scrollZoom.isZooming()},r.prototype.isRotating=function(){return this._rotating||this.dragRotate.isActive()},r.prototype.on=function(t,e,n){var r=this;if(void 0===n)return i.prototype.on.call(this,t,e);var o=function(){var i;if("mouseenter"===t||"mouseover"===t){var o=!1;return{layer:e,listener:n,delegates:{mousemove:function(i){var a=r.getLayer(e)?r.queryRenderedFeatures(i.point,{layers:[e]}):[];a.length?o||(o=!0,n.call(r,new ci(t,r,i.originalEvent,{features:a}))):o=!1},mouseout:function(){o=!1}}}}if("mouseleave"===t||"mouseout"===t){var a=!1;return{layer:e,listener:n,delegates:{mousemove:function(i){(r.getLayer(e)?r.queryRenderedFeatures(i.point,{layers:[e]}):[]).length?a=!0:a&&(a=!1,n.call(r,new ci(t,r,i.originalEvent)))},mouseout:function(e){a&&(a=!1,n.call(r,new ci(t,r,e.originalEvent)))}}}}return{layer:e,listener:n,delegates:(i={},i[t]=function(t){var i=r.getLayer(e)?r.queryRenderedFeatures(t.point,{layers:[e]}):[];i.length&&(t.features=i,n.call(r,t),delete t.features)},i)}}();for(var a in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(o),o.delegates)this.on(a,o.delegates[a]);return this},r.prototype.off=function(t,e,n){if(void 0===n)return i.prototype.off.call(this,t,e);if(this._delegatedListeners&&this._delegatedListeners[t])for(var r=this._delegatedListeners[t],o=0;o<r.length;o++){var a=r[o];if(a.layer===e&&a.listener===n){for(var s in a.delegates)this.off(s,a.delegates[s]);return r.splice(o,1),this}}return this},r.prototype.queryRenderedFeatures=function(e,n){if(!this.style)return[];var i;if(void 0!==n||void 0===e||e instanceof t.Point||Array.isArray(e)||(n=e,e=void 0),n=n||{},(e=e||[[0,0],[this.transform.width,this.transform.height]])instanceof t.Point||"number"==typeof e[0])i=[t.Point.convert(e)];else{var r=t.Point.convert(e[0]),o=t.Point.convert(e[1]);i=[r,new t.Point(o.x,r.y),o,new t.Point(r.x,o.y),r]}return this.style.queryRenderedFeatures(i,n,this.transform)},r.prototype.querySourceFeatures=function(t,e){return this.style.querySourceFeatures(t,e)},r.prototype.setStyle=function(t,e){return(!e||!1!==e.diff&&!e.localIdeographFontFamily)&&this.style&&t?(this._diffStyle(t,e),this):this._updateStyle(t,e)},r.prototype._updateStyle=function(t,e){return this.style&&(this.style.setEventedParent(null),this.style._remove()),t?(this.style=new Me(this,e||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t):this.style.loadJSON(t),this):(delete this.style,this)},r.prototype._diffStyle=function(e,n){var i=this;if("string"==typeof e){var r=t.normalizeStyleURL(e),o=this._transformRequest(r,t.ResourceType.Style);t.getJSON(o,function(e,r){e?i.fire(new t.ErrorEvent(e)):r&&i._updateDiff(r,n)})}else"object"==typeof e&&this._updateDiff(e,n)},r.prototype._updateDiff=function(e,n){try{this.style.setState(e)&&this._update(!0)}catch(i){t.warnOnce("Unable to perform style diff: "+(i.message||i.error||i)+". Rebuilding the style from scratch."),this._updateStyle(e,n)}},r.prototype.getStyle=function(){if(this.style)return this.style.serialize()},r.prototype.isStyleLoaded=function(){return this.style?this.style.loaded():t.warnOnce("There is no style added to the map.")},r.prototype.addSource=function(t,e){return this.style.addSource(t,e),this._update(!0)},r.prototype.isSourceLoaded=function(e){var n=this.style&&this.style.sourceCaches[e];if(void 0!==n)return n.loaded();this.fire(new t.ErrorEvent(new Error("There is no source with ID '"+e+"'")))},r.prototype.areTilesLoaded=function(){var t=this.style&&this.style.sourceCaches;for(var e in t){var n=t[e]._tiles;for(var i in n){var r=n[i];if("loaded"!==r.state&&"errored"!==r.state)return!1}}return!0},r.prototype.addSourceType=function(t,e,n){return this.style.addSourceType(t,e,n)},r.prototype.removeSource=function(t){return this.style.removeSource(t),this._update(!0)},r.prototype.getSource=function(t){return this.style.getSource(t)},r.prototype.addImage=function(e,n,i){void 0===i&&(i={});var r=i.pixelRatio;void 0===r&&(r=1);var o=i.sdf;if(void 0===o&&(o=!1),n instanceof Ai){var a=t.browser.getImageData(n),s=a.width,l=a.height,u=a.data;this.style.addImage(e,{data:new t.RGBAImage({width:s,height:l},u),pixelRatio:r,sdf:o})}else{if(void 0===n.width||void 0===n.height)return this.fire(new t.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));var c=n.width,p=n.height,h=n.data;this.style.addImage(e,{data:new t.RGBAImage({width:c,height:p},new Uint8Array(h)),pixelRatio:r,sdf:o})}},r.prototype.hasImage=function(e){return e?!!this.style.getImage(e):(this.fire(new t.ErrorEvent(new Error("Missing required image id"))),!1)},r.prototype.removeImage=function(t){this.style.removeImage(t)},r.prototype.loadImage=function(e,n){t.getImage(this._transformRequest(e,t.ResourceType.Image),n)},r.prototype.listImages=function(){return this.style.listImages()},r.prototype.addLayer=function(t,e){return this.style.addLayer(t,e),this._update(!0)},r.prototype.moveLayer=function(t,e){return this.style.moveLayer(t,e),this._update(!0)},r.prototype.removeLayer=function(t){return this.style.removeLayer(t),this._update(!0)},r.prototype.getLayer=function(t){return this.style.getLayer(t)},r.prototype.setFilter=function(t,e,n){return void 0===n&&(n={}),this.style.setFilter(t,e,n),this._update(!0)},r.prototype.setLayerZoomRange=function(t,e,n){return this.style.setLayerZoomRange(t,e,n),this._update(!0)},r.prototype.getFilter=function(t){return this.style.getFilter(t)},r.prototype.setPaintProperty=function(t,e,n,i){return void 0===i&&(i={}),this.style.setPaintProperty(t,e,n,i),this._update(!0)},r.prototype.getPaintProperty=function(t,e){return this.style.getPaintProperty(t,e)},r.prototype.setLayoutProperty=function(t,e,n,i){return void 0===i&&(i={}),this.style.setLayoutProperty(t,e,n,i),this._update(!0)},r.prototype.getLayoutProperty=function(t,e){return this.style.getLayoutProperty(t,e)},r.prototype.setLight=function(t,e){return void 0===e&&(e={}),this.style.setLight(t,e),this._update(!0)},r.prototype.getLight=function(){return this.style.getLight()},r.prototype.setFeatureState=function(t,e){return this.style.setFeatureState(t,e),this._update()},r.prototype.removeFeatureState=function(t,e){return this.style.removeFeatureState(t,e),this._update()},r.prototype.getFeatureState=function(t){return this.style.getFeatureState(t)},r.prototype.getContainer=function(){return this._container},r.prototype.getCanvasContainer=function(){return this._canvasContainer},r.prototype.getCanvas=function(){return this._canvas},r.prototype._containerDimensions=function(){var t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]},r.prototype._detectMissingCSS=function(){"rgb(250, 128, 114)"!==t.window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&t.warnOnce("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")},r.prototype._setupContainer=function(){var t=this._container;t.classList.add("mapboxgl-map"),(this._missingCSSCanary=n.create("div","mapboxgl-canary",t)).style.visibility="hidden",this._detectMissingCSS();var e=this._canvasContainer=n.create("div","mapboxgl-canvas-container",t);this._interactive&&e.classList.add("mapboxgl-interactive"),this._canvas=n.create("canvas","mapboxgl-canvas",e),this._canvas.style.position="absolute",this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map");var i=this._containerDimensions();this._resizeCanvas(i[0],i[1]);var r=this._controlContainer=n.create("div","mapboxgl-control-container",t),o=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(function(t){o[t]=n.create("div","mapboxgl-ctrl-"+t,r)})},r.prototype._resizeCanvas=function(e,n){var i=t.window.devicePixelRatio||1;this._canvas.width=i*e,this._canvas.height=i*n,this._canvas.style.width=e+"px",this._canvas.style.height=n+"px"},r.prototype._setupPainter=function(){var n=t.extend({failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer},e.webGLContextAttributes),i=this._canvas.getContext("webgl",n)||this._canvas.getContext("experimental-webgl",n);i?(this.painter=new ii(i,this.transform),t.webpSupported.testSupport(i)):this.fire(new t.ErrorEvent(new Error("Failed to initialize WebGL")))},r.prototype._contextLost=function(e){e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new t.Event("webglcontextlost",{originalEvent:e}))},r.prototype._contextRestored=function(e){this._setupPainter(),this.resize(),this._update(),this.fire(new t.Event("webglcontextrestored",{originalEvent:e}))},r.prototype.loaded=function(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()},r.prototype._update=function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this):this},r.prototype._requestRenderFrame=function(t){return this._update(),this._renderTaskQueue.add(t)},r.prototype._cancelRenderFrame=function(t){this._renderTaskQueue.remove(t)},r.prototype._render=function(){this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run();var e=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;var n=this.transform.zoom,i=t.browser.now();this.style.zoomHistory.update(n,i);var r=new t.EvaluationParameters(n,{now:i,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),o=r.crossFadingFactor();1===o&&o===this._crossFadingFactor||(e=!0,this._crossFadingFactor=o),this.style.update(r)}return this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration}),this.fire(new t.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new t.Event("load"))),this.style&&(this.style.hasTransitions()||e)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this._sourcesDirty||this._repaint||this._styleDirty||this._placementDirty?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.Event("idle")),this},r.prototype.remove=function(){this._hash&&this._hash.remove();for(var e=0,n=this._controls;e<n.length;e+=1)n[e].onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.setStyle(null),void 0!==t.window&&(t.window.removeEventListener("resize",this._onWindowResize,!1),t.window.removeEventListener("online",this._onWindowOnline,!1));var i=this.painter.context.gl.getExtension("WEBGL_lose_context");i&&i.loseContext(),Ii(this._canvasContainer),Ii(this._controlContainer),Ii(this._missingCSSCanary),this._container.classList.remove("mapboxgl-map"),this.fire(new t.Event("remove"))},r.prototype.triggerRepaint=function(){var e=this;this.style&&!this._frame&&(this._frame=t.browser.frame(function(){e._frame=null,e._render()}))},r.prototype._onWindowOnline=function(){this._update()},r.prototype._onWindowResize=function(){this._trackResize&&this.resize()._update()},o.showTileBoundaries.get=function(){return!!this._showTileBoundaries},o.showTileBoundaries.set=function(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())},o.showCollisionBoxes.get=function(){return!!this._showCollisionBoxes},o.showCollisionBoxes.set=function(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())},o.showOverdrawInspector.get=function(){return!!this._showOverdrawInspector},o.showOverdrawInspector.set=function(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())},o.repaint.get=function(){return!!this._repaint},o.repaint.set=function(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())},o.vertices.get=function(){return!!this._vertices},o.vertices.set=function(t){this._vertices=t,this._update()},Object.defineProperties(r.prototype,o),r}(Si);function Ii(t){t.parentNode&&t.parentNode.removeChild(t)}var Oi={showCompass:!0,showZoom:!0},Di=function(e){var i=this;this.options=t.extend({},Oi,e),this._container=n.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",function(t){return t.preventDefault()}),this.options.showZoom&&(this._zoomInButton=this._createButton("mapboxgl-ctrl-icon mapboxgl-ctrl-zoom-in","Zoom in",function(){return i._map.zoomIn()}),this._zoomOutButton=this._createButton("mapboxgl-ctrl-icon mapboxgl-ctrl-zoom-out","Zoom out",function(){return i._map.zoomOut()})),this.options.showCompass&&(t.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-icon mapboxgl-ctrl-compass","Reset bearing to north",function(){return i._map.resetNorth()}),this._compassArrow=n.create("span","mapboxgl-ctrl-compass-arrow",this._compass))};function Ri(e,n,i){if(e=new t.LngLat(e.lng,e.lat),n){var r=new t.LngLat(e.lng-360,e.lat),o=new t.LngLat(e.lng+360,e.lat),a=i.locationPoint(e).distSqr(n);i.locationPoint(r).distSqr(n)<a?e=r:i.locationPoint(o).distSqr(n)<a&&(e=o)}for(;Math.abs(e.lng-i.center.lng)>180;){var s=i.locationPoint(e);if(s.x>=0&&s.y>=0&&s.x<=i.width&&s.y<=i.height)break;e.lng>i.center.lng?e.lng-=360:e.lng+=360}return e}Di.prototype._rotateCompassArrow=function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t},Di.prototype.onAdd=function(t){return this._map=t,this.options.showCompass&&(this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new yi(t,{button:"left",element:this._compass}),n.addEventListener(this._compass,"mousedown",this._handler.onMouseDown),this._handler.enable()),this._container},Di.prototype.onRemove=function(){n.remove(this._container),this.options.showCompass&&(this._map.off("rotate",this._rotateCompassArrow),n.removeEventListener(this._compass,"mousedown",this._handler.onMouseDown),this._handler.disable(),delete this._handler),delete this._map},Di.prototype._createButton=function(t,e,i){var r=n.create("button",t,this._container);return r.type="button",r.title=e,r.setAttribute("aria-label",e),r.addEventListener("click",i),r};var Bi={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Fi(t,e,n){var i=t.classList;for(var r in Bi)i.remove("mapboxgl-"+n+"-anchor-"+r);i.add("mapboxgl-"+n+"-anchor-"+e)}var Ni,Ui=function(e){function i(i,r){if(e.call(this),(i instanceof t.window.HTMLElement||r)&&(i=t.extend({element:i},r)),t.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick"],this),this._anchor=i&&i.anchor||"center",this._color=i&&i.color||"#3FB1CE",this._draggable=i&&i.draggable||!1,this._state="inactive",i&&i.element)this._element=i.element,this._offset=t.Point.convert(i&&i.offset||[0,0]);else{this._defaultMarker=!0,this._element=n.create("div");var o=n.createNS("http://www.w3.org/2000/svg","svg");o.setAttributeNS(null,"height","41px"),o.setAttributeNS(null,"width","27px"),o.setAttributeNS(null,"viewBox","0 0 27 41");var a=n.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");var s=n.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");var l=n.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");for(var u=0,c=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];u<c.length;u+=1){var p=c[u],h=n.createNS("http://www.w3.org/2000/svg","ellipse");h.setAttributeNS(null,"opacity","0.04"),h.setAttributeNS(null,"cx","10.5"),h.setAttributeNS(null,"cy","5.80029008"),h.setAttributeNS(null,"rx",p.rx),h.setAttributeNS(null,"ry",p.ry),l.appendChild(h)}var f=n.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill",this._color);var d=n.createNS("http://www.w3.org/2000/svg","path");d.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),f.appendChild(d);var m=n.createNS("http://www.w3.org/2000/svg","g");m.setAttributeNS(null,"opacity","0.25"),m.setAttributeNS(null,"fill","#000000");var y=n.createNS("http://www.w3.org/2000/svg","path");y.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),m.appendChild(y);var _=n.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(6.0, 7.0)"),_.setAttributeNS(null,"fill","#FFFFFF");var g=n.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"transform","translate(8.0, 8.0)");var v=n.createNS("http://www.w3.org/2000/svg","circle");v.setAttributeNS(null,"fill","#000000"),v.setAttributeNS(null,"opacity","0.25"),v.setAttributeNS(null,"cx","5.5"),v.setAttributeNS(null,"cy","5.5"),v.setAttributeNS(null,"r","5.4999962");var x=n.createNS("http://www.w3.org/2000/svg","circle");x.setAttributeNS(null,"fill","#FFFFFF"),x.setAttributeNS(null,"cx","5.5"),x.setAttributeNS(null,"cy","5.5"),x.setAttributeNS(null,"r","5.4999962"),g.appendChild(v),g.appendChild(x),s.appendChild(l),s.appendChild(f),s.appendChild(m),s.appendChild(_),s.appendChild(g),o.appendChild(s),this._element.appendChild(o),this._offset=t.Point.convert(i&&i.offset||[0,-14])}this._element.classList.add("mapboxgl-marker"),this._popup=null}return e&&(i.__proto__=e),i.prototype=Object.create(e&&e.prototype),i.prototype.constructor=i,i.prototype.addTo=function(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this},i.prototype.remove=function(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),delete this._map),n.remove(this._element),this._popup&&this._popup.remove(),this},i.prototype.getLngLat=function(){return this._lngLat},i.prototype.setLngLat=function(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this},i.prototype.getElement=function(){return this._element},i.prototype.setPopup=function(t){if(this._popup&&(this._popup.remove(),this._popup=null),t){if(!("offset"in t.options)){var e=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[e,-1*(24.6+e)],"bottom-right":[-e,-1*(24.6+e)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat)}return this},i.prototype._onMapClick=function(t){var e=t.originalEvent.target,n=this._element;this._popup&&(e===n||n.contains(e))&&this.togglePopup()},i.prototype.getPopup=function(){return this._popup},i.prototype.togglePopup=function(){var t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this},i.prototype._update=function(t){this._map&&(this._map.transform.renderWorldCopies&&(this._lngLat=Ri(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset),t&&"moveend"!==t.type||(this._pos=this._pos.round()),n.setTransform(this._element,Bi[this._anchor]+" translate("+this._pos.x+"px, "+this._pos.y+"px)"),Fi(this._element,this._anchor,"marker"))},i.prototype.getOffset=function(){return this._offset},i.prototype.setOffset=function(e){return this._offset=t.Point.convert(e),this._update(),this},i.prototype._onMove=function(e){this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.Event("dragstart"))),this.fire(new t.Event("drag"))},i.prototype._onUp=function(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.Event("dragend")),this._state="inactive"},i.prototype._addDragHandler=function(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},i.prototype.setDraggable=function(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this},i.prototype.isDraggable=function(){return this._draggable},i}(t.Evented),ji={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showUserLocation:!0},Vi=function(e){function i(n){e.call(this),this.options=t.extend({},ji,n),t.bindAll(["_onSuccess","_onError","_finish","_setupUI","_updateCamera","_updateMarker"],this)}return e&&(i.__proto__=e),i.prototype=Object.create(e&&e.prototype),i.prototype.constructor=i,i.prototype.onAdd=function(e){var i;return this._map=e,this._container=n.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),i=this._setupUI,void 0!==Ni?i(Ni):void 0!==t.window.navigator.permissions?t.window.navigator.permissions.query({name:"geolocation"}).then(function(t){Ni="denied"!==t.state,i(Ni)}):(Ni=!!t.window.navigator.geolocation,i(Ni)),this._container},i.prototype.onRemove=function(){void 0!==this._geolocationWatchID&&(t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),n.remove(this._container),this._map=void 0},i.prototype._onSuccess=function(e){if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish()},i.prototype._updateCamera=function(e){var n=new t.LngLat(e.coords.longitude,e.coords.latitude),i=e.coords.accuracy;this._map.fitBounds(n.toBounds(i),this.options.fitBoundsOptions,{geolocateSource:!0})},i.prototype._updateMarker=function(t){t?this._userLocationDotMarker.setLngLat([t.coords.longitude,t.coords.latitude]).addTo(this._map):this._userLocationDotMarker.remove()},i.prototype._onError=function(e){if(this.options.trackUserLocation)if(1===e.code)this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),void 0!==this._geolocationWatchID&&this._clearWatch();else switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()},i.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},i.prototype._setupUI=function(e){var i=this;!1!==e?(this._container.addEventListener("contextmenu",function(t){return t.preventDefault()}),this._geolocateButton=n.create("button","mapboxgl-ctrl-icon mapboxgl-ctrl-geolocate",this._container),this._geolocateButton.type="button",this._geolocateButton.setAttribute("aria-label","Geolocate"),this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=n.create("div","mapboxgl-user-location-dot"),this._userLocationDotMarker=new Ui(this._dotElement),this.options.trackUserLocation&&(this._watchState="OFF")),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",function(e){e.geolocateSource||"ACTIVE_LOCK"!==i._watchState||(i._watchState="BACKGROUND",i._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),i._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),i.fire(new t.Event("trackuserlocationend")))})):t.warnOnce("Geolocation support is not available, the GeolocateControl will not be visible.")},i.prototype.trigger=function(){if(!this._setup)return t.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}"OFF"===this._watchState&&void 0!==this._geolocationWatchID?this._clearWatch():void 0===this._geolocationWatchID&&(this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._geolocationWatchID=t.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,this.options.positionOptions))}else t.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0},i.prototype._clearWatch=function(){t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)},i}(t.Evented),Zi={maxWidth:100,unit:"metric"},qi=function(e){this.options=t.extend({},Zi,e),t.bindAll(["_onMove","setUnit"],this)};function Gi(t,e,n){var i,r,o,a,s,l,u=n&&n.maxWidth||100,c=t._container.clientHeight/2,p=(i=t.unproject([0,c]),r=t.unproject([u,c]),o=Math.PI/180,a=i.lat*o,s=r.lat*o,l=Math.sin(a)*Math.sin(s)+Math.cos(a)*Math.cos(s)*Math.cos((r.lng-i.lng)*o),6371e3*Math.acos(Math.min(l,1)));if(n&&"imperial"===n.unit){var h=3.2808*p;h>5280?Wi(e,u,h/5280,"mi"):Wi(e,u,h,"ft")}else n&&"nautical"===n.unit?Wi(e,u,p/1852,"nm"):Wi(e,u,p,"m")}function Wi(t,e,n,i){var r,o,a,s=(r=n,(o=Math.pow(10,(""+Math.floor(r)).length-1))*(a=(a=r/o)>=10?10:a>=5?5:a>=3?3:a>=2?2:a>=1?1:function(t){var e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(a))),l=s/n;"m"===i&&s>=1e3&&(s/=1e3,i="km"),t.style.width=e*l+"px",t.innerHTML=s+i}qi.prototype.getDefaultPosition=function(){return"bottom-left"},qi.prototype._onMove=function(){Gi(this._map,this._container,this.options)},qi.prototype.onAdd=function(t){return this._map=t,this._container=n.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},qi.prototype.onRemove=function(){n.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},qi.prototype.setUnit=function(t){this.options.unit=t,Gi(this._map,this._container,this.options)};var Hi=function(e){this._fullscreen=!1,e&&e.container&&(e.container instanceof t.window.HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in t.window.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in t.window.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in t.window.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in t.window.document&&(this._fullscreenchange="MSFullscreenChange"),this._className="mapboxgl-ctrl"};Hi.prototype.onAdd=function(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=n.create("div",this._className+" mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer},Hi.prototype.onRemove=function(){n.remove(this._controlContainer),this._map=null,t.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)},Hi.prototype._checkFullscreenSupport=function(){return!!(t.window.document.fullscreenEnabled||t.window.document.mozFullScreenEnabled||t.window.document.msFullscreenEnabled||t.window.document.webkitFullscreenEnabled)},Hi.prototype._setupUI=function(){var e=this._fullscreenButton=n.create("button",this._className+"-icon "+this._className+"-fullscreen",this._controlContainer);e.setAttribute("aria-label","Toggle fullscreen"),e.type="button",this._fullscreenButton.addEventListener("click",this._onClickFullscreen),t.window.document.addEventListener(this._fullscreenchange,this._changeIcon)},Hi.prototype._isFullscreen=function(){return this._fullscreen},Hi.prototype._changeIcon=function(){(t.window.document.fullscreenElement||t.window.document.mozFullScreenElement||t.window.document.webkitFullscreenElement||t.window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle(this._className+"-shrink"),this._fullscreenButton.classList.toggle(this._className+"-fullscreen"))},Hi.prototype._onClickFullscreen=function(){this._isFullscreen()?t.window.document.exitFullscreen?t.window.document.exitFullscreen():t.window.document.mozCancelFullScreen?t.window.document.mozCancelFullScreen():t.window.document.msExitFullscreen?t.window.document.msExitFullscreen():t.window.document.webkitCancelFullScreen&&t.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()};var Xi={closeButton:!0,closeOnClick:!0,className:""},Ki=function(e){function i(n){e.call(this),this.options=t.extend(Object.create(Xi),n),t.bindAll(["_update","_onClickClose","remove"],this)}return e&&(i.__proto__=e),i.prototype=Object.create(e&&e.prototype),i.prototype.constructor=i,i.prototype.addTo=function(e){return this._map=e,this._map.on("move",this._update),this.options.closeOnClick&&this._map.on("click",this._onClickClose),this._map.on("remove",this.remove),this._update(),this.fire(new t.Event("open")),this},i.prototype.isOpen=function(){return!!this._map},i.prototype.remove=function(){return this._content&&n.remove(this._content),this._container&&(n.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("click",this._onClickClose),this._map.off("remove",this.remove),delete this._map),this.fire(new t.Event("close")),this},i.prototype.getLngLat=function(){return this._lngLat},i.prototype.setLngLat=function(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._update(),this},i.prototype.setText=function(e){return this.setDOMContent(t.window.document.createTextNode(e))},i.prototype.setHTML=function(e){var n,i=t.window.document.createDocumentFragment(),r=t.window.document.createElement("body");for(r.innerHTML=e;n=r.firstChild;)i.appendChild(n);return this.setDOMContent(i)},i.prototype.setDOMContent=function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},i.prototype._createContent=function(){this._content&&n.remove(this._content),this._content=n.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=n.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClickClose))},i.prototype._update=function(){var e=this;if(this._map&&this._lngLat&&this._content){this._container||(this._container=n.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=n.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(function(t){return e._container.classList.add(t)})),this._map.transform.renderWorldCopies&&(this._lngLat=Ri(this._lngLat,this._pos,this._map.transform));var i=this._pos=this._map.project(this._lngLat),r=this.options.anchor,o=function e(n){if(n){if("number"==typeof n){var i=Math.round(Math.sqrt(.5*Math.pow(n,2)));return{center:new t.Point(0,0),top:new t.Point(0,n),"top-left":new t.Point(i,i),"top-right":new t.Point(-i,i),bottom:new t.Point(0,-n),"bottom-left":new t.Point(i,-i),"bottom-right":new t.Point(-i,-i),left:new t.Point(n,0),right:new t.Point(-n,0)}}if(n instanceof t.Point||Array.isArray(n)){var r=t.Point.convert(n);return{center:r,top:r,"top-left":r,"top-right":r,bottom:r,"bottom-left":r,"bottom-right":r,left:r,right:r}}return{center:t.Point.convert(n.center||[0,0]),top:t.Point.convert(n.top||[0,0]),"top-left":t.Point.convert(n["top-left"]||[0,0]),"top-right":t.Point.convert(n["top-right"]||[0,0]),bottom:t.Point.convert(n.bottom||[0,0]),"bottom-left":t.Point.convert(n["bottom-left"]||[0,0]),"bottom-right":t.Point.convert(n["bottom-right"]||[0,0]),left:t.Point.convert(n.left||[0,0]),right:t.Point.convert(n.right||[0,0])}}return e(new t.Point(0,0))}(this.options.offset);if(!r){var a,s=this._container.offsetWidth,l=this._container.offsetHeight;a=i.y+o.bottom.y<l?["top"]:i.y>this._map.transform.height-l?["bottom"]:[],i.x<s/2?a.push("left"):i.x>this._map.transform.width-s/2&&a.push("right"),r=0===a.length?"bottom":a.join("-")}var u=i.add(o[r]).round();n.setTransform(this._container,Bi[r]+" translate("+u.x+"px,"+u.y+"px)"),Fi(this._container,r,"popup")}},i.prototype._onClickClose=function(){this.remove()},i}(t.Evented),Yi={version:t.version,supported:e,setRTLTextPlugin:t.setRTLTextPlugin,Map:Mi,NavigationControl:Di,GeolocateControl:Vi,AttributionControl:Pi,ScaleControl:qi,FullscreenControl:Hi,Popup:Ki,Marker:Ui,Style:Me,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.Point,MercatorCoordinate:t.MercatorCoordinate,Evented:t.Evented,config:t.config,get accessToken(){return t.config.ACCESS_TOKEN},set accessToken(e){t.config.ACCESS_TOKEN=e},get baseApiUrl(){return t.config.API_URL},set baseApiUrl(e){t.config.API_URL=e},get workerCount(){return zt.workerCount},set workerCount(t){zt.workerCount=t},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e},workerUrl:""};return Yi}),n}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.__RewireAPI__=e.__ResetDependency__=e.__set__=e.__Rewire__=e.__GetDependency__=e.__get__=e.RedBoxError=void 0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);i=!0);}catch(t){r=!0,o=t}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),o=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),a=m(n(6)),s=n(0),l=m(s),u=m(n(10)),c=m(n(25)),p=m(n(26)),h=m(n(9)),f=n(28),d=n(29);function m(t){return t&&t.__esModule?t:{default:t}}function y(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function g(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var v=e.RedBoxError=function(t){function e(t){y(this,e);var n=_(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return n.state={error:null,mapped:!1},n.mapOnConstruction(t.error),n}return g(e,T("Component")),o(e,[{key:"componentDidMount",value:function(){this.state.mapped||this.mapError(this.props.error)}},{key:"mapOnConstruction",value:function(t){var e=t.stack.split("\n");if(e.length<2)this.state={error:t,mapped:!0};else if(-1!==e[1].search(/\(webpack:\/{3}/))this.state={error:t,mapped:!0};else if(-1!==e[1].search(/\(eval at/)){var n=[e.shift()],i=!0,o=!1,a=void 0;try{for(var s,l=e[Symbol.iterator]();!(i=(s=l.next()).done);i=!0){var u=s.value,c=u.match(/(.+)\(eval at (.+) \(.+?\), .+(\:[0-9]+\:[0-9]+)\)/);if(c){var p=r(c,4),h=p[1],f=p[2],d=p[3];n.push(h+" ("+f+d+")")}else n.push(u)}}catch(t){o=!0,a=t}finally{try{!i&&l.return&&l.return()}finally{if(o)throw a}}t.stack=n.join("\n"),this.state={error:t,mapped:!0}}else this.state={error:t,mapped:!1}}},{key:"mapError",value:function(t){var e=this;T("mapStackTrace")(t.stack,function(n){t.stack=n.join("\n"),e.setState({error:t,mapped:!0})})}},{key:"renderFrames",value:function(t){var e=this.props,n=e.filename,i=e.editorScheme,r=e.useLines,o=e.useColumns,a=T("assign")({},T("style"),this.props.style),s=a.frame,l=a.file,u=a.linkToFile;return t.map(function(t,e){var a=void 0,c=void 0;if(0===e&&n&&!T("isFilenameAbsolute")(t.fileName))c=T("makeUrl")(n,i),a=T("makeLinkText")(n);else{var p=r?t.lineNumber:null,h=o?t.columnNumber:null;c=T("makeUrl")(t.fileName,i,p,h),a=T("makeLinkText")(t.fileName,p,h)}return T("React").createElement("div",{style:s,key:e},T("React").createElement("div",null,t.functionName),T("React").createElement("div",{style:l},T("React").createElement("a",{href:c,style:u},a)))})}},{key:"render",value:function(){var t=this.state.error,e=this.props.className,n=T("assign")({},T("style"),this.props.style),i=n.redbox,r=n.message,o=n.stack,a=n.frame,s=void 0,l=void 0;try{s=T("ErrorStackParser").parse(t)}catch(t){l=new Error("Failed to parse stack trace. Stack trace information unavailable.")}return s=l?T("React").createElement("div",{style:a,key:0},T("React").createElement("div",null,l.message)):this.renderFrames(s),T("React").createElement("div",{style:i,className:e},T("React").createElement("div",{style:r},t.name,": ",t.message),T("React").createElement("div",{style:o},s))}}]),e}();v.propTypes={error:T("PropTypes").instanceOf(Error).isRequired,filename:T("PropTypes").string,editorScheme:T("PropTypes").string,useLines:T("PropTypes").bool,useColumns:T("PropTypes").bool,style:T("PropTypes").object,className:T("PropTypes").string},v.displayName="RedBoxError",v.defaultProps={useLines:!0,useColumns:!0};var x=function(t){function e(){return y(this,e),_(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return g(e,T("Component")),o(e,[{key:"componentDidMount",value:function(){this.el=document.createElement("div"),document.body.appendChild(this.el),this.renderRedBoxError()}},{key:"componentDidUpdate",value:function(){this.renderRedBoxError()}},{key:"componentWillUnmount",value:function(){T("ReactDOM").unmountComponentAtNode(this.el),document.body.removeChild(this.el),this.el=null}},{key:"renderRedBoxError",value:function(){T("ReactDOM").render(T("React").createElement(T("RedBoxError"),this.props),this.el)}},{key:"render",value:function(){return null}}]),e}();x.propTypes={error:T("PropTypes").instanceOf(Error).isRequired},x.displayName="RedBox",e.default=x;var b=Object.create(null),w="__INTENTIONAL_UNDEFINED__",E={};function T(t){if(void 0===b||void 0===b[t])return function(t){switch(t){case"PropTypes":return a.default;case"mapStackTrace":return d.mapStackTrace;case"assign":return h.default;case"style":return c.default;case"isFilenameAbsolute":return f.isFilenameAbsolute;case"makeUrl":return f.makeUrl;case"makeLinkText":return f.makeLinkText;case"ErrorStackParser":return p.default;case"Component":return s.Component;case"ReactDOM":return u.default;case"React":return l.default;case"RedBoxError":return v}return}(t);var e=b[t];return e===w?void 0:e}function S(t,e){if("object"!==(void 0===t?"undefined":i(t)))return b[t]=void 0===e?w:e,function(){P(t)};Object.keys(t).forEach(function(e){b[e]=t[e]})}function P(t){delete b[t]}function C(t){var e=Object.keys(t),n={};function i(){e.forEach(function(t){b[t]=n[t]})}return function(r){e.forEach(function(e){n[e]=b[e],b[e]=t[e]});var o=r();return o&&"function"==typeof o.then?o.then(i).catch(i):i(),o}}!function(){function t(t,e){Object.defineProperty(E,t,{value:e,enumerable:!1,configurable:!0})}t("__get__",T),t("__GetDependency__",T),t("__Rewire__",S),t("__set__",S),t("__reset__",P),t("__ResetDependency__",P),t("__with__",C)}();var k=void 0===x?"undefined":i(x);function A(t,e){Object.defineProperty(x,t,{value:e,enumerable:!1,configurable:!0})}"object"!==k&&"function"!==k||!Object.isExtensible(x)||(A("__get__",T),A("__GetDependency__",T),A("__Rewire__",S),A("__set__",S),A("__reset__",P),A("__ResetDependency__",P),A("__with__",C),A("__RewireAPI__",E)),e.__get__=T,e.__GetDependency__=T,e.__Rewire__=S,e.__set__=S,e.__ResetDependency__=P,e.__RewireAPI__=E},function(t,e,n){var i;
/*!
Copyright (c) 2017 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/*!
Copyright (c) 2017 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var t=[],e=0;e<arguments.length;e++){var i=arguments[e];if(i){var o=typeof i;if("string"===o||"number"===o)t.push(i);else if(Array.isArray(i)&&i.length){var a=r.apply(null,i);a&&t.push(a)}else if("object"===o)for(var s in i)n.call(i,s)&&i[s]&&t.push(s)}}return t.join(" ")}t.exports?(r.default=r,t.exports=r):void 0===(i=function(){return r}.apply(e,[]))||(t.exports=i)}()},function(t,e,n){"use strict";var i=n(36),r={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},s={};function l(t){return i.isMemo(t)?a:s[t.$$typeof]||r}s[i.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0};var u=Object.defineProperty,c=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols,h=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,d=Object.prototype;t.exports=function t(e,n,i){if("string"!=typeof n){if(d){var r=f(n);r&&r!==d&&t(e,r,i)}var a=c(n);p&&(a=a.concat(p(n)));for(var s=l(e),m=l(n),y=0;y<a.length;++y){var _=a[y];if(!(o[_]||i&&i[_]||m&&m[_]||s&&s[_])){var g=h(n,_);try{u(e,_,g)}catch(t){}}}return e}return e}},function(t,e,n){"use strict";t.exports=n(38)},,function(t,e,n){"use strict";
/** @license React v16.8.2
* react.production.min.js
*
* 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.
*/var i=n(9),r="function"==typeof Symbol&&Symbol.for,o=r?Symbol.for("react.element"):60103,a=r?Symbol.for("react.portal"):60106,s=r?Symbol.for("react.fragment"):60107,l=r?Symbol.for("react.strict_mode"):60108,u=r?Symbol.for("react.profiler"):60114,c=r?Symbol.for("react.provider"):60109,p=r?Symbol.for("react.context"):60110,h=r?Symbol.for("react.concurrent_mode"):60111,f=r?Symbol.for("react.forward_ref"):60112,d=r?Symbol.for("react.suspense"):60113,m=r?Symbol.for("react.memo"):60115,y=r?Symbol.for("react.lazy"):60116,_="function"==typeof Symbol&&Symbol.iterator;function g(t){for(var e=arguments.length-1,n="https://reactjs.org/docs/error-decoder.html?invariant="+t,i=0;i<e;i++)n+="&args[]="+encodeURIComponent(arguments[i+1]);!function(t,e,n,i,r,o,a,s){if(!t){if(t=void 0,void 0===e)t=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,i,r,o,a,s],u=0;(t=Error(e.replace(/%s/g,function(){return l[u++]}))).name="Invariant Violation"}throw t.framesToPop=1,t}}(!1,"Minified React error #"+t+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",n)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x={};function b(t,e,n){this.props=t,this.context=e,this.refs=x,this.updater=n||v}function w(){}function E(t,e,n){this.props=t,this.context=e,this.refs=x,this.updater=n||v}b.prototype.isReactComponent={},b.prototype.setState=function(t,e){"object"!=typeof t&&"function"!=typeof t&&null!=t&&g("85"),this.updater.enqueueSetState(this,t,e,"setState")},b.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")},w.prototype=b.prototype;var T=E.prototype=new w;T.constructor=E,i(T,b.prototype),T.isPureReactComponent=!0;var S={current:null},P={current:null},C=Object.prototype.hasOwnProperty,k={key:!0,ref:!0,__self:!0,__source:!0};function A(t,e,n){var i=void 0,r={},a=null,s=null;if(null!=e)for(i in void 0!==e.ref&&(s=e.ref),void 0!==e.key&&(a=""+e.key),e)C.call(e,i)&&!k.hasOwnProperty(i)&&(r[i]=e[i]);var l=arguments.length-2;if(1===l)r.children=n;else if(1<l){for(var u=Array(l),c=0;c<l;c++)u[c]=arguments[c+2];r.children=u}if(t&&t.defaultProps)for(i in l=t.defaultProps)void 0===r[i]&&(r[i]=l[i]);return{$$typeof:o,type:t,key:a,ref:s,props:r,_owner:P.current}}function z(t){return"object"==typeof t&&null!==t&&t.$$typeof===o}var L=/\/+/g,M=[];function I(t,e,n,i){if(M.length){var r=M.pop();return r.result=t,r.keyPrefix=e,r.func=n,r.context=i,r.count=0,r}return{result:t,keyPrefix:e,func:n,context:i,count:0}}function O(t){t.result=null,t.keyPrefix=null,t.func=null,t.context=null,t.count=0,10>M.length&&M.push(t)}function D(t,e,n){return null==t?0:function t(e,n,i,r){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var l=!1;if(null===e)l=!0;else switch(s){case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case o:case a:l=!0}}if(l)return i(r,e,""===n?"."+R(e,0):n),1;if(l=0,n=""===n?".":n+":",Array.isArray(e))for(var u=0;u<e.length;u++){var c=n+R(s=e[u],u);l+=t(s,c,i,r)}else if(c=null===e||"object"!=typeof e?null:"function"==typeof(c=_&&e[_]||e["@@iterator"])?c:null,"function"==typeof c)for(e=c.call(e),u=0;!(s=e.next()).done;)l+=t(s=s.value,c=n+R(s,u++),i,r);else"object"===s&&g("31","[object Object]"==(i=""+e)?"object with keys {"+Object.keys(e).join(", ")+"}":i,"");return l}(t,"",e,n)}function R(t,e){return"object"==typeof t&&null!==t&&null!=t.key?function(t){var e={"=":"=0",":":"=2"};return"$"+(""+t).replace(/[=:]/g,function(t){return e[t]})}(t.key):e.toString(36)}function B(t,e){t.func.call(t.context,e,t.count++)}function F(t,e,n){var i=t.result,r=t.keyPrefix;t=t.func.call(t.context,e,t.count++),Array.isArray(t)?N(t,i,n,function(t){return t}):null!=t&&(z(t)&&(t=function(t,e){return{$$typeof:o,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}(t,r+(!t.key||e&&e.key===t.key?"":(""+t.key).replace(L,"$&/")+"/")+n)),i.push(t))}function N(t,e,n,i,r){var o="";null!=n&&(o=(""+n).replace(L,"$&/")+"/"),D(t,F,e=I(e,o,i,r)),O(e)}function U(){var t=S.current;return null===t&&g("307"),t}var j={Children:{map:function(t,e,n){if(null==t)return t;var i=[];return N(t,i,null,e,n),i},forEach:function(t,e,n){if(null==t)return t;D(t,B,e=I(null,null,e,n)),O(e)},count:function(t){return D(t,function(){return null},null)},toArray:function(t){var e=[];return N(t,e,null,function(t){return t}),e},only:function(t){return z(t)||g("143"),t}},createRef:function(){return{current:null}},Component:b,PureComponent:E,createContext:function(t,e){return void 0===e&&(e=null),(t={$$typeof:p,_calculateChangedBits:e,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:c,_context:t},t.Consumer=t},forwardRef:function(t){return{$$typeof:f,render:t}},lazy:function(t){return{$$typeof:y,_ctor:t,_status:-1,_result:null}},memo:function(t,e){return{$$typeof:m,type:t,compare:void 0===e?null:e}},useCallback:function(t,e){return U().useCallback(t,e)},useContext:function(t,e){return U().useContext(t,e)},useEffect:function(t,e){return U().useEffect(t,e)},useImperativeHandle:function(t,e,n){return U().useImperativeHandle(t,e,n)},useDebugValue:function(){},useLayoutEffect:function(t,e){return U().useLayoutEffect(t,e)},useMemo:function(t,e){return U().useMemo(t,e)},useReducer:function(t,e,n){return U().useReducer(t,e,n)},useRef:function(t){return U().useRef(t)},useState:function(t){return U().useState(t)},Fragment:s,StrictMode:l,Suspense:d,createElement:A,cloneElement:function(t,e,n){null==t&&g("267",t);var r=void 0,a=i({},t.props),s=t.key,l=t.ref,u=t._owner;if(null!=e){void 0!==e.ref&&(l=e.ref,u=P.current),void 0!==e.key&&(s=""+e.key);var c=void 0;for(r in t.type&&t.type.defaultProps&&(c=t.type.defaultProps),e)C.call(e,r)&&!k.hasOwnProperty(r)&&(a[r]=void 0===e[r]&&void 0!==c?c[r]:e[r])}if(1===(r=arguments.length-2))a.children=n;else if(1<r){c=Array(r);for(var p=0;p<r;p++)c[p]=arguments[p+2];a.children=c}return{$$typeof:o,type:t.type,key:s,ref:l,props:a,_owner:u}},createFactory:function(t){var e=A.bind(null,t);return e.type=t,e},isValidElement:z,version:"16.8.2",unstable_ConcurrentMode:h,unstable_Profiler:u,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentDispatcher:S,ReactCurrentOwner:P,assign:i}},V={default:j},Z=V&&j||V;t.exports=Z.default||Z},function(t,e,n){"use strict";
/** @license React v16.8.2
* react-dom.production.min.js
*
* 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.
*/var i=n(0),r=n(9),o=n(21);function a(t){for(var e=arguments.length-1,n="https://reactjs.org/docs/error-decoder.html?invariant="+t,i=0;i<e;i++)n+="&args[]="+encodeURIComponent(arguments[i+1]);!function(t,e,n,i,r,o,a,s){if(!t){if(t=void 0,void 0===e)t=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,i,r,o,a,s],u=0;(t=Error(e.replace(/%s/g,function(){return l[u++]}))).name="Invariant Violation"}throw t.framesToPop=1,t}}(!1,"Minified React error #"+t+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",n)}i||a("227");var s=!1,l=null,u=!1,c=null,p={onError:function(t){s=!0,l=t}};function h(t,e,n,i,r,o,a,u,c){s=!1,l=null,function(t,e,n,i,r,o,a,s,l){var u=Array.prototype.slice.call(arguments,3);try{e.apply(n,u)}catch(t){this.onError(t)}}.apply(p,arguments)}var f=null,d={};function m(){if(f)for(var t in d){var e=d[t],n=f.indexOf(t);if(-1<n||a("96",t),!_[n])for(var i in e.extractEvents||a("97",t),_[n]=e,n=e.eventTypes){var r=void 0,o=n[i],s=e,l=i;g.hasOwnProperty(l)&&a("99",l),g[l]=o;var u=o.phasedRegistrationNames;if(u){for(r in u)u.hasOwnProperty(r)&&y(u[r],s,l);r=!0}else o.registrationName?(y(o.registrationName,s,l),r=!0):r=!1;r||a("98",i,t)}}}function y(t,e,n){v[t]&&a("100",t),v[t]=e,x[t]=e.eventTypes[n].dependencies}var _=[],g={},v={},x={},b=null,w=null,E=null;function T(t,e,n){var i=t.type||"unknown-event";t.currentTarget=E(n),function(t,e,n,i,r,o,p,f,d){if(h.apply(this,arguments),s){if(s){var m=l;s=!1,l=null}else a("198"),m=void 0;u||(u=!0,c=m)}}(i,e,void 0,t),t.currentTarget=null}function S(t,e){return null==e&&a("30"),null==t?e:Array.isArray(t)?Array.isArray(e)?(t.push.apply(t,e),t):(t.push(e),t):Array.isArray(e)?[t].concat(e):[t,e]}function P(t,e,n){Array.isArray(t)?t.forEach(e,n):t&&e.call(n,t)}var C=null;function k(t){if(t){var e=t._dispatchListeners,n=t._dispatchInstances;if(Array.isArray(e))for(var i=0;i<e.length&&!t.isPropagationStopped();i++)T(t,e[i],n[i]);else e&&T(t,e,n);t._dispatchListeners=null,t._dispatchInstances=null,t.isPersistent()||t.constructor.release(t)}}var A={injectEventPluginOrder:function(t){f&&a("101"),f=Array.prototype.slice.call(t),m()},injectEventPluginsByName:function(t){var e,n=!1;for(e in t)if(t.hasOwnProperty(e)){var i=t[e];d.hasOwnProperty(e)&&d[e]===i||(d[e]&&a("102",e),d[e]=i,n=!0)}n&&m()}};function z(t,e){var n=t.stateNode;if(!n)return null;var i=b(n);if(!i)return null;n=i[e];t:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":(i=!i.disabled)||(i=!("button"===(t=t.type)||"input"===t||"select"===t||"textarea"===t)),t=!i;break t;default:t=!1}return t?null:(n&&"function"!=typeof n&&a("231",e,typeof n),n)}function L(t){if(null!==t&&(C=S(C,t)),t=C,C=null,t&&(P(t,k),C&&a("95"),u))throw t=c,u=!1,c=null,t}var M=Math.random().toString(36).slice(2),I="__reactInternalInstance$"+M,O="__reactEventHandlers$"+M;function D(t){if(t[I])return t[I];for(;!t[I];){if(!t.parentNode)return null;t=t.parentNode}return 5===(t=t[I]).tag||6===t.tag?t:null}function R(t){return!(t=t[I])||5!==t.tag&&6!==t.tag?null:t}function B(t){if(5===t.tag||6===t.tag)return t.stateNode;a("33")}function F(t){return t[O]||null}function N(t){do{t=t.return}while(t&&5!==t.tag);return t||null}function U(t,e,n){(e=z(t,n.dispatchConfig.phasedRegistrationNames[e]))&&(n._dispatchListeners=S(n._dispatchListeners,e),n._dispatchInstances=S(n._dispatchInstances,t))}function j(t){if(t&&t.dispatchConfig.phasedRegistrationNames){for(var e=t._targetInst,n=[];e;)n.push(e),e=N(e);for(e=n.length;0<e--;)U(n[e],"captured",t);for(e=0;e<n.length;e++)U(n[e],"bubbled",t)}}function V(t,e,n){t&&n&&n.dispatchConfig.registrationName&&(e=z(t,n.dispatchConfig.registrationName))&&(n._dispatchListeners=S(n._dispatchListeners,e),n._dispatchInstances=S(n._dispatchInstances,t))}function Z(t){t&&t.dispatchConfig.registrationName&&V(t._targetInst,null,t)}function q(t){P(t,j)}var G=!("undefined"==typeof window||!window.document||!window.document.createElement);function W(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var H={animationend:W("Animation","AnimationEnd"),animationiteration:W("Animation","AnimationIteration"),animationstart:W("Animation","AnimationStart"),transitionend:W("Transition","TransitionEnd")},X={},K={};function Y(t){if(X[t])return X[t];if(!H[t])return t;var e,n=H[t];for(e in n)if(n.hasOwnProperty(e)&&e in K)return X[t]=n[e];return t}G&&(K=document.createElement("div").style,"AnimationEvent"in window||(delete H.animationend.animation,delete H.animationiteration.animation,delete H.animationstart.animation),"TransitionEvent"in window||delete H.transitionend.transition);var J=Y("animationend"),$=Y("animationiteration"),Q=Y("animationstart"),tt=Y("transitionend"),et="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),nt=null,it=null,rt=null;function ot(){if(rt)return rt;var t,e,n=it,i=n.length,r="value"in nt?nt.value:nt.textContent,o=r.length;for(t=0;t<i&&n[t]===r[t];t++);var a=i-t;for(e=1;e<=a&&n[i-e]===r[o-e];e++);return rt=r.slice(t,1<e?1-e:void 0)}function at(){return!0}function st(){return!1}function lt(t,e,n,i){for(var r in this.dispatchConfig=t,this._targetInst=e,this.nativeEvent=n,t=this.constructor.Interface)t.hasOwnProperty(r)&&((e=t[r])?this[r]=e(n):"target"===r?this.target=i:this[r]=n[r]);return this.isDefaultPrevented=(null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue)?at:st,this.isPropagationStopped=st,this}function ut(t,e,n,i){if(this.eventPool.length){var r=this.eventPool.pop();return this.call(r,t,e,n,i),r}return new this(t,e,n,i)}function ct(t){t instanceof this||a("279"),t.destructor(),10>this.eventPool.length&&this.eventPool.push(t)}function pt(t){t.eventPool=[],t.getPooled=ut,t.release=ct}r(lt.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():"unknown"!=typeof t.returnValue&&(t.returnValue=!1),this.isDefaultPrevented=at)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():"unknown"!=typeof t.cancelBubble&&(t.cancelBubble=!0),this.isPropagationStopped=at)},persist:function(){this.isPersistent=at},isPersistent:st,destructor:function(){var t,e=this.constructor.Interface;for(t in e)this[t]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=st,this._dispatchInstances=this._dispatchListeners=null}}),lt.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null},lt.extend=function(t){function e(){}function n(){return i.apply(this,arguments)}var i=this;e.prototype=i.prototype;var o=new e;return r(o,n.prototype),n.prototype=o,n.prototype.constructor=n,n.Interface=r({},i.Interface,t),n.extend=i.extend,pt(n),n},pt(lt);var ht=lt.extend({data:null}),ft=lt.extend({data:null}),dt=[9,13,27,32],mt=G&&"CompositionEvent"in window,yt=null;G&&"documentMode"in document&&(yt=document.documentMode);var _t=G&&"TextEvent"in window&&!yt,gt=G&&(!mt||yt&&8<yt&&11>=yt),vt=String.fromCharCode(32),xt={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},bt=!1;function wt(t,e){switch(t){case"keyup":return-1!==dt.indexOf(e.keyCode);case"keydown":return 229!==e.keyCode;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function Et(t){return"object"==typeof(t=t.detail)&&"data"in t?t.data:null}var Tt=!1;var St={eventTypes:xt,extractEvents:function(t,e,n,i){var r=void 0,o=void 0;if(mt)t:{switch(t){case"compositionstart":r=xt.compositionStart;break t;case"compositionend":r=xt.compositionEnd;break t;case"compositionupdate":r=xt.compositionUpdate;break t}r=void 0}else Tt?wt(t,n)&&(r=xt.compositionEnd):"keydown"===t&&229===n.keyCode&&(r=xt.compositionStart);return r?(gt&&"ko"!==n.locale&&(Tt||r!==xt.compositionStart?r===xt.compositionEnd&&Tt&&(o=ot()):(it="value"in(nt=i)?nt.value:nt.textContent,Tt=!0)),r=ht.getPooled(r,e,n,i),o?r.data=o:null!==(o=Et(n))&&(r.data=o),q(r),o=r):o=null,(t=_t?function(t,e){switch(t){case"compositionend":return Et(e);case"keypress":return 32!==e.which?null:(bt=!0,vt);case"textInput":return(t=e.data)===vt&&bt?null:t;default:return null}}(t,n):function(t,e){if(Tt)return"compositionend"===t||!mt&&wt(t,e)?(t=ot(),rt=it=nt=null,Tt=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return gt&&"ko"!==e.locale?null:e.data;default:return null}}(t,n))?((e=ft.getPooled(xt.beforeInput,e,n,i)).data=t,q(e)):e=null,null===o?e:null===e?o:[o,e]}},Pt=null,Ct=null,kt=null;function At(t){if(t=w(t)){"function"!=typeof Pt&&a("280");var e=b(t.stateNode);Pt(t.stateNode,t.type,e)}}function zt(t){Ct?kt?kt.push(t):kt=[t]:Ct=t}function Lt(){if(Ct){var t=Ct,e=kt;if(kt=Ct=null,At(t),e)for(t=0;t<e.length;t++)At(e[t])}}function Mt(t,e){return t(e)}function It(t,e,n){return t(e,n)}function Ot(){}var Dt=!1;function Rt(t,e){if(Dt)return t(e);Dt=!0;try{return Mt(t,e)}finally{Dt=!1,(null!==Ct||null!==kt)&&(Ot(),Lt())}}var Bt={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Ft(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return"input"===e?!!Bt[t.type]:"textarea"===e}function Nt(t){return(t=t.target||t.srcElement||window).correspondingUseElement&&(t=t.correspondingUseElement),3===t.nodeType?t.parentNode:t}function Ut(t){if(!G)return!1;var e=(t="on"+t)in document;return e||((e=document.createElement("div")).setAttribute(t,"return;"),e="function"==typeof e[t]),e}function jt(t){var e=t.type;return(t=t.nodeName)&&"input"===t.toLowerCase()&&("checkbox"===e||"radio"===e)}function Vt(t){t._valueTracker||(t._valueTracker=function(t){var e=jt(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),i=""+t[e];if(!t.hasOwnProperty(e)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var r=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return r.call(this)},set:function(t){i=""+t,o.call(this,t)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return i},setValue:function(t){i=""+t},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}(t))}function Zt(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),i="";return t&&(i=jt(t)?t.checked?"true":"false":t.value),(t=i)!==n&&(e.setValue(t),!0)}var qt=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;qt.hasOwnProperty("ReactCurrentDispatcher")||(qt.ReactCurrentDispatcher={current:null});var Gt=/^(.*)[\\\/]/,Wt="function"==typeof Symbol&&Symbol.for,Ht=Wt?Symbol.for("react.element"):60103,Xt=Wt?Symbol.for("react.portal"):60106,Kt=Wt?Symbol.for("react.fragment"):60107,Yt=Wt?Symbol.for("react.strict_mode"):60108,Jt=Wt?Symbol.for("react.profiler"):60114,$t=Wt?Symbol.for("react.provider"):60109,Qt=Wt?Symbol.for("react.context"):60110,te=Wt?Symbol.for("react.concurrent_mode"):60111,ee=Wt?Symbol.for("react.forward_ref"):60112,ne=Wt?Symbol.for("react.suspense"):60113,ie=Wt?Symbol.for("react.memo"):60115,re=Wt?Symbol.for("react.lazy"):60116,oe="function"==typeof Symbol&&Symbol.iterator;function ae(t){return null===t||"object"!=typeof t?null:"function"==typeof(t=oe&&t[oe]||t["@@iterator"])?t:null}function se(t){if(null==t)return null;if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case te:return"ConcurrentMode";case Kt:return"Fragment";case Xt:return"Portal";case Jt:return"Profiler";case Yt:return"StrictMode";case ne:return"Suspense"}if("object"==typeof t)switch(t.$$typeof){case Qt:return"Context.Consumer";case $t:return"Context.Provider";case ee:var e=t.render;return e=e.displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case ie:return se(t.type);case re:if(t=1===t._status?t._result:null)return se(t)}return null}function le(t){var e="";do{t:switch(t.tag){case 3:case 4:case 6:case 7:case 10:case 9:var n="";break t;default:var i=t._debugOwner,r=t._debugSource,o=se(t.type);n=null,i&&(n=se(i.type)),i=o,o="",r?o=" (at "+r.fileName.replace(Gt,"")+":"+r.lineNumber+")":n&&(o=" (created by "+n+")"),n="\n in "+(i||"Unknown")+o}e+=n,t=t.return}while(t);return e}var ue=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ce=Object.prototype.hasOwnProperty,pe={},he={};function fe(t,e,n,i,r){this.acceptsBooleans=2===e||3===e||4===e,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=t,this.type=e}var de={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){de[t]=new fe(t,0,!1,t,null)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];de[e]=new fe(e,1,!1,t[1],null)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){de[t]=new fe(t,2,!1,t.toLowerCase(),null)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){de[t]=new fe(t,2,!1,t,null)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){de[t]=new fe(t,3,!1,t.toLowerCase(),null)}),["checked","multiple","muted","selected"].forEach(function(t){de[t]=new fe(t,3,!0,t,null)}),["capture","download"].forEach(function(t){de[t]=new fe(t,4,!1,t,null)}),["cols","rows","size","span"].forEach(function(t){de[t]=new fe(t,6,!1,t,null)}),["rowSpan","start"].forEach(function(t){de[t]=new fe(t,5,!1,t.toLowerCase(),null)});var me=/[\-:]([a-z])/g;function ye(t){return t[1].toUpperCase()}function _e(t,e,n,i){var r=de.hasOwnProperty(e)?de[e]:null;(null!==r?0===r.type:!i&&(2<e.length&&("o"===e[0]||"O"===e[0])&&("n"===e[1]||"N"===e[1])))||(function(t,e,n,i){if(null==e||function(t,e,n,i){if(null!==n&&0===n.type)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return!i&&(null!==n?!n.acceptsBooleans:"data-"!==(t=t.toLowerCase().slice(0,5))&&"aria-"!==t);default:return!1}}(t,e,n,i))return!0;if(i)return!1;if(null!==n)switch(n.type){case 3:return!e;case 4:return!1===e;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}(e,n,r,i)&&(n=null),i||null===r?function(t){return!!ce.call(he,t)||!ce.call(pe,t)&&(ue.test(t)?he[t]=!0:(pe[t]=!0,!1))}(e)&&(null===n?t.removeAttribute(e):t.setAttribute(e,""+n)):r.mustUseProperty?t[r.propertyName]=null===n?3!==r.type&&"":n:(e=r.attributeName,i=r.attributeNamespace,null===n?t.removeAttribute(e):(n=3===(r=r.type)||4===r&&!0===n?"":""+n,i?t.setAttributeNS(i,e,n):t.setAttribute(e,n))))}function ge(t){switch(typeof t){case"boolean":case"number":case"object":case"string":case"undefined":return t;default:return""}}function ve(t,e){var n=e.checked;return r({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:t._wrapperState.initialChecked})}function xe(t,e){var n=null==e.defaultValue?"":e.defaultValue,i=null!=e.checked?e.checked:e.defaultChecked;n=ge(null!=e.value?e.value:n),t._wrapperState={initialChecked:i,initialValue:n,controlled:"checkbox"===e.type||"radio"===e.type?null!=e.checked:null!=e.value}}function be(t,e){null!=(e=e.checked)&&_e(t,"checked",e,!1)}function we(t,e){be(t,e);var n=ge(e.value),i=e.type;if(null!=n)"number"===i?(0===n&&""===t.value||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if("submit"===i||"reset"===i)return void t.removeAttribute("value");e.hasOwnProperty("value")?Te(t,e.type,n):e.hasOwnProperty("defaultValue")&&Te(t,e.type,ge(e.defaultValue)),null==e.checked&&null!=e.defaultChecked&&(t.defaultChecked=!!e.defaultChecked)}function Ee(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!("submit"!==i&&"reset"!==i||void 0!==e.value&&null!==e.value))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}""!==(n=t.name)&&(t.name=""),t.defaultChecked=!t.defaultChecked,t.defaultChecked=!!t._wrapperState.initialChecked,""!==n&&(t.name=n)}function Te(t,e,n){"number"===e&&t.ownerDocument.activeElement===t||(null==n?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(me,ye);de[e]=new fe(e,1,!1,t,null)}),"xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(me,ye);de[e]=new fe(e,1,!1,t,"http://www.w3.org/1999/xlink")}),["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(me,ye);de[e]=new fe(e,1,!1,t,"http://www.w3.org/XML/1998/namespace")}),["tabIndex","crossOrigin"].forEach(function(t){de[t]=new fe(t,1,!1,t.toLowerCase(),null)});var Se={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"blur change click focus input keydown keyup selectionchange".split(" ")}};function Pe(t,e,n){return(t=lt.getPooled(Se.change,t,e,n)).type="change",zt(n),q(t),t}var Ce=null,ke=null;function Ae(t){L(t)}function ze(t){if(Zt(B(t)))return t}function Le(t,e){if("change"===t)return e}var Me=!1;function Ie(){Ce&&(Ce.detachEvent("onpropertychange",Oe),ke=Ce=null)}function Oe(t){"value"===t.propertyName&&ze(ke)&&Rt(Ae,t=Pe(ke,t,Nt(t)))}function De(t,e,n){"focus"===t?(Ie(),ke=n,(Ce=e).attachEvent("onpropertychange",Oe)):"blur"===t&&Ie()}function Re(t){if("selectionchange"===t||"keyup"===t||"keydown"===t)return ze(ke)}function Be(t,e){if("click"===t)return ze(e)}function Fe(t,e){if("input"===t||"change"===t)return ze(e)}G&&(Me=Ut("input")&&(!document.documentMode||9<document.documentMode));var Ne={eventTypes:Se,_isInputEventSupported:Me,extractEvents:function(t,e,n,i){var r=e?B(e):window,o=void 0,a=void 0,s=r.nodeName&&r.nodeName.toLowerCase();if("select"===s||"input"===s&&"file"===r.type?o=Le:Ft(r)?Me?o=Fe:(o=Re,a=De):(s=r.nodeName)&&"input"===s.toLowerCase()&&("checkbox"===r.type||"radio"===r.type)&&(o=Be),o&&(o=o(t,e)))return Pe(o,n,i);a&&a(t,r,e),"blur"===t&&(t=r._wrapperState)&&t.controlled&&"number"===r.type&&Te(r,"number",r.value)}},Ue=lt.extend({view:null,detail:null}),je={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ve(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):!!(t=je[t])&&!!e[t]}function Ze(){return Ve}var qe=0,Ge=0,We=!1,He=!1,Xe=Ue.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:Ze,button:null,buttons:null,relatedTarget:function(t){return t.relatedTarget||(t.fromElement===t.srcElement?t.toElement:t.fromElement)},movementX:function(t){if("movementX"in t)return t.movementX;var e=qe;return qe=t.screenX,We?"mousemove"===t.type?t.screenX-e:0:(We=!0,0)},movementY:function(t){if("movementY"in t)return t.movementY;var e=Ge;return Ge=t.screenY,He?"mousemove"===t.type?t.screenY-e:0:(He=!0,0)}}),Ke=Xe.extend({pointerId:null,width:null,height:null,pressure:null,tangentialPressure:null,tiltX:null,tiltY:null,twist:null,pointerType:null,isPrimary:null}),Ye={mouseEnter:{registrationName:"onMouseEnter",dependencies:["mouseout","mouseover"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["mouseout","mouseover"]},pointerEnter:{registrationName:"onPointerEnter",dependencies:["pointerout","pointerover"]},pointerLeave:{registrationName:"onPointerLeave",dependencies:["pointerout","pointerover"]}},Je={eventTypes:Ye,extractEvents:function(t,e,n,i){var r="mouseover"===t||"pointerover"===t,o="mouseout"===t||"pointerout"===t;if(r&&(n.relatedTarget||n.fromElement)||!o&&!r)return null;if(r=i.window===i?i:(r=i.ownerDocument)?r.defaultView||r.parentWindow:window,o?(o=e,e=(e=n.relatedTarget||n.toElement)?D(e):null):o=null,o===e)return null;var a=void 0,s=void 0,l=void 0,u=void 0;"mouseout"===t||"mouseover"===t?(a=Xe,s=Ye.mouseLeave,l=Ye.mouseEnter,u="mouse"):"pointerout"!==t&&"pointerover"!==t||(a=Ke,s=Ye.pointerLeave,l=Ye.pointerEnter,u="pointer");var c=null==o?r:B(o);if(r=null==e?r:B(e),(t=a.getPooled(s,o,n,i)).type=u+"leave",t.target=c,t.relatedTarget=r,(n=a.getPooled(l,e,n,i)).type=u+"enter",n.target=r,n.relatedTarget=c,i=e,o&&i)t:{for(r=i,u=0,a=e=o;a;a=N(a))u++;for(a=0,l=r;l;l=N(l))a++;for(;0<u-a;)e=N(e),u--;for(;0<a-u;)r=N(r),a--;for(;u--;){if(e===r||e===r.alternate)break t;e=N(e),r=N(r)}e=null}else e=null;for(r=e,e=[];o&&o!==r&&(null===(u=o.alternate)||u!==r);)e.push(o),o=N(o);for(o=[];i&&i!==r&&(null===(u=i.alternate)||u!==r);)o.push(i),i=N(i);for(i=0;i<e.length;i++)V(e[i],"bubbled",t);for(i=o.length;0<i--;)V(o[i],"captured",n);return[t,n]}};function $e(t,e){return t===e&&(0!==t||1/t==1/e)||t!=t&&e!=e}var Qe=Object.prototype.hasOwnProperty;function tn(t,e){if($e(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;var n=Object.keys(t),i=Object.keys(e);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++)if(!Qe.call(e,n[i])||!$e(t[n[i]],e[n[i]]))return!1;return!0}function en(t){var e=t;if(t.alternate)for(;e.return;)e=e.return;else{if(0!=(2&e.effectTag))return 1;for(;e.return;)if(0!=(2&(e=e.return).effectTag))return 1}return 3===e.tag?2:3}function nn(t){2!==en(t)&&a("188")}function rn(t){if(!(t=function(t){var e=t.alternate;if(!e)return 3===(e=en(t))&&a("188"),1===e?null:t;for(var n=t,i=e;;){var r=n.return,o=r?r.alternate:null;if(!r||!o)break;if(r.child===o.child){for(var s=r.child;s;){if(s===n)return nn(r),t;if(s===i)return nn(r),e;s=s.sibling}a("188")}if(n.return!==i.return)n=r,i=o;else{s=!1;for(var l=r.child;l;){if(l===n){s=!0,n=r,i=o;break}if(l===i){s=!0,i=r,n=o;break}l=l.sibling}if(!s){for(l=o.child;l;){if(l===n){s=!0,n=o,i=r;break}if(l===i){s=!0,i=o,n=r;break}l=l.sibling}s||a("189")}}n.alternate!==i&&a("190")}return 3!==n.tag&&a("188"),n.stateNode.current===n?t:e}(t)))return null;for(var e=t;;){if(5===e.tag||6===e.tag)return e;if(e.child)e.child.return=e,e=e.child;else{if(e===t)break;for(;!e.sibling;){if(!e.return||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}}return null}var on=lt.extend({animationName:null,elapsedTime:null,pseudoElement:null}),an=lt.extend({clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),sn=Ue.extend({relatedTarget:null});function ln(t){var e=t.keyCode;return"charCode"in t?0===(t=t.charCode)&&13===e&&(t=13):t=e,10===t&&(t=13),32<=t||13===t?t:0}var un={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},cn={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},pn=Ue.extend({key:function(t){if(t.key){var e=un[t.key]||t.key;if("Unidentified"!==e)return e}return"keypress"===t.type?13===(t=ln(t))?"Enter":String.fromCharCode(t):"keydown"===t.type||"keyup"===t.type?cn[t.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:Ze,charCode:function(t){return"keypress"===t.type?ln(t):0},keyCode:function(t){return"keydown"===t.type||"keyup"===t.type?t.keyCode:0},which:function(t){return"keypress"===t.type?ln(t):"keydown"===t.type||"keyup"===t.type?t.keyCode:0}}),hn=Xe.extend({dataTransfer:null}),fn=Ue.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:Ze}),dn=lt.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),mn=Xe.extend({deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:null,deltaMode:null}),yn=[["abort","abort"],[J,"animationEnd"],[$,"animationIteration"],[Q,"animationStart"],["canplay","canPlay"],["canplaythrough","canPlayThrough"],["drag","drag"],["dragenter","dragEnter"],["dragexit","dragExit"],["dragleave","dragLeave"],["dragover","dragOver"],["durationchange","durationChange"],["emptied","emptied"],["encrypted","encrypted"],["ended","ended"],["error","error"],["gotpointercapture","gotPointerCapture"],["load","load"],["loadeddata","loadedData"],["loadedmetadata","loadedMetadata"],["loadstart","loadStart"],["lostpointercapture","lostPointerCapture"],["mousemove","mouseMove"],["mouseout","mouseOut"],["mouseover","mouseOver"],["playing","playing"],["pointermove","pointerMove"],["pointerout","pointerOut"],["pointerover","pointerOver"],["progress","progress"],["scroll","scroll"],["seeking","seeking"],["stalled","stalled"],["suspend","suspend"],["timeupdate","timeUpdate"],["toggle","toggle"],["touchmove","touchMove"],[tt,"transitionEnd"],["waiting","waiting"],["wheel","wheel"]],_n={},gn={};function vn(t,e){var n=t[0],i="on"+((t=t[1])[0].toUpperCase()+t.slice(1));e={phasedRegistrationNames:{bubbled:i,captured:i+"Capture"},dependencies:[n],isInteractive:e},_n[t]=e,gn[n]=e}[["blur","blur"],["cancel","cancel"],["click","click"],["close","close"],["contextmenu","contextMenu"],["copy","copy"],["cut","cut"],["auxclick","auxClick"],["dblclick","doubleClick"],["dragend","dragEnd"],["dragstart","dragStart"],["drop","drop"],["focus","focus"],["input","input"],["invalid","invalid"],["keydown","keyDown"],["keypress","keyPress"],["keyup","keyUp"],["mousedown","mouseDown"],["mouseup","mouseUp"],["paste","paste"],["pause","pause"],["play","play"],["pointercancel","pointerCancel"],["pointerdown","pointerDown"],["pointerup","pointerUp"],["ratechange","rateChange"],["reset","reset"],["seeked","seeked"],["submit","submit"],["touchcancel","touchCancel"],["touchend","touchEnd"],["touchstart","touchStart"],["volumechange","volumeChange"]].forEach(function(t){vn(t,!0)}),yn.forEach(function(t){vn(t,!1)});var xn={eventTypes:_n,isInteractiveTopLevelEventType:function(t){return void 0!==(t=gn[t])&&!0===t.isInteractive},extractEvents:function(t,e,n,i){var r=gn[t];if(!r)return null;switch(t){case"keypress":if(0===ln(n))return null;case"keydown":case"keyup":t=pn;break;case"blur":case"focus":t=sn;break;case"click":if(2===n.button)return null;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":t=Xe;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":t=hn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":t=fn;break;case J:case $:case Q:t=on;break;case tt:t=dn;break;case"scroll":t=Ue;break;case"wheel":t=mn;break;case"copy":case"cut":case"paste":t=an;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":t=Ke;break;default:t=lt}return q(e=t.getPooled(r,e,n,i)),e}},bn=xn.isInteractiveTopLevelEventType,wn=[];function En(t){var e=t.targetInst,n=e;do{if(!n){t.ancestors.push(n);break}var i;for(i=n;i.return;)i=i.return;if(!(i=3!==i.tag?null:i.stateNode.containerInfo))break;t.ancestors.push(n),n=D(i)}while(n);for(n=0;n<t.ancestors.length;n++){e=t.ancestors[n];var r=Nt(t.nativeEvent);i=t.topLevelType;for(var o=t.nativeEvent,a=null,s=0;s<_.length;s++){var l=_[s];l&&(l=l.extractEvents(i,e,o,r))&&(a=S(a,l))}L(a)}}var Tn=!0;function Sn(t,e){if(!e)return null;var n=(bn(t)?Cn:kn).bind(null,t);e.addEventListener(t,n,!1)}function Pn(t,e){if(!e)return null;var n=(bn(t)?Cn:kn).bind(null,t);e.addEventListener(t,n,!0)}function Cn(t,e){It(kn,t,e)}function kn(t,e){if(Tn){var n=Nt(e);if(null===(n=D(n))||"number"!=typeof n.tag||2===en(n)||(n=null),wn.length){var i=wn.pop();i.topLevelType=t,i.nativeEvent=e,i.targetInst=n,t=i}else t={topLevelType:t,nativeEvent:e,targetInst:n,ancestors:[]};try{Rt(En,t)}finally{t.topLevelType=null,t.nativeEvent=null,t.targetInst=null,t.ancestors.length=0,10>wn.length&&wn.push(t)}}}var An={},zn=0,Ln="_reactListenersID"+(""+Math.random()).slice(2);function Mn(t){return Object.prototype.hasOwnProperty.call(t,Ln)||(t[Ln]=zn++,An[t[Ln]]={}),An[t[Ln]]}function In(t){if(void 0===(t=t||("undefined"!=typeof document?document:void 0)))return null;try{return t.activeElement||t.body}catch(e){return t.body}}function On(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Dn(t,e){var n,i=On(t);for(t=0;i;){if(3===i.nodeType){if(n=t+i.textContent.length,t<=e&&n>=e)return{node:i,offset:e-t};t=n}t:{for(;i;){if(i.nextSibling){i=i.nextSibling;break t}i=i.parentNode}i=void 0}i=On(i)}}function Rn(){for(var t=window,e=In();e instanceof t.HTMLIFrameElement;){try{t=e.contentDocument.defaultView}catch(t){break}e=In(t.document)}return e}function Bn(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&("input"===e&&("text"===t.type||"search"===t.type||"tel"===t.type||"url"===t.type||"password"===t.type)||"textarea"===e||"true"===t.contentEditable)}function Fn(t){var e=Rn(),n=t.focusedElem,i=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&function t(e,n){return!(!e||!n)&&(e===n||(!e||3!==e.nodeType)&&(n&&3===n.nodeType?t(e,n.parentNode):"contains"in e?e.contains(n):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(n))))}(n.ownerDocument.documentElement,n)){if(null!==i&&Bn(n))if(e=i.start,void 0===(t=i.end)&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if((t=(e=n.ownerDocument||document)&&e.defaultView||window).getSelection){t=t.getSelection();var r=n.textContent.length,o=Math.min(i.start,r);i=void 0===i.end?o:Math.min(i.end,r),!t.extend&&o>i&&(r=i,i=o,o=r),r=Dn(n,o);var a=Dn(n,i);r&&a&&(1!==t.rangeCount||t.anchorNode!==r.node||t.anchorOffset!==r.offset||t.focusNode!==a.node||t.focusOffset!==a.offset)&&((e=e.createRange()).setStart(r.node,r.offset),t.removeAllRanges(),o>i?(t.addRange(e),t.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),t.addRange(e)))}for(e=[],t=n;t=t.parentNode;)1===t.nodeType&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for("function"==typeof n.focus&&n.focus(),n=0;n<e.length;n++)(t=e[n]).element.scrollLeft=t.left,t.element.scrollTop=t.top}}var Nn=G&&"documentMode"in document&&11>=document.documentMode,Un={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},jn=null,Vn=null,Zn=null,qn=!1;function Gn(t,e){var n=e.window===e?e.document:9===e.nodeType?e:e.ownerDocument;return qn||null==jn||jn!==In(n)?null:("selectionStart"in(n=jn)&&Bn(n)?n={start:n.selectionStart,end:n.selectionEnd}:n={anchorNode:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset},Zn&&tn(Zn,n)?null:(Zn=n,(t=lt.getPooled(Un.select,Vn,t,e)).type="select",t.target=jn,q(t),t))}var Wn={eventTypes:Un,extractEvents:function(t,e,n,i){var r,o=i.window===i?i.document:9===i.nodeType?i:i.ownerDocument;if(!(r=!o)){t:{o=Mn(o),r=x.onSelect;for(var a=0;a<r.length;a++){var s=r[a];if(!o.hasOwnProperty(s)||!o[s]){o=!1;break t}}o=!0}r=!o}if(r)return null;switch(o=e?B(e):window,t){case"focus":(Ft(o)||"true"===o.contentEditable)&&(jn=o,Vn=e,Zn=null);break;case"blur":Zn=Vn=jn=null;break;case"mousedown":qn=!0;break;case"contextmenu":case"mouseup":case"dragend":return qn=!1,Gn(n,i);case"selectionchange":if(Nn)break;case"keydown":case"keyup":return Gn(n,i)}return null}};function Hn(t,e){return t=r({children:void 0},e),(e=function(t){var e="";return i.Children.forEach(t,function(t){null!=t&&(e+=t)}),e}(e.children))&&(t.children=e),t}function Xn(t,e,n,i){if(t=t.options,e){e={};for(var r=0;r<n.length;r++)e["$"+n[r]]=!0;for(n=0;n<t.length;n++)r=e.hasOwnProperty("$"+t[n].value),t[n].selected!==r&&(t[n].selected=r),r&&i&&(t[n].defaultSelected=!0)}else{for(n=""+ge(n),e=null,r=0;r<t.length;r++){if(t[r].value===n)return t[r].selected=!0,void(i&&(t[r].defaultSelected=!0));null!==e||t[r].disabled||(e=t[r])}null!==e&&(e.selected=!0)}}function Kn(t,e){return null!=e.dangerouslySetInnerHTML&&a("91"),r({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Yn(t,e){var n=e.value;null==n&&(n=e.defaultValue,null!=(e=e.children)&&(null!=n&&a("92"),Array.isArray(e)&&(1>=e.length||a("93"),e=e[0]),n=e),null==n&&(n="")),t._wrapperState={initialValue:ge(n)}}function Jn(t,e){var n=ge(e.value),i=ge(e.defaultValue);null!=n&&((n=""+n)!==t.value&&(t.value=n),null==e.defaultValue&&t.defaultValue!==n&&(t.defaultValue=n)),null!=i&&(t.defaultValue=""+i)}function $n(t){var e=t.textContent;e===t._wrapperState.initialValue&&(t.value=e)}A.injectEventPluginOrder("ResponderEventPlugin SimpleEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" ")),b=F,w=R,E=B,A.injectEventPluginsByName({SimpleEventPlugin:xn,EnterLeaveEventPlugin:Je,ChangeEventPlugin:Ne,SelectEventPlugin:Wn,BeforeInputEventPlugin:St});var Qn={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function ti(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ei(t,e){return null==t||"http://www.w3.org/1999/xhtml"===t?ti(e):"http://www.w3.org/2000/svg"===t&&"foreignObject"===e?"http://www.w3.org/1999/xhtml":t}var ni,ii=void 0,ri=(ni=function(t,e){if(t.namespaceURI!==Qn.svg||"innerHTML"in t)t.innerHTML=e;else{for((ii=ii||document.createElement("div")).innerHTML="<svg>"+e+"</svg>",e=ii.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,e,n,i){MSApp.execUnsafeLocalFunction(function(){return ni(t,e)})}:ni);function oi(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&3===n.nodeType)return void(n.nodeValue=e)}t.textContent=e}var ai={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},si=["Webkit","ms","Moz","O"];function li(t,e,n){return null==e||"boolean"==typeof e||""===e?"":n||"number"!=typeof e||0===e||ai.hasOwnProperty(t)&&ai[t]?(""+e).trim():e+"px"}function ui(t,e){for(var n in t=t.style,e)if(e.hasOwnProperty(n)){var i=0===n.indexOf("--"),r=li(n,e[n],i);"float"===n&&(n="cssFloat"),i?t.setProperty(n,r):t[n]=r}}Object.keys(ai).forEach(function(t){si.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ai[e]=ai[t]})});var ci=r({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function pi(t,e){e&&(ci[t]&&(null!=e.children||null!=e.dangerouslySetInnerHTML)&&a("137",t,""),null!=e.dangerouslySetInnerHTML&&(null!=e.children&&a("60"),"object"==typeof e.dangerouslySetInnerHTML&&"__html"in e.dangerouslySetInnerHTML||a("61")),null!=e.style&&"object"!=typeof e.style&&a("62",""))}function hi(t,e){if(-1===t.indexOf("-"))return"string"==typeof e.is;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}function fi(t,e){var n=Mn(t=9===t.nodeType||11===t.nodeType?t:t.ownerDocument);e=x[e];for(var i=0;i<e.length;i++){var r=e[i];if(!n.hasOwnProperty(r)||!n[r]){switch(r){case"scroll":Pn("scroll",t);break;case"focus":case"blur":Pn("focus",t),Pn("blur",t),n.blur=!0,n.focus=!0;break;case"cancel":case"close":Ut(r)&&Pn(r,t);break;case"invalid":case"submit":case"reset":break;default:-1===et.indexOf(r)&&Sn(r,t)}n[r]=!0}}}function di(){}var mi=null,yi=null;function _i(t,e){switch(t){case"button":case"input":case"select":case"textarea":return!!e.autoFocus}return!1}function gi(t,e){return"textarea"===t||"option"===t||"noscript"===t||"string"==typeof e.children||"number"==typeof e.children||"object"==typeof e.dangerouslySetInnerHTML&&null!==e.dangerouslySetInnerHTML&&null!=e.dangerouslySetInnerHTML.__html}var vi="function"==typeof setTimeout?setTimeout:void 0,xi="function"==typeof clearTimeout?clearTimeout:void 0,bi=o.unstable_scheduleCallback,wi=o.unstable_cancelCallback;function Ei(t){for(t=t.nextSibling;t&&1!==t.nodeType&&3!==t.nodeType;)t=t.nextSibling;return t}function Ti(t){for(t=t.firstChild;t&&1!==t.nodeType&&3!==t.nodeType;)t=t.nextSibling;return t}new Set;var Si=[],Pi=-1;function Ci(t){0>Pi||(t.current=Si[Pi],Si[Pi]=null,Pi--)}function ki(t,e){Si[++Pi]=t.current,t.current=e}var Ai={},zi={current:Ai},Li={current:!1},Mi=Ai;function Ii(t,e){var n=t.type.contextTypes;if(!n)return Ai;var i=t.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r,o={};for(r in n)o[r]=e[r];return i&&((t=t.stateNode).__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=o),o}function Oi(t){return null!=(t=t.childContextTypes)}function Di(t){Ci(Li),Ci(zi)}function Ri(t){Ci(Li),Ci(zi)}function Bi(t,e,n){zi.current!==Ai&&a("168"),ki(zi,e),ki(Li,n)}function Fi(t,e,n){var i=t.stateNode;if(t=e.childContextTypes,"function"!=typeof i.getChildContext)return n;for(var o in i=i.getChildContext())o in t||a("108",se(e)||"Unknown",o);return r({},n,i)}function Ni(t){var e=t.stateNode;return e=e&&e.__reactInternalMemoizedMergedChildContext||Ai,Mi=zi.current,ki(zi,e),ki(Li,Li.current),!0}function Ui(t,e,n){var i=t.stateNode;i||a("169"),n?(e=Fi(t,e,Mi),i.__reactInternalMemoizedMergedChildContext=e,Ci(Li),Ci(zi),ki(zi,e)):Ci(Li),ki(Li,n)}var ji=null,Vi=null;function Zi(t){return function(e){try{return t(e)}catch(t){}}}function qi(t,e,n,i){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.contextDependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.effectTag=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childExpirationTime=this.expirationTime=0,this.alternate=null}function Gi(t,e,n,i){return new qi(t,e,n,i)}function Wi(t){return!(!(t=t.prototype)||!t.isReactComponent)}function Hi(t,e){var n=t.alternate;return null===n?((n=Gi(t.tag,e,t.key,t.mode)).elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.effectTag=0,n.nextEffect=null,n.firstEffect=null,n.lastEffect=null),n.childExpirationTime=t.childExpirationTime,n.expirationTime=t.expirationTime,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,n.contextDependencies=t.contextDependencies,n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Xi(t,e,n,i,r,o){var s=2;if(i=t,"function"==typeof t)Wi(t)&&(s=1);else if("string"==typeof t)s=5;else t:switch(t){case Kt:return Ki(n.children,r,o,e);case te:return Yi(n,3|r,o,e);case Yt:return Yi(n,2|r,o,e);case Jt:return(t=Gi(12,n,e,4|r)).elementType=Jt,t.type=Jt,t.expirationTime=o,t;case ne:return(t=Gi(13,n,e,r)).elementType=ne,t.type=ne,t.expirationTime=o,t;default:if("object"==typeof t&&null!==t)switch(t.$$typeof){case $t:s=10;break t;case Qt:s=9;break t;case ee:s=11;break t;case ie:s=14;break t;case re:s=16,i=null;break t}a("130",null==t?t:typeof t,"")}return(e=Gi(s,n,e,r)).elementType=t,e.type=i,e.expirationTime=o,e}function Ki(t,e,n,i){return(t=Gi(7,t,i,e)).expirationTime=n,t}function Yi(t,e,n,i){return t=Gi(8,t,i,e),e=0==(1&e)?Yt:te,t.elementType=e,t.type=e,t.expirationTime=n,t}function Ji(t,e,n){return(t=Gi(6,t,null,e)).expirationTime=n,t}function $i(t,e,n){return(e=Gi(4,null!==t.children?t.children:[],t.key,e)).expirationTime=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Qi(t,e){t.didError=!1;var n=t.earliestPendingTime;0===n?t.earliestPendingTime=t.latestPendingTime=e:n<e?t.earliestPendingTime=e:t.latestPendingTime>e&&(t.latestPendingTime=e),nr(e,t)}function tr(t,e){t.didError=!1,t.latestPingedTime>=e&&(t.latestPingedTime=0);var n=t.earliestPendingTime,i=t.latestPendingTime;n===e?t.earliestPendingTime=i===e?t.latestPendingTime=0:i:i===e&&(t.latestPendingTime=n),n=t.earliestSuspendedTime,i=t.latestSuspendedTime,0===n?t.earliestSuspendedTime=t.latestSuspendedTime=e:n<e?t.earliestSuspendedTime=e:i>e&&(t.latestSuspendedTime=e),nr(e,t)}function er(t,e){var n=t.earliestPendingTime;return n>e&&(e=n),(t=t.earliestSuspendedTime)>e&&(e=t),e}function nr(t,e){var n=e.earliestSuspendedTime,i=e.latestSuspendedTime,r=e.earliestPendingTime,o=e.latestPingedTime;0===(r=0!==r?r:o)&&(0===t||i<t)&&(r=i),0!==(t=r)&&n>t&&(t=n),e.nextExpirationTimeToWorkOn=r,e.expirationTime=t}function ir(t,e){if(t&&t.defaultProps)for(var n in e=r({},e),t=t.defaultProps)void 0===e[n]&&(e[n]=t[n]);return e}var rr=(new i.Component).refs;function or(t,e,n,i){n=null==(n=n(i,e=t.memoizedState))?e:r({},e,n),t.memoizedState=n,null!==(i=t.updateQueue)&&0===t.expirationTime&&(i.baseState=n)}var ar={isMounted:function(t){return!!(t=t._reactInternalFiber)&&2===en(t)},enqueueSetState:function(t,e,n){t=t._reactInternalFiber;var i=ws(),r=Yo(i=Ka(i,t));r.payload=e,null!=n&&(r.callback=n),Za(),$o(t,r),$a(t,i)},enqueueReplaceState:function(t,e,n){t=t._reactInternalFiber;var i=ws(),r=Yo(i=Ka(i,t));r.tag=qo,r.payload=e,null!=n&&(r.callback=n),Za(),$o(t,r),$a(t,i)},enqueueForceUpdate:function(t,e){t=t._reactInternalFiber;var n=ws(),i=Yo(n=Ka(n,t));i.tag=Go,null!=e&&(i.callback=e),Za(),$o(t,i),$a(t,n)}};function sr(t,e,n,i,r,o,a){return"function"==typeof(t=t.stateNode).shouldComponentUpdate?t.shouldComponentUpdate(i,o,a):!e.prototype||!e.prototype.isPureReactComponent||(!tn(n,i)||!tn(r,o))}function lr(t,e,n){var i=!1,r=Ai,o=e.contextType;return"object"==typeof o&&null!==o?o=Vo(o):(r=Oi(e)?Mi:zi.current,o=(i=null!=(i=e.contextTypes))?Ii(t,r):Ai),e=new e(n,o),t.memoizedState=null!==e.state&&void 0!==e.state?e.state:null,e.updater=ar,t.stateNode=e,e._reactInternalFiber=t,i&&((t=t.stateNode).__reactInternalMemoizedUnmaskedChildContext=r,t.__reactInternalMemoizedMaskedChildContext=o),e}function ur(t,e,n,i){t=e.state,"function"==typeof e.componentWillReceiveProps&&e.componentWillReceiveProps(n,i),"function"==typeof e.UNSAFE_componentWillReceiveProps&&e.UNSAFE_componentWillReceiveProps(n,i),e.state!==t&&ar.enqueueReplaceState(e,e.state,null)}function cr(t,e,n,i){var r=t.stateNode;r.props=n,r.state=t.memoizedState,r.refs=rr;var o=e.contextType;"object"==typeof o&&null!==o?r.context=Vo(o):(o=Oi(e)?Mi:zi.current,r.context=Ii(t,o)),null!==(o=t.updateQueue)&&(na(t,o,n,r,i),r.state=t.memoizedState),"function"==typeof(o=e.getDerivedStateFromProps)&&(or(t,e,o,n),r.state=t.memoizedState),"function"==typeof e.getDerivedStateFromProps||"function"==typeof r.getSnapshotBeforeUpdate||"function"!=typeof r.UNSAFE_componentWillMount&&"function"!=typeof r.componentWillMount||(e=r.state,"function"==typeof r.componentWillMount&&r.componentWillMount(),"function"==typeof r.UNSAFE_componentWillMount&&r.UNSAFE_componentWillMount(),e!==r.state&&ar.enqueueReplaceState(r,r.state,null),null!==(o=t.updateQueue)&&(na(t,o,n,r,i),r.state=t.memoizedState)),"function"==typeof r.componentDidMount&&(t.effectTag|=4)}var pr=Array.isArray;function hr(t,e,n){if(null!==(t=n.ref)&&"function"!=typeof t&&"object"!=typeof t){if(n._owner){n=n._owner;var i=void 0;n&&(1!==n.tag&&a("309"),i=n.stateNode),i||a("147",t);var r=""+t;return null!==e&&null!==e.ref&&"function"==typeof e.ref&&e.ref._stringRef===r?e.ref:((e=function(t){var e=i.refs;e===rr&&(e=i.refs={}),null===t?delete e[r]:e[r]=t})._stringRef=r,e)}"string"!=typeof t&&a("284"),n._owner||a("290",t)}return t}function fr(t,e){"textarea"!==t.type&&a("31","[object Object]"===Object.prototype.toString.call(e)?"object with keys {"+Object.keys(e).join(", ")+"}":e,"")}function dr(t){function e(e,n){if(t){var i=e.lastEffect;null!==i?(i.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n,n.nextEffect=null,n.effectTag=8}}function n(n,i){if(!t)return null;for(;null!==i;)e(n,i),i=i.sibling;return null}function i(t,e){for(t=new Map;null!==e;)null!==e.key?t.set(e.key,e):t.set(e.index,e),e=e.sibling;return t}function r(t,e,n){return(t=Hi(t,e)).index=0,t.sibling=null,t}function o(e,n,i){return e.index=i,t?null!==(i=e.alternate)?(i=i.index)<n?(e.effectTag=2,n):i:(e.effectTag=2,n):n}function s(e){return t&&null===e.alternate&&(e.effectTag=2),e}function l(t,e,n,i){return null===e||6!==e.tag?((e=Ji(n,t.mode,i)).return=t,e):((e=r(e,n)).return=t,e)}function u(t,e,n,i){return null!==e&&e.elementType===n.type?((i=r(e,n.props)).ref=hr(t,e,n),i.return=t,i):((i=Xi(n.type,n.key,n.props,null,t.mode,i)).ref=hr(t,e,n),i.return=t,i)}function c(t,e,n,i){return null===e||4!==e.tag||e.stateNode.containerInfo!==n.containerInfo||e.stateNode.implementation!==n.implementation?((e=$i(n,t.mode,i)).return=t,e):((e=r(e,n.children||[])).return=t,e)}function p(t,e,n,i,o){return null===e||7!==e.tag?((e=Ki(n,t.mode,i,o)).return=t,e):((e=r(e,n)).return=t,e)}function h(t,e,n){if("string"==typeof e||"number"==typeof e)return(e=Ji(""+e,t.mode,n)).return=t,e;if("object"==typeof e&&null!==e){switch(e.$$typeof){case Ht:return(n=Xi(e.type,e.key,e.props,null,t.mode,n)).ref=hr(t,null,e),n.return=t,n;case Xt:return(e=$i(e,t.mode,n)).return=t,e}if(pr(e)||ae(e))return(e=Ki(e,t.mode,n,null)).return=t,e;fr(t,e)}return null}function f(t,e,n,i){var r=null!==e?e.key:null;if("string"==typeof n||"number"==typeof n)return null!==r?null:l(t,e,""+n,i);if("object"==typeof n&&null!==n){switch(n.$$typeof){case Ht:return n.key===r?n.type===Kt?p(t,e,n.props.children,i,r):u(t,e,n,i):null;case Xt:return n.key===r?c(t,e,n,i):null}if(pr(n)||ae(n))return null!==r?null:p(t,e,n,i,null);fr(t,n)}return null}function d(t,e,n,i,r){if("string"==typeof i||"number"==typeof i)return l(e,t=t.get(n)||null,""+i,r);if("object"==typeof i&&null!==i){switch(i.$$typeof){case Ht:return t=t.get(null===i.key?n:i.key)||null,i.type===Kt?p(e,t,i.props.children,r,i.key):u(e,t,i,r);case Xt:return c(e,t=t.get(null===i.key?n:i.key)||null,i,r)}if(pr(i)||ae(i))return p(e,t=t.get(n)||null,i,r,null);fr(e,i)}return null}function m(r,a,s,l){for(var u=null,c=null,p=a,m=a=0,y=null;null!==p&&m<s.length;m++){p.index>m?(y=p,p=null):y=p.sibling;var _=f(r,p,s[m],l);if(null===_){null===p&&(p=y);break}t&&p&&null===_.alternate&&e(r,p),a=o(_,a,m),null===c?u=_:c.sibling=_,c=_,p=y}if(m===s.length)return n(r,p),u;if(null===p){for(;m<s.length;m++)(p=h(r,s[m],l))&&(a=o(p,a,m),null===c?u=p:c.sibling=p,c=p);return u}for(p=i(r,p);m<s.length;m++)(y=d(p,r,m,s[m],l))&&(t&&null!==y.alternate&&p.delete(null===y.key?m:y.key),a=o(y,a,m),null===c?u=y:c.sibling=y,c=y);return t&&p.forEach(function(t){return e(r,t)}),u}function y(r,s,l,u){var c=ae(l);"function"!=typeof c&&a("150"),null==(l=c.call(l))&&a("151");for(var p=c=null,m=s,y=s=0,_=null,g=l.next();null!==m&&!g.done;y++,g=l.next()){m.index>y?(_=m,m=null):_=m.sibling;var v=f(r,m,g.value,u);if(null===v){m||(m=_);break}t&&m&&null===v.alternate&&e(r,m),s=o(v,s,y),null===p?c=v:p.sibling=v,p=v,m=_}if(g.done)return n(r,m),c;if(null===m){for(;!g.done;y++,g=l.next())null!==(g=h(r,g.value,u))&&(s=o(g,s,y),null===p?c=g:p.sibling=g,p=g);return c}for(m=i(r,m);!g.done;y++,g=l.next())null!==(g=d(m,r,y,g.value,u))&&(t&&null!==g.alternate&&m.delete(null===g.key?y:g.key),s=o(g,s,y),null===p?c=g:p.sibling=g,p=g);return t&&m.forEach(function(t){return e(r,t)}),c}return function(t,i,o,l){var u="object"==typeof o&&null!==o&&o.type===Kt&&null===o.key;u&&(o=o.props.children);var c="object"==typeof o&&null!==o;if(c)switch(o.$$typeof){case Ht:t:{for(c=o.key,u=i;null!==u;){if(u.key===c){if(7===u.tag?o.type===Kt:u.elementType===o.type){n(t,u.sibling),(i=r(u,o.type===Kt?o.props.children:o.props)).ref=hr(t,u,o),i.return=t,t=i;break t}n(t,u);break}e(t,u),u=u.sibling}o.type===Kt?((i=Ki(o.props.children,t.mode,l,o.key)).return=t,t=i):((l=Xi(o.type,o.key,o.props,null,t.mode,l)).ref=hr(t,i,o),l.return=t,t=l)}return s(t);case Xt:t:{for(u=o.key;null!==i;){if(i.key===u){if(4===i.tag&&i.stateNode.containerInfo===o.containerInfo&&i.stateNode.implementation===o.implementation){n(t,i.sibling),(i=r(i,o.children||[])).return=t,t=i;break t}n(t,i);break}e(t,i),i=i.sibling}(i=$i(o,t.mode,l)).return=t,t=i}return s(t)}if("string"==typeof o||"number"==typeof o)return o=""+o,null!==i&&6===i.tag?(n(t,i.sibling),(i=r(i,o)).return=t,t=i):(n(t,i),(i=Ji(o,t.mode,l)).return=t,t=i),s(t);if(pr(o))return m(t,i,o,l);if(ae(o))return y(t,i,o,l);if(c&&fr(t,o),void 0===o&&!u)switch(t.tag){case 1:case 0:a("152",(l=t.type).displayName||l.name||"Component")}return n(t,i)}}var mr=dr(!0),yr=dr(!1),_r={},gr={current:_r},vr={current:_r},xr={current:_r};function br(t){return t===_r&&a("174"),t}function wr(t,e){ki(xr,e),ki(vr,t),ki(gr,_r);var n=e.nodeType;switch(n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:ei(null,"");break;default:e=ei(e=(n=8===n?e.parentNode:e).namespaceURI||null,n=n.tagName)}Ci(gr),ki(gr,e)}function Er(t){Ci(gr),Ci(vr),Ci(xr)}function Tr(t){br(xr.current);var e=br(gr.current),n=ei(e,t.type);e!==n&&(ki(vr,t),ki(gr,n))}function Sr(t){vr.current===t&&(Ci(gr),Ci(vr))}var Pr=0,Cr=2,kr=4,Ar=8,zr=16,Lr=32,Mr=64,Ir=128,Or=qt.ReactCurrentDispatcher,Dr=0,Rr=null,Br=null,Fr=null,Nr=null,Ur=null,jr=null,Vr=0,Zr=null,qr=0,Gr=!1,Wr=null,Hr=0;function Xr(){a("307")}function Kr(t,e){if(null===e)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!$e(t[n],e[n]))return!1;return!0}function Yr(t,e,n,i,r,o){if(Dr=o,Rr=e,Fr=null!==t?t.memoizedState:null,Or.current=null===Fr?uo:co,e=n(i,r),Gr){do{Gr=!1,Hr+=1,Fr=null!==t?t.memoizedState:null,jr=Nr,Zr=Ur=Br=null,Or.current=co,e=n(i,r)}while(Gr);Wr=null,Hr=0}return Or.current=lo,(t=Rr).memoizedState=Nr,t.expirationTime=Vr,t.updateQueue=Zr,t.effectTag|=qr,t=null!==Br&&null!==Br.next,Dr=0,jr=Ur=Nr=Fr=Br=Rr=null,Vr=0,Zr=null,qr=0,t&&a("300"),e}function Jr(){Or.current=lo,Dr=0,jr=Ur=Nr=Fr=Br=Rr=null,Vr=0,Zr=null,qr=0,Gr=!1,Wr=null,Hr=0}function $r(){var t={memoizedState:null,baseState:null,queue:null,baseUpdate:null,next:null};return null===Ur?Nr=Ur=t:Ur=Ur.next=t,Ur}function Qr(){if(null!==jr)jr=(Ur=jr).next,Fr=null!==(Br=Fr)?Br.next:null;else{null===Fr&&a("310");var t={memoizedState:(Br=Fr).memoizedState,baseState:Br.baseState,queue:Br.queue,baseUpdate:Br.baseUpdate,next:null};Ur=null===Ur?Nr=t:Ur.next=t,Fr=Br.next}return Ur}function to(t,e){return"function"==typeof e?e(t):e}function eo(t){var e=Qr(),n=e.queue;if(null===n&&a("311"),0<Hr){var i=n.dispatch;if(null!==Wr){var r=Wr.get(n);if(void 0!==r){Wr.delete(n);var o=e.memoizedState;do{o=t(o,r.action),r=r.next}while(null!==r);return $e(o,e.memoizedState)||(wo=!0),e.memoizedState=o,e.baseUpdate===n.last&&(e.baseState=o),[o,i]}}return[e.memoizedState,i]}i=n.last;var s=e.baseUpdate;if(o=e.baseState,null!==s?(null!==i&&(i.next=null),i=s.next):i=null!==i?i.next:null,null!==i){var l=r=null,u=i,c=!1;do{var p=u.expirationTime;p<Dr?(c||(c=!0,l=s,r=o),p>Vr&&(Vr=p)):o=u.eagerReducer===t?u.eagerState:t(o,u.action),s=u,u=u.next}while(null!==u&&u!==i);c||(l=s,r=o),$e(o,e.memoizedState)||(wo=!0),e.memoizedState=o,e.baseUpdate=l,e.baseState=r,n.eagerReducer=t,n.eagerState=o}return[e.memoizedState,n.dispatch]}function no(t,e,n,i){return t={tag:t,create:e,destroy:n,deps:i,next:null},null===Zr?(Zr={lastEffect:null}).lastEffect=t.next=t:null===(e=Zr.lastEffect)?Zr.lastEffect=t.next=t:(n=e.next,e.next=t,t.next=n,Zr.lastEffect=t),t}function io(t,e,n,i){var r=$r();qr|=t,r.memoizedState=no(e,n,void 0,void 0===i?null:i)}function ro(t,e,n,i){var r=Qr();i=void 0===i?null:i;var o=void 0;if(null!==Br){var a=Br.memoizedState;if(o=a.destroy,null!==i&&Kr(i,a.deps))return void no(Pr,n,o,i)}qr|=t,r.memoizedState=no(e,n,o,i)}function oo(t,e){return"function"==typeof e?(t=t(),e(t),function(){e(null)}):null!=e?(t=t(),e.current=t,function(){e.current=null}):void 0}function ao(){}function so(t,e,n){25>Hr||a("301");var i=t.alternate;if(t===Rr||null!==i&&i===Rr)if(Gr=!0,t={expirationTime:Dr,action:n,eagerReducer:null,eagerState:null,next:null},null===Wr&&(Wr=new Map),void 0===(n=Wr.get(e)))Wr.set(e,t);else{for(e=n;null!==e.next;)e=e.next;e.next=t}else{Za();var r=ws(),o={expirationTime:r=Ka(r,t),action:n,eagerReducer:null,eagerState:null,next:null},s=e.last;if(null===s)o.next=o;else{var l=s.next;null!==l&&(o.next=l),s.next=o}if(e.last=o,0===t.expirationTime&&(null===i||0===i.expirationTime)&&null!==(i=e.eagerReducer))try{var u=e.eagerState,c=i(u,n);if(o.eagerReducer=i,o.eagerState=c,$e(c,u))return}catch(t){}$a(t,r)}}var lo={readContext:Vo,useCallback:Xr,useContext:Xr,useEffect:Xr,useImperativeHandle:Xr,useLayoutEffect:Xr,useMemo:Xr,useReducer:Xr,useRef:Xr,useState:Xr,useDebugValue:Xr},uo={readContext:Vo,useCallback:function(t,e){return $r().memoizedState=[t,void 0===e?null:e],t},useContext:Vo,useEffect:function(t,e){return io(516,Ir|Mr,t,e)},useImperativeHandle:function(t,e,n){return n=null!=n?n.concat([t]):null,io(4,kr|Lr,oo.bind(null,e,t),n)},useLayoutEffect:function(t,e){return io(4,kr|Lr,t,e)},useMemo:function(t,e){var n=$r();return e=void 0===e?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var i=$r();return e=void 0!==n?n(e):e,i.memoizedState=i.baseState=e,t=(t=i.queue={last:null,dispatch:null,eagerReducer:t,eagerState:e}).dispatch=so.bind(null,Rr,t),[i.memoizedState,t]},useRef:function(t){return t={current:t},$r().memoizedState=t},useState:function(t){var e=$r();return"function"==typeof t&&(t=t()),e.memoizedState=e.baseState=t,t=(t=e.queue={last:null,dispatch:null,eagerReducer:to,eagerState:t}).dispatch=so.bind(null,Rr,t),[e.memoizedState,t]},useDebugValue:ao},co={readContext:Vo,useCallback:function(t,e){var n=Qr();e=void 0===e?null:e;var i=n.memoizedState;return null!==i&&null!==e&&Kr(e,i[1])?i[0]:(n.memoizedState=[t,e],t)},useContext:Vo,useEffect:function(t,e){return ro(516,Ir|Mr,t,e)},useImperativeHandle:function(t,e,n){return n=null!=n?n.concat([t]):null,ro(4,kr|Lr,oo.bind(null,e,t),n)},useLayoutEffect:function(t,e){return ro(4,kr|Lr,t,e)},useMemo:function(t,e){var n=Qr();e=void 0===e?null:e;var i=n.memoizedState;return null!==i&&null!==e&&Kr(e,i[1])?i[0]:(t=t(),n.memoizedState=[t,e],t)},useReducer:eo,useRef:function(){return Qr().memoizedState},useState:function(t){return eo(to)},useDebugValue:ao},po=null,ho=null,fo=!1;function mo(t,e){var n=Gi(5,null,null,0);n.elementType="DELETED",n.type="DELETED",n.stateNode=e,n.return=t,n.effectTag=8,null!==t.lastEffect?(t.lastEffect.nextEffect=n,t.lastEffect=n):t.firstEffect=t.lastEffect=n}function yo(t,e){switch(t.tag){case 5:var n=t.type;return null!==(e=1!==e.nodeType||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e)&&(t.stateNode=e,!0);case 6:return null!==(e=""===t.pendingProps||3!==e.nodeType?null:e)&&(t.stateNode=e,!0);case 13:default:return!1}}function _o(t){if(fo){var e=ho;if(e){var n=e;if(!yo(t,e)){if(!(e=Ei(n))||!yo(t,e))return t.effectTag|=2,fo=!1,void(po=t);mo(po,n)}po=t,ho=Ti(e)}else t.effectTag|=2,fo=!1,po=t}}function go(t){for(t=t.return;null!==t&&5!==t.tag&&3!==t.tag&&18!==t.tag;)t=t.return;po=t}function vo(t){if(t!==po)return!1;if(!fo)return go(t),fo=!0,!1;var e=t.type;if(5!==t.tag||"head"!==e&&"body"!==e&&!gi(e,t.memoizedProps))for(e=ho;e;)mo(t,e),e=Ei(e);return go(t),ho=po?Ei(t.stateNode):null,!0}function xo(){ho=po=null,fo=!1}var bo=qt.ReactCurrentOwner,wo=!1;function Eo(t,e,n,i){e.child=null===t?yr(e,null,n,i):mr(e,t.child,n,i)}function To(t,e,n,i,r){n=n.render;var o=e.ref;return jo(e,r),i=Yr(t,e,n,i,o,r),null===t||wo?(e.effectTag|=1,Eo(t,e,i,r),e.child):(e.updateQueue=t.updateQueue,e.effectTag&=-517,t.expirationTime<=r&&(t.expirationTime=0),Io(t,e,r))}function So(t,e,n,i,r,o){if(null===t){var a=n.type;return"function"!=typeof a||Wi(a)||void 0!==a.defaultProps||null!==n.compare||void 0!==n.defaultProps?((t=Xi(n.type,null,i,null,e.mode,o)).ref=e.ref,t.return=e,e.child=t):(e.tag=15,e.type=a,Po(t,e,a,i,r,o))}return a=t.child,r<o&&(r=a.memoizedProps,(n=null!==(n=n.compare)?n:tn)(r,i)&&t.ref===e.ref)?Io(t,e,o):(e.effectTag|=1,(t=Hi(a,i)).ref=e.ref,t.return=e,e.child=t)}function Po(t,e,n,i,r,o){return null!==t&&tn(t.memoizedProps,i)&&t.ref===e.ref&&(wo=!1,r<o)?Io(t,e,o):ko(t,e,n,i,o)}function Co(t,e){var n=e.ref;(null===t&&null!==n||null!==t&&t.ref!==n)&&(e.effectTag|=128)}function ko(t,e,n,i,r){var o=Oi(n)?Mi:zi.current;return o=Ii(e,o),jo(e,r),n=Yr(t,e,n,i,o,r),null===t||wo?(e.effectTag|=1,Eo(t,e,n,r),e.child):(e.updateQueue=t.updateQueue,e.effectTag&=-517,t.expirationTime<=r&&(t.expirationTime=0),Io(t,e,r))}function Ao(t,e,n,i,r){if(Oi(n)){var o=!0;Ni(e)}else o=!1;if(jo(e,r),null===e.stateNode)null!==t&&(t.alternate=null,e.alternate=null,e.effectTag|=2),lr(e,n,i),cr(e,n,i,r),i=!0;else if(null===t){var a=e.stateNode,s=e.memoizedProps;a.props=s;var l=a.context,u=n.contextType;"object"==typeof u&&null!==u?u=Vo(u):u=Ii(e,u=Oi(n)?Mi:zi.current);var c=n.getDerivedStateFromProps,p="function"==typeof c||"function"==typeof a.getSnapshotBeforeUpdate;p||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==i||l!==u)&&ur(e,a,i,u),Ho=!1;var h=e.memoizedState;l=a.state=h;var f=e.updateQueue;null!==f&&(na(e,f,i,a,r),l=e.memoizedState),s!==i||h!==l||Li.current||Ho?("function"==typeof c&&(or(e,n,c,i),l=e.memoizedState),(s=Ho||sr(e,n,s,i,h,l,u))?(p||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||("function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount()),"function"==typeof a.componentDidMount&&(e.effectTag|=4)):("function"==typeof a.componentDidMount&&(e.effectTag|=4),e.memoizedProps=i,e.memoizedState=l),a.props=i,a.state=l,a.context=u,i=s):("function"==typeof a.componentDidMount&&(e.effectTag|=4),i=!1)}else a=e.stateNode,s=e.memoizedProps,a.props=e.type===e.elementType?s:ir(e.type,s),l=a.context,"object"==typeof(u=n.contextType)&&null!==u?u=Vo(u):u=Ii(e,u=Oi(n)?Mi:zi.current),(p="function"==typeof(c=n.getDerivedStateFromProps)||"function"==typeof a.getSnapshotBeforeUpdate)||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==i||l!==u)&&ur(e,a,i,u),Ho=!1,l=e.memoizedState,h=a.state=l,null!==(f=e.updateQueue)&&(na(e,f,i,a,r),h=e.memoizedState),s!==i||l!==h||Li.current||Ho?("function"==typeof c&&(or(e,n,c,i),h=e.memoizedState),(c=Ho||sr(e,n,s,i,l,h,u))?(p||"function"!=typeof a.UNSAFE_componentWillUpdate&&"function"!=typeof a.componentWillUpdate||("function"==typeof a.componentWillUpdate&&a.componentWillUpdate(i,h,u),"function"==typeof a.UNSAFE_componentWillUpdate&&a.UNSAFE_componentWillUpdate(i,h,u)),"function"==typeof a.componentDidUpdate&&(e.effectTag|=4),"function"==typeof a.getSnapshotBeforeUpdate&&(e.effectTag|=256)):("function"!=typeof a.componentDidUpdate||s===t.memoizedProps&&l===t.memoizedState||(e.effectTag|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===t.memoizedProps&&l===t.memoizedState||(e.effectTag|=256),e.memoizedProps=i,e.memoizedState=h),a.props=i,a.state=h,a.context=u,i=c):("function"!=typeof a.componentDidUpdate||s===t.memoizedProps&&l===t.memoizedState||(e.effectTag|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===t.memoizedProps&&l===t.memoizedState||(e.effectTag|=256),i=!1);return zo(t,e,n,i,o,r)}function zo(t,e,n,i,r,o){Co(t,e);var a=0!=(64&e.effectTag);if(!i&&!a)return r&&Ui(e,n,!1),Io(t,e,o);i=e.stateNode,bo.current=e;var s=a&&"function"!=typeof n.getDerivedStateFromError?null:i.render();return e.effectTag|=1,null!==t&&a?(e.child=mr(e,t.child,null,o),e.child=mr(e,null,s,o)):Eo(t,e,s,o),e.memoizedState=i.state,r&&Ui(e,n,!0),e.child}function Lo(t){var e=t.stateNode;e.pendingContext?Bi(0,e.pendingContext,e.pendingContext!==e.context):e.context&&Bi(0,e.context,!1),wr(t,e.containerInfo)}function Mo(t,e,n){var i=e.mode,r=e.pendingProps,o=e.memoizedState;if(0==(64&e.effectTag)){o=null;var a=!1}else o={timedOutAt:null!==o?o.timedOutAt:0},a=!0,e.effectTag&=-65;if(null===t)if(a){var s=r.fallback;t=Ki(null,i,0,null),0==(1&e.mode)&&(t.child=null!==e.memoizedState?e.child.child:e.child),i=Ki(s,i,n,null),t.sibling=i,(n=t).return=i.return=e}else n=i=yr(e,null,r.children,n);else null!==t.memoizedState?(s=(i=t.child).sibling,a?(n=r.fallback,r=Hi(i,i.pendingProps),0==(1&e.mode)&&((a=null!==e.memoizedState?e.child.child:e.child)!==i.child&&(r.child=a)),i=r.sibling=Hi(s,n,s.expirationTime),n=r,r.childExpirationTime=0,n.return=i.return=e):n=i=mr(e,i.child,r.children,n)):(s=t.child,a?(a=r.fallback,(r=Ki(null,i,0,null)).child=s,0==(1&e.mode)&&(r.child=null!==e.memoizedState?e.child.child:e.child),(i=r.sibling=Ki(a,i,n,null)).effectTag|=2,n=r,r.childExpirationTime=0,n.return=i.return=e):i=n=mr(e,s,r.children,n)),e.stateNode=t.stateNode;return e.memoizedState=o,e.child=n,i}function Io(t,e,n){if(null!==t&&(e.contextDependencies=t.contextDependencies),e.childExpirationTime<n)return null;if(null!==t&&e.child!==t.child&&a("153"),null!==e.child){for(n=Hi(t=e.child,t.pendingProps,t.expirationTime),e.child=n,n.return=e;null!==t.sibling;)t=t.sibling,(n=n.sibling=Hi(t,t.pendingProps,t.expirationTime)).return=e;n.sibling=null}return e.child}function Oo(t,e,n){var i=e.expirationTime;if(null!==t){if(t.memoizedProps!==e.pendingProps||Li.current)wo=!0;else if(i<n){switch(wo=!1,e.tag){case 3:Lo(e),xo();break;case 5:Tr(e);break;case 1:Oi(e.type)&&Ni(e);break;case 4:wr(e,e.stateNode.containerInfo);break;case 10:No(e,e.memoizedProps.value);break;case 13:if(null!==e.memoizedState)return 0!==(i=e.child.childExpirationTime)&&i>=n?Mo(t,e,n):null!==(e=Io(t,e,n))?e.sibling:null}return Io(t,e,n)}}else wo=!1;switch(e.expirationTime=0,e.tag){case 2:i=e.elementType,null!==t&&(t.alternate=null,e.alternate=null,e.effectTag|=2),t=e.pendingProps;var r=Ii(e,zi.current);if(jo(e,n),r=Yr(null,e,i,t,r,n),e.effectTag|=1,"object"==typeof r&&null!==r&&"function"==typeof r.render&&void 0===r.$$typeof){if(e.tag=1,Jr(),Oi(i)){var o=!0;Ni(e)}else o=!1;e.memoizedState=null!==r.state&&void 0!==r.state?r.state:null;var s=i.getDerivedStateFromProps;"function"==typeof s&&or(e,i,s,t),r.updater=ar,e.stateNode=r,r._reactInternalFiber=e,cr(e,i,t,n),e=zo(null,e,i,!0,o,n)}else e.tag=0,Eo(null,e,r,n),e=e.child;return e;case 16:switch(r=e.elementType,null!==t&&(t.alternate=null,e.alternate=null,e.effectTag|=2),o=e.pendingProps,t=function(t){var e=t._result;switch(t._status){case 1:return e;case 2:case 0:throw e;default:switch(t._status=0,(e=(e=t._ctor)()).then(function(e){0===t._status&&(e=e.default,t._status=1,t._result=e)},function(e){0===t._status&&(t._status=2,t._result=e)}),t._status){case 1:return t._result;case 2:throw t._result}throw t._result=e,e}}(r),e.type=t,r=e.tag=function(t){if("function"==typeof t)return Wi(t)?1:0;if(null!=t){if((t=t.$$typeof)===ee)return 11;if(t===ie)return 14}return 2}(t),o=ir(t,o),s=void 0,r){case 0:s=ko(null,e,t,o,n);break;case 1:s=Ao(null,e,t,o,n);break;case 11:s=To(null,e,t,o,n);break;case 14:s=So(null,e,t,ir(t.type,o),i,n);break;default:a("306",t,"")}return s;case 0:return i=e.type,r=e.pendingProps,ko(t,e,i,r=e.elementType===i?r:ir(i,r),n);case 1:return i=e.type,r=e.pendingProps,Ao(t,e,i,r=e.elementType===i?r:ir(i,r),n);case 3:return Lo(e),null===(i=e.updateQueue)&&a("282"),r=null!==(r=e.memoizedState)?r.element:null,na(e,i,e.pendingProps,null,n),(i=e.memoizedState.element)===r?(xo(),e=Io(t,e,n)):(r=e.stateNode,(r=(null===t||null===t.child)&&r.hydrate)&&(ho=Ti(e.stateNode.containerInfo),po=e,r=fo=!0),r?(e.effectTag|=2,e.child=yr(e,null,i,n)):(Eo(t,e,i,n),xo()),e=e.child),e;case 5:return Tr(e),null===t&&_o(e),i=e.type,r=e.pendingProps,o=null!==t?t.memoizedProps:null,s=r.children,gi(i,r)?s=null:null!==o&&gi(i,o)&&(e.effectTag|=16),Co(t,e),1!==n&&1&e.mode&&r.hidden?(e.expirationTime=e.childExpirationTime=1,e=null):(Eo(t,e,s,n),e=e.child),e;case 6:return null===t&&_o(e),null;case 13:return Mo(t,e,n);case 4:return wr(e,e.stateNode.containerInfo),i=e.pendingProps,null===t?e.child=mr(e,null,i,n):Eo(t,e,i,n),e.child;case 11:return i=e.type,r=e.pendingProps,To(t,e,i,r=e.elementType===i?r:ir(i,r),n);case 7:return Eo(t,e,e.pendingProps,n),e.child;case 8:case 12:return Eo(t,e,e.pendingProps.children,n),e.child;case 10:t:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,No(e,o=r.value),null!==s){var l=s.value;if(0===(o=$e(l,o)?0:0|("function"==typeof i._calculateChangedBits?i._calculateChangedBits(l,o):1073741823))){if(s.children===r.children&&!Li.current){e=Io(t,e,n);break t}}else for(null!==(l=e.child)&&(l.return=e);null!==l;){var u=l.contextDependencies;if(null!==u){s=l.child;for(var c=u.first;null!==c;){if(c.context===i&&0!=(c.observedBits&o)){1===l.tag&&((c=Yo(n)).tag=Go,$o(l,c)),l.expirationTime<n&&(l.expirationTime=n),null!==(c=l.alternate)&&c.expirationTime<n&&(c.expirationTime=n),c=n;for(var p=l.return;null!==p;){var h=p.alternate;if(p.childExpirationTime<c)p.childExpirationTime=c,null!==h&&h.childExpirationTime<c&&(h.childExpirationTime=c);else{if(!(null!==h&&h.childExpirationTime<c))break;h.childExpirationTime=c}p=p.return}u.expirationTime<n&&(u.expirationTime=n);break}c=c.next}}else s=10===l.tag&&l.type===e.type?null:l.child;if(null!==s)s.return=l;else for(s=l;null!==s;){if(s===e){s=null;break}if(null!==(l=s.sibling)){l.return=s.return,s=l;break}s=s.return}l=s}}Eo(t,e,r.children,n),e=e.child}return e;case 9:return r=e.type,i=(o=e.pendingProps).children,jo(e,n),i=i(r=Vo(r,o.unstable_observedBits)),e.effectTag|=1,Eo(t,e,i,n),e.child;case 14:return o=ir(r=e.type,e.pendingProps),So(t,e,r,o=ir(r.type,o),i,n);case 15:return Po(t,e,e.type,e.pendingProps,i,n);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:ir(i,r),null!==t&&(t.alternate=null,e.alternate=null,e.effectTag|=2),e.tag=1,Oi(i)?(t=!0,Ni(e)):t=!1,jo(e,n),lr(e,i,r),cr(e,i,r,n),zo(null,e,i,!0,t,n)}a("156")}var Do={current:null},Ro=null,Bo=null,Fo=null;function No(t,e){var n=t.type._context;ki(Do,n._currentValue),n._currentValue=e}function Uo(t){var e=Do.current;Ci(Do),t.type._context._currentValue=e}function jo(t,e){Ro=t,Fo=Bo=null;var n=t.contextDependencies;null!==n&&n.expirationTime>=e&&(wo=!0),t.contextDependencies=null}function Vo(t,e){return Fo!==t&&!1!==e&&0!==e&&("number"==typeof e&&1073741823!==e||(Fo=t,e=1073741823),e={context:t,observedBits:e,next:null},null===Bo?(null===Ro&&a("308"),Bo=e,Ro.contextDependencies={first:e,expirationTime:0}):Bo=Bo.next=e),t._currentValue}var Zo=0,qo=1,Go=2,Wo=3,Ho=!1;function Xo(t){return{baseState:t,firstUpdate:null,lastUpdate:null,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function Ko(t){return{baseState:t.baseState,firstUpdate:t.firstUpdate,lastUpdate:t.lastUpdate,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function Yo(t){return{expirationTime:t,tag:Zo,payload:null,callback:null,next:null,nextEffect:null}}function Jo(t,e){null===t.lastUpdate?t.firstUpdate=t.lastUpdate=e:(t.lastUpdate.next=e,t.lastUpdate=e)}function $o(t,e){var n=t.alternate;if(null===n){var i=t.updateQueue,r=null;null===i&&(i=t.updateQueue=Xo(t.memoizedState))}else i=t.updateQueue,r=n.updateQueue,null===i?null===r?(i=t.updateQueue=Xo(t.memoizedState),r=n.updateQueue=Xo(n.memoizedState)):i=t.updateQueue=Ko(r):null===r&&(r=n.updateQueue=Ko(i));null===r||i===r?Jo(i,e):null===i.lastUpdate||null===r.lastUpdate?(Jo(i,e),Jo(r,e)):(Jo(i,e),r.lastUpdate=e)}function Qo(t,e){var n=t.updateQueue;null===(n=null===n?t.updateQueue=Xo(t.memoizedState):ta(t,n)).lastCapturedUpdate?n.firstCapturedUpdate=n.lastCapturedUpdate=e:(n.lastCapturedUpdate.next=e,n.lastCapturedUpdate=e)}function ta(t,e){var n=t.alternate;return null!==n&&e===n.updateQueue&&(e=t.updateQueue=Ko(e)),e}function ea(t,e,n,i,o,a){switch(n.tag){case qo:return"function"==typeof(t=n.payload)?t.call(a,i,o):t;case Wo:t.effectTag=-2049&t.effectTag|64;case Zo:if(null==(o="function"==typeof(t=n.payload)?t.call(a,i,o):t))break;return r({},i,o);case Go:Ho=!0}return i}function na(t,e,n,i,r){Ho=!1;for(var o=(e=ta(t,e)).baseState,a=null,s=0,l=e.firstUpdate,u=o;null!==l;){var c=l.expirationTime;c<r?(null===a&&(a=l,o=u),s<c&&(s=c)):(u=ea(t,0,l,u,n,i),null!==l.callback&&(t.effectTag|=32,l.nextEffect=null,null===e.lastEffect?e.firstEffect=e.lastEffect=l:(e.lastEffect.nextEffect=l,e.lastEffect=l))),l=l.next}for(c=null,l=e.firstCapturedUpdate;null!==l;){var p=l.expirationTime;p<r?(null===c&&(c=l,null===a&&(o=u)),s<p&&(s=p)):(u=ea(t,0,l,u,n,i),null!==l.callback&&(t.effectTag|=32,l.nextEffect=null,null===e.lastCapturedEffect?e.firstCapturedEffect=e.lastCapturedEffect=l:(e.lastCapturedEffect.nextEffect=l,e.lastCapturedEffect=l))),l=l.next}null===a&&(e.lastUpdate=null),null===c?e.lastCapturedUpdate=null:t.effectTag|=32,null===a&&null===c&&(o=u),e.baseState=o,e.firstUpdate=a,e.firstCapturedUpdate=c,t.expirationTime=s,t.memoizedState=u}function ia(t,e,n){null!==e.firstCapturedUpdate&&(null!==e.lastUpdate&&(e.lastUpdate.next=e.firstCapturedUpdate,e.lastUpdate=e.lastCapturedUpdate),e.firstCapturedUpdate=e.lastCapturedUpdate=null),ra(e.firstEffect,n),e.firstEffect=e.lastEffect=null,ra(e.firstCapturedEffect,n),e.firstCapturedEffect=e.lastCapturedEffect=null}function ra(t,e){for(;null!==t;){var n=t.callback;if(null!==n){t.callback=null;var i=e;"function"!=typeof n&&a("191",n),n.call(i)}t=t.nextEffect}}function oa(t,e){return{value:t,source:e,stack:le(e)}}function aa(t){t.effectTag|=4}var sa=void 0,la=void 0,ua=void 0,ca=void 0;sa=function(t,e){for(var n=e.child;null!==n;){if(5===n.tag||6===n.tag)t.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===e)break;for(;null===n.sibling;){if(null===n.return||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},la=function(){},ua=function(t,e,n,i,o){var a=t.memoizedProps;if(a!==i){var s=e.stateNode;switch(br(gr.current),t=null,n){case"input":a=ve(s,a),i=ve(s,i),t=[];break;case"option":a=Hn(s,a),i=Hn(s,i),t=[];break;case"select":a=r({},a,{value:void 0}),i=r({},i,{value:void 0}),t=[];break;case"textarea":a=Kn(s,a),i=Kn(s,i),t=[];break;default:"function"!=typeof a.onClick&&"function"==typeof i.onClick&&(s.onclick=di)}pi(n,i),s=n=void 0;var l=null;for(n in a)if(!i.hasOwnProperty(n)&&a.hasOwnProperty(n)&&null!=a[n])if("style"===n){var u=a[n];for(s in u)u.hasOwnProperty(s)&&(l||(l={}),l[s]="")}else"dangerouslySetInnerHTML"!==n&&"children"!==n&&"suppressContentEditableWarning"!==n&&"suppressHydrationWarning"!==n&&"autoFocus"!==n&&(v.hasOwnProperty(n)?t||(t=[]):(t=t||[]).push(n,null));for(n in i){var c=i[n];if(u=null!=a?a[n]:void 0,i.hasOwnProperty(n)&&c!==u&&(null!=c||null!=u))if("style"===n)if(u){for(s in u)!u.hasOwnProperty(s)||c&&c.hasOwnProperty(s)||(l||(l={}),l[s]="");for(s in c)c.hasOwnProperty(s)&&u[s]!==c[s]&&(l||(l={}),l[s]=c[s])}else l||(t||(t=[]),t.push(n,l)),l=c;else"dangerouslySetInnerHTML"===n?(c=c?c.__html:void 0,u=u?u.__html:void 0,null!=c&&u!==c&&(t=t||[]).push(n,""+c)):"children"===n?u===c||"string"!=typeof c&&"number"!=typeof c||(t=t||[]).push(n,""+c):"suppressContentEditableWarning"!==n&&"suppressHydrationWarning"!==n&&(v.hasOwnProperty(n)?(null!=c&&fi(o,n),t||u===c||(t=[])):(t=t||[]).push(n,c))}l&&(t=t||[]).push("style",l),o=t,(e.updateQueue=o)&&aa(e)}},ca=function(t,e,n,i){n!==i&&aa(e)};var pa="function"==typeof WeakSet?WeakSet:Set;function ha(t,e){var n=e.source,i=e.stack;null===i&&null!==n&&(i=le(n)),null!==n&&se(n.type),e=e.value,null!==t&&1===t.tag&&se(t.type);try{console.error(e)}catch(t){setTimeout(function(){throw t})}}function fa(t){var e=t.ref;if(null!==e)if("function"==typeof e)try{e(null)}catch(e){Xa(t,e)}else e.current=null}function da(t,e,n){if(null!==(n=null!==(n=n.updateQueue)?n.lastEffect:null)){var i=n=n.next;do{if((i.tag&t)!==Pr){var r=i.destroy;i.destroy=void 0,void 0!==r&&r()}(i.tag&e)!==Pr&&(r=i.create,i.destroy=r()),i=i.next}while(i!==n)}}function ma(t){switch("function"==typeof Vi&&Vi(t),t.tag){case 0:case 11:case 14:case 15:var e=t.updateQueue;if(null!==e&&null!==(e=e.lastEffect)){var n=e=e.next;do{var i=n.destroy;if(void 0!==i){var r=t;try{i()}catch(t){Xa(r,t)}}n=n.next}while(n!==e)}break;case 1:if(fa(t),"function"==typeof(e=t.stateNode).componentWillUnmount)try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(e){Xa(t,e)}break;case 5:fa(t);break;case 4:ga(t)}}function ya(t){return 5===t.tag||3===t.tag||4===t.tag}function _a(t){t:{for(var e=t.return;null!==e;){if(ya(e)){var n=e;break t}e=e.return}a("160"),n=void 0}var i=e=void 0;switch(n.tag){case 5:e=n.stateNode,i=!1;break;case 3:case 4:e=n.stateNode.containerInfo,i=!0;break;default:a("161")}16&n.effectTag&&(oi(e,""),n.effectTag&=-17);t:e:for(n=t;;){for(;null===n.sibling;){if(null===n.return||ya(n.return)){n=null;break t}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag&&18!==n.tag;){if(2&n.effectTag)continue e;if(null===n.child||4===n.tag)continue e;n.child.return=n,n=n.child}if(!(2&n.effectTag)){n=n.stateNode;break t}}for(var r=t;;){if(5===r.tag||6===r.tag)if(n)if(i){var o=e,s=r.stateNode,l=n;8===o.nodeType?o.parentNode.insertBefore(s,l):o.insertBefore(s,l)}else e.insertBefore(r.stateNode,n);else i?(s=e,l=r.stateNode,8===s.nodeType?(o=s.parentNode).insertBefore(l,s):(o=s).appendChild(l),null!=(s=s._reactRootContainer)||null!==o.onclick||(o.onclick=di)):e.appendChild(r.stateNode);else if(4!==r.tag&&null!==r.child){r.child.return=r,r=r.child;continue}if(r===t)break;for(;null===r.sibling;){if(null===r.return||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}}function ga(t){for(var e=t,n=!1,i=void 0,r=void 0;;){if(!n){n=e.return;t:for(;;){switch(null===n&&a("160"),n.tag){case 5:i=n.stateNode,r=!1;break t;case 3:case 4:i=n.stateNode.containerInfo,r=!0;break t}n=n.return}n=!0}if(5===e.tag||6===e.tag){t:for(var o=e,s=o;;)if(ma(s),null!==s.child&&4!==s.tag)s.child.return=s,s=s.child;else{if(s===o)break;for(;null===s.sibling;){if(null===s.return||s.return===o)break t;s=s.return}s.sibling.return=s.return,s=s.sibling}r?(o=i,s=e.stateNode,8===o.nodeType?o.parentNode.removeChild(s):o.removeChild(s)):i.removeChild(e.stateNode)}else if(4===e.tag){if(null!==e.child){i=e.stateNode.containerInfo,r=!0,e.child.return=e,e=e.child;continue}}else if(ma(e),null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break;for(;null===e.sibling;){if(null===e.return||e.return===t)return;4===(e=e.return).tag&&(n=!1)}e.sibling.return=e.return,e=e.sibling}}function va(t,e){switch(e.tag){case 0:case 11:case 14:case 15:da(kr,Ar,e);break;case 1:break;case 5:var n=e.stateNode;if(null!=n){var i=e.memoizedProps;t=null!==t?t.memoizedProps:i;var r=e.type,o=e.updateQueue;e.updateQueue=null,null!==o&&function(t,e,n,i,r){t[O]=r,"input"===n&&"radio"===r.type&&null!=r.name&&be(t,r),hi(n,i),i=hi(n,r);for(var o=0;o<e.length;o+=2){var a=e[o],s=e[o+1];"style"===a?ui(t,s):"dangerouslySetInnerHTML"===a?ri(t,s):"children"===a?oi(t,s):_e(t,a,s,i)}switch(n){case"input":we(t,r);break;case"textarea":Jn(t,r);break;case"select":e=t._wrapperState.wasMultiple,t._wrapperState.wasMultiple=!!r.multiple,null!=(n=r.value)?Xn(t,!!r.multiple,n,!1):e!==!!r.multiple&&(null!=r.defaultValue?Xn(t,!!r.multiple,r.defaultValue,!0):Xn(t,!!r.multiple,r.multiple?[]:"",!1))}}(n,o,r,t,i)}break;case 6:null===e.stateNode&&a("162"),e.stateNode.nodeValue=e.memoizedProps;break;case 3:case 12:break;case 13:if(n=e.memoizedState,i=void 0,t=e,null===n?i=!1:(i=!0,t=e.child,0===n.timedOutAt&&(n.timedOutAt=ws())),null!==t&&function(t,e){for(var n=t;;){if(5===n.tag){var i=n.stateNode;if(e)i.style.display="none";else{i=n.stateNode;var r=n.memoizedProps.style;r=null!=r&&r.hasOwnProperty("display")?r.display:null,i.style.display=li("display",r)}}else if(6===n.tag)n.stateNode.nodeValue=e?"":n.memoizedProps;else{if(13===n.tag&&null!==n.memoizedState){(i=n.child.sibling).return=n,n=i;continue}if(null!==n.child){n.child.return=n,n=n.child;continue}}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}}(t,i),null!==(n=e.updateQueue)){e.updateQueue=null;var s=e.stateNode;null===s&&(s=e.stateNode=new pa),n.forEach(function(t){var n=function(t,e){var n=t.stateNode;null!==n&&n.delete(e),e=Ka(e=ws(),t),null!==(t=Ja(t,e))&&(Qi(t,e),0!==(e=t.expirationTime)&&Es(t,e))}.bind(null,e,t);s.has(t)||(s.add(t),t.then(n,n))})}break;case 17:break;default:a("163")}}var xa="function"==typeof WeakMap?WeakMap:Map;function ba(t,e,n){(n=Yo(n)).tag=Wo,n.payload={element:null};var i=e.value;return n.callback=function(){Ms(i),ha(t,e)},n}function wa(t,e,n){(n=Yo(n)).tag=Wo;var i=t.type.getDerivedStateFromError;if("function"==typeof i){var r=e.value;n.payload=function(){return i(r)}}var o=t.stateNode;return null!==o&&"function"==typeof o.componentDidCatch&&(n.callback=function(){"function"!=typeof i&&(null===Fa?Fa=new Set([this]):Fa.add(this));var n=e.value,r=e.stack;ha(t,e),this.componentDidCatch(n,{componentStack:null!==r?r:""})}),n}function Ea(t){switch(t.tag){case 1:Oi(t.type)&&Di();var e=t.effectTag;return 2048&e?(t.effectTag=-2049&e|64,t):null;case 3:return Er(),Ri(),0!=(64&(e=t.effectTag))&&a("285"),t.effectTag=-2049&e|64,t;case 5:return Sr(t),null;case 13:return 2048&(e=t.effectTag)?(t.effectTag=-2049&e|64,t):null;case 18:return null;case 4:return Er(),null;case 10:return Uo(t),null;default:return null}}var Ta=qt.ReactCurrentDispatcher,Sa=qt.ReactCurrentOwner,Pa=1073741822,Ca=!1,ka=null,Aa=null,za=0,La=-1,Ma=!1,Ia=null,Oa=!1,Da=null,Ra=null,Ba=null,Fa=null;function Na(){if(null!==ka)for(var t=ka.return;null!==t;){var e=t;switch(e.tag){case 1:var n=e.type.childContextTypes;null!=n&&Di();break;case 3:Er(),Ri();break;case 5:Sr(e);break;case 4:Er();break;case 10:Uo(e)}t=t.return}Aa=null,za=0,La=-1,Ma=!1,ka=null}function Ua(){for(;null!==Ia;){var t=Ia.effectTag;if(16&t&&oi(Ia.stateNode,""),128&t){var e=Ia.alternate;null!==e&&(null!==(e=e.ref)&&("function"==typeof e?e(null):e.current=null))}switch(14&t){case 2:_a(Ia),Ia.effectTag&=-3;break;case 6:_a(Ia),Ia.effectTag&=-3,va(Ia.alternate,Ia);break;case 4:va(Ia.alternate,Ia);break;case 8:ga(t=Ia),t.return=null,t.child=null,t.memoizedState=null,t.updateQueue=null,null!==(t=t.alternate)&&(t.return=null,t.child=null,t.memoizedState=null,t.updateQueue=null)}Ia=Ia.nextEffect}}function ja(){for(;null!==Ia;){if(256&Ia.effectTag)t:{var t=Ia.alternate,e=Ia;switch(e.tag){case 0:case 11:case 15:da(Cr,Pr,e);break t;case 1:if(256&e.effectTag&&null!==t){var n=t.memoizedProps,i=t.memoizedState;e=(t=e.stateNode).getSnapshotBeforeUpdate(e.elementType===e.type?n:ir(e.type,n),i),t.__reactInternalSnapshotBeforeUpdate=e}break t;case 3:case 5:case 6:case 4:case 17:break t;default:a("163")}}Ia=Ia.nextEffect}}function Va(t,e){for(;null!==Ia;){var n=Ia.effectTag;if(36&n){var i=Ia.alternate,r=Ia,o=e;switch(r.tag){case 0:case 11:case 15:da(zr,Lr,r);break;case 1:var s=r.stateNode;if(4&r.effectTag)if(null===i)s.componentDidMount();else{var l=r.elementType===r.type?i.memoizedProps:ir(r.type,i.memoizedProps);s.componentDidUpdate(l,i.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}null!==(i=r.updateQueue)&&ia(0,i,s);break;case 3:if(null!==(i=r.updateQueue)){if(s=null,null!==r.child)switch(r.child.tag){case 5:s=r.child.stateNode;break;case 1:s=r.child.stateNode}ia(0,i,s)}break;case 5:o=r.stateNode,null===i&&4&r.effectTag&&_i(r.type,r.memoizedProps)&&o.focus();break;case 6:case 4:case 12:case 13:case 17:break;default:a("163")}}128&n&&(null!==(r=Ia.ref)&&(o=Ia.stateNode,"function"==typeof r?r(o):r.current=o)),512&n&&(Da=t),Ia=Ia.nextEffect}}function Za(){null!==Ra&&wi(Ra),null!==Ba&&Ba()}function qa(t,e){Oa=Ca=!0,t.current===e&&a("177");var n=t.pendingCommitExpirationTime;0===n&&a("261"),t.pendingCommitExpirationTime=0;var i=e.expirationTime,r=e.childExpirationTime;for(function(t,e){if(t.didError=!1,0===e)t.earliestPendingTime=0,t.latestPendingTime=0,t.earliestSuspendedTime=0,t.latestSuspendedTime=0,t.latestPingedTime=0;else{e<t.latestPingedTime&&(t.latestPingedTime=0);var n=t.latestPendingTime;0!==n&&(n>e?t.earliestPendingTime=t.latestPendingTime=0:t.earliestPendingTime>e&&(t.earliestPendingTime=t.latestPendingTime)),0===(n=t.earliestSuspendedTime)?Qi(t,e):e<t.latestSuspendedTime?(t.earliestSuspendedTime=0,t.latestSuspendedTime=0,t.latestPingedTime=0,Qi(t,e)):e>n&&Qi(t,e)}nr(0,t)}(t,r>i?r:i),Sa.current=null,i=void 0,1<e.effectTag?null!==e.lastEffect?(e.lastEffect.nextEffect=e,i=e.firstEffect):i=e:i=e.firstEffect,mi=Tn,yi=function(){var t=Rn();if(Bn(t)){if("selectionStart"in t)var e={start:t.selectionStart,end:t.selectionEnd};else t:{var n=(e=(e=t.ownerDocument)&&e.defaultView||window).getSelection&&e.getSelection();if(n&&0!==n.rangeCount){e=n.anchorNode;var i=n.anchorOffset,r=n.focusNode;n=n.focusOffset;try{e.nodeType,r.nodeType}catch(t){e=null;break t}var o=0,a=-1,s=-1,l=0,u=0,c=t,p=null;e:for(;;){for(var h;c!==e||0!==i&&3!==c.nodeType||(a=o+i),c!==r||0!==n&&3!==c.nodeType||(s=o+n),3===c.nodeType&&(o+=c.nodeValue.length),null!==(h=c.firstChild);)p=c,c=h;for(;;){if(c===t)break e;if(p===e&&++l===i&&(a=o),p===r&&++u===n&&(s=o),null!==(h=c.nextSibling))break;p=(c=p).parentNode}c=h}e=-1===a||-1===s?null:{start:a,end:s}}else e=null}e=e||{start:0,end:0}}else e=null;return{focusedElem:t,selectionRange:e}}(),Tn=!1,Ia=i;null!==Ia;){r=!1;var s=void 0;try{ja()}catch(t){r=!0,s=t}r&&(null===Ia&&a("178"),Xa(Ia,s),null!==Ia&&(Ia=Ia.nextEffect))}for(Ia=i;null!==Ia;){r=!1,s=void 0;try{Ua()}catch(t){r=!0,s=t}r&&(null===Ia&&a("178"),Xa(Ia,s),null!==Ia&&(Ia=Ia.nextEffect))}for(Fn(yi),yi=null,Tn=!!mi,mi=null,t.current=e,Ia=i;null!==Ia;){r=!1,s=void 0;try{Va(t,n)}catch(t){r=!0,s=t}r&&(null===Ia&&a("178"),Xa(Ia,s),null!==Ia&&(Ia=Ia.nextEffect))}if(null!==i&&null!==Da){var l=function(t,e){Ba=Ra=Da=null;var n=rs;rs=!0;do{if(512&e.effectTag){var i=!1,r=void 0;try{var o=e;da(Ir,Pr,o),da(Pr,Mr,o)}catch(t){i=!0,r=t}i&&Xa(e,r)}e=e.nextEffect}while(null!==e);rs=n,0!==(n=t.expirationTime)&&Es(t,n),cs||rs||ks(1073741823,!1)}.bind(null,t,i);Ra=o.unstable_runWithPriority(o.unstable_NormalPriority,function(){return bi(l)}),Ba=l}Ca=Oa=!1,"function"==typeof ji&&ji(e.stateNode),n=e.expirationTime,0===(e=(e=e.childExpirationTime)>n?e:n)&&(Fa=null),function(t,e){t.expirationTime=e,t.finishedWork=null}(t,e)}function Ga(t){for(;;){var e=t.alternate,n=t.return,i=t.sibling;if(0==(1024&t.effectTag)){ka=t;t:{var o=e,s=za,l=(e=t).pendingProps;switch(e.tag){case 2:case 16:break;case 15:case 0:break;case 1:Oi(e.type)&&Di();break;case 3:Er(),Ri(),(l=e.stateNode).pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),null!==o&&null!==o.child||(vo(e),e.effectTag&=-3),la(e);break;case 5:Sr(e);var u=br(xr.current);if(s=e.type,null!==o&&null!=e.stateNode)ua(o,e,s,l,u),o.ref!==e.ref&&(e.effectTag|=128);else if(l){var c=br(gr.current);if(vo(e)){o=(l=e).stateNode;var p=l.type,h=l.memoizedProps,f=u;switch(o[I]=l,o[O]=h,s=void 0,u=p){case"iframe":case"object":Sn("load",o);break;case"video":case"audio":for(p=0;p<et.length;p++)Sn(et[p],o);break;case"source":Sn("error",o);break;case"img":case"image":case"link":Sn("error",o),Sn("load",o);break;case"form":Sn("reset",o),Sn("submit",o);break;case"details":Sn("toggle",o);break;case"input":xe(o,h),Sn("invalid",o),fi(f,"onChange");break;case"select":o._wrapperState={wasMultiple:!!h.multiple},Sn("invalid",o),fi(f,"onChange");break;case"textarea":Yn(o,h),Sn("invalid",o),fi(f,"onChange")}for(s in pi(u,h),p=null,h)h.hasOwnProperty(s)&&(c=h[s],"children"===s?"string"==typeof c?o.textContent!==c&&(p=["children",c]):"number"==typeof c&&o.textContent!==""+c&&(p=["children",""+c]):v.hasOwnProperty(s)&&null!=c&&fi(f,s));switch(u){case"input":Vt(o),Ee(o,h,!0);break;case"textarea":Vt(o),$n(o);break;case"select":case"option":break;default:"function"==typeof h.onClick&&(o.onclick=di)}s=p,l.updateQueue=s,(l=null!==s)&&aa(e)}else{h=e,o=s,f=l,p=9===u.nodeType?u:u.ownerDocument,c===Qn.html&&(c=ti(o)),c===Qn.html?"script"===o?((o=p.createElement("div")).innerHTML="<script><\/script>",p=o.removeChild(o.firstChild)):"string"==typeof f.is?p=p.createElement(o,{is:f.is}):(p=p.createElement(o),"select"===o&&f.multiple&&(p.multiple=!0)):p=p.createElementNS(c,o),(o=p)[I]=h,o[O]=l,sa(o,e,!1,!1),f=o;var d=u,m=hi(p=s,h=l);switch(p){case"iframe":case"object":Sn("load",f),u=h;break;case"video":case"audio":for(u=0;u<et.length;u++)Sn(et[u],f);u=h;break;case"source":Sn("error",f),u=h;break;case"img":case"image":case"link":Sn("error",f),Sn("load",f),u=h;break;case"form":Sn("reset",f),Sn("submit",f),u=h;break;case"details":Sn("toggle",f),u=h;break;case"input":xe(f,h),u=ve(f,h),Sn("invalid",f),fi(d,"onChange");break;case"option":u=Hn(f,h);break;case"select":f._wrapperState={wasMultiple:!!h.multiple},u=r({},h,{value:void 0}),Sn("invalid",f),fi(d,"onChange");break;case"textarea":Yn(f,h),u=Kn(f,h),Sn("invalid",f),fi(d,"onChange");break;default:u=h}pi(p,u),c=void 0;var y=p,_=f,g=u;for(c in g)if(g.hasOwnProperty(c)){var x=g[c];"style"===c?ui(_,x):"dangerouslySetInnerHTML"===c?null!=(x=x?x.__html:void 0)&&ri(_,x):"children"===c?"string"==typeof x?("textarea"!==y||""!==x)&&oi(_,x):"number"==typeof x&&oi(_,""+x):"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&"autoFocus"!==c&&(v.hasOwnProperty(c)?null!=x&&fi(d,c):null!=x&&_e(_,c,x,m))}switch(p){case"input":Vt(f),Ee(f,h,!1);break;case"textarea":Vt(f),$n(f);break;case"option":null!=h.value&&f.setAttribute("value",""+ge(h.value));break;case"select":(u=f).multiple=!!h.multiple,null!=(f=h.value)?Xn(u,!!h.multiple,f,!1):null!=h.defaultValue&&Xn(u,!!h.multiple,h.defaultValue,!0);break;default:"function"==typeof u.onClick&&(f.onclick=di)}(l=_i(s,l))&&aa(e),e.stateNode=o}null!==e.ref&&(e.effectTag|=128)}else null===e.stateNode&&a("166");break;case 6:o&&null!=e.stateNode?ca(o,e,o.memoizedProps,l):("string"!=typeof l&&(null===e.stateNode&&a("166")),o=br(xr.current),br(gr.current),vo(e)?(s=(l=e).stateNode,o=l.memoizedProps,s[I]=l,(l=s.nodeValue!==o)&&aa(e)):(s=e,(l=(9===o.nodeType?o:o.ownerDocument).createTextNode(l))[I]=e,s.stateNode=l));break;case 11:break;case 13:if(l=e.memoizedState,0!=(64&e.effectTag)){e.expirationTime=s,ka=e;break t}l=null!==l,s=null!==o&&null!==o.memoizedState,null!==o&&!l&&s&&(null!==(o=o.child.sibling)&&(null!==(u=e.firstEffect)?(e.firstEffect=o,o.nextEffect=u):(e.firstEffect=e.lastEffect=o,o.nextEffect=null),o.effectTag=8)),(l||s)&&(e.effectTag|=4);break;case 7:case 8:case 12:break;case 4:Er(),la(e);break;case 10:Uo(e);break;case 9:case 14:break;case 17:Oi(e.type)&&Di();break;case 18:break;default:a("156")}ka=null}if(e=t,1===za||1!==e.childExpirationTime){for(l=0,s=e.child;null!==s;)(o=s.expirationTime)>l&&(l=o),(u=s.childExpirationTime)>l&&(l=u),s=s.sibling;e.childExpirationTime=l}if(null!==ka)return ka;null!==n&&0==(1024&n.effectTag)&&(null===n.firstEffect&&(n.firstEffect=t.firstEffect),null!==t.lastEffect&&(null!==n.lastEffect&&(n.lastEffect.nextEffect=t.firstEffect),n.lastEffect=t.lastEffect),1<t.effectTag&&(null!==n.lastEffect?n.lastEffect.nextEffect=t:n.firstEffect=t,n.lastEffect=t))}else{if(null!==(t=Ea(t)))return t.effectTag&=1023,t;null!==n&&(n.firstEffect=n.lastEffect=null,n.effectTag|=1024)}if(null!==i)return i;if(null===n)break;t=n}return null}function Wa(t){var e=Oo(t.alternate,t,za);return t.memoizedProps=t.pendingProps,null===e&&(e=Ga(t)),Sa.current=null,e}function Ha(t,e){Ca&&a("243"),Za(),Ca=!0;var n=Ta.current;Ta.current=lo;var i=t.nextExpirationTimeToWorkOn;i===za&&t===Aa&&null!==ka||(Na(),za=i,ka=Hi((Aa=t).current,null),t.pendingCommitExpirationTime=0);for(var r=!1;;){try{if(e)for(;null!==ka&&!Ps();)ka=Wa(ka);else for(;null!==ka;)ka=Wa(ka)}catch(e){if(Fo=Bo=Ro=null,Jr(),null===ka)r=!0,Ms(e);else{null===ka&&a("271");var o=ka,s=o.return;if(null!==s){t:{var l=t,u=s,c=o,p=e;if(s=za,c.effectTag|=1024,c.firstEffect=c.lastEffect=null,null!==p&&"object"==typeof p&&"function"==typeof p.then){var h=p;p=u;var f=-1,d=-1;do{if(13===p.tag){var m=p.alternate;if(null!==m&&null!==(m=m.memoizedState)){d=10*(1073741822-m.timedOutAt);break}"number"==typeof(m=p.pendingProps.maxDuration)&&(0>=m?f=0:(-1===f||m<f)&&(f=m))}p=p.return}while(null!==p);p=u;do{if((m=13===p.tag)&&(m=void 0!==p.memoizedProps.fallback&&null===p.memoizedState),m){if(null===(u=p.updateQueue)?((u=new Set).add(h),p.updateQueue=u):u.add(h),0==(1&p.mode)){p.effectTag|=64,c.effectTag&=-1957,1===c.tag&&(null===c.alternate?c.tag=17:((s=Yo(1073741823)).tag=Go,$o(c,s))),c.expirationTime=1073741823;break t}u=s;var y=(c=l).pingCache;null===y?(y=c.pingCache=new xa,m=new Set,y.set(h,m)):void 0===(m=y.get(h))&&(m=new Set,y.set(h,m)),m.has(u)||(m.add(u),c=Ya.bind(null,c,h,u),h.then(c,c)),-1===f?l=1073741823:(-1===d&&(d=10*(1073741822-er(l,s))-5e3),l=d+f),0<=l&&La<l&&(La=l),p.effectTag|=2048,p.expirationTime=s;break t}p=p.return}while(null!==p);p=Error((se(c.type)||"A React component")+" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display."+le(c))}Ma=!0,p=oa(p,c),l=u;do{switch(l.tag){case 3:l.effectTag|=2048,l.expirationTime=s,Qo(l,s=ba(l,p,s));break t;case 1:if(f=p,d=l.type,c=l.stateNode,0==(64&l.effectTag)&&("function"==typeof d.getDerivedStateFromError||null!==c&&"function"==typeof c.componentDidCatch&&(null===Fa||!Fa.has(c)))){l.effectTag|=2048,l.expirationTime=s,Qo(l,s=wa(l,f,s));break t}}l=l.return}while(null!==l)}ka=Ga(o);continue}r=!0,Ms(e)}}break}if(Ca=!1,Ta.current=n,Fo=Bo=Ro=null,Jr(),r)Aa=null,t.finishedWork=null;else if(null!==ka)t.finishedWork=null;else{if(null===(n=t.current.alternate)&&a("281"),Aa=null,Ma){if(r=t.latestPendingTime,o=t.latestSuspendedTime,s=t.latestPingedTime,0!==r&&r<i||0!==o&&o<i||0!==s&&s<i)return tr(t,i),void bs(t,n,i,t.expirationTime,-1);if(!t.didError&&e)return t.didError=!0,i=t.nextExpirationTimeToWorkOn=i,e=t.expirationTime=1073741823,void bs(t,n,i,e,-1)}e&&-1!==La?(tr(t,i),(e=10*(1073741822-er(t,i)))<La&&(La=e),e=10*(1073741822-ws()),e=La-e,bs(t,n,i,t.expirationTime,0>e?0:e)):(t.pendingCommitExpirationTime=i,t.finishedWork=n)}}function Xa(t,e){for(var n=t.return;null!==n;){switch(n.tag){case 1:var i=n.stateNode;if("function"==typeof n.type.getDerivedStateFromError||"function"==typeof i.componentDidCatch&&(null===Fa||!Fa.has(i)))return $o(n,t=wa(n,t=oa(e,t),1073741823)),void $a(n,1073741823);break;case 3:return $o(n,t=ba(n,t=oa(e,t),1073741823)),void $a(n,1073741823)}n=n.return}3===t.tag&&($o(t,n=ba(t,n=oa(e,t),1073741823)),$a(t,1073741823))}function Ka(t,e){var n=o.unstable_getCurrentPriorityLevel(),i=void 0;if(0==(1&e.mode))i=1073741823;else if(Ca&&!Oa)i=za;else{switch(n){case o.unstable_ImmediatePriority:i=1073741823;break;case o.unstable_UserBlockingPriority:i=1073741822-10*(1+((1073741822-t+15)/10|0));break;case o.unstable_NormalPriority:i=1073741822-25*(1+((1073741822-t+500)/25|0));break;case o.unstable_LowPriority:case o.unstable_IdlePriority:i=1;break;default:a("313")}null!==Aa&&i===za&&--i}return n===o.unstable_UserBlockingPriority&&(0===ss||i<ss)&&(ss=i),i}function Ya(t,e,n){var i=t.pingCache;null!==i&&i.delete(e),null!==Aa&&za===n?Aa=null:(e=t.earliestSuspendedTime,i=t.latestSuspendedTime,0!==e&&n<=e&&n>=i&&(t.didError=!1,(0===(e=t.latestPingedTime)||e>n)&&(t.latestPingedTime=n),nr(n,t),0!==(n=t.expirationTime)&&Es(t,n)))}function Ja(t,e){t.expirationTime<e&&(t.expirationTime=e);var n=t.alternate;null!==n&&n.expirationTime<e&&(n.expirationTime=e);var i=t.return,r=null;if(null===i&&3===t.tag)r=t.stateNode;else for(;null!==i;){if(n=i.alternate,i.childExpirationTime<e&&(i.childExpirationTime=e),null!==n&&n.childExpirationTime<e&&(n.childExpirationTime=e),null===i.return&&3===i.tag){r=i.stateNode;break}i=i.return}return r}function $a(t,e){null!==(t=Ja(t,e))&&(!Ca&&0!==za&&e>za&&Na(),Qi(t,e),Ca&&!Oa&&Aa===t||Es(t,t.expirationTime),_s>ys&&(_s=0,a("185")))}function Qa(t,e,n,i,r){return o.unstable_runWithPriority(o.unstable_ImmediatePriority,function(){return t(e,n,i,r)})}var ts=null,es=null,ns=0,is=void 0,rs=!1,os=null,as=0,ss=0,ls=!1,us=null,cs=!1,ps=!1,hs=null,fs=o.unstable_now(),ds=1073741822-(fs/10|0),ms=ds,ys=50,_s=0,gs=null;function vs(){ds=1073741822-((o.unstable_now()-fs)/10|0)}function xs(t,e){if(0!==ns){if(e<ns)return;null!==is&&o.unstable_cancelCallback(is)}ns=e,t=o.unstable_now()-fs,is=o.unstable_scheduleCallback(Cs,{timeout:10*(1073741822-e)-t})}function bs(t,e,n,i,r){t.expirationTime=i,0!==r||Ps()?0<r&&(t.timeoutHandle=vi(function(t,e,n){t.pendingCommitExpirationTime=n,t.finishedWork=e,vs(),ms=ds,As(t,n)}.bind(null,t,e,n),r)):(t.pendingCommitExpirationTime=n,t.finishedWork=e)}function ws(){return rs?ms:(Ts(),0!==as&&1!==as||(vs(),ms=ds),ms)}function Es(t,e){null===t.nextScheduledRoot?(t.expirationTime=e,null===es?(ts=es=t,t.nextScheduledRoot=t):(es=es.nextScheduledRoot=t).nextScheduledRoot=ts):e>t.expirationTime&&(t.expirationTime=e),rs||(cs?ps&&(os=t,as=1073741823,zs(t,1073741823,!1)):1073741823===e?ks(1073741823,!1):xs(t,e))}function Ts(){var t=0,e=null;if(null!==es)for(var n=es,i=ts;null!==i;){var r=i.expirationTime;if(0===r){if((null===n||null===es)&&a("244"),i===i.nextScheduledRoot){ts=es=i.nextScheduledRoot=null;break}if(i===ts)ts=r=i.nextScheduledRoot,es.nextScheduledRoot=r,i.nextScheduledRoot=null;else{if(i===es){(es=n).nextScheduledRoot=ts,i.nextScheduledRoot=null;break}n.nextScheduledRoot=i.nextScheduledRoot,i.nextScheduledRoot=null}i=n.nextScheduledRoot}else{if(r>t&&(t=r,e=i),i===es)break;if(1073741823===t)break;n=i,i=i.nextScheduledRoot}}os=e,as=t}var Ss=!1;function Ps(){return!!Ss||!!o.unstable_shouldYield()&&(Ss=!0)}function Cs(){try{if(!Ps()&&null!==ts){vs();var t=ts;do{var e=t.expirationTime;0!==e&&ds<=e&&(t.nextExpirationTimeToWorkOn=ds),t=t.nextScheduledRoot}while(t!==ts)}ks(0,!0)}finally{Ss=!1}}function ks(t,e){if(Ts(),e)for(vs(),ms=ds;null!==os&&0!==as&&t<=as&&!(Ss&&ds>as);)zs(os,as,ds>as),Ts(),vs(),ms=ds;else for(;null!==os&&0!==as&&t<=as;)zs(os,as,!1),Ts();if(e&&(ns=0,is=null),0!==as&&xs(os,as),_s=0,gs=null,null!==hs)for(t=hs,hs=null,e=0;e<t.length;e++){var n=t[e];try{n._onComplete()}catch(t){ls||(ls=!0,us=t)}}if(ls)throw t=us,us=null,ls=!1,t}function As(t,e){rs&&a("253"),os=t,as=e,zs(t,e,!1),ks(1073741823,!1)}function zs(t,e,n){if(rs&&a("245"),rs=!0,n){var i=t.finishedWork;null!==i?Ls(t,i,e):(t.finishedWork=null,-1!==(i=t.timeoutHandle)&&(t.timeoutHandle=-1,xi(i)),Ha(t,n),null!==(i=t.finishedWork)&&(Ps()?t.finishedWork=i:Ls(t,i,e)))}else null!==(i=t.finishedWork)?Ls(t,i,e):(t.finishedWork=null,-1!==(i=t.timeoutHandle)&&(t.timeoutHandle=-1,xi(i)),Ha(t,n),null!==(i=t.finishedWork)&&Ls(t,i,e));rs=!1}function Ls(t,e,n){var i=t.firstBatch;if(null!==i&&i._expirationTime>=n&&(null===hs?hs=[i]:hs.push(i),i._defer))return t.finishedWork=e,void(t.expirationTime=0);t.finishedWork=null,t===gs?_s++:(gs=t,_s=0),o.unstable_runWithPriority(o.unstable_ImmediatePriority,function(){qa(t,e)})}function Ms(t){null===os&&a("246"),os.expirationTime=0,ls||(ls=!0,us=t)}function Is(t,e){var n=cs;cs=!0;try{return t(e)}finally{(cs=n)||rs||ks(1073741823,!1)}}function Os(t,e){if(cs&&!ps){ps=!0;try{return t(e)}finally{ps=!1}}return t(e)}function Ds(t,e,n){cs||rs||0===ss||(ks(ss,!1),ss=0);var i=cs;cs=!0;try{return o.unstable_runWithPriority(o.unstable_UserBlockingPriority,function(){return t(e,n)})}finally{(cs=i)||rs||ks(1073741823,!1)}}function Rs(t,e,n,i,r){var o=e.current;t:if(n){e:{2===en(n=n._reactInternalFiber)&&1===n.tag||a("170");var s=n;do{switch(s.tag){case 3:s=s.stateNode.context;break e;case 1:if(Oi(s.type)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break e}}s=s.return}while(null!==s);a("171"),s=void 0}if(1===n.tag){var l=n.type;if(Oi(l)){n=Fi(n,l,s);break t}}n=s}else n=Ai;return null===e.context?e.context=n:e.pendingContext=n,e=r,(r=Yo(i)).payload={element:t},null!==(e=void 0===e?null:e)&&(r.callback=e),Za(),$o(o,r),$a(o,i),i}function Bs(t,e,n,i){var r=e.current;return Rs(t,e,n,r=Ka(ws(),r),i)}function Fs(t){if(!(t=t.current).child)return null;switch(t.child.tag){case 5:default:return t.child.stateNode}}function Ns(t){var e=1073741822-25*(1+((1073741822-ws()+500)/25|0));e>=Pa&&(e=Pa-1),this._expirationTime=Pa=e,this._root=t,this._callbacks=this._next=null,this._hasChildren=this._didComplete=!1,this._children=null,this._defer=!0}function Us(){this._callbacks=null,this._didCommit=!1,this._onCommit=this._onCommit.bind(this)}function js(t,e,n){t={current:e=Gi(3,null,null,e?3:0),containerInfo:t,pendingChildren:null,pingCache:null,earliestPendingTime:0,latestPendingTime:0,earliestSuspendedTime:0,latestSuspendedTime:0,latestPingedTime:0,didError:!1,pendingCommitExpirationTime:0,finishedWork:null,timeoutHandle:-1,context:null,pendingContext:null,hydrate:n,nextExpirationTimeToWorkOn:0,expirationTime:0,firstBatch:null,nextScheduledRoot:null},this._internalRoot=e.stateNode=t}function Vs(t){return!(!t||1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType&&(8!==t.nodeType||" react-mount-point-unstable "!==t.nodeValue))}function Zs(t,e,n,i,r){var o=n._reactRootContainer;if(o){if("function"==typeof r){var a=r;r=function(){var t=Fs(o._internalRoot);a.call(t)}}null!=t?o.legacy_renderSubtreeIntoContainer(t,e,r):o.render(e,r)}else{if(o=n._reactRootContainer=function(t,e){if(e||(e=!(!(e=t?9===t.nodeType?t.documentElement:t.firstChild:null)||1!==e.nodeType||!e.hasAttribute("data-reactroot"))),!e)for(var n;n=t.lastChild;)t.removeChild(n);return new js(t,!1,e)}(n,i),"function"==typeof r){var s=r;r=function(){var t=Fs(o._internalRoot);s.call(t)}}Os(function(){null!=t?o.legacy_renderSubtreeIntoContainer(t,e,r):o.render(e,r)})}return Fs(o._internalRoot)}function qs(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;return Vs(e)||a("200"),function(t,e,n){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:Xt,key:null==i?null:""+i,children:t,containerInfo:e,implementation:n}}(t,e,null,n)}Pt=function(t,e,n){switch(e){case"input":if(we(t,n),e=n.name,"radio"===n.type&&null!=e){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var i=n[e];if(i!==t&&i.form===t.form){var r=F(i);r||a("90"),Zt(i),we(i,r)}}}break;case"textarea":Jn(t,n);break;case"select":null!=(e=n.value)&&Xn(t,!!n.multiple,e,!1)}},Ns.prototype.render=function(t){this._defer||a("250"),this._hasChildren=!0,this._children=t;var e=this._root._internalRoot,n=this._expirationTime,i=new Us;return Rs(t,e,null,n,i._onCommit),i},Ns.prototype.then=function(t){if(this._didComplete)t();else{var e=this._callbacks;null===e&&(e=this._callbacks=[]),e.push(t)}},Ns.prototype.commit=function(){var t=this._root._internalRoot,e=t.firstBatch;if(this._defer&&null!==e||a("251"),this._hasChildren){var n=this._expirationTime;if(e!==this){this._hasChildren&&(n=this._expirationTime=e._expirationTime,this.render(this._children));for(var i=null,r=e;r!==this;)i=r,r=r._next;null===i&&a("251"),i._next=r._next,this._next=e,t.firstBatch=this}this._defer=!1,As(t,n),e=this._next,this._next=null,null!==(e=t.firstBatch=e)&&e._hasChildren&&e.render(e._children)}else this._next=null,this._defer=!1},Ns.prototype._onComplete=function(){if(!this._didComplete){this._didComplete=!0;var t=this._callbacks;if(null!==t)for(var e=0;e<t.length;e++)(0,t[e])()}},Us.prototype.then=function(t){if(this._didCommit)t();else{var e=this._callbacks;null===e&&(e=this._callbacks=[]),e.push(t)}},Us.prototype._onCommit=function(){if(!this._didCommit){this._didCommit=!0;var t=this._callbacks;if(null!==t)for(var e=0;e<t.length;e++){var n=t[e];"function"!=typeof n&&a("191",n),n()}}},js.prototype.render=function(t,e){var n=this._internalRoot,i=new Us;return null!==(e=void 0===e?null:e)&&i.then(e),Bs(t,n,null,i._onCommit),i},js.prototype.unmount=function(t){var e=this._internalRoot,n=new Us;return null!==(t=void 0===t?null:t)&&n.then(t),Bs(null,e,null,n._onCommit),n},js.prototype.legacy_renderSubtreeIntoContainer=function(t,e,n){var i=this._internalRoot,r=new Us;return null!==(n=void 0===n?null:n)&&r.then(n),Bs(e,i,t,r._onCommit),r},js.prototype.createBatch=function(){var t=new Ns(this),e=t._expirationTime,n=this._internalRoot,i=n.firstBatch;if(null===i)n.firstBatch=t,t._next=null;else{for(n=null;null!==i&&i._expirationTime>=e;)n=i,i=i._next;t._next=i,null!==n&&(n._next=t)}return t},Mt=Is,It=Ds,Ot=function(){rs||0===ss||(ks(ss,!1),ss=0)};var Gs={createPortal:qs,findDOMNode:function(t){if(null==t)return null;if(1===t.nodeType)return t;var e=t._reactInternalFiber;return void 0===e&&("function"==typeof t.render?a("188"):a("268",Object.keys(t))),t=null===(t=rn(e))?null:t.stateNode},hydrate:function(t,e,n){return Vs(e)||a("200"),Zs(null,t,e,!0,n)},render:function(t,e,n){return Vs(e)||a("200"),Zs(null,t,e,!1,n)},unstable_renderSubtreeIntoContainer:function(t,e,n,i){return Vs(n)||a("200"),(null==t||void 0===t._reactInternalFiber)&&a("38"),Zs(t,e,n,!1,i)},unmountComponentAtNode:function(t){return Vs(t)||a("40"),!!t._reactRootContainer&&(Os(function(){Zs(null,null,t,!1,function(){t._reactRootContainer=null})}),!0)},unstable_createPortal:function(){return qs.apply(void 0,arguments)},unstable_batchedUpdates:Is,unstable_interactiveUpdates:Ds,flushSync:function(t,e){rs&&a("187");var n=cs;cs=!0;try{return Qa(t,e)}finally{cs=n,ks(1073741823,!1)}},unstable_createRoot:function(t,e){return Vs(t)||a("299","unstable_createRoot"),new js(t,!0,null!=e&&!0===e.hydrate)},unstable_flushControlled:function(t){var e=cs;cs=!0;try{Qa(t)}finally{(cs=e)||rs||ks(1073741823,!1)}},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{Events:[R,B,F,A.injectEventPluginsByName,g,q,function(t){P(t,Z)},zt,Lt,kn,L]}};!function(t){var e=t.findFiberByHostInstance;(function(t){if("undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var e=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(e.isDisabled||!e.supportsFiber)return!0;try{var n=e.inject(t);ji=Zi(function(t){return e.onCommitFiberRoot(n,t)}),Vi=Zi(function(t){return e.onCommitFiberUnmount(n,t)})}catch(t){}})(r({},t,{overrideProps:null,currentDispatcherRef:qt.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return null===(t=rn(t))?null:t.stateNode},findFiberByHostInstance:function(t){return e?e(t):null}}))}({findFiberByHostInstance:D,bundleType:0,version:"16.8.2",rendererPackageName:"react-dom"});var Ws={default:Gs},Hs=Ws&&Gs||Ws;t.exports=Hs.default||Hs},function(t,e,n){"use strict";t.exports=n(22)},function(t,e,n){"use strict";(function(t){
/** @license React v0.13.2
* scheduler.production.min.js
*
* 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.
*/
Object.defineProperty(e,"__esModule",{value:!0});var n=null,i=!1,r=3,o=-1,a=-1,s=!1,l=!1;function u(){if(!s){var t=n.expirationTime;l?E():l=!0,w(h,t)}}function c(){var t=n,e=n.next;if(n===e)n=null;else{var i=n.previous;n=i.next=e,e.previous=i}t.next=t.previous=null,i=t.callback,e=t.expirationTime,t=t.priorityLevel;var o=r,s=a;r=t,a=e;try{var l=i()}finally{r=o,a=s}if("function"==typeof l)if(l={callback:l,priorityLevel:t,expirationTime:e,next:null,previous:null},null===n)n=l.next=l.previous=l;else{i=null,t=n;do{if(t.expirationTime>=e){i=t;break}t=t.next}while(t!==n);null===i?i=n:i===n&&(n=l,u()),(e=i.previous).next=i.previous=l,l.next=i,l.previous=e}}function p(){if(-1===o&&null!==n&&1===n.priorityLevel){s=!0;try{do{c()}while(null!==n&&1===n.priorityLevel)}finally{s=!1,null!==n?u():l=!1}}}function h(t){s=!0;var r=i;i=t;try{if(t)for(;null!==n;){var o=e.unstable_now();if(!(n.expirationTime<=o))break;do{c()}while(null!==n&&n.expirationTime<=o)}else if(null!==n)do{c()}while(null!==n&&!T())}finally{s=!1,i=r,null!==n?u():l=!1,p()}}var f,d,m=Date,y="function"==typeof setTimeout?setTimeout:void 0,_="function"==typeof clearTimeout?clearTimeout:void 0,g="function"==typeof requestAnimationFrame?requestAnimationFrame:void 0,v="function"==typeof cancelAnimationFrame?cancelAnimationFrame:void 0;function x(t){f=g(function(e){_(d),t(e)}),d=y(function(){v(f),t(e.unstable_now())},100)}if("object"==typeof performance&&"function"==typeof performance.now){var b=performance;e.unstable_now=function(){return b.now()}}else e.unstable_now=function(){return m.now()};var w,E,T,S=null;if("undefined"!=typeof window?S=window:void 0!==t&&(S=t),S&&S._schedMock){var P=S._schedMock;w=P[0],E=P[1],T=P[2],e.unstable_now=P[3]}else if("undefined"==typeof window||"function"!=typeof MessageChannel){var C=null,k=function(t){if(null!==C)try{C(t)}finally{C=null}};w=function(t){null!==C?setTimeout(w,0,t):(C=t,setTimeout(k,0,!1))},E=function(){C=null},T=function(){return!1}}else{"undefined"!=typeof console&&("function"!=typeof g&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!=typeof v&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"));var A=null,z=!1,L=-1,M=!1,I=!1,O=0,D=33,R=33;T=function(){return O<=e.unstable_now()};var B=new MessageChannel,F=B.port2;B.port1.onmessage=function(){z=!1;var t=A,n=L;A=null,L=-1;var i=e.unstable_now(),r=!1;if(0>=O-i){if(!(-1!==n&&n<=i))return M||(M=!0,x(N)),A=t,void(L=n);r=!0}if(null!==t){I=!0;try{t(r)}finally{I=!1}}};var N=function(t){if(null!==A){x(N);var e=t-O+R;e<R&&D<R?(8>e&&(e=8),R=e<D?D:e):D=e,O=t+R,z||(z=!0,F.postMessage(void 0))}else M=!1};w=function(t,e){A=t,L=e,I||0>e?F.postMessage(void 0):M||(M=!0,x(N))},E=function(){A=null,z=!1,L=-1}}e.unstable_ImmediatePriority=1,e.unstable_UserBlockingPriority=2,e.unstable_NormalPriority=3,e.unstable_IdlePriority=5,e.unstable_LowPriority=4,e.unstable_runWithPriority=function(t,n){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var i=r,a=o;r=t,o=e.unstable_now();try{return n()}finally{r=i,o=a,p()}},e.unstable_next=function(t){switch(r){case 1:case 2:case 3:var n=3;break;default:n=r}var i=r,a=o;r=n,o=e.unstable_now();try{return t()}finally{r=i,o=a,p()}},e.unstable_scheduleCallback=function(t,i){var a=-1!==o?o:e.unstable_now();if("object"==typeof i&&null!==i&&"number"==typeof i.timeout)i=a+i.timeout;else switch(r){case 1:i=a+-1;break;case 2:i=a+250;break;case 5:i=a+1073741823;break;case 4:i=a+1e4;break;default:i=a+5e3}if(t={callback:t,priorityLevel:r,expirationTime:i,next:null,previous:null},null===n)n=t.next=t.previous=t,u();else{a=null;var s=n;do{if(s.expirationTime>i){a=s;break}s=s.next}while(s!==n);null===a?a=n:a===n&&(n=t,u()),(i=a.previous).next=a.previous=t,t.next=a,t.previous=i}return t},e.unstable_cancelCallback=function(t){var e=t.next;if(null!==e){if(e===t)n=null;else{t===n&&(n=e);var i=t.previous;i.next=e,e.previous=i}t.next=t.previous=null}},e.unstable_wrapCallback=function(t){var n=r;return function(){var i=r,a=o;r=n,o=e.unstable_now();try{return t.apply(this,arguments)}finally{r=i,o=a,p()}}},e.unstable_getCurrentPriorityLevel=function(){return r},e.unstable_shouldYield=function(){return!i&&(null!==n&&n.expirationTime<a||T())},e.unstable_continueExecution=function(){null!==n&&u()},e.unstable_pauseExecution=function(){},e.unstable_getFirstCallbackNode=function(){return n}}).call(this,n(12))},function(t,e,n){"use strict";var i=n(24);function r(){}function o(){}o.resetWarningCache=r,t.exports=function(){function t(t,e,n,r,o,a){if(a!==i){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function e(){return t}t.isRequired=t;var n={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:o,resetWarningCache:r};return n.PropTypes=n,n}},function(t,e,n){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default={redbox:{boxSizing:"border-box",fontFamily:"sans-serif",position:"fixed",padding:10,top:"0px",left:"0px",bottom:"0px",right:"0px",width:"100%",background:"rgb(204, 0, 0)",color:"white",zIndex:2147483647,textAlign:"left",fontSize:"16px",lineHeight:1.2,overflow:"auto"},message:{fontWeight:"bold"},stack:{fontFamily:"monospace",marginTop:"2em"},frame:{marginTop:"1em"},file:{fontSize:"0.8em",color:"rgba(255, 255, 255, 0.7)"},linkToFile:{textDecoration:"none",color:"rgba(255, 255, 255, 0.7)"}}},function(t,e,n){var i,r,o;!function(a,s){"use strict";r=[n(27)],void 0===(o="function"==typeof(i=function(t){var e=/(^|@)\S+\:\d+/,n=/^\s*at .*(\S+\:\d+|\(native\))/m,i=/^(eval@)?(\[native code\])?$/;function r(t,e,n){if("function"==typeof Array.prototype.map)return t.map(e,n);for(var i=new Array(t.length),r=0;r<t.length;r++)i[r]=e.call(n,t[r]);return i}function o(t,e,n){if("function"==typeof Array.prototype.filter)return t.filter(e,n);for(var i=[],r=0;r<t.length;r++)e.call(n,t[r])&&i.push(t[r]);return i}return{parse:function(t){if(void 0!==t.stacktrace||void 0!==t["opera#sourceloc"])return this.parseOpera(t);if(t.stack&&t.stack.match(n))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw new Error("Cannot parse given Error object")},extractLocation:function(t){if(-1===t.indexOf(":"))return[t];var e=/(.+?)(?:\:(\d+))?(?:\:(\d+))?$/.exec(t.replace(/[\(\)]/g,""));return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE:function(e){var i=o(e.stack.split("\n"),function(t){return!!t.match(n)},this);return r(i,function(e){e.indexOf("(eval ")>-1&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^\()]*)|(\)\,.*$)/g,""));var n=e.replace(/^\s+/,"").replace(/\(eval code/g,"(").split(/\s+/).slice(1),i=this.extractLocation(n.pop()),r=n.join(" ")||void 0,o=function(t,e){if("function"==typeof Array.prototype.indexOf)return t.indexOf(e);for(var n=0;n<t.length;n++)if(t[n]===e)return n;return-1}(["eval","<anonymous>"],i[0])>-1?void 0:i[0];return new t(r,void 0,o,i[1],i[2],e)},this)},parseFFOrSafari:function(e){var n=o(e.stack.split("\n"),function(t){return!t.match(i)},this);return r(n,function(e){if(e.indexOf(" > eval")>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval\:\d+\:\d+/g,":$1")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new t(e);var n=e.split("@"),i=this.extractLocation(n.pop()),r=n.join("@")||void 0;return new t(r,void 0,i[0],i[1],i[2],e)},this)},parseOpera:function(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9:function(e){for(var n=/Line (\d+).*script (?:in )?(\S+)/i,i=e.message.split("\n"),r=[],o=2,a=i.length;o<a;o+=2){var s=n.exec(i[o]);s&&r.push(new t(void 0,void 0,s[2],s[1],void 0,i[o]))}return r},parseOpera10:function(e){for(var n=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=e.stacktrace.split("\n"),r=[],o=0,a=i.length;o<a;o+=2){var s=n.exec(i[o]);s&&r.push(new t(s[3]||void 0,void 0,s[2],s[1],void 0,i[o]))}return r},parseOpera11:function(n){var i=o(n.stack.split("\n"),function(t){return!!t.match(e)&&!t.match(/^Error created at/)},this);return r(i,function(e){var n,i=e.split("@"),r=this.extractLocation(i.pop()),o=i.shift()||"",a=o.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^\)]*\)/g,"")||void 0;o.match(/\(([^\)]*)\)/)&&(n=o.replace(/^[^\(]+\(([^\)]*)\)$/,"$1"));var s=void 0===n||"[arguments not available]"===n?void 0:n.split(",");return new t(a,s,r[0],r[1],r[2],e)},this)}}})?i.apply(e,r):i)||(t.exports=o)}()},function(t,e,n){var i,r,o;!function(n,a){"use strict";r=[],void 0===(o="function"==typeof(i=function(){function t(t){return!isNaN(parseFloat(t))&&isFinite(t)}function e(t,e,n,i,r,o){void 0!==t&&this.setFunctionName(t),void 0!==e&&this.setArgs(e),void 0!==n&&this.setFileName(n),void 0!==i&&this.setLineNumber(i),void 0!==r&&this.setColumnNumber(r),void 0!==o&&this.setSource(o)}return e.prototype={getFunctionName:function(){return this.functionName},setFunctionName:function(t){this.functionName=String(t)},getArgs:function(){return this.args},setArgs:function(t){if("[object Array]"!==Object.prototype.toString.call(t))throw new TypeError("Args must be an Array");this.args=t},getFileName:function(){return this.fileName},setFileName:function(t){this.fileName=String(t)},getLineNumber:function(){return this.lineNumber},setLineNumber:function(e){if(!t(e))throw new TypeError("Line Number must be a Number");this.lineNumber=Number(e)},getColumnNumber:function(){return this.columnNumber},setColumnNumber:function(e){if(!t(e))throw new TypeError("Column Number must be a Number");this.columnNumber=Number(e)},getSource:function(){return this.source},setSource:function(t){this.source=String(t)},toString:function(){return(this.getFunctionName()||"{anonymous}")+"("+(this.getArgs()||[]).join(",")+")"+(this.getFileName()?"@"+this.getFileName():"")+(t(this.getLineNumber())?":"+this.getLineNumber():"")+(t(this.getColumnNumber())?":"+this.getColumnNumber():"")}},e})?i.apply(e,r):i)||(t.exports=o)}()},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=e.filenameWithoutLoaders=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=t.lastIndexOf("!");return e<0?t:t.substr(e+1)},o=(e.filenameHasLoaders=function(t){return u("filenameWithoutLoaders")(t)!==t},e.filenameHasSchema=function(t){return/^[\w]+\:/.test(t)}),a=(e.isFilenameAbsolute=function(t){return 0===u("filenameWithoutLoaders")(t).indexOf("/")},e.makeUrl=function(t,e,n,i){var r=u("filenameWithoutLoaders")(t);if(u("filenameHasSchema")(t))return r;var o="file://"+r;return"vscode"===e?(o=(o=e+"://file/"+o).replace(/file:\/\/\//,""),n&&r===t&&(o=o+":"+n,i&&(o=o+":"+i))):e&&(o=e+"://open?url="+o,n&&r===t&&(o=o+"&line="+n,i&&(o=o+"&column="+i))),o},e.makeLinkText=function(t,e,n){var i=u("filenameWithoutLoaders")(t);return e&&i===t&&(i=i+":"+e,n&&(i=i+":"+n)),i},Object.create(null)),s="__INTENTIONAL_UNDEFINED__",l={};function u(t){if(void 0===a||void 0===a[t])return function(t){switch(t){case"filenameWithoutLoaders":return r;case"filenameHasSchema":return o}return}(t);var e=a[t];return e===s?void 0:e}function c(t,e){if("object"!==(void 0===t?"undefined":i(t)))return a[t]=void 0===e?s:e,function(){p(t)};Object.keys(t).forEach(function(e){a[e]=t[e]})}function p(t){delete a[t]}function h(t){var e=Object.keys(t),n={};function i(){e.forEach(function(t){a[t]=n[t]})}return function(r){e.forEach(function(e){n[e]=a[e],a[e]=t[e]});var o=r();return o&&"function"==typeof o.then?o.then(i).catch(i):i(),o}}!function(){function t(t,e){Object.defineProperty(l,t,{value:e,enumerable:!1,configurable:!0})}t("__get__",u),t("__GetDependency__",u),t("__Rewire__",c),t("__set__",c),t("__reset__",p),t("__ResetDependency__",p),t("__with__",h)}(),e.__get__=u,e.__GetDependency__=u,e.__Rewire__=c,e.__set__=c,e.__ResetDependency__=p,e.__RewireAPI__=l,e.default=l},function(t,e,n){var i;i=function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={exports:{},id:i,loaded:!1};return t[i].call(r.exports,r,r.exports,n),r.loaded=!0,r.exports}return n.m=t,n.c=e,n.p="",n(0)}([function(t,e,n){var i,r;i=[n(1)],void 0===(r=function(t){var e={},n=function(){return navigator.userAgent.toLowerCase().indexOf("chrome")>-1},i=function(){return navigator.userAgent.toLowerCase().indexOf("firefox")>-1},r=function(){return navigator.userAgent.toLowerCase().indexOf("safari")>-1},o=function(){return document.documentMode&&document.documentMode>=11},a=function(){this.count=0,this.pending=[]};a.prototype.incr=function(){this.count++},a.prototype.decr=function(){this.count--,this.flush()},a.prototype.whenReady=function(t){this.pending.push(t),this.flush()},a.prototype.flush=function(){0===this.count&&(this.pending.forEach(function(t){t()}),this.pending=[])};var s=function(t){this.sem=new a,this.sync=t&&t.sync,this.mapForUri=t&&t.cacheGlobally?e:{}};s.prototype.ajax=function(t,e){var n=function(){for(var t=!1,e=0;e<h.length;e++){try{t=h[e]()}catch(t){continue}break}return t}(),i=this;n.onreadystatechange=function(){4==n.readyState&&e.call(i,n,t)},n.open("GET",t,!this.sync),n.send()},s.prototype.fetchScript=function(t){t in this.mapForUri||(this.sem.incr(),this.mapForUri[t]=null,this.ajax(t,this.onScriptLoad))};var l=new RegExp("^(?:[a-z]+:)?//","i");s.prototype.onScriptLoad=function(e,n){if(200===e.status||"file://"===n.slice(0,7)&&0===e.status){var i=e.responseText.match("//# [s]ourceMappingURL=(.*)[\\s]*$","m");if(i&&2===i.length){var r=i[1],o=r.match("data:application/json;(charset=[^;]+;)?base64,(.*)");if(o&&o[2])this.mapForUri[n]=new t.SourceMapConsumer(atob(o[2])),this.sem.decr();else{if(!l.test(r)){var a,s=n.lastIndexOf("/");-1!==s&&(a=n.slice(0,s+1),r=a+r)}this.ajax(r,function(e){(200===e.status||"file://"===r.slice(0,7)&&0===e.status)&&(this.mapForUri[n]=new t.SourceMapConsumer(e.responseText)),this.sem.decr()})}}else this.sem.decr()}else this.sem.decr()};var u=function(t,e,n){for(var i,r=[],o=0;o<t.length;o++){var a=e[o];if(a){var s=a[1],l=parseInt(a[2],10),u=parseInt(a[3],10);if(i=n[s]){var h=i.originalPositionFor({line:l,column:u});r.push(p(h.source,h.line,h.column,h.name||c(t[o])))}else r.push(p(s,l,u,c(t[o])))}else r.push(t[o])}return r};function c(t){var e=String(t).match(n()||o()?/ +at +([^ ]*).*/:/([^@]*)@.*/);return e&&e[1]}var p=function(t,e,n,i){return" at "+(i||"(unknown)")+" ("+t+":"+e+":"+n+")"},h=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}];return{mapStackTrace:function(t,e,a){var l,c,p,h,f,d,m,y={},_=new s(a);if(n()||o())d=/^ +at.+\((.*):([0-9]+):([0-9]+)/,f=4,m=1;else{if(!i()&&!r())throw new Error("unknown browser :(");d=/@(.*):([0-9]+):([0-9]+)/,f=4,m=0}l=t.split("\n").slice(m);for(var g=0;g<l.length;g++)c=l[g],a&&a.filter&&!a.filter(c)||(p=c.match(d))&&p.length===f&&(y[g]=p,(h=p[1]).match(/<anonymous>/)||_.fetchScript(h));_.sem.whenReady(function(){var t=u(l,y,_.mapForUri);e(t)})}}}.apply(e,i))||(t.exports=r)},function(t,e,n){var i=n(2),r=n(3),o=n(4).ArraySet,a=n(5),s=n(7).quickSort;function l(t){var e=t;return"string"==typeof t&&(e=JSON.parse(t.replace(/^\)\]\}'/,""))),null!=e.sections?new p(e):new u(e)}function u(t){var e=t;"string"==typeof t&&(e=JSON.parse(t.replace(/^\)\]\}'/,"")));var n=i.getArg(e,"version"),r=i.getArg(e,"sources"),a=i.getArg(e,"names",[]),s=i.getArg(e,"sourceRoot",null),l=i.getArg(e,"sourcesContent",null),u=i.getArg(e,"mappings"),c=i.getArg(e,"file",null);if(n!=this._version)throw new Error("Unsupported version: "+n);r=r.map(String).map(i.normalize).map(function(t){return s&&i.isAbsolute(s)&&i.isAbsolute(t)?i.relative(s,t):t}),this._names=o.fromArray(a.map(String),!0),this._sources=o.fromArray(r,!0),this.sourceRoot=s,this.sourcesContent=l,this._mappings=u,this.file=c}function c(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function p(t){var e=t;"string"==typeof t&&(e=JSON.parse(t.replace(/^\)\]\}'/,"")));var n=i.getArg(e,"version"),r=i.getArg(e,"sections");if(n!=this._version)throw new Error("Unsupported version: "+n);this._sources=new o,this._names=new o;var a={line:-1,column:0};this._sections=r.map(function(t){if(t.url)throw new Error("Support for url field in sections not implemented.");var e=i.getArg(t,"offset"),n=i.getArg(e,"line"),r=i.getArg(e,"column");if(n<a.line||n===a.line&&r<a.column)throw new Error("Section offsets must be ordered and non-overlapping.");return a=e,{generatedOffset:{generatedLine:n+1,generatedColumn:r+1},consumer:new l(i.getArg(t,"map"))}})}l.fromSourceMap=function(t){return u.fromSourceMap(t)},l.prototype._version=3,l.prototype.__generatedMappings=null,Object.defineProperty(l.prototype,"_generatedMappings",{get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}}),l.prototype.__originalMappings=null,Object.defineProperty(l.prototype,"_originalMappings",{get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}}),l.prototype._charIsMappingSeparator=function(t,e){var n=t.charAt(e);return";"===n||","===n},l.prototype._parseMappings=function(t,e){throw new Error("Subclasses must implement _parseMappings")},l.GENERATED_ORDER=1,l.ORIGINAL_ORDER=2,l.GREATEST_LOWER_BOUND=1,l.LEAST_UPPER_BOUND=2,l.prototype.eachMapping=function(t,e,n){var r,o=e||null;switch(n||l.GENERATED_ORDER){case l.GENERATED_ORDER:r=this._generatedMappings;break;case l.ORIGINAL_ORDER:r=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var a=this.sourceRoot;r.map(function(t){var e=null===t.source?null:this._sources.at(t.source);return null!=e&&null!=a&&(e=i.join(a,e)),{source:e,generatedLine:t.generatedLine,generatedColumn:t.generatedColumn,originalLine:t.originalLine,originalColumn:t.originalColumn,name:null===t.name?null:this._names.at(t.name)}},this).forEach(t,o)},l.prototype.allGeneratedPositionsFor=function(t){var e=i.getArg(t,"line"),n={source:i.getArg(t,"source"),originalLine:e,originalColumn:i.getArg(t,"column",0)};if(null!=this.sourceRoot&&(n.source=i.relative(this.sourceRoot,n.source)),!this._sources.has(n.source))return[];n.source=this._sources.indexOf(n.source);var o=[],a=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",i.compareByOriginalPositions,r.LEAST_UPPER_BOUND);if(a>=0){var s=this._originalMappings[a];if(void 0===t.column)for(var l=s.originalLine;s&&s.originalLine===l;)o.push({line:i.getArg(s,"generatedLine",null),column:i.getArg(s,"generatedColumn",null),lastColumn:i.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++a];else for(var u=s.originalColumn;s&&s.originalLine===e&&s.originalColumn==u;)o.push({line:i.getArg(s,"generatedLine",null),column:i.getArg(s,"generatedColumn",null),lastColumn:i.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++a]}return o},e.SourceMapConsumer=l,u.prototype=Object.create(l.prototype),u.prototype.consumer=l,u.fromSourceMap=function(t){var e=Object.create(u.prototype),n=e._names=o.fromArray(t._names.toArray(),!0),r=e._sources=o.fromArray(t._sources.toArray(),!0);e.sourceRoot=t._sourceRoot,e.sourcesContent=t._generateSourcesContent(e._sources.toArray(),e.sourceRoot),e.file=t._file;for(var a=t._mappings.toArray().slice(),l=e.__generatedMappings=[],p=e.__originalMappings=[],h=0,f=a.length;h<f;h++){var d=a[h],m=new c;m.generatedLine=d.generatedLine,m.generatedColumn=d.generatedColumn,d.source&&(m.source=r.indexOf(d.source),m.originalLine=d.originalLine,m.originalColumn=d.originalColumn,d.name&&(m.name=n.indexOf(d.name)),p.push(m)),l.push(m)}return s(e.__originalMappings,i.compareByOriginalPositions),e},u.prototype._version=3,Object.defineProperty(u.prototype,"sources",{get:function(){return this._sources.toArray().map(function(t){return null!=this.sourceRoot?i.join(this.sourceRoot,t):t},this)}}),u.prototype._parseMappings=function(t,e){for(var n,r,o,l,u,p=1,h=0,f=0,d=0,m=0,y=0,_=t.length,g=0,v={},x={},b=[],w=[];g<_;)if(";"===t.charAt(g))p++,g++,h=0;else if(","===t.charAt(g))g++;else{for((n=new c).generatedLine=p,l=g;l<_&&!this._charIsMappingSeparator(t,l);l++);if(o=v[r=t.slice(g,l)])g+=r.length;else{for(o=[];g<l;)a.decode(t,g,x),u=x.value,g=x.rest,o.push(u);if(2===o.length)throw new Error("Found a source, but no line and column");if(3===o.length)throw new Error("Found a source and line, but no column");v[r]=o}n.generatedColumn=h+o[0],h=n.generatedColumn,o.length>1&&(n.source=m+o[1],m+=o[1],n.originalLine=f+o[2],f=n.originalLine,n.originalLine+=1,n.originalColumn=d+o[3],d=n.originalColumn,o.length>4&&(n.name=y+o[4],y+=o[4])),w.push(n),"number"==typeof n.originalLine&&b.push(n)}s(w,i.compareByGeneratedPositionsDeflated),this.__generatedMappings=w,s(b,i.compareByOriginalPositions),this.__originalMappings=b},u.prototype._findMapping=function(t,e,n,i,o,a){if(t[n]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+t[n]);if(t[i]<0)throw new TypeError("Column must be greater than or equal to 0, got "+t[i]);return r.search(t,e,o,a)},u.prototype.computeColumnSpans=function(){for(var t=0;t<this._generatedMappings.length;++t){var e=this._generatedMappings[t];if(t+1<this._generatedMappings.length){var n=this._generatedMappings[t+1];if(e.generatedLine===n.generatedLine){e.lastGeneratedColumn=n.generatedColumn-1;continue}}e.lastGeneratedColumn=1/0}},u.prototype.originalPositionFor=function(t){var e={generatedLine:i.getArg(t,"line"),generatedColumn:i.getArg(t,"column")},n=this._findMapping(e,this._generatedMappings,"generatedLine","generatedColumn",i.compareByGeneratedPositionsDeflated,i.getArg(t,"bias",l.GREATEST_LOWER_BOUND));if(n>=0){var r=this._generatedMappings[n];if(r.generatedLine===e.generatedLine){var o=i.getArg(r,"source",null);null!==o&&(o=this._sources.at(o),null!=this.sourceRoot&&(o=i.join(this.sourceRoot,o)));var a=i.getArg(r,"name",null);return null!==a&&(a=this._names.at(a)),{source:o,line:i.getArg(r,"originalLine",null),column:i.getArg(r,"originalColumn",null),name:a}}}return{source:null,line:null,column:null,name:null}},u.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(t){return null==t}))},u.prototype.sourceContentFor=function(t,e){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(t=i.relative(this.sourceRoot,t)),this._sources.has(t))return this.sourcesContent[this._sources.indexOf(t)];var n;if(null!=this.sourceRoot&&(n=i.urlParse(this.sourceRoot))){var r=t.replace(/^file:\/\//,"");if("file"==n.scheme&&this._sources.has(r))return this.sourcesContent[this._sources.indexOf(r)];if((!n.path||"/"==n.path)&&this._sources.has("/"+t))return this.sourcesContent[this._sources.indexOf("/"+t)]}if(e)return null;throw new Error('"'+t+'" is not in the SourceMap.')},u.prototype.generatedPositionFor=function(t){var e=i.getArg(t,"source");if(null!=this.sourceRoot&&(e=i.relative(this.sourceRoot,e)),!this._sources.has(e))return{line:null,column:null,lastColumn:null};var n={source:e=this._sources.indexOf(e),originalLine:i.getArg(t,"line"),originalColumn:i.getArg(t,"column")},r=this._findMapping(n,this._originalMappings,"originalLine","originalColumn",i.compareByOriginalPositions,i.getArg(t,"bias",l.GREATEST_LOWER_BOUND));if(r>=0){var o=this._originalMappings[r];if(o.source===n.source)return{line:i.getArg(o,"generatedLine",null),column:i.getArg(o,"generatedColumn",null),lastColumn:i.getArg(o,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},e.BasicSourceMapConsumer=u,p.prototype=Object.create(l.prototype),p.prototype.constructor=l,p.prototype._version=3,Object.defineProperty(p.prototype,"sources",{get:function(){for(var t=[],e=0;e<this._sections.length;e++)for(var n=0;n<this._sections[e].consumer.sources.length;n++)t.push(this._sections[e].consumer.sources[n]);return t}}),p.prototype.originalPositionFor=function(t){var e={generatedLine:i.getArg(t,"line"),generatedColumn:i.getArg(t,"column")},n=r.search(e,this._sections,function(t,e){var n=t.generatedLine-e.generatedOffset.generatedLine;return n||t.generatedColumn-e.generatedOffset.generatedColumn}),o=this._sections[n];return o?o.consumer.originalPositionFor({line:e.generatedLine-(o.generatedOffset.generatedLine-1),column:e.generatedColumn-(o.generatedOffset.generatedLine===e.generatedLine?o.generatedOffset.generatedColumn-1:0),bias:t.bias}):{source:null,line:null,column:null,name:null}},p.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(t){return t.consumer.hasContentsOfAllSources()})},p.prototype.sourceContentFor=function(t,e){for(var n=0;n<this._sections.length;n++){var i=this._sections[n].consumer.sourceContentFor(t,!0);if(i)return i}if(e)return null;throw new Error('"'+t+'" is not in the SourceMap.')},p.prototype.generatedPositionFor=function(t){for(var e=0;e<this._sections.length;e++){var n=this._sections[e];if(-1!==n.consumer.sources.indexOf(i.getArg(t,"source"))){var r=n.consumer.generatedPositionFor(t);if(r)return{line:r.line+(n.generatedOffset.generatedLine-1),column:r.column+(n.generatedOffset.generatedLine===r.line?n.generatedOffset.generatedColumn-1:0)}}}return{line:null,column:null}},p.prototype._parseMappings=function(t,e){this.__generatedMappings=[],this.__originalMappings=[];for(var n=0;n<this._sections.length;n++)for(var r=this._sections[n],o=r.consumer._generatedMappings,a=0;a<o.length;a++){var l=o[a],u=r.consumer._sources.at(l.source);null!==r.consumer.sourceRoot&&(u=i.join(r.consumer.sourceRoot,u)),this._sources.add(u),u=this._sources.indexOf(u);var c=r.consumer._names.at(l.name);this._names.add(c),c=this._names.indexOf(c);var p={source:u,generatedLine:l.generatedLine+(r.generatedOffset.generatedLine-1),generatedColumn:l.generatedColumn+(r.generatedOffset.generatedLine===l.generatedLine?r.generatedOffset.generatedColumn-1:0),originalLine:l.originalLine,originalColumn:l.originalColumn,name:c};this.__generatedMappings.push(p),"number"==typeof p.originalLine&&this.__originalMappings.push(p)}s(this.__generatedMappings,i.compareByGeneratedPositionsDeflated),s(this.__originalMappings,i.compareByOriginalPositions)},e.IndexedSourceMapConsumer=p},function(t,e){e.getArg=function(t,e,n){if(e in t)return t[e];if(3===arguments.length)return n;throw new Error('"'+e+'" is a required argument.')};var n=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,i=/^data:.+\,.+$/;function r(t){var e=t.match(n);return e?{scheme:e[1],auth:e[2],host:e[3],port:e[4],path:e[5]}:null}function o(t){var e="";return t.scheme&&(e+=t.scheme+":"),e+="//",t.auth&&(e+=t.auth+"@"),t.host&&(e+=t.host),t.port&&(e+=":"+t.port),t.path&&(e+=t.path),e}function a(t){var n=t,i=r(t);if(i){if(!i.path)return t;n=i.path}for(var a,s=e.isAbsolute(n),l=n.split(/\/+/),u=0,c=l.length-1;c>=0;c--)"."===(a=l[c])?l.splice(c,1):".."===a?u++:u>0&&(""===a?(l.splice(c+1,u),u=0):(l.splice(c,2),u--));return""===(n=l.join("/"))&&(n=s?"/":"."),i?(i.path=n,o(i)):n}e.urlParse=r,e.urlGenerate=o,e.normalize=a,e.join=function(t,e){""===t&&(t="."),""===e&&(e=".");var n=r(e),s=r(t);if(s&&(t=s.path||"/"),n&&!n.scheme)return s&&(n.scheme=s.scheme),o(n);if(n||e.match(i))return e;if(s&&!s.host&&!s.path)return s.host=e,o(s);var l="/"===e.charAt(0)?e:a(t.replace(/\/+$/,"")+"/"+e);return s?(s.path=l,o(s)):l},e.isAbsolute=function(t){return"/"===t.charAt(0)||!!t.match(n)},e.relative=function(t,e){""===t&&(t="."),t=t.replace(/\/$/,"");for(var n=0;0!==e.indexOf(t+"/");){var i=t.lastIndexOf("/");if(i<0)return e;if((t=t.slice(0,i)).match(/^([^\/]+:\/)?\/*$/))return e;++n}return Array(n+1).join("../")+e.substr(t.length+1)};var s=!("__proto__"in Object.create(null));function l(t){return t}function u(t){if(!t)return!1;var e=t.length;if(e<9)return!1;if(95!==t.charCodeAt(e-1)||95!==t.charCodeAt(e-2)||111!==t.charCodeAt(e-3)||116!==t.charCodeAt(e-4)||111!==t.charCodeAt(e-5)||114!==t.charCodeAt(e-6)||112!==t.charCodeAt(e-7)||95!==t.charCodeAt(e-8)||95!==t.charCodeAt(e-9))return!1;for(var n=e-10;n>=0;n--)if(36!==t.charCodeAt(n))return!1;return!0}function c(t,e){return t===e?0:t>e?1:-1}e.toSetString=s?l:function(t){return u(t)?"$"+t:t},e.fromSetString=s?l:function(t){return u(t)?t.slice(1):t},e.compareByOriginalPositions=function(t,e,n){var i=t.source-e.source;return 0!==i?i:0!=(i=t.originalLine-e.originalLine)?i:0!=(i=t.originalColumn-e.originalColumn)||n?i:0!=(i=t.generatedColumn-e.generatedColumn)?i:0!=(i=t.generatedLine-e.generatedLine)?i:t.name-e.name},e.compareByGeneratedPositionsDeflated=function(t,e,n){var i=t.generatedLine-e.generatedLine;return 0!==i?i:0!=(i=t.generatedColumn-e.generatedColumn)||n?i:0!=(i=t.source-e.source)?i:0!=(i=t.originalLine-e.originalLine)?i:0!=(i=t.originalColumn-e.originalColumn)?i:t.name-e.name},e.compareByGeneratedPositionsInflated=function(t,e){var n=t.generatedLine-e.generatedLine;return 0!==n?n:0!=(n=t.generatedColumn-e.generatedColumn)?n:0!==(n=c(t.source,e.source))?n:0!=(n=t.originalLine-e.originalLine)?n:0!=(n=t.originalColumn-e.originalColumn)?n:c(t.name,e.name)}},function(t,e){e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2,e.search=function(t,n,i,r){if(0===n.length)return-1;var o=function t(n,i,r,o,a,s){var l=Math.floor((i-n)/2)+n,u=a(r,o[l],!0);return 0===u?l:u>0?i-l>1?t(l,i,r,o,a,s):s==e.LEAST_UPPER_BOUND?i<o.length?i:-1:l:l-n>1?t(n,l,r,o,a,s):s==e.LEAST_UPPER_BOUND?l:n<0?-1:n}(-1,n.length,t,n,i,r||e.GREATEST_LOWER_BOUND);if(o<0)return-1;for(;o-1>=0&&0===i(n[o],n[o-1],!0);)--o;return o}},function(t,e,n){var i=n(2),r=Object.prototype.hasOwnProperty;function o(){this._array=[],this._set=Object.create(null)}o.fromArray=function(t,e){for(var n=new o,i=0,r=t.length;i<r;i++)n.add(t[i],e);return n},o.prototype.size=function(){return Object.getOwnPropertyNames(this._set).length},o.prototype.add=function(t,e){var n=i.toSetString(t),o=r.call(this._set,n),a=this._array.length;o&&!e||this._array.push(t),o||(this._set[n]=a)},o.prototype.has=function(t){var e=i.toSetString(t);return r.call(this._set,e)},o.prototype.indexOf=function(t){var e=i.toSetString(t);if(r.call(this._set,e))return this._set[e];throw new Error('"'+t+'" is not in the set.')},o.prototype.at=function(t){if(t>=0&&t<this._array.length)return this._array[t];throw new Error("No element indexed by "+t)},o.prototype.toArray=function(){return this._array.slice()},e.ArraySet=o},function(t,e,n){var i=n(6);e.encode=function(t){var e,n="",r=function(t){return t<0?1+(-t<<1):0+(t<<1)}(t);do{e=31&r,(r>>>=5)>0&&(e|=32),n+=i.encode(e)}while(r>0);return n},e.decode=function(t,e,n){var r,o,a,s,l=t.length,u=0,c=0;do{if(e>=l)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(o=i.decode(t.charCodeAt(e++))))throw new Error("Invalid base64 digit: "+t.charAt(e-1));r=!!(32&o),u+=(o&=31)<<c,c+=5}while(r);n.value=(s=(a=u)>>1,1==(1&a)?-s:s),n.rest=e}},function(t,e){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");e.encode=function(t){if(0<=t&&t<n.length)return n[t];throw new TypeError("Must be between 0 and 63: "+t)},e.decode=function(t){return 65<=t&&t<=90?t-65:97<=t&&t<=122?t-97+26:48<=t&&t<=57?t-48+52:43==t?62:47==t?63:-1}},function(t,e){function n(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}function i(t,e,r,o){if(r<o){var a=r-1;n(t,(c=r,p=o,Math.round(c+Math.random()*(p-c))),o);for(var s=t[o],l=r;l<o;l++)e(t[l],s)<=0&&n(t,a+=1,l);n(t,a+1,l);var u=a+1;i(t,e,r,u-1),i(t,e,u+1,o)}var c,p}e.quickSort=function(t,e){i(t,e,0,t.length-1)}}])},t.exports=i()},function(t,e,n){n(31).polyfill()},function(t,e,n){(function(e){for(var i=n(32),r="undefined"==typeof window?e:window,o=["moz","webkit"],a="AnimationFrame",s=r["request"+a],l=r["cancel"+a]||r["cancelRequest"+a],u=0;!s&&u<o.length;u++)s=r[o[u]+"Request"+a],l=r[o[u]+"Cancel"+a]||r[o[u]+"CancelRequest"+a];if(!s||!l){var c=0,p=0,h=[];s=function(t){if(0===h.length){var e=i(),n=Math.max(0,1e3/60-(e-c));c=n+e,setTimeout(function(){var t=h.slice(0);h.length=0;for(var e=0;e<t.length;e++)if(!t[e].cancelled)try{t[e].callback(c)}catch(t){setTimeout(function(){throw t},0)}},Math.round(n))}return h.push({handle:++p,callback:t,cancelled:!1}),p},l=function(t){for(var e=0;e<h.length;e++)h[e].handle===t&&(h[e].cancelled=!0)}}t.exports=function(t){return s.call(r,t)},t.exports.cancel=function(){l.apply(r,arguments)},t.exports.polyfill=function(t){t||(t=r),t.requestAnimationFrame=s,t.cancelAnimationFrame=l}}).call(this,n(12))},function(t,e,n){(function(e){(function(){var n,i,r,o,a,s;"undefined"!=typeof performance&&null!==performance&&performance.now?t.exports=function(){return performance.now()}:null!=e&&e.hrtime?(t.exports=function(){return(n()-a)/1e6},i=e.hrtime,o=(n=function(){var t;return 1e9*(t=i())[0]+t[1]})(),s=1e9*e.uptime(),a=o-s):Date.now?(t.exports=function(){return Date.now()-r},r=Date.now()):(t.exports=function(){return(new Date).getTime()-r},r=(new Date).getTime())}).call(this)}).call(this,n(33))},function(t,e){var n,i,r=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(t){i=a}}();var l,u=[],c=!1,p=-1;function h(){c&&l&&(c=!1,l.length?u=l.concat(u):p=-1,u.length&&f())}function f(){if(!c){var t=s(h);c=!0;for(var e=u.length;e;){for(l=u,u=[];++p<e;)l&&l[p].run();p=-1,e=u.length}l=null,c=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function m(){}r.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new d(t,e)),1!==u.length||c||s(f)},d.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=m,r.addListener=m,r.once=m,r.off=m,r.removeListener=m,r.removeAllListeners=m,r.emit=m,r.prependListener=m,r.prependOnceListener=m,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},,function(t,e,n){(function(t){L.MapboxGL=L.Layer.extend({options:{updateInterval:32},initialize:function(e){if(L.setOptions(this,e),!e.accessToken)throw new Error("You should provide a Mapbox GL access token as a token option.");t.accessToken=e.accessToken;var n,i,r,o,a,s,l;this._throttledUpdate=(n=L.Util.bind(this._update,this),i=this.options.updateInterval,l=function(){o=!1,a&&(s.apply(r,a),a=!1)},s=function(){o?a=arguments:(n.apply(r,arguments),setTimeout(l,i),o=!0)})},onAdd:function(t){this._glContainer||this._initContainer(),t._panes.tilePane.appendChild(this._glContainer),this._initGL(),this._offset=this._map.containerPointToLayerPoint([0,0]),t.options.zoomAnimation&&L.DomEvent.on(t._proxy,L.DomUtil.TRANSITION_END,this._transitionEnd,this)},onRemove:function(t){this._map.options.zoomAnimation&&L.DomEvent.off(this._map._proxy,L.DomUtil.TRANSITION_END,this._transitionEnd,this),t.getPanes().tilePane.removeChild(this._glContainer),this._glMap.remove(),this._glMap=null},getEvents:function(){return{move:this._throttledUpdate,zoomanim:this._animateZoom,zoom:this._pinchZoom,zoomstart:this._zoomStart,zoomend:this._zoomEnd}},_initContainer:function(){var t=this._glContainer=L.DomUtil.create("div","leaflet-gl-layer"),e=this._map.getSize();t.style.width=e.x+"px",t.style.height=e.y+"px"},_initGL:function(){var e=this._map.getCenter(),n=L.extend({},this.options,{container:this._glContainer,interactive:!1,center:[e.lng,e.lat],zoom:this._map.getZoom()-1,attributionControl:!1});this._glMap=new t.Map(n),this._glMap.transform.latRange=null,this._glMap._canvas.canvas?this._glMap._actualCanvas=this._glMap._canvas.canvas:this._glMap._actualCanvas=this._glMap._canvas,L.DomUtil.addClass(this._glMap._actualCanvas,"leaflet-image-layer"),L.DomUtil.addClass(this._glMap._actualCanvas,"leaflet-zoom-animated")},_update:function(e){if(this._offset=this._map.containerPointToLayerPoint([0,0]),!this._zooming){var n=this._map.getSize(),i=this._glContainer,r=this._glMap,o=this._map.containerPointToLayerPoint([0,0]);L.DomUtil.setPosition(i,o);var a=this._map.getCenter(),s=r.transform;s.center=t.LngLat.convert([a.lng,a.lat]),s.zoom=this._map.getZoom()-1,r.transform.width!==n.x||r.transform.height!==n.y?(i.style.width=n.x+"px",i.style.height=n.y+"px",null!==r._resize&&void 0!==r._resize?r._resize():r.resize()):null!==r._update&&void 0!==r._update?r._update():r.update()}},_pinchZoom:function(t){this._glMap.jumpTo({zoom:this._map.getZoom()-1,center:this._map.getCenter()})},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),n=this._map._latLngToNewLayerPoint(this._map.getBounds().getNorthWest(),t.zoom,t.center);L.DomUtil.setTransform(this._glMap._actualCanvas,n.subtract(this._offset),e)},_zoomStart:function(t){this._zooming=!0},_zoomEnd:function(){var t=this._map.getZoomScale(this._map.getZoom()),e=this._map._latLngToNewLayerPoint(this._map.getBounds().getNorthWest(),this._map.getZoom(),this._map.getCenter());L.DomUtil.setTransform(this._glMap._actualCanvas,e.subtract(this._offset),t),this._zooming=!1},_transitionEnd:function(t){L.Util.requestAnimFrame(function(){var t=this._map.getZoom(),e=this._map.getCenter(),n=this._map.latLngToContainerPoint(this._map.getBounds().getNorthWest());L.DomUtil.setTransform(this._glMap._actualCanvas,n,1),this._glMap.once("moveend",L.Util.bind(function(){this._zoomEnd()},this)),this._glMap.jumpTo({center:e,zoom:t-1})},this)}}),L.mapboxGL=function(t){return new L.MapboxGL(t)}}).call(this,n(13))},function(t,e,n){"use strict";t.exports=n(37)},function(t,e,n){"use strict";
/** @license React v16.8.2
* react-is.production.min.js
*
* 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.
*/Object.defineProperty(e,"__esModule",{value:!0});var i="function"==typeof Symbol&&Symbol.for,r=i?Symbol.for("react.element"):60103,o=i?Symbol.for("react.portal"):60106,a=i?Symbol.for("react.fragment"):60107,s=i?Symbol.for("react.strict_mode"):60108,l=i?Symbol.for("react.profiler"):60114,u=i?Symbol.for("react.provider"):60109,c=i?Symbol.for("react.context"):60110,p=i?Symbol.for("react.async_mode"):60111,h=i?Symbol.for("react.concurrent_mode"):60111,f=i?Symbol.for("react.forward_ref"):60112,d=i?Symbol.for("react.suspense"):60113,m=i?Symbol.for("react.memo"):60115,y=i?Symbol.for("react.lazy"):60116;function _(t){if("object"==typeof t&&null!==t){var e=t.$$typeof;switch(e){case r:switch(t=t.type){case p:case h:case a:case l:case s:case d:return t;default:switch(t=t&&t.$$typeof){case c:case f:case u:return t;default:return e}}case y:case m:case o:return e}}}function g(t){return _(t)===h}e.typeOf=_,e.AsyncMode=p,e.ConcurrentMode=h,e.ContextConsumer=c,e.ContextProvider=u,e.Element=r,e.ForwardRef=f,e.Fragment=a,e.Lazy=y,e.Memo=m,e.Portal=o,e.Profiler=l,e.StrictMode=s,e.Suspense=d,e.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===a||t===h||t===l||t===s||t===d||"object"==typeof t&&null!==t&&(t.$$typeof===y||t.$$typeof===m||t.$$typeof===u||t.$$typeof===c||t.$$typeof===f)},e.isAsyncMode=function(t){return g(t)||_(t)===p},e.isConcurrentMode=g,e.isContextConsumer=function(t){return _(t)===c},e.isContextProvider=function(t){return _(t)===u},e.isElement=function(t){return"object"==typeof t&&null!==t&&t.$$typeof===r},e.isForwardRef=function(t){return _(t)===f},e.isFragment=function(t){return _(t)===a},e.isLazy=function(t){return _(t)===y},e.isMemo=function(t){return _(t)===m},e.isPortal=function(t){return _(t)===o},e.isProfiler=function(t){return _(t)===l},e.isStrictMode=function(t){return _(t)===s},e.isSuspense=function(t){return _(t)===d}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,r=(i=n(0))&&"object"==typeof i&&"default"in i?i.default:i;e.AppContainer=function(t){return r.Children.only(t.children)},e.hot=function(){return function(t){return t}},e.areComponentsEqual=function(t,e){return t===e},e.setConfig=function(){},e.cold=function(t){return t},e.configureComponent=function(){}},,function(t,e,n){"use strict";var i=n(1),r=n(4),o=n(2),a=n(3),s=n(0),l=n.n(s),u=n(7),c=n(8),p=function(t){return void 0===t&&(t=""),t.split(" ").filter(Boolean)},h=function(t,e,n){null!=t&&n!==e&&(null!=e&&e.length>0&&function(t,e){p(e).forEach(function(e){a.DomUtil.removeClass(t,e)})}(t,e),null!=n&&n.length>0&&function(t,e){p(e).forEach(function(e){a.DomUtil.addClass(t,e)})}(t,n))};n.d(e,"a",function(){return m});var f=["children","className","id","style","useFlyTo","whenReady"],d=function(t){return Array.isArray(t)?[t[0],t[1]]:[t.lat,t.lon?t.lon:t.lng]},m=function(t){function e(e){var n;return n=t.call(this,e)||this,Object(o.a)(Object(i.a)(n),"className",void 0),Object(o.a)(Object(i.a)(n),"contextValue",void 0),Object(o.a)(Object(i.a)(n),"container",void 0),Object(o.a)(Object(i.a)(n),"viewport",{center:void 0,zoom:void 0}),Object(o.a)(Object(i.a)(n),"_ready",!1),Object(o.a)(Object(i.a)(n),"_updating",!1),Object(o.a)(Object(i.a)(n),"onViewportChange",function(){var t=n.leafletElement.getCenter();n.viewport={center:t?[t.lat,t.lng]:void 0,zoom:n.leafletElement.getZoom()},n.props.onViewportChange&&!n._updating&&n.props.onViewportChange(n.viewport)}),Object(o.a)(Object(i.a)(n),"onViewportChanged",function(){n.props.onViewportChanged&&!n._updating&&n.props.onViewportChanged(n.viewport)}),Object(o.a)(Object(i.a)(n),"bindContainer",function(t){n.container=t}),n.className=e.className,n}Object(r.a)(e,t);var n=e.prototype;return n.createLeafletElement=function(t){var e=t.viewport,n=function(t,e){if(null==t)return{};var n,i,r={},o=Object.keys(t);for(i=0;i<o.length;i++)n=o[i],e.indexOf(n)>=0||(r[n]=t[n]);return r}(t,["viewport"]);return e&&(e.center&&(n.center=e.center),"number"==typeof e.zoom&&(n.zoom=e.zoom)),new a.Map(this.container,n)},n.updateLeafletElement=function(t,e){this._updating=!0;var n=e.animate,i=e.bounds,r=e.boundsOptions,o=e.boxZoom,a=e.center,s=e.className,l=e.doubleClickZoom,u=e.dragging,c=e.keyboard,p=e.maxBounds,f=e.scrollWheelZoom,d=e.tap,m=e.touchZoom,y=e.useFlyTo,_=e.viewport,g=e.zoom;if(h(this.container,t.className,s),_&&_!==t.viewport){var v=_.center?_.center:a,x=null==_.zoom?g:_.zoom;!0===y?this.leafletElement.flyTo(v,x,{animate:n}):this.leafletElement.setView(v,x,{animate:n})}else a&&this.shouldUpdateCenter(a,t.center)?!0===y?this.leafletElement.flyTo(a,g,{animate:n}):this.leafletElement.setView(a,g,{animate:n}):"number"==typeof g&&g!==t.zoom&&(null==t.zoom?this.leafletElement.setView(a,g):this.leafletElement.setZoom(g));p&&this.shouldUpdateBounds(p,t.maxBounds)&&this.leafletElement.setMaxBounds(p),i&&(this.shouldUpdateBounds(i,t.bounds)||r!==t.boundsOptions)&&(!0===y?this.leafletElement.flyToBounds(i,r):this.leafletElement.fitBounds(i,r)),o!==t.boxZoom&&(!0===o?this.leafletElement.boxZoom.enable():this.leafletElement.boxZoom.disable()),l!==t.doubleClickZoom&&(!0===l?this.leafletElement.doubleClickZoom.enable():this.leafletElement.doubleClickZoom.disable()),u!==t.dragging&&(!0===u?this.leafletElement.dragging.enable():this.leafletElement.dragging.disable()),c!==t.keyboard&&(!0===c?this.leafletElement.keyboard.enable():this.leafletElement.keyboard.disable()),f!==t.scrollWheelZoom&&(!0===f||"string"==typeof f?(this.leafletElement.options.scrollWheelZoom=f,this.leafletElement.scrollWheelZoom.enable()):this.leafletElement.scrollWheelZoom.disable()),d!==t.tap&&(!0===d?this.leafletElement.tap.enable():this.leafletElement.tap.disable()),m!==t.touchZoom&&(!0===m||"string"==typeof m?(this.leafletElement.options.touchZoom=m,this.leafletElement.touchZoom.enable()):this.leafletElement.touchZoom.disable()),this._updating=!1},n.componentDidMount=function(){var e=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];return Object.keys(t).reduce(function(e,i){return-1===n.indexOf(i)&&(e[i]=t[i]),e},{})}.apply(void 0,[this.props].concat(f));this.leafletElement=this.createLeafletElement(e),this.leafletElement.on("move",this.onViewportChange),this.leafletElement.on("moveend",this.onViewportChanged),null!=e.bounds&&this.leafletElement.fitBounds(e.bounds,e.boundsOptions),this.contextValue={layerContainer:this.leafletElement,map:this.leafletElement},t.prototype.componentDidMount.call(this),this.forceUpdate()},n.componentDidUpdate=function(e){!1===this._ready&&(this._ready=!0,this.props.whenReady&&this.leafletElement.whenReady(this.props.whenReady)),t.prototype.componentDidUpdate.call(this,e),this.updateLeafletElement(e,this.props)},n.componentWillUnmount=function(){t.prototype.componentWillUnmount.call(this),this.leafletElement.off("move",this.onViewportChange),this.leafletElement.off("moveend",this.onViewportChanged),!0===this.props.preferCanvas?(this.leafletElement._initEvents(!0),this.leafletElement._stop()):this.leafletElement.remove()},n.shouldUpdateCenter=function(t,e){return!e||(t=d(t),e=d(e),t[0]!==e[0]||t[1]!==e[1])},n.shouldUpdateBounds=function(t,e){return!e||!Object(a.latLngBounds)(t).equals(Object(a.latLngBounds)(e))},n.render=function(){return l.a.createElement("div",{className:this.className,id:this.props.id,ref:this.bindContainer,style:this.props.style},this.contextValue?l.a.createElement(u.a,{value:this.contextValue},this.props.children):null)},e}(c.a)},function(t,e,n){"use strict";var i=n(5),r=n(4),o=n(3);function a(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var s=n(1),l=n(2),u=n(0),c=n.n(u),p=n(7),h=function(t){function e(e){var n;return n=t.call(this,e)||this,Object(l.a)(Object(s.a)(n),"contextValue",void 0),Object(l.a)(Object(s.a)(n),"leafletElement",void 0),n.leafletElement=n.createLeafletElement(e),n}Object(r.a)(e,t);var n,i,o,h=e.prototype;return h.createLeafletElement=function(t){throw new Error("createLeafletElement() must be implemented")},h.updateLeafletElement=function(t,e){},h.componentDidMount=function(){t.prototype.componentDidMount.call(this),this.layerContainer.addLayer(this.leafletElement)},h.componentDidUpdate=function(e){if(t.prototype.componentDidUpdate.call(this,e),this.props.attribution!==e.attribution){var n=this.props.leaflet.map;null!=n&&null!=n.attributionControl&&(n.attributionControl.removeAttribution(e.attribution),n.attributionControl.addAttribution(this.props.attribution))}this.updateLeafletElement(e,this.props)},h.componentWillUnmount=function(){t.prototype.componentWillUnmount.call(this),this.layerContainer.removeLayer(this.leafletElement)},h.render=function(){var t=this.props.children;return null==t?null:null==this.contextValue?c.a.createElement(u.Fragment,null,t):c.a.createElement(p.a,{value:this.contextValue},t)},n=e,(i=[{key:"layerContainer",get:function(){return this.props.leaflet.layerContainer||this.props.leaflet.map}}])&&a(n.prototype,i),o&&a(n,o),e}(function(t){function e(){return t.apply(this,arguments)||this}return Object(r.a)(e,t),e.prototype.getOptions=function(t){return null!=t.pane?t:null!=t.leaflet&&null!=t.leaflet.pane?Object(i.a)({},t,{pane:t.leaflet.pane}):t},e}(n(8).a));n.d(e,"a",function(){return f});var f=function(t){function e(){return t.apply(this,arguments)||this}Object(r.a)(e,t);var n=e.prototype;return n.createLeafletElement=function(t){return new o.GridLayer(this.getOptions(t))},n.updateLeafletElement=function(t,e){var n=e.opacity,i=e.zIndex;n!==t.opacity&&this.leafletElement.setOpacity(n),i!==t.zIndex&&this.leafletElement.setZIndex(i)},n.getOptions=function(e){var n=t.prototype.getOptions.call(this,e);return null==e.leaflet.map?n:Object(i.a)({maxZoom:e.leaflet.map.options.maxZoom,minZoom:e.leaflet.map.options.minZoom},n)},n.render=function(){return null},e}(h)}]]);
//# sourceMappingURL=vendor.js.map |
import css from 'styled-jsx/css';
export default css`
.cover {
display: flex;
margin: 0 auto;
width: 50%;
}
`;
|
"use strict";
var isImplemented = require("../../../../reg-exp/#/search/is-implemented");
module.exports = function (a) { a(isImplemented(), true); };
|
#!/usr/bin/env python
from __future__ import print_function
import rospy
import sys
import copy
import math
import moveit_commander
import moveit_msgs.msg
from moveit_msgs.msg import Constraints, JointConstraint, PositionConstraint, OrientationConstraint, BoundingVolume
from sensor_msgs.msg import JointState
from moveit_msgs.msg import RobotState
import geometry_msgs.msg
from geometry_msgs.msg import Quaternion, Pose
from std_msgs.msg import String
from moveit_commander.conversions import pose_to_list
from niryo_moveit.srv import MoverService, MoverServiceRequest, MoverServiceResponse
joint_names = ['joint_1', 'joint_2', 'joint_3', 'joint_4', 'joint_5', 'joint_6']
# Between Melodic and Noetic, the return type of plan() changed. moveit_commander has no __version__ variable, so checking the python version as a proxy
if sys.version_info >= (3, 0):
def planCompat(plan):
return plan[1]
else:
def planCompat(plan):
return plan
"""
Given the start angles of the robot, plan a trajectory that ends at the destination pose.
"""
def plan_trajectory(move_group, destination_pose, start_joint_angles):
current_joint_state = JointState()
current_joint_state.name = joint_names
current_joint_state.position = start_joint_angles
moveit_robot_state = RobotState()
moveit_robot_state.joint_state = current_joint_state
move_group.set_start_state(moveit_robot_state)
move_group.set_pose_target(destination_pose)
plan = move_group.plan()
if not plan:
exception_str = """
Trajectory could not be planned for a destination of {} with starting joint angles {}.
Please make sure target and destination are reachable by the robot.
""".format(destination_pose, destination_pose)
raise Exception(exception_str)
return planCompat(plan)
"""
Creates a pick and place plan using the four states below.
1. Pre Grasp - position gripper directly above target object
2. Grasp - lower gripper so that fingers are on either side of object
3. Pick Up - raise gripper back to the pre grasp position
4. Place - move gripper to desired placement position
Gripper behaviour is handled outside of this trajectory planning.
- Gripper close occurs after 'grasp' position has been achieved
- Gripper open occurs after 'place' position has been achieved
https://github.com/ros-planning/moveit/blob/master/moveit_commander/src/moveit_commander/move_group.py
"""
def plan_pick_and_place(req):
response = MoverServiceResponse()
group_name = "arm"
move_group = moveit_commander.MoveGroupCommander(group_name)
current_robot_joint_configuration = req.joints_input.joints
# Pre grasp - position gripper directly above target object
pre_grasp_pose = plan_trajectory(move_group, req.pick_pose, current_robot_joint_configuration)
# If the trajectory has no points, planning has failed and we return an empty response
if not pre_grasp_pose.joint_trajectory.points:
return response
previous_ending_joint_angles = pre_grasp_pose.joint_trajectory.points[-1].positions
# Grasp - lower gripper so that fingers are on either side of object
pick_pose = copy.deepcopy(req.pick_pose)
pick_pose.position.z -= 0.05 # Static value coming from Unity, TODO: pass along with request
grasp_pose = plan_trajectory(move_group, pick_pose, previous_ending_joint_angles)
if not grasp_pose.joint_trajectory.points:
return response
previous_ending_joint_angles = grasp_pose.joint_trajectory.points[-1].positions
# Pick Up - raise gripper back to the pre grasp position
pick_up_pose = plan_trajectory(move_group, req.pick_pose, previous_ending_joint_angles)
if not pick_up_pose.joint_trajectory.points:
return response
previous_ending_joint_angles = pick_up_pose.joint_trajectory.points[-1].positions
# Place - move gripper to desired placement position
place_pose = plan_trajectory(move_group, req.place_pose, previous_ending_joint_angles)
if not place_pose.joint_trajectory.points:
return response
# If trajectory planning worked for all pick and place stages, add plan to response
response.trajectories.append(pre_grasp_pose)
response.trajectories.append(grasp_pose)
response.trajectories.append(pick_up_pose)
response.trajectories.append(place_pose)
move_group.clear_pose_targets()
return response
def moveit_server():
moveit_commander.roscpp_initialize(sys.argv)
rospy.init_node('niryo_moveit_server')
s = rospy.Service('niryo_moveit', MoverService, plan_pick_and_place)
print("Ready to plan")
rospy.spin()
if __name__ == "__main__":
moveit_server()
|
/* eslint-disable consistent-return */
/* eslint-disable array-callback-return */
/* eslint-disable no-restricted-globals */
/* ********************************************************************************************
* *
* Plese read the following tutorial before implementing tasks: *
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array *
* *
* NOTE : Please do not use loops! All tasks can be implmeneted using standard Array methods *
* *
******************************************************************************************** */
/**
* Returns an index of the specified element in array or -1 if element is not found
*
* @param {array} arr
* @param {any} value
* @return {number}
*
* @example
* ['Ace', 10, true], 10 => 1
* ['Array', 'Number', 'string'], 'Date' => -1
* [0, 1, 2, 3, 4, 5], 5 => 5
*/
function findElement(arr, value) {
return arr.indexOf(value);
}
/**
* Generates an array of odd numbers of the specified length
*
* @param {number} len
* @return {array}
*
* @example
* 1 => [ 1 ]
* 2 => [ 1, 3 ]
* 5 => [ 1, 3, 5, 7, 9 ]
*/
function generateOdds(len) {
const arr = new Array(len);
arr.fill(0);
return arr.map((item, index) => 2 * index + 1);
}
/**
* Returns the doubled array - elements of the specified array
* are repeated twice using original order
*
* @param {array} arr
* @return {array}
*
* @example
* ['Ace', 10, true] => ['Ace', 10, true, 'Ace', 10, true]
* [0, 1, 2, 3, 4, 5] => [0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5]
* [] => []
*/
function doubleArray(arr) {
// return arr.reduce((prevVal, item) => arr.push(item), 0);
return arr.concat(arr);
}
/**
* Returns an array of positive numbers from the specified array in original order
*
* @param {array} arr
* @return {array}
*
* @example
* [ 0, 1, 2, 3, 4, 5 ] => [ 1, 2, 3, 4, 5 ]
* [-1, 2, -5, -4, 0] => [ 2 ]
* [] => []
*/
function getArrayOfPositives(arr) {
return arr.filter((item) => item > 0);
}
/**
* Returns the array with strings only in the specified array (in original order)
*
* @param {array} arr
* @return {array}
*
* @example
* [ 0, 1, 'cat', 3, true, 'dog' ] => [ 'cat', 'dog' ]
* [ 1, 2, 3, 4, 5 ] => []
* [ 'cat, 'dog', 'raccoon' ] => [ 'cat', 'dog', 'raccoon' ]
*/
function getArrayOfStrings(arr) {
return arr.filter((item) => isNaN(item));
}
/**
* Removes falsy values from the specified array
* Falsy values: false, null, 0, "", undefined, and NaN.
* (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean#Description)
*
* @param {array} arr
* @return {array}
*
* @example
* [ 0, false, 'cat', NaN, true, '' ] => [ 'cat', true ]
* [ 1, 2, 3, 4, 5, 'false' ] => [ 1, 2, 3, 4, 5, 'false' ]
* [ false, 0, NaN, '', undefined ] => [ ]
*/
function removeFalsyValues(arr) {
return arr.filter((item) => Boolean(item));
}
/**
* Returns the array of uppercase strings from the specified array
*
* @param {array} arr
* @return {array}
*
* @example
* [ 'permanent-internship', 'glutinous-shriek', 'multiplicative-elevation' ]
* => [ 'PERMANENT-INTERNSHIP', 'GLUTINOUS-SHRIEK', 'MULTIPLICATIVE-ELEVATION' ],
* [ 'a', 'b', 'c', 'd', 'e', 'f', 'g' ] => [ 'A', 'B', 'C', 'D', 'E', 'F', 'G' ]
*/
function getUpperCaseStrings(arr) {
return arr.map((item) => item.toUpperCase());
}
/**
* Returns the array of string lengths from the specified string array.
*
* @param {array} arr
* @return {array}
*
* @example
* [ '', 'a', 'bc', 'def', 'ghij' ] => [ 0, 1, 2, 3, 4 ]
* [ 'angular', 'react', 'ember' ] => [ 7, 5, 5 ]
*/
function getStringsLength(arr) {
return arr.map((item) => item.length);
}
/**
* Inserts the item into specified array at specified index
*
* @param {array} arr
* @param {any} item
* @param {number} index
*
* @example
* [ 1, 3, 4, 5 ], 2, 1 => [ 1, 2, 3, 4, 5 ]
* [ 1, 'b', 'c'], 0, 'x' => [ 'x', 1, 'b', 'c' ]
*/
function insertItem(arr, item, index) {
return arr.splice(index, 0, item);
}
/**
* Returns the n first items of the specified array
*
* @param {array} arr
* @param {number} n
*
* @example
* [ 1, 3, 4, 5 ], 2 => [ 1, 3 ]
* [ 'a', 'b', 'c', 'd'], 3 => [ 'a', 'b', 'c' ]
*/
function getHead(arr, n) {
return arr.slice(0, n);
}
/**
* Returns the n last items of the specified array
*
* @param {array} arr
* @param {number} n
*
* @example
* [ 1, 3, 4, 5 ], 2 => [ 4, 5 ]
* [ 'a', 'b', 'c', 'd'], 3 => [ 'b', 'c', 'd' ]
*/
function getTail(arr, n) {
return arr.slice(n * -1);
}
/**
* Returns CSV represebtation of two-dimentional numeric array.
* https://en.wikipedia.org/wiki/Comma-separated_values
*
* @param {array} arr
* @return {string}
*
* @example
* [
* [ 0, 1, 2, 3, 4 ],
* [ 10,11,12,13,14 ],
* [ 20,21,22,23,24 ],
* [ 30,31,32,33,34 ]
* ]
* =>
* '0,1,2,3,4\n'
* +'10,11,12,13,14\n'
* +'20,21,22,23,24\n'
* +'30,31,32,33,34'
*/
function toCsvText(arr) {
return arr.join('\n');
}
/**
* Transforms the numeric array into the according array of squares:
* f(x) = x * x
*
* @param {array} arr
* @return {array}
*
* @example
* [ 0, 1, 2, 3, 4, 5 ] => [ 0, 1, 4, 9, 16, 25 ]
* [ 10, 100, -1 ] => [ 100, 10000, 1 ]
*/
function toArrayOfSquares(arr) {
return arr.map((item) => item ** 2);
}
/**
* Transforms the numeric array to the according moving sum array:
* f[n] = x[0] + x[1] + x[2] +...+ x[n]
* or f[n] = f[n-1] + x[n]
*
* @param {array} arr
* @return {array}
*
* Example :
* [ 1, 1, 1, 1, 1 ] => [ 1, 2, 3, 4, 5 ]
* [ 10, -10, 10, -10, 10 ] => [ 10, 0, 10, 0, 10 ]
* [ 0, 0, 0, 0, 0] => [ 0, 0, 0, 0, 0]
* [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] => [ 1, 3, 6, 10, 15, 21, 28, 36, 45, 55 ]
*/
function getMovingSum(arr) {
const res = [];
arr.reduce((prevVal, item) => {
res.push(prevVal + item);
return prevVal + item;
}, 0);
return res;
}
/**
* Returns every second item from the specified array:
*
* @param {array} arr
* @return {array}
*
* Example :
* [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] => [ 2, 4, 6, 8, 10 ]
* [ 'a', 'b', 'c' , null ] => [ "b", null ]
* [ "a" ] => []
*/
function getSecondItems(arr) {
return arr.filter((_, index) => index % 2 !== 0);
}
/**
* Propagates every item in sequence its position times
* Returns an array that consists of: one first item, two second items, tree third items etc.
*
* @param {array} arr
* @return {array}
*
* @example :
* [] => []
* [ 1 ] => [ 1 ]
* [ 'a', 'b' ] => [ 'a', 'b','b' ]
* [ 'a', 'b', 'c', null ] => [ 'a', 'b','b', 'c','c','c', null,null,null,null ]
* [ 1,2,3,4,5 ] => [ 1, 2,2, 3,3,3, 4,4,4,4, 5,5,5,5,5 ]
*/
function propagateItemsByPositionIndex(arr) {
const res = [];
// eslint-disable-next-line no-unused-vars
arr.map((item, index, ar) => res.push(...new Array(index + 1).fill(item)));
return res;
}
/**
* Returns the 3 largest numbers from the specified array
*
* @param {array} arr
* @return {array}
*
* @example
* [] => []
* [ 1, 2 ] => [ 2, 1 ]
* [ 1, 2, 3 ] => [ 3, 2, 1 ]
* [ 1,2,3,4,5,6,7,8,9,10 ] => [ 10, 9, 8 ]
* [ 10, 10, 10, 10 ] => [ 10, 10, 10 ]
*/
function get3TopItems(arr) {
return arr.slice(-3).reverse();
}
/**
* Returns the number of positive numbers from specified array
*
* @param {array} arr
* @return {number}
*
* @example
* [ ] => 0
* [ -1, 0, 1 ] => 1
* [ 1, 2, 3] => 3
* [ null, 1, 'elephant' ] => 1
* [ 1, '2' ] => 1
*/
function getPositivesCount(arr) {
return arr.reduce((prev, item) => {
if (typeof item === 'number' && item > 0) {
return prev + 1;
}
return prev;
}, 0);
}
/**
* Sorts digit names
*
* @param {array} arr
* @return {array}
*
* @example
* [] => []
* [ 'nine','one' ] => [ 'one', 'nine' ]
* [ 'one','two','three' ] => [ 'one','two', 'three' ]
* [ 'nine','eight','nine','eight'] => [ 'eight','eight','nine','nine']
* [ 'one','one','one','zero' ] => [ 'zero','one','one','one' ]
*/
function sortDigitNamesByNumericOrder(arr) {
const numbs = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'];
return arr.sort((a, b) => {
if (numbs.indexOf(a) > numbs.indexOf(b)) return 1;
if (numbs.indexOf(a) === numbs.indexOf(b)) return 0;
if (numbs.indexOf(a) < numbs.indexOf(b)) return -1;
});
}
/**
* Returns the sum of all items in the specified array of numbers
*
* @param {array} arr
* @return {number}
*
* @example
* [] => 0
* [ 1, 2, 3 ] => 6
* [ -1, 1, -1, 1 ] => 0
* [ 1, 10, 100, 1000 ] => 1111
*/
function getItemsSum(arr) {
return arr.reduce((prev, item) => prev + item, 0);
}
/**
* Returns the number of all falsy value in the specified array
*
* @param {array} arr
* @return {array}
*
* @example
* [] => 0
* [ 1, '', 3 ] => 1
* [ -1, 'false', null, 0 ] => 2
* [ null, undefined, NaN, false, 0, '' ] => 6
*/
function getFalsyValuesCount(arr) {
return arr.filter((item) => !item).length;
}
/**
* Returns a number of all occurences of the specified item in an array
*
* @param {array} arr
* @param {any} item
* @return {number}
*
* @example
* [ 0, 0, 1, 1, 1, 2 ], 1 => 3
* [ 1, 2, 3, 4, 5 ], 0 => 0
* [ 'a','b','c','c' ], 'c'=> 2
* [ null, undefined, null ], null => 2
* [ true, 0, 1, 'true' ], true => 1
*/
function findAllOccurences(arr, item) {
return arr.filter((el) => el === item).length;
}
/**
* Concatenates all elements from specified array into single string with ',' delimeter
*
* @param {array} arr
* @return {string}
*
* @example
* [0, false, 'cat', NaN, true, ''] => '0,false,cat,NaN,true,'
* [1, 2, 3, 4, 5] => '1,2,3,4,5'
* ['rock', 'paper', 'scissors'] => 'rock,paper,scissors'
*/
function toStringList(arr) {
return arr.join(',');
}
/**
* Sorts the specified array by country name first and city name
* (if countries are equal) in ascending order.
*
* @param {array} arr
* @return {array}
*
* @example
* [
* { country: 'Russia', city: 'Moscow' },
* { country: 'Belarus', city: 'Minsk' },
* { country: 'Poland', city: 'Warsaw' },
* { country: 'Russia', city: 'Saint Petersburg' },
* { country: 'Poland', city: 'Krakow' },
* { country: 'Belarus', city: 'Brest' }
* ]
* =>
* [
* { country: 'Belarus', city: 'Brest' },
* { country: 'Belarus', city: 'Minsk' },
* { country: 'Poland', city: 'Krakow' },
* { country: 'Poland', city: 'Warsaw' },
* { country: 'Russia', city: 'Moscow' },
* { country: 'Russia', city: 'Saint Petersburg' }
* ]
*/
function sortCitiesArray(arr) {
return arr.sort((a, b) => {
if (a.country > b.country) return 1;
if (a.country < b.country) return -1;
if (a.country === b.country) {
if (a.city > b.city) return 1;
if (a.city < b.city) return -1;
if (a.city === b.city) return 0;
}
});
}
/**
* Creates an indentity matrix of the specified size
*
* @param {number} n
* @return {array}
*
* @example
* 1 => [[1]]
*
* 2 => [[1,0],
* [0,1]]
*
* [[1,0,0,0,0],
* [0,1,0,0,0],
* 5 => [0,0,1,0,0],
* [0,0,0,1,0],
* [0,0,0,0,1]]
*/
function getIdentityMatrix(n) {
const a = new Array(n).fill(new Array(n).fill(0));
return a.map((el, indexR) => el.map((e, indexC) => {
if (indexR === indexC) return 1;
return 0;
}));
}
/**
* Creates an array of integers from the specified start to end (inclusive)
*
* @param {number} start
* @param {number} end
* @return {array}
*
* @example
* 1, 5 => [ 1, 2, 3, 4, 5 ]
* -2, 2 => [ -2, -1, 0, 1, 2 ]
* 0, 100 => [ 0, 1, 2, ..., 100 ]
* 3, 3 => [ 3 ]
*/
function getIntervalArray(start, end) {
const len = (end - start) + 1;
const res = Array(len).fill(0);
return res.map((el, index) => start + index);
}
/**
* Returns array containing only unique values from the specified array.
*
* @param {array} arr
* @return {array}
*
* @example
* [ 1, 2, 3, 3, 2, 1 ] => [ 1, 2, 3 ]
* [ 'a', 'a', 'a', 'a' ] => [ 'a' ]
* [ 1, 1, 2, 2, 3, 3, 4, 4] => [ 1, 2, 3, 4]
*/
function distinct(arr) {
return Array.from(new Set(arr));
}
/**
* Groups elements of the specified array by key.
* Returns multimap of keys extracted from array elements via keySelector callback
* and values extracted via valueSelector callback.
* See: https://en.wikipedia.org/wiki/Multimap
*
* @param {array} array
* @param {Function} keySelector
* @param {Function} valueSelector
* @return {Map}
*
* @example
* group([
* { country: 'Belarus', city: 'Brest' },
* { country: 'Russia', city: 'Omsk' },
* { country: 'Russia', city: 'Samara' },
* { country: 'Belarus', city: 'Grodno' },
* { country: 'Belarus', city: 'Minsk' },
* { country: 'Poland', city: 'Lodz' }
* ],
* item => item.country,
* item => item.city
* )
* =>
* Map {
* "Belarus" => ["Brest", "Grodno", "Minsk"],
* "Russia" => ["Omsk", "Samara"],
* "Poland" => ["Lodz"]
* }
*/
function group(array, keySelector, valueSelector) {
const res = new Map();
array.map((item) => {
if (res.has(keySelector(item))) {
res.get(keySelector(item)).push(valueSelector(item));
} else {
res.set(keySelector(item), [valueSelector(item)]);
}
});
return res;
}
/**
* Projects each element of the specified array to a sequence
* and flattens the resulting sequences into one array.
*
* @param {array} arr
* @param {Function} childrenSelector, a transform function to apply to each element
* that returns an array of children
* @return {array}
*
* @example
* [[1, 2], [3, 4], [5, 6]], (x) => x => [ 1, 2, 3, 4, 5, 6 ]
* ['one','two','three'], x=>x.split('') => ['o','n','e','t','w','o','t','h','r','e','e']
*/
function selectMany(arr, childrenSelector) {
return arr.map(childrenSelector).flat();
}
/**
* Returns an element from the multidimentional array by the specified indexes.
*
* @param {array} arr
* @param {array} indexes
* @return {any} element from array
*
* @example
* [[1, 2], [3, 4], [5, 6]], [0,0] => 1 (arr[0][0])
* ['one','two','three'], [2] => 'three' (arr[2])
* [[[ 1, 2, 3]]], [ 0, 0, 1 ] => 2 (arr[0][0][1])
*/
function getElementByIndexes(arr, indexes) {
let a = arr;
// eslint-disable-next-line no-return-assign
return indexes.reduce((prev, el) => a = a[el], 0);
}
/**
* Swaps the head and tail of the specified array:
* the head (first half) of array move to the end, the tail (last half) move to the start.
* The middle element (if exists) leave on the same position.
*
*
* @param {array} arr
* @return {array}
*
* @example
* [ 1, 2, 3, 4, 5 ] => [ 4, 5, 3, 1, 2 ]
* \----/ \----/
* head tail
*
* [ 1, 2 ] => [ 2, 1 ]
* [ 1, 2, 3, 4, 5, 6, 7, 8 ] => [ 5, 6, 7, 8, 1, 2, 3, 4 ]
*
*/
function swapHeadAndTail(arr) {
let res = [];
if (arr.length % 2 === 0) {
res = arr.slice(arr.length / 2).concat(arr.slice(0, arr.length / 2));
} else {
res = arr.slice(Math.floor(arr.length / 2) + 1).concat(arr[Math.floor(arr.length / 2)])
.concat(arr.slice(0, arr.length / 2));
}
return res;
}
module.exports = {
findElement,
generateOdds,
doubleArray,
getArrayOfPositives,
getArrayOfStrings,
removeFalsyValues,
getUpperCaseStrings,
getStringsLength,
insertItem,
getHead,
getTail,
toCsvText,
toStringList,
toArrayOfSquares,
getMovingSum,
getSecondItems,
propagateItemsByPositionIndex,
get3TopItems,
getPositivesCount,
sortDigitNamesByNumericOrder,
getItemsSum,
getFalsyValuesCount,
findAllOccurences,
sortCitiesArray,
getIdentityMatrix,
getIntervalArray,
distinct,
group,
selectMany,
getElementByIndexes,
swapHeadAndTail,
};
|
import time
import serial
# help : https://pythonhosted.org/pyserial/pyserial_api.html
from tkinter import *
#from tkinter.ttk import *
from id_frame import *
from eeprom_frame import *
from ram_frame import *
from trace_frame import *
from protocol2 import *
import cProfile
def main():
## change COM port here
servo = servo_protocol2('COM3',1000000) ##eeprom baud = 3
window = Tk()
window.title(" MyServoGUI")
window.geometry("1600x1020")
window.minsize(1600,1020)
fi = id_frame(window,servo)
fe = eeprom_frame(window,servo,fi)
ft =trace_frame(window,servo,fe,fi)
fr = ram_frame(window,servo,ft,fi)
fi.grid(column = 0, row = 0, sticky='nsew')
fe.grid(column = 1, row = 0, sticky='nsew')
ft.grid(column = 2, row = 0, sticky='nsew')
fr.grid(column = 3, row = 0, sticky='nsew')
window.columnconfigure(2, weight=1)
window.rowconfigure(0, weight=1)
mainloop()
if __name__ == "__main__":
##cProfile.run("main()")
main()
|
# -*- coding: utf-8 -*-
import utils.regexp as regexp
from django.utils.encoding import force_text
from django.core.exceptions import ValidationError
class DomainNameValidator(object):
"""Domain name validator adapted from Django's EmailValidator.
"""
message = 'Enter a valid domain name.'
code = 'invalid'
domain_regex = regexp.domain_regex
def __init__(self, message=None, code=None):
if message is not None:
self.message = message
if code is not None:
self.code = code
def __call__(self, value):
value = force_text(value)
if not value:
raise ValidationError(self.message, code=self.code)
if not self.domain_regex.match(value):
# Try for possible IDN domain-part
try:
value = value.encode('idna').decode('ascii')
if not self.domain_regex.match(value):
raise ValidationError(self.message, code=self.code)
else:
return
except UnicodeError:
pass
raise ValidationError(self.message, code=self.code)
|
function Plane() {}
|
'use strict';
var React = require('react');
var PureRenderMixin = require('react-addons-pure-render-mixin');
var SvgIcon = require('../../svg-icon');
var CommunicationMessage = React.createClass({
displayName: 'CommunicationMessage',
mixins: [PureRenderMixin],
render: function render() {
return React.createElement(
SvgIcon,
this.props,
React.createElement('path', { d: 'M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z' })
);
}
});
module.exports = CommunicationMessage; |
#!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
from codecs import open
from setuptools import setup
try:
from azure_bdist_wheel import cmdclass
except ImportError:
from distutils import log as logger
logger.warn("Wheel is not available, disabling bdist_wheel hook")
cmdclass = {}
VERSION = "2.2.6"
CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'License :: OSI Approved :: MIT License',
]
DEPENDENCIES = [
'azure-mgmt-msi==0.2.0',
'azure-mgmt-authorization==0.50.0',
'azure-mgmt-compute==4.3.1',
'azure-mgmt-keyvault==1.1.0',
'azure-keyvault==1.1.0',
'azure-mgmt-network==2.2.1',
'azure-multiapi-storage==0.2.2',
'azure-mgmt-marketplaceordering==0.1.0',
'azure-cli-core'
]
with open('README.rst', 'r', encoding='utf-8') as f:
README = f.read()
with open('HISTORY.rst', 'r', encoding='utf-8') as f:
HISTORY = f.read()
setup(
name='azure-cli-vm',
version=VERSION,
description='Microsoft Azure Command-Line Tools VM Command Module',
long_description=README + '\n\n' + HISTORY,
license='MIT',
author='Microsoft Corporation',
author_email='[email protected]',
url='https://github.com/Azure/azure-cli',
classifiers=CLASSIFIERS,
packages=[
'azure',
'azure.cli',
'azure.cli.command_modules',
'azure.cli.command_modules.vm',
],
install_requires=DEPENDENCIES,
cmdclass=cmdclass
)
|
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
require('custom-env').env(process.env.APP_ENV);
var mongoose_1 = __importDefault(require("mongoose"));
var userModel_1 = require("../lib/models/userModel");
var chai = require('chai');
var chaiHttp = require('chai-http');
var server = require('../server');
var should = chai.should();
chai.use(chaiHttp);
var User = mongoose_1.default.model('User', userModel_1.UserSchema);
var UserTest = new User({
firstName: "hello",
lastName: "world",
email: "[email protected]",
password: "azerty"
});
describe('Tests', function () {
before(function (done) {
mongoose_1.default.connect("mongodb://" + process.env.DB_HOST + ":" + process.env.DB_PORT + "/" + process.env.DB_NAME, { useNewUrlParser: true, useUnifiedTopology: true })
.then(function () {
done();
});
});
after(function (done) {
mongoose_1.default.connection.close();
done();
});
describe('Database Tests', function () {
it('Add User', function (done) {
User.create(UserTest).then(function (doc) {
done();
});
});
it('Get User', function (done) {
User.findOne({ email: '[email protected]' }).then(function (doc) {
chai.expect(doc).to.exist;
done();
});
});
});
describe('API Tests', function () {
var token;
var user = {
firstName: "hello",
lastName: "world",
email: "[email protected]",
password: "azerty"
};
it('Post Register', function (done) {
chai.request(server)
.post('/user/register')
.send(user)
.end(function (err, res) {
res.should.have.status(200);
res.body.should.be.a('object');
res.body.email.should.be.eq(user.email);
res.body.lastName.should.be.eq(user.lastName);
res.body.firstName.should.be.eq(user.firstName);
done();
});
});
it('Post authenticate', function (done) {
chai.request(server)
.post('/user/authenticate')
.send({ email: user.email, password: user.password })
.end(function (err, res) {
res.should.have.status(200);
res.body.should.be.a('object');
res.body.data.token.should.not.be.a('undefined');
token = res.body.data.token;
done();
});
});
it('Access User Info', function (done) {
chai.request(server)
.get('/me')
.set({ token: token })
.end(function (err, res) {
res.should.have.status(200);
res.body.email.should.be.eq(user.email);
res.body.lastName.should.be.eq(user.lastName);
res.body.firstName.should.be.eq(user.firstName);
done();
});
});
});
});
module.exports = {};
|
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# Original file Copyright Crytek GMBH or its affiliates, used under license.
#
# System Imports
import os
# waflib imports
from waflib import Logs
from waflib.Configure import conf
from waflib.Errors import WafError
@conf
def load_windows_common_settings(conf):
"""
Setup all compiler and linker settings shared over all windows configurations
"""
v = conf.env
# Configure manifest tool
v.MSVC_MANIFEST = True
# Setup default libraries to always link
v['LIB'] += [ 'User32', 'Advapi32', 'PsAPI' ]
# Load Resource Compiler Tool
conf.load_rc_tool()
@conf
def register_win_x64_external_ly_identity(self, compiler, configuration):
# Do not register as an external library if the source exists
if os.path.exists(self.Path('Code/Tools/LyIdentity/wscript')):
return
platform = 'windows'
processor = 'intel64'
if configuration not in ('Debug', 'Release'):
raise WafError("Invalid configuration value {}", configuration)
target_platform = 'win_x64'
ly_identity_base_path = self.CreateRootRelativePath('Tools/InternalSDKs/LyIdentity')
include_path = os.path.join(ly_identity_base_path, 'include')
stlib_path = os.path.join(ly_identity_base_path, 'lib', platform, processor, configuration)
shlib_path = os.path.join(ly_identity_base_path, 'bin', platform, processor, configuration)
self.register_3rd_party_uselib('LyIdentity_shared',
target_platform,
includes=[include_path],
defines=['LINK_LY_IDENTITY_DYNAMICALLY'],
importlib=['LyIdentity_shared.lib'],
sharedlibpath=[shlib_path],
sharedlib=['LyIdentity_shared.dll'])
self.register_3rd_party_uselib('LyIdentity_static',
target_platform,
includes=[include_path],
libpath=[stlib_path],
lib=['LyIdentity_static.lib'])
@conf
def register_win_x64_external_ly_metrics(self, compiler, configuration):
# Do not register as an external library if the source exists
if os.path.exists(self.Path('Code/Tools/LyMetrics/wscript')):
return
platform = 'windows'
processor = 'intel64'
if configuration not in ('Debug', 'Release'):
raise WafError("Invalid configuration value {}", configuration)
target_platform = 'win_x64'
ly_identity_base_path = self.CreateRootRelativePath('Tools/InternalSDKs/LyMetrics')
include_path = os.path.join(ly_identity_base_path, 'include')
stlib_path = os.path.join(ly_identity_base_path, 'lib', platform, processor, configuration)
shlib_path = os.path.join(ly_identity_base_path, 'bin', platform, processor, configuration)
self.register_3rd_party_uselib('LyMetricsShared_shared',
target_platform,
includes=[include_path],
defines=['LINK_LY_METRICS_DYNAMICALLY'],
importlib=['LyMetricsShared_shared.lib'],
sharedlibpath=[shlib_path],
sharedlib=['LyMetricsShared_shared.dll'])
self.register_3rd_party_uselib('LyMetricsShared_static',
target_platform,
includes=[include_path],
libpath=[stlib_path],
lib=['LyMetricsShared_static.lib'])
self.register_3rd_party_uselib('LyMetricsProducer_shared',
target_platform,
includes=[include_path],
defines=['LINK_LY_METRICS_PRODUCER_DYNAMICALLY'],
importlib=['LyMetricsProducer_shared.lib'],
sharedlibpath=[shlib_path],
sharedlib=['LyMetricsProducer_shared.dll'])
self.register_3rd_party_uselib('LyMetricsProducer_static',
target_platform,
includes=[include_path],
libpath=[stlib_path],
lib=['LyMetricsProducer_static.lib'])
@conf
def register_win_x64_external_optional_cuda(self, target_platform):
# Obtain CUDA sdk path from system variable CUDA_PATH
cuda_sdk_root = os.getenv('CUDA_PATH')
if not cuda_sdk_root or not os.path.isdir(cuda_sdk_root) or not os.path.exists(cuda_sdk_root):
return;
Logs.info('[INFO] Detected NVIDIA CUDA SDK at: {}'.format(cuda_sdk_root))
cuda_includes = os.path.join(cuda_sdk_root, 'include')
cude_libpath = os.path.join(cuda_sdk_root, 'lib', 'x64')
cuda_lib = 'cuda.lib'
folders_to_validate = [cuda_includes, cude_libpath]
for folder in folders_to_validate:
if not os.path.isdir(folder) or not os.path.exists(folder):
Logs.warn('[WARN] Missing NVIDIA CUDA SDK folder {}'.format(folder))
Logs.warn('[WARN] NVIDIA CUDA SDK will not be used.')
return;
self.register_3rd_party_uselib('CUDA', target_platform,
includes=[cuda_includes],
defines=['CUDA_ENABLED'],
libpath=[cude_libpath],
lib=[cuda_lib],
linkflags=['/DELAYLOAD:nvcuda.dll'])
|
var lop = require("lop");
var RegexTokeniser = lop.RegexTokeniser;
exports.tokenise = tokenise;
var stringPrefix = "'((?:\\\\.|[^'])*)";
function tokenise(string) {
var identifierCharacter = "(?:[a-zA-Z\\-_]|\\\\.)";
var tokeniser = new RegexTokeniser([
{
name: "identifier",
regex: new RegExp(
"(" + identifierCharacter + "(?:" + identifierCharacter + "|[0-9])*)"
),
},
{ name: "dot", regex: /\./ },
{ name: "colon", regex: /:/ },
{ name: "gt", regex: />/ },
{ name: "whitespace", regex: /\s+/ },
{ name: "arrow", regex: /=>/ },
{ name: "equals", regex: /=/ },
{ name: "startsWith", regex: /\^=/ },
{ name: "open-paren", regex: /\(/ },
{ name: "close-paren", regex: /\)/ },
{ name: "open-square-bracket", regex: /\[/ },
{ name: "close-square-bracket", regex: /\]/ },
{ name: "string", regex: new RegExp(stringPrefix + "'") },
{ name: "unterminated-string", regex: new RegExp(stringPrefix) },
{ name: "integer", regex: /([0-9]+)/ },
{ name: "choice", regex: /\|/ },
{ name: "bang", regex: /(!)/ },
]);
return tokeniser.tokenise(string);
}
|
(function(Clazz
,Clazz_newLongArray
,Clazz_doubleToByte
,Clazz_doubleToInt
,Clazz_doubleToLong
,Clazz_declarePackage
,Clazz_instanceOf
,Clazz_load
,Clazz_instantialize
,Clazz_decorateAsClass
,Clazz_floatToInt
,Clazz_floatToLong
,Clazz_makeConstructor
,Clazz_defineEnumConstant
,Clazz_exceptionOf
,Clazz_newIntArray
,Clazz_defineStatics
,Clazz_newFloatArray
,Clazz_declareType
,Clazz_prepareFields
,Clazz_superConstructor
,Clazz_newByteArray
,Clazz_declareInterface
,Clazz_p0p
,Clazz_pu$h
,Clazz_newShortArray
,Clazz_innerTypeInstance
,Clazz_isClassDefined
,Clazz_prepareCallback
,Clazz_newArray
,Clazz_castNullAs
,Clazz_floatToShort
,Clazz_superCall
,Clazz_decorateAsType
,Clazz_newBooleanArray
,Clazz_newCharArray
,Clazz_implementOf
,Clazz_newDoubleArray
,Clazz_overrideConstructor
,Clazz_clone
,Clazz_doubleToShort
,Clazz_getInheritedLevel
,Clazz_getParamsType
,Clazz_isAF
,Clazz_isAI
,Clazz_isAS
,Clazz_isASS
,Clazz_isAP
,Clazz_isAFloat
,Clazz_isAII
,Clazz_isAFF
,Clazz_isAFFF
,Clazz_tryToSearchAndExecute
,Clazz_getStackTrace
,Clazz_inheritArgs
,Clazz_alert
,Clazz_defineMethod
,Clazz_overrideMethod
,Clazz_declareAnonymous
//,Clazz_checkPrivateMethod
,Clazz_cloneFinals
){
var $t$;
//var c$;
Clazz_declarePackage ("J.adapter.smarter");
Clazz_load (["JU.P3"], "J.adapter.smarter.XtalSymmetry", ["java.lang.Boolean", "$.Float", "java.util.Hashtable", "JU.BS", "$.Lst", "$.M3", "$.M4", "$.P3i", "$.PT", "$.SB", "$.V3", "J.adapter.smarter.Atom", "JS.Symmetry", "JU.BSUtil", "$.Logger"], function () {
c$ = Clazz_decorateAsClass (function () {
this.asc = null;
this.acr = null;
this.symmetry = null;
this.unitCellParams = null;
this.baseUnitCell = null;
this.symmetryRange = 0;
this.doCentroidUnitCell = false;
this.centroidPacked = false;
this.packingError = 0;
this.filterSymop = null;
this.applySymmetryToBonds = false;
this.latticeCells = null;
this.ptSupercell = null;
this.matSupercell = null;
this.trajectoryUnitCells = null;
this.doNormalize = true;
this.doPackUnitCell = false;
this.baseSymmetry = null;
this.sym2 = null;
this.rminx = 0;
this.rminy = 0;
this.rminz = 0;
this.rmaxx = 0;
this.rmaxy = 0;
this.rmaxz = 0;
this.ptOffset = null;
this.unitCellOffset = null;
this.minXYZ = null;
this.maxXYZ = null;
this.minXYZ0 = null;
this.maxXYZ0 = null;
this.checkAll = false;
this.bondCount0 = 0;
this.dtype = 3;
this.unitCellTranslations = null;
this.latticeOp = 0;
this.latticeOnly = false;
this.noSymmetryCount = 0;
this.firstSymmetryAtom = 0;
this.ptTemp = null;
this.mTemp = null;
this.nVib = 0;
Clazz_instantialize (this, arguments);
}, J.adapter.smarter, "XtalSymmetry");
Clazz_prepareFields (c$, function () {
this.unitCellParams = Clazz_newFloatArray (6, 0);
this.ptOffset = new JU.P3 ();
});
Clazz_makeConstructor (c$,
function () {
});
Clazz_defineMethod (c$, "set",
function (reader) {
this.acr = reader;
this.asc = reader.asc;
this.getSymmetry ();
return this;
}, "J.adapter.smarter.AtomSetCollectionReader");
Clazz_defineMethod (c$, "getSymmetry",
function () {
return (this.symmetry == null ? (this.symmetry = this.acr.getInterface ("JS.Symmetry")) : this.symmetry);
});
Clazz_defineMethod (c$, "setSymmetry",
function (symmetry) {
return (this.symmetry = symmetry);
}, "J.api.SymmetryInterface");
Clazz_defineMethod (c$, "setSymmetryRange",
function (factor) {
this.symmetryRange = factor;
this.asc.setInfo ("symmetryRange", Float.$valueOf (factor));
}, "~N");
Clazz_defineMethod (c$, "setLatticeCells",
function () {
this.latticeCells = this.acr.latticeCells;
var isLatticeRange = (this.latticeCells[0] <= 555 && this.latticeCells[1] >= 555 && (this.latticeCells[2] == 0 || this.latticeCells[2] == 1 || this.latticeCells[2] == -1));
this.doNormalize = this.latticeCells[0] != 0 && (!isLatticeRange || this.latticeCells[2] == 1);
this.applySymmetryToBonds = this.acr.applySymmetryToBonds;
this.doPackUnitCell = this.acr.doPackUnitCell;
this.doCentroidUnitCell = this.acr.doCentroidUnitCell;
this.centroidPacked = this.acr.centroidPacked;
this.filterSymop = this.acr.filterSymop;
if (this.acr.strSupercell == null) this.setSupercellFromPoint (this.acr.ptSupercell);
});
Clazz_defineMethod (c$, "setSupercellFromPoint",
function (pt) {
this.ptSupercell = pt;
if (pt == null) {
this.matSupercell = null;
return;
}this.matSupercell = new JU.M4 ();
this.matSupercell.m00 = pt.x;
this.matSupercell.m11 = pt.y;
this.matSupercell.m22 = pt.z;
this.matSupercell.m33 = 1;
JU.Logger.info ("Using supercell \n" + this.matSupercell);
}, "JU.P3");
Clazz_defineMethod (c$, "setUnitCell",
function (info, matUnitCellOrientation, unitCellOffset) {
this.unitCellParams = Clazz_newFloatArray (info.length, 0);
this.unitCellOffset = unitCellOffset;
for (var i = 0; i < info.length; i++) this.unitCellParams[i] = info[i];
this.asc.haveUnitCell = true;
this.asc.setCurrentModelInfo ("unitCellParams", this.unitCellParams);
if (this.asc.isTrajectory) {
if (this.trajectoryUnitCells == null) {
this.trajectoryUnitCells = new JU.Lst ();
this.asc.setInfo ("unitCells", this.trajectoryUnitCells);
}this.trajectoryUnitCells.addLast (this.unitCellParams);
}this.asc.setGlobalBoolean (2);
this.getSymmetry ().setUnitCell (this.unitCellParams, false);
if (unitCellOffset != null) {
this.symmetry.setOffsetPt (unitCellOffset);
this.asc.setCurrentModelInfo ("unitCellOffset", unitCellOffset);
}if (matUnitCellOrientation != null) {
this.symmetry.initializeOrientation (matUnitCellOrientation);
this.asc.setCurrentModelInfo ("matUnitCellOrientation", matUnitCellOrientation);
}}, "~A,JU.M3,JU.P3");
Clazz_defineMethod (c$, "addSpaceGroupOperation",
function (xyz, andSetLattice) {
if (andSetLattice) this.setLatticeCells ();
this.symmetry.setSpaceGroup (this.doNormalize);
return this.symmetry.addSpaceGroupOperation (xyz, 0);
}, "~S,~B");
Clazz_defineMethod (c$, "setLatticeParameter",
function (latt) {
this.symmetry.setSpaceGroup (this.doNormalize);
this.symmetry.setLattice (latt);
}, "~N");
Clazz_defineMethod (c$, "applySymmetryFromReader",
function (readerSymmetry) {
this.asc.setCoordinatesAreFractional (this.acr.iHaveFractionalCoordinates);
this.setUnitCell (this.acr.unitCellParams, this.acr.matUnitCellOrientation, this.acr.unitCellOffset);
this.setAtomSetSpaceGroupName (this.acr.sgName);
this.setSymmetryRange (this.acr.symmetryRange);
if (this.acr.doConvertToFractional || this.acr.fileCoordinatesAreFractional) {
this.setLatticeCells ();
var doApplySymmetry = true;
if (this.acr.ignoreFileSpaceGroupName || !this.acr.iHaveSymmetryOperators) {
if (!this.acr.merging || readerSymmetry == null) readerSymmetry = this.acr.getNewSymmetry ();
doApplySymmetry = readerSymmetry.createSpaceGroup (this.acr.desiredSpaceGroupIndex, (this.acr.sgName.indexOf ("!") >= 0 ? "P1" : this.acr.sgName), this.acr.unitCellParams);
} else {
this.acr.doPreSymmetry ();
readerSymmetry = null;
}this.packingError = this.acr.packingError;
if (doApplySymmetry) {
if (readerSymmetry != null) this.symmetry.setSpaceGroupFrom (readerSymmetry);
this.applySymmetryLattice ();
if (readerSymmetry != null && this.filterSymop == null) this.setAtomSetSpaceGroupName (readerSymmetry.getSpaceGroupName ());
}}if (this.acr.iHaveFractionalCoordinates && this.acr.merging && readerSymmetry != null) {
var atoms = this.asc.atoms;
for (var i = this.asc.getLastAtomSetAtomIndex (), n = this.asc.ac; i < n; i++) readerSymmetry.toCartesian (atoms[i], true);
this.asc.setCoordinatesAreFractional (false);
this.acr.addVibrations = false;
}return this.symmetry;
}, "J.api.SymmetryInterface");
Clazz_defineMethod (c$, "setAtomSetSpaceGroupName",
function (spaceGroupName) {
this.asc.setCurrentModelInfo ("spaceGroup", spaceGroupName + "");
}, "~S");
Clazz_defineMethod (c$, "applySymmetryLattice",
function () {
if (!this.asc.coordinatesAreFractional || this.symmetry.getSpaceGroup () == null) return;
this.sym2 = null;
var maxX = this.latticeCells[0];
var maxY = this.latticeCells[1];
var maxZ = Math.abs (this.latticeCells[2]);
this.firstSymmetryAtom = this.asc.getLastAtomSetAtomIndex ();
var bsAtoms = null;
this.rminx = this.rminy = this.rminz = 3.4028235E38;
this.rmaxx = this.rmaxy = this.rmaxz = -3.4028235E38;
var pt0 = null;
if (this.acr.fillRange != null) {
if (this.asc.bsAtoms == null) this.asc.bsAtoms = new JU.BS ();
bsAtoms = this.asc.bsAtoms;
bsAtoms.setBits (this.firstSymmetryAtom, this.asc.ac);
this.doPackUnitCell = false;
this.minXYZ = new JU.P3i ();
this.maxXYZ = JU.P3i.new3 (1, 1, 1);
var oabc = new Array (4);
for (var i = 0; i < 4; i++) oabc[i] = JU.P3.newP (this.acr.fillRange[i]);
this.adjustRangeMinMax (oabc);
if (this.sym2 == null) {
this.sym2 = new JS.Symmetry ();
this.sym2.getUnitCell (this.acr.fillRange, false, null);
}this.applyAllSymmetry (this.acr.ms, bsAtoms);
pt0 = new JU.P3 ();
var atoms = this.asc.atoms;
for (var i = this.asc.ac; --i >= this.firstSymmetryAtom; ) {
pt0.setT (atoms[i]);
this.symmetry.toCartesian (pt0, false);
this.sym2.toFractional (pt0, false);
if (this.acr.fixJavaFloat) JU.PT.fixPtFloats (pt0, 100000.0);
if (!this.isWithinCell (this.dtype, pt0, 0, 1, 0, 1, 0, 1, this.packingError)) bsAtoms.clear (i);
}
return;
}var offset = null;
this.nVib = 0;
var va = null;
var vb = null;
var vc = null;
this.baseSymmetry = this.symmetry;
var supercell = this.acr.strSupercell;
var oabc = null;
var isSuper = (supercell != null && supercell.indexOf (",") >= 0);
if (isSuper) {
oabc = this.symmetry.getV0abc (supercell);
if (oabc != null) {
this.minXYZ = new JU.P3i ();
this.maxXYZ = JU.P3i.new3 (maxX, maxY, maxZ);
this.symmetry.setMinMaxLatticeParameters (this.minXYZ, this.maxXYZ);
pt0 = JU.P3.newP (oabc[0]);
va = JU.P3.newP (oabc[1]);
vb = JU.P3.newP (oabc[2]);
vc = JU.P3.newP (oabc[3]);
this.adjustRangeMinMax (oabc);
}}var iAtomFirst = this.asc.getLastAtomSetAtomIndex ();
if (this.rminx == 3.4028235E38) {
this.matSupercell = null;
supercell = null;
oabc = null;
} else {
var doPack0 = this.doPackUnitCell;
this.doPackUnitCell = doPack0;
if (this.asc.bsAtoms == null) this.asc.bsAtoms = JU.BSUtil.newBitSet2 (0, this.asc.ac);
bsAtoms = this.asc.bsAtoms;
this.applyAllSymmetry (this.acr.ms, null);
this.doPackUnitCell = doPack0;
var atoms = this.asc.atoms;
var atomCount = this.asc.ac;
for (var i = iAtomFirst; i < atomCount; i++) {
this.symmetry.toCartesian (atoms[i], true);
bsAtoms.set (i);
}
this.symmetry = null;
this.symmetry = this.getSymmetry ();
this.setUnitCell ( Clazz_newFloatArray (-1, [0, 0, 0, 0, 0, 0, va.x, va.y, va.z, vb.x, vb.y, vb.z, vc.x, vc.y, vc.z]), null, offset);
this.setAtomSetSpaceGroupName (oabc == null || supercell == null ? "P1" : "cell=" + supercell);
this.symmetry.setSpaceGroup (this.doNormalize);
this.symmetry.addSpaceGroupOperation ("x,y,z", 0);
if (pt0 != null) this.symmetry.toFractional (pt0, true);
for (var i = iAtomFirst; i < atomCount; i++) {
this.symmetry.toFractional (atoms[i], true);
if (pt0 != null) atoms[i].sub (pt0);
}
this.asc.haveAnisou = false;
this.asc.setCurrentModelInfo ("matUnitCellOrientation", null);
}this.minXYZ = new JU.P3i ();
this.maxXYZ = JU.P3i.new3 (maxX, maxY, maxZ);
this.symmetry.setMinMaxLatticeParameters (this.minXYZ, this.maxXYZ);
if (oabc == null) {
this.applyAllSymmetry (this.acr.ms, bsAtoms);
return;
}if (this.acr.forcePacked || this.doPackUnitCell) {
var bs = this.asc.bsAtoms;
var atoms = this.asc.atoms;
if (bs == null) bs = this.asc.bsAtoms = JU.BSUtil.newBitSet2 (0, this.asc.ac);
for (var i = bs.nextSetBit (iAtomFirst); i >= 0; i = bs.nextSetBit (i + 1)) {
if (!this.isWithinCell (this.dtype, atoms[i], this.minXYZ.x, this.maxXYZ.x, this.minXYZ.y, this.maxXYZ.y, this.minXYZ.z, this.maxXYZ.z, this.packingError)) bs.clear (i);
}
}});
Clazz_defineMethod (c$, "adjustRangeMinMax",
function (oabc) {
var pa = new JU.P3 ();
var pb = new JU.P3 ();
var pc = new JU.P3 ();
if (this.acr.forcePacked) {
pa.setT (oabc[1]);
pb.setT (oabc[2]);
pc.setT (oabc[3]);
pa.scale (this.packingError);
pb.scale (this.packingError);
pc.scale (this.packingError);
}oabc[0].scaleAdd2 (this.minXYZ.x, oabc[1], oabc[0]);
oabc[0].scaleAdd2 (this.minXYZ.y, oabc[2], oabc[0]);
oabc[0].scaleAdd2 (this.minXYZ.z, oabc[3], oabc[0]);
oabc[0].sub (pa);
oabc[0].sub (pb);
oabc[0].sub (pc);
var pt = JU.P3.newP (oabc[0]);
this.symmetry.toFractional (pt, true);
this.setSymmetryMinMax (pt);
oabc[1].scale (this.maxXYZ.x - this.minXYZ.x);
oabc[2].scale (this.maxXYZ.y - this.minXYZ.y);
oabc[3].scale (this.maxXYZ.z - this.minXYZ.z);
oabc[1].scaleAdd2 (2, pa, oabc[1]);
oabc[2].scaleAdd2 (2, pb, oabc[2]);
oabc[3].scaleAdd2 (2, pc, oabc[3]);
for (var i = 0; i < 3; i++) {
for (var j = i + 1; j < 4; j++) {
pt.add2 (oabc[i], oabc[j]);
if (i != 0) pt.add (oabc[0]);
this.symmetry.toFractional (pt, false);
this.setSymmetryMinMax (pt);
}
}
this.symmetry.toCartesian (pt, false);
pt.add (oabc[1]);
this.symmetry.toFractional (pt, false);
this.setSymmetryMinMax (pt);
this.minXYZ = JU.P3i.new3 (Clazz_doubleToInt (Math.min (0, Math.floor (this.rminx + 0.001))), Clazz_doubleToInt (Math.min (0, Math.floor (this.rminy + 0.001))), Clazz_doubleToInt (Math.min (0, Math.floor (this.rminz + 0.001))));
this.maxXYZ = JU.P3i.new3 (Clazz_doubleToInt (Math.max (1, Math.ceil (this.rmaxx - 0.001))), Clazz_doubleToInt (Math.max (1, Math.ceil (this.rmaxy - 0.001))), Clazz_doubleToInt (Math.max (1, Math.ceil (this.rmaxz - 0.001))));
}, "~A");
Clazz_defineMethod (c$, "setSymmetryMinMax",
function (c) {
if (this.rminx > c.x) this.rminx = c.x;
if (this.rminy > c.y) this.rminy = c.y;
if (this.rminz > c.z) this.rminz = c.z;
if (this.rmaxx < c.x) this.rmaxx = c.x;
if (this.rmaxy < c.y) this.rmaxy = c.y;
if (this.rmaxz < c.z) this.rmaxz = c.z;
}, "JU.P3");
Clazz_defineMethod (c$, "isWithinCell",
function (dtype, pt, minX, maxX, minY, maxY, minZ, maxZ, slop) {
return (pt.x > minX - slop && pt.x < maxX + slop && (dtype < 2 || pt.y > minY - slop && pt.y < maxY + slop) && (dtype < 3 || pt.z > minZ - slop && pt.z < maxZ + slop));
}, "~N,JU.P3,~N,~N,~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "applyAllSymmetry",
function (ms, bsAtoms) {
if (this.asc.ac == 0) return;
this.noSymmetryCount = (this.asc.baseSymmetryAtomCount == 0 ? this.asc.getLastAtomSetAtomCount () : this.asc.baseSymmetryAtomCount);
this.asc.setTensors ();
this.bondCount0 = this.asc.bondCount;
this.finalizeSymmetry (this.symmetry);
var operationCount = this.symmetry.getSpaceGroupOperationCount ();
this.dtype = Clazz_floatToInt (this.symmetry.getUnitCellInfoType (6));
this.symmetry.setMinMaxLatticeParameters (this.minXYZ, this.maxXYZ);
if (this.doCentroidUnitCell) this.asc.setInfo ("centroidMinMax", Clazz_newIntArray (-1, [this.minXYZ.x, this.minXYZ.y, this.minXYZ.z, this.maxXYZ.x, this.maxXYZ.y, this.maxXYZ.z, (this.centroidPacked ? 1 : 0)]));
if (this.ptSupercell != null) {
this.asc.setCurrentModelInfo ("supercell", this.ptSupercell);
switch (this.dtype) {
case 3:
this.minXYZ.z *= Clazz_floatToInt (Math.abs (this.ptSupercell.z));
this.maxXYZ.z *= Clazz_floatToInt (Math.abs (this.ptSupercell.z));
case 2:
this.minXYZ.y *= Clazz_floatToInt (Math.abs (this.ptSupercell.y));
this.maxXYZ.y *= Clazz_floatToInt (Math.abs (this.ptSupercell.y));
case 1:
this.minXYZ.x *= Clazz_floatToInt (Math.abs (this.ptSupercell.x));
this.maxXYZ.x *= Clazz_floatToInt (Math.abs (this.ptSupercell.x));
}
}if (this.doCentroidUnitCell || this.doPackUnitCell || this.symmetryRange != 0 && this.maxXYZ.x - this.minXYZ.x == 1 && this.maxXYZ.y - this.minXYZ.y == 1 && this.maxXYZ.z - this.minXYZ.z == 1) {
this.minXYZ0 = JU.P3.new3 (this.minXYZ.x, this.minXYZ.y, this.minXYZ.z);
this.maxXYZ0 = JU.P3.new3 (this.maxXYZ.x, this.maxXYZ.y, this.maxXYZ.z);
if (ms != null) {
ms.setMinMax0 (this.minXYZ0, this.maxXYZ0);
this.minXYZ.set (Clazz_floatToInt (this.minXYZ0.x), Clazz_floatToInt (this.minXYZ0.y), Clazz_floatToInt (this.minXYZ0.z));
this.maxXYZ.set (Clazz_floatToInt (this.maxXYZ0.x), Clazz_floatToInt (this.maxXYZ0.y), Clazz_floatToInt (this.maxXYZ0.z));
}switch (this.dtype) {
case 3:
this.minXYZ.z--;
this.maxXYZ.z++;
case 2:
this.minXYZ.y--;
this.maxXYZ.y++;
case 1:
this.minXYZ.x--;
this.maxXYZ.x++;
}
}var nCells = (this.maxXYZ.x - this.minXYZ.x) * (this.maxXYZ.y - this.minXYZ.y) * (this.maxXYZ.z - this.minXYZ.z);
var cartesianCount = (this.asc.checkSpecial ? this.noSymmetryCount * operationCount * nCells : this.symmetryRange > 0 ? this.noSymmetryCount * operationCount : this.symmetryRange < 0 ? 1 : 1);
var cartesians = new Array (cartesianCount);
for (var i = 0; i < this.noSymmetryCount; i++) this.asc.atoms[i + this.firstSymmetryAtom].bsSymmetry = JU.BS.newN (operationCount * (nCells + 1));
var pt = 0;
var unitCells = Clazz_newIntArray (nCells, 0);
this.unitCellTranslations = new Array (nCells);
var iCell = 0;
var cell555Count = 0;
var absRange = Math.abs (this.symmetryRange);
var checkCartesianRange = (this.symmetryRange != 0);
var checkRangeNoSymmetry = (this.symmetryRange < 0);
var checkRange111 = (this.symmetryRange > 0);
if (checkCartesianRange) {
this.rminx = this.rminy = this.rminz = 3.4028235E38;
this.rmaxx = this.rmaxy = this.rmaxz = -3.4028235E38;
}var symmetry = this.symmetry;
var lastSymmetry = symmetry;
this.latticeOp = symmetry.getLatticeOp ();
this.checkAll = (this.asc.atomSetCount == 1 && this.asc.checkSpecial && this.latticeOp >= 0);
this.latticeOnly = (this.asc.checkLatticeOnly && this.latticeOp >= 0);
var pttemp = null;
var op = symmetry.getSpaceGroupOperation (0);
if (this.doPackUnitCell) {
pttemp = new JU.P3 ();
this.ptOffset.set (0, 0, 0);
}for (var tx = this.minXYZ.x; tx < this.maxXYZ.x; tx++) for (var ty = this.minXYZ.y; ty < this.maxXYZ.y; ty++) for (var tz = this.minXYZ.z; tz < this.maxXYZ.z; tz++) {
this.unitCellTranslations[iCell] = JU.V3.new3 (tx, ty, tz);
unitCells[iCell++] = 555 + tx * 100 + ty * 10 + tz;
if (tx != 0 || ty != 0 || tz != 0 || cartesians.length == 0) continue;
for (pt = 0; pt < this.noSymmetryCount; pt++) {
var atom = this.asc.atoms[this.firstSymmetryAtom + pt];
if (ms != null) {
symmetry = ms.getAtomSymmetry (atom, this.symmetry);
if (symmetry !== lastSymmetry) {
if (symmetry.getSpaceGroupOperationCount () == 0) this.finalizeSymmetry (lastSymmetry = symmetry);
op = symmetry.getSpaceGroupOperation (0);
}}var c = JU.P3.newP (atom);
op.rotTrans (c);
symmetry.toCartesian (c, false);
if (this.doPackUnitCell) {
symmetry.toUnitCell (c, this.ptOffset);
pttemp.setT (c);
symmetry.toFractional (pttemp, false);
if (this.acr.fixJavaFloat) JU.PT.fixPtFloats (pttemp, 100000.0);
if (bsAtoms == null) atom.setT (pttemp);
else if (atom.distance (pttemp) < 0.0001) bsAtoms.set (atom.index);
else {
bsAtoms.clear (atom.index);
continue;
}}if (bsAtoms != null) atom.bsSymmetry.clearAll ();
atom.bsSymmetry.set (iCell * operationCount);
atom.bsSymmetry.set (0);
if (checkCartesianRange) this.setSymmetryMinMax (c);
if (pt < cartesianCount) cartesians[pt] = c;
}
if (checkRangeNoSymmetry) {
this.rminx -= absRange;
this.rminy -= absRange;
this.rminz -= absRange;
this.rmaxx += absRange;
this.rmaxy += absRange;
this.rmaxz += absRange;
}cell555Count = pt = this.symmetryAddAtoms (0, 0, 0, 0, pt, iCell * operationCount, cartesians, ms);
}
if (checkRange111) {
this.rminx -= absRange;
this.rminy -= absRange;
this.rminz -= absRange;
this.rmaxx += absRange;
this.rmaxy += absRange;
this.rmaxz += absRange;
}iCell = 0;
for (var tx = this.minXYZ.x; tx < this.maxXYZ.x; tx++) for (var ty = this.minXYZ.y; ty < this.maxXYZ.y; ty++) for (var tz = this.minXYZ.z; tz < this.maxXYZ.z; tz++) {
iCell++;
if (tx != 0 || ty != 0 || tz != 0) pt = this.symmetryAddAtoms (tx, ty, tz, cell555Count, pt, iCell * operationCount, cartesians, ms);
}
if (iCell * this.noSymmetryCount == this.asc.ac - this.firstSymmetryAtom) this.duplicateAtomProperties (iCell);
this.setSymmetryOps ();
this.asc.setCurrentModelInfo ("presymmetryAtomIndex", Integer.$valueOf (this.firstSymmetryAtom));
this.asc.setCurrentModelInfo ("presymmetryAtomCount", Integer.$valueOf (this.noSymmetryCount));
this.asc.setCurrentModelInfo ("latticeDesignation", symmetry.getLatticeDesignation ());
this.asc.setCurrentModelInfo ("unitCellRange", unitCells);
this.asc.setCurrentModelInfo ("unitCellTranslations", this.unitCellTranslations);
this.baseUnitCell = this.unitCellParams;
this.unitCellParams = Clazz_newFloatArray (6, 0);
this.reset ();
}, "J.adapter.smarter.MSInterface,JU.BS");
Clazz_defineMethod (c$, "symmetryAddAtoms",
function (transX, transY, transZ, baseCount, pt, iCellOpPt, cartesians, ms) {
var isBaseCell = (baseCount == 0);
var addBonds = (this.bondCount0 > this.asc.bondIndex0 && this.applySymmetryToBonds);
var atomMap = (addBonds ? Clazz_newIntArray (this.noSymmetryCount, 0) : null);
if (this.doPackUnitCell) this.ptOffset.set (transX, transY, transZ);
var range2 = this.symmetryRange * this.symmetryRange;
var checkRangeNoSymmetry = (this.symmetryRange < 0);
var checkRange111 = (this.symmetryRange > 0);
var checkSymmetryMinMax = (isBaseCell && checkRange111);
checkRange111 = new Boolean (checkRange111 & !isBaseCell).valueOf ();
var nOperations = this.symmetry.getSpaceGroupOperationCount ();
var checkSpecial = (nOperations == 1 && !this.doPackUnitCell ? false : this.asc.checkSpecial);
var checkSymmetryRange = (checkRangeNoSymmetry || checkRange111);
var checkDistances = (checkSpecial || checkSymmetryRange);
var addCartesian = (checkSpecial || checkSymmetryMinMax);
var symmetry = this.symmetry;
if (checkRangeNoSymmetry) baseCount = this.noSymmetryCount;
var atomMax = this.firstSymmetryAtom + this.noSymmetryCount;
var ptAtom = new JU.P3 ();
var code = null;
var subSystemId = '\u0000';
for (var iSym = 0; iSym < nOperations; iSym++) {
if (isBaseCell && iSym == 0 || this.latticeOnly && iSym > 0 && iSym != this.latticeOp) continue;
var pt0 = (checkSpecial ? pt : checkRange111 ? baseCount : 0);
var spinOp = (this.asc.vibScale == 0 ? symmetry.getSpinOp (iSym) : this.asc.vibScale);
for (var i = this.firstSymmetryAtom; i < atomMax; i++) {
var a = this.asc.atoms[i];
if (a.ignoreSymmetry) continue;
if (this.asc.bsAtoms != null && !this.asc.bsAtoms.get (i)) continue;
if (ms == null) {
symmetry.newSpaceGroupPoint (iSym, a, ptAtom, transX, transY, transZ);
} else {
symmetry = ms.getAtomSymmetry (a, this.symmetry);
symmetry.newSpaceGroupPoint (iSym, a, ptAtom, transX, transY, transZ);
code = symmetry.getSpaceGroupOperationCode (iSym);
if (code != null) {
subSystemId = code.charAt (0);
symmetry = ms.getSymmetryFromCode (code);
if (symmetry.getSpaceGroupOperationCount () == 0) this.finalizeSymmetry (symmetry);
}}if (this.acr.fixJavaFloat) JU.PT.fixPtFloats (ptAtom, 100000.0);
var c = JU.P3.newP (ptAtom);
symmetry.toCartesian (c, false);
if (this.doPackUnitCell) {
symmetry.toUnitCell (c, this.ptOffset);
ptAtom.setT (c);
symmetry.toFractional (ptAtom, false);
if (this.acr.fixJavaFloat) JU.PT.fixPtFloats (ptAtom, 100000.0);
if (!this.isWithinCell (this.dtype, ptAtom, this.minXYZ0.x, this.maxXYZ0.x, this.minXYZ0.y, this.maxXYZ0.y, this.minXYZ0.z, this.maxXYZ0.z, this.packingError)) continue;
}if (checkSymmetryMinMax) this.setSymmetryMinMax (c);
var special = null;
if (checkDistances) {
var minDist2 = 3.4028235E38;
if (checkSymmetryRange && (c.x < this.rminx || c.y < this.rminy || c.z < this.rminz || c.x > this.rmaxx || c.y > this.rmaxy || c.z > this.rmaxz)) continue;
var j0 = (this.checkAll ? this.asc.ac : pt0);
var name = a.atomName;
var id = (code == null ? a.altLoc : subSystemId);
for (var j = j0; --j >= 0; ) {
var pc = cartesians[j];
if (pc == null) continue;
var d2 = c.distanceSquared (pc);
if (checkSpecial && d2 < 0.0001) {
special = this.asc.atoms[this.firstSymmetryAtom + j];
if ((special.atomName == null || special.atomName.equals (name)) && special.altLoc == id) break;
special = null;
}if (checkRange111 && j < baseCount && d2 < minDist2) minDist2 = d2;
}
if (checkRange111 && minDist2 > range2) continue;
}var atomSite = a.atomSite;
if (special != null) {
if (addBonds) atomMap[atomSite] = special.index;
special.bsSymmetry.set (iCellOpPt + iSym);
special.bsSymmetry.set (iSym);
} else {
if (addBonds) atomMap[atomSite] = this.asc.ac;
var atom1 = this.asc.newCloneAtom (a);
if (this.asc.bsAtoms != null) this.asc.bsAtoms.set (atom1.index);
atom1.setT (ptAtom);
if (spinOp != 0 && atom1.vib != null) {
symmetry.getSpaceGroupOperation (iSym).rotate (atom1.vib);
atom1.vib.scale (spinOp);
}atom1.atomSite = atomSite;
if (code != null) atom1.altLoc = subSystemId;
atom1.bsSymmetry = JU.BSUtil.newAndSetBit (iCellOpPt + iSym);
atom1.bsSymmetry.set (iSym);
if (addCartesian) cartesians[pt++] = c;
var tensors = a.tensors;
if (tensors != null) {
atom1.tensors = null;
for (var j = tensors.size (); --j >= 0; ) {
var t = tensors.get (j);
if (t == null) continue;
if (nOperations == 1) atom1.addTensor (t.copyTensor (), null, false);
else this.addRotatedTensor (atom1, t, iSym, false, symmetry);
}
}}}
if (addBonds) {
var bonds = this.asc.bonds;
var atoms = this.asc.atoms;
for (var bondNum = this.asc.bondIndex0; bondNum < this.bondCount0; bondNum++) {
var bond = bonds[bondNum];
var atom1 = atoms[bond.atomIndex1];
var atom2 = atoms[bond.atomIndex2];
if (atom1 == null || atom2 == null) continue;
var iAtom1 = atomMap[atom1.atomSite];
var iAtom2 = atomMap[atom2.atomSite];
if (iAtom1 >= atomMax || iAtom2 >= atomMax) this.asc.addNewBondWithOrder (iAtom1, iAtom2, bond.order);
}
}}
return pt;
}, "~N,~N,~N,~N,~N,~N,~A,J.adapter.smarter.MSInterface");
Clazz_defineMethod (c$, "duplicateAtomProperties",
function (nTimes) {
var p = this.asc.getAtomSetAuxiliaryInfoValue (-1, "atomProperties");
if (p != null) for (var entry, $entry = p.entrySet ().iterator (); $entry.hasNext () && ((entry = $entry.next ()) || true);) {
var key = entry.getKey ();
var val = entry.getValue ();
if (Clazz_instanceOf (val, String)) {
var data = val;
var s = new JU.SB ();
for (var i = nTimes; --i >= 0; ) s.append (data);
p.put (key, s.toString ());
} else {
var f = val;
var fnew = Clazz_newFloatArray (f.length * nTimes, 0);
for (var i = nTimes; --i >= 0; ) System.arraycopy (f, 0, fnew, i * f.length, f.length);
}}
}, "~N");
Clazz_defineMethod (c$, "finalizeSymmetry",
function (symmetry) {
var name = this.asc.getAtomSetAuxiliaryInfoValue (-1, "spaceGroup");
symmetry.setFinalOperations (name, this.asc.atoms, this.firstSymmetryAtom, this.noSymmetryCount, this.doNormalize, this.filterSymop);
if (this.filterSymop != null || name == null || name.equals ("unspecified!")) this.setAtomSetSpaceGroupName (symmetry.getSpaceGroupName ());
}, "J.api.SymmetryInterface");
Clazz_defineMethod (c$, "setSymmetryOps",
function () {
var operationCount = this.symmetry.getSpaceGroupOperationCount ();
if (operationCount > 0) {
var symmetryList = new Array (operationCount);
for (var i = 0; i < operationCount; i++) symmetryList[i] = "" + this.symmetry.getSpaceGroupXyz (i, this.doNormalize);
this.asc.setCurrentModelInfo ("symmetryOperations", symmetryList);
this.asc.setCurrentModelInfo ("symmetryOps", this.symmetry.getSymmetryOperations ());
}this.asc.setCurrentModelInfo ("symmetryCount", Integer.$valueOf (operationCount));
});
Clazz_defineMethod (c$, "getOverallSpan",
function () {
return (this.maxXYZ0 == null ? JU.V3.new3 (this.maxXYZ.x - this.minXYZ.x, this.maxXYZ.y - this.minXYZ.y, this.maxXYZ.z - this.minXYZ.z) : JU.V3.newVsub (this.maxXYZ0, this.minXYZ0));
});
Clazz_defineMethod (c$, "applySymmetryBio",
function (thisBiomolecule, unitCellParams, applySymmetryToBonds, filter) {
if (this.latticeCells != null && this.latticeCells[0] != 0) {
JU.Logger.error ("Cannot apply biomolecule when lattice cells are indicated");
return;
}var particleMode = (filter.indexOf ("BYCHAIN") >= 0 ? 1 : filter.indexOf ("BYSYMOP") >= 0 ? 2 : 0);
this.doNormalize = false;
var biomts = thisBiomolecule.get ("biomts");
var biomtchains = thisBiomolecule.get ("chains");
if (biomts.size () < 2) return;
if (biomtchains.get (0).equals (biomtchains.get (1))) biomtchains = null;
this.symmetry = null;
if (!Float.isNaN (unitCellParams[0])) this.setUnitCell (unitCellParams, null, this.unitCellOffset);
this.getSymmetry ().setSpaceGroup (this.doNormalize);
this.addSpaceGroupOperation ("x,y,z", false);
var name = thisBiomolecule.get ("name");
this.setAtomSetSpaceGroupName (this.acr.sgName = name);
var len = biomts.size ();
this.applySymmetryToBonds = applySymmetryToBonds;
this.bondCount0 = this.asc.bondCount;
var addBonds = (this.bondCount0 > this.asc.bondIndex0 && applySymmetryToBonds);
var atomMap = (addBonds ? Clazz_newIntArray (this.asc.ac, 0) : null);
this.firstSymmetryAtom = this.asc.getLastAtomSetAtomIndex ();
var atomMax = this.asc.ac;
var ht = new java.util.Hashtable ();
var nChain = 0;
var atoms = this.asc.atoms;
switch (particleMode) {
case 1:
for (var i = atomMax; --i >= this.firstSymmetryAtom; ) {
var id = Integer.$valueOf (atoms[i].chainID);
var bs = ht.get (id);
if (bs == null) {
nChain++;
ht.put (id, bs = new JU.BS ());
}bs.set (i);
}
this.asc.bsAtoms = new JU.BS ();
for (var i = 0; i < nChain; i++) {
this.asc.bsAtoms.set (atomMax + i);
var a = new J.adapter.smarter.Atom ();
a.set (0, 0, 0);
a.radius = 16;
this.asc.addAtom (a);
}
var ichain = 0;
for (var e, $e = ht.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) {
var a = atoms[atomMax + ichain++];
var bs = e.getValue ();
for (var i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1)) a.add (atoms[i]);
a.scale (1 / bs.cardinality ());
a.atomName = "Pt" + ichain;
a.chainID = e.getKey ().intValue ();
}
this.firstSymmetryAtom = atomMax;
atomMax += nChain;
break;
case 2:
this.asc.bsAtoms = new JU.BS ();
this.asc.bsAtoms.set (atomMax);
var a = atoms[atomMax] = new J.adapter.smarter.Atom ();
a.set (0, 0, 0);
for (var i = atomMax; --i >= this.firstSymmetryAtom; ) a.add (atoms[i]);
a.scale (1 / (atomMax - this.firstSymmetryAtom));
a.atomName = "Pt";
a.radius = 16;
this.asc.addAtom (a);
this.firstSymmetryAtom = atomMax++;
break;
}
if (filter.indexOf ("#<") >= 0) {
len = Math.min (len, JU.PT.parseInt (filter.substring (filter.indexOf ("#<") + 2)) - 1);
filter = JU.PT.rep (filter, "#<", "_<");
}for (var iAtom = this.firstSymmetryAtom; iAtom < atomMax; iAtom++) atoms[iAtom].bsSymmetry = JU.BSUtil.newAndSetBit (0);
for (var i = (biomtchains == null ? 1 : 0); i < len; i++) {
if (filter.indexOf ("!#") >= 0) {
if (filter.indexOf ("!#" + (i + 1) + ";") >= 0) continue;
} else if (filter.indexOf ("#") >= 0 && filter.indexOf ("#" + (i + 1) + ";") < 0) {
continue;
}var mat = biomts.get (i);
var chains = (biomtchains == null ? null : biomtchains.get (i));
for (var iAtom = this.firstSymmetryAtom; iAtom < atomMax; iAtom++) {
if (this.asc.bsAtoms != null && !this.asc.bsAtoms.get (iAtom)) continue;
if (chains != null && chains.indexOf (":" + this.acr.vwr.getChainIDStr (atoms[iAtom].chainID) + ";") < 0) continue;
try {
var atomSite = atoms[iAtom].atomSite;
var atom1;
if (addBonds) atomMap[atomSite] = this.asc.ac;
atom1 = this.asc.newCloneAtom (atoms[iAtom]);
if (this.asc.bsAtoms != null) this.asc.bsAtoms.set (atom1.index);
atom1.atomSite = atomSite;
mat.rotTrans (atom1);
atom1.bsSymmetry = JU.BSUtil.newAndSetBit (i);
if (addBonds) {
for (var bondNum = this.asc.bondIndex0; bondNum < this.bondCount0; bondNum++) {
var bond = this.asc.bonds[bondNum];
var iAtom1 = atomMap[atoms[bond.atomIndex1].atomSite];
var iAtom2 = atomMap[atoms[bond.atomIndex2].atomSite];
if (iAtom1 >= atomMax || iAtom2 >= atomMax) this.asc.addNewBondWithOrder (iAtom1, iAtom2, bond.order);
}
}} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
this.asc.errorMessage = "appendAtomCollection error: " + e;
} else {
throw e;
}
}
}
if (i > 0) this.symmetry.addBioMoleculeOperation (mat, false);
}
if (biomtchains != null) {
if (this.asc.bsAtoms == null) this.asc.bsAtoms = JU.BSUtil.newBitSet2 (0, this.asc.ac);
for (var iAtom = this.firstSymmetryAtom; iAtom < atomMax; iAtom++) this.asc.bsAtoms.clear (iAtom);
}this.noSymmetryCount = atomMax - this.firstSymmetryAtom;
this.asc.setCurrentModelInfo ("presymmetryAtomIndex", Integer.$valueOf (this.firstSymmetryAtom));
this.asc.setCurrentModelInfo ("presymmetryAtomCount", Integer.$valueOf (this.noSymmetryCount));
this.asc.setCurrentModelInfo ("biosymmetryCount", Integer.$valueOf (len));
this.asc.setCurrentModelInfo ("biosymmetry", this.symmetry);
this.finalizeSymmetry (this.symmetry);
this.setSymmetryOps ();
this.reset ();
}, "java.util.Map,~A,~B,~S");
Clazz_defineMethod (c$, "reset",
function () {
this.asc.coordinatesAreFractional = false;
this.asc.setCurrentModelInfo ("hasSymmetry", Boolean.TRUE);
this.asc.setGlobalBoolean (1);
});
Clazz_defineMethod (c$, "addRotatedTensor",
function (a, t, iSym, reset, symmetry) {
if (this.ptTemp == null) {
this.ptTemp = new JU.P3 ();
this.mTemp = new JU.M3 ();
}return a.addTensor ((this.acr.getInterface ("JU.Tensor")).setFromEigenVectors (symmetry.rotateAxes (iSym, t.eigenVectors, this.ptTemp, this.mTemp), t.eigenValues, t.isIsotropic ? "iso" : t.type, t.id, t), null, reset);
}, "J.adapter.smarter.Atom,JU.Tensor,~N,~B,J.api.SymmetryInterface");
Clazz_defineMethod (c$, "setTensors",
function () {
var n = this.asc.ac;
for (var i = this.asc.getLastAtomSetAtomIndex (); i < n; i++) {
var a = this.asc.atoms[i];
if (a.anisoBorU == null) continue;
a.addTensor (this.symmetry.getTensor (this.acr.vwr, a.anisoBorU), null, false);
if (Float.isNaN (a.bfactor)) a.bfactor = a.anisoBorU[7] * 100;
a.anisoBorU = null;
}
});
Clazz_defineMethod (c$, "setTimeReversal",
function (op, timeRev) {
this.symmetry.setTimeReversal (op, timeRev);
}, "~N,~N");
Clazz_defineMethod (c$, "rotateToSuperCell",
function (t) {
if (this.matSupercell != null) this.matSupercell.rotTrans (t);
}, "JU.V3");
Clazz_defineMethod (c$, "setSpinVectors",
function () {
if (this.nVib > 0 || this.asc.iSet < 0 || !this.acr.vibsFractional) return this.nVib;
var i0 = this.asc.getAtomSetAtomIndex (this.asc.iSet);
var sym = this.getBaseSymmetry ();
for (var i = this.asc.ac; --i >= i0; ) {
var v = this.asc.atoms[i].vib;
if (v != null) {
if (v.modDim > 0) {
(v).setMoment ();
} else {
v = v.clone ();
sym.toCartesian (v, true);
this.asc.atoms[i].vib = v;
}this.nVib++;
}}
return this.nVib;
});
Clazz_defineMethod (c$, "scaleFractionalVibs",
function () {
var params = this.getBaseSymmetry ().getUnitCellParams ();
var ptScale = JU.P3.new3 (1 / params[0], 1 / params[1], 1 / params[2]);
var i0 = this.asc.getAtomSetAtomIndex (this.asc.iSet);
for (var i = this.asc.ac; --i >= i0; ) {
var v = this.asc.atoms[i].vib;
if (v != null) {
v.scaleT (ptScale);
}}
});
Clazz_defineMethod (c$, "getBaseSymmetry",
function () {
return (this.baseSymmetry == null ? this.symmetry : this.baseSymmetry);
});
Clazz_defineMethod (c$, "finalizeUnitCell",
function (ptSupercell) {
if (ptSupercell != null && this.baseUnitCell != null) {
this.baseUnitCell[22] = Math.max (1, Clazz_floatToInt (ptSupercell.x));
this.baseUnitCell[23] = Math.max (1, Clazz_floatToInt (ptSupercell.y));
this.baseUnitCell[24] = Math.max (1, Clazz_floatToInt (ptSupercell.z));
}}, "JU.P3");
Clazz_defineStatics (c$,
"PARTICLE_NONE", 0,
"PARTICLE_CHAIN", 1,
"PARTICLE_SYMOP", 2);
});
Clazz_declarePackage ("J.api");
Clazz_declareInterface (J.api, "SymmetryInterface");
Clazz_declarePackage ("JS");
Clazz_load (["J.api.SymmetryInterface"], "JS.Symmetry", ["JU.BS", "$.Lst", "$.M3", "$.M4", "$.P3", "$.V3", "J.api.Interface", "JS.PointGroup", "$.SpaceGroup", "$.SymmetryInfo", "$.SymmetryOperation", "$.UnitCell", "JU.Escape", "$.Logger", "$.SimpleUnitCell"], function () {
c$ = Clazz_decorateAsClass (function () {
this.pointGroup = null;
this.spaceGroup = null;
this.symmetryInfo = null;
this.unitCell = null;
this.$isBio = false;
this.desc = null;
Clazz_instantialize (this, arguments);
}, JS, "Symmetry", null, J.api.SymmetryInterface);
Clazz_overrideMethod (c$, "isBio",
function () {
return this.$isBio;
});
Clazz_makeConstructor (c$,
function () {
});
Clazz_overrideMethod (c$, "setPointGroup",
function (siLast, center, atomset, bsAtoms, haveVibration, distanceTolerance, linearTolerance, localEnvOnly) {
this.pointGroup = JS.PointGroup.getPointGroup (siLast == null ? null : (siLast).pointGroup, center, atomset, bsAtoms, haveVibration, distanceTolerance, linearTolerance, localEnvOnly);
return this;
}, "J.api.SymmetryInterface,JU.T3,~A,JU.BS,~B,~N,~N,~B");
Clazz_overrideMethod (c$, "getPointGroupName",
function () {
return this.pointGroup.getName ();
});
Clazz_overrideMethod (c$, "getPointGroupInfo",
function (modelIndex, asDraw, asInfo, type, index, scale) {
if (!asDraw && !asInfo && this.pointGroup.textInfo != null) return this.pointGroup.textInfo;
else if (asDraw && this.pointGroup.isDrawType (type, index, scale)) return this.pointGroup.drawInfo;
else if (asInfo && this.pointGroup.info != null) return this.pointGroup.info;
return this.pointGroup.getInfo (modelIndex, asDraw, asInfo, type, index, scale);
}, "~N,~B,~B,~S,~N,~N");
Clazz_overrideMethod (c$, "setSpaceGroup",
function (doNormalize) {
if (this.spaceGroup == null) this.spaceGroup = JS.SpaceGroup.getNull (true, doNormalize, false);
}, "~B");
Clazz_overrideMethod (c$, "addSpaceGroupOperation",
function (xyz, opId) {
return this.spaceGroup.addSymmetry (xyz, opId, false);
}, "~S,~N");
Clazz_overrideMethod (c$, "addBioMoleculeOperation",
function (mat, isReverse) {
this.$isBio = this.spaceGroup.isBio = true;
return this.spaceGroup.addSymmetry ((isReverse ? "!" : "") + "[[bio" + mat, 0, false);
}, "JU.M4,~B");
Clazz_overrideMethod (c$, "setLattice",
function (latt) {
this.spaceGroup.setLatticeParam (latt);
}, "~N");
Clazz_defineMethod (c$, "getSpaceGroup",
function () {
return this.spaceGroup;
});
Clazz_overrideMethod (c$, "setSpaceGroupFrom",
function (symmetry) {
this.spaceGroup = symmetry.getSpaceGroup ();
}, "J.api.SymmetryInterface");
Clazz_overrideMethod (c$, "createSpaceGroup",
function (desiredSpaceGroupIndex, name, data) {
this.spaceGroup = JS.SpaceGroup.createSpaceGroup (desiredSpaceGroupIndex, name, data);
if (this.spaceGroup != null && JU.Logger.debugging) JU.Logger.debug ("using generated space group " + this.spaceGroup.dumpInfo (null));
return this.spaceGroup != null;
}, "~N,~S,~O");
Clazz_overrideMethod (c$, "getSpaceGroupInfoStr",
function (name, cellInfo) {
return JS.SpaceGroup.getInfo (name, cellInfo);
}, "~S,J.api.SymmetryInterface");
Clazz_overrideMethod (c$, "getLatticeDesignation",
function () {
return this.spaceGroup.getLatticeDesignation ();
});
Clazz_overrideMethod (c$, "setFinalOperations",
function (name, atoms, iAtomFirst, noSymmetryCount, doNormalize, filterSymop) {
if (name != null && (name.startsWith ("bio") || name.indexOf (" *(") >= 0)) this.spaceGroup.name = name;
if (filterSymop != null) {
var lst = new JU.Lst ();
lst.addLast (this.spaceGroup.operations[0]);
for (var i = 1; i < this.spaceGroup.operationCount; i++) if (filterSymop.contains (" " + (i + 1) + " ")) lst.addLast (this.spaceGroup.operations[i]);
this.spaceGroup = JS.SpaceGroup.createSpaceGroup (-1, name + " *(" + filterSymop.trim () + ")", lst);
}this.spaceGroup.setFinalOperations (atoms, iAtomFirst, noSymmetryCount, doNormalize);
}, "~S,~A,~N,~N,~B,~S");
Clazz_overrideMethod (c$, "getSpaceGroupOperation",
function (i) {
return (i >= this.spaceGroup.operations.length ? null : this.spaceGroup.finalOperations == null ? this.spaceGroup.operations[i] : this.spaceGroup.finalOperations[i]);
}, "~N");
Clazz_overrideMethod (c$, "getSpaceGroupXyz",
function (i, doNormalize) {
return this.spaceGroup.getXyz (i, doNormalize);
}, "~N,~B");
Clazz_overrideMethod (c$, "newSpaceGroupPoint",
function (i, atom1, atom2, transX, transY, transZ) {
if (this.spaceGroup.finalOperations == null) {
if (!this.spaceGroup.operations[i].isFinalized) this.spaceGroup.operations[i].doFinalize ();
this.spaceGroup.operations[i].newPoint (atom1, atom2, transX, transY, transZ);
return;
}this.spaceGroup.finalOperations[i].newPoint (atom1, atom2, transX, transY, transZ);
}, "~N,JU.P3,JU.P3,~N,~N,~N");
Clazz_overrideMethod (c$, "rotateAxes",
function (iop, axes, ptTemp, mTemp) {
return (iop == 0 ? axes : this.spaceGroup.finalOperations[iop].rotateAxes (axes, this.unitCell, ptTemp, mTemp));
}, "~N,~A,JU.P3,JU.M3");
Clazz_overrideMethod (c$, "getSpaceGroupOperationCode",
function (iOp) {
return this.spaceGroup.operations[iOp].subsystemCode;
}, "~N");
Clazz_overrideMethod (c$, "setTimeReversal",
function (op, val) {
this.spaceGroup.operations[op].setTimeReversal (val);
}, "~N,~N");
Clazz_overrideMethod (c$, "getSpinOp",
function (op) {
return this.spaceGroup.operations[op].getSpinOp ();
}, "~N");
Clazz_overrideMethod (c$, "addLatticeVectors",
function (lattvecs) {
return this.spaceGroup.addLatticeVectors (lattvecs);
}, "JU.Lst");
Clazz_overrideMethod (c$, "getLatticeOp",
function () {
return this.spaceGroup.latticeOp;
});
Clazz_overrideMethod (c$, "getOperationRsVs",
function (iop) {
return (this.spaceGroup.finalOperations == null ? this.spaceGroup.operations : this.spaceGroup.finalOperations)[iop].rsvs;
}, "~N");
Clazz_overrideMethod (c$, "getSiteMultiplicity",
function (pt) {
return this.spaceGroup.getSiteMultiplicity (pt, this.unitCell);
}, "JU.P3");
Clazz_overrideMethod (c$, "addOp",
function (code, rs, vs, sigma) {
this.spaceGroup.isSSG = true;
var s = JS.SymmetryOperation.getXYZFromRsVs (rs, vs, false);
var i = this.spaceGroup.addSymmetry (s, -1, true);
this.spaceGroup.operations[i].setSigma (code, sigma);
return s;
}, "~S,JU.Matrix,JU.Matrix,JU.Matrix");
Clazz_overrideMethod (c$, "getMatrixFromString",
function (xyz, rotTransMatrix, allowScaling, modDim) {
return JS.SymmetryOperation.getMatrixFromString (null, xyz, rotTransMatrix, allowScaling);
}, "~S,~A,~B,~N");
Clazz_overrideMethod (c$, "getSpaceGroupName",
function () {
return (this.symmetryInfo != null ? this.symmetryInfo.sgName : this.spaceGroup != null ? this.spaceGroup.getName () : this.unitCell != null && this.unitCell.name.length > 0 ? "cell=" + this.unitCell.name : "");
});
Clazz_overrideMethod (c$, "getSpaceGroupOperationCount",
function () {
return (this.symmetryInfo != null ? this.symmetryInfo.symmetryOperations.length : this.spaceGroup != null && this.spaceGroup.finalOperations != null ? this.spaceGroup.finalOperations.length : 0);
});
Clazz_overrideMethod (c$, "getCoordinatesAreFractional",
function () {
return this.symmetryInfo == null || this.symmetryInfo.coordinatesAreFractional;
});
Clazz_overrideMethod (c$, "getCellRange",
function () {
return this.symmetryInfo == null ? null : this.symmetryInfo.cellRange;
});
Clazz_overrideMethod (c$, "getSymmetryInfoStr",
function () {
return (this.symmetryInfo == null ? "" : this.symmetryInfo.infoStr);
});
Clazz_overrideMethod (c$, "getSymmetryOperations",
function () {
if (this.symmetryInfo != null) return this.symmetryInfo.symmetryOperations;
if (this.spaceGroup == null) this.spaceGroup = JS.SpaceGroup.getNull (true, false, true);
return this.spaceGroup.finalOperations;
});
Clazz_overrideMethod (c$, "isPeriodic",
function () {
return (this.symmetryInfo == null ? false : this.symmetryInfo.isPeriodic ());
});
Clazz_overrideMethod (c$, "setSymmetryInfo",
function (modelIndex, modelAuxiliaryInfo, unitCellParams) {
this.symmetryInfo = new JS.SymmetryInfo ();
var params = this.symmetryInfo.setSymmetryInfo (modelAuxiliaryInfo, unitCellParams);
if (params == null) return;
this.setUnitCell (params, modelAuxiliaryInfo.containsKey ("jmolData"));
this.unitCell.moreInfo = modelAuxiliaryInfo.get ("moreUnitCellInfo");
modelAuxiliaryInfo.put ("infoUnitCell", this.getUnitCellAsArray (false));
this.setOffsetPt (modelAuxiliaryInfo.get ("unitCellOffset"));
var matUnitCellOrientation = modelAuxiliaryInfo.get ("matUnitCellOrientation");
if (matUnitCellOrientation != null) this.initializeOrientation (matUnitCellOrientation);
if (JU.Logger.debugging) JU.Logger.debug ("symmetryInfos[" + modelIndex + "]:\n" + this.unitCell.dumpInfo (true));
}, "~N,java.util.Map,~A");
Clazz_overrideMethod (c$, "haveUnitCell",
function () {
return (this.unitCell != null);
});
Clazz_overrideMethod (c$, "checkUnitCell",
function (uc, cell, ptTemp, isAbsolute) {
uc.toFractional (ptTemp, isAbsolute);
var slop = 0.02;
return (ptTemp.x >= cell.x - 1 - slop && ptTemp.x <= cell.x + slop && ptTemp.y >= cell.y - 1 - slop && ptTemp.y <= cell.y + slop && ptTemp.z >= cell.z - 1 - slop && ptTemp.z <= cell.z + slop);
}, "J.api.SymmetryInterface,JU.P3,JU.P3,~B");
Clazz_overrideMethod (c$, "setUnitCell",
function (unitCellParams, setRelative) {
this.unitCell = JS.UnitCell.newA (unitCellParams, setRelative);
}, "~A,~B");
Clazz_overrideMethod (c$, "unitCellEquals",
function (uc2) {
return ((uc2)).unitCell.isSameAs (this.unitCell);
}, "J.api.SymmetryInterface");
Clazz_overrideMethod (c$, "getUnitCellState",
function () {
return (this.unitCell == null ? "" : this.unitCell.getState ());
});
Clazz_overrideMethod (c$, "getMoreInfo",
function () {
return this.unitCell.moreInfo;
});
Clazz_defineMethod (c$, "getUnitsymmetryInfo",
function () {
return this.unitCell.dumpInfo (false);
});
Clazz_overrideMethod (c$, "initializeOrientation",
function (mat) {
this.unitCell.initOrientation (mat);
}, "JU.M3");
Clazz_overrideMethod (c$, "unitize",
function (ptFrac) {
this.unitCell.unitize (ptFrac);
}, "JU.P3");
Clazz_overrideMethod (c$, "toUnitCell",
function (pt, offset) {
this.unitCell.toUnitCell (pt, offset);
}, "JU.P3,JU.P3");
Clazz_overrideMethod (c$, "toSupercell",
function (fpt) {
return this.unitCell.toSupercell (fpt);
}, "JU.P3");
Clazz_defineMethod (c$, "toFractional",
function (pt, isAbsolute) {
if (!this.$isBio) this.unitCell.toFractional (pt, isAbsolute);
}, "JU.T3,~B");
Clazz_overrideMethod (c$, "toCartesian",
function (fpt, ignoreOffset) {
if (!this.$isBio) this.unitCell.toCartesian (fpt, ignoreOffset);
}, "JU.T3,~B");
Clazz_overrideMethod (c$, "getUnitCellParams",
function () {
return this.unitCell.getUnitCellParams ();
});
Clazz_overrideMethod (c$, "getUnitCellAsArray",
function (vectorsOnly) {
return this.unitCell.getUnitCellAsArray (vectorsOnly);
}, "~B");
Clazz_overrideMethod (c$, "getTensor",
function (vwr, parBorU) {
if (parBorU == null) return null;
if (this.unitCell == null) this.unitCell = JS.UnitCell.newA ( Clazz_newFloatArray (-1, [1, 1, 1, 90, 90, 90]), true);
return this.unitCell.getTensor (vwr, parBorU);
}, "JV.Viewer,~A");
Clazz_overrideMethod (c$, "getUnitCellVerticesNoOffset",
function () {
return this.unitCell.getVertices ();
});
Clazz_overrideMethod (c$, "getCartesianOffset",
function () {
return this.unitCell.getCartesianOffset ();
});
Clazz_overrideMethod (c$, "getFractionalOffset",
function () {
return this.unitCell.getFractionalOffset ();
});
Clazz_overrideMethod (c$, "setOffsetPt",
function (pt) {
this.unitCell.setOffset (pt);
}, "JU.T3");
Clazz_overrideMethod (c$, "setOffset",
function (nnn) {
var pt = new JU.P3 ();
JU.SimpleUnitCell.ijkToPoint3f (nnn, pt, 0);
this.unitCell.setOffset (pt);
}, "~N");
Clazz_overrideMethod (c$, "getUnitCellMultiplier",
function () {
return this.unitCell.getUnitCellMultiplier ();
});
Clazz_overrideMethod (c$, "getCanonicalCopy",
function (scale, withOffset) {
return this.unitCell.getCanonicalCopy (scale, withOffset);
}, "~N,~B");
Clazz_overrideMethod (c$, "getUnitCellInfoType",
function (infoType) {
return this.unitCell.getInfo (infoType);
}, "~N");
Clazz_overrideMethod (c$, "getUnitCellInfo",
function () {
return this.unitCell.dumpInfo (false);
});
Clazz_overrideMethod (c$, "isSlab",
function () {
return this.unitCell.isSlab ();
});
Clazz_overrideMethod (c$, "isPolymer",
function () {
return this.unitCell.isPolymer ();
});
Clazz_overrideMethod (c$, "setMinMaxLatticeParameters",
function (minXYZ, maxXYZ) {
this.unitCell.setMinMaxLatticeParameters (minXYZ, maxXYZ);
}, "JU.P3i,JU.P3i");
Clazz_overrideMethod (c$, "checkDistance",
function (f1, f2, distance, dx, iRange, jRange, kRange, ptOffset) {
return this.unitCell.checkDistance (f1, f2, distance, dx, iRange, jRange, kRange, ptOffset);
}, "JU.P3,JU.P3,~N,~N,~N,~N,~N,JU.P3");
Clazz_overrideMethod (c$, "getUnitCellVectors",
function () {
return this.unitCell.getUnitCellVectors ();
});
Clazz_overrideMethod (c$, "getUnitCell",
function (points, setRelative, name) {
this.unitCell = JS.UnitCell.newP (points, setRelative);
if (name != null) this.unitCell.name = name;
return this;
}, "~A,~B,~S");
Clazz_overrideMethod (c$, "isSupercell",
function () {
return this.unitCell.isSupercell ();
});
Clazz_overrideMethod (c$, "notInCentroid",
function (modelSet, bsAtoms, minmax) {
try {
var bsDelete = new JU.BS ();
var iAtom0 = bsAtoms.nextSetBit (0);
var molecules = modelSet.getMolecules ();
var moleculeCount = molecules.length;
var atoms = modelSet.at;
var isOneMolecule = (molecules[moleculeCount - 1].firstAtomIndex == modelSet.am[atoms[iAtom0].mi].firstAtomIndex);
var center = new JU.P3 ();
var centroidPacked = (minmax[6] == 1);
nextMol : for (var i = moleculeCount; --i >= 0 && bsAtoms.get (molecules[i].firstAtomIndex); ) {
var bs = molecules[i].atomList;
center.set (0, 0, 0);
var n = 0;
for (var j = bs.nextSetBit (0); j >= 0; j = bs.nextSetBit (j + 1)) {
if (isOneMolecule || centroidPacked) {
center.setT (atoms[j]);
if (this.isNotCentroid (center, 1, minmax, centroidPacked)) {
if (isOneMolecule) bsDelete.set (j);
} else if (!isOneMolecule) {
continue nextMol;
}} else {
center.add (atoms[j]);
n++;
}}
if (centroidPacked || n > 0 && this.isNotCentroid (center, n, minmax, false)) bsDelete.or (bs);
}
return bsDelete;
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
return null;
} else {
throw e;
}
}
}, "JM.ModelSet,JU.BS,~A");
Clazz_defineMethod (c$, "isNotCentroid",
function (center, n, minmax, centroidPacked) {
center.scale (1 / n);
this.toFractional (center, false);
if (centroidPacked) return (center.x + 0.000005 <= minmax[0] || center.x - 0.000005 > minmax[3] || center.y + 0.000005 <= minmax[1] || center.y - 0.000005 > minmax[4] || center.z + 0.000005 <= minmax[2] || center.z - 0.000005 > minmax[5]);
return (center.x + 0.000005 <= minmax[0] || center.x + 0.00005 > minmax[3] || center.y + 0.000005 <= minmax[1] || center.y + 0.00005 > minmax[4] || center.z + 0.000005 <= minmax[2] || center.z + 0.00005 > minmax[5]);
}, "JU.P3,~N,~A,~B");
Clazz_defineMethod (c$, "getDesc",
function (modelSet) {
return (this.desc == null ? (this.desc = (J.api.Interface.getInterface ("JS.SymmetryDesc", modelSet.vwr, "eval"))) : this.desc);
}, "JM.ModelSet");
Clazz_overrideMethod (c$, "getSymmetryInfoAtom",
function (modelSet, bsAtoms, xyz, op, pt, pt2, id, type) {
return this.getDesc (modelSet).getSymmetryInfoAtom (bsAtoms, xyz, op, pt, pt2, id, type, modelSet);
}, "JM.ModelSet,JU.BS,~S,~N,JU.P3,JU.P3,~S,~N");
Clazz_overrideMethod (c$, "getSymmetryInfoString",
function (modelSet, modelIndex, symOp, pt1, pt2, drawID, type) {
return this.getDesc (modelSet).getSymmetryInfoString (this, modelIndex, symOp, pt1, pt2, drawID, type, modelSet);
}, "JM.ModelSet,~N,~N,JU.P3,JU.P3,~S,~S");
Clazz_overrideMethod (c$, "getSpaceGroupInfo",
function (modelSet, sgName) {
return this.getDesc (modelSet).getSpaceGroupInfo (this, -1, sgName, 0, null, null, null, modelSet);
}, "JM.ModelSet,~S");
Clazz_overrideMethod (c$, "getSymmetryInfo",
function (modelSet, iModel, iAtom, uc, xyz, op, pt, pt2, id, type) {
return this.getDesc (modelSet).getSymmetryInfo (this, iModel, iAtom, uc, xyz, op, pt, pt2, id, type, modelSet);
}, "JM.ModelSet,~N,~N,J.api.SymmetryInterface,~S,~N,JU.P3,JU.P3,~S,~N");
Clazz_overrideMethod (c$, "fcoord",
function (p) {
return JS.SymmetryOperation.fcoord (p);
}, "JU.T3");
Clazz_overrideMethod (c$, "getV0abc",
function (def) {
if (this.unitCell == null) return null;
var m;
var isRev = false;
if (Clazz_instanceOf (def, String)) {
var sdef = def;
if (sdef.indexOf (";") < 0) sdef += ";0,0,0";
isRev = sdef.startsWith ("!");
if (isRev) sdef = sdef.substring (1);
var symTemp = new JS.Symmetry ();
symTemp.setSpaceGroup (false);
var i = symTemp.addSpaceGroupOperation ("=" + sdef, 0);
if (i < 0) return null;
m = symTemp.getSpaceGroupOperation (i);
(m).doFinalize ();
} else {
m = (Clazz_instanceOf (def, JU.M3) ? JU.M4.newMV (def, new JU.P3 ()) : def);
}var pts = new Array (4);
var pt = new JU.P3 ();
var m3 = new JU.M3 ();
m.getRotationScale (m3);
m.getTranslation (pt);
if (isRev) {
m3.invert ();
m3.transpose ();
m3.rotate (pt);
pt.scale (-1);
} else {
m3.transpose ();
}this.unitCell.toCartesian (pt, false);
pts[0] = JU.V3.newV (pt);
pts[1] = JU.V3.new3 (1, 0, 0);
pts[2] = JU.V3.new3 (0, 1, 0);
pts[3] = JU.V3.new3 (0, 0, 1);
for (var i = 1; i < 4; i++) {
m3.rotate (pts[i]);
this.unitCell.toCartesian (pts[i], true);
}
return pts;
}, "~O");
Clazz_overrideMethod (c$, "getQuaternionRotation",
function (abc) {
return (this.unitCell == null ? null : this.unitCell.getQuaternionRotation (abc));
}, "~S");
Clazz_overrideMethod (c$, "getFractionalOrigin",
function () {
return this.unitCell.getFractionalOrigin ();
});
Clazz_overrideMethod (c$, "setAxes",
function (scale, axisPoints, fixedOrigin, originPoint) {
var vertices = this.getUnitCellVerticesNoOffset ();
var offset = this.getCartesianOffset ();
if (fixedOrigin == null) originPoint.add2 (offset, vertices[0]);
else offset = fixedOrigin;
axisPoints[0].scaleAdd2 (scale, vertices[4], offset);
axisPoints[1].scaleAdd2 (scale, vertices[2], offset);
axisPoints[2].scaleAdd2 (scale, vertices[1], offset);
}, "~N,~A,JU.P3,JU.P3");
Clazz_overrideMethod (c$, "getState",
function (commands) {
var pt = this.getFractionalOffset ();
var loadUC = false;
if (pt != null && (pt.x != 0 || pt.y != 0 || pt.z != 0)) {
commands.append ("; set unitcell ").append (JU.Escape.eP (pt));
loadUC = true;
}pt = this.getUnitCellMultiplier ();
if (pt != null) {
commands.append ("; set unitcell ").append (JU.Escape.eP (pt));
loadUC = true;
}return loadUC;
}, "JU.SB");
Clazz_overrideMethod (c$, "getIterator",
function (vwr, atom, atoms, bsAtoms, radius) {
return (J.api.Interface.getInterface ("JS.UnitCellIterator", vwr, "script")).set (this, atom, atoms, bsAtoms, radius);
}, "JV.Viewer,JM.Atom,~A,JU.BS,~N");
});
Clazz_declarePackage ("JS");
Clazz_load (["JU.V3"], "JS.PointGroup", ["java.lang.Float", "java.util.Hashtable", "JU.Lst", "$.P3", "$.PT", "$.Quat", "$.SB", "JU.BSUtil", "$.Escape", "$.Logger", "$.Node", "$.Point3fi"], function () {
c$ = Clazz_decorateAsClass (function () {
this.isAtoms = false;
this.drawInfo = null;
this.info = null;
this.textInfo = null;
this.drawType = "";
this.drawIndex = 0;
this.scale = NaN;
this.nAxes = null;
this.axes = null;
this.nAtoms = 0;
this.radius = 0;
this.distanceTolerance = 0.25;
this.linearTolerance = 8;
this.cosTolerance = 0.99;
this.name = "C_1?";
this.principalAxis = null;
this.principalPlane = null;
this.vTemp = null;
this.centerAtomIndex = -1;
this.haveInversionCenter = false;
this.center = null;
this.points = null;
this.elements = null;
this.bsAtoms = null;
this.haveVibration = false;
this.localEnvOnly = false;
this.maxElement = 0;
this.eCounts = null;
this.nOps = 0;
if (!Clazz_isClassDefined ("JS.PointGroup.Operation")) {
JS.PointGroup.$PointGroup$Operation$ ();
}
Clazz_instantialize (this, arguments);
}, JS, "PointGroup");
Clazz_prepareFields (c$, function () {
this.nAxes = Clazz_newIntArray (JS.PointGroup.maxAxis, 0);
this.axes = new Array (JS.PointGroup.maxAxis);
this.vTemp = new JU.V3 ();
});
Clazz_defineMethod (c$, "getName",
function () {
return this.name;
});
c$.getPointGroup = Clazz_defineMethod (c$, "getPointGroup",
function (pgLast, center, atomset, bsAtoms, haveVibration, distanceTolerance, linearTolerance, localEnvOnly) {
var pg = new JS.PointGroup ();
pg.distanceTolerance = distanceTolerance;
pg.linearTolerance = linearTolerance;
pg.isAtoms = (bsAtoms != null);
pg.bsAtoms = (bsAtoms == null ? JU.BSUtil.newBitSet2 (0, atomset.length) : bsAtoms);
pg.haveVibration = haveVibration;
pg.center = center;
pg.localEnvOnly = localEnvOnly;
return (pg.set (pgLast, atomset) ? pg : pgLast);
}, "JS.PointGroup,JU.T3,~A,JU.BS,~B,~N,~N,~B");
Clazz_makeConstructor (c$,
function () {
});
Clazz_defineMethod (c$, "isEqual",
function (pg) {
if (pg == null) return false;
if (this.linearTolerance != pg.linearTolerance || this.distanceTolerance != pg.distanceTolerance || this.nAtoms != pg.nAtoms || this.localEnvOnly != pg.localEnvOnly || this.haveVibration != pg.haveVibration || this.bsAtoms == null ? pg.bsAtoms != null : !this.bsAtoms.equals (pg.bsAtoms)) return false;
for (var i = 0; i < this.nAtoms; i++) {
if (this.elements[i] != pg.elements[i] || !this.points[i].equals (pg.points[i])) return false;
}
return true;
}, "JS.PointGroup");
Clazz_defineMethod (c$, "set",
function (pgLast, atomset) {
this.cosTolerance = (Math.cos (this.linearTolerance / 180 * 3.141592653589793));
if (!this.getPointsAndElements (atomset)) {
JU.Logger.error ("Too many atoms for point group calculation");
this.name = "point group not determined -- ac > 100 -- select fewer atoms and try again.";
return true;
}this.getElementCounts ();
if (this.haveVibration) {
var atomVibs = new Array (this.points.length);
for (var i = this.points.length; --i >= 0; ) {
atomVibs[i] = JU.P3.newP (this.points[i]);
var v = (this.points[i]).getVibrationVector ();
if (v != null) atomVibs[i].add (v);
}
this.points = atomVibs;
}if (this.isEqual (pgLast)) return false;
this.findInversionCenter ();
if (this.isLinear (this.points)) {
if (this.haveInversionCenter) {
this.name = "D(infinity)h";
} else {
this.name = "C(infinity)v";
}this.vTemp.sub2 (this.points[1], this.points[0]);
this.addAxis (16, this.vTemp);
this.principalAxis = this.axes[16][0];
if (this.haveInversionCenter) {
this.axes[0] = new Array (1);
this.principalPlane = this.axes[0][this.nAxes[0]++] = Clazz_innerTypeInstance (JS.PointGroup.Operation, this, null, this.vTemp);
}return true;
}this.axes[0] = new Array (15);
var nPlanes = 0;
this.findCAxes ();
nPlanes = this.findPlanes ();
this.findAdditionalAxes (nPlanes);
var n = this.getHighestOrder ();
if (this.nAxes[17] > 1) {
if (this.nAxes[19] > 1) {
if (this.haveInversionCenter) {
this.name = "Ih";
} else {
this.name = "I";
}} else if (this.nAxes[18] > 1) {
if (this.haveInversionCenter) {
this.name = "Oh";
} else {
this.name = "O";
}} else {
if (nPlanes > 0) {
if (this.haveInversionCenter) {
this.name = "Th";
} else {
this.name = "Td";
}} else {
this.name = "T";
}}} else {
if (n < 2) {
if (nPlanes == 1) {
this.name = "Cs";
return true;
}if (this.haveInversionCenter) {
this.name = "Ci";
return true;
}this.name = "C1";
} else if ((n % 2) == 1 && this.nAxes[16] > 0 || (n % 2) == 0 && this.nAxes[16] > 1) {
this.principalAxis = this.setPrincipalAxis (n, nPlanes);
if (nPlanes == 0) {
if (n < 14) {
this.name = "S" + n;
} else {
this.name = "D" + (n - 14);
}} else {
if (n < 14) n = Clazz_doubleToInt (n / 2);
else n -= 14;
if (nPlanes == n) {
this.name = "D" + n + "d";
} else {
this.name = "D" + n + "h";
}}} else if (nPlanes == 0) {
this.principalAxis = this.axes[n][0];
if (n < 14) {
this.name = "S" + n;
} else {
this.name = "C" + (n - 14);
}} else if (nPlanes == n - 14) {
this.principalAxis = this.axes[n][0];
this.name = "C" + nPlanes + "v";
} else {
this.principalAxis = this.axes[n < 14 ? n + 14 : n][0];
this.principalPlane = this.axes[0][0];
if (n < 14) n /= 2;
else n -= 14;
this.name = "C" + n + "h";
}}return true;
}, "JS.PointGroup,~A");
Clazz_defineMethod (c$, "setPrincipalAxis",
function (n, nPlanes) {
var principalPlane = this.setPrincipalPlane (n, nPlanes);
if (nPlanes == 0 && n < 14 || this.nAxes[n] == 1) {
if (nPlanes > 0 && n < 14) n = 14 + Clazz_doubleToInt (n / 2);
return this.axes[n][0];
}if (principalPlane == null) return null;
for (var i = 0; i < this.nAxes[16]; i++) if (this.isParallel (principalPlane.normalOrAxis, this.axes[16][i].normalOrAxis)) {
if (i != 0) {
var o = this.axes[16][0];
this.axes[16][0] = this.axes[16][i];
this.axes[16][i] = o;
}return this.axes[16][0];
}
return null;
}, "~N,~N");
Clazz_defineMethod (c$, "setPrincipalPlane",
function (n, nPlanes) {
if (nPlanes == 1) return this.principalPlane = this.axes[0][0];
if (nPlanes == 0 || nPlanes == n - 14) return null;
for (var i = 0; i < nPlanes; i++) for (var j = 0, nPerp = 0; j < nPlanes; j++) if (this.isPerpendicular (this.axes[0][i].normalOrAxis, this.axes[0][j].normalOrAxis) && ++nPerp > 2) {
if (i != 0) {
var o = this.axes[0][0];
this.axes[0][0] = this.axes[0][i];
this.axes[0][i] = o;
}return this.principalPlane = this.axes[0][0];
}
return null;
}, "~N,~N");
Clazz_defineMethod (c$, "getPointsAndElements",
function (atomset) {
var ac = JU.BSUtil.cardinalityOf (this.bsAtoms);
if (this.isAtoms && ac > 100) return false;
this.points = new Array (ac);
this.elements = Clazz_newIntArray (ac, 0);
if (ac == 0) return true;
this.nAtoms = 0;
var needCenter = (this.center == null);
if (needCenter) this.center = new JU.P3 ();
for (var i = this.bsAtoms.nextSetBit (0); i >= 0; i = this.bsAtoms.nextSetBit (i + 1), this.nAtoms++) {
var p = this.points[this.nAtoms] = atomset[i];
if (Clazz_instanceOf (p, JU.Node)) {
var bondIndex = (this.localEnvOnly ? 1 : 1 + Math.max (3, (p).getCovalentBondCount ()));
this.elements[this.nAtoms] = (p).getElementNumber () * bondIndex;
} else if (Clazz_instanceOf (p, JU.Point3fi)) {
this.elements[this.nAtoms] = (p).sD;
}if (needCenter) this.center.add (this.points[this.nAtoms]);
}
if (needCenter) this.center.scale (1 / this.nAtoms);
for (var i = this.nAtoms; --i >= 0; ) {
var r = this.center.distance (this.points[i]);
if (this.isAtoms && r < this.distanceTolerance) this.centerAtomIndex = i;
this.radius = Math.max (this.radius, r);
}
return true;
}, "~A");
Clazz_defineMethod (c$, "findInversionCenter",
function () {
this.haveInversionCenter = this.checkOperation (null, this.center, -1);
if (this.haveInversionCenter) {
this.axes[1] = new Array (1);
this.axes[1][0] = Clazz_innerTypeInstance (JS.PointGroup.Operation, this, null);
}});
Clazz_defineMethod (c$, "checkOperation",
function (q, center, iOrder) {
var pt = new JU.P3 ();
var nFound = 0;
var isInversion = (iOrder < 14);
out : for (var i = this.points.length; --i >= 0 && nFound < this.points.length; ) if (i == this.centerAtomIndex) {
nFound++;
} else {
var a1 = this.points[i];
var e1 = this.elements[i];
if (q != null) {
pt.sub2 (a1, center);
q.transform2 (pt, pt).add (center);
} else {
pt.setT (a1);
}if (isInversion) {
this.vTemp.sub2 (center, pt);
pt.scaleAdd2 (2, this.vTemp, pt);
}if ((q != null || isInversion) && pt.distance (a1) < this.distanceTolerance) {
nFound++;
continue;
}for (var j = this.points.length; --j >= 0; ) {
if (j == i || j == this.centerAtomIndex || this.elements[j] != e1) continue;
var a2 = this.points[j];
if (pt.distance (a2) < this.distanceTolerance) {
nFound++;
continue out;
}}
}
return nFound == this.points.length;
}, "JU.Quat,JU.T3,~N");
Clazz_defineMethod (c$, "isLinear",
function (atoms) {
var v1 = null;
if (atoms.length < 2) return false;
for (var i = atoms.length; --i >= 0; ) {
if (i == this.centerAtomIndex) continue;
if (v1 == null) {
v1 = new JU.V3 ();
v1.sub2 (atoms[i], this.center);
v1.normalize ();
this.vTemp.setT (v1);
continue;
}this.vTemp.sub2 (atoms[i], this.center);
this.vTemp.normalize ();
if (!this.isParallel (v1, this.vTemp)) return false;
}
return true;
}, "~A");
Clazz_defineMethod (c$, "isParallel",
function (v1, v2) {
return (Math.abs (v1.dot (v2)) >= this.cosTolerance);
}, "JU.V3,JU.V3");
Clazz_defineMethod (c$, "isPerpendicular",
function (v1, v2) {
return (Math.abs (v1.dot (v2)) <= 1 - this.cosTolerance);
}, "JU.V3,JU.V3");
Clazz_defineMethod (c$, "getElementCounts",
function () {
for (var i = this.points.length; --i >= 0; ) {
var e1 = this.elements[i];
if (e1 > this.maxElement) this.maxElement = e1;
}
this.eCounts = Clazz_newIntArray (++this.maxElement, 0);
for (var i = this.points.length; --i >= 0; ) this.eCounts[this.elements[i]]++;
});
Clazz_defineMethod (c$, "findCAxes",
function () {
var v1 = new JU.V3 ();
var v2 = new JU.V3 ();
var v3 = new JU.V3 ();
for (var i = this.points.length; --i >= 0; ) {
if (i == this.centerAtomIndex) continue;
var a1 = this.points[i];
var e1 = this.elements[i];
for (var j = this.points.length; --j > i; ) {
var a2 = this.points[j];
if (this.elements[j] != e1) continue;
v1.sub2 (a1, this.center);
v2.sub2 (a2, this.center);
v1.normalize ();
v2.normalize ();
if (this.isParallel (v1, v2)) {
this.getAllAxes (v1);
continue;
}if (this.nAxes[16] < JS.PointGroup.axesMaxN[16]) {
v3.ave (a1, a2);
v3.sub (this.center);
this.getAllAxes (v3);
}var order = (6.283185307179586 / v1.angle (v2));
var iOrder = Clazz_doubleToInt (Math.floor (order + 0.01));
var isIntegerOrder = (order - iOrder <= 0.02);
if (!isIntegerOrder || (iOrder = iOrder + 14) >= JS.PointGroup.maxAxis) continue;
if (this.nAxes[iOrder] < JS.PointGroup.axesMaxN[iOrder]) {
v3.cross (v1, v2);
this.checkAxisOrder (iOrder, v3, this.center);
}}
}
var vs = new Array (this.nAxes[16] * 2);
for (var i = 0; i < vs.length; i++) vs[i] = new JU.V3 ();
var n = 0;
for (var i = 0; i < this.nAxes[16]; i++) {
vs[n++].setT (this.axes[16][i].normalOrAxis);
vs[n].setT (this.axes[16][i].normalOrAxis);
vs[n++].scale (-1);
}
for (var i = vs.length; --i >= 2; ) for (var j = i; --j >= 1; ) for (var k = j; --k >= 0; ) {
v3.add2 (vs[i], vs[j]);
v3.add (vs[k]);
if (v3.length () < 1.0) continue;
this.checkAxisOrder (17, v3, this.center);
}
var nMin = 2147483647;
var iMin = -1;
for (var i = 0; i < this.maxElement; i++) {
if (this.eCounts[i] < nMin && this.eCounts[i] > 2) {
nMin = this.eCounts[i];
iMin = i;
}}
out : for (var i = 0; i < this.points.length - 2; i++) if (this.elements[i] == iMin) for (var j = i + 1; j < this.points.length - 1; j++) if (this.elements[j] == iMin) for (var k = j + 1; k < this.points.length; k++) if (this.elements[k] == iMin) {
v1.sub2 (this.points[i], this.points[j]);
v2.sub2 (this.points[i], this.points[k]);
v1.normalize ();
v2.normalize ();
v3.cross (v1, v2);
this.getAllAxes (v3);
v1.add2 (this.points[i], this.points[j]);
v1.add (this.points[k]);
v1.normalize ();
if (!this.isParallel (v1, v3)) this.getAllAxes (v1);
if (this.nAxes[19] == JS.PointGroup.axesMaxN[19]) break out;
}
vs = new Array (this.maxElement);
for (var i = this.points.length; --i >= 0; ) {
var e1 = this.elements[i];
if (vs[e1] == null) vs[e1] = new JU.V3 ();
else if (this.haveInversionCenter) continue;
vs[e1].add (this.points[i]);
}
if (!this.haveInversionCenter) for (var i = 0; i < this.maxElement; i++) if (vs[i] != null) vs[i].scale (1 / this.eCounts[i]);
for (var i = 0; i < this.maxElement; i++) if (vs[i] != null) for (var j = 0; j < this.maxElement; j++) {
if (i == j || vs[j] == null) continue;
if (this.haveInversionCenter) v1.cross (vs[i], vs[j]);
else v1.sub2 (vs[i], vs[j]);
this.checkAxisOrder (16, v1, this.center);
}
return this.getHighestOrder ();
});
Clazz_defineMethod (c$, "getAllAxes",
function (v3) {
for (var o = 16; o < JS.PointGroup.maxAxis; o++) if (this.nAxes[o] < JS.PointGroup.axesMaxN[o]) this.checkAxisOrder (o, v3, this.center);
}, "JU.V3");
Clazz_defineMethod (c$, "getHighestOrder",
function () {
var n = 0;
for (n = 14; --n > 1 && this.nAxes[n] == 0; ) {
}
if (n > 1) return (n + 14 < JS.PointGroup.maxAxis && this.nAxes[n + 14] > 0 ? n + 14 : n);
for (n = JS.PointGroup.maxAxis; --n > 1 && this.nAxes[n] == 0; ) {
}
return n;
});
Clazz_defineMethod (c$, "checkAxisOrder",
function (iOrder, v, center) {
switch (iOrder) {
case 22:
if (this.nAxes[17] > 0) return false;
case 20:
case 18:
if (this.nAxes[19] > 0) return false;
break;
case 17:
if (this.nAxes[22] > 0) return false;
break;
case 19:
if (this.nAxes[18] > 0 || this.nAxes[20] > 0 || this.nAxes[22] > 0) return false;
break;
}
v.normalize ();
if (this.haveAxis (iOrder, v)) return false;
var q = JU.Quat.newVA (v, (iOrder < 14 ? 180 : 0) + Clazz_doubleToInt (360 / (iOrder % 14)));
if (!this.checkOperation (q, center, iOrder)) return false;
this.addAxis (iOrder, v);
switch (iOrder) {
case 16:
this.checkAxisOrder (4, v, center);
break;
case 17:
this.checkAxisOrder (3, v, center);
if (this.haveInversionCenter) this.addAxis (6, v);
break;
case 18:
this.addAxis (16, v);
this.checkAxisOrder (4, v, center);
this.checkAxisOrder (8, v, center);
break;
case 19:
this.checkAxisOrder (5, v, center);
if (this.haveInversionCenter) this.addAxis (10, v);
break;
case 20:
this.addAxis (16, v);
this.addAxis (17, v);
this.checkAxisOrder (3, v, center);
this.checkAxisOrder (6, v, center);
this.checkAxisOrder (12, v, center);
break;
case 22:
this.addAxis (16, v);
this.addAxis (18, v);
break;
}
return true;
}, "~N,JU.V3,JU.T3");
Clazz_defineMethod (c$, "addAxis",
function (iOrder, v) {
if (this.haveAxis (iOrder, v)) return;
if (this.axes[iOrder] == null) this.axes[iOrder] = new Array (JS.PointGroup.axesMaxN[iOrder]);
this.axes[iOrder][this.nAxes[iOrder]++] = Clazz_innerTypeInstance (JS.PointGroup.Operation, this, null, v, iOrder);
}, "~N,JU.V3");
Clazz_defineMethod (c$, "haveAxis",
function (iOrder, v) {
if (this.nAxes[iOrder] == JS.PointGroup.axesMaxN[iOrder]) {
return true;
}if (this.nAxes[iOrder] > 0) for (var i = this.nAxes[iOrder]; --i >= 0; ) {
if (this.isParallel (v, this.axes[iOrder][i].normalOrAxis)) return true;
}
return false;
}, "~N,JU.V3");
Clazz_defineMethod (c$, "findPlanes",
function () {
var pt = new JU.P3 ();
var v1 = new JU.V3 ();
var v2 = new JU.V3 ();
var v3 = new JU.V3 ();
var nPlanes = 0;
var haveAxes = (this.getHighestOrder () > 1);
for (var i = this.points.length; --i >= 0; ) {
if (i == this.centerAtomIndex) continue;
var a1 = this.points[i];
var e1 = this.elements[i];
for (var j = this.points.length; --j > i; ) {
if (haveAxes && this.elements[j] != e1) continue;
var a2 = this.points[j];
pt.add2 (a1, a2);
pt.scale (0.5);
v1.sub2 (a1, this.center);
v2.sub2 (a2, this.center);
if (!this.isParallel (v1, v2)) {
v3.cross (v1, v2);
v3.normalize ();
nPlanes = this.getPlane (v3);
}v3.sub2 (a2, a1);
v3.normalize ();
nPlanes = this.getPlane (v3);
if (nPlanes == JS.PointGroup.axesMaxN[0]) return nPlanes;
}
}
if (haveAxes) for (var i = 16; i < JS.PointGroup.maxAxis; i++) for (var j = 0; j < this.nAxes[i]; j++) nPlanes = this.getPlane (this.axes[i][j].normalOrAxis);
return nPlanes;
});
Clazz_defineMethod (c$, "getPlane",
function (v3) {
if (!this.haveAxis (0, v3) && this.checkOperation (JU.Quat.newVA (v3, 180), this.center, -1)) this.axes[0][this.nAxes[0]++] = Clazz_innerTypeInstance (JS.PointGroup.Operation, this, null, v3);
return this.nAxes[0];
}, "JU.V3");
Clazz_defineMethod (c$, "findAdditionalAxes",
function (nPlanes) {
var planes = this.axes[0];
var Cn = 0;
if (nPlanes > 1 && ((Cn = nPlanes + 14) < JS.PointGroup.maxAxis) && this.nAxes[Cn] == 0) {
this.vTemp.cross (planes[0].normalOrAxis, planes[1].normalOrAxis);
if (!this.checkAxisOrder (Cn, this.vTemp, this.center) && nPlanes > 2) {
this.vTemp.cross (planes[1].normalOrAxis, planes[2].normalOrAxis);
this.checkAxisOrder (Cn - 1, this.vTemp, this.center);
}}if (this.nAxes[16] == 0 && nPlanes > 2) {
for (var i = 0; i < nPlanes - 1; i++) {
for (var j = i + 1; j < nPlanes; j++) {
this.vTemp.add2 (planes[1].normalOrAxis, planes[2].normalOrAxis);
this.checkAxisOrder (16, this.vTemp, this.center);
}
}
}}, "~N");
Clazz_defineMethod (c$, "getInfo",
function (modelIndex, asDraw, asInfo, type, index, scaleFactor) {
this.info = (asInfo ? new java.util.Hashtable () : null);
var v = new JU.V3 ();
var op;
if (scaleFactor == 0) scaleFactor = 1;
this.scale = scaleFactor;
var nType = Clazz_newIntArray (4, 2, 0);
for (var i = 1; i < JS.PointGroup.maxAxis; i++) for (var j = this.nAxes[i]; --j >= 0; ) nType[this.axes[i][j].type][0]++;
var sb = new JU.SB ().append ("# ").appendI (this.nAtoms).append (" atoms\n");
if (asDraw) {
var haveType = (type != null && type.length > 0);
this.drawType = type = (haveType ? type : "");
this.drawIndex = index;
var anyProperAxis = (type.equalsIgnoreCase ("Cn"));
var anyImproperAxis = (type.equalsIgnoreCase ("Sn"));
sb.append ("set perspectivedepth off;\n");
var m = "_" + modelIndex + "_";
if (!haveType) sb.append ("draw pg0").append (m).append ("* delete;draw pgva").append (m).append ("* delete;draw pgvp").append (m).append ("* delete;");
if (!haveType || type.equalsIgnoreCase ("Ci")) sb.append ("draw pg0").append (m).append (this.haveInversionCenter ? "inv " : " ").append (JU.Escape.eP (this.center)).append (this.haveInversionCenter ? "\"i\";\n" : ";\n");
var offset = 0.1;
for (var i = 2; i < JS.PointGroup.maxAxis; i++) {
if (i == 14) offset = 0.1;
if (this.nAxes[i] == 0) continue;
var label = this.axes[i][0].getLabel ();
offset += 0.25;
var scale = scaleFactor * this.radius + offset;
if (!haveType || type.equalsIgnoreCase (label) || anyProperAxis && i >= 14 || anyImproperAxis && i < 14) for (var j = 0; j < this.nAxes[i]; j++) {
if (index > 0 && j + 1 != index) continue;
op = this.axes[i][j];
v.add2 (op.normalOrAxis, this.center);
if (op.type == 2) scale = -scale;
sb.append ("draw pgva").append (m).append (label).append ("_").appendI (j + 1).append (" width 0.05 scale ").appendF (scale).append (" ").append (JU.Escape.eP (v));
v.scaleAdd2 (-2, op.normalOrAxis, v);
var isPA = (this.principalAxis != null && op.index == this.principalAxis.index);
sb.append (JU.Escape.eP (v)).append ("\"").append (label).append (isPA ? "*" : "").append ("\" color ").append (isPA ? "red" : op.type == 2 ? "blue" : "yellow").append (";\n");
}
}
if (!haveType || type.equalsIgnoreCase ("Cs")) for (var j = 0; j < this.nAxes[0]; j++) {
if (index > 0 && j + 1 != index) continue;
op = this.axes[0][j];
sb.append ("draw pgvp").append (m).appendI (j + 1).append ("disk scale ").appendF (scaleFactor * this.radius * 2).append (" CIRCLE PLANE ").append (JU.Escape.eP (this.center));
v.add2 (op.normalOrAxis, this.center);
sb.append (JU.Escape.eP (v)).append (" color translucent yellow;\n");
v.add2 (op.normalOrAxis, this.center);
sb.append ("draw pgvp").append (m).appendI (j + 1).append ("ring width 0.05 scale ").appendF (scaleFactor * this.radius * 2).append (" arc ").append (JU.Escape.eP (v));
v.scaleAdd2 (-2, op.normalOrAxis, v);
sb.append (JU.Escape.eP (v));
v.add3 (0.011, 0.012, 0.013);
sb.append (JU.Escape.eP (v)).append ("{0 360 0.5} color ").append (this.principalPlane != null && op.index == this.principalPlane.index ? "red" : "blue").append (";\n");
}
sb.append ("# name=").append (this.name);
sb.append (", nCi=").appendI (this.haveInversionCenter ? 1 : 0);
sb.append (", nCs=").appendI (this.nAxes[0]);
sb.append (", nCn=").appendI (nType[1][0]);
sb.append (", nSn=").appendI (nType[2][0]);
sb.append (": ");
for (var i = JS.PointGroup.maxAxis; --i >= 2; ) if (this.nAxes[i] > 0) {
sb.append (" n").append (i < 14 ? "S" : "C").appendI (i % 14);
sb.append ("=").appendI (this.nAxes[i]);
}
sb.append (";\n");
this.drawInfo = sb.toString ();
return this.drawInfo;
}var n = 0;
var nTotal = 1;
var ctype = (this.haveInversionCenter ? "Ci" : "center");
if (this.haveInversionCenter) nTotal++;
if (this.info == null) sb.append ("\n\n").append (this.name).append ("\t").append (ctype).append ("\t").append (JU.Escape.eP (this.center));
else this.info.put (ctype, this.center);
for (var i = JS.PointGroup.maxAxis; --i >= 0; ) {
if (this.nAxes[i] > 0) {
n = JS.PointGroup.nUnique[i];
var label = this.axes[i][0].getLabel ();
if (this.info == null) sb.append ("\n\n").append (this.name).append ("\tn").append (label).append ("\t").appendI (this.nAxes[i]).append ("\t").appendI (n);
else this.info.put ("n" + label, Integer.$valueOf (this.nAxes[i]));
n *= this.nAxes[i];
nTotal += n;
nType[this.axes[i][0].type][1] += n;
var vinfo = (this.info == null ? null : new JU.Lst ());
for (var j = 0; j < this.nAxes[i]; j++) {
if (vinfo == null) sb.append ("\n").append (this.name).append ("\t").append (label).append ("_").appendI (j + 1).append ("\t").appendO (this.axes[i][j].normalOrAxis);
else vinfo.addLast (this.axes[i][j].normalOrAxis);
}
if (this.info != null) this.info.put (label, vinfo);
}}
if (this.info == null) {
sb.append ("\n");
sb.append ("\n").append (this.name).append ("\ttype\tnType\tnUnique");
sb.append ("\n").append (this.name).append ("\tE\t 1\t 1");
n = (this.haveInversionCenter ? 1 : 0);
sb.append ("\n").append (this.name).append ("\tCi\t ").appendI (n).append ("\t ").appendI (n);
sb.append ("\n").append (this.name).append ("\tCs\t");
JU.PT.rightJustify (sb, " ", this.nAxes[0] + "\t");
JU.PT.rightJustify (sb, " ", this.nAxes[0] + "\n");
sb.append (this.name).append ("\tCn\t");
JU.PT.rightJustify (sb, " ", nType[1][0] + "\t");
JU.PT.rightJustify (sb, " ", nType[1][1] + "\n");
sb.append (this.name).append ("\tSn\t");
JU.PT.rightJustify (sb, " ", nType[2][0] + "\t");
JU.PT.rightJustify (sb, " ", nType[2][1] + "\n");
sb.append (this.name).append ("\t\tTOTAL\t");
JU.PT.rightJustify (sb, " ", nTotal + "\n");
this.textInfo = sb.toString ();
return this.textInfo;
}this.info.put ("name", this.name);
this.info.put ("nAtoms", Integer.$valueOf (this.nAtoms));
this.info.put ("nTotal", Integer.$valueOf (nTotal));
this.info.put ("nCi", Integer.$valueOf (this.haveInversionCenter ? 1 : 0));
this.info.put ("nCs", Integer.$valueOf (this.nAxes[0]));
this.info.put ("nCn", Integer.$valueOf (nType[1][0]));
this.info.put ("nSn", Integer.$valueOf (nType[2][0]));
this.info.put ("distanceTolerance", Float.$valueOf (this.distanceTolerance));
this.info.put ("linearTolerance", Float.$valueOf (this.linearTolerance));
this.info.put ("detail", sb.toString ().$replace ('\n', ';'));
if (this.principalAxis != null && this.principalAxis.index > 0) this.info.put ("principalAxis", this.principalAxis.normalOrAxis);
if (this.principalPlane != null && this.principalPlane.index > 0) this.info.put ("principalPlane", this.principalPlane.normalOrAxis);
return this.info;
}, "~N,~B,~B,~S,~N,~N");
Clazz_defineMethod (c$, "isDrawType",
function (type, index, scale) {
return (this.drawInfo != null && this.drawType.equals (type == null ? "" : type) && this.drawIndex == index && this.scale == scale);
}, "~S,~N,~N");
c$.$PointGroup$Operation$ = function () {
Clazz_pu$h(self.c$);
c$ = Clazz_decorateAsClass (function () {
Clazz_prepareCallback (this, arguments);
this.type = 0;
this.order = 0;
this.index = 0;
this.normalOrAxis = null;
Clazz_instantialize (this, arguments);
}, JS.PointGroup, "Operation");
Clazz_makeConstructor (c$,
function () {
this.index = ++this.b$["JS.PointGroup"].nOps;
this.type = 3;
this.order = 1;
if (JU.Logger.debugging) JU.Logger.debug ("new operation -- " + JS.PointGroup.typeNames[this.type]);
});
Clazz_makeConstructor (c$,
function (a, b) {
this.index = ++this.b$["JS.PointGroup"].nOps;
this.type = (b < 14 ? 2 : 1);
this.order = b % 14;
this.normalOrAxis = JU.Quat.newVA (a, 180).getNormal ();
if (JU.Logger.debugging) JU.Logger.debug ("new operation -- " + (this.order == b ? "S" : "C") + this.order + " " + this.normalOrAxis);
}, "JU.V3,~N");
Clazz_makeConstructor (c$,
function (a) {
if (a == null) return;
this.index = ++this.b$["JS.PointGroup"].nOps;
this.type = 0;
this.normalOrAxis = JU.Quat.newVA (a, 180).getNormal ();
if (JU.Logger.debugging) JU.Logger.debug ("new operation -- plane " + this.normalOrAxis);
}, "JU.V3");
Clazz_defineMethod (c$, "getLabel",
function () {
switch (this.type) {
case 0:
return "Cs";
case 2:
return "S" + this.order;
default:
return "C" + this.order;
}
});
c$ = Clazz_p0p ();
};
Clazz_defineStatics (c$,
"axesMaxN", Clazz_newIntArray (-1, [15, 0, 0, 1, 3, 1, 10, 0, 1, 0, 6, 0, 1, 0, 0, 0, 15, 10, 6, 6, 10, 0, 1]),
"nUnique", Clazz_newIntArray (-1, [1, 0, 0, 2, 2, 4, 2, 0, 4, 0, 4, 0, 4, 0, 0, 0, 1, 2, 2, 4, 2, 0, 4]),
"s3", 3,
"s4", 4,
"s5", 5,
"s6", 6,
"s8", 8,
"s10", 10,
"s12", 12,
"firstProper", 14,
"c2", 16,
"c3", 17,
"c4", 18,
"c5", 19,
"c6", 20,
"c8", 22);
c$.maxAxis = c$.prototype.maxAxis = JS.PointGroup.axesMaxN.length;
Clazz_defineStatics (c$,
"ATOM_COUNT_MAX", 100,
"OPERATION_PLANE", 0,
"OPERATION_PROPER_AXIS", 1,
"OPERATION_IMPROPER_AXIS", 2,
"OPERATION_INVERSION_CENTER", 3,
"typeNames", Clazz_newArray (-1, ["plane", "proper axis", "improper axis", "center of inversion"]));
});
Clazz_declarePackage ("JS");
Clazz_load (null, "JS.SpaceGroup", ["java.lang.Character", "java.util.Arrays", "$.Hashtable", "JU.AU", "$.Lst", "$.M4", "$.P3", "$.PT", "$.SB", "JS.HallInfo", "$.HallTranslation", "$.SymmetryOperation", "JU.Logger"], function () {
c$ = Clazz_decorateAsClass (function () {
this.index = 0;
this.isSSG = false;
this.name = "unknown!";
this.hallSymbol = null;
this.hmSymbol = null;
this.hmSymbolFull = null;
this.hmSymbolExt = null;
this.hmSymbolAbbr = null;
this.hmSymbolAlternative = null;
this.hmSymbolAbbrShort = null;
this.ambiguityType = '\0';
this.uniqueAxis = '\0';
this.axisChoice = '\0';
this.intlTableNumber = null;
this.intlTableNumberFull = null;
this.intlTableNumberExt = null;
this.hallInfo = null;
this.latticeParameter = 0;
this.operations = null;
this.finalOperations = null;
this.operationCount = 0;
this.latticeOp = -1;
this.xyzList = null;
this.modDim = 0;
this.doNormalize = true;
this.isBio = false;
this.isBilbao = false;
Clazz_instantialize (this, arguments);
}, JS, "SpaceGroup");
c$.getNull = Clazz_defineMethod (c$, "getNull",
function (doInit, doNormalize, doFinalize) {
JS.SpaceGroup.getSpaceGroups ();
var sg = new JS.SpaceGroup (null, doInit);
sg.doNormalize = doNormalize;
if (doFinalize) sg.setFinalOperations (null, 0, 0, false);
return sg;
}, "~B,~B,~B");
Clazz_makeConstructor (c$,
function (cifLine, doInit) {
this.index = ++JS.SpaceGroup.sgIndex;
this.init (doInit && cifLine == null);
if (doInit && cifLine != null) this.buildSpaceGroup (cifLine);
}, "~S,~B");
Clazz_defineMethod (c$, "init",
function (addXYZ) {
this.xyzList = new java.util.Hashtable ();
this.operationCount = 0;
if (addXYZ) this.addSymmetry ("x,y,z", 0, false);
}, "~B");
c$.createSpaceGroup = Clazz_defineMethod (c$, "createSpaceGroup",
function (desiredSpaceGroupIndex, name, data) {
var sg = null;
if (desiredSpaceGroupIndex >= 0) {
sg = JS.SpaceGroup.getSpaceGroups ()[desiredSpaceGroupIndex];
} else {
if (Clazz_instanceOf (data, JU.Lst)) sg = JS.SpaceGroup.createSGFromList (name, data);
else sg = JS.SpaceGroup.determineSpaceGroupNA (name, data);
if (sg == null) sg = JS.SpaceGroup.createSpaceGroupN (name);
}if (sg != null) sg.generateAllOperators (null);
return sg;
}, "~N,~S,~O");
c$.createSGFromList = Clazz_defineMethod (c$, "createSGFromList",
function (name, data) {
var sg = new JS.SpaceGroup ("0;--;--;--", true);
sg.doNormalize = false;
sg.name = name;
var n = data.size ();
for (var i = 0; i < n; i++) {
var operation = data.get (i);
if (Clazz_instanceOf (operation, JS.SymmetryOperation)) {
var op = operation;
var iop = sg.addOp (op, op.xyz, false);
sg.operations[iop].setTimeReversal (op.timeReversal);
} else {
sg.addSymmetrySM ("xyz matrix:" + operation, operation);
}}
var sgn = sg.getDerivedSpaceGroup ();
if (sgn != null) sg = sgn;
return sg;
}, "~S,JU.Lst");
Clazz_defineMethod (c$, "addSymmetry",
function (xyz, opId, allowScaling) {
xyz = xyz.toLowerCase ();
return (xyz.indexOf ("[[") < 0 && xyz.indexOf ("x4") < 0 && xyz.indexOf (";") < 0 && (xyz.indexOf ("x") < 0 || xyz.indexOf ("y") < 0 || xyz.indexOf ("z") < 0) ? -1 : this.addOperation (xyz, opId, allowScaling));
}, "~S,~N,~B");
Clazz_defineMethod (c$, "setFinalOperations",
function (atoms, atomIndex, count, doNormalize) {
if (this.hallInfo == null && this.latticeParameter != 0) {
var h = new JS.HallInfo (JS.HallTranslation.getHallLatticeEquivalent (this.latticeParameter));
this.generateAllOperators (h);
}this.finalOperations = null;
this.isBio = (this.name.indexOf ("bio") >= 0);
if (this.index >= JS.SpaceGroup.getSpaceGroups ().length && !this.isBio && this.name.indexOf ("SSG:") < 0 && this.name.indexOf ("[subsystem") < 0) {
var sg = this.getDerivedSpaceGroup ();
if (sg != null) this.name = sg.getName ();
}this.finalOperations = new Array (this.operationCount);
if (doNormalize && count > 0 && atoms != null) {
this.finalOperations[0] = new JS.SymmetryOperation (this.operations[0], atoms, atomIndex, count, true);
var atom = atoms[atomIndex];
var c = JU.P3.newP (atom);
this.finalOperations[0].rotTrans (c);
if (c.distance (atom) > 0.0001) for (var i = 0; i < count; i++) {
atom = atoms[atomIndex + i];
c.setT (atom);
this.finalOperations[0].rotTrans (c);
atom.setT (c);
}
}var centering = null;
for (var i = 0; i < this.operationCount; i++) {
this.finalOperations[i] = new JS.SymmetryOperation (this.operations[i], atoms, atomIndex, count, doNormalize);
centering = this.finalOperations[i].setCentering (centering, true);
}
}, "~A,~N,~N,~B");
Clazz_defineMethod (c$, "getOperationCount",
function () {
return this.finalOperations.length;
});
Clazz_defineMethod (c$, "getOperation",
function (i) {
return this.finalOperations[i];
}, "~N");
Clazz_defineMethod (c$, "getXyz",
function (i, doNormalize) {
return (this.finalOperations == null ? this.operations[i].getXyz (doNormalize) : this.finalOperations[i].getXyz (doNormalize));
}, "~N,~B");
Clazz_defineMethod (c$, "newPoint",
function (i, atom1, atom2, transX, transY, transZ) {
this.finalOperations[i].newPoint (atom1, atom2, transX, transY, transZ);
}, "~N,JU.P3,JU.P3,~N,~N,~N");
c$.getInfo = Clazz_defineMethod (c$, "getInfo",
function (spaceGroup, cellInfo) {
var sg;
if (cellInfo != null) {
if (spaceGroup.indexOf ("[") >= 0) spaceGroup = spaceGroup.substring (0, spaceGroup.indexOf ("[")).trim ();
if (spaceGroup.equals ("unspecified!")) return "no space group identified in file";
sg = JS.SpaceGroup.determineSpaceGroupNA (spaceGroup, cellInfo.getUnitCellParams ());
} else if (spaceGroup.equalsIgnoreCase ("ALL")) {
return JS.SpaceGroup.dumpAll ();
} else if (spaceGroup.equalsIgnoreCase ("ALLSEITZ")) {
return JS.SpaceGroup.dumpAllSeitz ();
} else {
sg = JS.SpaceGroup.determineSpaceGroupN (spaceGroup);
if (sg == null) {
sg = JS.SpaceGroup.createSpaceGroupN (spaceGroup);
} else {
var sb = new JU.SB ();
while (sg != null) {
sb.append (sg.dumpInfo (null));
sg = JS.SpaceGroup.determineSpaceGroupNS (spaceGroup, sg);
}
return sb.toString ();
}}return sg == null ? "?" : sg.dumpInfo (cellInfo);
}, "~S,J.api.SymmetryInterface");
Clazz_defineMethod (c$, "dumpInfo",
function (cellInfo) {
var info = this.dumpCanonicalSeitzList ();
if (Clazz_instanceOf (info, JS.SpaceGroup)) return (info).dumpInfo (null);
var sb = new JU.SB ().append ("\nHermann-Mauguin symbol: ");
sb.append (this.hmSymbol).append (this.hmSymbolExt.length > 0 ? ":" + this.hmSymbolExt : "").append ("\ninternational table number: ").append (this.intlTableNumber).append (this.intlTableNumberExt.length > 0 ? ":" + this.intlTableNumberExt : "").append ("\n\n").appendI (this.operationCount).append (" operators").append (!this.hallInfo.hallSymbol.equals ("--") ? " from Hall symbol " + this.hallInfo.hallSymbol : "").append (": ");
for (var i = 0; i < this.operationCount; i++) {
sb.append ("\n").append (this.operations[i].xyz);
}
sb.append ("\n\n").append (this.hallInfo == null ? "invalid Hall symbol" : this.hallInfo.dumpInfo ());
sb.append ("\n\ncanonical Seitz: ").append (info).append ("\n----------------------------------------------------\n");
return sb.toString ();
}, "J.api.SymmetryInterface");
Clazz_defineMethod (c$, "getName",
function () {
return this.name;
});
Clazz_defineMethod (c$, "getLatticeDesignation",
function () {
return JS.HallTranslation.getLatticeDesignation (this.latticeParameter);
});
Clazz_defineMethod (c$, "setLatticeParam",
function (latticeParameter) {
this.latticeParameter = latticeParameter;
if (latticeParameter > 10) this.latticeParameter = -JS.HallTranslation.getLatticeIndex (JS.HallTranslation.getLatticeCode (latticeParameter));
}, "~N");
Clazz_defineMethod (c$, "dumpCanonicalSeitzList",
function () {
if (this.hallInfo == null) this.hallInfo = new JS.HallInfo (this.hallSymbol);
this.generateAllOperators (null);
var s = this.getCanonicalSeitzList ();
if (this.index >= JS.SpaceGroup.SG.length) {
var sgDerived = JS.SpaceGroup.findSpaceGroup (s);
if (sgDerived != null) return sgDerived;
}return (this.index >= 0 && this.index < JS.SpaceGroup.SG.length ? this.hallSymbol + " = " : "") + s;
});
Clazz_defineMethod (c$, "getDerivedSpaceGroup",
function () {
if (this.index >= 0 && this.index < JS.SpaceGroup.SG.length || this.modDim > 0 || this.operations == null || this.operations.length == 0 || this.operations[0].timeReversal != 0) return this;
if (this.finalOperations != null) this.setFinalOperations (null, 0, 0, false);
var s = this.getCanonicalSeitzList ();
return (s == null ? null : JS.SpaceGroup.findSpaceGroup (s));
});
Clazz_defineMethod (c$, "getCanonicalSeitzList",
function () {
var list = new Array (this.operationCount);
for (var i = 0; i < this.operationCount; i++) list[i] = JS.SymmetryOperation.dumpSeitz (this.operations[i], true);
java.util.Arrays.sort (list, 0, this.operationCount);
var sb = new JU.SB ().append ("\n[");
for (var i = 0; i < this.operationCount; i++) sb.append (list[i].$replace ('\t', ' ').$replace ('\n', ' ')).append ("; ");
sb.append ("]");
return sb.toString ();
});
c$.findSpaceGroup = Clazz_defineMethod (c$, "findSpaceGroup",
function (s) {
JS.SpaceGroup.getSpaceGroups ();
if (JS.SpaceGroup.canonicalSeitzList == null) JS.SpaceGroup.canonicalSeitzList = new Array (JS.SpaceGroup.SG.length);
for (var i = 0; i < JS.SpaceGroup.SG.length; i++) {
if (JS.SpaceGroup.canonicalSeitzList[i] == null) JS.SpaceGroup.canonicalSeitzList[i] = JS.SpaceGroup.SG[i].dumpCanonicalSeitzList ();
if (JS.SpaceGroup.canonicalSeitzList[i].indexOf (s) >= 0) return JS.SpaceGroup.SG[i];
}
return null;
}, "~S");
c$.dumpAll = Clazz_defineMethod (c$, "dumpAll",
function () {
var sb = new JU.SB ();
JS.SpaceGroup.getSpaceGroups ();
for (var i = 0; i < JS.SpaceGroup.SG.length; i++) sb.append ("\n----------------------\n" + JS.SpaceGroup.SG[i].dumpInfo (null));
return sb.toString ();
});
c$.dumpAllSeitz = Clazz_defineMethod (c$, "dumpAllSeitz",
function () {
JS.SpaceGroup.getSpaceGroups ();
var sb = new JU.SB ();
for (var i = 0; i < JS.SpaceGroup.SG.length; i++) sb.append ("\n").appendO (JS.SpaceGroup.SG[i].dumpCanonicalSeitzList ());
return sb.toString ();
});
Clazz_defineMethod (c$, "setLattice",
function (latticeCode, isCentrosymmetric) {
this.latticeParameter = JS.HallTranslation.getLatticeIndex (latticeCode);
if (!isCentrosymmetric) this.latticeParameter = -this.latticeParameter;
}, "~S,~B");
c$.createSpaceGroupN = Clazz_defineMethod (c$, "createSpaceGroupN",
function (name) {
JS.SpaceGroup.getSpaceGroups ();
name = name.trim ();
var sg = JS.SpaceGroup.determineSpaceGroupN (name);
var hallInfo;
if (sg == null) {
hallInfo = new JS.HallInfo (name);
if (hallInfo.nRotations > 0) {
sg = new JS.SpaceGroup ("0;--;--;" + name, true);
sg.hallInfo = hallInfo;
} else if (name.indexOf (",") >= 0) {
sg = new JS.SpaceGroup ("0;--;--;--", true);
sg.doNormalize = false;
sg.generateOperatorsFromXyzInfo (name);
}}if (sg != null) sg.generateAllOperators (null);
return sg;
}, "~S");
Clazz_defineMethod (c$, "addOperation",
function (xyz0, opId, allowScaling) {
if (xyz0 == null || xyz0.length < 3) {
this.init (false);
return -1;
}var isSpecial = (xyz0.charAt (0) == '=');
if (isSpecial) xyz0 = xyz0.substring (1);
var id = this.checkXYZlist (xyz0);
if (id >= 0) return id;
if (xyz0.startsWith ("x1,x2,x3,x4") && this.modDim == 0) {
this.xyzList.clear ();
this.operationCount = 0;
this.modDim = JU.PT.parseInt (xyz0.substring (xyz0.lastIndexOf ("x") + 1)) - 3;
} else if (xyz0.equals ("x,y,z,m")) {
this.xyzList.clear ();
this.operationCount = 0;
}var op = new JS.SymmetryOperation (null, null, 0, opId, this.doNormalize);
if (!op.setMatrixFromXYZ (xyz0, this.modDim, allowScaling)) {
JU.Logger.error ("couldn't interpret symmetry operation: " + xyz0);
return -1;
}return this.addOp (op, xyz0, isSpecial);
}, "~S,~N,~B");
Clazz_defineMethod (c$, "checkXYZlist",
function (xyz) {
return (this.xyzList.containsKey (xyz) && !(this.latticeOp > 0 && xyz.indexOf ("/") < 0) ? this.xyzList.get (xyz).intValue () : -1);
}, "~S");
Clazz_defineMethod (c$, "addOp",
function (op, xyz0, isSpecial) {
var xyz = op.xyz;
if (!isSpecial) {
var id = this.checkXYZlist (xyz);
if (id >= 0) return id;
if (this.latticeOp < 0) {
var xxx0 = (this.modDim > 0 ? JS.SymmetryOperation.replaceXn (xyz, this.modDim + 3) : xyz);
var xxx = JU.PT.replaceAllCharacters (xxx0, "+123/", "");
if (this.xyzList.containsKey (xxx)) this.latticeOp = this.operationCount;
else this.xyzList.put (xxx, Integer.$valueOf (this.operationCount));
}this.xyzList.put (xyz, Integer.$valueOf (this.operationCount));
}if (!xyz.equals (xyz0)) this.xyzList.put (xyz0, Integer.$valueOf (this.operationCount));
if (this.operations == null) this.operations = new Array (4);
if (this.operationCount == this.operations.length) this.operations = JU.AU.arrayCopyObject (this.operations, this.operationCount * 2);
this.operations[this.operationCount++] = op;
op.index = this.operationCount;
if (JU.Logger.debugging) JU.Logger.debug ("\naddOperation " + this.operationCount + op.dumpInfo ());
return this.operationCount - 1;
}, "JS.SymmetryOperation,~S,~B");
Clazz_defineMethod (c$, "generateOperatorsFromXyzInfo",
function (xyzInfo) {
this.init (true);
var terms = JU.PT.split (xyzInfo.toLowerCase (), ";");
for (var i = 0; i < terms.length; i++) this.addSymmetry (terms[i], 0, false);
}, "~S");
Clazz_defineMethod (c$, "generateAllOperators",
function (h) {
if (h == null) {
h = this.hallInfo;
if (this.operationCount > 0) return;
this.operations = new Array (4);
if (this.hallInfo == null || this.hallInfo.nRotations == 0) h = this.hallInfo = new JS.HallInfo (this.hallSymbol);
this.setLattice (this.hallInfo.latticeCode, this.hallInfo.isCentrosymmetric);
this.init (true);
}var mat1 = new JU.M4 ();
var operation = new JU.M4 ();
var newOps = new Array (7);
for (var i = 0; i < 7; i++) newOps[i] = new JU.M4 ();
for (var i = 0; i < h.nRotations; i++) {
mat1.setM4 (h.rotationTerms[i].seitzMatrix12ths);
var nRot = h.rotationTerms[i].order;
newOps[0].setIdentity ();
var nOps = this.operationCount;
for (var j = 1; j <= nRot; j++) {
newOps[j].mul2 (mat1, newOps[0]);
newOps[0].setM4 (newOps[j]);
for (var k = 0; k < nOps; k++) {
operation.mul2 (newOps[j], this.operations[k]);
JS.SymmetryOperation.normalizeTranslation (operation);
var xyz = JS.SymmetryOperation.getXYZFromMatrix (operation, true, true, true);
this.addSymmetrySM (xyz, operation);
}
}
}
}, "JS.HallInfo");
Clazz_defineMethod (c$, "addSymmetrySM",
function (xyz, operation) {
var iop = this.addOperation (xyz, 0, false);
if (iop >= 0) {
var symmetryOperation = this.operations[iop];
symmetryOperation.setM4 (operation);
}return iop;
}, "~S,JU.M4");
c$.determineSpaceGroupN = Clazz_defineMethod (c$, "determineSpaceGroupN",
function (name) {
return JS.SpaceGroup.determineSpaceGroup (name, 0, 0, 0, 0, 0, 0, -1);
}, "~S");
c$.determineSpaceGroupNS = Clazz_defineMethod (c$, "determineSpaceGroupNS",
function (name, sg) {
return JS.SpaceGroup.determineSpaceGroup (name, 0, 0, 0, 0, 0, 0, sg.index);
}, "~S,JS.SpaceGroup");
c$.determineSpaceGroupNA = Clazz_defineMethod (c$, "determineSpaceGroupNA",
function (name, unitCellParams) {
return (unitCellParams == null ? JS.SpaceGroup.determineSpaceGroup (name, 0, 0, 0, 0, 0, 0, -1) : JS.SpaceGroup.determineSpaceGroup (name, unitCellParams[0], unitCellParams[1], unitCellParams[2], unitCellParams[3], unitCellParams[4], unitCellParams[5], -1));
}, "~S,~A");
c$.determineSpaceGroup = Clazz_defineMethod (c$, "determineSpaceGroup",
function (name, a, b, c, alpha, beta, gamma, lastIndex) {
var i = JS.SpaceGroup.determineSpaceGroupIndex (name, a, b, c, alpha, beta, gamma, lastIndex);
return (i >= 0 ? JS.SpaceGroup.SG[i] : null);
}, "~S,~N,~N,~N,~N,~N,~N,~N");
c$.determineSpaceGroupIndex = Clazz_defineMethod (c$, "determineSpaceGroupIndex",
function (name, a, b, c, alpha, beta, gamma, lastIndex) {
JS.SpaceGroup.getSpaceGroups ();
if (lastIndex < 0) lastIndex = JS.SpaceGroup.SG.length;
name = name.trim ().toLowerCase ();
var checkBilbao = false;
if (name.startsWith ("bilbao:")) {
checkBilbao = true;
name = name.substring (7);
}var nameType = (name.startsWith ("hall:") ? 5 : name.startsWith ("hm:") ? 3 : 0);
if (nameType > 0) name = name.substring (nameType);
else if (name.contains ("[")) {
nameType = 5;
name = name.substring (0, name.indexOf ("[")).trim ();
}var nameExt = name;
var i;
var haveExtension = false;
name = name.$replace ('_', ' ');
if (name.length >= 2) {
i = (name.indexOf ("-") == 0 ? 2 : 1);
if (i < name.length && name.charAt (i) != ' ') name = name.substring (0, i) + " " + name.substring (i);
name = name.substring (0, 2).toUpperCase () + name.substring (2);
}var ext = "";
if ((i = name.indexOf (":")) > 0) {
ext = name.substring (i + 1);
name = name.substring (0, i).trim ();
haveExtension = true;
}if (nameType != 5 && !haveExtension && JU.PT.isOneOf (name, JS.SpaceGroup.ambiguousNames)) {
ext = "?";
haveExtension = true;
}var abbr = JU.PT.replaceAllCharacters (name, " ()", "");
var s;
if (nameType != 3 && !haveExtension) for (i = lastIndex; --i >= 0; ) if (JS.SpaceGroup.SG[i].hallSymbol.equals (name)) return i;
if (nameType != 5) {
if (nameType != 3) for (i = lastIndex; --i >= 0; ) if (JS.SpaceGroup.SG[i].intlTableNumberFull.equals (nameExt)) return i;
for (i = lastIndex; --i >= 0; ) if (JS.SpaceGroup.SG[i].hmSymbolFull.equals (nameExt)) return i;
for (i = lastIndex; --i >= 0; ) if ((s = JS.SpaceGroup.SG[i]).hmSymbolAlternative != null && s.hmSymbolAlternative.equals (nameExt)) return i;
if (haveExtension) {
for (i = lastIndex; --i >= 0; ) if ((s = JS.SpaceGroup.SG[i]).hmSymbolAbbr.equals (abbr) && s.intlTableNumberExt.equals (ext)) return i;
for (i = lastIndex; --i >= 0; ) if ((s = JS.SpaceGroup.SG[i]).hmSymbolAbbrShort.equals (abbr) && s.intlTableNumberExt.equals (ext)) return i;
}var uniqueAxis = JS.SpaceGroup.determineUniqueAxis (a, b, c, alpha, beta, gamma);
if (!haveExtension || ext.charAt (0) == '?') for (i = 0; i < lastIndex; i++) if (((s = JS.SpaceGroup.SG[i]).hmSymbolAbbr.equals (abbr) || s.hmSymbolAbbrShort.equals (abbr)) && (!checkBilbao || s.isBilbao)) switch (s.ambiguityType) {
case '\0':
return i;
case 'a':
if (s.uniqueAxis == uniqueAxis || uniqueAxis == '\0') return i;
break;
case 'o':
if (ext.length == 0) {
if (s.hmSymbolExt.equals ("2")) return i;
} else if (s.hmSymbolExt.equals (ext)) return i;
break;
case 't':
if (ext.length == 0) {
if (s.axisChoice == 'h') return i;
} else if ((s.axisChoice + "").equals (ext)) return i;
break;
}
}if (ext.length == 0) for (i = 0; i < lastIndex; i++) if ((s = JS.SpaceGroup.SG[i]).intlTableNumber.equals (nameExt) && (!checkBilbao || s.isBilbao)) return i;
return -1;
}, "~S,~N,~N,~N,~N,~N,~N,~N");
c$.determineUniqueAxis = Clazz_defineMethod (c$, "determineUniqueAxis",
function (a, b, c, alpha, beta, gamma) {
if (a == b) return (b == c ? '\0' : 'c');
if (b == c) return 'a';
if (c == a) return 'b';
if (alpha == beta) return (beta == gamma ? '\0' : 'c');
if (beta == gamma) return 'a';
if (gamma == alpha) return 'b';
return '\0';
}, "~N,~N,~N,~N,~N,~N");
Clazz_defineMethod (c$, "buildSpaceGroup",
function (cifLine) {
var terms = JU.PT.split (cifLine.toLowerCase (), ";");
this.intlTableNumberFull = terms[0].trim ();
this.isBilbao = (terms.length < 5 && !this.intlTableNumberFull.equals ("0"));
var parts = JU.PT.split (this.intlTableNumberFull, ":");
this.intlTableNumber = parts[0];
this.intlTableNumberExt = (parts.length == 1 ? "" : parts[1]);
this.ambiguityType = '\0';
if (this.intlTableNumberExt.length > 0) {
if (this.intlTableNumberExt.equals ("h") || this.intlTableNumberExt.equals ("r")) {
this.ambiguityType = 't';
this.axisChoice = this.intlTableNumberExt.charAt (0);
} else if (this.intlTableNumberExt.startsWith ("1") || this.intlTableNumberExt.startsWith ("2")) {
this.ambiguityType = 'o';
} else if (this.intlTableNumberExt.length <= 2) {
this.ambiguityType = 'a';
this.uniqueAxis = this.intlTableNumberExt.charAt (0);
} else if (this.intlTableNumberExt.contains ("-")) {
this.ambiguityType = '-';
}}this.hmSymbolFull = Character.toUpperCase (terms[2].charAt (0)) + terms[2].substring (1);
parts = JU.PT.split (this.hmSymbolFull, ":");
this.hmSymbol = parts[0];
this.hmSymbolExt = (parts.length == 1 ? "" : parts[1]);
var pt = this.hmSymbol.indexOf (" -3");
if (pt >= 1) if ("admn".indexOf (this.hmSymbol.charAt (pt - 1)) >= 0) {
this.hmSymbolAlternative = (this.hmSymbol.substring (0, pt) + " 3" + this.hmSymbol.substring (pt + 3)).toLowerCase ();
}this.hmSymbolAbbr = JU.PT.rep (this.hmSymbol, " ", "");
this.hmSymbolAbbrShort = JU.PT.rep (this.hmSymbol, " 1", "");
this.hmSymbolAbbrShort = JU.PT.rep (this.hmSymbolAbbrShort, " ", "");
this.hallSymbol = terms[3];
if (this.hallSymbol.length > 1) this.hallSymbol = this.hallSymbol.substring (0, 2).toUpperCase () + this.hallSymbol.substring (2);
var info = this.intlTableNumber + this.hallSymbol;
if (this.intlTableNumber.charAt (0) != '0' && JS.SpaceGroup.lastInfo.equals (info)) JS.SpaceGroup.ambiguousNames += this.hmSymbol + ";";
JS.SpaceGroup.lastInfo = info;
this.name = this.hallSymbol + " [" + this.hmSymbolFull + "] #" + this.intlTableNumber;
}, "~S");
c$.getSpaceGroups = Clazz_defineMethod (c$, "getSpaceGroups",
function () {
return (JS.SpaceGroup.SG == null ? (JS.SpaceGroup.SG = JS.SpaceGroup.createSpaceGroups ()) : JS.SpaceGroup.SG);
});
c$.createSpaceGroups = Clazz_defineMethod (c$, "createSpaceGroups",
function () {
var n = JS.SpaceGroup.STR_SG.length;
var defs = new Array (n);
for (var i = 0; i < n; i++) defs[i] = new JS.SpaceGroup (JS.SpaceGroup.STR_SG[i], true);
JS.SpaceGroup.STR_SG = null;
return defs;
});
Clazz_defineMethod (c$, "addLatticeVectors",
function (lattvecs) {
if (this.latticeOp >= 0 || lattvecs.size () == 0) return false;
var nOps = this.latticeOp = this.operationCount;
var isMag = (lattvecs.get (0).length == this.modDim + 4);
var magRev = -2;
for (var j = 0; j < lattvecs.size (); j++) {
var data = lattvecs.get (j);
if (isMag) {
magRev = Clazz_floatToInt (data[this.modDim + 3]);
data = JU.AU.arrayCopyF (data, this.modDim + 3);
}if (data.length > this.modDim + 3) return false;
for (var i = 0; i < nOps; i++) {
var newOp = new JS.SymmetryOperation (null, null, 0, 0, this.doNormalize);
newOp.modDim = this.modDim;
var op = this.operations[i];
newOp.linearRotTrans = JU.AU.arrayCopyF (op.linearRotTrans, -1);
newOp.setFromMatrix (data, false);
if (magRev != -2) newOp.setTimeReversal (op.timeReversal * magRev);
newOp.xyzOriginal = newOp.xyz;
this.addOp (newOp, newOp.xyz, true);
}
}
return true;
}, "JU.Lst");
Clazz_defineMethod (c$, "getSiteMultiplicity",
function (pt, unitCell) {
var n = this.finalOperations.length;
var pts = new JU.Lst ();
for (var i = n; --i >= 0; ) {
var pt1 = JU.P3.newP (pt);
this.finalOperations[i].rotTrans (pt1);
unitCell.unitize (pt1);
for (var j = pts.size (); --j >= 0; ) {
var pt0 = pts.get (j);
if (pt1.distanceSquared (pt0) < 0.000001) {
pt1 = null;
break;
}}
if (pt1 != null) pts.addLast (pt1);
}
return Clazz_doubleToInt (n / pts.size ());
}, "JU.P3,JS.UnitCell");
Clazz_defineStatics (c$,
"canonicalSeitzList", null,
"NAME_HALL", 5,
"NAME_HM", 3,
"sgIndex", -1,
"ambiguousNames", "",
"lastInfo", "",
"SG", null,
"STR_SG", Clazz_newArray (-1, ["1;c1^1;p 1;p 1", "2;ci^1;p -1;-p 1", "3:b;c2^1;p 1 2 1;p 2y", "3:b;c2^1;p 2;p 2y", "3:c;c2^1;p 1 1 2;p 2", "3:a;c2^1;p 2 1 1;p 2x", "4:b;c2^2;p 1 21 1;p 2yb", "4:b;c2^2;p 21;p 2yb", "4:b*;c2^2;p 1 21 1*;p 2y1", "4:c;c2^2;p 1 1 21;p 2c", "4:c*;c2^2;p 1 1 21*;p 21", "4:a;c2^2;p 21 1 1;p 2xa", "4:a*;c2^2;p 21 1 1*;p 2x1", "5:b1;c2^3;c 1 2 1;c 2y", "5:b1;c2^3;c 2;c 2y", "5:b2;c2^3;a 1 2 1;a 2y", "5:b3;c2^3;i 1 2 1;i 2y", "5:c1;c2^3;a 1 1 2;a 2", "5:c2;c2^3;b 1 1 2;b 2", "5:c3;c2^3;i 1 1 2;i 2", "5:a1;c2^3;b 2 1 1;b 2x", "5:a2;c2^3;c 2 1 1;c 2x", "5:a3;c2^3;i 2 1 1;i 2x", "6:b;cs^1;p 1 m 1;p -2y", "6:b;cs^1;p m;p -2y", "6:c;cs^1;p 1 1 m;p -2", "6:a;cs^1;p m 1 1;p -2x", "7:b1;cs^2;p 1 c 1;p -2yc", "7:b1;cs^2;p c;p -2yc", "7:b2;cs^2;p 1 n 1;p -2yac", "7:b2;cs^2;p n;p -2yac", "7:b3;cs^2;p 1 a 1;p -2ya", "7:b3;cs^2;p a;p -2ya", "7:c1;cs^2;p 1 1 a;p -2a", "7:c2;cs^2;p 1 1 n;p -2ab", "7:c3;cs^2;p 1 1 b;p -2b", "7:a1;cs^2;p b 1 1;p -2xb", "7:a2;cs^2;p n 1 1;p -2xbc", "7:a3;cs^2;p c 1 1;p -2xc", "8:b1;cs^3;c 1 m 1;c -2y", "8:b1;cs^3;c m;c -2y", "8:b2;cs^3;a 1 m 1;a -2y", "8:b3;cs^3;i 1 m 1;i -2y", "8:b3;cs^3;i m;i -2y", "8:c1;cs^3;a 1 1 m;a -2", "8:c2;cs^3;b 1 1 m;b -2", "8:c3;cs^3;i 1 1 m;i -2", "8:a1;cs^3;b m 1 1;b -2x", "8:a2;cs^3;c m 1 1;c -2x", "8:a3;cs^3;i m 1 1;i -2x", "9:b1;cs^4;c 1 c 1;c -2yc", "9:b1;cs^4;c c;c -2yc", "9:b2;cs^4;a 1 n 1;a -2yab", "9:b3;cs^4;i 1 a 1;i -2ya", "9:-b1;cs^4;a 1 a 1;a -2ya", "9:-b2;cs^4;c 1 n 1;c -2yac", "9:-b3;cs^4;i 1 c 1;i -2yc", "9:c1;cs^4;a 1 1 a;a -2a", "9:c2;cs^4;b 1 1 n;b -2ab", "9:c3;cs^4;i 1 1 b;i -2b", "9:-c1;cs^4;b 1 1 b;b -2b", "9:-c2;cs^4;a 1 1 n;a -2ab", "9:-c3;cs^4;i 1 1 a;i -2a", "9:a1;cs^4;b b 1 1;b -2xb", "9:a2;cs^4;c n 1 1;c -2xac", "9:a3;cs^4;i c 1 1;i -2xc", "9:-a1;cs^4;c c 1 1;c -2xc", "9:-a2;cs^4;b n 1 1;b -2xab", "9:-a3;cs^4;i b 1 1;i -2xb", "10:b;c2h^1;p 1 2/m 1;-p 2y", "10:b;c2h^1;p 2/m;-p 2y", "10:c;c2h^1;p 1 1 2/m;-p 2", "10:a;c2h^1;p 2/m 1 1;-p 2x", "11:b;c2h^2;p 1 21/m 1;-p 2yb", "11:b;c2h^2;p 21/m;-p 2yb", "11:b*;c2h^2;p 1 21/m 1*;-p 2y1", "11:c;c2h^2;p 1 1 21/m;-p 2c", "11:c*;c2h^2;p 1 1 21/m*;-p 21", "11:a;c2h^2;p 21/m 1 1;-p 2xa", "11:a*;c2h^2;p 21/m 1 1*;-p 2x1", "12:b1;c2h^3;c 1 2/m 1;-c 2y", "12:b1;c2h^3;c 2/m;-c 2y", "12:b2;c2h^3;a 1 2/m 1;-a 2y", "12:b3;c2h^3;i 1 2/m 1;-i 2y", "12:b3;c2h^3;i 2/m;-i 2y", "12:c1;c2h^3;a 1 1 2/m;-a 2", "12:c2;c2h^3;b 1 1 2/m;-b 2", "12:c3;c2h^3;i 1 1 2/m;-i 2", "12:a1;c2h^3;b 2/m 1 1;-b 2x", "12:a2;c2h^3;c 2/m 1 1;-c 2x", "12:a3;c2h^3;i 2/m 1 1;-i 2x", "13:b1;c2h^4;p 1 2/c 1;-p 2yc", "13:b1;c2h^4;p 2/c;-p 2yc", "13:b2;c2h^4;p 1 2/n 1;-p 2yac", "13:b2;c2h^4;p 2/n;-p 2yac", "13:b3;c2h^4;p 1 2/a 1;-p 2ya", "13:b3;c2h^4;p 2/a;-p 2ya", "13:c1;c2h^4;p 1 1 2/a;-p 2a", "13:c2;c2h^4;p 1 1 2/n;-p 2ab", "13:c3;c2h^4;p 1 1 2/b;-p 2b", "13:a1;c2h^4;p 2/b 1 1;-p 2xb", "13:a2;c2h^4;p 2/n 1 1;-p 2xbc", "13:a3;c2h^4;p 2/c 1 1;-p 2xc", "14:b1;c2h^5;p 1 21/c 1;-p 2ybc", "14:b1;c2h^5;p 21/c;-p 2ybc", "14:b2;c2h^5;p 1 21/n 1;-p 2yn", "14:b2;c2h^5;p 21/n;-p 2yn", "14:b3;c2h^5;p 1 21/a 1;-p 2yab", "14:b3;c2h^5;p 21/a;-p 2yab", "14:c1;c2h^5;p 1 1 21/a;-p 2ac", "14:c2;c2h^5;p 1 1 21/n;-p 2n", "14:c3;c2h^5;p 1 1 21/b;-p 2bc", "14:a1;c2h^5;p 21/b 1 1;-p 2xab", "14:a2;c2h^5;p 21/n 1 1;-p 2xn", "14:a3;c2h^5;p 21/c 1 1;-p 2xac", "15:b1;c2h^6;c 1 2/c 1;-c 2yc", "15:b1;c2h^6;c 2/c;-c 2yc", "15:b2;c2h^6;a 1 2/n 1;-a 2yab", "15:b3;c2h^6;i 1 2/a 1;-i 2ya", "15:b3;c2h^6;i 2/a;-i 2ya", "15:-b1;c2h^6;a 1 2/a 1;-a 2ya", "15:-b2;c2h^6;c 1 2/n 1;-c 2yac", "15:-b2;c2h^6;c 2/n;-c 2yac", "15:-b3;c2h^6;i 1 2/c 1;-i 2yc", "15:-b3;c2h^6;i 2/c;-i 2yc", "15:c1;c2h^6;a 1 1 2/a;-a 2a", "15:c2;c2h^6;b 1 1 2/n;-b 2ab", "15:c3;c2h^6;i 1 1 2/b;-i 2b", "15:-c1;c2h^6;b 1 1 2/b;-b 2b", "15:-c2;c2h^6;a 1 1 2/n;-a 2ab", "15:-c3;c2h^6;i 1 1 2/a;-i 2a", "15:a1;c2h^6;b 2/b 1 1;-b 2xb", "15:a2;c2h^6;c 2/n 1 1;-c 2xac", "15:a3;c2h^6;i 2/c 1 1;-i 2xc", "15:-a1;c2h^6;c 2/c 1 1;-c 2xc", "15:-a2;c2h^6;b 2/n 1 1;-b 2xab", "15:-a3;c2h^6;i 2/b 1 1;-i 2xb", "16;d2^1;p 2 2 2;p 2 2", "17;d2^2;p 2 2 21;p 2c 2", "17*;d2^2;p 2 2 21*;p 21 2", "17:cab;d2^2;p 21 2 2;p 2a 2a", "17:bca;d2^2;p 2 21 2;p 2 2b", "18;d2^3;p 21 21 2;p 2 2ab", "18:cab;d2^3;p 2 21 21;p 2bc 2", "18:bca;d2^3;p 21 2 21;p 2ac 2ac", "19;d2^4;p 21 21 21;p 2ac 2ab", "20;d2^5;c 2 2 21;c 2c 2", "20*;d2^5;c 2 2 21*;c 21 2", "20:cab;d2^5;a 21 2 2;a 2a 2a", "20:cab*;d2^5;a 21 2 2*;a 2a 21", "20:bca;d2^5;b 2 21 2;b 2 2b", "21;d2^6;c 2 2 2;c 2 2", "21:cab;d2^6;a 2 2 2;a 2 2", "21:bca;d2^6;b 2 2 2;b 2 2", "22;d2^7;f 2 2 2;f 2 2", "23;d2^8;i 2 2 2;i 2 2", "24;d2^9;i 21 21 21;i 2b 2c", "25;c2v^1;p m m 2;p 2 -2", "25:cab;c2v^1;p 2 m m;p -2 2", "25:bca;c2v^1;p m 2 m;p -2 -2", "26;c2v^2;p m c 21;p 2c -2", "26*;c2v^2;p m c 21*;p 21 -2", "26:ba-c;c2v^2;p c m 21;p 2c -2c", "26:ba-c*;c2v^2;p c m 21*;p 21 -2c", "26:cab;c2v^2;p 21 m a;p -2a 2a", "26:-cba;c2v^2;p 21 a m;p -2 2a", "26:bca;c2v^2;p b 21 m;p -2 -2b", "26:a-cb;c2v^2;p m 21 b;p -2b -2", "27;c2v^3;p c c 2;p 2 -2c", "27:cab;c2v^3;p 2 a a;p -2a 2", "27:bca;c2v^3;p b 2 b;p -2b -2b", "28;c2v^4;p m a 2;p 2 -2a", "28*;c2v^4;p m a 2*;p 2 -21", "28:ba-c;c2v^4;p b m 2;p 2 -2b", "28:cab;c2v^4;p 2 m b;p -2b 2", "28:-cba;c2v^4;p 2 c m;p -2c 2", "28:-cba*;c2v^4;p 2 c m*;p -21 2", "28:bca;c2v^4;p c 2 m;p -2c -2c", "28:a-cb;c2v^4;p m 2 a;p -2a -2a", "29;c2v^5;p c a 21;p 2c -2ac", "29:ba-c;c2v^5;p b c 21;p 2c -2b", "29:cab;c2v^5;p 21 a b;p -2b 2a", "29:-cba;c2v^5;p 21 c a;p -2ac 2a", "29:bca;c2v^5;p c 21 b;p -2bc -2c", "29:a-cb;c2v^5;p b 21 a;p -2a -2ab", "30;c2v^6;p n c 2;p 2 -2bc", "30:ba-c;c2v^6;p c n 2;p 2 -2ac", "30:cab;c2v^6;p 2 n a;p -2ac 2", "30:-cba;c2v^6;p 2 a n;p -2ab 2", "30:bca;c2v^6;p b 2 n;p -2ab -2ab", "30:a-cb;c2v^6;p n 2 b;p -2bc -2bc", "31;c2v^7;p m n 21;p 2ac -2", "31:ba-c;c2v^7;p n m 21;p 2bc -2bc", "31:cab;c2v^7;p 21 m n;p -2ab 2ab", "31:-cba;c2v^7;p 21 n m;p -2 2ac", "31:bca;c2v^7;p n 21 m;p -2 -2bc", "31:a-cb;c2v^7;p m 21 n;p -2ab -2", "32;c2v^8;p b a 2;p 2 -2ab", "32:cab;c2v^8;p 2 c b;p -2bc 2", "32:bca;c2v^8;p c 2 a;p -2ac -2ac", "33;c2v^9;p n a 21;p 2c -2n", "33*;c2v^9;p n a 21*;p 21 -2n", "33:ba-c;c2v^9;p b n 21;p 2c -2ab", "33:ba-c*;c2v^9;p b n 21*;p 21 -2ab", "33:cab;c2v^9;p 21 n b;p -2bc 2a", "33:cab*;c2v^9;p 21 n b*;p -2bc 21", "33:-cba;c2v^9;p 21 c n;p -2n 2a", "33:-cba*;c2v^9;p 21 c n*;p -2n 21", "33:bca;c2v^9;p c 21 n;p -2n -2ac", "33:a-cb;c2v^9;p n 21 a;p -2ac -2n", "34;c2v^10;p n n 2;p 2 -2n", "34:cab;c2v^10;p 2 n n;p -2n 2", "34:bca;c2v^10;p n 2 n;p -2n -2n", "35;c2v^11;c m m 2;c 2 -2", "35:cab;c2v^11;a 2 m m;a -2 2", "35:bca;c2v^11;b m 2 m;b -2 -2", "36;c2v^12;c m c 21;c 2c -2", "36*;c2v^12;c m c 21*;c 21 -2", "36:ba-c;c2v^12;c c m 21;c 2c -2c", "36:ba-c*;c2v^12;c c m 21*;c 21 -2c", "36:cab;c2v^12;a 21 m a;a -2a 2a", "36:cab*;c2v^12;a 21 m a*;a -2a 21", "36:-cba;c2v^12;a 21 a m;a -2 2a", "36:-cba*;c2v^12;a 21 a m*;a -2 21", "36:bca;c2v^12;b b 21 m;b -2 -2b", "36:a-cb;c2v^12;b m 21 b;b -2b -2", "37;c2v^13;c c c 2;c 2 -2c", "37:cab;c2v^13;a 2 a a;a -2a 2", "37:bca;c2v^13;b b 2 b;b -2b -2b", "38;c2v^14;a m m 2;a 2 -2", "38:ba-c;c2v^14;b m m 2;b 2 -2", "38:cab;c2v^14;b 2 m m;b -2 2", "38:-cba;c2v^14;c 2 m m;c -2 2", "38:bca;c2v^14;c m 2 m;c -2 -2", "38:a-cb;c2v^14;a m 2 m;a -2 -2", "39;c2v^15;a e m 2;a 2 -2b", "39;c2v^15;a b m 2;a 2 -2b", "39:ba-c;c2v^15;b m a 2;b 2 -2a", "39:cab;c2v^15;b 2 c m;b -2a 2", "39:-cba;c2v^15;c 2 m b;c -2a 2", "39:bca;c2v^15;c m 2 a;c -2a -2a", "39:a-cb;c2v^15;a c 2 m;a -2b -2b", "40;c2v^16;a m a 2;a 2 -2a", "40:ba-c;c2v^16;b b m 2;b 2 -2b", "40:cab;c2v^16;b 2 m b;b -2b 2", "40:-cba;c2v^16;c 2 c m;c -2c 2", "40:bca;c2v^16;c c 2 m;c -2c -2c", "40:a-cb;c2v^16;a m 2 a;a -2a -2a", "41;c2v^17;a e a 2;a 2 -2ab", "41;c2v^17;a b a 2;a 2 -2ab;-b", "41:ba-c;c2v^17;b b a 2;b 2 -2ab", "41:cab;c2v^17;b 2 c b;b -2ab 2", "41:-cba;c2v^17;c 2 c b;c -2ac 2", "41:bca;c2v^17;c c 2 a;c -2ac -2ac", "41:a-cb;c2v^17;a c 2 a;a -2ab -2ab", "42;c2v^18;f m m 2;f 2 -2", "42:cab;c2v^18;f 2 m m;f -2 2", "42:bca;c2v^18;f m 2 m;f -2 -2", "43;c2v^19;f d d 2;f 2 -2d", "43:cab;c2v^19;f 2 d d;f -2d 2", "43:bca;c2v^19;f d 2 d;f -2d -2d", "44;c2v^20;i m m 2;i 2 -2", "44:cab;c2v^20;i 2 m m;i -2 2", "44:bca;c2v^20;i m 2 m;i -2 -2", "45;c2v^21;i b a 2;i 2 -2c", "45:cab;c2v^21;i 2 c b;i -2a 2", "45:bca;c2v^21;i c 2 a;i -2b -2b", "46;c2v^22;i m a 2;i 2 -2a", "46:ba-c;c2v^22;i b m 2;i 2 -2b", "46:cab;c2v^22;i 2 m b;i -2b 2", "46:-cba;c2v^22;i 2 c m;i -2c 2", "46:bca;c2v^22;i c 2 m;i -2c -2c", "46:a-cb;c2v^22;i m 2 a;i -2a -2a", "47;d2h^1;p m m m;-p 2 2", "48:1;d2h^2;p n n n:1;p 2 2 -1n;-b", "48:2;d2h^2;p n n n:2;-p 2ab 2bc", "49;d2h^3;p c c m;-p 2 2c", "49:cab;d2h^3;p m a a;-p 2a 2", "49:bca;d2h^3;p b m b;-p 2b 2b", "50:1;d2h^4;p b a n:1;p 2 2 -1ab;-b", "50:2;d2h^4;p b a n:2;-p 2ab 2b", "50:1cab;d2h^4;p n c b:1;p 2 2 -1bc", "50:2cab;d2h^4;p n c b:2;-p 2b 2bc", "50:1bca;d2h^4;p c n a:1;p 2 2 -1ac", "50:2bca;d2h^4;p c n a:2;-p 2a 2c", "51;d2h^5;p m m a;-p 2a 2a", "51:ba-c;d2h^5;p m m b;-p 2b 2", "51:cab;d2h^5;p b m m;-p 2 2b", "51:-cba;d2h^5;p c m m;-p 2c 2c", "51:bca;d2h^5;p m c m;-p 2c 2", "51:a-cb;d2h^5;p m a m;-p 2 2a", "52;d2h^6;p n n a;-p 2a 2bc", "52:ba-c;d2h^6;p n n b;-p 2b 2n", "52:cab;d2h^6;p b n n;-p 2n 2b", "52:-cba;d2h^6;p c n n;-p 2ab 2c", "52:bca;d2h^6;p n c n;-p 2ab 2n", "52:a-cb;d2h^6;p n a n;-p 2n 2bc", "53;d2h^7;p m n a;-p 2ac 2", "53:ba-c;d2h^7;p n m b;-p 2bc 2bc", "53:cab;d2h^7;p b m n;-p 2ab 2ab", "53:-cba;d2h^7;p c n m;-p 2 2ac", "53:bca;d2h^7;p n c m;-p 2 2bc", "53:a-cb;d2h^7;p m a n;-p 2ab 2", "54;d2h^8;p c c a;-p 2a 2ac", "54:ba-c;d2h^8;p c c b;-p 2b 2c", "54:cab;d2h^8;p b a a;-p 2a 2b", "54:-cba;d2h^8;p c a a;-p 2ac 2c", "54:bca;d2h^8;p b c b;-p 2bc 2b", "54:a-cb;d2h^8;p b a b;-p 2b 2ab", "55;d2h^9;p b a m;-p 2 2ab", "55:cab;d2h^9;p m c b;-p 2bc 2", "55:bca;d2h^9;p c m a;-p 2ac 2ac", "56;d2h^10;p c c n;-p 2ab 2ac", "56:cab;d2h^10;p n a a;-p 2ac 2bc", "56:bca;d2h^10;p b n b;-p 2bc 2ab", "57;d2h^11;p b c m;-p 2c 2b", "57:ba-c;d2h^11;p c a m;-p 2c 2ac", "57:cab;d2h^11;p m c a;-p 2ac 2a", "57:-cba;d2h^11;p m a b;-p 2b 2a", "57:bca;d2h^11;p b m a;-p 2a 2ab", "57:a-cb;d2h^11;p c m b;-p 2bc 2c", "58;d2h^12;p n n m;-p 2 2n", "58:cab;d2h^12;p m n n;-p 2n 2", "58:bca;d2h^12;p n m n;-p 2n 2n", "59:1;d2h^13;p m m n:1;p 2 2ab -1ab;-b", "59:2;d2h^13;p m m n:2;-p 2ab 2a", "59:1cab;d2h^13;p n m m:1;p 2bc 2 -1bc", "59:2cab;d2h^13;p n m m:2;-p 2c 2bc", "59:1bca;d2h^13;p m n m:1;p 2ac 2ac -1ac", "59:2bca;d2h^13;p m n m:2;-p 2c 2a", "60;d2h^14;p b c n;-p 2n 2ab", "60:ba-c;d2h^14;p c a n;-p 2n 2c", "60:cab;d2h^14;p n c a;-p 2a 2n", "60:-cba;d2h^14;p n a b;-p 2bc 2n", "60:bca;d2h^14;p b n a;-p 2ac 2b", "60:a-cb;d2h^14;p c n b;-p 2b 2ac", "61;d2h^15;p b c a;-p 2ac 2ab", "61:ba-c;d2h^15;p c a b;-p 2bc 2ac", "62;d2h^16;p n m a;-p 2ac 2n", "62:ba-c;d2h^16;p m n b;-p 2bc 2a", "62:cab;d2h^16;p b n m;-p 2c 2ab", "62:-cba;d2h^16;p c m n;-p 2n 2ac", "62:bca;d2h^16;p m c n;-p 2n 2a", "62:a-cb;d2h^16;p n a m;-p 2c 2n", "63;d2h^17;c m c m;-c 2c 2", "63:ba-c;d2h^17;c c m m;-c 2c 2c", "63:cab;d2h^17;a m m a;-a 2a 2a", "63:-cba;d2h^17;a m a m;-a 2 2a", "63:bca;d2h^17;b b m m;-b 2 2b", "63:a-cb;d2h^17;b m m b;-b 2b 2", "64;d2h^18;c m c e;-c 2ac 2", "64;d2h^18;c m c a;-c 2ac 2", "64:ba-c;d2h^18;c c m b;-c 2ac 2ac", "64:cab;d2h^18;a b m a;-a 2ab 2ab", "64:-cba;d2h^18;a c a m;-a 2 2ab", "64:bca;d2h^18;b b c m;-b 2 2ab", "64:a-cb;d2h^18;b m a b;-b 2ab 2", "65;d2h^19;c m m m;-c 2 2", "65:cab;d2h^19;a m m m;-a 2 2", "65:bca;d2h^19;b m m m;-b 2 2", "66;d2h^20;c c c m;-c 2 2c", "66:cab;d2h^20;a m a a;-a 2a 2", "66:bca;d2h^20;b b m b;-b 2b 2b", "67;d2h^21;c m m e;-c 2a 2", "67;d2h^21;c m m a;-c 2a 2", "67:ba-c;d2h^21;c m m b;-c 2a 2a", "67:cab;d2h^21;a b m m;-a 2b 2b", "67:-cba;d2h^21;a c m m;-a 2 2b", "67:bca;d2h^21;b m c m;-b 2 2a", "67:a-cb;d2h^21;b m a m;-b 2a 2", "68:1;d2h^22;c c c e:1;c 2 2 -1ac;-b", "68:1;d2h^22;c c c a:1;c 2 2 -1ac;-b", "68:2;d2h^22;c c c e:2;-c 2a 2ac", "68:2;d2h^22;c c c a:2;-c 2a 2ac", "68:1ba-c;d2h^22;c c c b:1;c 2 2 -1ac", "68:2ba-c;d2h^22;c c c b:2;-c 2a 2c", "68:1cab;d2h^22;a b a a:1;a 2 2 -1ab", "68:2cab;d2h^22;a b a a:2;-a 2a 2b", "68:1-cba;d2h^22;a c a a:1;a 2 2 -1ab", "68:2-cba;d2h^22;a c a a:2;-a 2ab 2b", "68:1bca;d2h^22;b b c b:1;b 2 2 -1ab", "68:2bca;d2h^22;b b c b:2;-b 2ab 2b", "68:1a-cb;d2h^22;b b a b:1;b 2 2 -1ab", "68:2a-cb;d2h^22;b b a b:2;-b 2b 2ab", "69;d2h^23;f m m m;-f 2 2", "70:1;d2h^24;f d d d:1;f 2 2 -1d;-b", "70:2;d2h^24;f d d d:2;-f 2uv 2vw", "71;d2h^25;i m m m;-i 2 2", "72;d2h^26;i b a m;-i 2 2c", "72:cab;d2h^26;i m c b;-i 2a 2", "72:bca;d2h^26;i c m a;-i 2b 2b", "73;d2h^27;i b c a;-i 2b 2c", "73:ba-c;d2h^27;i c a b;-i 2a 2b", "74;d2h^28;i m m a;-i 2b 2", "74:ba-c;d2h^28;i m m b;-i 2a 2a", "74:cab;d2h^28;i b m m;-i 2c 2c", "74:-cba;d2h^28;i c m m;-i 2 2b", "74:bca;d2h^28;i m c m;-i 2 2a", "74:a-cb;d2h^28;i m a m;-i 2c 2", "75;c4^1;p 4;p 4", "76;c4^2;p 41;p 4w", "76*;c4^2;p 41*;p 41", "77;c4^3;p 42;p 4c", "77*;c4^3;p 42*;p 42", "78;c4^4;p 43;p 4cw", "78*;c4^4;p 43*;p 43", "79;c4^5;i 4;i 4", "80;c4^6;i 41;i 4bw", "81;s4^1;p -4;p -4", "82;s4^2;i -4;i -4", "83;c4h^1;p 4/m;-p 4", "84;c4h^2;p 42/m;-p 4c", "84*;c4h^2;p 42/m*;-p 42", "85:1;c4h^3;p 4/n:1;p 4ab -1ab;-b", "85:2;c4h^3;p 4/n:2;-p 4a", "86:1;c4h^4;p 42/n:1;p 4n -1n;-b", "86:2;c4h^4;p 42/n:2;-p 4bc", "87;c4h^5;i 4/m;-i 4", "88:1;c4h^6;i 41/a:1;i 4bw -1bw;-b", "88:2;c4h^6;i 41/a:2;-i 4ad", "89;d4^1;p 4 2 2;p 4 2", "90;d4^2;p 4 21 2;p 4ab 2ab", "91;d4^3;p 41 2 2;p 4w 2c", "91*;d4^3;p 41 2 2*;p 41 2c", "92;d4^4;p 41 21 2;p 4abw 2nw", "93;d4^5;p 42 2 2;p 4c 2", "93*;d4^5;p 42 2 2*;p 42 2", "94;d4^6;p 42 21 2;p 4n 2n", "95;d4^7;p 43 2 2;p 4cw 2c", "95*;d4^7;p 43 2 2*;p 43 2c", "96;d4^8;p 43 21 2;p 4nw 2abw", "97;d4^9;i 4 2 2;i 4 2", "98;d4^10;i 41 2 2;i 4bw 2bw", "99;c4v^1;p 4 m m;p 4 -2", "100;c4v^2;p 4 b m;p 4 -2ab", "101;c4v^3;p 42 c m;p 4c -2c", "101*;c4v^3;p 42 c m*;p 42 -2c", "102;c4v^4;p 42 n m;p 4n -2n", "103;c4v^5;p 4 c c;p 4 -2c", "104;c4v^6;p 4 n c;p 4 -2n", "105;c4v^7;p 42 m c;p 4c -2", "105*;c4v^7;p 42 m c*;p 42 -2", "106;c4v^8;p 42 b c;p 4c -2ab", "106*;c4v^8;p 42 b c*;p 42 -2ab", "107;c4v^9;i 4 m m;i 4 -2", "108;c4v^10;i 4 c m;i 4 -2c", "109;c4v^11;i 41 m d;i 4bw -2", "110;c4v^12;i 41 c d;i 4bw -2c", "111;d2d^1;p -4 2 m;p -4 2", "112;d2d^2;p -4 2 c;p -4 2c", "113;d2d^3;p -4 21 m;p -4 2ab", "114;d2d^4;p -4 21 c;p -4 2n", "115;d2d^5;p -4 m 2;p -4 -2", "116;d2d^6;p -4 c 2;p -4 -2c", "117;d2d^7;p -4 b 2;p -4 -2ab", "118;d2d^8;p -4 n 2;p -4 -2n", "119;d2d^9;i -4 m 2;i -4 -2", "120;d2d^10;i -4 c 2;i -4 -2c", "121;d2d^11;i -4 2 m;i -4 2", "122;d2d^12;i -4 2 d;i -4 2bw", "123;d4h^1;p 4/m m m;-p 4 2", "124;d4h^2;p 4/m c c;-p 4 2c", "125:1;d4h^3;p 4/n b m:1;p 4 2 -1ab;-b", "125:2;d4h^3;p 4/n b m:2;-p 4a 2b", "126:1;d4h^4;p 4/n n c:1;p 4 2 -1n;-b", "126:2;d4h^4;p 4/n n c:2;-p 4a 2bc", "127;d4h^5;p 4/m b m;-p 4 2ab", "128;d4h^6;p 4/m n c;-p 4 2n", "129:1;d4h^7;p 4/n m m:1;p 4ab 2ab -1ab;-b", "129:2;d4h^7;p 4/n m m:2;-p 4a 2a", "130:1;d4h^8;p 4/n c c:1;p 4ab 2n -1ab;-b", "130:2;d4h^8;p 4/n c c:2;-p 4a 2ac", "131;d4h^9;p 42/m m c;-p 4c 2", "132;d4h^10;p 42/m c m;-p 4c 2c", "133:1;d4h^11;p 42/n b c:1;p 4n 2c -1n;-b", "133:2;d4h^11;p 42/n b c:2;-p 4ac 2b", "134:1;d4h^12;p 42/n n m:1;p 4n 2 -1n;-b", "134:2;d4h^12;p 42/n n m:2;-p 4ac 2bc", "135;d4h^13;p 42/m b c;-p 4c 2ab", "135*;d4h^13;p 42/m b c*;-p 42 2ab", "136;d4h^14;p 42/m n m;-p 4n 2n", "137:1;d4h^15;p 42/n m c:1;p 4n 2n -1n;-b", "137:2;d4h^15;p 42/n m c:2;-p 4ac 2a", "138:1;d4h^16;p 42/n c m:1;p 4n 2ab -1n;-b", "138:2;d4h^16;p 42/n c m:2;-p 4ac 2ac", "139;d4h^17;i 4/m m m;-i 4 2", "140;d4h^18;i 4/m c m;-i 4 2c", "141:1;d4h^19;i 41/a m d:1;i 4bw 2bw -1bw;-b", "141:2;d4h^19;i 41/a m d:2;-i 4bd 2", "142:1;d4h^20;i 41/a c d:1;i 4bw 2aw -1bw;-b", "142:2;d4h^20;i 41/a c d:2;-i 4bd 2c", "143;c3^1;p 3;p 3", "144;c3^2;p 31;p 31", "145;c3^3;p 32;p 32", "146:h;c3^4;r 3:h;r 3", "146:r;c3^4;r 3:r;p 3*", "147;c3i^1;p -3;-p 3", "148:h;c3i^2;r -3:h;-r 3", "148:r;c3i^2;r -3:r;-p 3*", "149;d3^1;p 3 1 2;p 3 2", "150;d3^2;p 3 2 1;p 3 2\"", "151;d3^3;p 31 1 2;p 31 2 (0 0 4)", "152;d3^4;p 31 2 1;p 31 2\"", "153;d3^5;p 32 1 2;p 32 2 (0 0 2)", "154;d3^6;p 32 2 1;p 32 2\"", "155:h;d3^7;r 3 2:h;r 3 2\"", "155:r;d3^7;r 3 2:r;p 3* 2", "156;c3v^1;p 3 m 1;p 3 -2\"", "157;c3v^2;p 3 1 m;p 3 -2", "158;c3v^3;p 3 c 1;p 3 -2\"c", "159;c3v^4;p 3 1 c;p 3 -2c", "160:h;c3v^5;r 3 m:h;r 3 -2\"", "160:r;c3v^5;r 3 m:r;p 3* -2", "161:h;c3v^6;r 3 c:h;r 3 -2\"c", "161:r;c3v^6;r 3 c:r;p 3* -2n", "162;d3d^1;p -3 1 m;-p 3 2", "163;d3d^2;p -3 1 c;-p 3 2c", "164;d3d^3;p -3 m 1;-p 3 2\"", "165;d3d^4;p -3 c 1;-p 3 2\"c", "166:h;d3d^5;r -3 m:h;-r 3 2\"", "166:r;d3d^5;r -3 m:r;-p 3* 2", "167:h;d3d^6;r -3 c:h;-r 3 2\"c", "167:r;d3d^6;r -3 c:r;-p 3* 2n", "168;c6^1;p 6;p 6", "169;c6^2;p 61;p 61", "170;c6^3;p 65;p 65", "171;c6^4;p 62;p 62", "172;c6^5;p 64;p 64", "173;c6^6;p 63;p 6c", "173*;c6^6;p 63*;p 63 ", "174;c3h^1;p -6;p -6", "175;c6h^1;p 6/m;-p 6", "176;c6h^2;p 63/m;-p 6c", "176*;c6h^2;p 63/m*;-p 63", "177;d6^1;p 6 2 2;p 6 2", "178;d6^2;p 61 2 2;p 61 2 (0 0 5)", "179;d6^3;p 65 2 2;p 65 2 (0 0 1)", "180;d6^4;p 62 2 2;p 62 2 (0 0 4)", "181;d6^5;p 64 2 2;p 64 2 (0 0 2)", "182;d6^6;p 63 2 2;p 6c 2c", "182*;d6^6;p 63 2 2*;p 63 2c", "183;c6v^1;p 6 m m;p 6 -2", "184;c6v^2;p 6 c c;p 6 -2c", "185;c6v^3;p 63 c m;p 6c -2", "185*;c6v^3;p 63 c m*;p 63 -2", "186;c6v^4;p 63 m c;p 6c -2c", "186*;c6v^4;p 63 m c*;p 63 -2c", "187;d3h^1;p -6 m 2;p -6 2", "188;d3h^2;p -6 c 2;p -6c 2", "189;d3h^3;p -6 2 m;p -6 -2", "190;d3h^4;p -6 2 c;p -6c -2c", "191;d6h^1;p 6/m m m;-p 6 2", "192;d6h^2;p 6/m c c;-p 6 2c", "193;d6h^3;p 63/m c m;-p 6c 2", "193*;d6h^3;p 63/m c m*;-p 63 2", "194;d6h^4;p 63/m m c;-p 6c 2c", "194*;d6h^4;p 63/m m c*;-p 63 2c", "195;t^1;p 2 3;p 2 2 3", "196;t^2;f 2 3;f 2 2 3", "197;t^3;i 2 3;i 2 2 3", "198;t^4;p 21 3;p 2ac 2ab 3", "199;t^5;i 21 3;i 2b 2c 3", "200;th^1;p m -3;-p 2 2 3", "201:1;th^2;p n -3:1;p 2 2 3 -1n;-b", "201:2;th^2;p n -3:2;-p 2ab 2bc 3", "202;th^3;f m -3;-f 2 2 3", "203:1;th^4;f d -3:1;f 2 2 3 -1d;-b", "203:2;th^4;f d -3:2;-f 2uv 2vw 3", "204;th^5;i m -3;-i 2 2 3", "205;th^6;p a -3;-p 2ac 2ab 3", "206;th^7;i a -3;-i 2b 2c 3", "207;o^1;p 4 3 2;p 4 2 3", "208;o^2;p 42 3 2;p 4n 2 3", "209;o^3;f 4 3 2;f 4 2 3", "210;o^4;f 41 3 2;f 4d 2 3", "211;o^5;i 4 3 2;i 4 2 3", "212;o^6;p 43 3 2;p 4acd 2ab 3", "213;o^7;p 41 3 2;p 4bd 2ab 3", "214;o^8;i 41 3 2;i 4bd 2c 3", "215;td^1;p -4 3 m;p -4 2 3", "216;td^2;f -4 3 m;f -4 2 3", "217;td^3;i -4 3 m;i -4 2 3", "218;td^4;p -4 3 n;p -4n 2 3", "219;td^5;f -4 3 c;f -4a 2 3", "220;td^6;i -4 3 d;i -4bd 2c 3", "221;oh^1;p m -3 m;-p 4 2 3", "222:1;oh^2;p n -3 n:1;p 4 2 3 -1n;-b", "222:2;oh^2;p n -3 n:2;-p 4a 2bc 3", "223;oh^3;p m -3 n;-p 4n 2 3", "224:1;oh^4;p n -3 m:1;p 4n 2 3 -1n;-b", "224:2;oh^4;p n -3 m:2;-p 4bc 2bc 3", "225;oh^5;f m -3 m;-f 4 2 3", "226;oh^6;f m -3 c;-f 4a 2 3", "227:1;oh^7;f d -3 m:1;f 4d 2 3 -1d;-b", "227:2;oh^7;f d -3 m:2;-f 4vw 2vw 3", "228:1;oh^8;f d -3 c:1;f 4d 2 3 -1ad;-b", "228:2;oh^8;f d -3 c:2;-f 4ud 2vw 3", "229;oh^9;i m -3 m;-i 4 2 3", "230;oh^10;i a -3 d;-i 4bd 2c 3"]));
});
Clazz_declarePackage ("JS");
Clazz_load (null, "JS.HallInfo", ["JU.P3i", "$.SB", "JS.HallRotationTerm", "$.HallTranslation", "JU.Logger"], function () {
c$ = Clazz_decorateAsClass (function () {
this.hallSymbol = null;
this.primitiveHallSymbol = null;
this.latticeCode = '\0';
this.latticeExtension = null;
this.isCentrosymmetric = false;
this.nRotations = 0;
this.rotationTerms = null;
this.vector12ths = null;
this.vectorCode = null;
Clazz_instantialize (this, arguments);
}, JS, "HallInfo");
Clazz_prepareFields (c$, function () {
this.rotationTerms = new Array (16);
});
Clazz_makeConstructor (c$,
function (hallSymbol) {
try {
var str = this.hallSymbol = hallSymbol.trim ();
str = this.extractLatticeInfo (str);
if (JS.HallTranslation.getLatticeIndex (this.latticeCode) == 0) return;
this.latticeExtension = JS.HallTranslation.getLatticeExtension (this.latticeCode, this.isCentrosymmetric);
str = this.extractVectorInfo (str) + this.latticeExtension;
if (JU.Logger.debugging) JU.Logger.debug ("Hallinfo: " + hallSymbol + " " + str);
var prevOrder = 0;
var prevAxisType = '\u0000';
this.primitiveHallSymbol = "P";
while (str.length > 0 && this.nRotations < 16) {
str = this.extractRotationInfo (str, prevOrder, prevAxisType);
var r = this.rotationTerms[this.nRotations - 1];
prevOrder = r.order;
prevAxisType = r.axisType;
this.primitiveHallSymbol += " " + r.primitiveCode;
}
this.primitiveHallSymbol += this.vectorCode;
} catch (e) {
if (Clazz_exceptionOf (e, Exception)) {
JU.Logger.error ("Invalid Hall symbol " + e);
this.nRotations = 0;
} else {
throw e;
}
}
}, "~S");
Clazz_defineMethod (c$, "dumpInfo",
function () {
var sb = new JU.SB ();
sb.append ("\nHall symbol: ").append (this.hallSymbol).append ("\nprimitive Hall symbol: ").append (this.primitiveHallSymbol).append ("\nlattice type: ").append (this.getLatticeDesignation ());
for (var i = 0; i < this.nRotations; i++) {
sb.append ("\n\nrotation term ").appendI (i + 1).append (this.rotationTerms[i].dumpInfo (this.vectorCode));
}
return sb.toString ();
});
Clazz_defineMethod (c$, "getLatticeDesignation",
function () {
return JS.HallTranslation.getLatticeDesignation2 (this.latticeCode, this.isCentrosymmetric);
});
Clazz_defineMethod (c$, "extractLatticeInfo",
function (name) {
var i = name.indexOf (" ");
if (i < 0) return "";
var term = name.substring (0, i).toUpperCase ();
this.latticeCode = term.charAt (0);
if (this.latticeCode == '-') {
this.isCentrosymmetric = true;
this.latticeCode = term.charAt (1);
}return name.substring (i + 1).trim ();
}, "~S");
Clazz_defineMethod (c$, "extractVectorInfo",
function (name) {
this.vector12ths = new JU.P3i ();
this.vectorCode = "";
var i = name.indexOf ("(");
var j = name.indexOf (")", i);
if (i > 0 && j > i) {
var term = name.substring (i + 1, j);
this.vectorCode = " (" + term + ")";
name = name.substring (0, i).trim ();
i = term.indexOf (" ");
if (i >= 0) {
this.vector12ths.x = Integer.parseInt (term.substring (0, i));
term = term.substring (i + 1).trim ();
i = term.indexOf (" ");
if (i >= 0) {
this.vector12ths.y = Integer.parseInt (term.substring (0, i));
term = term.substring (i + 1).trim ();
}}this.vector12ths.z = Integer.parseInt (term);
}return name;
}, "~S");
Clazz_defineMethod (c$, "extractRotationInfo",
function (name, prevOrder, prevAxisType) {
var i = name.indexOf (" ");
var code;
if (i >= 0) {
code = name.substring (0, i);
name = name.substring (i + 1).trim ();
} else {
code = name;
name = "";
}this.rotationTerms[this.nRotations] = new JS.HallRotationTerm (this, code, prevOrder, prevAxisType);
this.nRotations++;
return name;
}, "~S,~N,~S");
});
Clazz_declarePackage ("JS");
Clazz_load (["JU.M4"], "JS.HallRotationTerm", ["JU.SB", "JS.HallRotation", "$.HallTranslation", "$.SymmetryOperation", "JU.Logger"], function () {
c$ = Clazz_decorateAsClass (function () {
this.inputCode = null;
this.primitiveCode = null;
this.lookupCode = null;
this.translationString = null;
this.rotation = null;
this.translation = null;
this.seitzMatrix12ths = null;
this.isImproper = false;
this.order = 0;
this.axisType = '\0';
this.diagonalReferenceAxis = '\0';
this.allPositive = true;
Clazz_instantialize (this, arguments);
}, JS, "HallRotationTerm");
Clazz_prepareFields (c$, function () {
this.seitzMatrix12ths = new JU.M4 ();
});
Clazz_makeConstructor (c$,
function (hallInfo, code, prevOrder, prevAxisType) {
this.inputCode = code;
code += " ";
if (code.charAt (0) == '-') {
this.isImproper = true;
code = code.substring (1);
}this.primitiveCode = "";
this.order = code.charCodeAt (0) - 48;
this.diagonalReferenceAxis = '\0';
this.axisType = '\0';
var ptr = 2;
var c;
switch (c = code.charAt (1)) {
case 'x':
case 'y':
case 'z':
switch (code.charAt (2)) {
case '\'':
case '"':
this.diagonalReferenceAxis = c;
c = code.charAt (2);
ptr++;
}
case '*':
this.axisType = c;
break;
case '\'':
case '"':
this.axisType = c;
switch (code.charAt (2)) {
case 'x':
case 'y':
case 'z':
this.diagonalReferenceAxis = code.charAt (2);
ptr++;
break;
default:
this.diagonalReferenceAxis = prevAxisType;
}
break;
default:
this.axisType = (this.order == 1 ? '_' : hallInfo.nRotations == 0 ? 'z' : hallInfo.nRotations == 2 ? '*' : prevOrder == 2 || prevOrder == 4 ? 'x' : '\'');
code = code.substring (0, 1) + this.axisType + code.substring (1);
}
this.primitiveCode += (this.axisType == '_' ? "1" : code.substring (0, 2));
if (this.diagonalReferenceAxis != '\0') {
code = code.substring (0, 1) + this.diagonalReferenceAxis + this.axisType + code.substring (ptr);
this.primitiveCode += this.diagonalReferenceAxis;
ptr = 3;
}this.lookupCode = code.substring (0, ptr);
this.rotation = JS.HallRotation.lookup (this.lookupCode);
if (this.rotation == null) {
JU.Logger.error ("Rotation lookup could not find " + this.inputCode + " ? " + this.lookupCode);
return;
}this.translation = new JS.HallTranslation ('\0', null);
this.translationString = "";
var len = code.length;
for (var i = ptr; i < len; i++) {
var translationCode = code.charAt (i);
var t = JS.HallTranslation.getHallTranslation (translationCode, this.order);
if (t != null) {
this.translationString += "" + t.translationCode;
this.translation.rotationShift12ths += t.rotationShift12ths;
this.translation.vectorShift12ths.add (t.vectorShift12ths);
}}
this.primitiveCode = (this.isImproper ? "-" : "") + this.primitiveCode + this.translationString;
this.seitzMatrix12ths.setM4 (this.isImproper ? this.rotation.seitzMatrixInv : this.rotation.seitzMatrix);
this.seitzMatrix12ths.m03 = this.translation.vectorShift12ths.x;
this.seitzMatrix12ths.m13 = this.translation.vectorShift12ths.y;
this.seitzMatrix12ths.m23 = this.translation.vectorShift12ths.z;
switch (this.axisType) {
case 'x':
this.seitzMatrix12ths.m03 += this.translation.rotationShift12ths;
break;
case 'y':
this.seitzMatrix12ths.m13 += this.translation.rotationShift12ths;
break;
case 'z':
this.seitzMatrix12ths.m23 += this.translation.rotationShift12ths;
break;
}
if (hallInfo.vectorCode.length > 0) {
var m1 = JU.M4.newM4 (null);
var m2 = JU.M4.newM4 (null);
var v = hallInfo.vector12ths;
m1.m03 = v.x;
m1.m13 = v.y;
m1.m23 = v.z;
m2.m03 = -v.x;
m2.m13 = -v.y;
m2.m23 = -v.z;
this.seitzMatrix12ths.mul2 (m1, this.seitzMatrix12ths);
this.seitzMatrix12ths.mul (m2);
}if (JU.Logger.debugging) {
JU.Logger.debug ("code = " + code + "; primitive code =" + this.primitiveCode + "\n Seitz Matrix(12ths):" + this.seitzMatrix12ths);
}}, "JS.HallInfo,~S,~N,~S");
Clazz_defineMethod (c$, "dumpInfo",
function (vectorCode) {
var sb = new JU.SB ();
sb.append ("\ninput code: ").append (this.inputCode).append ("; primitive code: ").append (this.primitiveCode).append ("\norder: ").appendI (this.order).append (this.isImproper ? " (improper axis)" : "");
if (this.axisType != '_') {
sb.append ("; axisType: ").appendC (this.axisType);
if (this.diagonalReferenceAxis != '\0') sb.appendC (this.diagonalReferenceAxis);
}if (this.translationString.length > 0) sb.append ("; translation: ").append (this.translationString);
if (vectorCode.length > 0) sb.append ("; vector offset: ").append (vectorCode);
if (this.rotation != null) sb.append ("\noperator: ").append (this.getXYZ (this.allPositive)).append ("\nSeitz matrix:\n").append (JS.SymmetryOperation.dumpSeitz (this.seitzMatrix12ths, false));
return sb.toString ();
}, "~S");
Clazz_defineMethod (c$, "getXYZ",
function (allPositive) {
return JS.SymmetryOperation.getXYZFromMatrix (this.seitzMatrix12ths, true, allPositive, true);
}, "~B");
});
Clazz_declarePackage ("JS");
Clazz_load (["JU.M4"], "JS.HallRotation", null, function () {
c$ = Clazz_decorateAsClass (function () {
this.rotCode = null;
this.seitzMatrix = null;
this.seitzMatrixInv = null;
Clazz_instantialize (this, arguments);
}, JS, "HallRotation");
Clazz_prepareFields (c$, function () {
this.seitzMatrix = new JU.M4 ();
this.seitzMatrixInv = new JU.M4 ();
});
Clazz_makeConstructor (c$,
function (code, matrixData) {
this.rotCode = code;
var data = Clazz_newFloatArray (16, 0);
var dataInv = Clazz_newFloatArray (16, 0);
data[15] = dataInv[15] = 1;
for (var i = 0, ipt = 0; ipt < 11; i++) {
var value = 0;
switch (matrixData.charAt (i)) {
case ' ':
ipt++;
continue;
case '+':
case '1':
value = 1;
break;
case '-':
value = -1;
break;
}
data[ipt] = value;
dataInv[ipt] = -value;
ipt++;
}
this.seitzMatrix.setA (data);
this.seitzMatrixInv.setA (dataInv);
}, "~S,~S");
c$.lookup = Clazz_defineMethod (c$, "lookup",
function (code) {
for (var i = JS.HallRotation.getHallTerms ().length; --i >= 0; ) if (JS.HallRotation.hallRotationTerms[i].rotCode.equals (code)) return JS.HallRotation.hallRotationTerms[i];
return null;
}, "~S");
c$.getHallTerms = Clazz_defineMethod (c$, "getHallTerms",
function () {
return (JS.HallRotation.hallRotationTerms == null ? JS.HallRotation.hallRotationTerms = Clazz_newArray (-1, [ new JS.HallRotation ("1_", "+00 0+0 00+"), new JS.HallRotation ("2x", "+00 0-0 00-"), new JS.HallRotation ("2y", "-00 0+0 00-"), new JS.HallRotation ("2z", "-00 0-0 00+"), new JS.HallRotation ("2'", "0-0 -00 00-"), new JS.HallRotation ("2\"", "0+0 +00 00-"), new JS.HallRotation ("2x'", "-00 00- 0-0"), new JS.HallRotation ("2x\"", "-00 00+ 0+0"), new JS.HallRotation ("2y'", "00- 0-0 -00"), new JS.HallRotation ("2y\"", "00+ 0-0 +00"), new JS.HallRotation ("2z'", "0-0 -00 00-"), new JS.HallRotation ("2z\"", "0+0 +00 00-"), new JS.HallRotation ("3x", "+00 00- 0+-"), new JS.HallRotation ("3y", "-0+ 0+0 -00"), new JS.HallRotation ("3z", "0-0 +-0 00+"), new JS.HallRotation ("3*", "00+ +00 0+0"), new JS.HallRotation ("4x", "+00 00- 0+0"), new JS.HallRotation ("4y", "00+ 0+0 -00"), new JS.HallRotation ("4z", "0-0 +00 00+"), new JS.HallRotation ("6x", "+00 0+- 0+0"), new JS.HallRotation ("6y", "00+ 0+0 -0+"), new JS.HallRotation ("6z", "+-0 +00 00+")]) : JS.HallRotation.hallRotationTerms);
});
Clazz_defineStatics (c$,
"hallRotationTerms", null);
});
Clazz_declarePackage ("JS");
Clazz_load (null, "JS.HallTranslation", ["JU.P3i"], function () {
c$ = Clazz_decorateAsClass (function () {
this.translationCode = '\0';
this.rotationOrder = 0;
this.rotationShift12ths = 0;
this.vectorShift12ths = null;
Clazz_instantialize (this, arguments);
}, JS, "HallTranslation");
Clazz_makeConstructor (c$,
function (translationCode, params) {
this.translationCode = translationCode;
if (params != null) {
if (params.z >= 0) {
this.vectorShift12ths = params;
return;
}this.rotationOrder = params.x;
this.rotationShift12ths = params.y;
}this.vectorShift12ths = new JU.P3i ();
}, "~S,JU.P3i");
c$.getHallLatticeEquivalent = Clazz_defineMethod (c$, "getHallLatticeEquivalent",
function (latticeParameter) {
var latticeCode = JS.HallTranslation.getLatticeCode (latticeParameter);
var isCentrosymmetric = (latticeParameter > 0);
return (isCentrosymmetric ? "-" : "") + latticeCode + " 1";
}, "~N");
c$.getLatticeIndex = Clazz_defineMethod (c$, "getLatticeIndex",
function (latt) {
for (var i = 1, ipt = 3; i <= JS.HallTranslation.nLatticeTypes; i++, ipt += 3) if (JS.HallTranslation.latticeTranslationData[ipt].charAt (0) == latt) return i;
return 0;
}, "~S");
c$.getLatticeCode = Clazz_defineMethod (c$, "getLatticeCode",
function (latt) {
if (latt < 0) latt = -latt;
return (latt == 0 ? '\0' : latt > JS.HallTranslation.nLatticeTypes ? JS.HallTranslation.getLatticeCode (JS.HallTranslation.getLatticeIndex (String.fromCharCode (latt))) : JS.HallTranslation.latticeTranslationData[latt * 3].charAt (0));
}, "~N");
c$.getLatticeDesignation = Clazz_defineMethod (c$, "getLatticeDesignation",
function (latt) {
var isCentrosymmetric = (latt > 0);
var str = (isCentrosymmetric ? "-" : "");
if (latt < 0) latt = -latt;
if (latt == 0 || latt > JS.HallTranslation.nLatticeTypes) return "";
return str + JS.HallTranslation.getLatticeCode (latt) + ": " + (isCentrosymmetric ? "centrosymmetric " : "") + JS.HallTranslation.latticeTranslationData[latt * 3 + 1];
}, "~N");
c$.getLatticeDesignation2 = Clazz_defineMethod (c$, "getLatticeDesignation2",
function (latticeCode, isCentrosymmetric) {
var latt = JS.HallTranslation.getLatticeIndex (latticeCode);
if (!isCentrosymmetric) latt = -latt;
return JS.HallTranslation.getLatticeDesignation (latt);
}, "~S,~B");
c$.getLatticeExtension = Clazz_defineMethod (c$, "getLatticeExtension",
function (latt, isCentrosymmetric) {
for (var i = 1, ipt = 3; i <= JS.HallTranslation.nLatticeTypes; i++, ipt += 3) if (JS.HallTranslation.latticeTranslationData[ipt].charAt (0) == latt) return JS.HallTranslation.latticeTranslationData[ipt + 2] + (isCentrosymmetric ? " -1" : "");
return "";
}, "~S,~B");
c$.getHallTerms = Clazz_defineMethod (c$, "getHallTerms",
function () {
return (JS.HallTranslation.hallTranslationTerms == null ? JS.HallTranslation.hallTranslationTerms = Clazz_newArray (-1, [ new JS.HallTranslation ('a', JU.P3i.new3 (6, 0, 0)), new JS.HallTranslation ('b', JU.P3i.new3 (0, 6, 0)), new JS.HallTranslation ('c', JU.P3i.new3 (0, 0, 6)), new JS.HallTranslation ('n', JU.P3i.new3 (6, 6, 6)), new JS.HallTranslation ('u', JU.P3i.new3 (3, 0, 0)), new JS.HallTranslation ('v', JU.P3i.new3 (0, 3, 0)), new JS.HallTranslation ('w', JU.P3i.new3 (0, 0, 3)), new JS.HallTranslation ('d', JU.P3i.new3 (3, 3, 3)), new JS.HallTranslation ('1', JU.P3i.new3 (2, 6, -1)), new JS.HallTranslation ('1', JU.P3i.new3 (3, 4, -1)), new JS.HallTranslation ('2', JU.P3i.new3 (3, 8, -1)), new JS.HallTranslation ('1', JU.P3i.new3 (4, 3, -1)), new JS.HallTranslation ('3', JU.P3i.new3 (4, 9, -1)), new JS.HallTranslation ('1', JU.P3i.new3 (6, 2, -1)), new JS.HallTranslation ('2', JU.P3i.new3 (6, 4, -1)), new JS.HallTranslation ('4', JU.P3i.new3 (6, 8, -1)), new JS.HallTranslation ('5', JU.P3i.new3 (6, 10, -1)), new JS.HallTranslation ('r', JU.P3i.new3 (4, 8, 8)), new JS.HallTranslation ('s', JU.P3i.new3 (8, 8, 4)), new JS.HallTranslation ('t', JU.P3i.new3 (8, 4, 8))]) : JS.HallTranslation.hallTranslationTerms);
});
c$.getHallTranslation = Clazz_defineMethod (c$, "getHallTranslation",
function (translationCode, order) {
var ht = null;
for (var i = JS.HallTranslation.getHallTerms ().length; --i >= 0; ) {
var h = JS.HallTranslation.hallTranslationTerms[i];
if (h.translationCode == translationCode) {
if (h.rotationOrder == 0 || h.rotationOrder == order) {
ht = new JS.HallTranslation (translationCode, null);
ht.translationCode = translationCode;
ht.rotationShift12ths = h.rotationShift12ths;
ht.vectorShift12ths = h.vectorShift12ths;
return ht;
}}}
return ht;
}, "~S,~N");
Clazz_defineStatics (c$,
"latticeTranslationData", Clazz_newArray (-1, ["\0", "unknown", "", "P", "primitive", "", "I", "body-centered", " 1n", "R", "rhombohedral", " 1r 1r", "F", "face-centered", " 1ab 1bc 1ac", "A", "A-centered", " 1bc", "B", "B-centered", " 1ac", "C", "C-centered", " 1ab", "S", "rhombohedral(S)", " 1s 1s", "T", "rhombohedral(T)", " 1t 1t"]));
c$.nLatticeTypes = c$.prototype.nLatticeTypes = Clazz_doubleToInt (JS.HallTranslation.latticeTranslationData.length / 3) - 1;
Clazz_defineStatics (c$,
"hallTranslationTerms", null);
});
Clazz_declarePackage ("JS");
Clazz_load (["JU.M4"], "JS.SymmetryOperation", ["java.lang.Float", "JU.Matrix", "$.P3", "$.PT", "$.SB", "$.V3", "JU.Logger", "$.Parser"], function () {
c$ = Clazz_decorateAsClass (function () {
this.xyzOriginal = null;
this.xyz = null;
this.doNormalize = true;
this.isFinalized = false;
this.opId = 0;
this.centering = null;
this.atomTest = null;
this.myLabels = null;
this.modDim = 0;
this.linearRotTrans = null;
this.rsvs = null;
this.isBio = false;
this.sigma = null;
this.index = 0;
this.subsystemCode = null;
this.timeReversal = 0;
this.unCentered = false;
this.isCenteringOp = false;
this.magOp = 3.4028235E38;
Clazz_instantialize (this, arguments);
}, JS, "SymmetryOperation", JU.M4);
Clazz_defineMethod (c$, "setSigma",
function (subsystemCode, sigma) {
this.subsystemCode = subsystemCode;
this.sigma = sigma;
}, "~S,JU.Matrix");
Clazz_overrideConstructor (c$,
function (op, atoms, atomIndex, countOrId, doNormalize) {
this.doNormalize = doNormalize;
if (op == null) {
this.opId = countOrId;
return;
}this.xyzOriginal = op.xyzOriginal;
this.xyz = op.xyz;
this.opId = op.opId;
this.modDim = op.modDim;
this.myLabels = op.myLabels;
this.index = op.index;
this.linearRotTrans = op.linearRotTrans;
this.sigma = op.sigma;
this.subsystemCode = op.subsystemCode;
this.timeReversal = op.timeReversal;
this.setMatrix (false);
if (!op.isFinalized) this.doFinalize ();
if (doNormalize && this.sigma == null) this.setOffset (atoms, atomIndex, countOrId);
}, "JS.SymmetryOperation,~A,~N,~N,~B");
Clazz_defineMethod (c$, "setGamma",
function (isReverse) {
var n = 3 + this.modDim;
var a = (this.rsvs = new JU.Matrix (null, n + 1, n + 1)).getArray ();
var t = Clazz_newDoubleArray (n, 0);
var pt = 0;
for (var i = 0; i < n; i++) {
for (var j = 0; j < n; j++) a[i][j] = this.linearRotTrans[pt++];
t[i] = (isReverse ? -1 : 1) * this.linearRotTrans[pt++];
}
a[n][n] = 1;
if (isReverse) this.rsvs = this.rsvs.inverse ();
for (var i = 0; i < n; i++) a[i][n] = t[i];
a = this.rsvs.getSubmatrix (0, 0, 3, 3).getArray ();
for (var i = 0; i < 3; i++) for (var j = 0; j < 4; j++) this.setElement (i, j, (j < 3 ? a[i][j] : t[i]));
this.setElement (3, 3, 1);
}, "~B");
Clazz_defineMethod (c$, "doFinalize",
function () {
this.m03 /= 12;
this.m13 /= 12;
this.m23 /= 12;
if (this.modDim > 0) {
var a = this.rsvs.getArray ();
for (var i = a.length - 1; --i >= 0; ) a[i][3 + this.modDim] /= 12;
}this.isFinalized = true;
});
Clazz_defineMethod (c$, "getXyz",
function (normalized) {
return (normalized && this.modDim == 0 || this.xyzOriginal == null ? this.xyz : this.xyzOriginal);
}, "~B");
Clazz_defineMethod (c$, "newPoint",
function (atom1, atom2, x, y, z) {
this.rotTrans2 (atom1, atom2);
atom2.add3 (x, y, z);
}, "JU.P3,JU.P3,~N,~N,~N");
Clazz_defineMethod (c$, "dumpInfo",
function () {
return "\n" + this.xyz + "\ninternal matrix representation:\n" + this.toString ();
});
c$.dumpSeitz = Clazz_defineMethod (c$, "dumpSeitz",
function (s, isCanonical) {
var sb = new JU.SB ();
var r = Clazz_newFloatArray (4, 0);
for (var i = 0; i < 3; i++) {
s.getRow (i, r);
sb.append ("[\t");
for (var j = 0; j < 3; j++) sb.appendI (Clazz_floatToInt (r[j])).append ("\t");
sb.append (JS.SymmetryOperation.twelfthsOf (isCanonical ? (Clazz_floatToInt (r[3]) + 12) % 12 : Clazz_floatToInt (r[3]))).append ("\t]\n");
}
return sb.toString ();
}, "JU.M4,~B");
Clazz_defineMethod (c$, "setMatrixFromXYZ",
function (xyz, modDim, allowScaling) {
if (xyz == null) return false;
this.xyzOriginal = xyz;
xyz = xyz.toLowerCase ();
this.setModDim (modDim);
var isReverse = (xyz.startsWith ("!"));
if (isReverse) xyz = xyz.substring (1);
if (xyz.indexOf ("xyz matrix:") == 0) {
this.xyz = xyz;
JU.Parser.parseStringInfestedFloatArray (xyz, null, this.linearRotTrans);
return this.setFromMatrix (null, isReverse);
}if (xyz.indexOf ("[[") == 0) {
xyz = xyz.$replace ('[', ' ').$replace (']', ' ').$replace (',', ' ');
JU.Parser.parseStringInfestedFloatArray (xyz, null, this.linearRotTrans);
for (var i = this.linearRotTrans.length; --i >= 0; ) if (Float.isNaN (this.linearRotTrans[i])) return false;
this.setMatrix (isReverse);
this.isFinalized = true;
this.isBio = (xyz.indexOf ("bio") >= 0);
this.xyz = (this.isBio ? this.toString () : JS.SymmetryOperation.getXYZFromMatrix (this, false, false, false));
return true;
}if (modDim == 0 && xyz.indexOf ("x4") >= 0) {
for (var i = 14; --i >= 4; ) {
if (xyz.indexOf ("x" + i) >= 0) {
this.setModDim (i - 3);
break;
}}
}if (xyz.endsWith ("m")) {
this.timeReversal = (xyz.indexOf ("-m") >= 0 ? -1 : 1);
allowScaling = true;
}var strOut = JS.SymmetryOperation.getMatrixFromString (this, xyz, this.linearRotTrans, allowScaling);
if (strOut == null) return false;
this.setMatrix (isReverse);
this.xyz = (isReverse ? JS.SymmetryOperation.getXYZFromMatrix (this, true, false, false) : strOut);
if (this.timeReversal != 0) this.xyz += (this.timeReversal == 1 ? ",m" : ",-m");
if (JU.Logger.debugging) JU.Logger.debug ("" + this);
return true;
}, "~S,~N,~B");
Clazz_defineMethod (c$, "setModDim",
function (dim) {
var n = (dim + 4) * (dim + 4);
this.modDim = dim;
if (dim > 0) this.myLabels = JS.SymmetryOperation.labelsXn;
this.linearRotTrans = Clazz_newFloatArray (n, 0);
}, "~N");
Clazz_defineMethod (c$, "setMatrix",
function (isReverse) {
if (this.linearRotTrans.length > 16) {
this.setGamma (isReverse);
} else {
this.setA (this.linearRotTrans);
if (isReverse) {
var p3 = JU.P3.new3 (this.m03, this.m13, this.m23);
this.invert ();
this.rotate (p3);
p3.scale (-1);
this.setTranslation (p3);
}}}, "~B");
Clazz_defineMethod (c$, "setFromMatrix",
function (offset, isReverse) {
var v = 0;
var pt = 0;
this.myLabels = (this.modDim == 0 ? JS.SymmetryOperation.labelsXYZ : JS.SymmetryOperation.labelsXn);
var rowPt = 0;
var n = 3 + this.modDim;
for (var i = 0; rowPt < n; i++) {
if (Float.isNaN (this.linearRotTrans[i])) return false;
v = this.linearRotTrans[i];
if (Math.abs (v) < 0.00001) v = 0;
var isTrans = ((i + 1) % (n + 1) == 0);
if (isTrans) {
if (offset != null) {
v /= 12;
if (pt < offset.length) v += offset[pt++];
}v = JS.SymmetryOperation.normalizeTwelfths ((v < 0 ? -1 : 1) * Math.abs (v * 12) / 12, this.doNormalize);
rowPt++;
}this.linearRotTrans[i] = v;
}
this.linearRotTrans[this.linearRotTrans.length - 1] = 1;
this.setMatrix (isReverse);
this.isFinalized = (offset == null);
this.xyz = JS.SymmetryOperation.getXYZFromMatrix (this, true, false, false);
return true;
}, "~A,~B");
c$.getMatrixFromString = Clazz_defineMethod (c$, "getMatrixFromString",
function (op, xyz, linearRotTrans, allowScaling) {
var isDenominator = false;
var isDecimal = false;
var isNegative = false;
var modDim = (op == null ? 0 : op.modDim);
var nRows = 4 + modDim;
var doNormalize = (op != null && op.doNormalize);
var dimOffset = (modDim > 0 ? 3 : 0);
linearRotTrans[linearRotTrans.length - 1] = 1;
var transPt = xyz.indexOf (';') + 1;
if (transPt != 0) {
allowScaling = true;
if (transPt == xyz.length) xyz += "0,0,0";
}var rotPt = -1;
var myLabels = (op == null || modDim == 0 ? null : op.myLabels);
if (myLabels == null) myLabels = JS.SymmetryOperation.labelsXYZ;
xyz = xyz.toLowerCase () + ",";
if (modDim > 0) xyz = JS.SymmetryOperation.replaceXn (xyz, modDim + 3);
var xpt = 0;
var tpt0 = 0;
var rowPt = 0;
var ch;
var iValue = 0;
var decimalMultiplier = 1;
var strT = "";
var strOut = "";
for (var i = 0; i < xyz.length; i++) {
switch (ch = xyz.charAt (i)) {
case ';':
break;
case '\'':
case ' ':
case '{':
case '}':
case '!':
continue;
case '-':
isNegative = true;
continue;
case '+':
isNegative = false;
continue;
case '/':
isDenominator = true;
continue;
case 'x':
case 'y':
case 'z':
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
case 'g':
case 'h':
tpt0 = rowPt * nRows;
var ipt = (ch >= 'x' ? ch.charCodeAt (0) - 120 : ch.charCodeAt (0) - 97 + dimOffset);
xpt = tpt0 + ipt;
var val = (isNegative ? -1 : 1);
if (allowScaling && iValue != 0) {
linearRotTrans[xpt] = iValue;
val = Clazz_floatToInt (iValue);
iValue = 0;
} else {
linearRotTrans[xpt] = val;
}strT += JS.SymmetryOperation.plusMinus (strT, val, myLabels[ipt]);
break;
case ',':
if (transPt != 0) {
if (transPt > 0) {
rotPt = i;
i = transPt - 1;
transPt = -i;
iValue = 0;
continue;
}transPt = i + 1;
i = rotPt;
}iValue = JS.SymmetryOperation.normalizeTwelfths (iValue, doNormalize);
linearRotTrans[tpt0 + nRows - 1] = iValue;
strT += JS.SymmetryOperation.xyzFraction (iValue, false, true);
strOut += (strOut === "" ? "" : ",") + strT;
if (rowPt == nRows - 2) return strOut;
iValue = 0;
strT = "";
if (rowPt++ > 2 && modDim == 0) {
JU.Logger.warn ("Symmetry Operation? " + xyz);
return null;
}break;
case '.':
isDecimal = true;
decimalMultiplier = 1;
continue;
case '0':
if (!isDecimal && (isDenominator || !allowScaling)) continue;
default:
var ich = ch.charCodeAt (0) - 48;
if (isDecimal && ich >= 0 && ich <= 9) {
decimalMultiplier /= 10;
if (iValue < 0) isNegative = true;
iValue += decimalMultiplier * ich * (isNegative ? -1 : 1);
continue;
}if (ich >= 0 && ich <= 9) {
if (isDenominator) {
if (iValue == 0) {
linearRotTrans[xpt] /= ich;
} else {
iValue /= ich;
}} else {
iValue = iValue * 10 + (isNegative ? -1 : 1) * ich;
isNegative = false;
}} else {
JU.Logger.warn ("symmetry character?" + ch);
}}
isDecimal = isDenominator = isNegative = false;
}
return null;
}, "JS.SymmetryOperation,~S,~A,~B");
c$.replaceXn = Clazz_defineMethod (c$, "replaceXn",
function (xyz, n) {
for (var i = n; --i >= 0; ) xyz = JU.PT.rep (xyz, JS.SymmetryOperation.labelsXn[i], JS.SymmetryOperation.labelsXnSub[i]);
return xyz;
}, "~S,~N");
c$.xyzFraction = Clazz_defineMethod (c$, "xyzFraction",
function (n12ths, allPositive, halfOrLess) {
var n = n12ths;
if (allPositive) {
while (n < 0) n += 12;
} else if (halfOrLess) {
while (n > 6) n -= 12;
while (n < -6.0) n += 12;
}var s = JS.SymmetryOperation.twelfthsOf (n);
return (s.charAt (0) == '0' ? "" : n > 0 ? "+" + s : s);
}, "~N,~B,~B");
c$.twelfthsOf = Clazz_defineMethod (c$, "twelfthsOf",
function (n12ths) {
var str = "";
if (n12ths < 0) {
n12ths = -n12ths;
str = "-";
}var m = 12;
var n = Math.round (n12ths);
if (Math.abs (n - n12ths) > 0.01) {
var f = n12ths / 12;
var max = 20;
for (m = 5; m < max; m++) {
var fm = f * m;
n = Math.round (fm);
if (Math.abs (n - fm) < 0.01) break;
}
if (m == max) return str + f;
} else {
if (n == 12) return str + "1";
if (n < 12) return str + JS.SymmetryOperation.twelfths[n % 12];
switch (n % 12) {
case 0:
return "" + Clazz_doubleToInt (n / 12);
case 2:
case 10:
m = 6;
break;
case 3:
case 9:
m = 4;
break;
case 4:
case 8:
m = 3;
break;
case 6:
m = 2;
break;
default:
break;
}
n = (Clazz_doubleToInt (n * m / 12));
}return str + n + "/" + m;
}, "~N");
c$.plusMinus = Clazz_defineMethod (c$, "plusMinus",
function (strT, x, sx) {
return (x == 0 ? "" : (x < 0 ? "-" : strT.length == 0 ? "" : "+") + (x == 1 || x == -1 ? "" : "" + Clazz_floatToInt (Math.abs (x))) + sx);
}, "~S,~N,~S");
c$.normalizeTwelfths = Clazz_defineMethod (c$, "normalizeTwelfths",
function (iValue, doNormalize) {
iValue *= 12;
if (doNormalize) {
while (iValue > 6) iValue -= 12;
while (iValue <= -6) iValue += 12;
}return iValue;
}, "~N,~B");
c$.getXYZFromMatrix = Clazz_defineMethod (c$, "getXYZFromMatrix",
function (mat, is12ths, allPositive, halfOrLess) {
var str = "";
var op = (Clazz_instanceOf (mat, JS.SymmetryOperation) ? mat : null);
if (op != null && op.modDim > 0) return JS.SymmetryOperation.getXYZFromRsVs (op.rsvs.getRotation (), op.rsvs.getTranslation (), is12ths);
var row = Clazz_newFloatArray (4, 0);
for (var i = 0; i < 3; i++) {
var lpt = (i < 3 ? 0 : 3);
mat.getRow (i, row);
var term = "";
for (var j = 0; j < 3; j++) if (row[j] != 0) term += JS.SymmetryOperation.plusMinus (term, row[j], JS.SymmetryOperation.labelsXYZ[j + lpt]);
term += JS.SymmetryOperation.xyzFraction ((is12ths ? row[3] : row[3] * 12), allPositive, halfOrLess);
str += "," + term;
}
return str.substring (1);
}, "JU.M4,~B,~B,~B");
Clazz_defineMethod (c$, "setOffset",
function (atoms, atomIndex, count) {
var i1 = atomIndex;
var i2 = i1 + count;
var x = 0;
var y = 0;
var z = 0;
if (this.atomTest == null) this.atomTest = new JU.P3 ();
for (var i = i1; i < i2; i++) {
this.newPoint (atoms[i], this.atomTest, 0, 0, 0);
x += this.atomTest.x;
y += this.atomTest.y;
z += this.atomTest.z;
}
while (x < -0.001 || x >= count + 0.001) {
this.m03 += (x < 0 ? 1 : -1);
x += (x < 0 ? count : -count);
}
while (y < -0.001 || y >= count + 0.001) {
this.m13 += (y < 0 ? 1 : -1);
y += (y < 0 ? count : -count);
}
while (z < -0.001 || z >= count + 0.001) {
this.m23 += (z < 0 ? 1 : -1);
z += (z < 0 ? count : -count);
}
}, "~A,~N,~N");
Clazz_defineMethod (c$, "rotateAxes",
function (vectors, unitcell, ptTemp, mTemp) {
var vRot = new Array (3);
this.getRotationScale (mTemp);
for (var i = vectors.length; --i >= 0; ) {
ptTemp.setT (vectors[i]);
unitcell.toFractional (ptTemp, true);
mTemp.rotate (ptTemp);
unitcell.toCartesian (ptTemp, true);
vRot[i] = JU.V3.newV (ptTemp);
}
return vRot;
}, "~A,JS.UnitCell,JU.P3,JU.M3");
c$.fcoord = Clazz_defineMethod (c$, "fcoord",
function (p) {
return JS.SymmetryOperation.fc (p.x) + " " + JS.SymmetryOperation.fc (p.y) + " " + JS.SymmetryOperation.fc (p.z);
}, "JU.T3");
c$.fc = Clazz_defineMethod (c$, "fc",
function (x) {
var xabs = Math.abs (x);
var x24 = Clazz_floatToInt (JS.SymmetryOperation.approxF (xabs * 24));
var m = (x < 0 ? "-" : "");
if (x24 % 8 != 0) return m + JS.SymmetryOperation.twelfthsOf (x24 >> 1);
return (x24 == 0 ? "0" : x24 == 24 ? m + "1" : m + (Clazz_doubleToInt (x24 / 8)) + "/3");
}, "~N");
c$.approxF = Clazz_defineMethod (c$, "approxF",
function (f) {
return JU.PT.approx (f, 100);
}, "~N");
c$.normalizeTranslation = Clazz_defineMethod (c$, "normalizeTranslation",
function (operation) {
operation.m03 = (Clazz_floatToInt (operation.m03) + 12) % 12;
operation.m13 = (Clazz_floatToInt (operation.m13) + 12) % 12;
operation.m23 = (Clazz_floatToInt (operation.m23) + 12) % 12;
}, "JU.M4");
c$.getXYZFromRsVs = Clazz_defineMethod (c$, "getXYZFromRsVs",
function (rs, vs, is12ths) {
var ra = rs.getArray ();
var va = vs.getArray ();
var d = ra.length;
var s = "";
for (var i = 0; i < d; i++) {
s += ",";
for (var j = 0; j < d; j++) {
var r = ra[i][j];
if (r != 0) {
s += (r < 0 ? "-" : s.endsWith (",") ? "" : "+") + (Math.abs (r) == 1 ? "" : "" + Clazz_doubleToInt (Math.abs (r))) + "x" + (j + 1);
}}
s += JS.SymmetryOperation.xyzFraction (Clazz_doubleToInt (va[i][0] * (is12ths ? 1 : 12)), false, true);
}
return JU.PT.rep (s.substring (1), ",+", ",");
}, "JU.Matrix,JU.Matrix,~B");
Clazz_defineMethod (c$, "toString",
function () {
return (this.rsvs == null ? Clazz_superCall (this, JS.SymmetryOperation, "toString", []) : Clazz_superCall (this, JS.SymmetryOperation, "toString", []) + " " + this.rsvs.toString ());
});
Clazz_defineMethod (c$, "getSpinOp",
function () {
if (this.magOp == 3.4028235E38) this.magOp = this.determinant3 () * this.timeReversal;
return this.magOp;
});
Clazz_defineMethod (c$, "setTimeReversal",
function (magRev) {
this.timeReversal = magRev;
if (this.xyz.indexOf ("m") >= 0) this.xyz = this.xyz.substring (0, this.xyz.indexOf ("m"));
this.xyz += (magRev == 1 ? ",m" : magRev == -1 ? ",-m" : "");
}, "~N");
c$.getPrettyMatrix = Clazz_defineMethod (c$, "getPrettyMatrix",
function (sb, m4) {
sb.append ("[ ");
var row = Clazz_newFloatArray (4, 0);
for (var i = 0; i < 3; i++) {
m4.getRow (i, row);
sb.append ("[ ").appendI (Clazz_floatToInt (row[0])).appendC (' ').appendI (Clazz_floatToInt (row[1])).appendC (' ').appendI (Clazz_floatToInt (row[2])).appendC (' ');
sb.append (JS.SymmetryOperation.twelfthsOf (row[3] * 12)).append (" ]");
}
return sb.append (" ]").toString ();
}, "JU.SB,JU.M4");
Clazz_defineMethod (c$, "setCentering",
function (c, isFinal) {
if (this.centering == null && !this.unCentered) {
if (this.modDim == 0 && this.index > 1 && this.m00 == 1 && this.m11 == 1 && this.m22 == 1 && this.m01 == 0 && this.m02 == 0 && this.m10 == 0 && this.m12 == 0 && this.m20 == 0 && this.m21 == 0) {
this.centering = JU.V3.new3 (this.m03, this.m13, this.m23);
if (this.centering.lengthSquared () == 0) {
this.unCentered = true;
this.centering = null;
} else if (!isFinal) this.centering.scale (0.083333336);
this.isCenteringOp = true;
} else {
this.centering = c;
}}return this.centering;
}, "JU.V3,~B");
Clazz_defineStatics (c$,
"twelfths", Clazz_newArray (-1, ["0", "1/12", "1/6", "1/4", "1/3", "5/12", "1/2", "7/12", "2/3", "3/4", "5/6", "11/12"]));
c$.labelsXYZ = c$.prototype.labelsXYZ = Clazz_newArray (-1, ["x", "y", "z"]);
c$.labelsXn = c$.prototype.labelsXn = Clazz_newArray (-1, ["x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10", "x11", "x12", "x13"]);
c$.labelsXnSub = c$.prototype.labelsXnSub = Clazz_newArray (-1, ["x", "y", "z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]);
});
Clazz_declarePackage ("JS");
Clazz_load (null, "JS.SymmetryInfo", ["JU.Lst", "$.PT", "JU.SimpleUnitCell"], function () {
c$ = Clazz_decorateAsClass (function () {
this.coordinatesAreFractional = false;
this.isMultiCell = false;
this.sgName = null;
this.symmetryOperations = null;
this.infoStr = null;
this.cellRange = null;
this.periodicOriginXyz = null;
this.centerings = null;
Clazz_instantialize (this, arguments);
}, JS, "SymmetryInfo");
Clazz_defineMethod (c$, "isPeriodic",
function () {
return this.periodicOriginXyz != null;
});
Clazz_makeConstructor (c$,
function () {
});
Clazz_defineMethod (c$, "setSymmetryInfo",
function (info, unitCellParams) {
this.cellRange = info.get ("unitCellRange");
this.periodicOriginXyz = info.get ("periodicOriginXyz");
this.sgName = info.get ("spaceGroup");
if (this.sgName == null || this.sgName === "") this.sgName = "spacegroup unspecified";
var symmetryCount = info.containsKey ("symmetryCount") ? (info.get ("symmetryCount")).intValue () : 0;
this.symmetryOperations = info.remove ("symmetryOps");
this.infoStr = "Spacegroup: " + this.sgName;
if (this.symmetryOperations == null) {
this.infoStr += "\nNumber of symmetry operations: ?\nSymmetry Operations: unspecified\n";
} else {
this.centerings = new JU.Lst ();
var c = "";
var s = "\nNumber of symmetry operations: " + (symmetryCount == 0 ? 1 : symmetryCount) + "\nSymmetry Operations:";
for (var i = 0; i < symmetryCount; i++) {
var op = this.symmetryOperations[i];
s += "\n" + op.xyz;
if (op.isCenteringOp) {
this.centerings.addLast (op.centering);
var oc = JU.PT.replaceAllCharacters (op.xyz, "xyz", "0");
c += " (" + JU.PT.rep (oc, "0+", "") + ")";
}}
if (c.length > 0) this.infoStr += "\nCentering: " + c;
this.infoStr += s;
}this.infoStr += "\n";
if (unitCellParams == null) unitCellParams = info.get ("unitCellParams");
if (!JU.SimpleUnitCell.isValid (unitCellParams)) return null;
this.coordinatesAreFractional = info.containsKey ("coordinatesAreFractional") ? (info.get ("coordinatesAreFractional")).booleanValue () : false;
this.isMultiCell = (this.coordinatesAreFractional && this.symmetryOperations != null);
return unitCellParams;
}, "java.util.Map,~A");
});
Clazz_declarePackage ("JS");
Clazz_load (["JU.SimpleUnitCell", "JU.P3", "JV.JC"], "JS.UnitCell", ["java.lang.Float", "JU.M4", "$.Quat", "$.T4", "$.V3", "J.api.Interface", "JU.BoxInfo", "$.Escape"], function () {
c$ = Clazz_decorateAsClass (function () {
this.vertices = null;
this.cartesianOffset = null;
this.fractionalOffset = null;
this.allFractionalRelative = false;
this.unitCellMultiplier = null;
this.moreInfo = null;
this.name = "";
Clazz_instantialize (this, arguments);
}, JS, "UnitCell", JU.SimpleUnitCell);
Clazz_prepareFields (c$, function () {
this.cartesianOffset = new JU.P3 ();
});
c$.newP = Clazz_defineMethod (c$, "newP",
function (points, setRelative) {
var c = new JS.UnitCell ();
var parameters = Clazz_newFloatArray (-1, [-1, 0, 0, 0, 0, 0, points[1].x, points[1].y, points[1].z, points[2].x, points[2].y, points[2].z, points[3].x, points[3].y, points[3].z]);
c.init (parameters);
c.allFractionalRelative = setRelative;
c.initUnitcellVertices ();
c.setCartesianOffset (points[0]);
return c;
}, "~A,~B");
c$.newA = Clazz_defineMethod (c$, "newA",
function (params, setRelative) {
var c = new JS.UnitCell ();
c.init (params);
c.initUnitcellVertices ();
c.allFractionalRelative = setRelative;
return c;
}, "~A,~B");
Clazz_defineMethod (c$, "initOrientation",
function (mat) {
if (mat == null) return;
var m = new JU.M4 ();
m.setToM3 (mat);
this.matrixFractionalToCartesian.mul2 (m, this.matrixFractionalToCartesian);
this.matrixCartesianToFractional.setM4 (this.matrixFractionalToCartesian).invert ();
this.initUnitcellVertices ();
}, "JU.M3");
Clazz_defineMethod (c$, "toUnitCell",
function (pt, offset) {
if (this.matrixCartesianToFractional == null) return;
if (offset == null) {
this.matrixCartesianToFractional.rotTrans (pt);
this.unitize (pt);
this.matrixFractionalToCartesian.rotTrans (pt);
} else {
this.matrixCtoFANoOffset.rotTrans (pt);
this.unitize (pt);
pt.add (offset);
this.matrixFtoCNoOffset.rotTrans (pt);
}}, "JU.P3,JU.P3");
Clazz_defineMethod (c$, "unitize",
function (pt) {
switch (this.dimension) {
case 3:
pt.z = JS.UnitCell.toFractionalX (pt.z);
case 2:
pt.y = JS.UnitCell.toFractionalX (pt.y);
case 1:
pt.x = JS.UnitCell.toFractionalX (pt.x);
}
}, "JU.P3");
Clazz_defineMethod (c$, "reset",
function () {
this.unitCellMultiplier = null;
this.setOffset (JU.P3.new3 (0, 0, 0));
});
Clazz_defineMethod (c$, "setOffset",
function (pt) {
if (pt == null) return;
var pt4 = (Clazz_instanceOf (pt, JU.T4) ? pt : null);
if (pt4 != null ? pt4.w <= 0 : pt.x >= 100 || pt.y >= 100) {
this.unitCellMultiplier = (pt.z == 0 && pt.x == pt.y ? null : JU.P3.newP (pt));
if (pt4 == null || pt4.w == 0) return;
}if (this.hasOffset () || pt.lengthSquared () > 0) {
this.fractionalOffset = new JU.P3 ();
this.fractionalOffset.setT (pt);
}this.matrixCartesianToFractional.m03 = -pt.x;
this.matrixCartesianToFractional.m13 = -pt.y;
this.matrixCartesianToFractional.m23 = -pt.z;
this.cartesianOffset.setT (pt);
this.matrixFractionalToCartesian.m03 = 0;
this.matrixFractionalToCartesian.m13 = 0;
this.matrixFractionalToCartesian.m23 = 0;
this.matrixFractionalToCartesian.rotTrans (this.cartesianOffset);
this.matrixFractionalToCartesian.m03 = this.cartesianOffset.x;
this.matrixFractionalToCartesian.m13 = this.cartesianOffset.y;
this.matrixFractionalToCartesian.m23 = this.cartesianOffset.z;
if (this.allFractionalRelative) {
this.matrixCtoFANoOffset.setM4 (this.matrixCartesianToFractional);
this.matrixFtoCNoOffset.setM4 (this.matrixFractionalToCartesian);
}}, "JU.T3");
Clazz_defineMethod (c$, "setCartesianOffset",
function (origin) {
this.cartesianOffset.setT (origin);
this.matrixFractionalToCartesian.m03 = this.cartesianOffset.x;
this.matrixFractionalToCartesian.m13 = this.cartesianOffset.y;
this.matrixFractionalToCartesian.m23 = this.cartesianOffset.z;
var wasOffset = this.hasOffset ();
this.fractionalOffset = new JU.P3 ();
this.fractionalOffset.setT (this.cartesianOffset);
this.matrixCartesianToFractional.m03 = 0;
this.matrixCartesianToFractional.m13 = 0;
this.matrixCartesianToFractional.m23 = 0;
this.matrixCartesianToFractional.rotTrans (this.fractionalOffset);
this.matrixCartesianToFractional.m03 = -this.fractionalOffset.x;
this.matrixCartesianToFractional.m13 = -this.fractionalOffset.y;
this.matrixCartesianToFractional.m23 = -this.fractionalOffset.z;
if (this.allFractionalRelative) {
this.matrixCtoFANoOffset.setM4 (this.matrixCartesianToFractional);
this.matrixFtoCNoOffset.setM4 (this.matrixFractionalToCartesian);
}if (!wasOffset && this.fractionalOffset.lengthSquared () == 0) this.fractionalOffset = null;
}, "JU.T3");
Clazz_defineMethod (c$, "setMinMaxLatticeParameters",
function (minXYZ, maxXYZ) {
if (maxXYZ.x <= maxXYZ.y && maxXYZ.y >= 555) {
var pt = new JU.P3 ();
JU.SimpleUnitCell.ijkToPoint3f (maxXYZ.x, pt, 0);
minXYZ.x = Clazz_floatToInt (pt.x);
minXYZ.y = Clazz_floatToInt (pt.y);
minXYZ.z = Clazz_floatToInt (pt.z);
JU.SimpleUnitCell.ijkToPoint3f (maxXYZ.y, pt, 1);
maxXYZ.x = Clazz_floatToInt (pt.x);
maxXYZ.y = Clazz_floatToInt (pt.y);
maxXYZ.z = Clazz_floatToInt (pt.z);
}switch (this.dimension) {
case 1:
minXYZ.y = 0;
maxXYZ.y = 1;
case 2:
minXYZ.z = 0;
maxXYZ.z = 1;
}
}, "JU.P3i,JU.P3i");
Clazz_defineMethod (c$, "dumpInfo",
function (isFull) {
return "a=" + this.a + ", b=" + this.b + ", c=" + this.c + ", alpha=" + this.alpha + ", beta=" + this.beta + ", gamma=" + this.gamma + "\n" + JU.Escape.eAP (this.getUnitCellVectors ()) + "\nvolume=" + this.volume + (isFull ? "\nfractional to cartesian: " + this.matrixFractionalToCartesian + "\ncartesian to fractional: " + this.matrixCartesianToFractional : "");
}, "~B");
Clazz_defineMethod (c$, "getVertices",
function () {
return this.vertices;
});
Clazz_defineMethod (c$, "getCartesianOffset",
function () {
return this.cartesianOffset;
});
Clazz_defineMethod (c$, "getFractionalOffset",
function () {
return this.fractionalOffset;
});
Clazz_defineMethod (c$, "getTensor",
function (vwr, parBorU) {
var t = (J.api.Interface.getUtil ("Tensor", vwr, "file"));
if (parBorU[0] == 0 && parBorU[1] == 0 && parBorU[2] == 0) {
var f = parBorU[7];
var eigenValues = Clazz_newFloatArray (-1, [f, f, f]);
return t.setFromEigenVectors (JS.UnitCell.unitVectors, eigenValues, "iso", "Uiso=" + f, null);
}t.parBorU = parBorU;
var Bcart = Clazz_newDoubleArray (6, 0);
var ortepType = Clazz_floatToInt (parBorU[6]);
if (ortepType == 12) {
Bcart[0] = parBorU[0] * 19.739208802178716;
Bcart[1] = parBorU[1] * 19.739208802178716;
Bcart[2] = parBorU[2] * 19.739208802178716;
Bcart[3] = parBorU[3] * 19.739208802178716 * 2;
Bcart[4] = parBorU[4] * 19.739208802178716 * 2;
Bcart[5] = parBorU[5] * 19.739208802178716 * 2;
parBorU[7] = (parBorU[0] + parBorU[1] + parBorU[3]) / 3;
} else {
var isFractional = (ortepType == 4 || ortepType == 5 || ortepType == 8 || ortepType == 9);
var cc = 2 - (ortepType % 2);
var dd = (ortepType == 8 || ortepType == 9 || ortepType == 10 ? 19.739208802178716 : ortepType == 4 || ortepType == 5 ? 0.25 : ortepType == 2 || ortepType == 3 ? Math.log (2) : 1);
var B11 = parBorU[0] * dd * (isFractional ? this.a_ * this.a_ : 1);
var B22 = parBorU[1] * dd * (isFractional ? this.b_ * this.b_ : 1);
var B33 = parBorU[2] * dd * (isFractional ? this.c_ * this.c_ : 1);
var B12 = parBorU[3] * dd * (isFractional ? this.a_ * this.b_ : 1) * cc;
var B13 = parBorU[4] * dd * (isFractional ? this.a_ * this.c_ : 1) * cc;
var B23 = parBorU[5] * dd * (isFractional ? this.b_ * this.c_ : 1) * cc;
parBorU[7] = Math.pow (B11 / 19.739208802178716 / this.a_ / this.a_ * B22 / 19.739208802178716 / this.b_ / this.b_ * B33 / 19.739208802178716 / this.c_ / this.c_, 0.3333);
Bcart[0] = this.a * this.a * B11 + this.b * this.b * this.cosGamma * this.cosGamma * B22 + this.c * this.c * this.cosBeta * this.cosBeta * B33 + this.a * this.b * this.cosGamma * B12 + this.b * this.c * this.cosGamma * this.cosBeta * B23 + this.a * this.c * this.cosBeta * B13;
Bcart[1] = this.b * this.b * this.sinGamma * this.sinGamma * B22 + this.c * this.c * this.cA_ * this.cA_ * B33 + this.b * this.c * this.cA_ * this.sinGamma * B23;
Bcart[2] = this.c * this.c * this.cB_ * this.cB_ * B33;
Bcart[3] = 2 * this.b * this.b * this.cosGamma * this.sinGamma * B22 + 2 * this.c * this.c * this.cA_ * this.cosBeta * B33 + this.a * this.b * this.sinGamma * B12 + this.b * this.c * (this.cA_ * this.cosGamma + this.sinGamma * this.cosBeta) * B23 + this.a * this.c * this.cA_ * B13;
Bcart[4] = 2 * this.c * this.c * this.cB_ * this.cosBeta * B33 + this.b * this.c * this.cosGamma * B23 + this.a * this.c * this.cB_ * B13;
Bcart[5] = 2 * this.c * this.c * this.cA_ * this.cB_ * B33 + this.b * this.c * this.cB_ * this.sinGamma * B23;
}return t.setFromThermalEquation (Bcart, JU.Escape.eAF (parBorU));
}, "JV.Viewer,~A");
Clazz_defineMethod (c$, "getCanonicalCopy",
function (scale, withOffset) {
var pts = new Array (8);
var cell0 = null;
var cell1 = null;
if (withOffset && this.unitCellMultiplier != null) {
cell0 = new JU.P3 ();
cell1 = new JU.P3 ();
JU.SimpleUnitCell.ijkToPoint3f (Clazz_floatToInt (this.unitCellMultiplier.x), cell0, 0);
JU.SimpleUnitCell.ijkToPoint3f (Clazz_floatToInt (this.unitCellMultiplier.y), cell1, 0);
cell1.sub (cell0);
}for (var i = 0; i < 8; i++) {
var pt = pts[i] = JU.P3.newP (JU.BoxInfo.unitCubePoints[i]);
if (cell0 != null) {
scale *= (this.unitCellMultiplier.z == 0 ? 1 : this.unitCellMultiplier.z);
pts[i].add3 (cell0.x + cell1.x * pt.x, cell0.y + cell1.y * pt.y, cell0.z + cell1.z * pt.z);
}this.matrixFractionalToCartesian.rotTrans (pt);
if (!withOffset) pt.sub (this.cartesianOffset);
}
return JU.BoxInfo.getCanonicalCopy (pts, scale);
}, "~N,~B");
c$.toFractionalX = Clazz_defineMethod (c$, "toFractionalX",
function (x) {
x = (x - Math.floor (x));
if (x > 0.9999 || x < 0.0001) x = 0;
return x;
}, "~N");
Clazz_defineMethod (c$, "initUnitcellVertices",
function () {
if (this.matrixFractionalToCartesian == null) return;
this.matrixCtoFANoOffset = JU.M4.newM4 (this.matrixCartesianToFractional);
this.matrixFtoCNoOffset = JU.M4.newM4 (this.matrixFractionalToCartesian);
this.vertices = new Array (8);
for (var i = 8; --i >= 0; ) this.vertices[i] = this.matrixFractionalToCartesian.rotTrans2 (JU.BoxInfo.unitCubePoints[i], new JU.P3 ());
});
Clazz_defineMethod (c$, "checkDistance",
function (f1, f2, distance, dx, iRange, jRange, kRange, ptOffset) {
var p1 = JU.P3.newP (f1);
this.toCartesian (p1, true);
for (var i = -iRange; i <= iRange; i++) for (var j = -jRange; j <= jRange; j++) for (var k = -kRange; k <= kRange; k++) {
ptOffset.set (f2.x + i, f2.y + j, f2.z + k);
this.toCartesian (ptOffset, true);
var d = p1.distance (ptOffset);
if (dx > 0 ? Math.abs (d - distance) <= dx : d <= distance && d > 0.1) {
ptOffset.set (i, j, k);
return true;
}}
return false;
}, "JU.P3,JU.P3,~N,~N,~N,~N,~N,JU.P3");
Clazz_defineMethod (c$, "getUnitCellMultiplier",
function () {
return this.unitCellMultiplier;
});
Clazz_defineMethod (c$, "getUnitCellVectors",
function () {
var m = this.matrixFractionalToCartesian;
return Clazz_newArray (-1, [JU.P3.newP (this.cartesianOffset), JU.P3.new3 (this.fix (m.m00), this.fix (m.m10), this.fix (m.m20)), JU.P3.new3 (this.fix (m.m01), this.fix (m.m11), this.fix (m.m21)), JU.P3.new3 (this.fix (m.m02), this.fix (m.m12), this.fix (m.m22))]);
});
Clazz_defineMethod (c$, "fix",
function (x) {
return (Math.abs (x) < 0.001 ? 0 : x);
}, "~N");
Clazz_defineMethod (c$, "isSameAs",
function (uc) {
if (uc.unitCellParams.length != this.unitCellParams.length) return false;
for (var i = this.unitCellParams.length; --i >= 0; ) if (this.unitCellParams[i] != uc.unitCellParams[i] && !(Float.isNaN (this.unitCellParams[i]) && Float.isNaN (uc.unitCellParams[i]))) return false;
return (this.fractionalOffset == null ? !uc.hasOffset () : uc.fractionalOffset == null ? !this.hasOffset () : this.fractionalOffset.distanceSquared (uc.fractionalOffset) == 0);
}, "JS.UnitCell");
Clazz_defineMethod (c$, "hasOffset",
function () {
return (this.fractionalOffset != null && this.fractionalOffset.lengthSquared () != 0);
});
Clazz_defineMethod (c$, "getState",
function () {
var s = "";
if (this.fractionalOffset != null && this.fractionalOffset.lengthSquared () != 0) s += " unitcell offset " + JU.Escape.eP (this.fractionalOffset) + ";\n";
if (this.unitCellMultiplier != null) s += " unitcell range " + JU.Escape.eP (this.unitCellMultiplier) + ";\n";
return s;
});
Clazz_defineMethod (c$, "getQuaternionRotation",
function (abc) {
var a = JU.V3.newVsub (this.vertices[4], this.vertices[0]);
var b = JU.V3.newVsub (this.vertices[2], this.vertices[0]);
var c = JU.V3.newVsub (this.vertices[1], this.vertices[0]);
var x = new JU.V3 ();
var v = new JU.V3 ();
switch ("abc".indexOf (abc)) {
case 0:
x.cross (a, c);
v.cross (x, a);
break;
case 1:
x.cross (b, a);
v.cross (x, b);
break;
case 2:
x.cross (c, b);
v.cross (x, c);
break;
default:
return null;
}
return JU.Quat.getQuaternionFrame (null, v, x).inv ();
}, "~S");
Clazz_defineStatics (c$,
"twoP2", 19.739208802178716);
c$.unitVectors = c$.prototype.unitVectors = Clazz_newArray (-1, [JV.JC.axisX, JV.JC.axisY, JV.JC.axisZ]);
});
})(Clazz
,Clazz.newLongArray
,Clazz.doubleToByte
,Clazz.doubleToInt
,Clazz.doubleToLong
,Clazz.declarePackage
,Clazz.instanceOf
,Clazz.load
,Clazz.instantialize
,Clazz.decorateAsClass
,Clazz.floatToInt
,Clazz.floatToLong
,Clazz.makeConstructor
,Clazz.defineEnumConstant
,Clazz.exceptionOf
,Clazz.newIntArray
,Clazz.defineStatics
,Clazz.newFloatArray
,Clazz.declareType
,Clazz.prepareFields
,Clazz.superConstructor
,Clazz.newByteArray
,Clazz.declareInterface
,Clazz.p0p
,Clazz.pu$h
,Clazz.newShortArray
,Clazz.innerTypeInstance
,Clazz.isClassDefined
,Clazz.prepareCallback
,Clazz.newArray
,Clazz.castNullAs
,Clazz.floatToShort
,Clazz.superCall
,Clazz.decorateAsType
,Clazz.newBooleanArray
,Clazz.newCharArray
,Clazz.implementOf
,Clazz.newDoubleArray
,Clazz.overrideConstructor
,Clazz.clone
,Clazz.doubleToShort
,Clazz.getInheritedLevel
,Clazz.getParamsType
,Clazz.isAF
,Clazz.isAI
,Clazz.isAS
,Clazz.isASS
,Clazz.isAP
,Clazz.isAFloat
,Clazz.isAII
,Clazz.isAFF
,Clazz.isAFFF
,Clazz.tryToSearchAndExecute
,Clazz.getStackTrace
,Clazz.inheritArgs
,Clazz.alert
,Clazz.defineMethod
,Clazz.overrideMethod
,Clazz.declareAnonymous
//,Clazz.checkPrivateMethod
,Clazz.cloneFinals
);
|
import R from 'ramda'
import {
FETCH_CURRENT_USER_UPDATES_REQUEST
} from 'actions'
import {
getLastFetchAt
} from 'selectors'
export const
attachMinUpdatedAt = store => next => action => {
if (action.type == FETCH_CURRENT_USER_UPDATES_REQUEST){
const lastFetchAt = getLastFetchAt(store.getState()),
minUpdatedAt = R.path(["meta", "noMinUpdatedAt"], action) ? 1 : lastFetchAt
return next(R.assocPath(["payload", "minUpdatedAt"], minUpdatedAt, action))
}
return next(action)
} |
const Discord = require("discord.js");
module.exports = async (client, msg) => {
if (msg.author.bot) return;
if (!msg.guild) return;
let prefix;
if (msg.channel.type == "text") {
let gprefix = await client.db.fetch(`prefix_${msg.guild.id}`);
if (gprefix === null) gprefix = "s!";
prefix = gprefix;
} else {
prefix = `s!`;
}
client.prefix = prefix;
const prefixMention = new RegExp(`^<@!?${client.user.id}>( |)$`);
const embed = new Discord.MessageEmbed()
if (msg.content.match(prefixMention)) {
msg.channel.send({
embed: {
description: `**:wave:My prefix on this guild is** \`${client.prefix}\``,
color: `#00BFFF`
}
});
}
if (msg.content == `<@${client.user.id}>`) {
const embed = new Discord.MessageEmbed()
.setDescription(`**:wave: | My prefix is** \`${client.prefix}\``)
.setColor("#00BFFF")
.setFooter(`© ${client.user.usernme}`);
msg.channel.send(embed);
}
if (msg.content == client.prefix) {
const embed = new Discord.MessageEmbed()
.setDescription(
`**Hey, It's me!
You can type** \`${client.prefix}help\` **to get bot commands list**`
)
.setColor("#00BFFF")
.setFooter(`© ${client.user.username}`);
return msg.channel.send(embed);
}
let args = msg.content
.slice(client.prefix.length)
.trim()
.split(" ");
let cmd = args.shift().toLowerCase();
if (!msg.content.startsWith(client.prefix)) return;
try {
const file = client.commands.get(cmd) || client.aliases.get(cmd);
if (!file) return msg.reply("**❌Command that you want doesn't exist.**");
const now = Date.now();
if (client.db.has(`cooldown_${msg.author.id}`)) {
const expirationTime = client.db.get(`cooldown_${msg.author.id}`) + 3000;
if (now < expirationTime) {
const timeLeft = (expirationTime - now) / 1000;
return msg.reply(
`**please wait ${timeLeft.toFixed(
1
)} more second(s) before reusing the \`${file.name}\` command.**`
);
}
}
client.db.set(`cooldown_${msg.author.id}`, now);
setTimeout(() => {
client.db.delete(`cooldown_${msg.author.id}`);
}, 3000);
file.run(client, msg, args);
} catch (err) {
console.error(err);
} finally {
console.log(
`${msg.author.tag} using ${cmd} in ${msg.channel.name} | ${msg.guild.name}`
);
}
};
|
function ageDistance() {
var chart = nv.models.multiBarChart()
chart.stacked(true)
chart.reduceXTicks(false)
chart.yAxis.axisLabel('Average number of kilometres per day')
chart.yAxis.axisLabelDistance(-10);
chart.xAxis.axisLabel('age in years');
if ($(window).width() <=450) {
chart.staggerLabels(true);
};
;
d3.select('#chart svg').datum([
{
key: "Car (driver)",
color: "#fb6a4a",
values:
[
{x: "< 12", y: 0},
{x: "12 – 17", y: 0},
{x: "18 – 24", y: 12.23},
{x: "25 – 34", y: 23.07},
{x: "35 – 49", y: 25.59},
{x: "50 – 64", y: 21.51},
{x: "65 – 74", y: 12.38},
{x: "> 74", y: 5.19}
]
},
{
key: "Car (passenger)",
color: "#fc9272",
values:
[
{x: "< 12", y: 11.59},
{x: "12 – 17", y: 7.05},
{x: "18 – 24", y: 6.1},
{x: "25 – 34", y: 5.78},
{x: "35 – 49", y: 4.8},
{x: "50 – 64", y: 5},
{x: "65 – 74", y: 5.45},
{x: "> 74", y: 4.13}
]
},
{
key: "Moped",
color: "#fcbba1",
values:
[
{x: "< 12", y: 0},
{x: "12 – 17", y: 0.3},
{x: "18 – 24", y: 0.49},
{x: "25 – 34", y: 0},
{x: "35 – 49", y: 0.21},
{x: "50 – 64", y: 0.18},
{x: "65 – 74", y: 0},
{x: "> 74", y: 0}
]
},
{
key: "Train",
color: "#6baed6",
values:
[
{x: "< 12", y: 0},
{x: "12 – 17", y: 1.76},
{x: "18 – 24", y: 10.88},
{x: "25 – 34", y: 3.29},
{x: "35 – 49", y: 2.53},
{x: "50 – 64", y: 2.13},
{x: "65 – 74", y: 1.19},
{x: "> 74", y: 0}
]
},
{
key: "Bus/tram/metro",
color: "#9ecae1",
values:
[
{x: "< 12", y: 0.17},
{x: "12 – 17", y: 1.74},
{x: "18 – 24", y: 3.48},
{x: "25 – 34", y: 1.32},
{x: "35 – 49", y: 0.62},
{x: "50 – 64", y: 0.51},
{x: "65 – 74", y: 0.35},
{x: "> 74", y: 0.34}
]
},
{
key: "Bicycle",
color: "#74c476",
values:
[
{x: "< 12", y: 1.77},
{x: "12 – 17", y: 6.2},
{x: "18 – 24", y: 2.66},
{x: "25 – 34", y: 2.23},
{x: "35 – 49", y: 2.28},
{x: "50 – 64", y: 2.56},
{x: "65 – 74", y: 2.58},
{x: "> 74", y: 1.37}
]
},
{
key: "Walking",
color: "#a1d99b",
values:
[
{x: "< 12", y: 0.83},
{x: "12 – 17", y: 0.6},
{x: "18 – 24", y: 0.75},
{x: "25 – 34", y: 0.79},
{x: "35 – 49", y: 0.81},
{x: "50 – 64", y: 0.89},
{x: "65 – 74", y: 0.95},
{x: "> 74", y: 0.69}
]
},
{
key: "Other",
color: "#bcbddc",
values:
[
{x: "< 12", y: 0.67},
{x: "12 – 17", y: 0.97},
{x: "18 – 24", y: 0},
{x: "25 – 34", y: 1},
{x: "35 – 49", y: 1.26},
{x: "50 – 64", y: 1.1},
{x: "65 – 74", y: 0.62},
{x: "> 74", y: 0.58}
]
}
]).transition().duration(500).call(chart);
$('#chart-title').html('<h4>Kilometres per day by age <div class="btn-group" role="group"><button onclick="ageTime()" type="button" class="btn btn-sm btn-secondary"><i class="fa fa-clock-o" aria-hidden="true"></i> Time</button><button onclick="ageDistance()" type="button" class="btn btn-sm btn-secondary active"><i class="fa fa-road" aria-hidden="true"></i> Distance</button></div></h4>');
} |
from django.db import models
CONTINENT_CHOICES = [
('EU', 'Europe'),
('AS', 'Asia'),
('NA', 'North America'),
('AF', 'Africa'),
('OC', 'Ocean'),
('SA', 'South America'),
('AN', 'Antarctica')]
class Country(models.Model):
id = models.PositiveIntegerField(unique=True, primary_key=True)
iso2 = models.CharField(max_length=2)
iso3 = models.CharField(max_length=3)
isoN = models.CharField(max_length=3)
fips = models.CharField(max_length=2)
continent = models.CharField(max_length=2, choices=CONTINENT_CHOICES)
tld = models.CharField(max_length=8)
currency_code = models.CharField(max_length=3)
phone_number_prefix = models.CharField(max_length=255)
phone_number_regex = models.CharField(max_length=255)
postal_code_format = models.CharField(max_length=255)
postal_code_regex = models.CharField(max_length=255)
geoname_id = models.PositiveIntegerField()
def __str__(self):
return self.name or self.iso3
class Meta:
verbose_name = 'Country'
verbose_name_plural = 'Countries'
localizable_fields = ('name',)
class PostalZoneManager(models.Manager):
def get_by_natural_key(self, code):
return self.get(code=code)
class PostalZone(models.Model):
objects = PostalZoneManager()
id = models.AutoField(unique=True, primary_key=True)
country = models.ForeignKey(Country, related_name='+', on_delete=models.CASCADE)
code = models.CharField(max_length=255)
def natural_key(self):
return (self.code,)
def __str__(self):
return self.code
class Meta:
verbose_name = 'Postal Zone'
verbose_name_plural = 'Postal Zones'
class CountryDivisionTypeManager(models.Manager):
def get_by_natural_key(self, code):
return self.get(code=code)
class CountryDivisionType(models.Model):
objects = CountryDivisionTypeManager()
id = models.AutoField(unique=True, primary_key=True)
country = models.ForeignKey(Country, related_name='+', on_delete=models.CASCADE)
code = models.CharField(max_length=255)
def natural_key(self):
return (self.code,)
def __str__(self):
return self.name or self.code
class Meta:
verbose_name = 'Country Division Type'
verbose_name_plural = 'Country Division Types'
localizable_fields = ('name',)
class CountryDivisionManager(models.Manager):
def get_by_natural_key(self, code):
return self.get(code=code)
class CountryDivision(models.Model):
objects = CountryDivisionManager()
id = models.AutoField(unique=True, primary_key=True)
country = models.ForeignKey(Country, related_name='+', on_delete=models.CASCADE)
country_division_type = models.ForeignKey(CountryDivisionType, related_name='+', on_delete=models.CASCADE)
parent = models.ForeignKey('self', null=True, blank=True, related_name='children', on_delete=models.CASCADE)
postal_zone = models.ForeignKey(PostalZone, null=True, blank=True, related_name='+', on_delete=models.CASCADE)
code = models.CharField(max_length=255)
latitude_min = models.DecimalField(max_digits=12, decimal_places=8)
latitude_max = models.DecimalField(max_digits=12, decimal_places=8)
longitude_min = models.DecimalField(max_digits=12, decimal_places=8)
longitude_max = models.DecimalField(max_digits=12, decimal_places=8)
geoname_id = models.PositiveIntegerField(null=True, blank=True)
def natural_key(self):
return (self.code,)
def __str__(self):
return '{0}, {1}'.format(self.parent, self.name or self.code) if self.parent else (self.name or self.code)
class Meta:
verbose_name = 'Country Division'
verbose_name_plural = 'Country Divisions'
localizable_fields = ('name',)
|
'use strict';
/**
* Created by nhatnk on 4/30/15.
*/
(function(){
angular
.module('BlendEdxApp')
.directive('postbox', ['announcementService', 'groupService', 'FileUploader', '$q', 'localStorageService', postbox]);
function postbox(){
return {
templateUrl: 'js/directives/postbox/postbox.html',
controller: controllerFn,
link: linkFn,
scope: {
group: '=',
addFeed: '='
}
}
function controllerFn($scope, announcementService, groupService, FileUploader, $q, localStorageService){
$scope.note = {text: '', attachments: [], groups: []};
/**
* Create new note
*/
$scope.postNote = function(){
announcementService.post($scope.note).then(function(data){
$scope.addFeed(data);
$scope.note.text = "";
$scope.note.attachments = [];
$scope.uploader.clearQueue();
toastr.success("Announcement posted successfully", "Success");
},function(){
toastr.error("Error", "Posting annoucement failed");
});
}
/**
* Load groups for auto-complete input-tags
* @param query
*/
$scope.loadGroups = function(query){
var deferred = $q.defer();
groupService.getList({name: query}).then(function(groups){
var tags = [];
deferred.resolve(groups);
});
return deferred.promise;
};
$scope.uploader = new FileUploader({
autoUpload: true,
url: 'http://localhost:9000/files',
headers: {'x-access-token': localStorageService.get('token')},
onSuccessItem: function(item, response, status, headers){
$scope.note.attachments.push(response);
},
onErrorItem: function(item, response, status, headers){
$scope.uploader.removeFromQueue(item);
toastr.error(response.message, "Error");
}
});
}
function linkFn(scope, element, attrs){
scope.$watch(attrs.group, function(g){
if(g)
scope.note.groups = [g];
});
}
}
})(); |
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
//import moment from 'moment';
import {Card,CardTitle,CardBody,CardText} from 'reactstrap';
import Web3 from 'web3';
const ETHER = 1000000000000000000;
function CertificateComp ({art}){
return (
<Card >
<div style={{ maxWidth: '250px'}}>
<a href={`https://ipfs.infura.io/ipfs/${art.ipfs_hash}`} target="_black" ><img src={`https://ipfs.infura.io/ipfs/${art.ipfs_hash}`} style={{ maxWidth: '250px'}}/></a>
</div>
<CardBody>
<CardTitle><small>Student ID : {art.stu_id}</small></CardTitle>
<CardText><small>College Id : {art.college_id}</small></CardText>
<CardText><small>Student Adhar no : {art.student_aadhar}</small></CardText>
<CardText><small>Certificate Id : {art.cert_id}</small></CardText>
<CardText><small>Certificate Name : {art.cert_name}</small></CardText>
<CardText><small>IPFS Hash : {art.ipfs_hash}</small></CardText>
</CardBody>
</Card>
);
}
class AllCertComp extends Component {
constructor(props) {
super(props);
this.state = {
art: [],
title: ''
};
}
render() {
console.log(this.props.art);
for(let i = 0;i<this.props.art?.length;i++){
console.log(this.props.art[i]);
}
const Menu = this.props.art.map((x) => {
if(x.stu_id == this.props.matchId){
return (
<div key={x.cert_id} className='col-4 col-md-3'>
<CertificateComp
art={x}
contract={this.props.contract}
accounts={this.props.accounts}
/>
<br />
<br />
</div>
);
}
else{
return(<></>);
}
});
return (
<div className='container'>
<h2>All Certficate</h2>
<br />
<br />
<div className='row'>{Menu}</div>
<br />
<br />
<br />
<br />
<br />
</div>
);
}
}
export default AllCertComp;
|
/**
* @author alteredq / http://alteredqualia.com/
*/
(function() {
function MaskPass( scene, camera ) {
if (!(this instanceof MaskPass)) return new MaskPass(scene, camera);
this.scene = scene;
this.camera = camera;
this.enabled = true;
this.clear = true;
this.needsSwap = false;
this.inverse = false;
}
MaskPass.prototype = {
render: function ( renderer, writeBuffer, readBuffer, delta ) {
var context = renderer.context;
// don't update color or depth
context.colorMask( false, false, false, false );
context.depthMask( false );
// set up stencil
var writeValue, clearValue;
if ( this.inverse ) {
writeValue = 0;
clearValue = 1;
} else {
writeValue = 1;
clearValue = 0;
}
context.enable( context.STENCIL_TEST );
context.stencilOp( context.REPLACE, context.REPLACE, context.REPLACE );
context.stencilFunc( context.ALWAYS, writeValue, 0xffffffff );
context.clearStencil( clearValue );
// draw into the stencil buffer
renderer.render( this.scene, this.camera, readBuffer, this.clear );
renderer.render( this.scene, this.camera, writeBuffer, this.clear );
// re-enable update of color and depth
context.colorMask( true, true, true, true );
context.depthMask( true );
// only render where stencil is set to 1
context.stencilFunc( context.EQUAL, 1, 0xffffffff ); // draw if == 1
context.stencilOp( context.KEEP, context.KEEP, context.KEEP );
}
};
module.exports = MaskPass
})();
|
'use strict';
const assert = require('assert');
const CONCAT = require('../../../../src/sqlFunctions/basic/CONCAT');
const DataType = require('../../../../src/DataType');
describe('SQL function CONCAT()', () => {
it('data type', () => {
assert.strictEqual(CONCAT.dataType(), DataType.STRING);
});
it('result', () => {
const f = new CONCAT;
assert.strictEqual(f.call([1, 2]), '12');
assert.strictEqual(f.call([1, '2', 3]), '123');
assert.strictEqual(f.call(['1', 2]), '12');
assert.strictEqual(f.call(['1', [2, 3]]), '1[object Object]');
assert.strictEqual(f.call(['1', null]), '1null');
assert.strictEqual(f.call(['1', undefined, 2]), '12');
assert.strictEqual(f.call(['1', {a: 'b'}]), '1[object Object]');
});
});
|
/*jshint maxlen:999*/
/*global describe:false,it:false,afterEach:false*/
'use strict';
var LIB_DIR = process.env.LIB_FOR_TESTS_DIR || '../lib';
var should = require('should');
var Subscription = require(LIB_DIR + '/Subscription');
describe("Subscription", function()
{
function newSub()
{
return new Subscription('1', 'a');
}
var originalCompileFilter = Subscription.compileFilter;
function restoreCompileFilter()
{
Subscription.compileFilter = originalCompileFilter;
}
describe("compileFilter", function()
{
it("should throw an Error", function()
{
Subscription.compileFilter.bind(null, {}).should.throw();
});
});
describe("getJSON", function()
{
it("should return a JSON object with id, topic, filter and limit properties", function()
{
var expected = {
id: '1',
topic: 'a',
filter: null,
limit: 3
};
var sub = new Subscription(expected.id, expected.topic);
sub.setLimit(expected.limit);
sub.toJSON().should.eql(expected);
});
it("should return a source of the filter function", function()
{
var filter = function(message)
{
return typeof message === 'string';
};
var expected = filter.toString();
var sub = newSub();
sub.setFilter(filter);
var actual = sub.toJSON().filter;
actual.should.equal(expected);
});
});
describe("getId", function()
{
it("should return the subscription ID", function()
{
var id = 'expectedId';
var sub = new Subscription(id, 'a');
sub.getId().should.equal(id);
});
});
describe("getTopic", function()
{
it("should return the subscription topic", function()
{
var topic = 'expected.topic';
var sub = new Subscription('1', topic);
sub.getTopic().should.equal(topic);
});
});
describe("getFilter", function()
{
it("should return NULL if the filter was not set", function()
{
should.not.exist(newSub().getFilter());
});
it("should return the set filter", function()
{
var filter = function() { return true; };
var sub = newSub().setFilter(filter);
sub.getFilter().should.equal(filter);
});
});
describe("setFilter", function()
{
afterEach(function()
{
restoreCompileFilter();
});
it("should set the filter to the specified function", function()
{
var filter = function() { return true; };
var sub = newSub();
sub.setFilter(filter);
sub.getFilter().should.equal(filter);
});
it("should compile the specified filter if it is not a function", function()
{
var actualFilter = null;
var expectedFilter = {foo: {$gt: 7}};
Subscription.compileFilter = function(filter)
{
actualFilter = filter;
return function() { return true; };
};
newSub().setFilter(expectedFilter);
should.exist(actualFilter);
actualFilter.should.equal(expectedFilter);
});
it("should throw an Error if the compileFilter() does not return a function", function()
{
Subscription.compileFilter = function() { return 'NOT_A_FUNCTION'; };
var sub = newSub();
sub.setFilter.bind(sub, {a: 1}).should.throw();
});
it("should return self", function()
{
var sub = newSub();
sub.setFilter(function() {}).should.equal(sub);
});
});
describe("getLimit", function()
{
it("should return 0 if the limit was not set", function()
{
newSub().getLimit().should.equal(0);
});
it("should return the set limit", function()
{
newSub().setLimit(3).getLimit().should.equal(3);
});
});
describe("setLimit", function()
{
it("should set the subscription limit to the specified value", function()
{
var sub = newSub();
sub.setLimit(10);
sub.getLimit().should.equal(10);
});
it("should throw an Error if the specified limit is less than 1", function()
{
var sub = newSub();
sub.setLimit.bind(sub, 0).should.throw();
sub.setLimit.bind(sub, -10).should.throw();
});
it("should return self", function()
{
var sub = newSub();
sub.setLimit(1).should.equal(sub);
});
});
describe("getMessageCount", function()
{
it("should return 0 if no messages were sent", function()
{
newSub().getMessageCount().should.equal(0);
});
it("should return the number of sent messages", function()
{
var sub = newSub();
sub.send('a', null, {});
sub.send('b', null, {});
sub.send('c', null, {});
sub.getMessageCount().should.equal(3);
});
});
describe("on", function()
{
it("should register the specified message listener function", function()
{
var calls = 0;
var sub = newSub();
sub.on('message', function() { ++calls; });
sub.send('a', null, {});
calls.should.equal(1);
});
it("should register the specified cancel listener function", function()
{
var calls = 0;
var sub = newSub();
sub.on('cancel', function() { ++calls; });
sub.cancel();
calls.should.equal(1);
});
it("should register the specified multiple listener functions", function()
{
var calls = 0;
var sub = newSub();
sub.on('cancel', function() { ++calls; });
sub.on('cancel', function() { ++calls; });
sub.cancel();
calls.should.equal(2);
});
it("should throw an Error if the specified event name is invalid", function()
{
var sub = newSub();
function test()
{
sub.on('unknown event', function() {});
}
test.should.throw();
});
it("should do nothing if the subscription was cancelled", function()
{
var sub = newSub();
sub.cancel();
sub.on('unknown event', function() {});
});
});
describe("off", function()
{
it("should remove the specified message listener function", function()
{
var calls = 0;
var sub = newSub();
function cb() { ++calls; }
sub.on('message', cb);
sub.off('message', cb);
sub.send('a', null, {});
calls.should.equal(0);
});
it("should remove only the specified listener function of 2", function()
{
var calls1 = 0;
var calls2 = 0;
var sub = newSub();
function cb() { ++calls1; }
sub.on('cancel', function() { ++calls2; });
sub.on('cancel', cb);
sub.off('cancel', cb);
sub.cancel();
calls1.should.equal(0);
calls2.should.equal(1);
});
it("should remove only the specified listener function of 3", function()
{
var calls1 = 0;
var calls2 = 0;
var calls3 = 0;
var sub = newSub();
function cb() { ++calls1; }
sub.on('cancel', function() { ++calls2; });
sub.on('cancel', function() { ++calls3; });
sub.on('cancel', cb);
sub.off('cancel', cb);
sub.cancel();
calls1.should.equal(0);
calls2.should.equal(1);
calls3.should.equal(1);
});
it("should throw an Error if the specified event name is invalid", function()
{
var sub = newSub();
function test()
{
sub.off('unknown event', function() {});
}
test.should.throw();
});
it("should do nothing if the subscription was cancelled", function()
{
var sub = newSub();
sub.cancel();
sub.off('unknown event', function() {});
});
it("should do nothing if the no listeners were registered", function()
{
var sub = newSub();
sub.off('message', function() {});
});
it("should do nothing if the the specified listener was not registered", function()
{
var sub = newSub();
sub.on('message', function() {});
sub.on('message', function() {});
sub.on('message', function() {});
sub.off('message', function() {});
});
});
describe("send", function()
{
it("should not emit a message event if the subscription was cancelled", function()
{
var calls = 0;
var sub = newSub();
sub.on('message', function() { ++calls; });
sub.cancel();
sub.send('a', null, {});
calls.should.equal(0);
});
it("should not emit a message event if the filter does not match the message", function()
{
var calls = 0;
var sub = newSub();
sub.setFilter(function() { return false; });
sub.on('message', function() { ++calls; });
sub.send('a', null, {});
calls.should.equal(0);
});
it("should pass message, topic, meta and self to the filter function", function()
{
var sub = newSub();
var expectedArgs = ['message', 'topic', {me: 'ta'}, sub];
var actualArgs = [];
sub.setFilter(function() { actualArgs = Array.prototype.slice.call(arguments); });
sub.send(expectedArgs[1], expectedArgs[0], expectedArgs);
});
it("should emit a message event", function()
{
var calls = 0;
var sub = newSub();
sub.on('message', function() { ++calls; });
sub.send('a', null, {});
calls.should.equal(1);
});
it("should invoke all message listeners", function()
{
var calls = 0;
var sub = newSub();
sub.on('message', function() { ++calls; });
sub.on('message', function() { ++calls; });
sub.on('message', function() { ++calls; });
sub.send('a', null, {});
calls.should.equal(3);
});
it("should cancel the subscription if the message limit was reached", function()
{
var calls = 0;
var sub = newSub();
sub.on('cancel', function() { ++calls; });
sub.setLimit(1);
sub.send('a', null, {});
calls.should.equal(1);
});
});
describe("cancel", function()
{
it("should emit a cancel event", function()
{
var calls = 0;
var sub = newSub();
sub.on('cancel', function() { ++calls; });
sub.cancel();
calls.should.equal(1);
});
it("should invoke all cancel listeners", function()
{
var calls = 0;
var sub = newSub();
sub.on('cancel', function() { ++calls; });
sub.on('cancel', function() { ++calls; });
sub.on('cancel', function() { ++calls; });
sub.cancel();
calls.should.equal(3);
});
it("should do nothing if the subscription was already cancelled", function()
{
var calls = 0;
var sub = newSub();
sub.on('cancel', function() { ++calls; });
sub.cancel();
sub.cancel();
calls.should.equal(1);
});
});
});
|
import React, { Component } from 'react';
import { Platform } from 'react-native'
import { WebView } from 'react-native-webview';
import RNFetchBlob from 'rn-fetch-blob';
import RNImageColorPicker from 'image-color-picker'
import { canvasHtml } from './canvas-html';
async function getColor(imagePath) {
return RNImageColorPicker.getColor(imagePath)
}
export default class ImageColorPicker extends Component {
state = {
imageBlob: ''
};
componentWillMount() {
if (this.props.imageUrl)
this.getImage(this.props.imageUrl);
}
getImage = async imageUrl => {
try {
const localImage = await RNFetchBlob.config({ fileCache: true }).fetch(
'GET',
imageUrl
)
// if we are on Android, then use native for Android
if (Platform.OS === 'android') {
let colors = [];
const color = await getColor(localImage.path());
color.forEach(c => {
colors.push(c.split('-'));
});
this.imageColorPickerView.props.onMessage({
promise: JSON.stringify({ 'message': 'imageColorPicker', 'payload': colors })
});
return;
}
const base64EncodedImage = await RNFetchBlob.fs.readFile(
localImage.path(),
'base64'
);
this.setState({ imageBlob: base64EncodedImage });
} catch (error) {
this.props.pickerCallback(error);
}
};
render() {
const { pickerCallback, pickerStyle } = this.props;
return (
<WebView
originWhitelist={['*']}
ref={imageColorPickerView => (this.imageColorPickerView = imageColorPickerView)}
source={{ html: canvasHtml(this.state.imageBlob, this.props) }}
javaScriptEnabled={true}
onMessage={event => { pickerCallback(event); } }
style={pickerStyle}
/>
);
}
}
|
'use strict';
module.exports = require('./test');
|
import React from 'react'
import { Link } from 'gatsby'
// Header component
const Header = () => (
<header className="header">
<div className="container">
<nav className="nav">
<div className="logo">
<Link to="/">ellie grace</Link>
</div>
<ul className="header__list-links">
<li>
<Link to="/about/">About me</Link>
</li>
<li>
<Link to="/portfolio">Portfolio</Link>
</li>
<li>
<Link to="/blog">Blog</Link>
</li>
<li>
<Link to="/contact/">Contact</Link>
</li>
</ul>
</nav>
</div>
</header>
)
export default Header |
define(function() {
return {"type":"FeatureCollection","features":[{"type":"Feature","id":"1409","properties":{"name":"忻州市","cp":[112.4561,38.8971],"childNum":14},"geometry":{"type":"Polygon","coordinates":["@@Vx@lnbn¦WlnnUm°²VVVVVnUnºlz@l@J@kXWVXl@La@KULlbnKlLnKLnKÆXn°bVV@bUVl°Un@LnaVJUbW@UX²l@ČwlVVIWnkÆa°anVKn°UW¯@aVUVk@Un@aV@ValwUanmWUk@WVUUanaVwnLVl°@nk@mVU@UVK@wLVKVU@K@UUKVUV@@bnLaVaôlIXmlKX_°KVV@bVV@zV`kblIVUlL@bnV@VĊllVlIXW@kaU²blKVnIlJalbXXlWVn°JnnL@l@XlJlaX@XW²@l_VmnKUblU@mnkVK¯@U@ma@kX¥VmakkLa@a@WIUUVXWWnk@a°a@kkm@kUUmJm@WUUUIk`m@VkaWWkXKmXk¯@WKLkak@±bw@aa@aka@ma¯@LKÇÅkKWbkmġ±ÅULUKVVkm¯LUVVbUwUW¯bmULxWJ@klmkUm@@KnwVkVK@akw@@a¯bKknVUIb¯mmbk@UbmKUL@xUU@klmLUlVXIVVVUVUU`mLXVWbXnW`Ų°xmxU@mĉwU@mbU@UmbkVW¦kJ@X@`¯Im@UlUVVnb@bWJXnmbJUUUUa@UamIkax@@x@b"],"encodeOffsets":[[113614,39657]]}},{"type":"Feature","id":"1411","properties":{"name":"吕梁市","cp":[111.3574,37.7325],"childNum":13},"geometry":{"type":"Polygon","coordinates":["@@@a@w@wlbnJVb@VbVVVInaWmXI@aaUmVUVkn@°J@_W@lIX¥lUnaVV@naV@xĊnV@wn¯wƱX_WmXaWUnKV_VVUUUUWJkUVnKlk¯@@kmKUaűKkU@WmI@WUIlUUmVwXw@UlUVwV@LnbW@anU@UaVkô@l»n@naJnUÈLVaÆUUVmVKV²L@mU_lK@UVWkUa@a@U¯aUaÑóÑUbKk@@ak¯mVaUwVÑkWUmK@UUKmXUWÝwUaLUU@aWJUUU@UaÝU@WL@VKVaVI@WnU@alIVK@kImIkJ@m@@@_K@x@kaW@U@Vmn@UK@mIJUXV¤XXWlkKkkK@XmJVakImJU@ó¯LWKUV@nUVLkxmKkLma@kXKmmLabLmK@V@mXVÆUxX@`nLaV@@VmLUVnLlLb@°²nx@bVUxlb@V¯bUV@zVXVĊXVx@lVn@VnnmU@LlJXVz¯VWVXbV@bmnVUVkÇþÅ@XVxmbUlVUlnW@Xl@VLXÒ@bÞJ°¦Lò@nUb@°X@XbmVUVnb@xx"],"encodeOffsets":[[113614,39657]]}},{"type":"Feature","id":"1410","properties":{"name":"临汾市","cp":[111.4783,36.1615],"childNum":17},"geometry":{"type":"Polygon","coordinates":["@@nW@@UnLKabKnnWL@lnblKnLlwKVU@mVUXL°KôV@nIlJUbnI@WlLllLXkWWU£VWInJ@VL@nm@UVX@lb@@wL@`@n@V@lw@nVmVXWmwnUla@_lKwVlUn°xVKVXXWlUVVI@K@Kn°KwlVlU@kna@V_WnmUVm@kXml_@mLlKXw°m@_ôJVUV@Xl@UaV@Va°Ilk»VwUkVmwUmmVn@V¯@KUwmK@U¯wUVÝ@mJUnWK@@UnKVa_lykUmKÛnm@x@UUlwVkXW@a@U@@K@kIVnammVakUl@wX@@k¯@VVbml@°UbULmlVbnbÅK±VKVXUJWa@ULWaUU@@U@aWK@UkxUKLUUUJ±UkL@V±kk@kam@UV@l@LWl@n@VVUxLlUUx@VUVU@aIUlL@°mLUbkUUaWUUaUU@aWKLWJ@bUL@VUVVbU@m@a@kmKmnĉlUKXWUblbxmIkU@xWb@lkVxLXmzVV@bklVVUzm@bk@Vx@xlU@lUbVnl@Wxnl@n@UbVmLmb@`X@lUX@@xlnkLWaUJnnWVVn@l@bULVV@lV@XnJVX"],"encodeOffsets":[[113063,37784]]}},{"type":"Feature","id":"1407","properties":{"name":"晋中市","cp":[112.7747,37.37],"childNum":11},"geometry":{"type":"Polygon","coordinates":["@@@lInJlJ@ULkJ@bmV@XUJUbL@UXKV@ÞVbV@VVXI@bVVKVbÞxVXnWVL@VnLVlXÒUVxUb°nl@bl@LVaôÒÒVb°b@VnLnnV@lmn@lbUV@JUVVXkl@lUzmJ@xXklbUnJVUbnUlbV@nlLX@lakV`Ub°@XVJnUL²KlxnI@KV@lbUbVVKnVl@zlm@U@nI@WUaVl@@mVU@XkW@nkVKV_Vwy@knwVa@XalU@Vnml@X@VLKVaÞbnnlJImVKnVVVInVlU@m@mXK@UmyUI@mWUUakamw@wUwmLkakwVmKw@wUam£y@am_W@UU@knmmamU@WUa@knw@UUUUV@nJm@mVUkKVUUUkKmwKULKUImV@lUnnm@mbUK@°bUnmbUmkkWUb@am@UXkK@a±@V@ĉÅVUXVxUVkLWl¯@@bULUlm@@nm`XlWakIkmVUbUL@Vm@kI@@Km@VaXI@W@aU@kUVU_KbJkkÇb@nkKmLwÅW@kVUUVU@WUIJmIXmma@_kyVaUUlkUm@kUx¯Lm@L@LUJUkVWXUWUL¯wVmUkxkL@`bkmVnxXUWUnm@kxU@"],"encodeOffsets":[[114087,37682]]}},{"type":"Feature","id":"1408","properties":{"name":"运城市","cp":[111.1487,35.2002],"childNum":13},"geometry":{"type":"Polygon","coordinates":["@@VlnJwkaVaXWVLĊknmnLl@@bnV@UaVU@UVK@aXIKXL@bVVVbXVVblVaVnK@¯KVkJ@bVVU@UVwkVKVwUUm@@Xk@K@kVUn@lbl@²l@UlK²VVIVVKVLlw@VXL@b@VV@VXbVK@XbVIUWLU²ÆLmaUankVKVa¯@nkUaU°@n@@kWaUVaXUW@IXKVw@UWU@W@@UUU@mn@`m@UUULkUmJIU@@UK@U@anak_@wmKUwmakVkmKVk¯bw`kwUIÇx¯»ÇaÅmn@@mmUkV@wkKW@kxmLUkĉLÝkxÝw¯lóVUmV@ĀVVX¦W¤kz@`Vx°²ĸ@Ul@xêĸNJ°¤VVlXLWnXxmV@nUl@"],"encodeOffsets":[[113232,36597]]}},{"type":"Feature","id":"1402","properties":{"name":"大同市","cp":[113.7854,39.8035],"childNum":8},"geometry":{"type":"Polygon","coordinates":["@@²£yl@ČĖ@bĸĢbĸXaKŤnn@ŎôllÈxnVnÞÇV@bnXllL°KbVb@J@b@UxlKXLlKlXk@UlkJlkUVKXUÇVIVm@_nÇLalwVnU@UUwma@aaÝaLmUk@@W@U@@XwVWÝUUUk@@VmLKV»nwUwaUL@`mzJUIVUaUwKUaVIlJôanÑlLVUn@a@VV@@UUwVK°Vn_lJÆLéW@UUUÅ@»lm@aÞIVwXWUUkkm@U@aU@mwU£VWU_kWmXwW_°yUkkK@UÇK@kkUVymóKU@KWIbUak@mJ@bkbmLkUmkVUW¦@lnb@@V°ULml@nkVaVmLUnk`±@XWW@kbǦX¯WxI@xmbmxXlWV@bÅUz@Jb@bÞbU@Wbk@xk@WX¯VÛWÝbÝUkVUU@alI@a@akLWam@U¯UUmÇL@K@aU@¯VUkKmX@`@kJ@nVUb@lbVÆXVWULU`VbkLUV@XWl@bXJ@VbV@Vl"],"encodeOffsets":[[115335,41209]]}},{"type":"Feature","id":"1404","properties":{"name":"长治市","cp":[112.8625,36.4746],"childNum":12},"geometry":{"type":"Polygon","coordinates":["@@UkLky@IJVa@mÞaWy@_W@_WXVlUVw@nw°K@mUVamVkU@mmmnLVUmKXaU@IlKVUnK@UmWkX@WV_V@akU@aKWIXyIUVmUnUa@WaXUVKVmkUWVkULU@@VbKbIUm@mbVLxWUUkn±V¯wbÅJUbmLkbmKÅKbVnUbVKUbKUbmLKmbaKkUm@UnnVnxUVlUxl¼k¯JUbU@Vbk@WU@UVóI@`¯nWxkLK@nk`Wn@lUnVnmXU`@mb@lkV@VnklVVUblz@`nbWnnJIVJ@XUVVUV@lÆXxnKlL@maÈllIaLV`UlVV@@b@XJWUb@n@L@lJn@@UVKVaUlnlJXbkWn_@mn@VkVK@a°@XklKVUUwVWUĊÆ@U²@@blLVWn@@bVaXllVnnaVma@¯VLnan@mVm@knUVJ"],"encodeOffsets":[[116269,37637]]}},{"type":"Feature","id":"1406","properties":{"name":"朔州市","cp":[113.0713,39.6991],"childNum":5},"geometry":{"type":"Polygon","coordinates":["@@XXWVXVWnnlnn@èÆ¼@xlVnblVÈUVl@blnLÜĊmUkU@Ua@WI@aXk@WVUlKUaV_VKXWUUÅka@VaU@mlI@@_nWLVl°UV@@b@LÈKVn°V@VnXblK@b@bkJ@bVVlUÞVÞaXܰUXWl@wl@XaV@Ýa@aa@IVyÆ@aXUWknwna@wJXw°WÈ¥kI@W@kmKm¯IUmkXWWkabkImJUkL±aVb@lWXkJUkĉk@UmU@aKkVUkJlaU_y@UU@aUU¯LW`kLWnkJóbUbmK@aU@UVVL@VL@UVULK@xUL@VUV@nml¯@UkmKUxmbVbUV@XlXVmnVbkxUbU@bm@@VUlUVb°@VX¯m"],"encodeOffsets":[[114615,40562]]}},{"type":"Feature","id":"1405","properties":{"name":"晋城市","cp":[112.7856,35.6342],"childNum":6},"geometry":{"type":"Polygon","coordinates":["@@lVLbanLnKVaLVaLUVaUmaÆLnLlanKVaÆIa°x²UlmVVXwUKna@VnJaLa@UV@@alUkKVKnkmmVwUkw@@kxWUXW@@mk@aUa@a¯aLkKmwkUm@kL@K@aWIXmVXWkUVakL@UVKw@aUK@UUKmLU@¯nKUwVUIWJUWmka@UXJk@UkmW@kLWKVx@bmI@VUaVU@a¯@UUmVKmX@±`kÝKVxUL±akL@VbLkKmV@XWVUbVXb@lm@@lW@@xklVUbnnmbUlJ@@L@@Vb@WXUlkxVV@wn@ÜmnLlVkz`UbmL@V@XLmVnIÞ@VU°x@VnLxV@LU°"],"encodeOffsets":[[115223,36895]]}},{"type":"Feature","id":"1401","properties":{"name":"太原市","cp":[112.3352,37.9413],"childNum":5},"geometry":{"type":"Polygon","coordinates":["@@@VV@wVKnLVal@na°naVJUlmL°a@b@lx@bULUlmx@Ln@lVknl@XIwKVn°aVXVxUaVU°KnUlUVLKÆV²ĢlnXalLÈÆLKUaVkUanmWUa@WwkUWU¯y¯Ñ@anIl@@aVUmIymULUUVakaU@@LmJkw±LKmVUI@W¯VaU_lkbW@kK@mUkaVmVaUIVmalkW@wnIVy@klkWUUVI@UVkam@knU@mmmK@bblVUX@VkLV`@n±KUULUnVVÅUbÇKmVImbm@k¼ó@Ulb@VmV@bXmaK@UUxkVV@xWUxVnkVVJ@XnJ@XlV²LÆVbnL@l@°"],"encodeOffsets":[[114503,39134]]}},{"type":"Feature","id":"1403","properties":{"name":"阳泉市","cp":[113.4778,38.0951],"childNum":3},"geometry":{"type":"Polygon","coordinates":["@@°@nb@lb@bbb@x²al@lbKXU@mkUWkkmUUVwV@XUW@naVklKXblKnLnLVanImaXKlLaV@U@KUKWalXK@£WKXUV@VUUUVW_V@W@@K@UIWmXUmULnJkImmÝaUbLK@UWk@mnU@kVWb@Ubmx@lzUx`UULml@XWl@UV@nk@UVb@XJm@@Vknyk@zJnUV@bk@mJ@b°Ò°zXVlVXx@bXVmnVbUlVb"],"encodeOffsets":[[115864,39336]]}}],"UTF8Encoding":true};
}); |
"use strict";
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importDefault(require("react"));
var styled_components_1 = __importDefault(require("styled-components"));
exports.Widgets = styled_components_1.default.svg.attrs({
children: function (props) { return (props.title != null
? [react_1.default.createElement("title", { key: "Widgets-title" }, props.title), react_1.default.createElement("path", { d: "M13 13v8h8v-8h-8zM3 21h8v-8H3v8zM3 3v8h8V3H3zm13.66-1.31L11 7.34 16.66 13l5.66-5.66-5.66-5.65z", key: "k0" })
]
: [react_1.default.createElement("path", { d: "M13 13v8h8v-8h-8zM3 21h8v-8H3v8zM3 3v8h8V3H3zm13.66-1.31L11 7.34 16.66 13l5.66-5.66-5.66-5.65z", key: "k0" })
]); },
viewBox: '0 0 24 24',
height: function (props) { return (props.height !== undefined ? props.height : props.size); },
width: function (props) { return (props.width !== undefined ? props.width : props.size); },
// @ts-ignore - aria is not always defined on SVG in React TypeScript types
'aria-hidden': function (props) { return (props.title == null ? 'true' : undefined); },
focusable: 'false',
role: function (props) { return (props.title != null ? 'img' : undefined); },
"fill": "currentColor",
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-block;\n vertical-align: middle;\n overflow: hidden;\n"], ["\n display: inline-block;\n vertical-align: middle;\n overflow: hidden;\n"])));
exports.Widgets.displayName = 'Widgets';
exports.WidgetsDimensions = { height: 24, width: 24 };
var templateObject_1;
|
from wtforms import Form, StringField, DecimalField, IntegerField, TextAreaField, PasswordField, validators
#form used on Register page
class RegisterForm(Form):
name = StringField('Full Name', [validators.Length(min=1,max=50)])
username = StringField('Username', [validators.Length(min=4,max=25)])
email = StringField('Email', [validators.Length(min=6,max=50)])
password = PasswordField('Password', [validators.DataRequired(), validators.EqualTo('confirm', message='Passwords do not match')])
confirm = PasswordField('Confirm Password')
#form used on the Transactions page
class SendMoneyForm(Form):
username = StringField('Username', [validators.Length(min=4,max=25)])
amount = StringField('Amount', [validators.Length(min=1,max=50)])
#form used on the Buy page
class BuyForm(Form):
amount = StringField('Amount', [validators.Length(min=1,max=50)])
|
import React from "react"
import styled from "styled-components"
//components
import Layout from "../layout"
const AboutPageContainer = styled.div`
height: 100%;
width: 100%;
`
const About = () => {
return (
<Layout>
<AboutPageContainer>
<h1>hi</h1>
</AboutPageContainer>
</Layout>
)
}
export default About
|
/*!
* stack-admin-theme (https://pixinvent.com/bootstrap-admin-template/stack)
* Copyright 2018 PIXINVENT
* Licensed under the Themeforest Standard Licenses
*/
$(window).on("load",function(){function resize(){width=ele.node().getBoundingClientRect().width-margin.left-margin.right,container.attr("width",width+margin.left+margin.right),svg.attr("width",width+margin.left+margin.right),x.range([0,width]),svg.selectAll(".d3-xaxis").call(xAxis),svg.selectAll(".d3-area").attr("d",area)}var ele=d3.select("#bivariate-chart"),margin={top:20,right:20,bottom:30,left:50},width=ele.node().getBoundingClientRect().width-margin.left-margin.right,height=500-margin.top-margin.bottom,parseDate=d3.time.format("%Y%m%d").parse,x=d3.time.scale().range([0,width]),y=d3.scale.linear().range([height,0]),xAxis=d3.svg.axis().scale(x).orient("bottom"),yAxis=d3.svg.axis().scale(y).orient("left"),area=d3.svg.area().x(function(d){return x(d.date)}).y0(function(d){return y(d.low)}).y1(function(d){return y(d.high)}),container=ele.append("svg"),svg=container.attr("width",width+margin.left+margin.right).attr("height",height+margin.top+margin.bottom).append("g").attr("transform","translate("+margin.left+","+margin.top+")");d3.tsv("../../../app-assets/data/d3/line/bivariate-area.tsv",function(error,data){if(error)throw error;data.forEach(function(d){d.date=parseDate(d.date),d.low=+d.low,d.high=+d.high}),x.domain(d3.extent(data,function(d){return d.date})),y.domain([d3.min(data,function(d){return d.low}),d3.max(data,function(d){return d.high})]),svg.append("path").datum(data).attr("class","d3-area").attr("d",area).style("fill","#FF5722"),svg.append("g").attr("class","d3-axis d3-xaxis").attr("transform","translate(0,"+height+")").call(xAxis),svg.append("g").attr("class","d3-axis d3-yaxis").call(yAxis).append("text").attr("transform","rotate(-90)").attr("y",6).attr("dy",".71em").style("text-anchor","end").style("fill","#FF5722").style("font-size",12).text("Price ($)")}),$(window).on("resize",resize),$(".menu-toggle").on("click",resize)}); |
/*
Copyright (c) 2018-2019 Uber Technologies, Inc.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
// @flow
// BASEUI-GENERATED-REACT-ICON
// DO NOT EDIT THIS FILE DIRECTLY, SEE README.md
import * as React from 'react';
import Icon from './icon.js';
import type {IconPropsT} from './types.js';
import {ThemeContext} from '../styles/theme-provider.js';
export default function ChevronRight(props: IconPropsT) {
return (
<ThemeContext.Consumer>
{theme =>
theme.icons && theme.icons.ChevronRight ? (
<theme.icons.ChevronRight
title="Chevron Right"
viewBox="0 0 24 24"
{...props}
/>
) : (
<Icon title="Chevron Right" viewBox="0 0 24 24" {...props}>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M9.29289 7.29289C8.90237 7.68342 8.90237 8.31658 9.29289 8.70711L12.5858 12L9.29289 15.2929C8.90237 15.6834 8.90237 16.3166 9.29289 16.7071C9.68342 17.0976 10.3166 17.0976 10.7071 16.7071L14.7071 12.7071C14.8946 12.5196 15 12.2652 15 12C15 11.7348 14.8946 11.4804 14.7071 11.2929L10.7071 7.29289C10.3166 6.90237 9.68342 6.90237 9.29289 7.29289Z"
/>
</Icon>
)
}
</ThemeContext.Consumer>
);
}
|
"""Base Class for tabular models."""
import logging
import pickle
import uuid
from warnings import warn
import numpy as np
import pandas as pd
from sdv.metadata import Table
LOGGER = logging.getLogger(__name__)
COND_IDX = str(uuid.uuid4())
class NonParametricError(Exception):
"""Exception to indicate that a model is not parametric."""
class BaseTabularModel:
"""Base class for all the tabular models.
The ``BaseTabularModel`` class defines the common API that all the
TabularModels need to implement, as well as common functionality.
Args:
field_names (list[str]):
List of names of the fields that need to be modeled
and included in the generated output data. Any additional
fields found in the data will be ignored and will not be
included in the generated output.
If ``None``, all the fields found in the data are used.
field_types (dict[str, dict]):
Dictinary specifying the data types and subtypes
of the fields that will be modeled. Field types and subtypes
combinations must be compatible with the SDV Metadata Schema.
field_transformers (dict[str, str]):
Dictinary specifying which transformers to use for each field.
Available transformers are:
* ``integer``: Uses a ``NumericalTransformer`` of dtype ``int``.
* ``float``: Uses a ``NumericalTransformer`` of dtype ``float``.
* ``categorical``: Uses a ``CategoricalTransformer`` without gaussian noise.
* ``categorical_fuzzy``: Uses a ``CategoricalTransformer`` adding gaussian noise.
* ``one_hot_encoding``: Uses a ``OneHotEncodingTransformer``.
* ``label_encoding``: Uses a ``LabelEncodingTransformer``.
* ``boolean``: Uses a ``BooleanTransformer``.
* ``datetime``: Uses a ``DatetimeTransformer``.
anonymize_fields (dict[str, str]):
Dict specifying which fields to anonymize and what faker
category they belong to.
primary_key (str):
Name of the field which is the primary key of the table.
constraints (list[Constraint, dict]):
List of Constraint objects or dicts.
table_metadata (dict or metadata.Table):
Table metadata instance or dict representation.
If given alongside any other metadata-related arguments, an
exception will be raised.
If not given at all, it will be built using the other
arguments or learned from the data.
"""
_DTYPE_TRANSFORMERS = None
_metadata = None
def __init__(self, field_names=None, field_types=None, field_transformers=None,
anonymize_fields=None, primary_key=None, constraints=None, table_metadata=None):
if table_metadata is None:
self._metadata = Table(
field_names=field_names,
primary_key=primary_key,
field_types=field_types,
field_transformers=field_transformers,
anonymize_fields=anonymize_fields,
constraints=constraints,
dtype_transformers=self._DTYPE_TRANSFORMERS,
)
self._metadata_fitted = False
else:
for arg in (field_names, primary_key, field_types, anonymize_fields, constraints):
if arg:
raise ValueError(
'If table_metadata is given {} must be None'.format(arg.__name__))
if isinstance(table_metadata, dict):
table_metadata = Table.from_dict(table_metadata)
table_metadata._dtype_transformers.update(self._DTYPE_TRANSFORMERS)
self._metadata = table_metadata
self._metadata_fitted = table_metadata.fitted
def fit(self, data):
"""Fit this model to the data.
If the table metadata has not been given, learn it from the data.
Args:
data (pandas.DataFrame or str):
Data to fit the model to. It can be passed as a
``pandas.DataFrame`` or as an ``str``.
If an ``str`` is passed, it is assumed to be
the path to a CSV file which can be loaded using
``pandas.read_csv``.
"""
LOGGER.debug('Fitting %s to table %s; shape: %s', self.__class__.__name__,
self._metadata.name, data.shape)
if not self._metadata_fitted:
self._metadata.fit(data)
self._num_rows = len(data)
LOGGER.debug('Transforming table %s; shape: %s', self._metadata.name, data.shape)
transformed = self._metadata.transform(data)
if self._metadata.get_dtypes(ids=False):
LOGGER.debug(
'Fitting %s model to table %s', self.__class__.__name__, self._metadata.name)
self._fit(transformed)
def get_metadata(self):
"""Get metadata about the table.
This will return an ``sdv.metadata.Table`` object containing
the information about the data that this model has learned.
This Table metadata will contain some common information,
such as field names and data types, as well as additional
information that each Sub-class might add, such as the
observed data field distributions and their parameters.
Returns:
sdv.metadata.Table:
Table metadata.
"""
return self._metadata
@staticmethod
def _filter_conditions(sampled, conditions, float_rtol):
"""Filter the sampled rows that match the conditions.
If condition columns are float values, consider a match anything that
is closer than the given ``float_rtol`` and then make the value exact.
Args:
sampled (pandas.DataFrame):
The sampled rows, reverse transformed.
conditions (dict):
The dictionary of conditioning values.
float_rtol (float):
Maximum tolerance when considering a float match.
Returns:
pandas.DataFrame:
Rows from the sampled data that match the conditions.
"""
for column, value in conditions.items():
column_values = sampled[column]
if column_values.dtype.kind == 'f':
distance = value * float_rtol
sampled = sampled[np.abs(column_values - value) < distance]
sampled[column] = value
else:
sampled = sampled[column_values == value]
return sampled
def _sample_rows(self, num_rows, conditions=None, transformed_conditions=None,
float_rtol=0.1, previous_rows=None):
"""Sample rows with the given conditions.
Input conditions is taken both in the raw input format, which will be used
for filtering during the reject-sampling loop, and already transformed
to the model format, which will be passed down to the model if it supports
conditional sampling natively.
If condition columns are float values, consider a match anything that
is closer than the given ``float_rtol`` and then make the value exact.
If the model does not have any data columns, the result of this call
is a dataframe of the requested length with no columns in it.
Args:
num_rows (int):
Number of rows to sample.
conditions (dict):
The dictionary of conditioning values in the original format.
transformed_conditions (dict):
The dictionary of conditioning values transformed to the model format.
float_rtol (float):
Maximum tolerance when considering a float match.
previous_rows (pandas.DataFrame):
Valid rows sampled in the previous iterations.
Returns:
tuple:
* pandas.DataFrame:
Rows from the sampled data that match the conditions.
* int:
Number of rows that are considered valid.
"""
if self._metadata.get_dtypes(ids=False):
if conditions is None:
sampled = self._sample(num_rows)
else:
try:
sampled = self._sample(num_rows, transformed_conditions)
except NotImplementedError:
sampled = self._sample(num_rows)
sampled = self._metadata.reverse_transform(sampled)
if previous_rows is not None:
sampled = previous_rows.append(sampled)
sampled = self._metadata.filter_valid(sampled)
if conditions is not None:
sampled = self._filter_conditions(sampled, conditions, float_rtol)
num_valid = len(sampled)
return sampled, num_valid
else:
sampled = pd.DataFrame(index=range(num_rows))
sampled = self._metadata.reverse_transform(sampled)
return sampled, num_rows
def _sample_batch(self, num_rows=None, max_retries=100, max_rows_multiplier=10,
conditions=None, transformed_conditions=None, float_rtol=0.01):
"""Sample a batch of rows with the given conditions.
This will enter a reject-sampling loop in which rows will be sampled until
all of them are valid and match the requested conditions. If `max_retries`
is exceeded, it will return as many rows as it has sampled, which may be less
than the target number of rows.
Input conditions is taken both in the raw input format, which will be used
for filtering during the reject-sampling loop, and already transformed
to the model format, which will be passed down to the model if it supports
conditional sampling natively.
If condition columns are float values, consider a match anything that is
relatively closer than the given ``float_rtol`` and then make the value exact.
If the model does not have any data columns, the result of this call
is a dataframe of the requested length with no columns in it.
Args:
num_rows (int):
Number of rows to sample. If not given the model
will generate as many rows as there were in the
data passed to the ``fit`` method.
max_retries (int):
Number of times to retry sampling discarded rows.
Defaults to 100.
max_rows_multiplier (int):
Multiplier to use when computing the maximum number of rows
that can be sampled during the reject-sampling loop.
The maximum number of rows that are sampled at each iteration
will be equal to this number multiplied by the requested num_rows.
Defaults to 10.
conditions (dict):
The dictionary of conditioning values in the original input format.
transformed_conditions (dict):
The dictionary of conditioning values transformed to the model format.
float_rtol (float):
Maximum tolerance when considering a float match.
Returns:
pandas.DataFrame:
Sampled data.
"""
sampled, num_valid = self._sample_rows(
num_rows, conditions, transformed_conditions, float_rtol)
counter = 0
total_sampled = num_rows
while num_valid < num_rows:
if counter >= max_retries:
break
remaining = num_rows - num_valid
valid_probability = (num_valid + 1) / (total_sampled + 1)
max_rows = num_rows * max_rows_multiplier
num_to_sample = min(int(remaining / valid_probability), max_rows)
total_sampled += num_to_sample
LOGGER.info('%s valid rows remaining. Resampling %s rows', remaining, num_to_sample)
sampled, num_valid = self._sample_rows(
num_to_sample, conditions, transformed_conditions, float_rtol, sampled
)
counter += 1
return sampled.head(min(len(sampled), num_rows))
def _make_conditions_df(self, conditions, num_rows):
"""Transform `conditions` into a dataframe.
Args:
conditions (pd.DataFrame, dict or pd.Series):
If this is a dictionary/Series which maps column names to the column
value, then this method generates `num_rows` samples, all of
which are conditioned on the given variables. If this is a DataFrame,
then it generates an output DataFrame such that each row in the output
is sampled conditional on the corresponding row in the input.
num_rows (int):
Number of rows to sample. If a conditions dataframe is given, this must
either be ``None`` or match the length of the ``conditions`` dataframe.
Returns:
pandas.DataFrame:
`conditions` as a dataframe.
"""
if isinstance(conditions, pd.Series):
conditions = pd.DataFrame([conditions] * num_rows)
elif isinstance(conditions, dict):
try:
conditions = pd.DataFrame(conditions)
except ValueError:
conditions = pd.DataFrame([conditions] * num_rows)
elif not isinstance(conditions, pd.DataFrame):
raise TypeError('`conditions` must be a dataframe, a dictionary or a pandas series.')
elif num_rows is not None and len(conditions) != num_rows:
raise ValueError(
'If `conditions` is a `DataFrame`, `num_rows` must be `None` or match its lenght.')
return conditions.copy()
def _conditionally_sample_rows(self, dataframe, max_retries, max_rows_multiplier,
condition, transformed_condition, float_rtol,
graceful_reject_sampling):
num_rows = len(dataframe)
sampled_rows = self._sample_batch(
num_rows,
max_retries,
max_rows_multiplier,
condition,
transformed_condition,
float_rtol
)
num_sampled_rows = len(sampled_rows)
if num_sampled_rows < num_rows:
# Didn't get enough rows.
if len(sampled_rows) == 0:
error = 'No valid rows could be generated with the given conditions.'
raise ValueError(error)
elif not graceful_reject_sampling:
error = f'Could not get enough valid rows within {max_retries} trials.'
raise ValueError(error)
else:
warn(f'Only {len(sampled_rows)} rows could '
f'be sampled within {max_retries} trials.')
if len(sampled_rows) > 0:
sampled_rows[COND_IDX] = dataframe[COND_IDX].values[:len(sampled_rows)]
return sampled_rows
def sample(self, num_rows=None, max_retries=100, max_rows_multiplier=10,
conditions=None, float_rtol=0.01, graceful_reject_sampling=False):
"""Sample rows from this table.
Args:
num_rows (int):
Number of rows to sample. If not given the model
will generate as many rows as there were in the
data passed to the ``fit`` method.
max_retries (int):
Number of times to retry sampling discarded rows.
Defaults to 100.
max_rows_multiplier (int):
Multiplier to use when computing the maximum number of rows
that can be sampled during the reject-sampling loop.
The maximum number of rows that are sampled at each iteration
will be equal to this number multiplied by the requested num_rows.
Defaults to 10.
conditions (pd.DataFrame, dict or pd.Series):
If this is a dictionary/Series which maps column names to the column
value, then this method generates `num_rows` samples, all of
which are conditioned on the given variables. If this is a DataFrame,
then it generates an output DataFrame such that each row in the output
is sampled conditional on the corresponding row in the input.
float_rtol (float):
Maximum tolerance when considering a float match. This is the maximum
relative distance at which a float value will be considered a match
when performing reject-sampling based conditioning. Defaults to 0.01.
graceful_reject_sampling (bool):
If `False` raises a `ValueError` if not enough valid rows could be sampled
within `max_retries` trials. If `True` prints a warning and returns
as many rows as it was able to sample within `max_retries`. If no rows could
be generated, raises a `ValueError`.
Defaults to False.
Returns:
pandas.DataFrame:
Sampled data.
"""
if conditions is None:
num_rows = num_rows or self._num_rows
return self._sample_batch(num_rows, max_retries, max_rows_multiplier)
# convert conditions to dataframe
conditions = self._make_conditions_df(conditions, num_rows)
# validate columns
for column in conditions.columns:
if column not in self._metadata.get_fields():
raise ValueError(f'Invalid column name `{column}`')
transformed_conditions = self._metadata.transform(conditions, on_missing_column='drop')
condition_columns = list(conditions.columns)
transformed_columns = list(transformed_conditions.columns)
conditions.index.name = COND_IDX
conditions.reset_index(inplace=True)
transformed_conditions.index.name = COND_IDX
transformed_conditions.reset_index(inplace=True)
grouped_conditions = conditions.groupby(condition_columns)
# sample
all_sampled_rows = list()
for group, dataframe in grouped_conditions:
if not isinstance(group, tuple):
group = [group]
condition_indices = dataframe[COND_IDX]
condition = dict(zip(condition_columns, group))
if transformed_conditions.empty:
sampled_rows = self._conditionally_sample_rows(
dataframe,
max_retries,
max_rows_multiplier,
condition,
None,
float_rtol,
graceful_reject_sampling
)
all_sampled_rows.append(sampled_rows)
else:
transformed_conditions_in_group = transformed_conditions.loc[condition_indices]
transformed_groups = transformed_conditions_in_group.groupby(transformed_columns)
for transformed_group, transformed_dataframe in transformed_groups:
if not isinstance(transformed_group, tuple):
transformed_group = [transformed_group]
transformed_condition = dict(zip(transformed_columns, transformed_group))
sampled_rows = self._conditionally_sample_rows(
transformed_dataframe,
max_retries,
max_rows_multiplier,
condition,
transformed_condition,
float_rtol,
graceful_reject_sampling
)
all_sampled_rows.append(sampled_rows)
all_sampled_rows = pd.concat(all_sampled_rows)
all_sampled_rows = all_sampled_rows.set_index(COND_IDX)
all_sampled_rows.index.name = conditions.index.name
all_sampled_rows = all_sampled_rows.sort_index()
all_sampled_rows = self._metadata.make_ids_unique(all_sampled_rows)
return all_sampled_rows
def _get_parameters(self):
raise NonParametricError()
def get_parameters(self):
"""Get the parameters learned from the data.
The result is a flat dict (single level) which contains
all the necessary parameters to be able to reproduce
this model.
Subclasses which are not parametric, such as DeepLearning
based models, raise a NonParametricError indicating that
this method is not supported for their implementation.
Returns:
parameters (dict):
flat dict (single level) which contains all the
necessary parameters to be able to reproduce
this model.
Raises:
NonParametricError:
If the model is not parametric or cannot be described
using a simple dictionary.
"""
if self._metadata.get_dtypes(ids=False):
parameters = self._get_parameters()
else:
parameters = {}
parameters['num_rows'] = self._num_rows
return parameters
def _set_parameters(self, parameters):
raise NonParametricError()
def set_parameters(self, parameters):
"""Regenerate a previously learned model from its parameters.
Subclasses which are not parametric, such as DeepLearning
based models, raise a NonParametricError indicating that
this method is not supported for their implementation.
Args:
dict:
Model parameters.
Raises:
NonParametricError:
If the model is not parametric or cannot be described
using a simple dictionary.
"""
num_rows = parameters.pop('num_rows')
self._num_rows = 0 if pd.isnull(num_rows) else max(0, int(round(num_rows)))
if self._metadata.get_dtypes(ids=False):
self._set_parameters(parameters)
def save(self, path):
"""Save this model instance to the given path using pickle.
Args:
path (str):
Path where the SDV instance will be serialized.
"""
with open(path, 'wb') as output:
pickle.dump(self, output)
@classmethod
def load(cls, path):
"""Load a TabularModel instance from a given path.
Args:
path (str):
Path from which to load the instance.
Returns:
TabularModel:
The loaded tabular model.
"""
with open(path, 'rb') as f:
return pickle.load(f)
|
var express = require('express');
var _ = require('lodash');
var router = express.Router();
var request = require('request');
var moment = require('moment');
var configuration = require('../config.json');
router.get('/flights/:from/:to/:start/:end/:direction/:limit', function(req, res, next) {
var leaveFrom = req.params.from;
var goTo = req.params.to;
var start = req.params.start;
var end = req.params.end;
var direction = req.params.direction;
var limit = req.params.limit;
var parsedBody;
var jsonUrl = 'http://static.letsgo.woooooo.science/flights/outbound.json';
var endpointUrl = 'https://www.priceline.com/pws/v0/air/search/'+leaveFrom+'-'+goTo+'-'+start+'/'+goTo+'-'+leaveFrom+'-'+end+'/1?direction='+direction;
function parseBody(err, resp, body) {
if(!err && resp.statusCode == 200) {
parsedBody = JSON.parse(body)["airSearchRsp"];
var sliceMap = parsedBody["sliceMap"];
var segmentMap = parsedBody["segmentMap"];
var itineraryPricing = parsedBody["pricedItinerary"];
var segments = _.map(segmentMap, function(segment) {
return {
'flightID': segment.uniqueSegId,
'arrival': segment.arrivalDateTime,
'depart': segment.departDateTime,
'origin': segment.origAirport,
'dest': segment.destAirport,
'airline': segment.marketingAirline,
'fltno': segment.flightNumber,
'aircraft': segment.equipmentCode,
'duration': segment.duration
}
});
var itineraries = _.map(itineraryPricing, function(itinerary) {
return {
'id': itinerary.slice[0].uniqueSliceId,
'fare': itinerary.pricingInfo.totalFare
};
});
var flights = _.map(sliceMap, function(slice) {
var fullSegment = [];
var flightduration = 0;
for (var i = 0; i < slice.segment.length; i++) {
var applicableSegments = _.filter(segments, {'flightID': slice.segment[i].uniqueSegId});
fullSegment.push(applicableSegments);
applicableSegments.forEach(function(element) {
flightduration += element.duration;
}, this);
}
return {
'id': slice.uniqueSliceId,
'layoverTime': slice.duration - flightduration,
'cost': _.filter(itineraries, {'id': slice.uniqueSliceId})[0].fare,
'tripSegment': fullSegment
}
});
//console.log(flights);
// sliceMap.forEach(function(entry) {
// var fullSegment = [];
// entry["segment"].forEach(function(flight) {
// fullSegment.push(segmentMap[flight.uniqueSegId]);
// });
// flights.push(fullSegment);
// });
if(limit > 0) {
res.json(_.slice(flights, 0, limit));
} else {
res.json(flights);
}
}
}
request(endpointUrl, parseBody);
});
//Query http link
// receive JSON
// parse usable data into js array
router.get('/hotels/:coordinates/:start/:end', function(req, res, next) {
var coordinates = req.params.coordinates;
var start = req.params.start;
var end = req.params.end;
request('http://priceline.com/api/hotelretail/listing/v3/'+coordinates+'/'+start+'/'+end+'/1/50?minStars=3&minGuestRating=6&sort=2', function(error, response, body){
if(!error && response.statusCode == 200) {
var hotelResp = JSON.parse(body);
var sortedPrice = hotelResp["priceSorted"];
var availableHotels = [];
for(var i = 0; i < sortedPrice.length; i++) {
if(hotelResp["hotels"][sortedPrice[i]].remainingRooms > 0) {
availableHotels.push(sortedPrice[i]);
}
}
var firstElement = hotelResp["hotels"][availableHotels[0]];
res.send({
'name': firstElement.hotelName,
'price': firstElement.merchPrice,
'overallRating': firstElement.overallRatingScore,
'address': firstElement.address,
'image': firstElement.thumbnailURL,
'amenities': firstElement.amenities
});
}
});
});
router.get('/places/:loc/:query', function(req, res, next) {
var loc = req.params.loc;
var query = req.params.query;
var rand;
request('https://maps.googleapis.com/maps/api/place/textsearch/json?query='+query+' in '+loc+"&key="+configuration.gmaps.API_KEY, function(error, response, body){
if(!error && response.statusCode == 200 && response.status!="ZERO") {
var ret = []
var stuff = JSON.parse(body)["results"];
rand = Math.floor(Math.random() * stuff.length);
// console.log(rand + " length of array is " + stuff.length);
while(stuff[rand] && ret.length < 3){
ret.push({
'name': stuff[rand].name,
'address': stuff[rand].formatted_address,
'icon': stuff[rand].icon
});
rand = Math.floor(Math.random() * stuff.length);
}
res.send(ret);
} else {
res.send({
'status': 'ERR_NORESULT'
});
}
});
});
router.get('/uber/:startLat/:startLon/:endLat/:endLon', function(req, res, next){
var startLat = req.params.startLat;
var startLon = req.params.startLon;
var endLat = req.params.endLat;
var endLon = req.params.endLon;
request('https://api.uber.com/v1/estimates/price?start_latitude='+startLat+'&start_longitude='+startLon+'&end_latitude='+endLat+'&end_longitude='+endLon+'&server_token='+configuration.uber.API_KEY, function(error, response, body){
if(!error && response.statusCode == 200 && typeof JSON.parse(body)["prices"][0] != 'undefined'){
console.log(error + " " + response + " " + body);
var rideInfo = JSON.parse(body)["prices"];
console.log(rideInfo);
res.send({
'name': rideInfo[0].display_name,
'costEstimate': rideInfo[0].estimate,
'duration': rideInfo[0].duration
});
}
else if(JSON.parse(body)["prices"].length == 0){
res.send({
'available': 0
});
}
});
});
module.exports = router;
|
window.globalProvideData('slide', '{"title":"Transparency Assessments","trackViews":true,"showMenuResultIcon":false,"viewGroupId":"","historyGroupId":"","videoZoom":"","scrolling":false,"transition":"tween","slideLock":false,"navIndex":-1,"globalAudioId":"","thumbnailid":"","presenterRef":{"id":"none"},"slideLayers":[{"audiolib":[{"kind":"audio","assetId":143,"id":"5VGTb0xn2vn"}],"enableSeek":true,"enableReplay":true,"timeline":{"duration":22250,"events":[{"kind":"ontimelinetick","time":0,"actions":[{"kind":"show","transition":"appear","objRef":{"type":"string","value":"5W0KAimvzOB"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"5sqzW5GpIfk"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"5nkoZRmHisH"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"6e89JvWNDJz"}},{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"6B4z2dD9NR6"}},{"kind":"media_seek","position":0,"objRef":{"type":"string","value":"5VGTb0xn2vn"}},{"kind":"media_play","objRef":{"type":"string","value":"5VGTb0xn2vn"}},{"kind":"set_volume","volume":75,"objRef":{"type":"string","value":"5VGTb0xn2vn"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"6997nK7JXG4"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"6bqfMNA45jX"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"62UT52no5Jj"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"6k5TKhckheu"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"696jAZ9krxF"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"6WBv5hu56wz"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"6V5AIMZqJTB"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"67NPqMByO9z"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"5rzSNTZCYqQ"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"6fTN5KzrTen"}}]},{"kind":"ontimelinetick","time":250,"actions":[{"kind":"show","transition":"appear","objRef":{"type":"string","value":"6YyECfUUNBD"}},{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"6YyECfUUNBD.6dvl5Nn3SNl"}},{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"6YyECfUUNBD.6idsNs0dWjw"}},{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"6YyECfUUNBD.5pTlWFhA34r"}},{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"6YyECfUUNBD.6gruWgm5pq8"}},{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"6YyECfUUNBD.5rCfVESXYVg"}},{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"6YyECfUUNBD.5aomkNnDnI1"}},{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"6YyECfUUNBD.5ymvZdZ0HK3"}}]},{"kind":"ontimelinetick","time":4875,"actions":[{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"6YyECfUUNBD.6JvEsJRDcCm"}}]},{"kind":"ontimelinetick","time":4896,"actions":[{"kind":"hide","transition":"appear","objRef":{"type":"string","value":"6fTN5KzrTen"}},{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"6YyECfUUNBD.5jfPTiYUlFb"}},{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"6YyECfUUNBD.6SAr2kC47ec"}}]},{"kind":"ontimelinetick","time":4897,"actions":[{"kind":"show","transition":"appear","objRef":{"type":"string","value":"5oS63TeOPkm"}}]},{"kind":"ontimelinetick","time":9500,"actions":[{"kind":"hide","transition":"custom","animationId":"Exit","reverse":false,"objRef":{"type":"string","value":"6YyECfUUNBD.6dvl5Nn3SNl"}},{"kind":"hide","transition":"custom","animationId":"Exit","reverse":false,"objRef":{"type":"string","value":"6YyECfUUNBD.6idsNs0dWjw"}},{"kind":"hide","transition":"custom","animationId":"Exit","reverse":false,"objRef":{"type":"string","value":"6YyECfUUNBD.5pTlWFhA34r"}},{"kind":"hide","transition":"custom","animationId":"Exit","reverse":false,"objRef":{"type":"string","value":"6YyECfUUNBD.6gruWgm5pq8"}},{"kind":"hide","transition":"custom","animationId":"Exit","reverse":false,"objRef":{"type":"string","value":"6YyECfUUNBD.5rCfVESXYVg"}},{"kind":"hide","transition":"custom","animationId":"Exit","reverse":false,"objRef":{"type":"string","value":"6YyECfUUNBD.5aomkNnDnI1"}},{"kind":"hide","transition":"custom","animationId":"Exit","reverse":false,"objRef":{"type":"string","value":"6YyECfUUNBD.5ymvZdZ0HK3"}},{"kind":"hide","transition":"custom","animationId":"Exit","reverse":false,"objRef":{"type":"string","value":"6YyECfUUNBD.6JvEsJRDcCm"}}]},{"kind":"ontimelinetick","time":9521,"actions":[{"kind":"hide","transition":"custom","animationId":"Exit","reverse":false,"objRef":{"type":"string","value":"6YyECfUUNBD.5jfPTiYUlFb"}},{"kind":"hide","transition":"custom","animationId":"Exit","reverse":false,"objRef":{"type":"string","value":"6YyECfUUNBD.6SAr2kC47ec"}}]},{"kind":"ontimelinetick","time":9583,"actions":[{"kind":"hide","transition":"custom","animationId":"Exit","reverse":false,"objRef":{"type":"string","value":"6B4z2dD9NR6"}}]},{"kind":"ontimelinetick","time":10250,"actions":[{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"6rEQ6cP8Kgg"}},{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"6nLxqCyjDbf"}}]},{"kind":"ontimelinetick","time":10271,"actions":[{"kind":"hide","transition":"appear","objRef":{"type":"string","value":"6YyECfUUNBD"}}]},{"kind":"ontimelinetick","time":10272,"actions":[{"kind":"show","transition":"appear","objRef":{"type":"string","value":"5Y82ge0uKg1"}}]},{"kind":"ontimelinetick","time":10334,"actions":[{"kind":"hide","transition":"appear","objRef":{"type":"string","value":"5oS63TeOPkm"}}]},{"kind":"ontimelinetick","time":11750,"actions":[{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"6qfCpYKOGYN"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"6qfCpYKOGYN.5kT7vBUszGq"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"6qfCpYKOGYN.5abAQcLuvl4"}},{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"6qfCpYKOGYN.6ccZXXh8ZAr"}}]},{"kind":"ontimelinetick","time":13000,"actions":[{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"5cHD7Y1WxFS"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"5cHD7Y1WxFS.5t8TDdQfwxU"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"5cHD7Y1WxFS.5ao9P4C0DOS"}},{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"5cHD7Y1WxFS.6GJP4Cx0H1D"}}]},{"kind":"ontimelinetick","time":14896,"actions":[{"kind":"hide","transition":"appear","objRef":{"type":"string","value":"5Y82ge0uKg1"}}]},{"kind":"ontimelinetick","time":14897,"actions":[{"kind":"show","transition":"appear","objRef":{"type":"string","value":"6kYFnsbtEPu"}}]},{"kind":"ontimelinetick","time":18355,"actions":[{"kind":"show","transition":"appear","objRef":{"type":"string","value":"5kRG7hdSl54"}}]},{"kind":"ontimelinetick","time":18375,"actions":[{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"6JotPwkMkDW"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"6JotPwkMkDW.66zZ6Bmgrju"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"6JotPwkMkDW.6PYctCbHqK4"}},{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"6T7TdyyDovX"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"6T7TdyyDovX.6HWNFmdN4JF"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"6T7TdyyDovX.66AmiOAWAQK"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"6T7TdyyDovX.6EnIKYNzFsH"}},{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"6ghh0tK6HNW"}},{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"6LoJ57uC6Nu"}},{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"5gJbZfl0Rsp"}}]},{"kind":"ontimelinetick","time":18396,"actions":[{"kind":"hide","transition":"appear","objRef":{"type":"string","value":"6kYFnsbtEPu"}}]},{"kind":"ontimelinetick","time":19125,"actions":[{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"6GTON98Id5r"}}]}]},"objects":[{"kind":"vectorshape","rotation":0,"accType":"image","cliptobounds":false,"defaultAction":"","imagelib":[{"kind":"imagedata","assetId":7,"id":"01","url":"story_content/5y5CcPM8Fb5_DX1440_DY1440.swf","type":"normal","altText":"UI-new-001.png","width":720,"height":540,"mobiledx":0,"mobiledy":0}],"shapemaskId":"","xPos":0,"yPos":0,"tabIndex":6,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":360,"rotateYPos":270,"scaleX":100,"scaleY":100,"alpha":100,"depth":1,"scrolling":false,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":720,"bottom":540,"altText":"UI-new-001.png","pngfb":false,"pr":{"l":"Lib","i":0}},"html5data":{"xPos":0,"yPos":0,"width":720,"height":540,"strokewidth":0}},"width":720,"height":540,"resume":false,"useHandCursor":true,"id":"6V5AIMZqJTB"},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"67NPqMByO9z_-835033488","id":"01","linkId":"txt__default_67NPqMByO9z","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":196,"bottom":29,"pngfb":false,"pr":{"l":"Lib","i":2}}}],"shapemaskId":"","xPos":72,"yPos":13,"tabIndex":7,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":103,"rotateYPos":17,"scaleX":100,"scaleY":100,"alpha":100,"depth":2,"scrolling":false,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":206,"bottom":34,"altText":"Introduction to IATI","pngfb":false,"pr":{"l":"Lib","i":1}},"html5data":{"xPos":-1,"yPos":-1,"width":207,"height":35,"strokewidth":0}},"width":206,"height":34,"resume":false,"useHandCursor":true,"id":"67NPqMByO9z"},{"kind":"vectorshape","rotation":0,"accType":"button","cliptobounds":false,"defaultAction":"onrelease","imagelib":[{"kind":"imagedata","assetId":8,"id":"01","url":"story_content/6959LQb2FCO_DX102_DY102.swf","type":"normal","altText":"CC.png","width":51,"height":26,"mobiledx":0,"mobiledy":0}],"shapemaskId":"","xPos":4,"yPos":510,"tabIndex":54,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":25.5,"rotateYPos":13,"scaleX":100,"scaleY":100,"alpha":100,"depth":3,"scrolling":false,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":51,"bottom":26,"altText":"CC.png","pngfb":false,"pr":{"l":"Lib","i":30}},"html5data":{"xPos":0,"yPos":0,"width":51,"height":26,"strokewidth":0}},"width":51,"height":26,"resume":false,"useHandCursor":true,"id":"5rzSNTZCYqQ","events":[{"kind":"onrelease","actions":[{"kind":"adjustvar","variable":"_player.Transcripttoggle","operator":"toggle","value":{"type":"var","value":"_player.#Transcripttoggle"}}]}]},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"6bqfMNA45jX_-2074032789","id":"01","linkId":"txt__default_6bqfMNA45jX","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":100,"bottom":100,"pngfb":false,"pr":{"l":"Lib","i":4}}}],"shapemaskId":"","xPos":1095,"yPos":469,"tabIndex":52,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":56,"rotateYPos":52.5,"scaleX":100,"scaleY":100,"alpha":100,"depth":4,"scrolling":false,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":112,"bottom":105,"altText":"constScreensInCourse^%^constScreensInCourse^%^","pngfb":false,"pr":{"l":"Lib","i":3}},"html5data":{"xPos":-1,"yPos":-1,"width":113,"height":106,"strokewidth":0}},"width":112,"height":105,"resume":false,"useHandCursor":true,"id":"6bqfMNA45jX"},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"62UT52no5Jj_2020058222","id":"01","linkId":"txt__default_62UT52no5Jj","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":271,"bottom":24,"pngfb":false,"pr":{"l":"Lib","i":6}}}],"shapemaskId":"","xPos":895,"yPos":157,"tabIndex":16,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":172,"rotateYPos":14.5,"scaleX":100,"scaleY":100,"alpha":100,"depth":5,"scrolling":false,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":344,"bottom":29,"altText":"Count: ^%^gblScreensVisitedCount^%^","pngfb":false,"pr":{"l":"Lib","i":5}},"html5data":{"xPos":-1,"yPos":-1,"width":345,"height":30,"strokewidth":0}},"width":344,"height":29,"resume":false,"useHandCursor":true,"id":"62UT52no5Jj"},{"kind":"vectorshape","rotation":0,"accType":"radio","cliptobounds":false,"defaultAction":"onrelease","shapemaskId":"","xPos":1135,"yPos":168,"tabIndex":17,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":32,"rotateYPos":21.5,"scaleX":100,"scaleY":100,"alpha":100,"depth":6,"scrolling":false,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":-1,"top":-1,"right":64,"bottom":43,"altText":"Text Box 2","pngfb":false,"pr":{"l":"Lib","i":7}},"html5data":{"xPos":-1,"yPos":-1,"width":65,"height":44,"strokewidth":0}},"states":[{"kind":"state","name":"_default_Disabled","data":{"hotlinkId":"","accState":1,"vectorData":{"left":-1,"top":-1,"right":64,"bottom":43,"altText":"Radio Button 1","pngfb":false,"pr":{"l":"Lib","i":8}},"html5data":{"xPos":-1,"yPos":-1,"width":65,"height":44,"strokewidth":3}}},{"kind":"state","name":"_default_Down","data":{"hotlinkId":"","accState":8,"vectorData":{"left":-1,"top":-1,"right":64,"bottom":43,"altText":"Radio Button 1","pngfb":false,"pr":{"l":"Lib","i":8}},"html5data":{"xPos":-1,"yPos":-1,"width":65,"height":44,"strokewidth":3}}},{"kind":"state","name":"_default_Selected","data":{"hotlinkId":"","accState":16,"vectorData":{"left":-1,"top":-1,"right":64,"bottom":43,"altText":"Radio Button 1","pngfb":false,"pr":{"l":"Lib","i":9}},"html5data":{"xPos":-1,"yPos":-1,"width":65,"height":44,"strokewidth":3}}},{"kind":"state","name":"_default_Selected_Disabled","data":{"hotlinkId":"","accState":17,"vectorData":{"left":-1,"top":-1,"right":64,"bottom":43,"altText":"Radio Button 1","pngfb":false,"pr":{"l":"Lib","i":9}},"html5data":{"xPos":-1,"yPos":-1,"width":65,"height":44,"strokewidth":3}}},{"kind":"state","name":"_default_Down_Selected","data":{"hotlinkId":"","accState":24,"vectorData":{"left":-1,"top":-1,"right":64,"bottom":43,"altText":"Radio Button 1","pngfb":false,"pr":{"l":"Lib","i":10}},"html5data":{"xPos":-1,"yPos":-1,"width":65,"height":44,"strokewidth":3}}},{"kind":"state","name":"_default_Hover","data":{"hotlinkId":"","accState":0,"vectorData":{"left":-1,"top":-1,"right":64,"bottom":43,"altText":"Radio Button 1","pngfb":false,"pr":{"l":"Lib","i":11}},"html5data":{"xPos":-1,"yPos":-1,"width":65,"height":44,"strokewidth":3}}},{"kind":"state","name":"_default_Hover_Disabled","data":{"hotlinkId":"","accState":1,"vectorData":{"left":-1,"top":-1,"right":64,"bottom":43,"altText":"Radio Button 1","pngfb":false,"pr":{"l":"Lib","i":11}},"html5data":{"xPos":-1,"yPos":-1,"width":65,"height":44,"strokewidth":3}}},{"kind":"state","name":"_default_Hover_Down","data":{"hotlinkId":"","accState":8,"vectorData":{"left":-1,"top":-1,"right":64,"bottom":43,"altText":"Radio Button 1","pngfb":false,"pr":{"l":"Lib","i":12}},"html5data":{"xPos":-1,"yPos":-1,"width":65,"height":44,"strokewidth":3}}},{"kind":"state","name":"_default_Hover_Selected","data":{"hotlinkId":"","accState":16,"vectorData":{"left":-1,"top":-1,"right":64,"bottom":43,"altText":"Radio Button 1","pngfb":false,"pr":{"l":"Lib","i":13}},"html5data":{"xPos":-1,"yPos":-1,"width":65,"height":44,"strokewidth":3}}},{"kind":"state","name":"_default_Hover_Selected_Disabled","data":{"hotlinkId":"","accState":17,"vectorData":{"left":-1,"top":-1,"right":64,"bottom":43,"altText":"Radio Button 1","pngfb":false,"pr":{"l":"Lib","i":14}},"html5data":{"xPos":-1,"yPos":-1,"width":65,"height":44,"strokewidth":3}}},{"kind":"state","name":"_default_Hover_Down_Selected","data":{"hotlinkId":"","accState":24,"vectorData":{"left":-1,"top":-1,"right":64,"bottom":43,"altText":"Radio Button 1","pngfb":false,"pr":{"l":"Lib","i":15}},"html5data":{"xPos":-1,"yPos":-1,"width":65,"height":44,"strokewidth":3}}}],"width":64,"height":43,"resume":true,"useHandCursor":true,"id":"6k5TKhckheu","variables":[{"kind":"variable","name":"_hover","type":"boolean","value":false,"resume":true},{"kind":"variable","name":"_down","type":"boolean","value":false,"resume":true},{"kind":"variable","name":"_disabled","type":"boolean","value":false,"resume":true},{"kind":"variable","name":"_checked","type":"boolean","value":false,"resume":true},{"kind":"variable","name":"_state","type":"string","value":"_default","resume":true},{"kind":"variable","name":"_stateName","type":"string","value":"","resume":true},{"kind":"variable","name":"_tempStateName","type":"string","value":"","resume":false}],"actionGroups":{"ActGrpSetCheckedState":{"kind":"actiongroup","actions":[{"kind":"adjustvar","variable":"_checked","operator":"set","value":{"type":"boolean","value":true}},{"kind":"exe_actiongroup","id":"_player._setstates","scopeRef":{"type":"string","value":"_this"}}]},"ActGrpSetHoverState":{"kind":"actiongroup","actions":[{"kind":"adjustvar","variable":"_hover","operator":"set","value":{"type":"boolean","value":true}},{"kind":"exe_actiongroup","id":"_player._setstates","scopeRef":{"type":"string","value":"_this"}}]},"ActGrpClearHoverState":{"kind":"actiongroup","actions":[{"kind":"adjustvar","variable":"_hover","operator":"set","value":{"type":"boolean","value":false}},{"kind":"exe_actiongroup","id":"_player._setstates","scopeRef":{"type":"string","value":"_this"}}]},"ActGrpSetDisabledState":{"kind":"actiongroup","actions":[{"kind":"adjustvar","variable":"_disabled","operator":"set","value":{"type":"boolean","value":true}},{"kind":"exe_actiongroup","id":"_player._setstates","scopeRef":{"type":"string","value":"_this"}}]},"ActGrpSetDownState":{"kind":"actiongroup","actions":[{"kind":"adjustvar","variable":"_down","operator":"set","value":{"type":"boolean","value":true}},{"kind":"exe_actiongroup","id":"_player._setstates","scopeRef":{"type":"string","value":"_this"}}]},"ActGrpClearStateVars":{"kind":"actiongroup","actions":[{"kind":"adjustvar","variable":"_hover","operator":"set","value":{"type":"boolean","value":false}},{"kind":"adjustvar","variable":"_down","operator":"set","value":{"type":"boolean","value":false}},{"kind":"adjustvar","variable":"_disabled","operator":"set","value":{"type":"boolean","value":false}},{"kind":"adjustvar","variable":"_checked","operator":"set","value":{"type":"boolean","value":false}}]}},"events":[{"kind":"ontransitionin","actions":[{"kind":"exe_actiongroup","id":"_player._setstates","scopeRef":{"type":"string","value":"_this"}}]},{"kind":"onrollover","actions":[{"kind":"exe_actiongroup","id":"ActGrpSetHoverState","scopeRef":{"type":"string","value":"_this"}}]},{"kind":"onrollout","actions":[{"kind":"exe_actiongroup","id":"ActGrpClearHoverState","scopeRef":{"type":"string","value":"_this"}}]},{"kind":"onpress","actions":[{"kind":"exe_actiongroup","id":"ActGrpSetDownState","scopeRef":{"type":"string","value":"_this"}}]},{"kind":"onrelease","actions":[{"kind":"adjustvar","variable":"_checked","operator":"set","value":{"type":"boolean","value":true}},{"kind":"adjustvar","variable":"_down","operator":"set","value":{"type":"boolean","value":false}},{"kind":"exe_actiongroup","id":"_player._setstates","scopeRef":{"type":"string","value":"_this"}}]},{"kind":"onreleaseoutside","actions":[{"kind":"adjustvar","variable":"_down","operator":"set","value":{"type":"boolean","value":false}},{"kind":"exe_actiongroup","id":"_player._setstates","scopeRef":{"type":"string","value":"_this"}}]}]},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"696jAZ9krxF_898765040","id":"01","linkId":"txt__default_696jAZ9krxF","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":239,"bottom":43,"pngfb":false,"pr":{"l":"Lib","i":17}}}],"shapemaskId":"","xPos":863,"yPos":180,"tabIndex":18,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":128,"rotateYPos":24,"scaleX":100,"scaleY":100,"alpha":100,"depth":7,"scrolling":false,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":256,"bottom":48,"altText":"^%^gblScreensVisitedPercentage^%^","pngfb":false,"pr":{"l":"Lib","i":16}},"html5data":{"xPos":-1,"yPos":-1,"width":257,"height":49,"strokewidth":0}},"width":256,"height":48,"resume":false,"useHandCursor":true,"id":"696jAZ9krxF"},{"kind":"vectorshape","rotation":0,"accType":"button","cliptobounds":false,"defaultAction":"onrelease","imagelib":[{"kind":"imagedata","assetId":8,"id":"01","url":"story_content/6959LQb2FCO_DX102_DY102.swf","type":"normal","altText":"CC.png","width":51,"height":26,"mobiledx":0,"mobiledy":0}],"shapemaskId":"","xPos":4,"yPos":510,"tabIndex":53,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":25.5,"rotateYPos":13,"scaleX":100,"scaleY":100,"alpha":100,"depth":8,"scrolling":false,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":51,"bottom":26,"altText":"CC.png","pngfb":false,"pr":{"l":"Lib","i":30}},"html5data":{"xPos":0,"yPos":0,"width":51,"height":26,"strokewidth":0}},"width":51,"height":26,"resume":false,"useHandCursor":true,"id":"6WBv5hu56wz","events":[{"kind":"onrelease","actions":[{"kind":"adjustvar","variable":"_player.Transcripttoggle","operator":"toggle","value":{"type":"var","value":"_player.#Transcripttoggle"}}]}]},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"5W0KAimvzOB_1538290639","id":"01","linkId":"txt__default_5W0KAimvzOB","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":19,"bottom":25,"pngfb":false,"pr":{"l":"Lib","i":399}}}],"shapemaskId":"","xPos":87,"yPos":62,"tabIndex":10,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":14.5,"rotateYPos":15,"scaleX":100,"scaleY":100,"alpha":100,"depth":9,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":29,"bottom":30,"altText":"4","pngfb":false,"pr":{"l":"Lib","i":157}},"html5data":{"xPos":-1,"yPos":-1,"width":30,"height":31,"strokewidth":0}},"width":29,"height":30,"resume":false,"useHandCursor":true,"id":"5W0KAimvzOB"},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"5sqzW5GpIfk_308112437","id":"01","linkId":"txt__default_5sqzW5GpIfk","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":281,"bottom":25,"pngfb":false,"pr":{"l":"Lib","i":401}}}],"shapemaskId":"","xPos":111,"yPos":62,"tabIndex":11,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":145.5,"rotateYPos":15,"scaleX":100,"scaleY":100,"alpha":100,"depth":10,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":291,"bottom":30,"altText":"Quality and Completeness of Data","pngfb":false,"pr":{"l":"Lib","i":400}},"html5data":{"xPos":-1,"yPos":-1,"width":292,"height":31,"strokewidth":0}},"width":291,"height":30,"resume":false,"useHandCursor":true,"id":"5sqzW5GpIfk"},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"5nkoZRmHisH_-491081242","id":"01","linkId":"txt__default_5nkoZRmHisH","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":24,"bottom":21,"pngfb":false,"pr":{"l":"Lib","i":114}}}],"shapemaskId":"","xPos":644,"yPos":18,"tabIndex":8,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":17,"rotateYPos":13,"scaleX":100,"scaleY":100,"alpha":100,"depth":11,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":34,"bottom":26,"altText":"02","pngfb":false,"pr":{"l":"Lib","i":43}},"html5data":{"xPos":-1,"yPos":-1,"width":35,"height":27,"strokewidth":0}},"width":34,"height":26,"resume":false,"useHandCursor":true,"id":"5nkoZRmHisH"},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"6e89JvWNDJz_-31687256","id":"01","linkId":"txt__default_6e89JvWNDJz","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":222,"bottom":25,"pngfb":false,"pr":{"l":"Lib","i":450}}}],"shapemaskId":"","xPos":7,"yPos":102,"tabIndex":12,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":116,"rotateYPos":15,"scaleX":100,"scaleY":100,"alpha":100,"depth":12,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":232,"bottom":30,"altText":"Transparency Assessments","pngfb":false,"pr":{"l":"Lib","i":261}},"html5data":{"xPos":-1,"yPos":-1,"width":233,"height":31,"strokewidth":0}},"width":232,"height":30,"resume":false,"useHandCursor":true,"id":"6e89JvWNDJz"},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"6B4z2dD9NR6_594702569","id":"01","linkId":"txt__default_6B4z2dD9NR6","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":692,"bottom":43,"pngfb":false,"pr":{"l":"Lib","i":451}}}],"shapemaskId":"","xPos":7,"yPos":129,"tabIndex":13,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":349.5,"rotateYPos":24,"scaleX":100,"scaleY":100,"alpha":100,"depth":13,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":699,"bottom":48,"altText":"Transparency and accountability should be at the core of an organisation’s work as they are vital to improving trust and confidence in humanitarian and development initiatives. ","pngfb":false,"pr":{"l":"Lib","i":415}},"html5data":{"xPos":-1,"yPos":-1,"width":700,"height":49,"strokewidth":0}},"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]},{"kind":"animation","id":"Exit","duration":750,"hidetextatend":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"100","dstart":"0","end":"0","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easeout"}}]}],"width":699,"height":48,"resume":false,"useHandCursor":true,"id":"6B4z2dD9NR6"},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"6fTN5KzrTen_1750747223","id":"01","linkId":"txt__default_6fTN5KzrTen","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":44,"bottom":25,"pngfb":false,"pr":{"l":"Lib","i":32}}}],"shapemaskId":"","xPos":-80,"yPos":150,"tabIndex":15,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":29.5,"rotateYPos":14.5,"scaleX":100,"scaleY":100,"alpha":100,"depth":14,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":-2,"top":-2,"right":62,"bottom":32,"altText":"CC 1","pngfb":false,"pr":{"l":"Lib","i":31}},"html5data":{"xPos":-1,"yPos":-1,"width":61,"height":31,"strokewidth":3}},"width":60,"height":30,"resume":false,"useHandCursor":true,"id":"6fTN5KzrTen","events":[{"kind":"ontransitionin","actions":[{"kind":"adjustvar","variable":"_player.Transcript","operator":"set","value":{"type":"string","value":"Transparency and accountability should be at the core of an organisation’s work as"}}]}]},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"5oS63TeOPkm_-89570216","id":"01","linkId":"txt__default_5oS63TeOPkm","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":44,"bottom":25,"pngfb":false,"pr":{"l":"Lib","i":33}}}],"shapemaskId":"","xPos":-80,"yPos":188,"tabIndex":19,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":29.5,"rotateYPos":14.5,"scaleX":100,"scaleY":100,"alpha":100,"depth":15,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":-2,"top":-2,"right":62,"bottom":32,"altText":"CC 2","pngfb":false,"pr":{"l":"Lib","i":31}},"html5data":{"xPos":-1,"yPos":-1,"width":61,"height":31,"strokewidth":3}},"width":60,"height":30,"resume":false,"useHandCursor":true,"id":"5oS63TeOPkm","events":[{"kind":"ontransitionin","actions":[{"kind":"adjustvar","variable":"_player.Transcript","operator":"set","value":{"type":"string","value":"they are vital to improving trust and confidence in humanitarian and development initiatives. "}}]}]},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"5Y82ge0uKg1_-1525270083","id":"01","linkId":"txt__default_5Y82ge0uKg1","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":44,"bottom":25,"pngfb":false,"pr":{"l":"Lib","i":34}}}],"shapemaskId":"","xPos":-80,"yPos":227,"tabIndex":31,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":29.5,"rotateYPos":14.5,"scaleX":100,"scaleY":100,"alpha":100,"depth":16,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":-2,"top":-2,"right":62,"bottom":32,"altText":"CC 3","pngfb":false,"pr":{"l":"Lib","i":31}},"html5data":{"xPos":-1,"yPos":-1,"width":61,"height":31,"strokewidth":3}},"width":60,"height":30,"resume":false,"useHandCursor":true,"id":"5Y82ge0uKg1","events":[{"kind":"ontransitionin","actions":[{"kind":"adjustvar","variable":"_player.Transcript","operator":"set","value":{"type":"string","value":"IATI data is often used by donors and independent agencies to assess "}}]}]},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"6kYFnsbtEPu_-1951706760","id":"01","linkId":"txt__default_6kYFnsbtEPu","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":44,"bottom":25,"pngfb":false,"pr":{"l":"Lib","i":35}}}],"shapemaskId":"","xPos":-80,"yPos":265,"tabIndex":41,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":29.5,"rotateYPos":14.5,"scaleX":100,"scaleY":100,"alpha":100,"depth":17,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":-2,"top":-2,"right":62,"bottom":32,"altText":"CC 4","pngfb":false,"pr":{"l":"Lib","i":31}},"html5data":{"xPos":-1,"yPos":-1,"width":61,"height":31,"strokewidth":3}},"width":60,"height":30,"resume":false,"useHandCursor":true,"id":"6kYFnsbtEPu","events":[{"kind":"ontransitionin","actions":[{"kind":"adjustvar","variable":"_player.Transcript","operator":"set","value":{"type":"string","value":"a publisher\'s performance on transparency indicators."}}]}]},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"5kRG7hdSl54_993937830","id":"01","linkId":"txt__default_5kRG7hdSl54","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":44,"bottom":25,"pngfb":false,"pr":{"l":"Lib","i":36}}}],"shapemaskId":"","xPos":-80,"yPos":304,"tabIndex":42,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":29.5,"rotateYPos":14.5,"scaleX":100,"scaleY":100,"alpha":100,"depth":18,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":-2,"top":-2,"right":62,"bottom":32,"altText":"CC 5","pngfb":false,"pr":{"l":"Lib","i":31}},"html5data":{"xPos":-1,"yPos":-1,"width":61,"height":31,"strokewidth":3}},"width":60,"height":30,"resume":false,"useHandCursor":true,"id":"5kRG7hdSl54","events":[{"kind":"ontransitionin","actions":[{"kind":"adjustvar","variable":"_player.Transcript","operator":"set","value":{"type":"string","value":"Examples of such assessments are described in the following pages."}}]}]},{"kind":"objgroup","objects":[{"kind":"vectorshape","rotation":0,"accType":"image","cliptobounds":false,"defaultAction":"","imagelib":[{"kind":"imagedata","assetId":135,"id":"01","url":"story_content/5Wx0prl94rl_DX180_DY180.swf","type":"normal","altText":"publisher.png","width":180,"height":180,"mobiledx":0,"mobiledy":0}],"shapemaskId":"","xPos":196,"yPos":50,"tabIndex":25,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":45,"rotateYPos":45,"scaleX":100,"scaleY":100,"alpha":100,"depth":1,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":90,"bottom":90,"altText":"publisher.png","pngfb":false,"pr":{"l":"Lib","i":452}},"html5data":{"xPos":0,"yPos":0,"width":90,"height":90,"strokewidth":0}},"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]},{"kind":"animation","id":"Exit","duration":750,"hidetextatend":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"100","dstart":"0","end":"0","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easeout"}}]}],"width":90,"height":90,"resume":false,"useHandCursor":true,"id":"6dvl5Nn3SNl"},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","shapemaskId":"","xPos":161,"yPos":11,"tabIndex":23,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":0,"rotateYPos":84,"scaleX":100,"scaleY":100,"alpha":100,"depth":2,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":-2,"top":-2,"right":2,"bottom":170,"altText":"Line 1","pngfb":false,"pr":{"l":"Lib","i":453}},"html5data":{"xPos":-1,"yPos":-1,"width":1,"height":169,"strokewidth":2}},"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]},{"kind":"animation","id":"Exit","duration":750,"hidetextatend":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"100","dstart":"0","end":"0","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easeout"}}]}],"width":0,"height":168,"resume":false,"useHandCursor":true,"id":"6idsNs0dWjw"},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","shapemaskId":"","xPos":161,"yPos":96,"tabIndex":27,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":17.5,"rotateYPos":0,"scaleX":100,"scaleY":100,"alpha":100,"depth":3,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":-2,"top":-2,"right":37,"bottom":2,"altText":"Line 2","pngfb":false,"pr":{"l":"Lib","i":454}},"html5data":{"xPos":-1,"yPos":-1,"width":36,"height":1,"strokewidth":2}},"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]},{"kind":"animation","id":"Exit","duration":750,"hidetextatend":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"100","dstart":"0","end":"0","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easeout"}}]}],"width":35,"height":0,"resume":false,"useHandCursor":true,"id":"5pTlWFhA34r"},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","shapemaskId":"","xPos":137,"yPos":179,"tabIndex":30,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":12,"rotateYPos":0,"scaleX":100,"scaleY":100,"alpha":100,"depth":4,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":-2,"top":-2,"right":26,"bottom":2,"altText":"Line 3","pngfb":false,"pr":{"l":"Lib","i":455}},"html5data":{"xPos":-1,"yPos":-1,"width":25,"height":1,"strokewidth":2}},"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]},{"kind":"animation","id":"Exit","duration":750,"hidetextatend":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"100","dstart":"0","end":"0","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easeout"}}]}],"width":24,"height":0,"resume":false,"useHandCursor":true,"id":"6gruWgm5pq8"},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","shapemaskId":"","xPos":137,"yPos":11,"tabIndex":22,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":12,"rotateYPos":0,"scaleX":100,"scaleY":100,"alpha":100,"depth":5,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":-2,"top":-2,"right":26,"bottom":2,"altText":"Line 4","pngfb":false,"pr":{"l":"Lib","i":455}},"html5data":{"xPos":-1,"yPos":-1,"width":25,"height":1,"strokewidth":2}},"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]},{"kind":"animation","id":"Exit","duration":750,"hidetextatend":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"100","dstart":"0","end":"0","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easeout"}}]}],"width":24,"height":0,"resume":false,"useHandCursor":true,"id":"5rCfVESXYVg"},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"5bshpeBkCS5_-416551657","id":"01","linkId":"txt__default_5aomkNnDnI1","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":121,"bottom":22,"pngfb":false,"pr":{"l":"Lib","i":458}}}],"shapemaskId":"","xPos":0,"yPos":0,"tabIndex":21,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":72,"rotateYPos":12,"scaleX":100,"scaleY":100,"alpha":100,"depth":6,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":-1,"top":-1,"right":145,"bottom":25,"altText":"Transparency","pngfb":false,"pr":{"l":"Lib","i":456}},"html5data":{"xPos":-1,"yPos":-1,"width":145,"height":25,"strokewidth":0}},"states":[{"kind":"state","name":"New State","data":{"hotlinkId":"","accState":0,"vectorData":{"left":-1,"top":-1,"right":145,"bottom":25,"altText":"Transparency","pngfb":false,"pr":{"l":"Lib","i":457}},"html5data":{"xPos":-1,"yPos":-1,"width":145,"height":25,"strokewidth":0}}}],"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]},{"kind":"animation","id":"Exit","duration":750,"hidetextatend":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"100","dstart":"0","end":"0","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easeout"}}]}],"width":144,"height":24,"resume":false,"useHandCursor":true,"id":"5aomkNnDnI1","variables":[{"kind":"variable","name":"_state","type":"string","value":"New State","resume":true},{"kind":"variable","name":"_disabled","type":"boolean","value":false,"resume":true},{"kind":"variable","name":"_stateName","type":"string","value":"","resume":true},{"kind":"variable","name":"_tempStateName","type":"string","value":"","resume":false}],"actionGroups":{"ActGrpClearStateVars":{"kind":"actiongroup","actions":[]}},"events":[{"kind":"ontransitionin","actions":[{"kind":"exe_actiongroup","id":"_player._setstates","scopeRef":{"type":"string","value":"_this"}}]}]},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"6PLe3DSC7TH_-169768929","id":"01","linkId":"txt__default_5ymvZdZ0HK3","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":125,"bottom":22,"pngfb":false,"pr":{"l":"Lib","i":459}}}],"shapemaskId":"","xPos":0,"yPos":167,"tabIndex":29,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":72,"rotateYPos":12,"scaleX":100,"scaleY":100,"alpha":100,"depth":7,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":-1,"top":-1,"right":145,"bottom":25,"altText":"Accountability","pngfb":false,"pr":{"l":"Lib","i":456}},"html5data":{"xPos":-1,"yPos":-1,"width":145,"height":25,"strokewidth":0}},"states":[{"kind":"state","name":"New State","data":{"hotlinkId":"","accState":0,"vectorData":{"left":-1,"top":-1,"right":145,"bottom":25,"altText":"Accountability","pngfb":false,"pr":{"l":"Lib","i":457}},"html5data":{"xPos":-1,"yPos":-1,"width":145,"height":25,"strokewidth":0}}}],"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]},{"kind":"animation","id":"Exit","duration":750,"hidetextatend":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"100","dstart":"0","end":"0","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easeout"}}]}],"width":144,"height":24,"resume":false,"useHandCursor":true,"id":"5ymvZdZ0HK3","variables":[{"kind":"variable","name":"_state","type":"string","value":"New State","resume":true},{"kind":"variable","name":"_disabled","type":"boolean","value":false,"resume":true},{"kind":"variable","name":"_stateName","type":"string","value":"","resume":true},{"kind":"variable","name":"_tempStateName","type":"string","value":"","resume":false}],"actionGroups":{"ActGrpClearStateVars":{"kind":"actiongroup","actions":[]}},"events":[{"kind":"ontransitionin","actions":[{"kind":"exe_actiongroup","id":"_player._setstates","scopeRef":{"type":"string","value":"_this"}}]}]},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"6JvEsJRDcCm_1342853988","id":"01","linkId":"txt__default_6JvEsJRDcCm","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":147,"bottom":41,"pngfb":false,"pr":{"l":"Lib","i":461}}}],"shapemaskId":"","xPos":356,"yPos":142,"tabIndex":28,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":76.5,"rotateYPos":23,"scaleX":100,"scaleY":100,"alpha":100,"depth":8,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":153,"bottom":46,"altText":"Improving trust and confidence","pngfb":false,"pr":{"l":"Lib","i":460}},"html5data":{"xPos":-1,"yPos":-1,"width":154,"height":47,"strokewidth":0}},"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]},{"kind":"animation","id":"Exit","duration":750,"hidetextatend":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"100","dstart":"0","end":"0","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easeout"}}]}],"width":153,"height":46,"resume":false,"useHandCursor":true,"id":"6JvEsJRDcCm"},{"kind":"vectorshape","rotation":0,"accType":"image","cliptobounds":false,"defaultAction":"","imagelib":[{"kind":"imagedata","assetId":136,"id":"01","url":"story_content/6q5Ia7AsC8T_DX188_DY188.swf","type":"normal","altText":"Group 7.png","width":188,"height":188,"mobiledx":0,"mobiledy":0}],"shapemaskId":"","xPos":380,"yPos":47,"tabIndex":24,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":47,"rotateYPos":47,"scaleX":100,"scaleY":100,"alpha":100,"depth":9,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":94,"bottom":94,"altText":"Group 7.png","pngfb":false,"pr":{"l":"Lib","i":462}},"html5data":{"xPos":0,"yPos":0,"width":94,"height":94,"strokewidth":0}},"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]},{"kind":"animation","id":"Exit","duration":750,"hidetextatend":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"100","dstart":"0","end":"0","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easeout"}}]}],"width":94,"height":94,"resume":false,"useHandCursor":true,"id":"5jfPTiYUlFb"},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","shapemaskId":"","xPos":284,"yPos":79,"tabIndex":26,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":48,"rotateYPos":16,"scaleX":100,"scaleY":100,"alpha":100,"depth":10,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":96,"bottom":32,"altText":"Right Arrow 1","pngfb":false,"pr":{"l":"Lib","i":463}},"html5data":{"xPos":-1,"yPos":-1,"width":97,"height":33,"strokewidth":0}},"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]},{"kind":"animation","id":"Exit","duration":750,"hidetextatend":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"100","dstart":"0","end":"0","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easeout"}}]}],"width":96,"height":32,"resume":false,"useHandCursor":true,"id":"6SAr2kC47ec"}],"accType":"text","altText":"Group\\r\\n 8","shapemaskId":"","xPos":23,"yPos":219,"tabIndex":20,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":254.5,"rotateYPos":95.5,"scaleX":100,"scaleY":100,"alpha":100,"rotation":0,"depth":19,"scrolling":true,"shuffleLock":false,"width":509,"height":191,"resume":false,"useHandCursor":true,"id":"6YyECfUUNBD"},{"kind":"objgroup","objects":[{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"6j5RitcYUpN_608893036","id":"01","linkId":"txt__default_5kT7vBUszGq","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":106,"bottom":30,"pngfb":false,"pr":{"l":"Lib","i":466}}}],"shapemaskId":"","xPos":0,"yPos":11,"tabIndex":35,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":88,"rotateYPos":20,"scaleX":100,"scaleY":100,"alpha":100,"depth":1,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":-1,"top":-1,"right":177,"bottom":41,"altText":"Data","pngfb":false,"pr":{"l":"Lib","i":464}},"html5data":{"xPos":-1,"yPos":-1,"width":177,"height":41,"strokewidth":0}},"states":[{"kind":"state","name":"New State","data":{"hotlinkId":"","accState":0,"vectorData":{"left":-1,"top":-1,"right":177,"bottom":41,"altText":"Data","pngfb":false,"pr":{"l":"Lib","i":465}},"html5data":{"xPos":-1,"yPos":-1,"width":177,"height":41,"strokewidth":0}}}],"width":176,"height":40,"resume":false,"useHandCursor":true,"id":"5kT7vBUszGq","variables":[{"kind":"variable","name":"_state","type":"string","value":"New State","resume":true},{"kind":"variable","name":"_disabled","type":"boolean","value":false,"resume":true},{"kind":"variable","name":"_stateName","type":"string","value":"","resume":true},{"kind":"variable","name":"_tempStateName","type":"string","value":"","resume":false}],"actionGroups":{"ActGrpClearStateVars":{"kind":"actiongroup","actions":[]}},"events":[{"kind":"ontransitionin","actions":[{"kind":"exe_actiongroup","id":"_player._setstates","scopeRef":{"type":"string","value":"_this"}}]}]},{"kind":"vectorshape","rotation":0,"accType":"image","cliptobounds":false,"defaultAction":"","imagelib":[{"kind":"imagedata","assetId":137,"id":"01","url":"story_content/6qb7PMm8tOa_DX124_DY124.swf","type":"normal","altText":"Group 2.png","width":124,"height":124,"mobiledx":0,"mobiledy":0}],"shapemaskId":"","xPos":169,"yPos":0,"tabIndex":34,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":31,"rotateYPos":31,"scaleX":100,"scaleY":100,"alpha":100,"depth":2,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":62,"bottom":62,"altText":"Group 2.png","pngfb":false,"pr":{"l":"Lib","i":467}},"html5data":{"xPos":0,"yPos":0,"width":62,"height":62,"strokewidth":0}},"width":62,"height":62,"resume":false,"useHandCursor":true,"id":"5abAQcLuvl4"},{"kind":"vectorshape","rotation":90,"accType":"text","cliptobounds":false,"defaultAction":"","shapemaskId":"","xPos":186,"yPos":58,"tabIndex":36,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":14,"rotateYPos":12,"scaleX":100,"scaleY":100,"alpha":100,"depth":3,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":28,"bottom":24,"altText":"Right Arrow 2","pngfb":false,"pr":{"l":"Lib","i":468}},"html5data":{"xPos":-1,"yPos":-1,"width":29,"height":25,"strokewidth":0}},"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]}],"width":28,"height":24,"resume":false,"useHandCursor":true,"id":"6ccZXXh8ZAr"}],"accType":"text","altText":"Group\\r\\n 10","shapemaskId":"","xPos":42,"yPos":243,"tabIndex":33,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":116,"rotateYPos":42,"scaleX":100,"scaleY":100,"alpha":100,"rotation":0,"depth":20,"scrolling":true,"shuffleLock":false,"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]}],"width":232,"height":84,"resume":false,"useHandCursor":true,"id":"6qfCpYKOGYN"},{"kind":"objgroup","objects":[{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"6Uka8UrFACL_-2074703327","id":"01","linkId":"txt__default_5t8TDdQfwxU","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":169,"bottom":39,"pngfb":false,"pr":{"l":"Lib","i":469}}}],"shapemaskId":"","xPos":0,"yPos":10,"tabIndex":46,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":88,"rotateYPos":20,"scaleX":100,"scaleY":100,"alpha":100,"depth":1,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":-1,"top":-1,"right":177,"bottom":41,"altText":"Donors/Independent Agencies ","pngfb":false,"pr":{"l":"Lib","i":464}},"html5data":{"xPos":-1,"yPos":-1,"width":177,"height":41,"strokewidth":0}},"states":[{"kind":"state","name":"New State","data":{"hotlinkId":"","accState":0,"vectorData":{"left":-1,"top":-1,"right":177,"bottom":41,"altText":"Donors/Independent Agencies ","pngfb":false,"pr":{"l":"Lib","i":465}},"html5data":{"xPos":-1,"yPos":-1,"width":177,"height":41,"strokewidth":0}}}],"width":176,"height":40,"resume":false,"useHandCursor":true,"id":"5t8TDdQfwxU","variables":[{"kind":"variable","name":"_state","type":"string","value":"New State","resume":true},{"kind":"variable","name":"_disabled","type":"boolean","value":false,"resume":true},{"kind":"variable","name":"_stateName","type":"string","value":"","resume":true},{"kind":"variable","name":"_tempStateName","type":"string","value":"","resume":false}],"actionGroups":{"ActGrpClearStateVars":{"kind":"actiongroup","actions":[]}},"events":[{"kind":"ontransitionin","actions":[{"kind":"exe_actiongroup","id":"_player._setstates","scopeRef":{"type":"string","value":"_this"}}]}]},{"kind":"vectorshape","rotation":0,"accType":"image","cliptobounds":false,"defaultAction":"","imagelib":[{"kind":"imagedata","assetId":138,"id":"01","url":"story_content/5uu2OmmvqRj_DX124_DY124.swf","type":"normal","altText":"user.png","width":124,"height":124,"mobiledx":0,"mobiledy":0}],"shapemaskId":"","xPos":169,"yPos":0,"tabIndex":45,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":31,"rotateYPos":31,"scaleX":100,"scaleY":100,"alpha":100,"depth":2,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":62,"bottom":62,"altText":"user.png","pngfb":false,"pr":{"l":"Lib","i":467}},"html5data":{"xPos":0,"yPos":0,"width":62,"height":62,"strokewidth":0}},"width":62,"height":62,"resume":false,"useHandCursor":true,"id":"5ao9P4C0DOS"},{"kind":"vectorshape","rotation":90,"accType":"text","cliptobounds":false,"defaultAction":"","shapemaskId":"","xPos":186,"yPos":55,"tabIndex":47,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":14,"rotateYPos":12,"scaleX":100,"scaleY":100,"alpha":100,"depth":3,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":28,"bottom":24,"altText":"Right Arrow 3","pngfb":false,"pr":{"l":"Lib","i":468}},"html5data":{"xPos":-1,"yPos":-1,"width":29,"height":25,"strokewidth":0}},"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]}],"width":28,"height":24,"resume":false,"useHandCursor":true,"id":"6GJP4Cx0H1D"}],"accType":"text","altText":"Group\\r\\n 9","shapemaskId":"","xPos":42,"yPos":328,"tabIndex":44,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":116,"rotateYPos":40.5,"scaleX":100,"scaleY":100,"alpha":100,"rotation":0,"depth":21,"scrolling":true,"shuffleLock":false,"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]}],"width":232,"height":81,"resume":false,"useHandCursor":true,"id":"5cHD7Y1WxFS"},{"kind":"objgroup","objects":[{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"6RNWnk4sRO2_47245419","id":"01","linkId":"txt__default_66zZ6Bmgrju","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":141,"bottom":39,"pngfb":false,"pr":{"l":"Lib","i":470}}}],"shapemaskId":"","xPos":0,"yPos":10,"tabIndex":50,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":88,"rotateYPos":20,"scaleX":100,"scaleY":100,"alpha":100,"depth":1,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":-1,"top":-1,"right":177,"bottom":41,"altText":"Transparency Indicators","pngfb":false,"pr":{"l":"Lib","i":464}},"html5data":{"xPos":-1,"yPos":-1,"width":177,"height":41,"strokewidth":0}},"states":[{"kind":"state","name":"New State","data":{"hotlinkId":"","accState":0,"vectorData":{"left":-1,"top":-1,"right":177,"bottom":41,"altText":"Transparency Indicators","pngfb":false,"pr":{"l":"Lib","i":465}},"html5data":{"xPos":-1,"yPos":-1,"width":177,"height":41,"strokewidth":0}}}],"width":176,"height":40,"resume":false,"useHandCursor":true,"id":"66zZ6Bmgrju","variables":[{"kind":"variable","name":"_state","type":"string","value":"New State","resume":true},{"kind":"variable","name":"_disabled","type":"boolean","value":false,"resume":true},{"kind":"variable","name":"_stateName","type":"string","value":"","resume":true},{"kind":"variable","name":"_tempStateName","type":"string","value":"","resume":false}],"actionGroups":{"ActGrpClearStateVars":{"kind":"actiongroup","actions":[]}},"events":[{"kind":"ontransitionin","actions":[{"kind":"exe_actiongroup","id":"_player._setstates","scopeRef":{"type":"string","value":"_this"}}]}]},{"kind":"vectorshape","rotation":0,"accType":"image","cliptobounds":false,"defaultAction":"","imagelib":[{"kind":"imagedata","assetId":139,"id":"01","url":"story_content/5ff2fiQ9fx0_DX124_DY124.swf","type":"normal","altText":"grp.png","width":124,"height":124,"mobiledx":0,"mobiledy":0}],"shapemaskId":"","xPos":169,"yPos":0,"tabIndex":49,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":31,"rotateYPos":31,"scaleX":100,"scaleY":100,"alpha":100,"depth":2,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":62,"bottom":62,"altText":"grp.png","pngfb":false,"pr":{"l":"Lib","i":467}},"html5data":{"xPos":0,"yPos":0,"width":62,"height":62,"strokewidth":0}},"width":62,"height":62,"resume":false,"useHandCursor":true,"id":"6PYctCbHqK4"}],"accType":"text","altText":"Group\\r\\n 6","shapemaskId":"","xPos":42,"yPos":412,"tabIndex":48,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":116,"rotateYPos":31,"scaleX":100,"scaleY":100,"alpha":100,"rotation":0,"depth":22,"scrolling":true,"shuffleLock":false,"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]}],"width":232,"height":62,"resume":false,"useHandCursor":true,"id":"6JotPwkMkDW"},{"kind":"objgroup","objects":[{"kind":"vectorshape","rotation":335,"accType":"text","cliptobounds":false,"defaultAction":"","imagelib":[{"kind":"imagedata","assetId":140,"id":"01","url":"","type":"normal","width":229,"height":122,"mobiledx":0,"mobiledy":0}],"shapemaskId":"","xPos":11,"yPos":39,"tabIndex":38,"tabEnabled":true,"xOffset":-10,"yOffset":-11,"rotateXPos":104,"rotateYPos":50.5,"scaleX":100,"scaleY":100,"alpha":100,"depth":1,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":229,"bottom":122,"altText":"Arrow 2","pngfb":false,"pr":{"l":"Lib","i":142}},"html5data":{"url":"txt__default_6HWNFmdN4JF.png","xPos":-10,"yPos":-11,"width":229,"height":122,"strokewidth":1,"mask":"9CBO1XDCO7XD9O8XDBO7XDBO7XDAO8XD9O9XD8O6X1O1XD9O4XDFO2XDBO2XDFO5XDCO6XDCO5XDEO3XDBO1X2O1XDAO4XDDO6XDBO6XDDO4XDBO0X3O1XDBO3XDEO5XDCO6XDCO5XDFO2XDBO1XE0O4XDDO6XDBO6XDDO4XDBO0X3O1XDBO2XDEO5XDCO6XDDO4XDFO2XDBO2XDFO4XDDO6XDBO6XDEO3XDBO0X3O1XDBO3XDEO5XDCO6XDCO5XDFO2XDBO1XDFO5XDCO6XDCO5XDEO3XDBO1X3O0XDBO3XDEO6XDBO6XDDO4XDFO2XDBO2XDFO4XDDO6XDBO6XDEO3XDBO0X3O1XDBO3XDDO6XDBO6XDDO4XE0O1XDBO2XDFO5XDCO6XDCO5XDEO3XDBO1X3O0XDBO3XDEO6XDBO6XDDO4XDFO2XDBO2XDFO4XDCO6XDCO5XDFO2XDBO1X3O0XDBO4XDDO6XDBO6XDDO4XDBO0X3O1XDBO3XDEO5XDCO6XDCO5XDEO3XDBO1XE0O4XDCO6XDCO5XDEO3XE0O1X8E5O"}},"width":208,"height":101,"resume":false,"useHandCursor":true,"id":"6HWNFmdN4JF"},{"kind":"vectorshape","rotation":35,"accType":"text","cliptobounds":false,"defaultAction":"","imagelib":[{"kind":"imagedata","assetId":141,"id":"01","url":"","type":"normal","width":86,"height":175,"mobiledx":0,"mobiledy":0}],"shapemaskId":"","xPos":85,"yPos":57,"tabIndex":40,"tabEnabled":true,"xOffset":-10,"yOffset":-11,"rotateXPos":32.5,"rotateYPos":76.5,"scaleX":100,"scaleY":100,"alpha":100,"depth":2,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":86,"bottom":175,"altText":"Arrow 4","pngfb":false,"pr":{"l":"Lib","i":142}},"html5data":{"url":"txt__default_66AmiOAWAQK.png","xPos":-10,"yPos":-11,"width":86,"height":175,"strokewidth":1,"mask":"3A7O0X53O1X52O2X52O2X51O3X50O4X4FO4X4FO5X4FO5X4FO5X50O4X4FO3X51O2X52O2X51O2X52O2X152O1X53O2X51O3X51O2X51O3X51O2X51O3X51O2X52O2X152O2X51O3X51O2X52O2X51O3X51O2X51O3X51O2X54O0XFCO1X53O2X51O3X51O2X52O2X51O3X51O2X51O3X51O2X152O2X52O2X51O3X51O2X51O3X51O2X52O2X51O3X52O1XFDO0X53O2X52O2X51O3X51O2X51O3X51O2X52O2X51O3X151O2X52O2X52O2X51O3X51O2X51O3X51O2X52O2X52O1X152O2X52O2X52O2X51O2X52O2X51O3X51O2X52O2X152O1X52O3X51O2X51O3X51O2X52O2X51O3X51O2X52O2X152O2X51O3X51O2X51O3X51O2X52O2X51O3X51O2X53O1XFCO0X54O2X51O3X51O2X51O3X51O2X52O2X51O2X52O2X152O2X52O2X51O2X52O2X51O3X51O2X51O3X51O2X53O1XFCO0X54O2X52O2X51O2X52O2X51O3X51O2X51O3X51O2X3A5O"}},"width":65,"height":153,"resume":false,"useHandCursor":true,"id":"66AmiOAWAQK"},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","imagelib":[{"kind":"imagedata","assetId":142,"id":"01","url":"","type":"normal","width":169,"height":25,"mobiledx":0,"mobiledy":0}],"shapemaskId":"","xPos":41,"yPos":175,"tabIndex":39,"tabEnabled":true,"xOffset":-10,"yOffset":-11,"rotateXPos":74,"rotateYPos":2,"scaleX":100,"scaleY":100,"alpha":100,"depth":3,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":169,"bottom":25,"altText":"Arrow 3","pngfb":false,"pr":{"l":"Lib","i":142}},"html5data":{"url":"txt__default_6EnIKYNzFsH.png","xPos":-10,"yPos":-11,"width":169,"height":25,"strokewidth":1,"mask":"5DCO3XA4O7X7DO5X3O7X3O8X3OAX54O5X3O8X3O7X3O8X3O7X3O8X3O9X31O4X3O8X2O8X3O7X3O8X3O7X3O8X3O7X3O5X6O6X17O8X3O8X2O8X3O8X2O8X3O7X3O8X3O5X2BO3X1AO8X3O8X2O8X3O8X2O6X6FO8X3O8X679O"}},"width":148,"height":4,"resume":false,"useHandCursor":true,"id":"6EnIKYNzFsH"}],"accType":"text","altText":"Group\\r\\n 7","shapemaskId":"","xPos":225,"yPos":259,"tabIndex":37,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":115.5,"rotateYPos":107,"scaleX":100,"scaleY":100,"alpha":100,"rotation":0,"depth":23,"scrolling":true,"shuffleLock":false,"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]}],"width":231,"height":214,"resume":false,"useHandCursor":true,"id":"6T7TdyyDovX"},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"6ghh0tK6HNW_1161743674","id":"01","linkId":"txt__default_6ghh0tK6HNW","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":227,"bottom":30,"pngfb":false,"pr":{"l":"Lib","i":472}}}],"shapemaskId":"","xPos":414,"yPos":242,"tabIndex":32,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":124,"rotateYPos":20,"scaleX":100,"scaleY":100,"alpha":100,"depth":24,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":-2,"top":-2,"right":250,"bottom":43,"altText":"The Aid Transparency Index","pngfb":false,"pr":{"l":"Lib","i":471}},"html5data":{"xPos":-1,"yPos":-1,"width":249,"height":41,"strokewidth":2}},"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]}],"width":248,"height":40,"resume":false,"useHandCursor":true,"id":"6ghh0tK6HNW"},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"6LoJ57uC6Nu_-1335981803","id":"01","linkId":"txt__default_6LoJ57uC6Nu","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":208,"bottom":39,"pngfb":false,"pr":{"l":"Lib","i":474}}}],"shapemaskId":"","xPos":414,"yPos":328,"tabIndex":43,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":124,"rotateYPos":20,"scaleX":100,"scaleY":100,"alpha":100,"depth":25,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":-2,"top":-2,"right":250,"bottom":42,"altText":"Global Partnership Transparency Indicator","pngfb":false,"pr":{"l":"Lib","i":473}},"html5data":{"xPos":-1,"yPos":-1,"width":249,"height":41,"strokewidth":2}},"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]}],"width":248,"height":40,"resume":false,"useHandCursor":true,"id":"6LoJ57uC6Nu"},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"5gJbZfl0Rsp_-1725941451","id":"01","linkId":"txt__default_5gJbZfl0Rsp","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":179,"bottom":29,"pngfb":false,"pr":{"l":"Lib","i":475}}}],"shapemaskId":"","xPos":414,"yPos":414,"tabIndex":51,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":124,"rotateYPos":20,"scaleX":100,"scaleY":100,"alpha":100,"depth":26,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":-2,"top":-2,"right":250,"bottom":42,"altText":"Donor Reviews","pngfb":false,"pr":{"l":"Lib","i":473}},"html5data":{"xPos":-1,"yPos":-1,"width":249,"height":41,"strokewidth":2}},"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]}],"width":248,"height":40,"resume":false,"useHandCursor":true,"id":"5gJbZfl0Rsp"},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","shapemaskId":"","xPos":7,"yPos":129,"tabIndex":14,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":349.5,"rotateYPos":43,"scaleX":100,"scaleY":100,"alpha":100,"depth":27,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":699,"bottom":86,"altText":"IATI data is often used by donors and independent agencies to assess a publisher\'s performance on transparency indicators.\\n\\nExamples of such assessments are described in the following pages.","pngfb":false,"pr":{"l":"Lib","i":476}},"html5data":{"xPos":-1,"yPos":-1,"width":700,"height":87,"strokewidth":0}},"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]}],"width":699,"height":86,"resume":false,"useHandCursor":true,"id":"6rEQ6cP8Kgg"},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"txt_6GTON98Id5r","id":"01","linkId":"txt_6GTON98Id5r","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":504,"bottom":81,"pngfb":false,"pr":{"l":"Lib","i":478}}}],"shapemaskId":"","xPos":7,"yPos":129,"tabIndex":55,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":349.5,"rotateYPos":43,"scaleX":100,"scaleY":100,"alpha":100,"depth":28,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":504,"bottom":81,"altText":"Examples of such assessments are described in the following pages.","pngfb":false,"pr":{"l":"Lib","i":477}},"html5data":{"xPos":0,"yPos":0,"width":504,"height":81,"strokewidth":0}},"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]}],"width":699,"height":86,"resume":false,"useHandCursor":true,"id":"6GTON98Id5r"},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"txt_6nLxqCyjDbf","id":"01","linkId":"txt_6nLxqCyjDbf","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":621,"bottom":43,"pngfb":false,"pr":{"l":"Lib","i":479}}}],"shapemaskId":"","xPos":7,"yPos":129,"tabIndex":56,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":349.5,"rotateYPos":43,"scaleX":100,"scaleY":100,"alpha":100,"depth":29,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":621,"bottom":43,"altText":"IATI data is often used by donors and independent agencies to assess a publisher\'s performance on transparency indicators.","pngfb":false,"pr":{"l":"Lib","i":477}},"html5data":{"xPos":0,"yPos":0,"width":621,"height":43,"strokewidth":0}},"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]}],"width":699,"height":86,"resume":false,"useHandCursor":true,"id":"6nLxqCyjDbf"},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","uniqueId":"6997nK7JXG4_853005538","id":"01","linkId":"txt__default_6997nK7JXG4","type":"vectortext","xPos":0,"yPos":0,"width":0,"height":0,"shadowIndex":-1,"vectortext":{"left":0,"top":0,"right":24,"bottom":21,"pngfb":false,"pr":{"l":"Lib","i":313}}}],"shapemaskId":"","xPos":667,"yPos":18,"tabIndex":9,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":17,"rotateYPos":13,"scaleX":100,"scaleY":100,"alpha":100,"depth":30,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":34,"bottom":26,"altText":"05","pngfb":false,"pr":{"l":"Lib","i":43}},"html5data":{"xPos":-1,"yPos":-1,"width":35,"height":27,"strokewidth":0}},"width":34,"height":26,"resume":false,"useHandCursor":true,"id":"6997nK7JXG4"}],"startTime":-1,"elapsedTimeMode":"normal","animations":[{"kind":"animation","id":"5oNS2t3GPFB","duration":500,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":500,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":500,"easing":"linear","easingdir":"easein"}}]}],"useHandCursor":false,"resume":false,"kind":"slidelayer","isBaseLayer":true},{"kind":"slidelayer","depth":0,"modal":true,"pauseParent":false,"rotateXPos":360,"rotateYPos":270,"tabIndex":-1,"enableSeek":true,"enableReplay":true,"lmsId":"","timeline":{"duration":1000,"events":[]},"objects":[],"startTime":-1,"elapsedTimeMode":"normal","width":720,"height":540,"resume":false,"useHandCursor":false,"id":"5uvCfU3i3yN","events":[{"kind":"onslidestart","actions":[{"kind":"set_window_control_visible","name":"next","visible":true},{"kind":"enable_window_control","name":"next","enable":true},{"kind":"enable_window_control","name":"swiperight","enable":true}]},{"kind":"ontimelinecomplete","actions":[{"kind":"show_slidelayer","hideOthers":"oncomplete","transition":"appear","objRef":{"type":"string","value":"_parent.6OBJ8jSmafv"}}]}]},{"kind":"slidelayer","depth":0,"modal":true,"pauseParent":false,"rotateXPos":360,"rotateYPos":270,"tabIndex":-1,"enableSeek":true,"enableReplay":true,"lmsId":"","timeline":{"duration":1000,"events":[]},"objects":[],"startTime":-1,"elapsedTimeMode":"normal","width":720,"height":540,"resume":false,"useHandCursor":false,"id":"6OBJ8jSmafv","events":[{"kind":"onslidestart","actions":[{"kind":"set_window_control_visible","name":"next","visible":true},{"kind":"enable_window_control","name":"next","enable":false},{"kind":"enable_window_control","name":"swiperight","enable":false}]},{"kind":"ontimelinecomplete","actions":[{"kind":"show_slidelayer","hideOthers":"oncomplete","transition":"appear","objRef":{"type":"string","value":"_parent.5uvCfU3i3yN"}}]}]},{"kind":"slidelayer","depth":0,"modal":false,"pauseParent":false,"rotateXPos":360,"rotateYPos":270,"tabIndex":-1,"enableSeek":true,"enableReplay":true,"lmsId":"","timeline":{"duration":92750,"events":[{"kind":"ontimelinetick","time":0,"actions":[{"kind":"show","transition":"appear","objRef":{"type":"string","value":"5nygwGXXfIs"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"6WEryrrPsY5"}},{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"5VLKez9xXGn"}}]}]},"objects":[{"kind":"vectorshape","rotation":0,"accType":"image","cliptobounds":false,"defaultAction":"","imagelib":[{"kind":"imagedata","assetId":20,"id":"01","url":"story_content/6JUTkcudY4d_DX1440_DY1440.swf","type":"normal","altText":"Rectangle 4.png","width":720,"height":34,"mobiledx":0,"mobiledy":0}],"shapemaskId":"","xPos":0,"yPos":506,"tabIndex":3,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":360,"rotateYPos":17,"scaleX":100,"scaleY":100,"alpha":100,"depth":1,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":720,"bottom":34,"altText":"Rectangle 4.png","pngfb":false,"pr":{"l":"Lib","i":66}},"html5data":{"xPos":0,"yPos":0,"width":720,"height":34,"strokewidth":0}},"width":720,"height":34,"resume":false,"useHandCursor":true,"id":"5nygwGXXfIs"},{"kind":"vectorshape","rotation":0,"accType":"button","cliptobounds":false,"defaultAction":"onrelease","imagelib":[{"kind":"imagedata","assetId":8,"id":"01","url":"story_content/6959LQb2FCO_DX102_DY102.swf","type":"normal","altText":"CC.png","width":51,"height":26,"mobiledx":0,"mobiledy":0}],"shapemaskId":"","xPos":4,"yPos":510,"tabIndex":5,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":25.5,"rotateYPos":13,"scaleX":100,"scaleY":100,"alpha":100,"depth":2,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":51,"bottom":26,"altText":"CC.png","pngfb":false,"pr":{"l":"Lib","i":30}},"html5data":{"xPos":0,"yPos":0,"width":51,"height":26,"strokewidth":0}},"width":51,"height":26,"resume":false,"useHandCursor":true,"id":"6WEryrrPsY5","events":[{"kind":"onrelease","actions":[{"kind":"adjustvar","variable":"_player.Transcripttoggle","operator":"toggle","value":{"type":"var","value":"_player.#Transcripttoggle"}}]}]},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","id":"01","linkId":"txt__default_5VLKez9xXGn","type":"vartext","xPos":0,"yPos":0,"width":649,"height":21,"device":true,"valign":"center","shadowIndex":-1,"vartext":"<p style=\\"text-align:center;direction: ltr\\"><font style=\\"font-family: \'Articulate Charset0_v8MBBDD1F1C\',\'Articulate\'; font-size:14px; color:#000000;line-height:16.198px;\\">%_player.Transcript%</font></p>"}],"shapemaskId":"","xPos":49,"yPos":508,"tabIndex":4,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":335,"rotateYPos":15.5,"scaleX":100,"scaleY":100,"alpha":100,"depth":3,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":671,"bottom":32,"altText":"%_player.Transcript%","pngfb":false,"pr":{"l":"Lib","i":67}},"html5data":{"xPos":-1,"yPos":-1,"width":671,"height":32,"strokewidth":0}},"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]}],"width":670,"height":31,"resume":false,"useHandCursor":true,"id":"5VLKez9xXGn"}],"startTime":-1,"elapsedTimeMode":"normal","width":720,"height":540,"resume":false,"useHandCursor":false,"id":"5iftd3jIQJ3"},{"kind":"slidelayer","depth":0,"modal":false,"pauseParent":false,"rotateXPos":360,"rotateYPos":270,"tabIndex":-1,"enableSeek":true,"enableReplay":true,"lmsId":"","timeline":{"duration":92750,"events":[{"kind":"ontimelinetick","time":0,"actions":[{"kind":"show","transition":"appear","objRef":{"type":"string","value":"6mMh379uDrp"}},{"kind":"show","transition":"appear","objRef":{"type":"string","value":"5g4O53RXvlj"}},{"kind":"show","transition":"custom","animationId":"Entrance","reverse":false,"objRef":{"type":"string","value":"5fT6FmrM0Wp"}}]}]},"objects":[{"kind":"vectorshape","rotation":0,"accType":"image","cliptobounds":false,"defaultAction":"","imagelib":[{"kind":"imagedata","assetId":20,"id":"01","url":"story_content/6JUTkcudY4d_DX1440_DY1440.swf","type":"normal","altText":"Rectangle 4.png","width":720,"height":34,"mobiledx":0,"mobiledy":0}],"shapemaskId":"","xPos":0,"yPos":506,"tabIndex":0,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":360,"rotateYPos":17,"scaleX":100,"scaleY":100,"alpha":100,"depth":1,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":720,"bottom":34,"altText":"Rectangle 4.png","pngfb":false,"pr":{"l":"Lib","i":66}},"html5data":{"xPos":0,"yPos":0,"width":720,"height":34,"strokewidth":0}},"width":720,"height":34,"resume":false,"useHandCursor":true,"id":"6mMh379uDrp"},{"kind":"vectorshape","rotation":0,"accType":"button","cliptobounds":false,"defaultAction":"onrelease","imagelib":[{"kind":"imagedata","assetId":8,"id":"01","url":"story_content/6959LQb2FCO_DX102_DY102.swf","type":"normal","altText":"CC.png","width":51,"height":26,"mobiledx":0,"mobiledy":0}],"shapemaskId":"","xPos":4,"yPos":510,"tabIndex":2,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":25.5,"rotateYPos":13,"scaleX":100,"scaleY":100,"alpha":100,"depth":2,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":51,"bottom":26,"altText":"CC.png","pngfb":false,"pr":{"l":"Lib","i":30}},"html5data":{"xPos":0,"yPos":0,"width":51,"height":26,"strokewidth":0}},"width":51,"height":26,"resume":false,"useHandCursor":true,"id":"5g4O53RXvlj","events":[{"kind":"onrelease","actions":[{"kind":"adjustvar","variable":"_player.Transcripttoggle","operator":"toggle","value":{"type":"var","value":"_player.#Transcripttoggle"}}]}]},{"kind":"vectorshape","rotation":0,"accType":"text","cliptobounds":false,"defaultAction":"","textLib":[{"kind":"textdata","id":"01","linkId":"txt__default_5fT6FmrM0Wp","type":"vartext","xPos":0,"yPos":0,"width":649,"height":21,"device":true,"valign":"center","shadowIndex":-1,"vartext":"<p style=\\"text-align:center;direction: ltr\\"><font style=\\"font-family: \'Articulate Charset0_v8MBBDD1F1C\',\'Articulate\'; font-size:14px; color:#000000;line-height:16.198px;\\">%_player.Transcript%</font></p>"}],"shapemaskId":"","xPos":49,"yPos":508,"tabIndex":1,"tabEnabled":true,"xOffset":0,"yOffset":0,"rotateXPos":335,"rotateYPos":15.5,"scaleX":100,"scaleY":100,"alpha":100,"depth":3,"scrolling":true,"shuffleLock":false,"data":{"hotlinkId":"","accState":0,"vectorData":{"left":0,"top":0,"right":671,"bottom":32,"altText":"%_player.Transcript%","pngfb":false,"pr":{"l":"Lib","i":67}},"html5data":{"xPos":-1,"yPos":-1,"width":671,"height":32,"strokewidth":0}},"animations":[{"kind":"animation","id":"Entrance","duration":750,"hidetextatstart":true,"animateshapewithtext":false,"tweens":[{"kind":"tween","time":0,"duration":750,"alpha":{"path":[{"kind":"segment","start":"0","dstart":"0","end":"100","dend":"0"}],"duration":750,"easing":"linear","easingdir":"easein"}}]}],"width":670,"height":31,"resume":false,"useHandCursor":true,"id":"5fT6FmrM0Wp"}],"startTime":-1,"elapsedTimeMode":"normal","width":720,"height":540,"resume":false,"useHandCursor":false,"id":"5VM01tUYIoA"}],"showAnimationId":"5oNS2t3GPFB","lmsId":"Slide2","width":720,"height":540,"resume":false,"background":{"type":"fill","fill":{"type":"linear","rotation":90,"colors":[{"kind":"color","rgb":"0xFFFFFF","alpha":100,"stop":0}]}},"id":"68EDn1Tvvcm","actionGroups":{"ActGrpOnSubmitButtonClick":{"kind":"actiongroup","actions":[]},"ActGrpOnNextButtonClick":{"kind":"actiongroup","actions":[{"kind":"gotoplay","window":"_current","wndtype":"normal","objRef":{"type":"string","value":"_player.6EcUFN1KkNJ.5eIYYmxt7UY"}}]},"ActGrpOnPrevButtonClick":{"kind":"actiongroup","actions":[{"kind":"gotoplay","window":"_current","wndtype":"normal","objRef":{"type":"string","value":"_player.6EcUFN1KkNJ.6n01GKdK338"}}]},"NavigationRestrictionNextSlide_68EDn1Tvvcm":{"kind":"actiongroup","actions":[{"kind":"exe_actiongroup","id":"ActGrpOnNextButtonClick"}]},"NavigationRestrictionPreviousSlide_68EDn1Tvvcm":{"kind":"actiongroup","actions":[{"kind":"exe_actiongroup","id":"ActGrpOnPrevButtonClick"}]}},"events":[{"kind":"onslidestart","actions":[{"kind":"if_action","condition":{"statement":{"kind":"and","statements":[{"kind":"and","statements":[{"kind":"compare","operator":"eq","valuea":"_player.#Transcripttoggle","typea":"var","valueb":true,"typeb":"boolean"}]}]}},"thenActions":[{"kind":"show_slidelayer","hideOthers":"never","transition":"appear","objRef":{"type":"string","value":"5iftd3jIQJ3"}}]}]},{"kind":"onbeforeslidein","actions":[{"kind":"if_action","condition":{"statement":{"kind":"compare","operator":"eq","valuea":"$WindowId","typea":"property","valueb":"_frame","typeb":"string"}},"thenActions":[{"kind":"set_frame_layout","name":"pxabnsnfns10111000101"}],"elseActions":[{"kind":"set_window_control_layout","name":"pxabnsnfns10111000101"}]}]},{"kind":"onvarchanged","varname":"_player.Transcripttoggle","priority":0,"actions":[{"kind":"if_action","condition":{"statement":{"kind":"and","statements":[{"kind":"and","statements":[{"kind":"compare","operator":"eq","valuea":"_player.#Transcripttoggle","typea":"var","valueb":true,"typeb":"boolean"}]}]}},"thenActions":[{"kind":"show_slidelayer","hideOthers":"never","transition":"appear","objRef":{"type":"string","value":"5iftd3jIQJ3"}}]},{"kind":"if_action","condition":{"statement":{"kind":"and","statements":[{"kind":"and","statements":[{"kind":"compare","operator":"eq","valuea":"_player.#Transcripttoggle","typea":"var","valueb":false,"typeb":"boolean"}]}]}},"thenActions":[{"kind":"hide_slidelayer","transition":"appear","objRef":{"type":"string","value":"5iftd3jIQJ3"}}]}]},{"kind":"onsubmitslide","actions":[{"kind":"exe_actiongroup","id":"ActGrpOnSubmitButtonClick"}]},{"kind":"onnextslide","actions":[{"kind":"exe_actiongroup","id":"NavigationRestrictionNextSlide_68EDn1Tvvcm"}]},{"kind":"onprevslide","actions":[{"kind":"exe_actiongroup","id":"NavigationRestrictionPreviousSlide_68EDn1Tvvcm"}]},{"kind":"ontimelinecomplete","actions":[{"kind":"show_slidelayer","hideOthers":"oncomplete","transition":"appear","objRef":{"type":"string","value":"5uvCfU3i3yN"}}]},{"kind":"ontransitionin","actions":[{"kind":"adjustvar","variable":"_player.LastSlideViewed_5vpqSu9pkXz","operator":"set","value":{"type":"string","value":"_player."}},{"kind":"adjustvar","variable":"_player.LastSlideViewed_5vpqSu9pkXz","operator":"add","value":{"type":"property","value":"$AbsoluteId"}}]}]}'); |
"use strict";
exports.__esModule = true;
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
function IconWideScreenSizeXs(props) {
return (React.createElement("svg", tslib_1.__assign({ viewBox: "0 0 12 12" }, props),
React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M2 2a1 1 0 00-1 1v4a1 1 0 001 1h3v1H4v1h4V9H7V8h3a1 1 0 001-1V3a1 1 0 00-1-1H2zm8 1H2v4h8V3z" })));
}
exports["default"] = IconWideScreenSizeXs;
|
/**
* Accordion: Basic Usage
*/
/* eslint-disable max-len */
import React from 'react';
import { AccordionSet, Accordion } from '..';
import Button from '../../Button';
const BasicUsage = () => (
<AccordionSet>
<Accordion label="Information" displayWhenOpen={<Button icon="plus-sign">Add</Button>}>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas vitae fringilla felis, sed commodo tellus. Sed bibendum mi id lorem sagittis sodales. Quisque ac lectus gravida, viverra ante et, iaculis sapien. Praesent eget ligula tortor. Praesent vitae ipsum placerat, blandit quam quis, tempus tortor. Aliquam erat volutpat. Fusce hendrerit lectus sed ex dictum, in pretium eros vestibulum. Nulla semper vehicula leo at varius. Quisque bibendum mauris sit amet tellus lobortis ultricies. Mauris eleifend sapien vel est posuere tincidunt. Proin ut nunc ut enim rhoncus elementum vitae in mauris. Nullam ultrices dictum nulla in commodo. Suspendisse potenti. Donec et velit ac quam consequat cursus. Pellentesque quis elit magna. Fusce velit libero, mattis ac placerat eget, aliquam a ante.
<br />
<br />
Ut eu velit a mi suscipit malesuada. Sed sollicitudin magna sed leo dignissim, vel fringilla quam placerat. Donec tempor id orci et posuere. Nam at erat at urna lobortis congue vitae at mauris. Maecenas rutrum ex tempor felis dignissim, sit amet varius lacus porttitor. Ut imperdiet sapien eu rutrum placerat. Donec eget interdum leo, quis interdum augue. Duis interdum aliquet semper. Donec aliquam molestie ipsum, quis interdum mi ullamcorper id. Vivamus in ligula eu turpis venenatis mattis. Praesent accumsan ultricies ante, nec pulvinar nunc iaculis eu.
</Accordion>
<Accordion label="Extended Information">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas vitae fringilla felis, sed commodo tellus. Sed bibendum mi id lorem sagittis sodales. Quisque ac lectus gravida, viverra ante et, iaculis sapien. Praesent eget ligula tortor. Praesent vitae ipsum placerat, blandit quam quis, tempus tortor. Aliquam erat volutpat. Fusce hendrerit lectus sed ex dictum, in pretium eros vestibulum. Nulla semper vehicula leo at varius. Quisque bibendum mauris sit amet tellus lobortis ultricies. Mauris eleifend sapien vel est posuere tincidunt. Proin ut nunc ut enim rhoncus elementum vitae in mauris. Nullam ultrices dictum nulla in commodo. Suspendisse potenti. Donec et velit ac quam consequat cursus. Pellentesque quis elit magna. Fusce velit libero, mattis ac placerat eget, aliquam a ante.
<br />
<br />
Ut eu velit a mi suscipit malesuada. Sed sollicitudin magna sed leo dignissim, vel fringilla quam placerat. Donec tempor id orci et posuere. Nam at erat at urna lobortis congue vitae at mauris. Maecenas rutrum ex tempor felis dignissim, sit amet varius lacus porttitor. Ut imperdiet sapien eu rutrum placerat. Donec eget interdum leo, quis interdum augue. Duis interdum aliquet semper. Donec aliquam molestie ipsum, quis interdum mi ullamcorper id. Vivamus in ligula eu turpis venenatis mattis. Praesent accumsan ultricies ante, nec pulvinar nunc iaculis eu.
</Accordion>
<Accordion label="Proxy">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas vitae fringilla felis, sed commodo tellus. Sed bibendum mi id lorem sagittis sodales. Quisque ac lectus gravida, viverra ante et, iaculis sapien. Praesent eget ligula tortor. Praesent vitae ipsum placerat, blandit quam quis, tempus tortor. Aliquam erat volutpat. Fusce hendrerit lectus sed ex dictum, in pretium eros vestibulum. Nulla semper vehicula leo at varius. Quisque bibendum mauris sit amet tellus lobortis ultricies. Mauris eleifend sapien vel est posuere tincidunt. Proin ut nunc ut enim rhoncus elementum vitae in mauris. Nullam ultrices dictum nulla in commodo. Suspendisse potenti. Donec et velit ac quam consequat cursus. Pellentesque quis elit magna. Fusce velit libero, mattis ac placerat eget, aliquam a ante.
<br />
<br />
Ut eu velit a mi suscipit malesuada. Sed sollicitudin magna sed leo dignissim, vel fringilla quam placerat. Donec tempor id orci et posuere. Nam at erat at urna lobortis congue vitae at mauris. Maecenas rutrum ex tempor felis dignissim, sit amet varius lacus porttitor. Ut imperdiet sapien eu rutrum placerat. Donec eget interdum leo, quis interdum augue. Duis interdum aliquet semper. Donec aliquam molestie ipsum, quis interdum mi ullamcorper id. Vivamus in ligula eu turpis venenatis mattis. Praesent accumsan ultricies ante, nec pulvinar nunc iaculis eu.
</Accordion>
<Accordion label="Loans">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas vitae fringilla felis, sed commodo tellus. Sed bibendum mi id lorem sagittis sodales. Quisque ac lectus gravida, viverra ante et, iaculis sapien. Praesent eget ligula tortor. Praesent vitae ipsum placerat, blandit quam quis, tempus tortor. Aliquam erat volutpat. Fusce hendrerit lectus sed ex dictum, in pretium eros vestibulum. Nulla semper vehicula leo at varius. Quisque bibendum mauris sit amet tellus lobortis ultricies. Mauris eleifend sapien vel est posuere tincidunt. Proin ut nunc ut enim rhoncus elementum vitae in mauris. Nullam ultrices dictum nulla in commodo. Suspendisse potenti. Donec et velit ac quam consequat cursus. Pellentesque quis elit magna. Fusce velit libero, mattis ac placerat eget, aliquam a ante.
<br />
<br />
Ut eu velit a mi suscipit malesuada. Sed sollicitudin magna sed leo dignissim, vel fringilla quam placerat. Donec tempor id orci et posuere. Nam at erat at urna lobortis congue vitae at mauris. Maecenas rutrum ex tempor felis dignissim, sit amet varius lacus porttitor. Ut imperdiet sapien eu rutrum placerat. Donec eget interdum leo, quis interdum augue. Duis interdum aliquet semper. Donec aliquam molestie ipsum, quis interdum mi ullamcorper id. Vivamus in ligula eu turpis venenatis mattis. Praesent accumsan ultricies ante, nec pulvinar nunc iaculis eu.
</Accordion>
</AccordionSet>
);
export default BasicUsage;
|
#!/usr/bin/env python
# https://www.microchip.com/wwwproducts/en/ATSAMD21E18
# import attr
import time
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
import matplotlib.dates as mdates
from collections import deque
import numpy as np
import sys
from slurm.rate import Rate
from math import pi
import pickle
from colorama import Fore
# from opencv_camera import ThreadedCamera
# from opencv_camera.color_space import ColorSpace
from imu_driver import IMUDriver
from imu_driver import AGMPT, AGMPTBN055
# ImageIMU = namedtuple("ImageIMU","image accel gyro temperature timestamp")
deg2rad = pi / 180.0
RAD2DEG = 180/pi
DEG2RAD = pi/180
FT2M = 0.3048 # feet to meters
MI2M = 1609.34 # miles to meters
PACKET_LEN = 7
BUFFER_SIZE = 1000000
data = deque(maxlen=BUFFER_SIZE)
def savePickle(data, filename):
with open(filename, 'wb') as fd:
d = pickle.dumps(data)
fd.write(d)
port = "/dev/tty.usbmodem14401"
# port = "/dev/tty.usbmodem14501"
parser = AGMPTBN055()
s = IMUDriver(port, parser)
if len(sys.argv) > 1:
filename = sys.argv[1]
else:
filename = "data.pickle"
rate = Rate(200)
fig, ax = plt.subplots(1, 1)
ax.set_aspect(1)
mag_x = deque(maxlen=BUFFER_SIZE)
mag_y = deque(maxlen=BUFFER_SIZE)
mag_z = deque(maxlen=BUFFER_SIZE)
def plot(ax, x,y,z,title):
# Clear all axis
ax.cla()
# Display the sub-plots
ax.scatter(x, y, color='r', label="X-Y")
ax.scatter(y, z, color='g', label="Y-Z")
ax.scatter(z, x, color='b', label="Z-X")
ax.grid()
ax.legend()
ax.set_title(title)
# Pause the plot for INTERVAL seconds
plt.pause(0.1)
try:
start = time.monotonic()
start_hz = start
cnt = 0
while True:
agmpt = s.read()
if agmpt is None:
print(f"{Fore.RED}*** oops: {agmpt} ***{Fore.RESET}")
continue
if cnt == 100:
# try:
# a = agmpt[2]
# a = len(agmpt)
# print(f">> {a}")
now = time.monotonic()
hz = cnt/(now - start_hz)
cnt = 0
start_hz = now
title = f"{hz:0.1f} Hz"
if 0:
plot(ax,mag_x,mag_y,mag_z, title)
else:
print(">>", title)
# except Exception as e:
# print(f"{Fore.RED}*** {e} ***{Fore.RESET}")
# continue
dt = time.monotonic() - start
# save data for real-time plotting
mag_x.append(agmpt[2][0])
mag_y.append(agmpt[2][1])
mag_z.append(agmpt[2][2])
# append timestamp
agmpt += (dt,)
data.append(agmpt)
cnt += 1
rate.sleep()
except KeyboardInterrupt:
print("ctrl-C")
finally:
s.close()
# camera.close()
# cv2.destroyAllWindows()
if len(data) > 0:
print(f">> Collected {len(data)} data points, saving to {filename}")
savePickle(data, filename)
print("\n\nbye ...\n")
|
const { merge } = require('webpack-merge');
const config = require('./webpack.config.js');
module.exports = merge(config, {
devtool: 'inline-source-map',
mode: 'development',
});
|
'use strict';
(function () {
$(document).ready(function () {
tableau.extensions.initializeDialogAsync().then(function (openPayload) {
buildDialog();
});
});
// We bulid the dialogue box and ensure that settings are read from the
// UI Namespace and the UI is updated.
function buildDialog() {
var worksheetName = tableau.extensions.settings.get("worksheet");
if (worksheetName != undefined) {
// We restore the look and feel settings.
if (tableau.extensions.settings.get("compact") == "Y") {
$("#compact").prop("checked", true);
} else {
$("#compact").prop("checked", false);
}
if (tableau.extensions.settings.get("hover") == "Y") {
$("#hover").prop("checked", true);
} else {
$("#hover").prop("checked", false);
}
if (tableau.extensions.settings.get("nowrap") == "Y") {
$("#nowrap").prop("checked", true);
} else {
$("#nowrap").prop("checked", false);
}
if (tableau.extensions.settings.get("order-column") == "Y") {
$("#order-column").prop("checked", true);
} else {
$("#order-column").prop("checked", false);
}
if (tableau.extensions.settings.get("row-border") == "Y") {
$("#row-border").prop("checked", true);
} else {
$("#row-border").prop("checked", false);
}
if (tableau.extensions.settings.get("stripe") == "Y") {
$("#stripe").prop("checked", true);
} else {
$("#stripe").prop("checked", false);
}
$("#include-table-name").prop("checked", tableau.extensions.settings.get("include-table-name") == "Y" ? true : false);
// ASL: additional controls
if (tableau.extensions.settings.get("show-search-box") == "Y") {
$("#show-search-box").prop("checked", true);
} else {
$("#show-search-box").prop("checked", false);
}
if (tableau.extensions.settings.get("show-filter-row") == "Y") {
$("#show-filter-row").prop("checked", true);
} else {
$("#show-filter-row").prop("checked", false);
}
// We restore the Buttons plugin settings.
if (tableau.extensions.settings.get("copy-btn") == "Y") {
$("#copy-btn").prop("checked", true);
} else {
$("#copy-btn").prop("checked", false);
}
if (tableau.extensions.settings.get("export-excel-btn") == "Y") {
$("#export-excel-btn").prop("checked", true);
} else {
$("#export-excel-btn").prop("checked", false);
}
if (tableau.extensions.settings.get("export-csv-btn") == "Y") {
$("#export-csv-btn").prop("checked", true);
} else {
$("#export-csv-btn").prop("checked", false);
}
if (tableau.extensions.settings.get("export-pdf-btn") == "Y") {
$("#export-pdf-btn").prop("checked", true);
} else {
$("#export-pdf-btn").prop("checked", false);
}
if (tableau.extensions.settings.get("print-btn") == "Y") {
$("#print-btn").prop("checked", true);
} else {
$("#print-btn").prop("checked", false);
}
if (tableau.extensions.settings.get("colvis-btn") == "Y") {
$("#colvis-btn").prop("checked", true);
} else {
$("#colvis-btn").prop("checked", false);
}
if (tableau.extensions.settings.get("checkbox-options") == "Y") {
$("#checkbox-options").prop("checked", true);
} else {
$("#checkbox-options").prop("checked", false);
}
if (tableau.extensions.settings.get("checkbox-apply") == "Y") {
$("#checkbox-apply").prop("checked", true);
} else {
$("#checkbox-apply").prop("checked", false);
}
}
// Populate the worksheet drop down with a list of worksheets.
// Generated at the time of opening the dialogue.
let dashboard = tableau.extensions.dashboardContent.dashboard;
dashboard.worksheets.forEach(function (worksheet) {
$("#selectWorksheet").append("<option value='" + worksheet.name + "'>" + worksheet.name + "</option>");
$("#selectWorksheetFilter").append("<option value='" + worksheet.name + "'>" + worksheet.name + "</option>");
});
// Add the column orders it exists
var column_order = tableau.extensions.settings.get("column-order");
if (column_order != undefined && column_order.length > 0) {
var column_names_array = tableau.extensions.settings.get("column-names").split("|");
var column_order_array = tableau.extensions.settings.get("column-order").split("|");
$("#sort-it ol").text("");
for (var i = 0; i < column_names_array.length; i++) {
//alert(column_names_array[i] + " : " + column_order_array[i]);
$("#sort-it ol").append("<li><div class='input-field'><input id='" + column_names_array[i] + "' type='text' col_num=" + column_order_array[i] + "><label for=" + column_names_array[i] + "'>" + column_names_array[i] + "</label></div></li>");
// add option to "number of columns for row header" dropdown
$('#col-count-row-header').append('<option value="' + (i + 1) + '" ' +
(tableau.extensions.settings.get('col-count-row-header') == i + 1 ? 'selected' : '') + '>' + (i + 1) + '</option>');
}
$('#sort-it ol').sortable({
onDrop: function (item) {
$(item).removeClass("dragged").removeAttr("style");
$("body").removeClass("dragging");
}
});
}
// Initialise the tabs, select and attach functions to buttons.
$("#selectWorksheet").val(tableau.extensions.settings.get("worksheet"));
$("#selectWorksheetFilter").val(tableau.extensions.settings.get("worksheet-filter"));
$("#table-classes").val(tableau.extensions.settings.get("table-classes"));
$("#items-per-page").val(tableau.extensions.settings.get("items-per-page"));
$("#action-element").val(tableau.extensions.settings.get("action-element"));
$("#action-element-column").val(tableau.extensions.settings.get("action-element-column"));
$("#checkbox-column").val(tableau.extensions.settings.get("checkbox-column"));
$("#filter-row-input-size").val(tableau.extensions.settings.get("filter-row-input-size"));
$("#select-btn-text").val(tableau.extensions.settings.get("select-btn-text"));
$("#column-classes").val(tableau.extensions.settings.get("column-classes"));
$('#selectWorksheet').on('change', '', function (e) {
columnsUpdate();
});
$('select').formSelect();
$('.tabs').tabs();
$('#closeButton').click(closeDialog);
$('#saveButton').click(saveButton);
// $('#resetButton').click(resetButton);
}
function columnsUpdate() {
var worksheets = tableau.extensions.dashboardContent.dashboard.worksheets;
var worksheetName = $("#selectWorksheet").val();
// Get the worksheet object for the specified names.
var worksheet = worksheets.find(function (sheet) {
return sheet.name === worksheetName;
});
// Note that for our purposes and to speed things up we only want 1 record.
worksheet.getSummaryDataAsync({ maxRows: 1 }).then(function (sumdata) {
var worksheetColumns = sumdata.columns;
// This blanks out the column list
$("#sort-it ol").text("");
var counter = 1;
worksheetColumns.forEach(function (current_value) {
// For each column we add a list item with an input box and label.
// Note that this is based on materialisecss.
$("#sort-it ol").append("<li><div class='input-field'><input id='" + current_value.fieldName + "' type='text' col_num=" + counter + "><label for=" + current_value.fieldName + "'>" + current_value.fieldName + "</label></div></li>");
counter++;
});
});
// Sets up the sortable elements for the columns list.
// https://jqueryui.com/sortable/
$('#sort-it ol').sortable({
onDrop: function (item) {
$(item).removeClass("dragged").removeAttr("style");
$("body").removeClass("dragging");
}
});
}
// This function closes the dialog box without.
function closeDialog() {
tableau.extensions.ui.closeDialog("10");
}
// This function saves then settings and then closes then closes the dialogue
// window.
function saveButton() {
// Data settings
tableau.extensions.settings.set("worksheet", $("#selectWorksheet").val());
tableau.extensions.settings.set("worksheet-filter", $("#selectWorksheetFilter").val());
// https://datatables.net/examples/styling/
var tableClass = $("#table-classes").val();
tableau.extensions.settings.set("table-classes", tableClass);
// ASL: additional controls
if ($("#show-search-box").is(":checked")) {
tableau.extensions.settings.set("show-search-box", "Y");
} else {
tableau.extensions.settings.set("show-search-box", "N");
}
if ($("#show-filter-row").is(":checked")) {
tableau.extensions.settings.set("show-filter-row", "Y");
} else {
tableau.extensions.settings.set("show-filter-row", "N");
}
// Saves the individual Y and N for the Buttons plugin settings so that we can restore this
// when you open the configuration dialogue.
// https://datatables.net/extensions/buttons/examples/html5/simple.html
if ($("#copy-btn").is(":checked")) {
tableau.extensions.settings.set("copy-btn", "Y");
} else {
tableau.extensions.settings.set("copy-btn", "N");
}
if ($("#export-excel-btn").is(":checked")) {
tableau.extensions.settings.set("export-excel-btn", "Y");
} else {
tableau.extensions.settings.set("export-excel-btn", "N");
}
if ($("#export-csv-btn").is(":checked")) {
tableau.extensions.settings.set("export-csv-btn", "Y");
} else {
tableau.extensions.settings.set("export-csv-btn", "N");
}
if ($("#export-pdf-btn").is(":checked")) {
tableau.extensions.settings.set("export-pdf-btn", "Y");
} else {
tableau.extensions.settings.set("export-pdf-btn", "N");
}
if ($("#print-btn").is(":checked")) {
tableau.extensions.settings.set("print-btn", "Y");
} else {
tableau.extensions.settings.set("print-btn", "N");
}
if ($("#colvis-btn").is(":checked")) {
tableau.extensions.settings.set("colvis-btn", "Y");
} else {
tableau.extensions.settings.set("colvis-btn", "N");
}
if ($("#checkbox-options").is(":checked")) {
tableau.extensions.settings.set("checkbox-options", "Y");
} else {
tableau.extensions.settings.set("checkbox-options", "N");
}
if ($("#checkbox-apply").is(":checked")) {
tableau.extensions.settings.set("checkbox-apply", "Y");
} else {
tableau.extensions.settings.set("checkbox-apply", "N");
}
var items_per_page = $("#items-per-page").val();
if (!items_per_page) { items_per_page = "5"; }
tableau.extensions.settings.set("items-per-page", items_per_page);
tableau.extensions.settings.set("action-element", $("#action-element").val());
tableau.extensions.settings.set("action-element-column", $("#action-element-column").val());
tableau.extensions.settings.set("checkbox-column", $("#checkbox-column").val());
tableau.extensions.settings.set("filter-row-input-size", $("#filter-row-input-size").val());
tableau.extensions.settings.set("select-btn-text", $("#select-btn-text").val());
tableau.extensions.settings.set("column-classes", $("#column-classes").val());
// This gets the column information and saves the column order and column name.
// For example, if you have a data source with three columns and then reorder
// there so that you get the third, first and then second column, you would get:
// --- column_order will look like: 3|1|2
// --- column_name will look like: SUM(Sales)|Country|Region
var column_order = "";
var column_name = "";
var counter = 0;
$("#sort-it").find("input").each(function (column) {
// This handles the column order
if (counter == 0) {
column_order = $(this).attr("col_num");
} else {
column_order = column_order + "|" + $(this).attr("col_num");
}
// This handles the column name.
if (counter == 0) {
if ($(this).val().length > 0) {
column_name = $(this).val();
} else {
column_name = $(this).attr("id");
}
} else {
if ($(this).val().length > 0) {
column_name = column_name + "|" + $(this).val();
} else {
column_name = column_name + "|" + $(this).attr("id");
}
}
counter++;
});
// row header setting
tableau.extensions.settings.set("col-count-row-header", $('#col-count-row-header').val());
// We save the column order and column name variables in the UI Namespace.
tableau.extensions.settings.set("column-order", column_order);
tableau.extensions.settings.set("column-names", column_name);
// Call saveAsync to save the settings before calling closeDialog.
tableau.extensions.settings.saveAsync().then((currentSettings) => {
tableau.extensions.ui.closeDialog("10");
});
}
})(); |
var annotated_dup =
[
[ "elem_blk_parm", "structelem__blk__parm.html", "structelem__blk__parm" ],
[ "ex_block", "structex__block.html", "structex__block" ],
[ "ex_block_params", "structex__block__params.html", "structex__block__params" ],
[ "ex_file_item", "structex__file__item.html", "structex__file__item" ],
[ "ex_init_params", "structex__init__params.html", "structex__init__params" ],
[ "ex_set", "structex__set.html", "structex__set" ],
[ "ex_set_specs", "structex__set__specs.html", "structex__set__specs" ],
[ "ex_var_params", "structex__var__params.html", "structex__var__params" ],
[ "list_item", "structlist__item.html", "structlist__item" ],
[ "obj_stats", "structobj__stats.html", "structobj__stats" ]
]; |
/**!
* @fileOverview Kickass library to create and place poppers near their reference elements.
* @version 1.12.5
* @license
* Copyright (c) 2016 Federico Zivolo and contributors
*
* 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 (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.Popper = factory());
}(this, (function () { 'use strict';
var nativeHints = ['native code', '[object MutationObserverConstructor]'];
/**
* Determine if a function is implemented natively (as opposed to a polyfill).
* @method
* @memberof Popper.Utils
* @argument {Function | undefined} fn the function to check
* @returns {Boolean}
*/
var isNative = (function (fn) {
return nativeHints.some(function (hint) {
return (fn || '').toString().indexOf(hint) > -1;
});
});
var isBrowser = typeof window !== 'undefined';
var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
var timeoutDuration = 0;
for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
timeoutDuration = 1;
break;
}
}
function microtaskDebounce(fn) {
var scheduled = false;
var i = 0;
var elem = document.createElement('span');
// MutationObserver provides a mechanism for scheduling microtasks, which
// are scheduled *before* the next task. This gives us a way to debounce
// a function but ensure it's called *before* the next paint.
var observer = new MutationObserver(function () {
fn();
scheduled = false;
});
observer.observe(elem, { attributes: true });
return function () {
if (!scheduled) {
scheduled = true;
elem.setAttribute('x-index', i);
i = i + 1; // don't use compund (+=) because it doesn't get optimized in V8
}
};
}
function taskDebounce(fn) {
var scheduled = false;
return function () {
if (!scheduled) {
scheduled = true;
setTimeout(function () {
scheduled = false;
fn();
}, timeoutDuration);
}
};
}
// It's common for MutationObserver polyfills to be seen in the wild, however
// these rely on Mutation Events which only occur when an element is connected
// to the DOM. The algorithm used in this module does not use a connected element,
// and so we must ensure that a *native* MutationObserver is available.
var supportsNativeMutationObserver = isBrowser && isNative(window.MutationObserver);
/**
* Create a debounced version of a method, that's asynchronously deferred
* but called in the minimum time possible.
*
* @method
* @memberof Popper.Utils
* @argument {Function} fn
* @returns {Function}
*/
var debounce = supportsNativeMutationObserver ? microtaskDebounce : taskDebounce;
/**
* Check if the given variable is a function
* @method
* @memberof Popper.Utils
* @argument {Any} functionToCheck - variable to check
* @returns {Boolean} answer to: is a function?
*/
function isFunction(functionToCheck) {
var getType = {};
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
}
/**
* Get CSS computed property of the given element
* @method
* @memberof Popper.Utils
* @argument {Eement} element
* @argument {String} property
*/
function getStyleComputedProperty(element, property) {
if (element.nodeType !== 1) {
return [];
}
// NOTE: 1 DOM access here
var css = window.getComputedStyle(element, null);
return property ? css[property] : css;
}
/**
* Returns the parentNode or the host of the element
* @method
* @memberof Popper.Utils
* @argument {Element} element
* @returns {Element} parent
*/
function getParentNode(element) {
if (element.nodeName === 'HTML') {
return element;
}
return element.parentNode || element.host;
}
/**
* Returns the scrolling parent of the given element
* @method
* @memberof Popper.Utils
* @argument {Element} element
* @returns {Element} scroll parent
*/
function getScrollParent(element) {
// Return body, `getScroll` will take care to get the correct `scrollTop` from it
if (!element || ['HTML', 'BODY', '#document'].indexOf(element.nodeName) !== -1) {
return window.document.body;
}
// Firefox want us to check `-x` and `-y` variations as well
var _getStyleComputedProp = getStyleComputedProperty(element),
overflow = _getStyleComputedProp.overflow,
overflowX = _getStyleComputedProp.overflowX,
overflowY = _getStyleComputedProp.overflowY;
if (/(auto|scroll)/.test(overflow + overflowY + overflowX)) {
return element;
}
return getScrollParent(getParentNode(element));
}
/**
* Returns the offset parent of the given element
* @method
* @memberof Popper.Utils
* @argument {Element} element
* @returns {Element} offset parent
*/
function getOffsetParent(element) {
// NOTE: 1 DOM access here
var offsetParent = element && element.offsetParent;
var nodeName = offsetParent && offsetParent.nodeName;
if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
return window.document.documentElement;
}
// .offsetParent will return the closest TD or TABLE in case
// no offsetParent is present, I hate this job...
if (['TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
return getOffsetParent(offsetParent);
}
return offsetParent;
}
function isOffsetContainer(element) {
var nodeName = element.nodeName;
if (nodeName === 'BODY') {
return false;
}
return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
}
/**
* Finds the root node (document, shadowDOM root) of the given element
* @method
* @memberof Popper.Utils
* @argument {Element} node
* @returns {Element} root node
*/
function getRoot(node) {
if (node.parentNode !== null) {
return getRoot(node.parentNode);
}
return node;
}
/**
* Finds the offset parent common to the two provided nodes
* @method
* @memberof Popper.Utils
* @argument {Element} element1
* @argument {Element} element2
* @returns {Element} common offset parent
*/
function findCommonOffsetParent(element1, element2) {
// This check is needed to avoid errors in case one of the elements isn't defined for any reason
if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
return window.document.documentElement;
}
// Here we make sure to give as "start" the element that comes first in the DOM
var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
var start = order ? element1 : element2;
var end = order ? element2 : element1;
// Get common ancestor container
var range = document.createRange();
range.setStart(start, 0);
range.setEnd(end, 0);
var commonAncestorContainer = range.commonAncestorContainer;
// Both nodes are inside #document
if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
if (isOffsetContainer(commonAncestorContainer)) {
return commonAncestorContainer;
}
return getOffsetParent(commonAncestorContainer);
}
// one of the nodes is inside shadowDOM, find which one
var element1root = getRoot(element1);
if (element1root.host) {
return findCommonOffsetParent(element1root.host, element2);
} else {
return findCommonOffsetParent(element1, getRoot(element2).host);
}
}
/**
* Gets the scroll value of the given element in the given side (top and left)
* @method
* @memberof Popper.Utils
* @argument {Element} element
* @argument {String} side `top` or `left`
* @returns {number} amount of scrolled pixels
*/
function getScroll(element) {
var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
var nodeName = element.nodeName;
if (nodeName === 'BODY' || nodeName === 'HTML') {
var html = window.document.documentElement;
var scrollingElement = window.document.scrollingElement || html;
return scrollingElement[upperSide];
}
return element[upperSide];
}
/*
* Sum or subtract the element scroll values (left and top) from a given rect object
* @method
* @memberof Popper.Utils
* @param {Object} rect - Rect object you want to change
* @param {HTMLElement} element - The element from the function reads the scroll values
* @param {Boolean} subtract - set to true if you want to subtract the scroll values
* @return {Object} rect - The modifier rect object
*/
function includeScroll(rect, element) {
var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var scrollTop = getScroll(element, 'top');
var scrollLeft = getScroll(element, 'left');
var modifier = subtract ? -1 : 1;
rect.top += scrollTop * modifier;
rect.bottom += scrollTop * modifier;
rect.left += scrollLeft * modifier;
rect.right += scrollLeft * modifier;
return rect;
}
/*
* Helper to detect borders of a given element
* @method
* @memberof Popper.Utils
* @param {CSSStyleDeclaration} styles
* Result of `getStyleComputedProperty` on the given element
* @param {String} axis - `x` or `y`
* @return {number} borders - The borders size of the given axis
*/
function getBordersSize(styles, axis) {
var sideA = axis === 'x' ? 'Left' : 'Top';
var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
return +styles['border' + sideA + 'Width'].split('px')[0] + +styles['border' + sideB + 'Width'].split('px')[0];
}
/**
* Tells if you are running Internet Explorer 10
* @method
* @memberof Popper.Utils
* @returns {Boolean} isIE10
*/
var isIE10 = undefined;
var isIE10$1 = function () {
if (isIE10 === undefined) {
isIE10 = navigator.appVersion.indexOf('MSIE 10') !== -1;
}
return isIE10;
};
function getSize(axis, body, html, computedStyle) {
return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE10$1() ? html['offset' + axis] + computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')] + computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')] : 0);
}
function getWindowSizes() {
var body = window.document.body;
var html = window.document.documentElement;
var computedStyle = isIE10$1() && window.getComputedStyle(html);
return {
height: getSize('Height', body, html, computedStyle),
width: getSize('Width', body, html, computedStyle)
};
}
var classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
var createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);
if (staticProps) defineProperties(Constructor, staticProps);
return Constructor;
};
}();
var defineProperty = function (obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
};
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;
};
/**
* Given element offsets, generate an output similar to getBoundingClientRect
* @method
* @memberof Popper.Utils
* @argument {Object} offsets
* @returns {Object} ClientRect like output
*/
function getClientRect(offsets) {
return _extends({}, offsets, {
right: offsets.left + offsets.width,
bottom: offsets.top + offsets.height
});
}
/**
* Get bounding client rect of given element
* @method
* @memberof Popper.Utils
* @param {HTMLElement} element
* @return {Object} client rect
*/
function getBoundingClientRect(element) {
var rect = {};
// IE10 10 FIX: Please, don't ask, the element isn't
// considered in DOM in some circumstances...
// This isn't reproducible in IE10 compatibility mode of IE11
if (isIE10$1()) {
try {
rect = element.getBoundingClientRect();
var scrollTop = getScroll(element, 'top');
var scrollLeft = getScroll(element, 'left');
rect.top += scrollTop;
rect.left += scrollLeft;
rect.bottom += scrollTop;
rect.right += scrollLeft;
} catch (err) {}
} else {
rect = element.getBoundingClientRect();
}
var result = {
left: rect.left,
top: rect.top,
width: rect.right - rect.left,
height: rect.bottom - rect.top
};
// subtract scrollbar size from sizes
var sizes = element.nodeName === 'HTML' ? getWindowSizes() : {};
var width = sizes.width || element.clientWidth || result.right - result.left;
var height = sizes.height || element.clientHeight || result.bottom - result.top;
var horizScrollbar = element.offsetWidth - width;
var vertScrollbar = element.offsetHeight - height;
// if an hypothetical scrollbar is detected, we must be sure it's not a `border`
// we make this check conditional for performance reasons
if (horizScrollbar || vertScrollbar) {
var styles = getStyleComputedProperty(element);
horizScrollbar -= getBordersSize(styles, 'x');
vertScrollbar -= getBordersSize(styles, 'y');
result.width -= horizScrollbar;
result.height -= vertScrollbar;
}
return getClientRect(result);
}
function getOffsetRectRelativeToArbitraryNode(children, parent) {
var isIE10 = isIE10$1();
var isHTML = parent.nodeName === 'HTML';
var childrenRect = getBoundingClientRect(children);
var parentRect = getBoundingClientRect(parent);
var scrollParent = getScrollParent(children);
var styles = getStyleComputedProperty(parent);
var borderTopWidth = +styles.borderTopWidth.split('px')[0];
var borderLeftWidth = +styles.borderLeftWidth.split('px')[0];
var offsets = getClientRect({
top: childrenRect.top - parentRect.top - borderTopWidth,
left: childrenRect.left - parentRect.left - borderLeftWidth,
width: childrenRect.width,
height: childrenRect.height
});
offsets.marginTop = 0;
offsets.marginLeft = 0;
// Subtract margins of documentElement in case it's being used as parent
// we do this only on HTML because it's the only element that behaves
// differently when margins are applied to it. The margins are included in
// the box of the documentElement, in the other cases not.
if (!isIE10 && isHTML) {
var marginTop = +styles.marginTop.split('px')[0];
var marginLeft = +styles.marginLeft.split('px')[0];
offsets.top -= borderTopWidth - marginTop;
offsets.bottom -= borderTopWidth - marginTop;
offsets.left -= borderLeftWidth - marginLeft;
offsets.right -= borderLeftWidth - marginLeft;
// Attach marginTop and marginLeft because in some circumstances we may need them
offsets.marginTop = marginTop;
offsets.marginLeft = marginLeft;
}
if (isIE10 ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
offsets = includeScroll(offsets, parent);
}
return offsets;
}
function getViewportOffsetRectRelativeToArtbitraryNode(element) {
var html = window.document.documentElement;
var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
var width = Math.max(html.clientWidth, window.innerWidth || 0);
var height = Math.max(html.clientHeight, window.innerHeight || 0);
var scrollTop = getScroll(html);
var scrollLeft = getScroll(html, 'left');
var offset = {
top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
width: width,
height: height
};
return getClientRect(offset);
}
/**
* Check if the given element is fixed or is inside a fixed parent
* @method
* @memberof Popper.Utils
* @argument {Element} element
* @argument {Element} customContainer
* @returns {Boolean} answer to "isFixed?"
*/
function isFixed(element) {
var nodeName = element.nodeName;
if (nodeName === 'BODY' || nodeName === 'HTML') {
return false;
}
if (getStyleComputedProperty(element, 'position') === 'fixed') {
return true;
}
return isFixed(getParentNode(element));
}
/**
* Computed the boundaries limits and return them
* @method
* @memberof Popper.Utils
* @param {HTMLElement} popper
* @param {HTMLElement} reference
* @param {number} padding
* @param {HTMLElement} boundariesElement - Element used to define the boundaries
* @returns {Object} Coordinates of the boundaries
*/
function getBoundaries(popper, reference, padding, boundariesElement) {
// NOTE: 1 DOM access here
var boundaries = { top: 0, left: 0 };
var offsetParent = findCommonOffsetParent(popper, reference);
// Handle viewport case
if (boundariesElement === 'viewport') {
boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent);
} else {
// Handle other cases based on DOM element used as boundaries
var boundariesNode = void 0;
if (boundariesElement === 'scrollParent') {
boundariesNode = getScrollParent(getParentNode(popper));
if (boundariesNode.nodeName === 'BODY') {
boundariesNode = window.document.documentElement;
}
} else if (boundariesElement === 'window') {
boundariesNode = window.document.documentElement;
} else {
boundariesNode = boundariesElement;
}
var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent);
// In case of HTML, we need a different computation
if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
var _getWindowSizes = getWindowSizes(),
height = _getWindowSizes.height,
width = _getWindowSizes.width;
boundaries.top += offsets.top - offsets.marginTop;
boundaries.bottom = height + offsets.top;
boundaries.left += offsets.left - offsets.marginLeft;
boundaries.right = width + offsets.left;
} else {
// for all the other DOM elements, this one is good
boundaries = offsets;
}
}
// Add paddings
boundaries.left += padding;
boundaries.top += padding;
boundaries.right -= padding;
boundaries.bottom -= padding;
return boundaries;
}
function getArea(_ref) {
var width = _ref.width,
height = _ref.height;
return width * height;
}
/**
* Utility used to transform the `auto` placement to the placement with more
* available space.
* @method
* @memberof Popper.Utils
* @argument {Object} data - The data object generated by update method
* @argument {Object} options - Modifiers configuration and options
* @returns {Object} The data object, properly modified
*/
function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
if (placement.indexOf('auto') === -1) {
return placement;
}
var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
var rects = {
top: {
width: boundaries.width,
height: refRect.top - boundaries.top
},
right: {
width: boundaries.right - refRect.right,
height: boundaries.height
},
bottom: {
width: boundaries.width,
height: boundaries.bottom - refRect.bottom
},
left: {
width: refRect.left - boundaries.left,
height: boundaries.height
}
};
var sortedAreas = Object.keys(rects).map(function (key) {
return _extends({
key: key
}, rects[key], {
area: getArea(rects[key])
});
}).sort(function (a, b) {
return b.area - a.area;
});
var filteredAreas = sortedAreas.filter(function (_ref2) {
var width = _ref2.width,
height = _ref2.height;
return width >= popper.clientWidth && height >= popper.clientHeight;
});
var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
var variation = placement.split('-')[1];
return computedPlacement + (variation ? '-' + variation : '');
}
/**
* Get offsets to the reference element
* @method
* @memberof Popper.Utils
* @param {Object} state
* @param {Element} popper - the popper element
* @param {Element} reference - the reference element (the popper will be relative to this)
* @returns {Object} An object containing the offsets which will be applied to the popper
*/
function getReferenceOffsets(state, popper, reference) {
var commonOffsetParent = findCommonOffsetParent(popper, reference);
return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent);
}
/**
* Get the outer sizes of the given element (offset size + margins)
* @method
* @memberof Popper.Utils
* @argument {Element} element
* @returns {Object} object containing width and height properties
*/
function getOuterSizes(element) {
var styles = window.getComputedStyle(element);
var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
var result = {
width: element.offsetWidth + y,
height: element.offsetHeight + x
};
return result;
}
/**
* Get the opposite placement of the given one
* @method
* @memberof Popper.Utils
* @argument {String} placement
* @returns {String} flipped placement
*/
function getOppositePlacement(placement) {
var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
return placement.replace(/left|right|bottom|top/g, function (matched) {
return hash[matched];
});
}
/**
* Get offsets to the popper
* @method
* @memberof Popper.Utils
* @param {Object} position - CSS position the Popper will get applied
* @param {HTMLElement} popper - the popper element
* @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
* @param {String} placement - one of the valid placement options
* @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
*/
function getPopperOffsets(popper, referenceOffsets, placement) {
placement = placement.split('-')[0];
// Get popper node sizes
var popperRect = getOuterSizes(popper);
// Add position, width and height to our offsets object
var popperOffsets = {
width: popperRect.width,
height: popperRect.height
};
// depending by the popper placement we have to compute its offsets slightly differently
var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
var mainSide = isHoriz ? 'top' : 'left';
var secondarySide = isHoriz ? 'left' : 'top';
var measurement = isHoriz ? 'height' : 'width';
var secondaryMeasurement = !isHoriz ? 'height' : 'width';
popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
if (placement === secondarySide) {
popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
} else {
popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
}
return popperOffsets;
}
/**
* Mimics the `find` method of Array
* @method
* @memberof Popper.Utils
* @argument {Array} arr
* @argument prop
* @argument value
* @returns index or -1
*/
function find(arr, check) {
// use native find if supported
if (Array.prototype.find) {
return arr.find(check);
}
// use `filter` to obtain the same behavior of `find`
return arr.filter(check)[0];
}
/**
* Return the index of the matching object
* @method
* @memberof Popper.Utils
* @argument {Array} arr
* @argument prop
* @argument value
* @returns index or -1
*/
function findIndex(arr, prop, value) {
// use native findIndex if supported
if (Array.prototype.findIndex) {
return arr.findIndex(function (cur) {
return cur[prop] === value;
});
}
// use `find` + `indexOf` if `findIndex` isn't supported
var match = find(arr, function (obj) {
return obj[prop] === value;
});
return arr.indexOf(match);
}
/**
* Loop trough the list of modifiers and run them in order,
* each of them will then edit the data object.
* @method
* @memberof Popper.Utils
* @param {dataObject} data
* @param {Array} modifiers
* @param {String} ends - Optional modifier name used as stopper
* @returns {dataObject}
*/
function runModifiers(modifiers, data, ends) {
var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
modifiersToRun.forEach(function (modifier) {
if (modifier.function) {
console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
}
var fn = modifier.function || modifier.fn;
if (modifier.enabled && isFunction(fn)) {
// Add properties to offsets to make them a complete clientRect object
// we do this before each modifier to make sure the previous one doesn't
// mess with these values
data.offsets.popper = getClientRect(data.offsets.popper);
data.offsets.reference = getClientRect(data.offsets.reference);
data = fn(data, modifier);
}
});
return data;
}
/**
* Updates the position of the popper, computing the new offsets and applying
* the new style.<br />
* Prefer `scheduleUpdate` over `update` because of performance reasons.
* @method
* @memberof Popper
*/
function update() {
// if popper is destroyed, don't perform any further update
if (this.state.isDestroyed) {
return;
}
var data = {
instance: this,
styles: {},
arrowStyles: {},
attributes: {},
flipped: false,
offsets: {}
};
// compute reference element offsets
data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference);
// compute auto placement, store placement inside the data object,
// modifiers will be able to edit `placement` if needed
// and refer to originalPlacement to know the original value
data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
// store the computed placement inside `originalPlacement`
data.originalPlacement = data.placement;
// compute the popper offsets
data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
data.offsets.popper.position = 'absolute';
// run the modifiers
data = runModifiers(this.modifiers, data);
// the first `update` will call `onCreate` callback
// the other ones will call `onUpdate` callback
if (!this.state.isCreated) {
this.state.isCreated = true;
this.options.onCreate(data);
} else {
this.options.onUpdate(data);
}
}
/**
* Helper used to know if the given modifier is enabled.
* @method
* @memberof Popper.Utils
* @returns {Boolean}
*/
function isModifierEnabled(modifiers, modifierName) {
return modifiers.some(function (_ref) {
var name = _ref.name,
enabled = _ref.enabled;
return enabled && name === modifierName;
});
}
/**
* Get the prefixed supported property name
* @method
* @memberof Popper.Utils
* @argument {String} property (camelCase)
* @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
*/
function getSupportedPropertyName(property) {
var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
for (var i = 0; i < prefixes.length - 1; i++) {
var prefix = prefixes[i];
var toCheck = prefix ? '' + prefix + upperProp : property;
if (typeof window.document.body.style[toCheck] !== 'undefined') {
return toCheck;
}
}
return null;
}
/**
* Destroy the popper
* @method
* @memberof Popper
*/
function destroy() {
this.state.isDestroyed = true;
// touch DOM only if `applyStyle` modifier is enabled
if (isModifierEnabled(this.modifiers, 'applyStyle')) {
this.popper.removeAttribute('x-placement');
this.popper.style.left = '';
this.popper.style.position = '';
this.popper.style.top = '';
this.popper.style[getSupportedPropertyName('transform')] = '';
}
this.disableEventListeners();
// remove the popper if user explicity asked for the deletion on destroy
// do not use `remove` because IE11 doesn't support it
if (this.options.removeOnDestroy) {
this.popper.parentNode.removeChild(this.popper);
}
return this;
}
function attachToScrollParents(scrollParent, event, callback, scrollParents) {
var isBody = scrollParent.nodeName === 'BODY';
var target = isBody ? window : scrollParent;
target.addEventListener(event, callback, { passive: true });
if (!isBody) {
attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
}
scrollParents.push(target);
}
/**
* Setup needed event listeners used to update the popper position
* @method
* @memberof Popper.Utils
* @private
*/
function setupEventListeners(reference, options, state, updateBound) {
// Resize event listener on window
state.updateBound = updateBound;
window.addEventListener('resize', state.updateBound, { passive: true });
// Scroll event listener on scroll parents
var scrollElement = getScrollParent(reference);
attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
state.scrollElement = scrollElement;
state.eventsEnabled = true;
return state;
}
/**
* It will add resize/scroll events and start recalculating
* position of the popper element when they are triggered.
* @method
* @memberof Popper
*/
function enableEventListeners() {
if (!this.state.eventsEnabled) {
this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
}
}
/**
* Remove event listeners used to update the popper position
* @method
* @memberof Popper.Utils
* @private
*/
function removeEventListeners(reference, state) {
// Remove resize event listener on window
window.removeEventListener('resize', state.updateBound);
// Remove scroll event listener on scroll parents
state.scrollParents.forEach(function (target) {
target.removeEventListener('scroll', state.updateBound);
});
// Reset state
state.updateBound = null;
state.scrollParents = [];
state.scrollElement = null;
state.eventsEnabled = false;
return state;
}
/**
* It will remove resize/scroll events and won't recalculate popper position
* when they are triggered. It also won't trigger onUpdate callback anymore,
* unless you call `update` method manually.
* @method
* @memberof Popper
*/
function disableEventListeners() {
if (this.state.eventsEnabled) {
window.cancelAnimationFrame(this.scheduleUpdate);
this.state = removeEventListeners(this.reference, this.state);
}
}
/**
* Tells if a given input is a number
* @method
* @memberof Popper.Utils
* @param {*} input to check
* @return {Boolean}
*/
function isNumeric(n) {
return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
}
/**
* Set the style to the given popper
* @method
* @memberof Popper.Utils
* @argument {Element} element - Element to apply the style to
* @argument {Object} styles
* Object with a list of properties and values which will be applied to the element
*/
function setStyles(element, styles) {
Object.keys(styles).forEach(function (prop) {
var unit = '';
// add unit if the value is numeric and is one of the following
if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
unit = 'px';
}
element.style[prop] = styles[prop] + unit;
});
}
/**
* Set the attributes to the given popper
* @method
* @memberof Popper.Utils
* @argument {Element} element - Element to apply the attributes to
* @argument {Object} styles
* Object with a list of properties and values which will be applied to the element
*/
function setAttributes(element, attributes) {
Object.keys(attributes).forEach(function (prop) {
var value = attributes[prop];
if (value !== false) {
element.setAttribute(prop, attributes[prop]);
} else {
element.removeAttribute(prop);
}
});
}
/**
* @function
* @memberof Modifiers
* @argument {Object} data - The data object generated by `update` method
* @argument {Object} data.styles - List of style properties - values to apply to popper element
* @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
* @argument {Object} options - Modifiers configuration and options
* @returns {Object} The same data object
*/
function applyStyle(data) {
// any property present in `data.styles` will be applied to the popper,
// in this way we can make the 3rd party modifiers add custom styles to it
// Be aware, modifiers could override the properties defined in the previous
// lines of this modifier!
setStyles(data.instance.popper, data.styles);
// any property present in `data.attributes` will be applied to the popper,
// they will be set as HTML attributes of the element
setAttributes(data.instance.popper, data.attributes);
// if arrowElement is defined and arrowStyles has some properties
if (data.arrowElement && Object.keys(data.arrowStyles).length) {
setStyles(data.arrowElement, data.arrowStyles);
}
return data;
}
/**
* Set the x-placement attribute before everything else because it could be used
* to add margins to the popper margins needs to be calculated to get the
* correct popper offsets.
* @method
* @memberof Popper.modifiers
* @param {HTMLElement} reference - The reference element used to position the popper
* @param {HTMLElement} popper - The HTML element used as popper.
* @param {Object} options - Popper.js options
*/
function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
// compute reference element offsets
var referenceOffsets = getReferenceOffsets(state, popper, reference);
// compute auto placement, store placement inside the data object,
// modifiers will be able to edit `placement` if needed
// and refer to originalPlacement to know the original value
var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
popper.setAttribute('x-placement', placement);
// Apply `position` to popper before anything else because
// without the position applied we can't guarantee correct computations
setStyles(popper, { position: 'absolute' });
return options;
}
/**
* @function
* @memberof Modifiers
* @argument {Object} data - The data object generated by `update` method
* @argument {Object} options - Modifiers configuration and options
* @returns {Object} The data object, properly modified
*/
function computeStyle(data, options) {
var x = options.x,
y = options.y;
var popper = data.offsets.popper;
// Remove this legacy support in Popper.js v2
var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
return modifier.name === 'applyStyle';
}).gpuAcceleration;
if (legacyGpuAccelerationOption !== undefined) {
console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
}
var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
var offsetParent = getOffsetParent(data.instance.popper);
var offsetParentRect = getBoundingClientRect(offsetParent);
// Styles
var styles = {
position: popper.position
};
// floor sides to avoid blurry text
var offsets = {
left: Math.floor(popper.left),
top: Math.floor(popper.top),
bottom: Math.floor(popper.bottom),
right: Math.floor(popper.right)
};
var sideA = x === 'bottom' ? 'top' : 'bottom';
var sideB = y === 'right' ? 'left' : 'right';
// if gpuAcceleration is set to `true` and transform is supported,
// we use `translate3d` to apply the position to the popper we
// automatically use the supported prefixed version if needed
var prefixedProperty = getSupportedPropertyName('transform');
// now, let's make a step back and look at this code closely (wtf?)
// If the content of the popper grows once it's been positioned, it
// may happen that the popper gets misplaced because of the new content
// overflowing its reference element
// To avoid this problem, we provide two options (x and y), which allow
// the consumer to define the offset origin.
// If we position a popper on top of a reference element, we can set
// `x` to `top` to make the popper grow towards its top instead of
// its bottom.
var left = void 0,
top = void 0;
if (sideA === 'bottom') {
top = -offsetParentRect.height + offsets.bottom;
} else {
top = offsets.top;
}
if (sideB === 'right') {
left = -offsetParentRect.width + offsets.right;
} else {
left = offsets.left;
}
if (gpuAcceleration && prefixedProperty) {
styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
styles[sideA] = 0;
styles[sideB] = 0;
styles.willChange = 'transform';
} else {
// othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
var invertTop = sideA === 'bottom' ? -1 : 1;
var invertLeft = sideB === 'right' ? -1 : 1;
styles[sideA] = top * invertTop;
styles[sideB] = left * invertLeft;
styles.willChange = sideA + ', ' + sideB;
}
// Attributes
var attributes = {
'x-placement': data.placement
};
// Update `data` attributes, styles and arrowStyles
data.attributes = _extends({}, attributes, data.attributes);
data.styles = _extends({}, styles, data.styles);
data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
return data;
}
/**
* Helper used to know if the given modifier depends from another one.<br />
* It checks if the needed modifier is listed and enabled.
* @method
* @memberof Popper.Utils
* @param {Array} modifiers - list of modifiers
* @param {String} requestingName - name of requesting modifier
* @param {String} requestedName - name of requested modifier
* @returns {Boolean}
*/
function isModifierRequired(modifiers, requestingName, requestedName) {
var requesting = find(modifiers, function (_ref) {
var name = _ref.name;
return name === requestingName;
});
var isRequired = !!requesting && modifiers.some(function (modifier) {
return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
});
if (!isRequired) {
var _requesting = '`' + requestingName + '`';
var requested = '`' + requestedName + '`';
console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
}
return isRequired;
}
/**
* @function
* @memberof Modifiers
* @argument {Object} data - The data object generated by update method
* @argument {Object} options - Modifiers configuration and options
* @returns {Object} The data object, properly modified
*/
function arrow(data, options) {
// arrow depends on keepTogether in order to work
if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
return data;
}
var arrowElement = options.element;
// if arrowElement is a string, suppose it's a CSS selector
if (typeof arrowElement === 'string') {
arrowElement = data.instance.popper.querySelector(arrowElement);
// if arrowElement is not found, don't run the modifier
if (!arrowElement) {
return data;
}
} else {
// if the arrowElement isn't a query selector we must check that the
// provided DOM node is child of its popper node
if (!data.instance.popper.contains(arrowElement)) {
console.warn('WARNING: `arrow.element` must be child of its popper element!');
return data;
}
}
var placement = data.placement.split('-')[0];
var _data$offsets = data.offsets,
popper = _data$offsets.popper,
reference = _data$offsets.reference;
var isVertical = ['left', 'right'].indexOf(placement) !== -1;
var len = isVertical ? 'height' : 'width';
var sideCapitalized = isVertical ? 'Top' : 'Left';
var side = sideCapitalized.toLowerCase();
var altSide = isVertical ? 'left' : 'top';
var opSide = isVertical ? 'bottom' : 'right';
var arrowElementSize = getOuterSizes(arrowElement)[len];
//
// extends keepTogether behavior making sure the popper and its
// reference have enough pixels in conjuction
//
// top/left side
if (reference[opSide] - arrowElementSize < popper[side]) {
data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
}
// bottom/right side
if (reference[side] + arrowElementSize > popper[opSide]) {
data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
}
// compute center of the popper
var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
// Compute the sideValue using the updated popper offsets
// take popper margin in accounts because we don't have this info available
var popperMarginSide = getStyleComputedProperty(data.instance.popper, 'margin' + sideCapitalized).replace('px', '');
var sideValue = center - getClientRect(data.offsets.popper)[side] - popperMarginSide;
// prevent arrowElement from being placed not contiguously to its popper
sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
data.arrowElement = arrowElement;
data.offsets.arrow = {};
data.offsets.arrow[side] = Math.round(sideValue);
data.offsets.arrow[altSide] = ''; // make sure to unset any eventual altSide value from the DOM node
return data;
}
/**
* Get the opposite placement variation of the given one
* @method
* @memberof Popper.Utils
* @argument {String} placement variation
* @returns {String} flipped placement variation
*/
function getOppositeVariation(variation) {
if (variation === 'end') {
return 'start';
} else if (variation === 'start') {
return 'end';
}
return variation;
}
/**
* List of accepted placements to use as values of the `placement` option.<br />
* Valid placements are:
* - `auto`
* - `top`
* - `right`
* - `bottom`
* - `left`
*
* Each placement can have a variation from this list:
* - `-start`
* - `-end`
*
* Variations are interpreted easily if you think of them as the left to right
* written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
* is right.<br />
* Vertically (`left` and `right`), `start` is top and `end` is bottom.
*
* Some valid examples are:
* - `top-end` (on top of reference, right aligned)
* - `right-start` (on right of reference, top aligned)
* - `bottom` (on bottom, centered)
* - `auto-right` (on the side with more space available, alignment depends by placement)
*
* @static
* @type {Array}
* @enum {String}
* @readonly
* @method placements
* @memberof Popper
*/
var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
// Get rid of `auto` `auto-start` and `auto-end`
var validPlacements = placements.slice(3);
/**
* Given an initial placement, returns all the subsequent placements
* clockwise (or counter-clockwise).
*
* @method
* @memberof Popper.Utils
* @argument {String} placement - A valid placement (it accepts variations)
* @argument {Boolean} counter - Set to true to walk the placements counterclockwise
* @returns {Array} placements including their variations
*/
function clockwise(placement) {
var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var index = validPlacements.indexOf(placement);
var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
return counter ? arr.reverse() : arr;
}
var BEHAVIORS = {
FLIP: 'flip',
CLOCKWISE: 'clockwise',
COUNTERCLOCKWISE: 'counterclockwise'
};
/**
* @function
* @memberof Modifiers
* @argument {Object} data - The data object generated by update method
* @argument {Object} options - Modifiers configuration and options
* @returns {Object} The data object, properly modified
*/
function flip(data, options) {
// if `inner` modifier is enabled, we can't use the `flip` modifier
if (isModifierEnabled(data.instance.modifiers, 'inner')) {
return data;
}
if (data.flipped && data.placement === data.originalPlacement) {
// seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
return data;
}
var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement);
var placement = data.placement.split('-')[0];
var placementOpposite = getOppositePlacement(placement);
var variation = data.placement.split('-')[1] || '';
var flipOrder = [];
switch (options.behavior) {
case BEHAVIORS.FLIP:
flipOrder = [placement, placementOpposite];
break;
case BEHAVIORS.CLOCKWISE:
flipOrder = clockwise(placement);
break;
case BEHAVIORS.COUNTERCLOCKWISE:
flipOrder = clockwise(placement, true);
break;
default:
flipOrder = options.behavior;
}
flipOrder.forEach(function (step, index) {
if (placement !== step || flipOrder.length === index + 1) {
return data;
}
placement = data.placement.split('-')[0];
placementOpposite = getOppositePlacement(placement);
var popperOffsets = data.offsets.popper;
var refOffsets = data.offsets.reference;
// using floor because the reference offsets may contain decimals we are not going to consider here
var floor = Math.floor;
var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
// flip the variation if required
var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
var flippedVariation = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
if (overlapsRef || overflowsBoundaries || flippedVariation) {
// this boolean to detect any flip loop
data.flipped = true;
if (overlapsRef || overflowsBoundaries) {
placement = flipOrder[index + 1];
}
if (flippedVariation) {
variation = getOppositeVariation(variation);
}
data.placement = placement + (variation ? '-' + variation : '');
// this object contains `position`, we want to preserve it along with
// any additional property we may add in the future
data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
data = runModifiers(data.instance.modifiers, data, 'flip');
}
});
return data;
}
/**
* @function
* @memberof Modifiers
* @argument {Object} data - The data object generated by update method
* @argument {Object} options - Modifiers configuration and options
* @returns {Object} The data object, properly modified
*/
function keepTogether(data) {
var _data$offsets = data.offsets,
popper = _data$offsets.popper,
reference = _data$offsets.reference;
var placement = data.placement.split('-')[0];
var floor = Math.floor;
var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
var side = isVertical ? 'right' : 'bottom';
var opSide = isVertical ? 'left' : 'top';
var measurement = isVertical ? 'width' : 'height';
if (popper[side] < floor(reference[opSide])) {
data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
}
if (popper[opSide] > floor(reference[side])) {
data.offsets.popper[opSide] = floor(reference[side]);
}
return data;
}
/**
* Converts a string containing value + unit into a px value number
* @function
* @memberof {modifiers~offset}
* @private
* @argument {String} str - Value + unit string
* @argument {String} measurement - `height` or `width`
* @argument {Object} popperOffsets
* @argument {Object} referenceOffsets
* @returns {Number|String}
* Value in pixels, or original string if no values were extracted
*/
function toValue(str, measurement, popperOffsets, referenceOffsets) {
// separate value from unit
var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
var value = +split[1];
var unit = split[2];
// If it's not a number it's an operator, I guess
if (!value) {
return str;
}
if (unit.indexOf('%') === 0) {
var element = void 0;
switch (unit) {
case '%p':
element = popperOffsets;
break;
case '%':
case '%r':
default:
element = referenceOffsets;
}
var rect = getClientRect(element);
return rect[measurement] / 100 * value;
} else if (unit === 'vh' || unit === 'vw') {
// if is a vh or vw, we calculate the size based on the viewport
var size = void 0;
if (unit === 'vh') {
size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
} else {
size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
}
return size / 100 * value;
} else {
// if is an explicit pixel unit, we get rid of the unit and keep the value
// if is an implicit unit, it's px, and we return just the value
return value;
}
}
/**
* Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
* @function
* @memberof {modifiers~offset}
* @private
* @argument {String} offset
* @argument {Object} popperOffsets
* @argument {Object} referenceOffsets
* @argument {String} basePlacement
* @returns {Array} a two cells array with x and y offsets in numbers
*/
function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
var offsets = [0, 0];
// Use height if placement is left or right and index is 0 otherwise use width
// in this way the first offset will use an axis and the second one
// will use the other one
var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
// Split the offset string to obtain a list of values and operands
// The regex addresses values with the plus or minus sign in front (+10, -20, etc)
var fragments = offset.split(/(\+|\-)/).map(function (frag) {
return frag.trim();
});
// Detect if the offset string contains a pair of values or a single one
// they could be separated by comma or space
var divider = fragments.indexOf(find(fragments, function (frag) {
return frag.search(/,|\s/) !== -1;
}));
if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
}
// If divider is found, we divide the list of values and operands to divide
// them by ofset X and Y.
var splitRegex = /\s*,\s*|\s+/;
var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];
// Convert the values with units to absolute pixels to allow our computations
ops = ops.map(function (op, index) {
// Most of the units rely on the orientation of the popper
var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
var mergeWithPrevious = false;
return op
// This aggregates any `+` or `-` sign that aren't considered operators
// e.g.: 10 + +5 => [10, +, +5]
.reduce(function (a, b) {
if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
a[a.length - 1] = b;
mergeWithPrevious = true;
return a;
} else if (mergeWithPrevious) {
a[a.length - 1] += b;
mergeWithPrevious = false;
return a;
} else {
return a.concat(b);
}
}, [])
// Here we convert the string values into number values (in px)
.map(function (str) {
return toValue(str, measurement, popperOffsets, referenceOffsets);
});
});
// Loop trough the offsets arrays and execute the operations
ops.forEach(function (op, index) {
op.forEach(function (frag, index2) {
if (isNumeric(frag)) {
offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
}
});
});
return offsets;
}
/**
* @function
* @memberof Modifiers
* @argument {Object} data - The data object generated by update method
* @argument {Object} options - Modifiers configuration and options
* @argument {Number|String} options.offset=0
* The offset value as described in the modifier description
* @returns {Object} The data object, properly modified
*/
function offset(data, _ref) {
var offset = _ref.offset;
var placement = data.placement,
_data$offsets = data.offsets,
popper = _data$offsets.popper,
reference = _data$offsets.reference;
var basePlacement = placement.split('-')[0];
var offsets = void 0;
if (isNumeric(+offset)) {
offsets = [+offset, 0];
} else {
offsets = parseOffset(offset, popper, reference, basePlacement);
}
if (basePlacement === 'left') {
popper.top += offsets[0];
popper.left -= offsets[1];
} else if (basePlacement === 'right') {
popper.top += offsets[0];
popper.left += offsets[1];
} else if (basePlacement === 'top') {
popper.left += offsets[0];
popper.top -= offsets[1];
} else if (basePlacement === 'bottom') {
popper.left += offsets[0];
popper.top += offsets[1];
}
data.popper = popper;
return data;
}
/**
* @function
* @memberof Modifiers
* @argument {Object} data - The data object generated by `update` method
* @argument {Object} options - Modifiers configuration and options
* @returns {Object} The data object, properly modified
*/
function preventOverflow(data, options) {
var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
// If offsetParent is the reference element, we really want to
// go one step up and use the next offsetParent as reference to
// avoid to make this modifier completely useless and look like broken
if (data.instance.reference === boundariesElement) {
boundariesElement = getOffsetParent(boundariesElement);
}
var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement);
options.boundaries = boundaries;
var order = options.priority;
var popper = data.offsets.popper;
var check = {
primary: function primary(placement) {
var value = popper[placement];
if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
value = Math.max(popper[placement], boundaries[placement]);
}
return defineProperty({}, placement, value);
},
secondary: function secondary(placement) {
var mainSide = placement === 'right' ? 'left' : 'top';
var value = popper[mainSide];
if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
}
return defineProperty({}, mainSide, value);
}
};
order.forEach(function (placement) {
var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
popper = _extends({}, popper, check[side](placement));
});
data.offsets.popper = popper;
return data;
}
/**
* @function
* @memberof Modifiers
* @argument {Object} data - The data object generated by `update` method
* @argument {Object} options - Modifiers configuration and options
* @returns {Object} The data object, properly modified
*/
function shift(data) {
var placement = data.placement;
var basePlacement = placement.split('-')[0];
var shiftvariation = placement.split('-')[1];
// if shift shiftvariation is specified, run the modifier
if (shiftvariation) {
var _data$offsets = data.offsets,
reference = _data$offsets.reference,
popper = _data$offsets.popper;
var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
var side = isVertical ? 'left' : 'top';
var measurement = isVertical ? 'width' : 'height';
var shiftOffsets = {
start: defineProperty({}, side, reference[side]),
end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
};
data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
}
return data;
}
/**
* @function
* @memberof Modifiers
* @argument {Object} data - The data object generated by update method
* @argument {Object} options - Modifiers configuration and options
* @returns {Object} The data object, properly modified
*/
function hide(data) {
if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
return data;
}
var refRect = data.offsets.reference;
var bound = find(data.instance.modifiers, function (modifier) {
return modifier.name === 'preventOverflow';
}).boundaries;
if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
// Avoid unnecessary DOM access if visibility hasn't changed
if (data.hide === true) {
return data;
}
data.hide = true;
data.attributes['x-out-of-boundaries'] = '';
} else {
// Avoid unnecessary DOM access if visibility hasn't changed
if (data.hide === false) {
return data;
}
data.hide = false;
data.attributes['x-out-of-boundaries'] = false;
}
return data;
}
/**
* @function
* @memberof Modifiers
* @argument {Object} data - The data object generated by `update` method
* @argument {Object} options - Modifiers configuration and options
* @returns {Object} The data object, properly modified
*/
function inner(data) {
var placement = data.placement;
var basePlacement = placement.split('-')[0];
var _data$offsets = data.offsets,
popper = _data$offsets.popper,
reference = _data$offsets.reference;
var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
data.placement = getOppositePlacement(placement);
data.offsets.popper = getClientRect(popper);
return data;
}
/**
* Modifier function, each modifier can have a function of this type assigned
* to its `fn` property.<br />
* These functions will be called on each update, this means that you must
* make sure they are performant enough to avoid performance bottlenecks.
*
* @function ModifierFn
* @argument {dataObject} data - The data object generated by `update` method
* @argument {Object} options - Modifiers configuration and options
* @returns {dataObject} The data object, properly modified
*/
/**
* Modifiers are plugins used to alter the behavior of your poppers.<br />
* Popper.js uses a set of 9 modifiers to provide all the basic functionalities
* needed by the library.
*
* Usually you don't want to override the `order`, `fn` and `onLoad` props.
* All the other properties are configurations that could be tweaked.
* @namespace modifiers
*/
var modifiers = {
/**
* Modifier used to shift the popper on the start or end of its reference
* element.<br />
* It will read the variation of the `placement` property.<br />
* It can be one either `-end` or `-start`.
* @memberof modifiers
* @inner
*/
shift: {
/** @prop {number} order=100 - Index used to define the order of execution */
order: 100,
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
enabled: true,
/** @prop {ModifierFn} */
fn: shift
},
/**
* The `offset` modifier can shift your popper on both its axis.
*
* It accepts the following units:
* - `px` or unitless, interpreted as pixels
* - `%` or `%r`, percentage relative to the length of the reference element
* - `%p`, percentage relative to the length of the popper element
* - `vw`, CSS viewport width unit
* - `vh`, CSS viewport height unit
*
* For length is intended the main axis relative to the placement of the popper.<br />
* This means that if the placement is `top` or `bottom`, the length will be the
* `width`. In case of `left` or `right`, it will be the height.
*
* You can provide a single value (as `Number` or `String`), or a pair of values
* as `String` divided by a comma or one (or more) white spaces.<br />
* The latter is a deprecated method because it leads to confusion and will be
* removed in v2.<br />
* Additionally, it accepts additions and subtractions between different units.
* Note that multiplications and divisions aren't supported.
*
* Valid examples are:
* ```
* 10
* '10%'
* '10, 10'
* '10%, 10'
* '10 + 10%'
* '10 - 5vh + 3%'
* '-10px + 5vh, 5px - 6%'
* ```
* > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
* > with their reference element, unfortunately, you will have to disable the `flip` modifier.
* > More on this [reading this issue](https://github.com/FezVrasta/popper.js/issues/373)
*
* @memberof modifiers
* @inner
*/
offset: {
/** @prop {number} order=200 - Index used to define the order of execution */
order: 200,
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
enabled: true,
/** @prop {ModifierFn} */
fn: offset,
/** @prop {Number|String} offset=0
* The offset value as described in the modifier description
*/
offset: 0
},
/**
* Modifier used to prevent the popper from being positioned outside the boundary.
*
* An scenario exists where the reference itself is not within the boundaries.<br />
* We can say it has "escaped the boundaries" — or just "escaped".<br />
* In this case we need to decide whether the popper should either:
*
* - detach from the reference and remain "trapped" in the boundaries, or
* - if it should ignore the boundary and "escape with its reference"
*
* When `escapeWithReference` is set to`true` and reference is completely
* outside its boundaries, the popper will overflow (or completely leave)
* the boundaries in order to remain attached to the edge of the reference.
*
* @memberof modifiers
* @inner
*/
preventOverflow: {
/** @prop {number} order=300 - Index used to define the order of execution */
order: 300,
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
enabled: true,
/** @prop {ModifierFn} */
fn: preventOverflow,
/**
* @prop {Array} [priority=['left','right','top','bottom']]
* Popper will try to prevent overflow following these priorities by default,
* then, it could overflow on the left and on top of the `boundariesElement`
*/
priority: ['left', 'right', 'top', 'bottom'],
/**
* @prop {number} padding=5
* Amount of pixel used to define a minimum distance between the boundaries
* and the popper this makes sure the popper has always a little padding
* between the edges of its container
*/
padding: 5,
/**
* @prop {String|HTMLElement} boundariesElement='scrollParent'
* Boundaries used by the modifier, can be `scrollParent`, `window`,
* `viewport` or any DOM element.
*/
boundariesElement: 'scrollParent'
},
/**
* Modifier used to make sure the reference and its popper stay near eachothers
* without leaving any gap between the two. Expecially useful when the arrow is
* enabled and you want to assure it to point to its reference element.
* It cares only about the first axis, you can still have poppers with margin
* between the popper and its reference element.
* @memberof modifiers
* @inner
*/
keepTogether: {
/** @prop {number} order=400 - Index used to define the order of execution */
order: 400,
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
enabled: true,
/** @prop {ModifierFn} */
fn: keepTogether
},
/**
* This modifier is used to move the `arrowElement` of the popper to make
* sure it is positioned between the reference element and its popper element.
* It will read the outer size of the `arrowElement` node to detect how many
* pixels of conjuction are needed.
*
* It has no effect if no `arrowElement` is provided.
* @memberof modifiers
* @inner
*/
arrow: {
/** @prop {number} order=500 - Index used to define the order of execution */
order: 500,
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
enabled: true,
/** @prop {ModifierFn} */
fn: arrow,
/** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
element: '[x-arrow]'
},
/**
* Modifier used to flip the popper's placement when it starts to overlap its
* reference element.
*
* Requires the `preventOverflow` modifier before it in order to work.
*
* **NOTE:** this modifier will interrupt the current update cycle and will
* restart it if it detects the need to flip the placement.
* @memberof modifiers
* @inner
*/
flip: {
/** @prop {number} order=600 - Index used to define the order of execution */
order: 600,
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
enabled: true,
/** @prop {ModifierFn} */
fn: flip,
/**
* @prop {String|Array} behavior='flip'
* The behavior used to change the popper's placement. It can be one of
* `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
* placements (with optional variations).
*/
behavior: 'flip',
/**
* @prop {number} padding=5
* The popper will flip if it hits the edges of the `boundariesElement`
*/
padding: 5,
/**
* @prop {String|HTMLElement} boundariesElement='viewport'
* The element which will define the boundaries of the popper position,
* the popper will never be placed outside of the defined boundaries
* (except if keepTogether is enabled)
*/
boundariesElement: 'viewport'
},
/**
* Modifier used to make the popper flow toward the inner of the reference element.
* By default, when this modifier is disabled, the popper will be placed outside
* the reference element.
* @memberof modifiers
* @inner
*/
inner: {
/** @prop {number} order=700 - Index used to define the order of execution */
order: 700,
/** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
enabled: false,
/** @prop {ModifierFn} */
fn: inner
},
/**
* Modifier used to hide the popper when its reference element is outside of the
* popper boundaries. It will set a `x-out-of-boundaries` attribute which can
* be used to hide with a CSS selector the popper when its reference is
* out of boundaries.
*
* Requires the `preventOverflow` modifier before it in order to work.
* @memberof modifiers
* @inner
*/
hide: {
/** @prop {number} order=800 - Index used to define the order of execution */
order: 800,
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
enabled: true,
/** @prop {ModifierFn} */
fn: hide
},
/**
* Computes the style that will be applied to the popper element to gets
* properly positioned.
*
* Note that this modifier will not touch the DOM, it just prepares the styles
* so that `applyStyle` modifier can apply it. This separation is useful
* in case you need to replace `applyStyle` with a custom implementation.
*
* This modifier has `850` as `order` value to maintain backward compatibility
* with previous versions of Popper.js. Expect the modifiers ordering method
* to change in future major versions of the library.
*
* @memberof modifiers
* @inner
*/
computeStyle: {
/** @prop {number} order=850 - Index used to define the order of execution */
order: 850,
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
enabled: true,
/** @prop {ModifierFn} */
fn: computeStyle,
/**
* @prop {Boolean} gpuAcceleration=true
* If true, it uses the CSS 3d transformation to position the popper.
* Otherwise, it will use the `top` and `left` properties.
*/
gpuAcceleration: true,
/**
* @prop {string} [x='bottom']
* Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
* Change this if your popper should grow in a direction different from `bottom`
*/
x: 'bottom',
/**
* @prop {string} [x='left']
* Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
* Change this if your popper should grow in a direction different from `right`
*/
y: 'right'
},
/**
* Applies the computed styles to the popper element.
*
* All the DOM manipulations are limited to this modifier. This is useful in case
* you want to integrate Popper.js inside a framework or view library and you
* want to delegate all the DOM manipulations to it.
*
* Note that if you disable this modifier, you must make sure the popper element
* has its position set to `absolute` before Popper.js can do its work!
*
* Just disable this modifier and define you own to achieve the desired effect.
*
* @memberof modifiers
* @inner
*/
applyStyle: {
/** @prop {number} order=900 - Index used to define the order of execution */
order: 900,
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
enabled: true,
/** @prop {ModifierFn} */
fn: applyStyle,
/** @prop {Function} */
onLoad: applyStyleOnLoad,
/**
* @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
* @prop {Boolean} gpuAcceleration=true
* If true, it uses the CSS 3d transformation to position the popper.
* Otherwise, it will use the `top` and `left` properties.
*/
gpuAcceleration: undefined
}
};
/**
* The `dataObject` is an object containing all the informations used by Popper.js
* this object get passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
* @name dataObject
* @property {Object} data.instance The Popper.js instance
* @property {String} data.placement Placement applied to popper
* @property {String} data.originalPlacement Placement originally defined on init
* @property {Boolean} data.flipped True if popper has been flipped by flip modifier
* @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper.
* @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
* @property {Object} data.styles Any CSS property defined here will be applied to the popper, it expects the JavaScript nomenclature (eg. `marginBottom`)
* @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow, it expects the JavaScript nomenclature (eg. `marginBottom`)
* @property {Object} data.boundaries Offsets of the popper boundaries
* @property {Object} data.offsets The measurements of popper, reference and arrow elements.
* @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
* @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
* @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
*/
/**
* Default options provided to Popper.js constructor.<br />
* These can be overriden using the `options` argument of Popper.js.<br />
* To override an option, simply pass as 3rd argument an object with the same
* structure of this object, example:
* ```
* new Popper(ref, pop, {
* modifiers: {
* preventOverflow: { enabled: false }
* }
* })
* ```
* @type {Object}
* @static
* @memberof Popper
*/
var Defaults = {
/**
* Popper's placement
* @prop {Popper.placements} placement='bottom'
*/
placement: 'bottom',
/**
* Whether events (resize, scroll) are initially enabled
* @prop {Boolean} eventsEnabled=true
*/
eventsEnabled: true,
/**
* Set to true if you want to automatically remove the popper when
* you call the `destroy` method.
* @prop {Boolean} removeOnDestroy=false
*/
removeOnDestroy: false,
/**
* Callback called when the popper is created.<br />
* By default, is set to no-op.<br />
* Access Popper.js instance with `data.instance`.
* @prop {onCreate}
*/
onCreate: function onCreate() {},
/**
* Callback called when the popper is updated, this callback is not called
* on the initialization/creation of the popper, but only on subsequent
* updates.<br />
* By default, is set to no-op.<br />
* Access Popper.js instance with `data.instance`.
* @prop {onUpdate}
*/
onUpdate: function onUpdate() {},
/**
* List of modifiers used to modify the offsets before they are applied to the popper.
* They provide most of the functionalities of Popper.js
* @prop {modifiers}
*/
modifiers: modifiers
};
/**
* @callback onCreate
* @param {dataObject} data
*/
/**
* @callback onUpdate
* @param {dataObject} data
*/
// Utils
// Methods
var Popper = function () {
/**
* Create a new Popper.js instance
* @class Popper
* @param {HTMLElement|referenceObject} reference - The reference element used to position the popper
* @param {HTMLElement} popper - The HTML element used as popper.
* @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
* @return {Object} instance - The generated Popper.js instance
*/
function Popper(reference, popper) {
var _this = this;
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
classCallCheck(this, Popper);
this.scheduleUpdate = function () {
return requestAnimationFrame(_this.update);
};
// make update() debounced, so that it only runs at most once-per-tick
this.update = debounce(this.update.bind(this));
// with {} we create a new object with the options inside it
this.options = _extends({}, Popper.Defaults, options);
// init state
this.state = {
isDestroyed: false,
isCreated: false,
scrollParents: []
};
// get reference and popper elements (allow jQuery wrappers)
this.reference = reference.jquery ? reference[0] : reference;
this.popper = popper.jquery ? popper[0] : popper;
// Deep merge modifiers options
this.options.modifiers = {};
Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
_this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
});
// Refactoring modifiers' list (Object => Array)
this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
return _extends({
name: name
}, _this.options.modifiers[name]);
})
// sort the modifiers by order
.sort(function (a, b) {
return a.order - b.order;
});
// modifiers have the ability to execute arbitrary code when Popper.js get inited
// such code is executed in the same order of its modifier
// they could add new properties to their options configuration
// BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
this.modifiers.forEach(function (modifierOptions) {
if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
}
});
// fire the first update to position the popper in the right place
this.update();
var eventsEnabled = this.options.eventsEnabled;
if (eventsEnabled) {
// setup event listeners, they will take care of update the position in specific situations
this.enableEventListeners();
}
this.state.eventsEnabled = eventsEnabled;
}
// We can't use class properties because they don't get listed in the
// class prototype and break stuff like Sinon stubs
createClass(Popper, [{
key: 'update',
value: function update$$1() {
return update.call(this);
}
}, {
key: 'destroy',
value: function destroy$$1() {
return destroy.call(this);
}
}, {
key: 'enableEventListeners',
value: function enableEventListeners$$1() {
return enableEventListeners.call(this);
}
}, {
key: 'disableEventListeners',
value: function disableEventListeners$$1() {
return disableEventListeners.call(this);
}
/**
* Schedule an update, it will run on the next UI update available
* @method scheduleUpdate
* @memberof Popper
*/
/**
* Collection of utilities useful when writing custom modifiers.
* Starting from version 1.7, this method is available only if you
* include `popper-utils.js` before `popper.js`.
*
* **DEPRECATION**: This way to access PopperUtils is deprecated
* and will be removed in v2! Use the PopperUtils module directly instead.
* Due to the high instability of the methods contained in Utils, we can't
* guarantee them to follow semver. Use them at your own risk!
* @static
* @private
* @type {Object}
* @deprecated since version 1.8
* @member Utils
* @memberof Popper
*/
}]);
return Popper;
}();
/**
* The `referenceObject` is an object that provides an interface compatible with Popper.js
* and lets you use it as replacement of a real DOM node.<br />
* You can use this method to position a popper relatively to a set of coordinates
* in case you don't have a DOM node to use as reference.
*
* ```
* new Popper(referenceObject, popperNode);
* ```
*
* NB: This feature isn't supported in Internet Explorer 10
* @name referenceObject
* @property {Function} data.getBoundingClientRect
* A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
* @property {number} data.clientWidth
* An ES6 getter that will return the width of the virtual reference element.
* @property {number} data.clientHeight
* An ES6 getter that will return the height of the virtual reference element.
*/
Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
Popper.placements = placements;
Popper.Defaults = Defaults;
return Popper;
})));
//# sourceMappingURL=popper.js.map
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.