PageSourceSearch

https://weathrplan.com/assets/trip-detail-Dill9oNx.js

js weathrplan.com collected 2026-10-02 16:13:09 UTC 264,027 bytes, 27 lines download raw bytes

1import{c as zi,r as D,R as Ae,bc as sr,bd as ar,ai as rr,u as or,d as lr,a1 as cr,aj as hr,be as dr,b as ur,h as mr,g as Ke,an as Ft,b9 as li,ba as ci,ao as fr,j as s,ak as pr,a2 as rn,B as Qt,s as gr,S as _r,H as vr,bf as xr,bg as Vs,aP as yr,i as br,t as Ai,aT as wr,a$ as Gs,b0 as Ks,b3 as Tr,b1 as Ys,bh as Js,bi as nn,bj as Xs,P as Qs,I as sn,O as ye,bk as Sr,bl as ps,L as ri,M as ta,as as ea,bm as ya,b2 as Nr,_ as Pr,U as ia,bn as na,N as gs,aA as an,bo as Lr,bp as sa,o as jr,at as aa,aC as ra,aR as oa,bq as kr,av as Dr,T as Oi,aw as la,br as Mr,C as Cr,a3 as Ir,bs as Er,bt as Ar,bu as Or,bv as ca,bw as zr,a4 as te,a0 as Zr,ax as Br,bx as Rr,a5 as ha,by as da}from"./index-DKBJUXPI.js";import{A as ua}from"./airport-autocomplete-CMDfFYU9.js";import{S as Fr,a as ma,C as Hr}from"./switch-HDyb-XWM.js";import{T as Wr}from"./trash-2-CjEnnfp4.js";const $r=[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1",key:"pwadti"}],["path",{d:"M6 2v2",key:"colzsn"}]],Ur=zi("coffee",$r);const qr=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Vr=zi("download",qr);const Gr=[["path",{d:"M14 13h2a2 2 0 0 1 2 2v2a2 2 0 0 0 4 0v-6.998a2 2 0 0 0-.59-1.42L18 5",key:"1wtuz0"}],["path",{d:"M14 21V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v16",key:"e09ifn"}],["path",{d:"M2 21h13",key:"1x0fut"}],["path",{d:"M3 9h11",key:"1p7c0w"}]],Kr=zi("fuel",Gr);const Yr=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Jr=zi("list",Yr);const Xr=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],An=zi("pen",Xr);const Qr=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],to=zi("share-2",Qr);function ba(p,v){const l=D.useRef(v);D.useEffect(function(){v!==l.current&&p.attributionControl!=null&&(l.current!=null&&p.attributionControl.removeAttribution(l.current),v!=null&&p.attributionControl.addAttribution(v)),l.current=v},[p,v])}const eo=1;function io(p){return Object.freeze({__version:eo,map:p})}function wa(p,v){return Object.freeze({...p,...v})}const ys=D.createContext(null);function Bn(){const p=D.use(ys);if(p==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of <MapContainer>");return p}function Ta(p){function v(l,x){const{instance:y,context:Z}=p(l).current;D.useImperativeHandle(x,()=>y);const{children:S}=l;return S==null?null:Ae.createElement(ys,{value:Z},S)}return D.forwardRef(v)}function no(p){function v(l,x){const[y,Z]=D.useState(!1),{instance:S}=p(l,Z).current;D.useImperativeHandle(x,()=>S),D.useEffect(function(){y&&S.update()},[S,y,l.children]);const V=S._contentNode;return V?sr.createPortal(l.children,V):null}return D.forwardRef(v)}function so(p){function v(l,x){const{instance:y}=p(l).current;return D.useImperativeHandle(x,()=>y),null}return D.forwardRef(v)}function bs(p,v){const l=D.useRef(void 0);D.useEffect(function(){return v!=null&&p.instance.on(v),l.current=v,function(){l.current!=null&&p.instance.off(l.current),l.current=null}},[p,v])}function Rn(p,v){const l=p.pane??v.pane;return l?{...p,pane:l}:p}function ao(p,v){return function(x,y){const Z=Bn(),S=p(Rn(x,Z),Z);return ba(Z.map,x.attribution),bs(S.current,x.eventHandlers),v(S.current,Z,x,y),S}}var on={exports:{}};var ro=on.exports,fa;function oo(){return fa||(fa=1,(function(p,v){(function(l,x){x(v)})(ro,(function(l){var x="1.9.4";function y(t){var e,i,n,a;for(i=1,n=arguments.length;i<n;i++){a=arguments[i];for(e in a)t[e]=a[e]}return t}var Z=Object.create||(function(){function t(){}return function(e){return t.prototype=e,new t}})();function S(t,e){var i=Array.prototype.slice;
1if(t.bind)return t.bind.apply(t,i.call(arguments,1));var n=i.call(arguments,2);return function(){return t.apply(e,n.length?n.concat(i.call(arguments)):arguments)}}var V=0;function j(t){return"_leaflet_id"in t||(t._leaflet_id=++V),t._leaflet_id}function O(t,e,i){var n,a,r,c;return c=function(){n=!1,a&&(r.apply(i,a),a=!1)},r=function(){n?a=arguments:(t.apply(i,arguments),setTimeout(c,e),n=!0)},r}function yt(t,e,i){var n=e[1],a=e[0],r=n-a;return t===n&&i?t:((t-a)%r+r)%r+a}function I(){return!1}function z(t,e){if(e===!1)return t;var i=Math.pow(10,e===void 0?6:e);return Math.round(t*i)/i}function B(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function at(t){return B(t).split(/\s+/)}function H(t,e){Object.prototype.hasOwnProperty.call(t,"options")||(t.options=t.options?Z(t.options):{});for(var i in e)t.options[i]=e[i];return t.options}function bt(t,e,i){var n=[];for(var a in t)n.push(encodeURIComponent(i?a.toUpperCase():a)+"="+encodeURIComponent(t[a]));return(!e||e.indexOf("?")===-1?"?":"&")+n.join("&")}var Ct=/\{ *([\w_ -]+) *\}/g;function It(t,e){return t.replace(Ct,function(i,n){var a=e[n];if(a===void 0)throw new Error("No value provided for variable "+i);return typeof a=="function"&&(a=a(e)),a})}var _t=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"};function Gt(t,e){for(var i=0;i<t.length;i++)if(t[i]===e)return i;return-1}var ue="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function ct(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var Kt=0;function be(t){var e=+new Date,i=Math.max(0,16-(e-Kt));return Kt=e+i,window.setTimeout(t,i)}var ut=window.requestAnimationFrame||ct("RequestAnimationFrame")||be,ce=window.cancelAnimationFrame||ct("CancelAnimationFrame")||ct("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function Zt(t,e,i){if(i&&ut===be)t.call(e);else return ut.call(window,S(t,e))}function Dt(t){t&&ce.call(window,t)}var Ye={__proto__:null,extend:y,create:Z,bind:S,get lastId(){return V},stamp:j,throttle:O,wrapNum:yt,falseFn:I,formatNum:z,trim:B,splitWords:at,setOptions:H,getParamString:bt,template:It,isArray:_t,indexOf:Gt,emptyImageUrl:ue,requestFn:ut,cancelFn:ce,requestAnimFrame:Zt,cancelAnimFrame:Dt};function Tt(){}Tt.extend=function(t){var e=function(){H(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},i=e.__super__=this.prototype,n=Z(i);n.constructor=e,e.prototype=n;for(var a in this)Object.prototype.hasOwnProperty.call(this,a)&&a!=="prototype"&&a!=="__super__"&&(e[a]=this[a]);return t.statics&&y(e,t.statics),t.includes&&(Wn(t.includes),y.apply(null,[n].concat(t.includes))),y(n,t),delete n.statics,delete n.includes,n.options&&(n.options=i.options?Z(i.options):{},y(n.options,t.options)),n._initHooks=[],n.callInitHooks=function(){if(!this._initHooksCalled){i.callInitHooks&&i.callInitHooks.call(this),this._initHooksCalled=!0;for(var r=0,c=n._initHooks.length;r<c;r++)n._initHooks[r].call(this)}},e},Tt.include=function(t){var e=this.prototype.options;return y(this.prototype,t),t.options&&(this.prototype.options=e,this.mergeOptions(t.options)),this},Tt.mergeOptions=function(t){return y(this.prototype.options,t),this},Tt.addInitHook=function(t){var e=Array.prototype.slice.call(arguments,1),i=typeof t=="function"?t:function(){this[t].apply(this,e)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(i),this};function Wn(t){if(!(typeof L>"u"||!L||!L.Mixin)){t=_t(t)?t:[t];for(var e=0;e<t.length;
1e++)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)}}var ee={on:function(t,e,i){if(typeof t=="object")for(var n in t)this._on(n,t[n],e);else{t=at(t);for(var a=0,r=t.length;a<r;a++)this._on(t[a],e,i)}return this},off:function(t,e,i){if(!arguments.length)delete this._events;else if(typeof t=="object")for(var n in t)this._off(n,t[n],e);else{t=at(t);for(var a=arguments.length===1,r=0,c=t.length;r<c;r++)a?this._off(t[r]):this._off(t[r],e,i)}return this},_on:function(t,e,i,n){if(typeof e!="function"){console.warn("wrong listener type: "+typeof e);return}if(this._listens(t,e,i)===!1){i===this&&(i=void 0);var a={fn:e,ctx:i};n&&(a.once=!0),this._events=this._events||{},this._events[t]=this._events[t]||[],this._events[t].push(a)}},_off:function(t,e,i){var n,a,r;if(this._events&&(n=this._events[t],!!n)){if(arguments.length===1){if(this._firingCount)for(a=0,r=n.length;a<r;a++)n[a].fn=I;delete this._events[t];return}if(typeof e!="function"){console.warn("wrong listener type: "+typeof e);return}var c=this._listens(t,e,i);if(c!==!1){var d=n[c];this._firingCount&&(d.fn=I,this._events[t]=n=n.slice()),n.splice(c,1)}}},fire:function(t,e,i){if(!this.listens(t,i))return this;var n=y({},e,{type:t,target:this,sourceTarget:e&&e.sourceTarget||this});if(this._events){var a=this._events[t];if(a){this._firingCount=this._firingCount+1||1;for(var r=0,c=a.length;r<c;r++){var d=a[r],g=d.fn;d.once&&this.off(t,g,d.ctx),g.call(d.ctx||this,n)}this._firingCount--}}return i&&this._propagateEvent(n),this},listens:function(t,e,i,n){typeof t!="string"&&console.warn('"string" type argument expected');var a=e;typeof e!="function"&&(n=!!e,a=void 0,i=void 0);var r=this._events&&this._events[t];if(r&&r.length&&this._listens(t,a,i)!==!1)return!0;if(n){for(var c in this._eventParents)if(this._eventParents[c].listens(t,e,i,n))return!0}return!1},_listens:function(t,e,i){if(!this._events)return!1;var n=this._events[t]||[];if(!e)return!!n.length;i===this&&(i=void 0);for(var a=0,r=n.length;a<r;a++)if(n[a].fn===e&&n[a].ctx===i)return a;return!1},once:function(t,e,i){if(typeof t=="object")for(var n in t)this._on(n,t[n],e,!0);else{t=at(t);for(var a=0,r=t.length;a<r;a++)this._on(t[a],e,i,!0)}return this},addEventParent:function(t){return this._eventParents=this._eventParents||{},this._eventParents[j(t)]=t,this},removeEventParent:function(t){return this._eventParents&&delete this._eventParents[j(t)],this},_propagateEvent:function(t){for(var e in this._eventParents)this._eventParents[e].fire(t.type,y({layer:t.target,propagatedFrom:t.target},t),!0)}};ee.addEventListener=ee.on,ee.removeEventListener=ee.clearAllEventListeners=ee.off,ee.addOneTimeEventListener=ee.once,ee.fireEvent=ee.fire,ee.hasEventListeners=ee.listens;var hi=Tt.extend(ee);function K(t,e,i){this.x=i?Math.round(t):t,this.y=i?Math.round(e):e}var $n=Math.trunc||function(t){return t>0?Math.floor(t):Math.ceil(t)};K.prototype={clone:function(){return new K(this.x,this.y)},add:function(t){return this.clone()._add(q(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(q(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 K(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new K(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=$n(this.x),this.y=$n(this.y),this},distanceTo:function(t){t=q(t);var e=t.x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},equals:function(t){return t=q(t),t.x===this.x&&t.y===this.y},contains:function(t){return t=q(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+z(this.x)+", "+z(this.y)+")"}};function q(t,e,i){return t instanceof K?t:_t(t)?new K(t[0],t[1]):t==null?t:typeof t=="object"&&"x"in t&&"y"in t?new K(t.x,t.y):new K(t,e,i)}function St(t,e){if(t)for(var i=e?[t,e]:t,n=0,a=i.length;n<a;n++)this.extend(i[n])}St.prototype={extend:function(t){var e,i;if(!t)return this;if(t instanceof K||typeof t[0]=="number"||"x"in t)e=i=q(t);else if(t=Ht(t),e=t.min,i=t.max,!e||!i)return this;
1return!this.min&&!this.max?(this.min=e.clone(),this.max=i.clone()):(this.min.x=Math.min(e.x,this.min.x),this.max.x=Math.max(i.x,this.max.x),this.min.y=Math.min(e.y,this.min.y),this.max.y=Math.max(i.y,this.max.y)),this},getCenter:function(t){return q((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return q(this.min.x,this.max.y)},getTopRight:function(){return q(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,i;return typeof t[0]=="number"||t instanceof K?t=q(t):t=Ht(t),t instanceof St?(e=t.min,i=t.max):e=i=t,e.x>=this.min.x&&i.x<=this.max.x&&e.y>=this.min.y&&i.y<=this.max.y},intersects:function(t){t=Ht(t);var e=this.min,i=this.max,n=t.min,a=t.max,r=a.x>=e.x&&n.x<=i.x,c=a.y>=e.y&&n.y<=i.y;return r&&c},overlaps:function(t){t=Ht(t);var e=this.min,i=this.max,n=t.min,a=t.max,r=a.x>e.x&&n.x<i.x,c=a.y>e.y&&n.y<i.y;return r&&c},isValid:function(){return!!(this.min&&this.max)},pad:function(t){var e=this.min,i=this.max,n=Math.abs(e.x-i.x)*t,a=Math.abs(e.y-i.y)*t;return Ht(q(e.x-n,e.y-a),q(i.x+n,i.y+a))},equals:function(t){return t?(t=Ht(t),this.min.equals(t.getTopLeft())&&this.max.equals(t.getBottomRight())):!1}};function Ht(t,e){return!t||t instanceof St?t:new St(t,e)}function Ut(t,e){if(t)for(var i=e?[t,e]:t,n=0,a=i.length;n<a;n++)this.extend(i[n])}Ut.prototype={extend:function(t){var e=this._southWest,i=this._northEast,n,a;if(t instanceof vt)n=t,a=t;else if(t instanceof Ut){if(n=t._southWest,a=t._northEast,!n||!a)return this}else return t?this.extend(tt(t)||wt(t)):this;return!e&&!i?(this._southWest=new vt(n.lat,n.lng),this._northEast=new vt(a.lat,a.lng)):(e.lat=Math.min(n.lat,e.lat),e.lng=Math.min(n.lng,e.lng),i.lat=Math.max(a.lat,i.lat),i.lng=Math.max(a.lng,i.lng)),this},pad:function(t){var e=this._southWest,i=this._northEast,n=Math.abs(e.lat-i.lat)*t,a=Math.abs(e.lng-i.lng)*t;return new Ut(new vt(e.lat-n,e.lng-a),new vt(i.lat+n,i.lng+a))},getCenter:function(){return new vt((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 vt(this.getNorth(),this.getWest())},getSouthEast:function(){return new vt(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){typeof t[0]=="number"||t instanceof vt||"lat"in t?t=tt(t):t=wt(t);var e=this._southWest,i=this._northEast,n,a;
1return t instanceof Ut?(n=t.getSouthWest(),a=t.getNorthEast()):n=a=t,n.lat>=e.lat&&a.lat<=i.lat&&n.lng>=e.lng&&a.lng<=i.lng},intersects:function(t){t=wt(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),a=t.getNorthEast(),r=a.lat>=e.lat&&n.lat<=i.lat,c=a.lng>=e.lng&&n.lng<=i.lng;return r&&c},overlaps:function(t){t=wt(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),a=t.getNorthEast(),r=a.lat>e.lat&&n.lat<i.lat,c=a.lng>e.lng&&n.lng<i.lng;return r&&c},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t,e){return t?(t=wt(t),this._southWest.equals(t.getSouthWest(),e)&&this._northEast.equals(t.getNorthEast(),e)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function wt(t,e){return t instanceof Ut?t:new Ut(t,e)}function vt(t,e,i){if(isNaN(t)||isNaN(e))throw new Error("Invalid LatLng object: ("+t+", "+e+")");this.lat=+t,this.lng=+e,i!==void 0&&(this.alt=+i)}vt.prototype={equals:function(t,e){if(!t)return!1;t=tt(t);var i=Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng));return i<=(e===void 0?1e-9:e)},toString:function(t){return"LatLng("+z(this.lat,t)+", "+z(this.lng,t)+")"},distanceTo:function(t){return fe.distance(this,tt(t))},wrap:function(){return fe.wrapLatLng(this)},toBounds:function(t){var e=180*t/40075017,i=e/Math.cos(Math.PI/180*this.lat);return wt([this.lat-e,this.lng-i],[this.lat+e,this.lng+i])},clone:function(){return new vt(this.lat,this.lng,this.alt)}};function tt(t,e,i){return t instanceof vt?t:_t(t)&&typeof t[0]!="object"?t.length===3?new vt(t[0],t[1],t[2]):t.length===2?new vt(t[0],t[1]):null:t==null?t:typeof t=="object"&&"lat"in t?new vt(t.lat,"lng"in t?t.lng:t.lon,t.alt):e===void 0?null:new vt(t,e,i)}var me={latLngToPoint:function(t,e){var i=this.projection.project(t),n=this.scale(e);return this.transformation._transform(i,n)},pointToLatLng:function(t,e){var i=this.scale(e),n=this.transformation.untransform(t,i);return this.projection.unproject(n)},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,i=this.scale(t),n=this.transformation.transform(e.min,i),a=this.transformation.transform(e.max,i);return new St(n,a)},infinite:!1,wrapLatLng:function(t){var e=this.wrapLng?yt(t.lng,this.wrapLng,!0):t.lng,i=this.wrapLat?yt(t.lat,this.wrapLat,!0):t.lat,n=t.alt;return new vt(i,e,n)},wrapLatLngBounds:function(t){var e=t.getCenter(),i=this.wrapLatLng(e),n=e.lat-i.lat,a=e.lng-i.lng;if(n===0&&a===0)return t;
1var r=t.getSouthWest(),c=t.getNorthEast(),d=new vt(r.lat-n,r.lng-a),g=new vt(c.lat-n,c.lng-a);return new Ut(d,g)}},fe=y({},me,{wrapLng:[-180,180],R:6371e3,distance:function(t,e){var i=Math.PI/180,n=t.lat*i,a=e.lat*i,r=Math.sin((e.lat-t.lat)*i/2),c=Math.sin((e.lng-t.lng)*i/2),d=r*r+Math.cos(n)*Math.cos(a)*c*c,g=2*Math.atan2(Math.sqrt(d),Math.sqrt(1-d));return this.R*g}}),ln=6378137,Je={R:ln,MAX_LATITUDE:85.0511287798,project:function(t){var e=Math.PI/180,i=this.MAX_LATITUDE,n=Math.max(Math.min(i,t.lat),-i),a=Math.sin(n*e);return new K(this.R*t.lng*e,this.R*Math.log((1+a)/(1-a))/2)},unproject:function(t){var e=180/Math.PI;return new vt((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*e,t.x*e/this.R)},bounds:(function(){var t=ln*Math.PI;return new St([-t,-t],[t,t])})()};function Xe(t,e,i,n){if(_t(t)){this._a=t[0],this._b=t[1],this._c=t[2],this._d=t[3];return}this._a=t,this._b=e,this._c=i,this._d=n}Xe.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 K((t.x/e-this._b)/this._a,(t.y/e-this._d)/this._c)}};function pe(t,e,i,n){return new Xe(t,e,i,n)}var di=y({},fe,{code:"EPSG:3857",projection:Je,transformation:(function(){var t=.5/(Math.PI*Je.R);return pe(t,.5,-t,.5)})()}),ui=y({},di,{code:"EPSG:900913"});function vi(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function ke(t,e){var i="",n,a,r,c,d,g;for(n=0,r=t.length;n<r;n++){for(d=t[n],a=0,c=d.length;a<c;a++)g=d[a],i+=(a?"L":"M")+g.x+" "+g.y;i+=e?R.svg?"z":"x":""}return i||"M0 0"}var Oe=document.documentElement.style,ae="ActiveXObject"in window,ze=ae&&!document.addEventListener,mi="msLaunchUri"in navigator&&!("documentMode"in document),xi=re("webkit"),yi=re("android"),cn=re("android 2")||re("android 3"),Bi=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),Un=yi&&re("Google")&&Bi<537&&!("AudioNode"in window),hn=!!window.opera,qn=!mi&&re("chrome"),Vn=re("gecko")&&!xi&&!hn&&!ae,ws=!qn&&re("safari"),Gn=re("phantom"),Kn="OTransition"in Oe,Ts=navigator.platform.indexOf("Win")===0,Yn=ae&&"transition"in Oe,Ri="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!cn,dn="MozPerspective"in Oe,un=!window.L_DISABLE_3D&&(Yn||Ri||dn)&&!Kn&&!Gn,Qe=typeof orientation<"u"||re("mobile"),mn=Qe&&xi,fn=Qe&&Ri,Fi=!window.PointerEvent&&window.MSPointerEvent,pn=!!(window.PointerEvent||Fi),gn="ontouchstart"in window||!!window.TouchEvent,Jn=!window.L_NO_TOUCH&&(gn||pn),De=Qe&&hn,Me=Qe&&Vn,Xn=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,Qn=(function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassiveEventSupport",I,e),window.removeEventListener("testPassiveEventSupport",I,e)}catch{}return t})(),Yt=(function(){return!!document.createElement("canvas").getContext})(),Ze=!!(document.createElementNS&&vi("svg").createSVGRect),bi=!!Ze&&(function(){var t=document.createElement("div");return t.innerHTML="<svg/>",(t.firstChild&&t.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"})(),ts=!Ze&&(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&&typeof e.adj=="object"}catch{return!1}})(),_n=navigator.platform.indexOf("Mac")===0,es=navigator.platform.indexOf("Linux")===0;function re(t){return navigator.userAgent.toLowerCase().indexOf(t)>=0}var R={ie:ae,ielt9:ze,edge:mi,webkit:xi,android:yi,android23:cn,androidStock:Un,opera:hn,chrome:qn,gecko:Vn,safari:ws,phantom:Gn,opera12:Kn,win:Ts,ie3d:Yn,webkit3d:Ri,gecko3d:dn,any3d:un,mobile:Qe,mobileWebkit:mn,mobileWebkit3d:fn,msPointer:Fi,pointer:pn,touch:Jn,touchNative:gn,mobileOpera:De,mobileGecko:Me,retina:Xn,passiveEvents:Qn,canvas:Yt,svg:Ze,vml:ts,inlineSvg:bi,mac:_n,linux:es},Hi=R.msPointer?"MSPointerDown":"pointerdown",Wi=R.msPointer?"MSPointerMove":"pointermove",$i=R.msPointer?"MSPointerUp":"pointerup",Ui=R.msPointer?"MSPointerCancel":"pointercancel",wi={touchstart:Hi,touchmove:Wi,touchend:$i,touchcancel:Ui},vn={touchstart:ie,touchmove:fi,touchend:fi,touchcancel:fi},ti={},qi=!1;function xn(t,e,i){return e==="touchstart"&&ss(),vn[e]?(i=vn[e].bind(this,i),t.addEventListener(wi[e],i,!1),i):(console.warn("wrong event specified:",e),I)}
1function is(t,e,i){if(!wi[e]){console.warn("wrong event specified:",e);return}t.removeEventListener(wi[e],i,!1)}function ns(t){ti[t.pointerId]=t}function b(t){ti[t.pointerId]&&(ti[t.pointerId]=t)}function yn(t){delete ti[t.pointerId]}function ss(){qi||(document.addEventListener(Hi,ns,!0),document.addEventListener(Wi,b,!0),document.addEventListener($i,yn,!0),document.addEventListener(Ui,yn,!0),qi=!0)}function fi(t,e){if(e.pointerType!==(e.MSPOINTER_TYPE_MOUSE||"mouse")){e.touches=[];for(var i in ti)e.touches.push(ti[i]);e.changedTouches=[e],t(e)}}function ie(t,e){e.MSPOINTER_TYPE_TOUCH&&e.pointerType===e.MSPOINTER_TYPE_TOUCH&&h(e),fi(t,e)}function as(t){var e={},i,n;for(n in t)i=t[n],e[n]=i&&i.bind?i.bind(t):i;return t=e,e.type="dblclick",e.detail=2,e.isTrusted=!1,e._simulated=!0,e}var we=200;function rt(t,e){t.addEventListener("dblclick",e);var i=0,n;function a(r){if(r.detail!==1){n=r.detail;return}if(!(r.pointerType==="mouse"||r.sourceCapabilities&&!r.sourceCapabilities.firesTouchEvents)){var c=w(r);if(!(c.some(function(g){return g instanceof HTMLLabelElement&&g.attributes.for})&&!c.some(function(g){return g instanceof HTMLInputElement||g instanceof HTMLSelectElement}))){var d=Date.now();d-i<=we?(n++,n===2&&e(as(r))):n=1,i=d}}}return t.addEventListener("click",a),{dblclick:e,simDblclick:a}}function rs(t,e){t.removeEventListener("dblclick",e.dblclick),t.removeEventListener("click",e.simDblclick)}var Ti=Ne(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),ge=Ne(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Si=ge==="webkitTransition"||ge==="OTransition"?ge+"End":"transitionend";function pi(t){return typeof t=="string"?document.getElementById(t):t}function Te(t,e){var i=t.style[e]||t.currentStyle&&t.currentStyle[e];if((!i||i==="auto")&&document.defaultView){var n=document.defaultView.getComputedStyle(t,null);i=n?n[e]:null}return i==="auto"?null:i}function ot(t,e,i){var n=document.createElement(t);return n.className=e||"",i&&i.appendChild(n),n}function Nt(t){var e=t.parentNode;e&&e.removeChild(t)}function Be(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function Re(t){var e=t.parentNode;e&&e.lastChild!==t&&e.appendChild(t)}function Se(t){var e=t.parentNode;e&&e.firstChild!==t&&e.insertBefore(t,e.firstChild)}function Jt(t,e){if(t.classList!==void 0)return t.classList.contains(e);var i=Et(t);return i.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(i)}function J(t,e){if(t.classList!==void 0)for(var i=at(e),n=0,a=i.length;n<a;n++)t.classList.add(i[n]);else if(!Jt(t,e)){var r=Et(t);Ce(t,(r?r+" ":"")+e)}}function Lt(t,e){t.classList!==void 0?t.classList.remove(e):Ce(t,B((" "+Et(t)+" ").replace(" "+e+" "," ")))}function Ce(t,e){t.className.baseVal===void 0?t.className=e:t.className.baseVal=e}function Et(t){return t.correspondingElement&&(t=t.correspondingElement),t.className.baseVal===void 0?t.className:t.className.baseVal}function qt(t,e){"opacity"in t.style?t.style.opacity=e:"filter"in t.style&&os(t,e)}function os(t,e){var i=!1,n="DXImageTransform.Microsoft.Alpha";try{i=t.filters.item(n)}catch{if(e===1)return}e=Math.round(e*100),i?(i.Enabled=e!==100,i.Opacity=e):t.style.filter+=" progid:"+n+"(opacity="+e+")"}function Ne(t){for(var e=document.documentElement.style,i=0;i<t.length;i++)if(t[i]in e)return t[i];return!1}function Ie(t,e,i){var n=e||new K(0,0);t.style[Ti]=(R.ie3d?"translate("+n.x+"px,"+n.y+"px)":"translate3d("+n.x+"px,"+n.y+"px,0)")+(i?" scale("+i+")":"")}function jt(t,e){t._leaflet_pos=e,R.any3d?Ie(t,e):(t.style.left=e.x+"px",t.style.top=e.y+"px")}function Pe(t){return t._leaflet_pos||new K(0,0)}var Fe,ei,Ni;if("onselectstart"in document)Fe=function(){G(window,"selectstart",h)},ei=function(){Q(window,"selectstart",h)};else{var ii=Ne(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);Fe=function(){if(ii){var t=document.documentElement.style;Ni=t[ii],t[ii]="none"}},ei=function(){ii&&(document.documentElement.style[ii]=Ni,Ni=void 0)}}function bn(){G(window,"dragstart",h)}function ni(){Q(window,"dragstart",h)}var gi,Vi;function wn(t){for(;t.tabIndex===-1;)t=t.parentNode;t.style&&(Gi(),gi=t,Vi=t.style.outlineStyle,t.style.outlineStyle="none",G(window,"keydown",Gi))}function Gi(){gi&&(gi.style.outlineStyle=Vi,gi=void 0,Vi=void 0,Q(window,"keydown",Gi))}function _e(t){do t=t.parentNode;while((!t.offsetWidth||!t.offsetHeight)&&t!==document.body);return t}function Ki(t){var e=t.getBoundingClientRect();
1return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}var Tn={__proto__:null,TRANSFORM:Ti,TRANSITION:ge,TRANSITION_END:Si,get:pi,getStyle:Te,create:ot,remove:Nt,empty:Be,toFront:Re,toBack:Se,hasClass:Jt,addClass:J,removeClass:Lt,setClass:Ce,getClass:Et,setOpacity:qt,testProp:Ne,setTransform:Ie,setPosition:jt,getPosition:Pe,get disableTextSelection(){return Fe},get enableTextSelection(){return ei},disableImageDrag:bn,enableImageDrag:ni,preventOutline:wn,restoreOutline:Gi,getSizedParentNode:_e,getScale:Ki};function G(t,e,i,n){if(e&&typeof e=="object")for(var a in e)Li(t,a,e[a],i);else{e=at(e);for(var r=0,c=e.length;r<c;r++)Li(t,e[r],i,n)}return this}var he="_leaflet_events";function Q(t,e,i,n){if(arguments.length===1)Pi(t),delete t[he];else if(e&&typeof e=="object")for(var a in e)Yi(t,a,e[a],i);else if(e=at(e),arguments.length===2)Pi(t,function(d){return Gt(e,d)!==-1});else for(var r=0,c=e.length;r<c;r++)Yi(t,e[r],i,n);return this}function Pi(t,e){for(var i in t[he]){var n=i.split(/\d/)[0];(!e||e(n))&&Yi(t,n,null,null,i)}}
1var _i={mouseenter:"mouseover",mouseleave:"mouseout",wheel:!("onwheel"in window)&&"mousewheel"};function Li(t,e,i,n){var a=e+j(i)+(n?"_"+j(n):"");if(t[he]&&t[he][a])return this;var r=function(d){return i.call(n||t,d||window.event)},c=r;!R.touchNative&&R.pointer&&e.indexOf("touch")===0?r=xn(t,e,r):R.touch&&e==="dblclick"?r=rt(t,r):"addEventListener"in t?e==="touchstart"||e==="touchmove"||e==="wheel"||e==="mousewheel"?t.addEventListener(_i[e]||e,r,R.passiveEvents?{passive:!1}:!1):e==="mouseenter"||e==="mouseleave"?(r=function(d){d=d||window.event,M(t,d)&&c(d)},t.addEventListener(_i[e],r,!1)):t.addEventListener(e,c,!1):t.attachEvent("on"+e,r),t[he]=t[he]||{},t[he][a]=r}function Yi(t,e,i,n,a){a=a||e+j(i)+(n?"_"+j(n):"");var r=t[he]&&t[he][a];if(!r)return this;!R.touchNative&&R.pointer&&e.indexOf("touch")===0?is(t,e,r):R.touch&&e==="dblclick"?rs(t,r):"removeEventListener"in t?t.removeEventListener(_i[e]||e,r,!1):t.detachEvent("on"+e,r),t[he][a]=null}function He(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,this}function o(t){return Li(t,"wheel",He),this}function u(t){return G(t,"mousedown touchstart dblclick contextmenu",He),t._leaflet_disable_click=!0,this}function h(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function _(t){return h(t),He(t),this}function w(t){if(t.composedPath)return t.composedPath();for(var e=[],i=t.target;i;)e.push(i),i=i.parentNode;return e}function N(t,e){if(!e)return new K(t.clientX,t.clientY);var i=Ki(e),n=i.boundingClientRect;return new K((t.clientX-n.left)/i.x-e.clientLeft,(t.clientY-n.top)/i.y-e.clientTop)}var m=R.linux&&R.chrome?window.devicePixelRatio:R.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function P(t){return R.edge?t.wheelDeltaY/2:t.deltaY&&t.deltaMode===0?-t.deltaY/m:t.deltaY&&t.deltaMode===1?-t.deltaY*20:t.deltaY&&t.deltaMode===2?-t.deltaY*60:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?-t.detail*20:t.detail?t.detail/-32765*60:0}function M(t,e){var i=e.relatedTarget;if(!i)return!0;try{for(;i&&i!==t;)i=i.parentNode}catch{return!1}return i!==t}var ht={__proto__:null,on:G,off:Q,stopPropagation:He,disableScrollPropagation:o,disableClickPropagation:u,preventDefault:h,stop:_,getPropagationPath:w,getMousePosition:N,getWheelDelta:P,isExternalTarget:M,addListener:G,removeListener:Q},E=hi.extend({run:function(t,e,i,n){this.stop(),this._el=t,this._inProgress=!0,this._duration=i||.25,this._easeOutPower=1/Math.max(n||.5,.2),this._startPos=Pe(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=Zt(this._animate,this),this._step()},_step:function(t){var e=+new Date-this._startTime,i=this._duration*1e3;e<i?this._runFrame(this._easeOut(e/i),t):(this._runFrame(1),this._complete())},_runFrame:function(t,e){var i=this._startPos.add(this._offset.multiplyBy(t));e&&i._round(),jt(this._el,i),this.fire("step")},_complete:function(){Dt(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),C=hi.extend({options:{crs:di,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=H(this,e),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),this._onResize=S(this._onResize,this),this._initEvents(),e.maxBounds&&this.setMaxBounds(e.maxBounds),e.zoom!==void 0&&(this._zoom=this._limitZoom(e.zoom)),e.center&&e.zoom!==void 0&&this.setView(tt(e.center),e.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=ge&&R.any3d&&!R.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),G(this._proxy,Si,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)}
1,setView:function(t,e,i){if(e=e===void 0?this._zoom:this._limitZoom(e),t=this._limitCenter(tt(t),e,this.options.maxBounds),i=i||{},this._stop(),this._loaded&&!i.reset&&i!==!0){i.animate!==void 0&&(i.zoom=y({animate:i.animate},i.zoom),i.pan=y({animate:i.animate,duration:i.duration},i.pan));var n=this._zoom!==e?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,e,i.zoom):this._tryAnimatedPan(t,i.pan);if(n)return clearTimeout(this._sizeTimer),this}return this._resetView(t,e,i.pan&&i.pan.noMoveStart),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||(R.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom+t,e)},zoomOut:function(t,e){return t=t||(R.any3d?this.options.zoomDelta:1),this.setZoom(this._zoom-t,e)},setZoomAround:function(t,e,i){var n=this.getZoomScale(e),a=this.getSize().divideBy(2),r=t instanceof K?t:this.latLngToContainerPoint(t),c=r.subtract(a).multiplyBy(1-1/n),d=this.containerPointToLatLng(a.add(c));return this.setView(d,e,{zoom:i})},_getBoundsCenterZoom:function(t,e){e=e||{},t=t.getBounds?t.getBounds():wt(t);var i=q(e.paddingTopLeft||e.padding||[0,0]),n=q(e.paddingBottomRight||e.padding||[0,0]),a=this.getBoundsZoom(t,!1,i.add(n));if(a=typeof e.maxZoom=="number"?Math.min(e.maxZoom,a):a,a===1/0)return{center:t.getCenter(),zoom:a};
1var r=n.subtract(i).divideBy(2),c=this.project(t.getSouthWest(),a),d=this.project(t.getNorthEast(),a),g=this.unproject(c.add(d).divideBy(2).add(r),a);return{center:g,zoom:a}},fitBounds:function(t,e){if(t=wt(t),!t.isValid())throw new Error("Bounds are not valid.");var i=this._getBoundsCenterZoom(t,e);return this.setView(i.center,i.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=q(t).round(),e=e||{},!t.x&&!t.y)return this.fire("moveend");if(e.animate!==!0&&!this.getSize().contains(t))return this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new E,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),e.noMoveStart||this.fire("movestart"),e.animate!==!1){J(this._mapPane,"leaflet-pan-anim");var i=this._getMapPanePos().subtract(t).round();this._panAnim.run(this._mapPane,i,e.duration||.25,e.easeLinearity)}else this._rawPanBy(t),this.fire("move").fire("moveend");return this},flyTo:function(t,e,i){if(i=i||{},i.animate===!1||!R.any3d)return this.setView(t,e,i);this._stop();var n=this.project(this.getCenter()),a=this.project(t),r=this.getSize(),c=this._zoom;t=tt(t),e=e===void 0?c:e;var d=Math.max(r.x,r.y),g=d*this.getZoomScale(c,e),T=a.distanceTo(n)||1,A=1.42,U=A*A;function st(zt){var En=zt?-1:1,tr=zt?g:d,er=g*g-d*d+En*U*U*T*T,ir=2*tr*U*T,fs=er/ir,qs=Math.sqrt(fs*fs+1)-fs,nr=qs<1e-9?-18:Math.log(qs);return nr}function se(zt){return(Math.exp(zt)-Math.exp(-zt))/2}function $t(zt){return(Math.exp(zt)+Math.exp(-zt))/2}function xe(zt){return se(zt)/$t(zt)}var le=st(0);function Ei(zt){return d*($t(le)/$t(le+A*zt))}function Ya(zt){return d*($t(le)*xe(le+A*zt)-se(le))/U}function Ja(zt){return 1-Math.pow(1-zt,1.5)}var Xa=Date.now(),$s=(st(1)-le)/A,Qa=i.duration?1e3*i.duration:1e3*$s*.8;function Us(){var zt=(Date.now()-Xa)/Qa,En=Ja(zt)*$s;zt<=1?(this._flyToFrame=Zt(Us,this),this._move(this.unproject(n.add(a.subtract(n).multiplyBy(Ya(En)/T)),c),this.getScaleZoom(d/Ei(En),c),{flyTo:!0})):this._move(t,e)._moveEnd(!0)}return this._moveStart(!0,i.noMoveStart),Us.call(this),this},flyToBounds:function(t,e){var i=this._getBoundsCenterZoom(t,e);return this.flyTo(i.center,i.zoom,e)},setMaxBounds:function(t){return t=wt(t),this.listens("moveend",this._panInsideMaxBounds)&&this.off("moveend",this._panInsideMaxBounds),t.isValid()?(this.options.maxBounds=t,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},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 i=this.getCenter(),n=this._limitCenter(i,this._zoom,wt(t));return i.equals(n)||this.panTo(n,e),this._enforcingBounds=!1,this},panInside:function(t,e){e=e||{};var i=q(e.paddingTopLeft||e.padding||[0,0]),n=q(e.paddingBottomRight||e.padding||[0,0]),a=this.project(this.getCenter()),r=this.project(t),c=this.getPixelBounds(),d=Ht([c.min.add(i),c.max.subtract(n)]),g=d.getSize();if(!d.contains(r)){this._enforcingBounds=!0;var T=r.subtract(d.getCenter()),A=d.extend(r).getSize().subtract(g);a.x+=T.x<0?-A.x:A.x,a.y+=T.y<0?-A.y:A.y,this.panTo(this.unproject(a),e),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=y({animate:!1,pan:!0},t===!0?{animate:!0}:t);var e=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var i=this.getSize(),n=e.divideBy(2).round(),a=i.divideBy(2).round(),r=n.subtract(a);return!r.x&&!r.y?this:(t.animate&&t.pan?this.panBy(r):(t.pan&&this._rawPanBy(r),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(S(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:e,newSize:i}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=y({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var e=S(this._handleGeolocationResponse,this),i=S(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){if(this._container._leaflet_id){var e=t.code,i=t.message||(e===1?"permission denied":e===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+i+"."})}},_handleGeolocationResponse:function(t){if(this._container._leaflet_id){var e=t.coords.latitude,i=t.coords.longitude,n=new vt(e,i),a=n.toBounds(t.coords.accuracy*2),r=this._locateOptions;if(r.setView){var c=this.getBoundsZoom(a);this.setView(n,r.maxZoom?Math.min(c,r.maxZoom):c)}var d={latlng:n,bounds:a,timestamp:t.timestamp};for(var g in t.coords)typeof t.coords[g]=="number"&&(d[g]=t.coords[g]);this.fire("locationfound",d)}},addHandler:function(t,e){if(!e)return this;var i=this[t]=new e(this);return this._handlers.push(i),this.options[t]&&i.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),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{this._container._leaflet_id=void 0,this._containerId=void 0}this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),Nt(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(Dt(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var t;for(t in this._layers)this._layers[t].remove();for(t in this._panes)Nt(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,e){var i="leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),n=ot("div",i,e||this._mapPane);return t&&(this._panes[t]=n),n},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds(),e=this.unproject(t.getBottomLeft()),i=this.unproject(t.getTopRight());return new Ut(e,i)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZo
1om===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,i){t=wt(t),i=q(i||[0,0]);var n=this.getZoom()||0,a=this.getMinZoom(),r=this.getMaxZoom(),c=t.getNorthWest(),d=t.getSouthEast(),g=this.getSize().subtract(i),T=Ht(this.project(d,n),this.project(c,n)).getSize(),A=R.any3d?this.options.zoomSnap:1,U=g.x/T.x,st=g.y/T.y,se=e?Math.max(U,st):Math.min(U,st);return n=this.getScaleZoom(se,n),A&&(n=Math.round(n/(A/100))*(A/100),n=e?Math.ceil(n/A)*A:Math.floor(n/A)*A),Math.max(a,Math.min(r,n))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new K(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,e){var i=this._getTopLeftPoint(t,e);return new St(i,i.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(t===void 0?this.getZoom():t)},getPane:function(t){return typeof t=="string"?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,e){var i=this.options.crs;return e=e===void 0?this._zoom:e,i.scale(t)/i.scale(e)},getScaleZoom:function(t,e){var i=this.options.crs;e=e===void 0?this._zoom:e;var n=i.zoom(t*i.scale(e));return isNaN(n)?1/0:n},project:function(t,e){return e=e===void 0?this._zoom:e,this.options.crs.latLngToPoint(tt(t),e)},unproject:function(t,e){return e=e===void 0?this._zoom:e,this.options.crs.pointToLatLng(q(t),e)},layerPointToLatLng:function(t){var e=q(t).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){var e=this.project(tt(t))._round();return e._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(tt(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(wt(t))},distance:function(t,e){return this.options.crs.distance(tt(t),tt(e))},containerPointToLayerPoint:function(t){return q(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return q(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var e=this.containerPointToLayerPoint(q(t));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(tt(t)))},mouseEventToContainerPoint:function(t){return N(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=pi(t);if(e){if(e._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");G(e,"scroll",this._onScroll,this),this._containerId=j(e)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&R.any3d,J(t,"leaflet-container"+(R.touch?" leaflet-touch":"")+(R.retina?" leaflet-retina":"")+(R.ielt9?" leaflet-oldie":"")+(R.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var e=Te(t,"position");e!=="absolute"&&e!=="relative"&&e!=="fixed"&&e!=="sticky"&&(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),jt(this._mapPane,new K(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(J(t.markerPane,"leaflet-zoom-hide"),J(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,e,i){jt(this._mapPane,new K(0,0));var n=!this._loaded;this._loaded=!0,e=this._limitZoom(e),this.fire("viewprereset");var a=this._zoom!==e;this._moveStart(a,i)._move(t,e)._moveEnd(a),this.fire("viewreset"),n&&this.fire("load")},_moveStart:function(t,e){return t&&this.fire("zoomstart"),e||this.fire("movestart"),this}
1,_move:function(t,e,i,n){e===void 0&&(e=this._zoom);var a=this._zoom!==e;return this._zoom=e,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),n?i&&i.pinch&&this.fire("zoom",i):((a||i&&i.pinch)&&this.fire("zoom",i),this.fire("move",i)),this},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return Dt(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){jt(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[j(this._container)]=this;var e=t?Q:G;e(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),R.any3d&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){Dt(this._resizeRequest),this._resizeRequest=Zt(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 i=[],n,a=e==="mouseout"||e==="mouseover",r=t.target||t.srcElement,c=!1;r;){if(n=this._targets[j(r)],n&&(e==="click"||e==="preclick")&&this._draggableMoved(n)){c=!0;break}if(n&&n.listens(e,!0)&&(a&&!M(r,t)||(i.push(n),a))||r===this._container)break;r=r.parentNode}return!i.length&&!c&&!a&&this.listens(e,!0)&&(i=[this]),i},_isClickDisabled:function(t){for(;t&&t!==this._container;){if(t._leaflet_disable_click)return!0;t=t.parentNode}},_handleDOMEvent:function(t){var e=t.target||t.srcElement;if(!(!this._loaded||e._leaflet_disable_events||t.type==="click"&&this._isClickDisabled(e))){var i=t.type;i==="mousedown"&&wn(e),this._fireDOMEvent(t,i)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,e,i){if(t.type==="click"){var n=y({},t);n.type="preclick",this._fireDOMEvent(n,n.type,i)}var a=this._findEventTargets(t,e);if(i){for(var r=[],c=0;c<i.length;c++)i[c].listens(e,!0)&&r.push(i[c]);a=r.concat(a)}if(a.length){e==="contextmenu"&&h(t);var d=a[0],g={originalEvent:t};if(t.type!=="keypress"&&t.type!=="keydown"&&t.type!=="keyup"){var T=d.getLatLng&&(!d._radius||d._radius<=10);g.containerPoint=T?this.latLngToContainerPoint(d.getLatLng()):this.mouseEventToContainerPoint(t),g.layerPoint=this.containerPointToLayerPoint(g.containerPoint),g.latlng=T?d.getLatLng():this.layerPointToLatLng(g.layerPoint)}for(c=0;c<a.length;c++)if(a[c].fire(e,g,!0),g.originalEvent._stopped||a[c].options.bubblingMouseEvents===!1&&Gt(this._mouseEvents,e)!==-1)return}},_draggableMoved:function(t){return t=t.dragging&&t.dragging.enabled()?t:this,t.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 Pe(this._mapPane)||new K(0,0)},_moved:function(){var t=this._getMapPanePos();return t&&!t.equals([0,0])},_getTopLeftPoint:function(t,e){var i=t&&e!==void 0?this._getNewPixelOrigin(t,e):this.getPixelOrigin();return i.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(t,e){var i=this.getSize()._divideBy(2);return this.project(t,e)._subtract(i)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(t,e,i){var n=this._getNewPixelOrigin(i,e);return this.project(t,e)._subtract(n)},_latLngBoundsToNewLayerBounds:function(t,e,i){var n=this._getNewPixelOrigin(i,e);
1return Ht([this.project(t.getSouthWest(),e)._subtract(n),this.project(t.getNorthWest(),e)._subtract(n),this.project(t.getSouthEast(),e)._subtract(n),this.project(t.getNorthEast(),e)._subtract(n)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())},_limitCenter:function(t,e,i){if(!i)return t;var n=this.project(t,e),a=this.getSize().divideBy(2),r=new St(n.subtract(a),n.add(a)),c=this._getBoundsOffset(r,i,e);return Math.abs(c.x)<=1&&Math.abs(c.y)<=1?t:this.unproject(n.add(c),e)},_limitOffset:function(t,e){if(!e)return t;var i=this.getPixelBounds(),n=new St(i.min.add(t),i.max.add(t));return t.add(this._getBoundsOffset(n,e))},_getBoundsOffset:function(t,e,i){var n=Ht(this.project(e.getNorthEast(),i),this.project(e.getSouthWest(),i)),a=n.min.subtract(t.min),r=n.max.subtract(t.max),c=this._rebound(a.x,-r.x),d=this._rebound(a.y,-r.y);return new K(c,d)},_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(),i=this.getMaxZoom(),n=R.any3d?this.options.zoomSnap:1;return n&&(t=Math.round(t/n)*n),Math.max(e,Math.min(i,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){Lt(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,e){var i=this._getCenterOffset(t)._trunc();return(e&&e.animate)!==!0&&!this.getSize().contains(i)?!1:(this.panBy(i,e),!0)},_createAnimProxy:function(){var t=this._proxy=ot("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",function(e){var i=Ti,n=this._proxy.style[i];Ie(this._proxy,this.project(e.center,e.zoom),this.getZoomScale(e.zoom,1)),n===this._proxy.style[i]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){Nt(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var t=this.getCenter(),e=this.getZoom();Ie(this._proxy,this.project(t,e),this.getZoomScale(e,1))},_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,i){if(this._animatingZoom)return!0;if(i=i||{},!this._zoomAnimated||i.animate===!1||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(e),a=this._getCenterOffset(t)._divideBy(1-1/n);return i.animate!==!0&&!this.getSize().contains(a)?!1:(Zt(function(){this._moveStart(!0,i.noMoveStart||!1)._animateZoom(t,e,!0)},this),!0)},_animateZoom:function(t,e,i,n){this._mapPane&&(i&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=e,J(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:e,noUpdate:n}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(S(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&Lt(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire("zoom"),delete this._tempFireZoomEvent,this.fire("move"),this._moveEnd(!0))}});function $(t,e){return new C(t,e)}var mt=Tt.extend({options:{position:"topright"},initialize:function(t){H(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),i=this.getPosition(),n=t._controlCorners[i];return J(e,"leaflet-control"),i.indexOf("bottom")!==-1?n.insertBefore(e,n.firstChild):n.appendChild(e),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(Nt(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(t){this._map&&t&&t.screenX>0&&t.screenY>0&&this._map.getContainer().focus()}}),et=function(t){return new mt(t)};C.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this}
1,_initControlPos:function(){var t=this._controlCorners={},e="leaflet-",i=this._controlContainer=ot("div",e+"control-container",this._container);function n(a,r){var c=e+a+" "+e+r;t[a+r]=ot("div",c,i)}n("top","left"),n("top","right"),n("bottom","left"),n("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)Nt(this._controlCorners[t]);Nt(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var dt=mt.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,e,i,n){return i<n?-1:n<i?1:0}},initialize:function(t,e,i){H(this,i),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1;for(var n in t)this._addLayer(t[n],n);for(n in e)this._addLayer(e[n],n,!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 mt.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(j(t));return e&&this._layers.splice(this._layers.indexOf(e),1),this._map?this._update():this},expand:function(){J(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?(J(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=t+"px"):Lt(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return Lt(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var t="leaflet-control-layers",e=this._container=ot("div",t),i=this.options.collapsed;e.setAttribute("aria-haspopup",!0),u(e),o(e);var n=this._section=ot("section",t+"-list");i&&(this._map.on("click",this.collapse,this),G(e,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var a=this._layersLink=ot("a",t+"-toggle",e);a.href="#",a.title="Layers",a.setAttribute("role","button"),G(a,{keydown:function(r){r.keyCode===13&&this._expandSafely()},click:function(r){h(r),this._expandSafely()}},this),i||this.expand(),this._baseLayersList=ot("div",t+"-base",n),this._separator=ot("div",t+"-separator",n),this._overlaysList=ot("div",t+"-overlays",n),e.appendChild(n)},_getLayer:function(t){for(var e=0;e<this._layers.length;e++)if(this._layers[e]&&j(this._layers[e].layer)===t)return this._layers[e]},_addLayer:function(t,e,i){this._map&&t.on("add remove",this._onLayerChange,this),this._layers.push({layer:t,name:e,overlay:i}),this.options.sortLayers&&this._layers.sort(S(function(n,a){return this.options.sortFunction(n.layer,a.layer,n.name,a.name)},this)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;Be(this._baseLayersList),Be(this._overlaysList),this._layerControlInputs=[];var t,e,i,n,a=0;for(i=0;i<this._layers.length;i++)n=this._layers[i],this._addItem(n),e=e||n.overlay,t=t||!n.overlay,a+=n.overlay?0:1;return this.options.hideSingleBase&&(t=t&&a>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(j(t.target)),i=e.overlay?t.type==="add"?"overlayadd":"overlayremove":t.type==="add"?"baselayerchange":null;i&&this._map.fire(i,e)},_createRadioElement:function(t,e){var i='<input type="radio" class="leaflet-control-layers-selector" name="'+t+'"'+(e?' checked="checked"':"")+"/>",n=document.createElement("div");return n.innerHTML=i,n.firstChild},_addItem:function(t){var e=document.createElement("label"),i=this._map.hasLayer(t.layer),n;t.overlay?(n=document.createElement("input"),n.type="checkbox",n.className="leaflet-control-layers-selector",n.defaultChecked=i):n=this._createRadioElement("leaflet-base-layers_"+j(this),i),this._layerControlInputs.push(n),n.layerId=j(t.layer),G(n,"click",this._onInputClick,this);var a=document.createElement("span");a.innerHTML=" "+t.name;var r=document.createElement("span");e.appendChild(r),r.appendChild(n),r.appendChild(a);var c=t.overlay?this._overlaysList:this._baseLayersList;return c.appendChild(e),this._checkDisabledLayers(),e},_onInputClick:function(){if(!this._preventClick){var t=this._layerControlInputs,e,i,n=[],a=[];this._handlingClick=!0;for(var r=t.length-1;r>=0;r--)e=t[r],i=this._getLayer(e.layerId).layer,e.checked?n.push(i):e.checked||a.push(i);for(r=0;r<a.length;r++)this._map.hasLayer(a[r])&&this._map.removeLayer(a[r]);for(r=0;r<n.length;r++)this._map.hasLayer(n[r])||this._map.addLayer(n[r]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var t=this._layerControlInputs,e,i,n=this._map.getZoom(),a=t.length-1;a>=0;a--)e=t[a],i=this._getLayer(e.layerId).layer,e.disabled=i.options.minZoom!==void 0&&n<i.options.minZoom||i.options.maxZoom!==void 0&&n>i.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var t=this._section;this._preventClick=!0,G(t,"click",h),this.expand();var e=this;setTimeout(function(){Q(t,"click",h),e._preventClick=!1})}}
1),ft=function(t,e,i){return new dt(t,e,i)},it=mt.extend({options:{position:"topleft",zoomInText:'<span aria-hidden="true">+</span>',zoomInTitle:"Zoom in",zoomOutText:'<span aria-hidden="true">&#x2212;</span>',zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",i=ot("div",e+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,e+"-in",i,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,e+"-out",i,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),i},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,i,n,a){var r=ot("a",i,n);return r.innerHTML=t,r.href="#",r.title=e,r.setAttribute("role","button"),r.setAttribute("aria-label",e),u(r),G(r,"click",_),G(r,"click",a,this),G(r,"click",this._refocusOnMap,this),r},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";Lt(this._zoomInButton,e),Lt(this._zoomOutButton,e),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||t._zoom===t.getMinZoom())&&(J(this._zoomOutButton,e),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||t._zoom===t.getMaxZoom())&&(J(this._zoomInButton,e),this._zoomInButton.setAttribute("aria-disabled","true"))}});C.mergeOptions({zoomControl:!0}),C.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new it,this.addControl(this.zoomControl))});var W=function(t){return new it(t)},pt=mt.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var e="leaflet-control-scale",i=ot("div",e),n=this.options;return this._addScales(n,e+"-line",i),t.on(n.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),i},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,i){t.metric&&(this._mScale=ot("div",e,i)),t.imperial&&(this._iScale=ot("div",e,i))},_update:function(){var t=this._map,e=t.getSize().y/2,i=t.distance(t.containerPointToLatLng([0,e]),t.containerPointToLatLng([this.options.maxWidth,e]));this._updateScales(i)},_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),i=e<1e3?e+" m":e/1e3+" km";this._updateScale(this._mScale,i,e/t)},_updateImperial:function(t){var e=t*3.2808399,i,n,a;e>5280?(i=e/5280,n=this._getRoundNum(i),this._updateScale(this._iScale,n+" mi",n/i)):(a=this._getRoundNum(e),this._updateScale(this._iScale,a+" ft",a/e))},_updateScale:function(t,e,i){t.style.width=Math.round(this.options.maxWidth*i)+"px",t.innerHTML=e},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:1,e*i}}),Wt=function(t){return new pt(t)},Xt='<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8" class="leaflet-attribution-flag"><path fill="#4C7BE1" d="M0 0h12v4H0z"/><path fill="#FFD500" d="M0 4h12v3H0z"/><path fill="#E0BC00" d="M0 7h12v1H0z"/></svg>',At=mt.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">'+(R.inlineSvg?Xt+" ":"")+"Leaflet</a>"},initialize:function(t){H(this,t),this._attributions={}},onAdd:function(t){t.attributionControl=this,this._container=ot("div","leaflet-control-attribution"),u(this._container);for(var e in t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return this._update(),t.on("layeradd",this._addAttribution,this),this._container},onRemove:function(t){t.off("layeradd",this._addAttribution,this)},_addAttribution:function(t){t.layer.getAttribution&&(this.addAttribution(t.layer.getAttribution()),t.layer.once("remove",function(){this.removeAttribution(t.layer.getAttribution())},this))},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 i=[];this.options.prefix&&i.push(this.options.prefix),t.length&&i.push(t.join(", ")),this._container.innerHTML=i.join(' <span aria-hidden="true">|</span> ')}}});C.mergeOptions({attributionControl:!0}),C.addInitHook(function(){this.options.attributionControl&&new At().addTo(this)});var Mt=function(t){return new At(t)};mt.Layers=dt,mt.Zoom=it,mt.Scale=pt,mt.Attribution=At,et.layers=ft,et.zoom=W,et.scale=Wt,et.attribution=Mt;var Pt=Tt.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}});Pt.addTo=function(t,e){return t.addHandler(e,this),this};var ve={Events:ee},f=R.touch?"touchstart mousedown":"mousedown",k=hi.extend({options:{clickTolerance:3}
1,initialize:function(t,e,i,n){H(this,n),this._element=t,this._dragStartTarget=e||t,this._preventOutline=i},enable:function(){this._enabled||(G(this._dragStartTarget,f,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(k._dragging===this&&this.finishDrag(!0),Q(this._dragStartTarget,f,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(this._enabled&&(this._moved=!1,!Jt(this._element,"leaflet-zoom-anim"))){if(t.touches&&t.touches.length!==1){k._dragging===this&&this.finishDrag();return}if(!(k._dragging||t.shiftKey||t.which!==1&&t.button!==1&&!t.touches)&&(k._dragging=this,this._preventOutline&&wn(this._element),bn(),Fe(),!this._moving)){this.fire("down");var e=t.touches?t.touches[0]:t,i=_e(this._element);this._startPoint=new K(e.clientX,e.clientY),this._startPos=Pe(this._element),this._parentScale=Ki(i);var n=t.type==="mousedown";G(document,n?"mousemove":"touchmove",this._onMove,this),G(document,n?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(t){if(this._enabled){if(t.touches&&t.touches.length>1){this._moved=!0;return}var e=t.touches&&t.touches.length===1?t.touches[0]:t,i=new K(e.clientX,e.clientY)._subtract(this._startPoint);!i.x&&!i.y||Math.abs(i.x)+Math.abs(i.y)<this.options.clickTolerance||(i.x/=this._parentScale.x,i.y/=this._parentScale.y,h(t),this._moved||(this.fire("dragstart"),this._moved=!0,J(document.body,"leaflet-dragging"),this._lastTarget=t.target||t.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),J(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(i),this._moving=!0,this._lastEvent=t,this._updatePosition())}},_updatePosition:function(){var t={originalEvent:this._lastEvent};this.fire("predrag",t),jt(this._element,this._newPos),this.fire("drag",t)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(t){Lt(document.body,"leaflet-dragging"),this._lastTarget&&(Lt(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),Q(document,"mousemove touchmove",this._onMove,this),Q(document,"mouseup touchend touchcancel",this._onUp,this),ni(),ei();var e=this._moved&&this._moving;this._moving=!1,k._dragging=!1,e&&this.fire("dragend",{noInertia:t,distance:this._newPos.distanceTo(this._startPos)})}});function F(t,e,i){var n,a=[1,4,2,8],r,c,d,g,T,A,U,st;for(r=0,A=t.length;r<A;r++)t[r]._code=$e(t[r],e);for(d=0;d<4;d++){for(U=a[d],n=[],r=0,A=t.length,c=A-1;r<A;c=r++)g=t[r],T=t[c],g._code&U?T._code&U||(st=We(T,g,U,e,i),st._code=$e(st,e),n.push(st)):(T._code&U&&(st=We(T,g,U,e,i),st._code=$e(st,e),n.push(st)),n.push(g));t=n}return t}function lt(t,e){var i,n,a,r,c,d,g,T,A;if(!t||t.length===0)throw new Error("latlngs not passed");ne(t)||(console.warn("latlngs are not flat! Only the first ring will be used"),t=t[0]);var U=tt([0,0]),st=wt(t),se=st.getNorthWest().distanceTo(st.getSouthWest
1())*st.getNorthEast().distanceTo(st.getNorthWest());se<1700&&(U=xt(t));var $t=t.length,xe=[];for(i=0;i<$t;i++){var le=tt(t[i]);xe.push(e.project(tt([le.lat-U.lat,le.lng-U.lng])))}for(d=g=T=0,i=0,n=$t-1;i<$t;n=i++)a=xe[i],r=xe[n],c=a.y*r.x-r.y*a.x,g+=(a.x+r.x)*c,T+=(a.y+r.y)*c,d+=c*3;d===0?A=xe[0]:A=[g/d,T/d];var Ei=e.unproject(q(A));return tt([Ei.lat+U.lat,Ei.lng+U.lng])}function xt(t){for(var e=0,i=0,n=0,a=0;a<t.length;a++){var r=tt(t[a]);e+=r.lat,i+=r.lng,n++}return tt([e/n,i/n])}var gt={__proto__:null,clipPolygon:F,polygonCenter:lt,centroid:xt};function Y(t,e){if(!e||!t.length)return t.slice();var i=e*e;return t=de(t,i),t=X(t,i),t}function nt(t,e,i){return Math.sqrt(si(t,e,i,!0))}function Ot(t,e,i){return si(t,e,i)}function X(t,e){var i=t.length,n=typeof Uint8Array<"u"?Uint8Array:Array,a=new n(i);a[0]=a[i-1]=1,Vt(t,a,e,0,i-1);var r,c=[];for(r=0;r<i;r++)a[r]&&c.push(t[r]);return c}function Vt(t,e,i,n,a){var r=0,c,d,g;for(d=n+1;d<=a-1;d++)g=si(t[d],t[n],t[a],!0),g>r&&(c=d,r=g);r>i&&(e[c]=1,Vt(t,e,i,n,c),Vt(t,e,i,c,a))}function de(t,e){for(var i=[t[0]],n=1,a=0,r=t.length;n<r;n++)ls(t[n],t[a])>e&&(i.push(t[n]),a=n);return a<r-1&&i.push(t[r-1]),i}var kt;function Bt(t,e,i,n,a){var r=n?kt:$e(t,i),c=$e(e,i),d,g,T;for(kt=c;;){if(!(r|c))return[t,e];if(r&c)return!1;d=r||c,g=We(t,e,d,i,a),T=$e(g,i),d===r?(t=g,r=T):(e=g,c=T)}}function We(t,e,i,n,a){var r=e.x-t.x,c=e.y-t.y,d=n.min,g=n.max,T,A;return i&8?(T=t.x+r*(g.y-t.y)/c,A=g.y):i&4?(T=t.x+r*(d.y-t.y)/c,A=d.y):i&2?(T=g.x,A=t.y+c*(g.x-t.x)/r):i&1&&(T=d.x,A=t.y+c*(d.x-t.x)/r),new K(T,A,a)}function $e(t,e){var i=0;return t.x<e.min.x?i|=1:t.x>e.max.x&&(i|=2),t.y<e.min.y?i|=4:t.y>e.max.y&&(i|=8),i}function ls(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n}function si(t,e,i,n){var a=e.x,r=e.y,c=i.x-a,d=i.y-r,g=c*c+d*d,T;return g>0&&(T=((t.x-a)*c+(t.y-r)*d)/g,T>1?(a=i.x,r=i.y):T>0&&(a+=c*T,r+=d*T)),c=t.x-a,d=t.y-r,n?c*c+d*d:new K(a,r)}function ne(t){return!_t(t[0])||typeof t[0][0]!="object"&&typeof t[0][0]<"u"}function Ji(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),ne(t)}function Rt(t,e){var i,n,a,r,c,d,g,T;if(!t||t.length===0)throw new Error("latlngs not passed");ne(t)||(console.warn("latlngs are not flat! Only the first ring will be used"),t=t[0]);var A=tt([0,0]),U=wt(t),st=U.getNorthWest().distanceTo(U.getSouthWest
1())*U.getNorthEast().distanceTo(U.getNorthWest());st<1700&&(A=xt(t));var se=t.length,$t=[];for(i=0;i<se;i++){var xe=tt(t[i]);$t.push(e.project(tt([xe.lat-A.lat,xe.lng-A.lng])))}for(i=0,n=0;i<se-1;i++)n+=$t[i].distanceTo($t[i+1])/2;if(n===0)T=$t[0];else for(i=0,r=0;i<se-1;i++)if(c=$t[i],d=$t[i+1],a=c.distanceTo(d),r+=a,r>n){g=(r-n)/a,T=[d.x-g*(d.x-c.x),d.y-g*(d.y-c.y)];break}var le=e.unproject(q(T));return tt([le.lat+A.lat,le.lng+A.lng])}var oe={__proto__:null,simplify:Y,pointToSegmentDistance:nt,closestPointOnSegment:Ot,clipSegment:Bt,_getEdgeIntersection:We,_getBitCode:$e,_sqClosestPointOnSegment:si,isFlat:ne,_flat:Ji,polylineCenter:Rt},ji={project:function(t){return new K(t.lng,t.lat)},unproject:function(t){return new vt(t.y,t.x)},bounds:new St([-180,-90],[180,90])},cs={R:6378137,R_MINOR:6356752314245179e-9,bounds:new St([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(t){var e=Math.PI/180,i=this.R,n=t.lat*e,a=this.R_MINOR/i,r=Math.sqrt(1-a*a),c=r*Math.sin(n),d=Math.tan(Math.PI/4-n/2)/Math.pow((1-c)/(1+c),r/2);return n=-i*Math.log(Math.max(d,1e-10)),new K(t.lng*e*i,n)},unproject:function(t){for(var e=180/Math.PI,i=this.R,n=this.R_MINOR/i,a=Math.sqrt(1-n*n),r=Math.exp(-t.y/i),c=Math.PI/2-2*Math.atan(r),d=0,g=.1,T;d<15&&Math.abs(g)>1e-7;d++)T=a*Math.sin(c),T=Math.pow((1-T)/(1+T),a/2),g=Math.PI/2-2*Math.atan(r*T)-c,c+=g;return new vt(c*e,t.x*e/i)}},Pa={__proto__:null,LonLat:ji,Mercator:cs,SphericalMercator:Je},La=y({},fe,{code:"EPSG:3395",projection:cs,transformation:(function(){var t=.5/(Math.PI*cs.R);return pe(t,.5,-t,.5)})()}),Ss=y({},fe,{code:"EPSG:4326",projection:ji,transformation:pe(1/180,1,-1/180,.5)}),ja=y({},me,{projection:ji,transformation:pe(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 i=e.lng-t.lng,n=e.lat-t.lat;return Math.sqrt(i*i+n*n)},infinite:!0});me.Earth=fe,me.EPSG3395=La,me.EPSG3857=di,me.EPSG900913=ui,me.EPSG4326=Ss,me.Simple=ja;var Le=hi.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[j(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[j(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 i=this.getEvents();e.on(i,this),this.once("remove",function(){e.off(i,this)},this)}this.onAdd(e),this.fire("add"),e.fire("layeradd",{layer:this})}}});C.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var e=j(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=j(t);return this._layers[e]?(this._loaded&&t.onRemove(this),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 j(t)in this._layers},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},_addLayers:function(t){t=t?_t(t)?t:[t]:[];for(var e=0,i=t.length;e<i;e++)this.addLayer(t[e])},_addZoomLimit:function(t){(!isNaN(t.options.maxZoom)||!isNaN(t.options.minZoom))&&(this._zoomBoundLayers[j(t)]=t,this._updateZoomLevels())},_removeZoomLimit:function(t){var e=j(t);this._zoomBoundLayers[e]&&(delete this._zoomBoundLayers[e],this._updateZoomLevels())},_updateZoomLevels:function(){var t=1/0,e=-1/0,i=this._getZoomSpan();for(var n in this._zoomBoundLayers){var a=this._zoomBoundLayers[n].options;t=a.minZoom===void 0?t:Math.min(t,a.minZoom),e=a.maxZoom===void 0?e:Math.max(e,a.maxZoom)}this._layersMaxZoom=e===-1/0?void 0:e,this._layersMinZoom=t===1/0?void 0:t,i!==this._getZoomSpan()&&this.fire("zoomlevelschange"),this.options.maxZoom===void 0&&this._layersMaxZo
1om&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var ki=Le.extend({initialize:function(t,e){H(this,e),this._layers={};var i,n;if(t)for(i=0,n=t.length;i<n;i++)this.addLayer(t[i])},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){var e=typeof t=="number"?t:this.getLayerId(t);return e in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(t){var e=Array.prototype.slice.call(arguments,1),i,n;for(i in this._layers)n=this._layers[i],n[t]&&n[t].apply(n,e);return this},onAdd:function(t){this.eachLayer(t.addLayer,t)},onRemove:function(t){this.eachLayer(t.removeLayer,t)},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);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 j(t)}}),ka=function(t,e){return new ki(t,e)},Ue=ki.extend({addLayer:function(t){return this.hasLayer(t)?this:(t.addEventParent(this),ki.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),ki.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 Ut;for(var e in this._layers){var i=this._layers[e];t.extend(i.getBounds?i.getBounds():i.getLatLng())}return t}}),Da=function(t,e){return new Ue(t,e)},Di=Tt.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(t){H(this,t)},createIcon:function(t){return this._createIcon("icon",t)},createShadow:function(t){return this._createIcon("shadow",t)},_createIcon:function(t,e){var i=this._getIconUrl(t);if(!i){if(t==="icon")throw new Error("iconUrl not set in Icon options (see the docs).");return null}var n=this._createImg(i,e&&e.tagName==="IMG"?e:null);return this._setIconStyles(n,t),(this.options.crossOrigin||this.options.crossOrigin==="")&&(n.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),n},_setIconStyles:function(t,e){var i=this.options,n=i[e+"Size"];typeof n=="number"&&(n=[n,n]);var a=q(n),r=q(e==="shadow"&&i.shadowAnchor||i.iconAnchor||a&&a.divideBy(2,!0));t.className="leaflet-marker-"+e+" "+(i.className||""),r&&(t.style.marginLeft=-r.x+"px",t.style.marginTop=-r.y+"px"),a&&(t.style.width=a.x+"px",t.style.height=a.y+"px")},_createImg:function(t,e){return e=e||document.createElement("img"),e.src=t,e},_getIconUrl:function(t){return R.retina&&this.options[t+"RetinaUrl"]||this.options[t+"Url"]}});function Ma(t){return new Di(t)}var Xi=Di.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 typeof Xi.imagePath!="string"&&(Xi.imagePath=this._detectIconPath()),(this.options.imagePath||Xi.imagePath)+Di.prototype._getIconUrl.call(this,t)},_stripUrl:function(t){var e=function(i,n,a){var r=n.exec(i);return r&&r[a]};return t=e(t,/^url\((['"])?(.+)\1\)$/,2),t&&e(t,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var t=ot("div","leaflet-default-icon-path",document.body),e=Te(t,"background-image")||Te(t,"backgroundImage");if(document.body.removeChild(t),e=this._stripUrl(e),e)return e;var i=document.querySelector('link[href$="leaflet.css"]');return i?i.href.substring(0,i.href.length-11-1):""}}),Ns=Pt.extend({initialize:function(t){this._marker=t},addHooks:function(){var t=this._marker._icon;this._draggable||(this._draggable=new k(t,t,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),J(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&&Lt(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(t){var e=this._marker,i=e._map,n=this._marker.options.autoPanSpeed,a=this._marker.options.autoPanPadding,r=Pe(e._icon),c=i.getPixelBounds(),d=i.getPixelOrigin(),g=Ht(c.min._subtract(d).add(a),c.max._subtract(d).subtract(a));if(!g.contains(r)){var T=q((Math.max(g.max.x,r.x)-g.max.x)/(c.max.x-g.max.x)-(Math.min(g.min.x,r.x)-g.min.x)/(c.min.x-g.min.x),(Math.max(g.max.y,r.y)-g.max.y)/(c.max.y-g.max.y)-(Math.min(g.min.y,r.
vendor: 4,952 bytes, line 1
1y)-g.min.y)/(c.min.y-g.min.y)).multiplyBy(n);i.panBy(T,{animate:!1}),this._draggable._newPos._add(T),this._draggable._startPos._add(T),jt(e._icon,this._draggable._newPos),this._onDrag(t),this._panRequest=Zt(this._adjustPan.bind(this,t))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire("movestart").fire("dragstart")},_onPreDrag:function(t){this._marker.options.autoPan&&(Dt(this._panRequest),this._panRequest=Zt(this._adjustPan.bind(this,t)))},_onDrag:function(t){var e=this._marker,i=e._shadow,n=Pe(e._icon),a=e._map.layerPointToLatLng(n);i&&jt(i,n),e._latlng=a,t.latlng=a,t.oldLatLng=this._oldLatLng,e.fire("move",t).fire("drag",t)},_onDragEnd:function(t){Dt(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",t)}}),Sn=Le.extend({options:{icon:new Xi,interactive:!0,keyboard:!0,title:"",alt:"Marker",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,autoPanOnFocus:!0,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(t,e){H(this,e),this._latlng=tt(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=tt(t),this.update(),this.fire("move",{oldLatLng:e,latlng:this._latlng})},setZIndexOffset:function(t){return this.options.zIndexOffset=t,this.update()},getIcon:function(){return this.options.icon},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"),i=t.icon.createIcon(this._icon),n=!1;i!==this._icon&&(this._icon&&this._removeIcon(),n=!0,t.title&&(i.title=t.title),i.tagName==="IMG"&&(i.alt=t.alt||"")),J(i,e),t.keyboard&&(i.tabIndex="0",i.setAttribute("role","button")),this._icon=i,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&G(i,"focus",this._panOnFocus,this);var a=t.icon.createShadow(this._shadow),r=!1;a!==this._shadow&&(this._removeShadow(),r=!0),a&&(J(a,e),a.alt=""),this._shadow=a,t.opacity<1&&this._updateOpacity(),n&&this.getPane().appendChild(this._icon),this._initInteraction(),a&&r&&this.getPane(t.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Q(this._icon,"focus",this._panOnFocus,this),Nt(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&Nt(this._shadow),this._shadow=null},_setPos:function(t){this._icon&&jt(this._icon,t),this._shadow&&jt(this._shadow,t),this._zIndex=t.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(t){this._icon&&(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&&(J(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),Ns)){var t=this.options.draggable;this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Ns(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;this._icon&&qt(this._icon,t),this._shadow&&qt(this._shadow,t)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var t=this._map;if(t){var e=this.options.icon.options,i=e.iconSize?q(e.iconSize):q(0,0),n=e.iconAnchor?q(e.iconAnchor):q(0,0);t.panInside(this._latlng,{paddingTopLeft:n,paddingBottomRight:i.subtract(n)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function Ca(t,e){return new Sn(t,e)}var ai=Le.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,f
vendor: 1,339 bytes, line 1
1illRule:"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 H(this,t),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&t&&Object.prototype.hasOwnProperty.call(t,"weight")&&this._updateBounds()),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||0)}}),Nn=ai.extend({options:{fill:!0,radius:10},initialize:function(t,e){H(this,e),this._latlng=tt(t),this._radius=this.options.radius},setLatLng:function(t){var e=this._latlng;return this._latlng=tt(t),this.redraw(),this.fire("move",{oldLatLng:e,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}
1,setStyle:function(t){var e=t&&t.radius||this._radius;return ai.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,i=this._clickTolerance(),n=[t+i,e+i];this._pxBounds=new St(this._point.subtract(n),this._point.add(n))},_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()}});function Ia(t,e){return new Nn(t,e)}var hs=Nn.extend({initialize:function(t,e,i){if(typeof e=="number"&&(e=y({},i,{radius:e})),H(this,e),this._latlng=tt(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 Ut(this._map.layerPointToLatLng(this._point.subtract(t)),this._map.layerPointToLatLng(this._point.add(t)))},setStyle:ai.prototype.setStyle,_project:function(){var t=this._latlng.lng,e=this._latlng.lat,i=this._map,n=i.options.crs;if(n.distance===fe.distance){var a=Math.PI/180,r=this._mRadius/fe.R/a,c=i.project([e+r,t]),d=i.project([e-r,t]),g=c.add(d).divideBy(2),T=i.unproject(g).lat,A=Math.acos((Math.cos(r*a)-Math.sin(e*a)*Math.sin(T*a))/(Math.cos(e*a)*Math.cos(T*a)))/a;(isNaN(A)||A===0)&&(A=r/Math.cos(Math.PI/180*e)),this._point=g.subtract(i.getPixelOrigin()),this._radius=isNaN(A)?0:g.x-i.project([T,t-A]).x,this._radiusY=g.y-c.y}else{var U=n.unproject(n.project(this._latlng).subtract([this._mRadius,0]));this._point=i.latLngToLayerPoint(this._latlng),this._radius=this._point.x-i.latLngToLayerPoint(U).x}this._updateBounds()}});function Ea(t,e,i){return new hs(t,e,i)}var qe=ai.extend({options:{smoothFactor:1,noClip:!1},initialize:function(t,e){H(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=1/0,i=null,n=si,a,r,c=0,d=this._parts.length;c<d;c++)for(var g=this._parts[c],T=1,A=g.length;T<A;T++){a=g[T-1],r=g[T];var U=n(t,a,r,!0);U<e&&(e=U,i=n(t,a,r))}return i&&(i.distance=Math.sqrt(e)),i}
1,getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return Rt(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(t,e){return e=e||this._defaultShape(),t=tt(t),e.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new Ut,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return ne(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var e=[],i=ne(t),n=0,a=t.length;n<a;n++)i?(e[n]=tt(t[n]),this._bounds.extend(e[n])):e[n]=this._convertLatLngs(t[n]);return e},_project:function(){var t=new St;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,t),this._bounds.isValid()&&t.isValid()&&(this._rawPxBounds=t,this._updateBounds())},_updateBounds:function(){var t=this._clickTolerance(),e=new K(t,t);this._rawPxBounds&&(this._pxBounds=new St([this._rawPxBounds.min.subtract(e),this._rawPxBounds.max.add(e)]))},_projectLatlngs:function(t,e,i){var n=t[0]instanceof vt,a=t.length,r,c;if(n){for(c=[],r=0;r<a;r++)c[r]=this._map.latLngToLayerPoint(t[r]),i.extend(c[r]);e.push(c)}else for(r=0;r<a;r++)this._projectLatlngs(t[r],e,i)},_clipPoints:function(){var t=this._renderer._bounds;if(this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(t))){if(this.options.noClip){this._parts=this._rings;return}var e=this._parts,i,n,a,r,c,d,g;for(i=0,a=0,r=this._rings.length;i<r;i++)for(g=this._rings[i],n=0,c=g.length;n<c-1;n++)d=Bt(g[n],g[n+1],t,n,!0),d&&(e[a]=e[a]||[],e[a].push(d[0]),(d[1]!==g[n+1]||n===c-2)&&(e[a].push(d[1]),a++))}},_simplifyPoints:function(){for(var t=this._parts,e=this.options.smoothFactor,i=0,n=t.length;i<n;i++)t[i]=Y(t[i],e)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(t,e){var i,n,a,r,c,d,g=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(i=0,r=this._parts.length;i<r;i++)for(d=this._parts[i],n=0,c=d.length,a=c-1;n<c;a=n++)if(!(!e&&n===0)&&nt(t,d[a],d[n])<=g)return!0;return!1}});function Aa(t,e){return new qe(t,e)}qe._flat=Ji;var Mi=qe.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length}
1,getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");return lt(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(t){var e=qe.prototype._convertLatLngs.call(this,t),i=e.length;return i>=2&&e[0]instanceof vt&&e[0].equals(e[i-1])&&e.pop(),e},_setLatLngs:function(t){qe.prototype._setLatLngs.call(this,t),ne(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return ne(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,e=this.options.weight,i=new K(e,e);if(t=new St(t.min.subtract(i),t.max.add(i)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(t))){if(this.options.noClip){this._parts=this._rings;return}for(var n=0,a=this._rings.length,r;n<a;n++)r=F(this._rings[n],t,!0),r.length&&this._parts.push(r)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(t){var e=!1,i,n,a,r,c,d,g,T;if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(r=0,g=this._parts.length;r<g;r++)for(i=this._parts[r],c=0,T=i.length,d=T-1;c<T;d=c++)n=i[c],a=i[d],n.y>t.y!=a.y>t.y&&t.x<(a.x-n.x)*(t.y-n.y)/(a.y-n.y)+n.x&&(e=!e);return e||qe.prototype._containsPoint.call(this,t,!0)}});function Oa(t,e){return new Mi(t,e)}var Ve=Ue.extend({initialize:function(t,e){H(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e=_t(t)?t:t.features,i,n,a;if(e){for(i=0,n=e.length;i<n;i++)a=e[i],(a.geometries||a.geometry||a.features||a.coordinates)&&this.addData(a);return this}var r=this.options;if(r.filter&&!r.filter(t))return this;var c=Pn(t,r);return c?(c.feature=kn(t),c.defaultOptions=c.options,this.resetStyle(c),r.onEachFeature&&r.onEachFeature(t,c),this.addLayer(c)):this},resetStyle:function(t){return t===void 0?this.eachLayer(this.resetStyle,this):(t.options=y({},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){t.setStyle&&(typeof e=="function"&&(e=e(t.feature)),t.setStyle(e))}});function Pn(t,e){var i=t.type==="Feature"?t.geometry:t,n=i?i.coordinates:null,a=[],r=e&&e.pointToLayer,c=e&&e.coordsToLatLng||ds,d,g,T,A;if(!n&&!i)return null;switch(i.type){case"Point":return d=c(n),Ps(r,t,d,e);case"MultiPoint":for(T=0,A=n.length;T<A;T++)d=c(n[T]),a.push(Ps(r,t,d,e));return new Ue(a);case"LineString":case"MultiLineString":return g=Ln(n,i.type==="LineString"?0:1,c),new qe(g,e);case"Polygon":case"MultiPolygon":return g=Ln(n,i.type==="Polygon"?1:2,c),new Mi(g,e);case"GeometryCollection":for(T=0,A=i.geometries.length;T<A;T++){var U=Pn({geometry:i.geometries[T],type:"Feature",properties:t.properties},e);U&&a.push(U)}return new Ue(a);case"FeatureCollection":for(T=0,A=i.features.length;T<A;T++){var st=Pn(i.features[T],e);st&&a.push(st)}return new Ue(a);default:throw new Error("Invalid GeoJSON object.")}}function Ps(t,e,i,n){return t?t(e,i):new Sn(i,n&&n.markersInheritOptions&&n)}function ds(t){return new vt(t[1],t[0],t[2])}function Ln(t,e,i){for(var n=[],a=0,r=t.length,c;a<r;a++)c=e?Ln(t[a],e-1,i):(i||ds)(t[a]),n.push(c);return n}function us(t,e){return t=tt(t),t.alt!==void 0?[z(t.lng,e),z(t.lat,e),z(t.alt,e)]:[z(t.lng,e),z(t.lat,e)]}function jn(t,e,i,n){for(var a=[],r=0,c=t.length;r<c;r++)a.push(e?jn(t[r],ne(t[r])?0:e-1,i,n):us(t[r],n));return!e&&i&&a.length>0&&a.push(a[0].slice()),a}function Ci(t,e){return t.feature?y({},t.feature,{geometry:e}):kn(e)}function kn(t){return t.type==="Feature"||t.type==="FeatureCollection"?t:{type:"Feature",properties:{},geometry:t}}var ms={toGeoJSON:function(t){return Ci(this,{type:"Point",coordinates:us(this.getLatLng(),t)})}};Sn.include(ms),hs.include(ms),Nn.include(ms),qe.include({toGeoJSON:function(t){var e=!ne(this._latlngs),i=jn(this._latlngs,e?1:0,!1,t);return Ci(this,{type:(e?"Multi":"")+"LineString",coordinates:i})}}),Mi.include({toGeoJSON:function(t){var e=!ne(this._latlngs),i=e&&!ne(this._latlngs[0]),n=jn(this._latlngs,i?2:e?1:0,!0,t);return e||(n=[n]),Ci(this,{type:(i?"Multi":"")+"Polygon",coordinates:n})}}),ki.include({toMultiPoint:function(t){var e=[];return this.eachLayer(function(i){e.push(i.toGeoJSON(t).geometry.coordinates)}),Ci(this,{type:"MultiPoint",coordinates:e})},toGeoJSON:function(t){var e=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(e==="MultiPoint")return this.toMultiPoint(t);var i=e==="GeometryCollection",n=[];
1return this.eachLayer(function(a){if(a.toGeoJSON){var r=a.toGeoJSON(t);if(i)n.push(r.geometry);else{var c=kn(r);c.type==="FeatureCollection"?n.push.apply(n,c.features):n.push(c)}}}),i?Ci(this,{geometries:n,type:"GeometryCollection"}):{type:"FeatureCollection",features:n}}});function Ls(t,e){return new Ve(t,e)}var za=Ls,Dn=Le.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,e,i){this._url=t,this._bounds=wt(e),H(this,i)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(J(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){Nt(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&&Re(this._image),this},bringToBack:function(){return this._map&&Se(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=wt(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=this._url.tagName==="IMG",e=this._image=t?this._url:ot("img");if(J(e,"leaflet-image-layer"),this._zoomAnimated&&J(e,"leaflet-zoom-animated"),this.options.className&&J(e,this.options.className),e.onselectstart=I,e.onmousemove=I,e.onload=S(this.fire,this,"load"),e.onerror=S(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(e.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t){this._url=e.src;return}e.src=this._url,e.alt=this.options.alt},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),i=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;Ie(this._image,i,e)},_reset:function(){var t=this._image,e=new St(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),i=e.getSize();jt(t,e.min),t.style.width=i.x+"px",t.style.height=i.y+"px"},_updateOpacity:function(){qt(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(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)},getCenter:function(){return this._bounds.getCenter()}}),Za=function(t,e,i){return new Dn(t,e,i)},js=Dn.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var t=this._url.tagName==="VIDEO",e=this._image=t?this._url:ot("video");if(J(e,"leaflet-image-layer"),this._zoomAnimated&&J(e,"leaflet-zoom-animated"),this.options.className&&J(e,this.options.className),e.onselectstart=I,e.onmousemove=I,e.onloadeddata=S(this.fire,this,"load"),t){for(var i=e.getElementsByTagName("source"),n=[],a=0;a<i.length;a++)n.push(i[a].src);this._url=i.length>0?n:[e.src];return}_t(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(e.style,"objectFit")&&(e.style.objectFit="fill"),e.autoplay=!!this.options.autoplay,e.loop=!!this.options.loop,e.muted=!!this.options.muted,e.playsInline=!!this.options.playsInline;for(var r=0;r<this._url.length;r++){var c=ot("source");c.src=this._url[r],e.appendChild(c)}}});function Ba(t,e,i){return new js(t,e,i)}var ks=Dn.extend({_initImage:function(){var t=this._image=this._url;J(t,"leaflet-image-layer"),this._zoomAnimated&&J(t,"leaflet-zoom-animated"),this.options.className&&J(t,this.options.className),t.onselectstart=I,t.onmousemove=I}});function Ra(t,e,i){return new ks(t,e,i)}var Ee=Le.extend({options:{interactive:!1,offset:[0,0],className:"",pane:void 0,content:""},initialize:function(t,e){t&&(t instanceof vt||_t(t))?(this._latlng=tt(t),H(this,e)):(H(this,t),this._source=e),this.options.content&&(this._content=this.options.content)},openOn:function(t){return t=arguments.length?t:this._source._map,t.hasLayer(this)||t.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(t){return this._map?this.close():(arguments.length?this._source=t:t=this._source,this._prepareOpen(),this.openOn(t._map)),this},onAdd:function(t){this._zoomAnimated=t._zoomAnimated,this._container||this._initLayout(),t._fadeAnimated&&qt(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),t._fadeAnimated&&qt(this._container,1),this.bringToFront(),this.options.interactive&&(J(this._container,"leaflet-interactive"),this.addInteractiveTarget(this._container))},onRemove:function(t){t._fadeAnimated?(qt(this._container,0),this._removeTimeout=setTimeout(S(Nt,void 0,this._container),200)):Nt(this._container),this.options.interactive&&(Lt(this._container,"leaflet-interactive"),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(t){return this._latlng=tt(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&&Re(this._container),this},bringToBack:function(){return this._map&&Se(this._container),this},_prepareOpen:function(t){var e=this._source;if(!e._map)return!1;if(e instanceof Ue){e=null;var i=this._source._layers;for(var n in i)if(i[n]._map){e=i[n];break}if(!e)return!1;this._source=e}if(!t)if(e.getCenter)t=e.getCenter();else if(e.getLatLng)t=e.getLatLng();else if(e.getBounds)t=e.getBounds().getCenter();else throw new Error("Unable to get source layer LatLng.");return this.setLatLng(t),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var t=this._contentNode,e=typeof this._content=="function"?this._content(this._source||this):this._content;if(typeof e=="string")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=q(this.options.offset),i=this._getAnchor();this._zoomAnimated?jt(this._container,t.add(i)):e=e.add(t).add(i);var n=this._containerBottom=-e.y,a=this._containerLeft=-Math.round(this._containerWidth/2)+e.x;this._container.style.bottom=n+"px",this._container.style.left=a+"px"}},_getAnchor:function(){return[0,0]}});
1C.include({_initOverlay:function(t,e,i,n){var a=e;return a instanceof t||(a=new t(n).setContent(e)),i&&a.setLatLng(i),a}}),Le.include({_initOverlay:function(t,e,i,n){var a=i;return a instanceof t?(H(a,n),a._source=this):(a=e&&!n?e:new t(n,this),a.setContent(i)),a}});var Mn=Ee.extend({options:{pane:"popupPane",offset:[0,7],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=arguments.length?t:this._source._map,!t.hasLayer(this)&&t._popup&&t._popup.options.autoClose&&t.removeLayer(t._popup),t._popup=this,Ee.prototype.openOn.call(this,t)},onAdd:function(t){Ee.prototype.onAdd.call(this,t),t.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof ai||this._source.on("preclick",He))},onRemove:function(t){Ee.prototype.onRemove.call(this,t),t.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof ai||this._source.off("preclick",He))},getEvents:function(){var t=Ee.prototype.getEvents.call(this);return(this.options.closeOnClick!==void 0?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(t.preclick=this.close),this.options.keepInView&&(t.moveend=this._adjustPan),t},_initLayout:function(){var t="leaflet-popup",e=this._container=ot("div",t+" "+(this.options.className||"")+" leaflet-zoom-animated"),i=this._wrapper=ot("div",t+"-content-wrapper",e);if(this._contentNode=ot("div",t+"-content",i),u(e),o(this._contentNode),G(e,"contextmenu",He),this._tipContainer=ot("div",t+"-tip-container",e),this._tip=ot("div",t+"-tip",this._tipContainer),this.options.closeButton){var n=this._closeButton=ot("a",t+"-close-button",e);n.setAttribute("role","button"),n.setAttribute("aria-label","Close popup"),n.href="#close",n.innerHTML='<span aria-hidden="true">&#215;</span>',G(n,"click",function(a){h(a),this.close()},this)}},_updateLayout:function(){var t=this._contentNode,e=t.style;e.width="",e.whiteSpace="nowrap";var i=t.offsetWidth;i=Math.min(i,this.options.maxWidth),i=Math.max(i,this.options.minWidth),e.width=i+1+"px",e.whiteSpace="",e.height="";var n=t.offsetHeight,a=this.options.maxHeight,r="leaflet-popup-scrolled";a&&n>a?(e.height=a+"px",J(t,r)):Lt(t,r),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),i=this._getAnchor();jt(this._container,e.add(i))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var t=this._map,e=parseInt(Te(this._container,"marginBottom"),10)||0,i=this._container.offsetHeight+e,n=this._containerWidth,a=new K(this._containerLeft,-i-this._containerBottom);a._add(Pe(this._container));var r=t.layerPointToContainerPoint(a),c=q(this.options.autoPanPadding),d=q(this.options.autoPanPaddingTopLeft||c),g=q(this.options.autoPanPaddingBottomRight||c),T=t.getSize(),A=0,U=0;r.x+n+g.x>T.x&&(A=r.x+n-T.x+g.x),r.x-A-d.x<0&&(A=r.x-d.x),r.y+i+g.y>T.y&&(U=r.y+i-T.y+g.y),r.y-U-d.y<0&&(U=r.y-d.y),(A||U)&&(this.options.keepInView&&(this._autopanning=!0),t.fire("autopanstart").panBy([A,U]))}},_getAnchor:function(){return q(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Fa=function(t,e){return new Mn(t,e)};C.mergeOptions({closePopupOnClick:!0}),C.include({openPopup:function(t,e,i){return this._initOverlay(Mn,t,e,i).openOn(this),this},closePopup:function(t){return t=arguments.length?t:this._popup,t&&t.close(),this}}),Le.include({bindPopup:function(t,e){return this._popup=this._initOverlay(Mn,this._popup,t,e),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){return this._popup&&(this instanceof Ue||(this._popup._source=this),this._popup._prepareOpen(t||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1}
1,setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){if(!(!this._popup||!this._map)){_(t);var e=t.layer||t.target;if(this._popup._source===e&&!(e instanceof ai)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng);return}this._popup._source=e,this.openPopup(t.latlng)}},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){t.originalEvent.keyCode===13&&this._openPopup(t)}});var Cn=Ee.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(t){Ee.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(t){Ee.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var t=Ee.prototype.getEvents.call(this);return this.options.permanent||(t.preclick=this.close),t},_initLayout:function(){var t="leaflet-tooltip",e=t+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=ot("div",e),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+j(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var e,i,n=this._map,a=this._container,r=n.latLngToContainerPoint(n.getCenter()),c=n.layerPointToContainerPoint(t),d=this.options.direction,g=a.offsetWidth,T=a.offsetHeight,A=q(this.options.offset),U=this._getAnchor();d==="top"?(e=g/2,i=T):d==="bottom"?(e=g/2,i=0):d==="center"?(e=g/2,i=T/2):d==="right"?(e=0,i=T/2):d==="left"?(e=g,i=T/2):c.x<r.x?(d="right",e=0,i=T/2):(d="left",e=g+(A.x+U.x)*2,i=T/2),t=t.subtract(q(e,i,!0)).add(A).add(U),Lt(a,"leaflet-tooltip-right"),Lt(a,"leaflet-tooltip-left"),Lt(a,"leaflet-tooltip-top"),Lt(a,"leaflet-tooltip-bottom"),J(a,"leaflet-tooltip-"+d),jt(a,t)},_updatePosition:function(){var t=this._map.latLngToLayerPoint(this._latlng);this._setPosition(t)},setOpacity:function(t){this.options.opacity=t,this._container&&qt(this._container,t)},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center);this._setPosition(e)},_getAnchor:function(){return q(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),Ha=function(t,e){return new Cn(t,e)};C.include({openTooltip:function(t,e,i){return this._initOverlay(Cn,t,e,i).openOn(this),this},closeTooltip:function(t){return t.close(),this}}),Le.include({bindTooltip:function(t,e){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(Cn,this._tooltip,t,e),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",i={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?i.add=this._openTooltip:(i.mouseover=this._openTooltip,i.mouseout=this.closeTooltip,i.click=this._openTooltip,this._map?this._addFocusListeners():i.add=this._addFocusListeners),this._tooltip.options.sticky&&(i.mousemove=this._moveTooltip),this[e](i),this._tooltipHandlersAdded=!t}},openTooltip:function(t){return this._tooltip&&(this instanceof Ue||(this._tooltip._source=this),this._tooltip._prepareOpen(t)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this))),this},closeTooltip:function(){if(this._tooltip)return this._tooltip.close()},toggleTooltip:function(){return this._tooltip&&this._tooltip.toggle(this),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(t){return this._tooltip&&this._tooltip.setContent(t),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(t){var e=typeof t.getElement=="function"&&t.getElement();e&&(G(e,"focus",function(){this._tooltip._source=t,this.openTooltip()},this),G(e,"blur",this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(t){var e=typeof t.getElement=="function"&&t.getElement();e&&e.setAttribute("aria-describedby",this._tooltip._container.id)},_openTooltip:function(t){if(!(!this._tooltip||!this._map)){if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var e=this;this._map.once("moveend",function(){e._openOnceFlag=!1,e._openTooltip(t)});return}this._tooltip._source=t.layer||t.target,this.openTooltip(this._tooltip.options.sticky?t.latlng:void 0)}},_moveTooltip:function(t){var e=t.latlng,i,n;this._tooltip.options.sticky&&t.originalEvent&&(i=this._map.mouseEventToContainerPoint(t.originalEvent),n=this._map.containerPointToLayerPoint(i),e=this._map.layerPointToLatLng(n)),this._tooltip.setLatLng(e)}});var Ds=Di.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(t){var e=t&&t.tagName==="DIV"?t:document.createElement("div"),i=this.options;if(i.html instanceof Element?(Be(e),e.appendChild(i.html)):e.innerHTML=i.html!==!1?i.html:"",i.bgPos){var n=q(i.bgPos);e.style.backgroundPosition=-n.x+"px "+-n.y+"px"}return this._setIconStyles(e,"icon"),e},createShadow:function(){return null}});function Wa(t){return new Ds(t)}Di.Default=Xi;var Qi=Le.extend({options:{tileSize:256,opacity:1,updateWhenIdle:R.mobile,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){H(this,t)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(t){t._addZoomLimit(this)},onRemove:function(t){this._removeAllTiles(),Nt(this._container),t._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(Re(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(Se(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(){if(this._map){this._removeAllTiles();var t=this._clampZoom(this._map.getZoom());t!==this._tileZoom&&(this._tileZoom=t,this._updateLevels()),this._update()}return 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=O(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 K?t:new K(t,t)},_updateZIndex:function(){this._container&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t){for(var e=this.getPane().children,i=-t(-1/0,1/0),n=0,a=e.length,r;n<a;n++)r=e[n].style.zIndex,e[n]!==this._container&&r&&(i=t(i,+r));isFinite(i)&&(this.options.zIndex=i+t(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!R.ielt9){qt(this._container,this.options.opacity);var t=+new Date,e=!1,i=!1;for(var n in this._tiles){var a=this._tiles[n];if(!(!a.current||!a.loaded)){var r=Math.min(1,(t-a.loaded)/200);qt(a.el,r),r<1?e=!0:(a.active?i=!0:this._onOpaqueTile(a),a.active=!0)}}i&&!this._noPrune&&this._pruneTiles(),e&&(Dt(this._fadeFrame),this._fadeFrame=Zt(this._updateOpacity,this))}}
1,_onOpaqueTile:I,_initContainer:function(){this._container||(this._container=ot("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(t!==void 0){for(var i in this._levels)i=Number(i),this._levels[i].el.children.length||i===t?(this._levels[i].el.style.zIndex=e-Math.abs(t-i),this._onUpdateLevel(i)):(Nt(this._levels[i].el),this._removeTilesAtZoom(i),this._onRemoveLevel(i),delete this._levels[i]);var n=this._levels[t],a=this._map;return n||(n=this._levels[t]={},n.el=ot("div","leaflet-tile-container leaflet-zoom-animated",this._container),n.el.style.zIndex=e,n.origin=a.project(a.unproject(a.getPixelOrigin()),t).round(),n.zoom=t,this._setZoomTransform(n,a.getCenter(),a.getZoom()),I(n.el.offsetWidth),this._onCreateLevel(n)),this._level=n,n}},_onUpdateLevel:I,_onRemoveLevel:I,_onCreateLevel:I,_pruneTiles:function(){if(this._map){var t,e,i=this._map.getZoom();if(i>this.options.maxZoom||i<this.options.minZoom){this._removeAllTiles();return}for(t in this._tiles)e=this._tiles[t],e.retain=e.current;for(t in this._tiles)if(e=this._tiles[t],e.current&&!e.active){var n=e.coords;this._retainParent(n.x,n.y,n.z,n.z-5)||this._retainChildren(n.x,n.y,n.z,n.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)Nt(this._levels[t].el),this._onRemoveLevel(Number(t)),delete this._levels[t];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(t,e,i,n){var a=Math.floor(t/2),r=Math.floor(e/2),c=i-1,d=new K(+a,+r);d.z=+c;var g=this._tileCoordsToKey(d),T=this._tiles[g];return T&&T.active?(T.retain=!0,!0):(T&&T.loaded&&(T.retain=!0),c>n?this._retainParent(a,r,c,n):!1)},_retainChildren:function(t,e,i,n){for(var a=2*t;a<2*t+2;a++)for(var r=2*e;r<2*e+2;r++){var c=new K(a,r);c.z=i+1;var d=this._tileCoordsToKey(c),g=this._tiles[d];if(g&&g.active){g.retain=!0;continue}else g&&g.loaded&&(g.retain=!0);i+1<n&&this._retainChildren(a,r,i+1,n)}},_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 e.minNativeZoom!==void 0&&t<e.minNativeZoom?e.minNativeZoom:e.maxNativeZoom!==void 0&&e.maxNativeZoom<t?e.maxNativeZoom:t},_setView:function(t,e,i,n){var a=Math.round(e);this.options.maxZoom!==void 0&&a>this.options.maxZoom||this.options.minZoom!==void 0&&a<this.options.minZoom?a=void 0:a=this._clampZoom(a);var r=this.options.updateWhenZooming&&a!==this._tileZoom;(!n||r)&&(this._tileZoom=a,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),a!==void 0&&this._update(t),i||this._pruneTiles(),this._noPrune=!!i),this._setZoomTransforms(t,e)},_setZoomTransforms:function(t,e){for(var i in this._levels)this._setZoomTransform(this._levels[i],t,e)},_setZoomTransform:function(t,e,i){var n=this._map.getZoomScale(i,t.zoom),a=t.origin.multiplyBy(n).subtract(this._map._getNewPixelOrigin(e,i)).round();R.any3d?Ie(t.el,a,n):jt(t.el,a)},_resetGrid:function(){var t=this._map,e=t.options.crs,i=this._tileSize=this.getTileSize(),n=this._tileZoom,a=this._map.getPixelWorldBounds(this._tileZoom);a&&(this._globalTileRange=this._pxBoundsToTileRange(a)),this._wrapX=e.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,e.wrapLng[0]],n).x/i.x),Math.ceil(t.project([0,e.wrapLng[1]],n).x/i.y)],this._wrapY=e.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([e.wrapLat[0],0],n).y/i.x),Math.ceil(t.project([e.wrapLat[1],0],n).y/i.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(t){var e=this._map,i=e._animatingZoom?Math.max(e._animateToZoom,e.getZoom()):e.getZoom(),n=e.getZoomScale(i,this._tileZoom),a=e.project(t,this._tileZoom).floor(),r=e.getSize().divideBy(n*2);return new St(a.subtract(r),a.add(r))},_update:function(t){var e=this._map;if(e){var i=this._clampZoom(e.getZoom());if(t===void 0&&(t=e.getCenter()),this._tileZoom!==void 0){var n=this._getTiledPixelBounds(t),a=this._pxBoundsToTileRange(n),r=a.getCenter(),c=[],d=this.options.keepBuffer,g=new St(a.getBottomLeft().subtract([d,-d]),a.getTopRight().add([d,-d]));if(!(isFinite(a.min.x)&&isFinite(a.min.y)&&isFinite(a.max.x)&&isFinite(a.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var T in this._tiles){var A=this._tiles[T].coords;(A.z!==this._tileZoom||!g.contains(new K(A.x,A.y)))&&(this._tiles[T].current=!1)}if(Math.abs(i-this._tileZoom)>
11){this._setView(t,i);return}for(var U=a.min.y;U<=a.max.y;U++)for(var st=a.min.x;st<=a.max.x;st++){var se=new K(st,U);if(se.z=this._tileZoom,!!this._isValidTile(se)){var $t=this._tiles[this._tileCoordsToKey(se)];$t?$t.current=!0:c.push(se)}}if(c.sort(function(le,Ei){return le.distanceTo(r)-Ei.distanceTo(r)}),c.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var xe=document.createDocumentFragment();for(st=0;st<c.length;st++)this._addTile(c[st],xe);this._level.el.appendChild(xe)}}}},_isValidTile:function(t){var e=this._map.options.crs;if(!e.infinite){var i=this._globalTileRange;if(!e.wrapLng&&(t.x<i.min.x||t.x>i.max.x)||!e.wrapLat&&(t.y<i.min.y||t.y>i.max.y))return!1}if(!this.options.bounds)return!0;var n=this._tileCoordsToBounds(t);return wt(this.options.bounds).overlaps(n)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var e=this._map,i=this.getTileSize(),n=t.scaleBy(i),a=n.add(i),r=e.unproject(n,t.z),c=e.unproject(a,t.z);return[r,c]},_tileCoordsToBounds:function(t){var e=this._tileCoordsToNwSe(t),i=new Ut(e[0],e[1]);return this.options.noWrap||(i=this._map.wrapLatLngBounds(i)),i},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var e=t.split(":"),i=new K(+e[0],+e[1]);return i.z=+e[2],i},_removeTile:function(t){var e=this._tiles[t];e&&(Nt(e.el),delete this._tiles[t],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){J(t,"leaflet-tile");var e=this.getTileSize();t.style.width=e.x+"px",t.style.height=e.y+"px",t.onselectstart=I,t.onmousemove=I,R.ielt9&&this.options.opacity<1&&qt(t,this.options.opacity)},_addTile:function(t,e){var i=this._getTilePos(t),n=this._tileCoordsToKey(t),a=this.createTile(this._wrapCoords(t),S(this._tileReady,this,t));this._initTile(a),this.createTile.length<2&&Zt(S(this._tileReady,this,t,null,a)),jt(a,i),this._tiles[n]={el:a,coords:t,current:!0},e.appendChild(a),this.fire("tileloadstart",{tile:a,coords:t})},_tileReady:function(t,e,i){e&&this.fire("tileerror",{error:e,tile:i,coords:t});var n=this._tileCoordsToKey(t);i=this._tiles[n],i&&(i.loaded=+new Date,this._map._fadeAnimated?(qt(i.el,0),Dt(this._fadeFrame),this._fadeFrame=Zt(this._updateOpacity,this)):(i.active=!0,this._pruneTiles()),e||(J(i.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:i.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),R.ielt9||!this._map._fadeAnimated?Zt(this._pruneTiles,this):setTimeout(S(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var e=new K(this._wrapX?yt(t.x,this._wrapX):t.x,this._wrapY?yt(t.y,this._wrapY):t.y);return e.z=t.z,e},_pxBoundsToTileRange:function(t){var e=this.getTileSize();return new St(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}});function $a(t){return new Qi(t)}var Ii=Qi.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(t,e){this._url=t,e=H(this,e),e.detectRetina&&R.retina&&e.maxZoom>0?(e.tileSize=Math.floor(e.tileSize/2),e.zoomReverse?(e.zoomOffset--,e.minZoom=Math.min(e.maxZoom,e.minZoom+1)):(e.zoomOffset++,e.maxZoom=Math.max(e.minZoom,e.maxZoom-1)),e.minZoom=Math.max(0,e.minZoom)):e.zoomReverse?e.minZoom=Math.min(e.maxZoom,e.minZoom):e.maxZoom=Math.max(e.minZoom,e.maxZoom),typeof e.subdomains=="string"&&(e.subdomains=e.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(t,e){return this._url===t&&e===void 0&&(e=!0),this._url=t,e||this.redraw(),this},createTile:function(t,e){var i=document.createElement("img");return G(i,"load",S(this._tileOnLoad,this,e,i)),G(i,"error",S(this._tileOnError,this,e,i)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(i.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(i.referrerPolicy=this.options.referrerPolicy),i.alt="",i.src=this.getTileUrl(t),i},getTileUrl:function(t){var e={r:R.retina?"@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 It(this._url,y(e,this.options))}
vendor: 6,720 bytes, line 1
1,_tileOnLoad:function(t,e){R.ielt9?setTimeout(S(t,this,null,e),0):t(null,e)},_tileOnError:function(t,e,i){var n=this.options.errorTileUrl;n&&e.getAttribute("src")!==n&&(e.src=n),t(i,e)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,e=this.options.maxZoom,i=this.options.zoomReverse,n=this.options.zoomOffset;return i&&(t=e-t),t+n},_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)if(this._tiles[t].coords.z!==this._tileZoom&&(e=this._tiles[t].el,e.onload=I,e.onerror=I,!e.complete)){e.src=ue;var i=this._tiles[t].coords;Nt(e),delete this._tiles[t],this.fire("tileabort",{tile:e,coords:i})}},_removeTile:function(t){var e=this._tiles[t];if(e)return e.el.setAttribute("src",ue),Qi.prototype._removeTile.call(this,t)},_tileReady:function(t,e,i){if(!(!this._map||i&&i.getAttribute("src")===ue))return Qi.prototype._tileReady.call(this,t,e,i)}});function Ms(t,e){return new Ii(t,e)}var Cs=Ii.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=y({},this.defaultWmsParams);for(var n in e)n in this.options||(i[n]=e[n]);e=H(this,e);var a=e.detectRetina&&R.retina?2:1,r=this.getTileSize();i.width=r.x*a,i.height=r.y*a,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,Ii.prototype.onAdd.call(this,t)},getTileUrl:function(t){var e=this._tileCoordsToNwSe(t),i=this._crs,n=Ht(i.project(e[0]),i.project(e[1])),a=n.min,r=n.max,c=(this._wmsVersion>=1.3&&this._crs===Ss?[a.y,a.x,r.y,r.x]:[a.x,a.y,r.x,r.y]).join(","),d=Ii.prototype.getTileUrl.call(this,t);return d+bt(this.wmsParams,d,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+c},setParams:function(t,e){return y(this.wmsParams,t),e||this.redraw(),this}});function Ua(t,e){return new Cs(t,e)}Ii.WMS=Cs,Ms.wms=Ua;var Ge=Le.extend({options:{padding:.1},initialize:function(t){H(this,t),j(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),J(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 i=this._map.getZoomScale(e,this._zoom),n=this._map.getSize().multiplyBy(.5+this.options.padding),a=this._map.project(this._center,e),r=n.multiplyBy(-i).add(a).subtract(this._map._getNewPixelOrigin(t,e));R.any3d?Ie(this._container,r,i):jt(this._container,r)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var t in 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(),i=this._map.containerPointToLayerPoint(e.multiplyBy(-t)).round();this._bounds=new St(i,i.add(e.multiplyBy(1+t*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Is=Ge.extend({options:{tolerance:0},getEvents:function(){var t=Ge.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Ge.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");G(t,"mousemove",this._onMouseMove,this),G(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),G(t,"mouseout",this._handleMouseOut,this),t._leaflet_disable_events=!0,this._ctx=t.getContext("2d")},_destroyContainer:function(){Dt(this._redrawRequest),delete this._ctx,Nt(this._container),Q(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var t;this._redrawBounds=null;for(var e in this._layers)t=this._layers[e],t._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Ge.prototype._update.call(this);var t=this._bounds,e=this._container,i=t.getSize(),n=R.retina?2:1;jt(e,t.min),e.width=n*i.x,e.height=n*i.y,e.style.width=i.x+"px",e.style.height=i.y+"px",R.retina&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){Ge.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[j(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,i=e.next,n=e.prev;i?i.prev=n:this._drawLast=n,n?n.next=i:this._drawFirst=i,delete t._order,delete this._layers[j(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(typeof t.options.dashArray=="string"){var e=t.options.dashArray.split(/[, ]+/),i=[],n,a;for(a=0;a<e.length;a++){if(n=Number(e[a]),isNaN(n))return;i.push(n)}t.options._dashArray=i}else t.options._dashArray=t.options.dashArray},_requestRedraw:function(t){this._map&&(this._extendRedrawBounds(t),this._redrawRequest=this._redrawRequest||Zt(this._redraw,this))},_extendRedrawBounds:function(t){if(t._pxBounds){var e=(t.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new St,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.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore(
1)},_draw:function(){var t,e=this._redrawBounds;if(this._ctx.save(),e){var i=e.getSize();this._ctx.beginPath(),this._ctx.rect(e.min.x,e.min.y,i.x,i.y),this._ctx.clip()}this._drawing=!0;for(var n=this._drawFirst;n;n=n.next)t=n.layer,(!e||t._pxBounds&&t._pxBounds.intersects(e))&&t._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(t,e){if(this._drawing){var i,n,a,r,c=t._parts,d=c.length,g=this._ctx;if(d){for(g.beginPath(),i=0;i<d;i++){for(n=0,a=c[i].length;n<a;n++)r=c[i][n],g[n?"lineTo":"moveTo"](r.x,r.y);e&&g.closePath()}this._fillStroke(g,t)}}},_updateCircle:function(t){if(!(!this._drawing||t._empty())){var e=t._point,i=this._ctx,n=Math.max(Math.round(t._radius),1),a=(Math.max(Math.round(t._radiusY),1)||n)/n;a!==1&&(i.save(),i.scale(1,a)),i.beginPath(),i.arc(e.x,e.y/a,n,0,Math.PI*2,!1),a!==1&&i.restore(),this._fillStroke(i,t)}},_fillStroke:function(t,e){var i=e.options;i.fill&&(t.globalAlpha=i.fillOpacity,t.fillStyle=i.fillColor||i.color,t.fill(i.fillRule||"evenodd")),i.stroke&&i.weight!==0&&(t.setLineDash&&t.setLineDash(e.options&&e.options._dashArray||[]),t.globalAlpha=i.opacity,t.lineWidth=i.weight,t.strokeStyle=i.color,t.lineCap=i.lineCap,t.lineJoin=i.lineJoin,t.stroke())},_onClick:function(t){for(var e=this._map.mouseEventToLayerPoint(t),i,n,a=this._drawFirst;a;a=a.next)i=a.layer,i.options.interactive&&i._containsPoint(e)&&(!(t.type==="click"||t.type==="preclick")||!this._map._draggableMoved(i))&&(n=i);this._fireEvent(n?[n]:!1,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&&(Lt(this._container,"leaflet-interactive"),this._fireEvent([e],t,"mouseout"),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(t,e){if(!this._mouseHoverThrottled){for(var i,n,a=this._drawFirst;a;a=a.next)i=a.layer,i.options.interactive&&i._containsPoint(e)&&(n=i);n!==this._hoveredLayer&&(this._handleMouseOut(t),n&&(J(this._container,"leaflet-interactive"),this._fireEvent([n],t,"mouseover"),this._hoveredLayer=n)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,t),this._mouseHoverThrottled=!0,setTimeout(S(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(t,e,i){this._map._fireDOMEvent(e,i||e.type,t)},_bringToFront:function(t){var e=t._order;if(e){var i=e.next,n=e.prev;if(i)i.prev=n;else return;n?n.next=i:i&&(this._drawFirst=i),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 i=e.next,n=e.prev;if(n)n.next=i;else return;i?i.prev=n:n&&(this._drawLast=n),e.prev=null,e.next=this._drawFirst,this._drawFirst.prev=e,this._drawFirst=e,this._requestRedraw(t)}}});function Es(t){return R.canvas?new Is(t):null}var tn=(function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(t){return document.createElement("<lvml:"+t+' class="lvml">')}}catch{}return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}})(),qa={_initContainer:function(){this._container=ot("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(Ge.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var e=t._container=tn("shape");J(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",t._path=tn("path"),e.appendChild(t._path),this._updateStyle(t),this._layers[j(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;Nt(e),t.removeInteractiveTarget(e),delete this._layers[j(t)]},_updateStyle:function(t){var e=t._stroke,i=t._fill,n=t.options,a=t._container;a.stroked=!!n.stroke,a.filled=!!n.fill,n.stroke?(e||(e=t._stroke=tn("stroke")),a.appendChild(e),e.weight=n.weight+"px",e.color=n.color,e.opacity=n.opacity,n.dashArray?e.dashStyle=_t(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):e.dashStyle="",e.endcap=n.lineCap.replace("butt","flat"),e.joinstyle=n.lineJoin):e&&(a.removeChild(e),t._stroke=null),n.fill?(i||(i=t._fill=tn("fill")),a.appendChild(i),i.color=n.fillColor||n.color,i.opacity=n.fillOpacity):i&&(a.removeChild(i),t._fill=null)},_updateCircle:function(t){var e=t._point.round(),i=Math.round(t._radius),n=Math.round(t._radiusY||i);this._setPath(t,t._empty()?"M0 0":"AL "+e.x+","+e.y+" "+i+","+n+" 0,"+65535*360)},_setPath:function(t,e){t._path.v=e},_bringToFront:function(t){Re(t._container)},_bringToBack:function(t){Se(t._container)}},In=R.vml?tn:vi,en=Ge.extend({_initContainer:function(){this._container=In("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=In("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){Nt(this._container),Q(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Ge.prototype._update.call(this);var t=this._bounds,e=t.getSize(),i=this._container;(!this._svgSize||!this._svgSize.equals(e))&&(this._svgSize=e,i.setAttribute("width",e.x),i.setAttribute("height",e.y)),jt(i,t.min),i.setAttribute("viewBox",[t.min.x,t.min.y,e.x,e.y].join(" ")),this.fire("update")}},_initPath:function(t){var e=t._path=In("path");t.options.className&&J(e,t.options.className),t.options.interactive&&J(e,"leaflet-interactive"),this._updateStyle(t),this._layers[j(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){Nt(t._path),t.removeInteractiveTarget(t._path),delete this._layers[j(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var e=t._path,i=t.options;e&&(i.stroke?(e.setAttribute("stroke",i.color),e.setAttribute("stroke-opacity",i.opacity),e.setAttribute("stroke-width",i.weight),e.setAttribute("stroke-linecap",i.lineCap),e.setAttribute("stroke-linejoin",i.lineJoin),i.dashArray?e.setAttribute("stroke-dasharray",i.dashArray):e.removeAttribute("stroke-dasharray"),i.dashOffset?e.setAttribute("stroke-dashoffset",i.dashOffset):e.removeAttribute("stroke-dashoffset")):e.setAttribute("stroke","none"),i.fill?(e.setAttribute("fill",i.fillColor||i.color),e.setAttribute("fill-opacity",i.fillOpacity),e.setAttribute("fill-rule",i.fillRule||"evenodd")):e.setAttribute("fill","none"))},_updatePoly:function(t,e){this._setPath(t,ke(t._parts,e))},_updateCircle:function(t){var e=t._point,i=Math.max(Math.round(t._radius),1),n=Math.max(Math.round(t._radiusY),1)||i,a="a"+i+","+n+" 0 1,0 ",r=t._empty()?"M0 0":"M"+(e.x-i)+","+e.y+a+i*2+",0 "+a+-i*2+",0 ";this._setPath(t,r)},_setPath:function(t,e){t._path.setAttribute("d",e)},_bringToFront:function(t){Re(t._path)},_bringToBack:function(t){Se(t._path)}});R.vml&&en.include(qa);function As(t){return R.svg||R.vml?new en(t):null}C.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(t==="overlayPane"||t===void 0)return!1;var e=this._paneRenderers[t];return e===void 0&&(e=this._createRenderer({pane:t}),this._paneRenderers[t]=e),e},_createRenderer:function(t){return this.options.preferCanvas&&Es(t)||As(t)}});var Os=Mi.extend({initialize:function(t,e){Mi.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))}
vendor: 6,235 bytes, line 1
1,_boundsToLatLngs:function(t){return t=wt(t),[t.getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});function Va(t,e){return new Os(t,e)}en.create=In,en.pointsToPath=ke,Ve.geometryToLayer=Pn,Ve.coordsToLatLng=ds,Ve.coordsToLatLngs=Ln,Ve.latLngToCoords=us,Ve.latLngsToCoords=jn,Ve.getFeature=Ci,Ve.asFeature=kn,C.mergeOptions({boxZoom:!0});var zs=Pt.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(){G(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Q(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){Nt(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||t.which!==1&&t.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),Fe(),bn(),this._startPoint=this._map.mouseEventToContainerPoint(t),G(document,{contextmenu:_,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=ot("div","leaflet-zoom-box",this._container),J(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var e=new St(this._point,this._startPoint),i=e.getSize();jt(this._box,e.min),this._box.style.width=i.x+"px",this._box.style.height=i.y+"px"},_finish:function(){this._moved&&(Nt(this._box),Lt(this._container,"leaflet-crosshair")),ei(),ni(),Q(document,{contextmenu:_,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if(!(t.which!==1&&t.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(S(this._resetState,this),0);var e=new Ut(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(e).fire("boxzoomend",{boxZoomBounds:e})}},_onKeyDown:function(t){t.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});C.addInitHook("addHandler","boxZoom",zs),C.mergeOptions({doubleClickZoom:!0});var Zs=Pt.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,i=e.getZoom(),n=e.options.zoomDelta,a=t.originalEvent.shiftKey?i-n:i+n;e.options.doubleClickZoom==="center"?e.setZoom(a):e.setZoomAround(t.containerPoint,a)}});C.addInitHook("addHandler","doubleClickZoom",Zs),C.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Bs=Pt.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new k(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))}J(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){Lt(this._map._container,"leaflet-grab"),Lt(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=wt(this._map.options.maxBounds);this._offsetLimit=Ht(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,i=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(i),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),i=this._initialWorldOffset,n=this._draggable._newPos.x,a=(n-e+i)%t+e-i,r=(n+e+i)%t-e-i,c=Math.abs(a+i)<Math.abs(r+i)?a:r;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=c},_onDragEnd:function(t){var e=this._map,i=e.options,n=!i.inertia||t.noInertia||this._times.length<2;if(e.fire("dragend",t),n)e.fire("moveend");else{this._prunePositions(+new Date);var a=this._lastPos.subtract(this._positions[0]),r=(this._lastTime-this._times[0])/1e3,c=i.easeLinearity,d=a.multiplyBy(c/r),g=d.distanceTo([0,0]),T=Math.min(i.inertiaMaxSpeed,g),A=d.multiplyBy(T/g),U=T/(i.inertiaDeceleration*c),st=A.multiplyBy(-U/2).round();!st.x&&!st.y?e.fire("moveend"):(st=e._limitOffset(st,e.options.maxBounds),Zt(function(){e.panBy(st,{duration:U,easeLinearity:c,noMoveStart:!0,animate:!0})}
1))}}});C.addInitHook("addHandler","dragging",Bs),C.mergeOptions({keyboard:!0,keyboardPanDelta:80});var Rs=Pt.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"),G(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(),Q(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,i=t.scrollTop||e.scrollTop,n=t.scrollLeft||e.scrollLeft;this._map._container.focus(),window.scrollTo(n,i)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(t){var e=this._panKeys={},i=this.keyCodes,n,a;for(n=0,a=i.left.length;n<a;n++)e[i.left[n]]=[-1*t,0];for(n=0,a=i.right.length;n<a;n++)e[i.right[n]]=[t,0];for(n=0,a=i.down.length;n<a;n++)e[i.down[n]]=[0,t];for(n=0,a=i.up.length;n<a;n++)e[i.up[n]]=[0,-1*t]},_setZoomDelta:function(t){var e=this._zoomKeys={},i=this.keyCodes,n,a;for(n=0,a=i.zoomIn.length;n<a;n++)e[i.zoomIn[n]]=t;for(n=0,a=i.zoomOut.length;n<a;n++)e[i.zoomOut[n]]=-t},_addHooks:function(){G(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){Q(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=t.keyCode,i=this._map,n;if(e in this._panKeys){if(!i._panAnim||!i._panAnim._inProgress)if(n=this._panKeys[e],t.shiftKey&&(n=q(n).multiplyBy(3)),i.options.maxBounds&&(n=i._limitOffset(q(n),i.options.maxBounds)),i.options.worldCopyJump){var a=i.wrapLatLng(i.unproject(i.project(i.getCenter()).add(n)));i.panTo(a)}else i.panBy(n)}else if(e in this._zoomKeys)i.setZoom(i.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[e]);else if(e===27&&i._popup&&i._popup.options.closeOnEscapeKey)i.closePopup();else return;_(t)}}});C.addInitHook("addHandler","keyboard",Rs),C.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var Fs=Pt.extend({addHooks:function(){G(this._map._container,"wheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Q(this._map._container,"wheel",this._onWheelScroll,this)},_onWheelScroll:function(t){var e=P(t),i=this._map.options.wheelDebounceTime;this._delta+=e,this._lastMousePos=this._map.mouseEventToContainerPoint(t),this._startTime||(this._startTime=+new Date);var n=Math.max(i-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(S(this._performZoom,this),n),_(t)},_performZoom:function(){var t=this._map,e=t.getZoom(),i=this._map.options.zoomSnap||0;t._stop();var n=this._delta/(this._map.options.wheelPxPerZoomLevel*4),a=4*Math.log(2/(1+Math.exp(-Math.abs(n))))/Math.LN2,r=i?Math.ceil(a/i)*i:a,c=t._limitZoom(e+(this._delta>0?r:-r))-e;this._delta=0,this._startTime=null,c&&(t.options.scrollWheelZoom==="center"?t.setZoom(e+c):t.setZoomAround(this._lastMousePos,e+c))}});C.addInitHook("addHandler","scrollWheelZoom",Fs);var Ga=600;C.mergeOptions({tapHold:R.touchNative&&R.safari&&R.mobile,tapTolerance:15});var Hs=Pt.extend({addHooks:function(){G(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Q(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(clearTimeout(this._holdTimeout),t.touches.length===1){var e=t.touches[0];this._startPos=this._newPos=new K(e.clientX,e.clientY),this._holdTimeout=setTimeout(S(function(){this._cancel(),this._isTapValid()&&(G(document,"touchend",h),G(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",e))},this),Ga),G(document,"touchend touchcancel contextmenu",this._cancel,this),G(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function t(){Q(document,"touchend",h),Q(document,"touchend touchcancel",t)},_cancel:function(){clearTimeout(this._holdTimeout),Q(document,"touchend touchcancel contextmenu",this._cancel,this),Q(document,"touchmove",this._onMove,this)},_onMove:function(t){var e=t.touches[0];this._newPos=new K(e.clientX,e.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(t,e){var i=new MouseEvent(t,{bubbles:!0,cancelable:!0,view:window,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY});i._simulated=!0,e.target.dispatchEvent(i)}});C.addInitHook("addHandler","tapHold",Hs),C.mergeOptions({touchZoom:R.touch,bounceAtZoomLimits:!0});var Ws=Pt.extend({addHooks:function(){J(this._map._container,"leaflet-touch-zoom"),G(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){Lt(this._map._container,"leaflet-touch-zoom"),Q(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var e=this._map;if(!(!t.touches||t.touches.length!==2||e._animatingZoom||this._zooming)){var i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=e.getSize()._divideBy(2),this._startLatLng=e.containerPointToLatLng(this._centerPoint),e.options.touchZoom!=="center"&&(this._pinchStartLatLng=e.containerPointToLatLng(i.add(n)._divideBy(2))),this._startDist=i.distanceTo(n),this._startZoom=e.getZoom(),this._moved=!1,this._zooming=!0,e._stop(),G(document,"touchmove",this._onTouchMove,this),G(document,"touchend touchcancel",this._onTouchEnd,this),h(t)}},_onTouchMove:function(t){if(!(!t.touches||t.touches.length!==2||!this._zooming)){var e=this._map,i=e.mouseEventToContainerPoint(t.touches[0]),n=e.mouseEventToContainerPoint(t.touches[1]),a=i.distanceTo(n)/this._startDist;if(this._zoom=e.getScaleZoom(a,this._startZoom),!e.options.bounceAtZoomLimits&&(this._zoom<e.getMin
1Zoom()&&a<1||this._zoom>e.getMaxZoom()&&a>1)&&(this._zoom=e._limitZoom(this._zoom)),e.options.touchZoom==="center"){if(this._center=this._startLatLng,a===1)return}else{var r=i._add(n)._divideBy(2)._subtract(this._centerPoint);if(a===1&&r.x===0&&r.y===0)return;this._center=e.unproject(e.project(this._pinchStartLatLng,this._zoom).subtract(r),this._zoom)}this._moved||(e._moveStart(!0,!1),this._moved=!0),Dt(this._animRequest);var c=S(e._move,e,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=Zt(c,this,!0),h(t)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,Dt(this._animRequest),Q(document,"touchmove",this._onTouchMove,this),Q(document,"touchend touchcancel",this._onTouchEnd,this),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))}});C.addInitHook("addHandler","touchZoom",Ws),C.BoxZoom=zs,C.DoubleClickZoom=Zs,C.Drag=Bs,C.Keyboard=Rs,C.ScrollWheelZoom=Fs,C.TapHold=Hs,C.TouchZoom=Ws,l.Bounds=St,l.Browser=R,l.CRS=me,l.Canvas=Is,l.Circle=hs,l.CircleMarker=Nn,l.Class=Tt,l.Control=mt,l.DivIcon=Ds,l.DivOverlay=Ee,l.DomEvent=ht,l.DomUtil=Tn,l.Draggable=k,l.Evented=hi,l.FeatureGroup=Ue,l.GeoJSON=Ve,l.GridLayer=Qi,l.Handler=Pt,l.Icon=Di,l.ImageOverlay=Dn,l.LatLng=vt,l.LatLngBounds=Ut,l.Layer=Le,l.LayerGroup=ki,l.LineUtil=oe,l.Map=C,l.Marker=Sn,l.Mixin=ve,l.Path=ai,l.Point=K,l.PolyUtil=gt,l.Polygon=Mi,l.Polyline=qe,l.Popup=Mn,l.PosAnimation=E,l.Projection=Pa,l.Rectangle=Os,l.Renderer=Ge,l.SVG=en,l.SVGOverlay=ks,l.TileLayer=Ii,l.Tooltip=Cn,l.Transformation=Xe,l.Util=Ye,l.VideoOverlay=js,l.bind=S,l.bounds=Ht,l.canvas=Es,l.circle=Ea,l.circleMarker=Ia,l.control=et,l.divIcon=Wa,l.extend=y,l.featureGroup=Da,l.geoJSON=Ls,l.geoJson=za,l.gridLayer=$a,l.icon=Ma,l.imageOverlay=Za,l.latLng=tt,l.latLngBounds=wt,l.layerGroup=ka,l.map=$,l.marker=Ca,l.point=q,l.polygon=Oa,l.polyline=Aa,l.popup=Fa,l.rectangle=Va,l.setOptions=H,l.stamp=j,l.svg=As,l.svgOverlay=Ra,l.tileLayer=Ms,l.tooltip=Ha,l.transformation=pe,l.version=x,l.videoOverlay=Ba;var Ka=window.L;l.noConflict=function(){return window.L=Ka,this},window.L=l}))})(on,on.exports)),on.exports}var Zi=oo();const Zn=ar(Zi);function Fn(p,v,l){return Object.freeze({instance:p,context:v,container:l})}function Hn(p,v){return v==null?function(x,y){const Z=D.useRef(void 0);return Z.current||(Z.current=p(x,y)),Z}:function(x,y){const Z=D.useRef(void 0);Z.current||(Z.current=p(x,y));const S=D.useRef(x),{instance:V}=Z.current;return D.useEffect(function(){S.current!==x&&(v(V,x,S.current),S.current=x)},[V,x,v]),Z}}function Sa(p,v){D.useEffect(function(){return(v.layerContainer??v.map).addLayer(p.instance),function(){v.layerContainer?.removeLayer(p.instance),v.map.removeLayer(p.instance)}},[v,p])}function Na(p){return function(l){const x=Bn(),y=p(Rn(l,x),x);return ba(x.map,l.attribution),bs(y.current,l.eventHandlers),Sa(y.current,x),y}}function lo(p,v){const l=D.useRef(void 0);D.useEffect(function(){if(v.pathOptions!==l.current){const y=v.pathOptions??{};p.instance.setStyle(y),l.current=y}},[p,v])}function co(p){return function(l){const x=Bn(),y=p(Rn(l,x),x);return bs(y.current,l.eventHandlers),Sa(y.current,x),lo(y.current,l),y}}function ho(p,v){const l=Hn(p,v),x=Na(l);return Ta(x)}function uo(p,v){const l=Hn(p),x=ao(l,v);return no(x)}function mo(p,v){const l=Hn(p,v),x=co(l);return Ta(x)}function fo(p,v){const l=Hn(p,v),x=Na(l);return so(x)}function po(p,v,l){const{opacity:x,zIndex:y}=v;x!=null&&x!==l.opacity&&p.setOpacity(x),y!=null&&y!==l.zIndex&&p.setZIndex(y)}function go(){return Bn().map}function _o({bounds:p,boundsOptions:v,center:l,children:x,className:y,id:Z,placeholder:S,style:V,whenReady:j,zoom:O,...yt},I){const[z]=D.useState({className:y,id:Z,style:V}),[B,at]=D.useState(null),H=D.useRef(void 0);D.useImperativeHandle(I,()=>B?.map??null,[B]);const bt=D.useCallback(It=>{if(It!==null&&!H.current){const _t=new Zi.Map(It,yt);H.current=_t,l!=null&&O!=null?_t.setView(l,O):p!=null&&_t.fitBounds(p,v),j!=null&&_t.whenReady(j),at(io(_t))}},[]);D.useEffect(()=>()=>{B?.map.remove()},[B]);const Ct=B?Ae.createElement(ys,{value:B},x):S??null;return Ae.createElement("div",{...z,ref:bt},Ct)}const vo=D.forwardRef(_o),vs=ho(function({position:v,...l},x){const y=new Zi.Marker(v,l);return Fn(y,wa(x,{overlayContainer:y}))},function(v,l,x){l.position!==x.position&&v.setLatLng(l.position),l.icon!=null&&l.icon!==x.icon&&v.setIcon(l.icon),l.zIndexOffset!=null&&l.zIndexOffset!==x.zIndexOffset&&v.setZIndexOffset(l.zIndexOffset),l.opacity!=null&&l.opacity!==x.opacity&&v.setOpacity(l.opacity),v.dragging!=null&&l.draggable!==x.draggable&&(l.draggable===!0?v.dragging.enable():v.dragging.disable())}),pa=mo(function({positions:v,...l},x){const y=new Zi.Polyline(v,l);return Fn(y,wa(x,{overlayContainer:y}))},function(v,l,x){l.positions!==x.positions&&v.setLatLngs(l.positions)}),xs=uo(function(v,l){const x=new Zi.Popup(v,l.overlayContainer);return Fn(x,l)},function(v,l,{position:x},y){D.useEffect(function(){const{instance:S}=v;function V(O){O.popup===S&&(S.update(),y(!0))}function j(O){O.popup===S&&y(!1)}return l.map.on({popupopen:V,popupclose:j}),l.overlayContainer==null?(x!=null&&S.setLatLng(x),S.openOn(l.map)):l.overlayContainer.bindPopup(S),function(){l.map.off({popupopen:V,popupclose:j}),l.overlayContainer?.unbindPopup(),l.map.removeLayer(S)}},[v,l,y,x])}),xo=fo(function({url:v,...l},x){const y=new Zi.TileLayer(v,Rn(l,x));return Fn(y,x)},function(v,l,x){po(v,l,x);const{url:y}=l;y!=null&&y!==x.url&&v.setUrl(y)});function yo(p,v){const l={isEvent:!1,isMultiDay:!1,isSingleDayEvent:!1};if(!p||p.purpose!=="event")return l;const x=p.preferences&&typeof p.preferences=="object"&&!Array.isArray(p.preferences)?p.preferences:{},y=v&&v.length>0?v[v.length-1]:void 0,Z=(typeof x.eventDate=="string"?x.eventDate:v?.[0]?.startDate)||void 0,S=(typeof x.eventEndDate=="string"?x.eventEndDate:y?.endDate)||void 0,V=typeof x.eventTime=="string"?x.eventTime:void 0;let j=x.isMultiDay===!0;return!("isMultiDay"in x)&&Z&&S&&(j=Z!==S),{isEvent:!0,isMultiDay:j,isSingleDayEvent:!j,eventDate:Z,eventEndDate:j?S:void 0,eventTime:j?void 0:V}}function bo(p){if(!p)return null;const v=p.match(/^(\d{1,2}):(\d{2})/);if(!v)return null;let l=parseInt(v[1],10);const x=v[2];if(Number.isNaN(l)||l<0||l>23)return null;const y=l>=12?"PM":"AM";return l=l%12,l===0&&(l=12),`${l}:${x} ${y}`}const je=Zr.isNativePlatform()?"https://weathrplan.com":"",wo=p=>[{id:"temperature",label:"Avg Temperature",unit:p,color:"#fbbf24",dataKey:"temp"},{id:"high",label:"Avg High",unit:p,color:"#ef4444",dataKey:"high"},{id:"low",label:"Avg Low",unit:p,color:"#3b82f6",dataKey:"low"},{id:"precipitation",label:"Precipitation",unit:"%",color:"#06b6d4",dataKey:"precipitation",isBar:!0}],On=[{id:"golf",label:"⛳ Golf"},{id:"hiking",label:"🥾 Hiking"},{id:"beach",label:"🏖️ Beach"},{id:"sightseeing",label:"🏛️ Sightseeing"},{id:"fishing",label:"🎣 Fishing"},{id:"photography",label:"📸 Photography"},{id:"cycling",label:"🚴 Cycling"},{id:"tennis",label:"🎾 Tennis"},{id:"skiing",label:"⛷️ Skiing"},{id:"boating",label:"⛵ Boating"},{id:"running",label:"🏃 Running"},{id:"swimming",label:"🏊 Swimming"},{id:"camping",label:"🏕️ Camping"}
1,{id:"surfing",label:"🏄 Surfing"},{id:"kayaking",label:"🛶 Kayaking"},{id:"pickleball",label:"🏓 Pickleball"},{id:"dining",label:"🍽️ Dining"},{id:"shopping",label:"🛍️ Shopping"},{id:"concert",label:"🎶 Concert/Event"},{id:"theme park",label:"🎢 Theme Park"},{id:"bird watching",label:"🐦 Bird Watching"}],zn=p=>{switch(p){case"excellent":return"text-green-700 dark:text-green-300";case"good":return"text-blue-700 dark:text-blue-300";case"fair":return"text-yellow-700 dark:text-yellow-200";case"challenging":return"text-orange-700 dark:text-orange-300";case"poor":return"text-red-700 dark:text-red-300";default:return"text-foreground"}},ga=p=>{switch(p){case"excellent":return"text-green-900 dark:text-green-100";case"good":return"text-blue-900 dark:text-blue-100";case"fair":return"text-yellow-900 dark:text-yellow-100";case"challenging":return"text-orange-900 dark:text-orange-100";case"poor":return"text-red-900 dark:text-red-100";default:return"text-foreground"}},_a=p=>{switch(p){case"excellent":return"bg-green-500/20 dark:bg-green-500/10 border-green-500/40 dark:border-green-500/30";case"good":return"bg-blue-500/20 dark:bg-blue-500/10 border-blue-500/40 dark:border-blue-500/30";case"fair":return"bg-yellow-500/25 dark:bg-yellow-500/10 border-yellow-500/50 dark:border-yellow-500/30";case"challenging":return"bg-orange-500/20 dark:bg-orange-500/10 border-orange-500/40 dark:border-orange-500/30";case"poor":return"bg-red-500/20 dark:bg-red-500/10 border-red-500/40 dark:border-red-500/30";default:return"bg-theme-card border-theme"}},To=p=>{const v=new Date(p+"T12:00:00");return isNaN(v.getTime())?p:v.toLocaleDateString("en-US",{weekday:"long"})},So=(p,v,l,x)=>{const{verdict:y,bestDays:Z,highlights:S}=p,V=v||"your activities",j=x?.isSingleDayEvent?[]:(Z||[]).slice(0,3).map(To),O=l&&Object.keys(l).length>0;if(x?.isSingleDayEvent){const B="your event",at=x.eventTime?` at ${x.eventTime}`:"",H=S&&S.length>0&&S[0].length<=120?` ${S[0]}`:"";return y==="excellent"||y==="good"?`${y==="excellent"?"Great":"Good"} weather expected for ${B}${at}.${H}`:y==="fair"?`Mixed conditions for ${B}${at} — plan for variability.${H}`:`Challenging weather expected for ${B}${at}. Plan around it and have a backup.`}const yt=B=>/\d+°|monday|tuesday|wednesday|thursday|friday|saturday|sunday|april|may|june|july|august|sept|oct|nov|dec|jan|feb|mar/i.test(B),I=S&&S.length>0&&S[0].length<=100&&yt(S[0])?` ${S[0]}`:"";let z="";if(O&&(z=Object.entries(l).slice(0,2).map(([H,bt])=>{const Ct=new Date(H+"T12:00:00"),It=isNaN(Ct.getTime())?H:Ct.toLocaleDateString("en-US",{weekday:"long"});return`${String(bt).split(/[,;]/).map(Gt=>Gt.trim()).filter(Boolean).join(", ")} on ${It}`}).join("; ")),y==="excellent"||y==="good"){const B=y==="excellent"?"great":"good";if(j.length>0){const H=`${B.charAt(0).toUpperCase()+B.slice(1)} weather for ${V}. Best days: ${j.join(", ")}.`;return z?`${H} Also, ${z} — looking ${B}.`:H+I}const at=`Weather looks ${B} for ${V} throughout your trip.`;return z?`${at} Also, ${z} — looking ${B}.`:at+I}else if(y==="fair"){if(j.length>0){const at=`Mixed conditions for ${V}. Aim for ${j.join(" or ")}.`;return z?`${at} ${z} — expect variable conditions.`:at+I}const B=`Mixed conditions expected for ${V}.`;return z?`${B} ${z} — check the details below.`:B+" Check the details below for the best windows."+I}else{if(j.length>0){const at=`Tough weather for ${V}, but ${j.join(" and ")} ${j.length===1?"looks":"look"} like your best bet.`;return z?`${at} ${z} may be challenging.`:at+I}const B=`Challenging weather expected for ${V}.`;return z?`${B} ${z} — consider flexible timing.`:B+" Plan for flexibility and check conditions closer to your trip."}},No=(p,v)=>{const l={excellent:10,good:8,fair:5,challenging:3,poor:1},x=p.map((I,z)=>({verdict:I,index:z})).filter(I=>I.verdict!==null);if(x.length===0)return null;const y=Math.round(x.reduce((I,z)=>I+(l[z.verdict]||5),0)/x.length),Z=x.reduce((I,z)=>{const B=l[z.verdict]||5,at=l[I.verdict]||5;return B>at?z:I},x[0]),S=x.reduce((I,z)=>{const B=l[z.verdict]||5,at=l[I.verdict]||5;return B<at?z:I},x[0]),V=v[Z.index],j=v[S.index],O=V?.dateISO?new Date(V.dateISO+"T12:00:00").toLocaleDateString("en-US",{weekday:"long"}):`Day ${Z.index+1}`,yt=j?.dateISO?new Date(j.dateISO+"T12:00:00").toLocaleDateString("en-US",{weekday:"long"}):`Day ${S.index+1}`;return y>=9?"Great weather across your trip — all days look comfortable.":y>=7?`Most days look comfortable — ${O} is the standout.`:y>=5?Z.verdict==="excellent"||Z.verdict==="good"?`${O} is your best bet for outdoor plans. ${yt} may be less comfortable.`:"Mixed comfort expected. Plan outdoor time around the better days.":`Challenging conditions expected for most of your trip. ${O} looks like the most comfortable day.`},Po={Alabama:"AL",Alaska:"AK",Arizona:"AZ",Arkansas:"AR",California:"
1CA",Colorado:"CO",Connecticut:"CT",Delaware:"DE",Florida:"FL",Georgia:"GA",Hawaii:"HI",Idaho:"ID",Illinois:"IL",Indiana:"IN",Iowa:"IA",Kansas:"KS",Kentucky:"KY",Louisiana:"LA",Maine:"ME",Maryland:"MD",Massachusetts:"MA",Michigan:"MI",Minnesota:"MN",Mississippi:"MS",Missouri:"MO",Montana:"MT",Nebraska:"NE",Nevada:"NV","New Hampshire":"NH","New Jersey":"NJ","New Mexico":"NM","New York":"NY","North Carolina":"NC","North Dakota":"ND",Ohio:"OH",Oklahoma:"OK",Oregon:"OR",Pennsylvania:"PA","Rhode Island":"RI","South Carolina":"SC","South Dakota":"SD",Tennessee:"TN",Texas:"TX",Utah:"UT",Vermont:"VT",Virginia:"VA",Washington:"WA","West Virginia":"WV",Wisconsin:"WI",Wyoming:"WY","District of Columbia":"DC"};function oi(p){if(!p)return p;const v=p.split(",").map(Z=>Z.trim());if(v.length<2)return p;const l=v[0],x=v[1],y=Po[x];if(y)return`${l}, ${y}`;if(v.length>=2){const Z=x.length>15?x.substring(0,12)+"...":x;return`${l}, ${Z}`}return p}function Lo(p,v){const l=[];if(p>=45&&p<=48&&l.push({type:"fog",label:"Foggy",color:"bg-gray-500/20 text-gray-600 dark:text-gray-400"}),p>=51&&p<=57&&l.push({type:"rain",label:"Drizzle",color:"bg-blue-500/20 text-blue-600 dark:text-blue-400"}),p>=61&&p<=67){const x=p>=65;l.push({type:"rain",label:x?"Heavy Rain":"Rain",color:x?"bg-red-500/20 text-red-600 dark:text-red-400":"bg-blue-500/20 text-blue-600 dark:text-blue-400"})}if((p===66||p===67)&&l.push({type:"ice",label:"Icy",color:"bg-red-500/20 text-red-600 dark:text-red-400"}),p>=71&&p<=77)if(v!==void 0&&v>50)l.push({type:"rain",label:"Rain",color:"bg-blue-500/20 text-blue-600 dark:text-blue-400"});else{const x=p>=73;l.push({type:"snow",label:x?"Heavy Snow":"Snow",color:x?"bg-red-500/20 text-red-600 dark:text-red-400":"bg-cyan-500/20 text-cyan-600 dark:text-cyan-400"})}if(p>=80&&p<=82){const x=p===82;l.push({type:"rain",label:x?"Heavy Showers":"Showers",color:x?"bg-red-500/20 text-red-600 dark:text-red-400":"bg-blue-500/20 text-blue-600 dark:text-blue-400"})}return p>=85&&p<=86&&l.push({type:"snow",label:"Snow Showers",color:"bg-cyan-500/20 text-cyan-600 dark:text-cyan-400"}),p>=95&&p<=99&&l.push({type:"storm",label:"Thunderstorm",color:"bg-red-500/20 text-red-600 dark:text-red-400"}),v!==void 0&&v<=32&&l.length===0&&l.push({type:"cold",label:"Freezing",color:"bg-cyan-500/20 text-cyan-600 dark:text-cyan-400"}),l}function va({latitude:p,longitude:v,tempUnit:l,tempSymbol:x,arrivalDateTime:y}){const Z=new Date,V=(y?Math.ceil((y.getTime()-Z.getTime())/(1e3*60*60*24)):0)>14,j=y?`${y.getFullYear()}-${String(y.getMonth()+1).padStart(2,"0")}-${String(y.getDate()).padStart(2,"0")}`:"",{data:O,isLoading:yt,error:I}=Ke({queryKey:["/api/weather",p,v],queryFn:async()=>{const ct=await fetch(`${je}/api/weather/${p}/${v}`);if(ct.status===404)return null;if(!ct.ok)throw ct.status>=500?new ci(ct.status,`Failed to fetch weather (${ct.status})`):new Error(`Failed to fetch weather (${ct.status})`);return ct.json()},enabled:!!p&&!!v&&!V,staleTime:300*1e3,...li}),{data:z,isLoading:B,error:at}=Ke({queryKey:["/api/historical-weather",p,v,j],queryFn:async()=>{const ct=await fetch(`${je}/api/historical-weather?latitude=${p}&longitude=${v}&startDate=${j}&endDate=${j}`);if(!ct.ok){if(ct.status===401||ct.status===403)return{premiumRequired:!0};if((await ct.json().catch(()=>({}))).code==="PREMIUM_REQUIRED")return{premiumRequired:!0};if(ct.status>=500)throw new ci(ct.status,`historical-weather ${ct.status}`);return null}return ct.json()},enabled:!!p&&!!v&&V&&!!j,staleTime:3600*1e3,...li});if(V?B:yt)return s.jsx("span",{className:"text-xs opacity-40",children:"..."});if(V&&z?.premiumRequired)return s.jsx(rn,{href:"/upgrade",children:s.jsxs("span",{className:"flex items-center gap-1.5 text-xs ml-auto cursor-pointer hover:opacity-80",children:[s.jsxs("span",{className:"flex items-center gap-1 opacity-50 blur-[2px]",children:[s.jsx(Br,{className:"h-3 w-3"}),s.jsx("span",{children:"--°"})]}),s.jsxs("span",{className:"inline-flex items-center gap-0.5 bg-gradient-to-r from-amber-500 to-yellow-400 text-amber-950 text-[9px] font-bold px-1.5 py-0.5 rounded-full shadow-sm ring-1 ring-amber-700/40",children:[s.jsx(ya,{className:"h-2.5 w-2.5 fill-current"}),"Pro"]})]})});let bt,Ct,It=!1,_t=!1;if(V&&z?.daily?.[0]){const ct=z.daily[0],Kt=ct.temperatureMax??ct.avgHighTemp??0;bt=Ft(Math.round(Kt),l),Ct=ct.weatherCode??2,_t=!0}else if(!V&&O)if(y&&O.daily&&O.daily.length>0){const ct=Z.getFullYear(),Kt=String(Z.getMonth()+1).padStart(2,"0"),be=String(Z.getDate()).padStart(2,"0"),ut=`${ct}-${Kt}-${be}`,ce=O.daily.find(Zt=>Zt.date===j);if(ce&&j>=ut)bt=Ft(Math.round(ce.temperatureMax),l),Ct=ce.weatherCode,It=!0;else if(O.current)bt=Ft(O.current.temperature,l),Ct=O.current.weatherCode;else return null}else if(O.current)bt=Ft(O.current.temperature,l),Ct=O.current.weatherCode;else return null;else return null;const Gt=Rr(Ct),ue=Lo(Ct,bt);return s.jsxs("span",{className:"flex items-center gap-1.5 text-xs ml-auto",children:[s.jsxs("span",{className:"flex items-center gap-1 opacity-70",children:[s.jsx(Gt,{className:"h-3 w-3"}),s.jsxs("span",{children:[bt,x]}),It&&s.jsx("span",{className:"text-[8px] opacity-50",children:"(forecast)"}),_t&&s.jsx("span",{className:"text-[8px] opacity-50",children:"(predicted)"})]}),ue.length>0&&s.jsx("span",{className:"flex items-center gap-1",children:ue.slice(0,2).map((ct,Kt)=>s.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded-full font-medium ${ct.color}`,children:ct.label},Kt))})]})}function jo({positions:p,polylinePositions:v}){const l=go(),x=v&&v.length>0?(()=>{const Z=v.length,S=[`${Z}`],V=Math.min(8,Z);for(let j=0;j<V;j++){const O=Math.floor(j*(Z-1)/Math.max(1,V-1));S.push(`${v[O][0].toFixed(4)},${v[O][1].toFixed(4)}`)}return S.join("|")})():"",y=p.map(Z=>`${Z[0]},${Z[1]}`).join("|");return D.useEffect(()=>{const Z=[...p,...v??[]];if(Z.length===0)return;const S=Zn.latLngBounds(Z.map(V=>Zn.latLng(V[0],V[1])));l.fitBounds(S,{padding:[50,50]})},[l,y,x]),null}function xa(p,v,l,x=!1,y=!1,Z=!1){const S=x?"#059669":y?"#d97706":"#0284c7",V="#ffffff",O=(z=>z===null?"":z===0?"☀️":z>=1&&z<=3?"⛅":z>=45&&z<=48?"🌫️":z>=51&&z<=67?"🌧️":z>=71&&z<=77?"❄️":z>=80&&z<=82?"🌧️":z>=85&&z<=86?"🌨️":z>=95?"⛈️":"☁️")(l),yt=p!==null?`${p}${v}`:"...",I=Z?"(pred)":"";return Zn.divIcon({className:"weather-marker",html:`
2      <div style="
3        background: ${S};
4        color: ${V};
5        padding: 6px 10px;
6        border-radius: 20px;
7        font-size: 12px;
8        font-weight: 700;
9        white-space: nowrap;
10        box-shadow: 0 2px 8px rgba(0,0,0,0.35);
11        border: 1.5px solid rgba(255,255,255,0.85);
12        text-shadow: 0 1px 1px rgba(0,0,0,0.25);
13        display: flex;
14        align-items: center;
15        gap: 4px;
16      ">
17        ${O?`<span>${O}</span>`:""}
18        <span>${yt}</span>
19        ${I?`<span style="font-size:9px;opacity:0.7">${I}</span>`:""}
20      </div>
21    `,iconSize:[90,30],iconAnchor:[45,15]})}function _s({latitude:p,longitude:v,name:l,arrivalDateTime:x,tempUnit:y,tempSymbol:Z,isOrigin:S=!1,isQuickStop:V=!1,stopInfo:j}){const O=new Date,I=(x?Math.ceil((x.getTime()-O.getTime())/(1e3*60*60*24)):0)>14,z=x?`${x.getFullYear()}-${String(x.getMonth()+1).padStart(2,"0")}-${String(x.getDate()).padStart(2,"0")}`:"",{data:B}=Ke({queryKey:["/api/weather",p,v],queryFn:async()=>{const ut=await fetch(`${je}/api/weather/${p}/${v}`);if(ut.status===404)return null;if(!ut.ok)throw ut.status>=500?new ci(ut.status,`Failed to fetch weather (${ut.status})`):new Error(`Failed to fetch weather (${ut.status})`);return ut.json()},enabled:!!p&&!!v&&!I,staleTime:300*1e3,...li}),{data:at}=Ke({queryKey:["/api/historical-weather",p,v,z],queryFn:async()=>{const ut=await fetch(`${je}/api/historical-weather?latitude=${p}&longitude=${v}&startDate=${z}&endDate=${z}`);if(!ut.ok){if(ut.status===401||ut.status===403)return{premiumRequired:!0};if((await ut.json().catch(()=>({}))).code==="PREMIUM_REQUIRED")return{premiumRequired:!0};if(ut.status>=500)throw new ci(ut.status,`historical-weather ${ut.status}`);return null}return ut.json()},enabled:!!p&&!!v&&I&&!!z,staleTime:3600*1e3,...li});let H=null,bt=null,Ct=!1;const It=I&&(at?.premiumRequired||!at),_t=parseFloat(p),Gt=parseFloat(v),ue=Number.isFinite(_t)&&Number.isFinite(Gt)&&Math.abs(_t)<=90&&Math.abs(Gt)<=180;if(It&&at!==void 0){if(!ue)return null;const ut=xa(null,Z,null,S,V,!1);return s.jsx(vs,{position:[_t,Gt],icon:ut,children:s.jsx(xs,{children:s.jsxs("div",{className:"text-center",children:[s.jsx("strong",{children:l}),s.jsx("br",{}),s.jsx("span",{className:"text-xs text-amber-600",children:"Upgrade to Pro for weather predictions"})]})})})}if(I&&at?.daily?.[0]){const ut=at.daily[0],ce=ut.temperatureMax??ut.avgHighTemp??0;H=Ft(Math.round(ce),y),bt=ut.weatherCode??2,Ct=!0}else if(!I&&B){const ut=O.getFullYear(),ce=String(O.getMonth()+1).padStart(2,"0"),Zt=String(O.getDate()).padStart(2,"0"),Dt=`${ut}-${ce}-${Zt}`;if(x&&B.daily&&B.daily.length>0){const Ye=B.daily.find(Tt=>Tt.date===z);Ye&&z>=Dt?(H=Ft(Math.round(Ye.temperatureMax),y),bt=Ye.weatherCode):B.current&&(H=Ft(B.current.temperature,y),bt=B.current.weatherCode)}else B.current&&(H=Ft(B.current.temperature,y),bt=B.current.weatherCode)}const ct=xa(H,Z,bt,S,V,Ct),Kt=parseFloat(p),be=parseFloat(v);return!Number.isFinite(Kt)||!Number.isFinite(be)||Math.abs(Kt)>90||Math.abs(be)>180?null:s.jsx(vs,{position:[Kt,be],icon:ct,children:s.jsx(xs,{children:s.jsxs("div",{className:"text-center",children:[s.jsx("strong",{children:l}),s.jsx("br",{}),s.jsx("span",{className:"text-xs text-gray-500",children:j||(S?"Starting point":"")}),H!==null&&s.jsxs(s.Fragment,{children:[s.jsx("br",{}),s.jsxs("span",{className:"text-sm font-medium",children:[H,Z]}),Ct&&s.jsx("span",{className:"text-xs text-gray-400",children:" (predicted)"})]})]})})})}function Io(){const[p,v]=rr("/trip/:id"),l=v?.id||"",[,x]=or(),{isAuthenticated:y,isLoading:Z}=lr(),{isPremium:S,isTripUnlocked:V,isLoading:j}=cr(),{toast:O}=hr(),{preferences:yt,tempUnit:I,windUnit:z,tempSymbol:B,windSymbol:at}=dr(),H=ur(),[bt,Ct]=D.useState(!1),[It,_t]=D.useState([]),[Gt,ue]=D.useState(""),[ct,Kt]=D.useState(""),[be,ut]=D.useState(!1),[ce,Zt]=D.useState("temperature"),[Dt,Ye]=D.useState(!1),[Tt,Wn]=D.useState(0),[ee,hi]=D.useState("temperature"),[K,$n]=D.useState(!1),[q,St]=D.useState(!1),[Ht,Ut]=D.useState(!1),[wt,vt]=D.useState(!0),[tt,me]=D.useState(!0),[fe,ln]=D.useState(!0),[Je,Xe]=D.useState(!1),[pe,di]=D.useState(""),[ui,vi]=D.useState([]),[ke,Oe]=D.useState("whole-trip"),[ae,ze]=D.useState(""),[mi,xi]=D.useState(!1),[yi,cn]=D.useState(!0),[Bi,Un]=D.useState(!0),[hn,qn]=D.useState(null),[Vn,ws]=D.useState(!1),[Gn,Kn]=D.useState(null),[Ts,Yn]=D.useState(!1),[Ri,dn]=D.useState(null),[un,Qe]=D.useState(new Set),[mn,fn]=D.useState(new Set),[Fi,pn]=D.useState(!1),[gn,Jn]=D.useState(new Set),[De,Me]=D.useState(null),[Xn,Qn]=D.useState(()=>Math.floor(Date.now()/6e4));D.useEffect(()=>{const o=setInterval(()=>{Qn(Math.floor(Date.now()/6e4))},6e4);return()=>clearInterval(o)},[]);const Yt=o=>{if(!o)return new Date(NaN);const h=o.split("T")[0].split("-").map(Number);if(h.length!==3||h.some(isNaN))return new Date(NaN);const[_,w,N]=h;return new Date(Date.UTC(_,w-1,N))},Ze=(o,u)=>Yt(o).toLocaleDateString("en-US",{...u,timeZone:"UTC"}),bi=()=>{const o=new Date;return new Date(Date.UTC(o.getFullYear(),o.getMonth(),o.getDate()))},ts=(o,u)=>{_t(h=>h.map(_=>_.id===o?{..._,destination:u.displayName,latitude:u.latitude,longitude:u.longitude}:_))},_n=async(o,u,h)=>
21{if(!(!b||!b.segments))try{if(u==="from")if(o===0)await te.updateTrip(l,{departureAirport:h});else{const _=b.segments[o-1];_&&await te.updateTripSegment(l,_.id,{arrivalAirport:h})}else{const _=b.segments[o];_&&await te.updateTripSegment(l,_.id,{arrivalAirport:h})}H.invalidateQueries({queryKey:["/api/trips",l]}),Be(),O({title:"Airport updated",description:`${u==="from"?"Departure":"Arrival"} airport changed to ${h}`})}catch{O({title:"Failed to update airport",description:"Please try again",variant:"destructive"})}},es=async(o,u)=>{if(!(!b||!b.segments))try{if(u)await te.updateTrip(l,{returnFlightEnabled:!1,returnAirport:"",returnDate:""});else if(o===0){await te.updateTrip(l,{departureAirport:""});const h=b.segments[0];h&&await te.updateTripSegment(l,h.id,{arrivalAirport:""})}else{const h=b.segments[o-1],_=b.segments[o];h&&await te.updateTripSegment(l,h.id,{arrivalAirport:""}),_&&await te.updateTripSegment(l,_.id,{arrivalAirport:""})}H.invalidateQueries({queryKey:["/api/trips",l]}),Be(),O({title:"Flight removed",description:u?"Return flight removed":"Airport codes cleared for this flight"})}catch{O({title:"Failed to remove flight",description:"Please try again",variant:"destructive"})}},re=mr({mutationFn:o=>te.updateTripSegments(l,o),onSuccess:()=>{H.invalidateQueries({queryKey:["/api/trips",l]}),Ct(!1),O({title:"Trip updated",description:"Your trip has been saved successfully"})},onError:()=>{O({title:"Error",description:"Failed to save trip changes. Please try again.",variant:"destructive"})}}),R=()=>{x(`/plan?edit=${l}`)},Hi=()=>{Ct(!1),_t([]),ue(""),Kt("")},Wi=async()=>{if(!Gt.trim()){O({title:"Error",description:"Please enter a trip name",variant:"destructive"});return}if(It.length===0){O({title:"Error",description:"Please add at least one destination",variant:"destructive"});return}if(!It.every(u=>u.latitude&&u.longitude)){O({title:"Error",description:"Please select valid destinations from the dropdown",variant:"destructive"});return}ut(!0);try{const u=Gt!==b?.name,h=ct!==b?.activity;(u||h)&&await te.updateTrip(l,{name:Gt,activity:ct}),await re.mutateAsync(It.map(_=>({destination:_.destination,latitude:_.latitude,longitude:_.longitude,startDate:_.startDate,endDate:_.endDate})))}catch{O({title:"Error",description:"Failed to save trip changes. Please try again.",variant:"destructive"}),ut(!1);return}ut(!1)},$i=async()=>{if(!(!l||!y)){xi(!0);try{const u=[...ui.map(_=>{const w=On.find(N=>N.id===_);return w?w.id:_})];pe.trim()&&u.push(pe.trim());const h=u.join(", ");if(ke==="specific-date"&&ae&&we.includes(ae)){const _=b?.preferences||{},w={..._.dateActivities||{},[ae]:h};await te.updateTrip(l,{preferences:{..._,dateActivities:w}});const N=new Date(ae+"T12:00:00"),m=isNaN(N.getTime())?ae:N.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"});O({title:"Activities updated",description:`Set activities for ${m}.`})}else await te.updateTrip(l,{activity:h||void 0}),O({title:"Activities updated",description:"Weather suitability will refresh with your activities."});H.invalidateQueries({queryKey:["trip-insights",l]}),H.invalidateQueries({queryKey:["trip",l]}),Xe(!1)}catch{O({title:"Error",description:"Failed to save activities.",variant:"destructive"})}xi(!1)}},Ui=()=>{const o=b?.activity||"",u=On.map(N=>N.id),h=o.split(/[,;]/).map(N=>N.trim()).filter(N=>N.length>0),_=[],w=[];for(const N of h){const m=N.toLowerCase(),P=u.find(M=>m===M||m.includes(M));P&&!_.includes(P)?_.push(P):w.push(N)}vi(_),di(w.join(", ")),Oe("whole-trip"),ze(""),Xe(!0)},wi=(o,u,h)=>{_t(_=>_.map(w=>w.id===o?{...w,[u]:h}:w))},vn=()=>{const o=It[It.length-1],u=o?o.endDate:new Date().toISOString().split("T")[0],h=new Date(new Date(u).getTime()+4320*60*1e3).toISOString().split("T")[0];_t(_=>[..._,{id:`segment-${Date.now()}`,destination:"",startDate:u,endDate:h,latitude:"",longitude:""}])},ti=o=>{if(It.length===1){O({title:"Cannot remove",description:"Trip must have at least one destination",variant:"destructive"});return}_t(u=>u.filter(h=>h.id!==o))},qi=o=>{const u=[`Packing List for ${b?.name||"Trip"}
22`],h={essential:[],recommended:[],optional:[]};return o.forEach(_=>{h[_.priority]&&h[_.priority].push(_)}
22),Object.entries(h).forEach(([_,w])=>{w.length>0&&(u.push(`
23${_.toUpperCase()}:`),w.forEach(N=>{u.push(`- ${N.item} (${N.category}): ${N.reason}`)}))}),u.join(`
24`)},xn=()=>typeof navigator<"u"&&typeof navigator.clipboard<"u"&&typeof navigator.clipboard.writeText=="function",is=async()=>{if(!rt?.packingList||rt.packingList.length===0){O({title:"No items to export",description:"The packing list is empty",variant:"destructive"});return}if(!xn()){O({title:"Copy not available",description:"Your browser doesn't support clipboard access. Try downloading instead.",variant:"destructive"});return}try{const o=qi(rt.packingList);await navigator.clipboard.writeText(o),O({title:"Copied!",description:"Packing list copied to clipboard"})}catch{O({title:"Failed to copy",description:"Clipboard access denied. Try downloading instead.",variant:"destructive"})}},ns=async()=>{if(!rt?.packingList||rt.packingList.length===0){O({title:"No items to share",description:"The packing list is empty",variant:"destructive"});return}const o=qi(rt.packingList);if(typeof navigator<"u"&&typeof navigator.share=="function")try{await navigator.share({title:`Packing List - ${b?.name||"Trip"}`,text:o});return}catch{}if(xn())try{await navigator.clipboard.writeText(o),O({title:"Copied!",description:"Packing list copied to clipboard"})}catch{O({title:"Failed to share",description:"Try downloading instead.",variant:"destructive"})}else O({title:"Share not available",description:"Your browser doesn't support sharing. Try downloading instead.",variant:"destructive"})},{data:b,isLoading:yn,isPending:ss,isFetching:fi}=Ke({queryKey:["trip",l,!0],queryFn:async()=>{if(y)return te.getTrip(l);const o=ha.getTrip(l);if(!o)return null;const u=new Date;let h=!1;const _=await Promise.all(o.segments.map(async w=>{try{const N=new Date(w.startDate),m=new Date(w.endDate),P=Math.ceil((N.getTime()-u.getTime())/(1e3*60*60*24)),M=Math.ceil((m.getTime()-u.getTime())/(1e3*60*60*24)),ht=async(C,$)=>(await te.getWeatherForRange(w.latitude,w.longitude,C,$)).map(et=>({date:et.date,dateISO:et.dateISO,temperature:et.temperature,temperatureMax:et.temperatureMax,temperatureMin:et.temperatureMin,condition:et.condition,weatherCode:et.weatherCode,precipitation:et.precipitation||0})),E=async(C,$)=>{const mt=await fetch(`${je}/api/historical-weather?latitude=${w.latitude}&longitude=${w.longitude}&startDate=${C}&endDate=${$}`);return mt.ok?(await mt.json()).daily.map(dt=>({date:dt.date,temperature:Math.round((dt.avgHighTemp+dt.avgLowTemp)/2),temperatureMax:dt.avgHighTemp,temperatureMin:dt.avgLowTemp,condition:dt.condition,weatherCode:dt.weatherCode??2,precipitation:dt.precipitationProbability||0})):[]};if(M<=14){const C=await ht(w.startDate,w.endDate);return{...w,weather:C,isHistorical:!1}}else if(P<=14){const C=new Date(u);C.setDate(C.getDate()+14);const $=C.toISOString().split("T")[0],mt=new Date(C);mt.setDate(mt.getDate()+1);const et=mt.toISOString().split("T")[0],dt=await ht(w.startDate,$),ft=await E(et,w.endDate);return ft.length>0&&(h=!0),{...w,weather:[...dt,...ft],isHistorical:ft.length>0}}else{h=!0;const C=await E(w.startDate,w.endDate);return{...w,weather:C,isHistorical:!0}}}catch{return{...w,weather:[],isHistorical:!1}}}));return{...o,segments:_,suggestions:[],hasHistoricalWeather:h,historicalDisclaimer:h?"Days marked Predicted use historical averages. Forecasts replace predictions 14 days before your trip.":null}},enabled:!!l&&!Z}),ie=S||V(l);console.log("[TripDetail] canAccessInsights:",ie,"isPremium:",S,"premiumLoading:",j,"tripId:",l);const as=D.useMemo(()=>b?.segments?b.segments.map(o=>`${o.id||o.destination}-${o.startDate}-${o.endDate}`).join("|"):null,[b?.segments]),we=D.useMemo(()=>{if(!b?.segments?.length)return[];const o=[];for(const u of b.segments){const h=u.startDate?.split("T")[0],_=u.endDate?.split("T")[0];if(h&&_){const w=new Date(h+"T12:00:00"),N=new Date(_+"T12:00:00");for(let m=new Date(w);m<=N;m.setDate(m.getDate()+1)){const P=m.toISOString().split("T")[0];o.includes(P)||o.push(P)}}else h&&(o.includes(h)||o.push(h))}return o.sort()},[b?.segments]),{data:rt,isLoading:rs,refetch:Ti,error:ge}=Ke({queryKey:["trip-insights",l,!0,as,ie],queryFn:async()=>
24{if(console.log("[TripDetail] Insights queryFn called, tripId:",l,"isAuthenticated:",y),!l)return null;if(y){const o=`${je}/api/trips/${l}/insights`;console.log("[TripDetail] Fetching insights from:",o);const u=await da(),h={"Content-Type":"application/json"};u&&(h.Authorization=`Bearer ${u}`);const _=await fetch(o,{credentials:"include",headers:h});if(console.log("[TripDetail] Insights response status:",_.status,_.statusText),_.status===401||_.status===403||_.status===404)return console.log("[TripDetail] Insights expected non-OK status, returning null"),null;if(!_.ok)throw _.status>=500?new ci(_.status,`Insights fetch failed (${_.status})`):new Error(`Insights fetch failed (${_.status})`);const w=await _.json();return console.log("[TripDetail] Insights data received:",w?"has data":"null"),w}else try{const o=ha.getTrip(l);if(!o)return null;const u=new Date;let h=!1;const _=await Promise.all(o.segments.map(async P=>{try{const M=new Date(P.startDate),ht=new Date(P.endDate),E=Math.ceil((M.getTime()-u.getTime())/(1e3*60*60*24)),C=Math.ceil((ht.getTime()-u.getTime())/(1e3*60*60*24)),$=async(et,dt)=>(await te.getWeatherForRange(P.latitude,P.longitude,et,dt)).map(it=>({avgHighTemp:it.temperatureMax,avgLowTemp:it.temperatureMin,precipitationProbability:it.precipitation||0,condition:it.condition})),mt=async(et,dt)=>{const ft=await fetch(`${je}/api/historical-weather?latitude=${P.latitude}&longitude=${P.longitude}&startDate=${et}&endDate=${dt}`);return ft.ok?(await ft.json()).daily.map(W=>({avgHighTemp:W.avgHighTemp,avgLowTemp:W.avgLowTemp,precipitationProbability:W.precipitationProbability,condition:W.condition})):[]};if(C<=14){const et=await $(P.startDate,P.endDate);return{destination:P.destination,startDate:P.startDate,endDate:P.endDate,weather:et,isHistorical:!1}}else if(E<=14){const et=new Date(u);et.setDate(et.getDate()+14);const dt=et.toISOString().split("T")[0],ft=new Date(et);ft.setDate(ft.getDate()+1);const it=ft.toISOString().split("T")[0],W=await $(P.startDate,dt),pt=await mt(it,P.endDate);return pt.length>0&&(h=!0),{destination:P.destination,startDate:P.startDate,endDate:P.endDate,weather:[...W,...pt],isHistorical:pt.length>0}}else{h=!0;const et=await mt(P.startDate,P.endDate);return{destination:P.destination,startDate:P.startDate,endDate:P.endDate,weather:et,isHistorical:!0}}}catch{return{destination:P.destination,startDate:P.startDate,endDate:P.endDate,weather:[],isHistorical:!1}}})),w=o.activity||o.tripType||"General Travel",N=await fetch(`${je}/api/activity-insights`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({activity:w,tripName:o.name,segments:_})});return N.ok?{...await N.json(),isHistorical:h,disclaimer:h?"Weather predictions are based on historical averages from past years. Actual conditions will vary. Real forecasts become available 14 days before your trip.":"Weather forecast is current and based on actual meteorological data."}:null}catch(o){return console.error("[TripDetail] Insights guest queryFn error:",o),null}},enabled:!!l&&!Z&&!j&&!!b&&ie,...li}),Si=Ae.useRef(!1);D.useEffect(()=>{console.log("[TripDetail] useEffect - prevAccess:",Si.current,"canAccessInsights:",ie,"trip:",!!b,"premiumLoading:",j),!Si.current&&ie&&b&&!j&&(console.log("[TripDetail] Triggering refetchInsights due to access change"),Ti()),Si.current=ie},[ie,b,Ti,j]);const pi=b?.travelMode==="flying",Te=!!(b?.departureAirport&&b?.segments?.some(o=>o.arrivalAirport)),{data:ot,isLoading:Nt,refetch:Be}=Ke({queryKey:["flight-turbulence",l],queryFn:async()=>l?await te.getFlightTurbulence(l):null,enabled:!!l&&!!y&&!!pi&&Te&&ie,staleTime:0,...li}),Re=Ae.useRef(!1);D.useEffect(()=>{!Re.current&&Te&&pi&&ie&&(H.invalidateQueries({queryKey:["flight-turbulence",l]}),Be()),Re.current=Te},[Te,pi,ie,l,H,Be]);const Se=b?.travelMode==="driving",{data:Jt,isLoading:J}=Ke({queryKey:["driving-route",l],queryFn:async()=>{if(!l)return null;const o=await da(),u={"Content-Type":"application/json"};o&&(u.Authorization=`Bearer ${o}`);const h=await fetch(`${je}/api/trips/${l}/driving-route`,{credentials:"include",headers:u});if(h.status===403||h.status===400)return null;if(!h.ok)throw h.status>=500?new ci(h.status,`Failed to fetch driving route (${h.status})`):new Error(`Failed to fetch driving route (${h.status})`);return h.json()},enabled:!!l&&!!y&&!!Se&&S,retry:2,retryDelay:o=>Math.min(1e3*2**o,5e3)}),Lt=D.useMemo(()=>wo(B),[B]);D.useEffect(()=>{if(b?.segments&&b.segments.length>0){const o=new Date,u=`${o.getFullYear()}
24-${String(o.getMonth()+1).padStart(2,"0")}-${String(o.getDate()).padStart(2,"0")}`;b.segments.reduce((_,w)=>w.endDate>_?w.endDate:_,b.segments[0].endDate)<u&&Ye(!0)}},[b?.segments]);const Ce=D.useMemo(()=>{if(!b?.segments)return[];const o=b.preferences?.routeStops||[],u=new Map,h=new Map;o.forEach(M=>{M.id&&u.set(M.id,M.isHome===!0),M.name&&M.isHome===!0&&h.set(M.name,!0)});const _=b.preferences?.hasReturnTrip===!0||o.some(M=>M.isHome===!0),w=b.segments.flatMap((M,ht)=>{let E=u.get(M.id)===!0;return!E&&M.destination&&(E=h.has(M.destination)),_&&E?[]:(M.weather||[]).map((C,$)=>({...C,segmentStartDate:M.startDate,segmentDayIndex:$,destination:M.destination,segmentIdx:ht,isHomeSegment:E}))}),N=bi();return(Dt?w:w.filter(M=>{if(M.dateISO){const ht=Yt(M.dateISO);if(!isNaN(ht.getTime()))return ht>=N}if(M.segmentStartDate!==void 0&&M.segmentDayIndex!==void 0){const ht=Yt(M.segmentStartDate);if(!isNaN(ht.getTime())){const E=new Date(ht);return E.setUTCDate(E.getUTCDate()+M.segmentDayIndex),E>=N}}return!0})).map((M,ht)=>({date:M.date,dateISO:M.dateISO,segmentStartDate:M.segmentStartDate,segmentDayIndex:M.segmentDayIndex,destination:M.destination,segmentIdx:M.segmentIdx,temp:Ft(M.temperature,I),high:Ft(M.temperatureMax,I),low:Ft(M.temperatureMin,I),precipitation:(M.precipitation||0)*(M.precipitation>1?1:100),weatherCode:M.weatherCode||0,index:ht})).slice(0,14)},[b?.segments,b?.preferences,Dt,I]),Et=D.useMemo(()=>{if(Tt===null||!Ce[Tt])return null;const o=Ce[Tt],u=b?.segments?.[o.segmentIdx];if(!u)return null;let h=o.dateISO,_=null;if(h){const P=Yt(h);isNaN(P.getTime())||(_=P)}if(!_&&o.segmentStartDate!==void 0&&o.segmentDayIndex!==void 0){const P=Yt(o.segmentStartDate);if(!isNaN(P.getTime())){const M=new Date(P);M.setUTCDate(M.getUTCDate()+o.segmentDayIndex),h=M.toISOString().split("T")[0],_=M}}const w=new Date;w.setHours(0,0,0,0);const N=_?Math.ceil((_.getTime()-w.getTime())/(1e3*60*60*24)):999,m=_!==null&&N>=0&&N<=14;return{dateISO:h,latitude:u.latitude,longitude:u.longitude,destination:o.destination,isHistorical:!m,weatherData:o}},[Tt,Ce,b?.segments]),{data:qt,isLoading:os,error:Ne}=Ke({queryKey:["trip-hourly-weather",Et?.latitude,Et?.longitude],queryFn:async()=>{if(!Et||Et.isHistorical)return null;const o=await fetch(`${je}/api/weather/${Et.latitude}/${Et.longitude}`);if(!o.ok)throw o.status>=500?new ci(o.status,`Failed to fetch hourly weather (${o.status})`):new Error(`Failed to fetch hourly weather (${o.status})`);return o.json()},enabled:!!Et&&!Et.isHistorical,staleTime:1e3*60*10,...li});D.useEffect(()=>{if(!b?.segments||!Ce.length)return;const o=new Map;Ce.forEach(u=>{const h=b.segments?.[u.segmentIdx];if(!h?.latitude||!h?.longitude)return;const _=u.dateISO?new Date(u.dateISO+"T12:00:00Z"):null,w=new Date;w.setHours(0,0,0,0);const N=new Date(w);if(N.setDate(N.getDate()+14),!(_&&_>=w&&_<=N))return;const P=`${h.latitude}-${h.longitude}`;o.has(P)||o.set(P,{lat:h.latitude,lon:h.longitude})}),o.forEach(({lat:u,lon:h})=>{H.prefetchQuery({queryKey:["trip-hourly-weather",u,h],queryFn:async()=>{const _=await fetch(`${je}/api/weather/${u}/${h}`);if(!_.ok)throw _.status>=500?new ci(_.status,`Failed to fetch hourly weather (${_.status})`):new Error(`Failed to fetch hourly weather (${_.status})`);return _.json()},staleTime:1e3*60*10,...li})})}
24,[b?.segments,Ce,H]);const Ie=D.useMemo(()=>{if(!Et)return[];if(Et.isHistorical){const N=Et.weatherData,m=[],P=55+Math.random()*30,M=3+Math.random()*8,ht=29.7+Math.random()*.5,E=N.precipitation>5,C=N.weatherCode>2?70:N.weatherCode>0?40:15;for(let $=0;$<25;$++){const mt=$%12||12,et=$<12?"AM":"PM",dt=$===24?"12 AM":`${mt} ${et}`,ft=N.high-N.low;let it;$<=6?it=.1+$/6*.1:$<=15?it=.2+($-6)/9*.8:it=1-($-15)/9*.7;const W=Math.round(N.low+ft*it),pt=Math.round(Math.max(30,Math.min(100,P+(1-it)*25))),Wt=Math.round(W-(100-pt)/5),Xt=.6+($>=10&&$<=18?.4:0),At=Math.round(M*Xt),Mt=Math.round(At*(1.3+Math.random()*.5)),Pt=Math.sin($/24*Math.PI*2)*15,ve=Math.round(Math.max(0,Math.min(100,C+Pt)));let f=0;if($>=7&&$<=19){const Y=Math.sin(($-7)/12*Math.PI);f=Math.round(Y*(ve<50?8:4))}let k=E?N.precipitation:0;E&&(k=Math.round(N.precipitation*($>=14&&$<=20?1.2:.8)));const F=Math.round(Math.max(1,49-(pt>85?20:0)-(k>50?20:0))),lt=Math.sin($/24*Math.PI*2)*.1,xt=Math.round((ht+lt)*100)/100;let gt=W;W<50&&At>3?gt=Math.round(W-At*.5):W>80&&pt>60&&(gt=Math.round(W+(pt-60)*.15)),m.push({time:dt,hour:$===24?0:$,date:Et.dateISO||"",isPast:!1,isCached:!1,isEndMarker:$===24,isPredicted:!0,confidence:"low",temperature:W,feelsLike:gt,humidity:pt,dewPoint:Wt,precipitation:k,windSpeed:At,windGust:Mt,cloudCover:ve,visibility:F,uvIndex:f,pressure:xt,weatherCode:N.weatherCode})}return m}if(!qt?.hourly)return[];const o=qt.utcOffsetSeconds??0,u=new Date,h=u.getTime()+u.getTimezoneOffset()*6e4,_=new Date(h+o*1e3),w=`${_.getFullYear()}-${String(_.getMonth()+1).padStart(2,"0")}-${String(_.getDate()).padStart(2,"0")}`;return fr(Et.dateISO||"",qt.hourly,void 0,{locationTodayDate:w,utcOffsetSeconds:o})},[Et,qt,Xn]),jt=Ae.useRef(null);Ae.useEffect(()=>{Ne&&Ne!==jt.current&&(jt.current=Ne,console.error("[TripDetail] Hourly weather query failed:",Ne),O({title:"Couldn't load weather",description:b?.name?`Weather for "${b.name}" didn't come through. Tap retry to try again.`:"Weather data didn't come through. Tap retry to try again.",variant:"destructive"})),Ne||(jt.current=null)},[Ne,b?.name,O]);const Pe=Ae.useRef(null);if(Ae.useEffect(()=>{ge&&ge!==Pe.current&&(Pe.current=ge,console.error("[TripDetail] Insights query failed:",ge),O({title:"Couldn't load insights",description:"Personalized insights didn't come through. They'll retry in the background.",variant:"destructive"})),ge||(Pe.current=null)},[ge,O]),yn||ss||fi&&!b)return s.jsxs("div",{className:"h-full bg-background overflow-y-auto",children:[s.jsx(pr,{isLoading:!0,message:"Trip is taking longer than usual to load.",testId:"banner-loading-trip",onRetry:()=>{H.invalidateQueries({queryKey:["trip",l,!0]}),H.invalidateQueries({queryKey:["trip-insights",l]})}}),s.jsxs("div",{className:"max-w-4xl mx-auto w-full p-4 animate-pulse",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[s.jsx("div",{className:"h-8 w-8 bg-white/10 rounded-full"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("div",{className:"h-6 w-48 bg-white/10 rounded-lg mb-2"}),s.jsx("div",{className:"h-4 w-32 bg-white/10 rounded"})]})]}),s.jsxs("div",{className:"glass-card rounded-2xl p-4 mb-4",children:[s.jsxs("div",{className:"flex justify-between items-start mb-3",children:[s.jsxs("div",{children:[s.jsx("div",{className:"h-5 w-28 bg-white/10 rounded mb-2"}),s.jsx("div",{className:"h-4 w-40 bg-white/10 rounded"})]}),s.jsx("div",{className:"h-12 w-20 bg-white/10 rounded-xl"})]}),s.jsx("div",{className:"h-32 w-full bg-white/10 rounded-xl mb-3"}),s.jsx("div",{className:"flex gap-2",children:Array.from({length:7}).map((o,u)=>s.jsxs("div",{className:"flex flex-col items-center gap-1 flex-1",children:[s.jsx("div",{className:"h-3 w-8 bg-white/10 rounded"}),s.jsx("div",{className:"h-6 w-6 bg-white/10 rounded-full"}),s.jsx("div",{className:"h-3 w-6 bg-white/10 rounded"})]},u))})]}),s.jsx("div",{className:"space-y-3",children:Array.from({length:3}).map((o,u)=>s.jsxs("div",{className:"glass-card rounded-xl p-3",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx("div",{className:"h-4 w-4 bg-white/10 rounded"}),s.jsx("div",{className:"h-4 w-32 bg-white/10 rounded"})]}),s.jsx("div",{className:"h-3 w-48 bg-white/10 rounded"})]},u))})]})]});if(!b&&!fi)return s.jsx("div",{className:"h-full flex items-center justify-center overflow-y-auto",children:s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Trip not found"}),s.jsx(rn,{href:"/",children:s.jsx(Qt,{children:"Go Home"})})]})});if(!b)return null;const Fe=b.preferences?.routeStops||[],ei=new Map,Ni=new Map;Fe.forEach(o=>{o.id&&ei.set(o.id,o.isHome===!0),o.name&&o.isHome===!0&&Ni.set(o.name,!0)});const ii=b.preferences?.hasReturnTrip===!0||Fe.some(o=>o.isHome===!0),ni=(b.segments?.flatMap((o,u)=>{let h=ei.get(o.id)===!0;return!h&&o.destination&&(h=Ni.has(o.destination)),ii&&h?[]:(o.weather||[]).map((_,w)=>
24({..._,segmentStartDate:o.startDate,segmentDayIndex:w,destination:o.destination,segmentIdx:u,isHomeSegment:h}))})||[]).map((o,u)=>({...o,index:u})),gi=bi(),Vi=o=>{if(o.dateISO){const u=Yt(o.dateISO);if(!isNaN(u.getTime()))return u<gi}if(o.segmentStartDate!==void 0&&o.segmentDayIndex!==void 0){const u=Yt(o.segmentStartDate);if(!isNaN(u.getTime())){const h=new Date(u);return h.setUTCDate(h.getUTCDate()+o.segmentDayIndex),h<gi}}return!1},_e=(Dt?ni:ni.filter(o=>!Vi(o))).map((o,u)=>({date:o.date,dateISO:o.dateISO,segmentStartDate:o.segmentStartDate,segmentDayIndex:o.segmentDayIndex,destination:o.destination,segmentIdx:o.segmentIdx,temp:Ft(o.temperature,I),high:Ft(o.temperatureMax,I),low:Ft(o.temperatureMin,I),precipitation:(o.precipitation||0)*(o.precipitation>1?1:100),weatherCode:o.weatherCode||0,windSpeedMax:o.windSpeedMax||0,index:u})).slice(0,14),Ki=_e.reduce((o,u,h)=>(h===0||u.segmentIdx!==_e[h-1]?.segmentIdx?o.push({index:o.length,destination:u.destination||"",startIdx:h,endIdx:h}):o.length>0&&(o[o.length-1].endIdx=h),o),[]),Tn=o=>{const h=bi().toISOString().split("T")[0];if(o.dateISO){if(o.dateISO===h)return"Today";const _=Yt(o.dateISO);if(!isNaN(_.getTime()))return _.toLocaleDateString("en-US",{weekday:"short",timeZone:"UTC"})}if(o.segmentStartDate!==void 0&&o.segmentDayIndex!==void 0){const _=Yt(o.segmentStartDate);if(!isNaN(_.getTime())){const w=new Date(_);return w.setUTCDate(w.getUTCDate()+o.segmentDayIndex),w.toISOString().split("T")[0]===h?"Today":w.toLocaleDateString("en-US",{weekday:"short",timeZone:"UTC"})}}return""};Lt.find(o=>o.id===ce)||Lt[0];const G=b.segments?.[0],he=b.segments?.[b.segments.length-1],Q=yo(b,b.segments);let Pi="";if(G&&he){const o=Ze(G.startDate,{month:"short",day:"numeric"}),u=Ze(he.endDate,{month:"short",day:"numeric"});if(Q.isSingleDayEvent&&Q.eventDate){const h=Ze(Q.eventDate,{weekday:"short",month:"short",day:"numeric"}),_=bo(Q.eventTime);Pi=_?`${h} · ${_}`:h}else Pi=`${o} - ${u}`}const _i=bi(),Li=(o,u,h)=>{if(o.dateISO){const w=Yt(o.dateISO);if(!isNaN(w.getTime()))return w<_i}const _=Yt(u);if(!isNaN(_.getTime())){const w=new Date(_);return w.setUTCDate(w.getUTCDate()+h),w<_i}return!1},Yi=b.segments?.some(o=>{const u=Yt(o.startDate);return!isNaN(u.getTime())&&u<_i})??!1,He=()=>{if(Tt===null||!_e[Tt])return"";const o=_e[Tt],u=o.dateISO||o.date;return u?new Date(u+(u.includes("T")?"":"T12:00:00")).toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric"}):Tn(o)};return s.jsxs("div",{className:"h-full flex flex-col bg-background text-foreground relative font-sans overflow-hidden",children:[s.jsx("div",{className:"page-bg-image fixed inset-0 z-0 pointer-events-none",style:{backgroundImage:`url(${gr})`,backgroundSize:"cover",backgroundPosition:"center",opacity:.3}}),s.jsxs(_r,{children:[s.jsx(vr,{title:b.name,subtitle:Pi,showBack:!1,showAiButton:!0,isAiExpanded:q,tips:xr,onToggleAi:()=>St(!q),rightContent:s.jsx("div",{className:"flex items-center gap-1",children:bt?s.jsxs(s.Fragment,{children:[s.jsx(Qt,{variant:"ghost",size:"icon",className:"btn-theme-ghost text-red-600 dark:text-red-400",onClick:Hi,"data-testid":"button-cancel-edit",children:s.jsx(Vs,{className:"h-5 w-5"})}),s.jsx(Qt,{variant:"ghost",size:"icon",className:"btn-theme-ghost text-green-600 dark:text-green-400",onClick:Wi,disabled:be,"data-testid":"button-save-edit",children:s.jsx(Fr,{className:"h-5 w-5"})})]}):s.jsx(Qt,{variant:"ghost",size:"icon",className:"btn-theme-ghost",onClick:R,"data-testid":"button-edit",children:s.jsx(An,{className:"h-5 w-5"})})})}),s.jsx(yr,{context:{location:b.segments?.[0]?.destination||b.name,conditions:[],tripName:b.name,activity:b.activity||void 0,eventInfo:Q.isEvent?{isSingleDayEvent:Q.isSingleDayEvent,eventDate:Q.eventDate,eventTime:Q.eventTime}:void 0},isExpanded:q})]}),s.jsx(br,{children:s.jsxs("div",{className:"relative z-10 max-w-4xl mx-auto px-4 sm:px-6 pb-24 overflow-x-hidden",children:[(()=>{const o=b?.segments||[],u=o[0]?.startDate?new Date(o[0].startDate):null;o[o.length-1]?.endDate&&new Date(o[o.length-1].endDate);const h=u?Math.round((u.getTime()-Date.now())/864e5):0,_=b?.preferences||{},w=Array.isArray(_.routeStops)?_.routeStops.some($=>
24$.stopType==="overnight"&&!$.isHome):!1,N=o.some($=>!!$?.destination),m=w||N,P=$=>$.split("T")[0],M=o[0]?.startDate?P(o[0].startDate):null,ht=o[o.length-1]?.endDate?P(o[o.length-1].endDate):null,E=M&&ht?Math.max(0,Math.round((new Date(ht+"T00:00:00Z").getTime()-new Date(M+"T00:00:00Z").getTime())/864e5)):0,C=!b?.activity?.trim();return s.jsxs("div",{className:"mt-4 space-y-2",children:[E>=1&&!m&&s.jsx(Ai,{hintKey:"trip-detail-no-overnight",children:"This trip includes at least one overnight, but no overnight stop is marked. Edit your trip to add one so we can plan packing and weather alerts per night."}),h>5&&s.jsx(Ai,{hintKey:"trip-detail-departure-5-days",children:"Your trip is more than 5 days out — the forecast confidence is still loose. We'll sharpen it as the date gets closer."}),C&&s.jsx(Ai,{hintKey:"trip-detail-no-activity-description",children:"Add an activity (golf, beach, wedding…) so packing tips and weather verdicts get tailored to what you're doing."})]})})(),Tt!==null&&Ie.length>0&&s.jsx("div",{className:"mt-4",children:s.jsx(wr,{data:Ie,selectedMetric:ee,onMetricChange:hi,tempSymbol:B,windSymbol:at,title:He(),showPredictedIndicator:Et?.isHistorical,chartId:"trip-hourly"})}),Tt!==null&&os&&s.jsx("div",{className:"glass-card rounded-2xl p-6 mb-4 flex items-center justify-center",children:s.jsx("div",{className:"text-sm opacity-60",children:"Loading hourly data..."})}),!bt&&_e.length>0&&s.jsx("div",{className:"glass-card rounded-2xl p-2 sm:p-3 mb-4",children:s.jsx("div",{className:"flex gap-3 sm:gap-2 overflow-x-auto scrollbar-hide pb-1",children:_e.map((o,u)=>{const h=Gs(o.weatherCode,o.precipitation||0),_=Ks(o.windSpeedMax),w=Tt===u,N=Tn(o),m=o.destination?.split(",")[0]||"";return s.jsxs("button",{onClick:()=>Wn(w?null:u),className:`flex flex-col items-center gap-0.5 min-w-[52px] sm:min-w-0 sm:flex-1 text-center px-2 py-2 rounded-xl transition-all ${w?"bg-theme-highlight ring-1 ring-theme-highlight ring-inset":"bg-theme-hover cursor-pointer"}`,"data-testid":`button-trip-day-${u}`,children:[s.jsx("span",{className:`text-xs text-theme-secondary ${w?"opacity-100 font-medium":"opacity-70"}`,children:N}),s.jsxs("div",{className:"relative",children:[s.jsx(h,{className:"h-6 w-6 sm:h-5 sm:w-5 text-theme-primary"}),_&&s.jsx(_.icon,{className:`absolute -bottom-1 -right-1 h-3 w-3 ${_.isVeryWindy?"text-orange-400":"text-sky-400"}`})]}),s.jsxs("span",{className:`font-bold text-sm sm:text-xs text-theme-primary ${w?"":"opacity-90"}`,children:[Math.round(o.high),B]}),s.jsxs("span",{className:"text-xs sm:text-[10px] text-theme-low-temp",children:[Math.round(o.low),B]}),Ki.length>1&&s.jsx("span",{className:"text-[10px] opacity-50 truncate max-w-[56px]",children:m})]},u)})})}),Tt!==null&&_e[Tt]&&s.jsx("div",{className:"mb-4",children:s.jsx(Tr,{dailyData:_e[Tt],tempUnit:I==="celsius"?"C":"F",precipUnit:"in",windUnit:z==="metric"?"km/h":"mph",tempsAlreadyConverted:!0,destination:_e[Tt].destination?.split(",")[0],userPreferences:yt?{tooColdTemp:yt.tooColdTemp??void 0,tooHotTemp:yt.tooHotTemp??void 0,healthSensitivities:yt.healthSensitivities??void 0,activities:yt.activities??void 0}:void 0})}),ie&&!bt&&!b?.activity&&!(b?.preferences?.dateActivities&&Object.keys(b.preferences.dateActivities).length>0)&&s.jsx("div",{className:"glass-card rounded-2xl p-6 mb-6","data-testid":"section-comfort-suitability",children:(()=>{const o=ni.slice(0,14).map(m=>Ys({high:m.temperatureMax,low:m.temperatureMin,precipProbability:m.precipitation,windSpeedMaxMph:m.windSpeedMax,uvIndexMax:m.uvIndexMax,weatherCode:m.weatherCode},{tooColdTemp:yt?.tooColdTemp??void 0,tooHotTemp:yt?.tooHotTemp??void 0,healthSensitivities:yt?.healthSensitivities||[]})),u={excellent:10,good:8,fair:5,challenging:3,poor:1},h=o.filter(m=>m!==null),_=h.length>0?Math.round(h.reduce((m,P)=>m+(u[P]||5),0)/h.length):null,w=_!==null?_>=9?"excellent":_>=7?"good":_>=5?"fair":_>=3?"challenging":"poor":null,N=No(o,ni.slice(0,14));return s.jsxs("div",{className:"space-y-4",children:[s.jsx(Js,{className:"mb-1"}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(nn,{size:"md"}),s.jsx("h3",{className:"font-bold",children:"Zeph's take"}),s.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-gradient-to-r from-amber-500 to-yellow-400 text-amber-950 font-bold shadow-sm ring-1 ring-amber-700/40",children:"PRO"})]}),w&&s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-theme-card flex items-center justify-center",children:s.jsx("span",{className:`text-lg font-bold ${zn(w)}`,children:_})}),s.jsx("span",{className:`text-sm font-semibold capitalize ${zn(w)}`,children:w})]})]}),N&&w&&s.jsxs("div",{className:`rounded-xl px-4 py-3 border ${_a(w)}`,"data-testid":"verdict-banner-comfort",children:[s.jsx("p",{className:`text-sm font-medium ${ga(w)}`,children:N}),s.jsx(Xs,{className:"mt-2"})]}),s.jsx("p",{className:"text-sm opacity-70",children:"Based on your comfort preferences. Add activities below for Zeph to tailor the suitability analysis."}),y&&!Je&&s.jsxs("button",{onClick:Ui,className:"flex items-center gap-2 text-sm text-primary hover:text-primary/80 transition-colors","data-testid":"button-add-activities-nudge",children:[s.jsx(Qs,{className:"h-4 w-4"}),"Add activities for personalized insights"]}),Je&&s.jsxs("div",{className:"space-y-3 pt-2 border-t border-theme",children:[s.jsx("p",{className:"text-xs opacity-50 font-medium uppercase tracking-wider",children:"What will you be doing?"}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>{Oe("whole-trip"),ze("")},className:`text-[10px] px-2 py-0.5 rounded-full border transition-all ${ke==="whole-trip"?"bg-primary/10 text-primary border-primary/20":"bg-transparent opacity-50 border-theme hover:opacity-80"}`,"data-testid":"scope-whole-trip",children:"Whole trip"}),s.jsx("button",{onClick:()=>{Oe("specific-date"),!ae&&we.length>0&&ze(we[0])},className:`text-[10px] px-2 py-0.5 rounded-full border transition-all ${ke==="specific-date"?"bg-primary/10 text-primary border-primary/20":"bg-transparent opacity-50 border-theme hover:opacity-80"}`,"data-testid":"scope-specific-date",children:"Specific date"})]}),ke==="specific-date"&&we.length>0&&s.jsx("select",{value:ae,onChange:m=>ze(m.target.value),className:"text-sm rounded-lg border border-theme bg-theme-card px-3 py-1.5 flex-1 min-w-[140px]","data-testid":"select-activity-date",children:we.map(m=>{const M=new Date(m+"T12:00:00").toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"});return s.jsx("option",{value:m,children:M},m)})})]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:On.map(m=>s.jsx("button",{onClick:()=>vi(P=>P.includes(m.id)?P.filter(M=>M!==m.id):[...P,m.id]),className:`px-3 py-1.5 rounded-full text-xs font-medium transition-all ${ui.includes(m.id)?"bg-primary text-white shadow-md":"bg-theme-card border border-theme hover:border-primary/50"}`,"data-testid":`activity-tag-${m.id}`,children:m.label},m.id))}),s.jsx(sn,{type:"text",placeholder:"Or describe your activity...",value:pe,onCh
24ange:m=>di(m.target.value),className:"h-10 glass bg-transparent border-theme text-sm","data-testid":"input-inline-activity"}),s.jsx(Ai,{hintKey:"trip-detail-activity-desc",children:'The more specific you are (e.g. "outdoor wedding 2pm"), the smarter the packing and weather tips get.'}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Qt,{size:"sm",onClick:$i,disabled:mi||ui.length===0&&!pe.trim(),className:"bg-primary text-white","data-testid":"button-save-inline-activity",children:mi?"Saving...":"Save & Analyze"}),s.jsx(Qt,{size:"sm",variant:"ghost",onClick:()=>Xe(!1),"data-testid":"button-cancel-inline-activity",children:"Cancel"})]})]})]})})()}),rt&&(!!b?.activity||b?.preferences?.dateActivities&&Object.keys(b.preferences.dateActivities).length>0)&&s.jsxs("div",{className:"glass-card rounded-2xl p-6 mb-6","data-testid":"section-activity-suitability",children:[s.jsx(Js,{className:"mb-3"}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(nn,{size:"md"}),s.jsx("h3",{className:"font-bold",children:"Zeph's take"}),s.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-gradient-to-r from-amber-500 to-yellow-400 text-amber-950 font-bold shadow-sm ring-1 ring-amber-700/40",children:"PRO"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("div",{className:"w-8 h-8 rounded-full bg-theme-card flex items-center justify-center",children:s.jsx("span",{className:`text-lg font-bold ${zn(rt.weatherSuitability.verdict)}`,children:rt.weatherSuitability.score})}),s.jsx("span",{className:`text-sm font-semibold capitalize ${zn(rt.weatherSuitability.verdict)}`,children:rt.weatherSuitability.verdict})]}),s.jsx("button",{onClick:()=>ln(!fe),className:"p-1 hover:opacity-80 transition-opacity",children:s.jsx(ye,{className:`h-4 w-4 opacity-50 transition-transform ${fe?"rotate-180":""}`})})]})]}),s.jsxs("div",{className:`rounded-xl px-4 py-3 border mt-3 ${_a(rt.weatherSuitability.verdict)}`,"data-testid":"verdict-banner-activity",children:[s.jsx("p",{className:`text-sm font-medium ${ga(rt.weatherSuitability.verdict)}`,children:So(rt.weatherSuitability,rt.activityType,b?.preferences?.dateActivities,Q.isEvent?{isSingleDayEvent:Q.isSingleDayEvent,eventDate:Q.eventDate,eventTime:Q.eventTime}:void 0)}),s.jsx(Xs,{className:"mt-2"})]}),fe&&s.jsxs(s.Fragment,{children:[(b?.activity||b?.preferences?.dateActivities)&&s.jsxs("div",{className:"mt-4 mb-3 space-y-2",children:[b?.activity&&s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"text-xs opacity-50",children:"For:"}),b.activity.split(/[,;]/).map((o,u)=>o.trim()).filter(o=>o).map((o,u)=>s.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-primary/10 text-primary border border-primary/20",children:o},u)),y&&!Je&&s.jsx("button",{onClick:Ui,className:"text-xs text-primary/60 hover:text-primary transition-colors ml-1","data-testid":"button-edit-activities",children:s.jsx(An,{className:"h-3 w-3"})})]}),b?.preferences?.dateActivities&&Object.entries(b.preferences.dateActivities).length>0&&s.jsx("div",{className:"space-y-1",children:Object.entries(b.preferences.dateActivities).map(([o,u])=>{const h=new Date(o+"T12:00:00"),_=isNaN(h.getTime())?o:h.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"});return s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-400 border border-blue-500/20",children:_}),String(u).split(/[,;]/).map(w=>w.trim()).filter(w=>w).map((w,N)=>s.jsx("span",{className:"text-xs px-2 py-0.5 rounded-full bg-primary/10 text-primary border border-primary/20",children:w},N))]},o)})})]}),Je&&s.jsxs("div",{className:"space-y-3 mb-4 p-3 rounded-xl bg-theme-card border border-theme",children:[s.jsx("p",{className:"text-xs opacity-50 font-medium uppercase tracking-wider",children:"Update Activities"}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>{Oe("whole-trip"),ze("")},className:`text-[10px] px-2 py-0.5 rounded-full border transition-all ${ke==="whole-trip"?"bg-primary/10 text-primary border-primary/20":"bg-transparent opacity-50 border-theme hover:opacity-80"}`,"data-testid":"scope-whole-trip-edit",children:"Whole trip"}),s.jsx("button",{onClick:()=>{Oe("specific-date"),!ae&&we.length>0&&ze(we[0])},className:`text-[10px] px-2 py-0.5 rounded-full border transition-all ${ke==="specific-date"?"bg-primary/10 text-primary border-primary/20":"bg-transparent opacity-50 border-theme hover:opacity-80"}`,"data-testid":"scope-specific-date-edit",children:"Specific date"})]}),ke==="specific-date"&&we.length>0&&s.jsx("select",{value:ae,onChange:o=>ze(o.target.value),className:"text-sm rounded-lg border border-theme bg-theme-card px-3 py-1.5 flex-1 min-w-[140px]","data-testid":"select-activity-date-edit",children:we.map(o=>{const h=new Date(o+"T12:00:00").toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"});return s.jsx("option",{value:o,children:h},o)})})]}),s.jsx("div",{className:"flex flex-wrap gap-2",children:On.map(o=>s.jsx("button",{onClick:()=>vi(u=>u.includes(o.id)?u.filter(h=>h!==o.id):[...u,o.id]),className:`px-3 py-1.5 rounded-full text-xs font-medium transition-all ${ui.includes(o.id)?"bg-primary text-white shadow-md":"bg-theme-subtle border border-theme hover:border-primary/50"}`,"data-testid":`activity-tag-edit-${o.id}`,children:o.label},o.id))}),s.jsx(sn,{type:"text",placeholder:"Or describe your activity...",value:pe,onCh
24ange:o=>di(o.target.value),className:"h-10 glass bg-transparent border-theme text-sm","data-testid":"input-inline-activity-edit"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Qt,{size:"sm",onClick:$i,disabled:mi||ui.length===0&&!pe.trim(),className:"bg-primary text-white","data-testid":"button-save-activity-edit",children:mi?"Saving...":"Save & Re-analyze"}),s.jsx(Qt,{size:"sm",variant:"ghost",onClick:()=>Xe(!1),"data-testid":"button-cancel-activity-edit",children:"Cancel"})]})]}),rt.weatherSuitability.highlights&&rt.weatherSuitability.highlights.length>0?s.jsxs("div",{className:"space-y-4 mt-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider opacity-50",children:"Highlights"}),s.jsx("ul",{className:"space-y-1",children:rt.weatherSuitability.highlights.map((o,u)=>s.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[s.jsx(Sr,{className:"h-4 w-4 text-emerald-600 dark:text-emerald-400 flex-shrink-0 mt-0.5"}),s.jsx("span",{className:"opacity-80",children:o})]},u))})]}),rt.weatherSuitability.concerns.length>0&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider opacity-50",children:"Concerns"}),s.jsx("ul",{className:"space-y-1",children:rt.weatherSuitability.concerns.map((o,u)=>s.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[s.jsx(ps,{className:"h-4 w-4 text-orange-600 dark:text-orange-400 flex-shrink-0 mt-0.5"}),s.jsx("span",{className:"opacity-80",children:o})]},u))})]})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-sm opacity-80 mb-4 mt-4",children:rt.weatherSuitability.explanation}),rt.weatherSuitability.concerns.length>0&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider opacity-50",children:"Concerns"}),s.jsx("ul",{className:"space-y-1",children:rt.weatherSuitability.concerns.map((o,u)=>s.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[s.jsx(ps,{className:"h-4 w-4 text-orange-600 dark:text-orange-400 flex-shrink-0 mt-0.5"}),s.jsx("span",{className:"opacity-80",children:o})]},u))})]})]}),!Q.isSingleDayEvent&&rt.weatherSuitability.bestDays&&rt.weatherSuitability.bestDays.length>0&&s.jsxs("div",{className:"space-y-2 mt-4",children:[s.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider opacity-50",children:"Best Days"}),s.jsx("div",{className:"flex flex-wrap gap-2",children:rt.weatherSuitability.bestDays.map((o,u)=>{const h=new Date(o+"T12:00:00"),_=isNaN(h.getTime())?o:h.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"});return s.jsx("span",{className:"text-xs px-2 py-1 rounded-full bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20",children:_},u)})})]})]})]}),rs&&ie&&!rt&&s.jsx("div",{className:"glass-card rounded-2xl p-6 mb-6",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"h-5 w-5 border-2 border-primary border-t-transparent rounded-full animate-spin"}),s.jsx("span",{className:"text-sm opacity-70",children:"Analyzing your trip with AI..."})]})}),!bt&&s.jsxs("div",{className:"space-y-6 mb-6",children:[Yi&&s.jsxs("div",{className:"flex items-center justify-between px-1 pb-2 border-b border-theme",children:[s.jsx(ri,{htmlFor:"show-past-days",className:"text-sm opacity-70 cursor-pointer",children:"Show past days"}),s.jsx(ma,{id:"show-past-days",checked:Dt,onCheckedChange:Ye,"data-testid":"switch-show-past-days"})]}),(()=>{let o=0;const u=new Map,h=new Map;return Fe.forEach(w=>{w.id&&u.set(w.id,w.isHome===!0),w.name&&w.isHome===!0&&h.set(w.name,!0)}),(b.segments?.filter(w=>{let N=u.get(w.id)===!0;return!N&&w.destination&&(N=h.has(w.destination)),!(ii&&N)})||[]).map((w,N)=>{const m=Ze(w.startDate,{month:"short",day:"numeric"}),P=Ze(w.endDate,{month:"short",day:"numeric"}),M=w.weather?.map((E,C)=>({...E,originalIdx:C}))||[],ht=Dt?M:M.filter(E=>!Li(E,w.startDate,E.originalIdx));return o+=w.weather?.length||0,!Dt&&ht.length===0?null:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between px-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ta,{className:"h-4 w-4 opacity-70"}),s.jsx("h3",{className:"font-bold","data-testid":`text-segment-destination-${N}`,children:oi(w.destination)})]}),s.jsxs("span",{className:"text-xs opacity-60",children:[m," - ",P]})]}),s.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:-mx-6 sm:px-6",children:s.jsx("div",{className:"flex gap-3 pb-2 w-max",children:ht.map((E,C)=>{const $=Gs(E.weatherCode,E.precipitation||0),mt=Ks(E.windSpeedMax||0),et=Li(E,w.startDate,E.originalIdx),dt=new Date;dt.setHours(0,0,0,0);let ft=null;if(E.dateISO){const At=Yt(E.dateISO);isNaN(At.getTime())||(ft=At)}if(!ft){const At=Yt(w.startDate),Mt=E.segmentDayIndex??E.originalIdx??C;!isNaN(At.getTime())&&typeof Mt=="number"&&(ft=new Date(At),ft.setUTCDate(ft.getUTCDate()+Mt))}const it=ft?Math.ceil((ft.getTime()-dt.getTime())/(1e3*60*60*24)):999,W=ft!==null&&it>=0&&it<=14,pt=ft&&!isNaN(ft.getTime())?ft.toLocaleDateString("en-US",{weekday:"short",timeZone:"UTC"}):null;if(!W&&!j&&!S&&!V(l))return s.jsx(rn,{href:"/upgrade",children:s.jsxs("div",{className:`glass-card p-3 rounded-xl min-w-[100px] flex flex-col items-center gap-1.5 cursor-pointer hover:opacity-80 ${et?"opacity-60":""}`,"data-testid":`weather-day-${N}-${C}`,children:[s.jsxs("span",{className:"text-xs opacity-70",children:[pt&&s.jsxs("span",{className:"font-medium",children:[pt," "]}),E.date]}),s.jsx("div",{className:"h-6 w-6 my-1 opacity-30 blur-[2px]",children:s.jsx($,{className:"h-6 w-6"})}),s.jsx("div",{className:"flex items-center gap-1.5 opacity-30 blur-[2px]",children:s.jsx("span",{className:"font-bold text-base",children:"--°"})}),s.jsx("span",{className:"text-[10px] opacity-30 blur-[2px] truncate w-full text-center",children:E.condition}),E.precipitation>0&&s.jsxs("span",{className:"inline-flex items-center gap-0.5 text-[10px] text-sky-400 opacity-30 blur-[2px]",children:[s.jsx(ea,{className:"h-2.5 w-2.5"}),Math.round(E.precipitation),"%"]}),s.jsxs("span",{className:"inline-flex items-center gap-0.5 bg-gradient-to-r from-amber-500 to-yellow-400 text-amber-950 text-[9px] font-bold px-1.5 py-0.5 rounded-full mt-0.5 shadow-sm ring-1 ring-amber-700/40",children:[s.jsx(ya,{className:"h-2.5 w-2.5 fill-current"}),"Pro"]})]})},C);const Xt=yt?Ys({high:E.temperatureMax,low:E.temperatureMin,precipProbability:E.precipitation,windSpeedMaxMph:E.windSpeedMax,uvIndexMax:E.uvIndexMax,weatherCode:E.weatherCode},{tooColdTemp:yt.tooColdTemp??void 0,tooHotTemp:yt.tooHotTemp??void 0,healthSensitivities:yt.healthSensitivities??void 0}):null;return s.jsxs("div",{className:`glass-card p-3 rounded-xl min-w-[100px] flex flex-col items-center gap-1.5 overflow-hidden relative ${et?"opacity-60":""}`,"data-testid":`weather-day-${N}-${C}`,children:[Xt&&s.jsx("div",{className:`absolute top-0 left-0 right-0 h-[3px] rounded-t-xl ${Nr(Xt)}`}),s.jsxs("span",{className:"text-xs opacity-70",children:[pt&&s.jsxs("span",{className:"font-medium",children:[pt," "]}),E.date]}),s.jsxs("div",{className:"relative my-1",children:[s.jsx($,{className:"h-6 w-6"}),mt&&s.jsx(mt.icon,{className:`absolute -bottom-1 -right-1 h-3 w-3 ${mt.isVeryWindy?"text-orange-400":"text-sky-400"}`})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs("span",{className:"font-bold text-base text-theme-high-temp",children:[Ft(E.temperatureMax,I),B]}),s.jsx("span",{className:"text-xs opacity-40",children:"/"}),s.jsxs("span",{className:"font-medium text-sm text-theme-low-temp",children:[Ft(E.temperatureMin,I),B]})]}),s.jsx("span",{className:"text-[10px] opacity-60 truncate w-full text-center",children:E.condition}),E.precipitation>0&&s.jsxs("span",{className:"inline-flex items-center gap-0.5 text-[10px] text-sky-400 opacity-80",children:[s.jsx(ea,{className:"h-2.5 w-2.5"}),Math.round(E.precipitation),"%"]}),s.jsx("span",{className:`text-[9px] px-1.5 py-0.5 rounded-full font-medium mt
24-0.5 ${W?"bg-sky-500/20 text-sky-600 dark:text-sky-400":"bg-amber-500/20 text-amber-600 dark:text-amber-400"}`,children:W?"Forecast":"Predicted"})]},C)})})})]},N)})})()]}),!bt&&(b.hasHistoricalWeather||rt?.isHistorical)&&s.jsx("div",{className:"mb-6 glass-card rounded-2xl p-4 border border-yellow-500/30 bg-yellow-500/10",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Pr,{className:"h-5 w-5 text-yellow-600 dark:text-yellow-400 flex-shrink-0 mt-0.5"}),s.jsxs("div",{children:[s.jsx("h4",{className:"font-semibold text-yellow-700 dark:text-yellow-300 text-sm",children:"Predicted Weather"}),s.jsx("p",{className:"text-xs text-yellow-600/80 dark:text-yellow-200/80 mt-1",children:b.historicalDisclaimer||rt?.disclaimer||"Days marked Predicted use historical averages. Forecasts replace predictions 14 days before your trip."})]})]})}),b.travelMode==="driving"&&b.preferences?.routeStops&&b.preferences.routeStops.length>0&&!bt&&(()=>{const o=b.preferences.routeStops,h=b.segments?.[0]?.startDate,_=b.departureTime||"08:00",[w,N]=_.split(":").map(Number);let m;if(h){const[f,k,F]=h.split("T")[0].split("-").map(Number);m=new Date(f,k-1,F,w||8,N||0,0,0)}const P=Jt?.legDurations||[],M=7200,ht=[];let E=m?new Date(m):void 0;for(let f=0;f<o.length;f++)if(E){const k=o[f],F=P[f]||M;if(E=new Date(E.getTime()+F*1e3),ht.push(new Date(E)),k.stopType==="quick")E=new Date(E.getTime()+(k.quickDuration||30)*60*1e3);else{const lt=k.stayDays||1;E.setDate(E.getDate()+lt);const[xt,gt]=(k.departureTime||"09:00").split(":").map(Number);E.setHours(xt||9,gt||0,0,0)}}else ht.push(void 0);const C=[];b.originLatitude&&b.originLongitude&&C.push([parseFloat(b.originLatitude),parseFloat(b.originLongitude)]),o.forEach(f=>{f.latitude&&f.longitude&&C.push([parseFloat(f.latitude),parseFloat(f.longitude)])});const $=new Date,mt=`${$.getFullYear()}-${String($.getMonth()+1).padStart(2,"0")}-${String($.getDate()).padStart(2,"0")}`,et=b.segments?.some(f=>f.endDate>=mt);b.originLatitude&&b.originLongitude;const dt=[];if(b.originName){const f=o.find(k=>k.stopType!=="quick");dt.push({value:-1,label:`${oi(b.originName)} → ${oi(f?f.name:o[0]?.name||"")}`,drivingDate:m})}o.filter(f=>f.stopType!=="quick"&&!f.isEndOfTrip).forEach(f=>{const k=o.findIndex(gt=>gt===f),F=o.slice(k+1).find(gt=>gt.stopType!=="quick");if(!F)return;const lt=ht[k];let xt;lt&&(xt=new Date(lt),xt.setDate(xt.getDate()+(f.stayDays||1))),dt.push({value:k,label:`${oi(f.name)} → ${oi(F.name)}`,drivingDate:xt})});const ft=(()=>{const f=new Date;f.setHours(0,0,0,0);for(const k of dt)if(k.drivingDate&&k.drivingDate>=f)return k.value;return dt.length>0?dt[dt.length-1].value:-1})(),it=Ri??ft,pt=(f=>{const k=new Set;if(f===-1)for(let F=0;F<o.length&&(k.add(F),o[F].stopType==="quick");F++);else{k.add(f);for(let F=f+1;F<o.length&&(k.add(F),o[F].stopType==="quick");F++);}return k})(it),Wt=Jt?.coordinateLatLngs,Xt=o.map(f=>{if(!Wt||!f?.latitude||!f?.longitude)return-1;const k=parseFloat(f.latitude),F=parseFloat(f.longitude);if(!Number.isFinite(k)||!Number.isFinite(F))return-1;let lt=-1,xt=1/0;for(let gt=1;gt<Wt.length;gt++){const Y=Math.abs(Wt[gt][0]-k)+Math.abs(Wt[gt][1]-F);Y<xt&&(xt=Y,lt=gt)}return xt<.05?lt:-1}),At=f=>{const k=Y=>Math.max(1,Y+1);if(f===-1){const Y=o.findIndex(X=>X.stopType!=="quick"),nt=Y>=0?Y:0,Ot=Xt[nt];return[0,Ot>=0?Ot:k(nt)]}const F=o.slice(f+1).findIndex(Y=>Y.stopType!=="quick"),lt=F>=0?f+1+F:f+1,xt=Xt[f],gt=Xt[lt];return[xt>=0?xt:f+1,gt>=0?gt:k(lt)]},[Mt,Pt]=At(it),ve=[];if(it===-1&&b.originLatitude&&b.originLongitude&&ve.push([parseFloat(b.originLatitude),parseFloat(b.originLongitude)]),pt.forEach(f=>{const k=o[f];k?.latitude&&k?.longitude&&ve.push([parseFloat(k.latitude),parseFloat(k.longitude)])}),it!==-1){const f=o[it];f?.latitude&&f?.longitude&&ve.unshift([parseFloat(f.latitude),parseFloat(f.longitude)])}return s.jsxs("div",{className:"glass-card rounded-2xl p-4 sm:p-6 mb-6",children:[s.jsxs("div",{className:"flex flex-col gap-4 mb-5",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("button",{className:"flex items-center gap-2 hover:opacity-80 transition-opacity",onClick:()=>vt(!wt),"data-testid":"button-toggle-route",children:[s.jsx(ia,{className:"h-5 w-5 text-sky-500"}),s.jsx("h3",{className:"font-bold text-lg",children:"Route Insights"}),S&&et&&s.jsx(na,{}
24),wt?s.jsx(gs,{className:"h-4 w-4 text-foreground/50"}):s.jsx(ye,{className:"h-4 w-4 text-foreground/50"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[b.departureTime&&s.jsxs("span",{className:"text-xs opacity-60 flex items-center gap-1 mr-2",children:[s.jsx(an,{className:"h-3 w-3"}),b.departureTime]}),wt&&s.jsxs("div",{className:"flex items-center bg-theme-card rounded-lg p-0.5",children:[s.jsx("button",{onClick:()=>Ut(!1),className:`p-2 rounded-md transition-colors ${Ht?"text-foreground/60 hover:text-foreground":"bg-sky-500 text-white"}`,"data-testid":"button-route-list-view",children:s.jsx(Jr,{className:"h-4 w-4"})}),s.jsx("button",{onClick:()=>Ut(!0),className:`p-2 rounded-md transition-colors ${Ht?"bg-sky-500 text-white":"text-foreground/60 hover:text-foreground"}`,"data-testid":"button-route-map-view",children:s.jsx(Lr,{className:"h-4 w-4"})})]})]})]}),wt&&dt.length>1&&s.jsx("select",{value:it,onChange:f=>dn(Number(f.target.value)),className:"w-full text-sm bg-theme-card border border-white/10 rounded-lg px-3 py-2 text-foreground focus:outline-none focus:border-sky-500/50 appearance-none",style:{backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")`,backgroundRepeat:"no-repeat",backgroundPosition:"right 12px center"},"data-testid":"select-route-leg",children:dt.map(f=>s.jsx("option",{value:f.value,children:f.label},f.value))}),wt&&!j&&!S&&et&&s.jsxs("div",{className:"flex items-center justify-between bg-gradient-to-r from-purple-500/10 to-sky-500/10 rounded-lg p-3 border border-purple-500/20",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(nn,{size:"sm"}),s.jsx("span",{className:"text-sm",children:"Get Zeph's weather insights for your route"})]}),s.jsx(sa,{compact:!0})]})]}),wt&&s.jsx(s.Fragment,{children:Ht&&C.length>0?s.jsxs("div",{className:"rounded-xl overflow-hidden h-[350px] sm:h-[400px] relative",children:[s.jsxs(vo,{center:C[0],zoom:6,style:{height:"100%",width:"100%"},scrollWheelZoom:!1,children:[s.jsx(xo,{attribution:'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),(()=>{let f=[];if(Se&&Jt?.geometry){const k=Jt.geometry.map(X=>[X[1],X[0]]),F=Jt.legDurations?.length||1,lt=Jt.legBoundaries;let xt=Array.isArray(lt)&&lt.length===F+1;if(xt)for(let X=0;X<lt.length;X++){if(!Number.isInteger(lt[X])||lt[X]<0||lt[X]>=k.length){xt=!1;break}if(X>0&&lt[X]<=lt[X-1]){xt=!1;break}}let gt,Y;const nt=X=>Number.isInteger(X)&&X>=0&&X<=F;if(xt&&nt(Mt)&&nt(Pt)&&Mt<Pt)gt=lt[Mt],Y=lt[Pt];else{const X=Math.max(0,Math.min(Mt,F-1)),Vt=Math.max(X+1,Math.min(Pt,F)),de=Math.floor(k.length/F);gt=X*de,Y=Vt>=F?k.length-1:Vt*de}let Ot=k.slice(gt,Y+1);if(Ot.length<2){const X=Math.max(0,Math.min(Mt,F-1)),Vt=Math.max(X+1,Math.min(Pt,F)),de=Math.max(1,Math.floor(k.length/F)),kt=Math.min(k.length-1,X*de),Bt=Vt>=F?k.length-1:Math.min(k.length-1,Vt*de);Ot=k.slice(kt,Bt+1)}f=Ot.length>=2?Ot:[]}return s.jsxs(s.Fragment,{children:[s.jsx(jo,{positions:ve.length>0?ve:C,polylinePositions:f}),Se&&Jt?.geometry?s.jsx(pa,{positions:f,color:"#0ea5e9",weight:4,opacity:.9}):s.jsx(pa,{positions:ve.length>1?ve:C,color:"#0ea5e9",weight:3,opacity:.7,dashArray:"10, 6"})]})})(),Jt?.waypointWeather?.filter(f=>f.legIndex>=Mt&&f.legIndex<Pt).map((f,k)=>{const F=f.temperature!==void 0?Ft(f.temperature,I):null,xt=(Y=>Y==null?"☁️":Y===0?"☀️":Y>=1&&Y<=3?"⛅":Y>=45&&Y<=48?"🌫️":Y>=51&&Y<=67?"🌧️":Y>=71&&Y<=77?"❄️":Y>=80&&Y<=82?"🌧️":Y>=85&&Y<=86?"🌨️":Y>=95?"⛈️":"☁️")(f.weatherCode),gt=f.formattedArrivalTime||"";return s.jsx(vs,{position:[f.latitude,f.longitude],icon:Zn.divIcon({className:"waypoint-weather-marker",html:`<div class="flex items-center gap-1 bg-white/90 dark:bg-gray-800/90 backdrop-blur-sm px-2 py-1 rounded-full shadow-md text-xs font-medium border border-gray-200 dark:border-gray-600">
25                              <span>${xt}</span>
26                              <span>${F!==null?`${F}${B}`:"--"}</span>
27                            </div>`,iconSize:[70,24],iconAnchor:[35,12]}),children:s.jsx(xs,{children:s.jsxs("div",{className:"text-sm",children:[s.jsx("p",{className:"font-medium",children:f.locationName||"En-route weather"}),gt&&s.jsx("p",{className:"text-xs text-gray-500",children:gt}),s.jsx("p",{children:f.condition||"Weather data"}),s.jsx("p",{className:"font-medium",children:F!==null?`${F}${B}`:"--"})]})})},`waypoint-${k}`)}),it===-1&&b.originLatitude&&b.originLongitude&&s.jsx(_s,{latitude:b.originLatitude,longitude:b.originLongitude,name:b.originName||"Origin",arrivalDateTime:m,tempUnit:I,tempSymbol:B,isOrigin:!0}),it!==-1&&(()=>{const f=o[it];return!f?.latitude||!f?.longitude?null:s.jsx(_s,{latitude:f.latitude,longitude:f.longitude,name:f.name,arrivalDateTime:ht[it],tempUnit:I,tempSymbol:B,stopInfo:`${f.stayDays||1} night${(f.stayDays||1)>1?"s":""}`})})(),o.map((f,k)=>{if(!f.latitude||!f.longitude||!pt.has(k))return null;const F=f.stopType==="quick",lt=ht[k];return s.jsx(_s,{latitude:f.latitude,longitude:f.longitude,name:f.name,arrivalDateTime:lt,tempUnit:I,tempSymbol:B,isQuickStop:F,stopInfo:F?`${f.quickDuration||30} min stop`:`${f.stayDays||1} night${(f.stayDays||1)>1?"s":""}`},k)})]}),Se&&!j&&!S&&s.jsx("div",{className:"absolute bottom-3 left-3 right-3 bg-gradient-to-r from-amber-500/95 to-orange-500/95 backdrop-blur-sm rounded-lg p-3 shadow-lg z-[1000]","data-testid":"info-premium-route",children:s.jsxs("div",{className:"flex items-center gap-2 text-white",children:[s.jsx(jr,{className:"h-4 w-4 shrink-0"}),s.jsxs("div",{className:"flex-1",children:[s.jsx("p",{className:"text-sm font-medium",children:"Unlock Smart Routing"}),s.jsx("p",{className:"text-xs opacity-90",children:"See actual driving routes and weather along the way"})]}),s.jsx(na,{})]})})]}):s.jsxs("div",{className:"space-y-3",children:[b.originName&&it===-1&&s.jsx("div",{className:"bg-green-500/15 dark:bg-green-500/10 rounded-xl p-4 border border-green-500/40 dark:border-green-500/25",children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:"w-10 h-10 rounded-full bg-green-500 flex items-center justify-center shrink-0 shadow-sm",children:s.jsx(ia,{className:"h-5 w-5 text-white"})}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-semibold text-foreground",children:oi(b.originName||"")}),h&&s.jsx("p",{className:"text-xs text-foreground/75","data-testid":"text-origin-date",children:new Date(h.split("T")[0]+"T12:00:00").toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}),s.jsx("p",{className:"text-sm text-foreground/85",children:"Starting point"})]}),b.originLatitude&&b.originLongitude&&s.jsx("div",{className:"shrink-0",children:s.jsx(va,{latitude:b.originLatitude,longitude:b.originLongitude,tempUnit:I,tempSymbol:B,arrivalDateTime:m})})]})})]})}),S&&Jt?.legInsights?.[0]&&it===-1&&(()=>{const f=Jt.legInsights[0],k=f.waypoints||[],F=un.has(0),lt=mn.has(0),xt=()=>{Qe(kt=>{const Bt=new Set(kt);return kt.has(0)?Bt.delete(0):Bt.add(0),Bt})},gt=()=>{fn(kt=>{const Bt=new Set(kt);return kt.has(0)?Bt.delete(0):Bt.add(0),Bt})},Y=b.departureTime||"09:00",[nt,Ot]=Y.split(":").map(Number),X=new Date(2e3,0,1,nt||9,Ot||0).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"}),Vt=ht[0],de=Vt?`~${Vt.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"})}`:"";return s.jsxs("div",{className:`rounded-xl p-3 border ml-7 ${f.isPassed?"bg-gray-500/15 border-gray-500/35":f.condition==="clear"?"bg-green-500/20 dark:bg-green-500/10 border-green-500/45 dark:border-green-500/25":f.condition==="caution"?"bg-yellow-500/25 dark:bg-yellow-500/10 border-yellow-500/55 dark:border-yellow-500/30":"bg-red-500/20 dark:bg-red-500/10 border-red-500/45 dark:border-red-500/25"}`,"data-testid":"card-leg-insight-0",children:[s.jsxs("button",{onClick:gt,className:"w-full flex items-center justify-between gap-2 text-left","data-testid":"button-toggle-conditions-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[f.isPassed?s.jsx(an,{className:"h-4 w-4 text-gray-400"}):s.jsxs(s.Fragment,{children:[f.condition==="clear"&&s.jsx(aa,{className:"h-4 w-4 text-green-400"}),f.condition==="caution"&&s.jsx(ra,{className:"h-4 w-4 text-theme-caution"}),f.condition==="hazardous"&&s.jsx(oa,{className:"h-4 w-4 text-red-400"})]}),s.jsx("span",{className:"text-xs font-medium capitalize",children:f.isPassed?"Passed Drive":`${f.condition==="hazardous"?"Hazardous":f.condition==="caution"?"Caution":"Clear"} Conditions`}),s.jsx(ye,{className:`h-3 w-3 opacity-50 transition-transform ${lt?"rotate-180":""}`})]}),s.jsx("span",{className:`text-xs font-medium ${f.isPassed?"text-gray-400":f.condition==="clear"?"text-green-400":f.condition==="caution"?"text-theme-caution":"text-red-400"}`,children:f.isPassed?f.savedAt?"Historical":"No Data":f.condition==="clear"?"Clear":f.condition==="caution"?"Caution":"Hazardous"})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs opacity-70 mt-1",children:[s.jsx(an,{className:"h-3 w-3"}),f.isPassed?s.jsxs("span",{children:["Departed ",X]}):s.jsxs(s.Fragment,{children:[s.jsxs("span",{children:["Departing ",X]}),de&&s.jsxs("span",{children:["• Arriving ",de]})]})]}),lt&&s.jsxs("div",{className:"mt-2 pt-2 border-t border-white/10",children:[s.jsx("p",{className:"text-xs text-theme-insight mb-1",children:f.summary}),f.alerts&&f.alerts.length>0&&s.jsx("div",{className:"text-xs space-y-0.5 mb-1",children:f.alerts.slice(0,2).map((kt,Bt)=>s.jsxs("div",{className:"flex items-start gap-1.5 text-theme-insight",children:[s.jsx("span",{children:"•"}),s.jsx("span",{children:kt})]},Bt))}),f.suggestion&&s.jsxs("div",{className:"text-xs bg-white/5 rounded p-2 mt-1",children:[s.jsx("span",{className:"font-medium",children:"Tip: "}),s.jsx("span",{className:"text-theme-insight",children:f.suggestion})]}),k.length>0&&s.jsxs("div",{className:"mt-2 pt-2 border-t border-white/10",children:[s.jsxs("button",{onClick:kt=>{kt.stopPropagation(),xt()},className:"flex items-center gap-1 text-xs text-sky-400 hover:text-sky-300 transition-colors","data-testid":"button-toggle-enroute-0",children:[F?s.jsx(gs,{className:"h-3 w-3"}):s.jsx(ye,{className:"h-3 w-3"}),"View en-route details (",k.length," points)"]}),F&&s.jsx("div",{className:"mt-2 space-y-1.5 pl-2 border-l-2 border-white/10",children:k.map((kt,Bt)=>{const We=kt.temperature!=null?Ft(kt.temperature,I):null;return s.jsxs("div",{className:"flex items-center justify-between text-xs opacity-80",children:[s.jsx("span",{className:"truncate max-w-[180px]",children:kt.locationName||`Point ${Bt+1}`}),s.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:[kt.estimatedTime&&s.jsxs("span",{className:"opacity-60",children:["~",kt.estimatedTime]}),s.jsx("span",{children:We!==null?`${We}${B}`:"--"}),s.jsxs("span",{className:"opacity-70",children:["• ",kt.condition||"Weather"]})]})]},Bt)})})]})]})]})})(),o.map((f,k)=>{if(!pt.has(k))return null;const F=f.stopType==="quick",lt=ht[k],xt=f.isEndOfTrip,gt=it>=0&&k===it;let Y=lt;if(gt&&!F&&lt){const nt=f.stayDays||1,Ot=new Date(lt);Ot.setDate(Ot.getDate()+nt);const[X,Vt]=(f.departureTime||"09:00").split(":").map(Number);Ot.setHours(X||9,Vt||0,0,0),Y=Ot}return s.jsxs(Ae.Fragment,{children:[s.jsx("div",{className:`rounded-xl p-4 border ${f.isHome?"bg-green-500/5 border-green-500/20":f.isEndOfTrip?"bg-purple-500/5 border-purple-500/20":F?"bg-amber-500/5 border-amber-500/20":"bg-sky-500/5 border-sky-500/20"}`,children:s.jsxs("div",{className:"flex items-start gap-4",children:[s.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center shrink-0 ${f.isHome?"bg-green-500":f.isEndOfTrip?"bg-purple-500":F?"bg-amber-500/20 border-2 border-amber-500":"bg-sky-500"}`,children:f.isHome?s.jsx(kr,{className:"h-5 w-5 text-white"}):f.isEndOfTrip?s.jsx(ta,{className:"h-5 w-5 text-white"}):F?f.quickDuration<=30?s.jsx(Ur,{className:"h-5 w-5 text-amber-500"}):s.jsx(Kr,{className:"h-5 w-5 text-amber-500"}):s.jsx(Dr,{className:"h-5 w-5 text-white"})}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsxs("div",{className:"flex items-start justify-between gap-2 flex-wrap",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"font-semibold truncate",children:oi(f.name)}
27),Y&&!F&&s.jsx("p",{className:"text-xs text-foreground/50 mt-0.5","data-testid":`text-stop-date-${k}`,children:Y.toLocaleDateString("en-US",{month:"short",day:"numeric"})}),s.jsx("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:s.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${f.isHome?"bg-green-500/20 text-green-600 dark:text-green-400":f.isEndOfTrip?"bg-purple-500/20 text-purple-600 dark:text-purple-400":F?"bg-amber-500/20 text-amber-600 dark:text-amber-400":"bg-sky-500/20 text-sky-600 dark:text-sky-400"}`,children:f.isHome?"Home":f.isEndOfTrip?"End of trip":F?`${f.quickDuration||30} min`:gt?`Departs ${f.departureTime||"09:00"}`:`${f.stayDays||1} night${(f.stayDays||1)>1?"s":""}`})})]}),!xt&&f.latitude&&f.longitude&&s.jsx("div",{className:"shrink-0 flex flex-col items-end gap-1",children:s.jsx(va,{latitude:f.latitude,longitude:f.longitude,tempUnit:I,tempSymbol:B,arrivalDateTime:Y})})]})})]})}),S&&!F&&!f.isEndOfTrip&&Jt?.legInsights?.[k+1]&&it===k&&(()=>{const nt=Jt.legInsights[k+1],Ot=nt.waypoints||[],X=k+1,Vt=un.has(X),de=mn.has(X),kt=()=>{Qe(Rt=>{const oe=new Set(Rt);return Rt.has(X)?oe.delete(X):oe.add(X),oe})},Bt=()=>{fn(Rt=>{const oe=new Set(Rt);return Rt.has(X)?oe.delete(X):oe.add(X),oe})},We=f.departureTime||"09:00",[$e,ls]=We.split(":").map(Number),si=new Date(2e3,0,1,$e||9,ls||0).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"}),ne=ht[k+1],Ji=ne?`~${ne.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit"})}`:"";return s.jsxs("div",{className:`rounded-xl p-3 border ml-7 ${nt.isPassed?"bg-gray-500/15 border-gray-500/35":nt.condition==="clear"?"bg-green-500/20 dark:bg-green-500/10 border-green-500/45 dark:border-green-500/25":nt.condition==="caution"?"bg-yellow-500/25 dark:bg-yellow-500/10 border-yellow-500/55 dark:border-yellow-500/30":"bg-red-500/20 dark:bg-red-500/10 border-red-500/45 dark:border-red-500/25"}`,"data-testid":`card-leg-insight-${k+1}`,children:[s.jsxs("button",{onClick:Bt,className:"w-full flex items-center justify-between gap-2 text-left","data-testid":`button-toggle-conditions-${X}`,children:[s.jsxs("div",{className:"flex items-center gap-2",children:[nt.isPassed?s.jsx(an,{className:"h-4 w-4 text-gray-400"}):s.jsxs(s.Fragment,{children:[nt.condition==="clear"&&s.jsx(aa,{className:"h-4 w-4 text-green-400"}),nt.condition==="caution"&&s.jsx(ra,{className:"h-4 w-4 text-theme-caution"}),nt.condition==="hazardous"&&s.jsx(oa,{className:"h-4 w-4 text-red-400"})]}),s.jsx("span",{className:"text-xs font-medium capitalize",children:nt.isPassed?"Passed Drive":`${nt.condition==="hazardous"?"Hazardous":nt.condition==="caution"?"Caution":"Clear"} Conditions`}),s.jsx(ye,{className:`h-3 w-3 opacity-50 transition-transform ${de?"rotate-180":""}`})]}),s.jsx("span",{className:`text-xs font-medium ${nt.isPassed?"text-gray-400":nt.condition==="clear"?"text-green-400":nt.condition==="caution"?"text-theme-caution":"text-red-400"}`,children:nt.isPassed?nt.savedAt?"Historical":"No Data":nt.condition==="clear"?"Clear":nt.condition==="caution"?"Caution":"Hazardous"})]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs opacity-70 mt-1",children:[s.jsx(an,{className:"h-3 w-3"}),nt.isPassed?s.jsxs("span",{children:["Departed ",si]}):s.jsxs(s.Fragment,{children:[s.jsxs("span",{children:["Departing ",si]}),Ji&&s.jsxs("span",{children:["• Arriving ",Ji]})]})]}),de&&s.jsxs("div",{className:"mt-2 pt-2 border-t border-white/10",children:[s.jsx("p",{className:"text-xs text-theme-insight mb-1",children:nt.summary}),nt.alerts&&nt.alerts.length>0&&s.jsx("div",{className:"text-xs space-y-0.5 mb-1",children:nt.alerts.slice(0,2).map((Rt,oe)=>s.jsxs("div",{className:"flex items-start gap-1.5 text-theme-insight",children:[s.jsx("span",{children:"•"}),s.jsx("span",{children:Rt})]},oe))}),nt.suggestion&&s.jsxs("div",{className:"text-xs bg-white/5 rounded p-2 mt-1",children:[s.jsx("span",{className:"font-medium",children:"Tip: "}),s.jsx("span",{className:"text-theme-insight",children:nt.suggestion})]}),Ot.length>0&&s.jsxs("div",{className:"mt-2 pt-2 border-t border-white/10",children:[s.jsxs("button",{onClick:Rt=>{Rt.stopPropagation(),kt()},className:"flex items-center gap-1 text-xs text-sky-400 hover:text-sky-300 transition-colors","data-testid":`button-toggle-enroute-${X}`,children:[Vt?s.jsx(gs,{className:"h-3 w-3"}):s.jsx(ye,{className:"h-3 w-3"}),"View en-route details (",Ot.length," points)"]}),Vt&&s.jsx("div",{className:"mt-2 space-y-1.5 pl-2 border-l-2 border-white/10",children:Ot.map((Rt,oe)=>{const ji=Rt.temperature!=null?Ft(Rt.temperature,I):null;return s.jsxs("div",{className:"flex items-center justify-between text-xs opacity-80",children:[s.jsx("span",{className:"truncate max-w-[180px]",children:Rt.locationName||`Point ${oe+1}`}),s.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",children:[Rt.estimatedTime&&s.jsxs("span",{className:"opacity-60",children:["~",Rt.estimatedTime]}),s.jsx("span",{children:ji!==null?`${ji}${B}`:"--"}),s.jsxs("span",{className:"opacity-70",children:["• ",Rt.condition||"Weather"]})]})]},oe)})})]})]})]})})()]},k)})]})})]})})(),pi&&s.jsxs("div",{className:"glass-card rounded-2xl p-4 sm:p-6 mb-6",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3 mb-4",children:[s.jsxs("button",{className:"flex items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>me(!tt),children:[s.jsx(Oi,{className:"h-5 w-5 text-blue-500"}),s.jsx("h3",{className:"font-bold text-lg",children:"Flight Conditions"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[!j&&!S&&s.jsx(sa,{compact:!0}),s.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-gradient-to-r from-amber-500 to-yellow-400 text-amber-950 font-bold shadow-sm ring-1 ring-amber-700/40",children:"PRO"}),s.jsx("button",{onClick:()=>me(!tt),className:"p-1 hover:opacity-80 transition-opacity",children:s.jsx(ye,{className:`h-4 w-4 opacity-50 transition-transform ${tt?"rotate-180":""}`})})]})]}),tt&&s.jsx(s.Fragment,{children:Te?!j&&!S?s.jsxs("div",{className:"text-center py-6",children:[s.jsxs("div",{className:"flex items-center justify-center gap-2 mb-3",children:[s.jsx(la,{className:"h-6 w-6 text-blue-500/50"}),s.jsx(Oi,{className:"h-8 w-8 text-blue-500/50"})]}),s.jsx("p",{className:"text-sm opacity-60 mb-2",children:"Upgrade to Premium to see turbulence forecasts for your flights"}),s.jsx("p",{className:"text-xs opacity-40",children:"Get jet stream alerts, best altitude recommendations, and route conditions"})]}):ot&&ot.flights.length>0?s.jsx("div",{className:"space-y-4",children:(()=>{const o=new Date().toISOString().split("T")[0],u=ot.flights.map((m,P)=>({...m,originalIdx:P})),h=u.filter(m=>
27m.date<o),_=u.filter(m=>m.date>=o),w=h.length>0,N=Fi?u:_;return s.jsxs(s.Fragment,{children:[w&&s.jsxs("div",{className:"flex items-center justify-between px-1 pb-2 border-b border-theme",children:[s.jsxs(ri,{htmlFor:"show-past-flights",className:"text-sm opacity-70 cursor-pointer",children:["Show ",h.length," past flight",h.length>1?"s":""]}),s.jsx(ma,{id:"show-past-flights",checked:Fi,onCheckedChange:pn,"data-testid":"switch-show-past-flights"})]}),N.map((m,P)=>{const M={smooth:"bg-green-500/20 text-green-600 dark:text-green-400 border-green-500/30",light:"bg-yellow-500/20 text-yellow-600 dark:text-yellow-400 border-yellow-500/30",moderate:"bg-orange-500/20 text-orange-600 dark:text-orange-400 border-orange-500/30",severe:"bg-red-500/20 text-red-600 dark:text-red-400 border-red-500/30"},ht={smooth:"✓",light:"~",moderate:"⚠",severe:"⛔"},E=W=>I==="celsius"?`${Math.round(W*.3048).toLocaleString()} m`:`${W.toLocaleString()} ft`,C=m.date<o,$=new Date(m.date+"T12:00:00"),mt=new Date,dt=Math.ceil(($.getTime()-mt.getTime())/(1e3*60*60*24))>14,ft=gn.has(m.originalIdx),it=W=>{W.target.closest("input, button")||Jn(pt=>{const Wt=new Set(pt);return Wt.has(m.originalIdx)?Wt.delete(m.originalIdx):Wt.add(m.originalIdx),Wt})};return s.jsxs("div",{className:`rounded-xl border border-theme bg-theme-card/50 ${C?"opacity-60":""}`,children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 p-3 cursor-pointer hover:bg-theme-card/30 transition-colors rounded-xl",onClick:it,"data-testid":`flight-card-header-${P}`,children:[s.jsxs("div",{className:"flex items-center gap-2 flex-wrap min-w-0",children:[De?.flightIdx===m.originalIdx&&De?.field==="from"?s.jsx(ua,{value:De.value,onChange:W=>Me({...De,value:W}),onSelect:W=>{W!==m.from&&_n(m.originalIdx,"from",W),Me(null)},onCancel:()=>Me(null),compact:!0,autoFocus:!0,dataTestId:`input-airport-from-${P}`}):s.jsx("button",{onClick:W=>{W.stopPropagation(),Me({flightIdx:m.originalIdx,field:"from",value:m.from||""})},className:"font-mono text-sm font-bold hover:bg-blue-500/20 px-1 py-0.5 rounded cursor-pointer transition-colors",title:"Click to edit departure airport","data-testid":`button-edit-airport-from-${P}`,children:m.from||"???"}),s.jsx(Oi,{className:"h-3.5 w-3.5 opacity-50"}),De?.flightIdx===m.originalIdx&&De?.field==="to"?s.jsx(ua,{value:De.value,onChange:W=>Me({...De,value:W}),onSelect:W=>{W!==m.to&&_n(m.originalIdx,"to",W),Me(null)},onCancel:()=>Me(null),compact:!0,autoFocus:!0,dataTestId:`input-airport-to-${P}`}):s.jsx("button",{onClick:W=>{W.stopPropagation(),Me({flightIdx:m.originalIdx,field:"to",value:m.to||""})},className:"font-mono text-sm font-bold hover:bg-blue-500/20 px-1 py-0.5 rounded cursor-pointer transition-colors",title:"Click to edit arrival airport","data-testid":`button-edit-airport-to-${P}`,children:m.to||"???"}),s.jsx("span",{className:"text-xs opacity-50",children:new Date(m.date+"T12:00:00").toLocaleDateString("en-US",{month:"short",day:"numeric"})}),dt&&s.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-amber-500/20 text-amber-600 dark:text-amber-400 border border-amber-500/30",children:"Predicted"})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[s.jsxs("span",{className:`text-xs px-2.5 py-0.5 rounded-full font-medium border ${M[m.rating]}`,children:[ht[m.rating]," ",m.rating.charAt(0).toUpperCase()+m.rating.slice(1)]}),s.jsx(ye,{className:`h-4 w-4 opacity-40 transition-transform ${ft?"rotate-180":""}`}),s.jsx("button",{onClick:W=>{W.stopPropagation(),es(m.originalIdx,m.isReturnFlight)},className:"p-1 rounded-full hover:bg-red-500/20 text-foreground/40 hover:text-red-500 transition-colors",title:"Remove flight","data-testid":`button-remove-flight-${P}`,children:s.jsx(Vs,{className:"h-3.5 w-3.5"})})]})]}),ft&&s.jsxs("div",{className:"px-3 pb-3 space-y-3",children:[s.jsxs("p",{className:"text-sm",children:[m.summary,(m.rating==="severe"||m.rating==="moderate")&&(m.takeoff?.smoothness==="smooth"||m.landing?.smoothness==="smooth")&&s.jsx("span",{className:"opacity-60 text-xs ml-1",children:"(at cruise altitude, 30,000-40,000 ft)"})]}),m.lookupFailed&&s.jsx("div",{className:"p-2 rounded-lg bg-amber-500/10 border border-amber-500/20",children:s.jsx("p",{className:"text-xs text-amber-600 dar
27k:text-amber-400",children:"Tip: Click the airport code above to edit it. Search by city name or IATA code to find the correct airport."})}),(m.takeoff||m.landing)&&s.jsxs("div",{className:"grid grid-cols-2 gap-3 text-xs",children:[m.takeoff&&s.jsxs("div",{className:"p-2 rounded-lg bg-theme-card/50 border border-theme",children:[s.jsxs("div",{className:"font-medium mb-1 flex items-center gap-1",children:[s.jsx(Oi,{className:"h-3 w-3 rotate-45"}),"Takeoff (",m.from,")"]}),s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${m.takeoff.smoothness==="smooth"?"bg-green-500/20 text-green-400 border border-green-500/30":m.takeoff.smoothness==="light"?"bg-yellow-500/20 text-theme-caution border border-yellow-500/30":m.takeoff.smoothness==="moderate"?"bg-orange-500/20 text-orange-400 border border-orange-500/30":"bg-red-500/20 text-red-400 border border-red-500/30"}`,children:m.takeoff.smoothness==="smooth"?"✓ Smooth":m.takeoff.smoothness==="light"?"~ Light bumps":m.takeoff.smoothness==="moderate"?"≈ Bumpy":"! Rough"})}),s.jsx("div",{className:"opacity-60",children:m.takeoff.condition}),s.jsx("div",{className:"opacity-50 text-[10px]",children:m.takeoff.details})]}),m.landing&&s.jsxs("div",{className:"p-2 rounded-lg bg-theme-card/50 border border-theme",children:[s.jsxs("div",{className:"font-medium mb-1 flex items-center gap-1",children:[s.jsx(Oi,{className:"h-3 w-3 -rotate-45"}),"Landing (",m.to,")"]}),s.jsx("div",{className:"flex items-center gap-2 mb-1",children:s.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full font-medium ${m.landing.smoothness==="smooth"?"bg-green-500/20 text-green-400 border border-green-500/30":m.landing.smoothness==="light"?"bg-yellow-500/20 text-theme-caution border border-yellow-500/30":m.landing.smoothness==="moderate"?"bg-orange-500/20 text-orange-400 border border-orange-500/30":"bg-red-500/20 text-red-400 border border-red-500/30"}`,children:m.landing.smoothness==="smooth"?"✓ Smooth":m.landing.smoothness==="light"?"~ Light bumps":m.landing.smoothness==="moderate"?"≈ Bumpy":"! Rough"})}),s.jsx("div",{className:"opacity-60",children:m.landing.condition}),s.jsx("div",{className:"opacity-50 text-[10px]",children:m.landing.details})]})]}),m.jetStreamActive&&s.jsxs("div",{className:"flex items-center gap-2 text-xs text-amber-500",children:[s.jsx(la,{className:"h-4 w-4"}),s.jsx("span",{className:"font-medium",children:"Jet stream crossing detected"})]}),s.jsxs("details",{className:"text-xs",children:[s.jsxs("summary",{className:"cursor-pointer opacity-70 hover:opacity-100 transition-opacity flex items-center gap-1","data-testid":"summary-flight-technical-details",children:[s.jsx(ye,{className:"h-3 w-3"}),"Technical Details"]}),s.jsxs("div",{className:"mt-2 p-3 rounded-lg bg-theme-card/50 border border-theme space-y-2",children:[m.segments&&m.segments.length>0&&(()=>{const W=m.segments.filter(Mt=>(Mt.windSpeed||0)>0);if(W.length===0)return null;const pt=Math.round(W.reduce((Mt,Pt)=>Mt+(Pt.windSpeed||0),0)/W.length),Wt=W.reduce((Mt,Pt)=>Mt+Math.sin((Pt.windDirection||0)*Math.PI/180),0),Xt=W.reduce((Mt,Pt)=>Mt+Math.cos((Pt.windDirection||0)*Math.PI/180),0);let At=Math.round(Math.atan2(Wt,Xt)*180/Math.PI);return At<0&&(At+=360),pt>0?s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"opacity-60",children:"Cruise altitude winds"}),s.jsxs("span",{children:[pt," km/h from ",At,"°"]})]}):null})(),m.segments&&m.segments.length>1&&(()=>{const W=m.segments.map(Xt=>Xt.windSpeed||0).filter(Xt=>Xt>0);if(W.length<2)return null;const pt=Math.max(...W)-Math.min(...W),Wt=pt>75?"Extreme":pt>40?"Moderate":pt>20?"Light":"Minimal";return s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"opacity-60",children:"Wind shear along route"}),s.jsxs("span",{children:[Wt," (",pt," km/h variation)"]})]})})(),m.jetStreamActive&&m.jetStreamAltitudeRange&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"opacity-60",children:"Jet stream zone"}),s.jsxs("span",{children:[E(m.jetStreamAltitudeRange.minFeet)," - ",E(m.jetStreamAltitudeRange.maxFeet)]})]}),m.smoothAltitudeRange&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"opacity-60",children:"Smoother altitudes"}),s.jsx("span",{children:m.smoothAltitudeRange.minFeet<=m.smoothAltitudeRange.maxFeet?`${E(m.smoothAltitudeRange.minFeet)} - ${E(m.smoothAltitudeRange.maxFeet)}`:`${E(m.smoothAltitudeRange.maxFeet)} - ${E(m.smoothAltitudeRange.minFeet)}`})]}),m.bestAltitudeFeet&&s.jsxs("div",{className:"flex justify-between",children:[s.jsx("span",{className:"opacity-60",children:"Analysis altitude"}),s.jsx("span",{children:E(m.bestAltitudeFeet)})]})]})]}),m.dataLimited&&s.jsx("div",{className:"p-2 rounded-lg bg-gray-500/10 border border-gray-500/20",children:s.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[s.jsx(ps,{className:"h-4 w-4 shrink-0 mt-0.5 text-gray-400"}),s.jsx("span",{children:"Some weather data unavailable for this route."})]})})]})]},P)})]})})()}):Nt?s.jsxs("div",{className:"text-center py-6",children:[s.jsx(Mr,{className:"h-8 w-8 mx-auto mb-3 animate-spin opacity-50"}),s.jsx("p",{className:"text-sm opacity-60",children:"Analyzing flight conditions..."})]}):s.jsx("p",{className:"text-sm opacity-60 text-center py-4",children:"Unable to load turbulence data. Please try again later."}):s.jsxs("div",{className:"text-center py-6",children:[s.jsx(Ai,{hintKey:"trip-detail-flight-info",className:"mb-3",children:"Add departure and arrival airports in Edit Trip to unlock turbulence forecasts along your flight path."}),s.jsx(Oi,{className:"h-12 w-12 mx-auto mb-3 opacity-30"}),s.jsx("p",{className:"text-sm opacity-60 mb-2",children:"No airports specified for this trip"}),s.jsx("p",{className:"text-xs opacity-40",children:"Edit your trip and add departure/arrival airport codes to see turbulence forecasts"}),s.jsxs(Qt,{variant:"outline",size:"sm",className:"mt-4",onClick:R,"data-testid":"button-add-airports",children:[s.jsx(An,{className:"h-4 w-4 mr-2"}),"Edit Trip to Add Airports"]})]})})]}),bt&&s.jsx("div",{className:"space-y-4",children:s.jsxs("div",{className:"glass-card rounded-2xl p-4",children:[s.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[s.jsx(An,{className:"h-4 w-4"}),"Edit Trip"]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ri,{className:"text-xs opacity-70",children:"Trip Name"}
27),s.jsx(sn,{value:Gt,onChange:o=>ue(o.target.value),placeholder:"Enter trip name...",className:"bg-theme-card border-theme","data-testid":"input-trip-name"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ri,{className:"text-xs opacity-70",children:"Main Activity"}),s.jsxs("select",{value:ct,onChange:o=>Kt(o.target.value),className:"w-full h-10 px-3 rounded-md bg-theme-card border border-theme text-sm","data-testid":"select-activity",children:[s.jsx("option",{value:"",children:"Select an activity..."}),s.jsx("option",{value:"outdoor",children:"🌤️ Outdoor Activity"}),s.jsx("option",{value:"sightseeing",children:"🏛️ Sightseeing"}),s.jsx("option",{value:"food",children:"🍽️ Food & Dining"}),s.jsx("option",{value:"nightlife",children:"🎉 Nightlife"}),s.jsx("option",{value:"shopping",children:"🛍️ Shopping"}),s.jsx("option",{value:"photography",children:"📸 Photography"}),s.jsx("option",{value:"beach",children:"🏖️ Beach"}),s.jsx("option",{value:"hiking",children:"🥾 Hiking"}),s.jsx("option",{value:"business",children:"💼 Business"}),s.jsx("option",{value:"relaxation",children:"🧘 Relaxation"})]})]}),s.jsx("div",{className:"border-t border-theme my-4 pt-4",children:s.jsx(ri,{className:"text-xs opacity-70 block mb-3",children:"Destinations"})}),It.map((o,u)=>s.jsxs("div",{className:"bg-theme-card rounded-xl p-4 space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("span",{className:"text-sm font-medium text-themed-secondary",children:["Stop ",u+1]}),s.jsx(Qt,{variant:"ghost",size:"icon",className:"h-8 w-8 text-red-600 dark:text-red-400 hover:bg-red-500/10",onClick:()=>ti(o.id),"data-testid":`button-remove-segment-${u}`,children:s.jsx(Wr,{className:"h-4 w-4"})})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ri,{className:"text-xs opacity-70",children:"Destination"}),s.jsx(Cr,{value:o.destination,onSelect:h=>ts(o.id,h),placeholder:"Search for a city...",triggerClassName:"bg-theme-card border-theme"})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(ri,{className:"text-xs opacity-70",children:"Start Date"}),s.jsx(sn,{type:"date",value:o.startDate,onChange:h=>wi(o.id,"startDate",h.target.value),className:"bg-theme-card border-theme","data-testid":`input-start-date-${u}`})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(ri,{className:"text-xs opacity-70",children:"End Date"}),s.jsx(sn,{type:"date",value:o.endDate,onChange:h=>wi(o.id,"endDate",h.target.value),className:"bg-theme-card border-theme","data-testid":`input-end-date-${u}`})]})]})]})]},o.id)),s.jsxs(Qt,{variant:"outline",className:"w-full border-dashed border-theme bg-transparent btn-theme-ghost",onClick:vn,"data-testid":"button-add-segment",children:[s.jsx(Qs,{className:"h-4 w-4 mr-2"}),"Add Another Destination"]})]}),s.jsxs("div",{className:"flex gap-3 mt-6",children:[s.jsx(Qt,{variant:"outline",className:"flex-1 border-theme",onClick:Hi,children:"Cancel"}),s.jsx(Qt,{className:"flex-1 bg-sky-500 hover:bg-sky-600",onClick:Wi,disabled:be||re.isPending,children:re.isPending?"Saving...":"Save Changes"})]})]})}),!ie&&!bt&&s.jsxs("div",{className:"glass-card rounded-2xl p-5 mb-6 border border-amber-500/20 bg-gradient-to-br from-amber-500/5 via-transparent to-transparent",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[s.jsx(nn,{size:"md"}),s.jsx("h3",{className:"font-bold",children:"Zeph's Packing List"}),s.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-gradient-to-r from-amber-500 to-yellow-400 text-amber-950 font-bold shadow-sm ring-1 ring-amber-700/40",children:"PRO"})]}),s.jsx("p",{className:"text-sm opacity-70 mb-4",children:"Let Zeph build a personalized packing list based on your trip's weather, activities, and destinations"}),y?s.jsx(rn,{href:"/upgrade",children:s.jsxs(Qt,{size:"sm",className:"bg-gradient-to-r from-amber-500 to-yellow-400 hover:from-amber-400 hover:to-yellow-300 text-black","data-testid":"button-upgrade-packing",children:[s.jsx(Ir,{className:"h-4 w-4 mr-2"}),"Upgrade to Pro"]})}):s.jsx(rn,{href:"/login",children:s.jsx(Qt,{size:"sm",className:"bg-sky-500 hover:bg-sky-600","data-testid":"button-login-packing",children:"Sign In to Unlock"})})]}),rt&&s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"glass-card rounded-2xl p-6",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsxs("button",{className:"flex items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>cn(!yi),children:[s.jsx(nn,{size:"md"}),s.jsx("h3",{className:"font-bold",children:"Zeph's Packing List"}),s.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-gradient-to-r from-amber-500 to-yellow-400 text-amber-950 font-bold shadow-sm ring-1 ring-amber-700/40",children:"PRO"}),s.jsx(ye,{className:`h-4 w-4 opacity-50 transition-transform ${yi?"rotate-180":""}`})]}),s.jsxs(Er,{children:[s.jsx(Ar,{asChild:!0,children:s.jsxs(Qt,{variant:"ghost",size:"sm",className:"h-8 btn-theme-ghost","data-testid":"button-export-packing",children:[s.jsx(Vr,{className:"h-4 w-4 mr-1"}),"Export"]})}),s.jsxs(Or,{align:"end",className:"dropdown-theme",children:[s.jsxs(ca,{onClick:is,className:"cursor-pointer","data-testid":"menu-copy-packing",children:[s.jsx(Hr,{className:"h-4 w-4 mr-2"}),"Copy to Clipboard"]}),s.jsxs(ca,{onClick:ns,className:"cursor-pointer","data-testid":"menu-share-packing",children:[s.jsx(to,{className:"h-4 w-4 mr-2"}),"Share"]})]})]})]}),yi&&s.jsxs("div",{className:"space-y-4",children:[s.jsx(Ai,{hintKey:"trip-detail-packing",children:"Packing tips update automatically as the forecast changes. Re-export anytime before you leave."}),["essential","recommended","optional"].map(o=>{const u=rt.packingList.filter(N=>N.priority===o);if(u.length===0)return null;const h=u.reduce((N,m)=>{const P=m.category||"other";return N[P]||(N[P]=[]),N[P].push(m),N},{}),_=["clothing","gear","protection","accessories","documents","toiletries","electronics","other"],w=Object.keys(h).sort((N,m)=>{const P=_.indexOf(N.toLowerCase()),M=_.indexOf(m.toLowerCase());return(P===-1?999:P)-(M===-1?999:M)});return s.jsxs("div",{children:[s.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider opacity-50 mb-3 capitalize",children:o}),s.jsx("div",{className:"space-y-3",children:w.map(N=>{const m=h[N];return s.jsxs("details",{className:"group",open:!0,children:[s.jsxs("summary",{className:"flex items-center gap-2 cursor-pointer list-none p-2 rounded-lg bg-theme-card hover:opacity-80 transition-opacity",children:[s.jsx(ye,{className:"h-4 w-4 opacity-50 transition-transform group-open:rotate-180"}),s.jsx("span",{className:"font-medium text-sm capitalize",children:N}),s.jsxs("span",{className:"text-xs opacity-50",children:["(",m.length,")"]})]}),s.jsx("ul",{className:"mt-2 ml-6 space-y-2",children:m.map((P,M)=>s.jsx("li",{className:"flex items-start gap-3 p-2 rounded-lg bg-white/5",children:s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"font-medium text-sm",children:P.item}),s.jsx("p",{className:"text-xs opacity-60",children:P.reason})]})},M))})]},N)})})]},o)})]})]}),rt.tips.length>0&&s.jsxs("div",{className:"glass-card rounded-2xl p-6",children:[s.jsxs("button",{className:"w-full flex items-center gap-2 mb-4 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>Un(!Bi),children:[s.jsx(zr,{className:"h-5 w-5 text-green-600 dark:text-green-400"}),s.jsxs("h3",{className:"font-bold",children:["Tips for Your ",rt.activityType]}),s.jsx("span",{className:"text-[10px] px-2 py-0.5 rounded-full bg-gradient-to-r from-amber-500 to-yellow-400 text-amber-950 font-bold shadow-sm ring-1 ring-amber-700/40",children:"PRO"}),s.jsx(ye,{className:`h-4 w-4 opacity-50 transition-transform ml-auto ${Bi?"rotate-180":""}`})]}),Bi&&s.jsx("ul",{className:"space-y-2",children:rt.tips.map((o,u)=>s.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[s.jsx("span",{className:"text-green-600 dark:text-green-400 mt-0.5",children:"•"}),s.jsx("span",{className:"opacity-80",children:o})]},u))})]})]})]})})]})}export{Io as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.