const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Equipment-CTLZqt7C.js","assets/MagnifyingGlassIcon-DIIDUrHz.js","assets/Products-BYbbRN4N.js","assets/Applications-Dk6lLrM6.js","assets/PlayIcon-CoXqSH0y.js","assets/Mowing-B8nXiqFU.js","assets/AdminDashboard-ZjlQm83Z.js","assets/UsersIcon-DAyxbQQr.js","assets/AdminUsers-DBAyiX-x.js","assets/ExclamationTriangleIcon-BZPGBcaI.js","assets/AdminProducts-Dw06v4jS.js","assets/ArrowUpIcon-cULW2MO5.js","assets/AdminEquipment-I7Ze0qiC.js"])))=>i.map(i=>d[i]); function wP(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var EP=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $w(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function YD(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var t1={exports:{}},np={},e1={exports:{}},ee={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Nf=Symbol.for("react.element"),SP=Symbol.for("react.portal"),CP=Symbol.for("react.fragment"),NP=Symbol.for("react.strict_mode"),PP=Symbol.for("react.profiler"),bP=Symbol.for("react.provider"),LP=Symbol.for("react.context"),IP=Symbol.for("react.forward_ref"),TP=Symbol.for("react.suspense"),OP=Symbol.for("react.memo"),RP=Symbol.for("react.lazy"),s0=Symbol.iterator;function MP(e){return e===null||typeof e!="object"?null:(e=s0&&e[s0]||e["@@iterator"],typeof e=="function"?e:null)}var n1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},r1=Object.assign,i1={};function ju(e,t,n){this.props=e,this.context=t,this.refs=i1,this.updater=n||n1}ju.prototype.isReactComponent={};ju.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ju.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function s1(){}s1.prototype=ju.prototype;function Fv(e,t,n){this.props=e,this.context=t,this.refs=i1,this.updater=n||n1}var jv=Fv.prototype=new s1;jv.constructor=Fv;r1(jv,ju.prototype);jv.isPureReactComponent=!0;var o0=Array.isArray,o1=Object.prototype.hasOwnProperty,zv={current:null},a1={key:!0,ref:!0,__self:!0,__source:!0};function l1(e,t,n){var r,i={},s=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(s=""+t.key),t)o1.call(t,r)&&!a1.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1>>1,Lt=z[vt];if(0>>1;vti(_t,tt))wti(Gt,_t)?(z[vt]=Gt,z[wt]=tt,vt=wt):(z[vt]=_t,z[ht]=tt,vt=ht);else if(wti(Gt,tt))z[vt]=Gt,z[wt]=tt,vt=wt;else break t}}return at}function i(z,at){var tt=z.sortIndex-at.sortIndex;return tt!==0?tt:z.id-at.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var c=[],f=[],g=1,d=null,v=3,y=!1,x=!1,S=!1,C=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function N(z){for(var at=n(f);at!==null;){if(at.callback===null)r(f);else if(at.startTime<=z)r(f),at.sortIndex=at.expirationTime,t(c,at);else break;at=n(f)}}function I(z){if(S=!1,N(z),!x)if(n(c)!==null)x=!0,it(R);else{var at=n(f);at!==null&&yt(I,at.startTime-z)}}function R(z,at){x=!1,S&&(S=!1,E(q),q=-1),y=!0;var tt=v;try{for(N(at),d=n(c);d!==null&&(!(d.expirationTime>at)||z&&!J());){var vt=d.callback;if(typeof vt=="function"){d.callback=null,v=d.priorityLevel;var Lt=vt(d.expirationTime<=at);at=e.unstable_now(),typeof Lt=="function"?d.callback=Lt:d===n(c)&&r(c),N(at)}else r(c);d=n(c)}if(d!==null)var ct=!0;else{var ht=n(f);ht!==null&&yt(I,ht.startTime-at),ct=!1}return ct}finally{d=null,v=tt,y=!1}}var A=!1,B=null,q=-1,Q=5,Y=-1;function J(){return!(e.unstable_now()-Yz||125vt?(z.sortIndex=tt,t(f,z),n(c)===null&&z===n(f)&&(S?(E(q),q=-1):S=!0,yt(I,tt-vt))):(z.sortIndex=Lt,t(c,z),x||y||(x=!0,it(R))),z},e.unstable_shouldYield=J,e.unstable_wrapCallback=function(z){var at=v;return function(){var tt=v;v=at;try{return z.apply(this,arguments)}finally{v=tt}}}})(d1);h1.exports=d1;var HP=h1.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ZP=P,li=HP;function ot(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),pm=Object.prototype.hasOwnProperty,WP=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,l0={},u0={};function XP(e){return pm.call(u0,e)?!0:pm.call(l0,e)?!1:WP.test(e)?u0[e]=!0:(l0[e]=!0,!1)}function YP(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function KP(e,t,n,r){if(t===null||typeof t>"u"||YP(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function kr(e,t,n,r,i,s,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=a}var rr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){rr[e]=new kr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];rr[t]=new kr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){rr[e]=new kr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){rr[e]=new kr(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){rr[e]=new kr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){rr[e]=new kr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){rr[e]=new kr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){rr[e]=new kr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){rr[e]=new kr(e,5,!1,e.toLowerCase(),null,!1,!1)});var Uv=/[\-:]([a-z])/g;function Vv(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Uv,Vv);rr[t]=new kr(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Uv,Vv);rr[t]=new kr(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Uv,Vv);rr[t]=new kr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){rr[e]=new kr(e,1,!1,e.toLowerCase(),null,!1,!1)});rr.xlinkHref=new kr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){rr[e]=new kr(e,1,!1,e.toLowerCase(),null,!0,!0)});function Gv(e,t,n,r){var i=rr.hasOwnProperty(t)?rr[t]:null;(i!==null?i.type!==0:r||!(2l||i[a]!==s[l]){var c=` `+i[a].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=a&&0<=l);break}}}finally{Ng=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ec(e):""}function QP(e){switch(e.tag){case 5:return Ec(e.type);case 16:return Ec("Lazy");case 13:return Ec("Suspense");case 19:return Ec("SuspenseList");case 0:case 2:case 15:return e=Pg(e.type,!1),e;case 11:return e=Pg(e.type.render,!1),e;case 1:return e=Pg(e.type,!0),e;default:return""}}function ym(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ql:return"Fragment";case Gl:return"Portal";case gm:return"Profiler";case qv:return"StrictMode";case mm:return"Suspense";case vm:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case m1:return(e.displayName||"Context")+".Consumer";case g1:return(e._context.displayName||"Context")+".Provider";case Hv:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Zv:return t=e.displayName||null,t!==null?t:ym(e.type)||"Memo";case Bo:t=e._payload,e=e._init;try{return ym(e(t))}catch{}}return null}function JP(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ym(t);case 8:return t===qv?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function fa(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function y1(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function $P(e){var t=y1(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,s.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function vh(e){e._valueTracker||(e._valueTracker=$P(e))}function _1(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=y1(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ud(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function _m(e,t){var n=t.checked;return Xe({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function f0(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=fa(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function x1(e,t){t=t.checked,t!=null&&Gv(e,"checked",t,!1)}function xm(e,t){x1(e,t);var n=fa(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?wm(e,t.type,n):t.hasOwnProperty("defaultValue")&&wm(e,t.type,fa(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function h0(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function wm(e,t,n){(t!=="number"||ud(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Sc=Array.isArray;function nu(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=yh.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function qc(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ic={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},tb=["Webkit","ms","Moz","O"];Object.keys(Ic).forEach(function(e){tb.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ic[t]=Ic[e]})});function C1(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Ic.hasOwnProperty(e)&&Ic[e]?(""+t).trim():t+"px"}function N1(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=C1(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var eb=Xe({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Cm(e,t){if(t){if(eb[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ot(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ot(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ot(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ot(62))}}function Nm(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Pm=null;function Wv(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var bm=null,ru=null,iu=null;function g0(e){if(e=Lf(e)){if(typeof bm!="function")throw Error(ot(280));var t=e.stateNode;t&&(t=ap(t),bm(e.stateNode,e.type,t))}}function P1(e){ru?iu?iu.push(e):iu=[e]:ru=e}function b1(){if(ru){var e=ru,t=iu;if(iu=ru=null,g0(e),t)for(e=0;e>>=0,e===0?32:31-(hb(e)/db|0)|0}var _h=64,xh=4194304;function Cc(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function dd(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,a=n&268435455;if(a!==0){var l=a&~i;l!==0?r=Cc(l):(s&=a,s!==0&&(r=Cc(s)))}else a=n&~i,a!==0?r=Cc(a):s!==0&&(r=Cc(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Pf(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-hs(t),e[t]=n}function vb(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Oc),C0=" ",N0=!1;function W1(e,t){switch(e){case"keyup":return Hb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function X1(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Hl=!1;function Wb(e,t){switch(e){case"compositionend":return X1(t);case"keypress":return t.which!==32?null:(N0=!0,C0);case"textInput":return e=t.data,e===C0&&N0?null:e;default:return null}}function Xb(e,t){if(Hl)return e==="compositionend"||!ey&&W1(e,t)?(e=H1(),qh=Jv=Yo=null,Hl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}t:{for(;n;){if(n.nextSibling){n=n.nextSibling;break t}n=n.parentNode}n=void 0}n=I0(n)}}function J1(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?J1(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $1(){for(var e=window,t=ud();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ud(e.document)}return t}function ny(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function rL(e){var t=$1(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&J1(n.ownerDocument.documentElement,n)){if(r!==null&&ny(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=T0(n,s);var a=T0(n,r);i&&a&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Zl=null,Mm=null,Mc=null,Am=!1;function O0(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Am||Zl==null||Zl!==ud(r)||(r=Zl,"selectionStart"in r&&ny(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Mc&&Kc(Mc,r)||(Mc=r,r=md(Mm,"onSelect"),0Yl||(e.current=Bm[Yl],Bm[Yl]=null,Yl--)}function Ne(e,t){Yl++,Bm[Yl]=e.current,e.current=t}var ha={},pr=Ca(ha),Gr=Ca(!1),rl=ha;function uu(e,t){var n=e.type.contextTypes;if(!n)return ha;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function qr(e){return e=e.childContextTypes,e!=null}function yd(){Te(Gr),Te(pr)}function j0(e,t,n){if(pr.current!==ha)throw Error(ot(168));Ne(pr,t),Ne(Gr,n)}function lE(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(ot(108,JP(e)||"Unknown",i));return Xe({},n,r)}function _d(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ha,rl=pr.current,Ne(pr,e),Ne(Gr,Gr.current),!0}function z0(e,t,n){var r=e.stateNode;if(!r)throw Error(ot(169));n?(e=lE(e,t,rl),r.__reactInternalMemoizedMergedChildContext=e,Te(Gr),Te(pr),Ne(pr,e)):Te(Gr),Ne(Gr,n)}var oo=null,lp=!1,Bg=!1;function uE(e){oo===null?oo=[e]:oo.push(e)}function gL(e){lp=!0,uE(e)}function Na(){if(!Bg&&oo!==null){Bg=!0;var e=0,t=pe;try{var n=oo;for(pe=1;e>=a,i-=a,ao=1<<32-hs(t)+i|n<q?(Q=B,B=null):Q=B.sibling;var Y=v(E,B,N[q],I);if(Y===null){B===null&&(B=Q);break}e&&B&&Y.alternate===null&&t(E,B),w=s(Y,w,q),A===null?R=Y:A.sibling=Y,A=Y,B=Q}if(q===N.length)return n(E,B),ke&&qa(E,q),R;if(B===null){for(;qq?(Q=B,B=null):Q=B.sibling;var J=v(E,B,Y.value,I);if(J===null){B===null&&(B=Q);break}e&&B&&J.alternate===null&&t(E,B),w=s(J,w,q),A===null?R=J:A.sibling=J,A=J,B=Q}if(Y.done)return n(E,B),ke&&qa(E,q),R;if(B===null){for(;!Y.done;q++,Y=N.next())Y=d(E,Y.value,I),Y!==null&&(w=s(Y,w,q),A===null?R=Y:A.sibling=Y,A=Y);return ke&&qa(E,q),R}for(B=r(E,B);!Y.done;q++,Y=N.next())Y=y(B,E,q,Y.value,I),Y!==null&&(e&&Y.alternate!==null&&B.delete(Y.key===null?q:Y.key),w=s(Y,w,q),A===null?R=Y:A.sibling=Y,A=Y);return e&&B.forEach(function(W){return t(E,W)}),ke&&qa(E,q),R}function C(E,w,N,I){if(typeof N=="object"&&N!==null&&N.type===ql&&N.key===null&&(N=N.props.children),typeof N=="object"&&N!==null){switch(N.$$typeof){case mh:t:{for(var R=N.key,A=w;A!==null;){if(A.key===R){if(R=N.type,R===ql){if(A.tag===7){n(E,A.sibling),w=i(A,N.props.children),w.return=E,E=w;break t}}else if(A.elementType===R||typeof R=="object"&&R!==null&&R.$$typeof===Bo&&V0(R)===A.type){n(E,A.sibling),w=i(A,N.props),w.ref=gc(E,A,N),w.return=E,E=w;break t}n(E,A);break}else t(E,A);A=A.sibling}N.type===ql?(w=el(N.props.children,E.mode,I,N.key),w.return=E,E=w):(I=Jh(N.type,N.key,N.props,null,E.mode,I),I.ref=gc(E,w,N),I.return=E,E=I)}return a(E);case Gl:t:{for(A=N.key;w!==null;){if(w.key===A)if(w.tag===4&&w.stateNode.containerInfo===N.containerInfo&&w.stateNode.implementation===N.implementation){n(E,w.sibling),w=i(w,N.children||[]),w.return=E,E=w;break t}else{n(E,w);break}else t(E,w);w=w.sibling}w=Xg(N,E.mode,I),w.return=E,E=w}return a(E);case Bo:return A=N._init,C(E,w,A(N._payload),I)}if(Sc(N))return x(E,w,N,I);if(cc(N))return S(E,w,N,I);bh(E,N)}return typeof N=="string"&&N!==""||typeof N=="number"?(N=""+N,w!==null&&w.tag===6?(n(E,w.sibling),w=i(w,N),w.return=E,E=w):(n(E,w),w=Wg(N,E.mode,I),w.return=E,E=w),a(E)):n(E,w)}return C}var fu=dE(!0),pE=dE(!1),Ed=Ca(null),Sd=null,Jl=null,oy=null;function ay(){oy=Jl=Sd=null}function ly(e){var t=Ed.current;Te(Ed),e._currentValue=t}function Gm(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function ou(e,t){Sd=e,oy=Jl=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Vr=!0),e.firstContext=null)}function ji(e){var t=e._currentValue;if(oy!==e)if(e={context:e,memoizedValue:t,next:null},Jl===null){if(Sd===null)throw Error(ot(308));Jl=e,Sd.dependencies={lanes:0,firstContext:e}}else Jl=Jl.next=e;return t}var Xa=null;function uy(e){Xa===null?Xa=[e]:Xa.push(e)}function gE(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,uy(t)):(n.next=i.next,i.next=n),t.interleaved=n,vo(e,r)}function vo(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Uo=!1;function cy(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function mE(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function co(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ra(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ae&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,vo(e,n)}return i=r.interleaved,i===null?(t.next=t,uy(r)):(t.next=i.next,i.next=t),r.interleaved=t,vo(e,n)}function Zh(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Yv(e,n)}}function G0(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=a:s=s.next=a,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Cd(e,t,n,r){var i=e.updateQueue;Uo=!1;var s=i.firstBaseUpdate,a=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,f=c.next;c.next=null,a===null?s=f:a.next=f,a=c;var g=e.alternate;g!==null&&(g=g.updateQueue,l=g.lastBaseUpdate,l!==a&&(l===null?g.firstBaseUpdate=f:l.next=f,g.lastBaseUpdate=c))}if(s!==null){var d=i.baseState;a=0,g=f=c=null,l=s;do{var v=l.lane,y=l.eventTime;if((r&v)===v){g!==null&&(g=g.next={eventTime:y,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});t:{var x=e,S=l;switch(v=t,y=n,S.tag){case 1:if(x=S.payload,typeof x=="function"){d=x.call(y,d,v);break t}d=x;break t;case 3:x.flags=x.flags&-65537|128;case 0:if(x=S.payload,v=typeof x=="function"?x.call(y,d,v):x,v==null)break t;d=Xe({},d,v);break t;case 2:Uo=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,v=i.effects,v===null?i.effects=[l]:v.push(l))}else y={eventTime:y,lane:v,tag:l.tag,payload:l.payload,callback:l.callback,next:null},g===null?(f=g=y,c=d):g=g.next=y,a|=v;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;v=l,l=v.next,v.next=null,i.lastBaseUpdate=v,i.shared.pending=null}}while(!0);if(g===null&&(c=d),i.baseState=c,i.firstBaseUpdate=f,i.lastBaseUpdate=g,t=i.shared.interleaved,t!==null){i=t;do a|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);ol|=a,e.lanes=a,e.memoizedState=d}}function q0(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Vg.transition;Vg.transition={};try{e(!1),t()}finally{pe=n,Vg.transition=r}}function ME(){return zi().memoizedState}function _L(e,t,n){var r=sa(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},AE(e))DE(t,n);else if(n=gE(e,t,n,r),n!==null){var i=Lr();ds(n,e,r,i),kE(n,t,r)}}function xL(e,t,n){var r=sa(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(AE(e))DE(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var a=t.lastRenderedState,l=s(a,n);if(i.hasEagerState=!0,i.eagerState=l,ms(l,a)){var c=t.interleaved;c===null?(i.next=i,uy(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=gE(e,t,i,r),n!==null&&(i=Lr(),ds(n,e,r,i),kE(n,t,r))}}function AE(e){var t=e.alternate;return e===We||t!==null&&t===We}function DE(e,t){Ac=Pd=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function kE(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Yv(e,n)}}var bd={readContext:ji,useCallback:lr,useContext:lr,useEffect:lr,useImperativeHandle:lr,useInsertionEffect:lr,useLayoutEffect:lr,useMemo:lr,useReducer:lr,useRef:lr,useState:lr,useDebugValue:lr,useDeferredValue:lr,useTransition:lr,useMutableSource:lr,useSyncExternalStore:lr,useId:lr,unstable_isNewReconciler:!1},wL={readContext:ji,useCallback:function(e,t){return As().memoizedState=[e,t===void 0?null:t],e},useContext:ji,useEffect:Z0,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Xh(4194308,4,LE.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Xh(4194308,4,e,t)},useInsertionEffect:function(e,t){return Xh(4,2,e,t)},useMemo:function(e,t){var n=As();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=As();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=_L.bind(null,We,e),[r.memoizedState,e]},useRef:function(e){var t=As();return e={current:e},t.memoizedState=e},useState:H0,useDebugValue:yy,useDeferredValue:function(e){return As().memoizedState=e},useTransition:function(){var e=H0(!1),t=e[0];return e=yL.bind(null,e[1]),As().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=We,i=As();if(ke){if(n===void 0)throw Error(ot(407));n=n()}else{if(n=t(),Gn===null)throw Error(ot(349));sl&30||xE(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,Z0(EE.bind(null,r,s,e),[e]),r.flags|=2048,sf(9,wE.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=As(),t=Gn.identifierPrefix;if(ke){var n=lo,r=ao;n=(r&~(1<<32-hs(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=nf++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[zs]=t,e[$c]=r,ZE(e,t,!1,!1),t.stateNode=e;t:{switch(a=Nm(n,r),n){case"dialog":Le("cancel",e),Le("close",e),i=r;break;case"iframe":case"object":case"embed":Le("load",e),i=r;break;case"video":case"audio":for(i=0;ipu&&(t.flags|=128,r=!0,mc(s,!1),t.lanes=4194304)}else{if(!r)if(e=Nd(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),mc(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!ke)return ur(t),null}else 2*nn()-s.renderingStartTime>pu&&n!==1073741824&&(t.flags|=128,r=!0,mc(s,!1),t.lanes=4194304);s.isBackwards?(a.sibling=t.child,t.child=a):(n=s.last,n!==null?n.sibling=a:t.child=a,s.last=a)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=nn(),t.sibling=null,n=Ve.current,Ne(Ve,r?n&1|2:n&1),t):(ur(t),null);case 22:case 23:return Cy(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ri&1073741824&&(ur(t),t.subtreeFlags&6&&(t.flags|=8192)):ur(t),null;case 24:return null;case 25:return null}throw Error(ot(156,t.tag))}function IL(e,t){switch(iy(t),t.tag){case 1:return qr(t.type)&&yd(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return hu(),Te(Gr),Te(pr),dy(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return hy(t),null;case 13:if(Te(Ve),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ot(340));cu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Te(Ve),null;case 4:return hu(),null;case 10:return ly(t.type._context),null;case 22:case 23:return Cy(),null;case 24:return null;default:return null}}var Ih=!1,fr=!1,TL=typeof WeakSet=="function"?WeakSet:Set,Ct=null;function $l(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Qe(e,t,r)}else n.current=null}function Jm(e,t,n){try{n()}catch(r){Qe(e,t,r)}}var rx=!1;function OL(e,t){if(Dm=pd,e=$1(),ny(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else t:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break t}var a=0,l=-1,c=-1,f=0,g=0,d=e,v=null;e:for(;;){for(var y;d!==n||i!==0&&d.nodeType!==3||(l=a+i),d!==s||r!==0&&d.nodeType!==3||(c=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(y=d.firstChild)!==null;)v=d,d=y;for(;;){if(d===e)break e;if(v===n&&++f===i&&(l=a),v===s&&++g===r&&(c=a),(y=d.nextSibling)!==null)break;d=v,v=d.parentNode}d=y}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(km={focusedElem:e,selectionRange:n},pd=!1,Ct=t;Ct!==null;)if(t=Ct,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ct=e;else for(;Ct!==null;){t=Ct;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var S=x.memoizedProps,C=x.memoizedState,E=t.stateNode,w=E.getSnapshotBeforeUpdate(t.elementType===t.type?S:ss(t.type,S),C);E.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var N=t.stateNode.containerInfo;N.nodeType===1?N.textContent="":N.nodeType===9&&N.documentElement&&N.removeChild(N.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ot(163))}}catch(I){Qe(t,t.return,I)}if(e=t.sibling,e!==null){e.return=t.return,Ct=e;break}Ct=t.return}return x=rx,rx=!1,x}function Dc(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&Jm(t,n,s)}i=i.next}while(i!==r)}}function fp(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function $m(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function YE(e){var t=e.alternate;t!==null&&(e.alternate=null,YE(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[zs],delete t[$c],delete t[zm],delete t[dL],delete t[pL])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function KE(e){return e.tag===5||e.tag===3||e.tag===4}function ix(e){t:for(;;){for(;e.sibling===null;){if(e.return===null||KE(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue t;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function tv(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=vd));else if(r!==4&&(e=e.child,e!==null))for(tv(e,t,n),e=e.sibling;e!==null;)tv(e,t,n),e=e.sibling}function ev(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(ev(e,t,n),e=e.sibling;e!==null;)ev(e,t,n),e=e.sibling}var Qn=null,os=!1;function Fo(e,t,n){for(n=n.child;n!==null;)QE(e,t,n),n=n.sibling}function QE(e,t,n){if(Vs&&typeof Vs.onCommitFiberUnmount=="function")try{Vs.onCommitFiberUnmount(rp,n)}catch{}switch(n.tag){case 5:fr||$l(n,t);case 6:var r=Qn,i=os;Qn=null,Fo(e,t,n),Qn=r,os=i,Qn!==null&&(os?(e=Qn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Qn.removeChild(n.stateNode));break;case 18:Qn!==null&&(os?(e=Qn,n=n.stateNode,e.nodeType===8?zg(e.parentNode,n):e.nodeType===1&&zg(e,n),Xc(e)):zg(Qn,n.stateNode));break;case 4:r=Qn,i=os,Qn=n.stateNode.containerInfo,os=!0,Fo(e,t,n),Qn=r,os=i;break;case 0:case 11:case 14:case 15:if(!fr&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&Jm(n,t,a),i=i.next}while(i!==r)}Fo(e,t,n);break;case 1:if(!fr&&($l(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Qe(n,t,l)}Fo(e,t,n);break;case 21:Fo(e,t,n);break;case 22:n.mode&1?(fr=(r=fr)||n.memoizedState!==null,Fo(e,t,n),fr=r):Fo(e,t,n);break;default:Fo(e,t,n)}}function sx(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new TL),t.forEach(function(r){var i=BL.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function rs(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=a),r&=~s}if(r=i,r=nn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ML(r/1960))-r,10e?16:e,Ko===null)var r=!1;else{if(e=Ko,Ko=null,Td=0,ae&6)throw Error(ot(331));var i=ae;for(ae|=4,Ct=e.current;Ct!==null;){var s=Ct,a=s.child;if(Ct.flags&16){var l=s.deletions;if(l!==null){for(var c=0;cnn()-Ey?tl(e,0):wy|=n),Hr(e,t)}function sS(e,t){t===0&&(e.mode&1?(t=xh,xh<<=1,!(xh&130023424)&&(xh=4194304)):t=1);var n=Lr();e=vo(e,t),e!==null&&(Pf(e,t,n),Hr(e,n))}function zL(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),sS(e,n)}function BL(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(ot(314))}r!==null&&r.delete(t),sS(e,n)}var oS;oS=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Gr.current)Vr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Vr=!1,bL(e,t,n);Vr=!!(e.flags&131072)}else Vr=!1,ke&&t.flags&1048576&&cE(t,wd,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Yh(e,t),e=t.pendingProps;var i=uu(t,pr.current);ou(t,n),i=gy(null,t,r,e,i,n);var s=my();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,qr(r)?(s=!0,_d(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,cy(t),i.updater=cp,t.stateNode=i,i._reactInternals=t,Hm(t,r,e,n),t=Xm(null,t,r,!0,s,n)):(t.tag=0,ke&&s&&ry(t),Nr(null,t,i,n),t=t.child),t;case 16:r=t.elementType;t:{switch(Yh(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=VL(r),e=ss(r,e),i){case 0:t=Wm(null,t,r,e,n);break t;case 1:t=tx(null,t,r,e,n);break t;case 11:t=J0(null,t,r,e,n);break t;case 14:t=$0(null,t,r,ss(r.type,e),n);break t}throw Error(ot(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ss(r,i),Wm(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ss(r,i),tx(e,t,r,i,n);case 3:t:{if(GE(t),e===null)throw Error(ot(387));r=t.pendingProps,s=t.memoizedState,i=s.element,mE(e,t),Cd(t,r,null,n);var a=t.memoizedState;if(r=a.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=du(Error(ot(423)),t),t=ex(e,t,r,n,i);break t}else if(r!==i){i=du(Error(ot(424)),t),t=ex(e,t,r,n,i);break t}else for(ii=na(t.stateNode.containerInfo.firstChild),si=t,ke=!0,as=null,n=pE(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(cu(),r===i){t=yo(e,t,n);break t}Nr(e,t,r,n)}t=t.child}return t;case 5:return vE(t),e===null&&Vm(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,a=i.children,Fm(r,i)?a=null:s!==null&&Fm(r,s)&&(t.flags|=32),VE(e,t),Nr(e,t,a,n),t.child;case 6:return e===null&&Vm(t),null;case 13:return qE(e,t,n);case 4:return fy(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=fu(t,null,r,n):Nr(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ss(r,i),J0(e,t,r,i,n);case 7:return Nr(e,t,t.pendingProps,n),t.child;case 8:return Nr(e,t,t.pendingProps.children,n),t.child;case 12:return Nr(e,t,t.pendingProps.children,n),t.child;case 10:t:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,a=i.value,Ne(Ed,r._currentValue),r._currentValue=a,s!==null)if(ms(s.value,a)){if(s.children===i.children&&!Gr.current){t=yo(e,t,n);break t}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){a=s.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(s.tag===1){c=co(-1,n&-n),c.tag=2;var f=s.updateQueue;if(f!==null){f=f.shared;var g=f.pending;g===null?c.next=c:(c.next=g.next,g.next=c),f.pending=c}}s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Gm(s.return,n,t),l.lanes|=n;break}c=c.next}}else if(s.tag===10)a=s.type===t.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error(ot(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),Gm(a,n,t),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===t){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}Nr(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,ou(t,n),i=ji(i),r=r(i),t.flags|=1,Nr(e,t,r,n),t.child;case 14:return r=t.type,i=ss(r,t.pendingProps),i=ss(r.type,i),$0(e,t,r,i,n);case 15:return BE(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:ss(r,i),Yh(e,t),t.tag=1,qr(r)?(e=!0,_d(t)):e=!1,ou(t,n),FE(t,r,i),Hm(t,r,i,n),Xm(null,t,r,!0,e,n);case 19:return HE(e,t,n);case 22:return UE(e,t,n)}throw Error(ot(156,t.tag))};function aS(e,t){return A1(e,t)}function UL(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ai(e,t,n,r){return new UL(e,t,n,r)}function Py(e){return e=e.prototype,!(!e||!e.isReactComponent)}function VL(e){if(typeof e=="function")return Py(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Hv)return 11;if(e===Zv)return 14}return 2}function oa(e,t){var n=e.alternate;return n===null?(n=Ai(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Jh(e,t,n,r,i,s){var a=2;if(r=e,typeof e=="function")Py(e)&&(a=1);else if(typeof e=="string")a=5;else t:switch(e){case ql:return el(n.children,i,s,t);case qv:a=8,i|=8;break;case gm:return e=Ai(12,n,t,i|2),e.elementType=gm,e.lanes=s,e;case mm:return e=Ai(13,n,t,i),e.elementType=mm,e.lanes=s,e;case vm:return e=Ai(19,n,t,i),e.elementType=vm,e.lanes=s,e;case v1:return dp(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case g1:a=10;break t;case m1:a=9;break t;case Hv:a=11;break t;case Zv:a=14;break t;case Bo:a=16,r=null;break t}throw Error(ot(130,e==null?e:typeof e,""))}return t=Ai(a,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function el(e,t,n,r){return e=Ai(7,e,r,t),e.lanes=n,e}function dp(e,t,n,r){return e=Ai(22,e,r,t),e.elementType=v1,e.lanes=n,e.stateNode={isHidden:!1},e}function Wg(e,t,n){return e=Ai(6,e,null,t),e.lanes=n,e}function Xg(e,t,n){return t=Ai(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function GL(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Lg(0),this.expirationTimes=Lg(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Lg(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function by(e,t,n,r,i,s,a,l,c){return e=new GL(e,t,n,l,c),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Ai(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},cy(s),e}function qL(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(fS)}catch(e){console.error(e)}}fS(),f1.exports=mi;var Oy=f1.exports;const YL=$w(Oy);var dx=Oy;dm.createRoot=dx.createRoot,dm.hydrateRoot=dx.hydrateRoot;const KL="modulepreload",QL=function(e){return"/"+e},px={},Yn=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=Promise.allSettled(n.map(c=>{if(c=QL(c),c in px)return;px[c]=!0;const f=c.endsWith(".css"),g=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${g}`))return;const d=document.createElement("link");if(d.rel=f?"stylesheet":KL,f||(d.as="script"),d.crossOrigin="",d.href=c,l&&d.setAttribute("nonce",l),document.head.appendChild(d),f)return new Promise((v,y)=>{d.addEventListener("load",v),d.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return i.then(a=>{for(const l of a||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})};/** * @remix-run/router v1.23.2 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function af(){return af=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function Ry(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function $L(){return Math.random().toString(36).substr(2,8)}function mx(e,t){return{usr:e.state,key:e.key,idx:t}}function ov(e,t,n,r){return n===void 0&&(n=null),af({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Uu(t):t,{state:n,key:t&&t.key||r||$L()})}function Md(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Uu(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function tI(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,a=i.history,l=Qo.Pop,c=null,f=g();f==null&&(f=0,a.replaceState(af({},a.state,{idx:f}),""));function g(){return(a.state||{idx:null}).idx}function d(){l=Qo.Pop;let C=g(),E=C==null?null:C-f;f=C,c&&c({action:l,location:S.location,delta:E})}function v(C,E){l=Qo.Push;let w=ov(S.location,C,E);f=g()+1;let N=mx(w,f),I=S.createHref(w);try{a.pushState(N,"",I)}catch(R){if(R instanceof DOMException&&R.name==="DataCloneError")throw R;i.location.assign(I)}s&&c&&c({action:l,location:S.location,delta:1})}function y(C,E){l=Qo.Replace;let w=ov(S.location,C,E);f=g();let N=mx(w,f),I=S.createHref(w);a.replaceState(N,"",I),s&&c&&c({action:l,location:S.location,delta:0})}function x(C){let E=i.location.origin!=="null"?i.location.origin:i.location.href,w=typeof C=="string"?C:Md(C);return w=w.replace(/ $/,"%20"),sn(E,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,E)}let S={get action(){return l},get location(){return e(i,a)},listen(C){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(gx,d),c=C,()=>{i.removeEventListener(gx,d),c=null}},createHref(C){return t(i,C)},createURL:x,encodeLocation(C){let E=x(C);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:v,replace:y,go(C){return a.go(C)}};return S}var vx;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(vx||(vx={}));function eI(e,t,n){return n===void 0&&(n="/"),nI(e,t,n)}function nI(e,t,n,r){let i=typeof t=="string"?Uu(t):t,s=My(i.pathname||"/",n);if(s==null)return null;let a=hS(e);rI(a);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:a,route:s};c.relativePath.startsWith("/")&&(sn(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let f=aa([r,c.relativePath]),g=n.concat(c);s.children&&s.children.length>0&&(sn(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+f+'".')),hS(s.children,t,g,f)),!(s.path==null&&!s.index)&&t.push({path:f,score:cI(f,s.index),routesMeta:g})};return e.forEach((s,a)=>{var l;if(s.path===""||!((l=s.path)!=null&&l.includes("?")))i(s,a);else for(let c of dS(s.path))i(s,a,c)}),t}function dS(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let a=dS(r.join("/")),l=[];return l.push(...a.map(c=>c===""?s:[s,c].join("/"))),i&&l.push(...a),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function rI(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:fI(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const iI=/^:[\w-]+$/,sI=3,oI=2,aI=1,lI=10,uI=-2,yx=e=>e==="*";function cI(e,t){let n=e.split("/"),r=n.length;return n.some(yx)&&(r+=uI),t&&(r+=oI),n.filter(i=>!yx(i)).reduce((i,s)=>i+(iI.test(s)?sI:s===""?aI:lI),r)}function fI(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function hI(e,t,n){let{routesMeta:r}=e,i={},s="/",a=[];for(let l=0;l{let{paramName:v,isOptional:y}=g;if(v==="*"){let S=l[d]||"";a=s.slice(0,s.length-S.length).replace(/(.)\/+$/,"$1")}const x=l[d];return y&&!x?f[v]=void 0:f[v]=(x||"").replace(/%2F/g,"/"),f},{}),pathname:s,pathnameBase:a,pattern:e}}function pI(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Ry(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function gI(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ry(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function My(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const mI=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,vI=e=>mI.test(e);function yI(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?Uu(e):e,s;if(n)if(vI(n))s=n;else{if(n.includes("//")){let a=n;n=n.replace(/\/\/+/g,"/"),Ry(!1,"Pathnames cannot have embedded double slashes - normalizing "+(a+" -> "+n))}n.startsWith("/")?s=_x(n.substring(1),"/"):s=_x(n,t)}else s=t;return{pathname:s,search:wI(r),hash:EI(i)}}function _x(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Yg(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function _I(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Ay(e,t){let n=_I(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Dy(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=Uu(e):(i=af({},e),sn(!i.pathname||!i.pathname.includes("?"),Yg("?","pathname","search",i)),sn(!i.pathname||!i.pathname.includes("#"),Yg("#","pathname","hash",i)),sn(!i.search||!i.search.includes("#"),Yg("#","search","hash",i)));let s=e===""||i.pathname==="",a=s?"/":i.pathname,l;if(a==null)l=n;else{let d=t.length-1;if(!r&&a.startsWith("..")){let v=a.split("/");for(;v[0]==="..";)v.shift(),d-=1;i.pathname=v.join("/")}l=d>=0?t[d]:"/"}let c=yI(i,l),f=a&&a!=="/"&&a.endsWith("/"),g=(s||a===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(f||g)&&(c.pathname+="/"),c}const aa=e=>e.join("/").replace(/\/\/+/g,"/"),xI=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),wI=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,EI=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function SI(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const pS=["post","put","patch","delete"];new Set(pS);const CI=["get",...pS];new Set(CI);/** * React Router v6.30.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function lf(){return lf=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),P.useCallback(function(f,g){if(g===void 0&&(g={}),!l.current)return;if(typeof f=="number"){r.go(f);return}let d=Dy(f,JSON.parse(a),s,g.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:aa([t,d.pathname])),(g.replace?r.replace:r.push)(d,g.state,g)},[t,r,a,s,e])}function LI(){let{matches:e}=P.useContext(To),t=e[e.length-1];return t?t.params:{}}function vS(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=P.useContext(Pa),{matches:i}=P.useContext(To),{pathname:s}=ba(),a=JSON.stringify(Ay(i,r.v7_relativeSplatPath));return P.useMemo(()=>Dy(e,JSON.parse(a),s,n==="path"),[e,a,s,n])}function II(e,t){return TI(e,t)}function TI(e,t,n,r){Vu()||sn(!1);let{navigator:i}=P.useContext(Pa),{matches:s}=P.useContext(To),a=s[s.length-1],l=a?a.params:{};a&&a.pathname;let c=a?a.pathnameBase:"/";a&&a.route;let f=ba(),g;if(t){var d;let C=typeof t=="string"?Uu(t):t;c==="/"||(d=C.pathname)!=null&&d.startsWith(c)||sn(!1),g=C}else g=f;let v=g.pathname||"/",y=v;if(c!=="/"){let C=c.replace(/^\//,"").split("/");y="/"+v.replace(/^\//,"").split("/").slice(C.length).join("/")}let x=eI(e,{pathname:y}),S=DI(x&&x.map(C=>Object.assign({},C,{params:Object.assign({},l,C.params),pathname:aa([c,i.encodeLocation?i.encodeLocation(C.pathname).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?c:aa([c,i.encodeLocation?i.encodeLocation(C.pathnameBase).pathname:C.pathnameBase])})),s,n,r);return t&&S?P.createElement(yp.Provider,{value:{location:lf({pathname:"/",search:"",hash:"",state:null,key:"default"},g),navigationType:Qo.Pop}},S):S}function OI(){let e=zI(),t=SI(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return P.createElement(P.Fragment,null,P.createElement("h2",null,"Unexpected Application Error!"),P.createElement("h3",{style:{fontStyle:"italic"}},t),n?P.createElement("pre",{style:i},n):null,null)}const RI=P.createElement(OI,null);class MI extends P.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?P.createElement(To.Provider,{value:this.props.routeContext},P.createElement(gS.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function AI(e){let{routeContext:t,match:n,children:r}=e,i=P.useContext(ky);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),P.createElement(To.Provider,{value:t},r)}function DI(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,l=(i=n)==null?void 0:i.errors;if(l!=null){let g=a.findIndex(d=>d.route.id&&(l==null?void 0:l[d.route.id])!==void 0);g>=0||sn(!1),a=a.slice(0,Math.min(a.length,g+1))}let c=!1,f=-1;if(n&&r&&r.v7_partialHydration)for(let g=0;g=0?a=a.slice(0,f+1):a=[a[0]];break}}}return a.reduceRight((g,d,v)=>{let y,x=!1,S=null,C=null;n&&(y=l&&d.route.id?l[d.route.id]:void 0,S=d.route.errorElement||RI,c&&(f<0&&v===0?(UI("route-fallback"),x=!0,C=null):f===v&&(x=!0,C=d.route.hydrateFallbackElement||null)));let E=t.concat(a.slice(0,v+1)),w=()=>{let N;return y?N=S:x?N=C:d.route.Component?N=P.createElement(d.route.Component,null):d.route.element?N=d.route.element:N=g,P.createElement(AI,{match:d,routeContext:{outlet:g,matches:E,isDataRoute:n!=null},children:N})};return n&&(d.route.ErrorBoundary||d.route.errorElement||v===0)?P.createElement(MI,{location:n.location,revalidation:n.revalidation,component:S,error:y,children:w(),routeContext:{outlet:null,matches:E,isDataRoute:!0}}):w()},null)}var yS=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(yS||{}),_S=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(_S||{});function kI(e){let t=P.useContext(ky);return t||sn(!1),t}function FI(e){let t=P.useContext(NI);return t||sn(!1),t}function jI(e){let t=P.useContext(To);return t||sn(!1),t}function xS(e){let t=jI(),n=t.matches[t.matches.length-1];return n.route.id||sn(!1),n.route.id}function zI(){var e;let t=P.useContext(gS),n=FI(),r=xS();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function BI(){let{router:e}=kI(yS.UseNavigateStable),t=xS(_S.UseNavigateStable),n=P.useRef(!1);return mS(()=>{n.current=!0}),P.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,lf({fromRouteId:t},s)))},[e,t])}const xx={};function UI(e,t,n){xx[e]||(xx[e]=!0)}function VI(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function uf(e){let{to:t,replace:n,state:r,relative:i}=e;Vu()||sn(!1);let{future:s,static:a}=P.useContext(Pa),{matches:l}=P.useContext(To),{pathname:c}=ba(),f=La(),g=Dy(t,Ay(l,s.v7_relativeSplatPath),c,i==="path"),d=JSON.stringify(g);return P.useEffect(()=>f(JSON.parse(d),{replace:n,state:r,relative:i}),[f,d,i,n,r]),null}function me(e){sn(!1)}function GI(e){let{basename:t="/",children:n=null,location:r,navigationType:i=Qo.Pop,navigator:s,static:a=!1,future:l}=e;Vu()&&sn(!1);let c=t.replace(/^\/*/,"/"),f=P.useMemo(()=>({basename:c,navigator:s,static:a,future:lf({v7_relativeSplatPath:!1},l)}),[c,l,s,a]);typeof r=="string"&&(r=Uu(r));let{pathname:g="/",search:d="",hash:v="",state:y=null,key:x="default"}=r,S=P.useMemo(()=>{let C=My(g,c);return C==null?null:{location:{pathname:C,search:d,hash:v,state:y,key:x},navigationType:i}},[c,g,d,v,y,x,i]);return S==null?null:P.createElement(Pa.Provider,{value:f},P.createElement(yp.Provider,{children:n,value:S}))}function qI(e){let{children:t,location:n}=e;return II(av(t),n)}new Promise(()=>{});function av(e,t){t===void 0&&(t=[]);let n=[];return P.Children.forEach(e,(r,i)=>{if(!P.isValidElement(r))return;let s=[...t,i];if(r.type===P.Fragment){n.push.apply(n,av(r.props.children,s));return}r.type!==me&&sn(!1),!r.props.index||!r.props.children||sn(!1);let a={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(a.children=av(r.props.children,s)),n.push(a)}),n}/** * React Router DOM v6.30.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function lv(){return lv=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function ZI(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function WI(e,t){return e.button===0&&(!t||t==="_self")&&!ZI(e)}function uv(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function XI(e,t){let n=uv(e);return t&&t.forEach((r,i)=>{n.has(i)||t.getAll(i).forEach(s=>{n.append(i,s)})}),n}const YI=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],KI="6";try{window.__reactRouterVersion=KI}catch{}const QI="startTransition",wx=jP[QI];function JI(e){let{basename:t,children:n,future:r,window:i}=e,s=P.useRef();s.current==null&&(s.current=JL({window:i,v5Compat:!0}));let a=s.current,[l,c]=P.useState({action:a.action,location:a.location}),{v7_startTransition:f}=r||{},g=P.useCallback(d=>{f&&wx?wx(()=>c(d)):c(d)},[c,f]);return P.useLayoutEffect(()=>a.listen(g),[a,g]),P.useEffect(()=>VI(r),[r]),P.createElement(GI,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:a,future:r})}const $I=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",t2=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,tr=P.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:s,replace:a,state:l,target:c,to:f,preventScrollReset:g,viewTransition:d}=t,v=HI(t,YI),{basename:y}=P.useContext(Pa),x,S=!1;if(typeof f=="string"&&t2.test(f)&&(x=f,$I))try{let N=new URL(window.location.href),I=f.startsWith("//")?new URL(N.protocol+f):new URL(f),R=My(I.pathname,y);I.origin===N.origin&&R!=null?f=R+I.search+I.hash:S=!0}catch{}let C=PI(f,{relative:i}),E=e2(f,{replace:a,state:l,target:c,preventScrollReset:g,relative:i,viewTransition:d});function w(N){r&&r(N),N.defaultPrevented||E(N)}return P.createElement("a",lv({},v,{href:x||C,onClick:S||s?r:w,ref:n,target:c}))});var Ex;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Ex||(Ex={}));var Sx;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Sx||(Sx={}));function e2(e,t){let{target:n,replace:r,state:i,preventScrollReset:s,relative:a,viewTransition:l}=t===void 0?{}:t,c=La(),f=ba(),g=vS(e,{relative:a});return P.useCallback(d=>{if(WI(d,n)){d.preventDefault();let v=r!==void 0?r:Md(f)===Md(g);c(e,{replace:v,state:i,preventScrollReset:s,relative:a,viewTransition:l})}},[f,c,g,r,i,n,e,s,a,l])}function wS(e){let t=P.useRef(uv(e)),n=P.useRef(!1),r=ba(),i=P.useMemo(()=>XI(r.search,n.current?null:t.current),[r.search]),s=La(),a=P.useCallback((l,c)=>{const f=uv(typeof l=="function"?l(i):l);n.current=!0,s("?"+f,c)},[s,i]);return[i,a]}function cv(e,t){return cv=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},cv(e,t)}function _p(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,cv(e,t)}var xp=function(){function e(){this.listeners=[]}var t=e.prototype;return t.subscribe=function(r){var i=this,s=r||function(){};return this.listeners.push(s),this.onSubscribe(),function(){i.listeners=i.listeners.filter(function(a){return a!==s}),i.onUnsubscribe()}},t.hasListeners=function(){return this.listeners.length>0},t.onSubscribe=function(){},t.onUnsubscribe=function(){},e}();function de(){return de=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u";function Cr(){}function n2(e,t){return typeof e=="function"?e(t):e}function r2(e){return typeof e=="number"&&e>=0&&e!==1/0}function Ad(e){return Array.isArray(e)?e:[e]}function i2(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Kg(e,t,n){return wp(e)?typeof t=="function"?de({},n,{queryKey:e,queryFn:t}):de({},t,{queryKey:e}):e}function Vo(e,t,n){return wp(e)?[de({},t,{queryKey:e}),n]:[e||{},t]}function s2(e,t){if(e===!0&&t===!0||e==null&&t==null)return"all";if(e===!1&&t===!1)return"none";var n=e??!t;return n?"active":"inactive"}function Cx(e,t){var n=e.active,r=e.exact,i=e.fetching,s=e.inactive,a=e.predicate,l=e.queryKey,c=e.stale;if(wp(l)){if(r){if(t.queryHash!==Fy(l,t.options))return!1}else if(!Dd(t.queryKey,l))return!1}var f=s2(n,s);if(f==="none")return!1;if(f!=="all"){var g=t.isActive();if(f==="active"&&!g||f==="inactive"&&g)return!1}return!(typeof c=="boolean"&&t.isStale()!==c||typeof i=="boolean"&&t.isFetching()!==i||a&&!a(t))}function Nx(e,t){var n=e.exact,r=e.fetching,i=e.predicate,s=e.mutationKey;if(wp(s)){if(!t.options.mutationKey)return!1;if(n){if(Ka(t.options.mutationKey)!==Ka(s))return!1}else if(!Dd(t.options.mutationKey,s))return!1}return!(typeof r=="boolean"&&t.state.status==="loading"!==r||i&&!i(t))}function Fy(e,t){var n=(t==null?void 0:t.queryKeyHashFn)||Ka;return n(e)}function Ka(e){var t=Ad(e);return o2(t)}function o2(e){return JSON.stringify(e,function(t,n){return fv(n)?Object.keys(n).sort().reduce(function(r,i){return r[i]=n[i],r},{}):n})}function Dd(e,t){return SS(Ad(e),Ad(t))}function SS(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(function(n){return!SS(e[n],t[n])}):!1}function CS(e,t){if(e===t)return e;var n=Array.isArray(e)&&Array.isArray(t);if(n||fv(e)&&fv(t)){for(var r=n?e.length:Object.keys(e).length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{},l=0,c=0;c"u")return!0;var n=t.prototype;return!(!Px(n)||!n.hasOwnProperty("isPrototypeOf"))}function Px(e){return Object.prototype.toString.call(e)==="[object Object]"}function wp(e){return typeof e=="string"||Array.isArray(e)}function a2(e){return new Promise(function(t){setTimeout(t,e)})}function bx(e){Promise.resolve().then(e).catch(function(t){return setTimeout(function(){throw t})})}function NS(){if(typeof AbortController=="function")return new AbortController}var l2=function(e){_p(t,e);function t(){var r;return r=e.call(this)||this,r.setup=function(i){var s;if(!ES&&((s=window)!=null&&s.addEventListener)){var a=function(){return i()};return window.addEventListener("visibilitychange",a,!1),window.addEventListener("focus",a,!1),function(){window.removeEventListener("visibilitychange",a),window.removeEventListener("focus",a)}}},r}var n=t.prototype;return n.onSubscribe=function(){this.cleanup||this.setEventListener(this.setup)},n.onUnsubscribe=function(){if(!this.hasListeners()){var i;(i=this.cleanup)==null||i.call(this),this.cleanup=void 0}},n.setEventListener=function(i){var s,a=this;this.setup=i,(s=this.cleanup)==null||s.call(this),this.cleanup=i(function(l){typeof l=="boolean"?a.setFocused(l):a.onFocus()})},n.setFocused=function(i){this.focused=i,i&&this.onFocus()},n.onFocus=function(){this.listeners.forEach(function(i){i()})},n.isFocused=function(){return typeof this.focused=="boolean"?this.focused:typeof document>"u"?!0:[void 0,"visible","prerender"].includes(document.visibilityState)},t}(xp),$h=new l2,u2=function(e){_p(t,e);function t(){var r;return r=e.call(this)||this,r.setup=function(i){var s;if(!ES&&((s=window)!=null&&s.addEventListener)){var a=function(){return i()};return window.addEventListener("online",a,!1),window.addEventListener("offline",a,!1),function(){window.removeEventListener("online",a),window.removeEventListener("offline",a)}}},r}var n=t.prototype;return n.onSubscribe=function(){this.cleanup||this.setEventListener(this.setup)},n.onUnsubscribe=function(){if(!this.hasListeners()){var i;(i=this.cleanup)==null||i.call(this),this.cleanup=void 0}},n.setEventListener=function(i){var s,a=this;this.setup=i,(s=this.cleanup)==null||s.call(this),this.cleanup=i(function(l){typeof l=="boolean"?a.setOnline(l):a.onOnline()})},n.setOnline=function(i){this.online=i,i&&this.onOnline()},n.onOnline=function(){this.listeners.forEach(function(i){i()})},n.isOnline=function(){return typeof this.online=="boolean"?this.online:typeof navigator>"u"||typeof navigator.onLine>"u"?!0:navigator.onLine},t}(xp),td=new u2;function c2(e){return Math.min(1e3*Math.pow(2,e),3e4)}function kd(e){return typeof(e==null?void 0:e.cancel)=="function"}var PS=function(t){this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent};function Qg(e){return e instanceof PS}var bS=function(t){var n=this,r=!1,i,s,a,l;this.abort=t.abort,this.cancel=function(v){return i==null?void 0:i(v)},this.cancelRetry=function(){r=!0},this.continueRetry=function(){r=!1},this.continue=function(){return s==null?void 0:s()},this.failureCount=0,this.isPaused=!1,this.isResolved=!1,this.isTransportCancelable=!1,this.promise=new Promise(function(v,y){a=v,l=y});var c=function(y){n.isResolved||(n.isResolved=!0,t.onSuccess==null||t.onSuccess(y),s==null||s(),a(y))},f=function(y){n.isResolved||(n.isResolved=!0,t.onError==null||t.onError(y),s==null||s(),l(y))},g=function(){return new Promise(function(y){s=y,n.isPaused=!0,t.onPause==null||t.onPause()}).then(function(){s=void 0,n.isPaused=!1,t.onContinue==null||t.onContinue()})},d=function v(){if(!n.isResolved){var y;try{y=t.fn()}catch(x){y=Promise.reject(x)}i=function(S){if(!n.isResolved&&(f(new PS(S)),n.abort==null||n.abort(),kd(y)))try{y.cancel()}catch{}},n.isTransportCancelable=kd(y),Promise.resolve(y).then(c).catch(function(x){var S,C;if(!n.isResolved){var E=(S=t.retry)!=null?S:3,w=(C=t.retryDelay)!=null?C:c2,N=typeof w=="function"?w(n.failureCount,x):w,I=E===!0||typeof E=="number"&&n.failureCount"u"&&(l.exact=!0),this.queries.find(function(c){return Cx(l,c)})},n.findAll=function(i,s){var a=Vo(i,s),l=a[0];return Object.keys(l).length>0?this.queries.filter(function(c){return Cx(l,c)}):this.queries},n.notify=function(i){var s=this;$n.batch(function(){s.listeners.forEach(function(a){a(i)})})},n.onFocus=function(){var i=this;$n.batch(function(){i.queries.forEach(function(s){s.onFocus()})})},n.onOnline=function(){var i=this;$n.batch(function(){i.queries.forEach(function(s){s.onOnline()})})},t}(xp),g2=function(){function e(n){this.options=de({},n.defaultOptions,n.options),this.mutationId=n.mutationId,this.mutationCache=n.mutationCache,this.observers=[],this.state=n.state||m2(),this.meta=n.meta}var t=e.prototype;return t.setState=function(r){this.dispatch({type:"setState",state:r})},t.addObserver=function(r){this.observers.indexOf(r)===-1&&this.observers.push(r)},t.removeObserver=function(r){this.observers=this.observers.filter(function(i){return i!==r})},t.cancel=function(){return this.retryer?(this.retryer.cancel(),this.retryer.promise.then(Cr).catch(Cr)):Promise.resolve()},t.continue=function(){return this.retryer?(this.retryer.continue(),this.retryer.promise):this.execute()},t.execute=function(){var r=this,i,s=this.state.status==="loading",a=Promise.resolve();return s||(this.dispatch({type:"loading",variables:this.options.variables}),a=a.then(function(){r.mutationCache.config.onMutate==null||r.mutationCache.config.onMutate(r.state.variables,r)}).then(function(){return r.options.onMutate==null?void 0:r.options.onMutate(r.state.variables)}).then(function(l){l!==r.state.context&&r.dispatch({type:"loading",context:l,variables:r.state.variables})})),a.then(function(){return r.executeMutation()}).then(function(l){i=l,r.mutationCache.config.onSuccess==null||r.mutationCache.config.onSuccess(i,r.state.variables,r.state.context,r)}).then(function(){return r.options.onSuccess==null?void 0:r.options.onSuccess(i,r.state.variables,r.state.context)}).then(function(){return r.options.onSettled==null?void 0:r.options.onSettled(i,null,r.state.variables,r.state.context)}).then(function(){return r.dispatch({type:"success",data:i}),i}).catch(function(l){return r.mutationCache.config.onError==null||r.mutationCache.config.onError(l,r.state.variables,r.state.context,r),IS().error(l),Promise.resolve().then(function(){return r.options.onError==null?void 0:r.options.onError(l,r.state.variables,r.state.context)}).then(function(){return r.options.onSettled==null?void 0:r.options.onSettled(void 0,l,r.state.variables,r.state.context)}).then(function(){throw r.dispatch({type:"error",error:l}),l})})},t.executeMutation=function(){var r=this,i;return this.retryer=new bS({fn:function(){return r.options.mutationFn?r.options.mutationFn(r.state.variables):Promise.reject("No mutationFn found")},onFail:function(){r.dispatch({type:"failed"})},onPause:function(){r.dispatch({type:"pause"})},onContinue:function(){r.dispatch({type:"continue"})},retry:(i=this.options.retry)!=null?i:0,retryDelay:this.options.retryDelay}),this.retryer.promise},t.dispatch=function(r){var i=this;this.state=v2(this.state,r),$n.batch(function(){i.observers.forEach(function(s){s.onMutationUpdate(r)}),i.mutationCache.notify(i)})},e}();function m2(){return{context:void 0,data:void 0,error:null,failureCount:0,isPaused:!1,status:"idle",variables:void 0}}function v2(e,t){switch(t.type){case"failed":return de({},e,{failureCount:e.failureCount+1});case"pause":return de({},e,{isPaused:!0});case"continue":return de({},e,{isPaused:!1});case"loading":return de({},e,{context:t.context,data:void 0,error:null,isPaused:!1,status:"loading",variables:t.variables});case"success":return de({},e,{data:t.data,error:null,status:"success",isPaused:!1});case"error":return de({},e,{data:void 0,error:t.error,failureCount:e.failureCount+1,isPaused:!1,status:"error"});case"setState":return de({},e,t.state);default:return e}}var y2=function(e){_p(t,e);function t(r){var i;return i=e.call(this)||this,i.config=r||{},i.mutations=[],i.mutationId=0,i}var n=t.prototype;return n.build=function(i,s,a){var l=new g2({mutationCache:this,mutationId:++this.mutationId,options:i.defaultMutationOptions(s),state:a,defaultOptions:s.mutationKey?i.getMutationDefaults(s.mutationKey):void 0,meta:s.meta});return this.add(l),l},n.add=function(i){this.mutations.push(i),this.notify(i)},n.remove=function(i){this.mutations=this.mutations.filter(function(s){return s!==i}),i.cancel(),this.notify(i)},n.clear=function(){var i=this;$n.batch(function(){i.mutations.forEach(function(s){i.remove(s)})})},n.getAll=function(){return this.mutations},n.find=function(i){return typeof i.exact>"u"&&(i.exact=!0),this.mutations.find(function(s){return Nx(i,s)})},n.findAll=function(i){return this.mutations.filter(function(s){return Nx(i,s)})},n.notify=function(i){var s=this;$n.batch(function(){s.listeners.forEach(function(a){a(i)})})},n.onFocus=function(){this.resumePausedMutations()},n.onOnline=function(){this.resumePausedMutations()},n.resumePausedMutations=function(){var i=this.mutations.filter(function(s){return s.state.isPaused});return $n.batch(function(){return i.reduce(function(s,a){return s.then(function(){return a.continue().catch(Cr)})},Promise.resolve())})},t}(xp);function _2(){return{onFetch:function(t){t.fetchFn=function(){var n,r,i,s,a,l,c=(n=t.fetchOptions)==null||(r=n.meta)==null?void 0:r.refetchPage,f=(i=t.fetchOptions)==null||(s=i.meta)==null?void 0:s.fetchMore,g=f==null?void 0:f.pageParam,d=(f==null?void 0:f.direction)==="forward",v=(f==null?void 0:f.direction)==="backward",y=((a=t.state.data)==null?void 0:a.pages)||[],x=((l=t.state.data)==null?void 0:l.pageParams)||[],S=NS(),C=S==null?void 0:S.signal,E=x,w=!1,N=t.options.queryFn||function(){return Promise.reject("Missing queryFn")},I=function(D,ut,it,yt){return E=yt?[ut].concat(E):[].concat(E,[ut]),yt?[it].concat(D):[].concat(D,[it])},R=function(D,ut,it,yt){if(w)return Promise.reject("Cancelled");if(typeof it>"u"&&!ut&&D.length)return Promise.resolve(D);var z={queryKey:t.queryKey,signal:C,pageParam:it,meta:t.meta},at=N(z),tt=Promise.resolve(at).then(function(Lt){return I(D,it,Lt,yt)});if(kd(at)){var vt=tt;vt.cancel=at.cancel}return tt},A;if(!y.length)A=R([]);else if(d){var B=typeof g<"u",q=B?g:Lx(t.options,y);A=R(y,B,q)}else if(v){var Q=typeof g<"u",Y=Q?g:x2(t.options,y);A=R(y,Q,Y,!0)}else(function(){E=[];var $=typeof t.options.getNextPageParam>"u",D=c&&y[0]?c(y[0],0,y):!0;A=D?R([],$,x[0]):Promise.resolve(I([],x[0],y[0]));for(var ut=function(z){A=A.then(function(at){var tt=c&&y[z]?c(y[z],z,y):!0;if(tt){var vt=$?x[z]:Lx(t.options,at);return R(at,$,vt)}return Promise.resolve(I(at,x[z],y[z]))})},it=1;it"u"&&(g.revert=!0);var d=$n.batch(function(){return a.queryCache.findAll(c).map(function(v){return v.cancel(g)})});return Promise.all(d).then(Cr).catch(Cr)},t.invalidateQueries=function(r,i,s){var a,l,c,f=this,g=Vo(r,i,s),d=g[0],v=g[1],y=de({},d,{active:(a=(l=d.refetchActive)!=null?l:d.active)!=null?a:!0,inactive:(c=d.refetchInactive)!=null?c:!1});return $n.batch(function(){return f.queryCache.findAll(d).forEach(function(x){x.invalidate()}),f.refetchQueries(y,v)})},t.refetchQueries=function(r,i,s){var a=this,l=Vo(r,i,s),c=l[0],f=l[1],g=$n.batch(function(){return a.queryCache.findAll(c).map(function(v){return v.fetch(void 0,de({},f,{meta:{refetchPage:c==null?void 0:c.refetchPage}}))})}),d=Promise.all(g).then(Cr);return f!=null&&f.throwOnError||(d=d.catch(Cr)),d},t.fetchQuery=function(r,i,s){var a=Kg(r,i,s),l=this.defaultQueryOptions(a);typeof l.retry>"u"&&(l.retry=!1);var c=this.queryCache.build(this,l);return c.isStaleByTime(l.staleTime)?c.fetch(l):Promise.resolve(c.state.data)},t.prefetchQuery=function(r,i,s){return this.fetchQuery(r,i,s).then(Cr).catch(Cr)},t.fetchInfiniteQuery=function(r,i,s){var a=Kg(r,i,s);return a.behavior=_2(),this.fetchQuery(a)},t.prefetchInfiniteQuery=function(r,i,s){return this.fetchInfiniteQuery(r,i,s).then(Cr).catch(Cr)},t.cancelMutations=function(){var r=this,i=$n.batch(function(){return r.mutationCache.getAll().map(function(s){return s.cancel()})});return Promise.all(i).then(Cr).catch(Cr)},t.resumePausedMutations=function(){return this.getMutationCache().resumePausedMutations()},t.executeMutation=function(r){return this.mutationCache.build(this,r).execute()},t.getQueryCache=function(){return this.queryCache},t.getMutationCache=function(){return this.mutationCache},t.getDefaultOptions=function(){return this.defaultOptions},t.setDefaultOptions=function(r){this.defaultOptions=r},t.setQueryDefaults=function(r,i){var s=this.queryDefaults.find(function(a){return Ka(r)===Ka(a.queryKey)});s?s.defaultOptions=i:this.queryDefaults.push({queryKey:r,defaultOptions:i})},t.getQueryDefaults=function(r){var i;return r?(i=this.queryDefaults.find(function(s){return Dd(r,s.queryKey)}))==null?void 0:i.defaultOptions:void 0},t.setMutationDefaults=function(r,i){var s=this.mutationDefaults.find(function(a){return Ka(r)===Ka(a.mutationKey)});s?s.defaultOptions=i:this.mutationDefaults.push({mutationKey:r,defaultOptions:i})},t.getMutationDefaults=function(r){var i;return r?(i=this.mutationDefaults.find(function(s){return Dd(r,s.mutationKey)}))==null?void 0:i.defaultOptions:void 0},t.defaultQueryOptions=function(r){if(r!=null&&r._defaulted)return r;var i=de({},this.defaultOptions.queries,this.getQueryDefaults(r==null?void 0:r.queryKey),r,{_defaulted:!0});return!i.queryHash&&i.queryKey&&(i.queryHash=Fy(i.queryKey,i)),i},t.defaultQueryObserverOptions=function(r){return this.defaultQueryOptions(r)},t.defaultMutationOptions=function(r){return r!=null&&r._defaulted?r:de({},this.defaultOptions.mutations,this.getMutationDefaults(r==null?void 0:r.mutationKey),r,{_defaulted:!0})},t.clear=function(){this.queryCache.clear(),this.mutationCache.clear()},e}(),E2=YL.unstable_batchedUpdates;$n.setBatchNotifyFunction(E2);var S2=console;h2(S2);var Ix=ye.createContext(void 0),C2=ye.createContext(!1);function N2(e){return e&&typeof window<"u"?(window.ReactQueryClientContext||(window.ReactQueryClientContext=Ix),window.ReactQueryClientContext):Ix}var P2=function(t){var n=t.client,r=t.contextSharing,i=r===void 0?!1:r,s=t.children;ye.useEffect(function(){return n.mount(),function(){n.unmount()}},[n]);var a=N2(i);return ye.createElement(C2.Provider,{value:i},ye.createElement(a.Provider,{value:n},s))};let b2={data:""},L2=e=>{if(typeof window=="object"){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||b2},I2=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,T2=/\/\*[^]*?\*\/| +/g,Tx=/\n+/g,Ho=(e,t)=>{let n="",r="",i="";for(let s in e){let a=e[s];s[0]=="@"?s[1]=="i"?n=s+" "+a+";":r+=s[1]=="f"?Ho(a,s):s+"{"+Ho(a,s[1]=="k"?"":t)+"}":typeof a=="object"?r+=Ho(a,t?t.replace(/([^,])+/g,l=>s.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,c=>/&/.test(c)?c.replace(/&/g,l):l?l+" "+c:c)):s):a!=null&&(s=/^--/.test(s)?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),i+=Ho.p?Ho.p(s,a):s+":"+a+";")}return n+(t&&i?t+"{"+i+"}":i)+r},io={},TS=e=>{if(typeof e=="object"){let t="";for(let n in e)t+=n+TS(e[n]);return t}return e},O2=(e,t,n,r,i)=>{let s=TS(e),a=io[s]||(io[s]=(c=>{let f=0,g=11;for(;f>>0;return"go"+g})(s));if(!io[a]){let c=s!==e?e:(f=>{let g,d,v=[{}];for(;g=I2.exec(f.replace(T2,""));)g[4]?v.shift():g[3]?(d=g[3].replace(Tx," ").trim(),v.unshift(v[0][d]=v[0][d]||{})):v[0][g[1]]=g[2].replace(Tx," ").trim();return v[0]})(e);io[a]=Ho(i?{["@keyframes "+a]:c}:c,n?"":"."+a)}let l=n&&io.g?io.g:null;return n&&(io.g=io[a]),((c,f,g,d)=>{d?f.data=f.data.replace(d,c):f.data.indexOf(c)===-1&&(f.data=g?c+f.data:f.data+c)})(io[a],t,r,l),a},R2=(e,t,n)=>e.reduce((r,i,s)=>{let a=t[s];if(a&&a.call){let l=a(n),c=l&&l.props&&l.props.className||/^go/.test(l)&&l;a=c?"."+c:l&&typeof l=="object"?l.props?"":Ho(l,""):l===!1?"":l}return r+i+(a??"")},"");function Ep(e){let t=this||{},n=e.call?e(t.p):e;return O2(n.unshift?n.raw?R2(n,[].slice.call(arguments,1),t.p):n.reduce((r,i)=>Object.assign(r,i&&i.call?i(t.p):i),{}):n,L2(t.target),t.g,t.o,t.k)}let OS,hv,dv;Ep.bind({g:1});let _o=Ep.bind({k:1});function M2(e,t,n,r){Ho.p=t,OS=e,hv=n,dv=r}function Ia(e,t){let n=this||{};return function(){let r=arguments;function i(s,a){let l=Object.assign({},s),c=l.className||i.className;n.p=Object.assign({theme:hv&&hv()},l),n.o=/ *go\d+/.test(c),l.className=Ep.apply(n,r)+(c?" "+c:"");let f=e;return e[0]&&(f=l.as||e,delete l.as),dv&&f[0]&&dv(l),OS(f,l)}return i}}var A2=e=>typeof e=="function",Fd=(e,t)=>A2(e)?e(t):e,D2=(()=>{let e=0;return()=>(++e).toString()})(),RS=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),k2=20,jy="default",MS=(e,t)=>{let{toastLimit:n}=e.settings;switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,n)};case 1:return{...e,toasts:e.toasts.map(a=>a.id===t.toast.id?{...a,...t.toast}:a)};case 2:let{toast:r}=t;return MS(e,{type:e.toasts.find(a=>a.id===r.id)?1:0,toast:r});case 3:let{toastId:i}=t;return{...e,toasts:e.toasts.map(a=>a.id===i||i===void 0?{...a,dismissed:!0,visible:!1}:a)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(a=>a.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let s=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(a=>({...a,pauseDuration:a.pauseDuration+s}))}}},ed=[],AS={toasts:[],pausedAt:void 0,settings:{toastLimit:k2}},Bs={},DS=(e,t=jy)=>{Bs[t]=MS(Bs[t]||AS,e),ed.forEach(([n,r])=>{n===t&&r(Bs[t])})},kS=e=>Object.keys(Bs).forEach(t=>DS(e,t)),F2=e=>Object.keys(Bs).find(t=>Bs[t].toasts.some(n=>n.id===e)),Sp=(e=jy)=>t=>{DS(t,e)},j2={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},z2=(e={},t=jy)=>{let[n,r]=P.useState(Bs[t]||AS),i=P.useRef(Bs[t]);P.useEffect(()=>(i.current!==Bs[t]&&r(Bs[t]),ed.push([t,r]),()=>{let a=ed.findIndex(([l])=>l===t);a>-1&&ed.splice(a,1)}),[t]);let s=n.toasts.map(a=>{var l,c,f;return{...e,...e[a.type],...a,removeDelay:a.removeDelay||((l=e[a.type])==null?void 0:l.removeDelay)||(e==null?void 0:e.removeDelay),duration:a.duration||((c=e[a.type])==null?void 0:c.duration)||(e==null?void 0:e.duration)||j2[a.type],style:{...e.style,...(f=e[a.type])==null?void 0:f.style,...a.style}}});return{...n,toasts:s}},B2=(e,t="blank",n)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...n,id:(n==null?void 0:n.id)||D2()}),Tf=e=>(t,n)=>{let r=B2(t,e,n);return Sp(r.toasterId||F2(r.id))({type:2,toast:r}),r.id},Tn=(e,t)=>Tf("blank")(e,t);Tn.error=Tf("error");Tn.success=Tf("success");Tn.loading=Tf("loading");Tn.custom=Tf("custom");Tn.dismiss=(e,t)=>{let n={type:3,toastId:e};t?Sp(t)(n):kS(n)};Tn.dismissAll=e=>Tn.dismiss(void 0,e);Tn.remove=(e,t)=>{let n={type:4,toastId:e};t?Sp(t)(n):kS(n)};Tn.removeAll=e=>Tn.remove(void 0,e);Tn.promise=(e,t,n)=>{let r=Tn.loading(t.loading,{...n,...n==null?void 0:n.loading});return typeof e=="function"&&(e=e()),e.then(i=>{let s=t.success?Fd(t.success,i):void 0;return s?Tn.success(s,{id:r,...n,...n==null?void 0:n.success}):Tn.dismiss(r),i}).catch(i=>{let s=t.error?Fd(t.error,i):void 0;s?Tn.error(s,{id:r,...n,...n==null?void 0:n.error}):Tn.dismiss(r)}),e};var U2=1e3,V2=(e,t="default")=>{let{toasts:n,pausedAt:r}=z2(e,t),i=P.useRef(new Map).current,s=P.useCallback((d,v=U2)=>{if(i.has(d))return;let y=setTimeout(()=>{i.delete(d),a({type:4,toastId:d})},v);i.set(d,y)},[]);P.useEffect(()=>{if(r)return;let d=Date.now(),v=n.map(y=>{if(y.duration===1/0)return;let x=(y.duration||0)+y.pauseDuration-(d-y.createdAt);if(x<0){y.visible&&Tn.dismiss(y.id);return}return setTimeout(()=>Tn.dismiss(y.id,t),x)});return()=>{v.forEach(y=>y&&clearTimeout(y))}},[n,r,t]);let a=P.useCallback(Sp(t),[t]),l=P.useCallback(()=>{a({type:5,time:Date.now()})},[a]),c=P.useCallback((d,v)=>{a({type:1,toast:{id:d,height:v}})},[a]),f=P.useCallback(()=>{r&&a({type:6,time:Date.now()})},[r,a]),g=P.useCallback((d,v)=>{let{reverseOrder:y=!1,gutter:x=8,defaultPosition:S}=v||{},C=n.filter(N=>(N.position||S)===(d.position||S)&&N.height),E=C.findIndex(N=>N.id===d.id),w=C.filter((N,I)=>IN.visible).slice(...y?[w+1]:[0,w]).reduce((N,I)=>N+(I.height||0)+x,0)},[n]);return P.useEffect(()=>{n.forEach(d=>{if(d.dismissed)s(d.id,d.removeDelay);else{let v=i.get(d.id);v&&(clearTimeout(v),i.delete(d.id))}})},[n,s]),{toasts:n,handlers:{updateHeight:c,startPause:l,endPause:f,calculateOffset:g}}},G2=_o` from { transform: scale(0) rotate(45deg); opacity: 0; } to { transform: scale(1) rotate(45deg); opacity: 1; }`,q2=_o` from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; }`,H2=_o` from { transform: scale(0) rotate(90deg); opacity: 0; } to { transform: scale(1) rotate(90deg); opacity: 1; }`,Z2=Ia("div")` width: 20px; opacity: 0; height: 20px; border-radius: 10px; background: ${e=>e.primary||"#ff4b4b"}; position: relative; transform: rotate(45deg); animation: ${G2} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; animation-delay: 100ms; &:after, &:before { content: ''; animation: ${q2} 0.15s ease-out forwards; animation-delay: 150ms; position: absolute; border-radius: 3px; opacity: 0; background: ${e=>e.secondary||"#fff"}; bottom: 9px; left: 4px; height: 2px; width: 12px; } &:before { animation: ${H2} 0.15s ease-out forwards; animation-delay: 180ms; transform: rotate(90deg); } `,W2=_o` from { transform: rotate(0deg); } to { transform: rotate(360deg); } `,X2=Ia("div")` width: 12px; height: 12px; box-sizing: border-box; border: 2px solid; border-radius: 100%; border-color: ${e=>e.secondary||"#e0e0e0"}; border-right-color: ${e=>e.primary||"#616161"}; animation: ${W2} 1s linear infinite; `,Y2=_o` from { transform: scale(0) rotate(45deg); opacity: 0; } to { transform: scale(1) rotate(45deg); opacity: 1; }`,K2=_o` 0% { height: 0; width: 0; opacity: 0; } 40% { height: 0; width: 6px; opacity: 1; } 100% { opacity: 1; height: 10px; }`,Q2=Ia("div")` width: 20px; opacity: 0; height: 20px; border-radius: 10px; background: ${e=>e.primary||"#61d345"}; position: relative; transform: rotate(45deg); animation: ${Y2} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; animation-delay: 100ms; &:after { content: ''; box-sizing: border-box; animation: ${K2} 0.2s ease-out forwards; opacity: 0; animation-delay: 200ms; position: absolute; border-right: 2px solid; border-bottom: 2px solid; border-color: ${e=>e.secondary||"#fff"}; bottom: 6px; left: 6px; height: 10px; width: 6px; } `,J2=Ia("div")` position: absolute; `,$2=Ia("div")` position: relative; display: flex; justify-content: center; align-items: center; min-width: 20px; min-height: 20px; `,tT=_o` from { transform: scale(0.6); opacity: 0.4; } to { transform: scale(1); opacity: 1; }`,eT=Ia("div")` position: relative; transform: scale(0.6); opacity: 0.4; min-width: 20px; animation: ${tT} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; `,nT=({toast:e})=>{let{icon:t,type:n,iconTheme:r}=e;return t!==void 0?typeof t=="string"?P.createElement(eT,null,t):t:n==="blank"?null:P.createElement($2,null,P.createElement(X2,{...r}),n!=="loading"&&P.createElement(J2,null,n==="error"?P.createElement(Z2,{...r}):P.createElement(Q2,{...r})))},rT=e=>` 0% {transform: translate3d(0,${e*-200}%,0) scale(.6); opacity:.5;} 100% {transform: translate3d(0,0,0) scale(1); opacity:1;} `,iT=e=>` 0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;} 100% {transform: translate3d(0,${e*-150}%,-1px) scale(.6); opacity:0;} `,sT="0%{opacity:0;} 100%{opacity:1;}",oT="0%{opacity:1;} 100%{opacity:0;}",aT=Ia("div")` display: flex; align-items: center; background: #fff; color: #363636; line-height: 1.3; will-change: transform; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05); max-width: 350px; pointer-events: auto; padding: 8px 10px; border-radius: 8px; `,lT=Ia("div")` display: flex; justify-content: center; margin: 4px 10px; color: inherit; flex: 1 1 auto; white-space: pre-line; `,uT=(e,t)=>{let n=e.includes("top")?1:-1,[r,i]=RS()?[sT,oT]:[rT(n),iT(n)];return{animation:t?`${_o(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${_o(i)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},cT=P.memo(({toast:e,position:t,style:n,children:r})=>{let i=e.height?uT(e.position||t||"top-center",e.visible):{opacity:0},s=P.createElement(nT,{toast:e}),a=P.createElement(lT,{...e.ariaProps},Fd(e.message,e));return P.createElement(aT,{className:e.className,style:{...i,...n,...e.style}},typeof r=="function"?r({icon:s,message:a}):P.createElement(P.Fragment,null,s,a))});M2(P.createElement);var fT=({id:e,className:t,style:n,onHeightUpdate:r,children:i})=>{let s=P.useCallback(a=>{if(a){let l=()=>{let c=a.getBoundingClientRect().height;r(e,c)};l(),new MutationObserver(l).observe(a,{subtree:!0,childList:!0,characterData:!0})}},[e,r]);return P.createElement("div",{ref:s,className:t,style:n},i)},hT=(e,t)=>{let n=e.includes("top"),r=n?{top:0}:{bottom:0},i=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:RS()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(n?1:-1)}px)`,...r,...i}},dT=Ep` z-index: 9999; > * { pointer-events: auto; } `,Rh=16,pT=({reverseOrder:e,position:t="top-center",toastOptions:n,gutter:r,children:i,toasterId:s,containerStyle:a,containerClassName:l})=>{let{toasts:c,handlers:f}=V2(n,s);return P.createElement("div",{"data-rht-toaster":s||"",style:{position:"fixed",zIndex:9999,top:Rh,left:Rh,right:Rh,bottom:Rh,pointerEvents:"none",...a},className:l,onMouseEnter:f.startPause,onMouseLeave:f.endPause},c.map(g=>{let d=g.position||t,v=f.calculateOffset(g,{reverseOrder:e,gutter:r,defaultPosition:t}),y=hT(d,v);return P.createElement(fT,{id:g.id,key:g.id,onHeightUpdate:f.updateHeight,className:g.visible?dT:"",style:y},g.type==="custom"?Fd(g.message,g):i?i(g):P.createElement(cT,{toast:g,position:d}))}))},re=Tn;function FS(e,t){return function(){return e.apply(t,arguments)}}const{toString:gT}=Object.prototype,{getPrototypeOf:zy}=Object,{iterator:Cp,toStringTag:jS}=Symbol,Np=(e=>t=>{const n=gT.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ps=e=>(e=e.toLowerCase(),t=>Np(t)===e),Pp=e=>t=>typeof t===e,{isArray:Gu}=Array,gu=Pp("undefined");function Of(e){return e!==null&&!gu(e)&&e.constructor!==null&&!gu(e.constructor)&&Zr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const zS=Ps("ArrayBuffer");function mT(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&zS(e.buffer),t}const vT=Pp("string"),Zr=Pp("function"),BS=Pp("number"),Rf=e=>e!==null&&typeof e=="object",yT=e=>e===!0||e===!1,nd=e=>{if(Np(e)!=="object")return!1;const t=zy(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(jS in e)&&!(Cp in e)},_T=e=>{if(!Rf(e)||Of(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},xT=Ps("Date"),wT=Ps("File"),ET=e=>!!(e&&typeof e.uri<"u"),ST=e=>e&&typeof e.getParts<"u",CT=Ps("Blob"),NT=Ps("FileList"),PT=e=>Rf(e)&&Zr(e.pipe);function bT(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Ox=bT(),Rx=typeof Ox.FormData<"u"?Ox.FormData:void 0,LT=e=>{let t;return e&&(Rx&&e instanceof Rx||Zr(e.append)&&((t=Np(e))==="formdata"||t==="object"&&Zr(e.toString)&&e.toString()==="[object FormData]"))},IT=Ps("URLSearchParams"),[TT,OT,RT,MT]=["ReadableStream","Request","Response","Headers"].map(Ps),AT=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Mf(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,i;if(typeof e!="object"&&(e=[e]),Gu(e))for(r=0,i=e.length;r0;)if(i=n[r],t===i.toLowerCase())return i;return null}const Qa=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,VS=e=>!gu(e)&&e!==Qa;function pv(){const{caseless:e,skipUndefined:t}=VS(this)&&this||{},n={},r=(i,s)=>{if(s==="__proto__"||s==="constructor"||s==="prototype")return;const a=e&&US(n,s)||s;nd(n[a])&&nd(i)?n[a]=pv(n[a],i):nd(i)?n[a]=pv({},i):Gu(i)?n[a]=i.slice():(!t||!gu(i))&&(n[a]=i)};for(let i=0,s=arguments.length;i(Mf(t,(i,s)=>{n&&Zr(i)?Object.defineProperty(e,s,{value:FS(i,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,s,{value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),kT=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),FT=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},jT=(e,t,n,r)=>{let i,s,a;const l={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),s=i.length;s-- >0;)a=i[s],(!r||r(a,e,t))&&!l[a]&&(t[a]=e[a],l[a]=!0);e=n!==!1&&zy(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},zT=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},BT=e=>{if(!e)return null;if(Gu(e))return e;let t=e.length;if(!BS(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},UT=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&zy(Uint8Array)),VT=(e,t)=>{const r=(e&&e[Cp]).call(e);let i;for(;(i=r.next())&&!i.done;){const s=i.value;t.call(e,s[0],s[1])}},GT=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},qT=Ps("HTMLFormElement"),HT=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),Mx=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),ZT=Ps("RegExp"),GS=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Mf(n,(i,s)=>{let a;(a=t(i,s,e))!==!1&&(r[s]=a||i)}),Object.defineProperties(e,r)},WT=e=>{GS(e,(t,n)=>{if(Zr(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Zr(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},XT=(e,t)=>{const n={},r=i=>{i.forEach(s=>{n[s]=!0})};return Gu(e)?r(e):r(String(e).split(t)),n},YT=()=>{},KT=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function QT(e){return!!(e&&Zr(e.append)&&e[jS]==="FormData"&&e[Cp])}const JT=e=>{const t=new Array(10),n=(r,i)=>{if(Rf(r)){if(t.indexOf(r)>=0)return;if(Of(r))return r;if(!("toJSON"in r)){t[i]=r;const s=Gu(r)?[]:{};return Mf(r,(a,l)=>{const c=n(a,i+1);!gu(c)&&(s[l]=c)}),t[i]=void 0,s}}return r};return n(e,0)},$T=Ps("AsyncFunction"),tO=e=>e&&(Rf(e)||Zr(e))&&Zr(e.then)&&Zr(e.catch),qS=((e,t)=>e?setImmediate:t?((n,r)=>(Qa.addEventListener("message",({source:i,data:s})=>{i===Qa&&s===n&&r.length&&r.shift()()},!1),i=>{r.push(i),Qa.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Zr(Qa.postMessage)),eO=typeof queueMicrotask<"u"?queueMicrotask.bind(Qa):typeof process<"u"&&process.nextTick||qS,nO=e=>e!=null&&Zr(e[Cp]),H={isArray:Gu,isArrayBuffer:zS,isBuffer:Of,isFormData:LT,isArrayBufferView:mT,isString:vT,isNumber:BS,isBoolean:yT,isObject:Rf,isPlainObject:nd,isEmptyObject:_T,isReadableStream:TT,isRequest:OT,isResponse:RT,isHeaders:MT,isUndefined:gu,isDate:xT,isFile:wT,isReactNativeBlob:ET,isReactNative:ST,isBlob:CT,isRegExp:ZT,isFunction:Zr,isStream:PT,isURLSearchParams:IT,isTypedArray:UT,isFileList:NT,forEach:Mf,merge:pv,extend:DT,trim:AT,stripBOM:kT,inherits:FT,toFlatObject:jT,kindOf:Np,kindOfTest:Ps,endsWith:zT,toArray:BT,forEachEntry:VT,matchAll:GT,isHTMLForm:qT,hasOwnProperty:Mx,hasOwnProp:Mx,reduceDescriptors:GS,freezeMethods:WT,toObjectSet:XT,toCamelCase:HT,noop:YT,toFiniteNumber:KT,findKey:US,global:Qa,isContextDefined:VS,isSpecCompliantForm:QT,toJSONObject:JT,isAsyncFn:$T,isThenable:tO,setImmediate:qS,asap:eO,isIterable:nO};let Ft=class HS extends Error{static from(t,n,r,i,s,a){const l=new HS(t.message,n||t.code,r,i,s);return l.cause=t,l.name=t.name,t.status!=null&&l.status==null&&(l.status=t.status),a&&Object.assign(l,a),l}constructor(t,n,r,i,s){super(t),Object.defineProperty(this,"message",{value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),i&&(this.request=i),s&&(this.response=s,this.status=s.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:H.toJSONObject(this.config),code:this.code,status:this.status}}};Ft.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Ft.ERR_BAD_OPTION="ERR_BAD_OPTION";Ft.ECONNABORTED="ECONNABORTED";Ft.ETIMEDOUT="ETIMEDOUT";Ft.ERR_NETWORK="ERR_NETWORK";Ft.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Ft.ERR_DEPRECATED="ERR_DEPRECATED";Ft.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Ft.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Ft.ERR_CANCELED="ERR_CANCELED";Ft.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Ft.ERR_INVALID_URL="ERR_INVALID_URL";const rO=null;function gv(e){return H.isPlainObject(e)||H.isArray(e)}function ZS(e){return H.endsWith(e,"[]")?e.slice(0,-2):e}function Jg(e,t,n){return e?e.concat(t).map(function(i,s){return i=ZS(i),!n&&s?"["+i+"]":i}).join(n?".":""):t}function iO(e){return H.isArray(e)&&!e.some(gv)}const sO=H.toFlatObject(H,{},null,function(t){return/^is[A-Z]/.test(t)});function bp(e,t,n){if(!H.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=H.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,C){return!H.isUndefined(C[S])});const r=n.metaTokens,i=n.visitor||g,s=n.dots,a=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&H.isSpecCompliantForm(t);if(!H.isFunction(i))throw new TypeError("visitor must be a function");function f(x){if(x===null)return"";if(H.isDate(x))return x.toISOString();if(H.isBoolean(x))return x.toString();if(!c&&H.isBlob(x))throw new Ft("Blob is not supported. Use a Buffer instead.");return H.isArrayBuffer(x)||H.isTypedArray(x)?c&&typeof Blob=="function"?new Blob([x]):Buffer.from(x):x}function g(x,S,C){let E=x;if(H.isReactNative(t)&&H.isReactNativeBlob(x))return t.append(Jg(C,S,s),f(x)),!1;if(x&&!C&&typeof x=="object"){if(H.endsWith(S,"{}"))S=r?S:S.slice(0,-2),x=JSON.stringify(x);else if(H.isArray(x)&&iO(x)||(H.isFileList(x)||H.endsWith(S,"[]"))&&(E=H.toArray(x)))return S=ZS(S),E.forEach(function(N,I){!(H.isUndefined(N)||N===null)&&t.append(a===!0?Jg([S],I,s):a===null?S:S+"[]",f(N))}),!1}return gv(x)?!0:(t.append(Jg(C,S,s),f(x)),!1)}const d=[],v=Object.assign(sO,{defaultVisitor:g,convertValue:f,isVisitable:gv});function y(x,S){if(!H.isUndefined(x)){if(d.indexOf(x)!==-1)throw Error("Circular reference detected in "+S.join("."));d.push(x),H.forEach(x,function(E,w){(!(H.isUndefined(E)||E===null)&&i.call(t,E,H.isString(w)?w.trim():w,S,v))===!0&&y(E,S?S.concat(w):[w])}),d.pop()}}if(!H.isObject(e))throw new TypeError("data must be an object");return y(e),t}function Ax(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function By(e,t){this._pairs=[],e&&bp(e,this,t)}const WS=By.prototype;WS.append=function(t,n){this._pairs.push([t,n])};WS.toString=function(t){const n=t?function(r){return t.call(this,r,Ax)}:Ax;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function oO(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function XS(e,t,n){if(!t)return e;const r=n&&n.encode||oO,i=H.isFunction(n)?{serialize:n}:n,s=i&&i.serialize;let a;if(s?a=s(t,i):a=H.isURLSearchParams(t)?t.toString():new By(t,i).toString(r),a){const l=e.indexOf("#");l!==-1&&(e=e.slice(0,l)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}class Dx{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){H.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Uy={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},aO=typeof URLSearchParams<"u"?URLSearchParams:By,lO=typeof FormData<"u"?FormData:null,uO=typeof Blob<"u"?Blob:null,cO={isBrowser:!0,classes:{URLSearchParams:aO,FormData:lO,Blob:uO},protocols:["http","https","file","blob","url","data"]},Vy=typeof window<"u"&&typeof document<"u",mv=typeof navigator=="object"&&navigator||void 0,fO=Vy&&(!mv||["ReactNative","NativeScript","NS"].indexOf(mv.product)<0),hO=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",dO=Vy&&window.location.href||"http://localhost",pO=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Vy,hasStandardBrowserEnv:fO,hasStandardBrowserWebWorkerEnv:hO,navigator:mv,origin:dO},Symbol.toStringTag,{value:"Module"})),hr={...pO,...cO};function gO(e,t){return bp(e,new hr.classes.URLSearchParams,{visitor:function(n,r,i,s){return hr.isNode&&H.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)},...t})}function mO(e){return H.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function vO(e){const t={},n=Object.keys(e);let r;const i=n.length;let s;for(r=0;r=n.length;return a=!a&&H.isArray(i)?i.length:a,c?(H.hasOwnProp(i,a)?i[a]=[i[a],r]:i[a]=r,!l):((!i[a]||!H.isObject(i[a]))&&(i[a]=[]),t(n,r,i[a],s)&&H.isArray(i[a])&&(i[a]=vO(i[a])),!l)}if(H.isFormData(e)&&H.isFunction(e.entries)){const n={};return H.forEachEntry(e,(r,i)=>{t(mO(r),i,n,0)}),n}return null}function yO(e,t,n){if(H.isString(e))try{return(t||JSON.parse)(e),H.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Af={transitional:Uy,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,s=H.isObject(t);if(s&&H.isHTMLForm(t)&&(t=new FormData(t)),H.isFormData(t))return i?JSON.stringify(YS(t)):t;if(H.isArrayBuffer(t)||H.isBuffer(t)||H.isStream(t)||H.isFile(t)||H.isBlob(t)||H.isReadableStream(t))return t;if(H.isArrayBufferView(t))return t.buffer;if(H.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return gO(t,this.formSerializer).toString();if((l=H.isFileList(t))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return bp(l?{"files[]":t}:t,c&&new c,this.formSerializer)}}return s||i?(n.setContentType("application/json",!1),yO(t)):t}],transformResponse:[function(t){const n=this.transitional||Af.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(H.isResponse(t)||H.isReadableStream(t))return t;if(t&&H.isString(t)&&(r&&!this.responseType||i)){const a=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(l){if(a)throw l.name==="SyntaxError"?Ft.from(l,Ft.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:hr.classes.FormData,Blob:hr.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};H.forEach(["delete","get","head","post","put","patch"],e=>{Af.headers[e]={}});const _O=H.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),xO=e=>{const t={};let n,r,i;return e&&e.split(` `).forEach(function(a){i=a.indexOf(":"),n=a.substring(0,i).trim().toLowerCase(),r=a.substring(i+1).trim(),!(!n||t[n]&&_O[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},kx=Symbol("internals"),wO=e=>!/[\r\n]/.test(e);function KS(e,t){if(!(e===!1||e==null)){if(H.isArray(e)){e.forEach(n=>KS(n,t));return}if(!wO(String(e)))throw new Error(`Invalid character in header content ["${t}"]`)}}function yc(e){return e&&String(e).trim().toLowerCase()}function EO(e){let t=e.length;for(;t>0;){const n=e.charCodeAt(t-1);if(n!==10&&n!==13)break;t-=1}return t===e.length?e:e.slice(0,t)}function rd(e){return e===!1||e==null?e:H.isArray(e)?e.map(rd):EO(String(e))}function SO(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const CO=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function $g(e,t,n,r,i){if(H.isFunction(r))return r.call(this,t,n);if(i&&(t=n),!!H.isString(t)){if(H.isString(r))return t.indexOf(r)!==-1;if(H.isRegExp(r))return r.test(t)}}function NO(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function PO(e,t){const n=H.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(i,s,a){return this[r].call(this,t,i,s,a)},configurable:!0})})}let Wr=class{constructor(t){t&&this.set(t)}set(t,n,r){const i=this;function s(l,c,f){const g=yc(c);if(!g)throw new Error("header name must be a non-empty string");const d=H.findKey(i,g);(!d||i[d]===void 0||f===!0||f===void 0&&i[d]!==!1)&&(KS(l,c),i[d||c]=rd(l))}const a=(l,c)=>H.forEach(l,(f,g)=>s(f,g,c));if(H.isPlainObject(t)||t instanceof this.constructor)a(t,n);else if(H.isString(t)&&(t=t.trim())&&!CO(t))a(xO(t),n);else if(H.isObject(t)&&H.isIterable(t)){let l={},c,f;for(const g of t){if(!H.isArray(g))throw TypeError("Object iterator must return a key-value pair");l[f=g[0]]=(c=l[f])?H.isArray(c)?[...c,g[1]]:[c,g[1]]:g[1]}a(l,n)}else t!=null&&s(n,t,r);return this}get(t,n){if(t=yc(t),t){const r=H.findKey(this,t);if(r){const i=this[r];if(!n)return i;if(n===!0)return SO(i);if(H.isFunction(n))return n.call(this,i,r);if(H.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=yc(t),t){const r=H.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||$g(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let i=!1;function s(a){if(a=yc(a),a){const l=H.findKey(r,a);l&&(!n||$g(r,r[l],l,n))&&(delete r[l],i=!0)}}return H.isArray(t)?t.forEach(s):s(t),i}clear(t){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const s=n[r];(!t||$g(this,this[s],s,t,!0))&&(delete this[s],i=!0)}return i}normalize(t){const n=this,r={};return H.forEach(this,(i,s)=>{const a=H.findKey(r,s);if(a){n[a]=rd(i),delete n[s];return}const l=t?NO(s):String(s).trim();l!==s&&delete n[s],n[l]=rd(i),r[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return H.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=t&&H.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[kx]=this[kx]={accessors:{}}).accessors,i=this.prototype;function s(a){const l=yc(a);r[l]||(PO(i,a),r[l]=!0)}return H.isArray(t)?t.forEach(s):s(t),this}};Wr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);H.reduceDescriptors(Wr.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});H.freezeMethods(Wr);function tm(e,t){const n=this||Af,r=t||n,i=Wr.from(r.headers);let s=r.data;return H.forEach(e,function(l){s=l.call(n,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function QS(e){return!!(e&&e.__CANCEL__)}let Df=class extends Ft{constructor(t,n,r){super(t??"canceled",Ft.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function JS(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Ft("Request failed with status code "+n.status,[Ft.ERR_BAD_REQUEST,Ft.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function bO(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function LO(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i=0,s=0,a;return t=t!==void 0?t:1e3,function(c){const f=Date.now(),g=r[s];a||(a=f),n[i]=c,r[i]=f;let d=s,v=0;for(;d!==i;)v+=n[d++],d=d%e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),f-a{n=g,i=null,s&&(clearTimeout(s),s=null),e(...f)};return[(...f)=>{const g=Date.now(),d=g-n;d>=r?a(f,g):(i=f,s||(s=setTimeout(()=>{s=null,a(i)},r-d)))},()=>i&&a(i)]}const jd=(e,t,n=3)=>{let r=0;const i=LO(50,250);return IO(s=>{const a=s.loaded,l=s.lengthComputable?s.total:void 0,c=a-r,f=i(c),g=a<=l;r=a;const d={loaded:a,total:l,progress:l?a/l:void 0,bytes:c,rate:f||void 0,estimated:f&&l&&g?(l-a)/f:void 0,event:s,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(d)},n)},Fx=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},jx=e=>(...t)=>H.asap(()=>e(...t)),TO=hr.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,hr.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(hr.origin),hr.navigator&&/(msie|trident)/i.test(hr.navigator.userAgent)):()=>!0,OO=hr.hasStandardBrowserEnv?{write(e,t,n,r,i,s,a){if(typeof document>"u")return;const l=[`${e}=${encodeURIComponent(t)}`];H.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),H.isString(r)&&l.push(`path=${r}`),H.isString(i)&&l.push(`domain=${i}`),s===!0&&l.push("secure"),H.isString(a)&&l.push(`SameSite=${a}`),document.cookie=l.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function RO(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function MO(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function $S(e,t,n){let r=!RO(t);return e&&(r||n==!1)?MO(e,t):t}const zx=e=>e instanceof Wr?{...e}:e;function ll(e,t){t=t||{};const n={};function r(f,g,d,v){return H.isPlainObject(f)&&H.isPlainObject(g)?H.merge.call({caseless:v},f,g):H.isPlainObject(g)?H.merge({},g):H.isArray(g)?g.slice():g}function i(f,g,d,v){if(H.isUndefined(g)){if(!H.isUndefined(f))return r(void 0,f,d,v)}else return r(f,g,d,v)}function s(f,g){if(!H.isUndefined(g))return r(void 0,g)}function a(f,g){if(H.isUndefined(g)){if(!H.isUndefined(f))return r(void 0,f)}else return r(void 0,g)}function l(f,g,d){if(d in t)return r(f,g);if(d in e)return r(void 0,f)}const c={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(f,g,d)=>i(zx(f),zx(g),d,!0)};return H.forEach(Object.keys({...e,...t}),function(g){if(g==="__proto__"||g==="constructor"||g==="prototype")return;const d=H.hasOwnProp(c,g)?c[g]:i,v=d(e[g],t[g],g);H.isUndefined(v)&&d!==l||(n[g]=v)}),n}const tC=e=>{const t=ll({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:a,auth:l}=t;if(t.headers=a=Wr.from(a),t.url=XS($S(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),H.isFormData(n)){if(hr.hasStandardBrowserEnv||hr.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(H.isFunction(n.getHeaders)){const c=n.getHeaders(),f=["content-type","content-length"];Object.entries(c).forEach(([g,d])=>{f.includes(g.toLowerCase())&&a.set(g,d)})}}if(hr.hasStandardBrowserEnv&&(r&&H.isFunction(r)&&(r=r(t)),r||r!==!1&&TO(t.url))){const c=i&&s&&OO.read(s);c&&a.set(i,c)}return t},AO=typeof XMLHttpRequest<"u",DO=AO&&function(e){return new Promise(function(n,r){const i=tC(e);let s=i.data;const a=Wr.from(i.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:f}=i,g,d,v,y,x;function S(){y&&y(),x&&x(),i.cancelToken&&i.cancelToken.unsubscribe(g),i.signal&&i.signal.removeEventListener("abort",g)}let C=new XMLHttpRequest;C.open(i.method.toUpperCase(),i.url,!0),C.timeout=i.timeout;function E(){if(!C)return;const N=Wr.from("getAllResponseHeaders"in C&&C.getAllResponseHeaders()),R={data:!l||l==="text"||l==="json"?C.responseText:C.response,status:C.status,statusText:C.statusText,headers:N,config:e,request:C};JS(function(B){n(B),S()},function(B){r(B),S()},R),C=null}"onloadend"in C?C.onloadend=E:C.onreadystatechange=function(){!C||C.readyState!==4||C.status===0&&!(C.responseURL&&C.responseURL.indexOf("file:")===0)||setTimeout(E)},C.onabort=function(){C&&(r(new Ft("Request aborted",Ft.ECONNABORTED,e,C)),C=null)},C.onerror=function(I){const R=I&&I.message?I.message:"Network Error",A=new Ft(R,Ft.ERR_NETWORK,e,C);A.event=I||null,r(A),C=null},C.ontimeout=function(){let I=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const R=i.transitional||Uy;i.timeoutErrorMessage&&(I=i.timeoutErrorMessage),r(new Ft(I,R.clarifyTimeoutError?Ft.ETIMEDOUT:Ft.ECONNABORTED,e,C)),C=null},s===void 0&&a.setContentType(null),"setRequestHeader"in C&&H.forEach(a.toJSON(),function(I,R){C.setRequestHeader(R,I)}),H.isUndefined(i.withCredentials)||(C.withCredentials=!!i.withCredentials),l&&l!=="json"&&(C.responseType=i.responseType),f&&([v,x]=jd(f,!0),C.addEventListener("progress",v)),c&&C.upload&&([d,y]=jd(c),C.upload.addEventListener("progress",d),C.upload.addEventListener("loadend",y)),(i.cancelToken||i.signal)&&(g=N=>{C&&(r(!N||N.type?new Df(null,e,C):N),C.abort(),C=null)},i.cancelToken&&i.cancelToken.subscribe(g),i.signal&&(i.signal.aborted?g():i.signal.addEventListener("abort",g)));const w=bO(i.url);if(w&&hr.protocols.indexOf(w)===-1){r(new Ft("Unsupported protocol "+w+":",Ft.ERR_BAD_REQUEST,e));return}C.send(s||null)})},kO=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,i;const s=function(f){if(!i){i=!0,l();const g=f instanceof Error?f:this.reason;r.abort(g instanceof Ft?g:new Df(g instanceof Error?g.message:g))}};let a=t&&setTimeout(()=>{a=null,s(new Ft(`timeout of ${t}ms exceeded`,Ft.ETIMEDOUT))},t);const l=()=>{e&&(a&&clearTimeout(a),a=null,e.forEach(f=>{f.unsubscribe?f.unsubscribe(s):f.removeEventListener("abort",s)}),e=null)};e.forEach(f=>f.addEventListener("abort",s));const{signal:c}=r;return c.unsubscribe=()=>H.asap(l),c}},FO=function*(e,t){let n=e.byteLength;if(n{const i=jO(e,t);let s=0,a,l=c=>{a||(a=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:f,value:g}=await i.next();if(f){l(),c.close();return}let d=g.byteLength;if(n){let v=s+=d;n(v)}c.enqueue(new Uint8Array(g))}catch(f){throw l(f),f}},cancel(c){return l(c),i.return()}},{highWaterMark:2})},Ux=64*1024,{isFunction:Mh}=H,BO=(({Request:e,Response:t})=>({Request:e,Response:t}))(H.global),{ReadableStream:Vx,TextEncoder:Gx}=H.global,qx=(e,...t)=>{try{return!!e(...t)}catch{return!1}},UO=e=>{e=H.merge.call({skipUndefined:!0},BO,e);const{fetch:t,Request:n,Response:r}=e,i=t?Mh(t):typeof fetch=="function",s=Mh(n),a=Mh(r);if(!i)return!1;const l=i&&Mh(Vx),c=i&&(typeof Gx=="function"?(x=>S=>x.encode(S))(new Gx):async x=>new Uint8Array(await new n(x).arrayBuffer())),f=s&&l&&qx(()=>{let x=!1;const S=new Vx,C=new n(hr.origin,{body:S,method:"POST",get duplex(){return x=!0,"half"}}).headers.has("Content-Type");return S.cancel(),x&&!C}),g=a&&l&&qx(()=>H.isReadableStream(new r("").body)),d={stream:g&&(x=>x.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(x=>{!d[x]&&(d[x]=(S,C)=>{let E=S&&S[x];if(E)return E.call(S);throw new Ft(`Response type '${x}' is not supported`,Ft.ERR_NOT_SUPPORT,C)})});const v=async x=>{if(x==null)return 0;if(H.isBlob(x))return x.size;if(H.isSpecCompliantForm(x))return(await new n(hr.origin,{method:"POST",body:x}).arrayBuffer()).byteLength;if(H.isArrayBufferView(x)||H.isArrayBuffer(x))return x.byteLength;if(H.isURLSearchParams(x)&&(x=x+""),H.isString(x))return(await c(x)).byteLength},y=async(x,S)=>{const C=H.toFiniteNumber(x.getContentLength());return C??v(S)};return async x=>{let{url:S,method:C,data:E,signal:w,cancelToken:N,timeout:I,onDownloadProgress:R,onUploadProgress:A,responseType:B,headers:q,withCredentials:Q="same-origin",fetchOptions:Y}=tC(x),J=t||fetch;B=B?(B+"").toLowerCase():"text";let W=kO([w,N&&N.toAbortSignal()],I),$=null;const D=W&&W.unsubscribe&&(()=>{W.unsubscribe()});let ut;try{if(A&&f&&C!=="get"&&C!=="head"&&(ut=await y(q,E))!==0){let vt=new n(S,{method:"POST",body:E,duplex:"half"}),Lt;if(H.isFormData(E)&&(Lt=vt.headers.get("content-type"))&&q.setContentType(Lt),vt.body){const[ct,ht]=Fx(ut,jd(jx(A)));E=Bx(vt.body,Ux,ct,ht)}}H.isString(Q)||(Q=Q?"include":"omit");const it=s&&"credentials"in n.prototype,yt={...Y,signal:W,method:C.toUpperCase(),headers:q.normalize().toJSON(),body:E,duplex:"half",credentials:it?Q:void 0};$=s&&new n(S,yt);let z=await(s?J($,Y):J(S,yt));const at=g&&(B==="stream"||B==="response");if(g&&(R||at&&D)){const vt={};["status","statusText","headers"].forEach(_t=>{vt[_t]=z[_t]});const Lt=H.toFiniteNumber(z.headers.get("content-length")),[ct,ht]=R&&Fx(Lt,jd(jx(R),!0))||[];z=new r(Bx(z.body,Ux,ct,()=>{ht&&ht(),D&&D()}),vt)}B=B||"text";let tt=await d[H.findKey(d,B)||"text"](z,x);return!at&&D&&D(),await new Promise((vt,Lt)=>{JS(vt,Lt,{data:tt,headers:Wr.from(z.headers),status:z.status,statusText:z.statusText,config:x,request:$})})}catch(it){throw D&&D(),it&&it.name==="TypeError"&&/Load failed|fetch/i.test(it.message)?Object.assign(new Ft("Network Error",Ft.ERR_NETWORK,x,$,it&&it.response),{cause:it.cause||it}):Ft.from(it,it&&it.code,x,$,it&&it.response)}}},VO=new Map,eC=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:i}=t,s=[r,i,n];let a=s.length,l=a,c,f,g=VO;for(;l--;)c=s[l],f=g.get(c),f===void 0&&g.set(c,f=l?new Map:UO(t)),g=f;return f};eC();const Gy={http:rO,xhr:DO,fetch:{get:eC}};H.forEach(Gy,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Hx=e=>`- ${e}`,GO=e=>H.isFunction(e)||e===null||e===!1;function qO(e,t){e=H.isArray(e)?e:[e];const{length:n}=e;let r,i;const s={};for(let a=0;a`adapter ${c} `+(f===!1?"is not supported by the environment":"is not available in the build"));let l=n?a.length>1?`since : `+a.map(Hx).join(` `):" "+Hx(a[0]):"as no adapter specified";throw new Ft("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return i}const nC={getAdapter:qO,adapters:Gy};function em(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Df(null,e)}function Zx(e){return em(e),e.headers=Wr.from(e.headers),e.data=tm.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),nC.getAdapter(e.adapter||Af.adapter,e)(e).then(function(r){return em(e),r.data=tm.call(e,e.transformResponse,r),r.headers=Wr.from(r.headers),r},function(r){return QS(r)||(em(e),r&&r.response&&(r.response.data=tm.call(e,e.transformResponse,r.response),r.response.headers=Wr.from(r.response.headers))),Promise.reject(r)})}const rC="1.15.0",Lp={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Lp[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Wx={};Lp.transitional=function(t,n,r){function i(s,a){return"[Axios v"+rC+"] Transitional option '"+s+"'"+a+(r?". "+r:"")}return(s,a,l)=>{if(t===!1)throw new Ft(i(a," has been removed"+(n?" in "+n:"")),Ft.ERR_DEPRECATED);return n&&!Wx[a]&&(Wx[a]=!0,console.warn(i(a," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(s,a,l):!0}};Lp.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function HO(e,t,n){if(typeof e!="object")throw new Ft("options must be an object",Ft.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const s=r[i],a=t[s];if(a){const l=e[s],c=l===void 0||a(l,s,e);if(c!==!0)throw new Ft("option "+s+" must be "+c,Ft.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Ft("Unknown option "+s,Ft.ERR_BAD_OPTION)}}const id={assertOptions:HO,validators:Lp},Pi=id.validators;let nl=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Dx,response:new Dx}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=(()=>{if(!i.stack)return"";const a=i.stack.indexOf(` `);return a===-1?"":i.stack.slice(a+1)})();try{if(!r.stack)r.stack=s;else if(s){const a=s.indexOf(` `),l=a===-1?-1:s.indexOf(` `,a+1),c=l===-1?"":s.slice(l+1);String(r.stack).endsWith(c)||(r.stack+=` `+s)}}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=ll(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&id.assertOptions(r,{silentJSONParsing:Pi.transitional(Pi.boolean),forcedJSONParsing:Pi.transitional(Pi.boolean),clarifyTimeoutError:Pi.transitional(Pi.boolean),legacyInterceptorReqResOrdering:Pi.transitional(Pi.boolean)},!1),i!=null&&(H.isFunction(i)?n.paramsSerializer={serialize:i}:id.assertOptions(i,{encode:Pi.function,serialize:Pi.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),id.assertOptions(n,{baseUrl:Pi.spelling("baseURL"),withXsrfToken:Pi.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=s&&H.merge(s.common,s[n.method]);s&&H.forEach(["delete","get","head","post","put","patch","common"],x=>{delete s[x]}),n.headers=Wr.concat(a,s);const l=[];let c=!0;this.interceptors.request.forEach(function(S){if(typeof S.runWhen=="function"&&S.runWhen(n)===!1)return;c=c&&S.synchronous;const C=n.transitional||Uy;C&&C.legacyInterceptorReqResOrdering?l.unshift(S.fulfilled,S.rejected):l.push(S.fulfilled,S.rejected)});const f=[];this.interceptors.response.forEach(function(S){f.push(S.fulfilled,S.rejected)});let g,d=0,v;if(!c){const x=[Zx.bind(this),void 0];for(x.unshift(...l),x.push(...f),v=x.length,g=Promise.resolve(n);d{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const a=new Promise(l=>{r.subscribe(l),s=l}).then(i);return a.cancel=function(){r.unsubscribe(s)},a},t(function(s,a,l){r.reason||(r.reason=new Df(s,a,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new iC(function(i){t=i}),cancel:t}}};function WO(e){return function(n){return e.apply(null,n)}}function XO(e){return H.isObject(e)&&e.isAxiosError===!0}const vv={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(vv).forEach(([e,t])=>{vv[t]=e});function sC(e){const t=new nl(e),n=FS(nl.prototype.request,t);return H.extend(n,nl.prototype,t,{allOwnKeys:!0}),H.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return sC(ll(e,i))},n}const on=sC(Af);on.Axios=nl;on.CanceledError=Df;on.CancelToken=ZO;on.isCancel=QS;on.VERSION=rC;on.toFormData=bp;on.AxiosError=Ft;on.Cancel=on.CanceledError;on.all=function(t){return Promise.all(t)};on.spread=WO;on.isAxiosError=XO;on.mergeConfig=ll;on.AxiosHeaders=Wr;on.formToJSON=e=>YS(H.isHTMLForm(e)?new FormData(e):e);on.getAdapter=nC.getAdapter;on.HttpStatusCode=vv;on.default=on;const{Axios:$D,AxiosError:tk,CanceledError:ek,isCancel:nk,CancelToken:rk,VERSION:ik,all:sk,Cancel:ok,isAxiosError:ak,spread:lk,toFormData:uk,AxiosHeaders:ck,HttpStatusCode:fk,formToJSON:hk,getAdapter:dk,mergeConfig:pk}=on,Xx="http://localhost:5001/api",oC={apiBaseUrl:Xx,apiOrigin:Xx.replace(/\/api\/?$/,"")},YO=oC.apiBaseUrl,K=on.create({baseURL:YO,timeout:1e4,headers:{"Content-Type":"application/json","Cache-Control":"no-cache",Pragma:"no-cache",Expires:"0"}});K.interceptors.request.use(e=>{const t=localStorage.getItem("authToken");if(t&&t!=="undefined"&&t!=="null"&&(e.headers.Authorization=`Bearer ${t}`),(e.method||"get").toLowerCase()==="get"){e.headers["Cache-Control"]="no-cache",e.headers.Pragma="no-cache",e.headers.Expires="0";const n=Object.fromEntries(Object.entries(e.params||{}).filter(([,i])=>i!=null&&i!==""&&i!=="undefined"&&i!=="null")),r=new URLSearchParams(n);r.has("_ts")||r.set("_ts",Date.now().toString()),e.params=Object.fromEntries(r.entries())}return e},e=>Promise.reject(e));let nm=!1;K.interceptors.response.use(e=>e,e=>{var t,n,r,i,s;if(((t=e.response)==null?void 0:t.status)===401||((n=e.response)==null?void 0:n.status)===403){const a=((r=e.config)==null?void 0:r.url)||"",l=a.includes("/auth/registration-status"),c=["/login","/register"].includes(window.location.pathname);if(!l&&(console.log("Clearing invalid token due to auth error:",(i=e.response)==null?void 0:i.status,"on",a),localStorage.removeItem("authToken"),!c&&!nm)){nm=!0;try{window.location.href="/login"}finally{setTimeout(()=>{nm=!1},1500)}}}else((s=e.response)==null?void 0:s.status)>=500?re.error("Server error. Please try again later."):e.code==="ECONNABORTED"?re.error("Request timeout. Please check your connection."):e.response||re.error("Network error. Please check your connection.");return Promise.reject(e)});const Zo={login:e=>K.post("/auth/login",e),register:e=>K.post("/auth/register",e),getCurrentUser:()=>K.get("/auth/me"),changePassword:e=>K.post("/auth/change-password",e),forgotPassword:e=>K.post("/auth/forgot-password",{email:e}),getInvitation:e=>K.get(`/auth/invitations/${e}`),validateResetToken:e=>K.get(`/auth/reset-password/${e}`),resetPassword:e=>K.post("/auth/reset-password",e)},gk={getProfile:()=>K.get("/users/profile"),updateProfile:e=>K.put("/users/profile",e),deleteAccount:e=>K.delete("/users/account",{data:e}),getStats:()=>K.get("/users/stats")},Za={getAll:()=>K.get("/properties"),getById:e=>K.get(`/properties/${e}`),create:e=>K.post("/properties",e),update:(e,t)=>K.put(`/properties/${e}`,t),delete:e=>K.delete(`/properties/${e}`),createSection:(e,t)=>K.post(`/properties/${e}/sections`,t),updateSection:(e,t,n)=>K.put(`/properties/${e}/sections/${t}`,n),deleteSection:(e,t)=>K.delete(`/properties/${e}/sections/${t}`)},mk={getAll:e=>K.get("/equipment",{params:e}),getById:e=>K.get(`/equipment/${e}`),create:e=>K.post("/equipment",e),update:(e,t)=>K.put(`/equipment/${e}`,t),delete:e=>K.delete(`/equipment/${e}`),getCategories:()=>K.get("/equipment/categories"),getTypes:e=>K.get("/equipment/types",{params:e}),getSpreaders:()=>K.get("/equipment/spreaders"),getCalculations:(e,t)=>K.get(`/equipment/${e}/calculations`,{params:t})},vk={getAll:()=>K.get("/nozzles"),getById:e=>K.get(`/nozzles/${e}`),create:e=>K.post("/nozzles",e),update:(e,t)=>K.put(`/nozzles/${e}`,t),delete:e=>K.delete(`/nozzles/${e}`),getNozzleTypes:()=>K.get("/nozzles/types"),getUserNozzles:()=>K.get("/nozzles/user"),calculateFlowRate:(e,t)=>K.get(`/nozzles/${e}/flow-rate`,{params:{pressure:t}}),getPumpAssignments:e=>K.get(`/nozzles/sprayer/${e}/pump-assignments`),assignPump:(e,t)=>K.post(`/nozzles/sprayer/${e}/pump-assignments`,{pumpId:t}),unassignPump:e=>K.delete(`/nozzles/pump-assignments/${e}`),getNozzleConfigurations:e=>K.get(`/nozzles/sprayer/${e}/nozzle-configurations`),addNozzleConfiguration:(e,t)=>K.post(`/nozzles/sprayer/${e}/nozzle-configurations`,t),removeNozzleConfiguration:e=>K.delete(`/nozzles/nozzle-configurations/${e}`),getTypes:e=>K.get("/nozzles/types",{params:e}),getAssignments:e=>K.get(`/nozzles/equipment/${e}/assignments`),assignToEquipment:(e,t)=>K.post(`/nozzles/equipment/${e}/assignments`,t),removeAssignment:e=>K.delete(`/nozzles/assignments/${e}`)},yk={getAll:e=>K.get("/products",{params:e}),getById:e=>K.get(`/products/${e}`),search:e=>K.get("/products/search",{params:e}),getCategories:()=>K.get("/products/categories"),getUserProducts:()=>K.get("/products/user"),createUserProduct:e=>K.post("/products/user",e),getUserProduct:e=>K.get(`/products/user/${e}`),updateUserProduct:(e,t)=>K.put(`/products/user/${e}`,t),deleteUserProduct:e=>K.delete(`/products/user/${e}`),archiveUserProduct:e=>K.put(`/products/user/${e}/archive`),unarchiveUserProduct:e=>K.put(`/products/user/${e}/unarchive`)},jc={getPlans:e=>K.get("/applications/plans",{params:e}),getPlan:e=>K.get(`/applications/plans/${e}`),createPlan:e=>K.post("/applications/plans",e),updatePlan:(e,t)=>K.put(`/applications/plans/${e}`,t),deletePlan:e=>K.delete(`/applications/plans/${e}`),updatePlanStatus:(e,t)=>K.put(`/applications/plans/${e}/status`,{status:t}),getLogs:e=>K.get("/applications/logs",{params:e}),getLog:e=>K.get(`/applications/logs/${e}`),createLog:e=>K.post("/applications/logs",e),getStats:e=>K.get("/applications/stats",{params:e})},_k={getByProduct:e=>K.get(`/product-spreader-settings/product/${e}`),getByUserProduct:e=>K.get(`/product-spreader-settings/user-product/${e}`),create:e=>K.post("/product-spreader-settings",e),update:(e,t)=>K.put(`/product-spreader-settings/${e}`,t),delete:e=>K.delete(`/product-spreader-settings/${e}`)},KO={getCurrent:e=>K.get(`/weather/${e}`),getForecast:e=>K.get(`/weather/${e}/forecast`),getHistory:(e,t)=>K.get(`/weather/${e}/history`,{params:t}),checkSuitability:(e,t)=>K.get(`/weather/conditions/suitable/${e}`,{params:t})},xk={getPlans:e=>K.get("/watering/plans",{params:e}),updatePlan:(e,t)=>K.put(`/watering/plans/${e}`,t),createPlan:e=>K.post("/watering/plans",e),deletePlan:e=>K.delete(`/watering/plans/${e}`),duplicatePlan:(e,t)=>K.post(`/watering/plans/${e}/duplicate`,t),getPlanPoints:e=>K.get(`/watering/plans/${e}/points`),addPlanPoint:(e,t)=>K.post(`/watering/plans/${e}/points`,t),updatePoint:(e,t)=>K.put(`/watering/points/${e}`,t),deletePoint:e=>K.delete(`/watering/points/${e}`),createLog:e=>K.post("/watering/runs",e),getLogs:e=>K.get("/watering/logs",{params:e}),getRun:e=>K.get(`/watering/runs/${e}`)},wk={getOperations:e=>K.get("/reports/operations",{params:e})},Ek={getDashboard:()=>K.get("/admin/dashboard"),getUsers:e=>K.get("/admin/users",{params:e}),inviteUser:e=>K.post("/admin/users/invite",e),updateUser:(e,t)=>K.put(`/admin/users/${e}`,t),updateUserRole:(e,t)=>K.put(`/admin/users/${e}/role`,{role:t}),deleteUser:e=>K.delete(`/admin/users/${e}`),getProducts:e=>K.get("/admin/products",{params:e}),getAllUserProducts:e=>K.get("/admin/products/user",{params:e}),createProduct:e=>K.post("/admin/products",e),updateProduct:(e,t)=>K.put(`/admin/products/${e}`,t),deleteProduct:e=>K.delete(`/admin/products/${e}`),promoteUserProduct:e=>K.post(`/admin/products/user/${e}/promote`),getProperties:e=>K.get("/admin/properties",{params:e}),getProperty:e=>K.get(`/admin/properties/${e}`),updateSectionAdmin:(e,t,n)=>K.put(`/admin/properties/${e}/sections/${t}`,n),getProductRates:e=>K.get(`/admin/products/${e}/rates`),getUserProductSpreaderSettings:e=>K.get(`/admin/products/user/${e}/spreader-settings`),addUserProductSpreaderSetting:(e,t)=>K.post(`/admin/products/user/${e}/spreader-settings`,t),deleteUserProductSpreaderSetting:e=>K.delete(`/admin/products/user/spreader-settings/${e}`),getAllUserEquipment:e=>K.get("/admin/equipment/user",{params:e}),promoteUserEquipment:e=>K.post(`/admin/equipment/user/${e}/promote`),getSystemHealth:()=>K.get("/admin/system/health"),sendTestEmail:e=>K.post("/admin/system/test-email",e),getSettings:()=>K.get("/admin/settings"),updateSettings:e=>K.put("/admin/settings",e)},aC={getPlans:()=>K.get("/mowing/plans"),getPlan:e=>K.get(`/mowing/plans/${e}`),createPlan:e=>K.post("/mowing/plans",e),updatePlanStatus:(e,t)=>K.put(`/mowing/plans/${e}/status`,{status:t}),createLog:e=>K.post("/mowing/sessions",e),getLogs:e=>K.get("/mowing/logs",{params:e}),getSession:e=>K.get(`/mowing/sessions/${e}`)},QO=()=>{const e=localStorage.getItem("authToken");return!e||e==="undefined"||e==="null"?(localStorage.removeItem("authToken"),null):e},JO={user:null,token:QO(),loading:!0,error:null},mn={SET_LOADING:"SET_LOADING",LOGIN_SUCCESS:"LOGIN_SUCCESS",LOGOUT:"LOGOUT",SET_ERROR:"SET_ERROR",CLEAR_ERROR:"CLEAR_ERROR",UPDATE_USER:"UPDATE_USER"},$O=(e,t)=>{switch(t.type){case mn.SET_LOADING:return{...e,loading:t.payload,error:null};case mn.LOGIN_SUCCESS:return localStorage.setItem("authToken",t.payload.token),{...e,user:t.payload.user,token:t.payload.token,loading:!1,error:null};case mn.LOGOUT:return localStorage.removeItem("authToken"),{...e,user:null,token:null,loading:!1,error:null};case mn.SET_ERROR:return{...e,error:t.payload,loading:!1};case mn.CLEAR_ERROR:return{...e,error:null};case mn.UPDATE_USER:return{...e,user:{...e.user,...t.payload}};default:return e}},lC=P.createContext(),tR=()=>{const e=P.useContext(lC);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},eR=({children:e})=>{var d;const[t,n]=P.useReducer($O,JO);P.useEffect(()=>{(async()=>{const y=localStorage.getItem("authToken");if(!y||y==="undefined"||y==="null"){localStorage.removeItem("authToken"),n({type:mn.SET_LOADING,payload:!1});return}try{const x=await Zo.getCurrentUser();n({type:mn.LOGIN_SUCCESS,payload:{user:x.data.data.user,token:y}})}catch(x){console.error("Auth check failed:",x),localStorage.removeItem("authToken"),n({type:mn.LOGOUT})}})()},[]);const r=async v=>{var y,x;try{n({type:mn.SET_LOADING,payload:!0}),n({type:mn.CLEAR_ERROR}),console.log("Attempting login...",v.email);const S=await Zo.login(v);return console.log("Login response:",S.data),n({type:mn.LOGIN_SUCCESS,payload:S.data.data}),re.success("Welcome back!"),{success:!0}}catch(S){console.error("Login error:",S);const C=((x=(y=S.response)==null?void 0:y.data)==null?void 0:x.message)||S.message||"Login failed. Please try again.";return n({type:mn.SET_ERROR,payload:C}),re.error(C),{success:!1,error:C}}},i=async v=>{var y,x;try{n({type:mn.SET_LOADING,payload:!0}),n({type:mn.CLEAR_ERROR});const{confirmPassword:S,agreeTerms:C,...E}=v;console.log("Attempting registration...",E.email);const w=await Zo.register(E);return console.log("Registration response:",w.data),n({type:mn.LOGIN_SUCCESS,payload:w.data.data}),re.success("Account created successfully!"),{success:!0}}catch(S){console.error("Registration error:",S);const C=((x=(y=S.response)==null?void 0:y.data)==null?void 0:x.message)||S.message||"Registration failed. Please try again.";return n({type:mn.SET_ERROR,payload:C}),re.error(C),{success:!1,error:C}}},s=()=>{n({type:mn.LOGOUT}),re.success("Logged out successfully")},a=v=>{n({type:mn.UPDATE_USER,payload:v})},l=async v=>{var y,x;try{return await Zo.changePassword(v),re.success("Password changed successfully"),{success:!0}}catch(S){const C=((x=(y=S.response)==null?void 0:y.data)==null?void 0:x.message)||"Failed to change password";return re.error(C),{success:!1,error:C}}},c=async v=>{var y,x;try{return await Zo.forgotPassword(v),re.success("Password reset instructions sent to your email"),{success:!0}}catch(S){const C=((x=(y=S.response)==null?void 0:y.data)==null?void 0:x.message)||"Failed to send reset email";return re.error(C),{success:!1,error:C}}},f=()=>{n({type:mn.CLEAR_ERROR})},g={user:t.user,token:t.token,loading:t.loading,error:t.error,isAuthenticated:!!t.user,isAdmin:((d=t.user)==null?void 0:d.role)==="admin",login:r,register:i,logout:s,updateUser:a,changePassword:l,forgotPassword:c,clearError:f};return p.jsx(lC.Provider,{value:g,children:e})},qu=tR;function nR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"}))}const rR=P.forwardRef(nR);function iR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 9V5.25A2.25 2.25 0 0 0 13.5 3h-6a2.25 2.25 0 0 0-2.25 2.25v13.5A2.25 2.25 0 0 0 7.5 21h6a2.25 2.25 0 0 0 2.25-2.25V15m3 0 3-3m0 0-3-3m3 3H9"}))}const Yx=P.forwardRef(iR);function sR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"}))}const oR=P.forwardRef(sR);function aR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 3.104v5.714a2.25 2.25 0 0 1-.659 1.591L5 14.5M9.75 3.104c-.251.023-.501.05-.75.082m.75-.082a24.301 24.301 0 0 1 4.5 0m0 0v5.714c0 .597.237 1.17.659 1.591L19.8 15.3M14.25 3.104c.251.023.501.05.75.082M19.8 15.3l-1.57.393A9.065 9.065 0 0 1 12 15a9.065 9.065 0 0 0-6.23-.693L5 14.5m14.8.8 1.402 1.402c1.232 1.232.65 3.318-1.067 3.611A48.309 48.309 0 0 1 12 21c-2.773 0-5.491-.235-8.135-.687-1.718-.293-2.3-2.379-1.067-3.61L5 14.5"}))}const yv=P.forwardRef(aR);function lR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.857 17.082a23.848 23.848 0 0 0 5.454-1.31A8.967 8.967 0 0 1 18 9.75V9A6 6 0 0 0 6 9v.75a8.967 8.967 0 0 1-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 0 1-5.714 0m5.714 0a3 3 0 1 1-5.714 0"}))}const uR=P.forwardRef(lR);function cR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5m-9-6h.008v.008H12v-.008ZM12 15h.008v.008H12V15Zm0 2.25h.008v.008H12v-.008ZM9.75 15h.008v.008H9.75V15Zm0 2.25h.008v.008H9.75v-.008ZM7.5 15h.008v.008H7.5V15Zm0 2.25h.008v.008H7.5v-.008Zm6.75-4.5h.008v.008h-.008v-.008Zm0 2.25h.008v.008h-.008V15Zm0 2.25h.008v.008h-.008v-.008Zm2.25-4.5h.008v.008H16.5v-.008Zm0 2.25h.008v.008H16.5V15Z"}))}const fR=P.forwardRef(cR);function hR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5"}))}const Kx=P.forwardRef(hR);function dR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 0 1 3 19.875v-6.75ZM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V8.625ZM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V4.125Z"}))}const pR=P.forwardRef(dR);function gR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}const uC=P.forwardRef(gR);function mR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 15a4.5 4.5 0 0 0 4.5 4.5H18a3.75 3.75 0 0 0 1.332-7.257 3 3 0 0 0-3.758-3.848 5.25 5.25 0 0 0-10.233 2.33A4.502 4.502 0 0 0 2.25 15Z"}))}const Qx=P.forwardRef(mR);function vR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"}),P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const yR=P.forwardRef(vR);function _R({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"}))}const cC=P.forwardRef(_R);function xR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}))}const zd=P.forwardRef(xR);function wR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m2.25 12 8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25"}))}const qy=P.forwardRef(wR);function ER({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"}),P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1 1 15 0Z"}))}const zc=P.forwardRef(ER);function SR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 6.75V15m6-6v8.25m.503 3.498 4.875-2.437c.381-.19.622-.58.622-1.006V4.82c0-.836-.88-1.38-1.628-1.006l-3.869 1.934c-.317.159-.69.159-1.006 0L9.503 3.252a1.125 1.125 0 0 0-1.006 0L3.622 5.689C3.24 5.88 3 6.27 3 6.695V19.18c0 .836.88 1.38 1.628 1.006l3.869-1.934c.317-.159.69-.159 1.006 0l4.994 2.497c.317.158.69.158 1.006 0Z"}))}const Jx=P.forwardRef(SR);function CR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125"}))}const NR=P.forwardRef(CR);function PR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"}))}const bR=P.forwardRef(PR);function LR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m0-10.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.75c0 5.592 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.57-.598-3.75h-.152c-3.196 0-6.1-1.25-8.25-3.286Zm0 13.036h.008v.008H12v-.008Z"}))}const IR=P.forwardRef(LR);function TR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.098 19.902a3.75 3.75 0 0 0 5.304 0l6.401-6.402M6.75 21A3.75 3.75 0 0 1 3 17.25V4.125C3 3.504 3.504 3 4.125 3h5.25c.621 0 1.125.504 1.125 1.125v4.072M6.75 21a3.75 3.75 0 0 0 3.75-3.75V8.197M6.75 21h13.125c.621 0 1.125-.504 1.125-1.125v-5.25c0-.621-.504-1.125-1.125-1.125h-4.072M10.5 8.197l2.88-2.88c.438-.439 1.15-.439 1.59 0l3.712 3.713c.44.44.44 1.152 0 1.59l-2.879 2.88M6.75 17.25h.008v.008H6.75v-.008Z"}))}const OR=P.forwardRef(TR);function RR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"}))}const MR=P.forwardRef(RR);function AR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z"}))}const rm=P.forwardRef(AR);function DR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.42 15.17 17.25 21A2.652 2.652 0 0 0 21 17.25l-5.877-5.877M11.42 15.17l2.496-3.03c.317-.384.74-.626 1.208-.766M11.42 15.17l-4.655 5.653a2.548 2.548 0 1 1-3.586-3.586l6.837-5.63m5.108-.233c.55-.164 1.163-.188 1.743-.14a4.5 4.5 0 0 0 4.486-6.336l-3.276 3.277a3.004 3.004 0 0 1-2.25-2.25l3.276-3.276a4.5 4.5 0 0 0-6.336 4.486c.091 1.076-.071 2.264-.904 2.95l-.102.085m-1.745 1.437L5.909 7.5H4.5L2.25 3.75l1.5-1.5L7.5 4.5v1.409l4.26 4.26m-1.745 1.437 1.745-1.437m6.615 8.206L15.75 15.75M4.867 19.125h.008v.008h-.008v-.008Z"}))}const mu=P.forwardRef(DR);function kR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"}))}const Hy=P.forwardRef(kR);function FR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{fillRule:"evenodd",d:"M10.5 3.798v5.02a3 3 0 0 1-.879 2.121l-2.377 2.377a9.845 9.845 0 0 1 5.091 1.013 8.315 8.315 0 0 0 5.713.636l.285-.071-3.954-3.955a3 3 0 0 1-.879-2.121v-5.02a23.614 23.614 0 0 0-3 0Zm4.5.138a.75.75 0 0 0 .093-1.495A24.837 24.837 0 0 0 12 2.25a25.048 25.048 0 0 0-3.093.191A.75.75 0 0 0 9 3.936v4.882a1.5 1.5 0 0 1-.44 1.06l-6.293 6.294c-1.62 1.621-.903 4.475 1.471 4.88 2.686.46 5.447.698 8.262.698 2.816 0 5.576-.239 8.262-.697 2.373-.406 3.092-3.26 1.47-4.881L15.44 9.879A1.5 1.5 0 0 1 15 8.818V3.936Z",clipRule:"evenodd"}))}const jR=P.forwardRef(FR);function zR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{d:"M12.75 12.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM7.5 15.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM8.25 17.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM9.75 15.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM10.5 17.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM12 15.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM12.75 17.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM14.25 15.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM15 17.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM16.5 15.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM15 12.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM16.5 13.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z"}),P.createElement("path",{fillRule:"evenodd",d:"M6.75 2.25A.75.75 0 0 1 7.5 3v1.5h9V3A.75.75 0 0 1 18 3v1.5h.75a3 3 0 0 1 3 3v11.25a3 3 0 0 1-3 3H5.25a3 3 0 0 1-3-3V7.5a3 3 0 0 1 3-3H6V3a.75.75 0 0 1 .75-.75Zm13.5 9a1.5 1.5 0 0 0-1.5-1.5H5.25a1.5 1.5 0 0 0-1.5 1.5v7.5a1.5 1.5 0 0 0 1.5 1.5h13.5a1.5 1.5 0 0 0 1.5-1.5v-7.5Z",clipRule:"evenodd"}))}const BR=P.forwardRef(zR);function UR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{d:"M18.375 2.25c-1.035 0-1.875.84-1.875 1.875v15.75c0 1.035.84 1.875 1.875 1.875h.75c1.035 0 1.875-.84 1.875-1.875V4.125c0-1.036-.84-1.875-1.875-1.875h-.75ZM9.75 8.625c0-1.036.84-1.875 1.875-1.875h.75c1.036 0 1.875.84 1.875 1.875v11.25c0 1.035-.84 1.875-1.875 1.875h-.75a1.875 1.875 0 0 1-1.875-1.875V8.625ZM3 13.125c0-1.036.84-1.875 1.875-1.875h.75c1.036 0 1.875.84 1.875 1.875v6.75c0 1.035-.84 1.875-1.875 1.875h-.75A1.875 1.875 0 0 1 3 19.875v-6.75Z"}))}const VR=P.forwardRef(UR);function GR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{fillRule:"evenodd",d:"M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25ZM12.75 6a.75.75 0 0 0-1.5 0v6c0 .414.336.75.75.75h4.5a.75.75 0 0 0 0-1.5h-3.75V6Z",clipRule:"evenodd"}))}const qR=P.forwardRef(GR);function HR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{fillRule:"evenodd",d:"M4.5 9.75a6 6 0 0 1 11.573-2.226 3.75 3.75 0 0 1 4.133 4.303A4.5 4.5 0 0 1 18 20.25H6.75a5.25 5.25 0 0 1-2.23-10.004 6.072 6.072 0 0 1-.02-.496Z",clipRule:"evenodd"}))}const $x=P.forwardRef(HR);function ZR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{d:"M11.47 3.841a.75.75 0 0 1 1.06 0l8.69 8.69a.75.75 0 1 0 1.06-1.061l-8.689-8.69a2.25 2.25 0 0 0-3.182 0l-8.69 8.69a.75.75 0 1 0 1.061 1.06l8.69-8.689Z"}),P.createElement("path",{d:"m12 5.432 8.159 8.159c.03.03.06.058.091.086v6.198c0 1.035-.84 1.875-1.875 1.875H15a.75.75 0 0 1-.75-.75v-4.5a.75.75 0 0 0-.75-.75h-3a.75.75 0 0 0-.75.75V21a.75.75 0 0 1-.75.75H5.625a1.875 1.875 0 0 1-1.875-1.875v-6.198a2.29 2.29 0 0 0 .091-.086L12 5.432Z"}))}const WR=P.forwardRef(ZR);function XR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{fillRule:"evenodd",d:"M8.161 2.58a1.875 1.875 0 0 1 1.678 0l4.993 2.498c.106.052.23.052.336 0l3.869-1.935A1.875 1.875 0 0 1 21.75 4.82v12.485c0 .71-.401 1.36-1.037 1.677l-4.875 2.437a1.875 1.875 0 0 1-1.676 0l-4.994-2.497a.375.375 0 0 0-.336 0l-3.868 1.935A1.875 1.875 0 0 1 2.25 19.18V6.695c0-.71.401-1.36 1.036-1.677l4.875-2.437ZM9 6a.75.75 0 0 1 .75.75V15a.75.75 0 0 1-1.5 0V6.75A.75.75 0 0 1 9 6Zm6.75 3a.75.75 0 0 0-1.5 0v8.25a.75.75 0 0 0 1.5 0V9Z",clipRule:"evenodd"}))}const YR=P.forwardRef(XR);function KR({title:e,titleId:t,...n},r){return P.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?P.createElement("title",{id:t},e):null,P.createElement("path",{fillRule:"evenodd",d:"M12 6.75a5.25 5.25 0 0 1 6.775-5.025.75.75 0 0 1 .313 1.248l-3.32 3.319c.063.475.276.934.641 1.299.365.365.824.578 1.3.64l3.318-3.319a.75.75 0 0 1 1.248.313 5.25 5.25 0 0 1-5.472 6.756c-1.018-.086-1.87.1-2.309.634L7.344 21.3A3.298 3.298 0 1 1 2.7 16.657l8.684-7.151c.533-.44.72-1.291.634-2.309A5.342 5.342 0 0 1 12 6.75ZM4.117 19.125a.75.75 0 0 1 .75-.75h.008a.75.75 0 0 1 .75.75v.008a.75.75 0 0 1-.75.75h-.008a.75.75 0 0 1-.75-.75v-.008Z",clipRule:"evenodd"}),P.createElement("path",{d:"m10.076 8.64-2.201-2.2V4.874a.75.75 0 0 0-.364-.643l-3.75-2.25a.75.75 0 0 0-.916.113l-.75.75a.75.75 0 0 0-.113.916l2.25 3.75a.75.75 0 0 0 .643.364h1.564l2.062 2.062 1.575-1.297Z"}),P.createElement("path",{fillRule:"evenodd",d:"m12.556 17.329 4.183 4.182a3.375 3.375 0 0 0 4.773-4.773l-3.306-3.305a6.803 6.803 0 0 1-1.53.043c-.394-.034-.682-.006-.867.042a.589.589 0 0 0-.167.063l-3.086 3.748Zm3.414-1.36a.75.75 0 0 1 1.06 0l1.875 1.876a.75.75 0 1 1-1.06 1.06L15.97 17.03a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const QR=P.forwardRef(KR),JR=e=>p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:e.className,"aria-hidden":"true",children:[p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 20h18"}),p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 20v-5m0 0 2 2m-2-2-2 2M9 20v-6m0 0 2 2m-2-2-2 2M13 20v-5m0 0 2 2m-2-2-2 2M17 20v-6m0 0 2 2m-2-2-2 2"})]}),$R=e=>p.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:e.className,"aria-hidden":"true",children:[p.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"0.5"}),p.jsx("path",{d:"M6 14v6h2v-4l2 2v2h2v-4l2 2v2h2v-4l2 2v2h2v-1.5l-2.5-2.5L22 16v-1.5l-2.5-2.5L22 12V10l-3 3-3-3v3l-2.5-2.5L13 12v3l-2.5-2.5L9 14v4H7v-3l-2 2v1H4v-1.5l2-2.5-2-1.5V14z"})]});function fC(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{const i={sm:"h-4 w-4",md:"h-8 w-8",lg:"h-12 w-12",xl:"h-16 w-16"},s={primary:"border-primary-600",white:"border-white",gray:"border-gray-600",grass:"border-grass-600"};return p.jsxs("div",{className:tw("flex flex-col items-center justify-center",n),children:[p.jsx("div",{className:tw("animate-spin rounded-full border-2 border-gray-200",i[e],s[t],"border-t-transparent"),role:"status","aria-label":"Loading"}),r&&p.jsx("p",{className:"mt-2 text-sm text-gray-600 text-center",children:r})]})},Pn=({children:e})=>{var d,v,y,x,S;const[t,n]=P.useState(!1),{user:r,logout:i,isAdmin:s}=qu(),a=ba(),l=La(),c=[{name:"Dashboard",href:"/dashboard",icon:qy,iconSolid:WR},{name:"Properties",href:"/properties",icon:Jx,iconSolid:YR},{name:"Equipment",href:"/equipment",icon:mu,iconSolid:QR},{name:"Products",href:"/products",icon:yv,iconSolid:jR},{name:"Applications",href:"/applications",icon:fR,iconSolid:BR},{name:"Watering",href:"/watering",icon:Qx,iconSolid:$x},{name:"Mowing",href:"/mowing",icon:JR,iconSolid:$R},{name:"History",href:"/history",icon:uC,iconSolid:qR},{name:"Reports",href:"/reports",icon:pR,iconSolid:VR},{name:"Weather",href:"/weather",icon:Qx,iconSolid:$x}],f=[{name:"Admin Dashboard",href:"/admin",icon:yR},{name:"Manage Users",href:"/admin/users",icon:rm},{name:"Manage Products",href:"/admin/products",icon:yv},{name:"Manage Equipment",href:"/admin/equipment",icon:mu},{name:"Manage Properties",href:"/admin/properties",icon:Jx}],g=()=>{i(),l("/login")};return r?p.jsxs("div",{className:"min-h-screen bg-gray-50",children:[p.jsx("div",{className:`lg:hidden ${t?"relative z-40":""}`,children:t&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"fixed inset-0 bg-gray-600 bg-opacity-75",onClick:()=>n(!1)}),p.jsxs("div",{className:"fixed inset-y-0 left-0 flex w-64 flex-col bg-white shadow-xl",children:[p.jsxs("div",{className:"relative flex h-20 items-center px-6 border-b border-gray-200",children:[p.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:p.jsx("img",{src:"/brand/logo.png",alt:"TurfTracking",className:"h-16 w-16 object-contain"})}),p.jsx("button",{type:"button",className:"text-gray-400 hover:text-gray-600",onClick:()=>n(!1),children:p.jsx(Hy,{className:"h-6 w-6"})})]}),p.jsxs("nav",{className:"flex-1 space-y-1 px-4 py-6",children:[c.map(C=>{const E=a.pathname===C.href||C.href!=="/dashboard"&&a.pathname.startsWith(C.href),w=E?C.iconSolid:C.icon;return p.jsxs(tr,{to:C.href,className:E?"nav-link-active":"nav-link-inactive",onClick:()=>n(!1),children:[p.jsx(w,{className:"h-5 w-5 mr-3"}),C.name]},C.name)}),s&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"border-t border-gray-200 my-4"}),p.jsx("div",{className:"px-3 py-2",children:p.jsx("h3",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Administration"})}),f.map(C=>{const E=a.pathname===C.href;return p.jsxs(tr,{to:C.href,className:E?"nav-link-active":"nav-link-inactive",onClick:()=>n(!1),children:[p.jsx(C.icon,{className:"h-5 w-5 mr-3"}),C.name]},C.name)})]})]}),p.jsxs("div",{className:"border-t border-gray-200 p-4",children:[p.jsxs("div",{className:"flex items-center mb-4",children:[p.jsx("div",{className:"flex-shrink-0",children:p.jsx("div",{className:"h-8 w-8 rounded-full bg-primary-600 flex items-center justify-center",children:p.jsxs("span",{className:"text-sm font-medium text-white",children:[(d=r.firstName)==null?void 0:d[0],(v=r.lastName)==null?void 0:v[0]]})})}),p.jsxs("div",{className:"ml-3",children:[p.jsxs("p",{className:"text-sm font-medium text-gray-900",children:[r.firstName," ",r.lastName]}),p.jsx("p",{className:"text-xs text-gray-500",children:r.email})]})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsxs(tr,{to:"/profile",className:"nav-link-inactive",onClick:()=>n(!1),children:[p.jsx(rm,{className:"h-5 w-5 mr-3"}),"Profile"]}),p.jsxs("button",{onClick:g,className:"nav-link-inactive w-full text-left",children:[p.jsx(Yx,{className:"h-5 w-5 mr-3"}),"Sign out"]})]})]})]})]})}),p.jsx("div",{className:"hidden lg:fixed lg:inset-y-0 lg:flex lg:w-64 lg:flex-col",children:p.jsxs("div",{className:"flex min-h-0 flex-1 flex-col bg-white border-r border-gray-200",children:[p.jsx("div",{className:"flex h-24 items-center justify-center px-6 border-b border-gray-200",children:p.jsx("img",{src:"/brand/logo.png",alt:"TurfTracking",className:"h-20 w-20 object-contain"})}),p.jsxs("nav",{className:"flex-1 space-y-1 px-4 py-6",children:[c.map(C=>{const E=a.pathname===C.href||C.href!=="/dashboard"&&a.pathname.startsWith(C.href),w=E?C.iconSolid:C.icon;return p.jsxs(tr,{to:C.href,className:E?"nav-link-active":"nav-link-inactive",children:[p.jsx(w,{className:"h-5 w-5 mr-3"}),C.name]},C.name)}),s&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"border-t border-gray-200 my-4"}),p.jsx("div",{className:"px-3 py-2",children:p.jsx("h3",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Administration"})}),f.map(C=>{const E=a.pathname===C.href;return p.jsxs(tr,{to:C.href,className:E?"nav-link-active":"nav-link-inactive",children:[p.jsx(C.icon,{className:"h-5 w-5 mr-3"}),C.name]},C.name)})]})]}),p.jsxs("div",{className:"border-t border-gray-200 p-4",children:[p.jsxs("div",{className:"flex items-center mb-4",children:[p.jsx("div",{className:"flex-shrink-0",children:p.jsx("div",{className:"h-8 w-8 rounded-full bg-primary-600 flex items-center justify-center",children:p.jsxs("span",{className:"text-sm font-medium text-white",children:[(y=r.firstName)==null?void 0:y[0],(x=r.lastName)==null?void 0:x[0]]})})}),p.jsxs("div",{className:"ml-3",children:[p.jsxs("p",{className:"text-sm font-medium text-gray-900",children:[r.firstName," ",r.lastName]}),p.jsx("p",{className:"text-xs text-gray-500",children:r.email})]})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsxs(tr,{to:"/profile",className:"nav-link-inactive",children:[p.jsx(rm,{className:"h-5 w-5 mr-3"}),"Profile"]}),p.jsxs("button",{onClick:g,className:"nav-link-inactive w-full text-left",children:[p.jsx(Yx,{className:"h-5 w-5 mr-3"}),"Sign out"]})]})]})]})}),p.jsxs("div",{className:"lg:pl-64",children:[p.jsx("div",{className:"sticky top-0 z-10 bg-white border-b border-gray-200 lg:hidden",children:p.jsxs("div",{className:"relative flex h-16 items-center justify-between px-4",children:[p.jsx("button",{type:"button",className:"text-gray-500 hover:text-gray-600",onClick:()=>n(!0),children:p.jsx(oR,{className:"h-6 w-6"})}),p.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:p.jsx("img",{src:"/brand/logo.png",alt:"TurfTracking",className:"h-12 w-12 object-contain"})}),p.jsxs("div",{className:"flex items-center space-x-4",children:[p.jsx("button",{className:"text-gray-400 hover:text-gray-500",children:p.jsx(uR,{className:"h-6 w-6"})}),p.jsx("div",{className:"h-6 w-6 rounded-full bg-primary-600 flex items-center justify-center",children:p.jsx("span",{className:"text-xs font-medium text-white",children:(S=r.firstName)==null?void 0:S[0]})})]})]})}),p.jsx("main",{className:"min-h-screen",children:e})]})]}):p.jsx("div",{className:"min-h-screen flex items-center justify-center",children:p.jsx(Hs,{size:"lg",message:"Loading..."})})},Ah=({children:e})=>p.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-primary-50 to-grass-50 flex flex-col justify-center py-12 sm:px-6 lg:px-8",children:[p.jsx("div",{className:"sm:mx-auto sm:w-full sm:max-w-md",children:p.jsxs("div",{className:"text-center",children:[p.jsx("div",{className:"mx-auto h-16 w-16 bg-primary-600 rounded-full flex items-center justify-center mb-6",children:p.jsx("svg",{className:"h-10 w-10 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:p.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"})})}),p.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[p.jsx("img",{src:"/brand/logo.png",alt:"TurfTracking",className:"h-8 w-8"}),p.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"TurfTracking"})]}),p.jsx("p",{className:"text-lg text-gray-600",children:"Professional Lawn Care Management"})]})}),p.jsx("div",{className:"mt-8 sm:mx-auto sm:w-full sm:max-w-md",children:p.jsx("div",{className:"bg-white py-8 px-4 shadow-xl rounded-lg sm:px-10 border border-gray-200",children:e})}),p.jsx("div",{className:"mt-8 text-center",children:p.jsx("p",{className:"text-sm text-gray-500",children:"Track your lawn care with confidence"})})]});var kf=e=>e.type==="checkbox",Ja=e=>e instanceof Date,Br=e=>e==null;const hC=e=>typeof e=="object";var rn=e=>!Br(e)&&!Array.isArray(e)&&hC(e)&&!Ja(e),tM=e=>rn(e)&&e.target?kf(e.target)?e.target.checked:e.target.value:e,eM=(e,t)=>t.split(".").some((n,r,i)=>!isNaN(Number(n))&&e.has(i.slice(0,r).join("."))),nM=e=>{const t=e.constructor&&e.constructor.prototype;return rn(t)&&t.hasOwnProperty("isPrototypeOf")},Zy=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ln(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(Zy&&(e instanceof Blob||t))return e;const n=Array.isArray(e);if(!n&&!(rn(e)&&nM(e)))return e;const r=n?[]:Object.create(Object.getPrototypeOf(e));for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=Ln(e[i]));return r}var Ip=e=>/^\w*$/.test(e),Ue=e=>e===void 0,Wy=e=>Array.isArray(e)?e.filter(Boolean):[],Xy=e=>Wy(e.replace(/["|']|\]/g,"").split(/\.|\[/)),bt=(e,t,n)=>{if(!t||!rn(e))return n;const r=(Ip(t)?[t]:Xy(t)).reduce((i,s)=>Br(i)?i:i[s],e);return Ue(r)||r===e?Ue(e[t])?n:e[t]:r},Fs=e=>typeof e=="boolean",us=e=>typeof e=="function",Ie=(e,t,n)=>{let r=-1;const i=Ip(t)?[t]:Xy(t),s=i.length,a=s-1;for(;++r{const i={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(i,s,{get:()=>{const a=s;return t._proxyFormState[a]!==cs.all&&(t._proxyFormState[a]=!r||cs.all),e[a]}});return i};const sM=typeof window<"u"?ye.useLayoutEffect:ye.useEffect;var br=e=>typeof e=="string",oM=(e,t,n,r,i)=>br(e)?(r&&t.watch.add(e),bt(n,e,i)):Array.isArray(e)?e.map(s=>(r&&t.watch.add(s),bt(n,s))):(r&&(t.watchAll=!0),n),_v=e=>Br(e)||!hC(e);function Wo(e,t,n=new WeakSet){if(_v(e)||_v(t))return Object.is(e,t);if(Ja(e)&&Ja(t))return Object.is(e.getTime(),t.getTime());const r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const s of r){const a=e[s];if(!i.includes(s))return!1;if(s!=="ref"){const l=t[s];if(Ja(a)&&Ja(l)||(rn(a)||Array.isArray(a))&&(rn(l)||Array.isArray(l))?!Wo(a,l,n):!Object.is(a,l))return!1}}return!0}const aM=ye.createContext(null);aM.displayName="HookFormContext";var lM=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},Bc=e=>Array.isArray(e)?e:[e],ew=()=>{let e=[];return{get observers(){return e},next:i=>{for(const s of e)s.next&&s.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(s=>s!==i)}}),unsubscribe:()=>{e=[]}}};function pC(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const i=e[r],s=t[r];if(i&&rn(i)&&s){const a=pC(i,s);rn(a)&&(n[r]=a)}else e[r]&&(n[r]=s)}return n}var Sr=e=>rn(e)&&!Object.keys(e).length,Yy=e=>e.type==="file",Bd=e=>{if(!Zy)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},gC=e=>e.type==="select-multiple",Ky=e=>e.type==="radio",uM=e=>Ky(e)||kf(e),sm=e=>Bd(e)&&e.isConnected;function cM(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{for(const t in e)if(us(e[t]))return!0;return!1};function mC(e){return Array.isArray(e)||rn(e)&&!hM(e)}function xv(e,t={}){for(const n in e){const r=e[n];mC(r)?(t[n]=Array.isArray(r)?[]:{},xv(r,t[n])):Ue(r)||(t[n]=!0)}return t}function Pc(e,t,n){n||(n=xv(t));for(const r in e){const i=e[r];if(mC(i))Ue(t)||_v(n[r])?n[r]=xv(i,Array.isArray(i)?[]:{}):Pc(i,Br(t)?{}:t[r],n[r]);else{const s=t[r];n[r]=!Wo(i,s)}}return n}const nw={value:!1,isValid:!1},rw={value:!0,isValid:!0};var vC=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ue(e[0].attributes.value)?Ue(e[0].value)||e[0].value===""?rw:{value:e[0].value,isValid:!0}:rw:nw}return nw},yC=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Ue(e)?e:t?e===""?NaN:e&&+e:n&&br(e)?new Date(e):r?r(e):e;const iw={isValid:!1,value:null};var _C=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,iw):iw;function sw(e){const t=e.ref;return Yy(t)?t.files:Ky(t)?_C(e.refs).value:gC(t)?[...t.selectedOptions].map(({value:n})=>n):kf(t)?vC(e.refs).value:yC(Ue(t.value)?e.ref.value:t.value,e)}var dM=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,pM=(e,t,n,r)=>{const i={};for(const s of e){const a=bt(t,s);a&&Ie(i,s,a._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},Ud=e=>e instanceof RegExp,_c=e=>Ue(e)?e:Ud(e)?e.source:rn(e)?Ud(e.value)?e.value.source:e.value:e,ow=e=>({isOnSubmit:!e||e===cs.onSubmit,isOnBlur:e===cs.onBlur,isOnChange:e===cs.onChange,isOnAll:e===cs.all,isOnTouch:e===cs.onTouched});const aw="AsyncFunction";var gM=e=>!!e&&!!e.validate&&!!(us(e.validate)&&e.validate.constructor.name===aw||rn(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===aw)),mM=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),lw=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const Uc=(e,t,n,r)=>{for(const i of n||Object.keys(e)){const s=bt(e,i);if(s){const{_f:a,...l}=s;if(a){if(a.refs&&a.refs[0]&&t(a.refs[0],i)&&!r)return!0;if(a.ref&&t(a.ref,a.name)&&!r)return!0;if(Uc(l,t))break}else if(rn(l)&&Uc(l,t))break}}};function uw(e,t,n){const r=bt(e,n);if(r||Ip(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const s=i.join("."),a=bt(t,s),l=bt(e,s);if(a&&!Array.isArray(a)&&n!==s)return{name:n};if(l&&l.type)return{name:s,error:l};if(l&&l.root&&l.root.type)return{name:`${s}.root`,error:l.root};i.pop()}return{name:n}}var vM=(e,t,n,r)=>{n(e);const{name:i,...s}=e;return Sr(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(a=>t[a]===(!r||cs.all))},yM=(e,t,n)=>!e||!t||e===t||Bc(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r))),_M=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:(n?r.isOnChange:i.isOnChange)?e:!0,xM=(e,t)=>!Wy(bt(e,t)).length&&gn(e,t),wM=(e,t,n)=>{const r=Bc(bt(e,n));return Ie(r,dC,t[n]),Ie(e,n,r),e};function cw(e,t,n="validate"){if(br(e)||Array.isArray(e)&&e.every(br)||Fs(e)&&!e)return{type:n,message:br(e)?e:"",ref:t}}var Ul=e=>rn(e)&&!Ud(e)?e:{value:e,message:""},fw=async(e,t,n,r,i,s)=>{const{ref:a,refs:l,required:c,maxLength:f,minLength:g,min:d,max:v,pattern:y,validate:x,name:S,valueAsNumber:C,mount:E}=e._f,w=bt(n,S);if(!E||t.has(S))return{};const N=l?l[0]:a,I=W=>{i&&N.reportValidity&&(N.setCustomValidity(Fs(W)?"":W||""),N.reportValidity())},R={},A=Ky(a),B=kf(a),q=A||B,Q=(C||Yy(a))&&Ue(a.value)&&Ue(w)||Bd(a)&&a.value===""||w===""||Array.isArray(w)&&!w.length,Y=lM.bind(null,S,r,R),J=(W,$,D,ut=is.maxLength,it=is.minLength)=>{const yt=W?$:D;R[S]={type:W?ut:it,message:yt,ref:a,...Y(W?ut:it,yt)}};if(s?!Array.isArray(w)||!w.length:c&&(!q&&(Q||Br(w))||Fs(w)&&!w||B&&!vC(l).isValid||A&&!_C(l).isValid)){const{value:W,message:$}=br(c)?{value:!!c,message:c}:Ul(c);if(W&&(R[S]={type:is.required,message:$,ref:N,...Y(is.required,$)},!r))return I($),R}if(!Q&&(!Br(d)||!Br(v))){let W,$;const D=Ul(v),ut=Ul(d);if(!Br(w)&&!isNaN(w)){const it=a.valueAsNumber||w&&+w;Br(D.value)||(W=it>D.value),Br(ut.value)||($=itnew Date(new Date().toDateString()+" "+tt),z=a.type=="time",at=a.type=="week";br(D.value)&&w&&(W=z?yt(w)>yt(D.value):at?w>D.value:it>new Date(D.value)),br(ut.value)&&w&&($=z?yt(w)+W.value,ut=!Br($.value)&&w.length<+$.value;if((D||ut)&&(J(D,W.message,$.message),!r))return I(R[S].message),R}if(y&&!Q&&br(w)){const{value:W,message:$}=Ul(y);if(Ud(W)&&!w.match(W)&&(R[S]={type:is.pattern,message:$,ref:a,...Y(is.pattern,$)},!r))return I($),R}if(x){if(us(x)){const W=await x(w,n),$=cw(W,N);if($&&(R[S]={...$,...Y(is.validate,$.message)},!r))return I($.message),R}else if(rn(x)){let W={};for(const $ in x){if(!Sr(W)&&!r)break;const D=cw(await x[$](w,n),N,$);D&&(W={...D,...Y($,D.message)},I(D.message),r&&(R[S]=W))}if(!Sr(W)&&(R[S]={ref:N,...W},!r))return R}}return I(!0),R};const EM={mode:cs.onSubmit,reValidateMode:cs.onChange,shouldFocusError:!0};function SM(e={}){let t={...EM,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:us(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=rn(t.defaultValues)||rn(t.values)?Ln(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:Ln(i),a={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set},c,f=0;const g={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={...g};let v={...d};const y={array:ew(),state:ew()},x=t.criteriaMode===cs.all,S=T=>F=>{clearTimeout(f),f=setTimeout(T,F)},C=async T=>{if(!a.keepIsValid&&!t.disabled&&(d.isValid||v.isValid||T)){let F;t.resolver?(F=Sr((await Q()).errors),E()):F=await W({fields:r,onlyCheckValid:!0,eventType:Bl.VALID}),F!==n.isValid&&y.state.next({isValid:F})}},E=(T,F)=>{!t.disabled&&(d.isValidating||d.validatingFields||v.isValidating||v.validatingFields)&&((T||Array.from(l.mount)).forEach(G=>{G&&(F?Ie(n.validatingFields,G,F):gn(n.validatingFields,G))}),y.state.next({validatingFields:n.validatingFields,isValidating:!Sr(n.validatingFields)}))},w=T=>{const F=Pc(i,s),G=dM(T);Ie(n.dirtyFields,G,bt(F,G))},N=(T,F=[],G,gt,pt=!0,ft=!0)=>{if(gt&&G&&!t.disabled){if(a.action=!0,ft&&Array.isArray(bt(r,T))){const Et=G(bt(r,T),gt.argA,gt.argB);pt&&Ie(r,T,Et)}if(ft&&Array.isArray(bt(n.errors,T))){const Et=G(bt(n.errors,T),gt.argA,gt.argB);pt&&Ie(n.errors,T,Et),xM(n.errors,T)}if((d.touchedFields||v.touchedFields)&&ft&&Array.isArray(bt(n.touchedFields,T))){const Et=G(bt(n.touchedFields,T),gt.argA,gt.argB);pt&&Ie(n.touchedFields,T,Et)}(d.dirtyFields||v.dirtyFields)&&w(T),y.state.next({name:T,isDirty:D(T,F),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Ie(s,T,F)},I=(T,F)=>{Ie(n.errors,T,F),y.state.next({errors:n.errors})},R=T=>{n.errors=T,y.state.next({errors:n.errors,isValid:!1})},A=(T,F,G,gt)=>{const pt=bt(r,T);if(pt){const ft=bt(s,T,Ue(G)?bt(i,T):G);Ue(ft)||gt&>.defaultChecked||F?Ie(s,T,F?ft:sw(pt._f)):yt(T,ft),a.mount&&!a.action&&C()}},B=(T,F,G,gt,pt)=>{let ft=!1,Et=!1;const Bt={name:T};if(!t.disabled){if(!G||gt){(d.isDirty||v.isDirty)&&(Et=n.isDirty,n.isDirty=Bt.isDirty=D(),ft=Et!==Bt.isDirty);const ne=Wo(bt(i,T),F);Et=!!bt(n.dirtyFields,T),ne?gn(n.dirtyFields,T):Ie(n.dirtyFields,T,!0),Bt.dirtyFields=n.dirtyFields,ft=ft||(d.dirtyFields||v.dirtyFields)&&Et!==!ne}if(G){const ne=bt(n.touchedFields,T);ne||(Ie(n.touchedFields,T,G),Bt.touchedFields=n.touchedFields,ft=ft||(d.touchedFields||v.touchedFields)&&ne!==G)}ft&&pt&&y.state.next(Bt)}return ft?Bt:{}},q=(T,F,G,gt)=>{const pt=bt(n.errors,T),ft=(d.isValid||v.isValid)&&Fs(F)&&n.isValid!==F;if(t.delayError&&G?(c=S(()=>I(T,G)),c(t.delayError)):(clearTimeout(f),c=null,G?Ie(n.errors,T,G):gn(n.errors,T)),(G?!Wo(pt,G):pt)||!Sr(gt)||ft){const Et={...gt,...ft&&Fs(F)?{isValid:F}:{},errors:n.errors,name:T};n={...n,...Et},y.state.next(Et)}},Q=async T=>(E(T,!0),await t.resolver(s,t.context,pM(T||l.mount,r,t.criteriaMode,t.shouldUseNativeValidation))),Y=async T=>{const{errors:F}=await Q(T);if(E(T),T)for(const G of T){const gt=bt(F,G);gt?Ie(n.errors,G,gt):gn(n.errors,G)}else n.errors=F;return F},J=async({name:T,eventType:F})=>{if(e.validate){const G=await e.validate({formValues:s,formState:n,name:T,eventType:F});if(rn(G))for(const gt in G)G[gt]&&wt(`${im}.${gt}`,{message:br(G.message)?G.message:"",type:is.validate});else br(G)||!G?wt(im,{message:G||"",type:is.validate}):_t(im);return G}return!0},W=async({fields:T,onlyCheckValid:F,name:G,eventType:gt,context:pt={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(pt.runRootValidation=!0,!await J({name:G,eventType:gt})&&(pt.valid=!1,F)))return pt.valid;for(const ft in T){const Et=T[ft];if(Et){const{_f:Bt,...ne}=Et;if(Bt){const $e=l.array.has(Bt.name),_r=Et._f&&gM(Et._f);_r&&d.validatingFields&&E([Bt.name],!0);const tn=await fw(Et,l.disabled,s,x,t.shouldUseNativeValidation&&!F,$e);if(_r&&d.validatingFields&&E([Bt.name]),tn[Bt.name]&&(pt.valid=!1,F)||(!F&&(bt(tn,Bt.name)?$e?wM(n.errors,tn,Bt.name):Ie(n.errors,Bt.name,tn[Bt.name]):gn(n.errors,Bt.name)),e.shouldUseNativeValidation&&tn[Bt.name]))break}!Sr(ne)&&await W({context:pt,onlyCheckValid:F,fields:ne,name:ft,eventType:gt})}}return pt.valid},$=()=>{for(const T of l.unMount){const F=bt(r,T);F&&(F._f.refs?F._f.refs.every(G=>!sm(G)):!sm(F._f.ref))&&Ee(T)}l.unMount=new Set},D=(T,F)=>!t.disabled&&(T&&F&&Ie(s,T,F),!Wo(ct(),i)),ut=(T,F,G)=>oM(T,l,{...a.mount?s:Ue(F)?i:br(T)?{[T]:F}:F},G,F),it=T=>Wy(bt(a.mount?s:i,T,t.shouldUnregister?bt(i,T,[]):[])),yt=(T,F,G={})=>{const gt=bt(r,T);let pt=F;if(gt){const ft=gt._f;ft&&(!ft.disabled&&Ie(s,T,yC(F,ft)),pt=Bd(ft.ref)&&Br(F)?"":F,gC(ft.ref)?[...ft.ref.options].forEach(Et=>Et.selected=pt.includes(Et.value)):ft.refs?kf(ft.ref)?ft.refs.forEach(Et=>{(!Et.defaultChecked||!Et.disabled)&&(Array.isArray(pt)?Et.checked=!!pt.find(Bt=>Bt===Et.value):Et.checked=pt===Et.value||!!pt)}):ft.refs.forEach(Et=>Et.checked=Et.value===pt):Yy(ft.ref)?ft.ref.value="":(ft.ref.value=pt,ft.ref.type||y.state.next({name:T,values:Ln(s)})))}(G.shouldDirty||G.shouldTouch)&&B(T,pt,G.shouldTouch,G.shouldDirty,!0),G.shouldValidate&&Lt(T)},z=(T,F,G)=>{for(const gt in F){if(!F.hasOwnProperty(gt))return;const pt=F[gt],ft=T+"."+gt,Et=bt(r,ft);(l.array.has(T)||rn(pt)||Et&&!Et._f)&&!Ja(pt)?z(ft,pt,G):yt(ft,pt,G)}},at=(T,F,G={})=>{const gt=bt(r,T),pt=l.array.has(T),ft=Ln(F);Ie(s,T,ft),pt?(y.array.next({name:T,values:Ln(s)}),(d.isDirty||d.dirtyFields||v.isDirty||v.dirtyFields)&&G.shouldDirty&&(w(T),y.state.next({name:T,dirtyFields:n.dirtyFields,isDirty:D(T,ft)}))):gt&&!gt._f&&!Br(ft)?z(T,ft,G):yt(T,ft,G),lw(T,l)?y.state.next({...n,name:T,values:Ln(s)}):y.state.next({name:a.mount?T:void 0,values:Ln(s)})},tt=async T=>{a.mount=!0;const F=T.target;let G=F.name,gt=!0;const pt=bt(r,G),ft=ne=>{gt=Number.isNaN(ne)||Ja(ne)&&isNaN(ne.getTime())||Wo(ne,bt(s,G,ne))},Et=ow(t.mode),Bt=ow(t.reValidateMode);if(pt){let ne,$e;const _r=F.type?sw(pt._f):tM(T),tn=T.type===Bl.BLUR||T.type===Bl.FOCUS_OUT,wi=!mM(pt._f)&&!e.validate&&!t.resolver&&!bt(n.errors,G)&&!pt._f.deps||_M(tn,bt(n.touchedFields,G),n.isSubmitted,Bt,Et),Aa=lw(G,l,tn);Ie(s,G,_r),tn?(!F||!F.readOnly)&&(pt._f.onBlur&&pt._f.onBlur(T),c&&c(0)):pt._f.onChange&&pt._f.onChange(T);const $i=B(G,_r,tn),Ku=!Sr($i)||Aa;if(!tn&&y.state.next({name:G,type:T.type,values:Ln(s)}),wi)return(d.isValid||v.isValid)&&(t.mode==="onBlur"?tn&&C():tn||C()),Ku&&y.state.next({name:G,...Aa?{}:$i});if(!t.resolver&&e.validate&&await J({name:G,eventType:T.type}),!tn&&Aa&&y.state.next({...n}),t.resolver){const{errors:Oo}=await Q([G]);if(E([G]),ft(_r),gt){const Da=uw(n.errors,r,G),Ls=uw(Oo,r,Da.name||G);ne=Ls.error,G=Ls.name,$e=Sr(Oo)}}else E([G],!0),ne=(await fw(pt,l.disabled,s,x,t.shouldUseNativeValidation))[G],E([G]),ft(_r),gt&&(ne?$e=!1:(d.isValid||v.isValid)&&($e=await W({fields:r,onlyCheckValid:!0,name:G,eventType:T.type})));gt&&(pt._f.deps&&(!Array.isArray(pt._f.deps)||pt._f.deps.length>0)&&Lt(pt._f.deps),q(G,$e,ne,$i))}},vt=(T,F)=>{if(bt(n.errors,F)&&T.focus)return T.focus(),1},Lt=async(T,F={})=>{let G,gt;const pt=Bc(T);if(t.resolver){const ft=await Y(Ue(T)?T:pt);G=Sr(ft),gt=T?!pt.some(Et=>bt(ft,Et)):G}else T?(gt=(await Promise.all(pt.map(async ft=>{const Et=bt(r,ft);return await W({fields:Et&&Et._f?{[ft]:Et}:Et,eventType:Bl.TRIGGER})}))).every(Boolean),!(!gt&&!n.isValid)&&C()):gt=G=await W({fields:r,name:T,eventType:Bl.TRIGGER});return y.state.next({...!br(T)||(d.isValid||v.isValid)&&G!==n.isValid?{}:{name:T},...t.resolver||!T?{isValid:G}:{},errors:n.errors}),F.shouldFocus&&!gt&&Uc(r,vt,T?pt:l.mount),gt},ct=(T,F)=>{let G={...a.mount?s:i};return F&&(G=pC(F.dirtyFields?n.dirtyFields:n.touchedFields,G)),Ue(T)?G:br(T)?bt(G,T):T.map(gt=>bt(G,gt))},ht=(T,F)=>({invalid:!!bt((F||n).errors,T),isDirty:!!bt((F||n).dirtyFields,T),error:bt((F||n).errors,T),isValidating:!!bt(n.validatingFields,T),isTouched:!!bt((F||n).touchedFields,T)}),_t=T=>{const F=T?Bc(T):void 0;F==null||F.forEach(G=>gn(n.errors,G)),F?F.forEach(G=>{y.state.next({name:G,errors:n.errors})}):y.state.next({errors:{}})},wt=(T,F,G)=>{const gt=(bt(r,T,{_f:{}})._f||{}).ref,pt=bt(n.errors,T)||{},{ref:ft,message:Et,type:Bt,...ne}=pt;Ie(n.errors,T,{...ne,...F,ref:gt}),y.state.next({name:T,errors:n.errors,isValid:!1}),G&&G.shouldFocus&>&>.focus&>.focus()},Gt=(T,F)=>us(T)?y.state.subscribe({next:G=>"values"in G&&T(ut(void 0,F),G)}):ut(T,F,!0),jt=T=>y.state.subscribe({next:F=>{yM(T.name,F.name,T.exact)&&vM(F,T.formState||d,Il,T.reRenderRoot)&&T.callback({values:{...s},...n,...F,defaultValues:i})}}).unsubscribe,we=T=>(a.mount=!0,v={...v,...T.formState},jt({...T,formState:{...g,...T.formState}})),Ee=(T,F={})=>{for(const G of T?Bc(T):l.mount)l.mount.delete(G),l.array.delete(G),F.keepValue||(gn(r,G),gn(s,G)),!F.keepError&&gn(n.errors,G),!F.keepDirty&&gn(n.dirtyFields,G),!F.keepTouched&&gn(n.touchedFields,G),!F.keepIsValidating&&gn(n.validatingFields,G),!t.shouldUnregister&&!F.keepDefaultValue&&gn(i,G);y.state.next({values:Ln(s)}),y.state.next({...n,...F.keepDirty?{isDirty:D()}:{}}),!F.keepIsValid&&C()},Je=({disabled:T,name:F})=>{if(Fs(T)&&a.mount||T||l.disabled.has(F)){const pt=l.disabled.has(F)!==!!T;T?l.disabled.add(F):l.disabled.delete(F),pt&&a.mount&&!a.action&&C()}},De=(T,F={})=>{let G=bt(r,T);const gt=Fs(F.disabled)||Fs(t.disabled),pt=!l.registerName.has(T)&&G&&!G._f.mount;return Ie(r,T,{...G||{},_f:{...G&&G._f?G._f:{ref:{name:T}},name:T,mount:!0,...F}}),l.mount.add(T),G&&!pt?Je({disabled:Fs(F.disabled)?F.disabled:t.disabled,name:T}):A(T,!0,F.value),{...gt?{disabled:F.disabled||t.disabled}:{},...t.progressive?{required:!!F.required,min:_c(F.min),max:_c(F.max),minLength:_c(F.minLength),maxLength:_c(F.maxLength),pattern:_c(F.pattern)}:{},name:T,onChange:tt,onBlur:tt,ref:ft=>{if(ft){l.registerName.add(T),De(T,F),l.registerName.delete(T),G=bt(r,T);const Et=Ue(ft.value)&&ft.querySelectorAll&&ft.querySelectorAll("input,select,textarea")[0]||ft,Bt=uM(Et),ne=G._f.refs||[];if(Bt?ne.find($e=>$e===Et):Et===G._f.ref)return;Ie(r,T,{_f:{...G._f,...Bt?{refs:[...ne.filter(sm),Et,...Array.isArray(bt(i,T))?[{}]:[]],ref:{type:Et.type,name:T}}:{ref:Et}}}),A(T,!1,void 0,Et)}else G=bt(r,T,{}),G._f&&(G._f.mount=!1),(t.shouldUnregister||F.shouldUnregister)&&!(eM(l.array,T)&&a.action)&&l.unMount.add(T)}}},jr=()=>t.shouldFocusError&&Uc(r,vt,l.mount),Nn=T=>{Fs(T)&&(y.state.next({disabled:T}),Uc(r,(F,G)=>{const gt=bt(r,G);gt&&(F.disabled=gt._f.disabled||T,Array.isArray(gt._f.refs)&>._f.refs.forEach(pt=>{pt.disabled=gt._f.disabled||T}))},0,!1))},Ke=(T,F)=>async G=>{let gt;G&&(G.preventDefault&&G.preventDefault(),G.persist&&G.persist());let pt=Ln(s);if(y.state.next({isSubmitting:!0}),t.resolver){const{errors:ft,values:Et}=await Q();E(),n.errors=ft,pt=Ln(Et)}else await W({fields:r,eventType:Bl.SUBMIT});if(l.disabled.size)for(const ft of l.disabled)gn(pt,ft);if(gn(n.errors,dC),Sr(n.errors)){y.state.next({errors:{}});try{await T(pt,G)}catch(ft){gt=ft}}else F&&await F({...n.errors},G),jr(),setTimeout(jr);if(y.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Sr(n.errors)&&!gt,submitCount:n.submitCount+1,errors:n.errors}),gt)throw gt},Ji=(T,F={})=>{bt(r,T)&&(Ue(F.defaultValue)?at(T,Ln(bt(i,T))):(at(T,F.defaultValue),Ie(i,T,Ln(F.defaultValue))),F.keepTouched||gn(n.touchedFields,T),F.keepDirty||(gn(n.dirtyFields,T),n.isDirty=F.defaultValue?D(T,Ln(bt(i,T))):D()),F.keepError||(gn(n.errors,T),d.isValid&&C()),y.state.next({...n}))},ar=(T,F={})=>{const G=T?Ln(T):i,gt=Ln(G),pt=Sr(T),ft=pt?i:gt;if(F.keepDefaultValues||(i=G),!F.keepValues){if(F.keepDirtyValues){const Et=new Set([...l.mount,...Object.keys(Pc(i,s))]);for(const Bt of Array.from(Et)){const ne=bt(n.dirtyFields,Bt),$e=bt(s,Bt),_r=bt(ft,Bt);ne&&!Ue($e)?Ie(ft,Bt,$e):!ne&&!Ue(_r)&&at(Bt,_r)}}else{if(Zy&&Ue(T))for(const Et of l.mount){const Bt=bt(r,Et);if(Bt&&Bt._f){const ne=Array.isArray(Bt._f.refs)?Bt._f.refs[0]:Bt._f.ref;if(Bd(ne)){const $e=ne.closest("form");if($e){$e.reset();break}}}}if(F.keepFieldsRef)for(const Et of l.mount)at(Et,bt(ft,Et));else r={}}s=t.shouldUnregister?F.keepDefaultValues?Ln(i):{}:Ln(ft),y.array.next({values:{...ft}}),y.state.next({values:{...ft}})}l={mount:F.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!d.isValid||!!F.keepIsValid||!!F.keepDirtyValues||!t.shouldUnregister&&!Sr(ft),a.watch=!!t.shouldUnregister,a.keepIsValid=!!F.keepIsValid,a.action=!1,F.keepErrors||(n.errors={}),y.state.next({submitCount:F.keepSubmitCount?n.submitCount:0,isDirty:pt?!1:F.keepDirty?n.isDirty:!!(F.keepDefaultValues&&!Wo(T,i)),isSubmitted:F.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:pt?{}:F.keepDirtyValues?F.keepDefaultValues&&s?Pc(i,s):n.dirtyFields:F.keepDefaultValues&&T?Pc(i,T):F.keepDirty?n.dirtyFields:{},touchedFields:F.keepTouched?n.touchedFields:{},errors:F.keepErrors?n.errors:{},isSubmitSuccessful:F.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:i})},cn=(T,F)=>ar(us(T)?T(s):T,{...t.resetOptions,...F}),xi=(T,F={})=>{const G=bt(r,T),gt=G&&G._f;if(gt){const pt=gt.refs?gt.refs[0]:gt.ref;pt.focus&&setTimeout(()=>{pt.focus(),F.shouldSelect&&us(pt.select)&&pt.select()})}},Il=T=>{n={...n,...T}},Ma={control:{register:De,unregister:Ee,getFieldState:ht,handleSubmit:Ke,setError:wt,_subscribe:jt,_runSchema:Q,_updateIsValidating:E,_focusError:jr,_getWatch:ut,_getDirty:D,_setValid:C,_setFieldArray:N,_setDisabledField:Je,_setErrors:R,_getFieldArray:it,_reset:ar,_resetDefaultValues:()=>us(t.defaultValues)&&t.defaultValues().then(T=>{cn(T,t.resetOptions),y.state.next({isLoading:!1})}),_removeUnmounted:$,_disableForm:Nn,_subjects:y,_proxyFormState:d,get _fields(){return r},get _formValues(){return s},get _state(){return a},set _state(T){a=T},get _defaultValues(){return i},get _names(){return l},set _names(T){l=T},get _formState(){return n},get _options(){return t},set _options(T){t={...t,...T}}},subscribe:we,trigger:Lt,register:De,handleSubmit:Ke,watch:Gt,setValue:at,getValues:ct,reset:cn,resetField:Ji,clearErrors:_t,unregister:Ee,setError:wt,setFocus:xi,getFieldState:ht};return{...Ma,formControl:Ma}}function Tp(e={}){const t=ye.useRef(void 0),n=ye.useRef(void 0),[r,i]=ye.useState({isDirty:!1,isValidating:!1,isLoading:us(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:us(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!us(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:a,...l}=SM(e);t.current={...l,formState:r}}const s=t.current.control;return s._options=e,sM(()=>{const a=s._subscribe({formState:s._proxyFormState,callback:()=>i({...s._formState}),reRenderRoot:!0});return i(l=>({...l,isReady:!0})),s._formState.isReady=!0,a},[s]),ye.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),ye.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),ye.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),ye.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),ye.useEffect(()=>{if(s._proxyFormState.isDirty){const a=s._getDirty();a!==r.isDirty&&s._subjects.state.next({isDirty:a})}},[s,r.isDirty]),ye.useEffect(()=>{var a;e.values&&!Wo(e.values,n.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),!((a=s._options.resetOptions)===null||a===void 0)&&a.keepIsValid||s._setValid(),n.current=e.values,i(l=>({...l}))):s._resetDefaultValues()},[s,e.values]),ye.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),t.current.formState=ye.useMemo(()=>iM(r,s),[s,r]),t.current}const CM=()=>{var E,w;const[e,t]=P.useState(!1),[n,r]=P.useState(!0),[i,s]=P.useState(!0),{login:a,loading:l}=qu(),c=La(),g=((w=(E=ba().state)==null?void 0:E.from)==null?void 0:w.pathname)||"/dashboard",{register:d,handleSubmit:v,formState:{errors:y},setError:x}=Tp();P.useEffect(()=>{(async()=>{try{const I=await K.get("/auth/registration-status");r(I.data.data.enabled)}catch(I){console.error("Failed to fetch registration setting:",I),r(!0)}finally{s(!1)}})()},[]);const S=async N=>{console.log("Login form submitted:",N.email);const I=await a(N);console.log("Login result:",I),I.success?(console.log("Login successful, navigating to:",g),c(g,{replace:!0})):(console.log("Login failed, showing error:",I.error),x("root",{type:"manual",message:I.error}))},C=()=>{window.location.href=`${oC.apiOrigin}/api/auth/authentik`};return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{children:[p.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:"Sign in to your account"}),!i&&n&&p.jsxs("p",{className:"mt-2 text-sm text-gray-600",children:["Or"," ",p.jsx(tr,{to:"/register",className:"font-medium text-primary-600 hover:text-primary-500",children:"create a new account"})]})]}),p.jsxs("form",{className:"space-y-6",onSubmit:v(S),children:[y.root&&p.jsx("div",{className:"rounded-md bg-red-50 p-4",children:p.jsx("div",{className:"flex",children:p.jsx("div",{className:"ml-3",children:p.jsx("h3",{className:"text-sm font-medium text-red-800",children:y.root.message})})})}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"email",className:"label",children:"Email address"}),p.jsxs("div",{className:"mt-1",children:[p.jsx("input",{id:"email",type:"email",autoComplete:"email",className:y.email?"input-error":"input",...d("email",{required:"Email is required",pattern:{value:/^\S+@\S+$/i,message:"Invalid email address"}})}),y.email&&p.jsx("p",{className:"mt-2 text-sm text-red-600",children:y.email.message})]})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"password",className:"label",children:"Password"}),p.jsxs("div",{className:"mt-1 relative",children:[p.jsx("input",{id:"password",type:e?"text":"password",autoComplete:"current-password",className:y.password?"input-error pr-10":"input pr-10",...d("password",{required:"Password is required"})}),p.jsx("button",{type:"button",className:"absolute inset-y-0 right-0 pr-3 flex items-center",onClick:()=>t(!e),children:e?p.jsx(cC,{className:"h-5 w-5 text-gray-400"}):p.jsx(zd,{className:"h-5 w-5 text-gray-400"})}),y.password&&p.jsx("p",{className:"mt-2 text-sm text-red-600",children:y.password.message})]})]}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center",children:[p.jsx("input",{id:"remember-me",name:"remember-me",type:"checkbox",className:"h-4 w-4 text-primary-600 focus:ring-primary-500 border-gray-300 rounded"}),p.jsx("label",{htmlFor:"remember-me",className:"ml-2 block text-sm text-gray-900",children:"Remember me"})]}),p.jsx("div",{className:"text-sm",children:p.jsx(tr,{to:"/forgot-password",className:"font-medium text-primary-600 hover:text-primary-500",children:"Forgot your password?"})})]}),p.jsx("div",{children:p.jsx("button",{type:"submit",disabled:l,className:"btn-primary w-full justify-center",children:l?p.jsx(Hs,{size:"sm",color:"white"}):"Sign in"})}),p.jsxs("div",{className:"mt-6",children:[p.jsxs("div",{className:"relative",children:[p.jsx("div",{className:"absolute inset-0 flex items-center",children:p.jsx("div",{className:"w-full border-t border-gray-300"})}),p.jsx("div",{className:"relative flex justify-center text-sm",children:p.jsx("span",{className:"px-2 bg-white text-gray-500",children:"Or continue with"})})]}),p.jsx("div",{className:"mt-6",children:p.jsxs("button",{type:"button",onClick:C,className:"w-full inline-flex justify-center py-2 px-4 border border-gray-300 rounded-lg shadow-sm bg-white text-sm font-medium text-gray-500 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500 transition-colors duration-200",children:[p.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:[p.jsx("path",{d:"M12 2L2 7v10c0 5.55 3.84 9.74 9 11 5.16-1.26 9-5.45 9-11V7l-10-5z"}),p.jsx("path",{d:"M10 17l-4-4 1.41-1.41L10 14.17l6.59-6.59L18 9l-8 8z",fill:"white"})]}),p.jsx("span",{className:"ml-2",children:"Sign in with Authentik"})]})})]})]})]})},NM=()=>{const[e,t]=P.useState(!1),[n,r]=P.useState(!1),{register:i,loading:s}=qu(),a=La(),[l]=wS(),c=l.get("invite"),{register:f,handleSubmit:g,formState:{errors:d},watch:v,setError:y,setValue:x}=Tp(),S=v("password");P.useEffect(()=>{(async()=>{var w,N,I,R;if(c)try{r(!0);const B=(N=(w=(await Zo.getInvitation(c)).data)==null?void 0:w.data)==null?void 0:N.invitation;if(!B)return;x("firstName",B.firstName||""),x("lastName",B.lastName||""),x("email",B.email||"")}catch(A){y("root",{type:"manual",message:((R=(I=A.response)==null?void 0:I.data)==null?void 0:R.message)||"Invitation is invalid or expired"})}finally{r(!1)}})()},[c,y,x]);const C=async E=>{console.log("Register form submitted:",E.email);const w=await i({...E,inviteToken:c});console.log("Register result:",w),w.success?(console.log("Registration successful, navigating to dashboard"),a("/dashboard")):(console.log("Registration failed, showing error:",w.error),y("root",{type:"manual",message:w.error}))};return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{children:[p.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:c?"Accept your invitation":"Create your account"}),p.jsxs("p",{className:"mt-2 text-sm text-gray-600",children:[c?"Finish account setup to access TurfTracking.":"Already have an account? ",!c&&p.jsx(tr,{to:"/login",className:"font-medium text-primary-600 hover:text-primary-500",children:"Sign in here"})]})]}),n&&p.jsx("div",{className:"rounded-md bg-blue-50 p-4 text-sm text-blue-800",children:"Validating invitation..."}),p.jsxs("form",{className:"space-y-6",onSubmit:g(C),children:[d.root&&p.jsx("div",{className:"rounded-md bg-red-50 p-4",children:p.jsx("div",{className:"flex",children:p.jsx("div",{className:"ml-3",children:p.jsx("h3",{className:"text-sm font-medium text-red-800",children:d.root.message})})})}),p.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[p.jsxs("div",{children:[p.jsx("label",{htmlFor:"firstName",className:"label",children:"First name"}),p.jsxs("div",{className:"mt-1",children:[p.jsx("input",{id:"firstName",type:"text",autoComplete:"given-name",className:d.firstName?"input-error":"input",...f("firstName",{required:"First name is required",minLength:{value:2,message:"First name must be at least 2 characters"}})}),d.firstName&&p.jsx("p",{className:"mt-2 text-sm text-red-600",children:d.firstName.message})]})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"lastName",className:"label",children:"Last name"}),p.jsxs("div",{className:"mt-1",children:[p.jsx("input",{id:"lastName",type:"text",autoComplete:"family-name",className:d.lastName?"input-error":"input",...f("lastName",{required:"Last name is required",minLength:{value:2,message:"Last name must be at least 2 characters"}})}),d.lastName&&p.jsx("p",{className:"mt-2 text-sm text-red-600",children:d.lastName.message})]})]})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"email",className:"label",children:"Email address"}),p.jsxs("div",{className:"mt-1",children:[p.jsx("input",{id:"email",type:"email",autoComplete:"email",className:d.email?"input-error":"input",readOnly:!!c,...f("email",{required:"Email is required",pattern:{value:/^\S+@\S+$/i,message:"Invalid email address"}})}),d.email&&p.jsx("p",{className:"mt-2 text-sm text-red-600",children:d.email.message})]})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"password",className:"label",children:"Password"}),p.jsxs("div",{className:"mt-1 relative",children:[p.jsx("input",{id:"password",type:e?"text":"password",autoComplete:"new-password",className:d.password?"input-error pr-10":"input pr-10",...f("password",{required:"Password is required",minLength:{value:8,message:"Password must be at least 8 characters"},pattern:{value:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&#+])[A-Za-z\d@$!%*?&#+]/,message:"Password must contain uppercase, lowercase, number, and special character"}})}),p.jsx("button",{type:"button",className:"absolute inset-y-0 right-0 pr-3 flex items-center",onClick:()=>t(!e),children:e?p.jsx(cC,{className:"h-5 w-5 text-gray-400"}):p.jsx(zd,{className:"h-5 w-5 text-gray-400"})}),d.password&&p.jsx("p",{className:"mt-2 text-sm text-red-600",children:d.password.message})]})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"confirmPassword",className:"label",children:"Confirm password"}),p.jsxs("div",{className:"mt-1",children:[p.jsx("input",{id:"confirmPassword",type:"password",autoComplete:"new-password",className:d.confirmPassword?"input-error":"input",...f("confirmPassword",{required:"Please confirm your password",validate:E=>E===S||"Passwords do not match"})}),d.confirmPassword&&p.jsx("p",{className:"mt-2 text-sm text-red-600",children:d.confirmPassword.message})]})]}),p.jsxs("div",{className:"flex items-center",children:[p.jsx("input",{id:"agree-terms",type:"checkbox",className:"h-4 w-4 text-primary-600 focus:ring-primary-500 border-gray-300 rounded",...f("agreeTerms",{required:"You must agree to the terms and conditions"})}),p.jsxs("label",{htmlFor:"agree-terms",className:"ml-2 block text-sm text-gray-900",children:["I agree to the"," ",p.jsx(tr,{to:"/terms",className:"text-primary-600 hover:text-primary-500",target:"_blank",children:"Terms and Conditions"})," ","and"," ",p.jsx(tr,{to:"/privacy",className:"text-primary-600 hover:text-primary-500",target:"_blank",children:"Privacy Policy"})]})]}),d.agreeTerms&&p.jsx("p",{className:"text-sm text-red-600",children:d.agreeTerms.message}),p.jsx("div",{children:p.jsx("button",{type:"submit",disabled:s,className:"btn-primary w-full justify-center",children:s?p.jsx(Hs,{size:"sm",color:"white"}):"Create account"})})]})]})},PM=()=>{const{forgotPassword:e,loading:t}=qu(),{register:n,handleSubmit:r,formState:{errors:i},setError:s,reset:a}=Tp(),l=async c=>{const f=await e(c.email);f.success?a():s("root",{type:"manual",message:f.error})};return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{children:[p.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:"Forgot your password?"}),p.jsx("p",{className:"mt-2 text-sm text-gray-600",children:"Enter your email address and we'll send you a link to reset your password."})]}),p.jsxs("form",{className:"space-y-6",onSubmit:r(l),children:[i.root&&p.jsx("div",{className:"rounded-md bg-red-50 p-4",children:p.jsx("div",{className:"flex",children:p.jsx("div",{className:"ml-3",children:p.jsx("h3",{className:"text-sm font-medium text-red-800",children:i.root.message})})})}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"email",className:"label",children:"Email address"}),p.jsxs("div",{className:"mt-1",children:[p.jsx("input",{id:"email",type:"email",autoComplete:"email",className:i.email?"input-error":"input",...n("email",{required:"Email is required",pattern:{value:/^\S+@\S+$/i,message:"Invalid email address"}})}),i.email&&p.jsx("p",{className:"mt-2 text-sm text-red-600",children:i.email.message})]})]}),p.jsx("div",{children:p.jsx("button",{type:"submit",disabled:t,className:"btn-primary w-full justify-center",children:t?p.jsx(Hs,{size:"sm",color:"white"}):"Send reset link"})}),p.jsx("div",{className:"text-center",children:p.jsx(tr,{to:"/login",className:"font-medium text-primary-600 hover:text-primary-500",children:"Back to sign in"})})]})]})},bM=()=>{const[e]=wS(),t=La(),n=e.get("token"),[r,i]=P.useState(!0),[s,a]=P.useState(!1),[l,c]=P.useState(!1),{register:f,handleSubmit:g,watch:d,setError:v,formState:{errors:y}}=Tp(),x=d("newPassword");P.useEffect(()=>{(async()=>{var E,w;if(!n){v("root",{type:"manual",message:"Password reset link is missing a token."}),i(!1);return}try{await Zo.validateResetToken(n),a(!0)}catch(N){v("root",{type:"manual",message:((w=(E=N.response)==null?void 0:E.data)==null?void 0:w.message)||"Password reset link is invalid or expired."})}finally{i(!1)}})()},[n,v]);const S=async C=>{var E,w;try{c(!0),await Zo.resetPassword({token:n,newPassword:C.newPassword}),t("/login",{replace:!0})}catch(N){v("root",{type:"manual",message:((w=(E=N.response)==null?void 0:E.data)==null?void 0:w.message)||"Failed to reset password"})}finally{c(!1)}};return r?p.jsxs("div",{className:"space-y-6",children:[p.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:"Reset your password"}),p.jsx("div",{className:"flex justify-center py-8",children:p.jsx(Hs,{size:"lg"})})]}):p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{children:[p.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:"Reset your password"}),p.jsx("p",{className:"mt-2 text-sm text-gray-600",children:"Choose a new password for your TurfTracking account."})]}),y.root&&p.jsx("div",{className:"rounded-md bg-red-50 p-4 text-sm font-medium text-red-800",children:y.root.message}),s&&p.jsxs("form",{className:"space-y-6",onSubmit:g(S),children:[p.jsxs("div",{children:[p.jsx("label",{htmlFor:"newPassword",className:"label",children:"New password"}),p.jsx("input",{id:"newPassword",type:"password",className:y.newPassword?"input-error":"input",...f("newPassword",{required:"Password is required",minLength:{value:8,message:"Password must be at least 8 characters"},pattern:{value:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&#+])[A-Za-z\d@$!%*?&#+]/,message:"Password must contain uppercase, lowercase, number, and special character"}})}),y.newPassword&&p.jsx("p",{className:"mt-2 text-sm text-red-600",children:y.newPassword.message})]}),p.jsxs("div",{children:[p.jsx("label",{htmlFor:"confirmPassword",className:"label",children:"Confirm password"}),p.jsx("input",{id:"confirmPassword",type:"password",className:y.confirmPassword?"input-error":"input",...f("confirmPassword",{required:"Please confirm your password",validate:C=>C===x||"Passwords do not match"})}),y.confirmPassword&&p.jsx("p",{className:"mt-2 text-sm text-red-600",children:y.confirmPassword.message})]}),p.jsx("button",{type:"submit",disabled:l,className:"btn-primary w-full justify-center",children:l?p.jsx(Hs,{size:"sm",color:"white"}):"Reset password"})]}),p.jsx("div",{className:"text-center",children:p.jsx(tr,{to:"/login",className:"font-medium text-primary-600 hover:text-primary-500",children:"Back to sign in"})})]})};function xC(e,t){const n=P.useRef(t);P.useEffect(function(){t!==n.current&&e.attributionControl!=null&&(n.current!=null&&e.attributionControl.removeAttribution(n.current),t!=null&&e.attributionControl.addAttribution(t)),n.current=t},[e,t])}const LM=1;function IM(e){return Object.freeze({__version:LM,map:e})}function Qy(e,t){return Object.freeze({...e,...t})}const wC=P.createContext(null),EC=wC.Provider;function Op(){const e=P.useContext(wC);if(e==null)throw new Error("No context provided: useLeafletContext() can only be used in a descendant of ");return e}function SC(e){function t(n,r){const{instance:i,context:s}=e(n).current;return P.useImperativeHandle(r,()=>i),n.children==null?null:ye.createElement(EC,{value:s},n.children)}return P.forwardRef(t)}function TM(e){function t(n,r){const[i,s]=P.useState(!1),{instance:a}=e(n,s).current;P.useImperativeHandle(r,()=>a),P.useEffect(function(){i&&a.update()},[a,i,n.children]);const l=a._contentNode;return l?Oy.createPortal(n.children,l):null}return P.forwardRef(t)}function OM(e){function t(n,r){const{instance:i}=e(n).current;return P.useImperativeHandle(r,()=>i),null}return P.forwardRef(t)}function Jy(e,t){const n=P.useRef();P.useEffect(function(){return t!=null&&e.instance.on(t),n.current=t,function(){n.current!=null&&e.instance.off(n.current),n.current=null}},[e,t])}function Rp(e,t){const n=e.pane??t.pane;return n?{...e,pane:n}:e}function RM(e,t){return function(r,i){const s=Op(),a=e(Rp(r,s),s);return xC(s.map,r.attribution),Jy(a.current,r.eventHandlers),t(a.current,s,r,i),a}}var wv={exports:{}};/* @preserve * Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com * (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade */(function(e,t){(function(n,r){r(t)})(EP,function(n){var r="1.9.4";function i(o){var u,h,m,_;for(h=1,m=arguments.length;h"u"||!L||!L.Mixin)){o=N(o)?o:[o];for(var u=0;u0?Math.floor(o):Math.ceil(o)};z.prototype={clone:function(){return new z(this.x,this.y)},add:function(o){return this.clone()._add(tt(o))},_add:function(o){return this.x+=o.x,this.y+=o.y,this},subtract:function(o){return this.clone()._subtract(tt(o))},_subtract:function(o){return this.x-=o.x,this.y-=o.y,this},divideBy:function(o){return this.clone()._divideBy(o)},_divideBy:function(o){return this.x/=o,this.y/=o,this},multiplyBy:function(o){return this.clone()._multiplyBy(o)},_multiplyBy:function(o){return this.x*=o,this.y*=o,this},scaleBy:function(o){return new z(this.x*o.x,this.y*o.y)},unscaleBy:function(o){return new z(this.x/o.x,this.y/o.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=at(this.x),this.y=at(this.y),this},distanceTo:function(o){o=tt(o);var u=o.x-this.x,h=o.y-this.y;return Math.sqrt(u*u+h*h)},equals:function(o){return o=tt(o),o.x===this.x&&o.y===this.y},contains:function(o){return o=tt(o),Math.abs(o.x)<=Math.abs(this.x)&&Math.abs(o.y)<=Math.abs(this.y)},toString:function(){return"Point("+v(this.x)+", "+v(this.y)+")"}};function tt(o,u,h){return o instanceof z?o:N(o)?new z(o[0],o[1]):o==null?o:typeof o=="object"&&"x"in o&&"y"in o?new z(o.x,o.y):new z(o,u,h)}function vt(o,u){if(o)for(var h=u?[o,u]:o,m=0,_=h.length;m<_;m++)this.extend(h[m])}vt.prototype={extend:function(o){var u,h;if(!o)return this;if(o instanceof z||typeof o[0]=="number"||"x"in o)u=h=tt(o);else if(o=Lt(o),u=o.min,h=o.max,!u||!h)return this;return!this.min&&!this.max?(this.min=u.clone(),this.max=h.clone()):(this.min.x=Math.min(u.x,this.min.x),this.max.x=Math.max(h.x,this.max.x),this.min.y=Math.min(u.y,this.min.y),this.max.y=Math.max(h.y,this.max.y)),this},getCenter:function(o){return tt((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,o)},getBottomLeft:function(){return tt(this.min.x,this.max.y)},getTopRight:function(){return tt(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(o){var u,h;return typeof o[0]=="number"||o instanceof z?o=tt(o):o=Lt(o),o instanceof vt?(u=o.min,h=o.max):u=h=o,u.x>=this.min.x&&h.x<=this.max.x&&u.y>=this.min.y&&h.y<=this.max.y},intersects:function(o){o=Lt(o);var u=this.min,h=this.max,m=o.min,_=o.max,b=_.x>=u.x&&m.x<=h.x,O=_.y>=u.y&&m.y<=h.y;return b&&O},overlaps:function(o){o=Lt(o);var u=this.min,h=this.max,m=o.min,_=o.max,b=_.x>u.x&&m.xu.y&&m.y=u.lat&&_.lat<=h.lat&&m.lng>=u.lng&&_.lng<=h.lng},intersects:function(o){o=ht(o);var u=this._southWest,h=this._northEast,m=o.getSouthWest(),_=o.getNorthEast(),b=_.lat>=u.lat&&m.lat<=h.lat,O=_.lng>=u.lng&&m.lng<=h.lng;return b&&O},overlaps:function(o){o=ht(o);var u=this._southWest,h=this._northEast,m=o.getSouthWest(),_=o.getNorthEast(),b=_.lat>u.lat&&m.latu.lng&&m.lng1,Yf=function(){var o=!1;try{var u=Object.defineProperty({},"passive",{get:function(){o=!0}});window.addEventListener("testPassiveEventSupport",d,u),window.removeEventListener("testPassiveEventSupport",d,u)}catch{}return o}(),Yp=function(){return!!document.createElement("canvas").getContext}(),Tl=!!(document.createElementNS&&Ke("svg").createSVGRect),Kf=!!Tl&&function(){var o=document.createElement("div");return o.innerHTML="",(o.firstChild&&o.firstChild.namespaceURI)==="http://www.w3.org/2000/svg"}(),Kp=!Tl&&function(){try{var o=document.createElement("div");o.innerHTML='';var u=o.firstChild;return u.style.behavior="url(#default#VML)",u&&typeof u.adj=="object"}catch{return!1}}(),Qp=navigator.platform.indexOf("Mac")===0,Jp=navigator.platform.indexOf("Linux")===0;function Ei(o){return navigator.userAgent.toLowerCase().indexOf(o)>=0}var It={ie:cn,ielt9:xi,edge:Il,webkit:Ra,android:Ma,android23:T,androidStock:G,opera:gt,chrome:pt,gecko:ft,safari:Et,phantom:Bt,opera12:ne,win:$e,ie3d:_r,webkit3d:tn,gecko3d:wi,any3d:Aa,mobile:$i,mobileWebkit:Ku,mobileWebkit3d:Oo,msPointer:Da,pointer:Ls,touch:Xf,touchNative:Wf,mobileOpera:Wp,mobileGecko:Xp,retina:Ro,passiveEvents:Yf,canvas:Yp,svg:Tl,vml:Kp,inlineSvg:Kf,mac:Qp,linux:Jp},Qu=It.msPointer?"MSPointerDown":"pointerdown",ka=It.msPointer?"MSPointerMove":"pointermove",Ju=It.msPointer?"MSPointerUp":"pointerup",U=It.msPointer?"MSPointerCancel":"pointercancel",X={touchstart:Qu,touchmove:ka,touchend:Ju,touchcancel:U},mt={touchstart:fn,touchmove:kn,touchend:kn,touchcancel:kn},st={},nt=!1;function St(o,u,h){return u==="touchstart"&&he(),mt[u]?(h=mt[u].bind(this,h),o.addEventListener(X[u],h,!1),h):(console.warn("wrong event specified:",u),d)}function Xt(o,u,h){if(!X[u]){console.warn("wrong event specified:",u);return}o.removeEventListener(X[u],h,!1)}function Yt(o){st[o.pointerId]=o}function Mt(o){st[o.pointerId]&&(st[o.pointerId]=o)}function zt(o){delete st[o.pointerId]}function he(){nt||(document.addEventListener(Qu,Yt,!0),document.addEventListener(ka,Mt,!0),document.addEventListener(Ju,zt,!0),document.addEventListener(U,zt,!0),nt=!0)}function kn(o,u){if(u.pointerType!==(u.MSPOINTER_TYPE_MOUSE||"mouse")){u.touches=[];for(var h in st)u.touches.push(st[h]);u.changedTouches=[u],o(u)}}function fn(o,u){u.MSPOINTER_TYPE_TOUCH&&u.pointerType===u.MSPOINTER_TYPE_TOUCH&&Kn(u),kn(o,u)}function ts(o){var u={},h,m;for(m in o)h=o[m],u[m]=h&&h.bind?h.bind(o):h;return o=u,u.type="dblclick",u.detail=2,u.isTrusted=!1,u._simulated=!0,u}var Mo=200;function Ao(o,u){o.addEventListener("dblclick",u);var h=0,m;function _(b){if(b.detail!==1){m=b.detail;return}if(!(b.pointerType==="mouse"||b.sourceCapabilities&&!b.sourceCapabilities.firesTouchEvents)){var O=w_(b);if(!(O.some(function(Z){return Z instanceof HTMLLabelElement&&Z.attributes.for})&&!O.some(function(Z){return Z instanceof HTMLInputElement||Z instanceof HTMLSelectElement}))){var j=Date.now();j-h<=Mo?(m++,m===2&&u(ts(b))):m=1,h=j}}}return o.addEventListener("click",_),{dblclick:u,simDblclick:_}}function hn(o,u){o.removeEventListener("dblclick",u.dblclick),o.removeEventListener("click",u.simDblclick)}var ni=th(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Fa=th(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Qf=Fa==="webkitTransition"||Fa==="OTransition"?Fa+"End":"transitionend";function y_(o){return typeof o=="string"?document.getElementById(o):o}function $u(o,u){var h=o.style[u]||o.currentStyle&&o.currentStyle[u];if((!h||h==="auto")&&document.defaultView){var m=document.defaultView.getComputedStyle(o,null);h=m?m[u]:null}return h==="auto"?null:h}function le(o,u,h){var m=document.createElement(o);return m.className=u||"",h&&h.appendChild(m),m}function Be(o){var u=o.parentNode;u&&u.removeChild(o)}function Jf(o){for(;o.firstChild;)o.removeChild(o.firstChild)}function Ol(o){var u=o.parentNode;u&&u.lastChild!==o&&u.appendChild(o)}function Rl(o){var u=o.parentNode;u&&u.firstChild!==o&&u.insertBefore(o,u.firstChild)}function $p(o,u){if(o.classList!==void 0)return o.classList.contains(u);var h=$f(o);return h.length>0&&new RegExp("(^|\\s)"+u+"(\\s|$)").test(h)}function Zt(o,u){if(o.classList!==void 0)for(var h=x(u),m=0,_=h.length;m<_;m++)o.classList.add(h[m]);else if(!$p(o,u)){var b=$f(o);tg(o,(b?b+" ":"")+u)}}function en(o,u){o.classList!==void 0?o.classList.remove(u):tg(o,y((" "+$f(o)+" ").replace(" "+u+" "," ")))}function tg(o,u){o.className.baseVal===void 0?o.className=u:o.className.baseVal=u}function $f(o){return o.correspondingElement&&(o=o.correspondingElement),o.className.baseVal===void 0?o.className:o.className.baseVal}function Si(o,u){"opacity"in o.style?o.style.opacity=u:"filter"in o.style&&PN(o,u)}function PN(o,u){var h=!1,m="DXImageTransform.Microsoft.Alpha";try{h=o.filters.item(m)}catch{if(u===1)return}u=Math.round(u*100),h?(h.Enabled=u!==100,h.Opacity=u):o.style.filter+=" progid:"+m+"(opacity="+u+")"}function th(o){for(var u=document.documentElement.style,h=0;h0?2*window.devicePixelRatio:1;function S_(o){return It.edge?o.wheelDeltaY/2:o.deltaY&&o.deltaMode===0?-o.deltaY/LN:o.deltaY&&o.deltaMode===1?-o.deltaY*20:o.deltaY&&o.deltaMode===2?-o.deltaY*60:o.deltaX||o.deltaZ?0:o.wheelDelta?(o.wheelDeltaY||o.wheelDelta)/2:o.detail&&Math.abs(o.detail)<32765?-o.detail*20:o.detail?o.detail/-32765*60:0}function fg(o,u){var h=u.relatedTarget;if(!h)return!0;try{for(;h&&h!==o;)h=h.parentNode}catch{return!1}return h!==o}var IN={__proto__:null,on:qt,off:Se,stopPropagation:Ba,disableScrollPropagation:cg,disableClickPropagation:rc,preventDefault:Kn,stop:Ua,getPropagationPath:w_,getMousePosition:E_,getWheelDelta:S_,isExternalTarget:fg,addListener:qt,removeListener:Se},C_=yt.extend({run:function(o,u,h,m){this.stop(),this._el=o,this._inProgress=!0,this._duration=h||.25,this._easeOutPower=1/Math.max(m||.5,.2),this._startPos=za(o),this._offset=u.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=J(this._animate,this),this._step()},_step:function(o){var u=+new Date-this._startTime,h=this._duration*1e3;uthis.options.maxZoom)?this.setZoom(o):this},panInsideBounds:function(o,u){this._enforcingBounds=!0;var h=this.getCenter(),m=this._limitCenter(h,this._zoom,ht(o));return h.equals(m)||this.panTo(m,u),this._enforcingBounds=!1,this},panInside:function(o,u){u=u||{};var h=tt(u.paddingTopLeft||u.padding||[0,0]),m=tt(u.paddingBottomRight||u.padding||[0,0]),_=this.project(this.getCenter()),b=this.project(o),O=this.getPixelBounds(),j=Lt([O.min.add(h),O.max.subtract(m)]),Z=j.getSize();if(!j.contains(b)){this._enforcingBounds=!0;var et=b.subtract(j.getCenter()),xt=j.extend(b).getSize().subtract(Z);_.x+=et.x<0?-xt.x:xt.x,_.y+=et.y<0?-xt.y:xt.y,this.panTo(this.unproject(_),u),this._enforcingBounds=!1}return this},invalidateSize:function(o){if(!this._loaded)return this;o=i({animate:!1,pan:!0},o===!0?{animate:!0}:o);var u=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var h=this.getSize(),m=u.divideBy(2).round(),_=h.divideBy(2).round(),b=m.subtract(_);return!b.x&&!b.y?this:(o.animate&&o.pan?this.panBy(b):(o.pan&&this._rawPanBy(b),this.fire("move"),o.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(a(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:u,newSize:h}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(o){if(o=this._locateOptions=i({timeout:1e4,watch:!1},o),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var u=a(this._handleGeolocationResponse,this),h=a(this._handleGeolocationError,this);return o.watch?this._locationWatchId=navigator.geolocation.watchPosition(u,h,o):navigator.geolocation.getCurrentPosition(u,h,o),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(o){if(this._container._leaflet_id){var u=o.code,h=o.message||(u===1?"permission denied":u===2?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:u,message:"Geolocation error: "+h+"."})}},_handleGeolocationResponse:function(o){if(this._container._leaflet_id){var u=o.coords.latitude,h=o.coords.longitude,m=new _t(u,h),_=m.toBounds(o.coords.accuracy*2),b=this._locateOptions;if(b.setView){var O=this.getBoundsZoom(_);this.setView(m,b.maxZoom?Math.min(O,b.maxZoom):O)}var j={latlng:m,bounds:_,timestamp:o.timestamp};for(var Z in o.coords)typeof o.coords[Z]=="number"&&(j[Z]=o.coords[Z]);this.fire("locationfound",j)}},addHandler:function(o,u){if(!u)return this;var h=this[o]=new u(this);return this._handlers.push(h),this.options[o]&&h.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(),Be(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(W(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload");var o;for(o in this._layers)this._layers[o].remove();for(o in this._panes)Be(this._panes[o]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(o,u){var h="leaflet-pane"+(o?" leaflet-"+o.replace("Pane","")+"-pane":""),m=le("div",h,u||this._mapPane);return o&&(this._panes[o]=m),m},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var o=this.getPixelBounds(),u=this.unproject(o.getBottomLeft()),h=this.unproject(o.getTopRight());return new ct(u,h)},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(o,u,h){o=ht(o),h=tt(h||[0,0]);var m=this.getZoom()||0,_=this.getMinZoom(),b=this.getMaxZoom(),O=o.getNorthWest(),j=o.getSouthEast(),Z=this.getSize().subtract(h),et=Lt(this.project(j,m),this.project(O,m)).getSize(),xt=It.any3d?this.options.zoomSnap:1,Dt=Z.x/et.x,Kt=Z.y/et.y,xr=u?Math.max(Dt,Kt):Math.min(Dt,Kt);return m=this.getScaleZoom(xr,m),xt&&(m=Math.round(m/(xt/100))*(xt/100),m=u?Math.ceil(m/xt)*xt:Math.floor(m/xt)*xt),Math.max(_,Math.min(b,m))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new z(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(o,u){var h=this._getTopLeftPoint(o,u);return new vt(h,h.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(o){return this.options.crs.getProjectedBounds(o===void 0?this.getZoom():o)},getPane:function(o){return typeof o=="string"?this._panes[o]:o},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(o,u){var h=this.options.crs;return u=u===void 0?this._zoom:u,h.scale(o)/h.scale(u)},getScaleZoom:function(o,u){var h=this.options.crs;u=u===void 0?this._zoom:u;var m=h.zoom(o*h.scale(u));return isNaN(m)?1/0:m},project:function(o,u){return u=u===void 0?this._zoom:u,this.options.crs.latLngToPoint(wt(o),u)},unproject:function(o,u){return u=u===void 0?this._zoom:u,this.options.crs.pointToLatLng(tt(o),u)},layerPointToLatLng:function(o){var u=tt(o).add(this.getPixelOrigin());return this.unproject(u)},latLngToLayerPoint:function(o){var u=this.project(wt(o))._round();return u._subtract(this.getPixelOrigin())},wrapLatLng:function(o){return this.options.crs.wrapLatLng(wt(o))},wrapLatLngBounds:function(o){return this.options.crs.wrapLatLngBounds(ht(o))},distance:function(o,u){return this.options.crs.distance(wt(o),wt(u))},containerPointToLayerPoint:function(o){return tt(o).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(o){return tt(o).add(this._getMapPanePos())},containerPointToLatLng:function(o){var u=this.containerPointToLayerPoint(tt(o));return this.layerPointToLatLng(u)},latLngToContainerPoint:function(o){return this.layerPointToContainerPoint(this.latLngToLayerPoint(wt(o)))},mouseEventToContainerPoint:function(o){return E_(o,this._container)},mouseEventToLayerPoint:function(o){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(o))},mouseEventToLatLng:function(o){return this.layerPointToLatLng(this.mouseEventToLayerPoint(o))},_initContainer:function(o){var u=this._container=y_(o);if(u){if(u._leaflet_id)throw new Error("Map container is already initialized.")}else throw new Error("Map container not found.");qt(u,"scroll",this._onScroll,this),this._containerId=c(u)},_initLayout:function(){var o=this._container;this._fadeAnimated=this.options.fadeAnimation&&It.any3d,Zt(o,"leaflet-container"+(It.touch?" leaflet-touch":"")+(It.retina?" leaflet-retina":"")+(It.ielt9?" leaflet-oldie":"")+(It.safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var u=$u(o,"position");u!=="absolute"&&u!=="relative"&&u!=="fixed"&&u!=="sticky"&&(o.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var o=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),dn(this._mapPane,new z(0,0)),this.createPane("tilePane"),this.createPane("overlayPane"),this.createPane("shadowPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(Zt(o.markerPane,"leaflet-zoom-hide"),Zt(o.shadowPane,"leaflet-zoom-hide"))},_resetView:function(o,u,h){dn(this._mapPane,new z(0,0));var m=!this._loaded;this._loaded=!0,u=this._limitZoom(u),this.fire("viewprereset");var _=this._zoom!==u;this._moveStart(_,h)._move(o,u)._moveEnd(_),this.fire("viewreset"),m&&this.fire("load")},_moveStart:function(o,u){return o&&this.fire("zoomstart"),u||this.fire("movestart"),this},_move:function(o,u,h,m){u===void 0&&(u=this._zoom);var _=this._zoom!==u;return this._zoom=u,this._lastCenter=o,this._pixelOrigin=this._getNewPixelOrigin(o),m?h&&h.pinch&&this.fire("zoom",h):((_||h&&h.pinch)&&this.fire("zoom",h),this.fire("move",h)),this},_moveEnd:function(o){return o&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return W(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(o){dn(this._mapPane,this._getMapPanePos().subtract(o))},_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(o){this._targets={},this._targets[c(this._container)]=this;var u=o?Se:qt;u(this._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&u(window,"resize",this._onResize,this),It.any3d&&this.options.transform3DLimit&&(o?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){W(this._resizeRequest),this._resizeRequest=J(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var o=this._getMapPanePos();Math.max(Math.abs(o.x),Math.abs(o.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(o,u){for(var h=[],m,_=u==="mouseout"||u==="mouseover",b=o.target||o.srcElement,O=!1;b;){if(m=this._targets[c(b)],m&&(u==="click"||u==="preclick")&&this._draggableMoved(m)){O=!0;break}if(m&&m.listens(u,!0)&&(_&&!fg(b,o)||(h.push(m),_))||b===this._container)break;b=b.parentNode}return!h.length&&!O&&!_&&this.listens(u,!0)&&(h=[this]),h},_isClickDisabled:function(o){for(;o&&o!==this._container;){if(o._leaflet_disable_click)return!0;o=o.parentNode}},_handleDOMEvent:function(o){var u=o.target||o.srcElement;if(!(!this._loaded||u._leaflet_disable_events||o.type==="click"&&this._isClickDisabled(u))){var h=o.type;h==="mousedown"&&sg(u),this._fireDOMEvent(o,h)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(o,u,h){if(o.type==="click"){var m=i({},o);m.type="preclick",this._fireDOMEvent(m,m.type,h)}var _=this._findEventTargets(o,u);if(h){for(var b=[],O=0;O0?Math.round(o-u)/2:Math.max(0,Math.ceil(o))-Math.max(0,Math.floor(u))},_limitZoom:function(o){var u=this.getMinZoom(),h=this.getMaxZoom(),m=It.any3d?this.options.zoomSnap:1;return m&&(o=Math.round(o/m)*m),Math.max(u,Math.min(h,o))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){en(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(o,u){var h=this._getCenterOffset(o)._trunc();return(u&&u.animate)!==!0&&!this.getSize().contains(h)?!1:(this.panBy(h,u),!0)},_createAnimProxy:function(){var o=this._proxy=le("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(o),this.on("zoomanim",function(u){var h=ni,m=this._proxy.style[h];ja(this._proxy,this.project(u.center,u.zoom),this.getZoomScale(u.zoom,1)),m===this._proxy.style[h]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",this._animMoveEnd,this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){Be(this._proxy),this.off("load moveend",this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var o=this.getCenter(),u=this.getZoom();ja(this._proxy,this.project(o,u),this.getZoomScale(u,1))},_catchTransitionEnd:function(o){this._animatingZoom&&o.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(o,u,h){if(this._animatingZoom)return!0;if(h=h||{},!this._zoomAnimated||h.animate===!1||this._nothingToAnimate()||Math.abs(u-this._zoom)>this.options.zoomAnimationThreshold)return!1;var m=this.getZoomScale(u),_=this._getCenterOffset(o)._divideBy(1-1/m);return h.animate!==!0&&!this.getSize().contains(_)?!1:(J(function(){this._moveStart(!0,h.noMoveStart||!1)._animateZoom(o,u,!0)},this),!0)},_animateZoom:function(o,u,h,m){this._mapPane&&(h&&(this._animatingZoom=!0,this._animateToCenter=o,this._animateToZoom=u,Zt(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:o,zoom:u,noUpdate:m}),this._tempFireZoomEvent||(this._tempFireZoomEvent=this._zoom!==this._animateToZoom),this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(a(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&en(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 TN(o,u){return new se(o,u)}var es=D.extend({options:{position:"topright"},initialize:function(o){S(this,o)},getPosition:function(){return this.options.position},setPosition:function(o){var u=this._map;return u&&u.removeControl(this),this.options.position=o,u&&u.addControl(this),this},getContainer:function(){return this._container},addTo:function(o){this.remove(),this._map=o;var u=this._container=this.onAdd(o),h=this.getPosition(),m=o._controlCorners[h];return Zt(u,"leaflet-control"),h.indexOf("bottom")!==-1?m.insertBefore(u,m.firstChild):m.appendChild(u),this._map.on("unload",this.remove,this),this},remove:function(){return this._map?(Be(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null,this):this},_refocusOnMap:function(o){this._map&&o&&o.screenX>0&&o.screenY>0&&this._map.getContainer().focus()}}),ic=function(o){return new es(o)};se.include({addControl:function(o){return o.addTo(this),this},removeControl:function(o){return o.remove(),this},_initControlPos:function(){var o=this._controlCorners={},u="leaflet-",h=this._controlContainer=le("div",u+"control-container",this._container);function m(_,b){var O=u+_+" "+u+b;o[_+b]=le("div",O,h)}m("top","left"),m("top","right"),m("bottom","left"),m("bottom","right")},_clearControlPos:function(){for(var o in this._controlCorners)Be(this._controlCorners[o]);Be(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var N_=es.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(o,u,h,m){return h1,this._baseLayersList.style.display=o?"":"none"),this._separator.style.display=u&&o?"":"none",this},_onLayerChange:function(o){this._handlingClick||this._update();var u=this._getLayer(c(o.target)),h=u.overlay?o.type==="add"?"overlayadd":"overlayremove":o.type==="add"?"baselayerchange":null;h&&this._map.fire(h,u)},_createRadioElement:function(o,u){var h='",m=document.createElement("div");return m.innerHTML=h,m.firstChild},_addItem:function(o){var u=document.createElement("label"),h=this._map.hasLayer(o.layer),m;o.overlay?(m=document.createElement("input"),m.type="checkbox",m.className="leaflet-control-layers-selector",m.defaultChecked=h):m=this._createRadioElement("leaflet-base-layers_"+c(this),h),this._layerControlInputs.push(m),m.layerId=c(o.layer),qt(m,"click",this._onInputClick,this);var _=document.createElement("span");_.innerHTML=" "+o.name;var b=document.createElement("span");u.appendChild(b),b.appendChild(m),b.appendChild(_);var O=o.overlay?this._overlaysList:this._baseLayersList;return O.appendChild(u),this._checkDisabledLayers(),u},_onInputClick:function(){if(!this._preventClick){var o=this._layerControlInputs,u,h,m=[],_=[];this._handlingClick=!0;for(var b=o.length-1;b>=0;b--)u=o[b],h=this._getLayer(u.layerId).layer,u.checked?m.push(h):u.checked||_.push(h);for(b=0;b<_.length;b++)this._map.hasLayer(_[b])&&this._map.removeLayer(_[b]);for(b=0;b=0;_--)u=o[_],h=this._getLayer(u.layerId).layer,u.disabled=h.options.minZoom!==void 0&&mh.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var o=this._section;this._preventClick=!0,qt(o,"click",Kn),this.expand();var u=this;setTimeout(function(){Se(o,"click",Kn),u._preventClick=!1})}}),ON=function(o,u,h){return new N_(o,u,h)},hg=es.extend({options:{position:"topleft",zoomInText:'',zoomInTitle:"Zoom in",zoomOutText:'',zoomOutTitle:"Zoom out"},onAdd:function(o){var u="leaflet-control-zoom",h=le("div",u+" leaflet-bar"),m=this.options;return this._zoomInButton=this._createButton(m.zoomInText,m.zoomInTitle,u+"-in",h,this._zoomIn),this._zoomOutButton=this._createButton(m.zoomOutText,m.zoomOutTitle,u+"-out",h,this._zoomOut),this._updateDisabled(),o.on("zoomend zoomlevelschange",this._updateDisabled,this),h},onRemove:function(o){o.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(o){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(o.shiftKey?3:1))},_createButton:function(o,u,h,m,_){var b=le("a",h,m);return b.innerHTML=o,b.href="#",b.title=u,b.setAttribute("role","button"),b.setAttribute("aria-label",u),rc(b),qt(b,"click",Ua),qt(b,"click",_,this),qt(b,"click",this._refocusOnMap,this),b},_updateDisabled:function(){var o=this._map,u="leaflet-disabled";en(this._zoomInButton,u),en(this._zoomOutButton,u),this._zoomInButton.setAttribute("aria-disabled","false"),this._zoomOutButton.setAttribute("aria-disabled","false"),(this._disabled||o._zoom===o.getMinZoom())&&(Zt(this._zoomOutButton,u),this._zoomOutButton.setAttribute("aria-disabled","true")),(this._disabled||o._zoom===o.getMaxZoom())&&(Zt(this._zoomInButton,u),this._zoomInButton.setAttribute("aria-disabled","true"))}});se.mergeOptions({zoomControl:!0}),se.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new hg,this.addControl(this.zoomControl))});var RN=function(o){return new hg(o)},P_=es.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(o){var u="leaflet-control-scale",h=le("div",u),m=this.options;return this._addScales(m,u+"-line",h),o.on(m.updateWhenIdle?"moveend":"move",this._update,this),o.whenReady(this._update,this),h},onRemove:function(o){o.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(o,u,h){o.metric&&(this._mScale=le("div",u,h)),o.imperial&&(this._iScale=le("div",u,h))},_update:function(){var o=this._map,u=o.getSize().y/2,h=o.distance(o.containerPointToLatLng([0,u]),o.containerPointToLatLng([this.options.maxWidth,u]));this._updateScales(h)},_updateScales:function(o){this.options.metric&&o&&this._updateMetric(o),this.options.imperial&&o&&this._updateImperial(o)},_updateMetric:function(o){var u=this._getRoundNum(o),h=u<1e3?u+" m":u/1e3+" km";this._updateScale(this._mScale,h,u/o)},_updateImperial:function(o){var u=o*3.2808399,h,m,_;u>5280?(h=u/5280,m=this._getRoundNum(h),this._updateScale(this._iScale,m+" mi",m/h)):(_=this._getRoundNum(u),this._updateScale(this._iScale,_+" ft",_/u))},_updateScale:function(o,u,h){o.style.width=Math.round(this.options.maxWidth*h)+"px",o.innerHTML=u},_getRoundNum:function(o){var u=Math.pow(10,(Math.floor(o)+"").length-1),h=o/u;return h=h>=10?10:h>=5?5:h>=3?3:h>=2?2:1,u*h}}),MN=function(o){return new P_(o)},AN='',dg=es.extend({options:{position:"bottomright",prefix:''+(It.inlineSvg?AN+" ":"")+"Leaflet"},initialize:function(o){S(this,o),this._attributions={}},onAdd:function(o){o.attributionControl=this,this._container=le("div","leaflet-control-attribution"),rc(this._container);for(var u in o._layers)o._layers[u].getAttribution&&this.addAttribution(o._layers[u].getAttribution());return this._update(),o.on("layeradd",this._addAttribution,this),this._container},onRemove:function(o){o.off("layeradd",this._addAttribution,this)},_addAttribution:function(o){o.layer.getAttribution&&(this.addAttribution(o.layer.getAttribution()),o.layer.once("remove",function(){this.removeAttribution(o.layer.getAttribution())},this))},setPrefix:function(o){return this.options.prefix=o,this._update(),this},addAttribution:function(o){return o?(this._attributions[o]||(this._attributions[o]=0),this._attributions[o]++,this._update(),this):this},removeAttribution:function(o){return o?(this._attributions[o]&&(this._attributions[o]--,this._update()),this):this},_update:function(){if(this._map){var o=[];for(var u in this._attributions)this._attributions[u]&&o.push(u);var h=[];this.options.prefix&&h.push(this.options.prefix),o.length&&h.push(o.join(", ")),this._container.innerHTML=h.join(' ')}}});se.mergeOptions({attributionControl:!0}),se.addInitHook(function(){this.options.attributionControl&&new dg().addTo(this)});var DN=function(o){return new dg(o)};es.Layers=N_,es.Zoom=hg,es.Scale=P_,es.Attribution=dg,ic.layers=ON,ic.zoom=RN,ic.scale=MN,ic.attribution=DN;var Ts=D.extend({initialize:function(o){this._map=o},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}});Ts.addTo=function(o,u){return o.addHandler(u,this),this};var kN={Events:it},b_=It.touch?"touchstart mousedown":"mousedown",Do=yt.extend({options:{clickTolerance:3},initialize:function(o,u,h,m){S(this,m),this._element=o,this._dragStartTarget=u||o,this._preventOutline=h},enable:function(){this._enabled||(qt(this._dragStartTarget,b_,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(Do._dragging===this&&this.finishDrag(!0),Se(this._dragStartTarget,b_,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(o){if(this._enabled&&(this._moved=!1,!$p(this._element,"leaflet-zoom-anim"))){if(o.touches&&o.touches.length!==1){Do._dragging===this&&this.finishDrag();return}if(!(Do._dragging||o.shiftKey||o.which!==1&&o.button!==1&&!o.touches)&&(Do._dragging=this,this._preventOutline&&sg(this._element),ng(),tc(),!this._moving)){this.fire("down");var u=o.touches?o.touches[0]:o,h=__(this._element);this._startPoint=new z(u.clientX,u.clientY),this._startPos=za(this._element),this._parentScale=og(h);var m=o.type==="mousedown";qt(document,m?"mousemove":"touchmove",this._onMove,this),qt(document,m?"mouseup":"touchend touchcancel",this._onUp,this)}}},_onMove:function(o){if(this._enabled){if(o.touches&&o.touches.length>1){this._moved=!0;return}var u=o.touches&&o.touches.length===1?o.touches[0]:o,h=new z(u.clientX,u.clientY)._subtract(this._startPoint);!h.x&&!h.y||Math.abs(h.x)+Math.abs(h.y)b&&(O=j,b=Z);b>h&&(u[O]=1,gg(o,u,h,m,O),gg(o,u,h,O,_))}function BN(o,u){for(var h=[o[0]],m=1,_=0,b=o.length;mu&&(h.push(o[m]),_=m);return _u.max.x&&(h|=2),o.yu.max.y&&(h|=8),h}function UN(o,u){var h=u.x-o.x,m=u.y-o.y;return h*h+m*m}function sc(o,u,h,m){var _=u.x,b=u.y,O=h.x-_,j=h.y-b,Z=O*O+j*j,et;return Z>0&&(et=((o.x-_)*O+(o.y-b)*j)/Z,et>1?(_=h.x,b=h.y):et>0&&(_+=O*et,b+=j*et)),O=o.x-_,j=o.y-b,m?O*O+j*j:new z(_,b)}function Ci(o){return!N(o[0])||typeof o[0][0]!="object"&&typeof o[0][0]<"u"}function A_(o){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Ci(o)}function D_(o,u){var h,m,_,b,O,j,Z,et;if(!o||o.length===0)throw new Error("latlngs not passed");Ci(o)||(console.warn("latlngs are not flat! Only the first ring will be used"),o=o[0]);var xt=wt([0,0]),Dt=ht(o),Kt=Dt.getNorthWest().distanceTo(Dt.getSouthWest())*Dt.getNorthEast().distanceTo(Dt.getNorthWest());Kt<1700&&(xt=pg(o));var xr=o.length,Fn=[];for(h=0;hm){Z=(b-m)/_,et=[j.x-Z*(j.x-O.x),j.y-Z*(j.y-O.y)];break}var zr=u.unproject(tt(et));return wt([zr.lat+xt.lat,zr.lng+xt.lng])}var VN={__proto__:null,simplify:T_,pointToSegmentDistance:O_,closestPointOnSegment:jN,clipSegment:M_,_getEdgeIntersection:rh,_getBitCode:Va,_sqClosestPointOnSegment:sc,isFlat:Ci,_flat:A_,polylineCenter:D_},mg={project:function(o){return new z(o.lng,o.lat)},unproject:function(o){return new _t(o.y,o.x)},bounds:new vt([-180,-90],[180,90])},vg={R:6378137,R_MINOR:6356752314245179e-9,bounds:new vt([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(o){var u=Math.PI/180,h=this.R,m=o.lat*u,_=this.R_MINOR/h,b=Math.sqrt(1-_*_),O=b*Math.sin(m),j=Math.tan(Math.PI/4-m/2)/Math.pow((1-O)/(1+O),b/2);return m=-h*Math.log(Math.max(j,1e-10)),new z(o.lng*u*h,m)},unproject:function(o){for(var u=180/Math.PI,h=this.R,m=this.R_MINOR/h,_=Math.sqrt(1-m*m),b=Math.exp(-o.y/h),O=Math.PI/2-2*Math.atan(b),j=0,Z=.1,et;j<15&&Math.abs(Z)>1e-7;j++)et=_*Math.sin(O),et=Math.pow((1-et)/(1+et),_/2),Z=Math.PI/2-2*Math.atan(b*et)-O,O+=Z;return new _t(O*u,o.x*u/h)}},GN={__proto__:null,LonLat:mg,Mercator:vg,SphericalMercator:Ee},qN=i({},jt,{code:"EPSG:3395",projection:vg,transformation:function(){var o=.5/(Math.PI*vg.R);return De(o,.5,-o,.5)}()}),k_=i({},jt,{code:"EPSG:4326",projection:mg,transformation:De(1/180,1,-1/180,.5)}),HN=i({},Gt,{projection:mg,transformation:De(1,0,-1,0),scale:function(o){return Math.pow(2,o)},zoom:function(o){return Math.log(o)/Math.LN2},distance:function(o,u){var h=u.lng-o.lng,m=u.lat-o.lat;return Math.sqrt(h*h+m*m)},infinite:!0});Gt.Earth=jt,Gt.EPSG3395=qN,Gt.EPSG3857=jr,Gt.EPSG900913=Nn,Gt.EPSG4326=k_,Gt.Simple=HN;var ns=yt.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(o){return o.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(o){return o&&o.removeLayer(this),this},getPane:function(o){return this._map.getPane(o?this.options[o]||o:this.options.pane)},addInteractiveTarget:function(o){return this._map._targets[c(o)]=this,this},removeInteractiveTarget:function(o){return delete this._map._targets[c(o)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(o){var u=o.target;if(u.hasLayer(this)){if(this._map=u,this._zoomAnimated=u._zoomAnimated,this.getEvents){var h=this.getEvents();u.on(h,this),this.once("remove",function(){u.off(h,this)},this)}this.onAdd(u),this.fire("add"),u.fire("layeradd",{layer:this})}}});se.include({addLayer:function(o){if(!o._layerAdd)throw new Error("The provided object is not a Layer.");var u=c(o);return this._layers[u]?this:(this._layers[u]=o,o._mapToAdd=this,o.beforeAdd&&o.beforeAdd(this),this.whenReady(o._layerAdd,o),this)},removeLayer:function(o){var u=c(o);return this._layers[u]?(this._loaded&&o.onRemove(this),delete this._layers[u],this._loaded&&(this.fire("layerremove",{layer:o}),o.fire("remove")),o._map=o._mapToAdd=null,this):this},hasLayer:function(o){return c(o)in this._layers},eachLayer:function(o,u){for(var h in this._layers)o.call(u,this._layers[h]);return this},_addLayers:function(o){o=o?N(o)?o:[o]:[];for(var u=0,h=o.length;uthis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&u[0]instanceof _t&&u[0].equals(u[h-1])&&u.pop(),u},_setLatLngs:function(o){eo.prototype._setLatLngs.call(this,o),Ci(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Ci(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var o=this._renderer._bounds,u=this.options.weight,h=new z(u,u);if(o=new vt(o.min.subtract(h),o.max.add(h)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(o))){if(this.options.noClip){this._parts=this._rings;return}for(var m=0,_=this._rings.length,b;m<_;m++)b=L_(this._rings[m],o,!0),b.length&&this._parts.push(b)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(o){var u=!1,h,m,_,b,O,j,Z,et;if(!this._pxBounds||!this._pxBounds.contains(o))return!1;for(b=0,Z=this._parts.length;bo.y!=_.y>o.y&&o.x<(_.x-m.x)*(o.y-m.y)/(_.y-m.y)+m.x&&(u=!u);return u||eo.prototype._containsPoint.call(this,o,!0)}});function $N(o,u){return new Dl(o,u)}var no=to.extend({initialize:function(o,u){S(this,u),this._layers={},o&&this.addData(o)},addData:function(o){var u=N(o)?o:o.features,h,m,_;if(u){for(h=0,m=u.length;h0&&_.push(_[0].slice()),_}function kl(o,u){return o.feature?i({},o.feature,{geometry:u}):uh(u)}function uh(o){return o.type==="Feature"||o.type==="FeatureCollection"?o:{type:"Feature",properties:{},geometry:o}}var wg={toGeoJSON:function(o){return kl(this,{type:"Point",coordinates:xg(this.getLatLng(),o)})}};ih.include(wg),yg.include(wg),sh.include(wg),eo.include({toGeoJSON:function(o){var u=!Ci(this._latlngs),h=lh(this._latlngs,u?1:0,!1,o);return kl(this,{type:(u?"Multi":"")+"LineString",coordinates:h})}}),Dl.include({toGeoJSON:function(o){var u=!Ci(this._latlngs),h=u&&!Ci(this._latlngs[0]),m=lh(this._latlngs,h?2:u?1:0,!0,o);return u||(m=[m]),kl(this,{type:(h?"Multi":"")+"Polygon",coordinates:m})}}),Ml.include({toMultiPoint:function(o){var u=[];return this.eachLayer(function(h){u.push(h.toGeoJSON(o).geometry.coordinates)}),kl(this,{type:"MultiPoint",coordinates:u})},toGeoJSON:function(o){var u=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(u==="MultiPoint")return this.toMultiPoint(o);var h=u==="GeometryCollection",m=[];return this.eachLayer(function(_){if(_.toGeoJSON){var b=_.toGeoJSON(o);if(h)m.push(b.geometry);else{var O=uh(b);O.type==="FeatureCollection"?m.push.apply(m,O.features):m.push(O)}}}),h?kl(this,{geometries:m,type:"GeometryCollection"}):{type:"FeatureCollection",features:m}}});function z_(o,u){return new no(o,u)}var tP=z_,ch=ns.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(o,u,h){this._url=o,this._bounds=ht(u),S(this,h)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(Zt(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){Be(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(o){return this.options.opacity=o,this._image&&this._updateOpacity(),this},setStyle:function(o){return o.opacity&&this.setOpacity(o.opacity),this},bringToFront:function(){return this._map&&Ol(this._image),this},bringToBack:function(){return this._map&&Rl(this._image),this},setUrl:function(o){return this._url=o,this._image&&(this._image.src=o),this},setBounds:function(o){return this._bounds=ht(o),this._map&&this._reset(),this},getEvents:function(){var o={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(o.zoomanim=this._animateZoom),o},setZIndex:function(o){return this.options.zIndex=o,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var o=this._url.tagName==="IMG",u=this._image=o?this._url:le("img");if(Zt(u,"leaflet-image-layer"),this._zoomAnimated&&Zt(u,"leaflet-zoom-animated"),this.options.className&&Zt(u,this.options.className),u.onselectstart=d,u.onmousemove=d,u.onload=a(this.fire,this,"load"),u.onerror=a(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(u.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),o){this._url=u.src;return}u.src=this._url,u.alt=this.options.alt},_animateZoom:function(o){var u=this._map.getZoomScale(o.zoom),h=this._map._latLngBoundsToNewLayerBounds(this._bounds,o.zoom,o.center).min;ja(this._image,h,u)},_reset:function(){var o=this._image,u=new vt(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),h=u.getSize();dn(o,u.min),o.style.width=h.x+"px",o.style.height=h.y+"px"},_updateOpacity:function(){Si(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 o=this.options.errorOverlayUrl;o&&this._url!==o&&(this._url=o,this._image.src=o)},getCenter:function(){return this._bounds.getCenter()}}),eP=function(o,u,h){return new ch(o,u,h)},B_=ch.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var o=this._url.tagName==="VIDEO",u=this._image=o?this._url:le("video");if(Zt(u,"leaflet-image-layer"),this._zoomAnimated&&Zt(u,"leaflet-zoom-animated"),this.options.className&&Zt(u,this.options.className),u.onselectstart=d,u.onmousemove=d,u.onloadeddata=a(this.fire,this,"load"),o){for(var h=u.getElementsByTagName("source"),m=[],_=0;_0?m:[u.src];return}N(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(u.style,"objectFit")&&(u.style.objectFit="fill"),u.autoplay=!!this.options.autoplay,u.loop=!!this.options.loop,u.muted=!!this.options.muted,u.playsInline=!!this.options.playsInline;for(var b=0;b_?(u.height=_+"px",Zt(o,b)):en(o,b),this._containerWidth=this._container.offsetWidth},_animateZoom:function(o){var u=this._map._latLngToNewLayerPoint(this._latlng,o.zoom,o.center),h=this._getAnchor();dn(this._container,u.add(h))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var o=this._map,u=parseInt($u(this._container,"marginBottom"),10)||0,h=this._container.offsetHeight+u,m=this._containerWidth,_=new z(this._containerLeft,-h-this._containerBottom);_._add(za(this._container));var b=o.layerPointToContainerPoint(_),O=tt(this.options.autoPanPadding),j=tt(this.options.autoPanPaddingTopLeft||O),Z=tt(this.options.autoPanPaddingBottomRight||O),et=o.getSize(),xt=0,Dt=0;b.x+m+Z.x>et.x&&(xt=b.x+m-et.x+Z.x),b.x-xt-j.x<0&&(xt=b.x-j.x),b.y+h+Z.y>et.y&&(Dt=b.y+h-et.y+Z.y),b.y-Dt-j.y<0&&(Dt=b.y-j.y),(xt||Dt)&&(this.options.keepInView&&(this._autopanning=!0),o.fire("autopanstart").panBy([xt,Dt]))}},_getAnchor:function(){return tt(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),iP=function(o,u){return new fh(o,u)};se.mergeOptions({closePopupOnClick:!0}),se.include({openPopup:function(o,u,h){return this._initOverlay(fh,o,u,h).openOn(this),this},closePopup:function(o){return o=arguments.length?o:this._popup,o&&o.close(),this}}),ns.include({bindPopup:function(o,u){return this._popup=this._initOverlay(fh,this._popup,o,u),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(o){return this._popup&&(this instanceof to||(this._popup._source=this),this._popup._prepareOpen(o||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},setPopupContent:function(o){return this._popup&&this._popup.setContent(o),this},getPopup:function(){return this._popup},_openPopup:function(o){if(!(!this._popup||!this._map)){Ua(o);var u=o.layer||o.target;if(this._popup._source===u&&!(u instanceof ko)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(o.latlng);return}this._popup._source=u,this.openPopup(o.latlng)}},_movePopup:function(o){this._popup.setLatLng(o.latlng)},_onKeyPress:function(o){o.originalEvent.keyCode===13&&this._openPopup(o)}});var hh=Os.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(o){Os.prototype.onAdd.call(this,o),this.setOpacity(this.options.opacity),o.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(o){Os.prototype.onRemove.call(this,o),o.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var o=Os.prototype.getEvents.call(this);return this.options.permanent||(o.preclick=this.close),o},_initLayout:function(){var o="leaflet-tooltip",u=o+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=le("div",u),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+c(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(o){var u,h,m=this._map,_=this._container,b=m.latLngToContainerPoint(m.getCenter()),O=m.layerPointToContainerPoint(o),j=this.options.direction,Z=_.offsetWidth,et=_.offsetHeight,xt=tt(this.options.offset),Dt=this._getAnchor();j==="top"?(u=Z/2,h=et):j==="bottom"?(u=Z/2,h=0):j==="center"?(u=Z/2,h=et/2):j==="right"?(u=0,h=et/2):j==="left"?(u=Z,h=et/2):O.xthis.options.maxZoom||hm?this._retainParent(_,b,O,m):!1)},_retainChildren:function(o,u,h,m){for(var _=2*o;_<2*o+2;_++)for(var b=2*u;b<2*u+2;b++){var O=new z(_,b);O.z=h+1;var j=this._tileCoordsToKey(O),Z=this._tiles[j];if(Z&&Z.active){Z.retain=!0;continue}else Z&&Z.loaded&&(Z.retain=!0);h+1this.options.maxZoom||this.options.minZoom!==void 0&&_1){this._setView(o,h);return}for(var Dt=_.min.y;Dt<=_.max.y;Dt++)for(var Kt=_.min.x;Kt<=_.max.x;Kt++){var xr=new z(Kt,Dt);if(xr.z=this._tileZoom,!!this._isValidTile(xr)){var Fn=this._tiles[this._tileCoordsToKey(xr)];Fn?Fn.current=!0:O.push(xr)}}if(O.sort(function(zr,jl){return zr.distanceTo(b)-jl.distanceTo(b)}),O.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var Ni=document.createDocumentFragment();for(Kt=0;Kth.max.x)||!u.wrapLat&&(o.yh.max.y))return!1}if(!this.options.bounds)return!0;var m=this._tileCoordsToBounds(o);return ht(this.options.bounds).overlaps(m)},_keyToBounds:function(o){return this._tileCoordsToBounds(this._keyToTileCoords(o))},_tileCoordsToNwSe:function(o){var u=this._map,h=this.getTileSize(),m=o.scaleBy(h),_=m.add(h),b=u.unproject(m,o.z),O=u.unproject(_,o.z);return[b,O]},_tileCoordsToBounds:function(o){var u=this._tileCoordsToNwSe(o),h=new ct(u[0],u[1]);return this.options.noWrap||(h=this._map.wrapLatLngBounds(h)),h},_tileCoordsToKey:function(o){return o.x+":"+o.y+":"+o.z},_keyToTileCoords:function(o){var u=o.split(":"),h=new z(+u[0],+u[1]);return h.z=+u[2],h},_removeTile:function(o){var u=this._tiles[o];u&&(Be(u.el),delete this._tiles[o],this.fire("tileunload",{tile:u.el,coords:this._keyToTileCoords(o)}))},_initTile:function(o){Zt(o,"leaflet-tile");var u=this.getTileSize();o.style.width=u.x+"px",o.style.height=u.y+"px",o.onselectstart=d,o.onmousemove=d,It.ielt9&&this.options.opacity<1&&Si(o,this.options.opacity)},_addTile:function(o,u){var h=this._getTilePos(o),m=this._tileCoordsToKey(o),_=this.createTile(this._wrapCoords(o),a(this._tileReady,this,o));this._initTile(_),this.createTile.length<2&&J(a(this._tileReady,this,o,null,_)),dn(_,h),this._tiles[m]={el:_,coords:o,current:!0},u.appendChild(_),this.fire("tileloadstart",{tile:_,coords:o})},_tileReady:function(o,u,h){u&&this.fire("tileerror",{error:u,tile:h,coords:o});var m=this._tileCoordsToKey(o);h=this._tiles[m],h&&(h.loaded=+new Date,this._map._fadeAnimated?(Si(h.el,0),W(this._fadeFrame),this._fadeFrame=J(this._updateOpacity,this)):(h.active=!0,this._pruneTiles()),u||(Zt(h.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:h.el,coords:o})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),It.ielt9||!this._map._fadeAnimated?J(this._pruneTiles,this):setTimeout(a(this._pruneTiles,this),250)))},_getTilePos:function(o){return o.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(o){var u=new z(this._wrapX?g(o.x,this._wrapX):o.x,this._wrapY?g(o.y,this._wrapY):o.y);return u.z=o.z,u},_pxBoundsToTileRange:function(o){var u=this.getTileSize();return new vt(o.min.unscaleBy(u).floor(),o.max.unscaleBy(u).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var o in this._tiles)if(!this._tiles[o].loaded)return!1;return!0}});function aP(o){return new ac(o)}var Fl=ac.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(o,u){this._url=o,u=S(this,u),u.detectRetina&&It.retina&&u.maxZoom>0?(u.tileSize=Math.floor(u.tileSize/2),u.zoomReverse?(u.zoomOffset--,u.minZoom=Math.min(u.maxZoom,u.minZoom+1)):(u.zoomOffset++,u.maxZoom=Math.max(u.minZoom,u.maxZoom-1)),u.minZoom=Math.max(0,u.minZoom)):u.zoomReverse?u.minZoom=Math.min(u.maxZoom,u.minZoom):u.maxZoom=Math.max(u.minZoom,u.maxZoom),typeof u.subdomains=="string"&&(u.subdomains=u.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(o,u){return this._url===o&&u===void 0&&(u=!0),this._url=o,u||this.redraw(),this},createTile:function(o,u){var h=document.createElement("img");return qt(h,"load",a(this._tileOnLoad,this,u,h)),qt(h,"error",a(this._tileOnError,this,u,h)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(h.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(h.referrerPolicy=this.options.referrerPolicy),h.alt="",h.src=this.getTileUrl(o),h},getTileUrl:function(o){var u={r:It.retina?"@2x":"",s:this._getSubdomain(o),x:o.x,y:o.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var h=this._globalTileRange.max.y-o.y;this.options.tms&&(u.y=h),u["-y"]=h}return w(this._url,i(u,this.options))},_tileOnLoad:function(o,u){It.ielt9?setTimeout(a(o,this,null,u),0):o(null,u)},_tileOnError:function(o,u,h){var m=this.options.errorTileUrl;m&&u.getAttribute("src")!==m&&(u.src=m),o(h,u)},_onTileRemove:function(o){o.tile.onload=null},_getZoomForUrl:function(){var o=this._tileZoom,u=this.options.maxZoom,h=this.options.zoomReverse,m=this.options.zoomOffset;return h&&(o=u-o),o+m},_getSubdomain:function(o){var u=Math.abs(o.x+o.y)%this.options.subdomains.length;return this.options.subdomains[u]},_abortLoading:function(){var o,u;for(o in this._tiles)if(this._tiles[o].coords.z!==this._tileZoom&&(u=this._tiles[o].el,u.onload=d,u.onerror=d,!u.complete)){u.src=R;var h=this._tiles[o].coords;Be(u),delete this._tiles[o],this.fire("tileabort",{tile:u,coords:h})}},_removeTile:function(o){var u=this._tiles[o];if(u)return u.el.setAttribute("src",R),ac.prototype._removeTile.call(this,o)},_tileReady:function(o,u,h){if(!(!this._map||h&&h.getAttribute("src")===R))return ac.prototype._tileReady.call(this,o,u,h)}});function G_(o,u){return new Fl(o,u)}var q_=Fl.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(o,u){this._url=o;var h=i({},this.defaultWmsParams);for(var m in u)m in this.options||(h[m]=u[m]);u=S(this,u);var _=u.detectRetina&&It.retina?2:1,b=this.getTileSize();h.width=b.x*_,h.height=b.y*_,this.wmsParams=h},onAdd:function(o){this._crs=this.options.crs||o.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var u=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[u]=this._crs.code,Fl.prototype.onAdd.call(this,o)},getTileUrl:function(o){var u=this._tileCoordsToNwSe(o),h=this._crs,m=Lt(h.project(u[0]),h.project(u[1])),_=m.min,b=m.max,O=(this._wmsVersion>=1.3&&this._crs===k_?[_.y,_.x,b.y,b.x]:[_.x,_.y,b.x,b.y]).join(","),j=Fl.prototype.getTileUrl.call(this,o);return j+C(this.wmsParams,j,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+O},setParams:function(o,u){return i(this.wmsParams,o),u||this.redraw(),this}});function lP(o,u){return new q_(o,u)}Fl.WMS=q_,G_.wms=lP;var ro=ns.extend({options:{padding:.1},initialize:function(o){S(this,o),c(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),Zt(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 o={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(o.zoomanim=this._onAnimZoom),o},_onAnimZoom:function(o){this._updateTransform(o.center,o.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(o,u){var h=this._map.getZoomScale(u,this._zoom),m=this._map.getSize().multiplyBy(.5+this.options.padding),_=this._map.project(this._center,u),b=m.multiplyBy(-h).add(_).subtract(this._map._getNewPixelOrigin(o,u));It.any3d?ja(this._container,b,h):dn(this._container,b)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var o in this._layers)this._layers[o]._reset()},_onZoomEnd:function(){for(var o in this._layers)this._layers[o]._project()},_updatePaths:function(){for(var o in this._layers)this._layers[o]._update()},_update:function(){var o=this.options.padding,u=this._map.getSize(),h=this._map.containerPointToLayerPoint(u.multiplyBy(-o)).round();this._bounds=new vt(h,h.add(u.multiplyBy(1+o*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),H_=ro.extend({options:{tolerance:0},getEvents:function(){var o=ro.prototype.getEvents.call(this);return o.viewprereset=this._onViewPreReset,o},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){ro.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var o=this._container=document.createElement("canvas");qt(o,"mousemove",this._onMouseMove,this),qt(o,"click dblclick mousedown mouseup contextmenu",this._onClick,this),qt(o,"mouseout",this._handleMouseOut,this),o._leaflet_disable_events=!0,this._ctx=o.getContext("2d")},_destroyContainer:function(){W(this._redrawRequest),delete this._ctx,Be(this._container),Se(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var o;this._redrawBounds=null;for(var u in this._layers)o=this._layers[u],o._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){ro.prototype._update.call(this);var o=this._bounds,u=this._container,h=o.getSize(),m=It.retina?2:1;dn(u,o.min),u.width=m*h.x,u.height=m*h.y,u.style.width=h.x+"px",u.style.height=h.y+"px",It.retina&&this._ctx.scale(2,2),this._ctx.translate(-o.min.x,-o.min.y),this.fire("update")}},_reset:function(){ro.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(o){this._updateDashArray(o),this._layers[c(o)]=o;var u=o._order={layer:o,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=u),this._drawLast=u,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(o){this._requestRedraw(o)},_removePath:function(o){var u=o._order,h=u.next,m=u.prev;h?h.prev=m:this._drawLast=m,m?m.next=h:this._drawFirst=h,delete o._order,delete this._layers[c(o)],this._requestRedraw(o)},_updatePath:function(o){this._extendRedrawBounds(o),o._project(),o._update(),this._requestRedraw(o)},_updateStyle:function(o){this._updateDashArray(o),this._requestRedraw(o)},_updateDashArray:function(o){if(typeof o.options.dashArray=="string"){var u=o.options.dashArray.split(/[, ]+/),h=[],m,_;for(_=0;_')}}catch{}return function(o){return document.createElement("<"+o+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}(),uP={_initContainer:function(){this._container=le("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(ro.prototype._update.call(this),this.fire("update"))},_initPath:function(o){var u=o._container=lc("shape");Zt(u,"leaflet-vml-shape "+(this.options.className||"")),u.coordsize="1 1",o._path=lc("path"),u.appendChild(o._path),this._updateStyle(o),this._layers[c(o)]=o},_addPath:function(o){var u=o._container;this._container.appendChild(u),o.options.interactive&&o.addInteractiveTarget(u)},_removePath:function(o){var u=o._container;Be(u),o.removeInteractiveTarget(u),delete this._layers[c(o)]},_updateStyle:function(o){var u=o._stroke,h=o._fill,m=o.options,_=o._container;_.stroked=!!m.stroke,_.filled=!!m.fill,m.stroke?(u||(u=o._stroke=lc("stroke")),_.appendChild(u),u.weight=m.weight+"px",u.color=m.color,u.opacity=m.opacity,m.dashArray?u.dashStyle=N(m.dashArray)?m.dashArray.join(" "):m.dashArray.replace(/( *, *)/g," "):u.dashStyle="",u.endcap=m.lineCap.replace("butt","flat"),u.joinstyle=m.lineJoin):u&&(_.removeChild(u),o._stroke=null),m.fill?(h||(h=o._fill=lc("fill")),_.appendChild(h),h.color=m.fillColor||m.color,h.opacity=m.fillOpacity):h&&(_.removeChild(h),o._fill=null)},_updateCircle:function(o){var u=o._point.round(),h=Math.round(o._radius),m=Math.round(o._radiusY||h);this._setPath(o,o._empty()?"M0 0":"AL "+u.x+","+u.y+" "+h+","+m+" 0,"+65535*360)},_setPath:function(o,u){o._path.v=u},_bringToFront:function(o){Ol(o._container)},_bringToBack:function(o){Rl(o._container)}},dh=It.vml?lc:Ke,uc=ro.extend({_initContainer:function(){this._container=dh("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=dh("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){Be(this._container),Se(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){ro.prototype._update.call(this);var o=this._bounds,u=o.getSize(),h=this._container;(!this._svgSize||!this._svgSize.equals(u))&&(this._svgSize=u,h.setAttribute("width",u.x),h.setAttribute("height",u.y)),dn(h,o.min),h.setAttribute("viewBox",[o.min.x,o.min.y,u.x,u.y].join(" ")),this.fire("update")}},_initPath:function(o){var u=o._path=dh("path");o.options.className&&Zt(u,o.options.className),o.options.interactive&&Zt(u,"leaflet-interactive"),this._updateStyle(o),this._layers[c(o)]=o},_addPath:function(o){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(o._path),o.addInteractiveTarget(o._path)},_removePath:function(o){Be(o._path),o.removeInteractiveTarget(o._path),delete this._layers[c(o)]},_updatePath:function(o){o._project(),o._update()},_updateStyle:function(o){var u=o._path,h=o.options;u&&(h.stroke?(u.setAttribute("stroke",h.color),u.setAttribute("stroke-opacity",h.opacity),u.setAttribute("stroke-width",h.weight),u.setAttribute("stroke-linecap",h.lineCap),u.setAttribute("stroke-linejoin",h.lineJoin),h.dashArray?u.setAttribute("stroke-dasharray",h.dashArray):u.removeAttribute("stroke-dasharray"),h.dashOffset?u.setAttribute("stroke-dashoffset",h.dashOffset):u.removeAttribute("stroke-dashoffset")):u.setAttribute("stroke","none"),h.fill?(u.setAttribute("fill",h.fillColor||h.color),u.setAttribute("fill-opacity",h.fillOpacity),u.setAttribute("fill-rule",h.fillRule||"evenodd")):u.setAttribute("fill","none"))},_updatePoly:function(o,u){this._setPath(o,Ji(o._parts,u))},_updateCircle:function(o){var u=o._point,h=Math.max(Math.round(o._radius),1),m=Math.max(Math.round(o._radiusY),1)||h,_="a"+h+","+m+" 0 1,0 ",b=o._empty()?"M0 0":"M"+(u.x-h)+","+u.y+_+h*2+",0 "+_+-h*2+",0 ";this._setPath(o,b)},_setPath:function(o,u){o._path.setAttribute("d",u)},_bringToFront:function(o){Ol(o._path)},_bringToBack:function(o){Rl(o._path)}});It.vml&&uc.include(uP);function W_(o){return It.svg||It.vml?new uc(o):null}se.include({getRenderer:function(o){var u=o.options.renderer||this._getPaneRenderer(o.options.pane)||this.options.renderer||this._renderer;return u||(u=this._renderer=this._createRenderer()),this.hasLayer(u)||this.addLayer(u),u},_getPaneRenderer:function(o){if(o==="overlayPane"||o===void 0)return!1;var u=this._paneRenderers[o];return u===void 0&&(u=this._createRenderer({pane:o}),this._paneRenderers[o]=u),u},_createRenderer:function(o){return this.options.preferCanvas&&Z_(o)||W_(o)}});var X_=Dl.extend({initialize:function(o,u){Dl.prototype.initialize.call(this,this._boundsToLatLngs(o),u)},setBounds:function(o){return this.setLatLngs(this._boundsToLatLngs(o))},_boundsToLatLngs:function(o){return o=ht(o),[o.getSouthWest(),o.getNorthWest(),o.getNorthEast(),o.getSouthEast()]}});function cP(o,u){return new X_(o,u)}uc.create=dh,uc.pointsToPath=Ji,no.geometryToLayer=oh,no.coordsToLatLng=_g,no.coordsToLatLngs=ah,no.latLngToCoords=xg,no.latLngsToCoords=lh,no.getFeature=kl,no.asFeature=uh,se.mergeOptions({boxZoom:!0});var Y_=Ts.extend({initialize:function(o){this._map=o,this._container=o._container,this._pane=o._panes.overlayPane,this._resetStateTimeout=0,o.on("unload",this._destroy,this)},addHooks:function(){qt(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Se(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){Be(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(o){if(!o.shiftKey||o.which!==1&&o.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),tc(),ng(),this._startPoint=this._map.mouseEventToContainerPoint(o),qt(document,{contextmenu:Ua,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(o){this._moved||(this._moved=!0,this._box=le("div","leaflet-zoom-box",this._container),Zt(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(o);var u=new vt(this._point,this._startPoint),h=u.getSize();dn(this._box,u.min),this._box.style.width=h.x+"px",this._box.style.height=h.y+"px"},_finish:function(){this._moved&&(Be(this._box),en(this._container,"leaflet-crosshair")),ec(),rg(),Se(document,{contextmenu:Ua,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(o){if(!(o.which!==1&&o.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(a(this._resetState,this),0);var u=new ct(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(u).fire("boxzoomend",{boxZoomBounds:u})}},_onKeyDown:function(o){o.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});se.addInitHook("addHandler","boxZoom",Y_),se.mergeOptions({doubleClickZoom:!0});var K_=Ts.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(o){var u=this._map,h=u.getZoom(),m=u.options.zoomDelta,_=o.originalEvent.shiftKey?h-m:h+m;u.options.doubleClickZoom==="center"?u.setZoom(_):u.setZoomAround(o.containerPoint,_)}});se.addInitHook("addHandler","doubleClickZoom",K_),se.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Q_=Ts.extend({addHooks:function(){if(!this._draggable){var o=this._map;this._draggable=new Do(o._mapPane,o._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),o.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),o.on("zoomend",this._onZoomEnd,this),o.whenReady(this._onZoomEnd,this))}Zt(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){en(this._map._container,"leaflet-grab"),en(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 o=this._map;if(o._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var u=ht(this._map.options.maxBounds);this._offsetLimit=Lt(this._map.latLngToContainerPoint(u.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(u.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;o.fire("movestart").fire("dragstart"),o.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(o){if(this._map.options.inertia){var u=this._lastTime=+new Date,h=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(h),this._times.push(u),this._prunePositions(u)}this._map.fire("move",o).fire("drag",o)},_prunePositions:function(o){for(;this._positions.length>1&&o-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var o=this._map.getSize().divideBy(2),u=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=u.subtract(o).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(o,u){return o-(o-u)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var o=this._draggable._newPos.subtract(this._draggable._startPos),u=this._offsetLimit;o.xu.max.x&&(o.x=this._viscousLimit(o.x,u.max.x)),o.y>u.max.y&&(o.y=this._viscousLimit(o.y,u.max.y)),this._draggable._newPos=this._draggable._startPos.add(o)}},_onPreDragWrap:function(){var o=this._worldWidth,u=Math.round(o/2),h=this._initialWorldOffset,m=this._draggable._newPos.x,_=(m-u+h)%o+u-h,b=(m+u+h)%o-u-h,O=Math.abs(_+h)0?b:-b))-u;this._delta=0,this._startTime=null,O&&(o.options.scrollWheelZoom==="center"?o.setZoom(u+O):o.setZoomAround(this._lastMousePos,u+O))}});se.addInitHook("addHandler","scrollWheelZoom",$_);var fP=600;se.mergeOptions({tapHold:It.touchNative&&It.safari&&It.mobile,tapTolerance:15});var t0=Ts.extend({addHooks:function(){qt(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Se(this._map._container,"touchstart",this._onDown,this)},_onDown:function(o){if(clearTimeout(this._holdTimeout),o.touches.length===1){var u=o.touches[0];this._startPos=this._newPos=new z(u.clientX,u.clientY),this._holdTimeout=setTimeout(a(function(){this._cancel(),this._isTapValid()&&(qt(document,"touchend",Kn),qt(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",u))},this),fP),qt(document,"touchend touchcancel contextmenu",this._cancel,this),qt(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function o(){Se(document,"touchend",Kn),Se(document,"touchend touchcancel",o)},_cancel:function(){clearTimeout(this._holdTimeout),Se(document,"touchend touchcancel contextmenu",this._cancel,this),Se(document,"touchmove",this._onMove,this)},_onMove:function(o){var u=o.touches[0];this._newPos=new z(u.clientX,u.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(o,u){var h=new MouseEvent(o,{bubbles:!0,cancelable:!0,view:window,screenX:u.screenX,screenY:u.screenY,clientX:u.clientX,clientY:u.clientY});h._simulated=!0,u.target.dispatchEvent(h)}});se.addInitHook("addHandler","tapHold",t0),se.mergeOptions({touchZoom:It.touch,bounceAtZoomLimits:!0});var e0=Ts.extend({addHooks:function(){Zt(this._map._container,"leaflet-touch-zoom"),qt(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){en(this._map._container,"leaflet-touch-zoom"),Se(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(o){var u=this._map;if(!(!o.touches||o.touches.length!==2||u._animatingZoom||this._zooming)){var h=u.mouseEventToContainerPoint(o.touches[0]),m=u.mouseEventToContainerPoint(o.touches[1]);this._centerPoint=u.getSize()._divideBy(2),this._startLatLng=u.containerPointToLatLng(this._centerPoint),u.options.touchZoom!=="center"&&(this._pinchStartLatLng=u.containerPointToLatLng(h.add(m)._divideBy(2))),this._startDist=h.distanceTo(m),this._startZoom=u.getZoom(),this._moved=!1,this._zooming=!0,u._stop(),qt(document,"touchmove",this._onTouchMove,this),qt(document,"touchend touchcancel",this._onTouchEnd,this),Kn(o)}},_onTouchMove:function(o){if(!(!o.touches||o.touches.length!==2||!this._zooming)){var u=this._map,h=u.mouseEventToContainerPoint(o.touches[0]),m=u.mouseEventToContainerPoint(o.touches[1]),_=h.distanceTo(m)/this._startDist;if(this._zoom=u.getScaleZoom(_,this._startZoom),!u.options.bounceAtZoomLimits&&(this._zoomu.getMaxZoom()&&_>1)&&(this._zoom=u._limitZoom(this._zoom)),u.options.touchZoom==="center"){if(this._center=this._startLatLng,_===1)return}else{var b=h._add(m)._divideBy(2)._subtract(this._centerPoint);if(_===1&&b.x===0&&b.y===0)return;this._center=u.unproject(u.project(this._pinchStartLatLng,this._zoom).subtract(b),this._zoom)}this._moved||(u._moveStart(!0,!1),this._moved=!0),W(this._animRequest);var O=a(u._move,u,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=J(O,this,!0),Kn(o)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,W(this._animRequest),Se(document,"touchmove",this._onTouchMove,this),Se(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))}});se.addInitHook("addHandler","touchZoom",e0),se.BoxZoom=Y_,se.DoubleClickZoom=K_,se.Drag=Q_,se.Keyboard=J_,se.ScrollWheelZoom=$_,se.TapHold=t0,se.TouchZoom=e0,n.Bounds=vt,n.Browser=It,n.CRS=Gt,n.Canvas=H_,n.Circle=yg,n.CircleMarker=sh,n.Class=D,n.Control=es,n.DivIcon=V_,n.DivOverlay=Os,n.DomEvent=IN,n.DomUtil=bN,n.Draggable=Do,n.Evented=yt,n.FeatureGroup=to,n.GeoJSON=no,n.GridLayer=ac,n.Handler=Ts,n.Icon=Al,n.ImageOverlay=ch,n.LatLng=_t,n.LatLngBounds=ct,n.Layer=ns,n.LayerGroup=Ml,n.LineUtil=VN,n.Map=se,n.Marker=ih,n.Mixin=kN,n.Path=ko,n.Point=z,n.PolyUtil=FN,n.Polygon=Dl,n.Polyline=eo,n.Popup=fh,n.PosAnimation=C_,n.Projection=GN,n.Rectangle=X_,n.Renderer=ro,n.SVG=uc,n.SVGOverlay=U_,n.TileLayer=Fl,n.Tooltip=hh,n.Transformation=Je,n.Util=$,n.VideoOverlay=B_,n.bind=a,n.bounds=Lt,n.canvas=Z_,n.circle=QN,n.circleMarker=KN,n.control=ic,n.divIcon=oP,n.extend=i,n.featureGroup=WN,n.geoJSON=z_,n.geoJson=tP,n.gridLayer=aP,n.icon=XN,n.imageOverlay=eP,n.latLng=wt,n.latLngBounds=ht,n.layerGroup=ZN,n.map=TN,n.marker=YN,n.point=tt,n.polygon=$N,n.polyline=JN,n.popup=iP,n.rectangle=cP,n.setOptions=S,n.stamp=c,n.svg=W_,n.svgOverlay=rP,n.tileLayer=G_,n.tooltip=sP,n.transformation=De,n.version=r,n.videoOverlay=nP;var hP=window.L;n.noConflict=function(){return window.L=hP,this},window.L=n})})(wv,wv.exports);var Fr=wv.exports;function Ff(e,t,n){return Object.freeze({instance:e,context:t,container:n})}function Mp(e,t){return t==null?function(r,i){const s=P.useRef();return s.current||(s.current=e(r,i)),s}:function(r,i){const s=P.useRef();s.current||(s.current=e(r,i));const a=P.useRef(r),{instance:l}=s.current;return P.useEffect(function(){a.current!==r&&(t(l,r,a.current),a.current=r)},[l,r,i]),s}}function CC(e,t){P.useEffect(function(){return(t.layerContainer??t.map).addLayer(e.instance),function(){var s;(s=t.layerContainer)==null||s.removeLayer(e.instance),t.map.removeLayer(e.instance)}},[t,e])}function NC(e){return function(n){const r=Op(),i=e(Rp(n,r),r);return xC(r.map,n.attribution),Jy(i.current,n.eventHandlers),CC(i.current,r),i}}function MM(e,t){const n=P.useRef();P.useEffect(function(){if(t.pathOptions!==n.current){const i=t.pathOptions??{};e.instance.setStyle(i),n.current=i}},[e,t])}function AM(e){return function(n){const r=Op(),i=e(Rp(n,r),r);return Jy(i.current,n.eventHandlers),CC(i.current,r),MM(i.current,n),i}}function DM(e,t){const n=Mp(e,t),r=NC(n);return SC(r)}function kM(e,t){const n=Mp(e),r=RM(n,t);return TM(r)}function PC(e,t){const n=Mp(e,t),r=AM(n);return SC(r)}function FM(e,t){const n=Mp(e,t),r=NC(n);return OM(r)}function jM(e,t,n){const{opacity:r,zIndex:i}=t;r!=null&&r!==n.opacity&&e.setOpacity(r),i!=null&&i!==n.zIndex&&e.setZIndex(i)}function $y(){return Op().map}function bC(e){const t=$y();return P.useEffect(function(){return t.on(e),function(){t.off(e)}},[t,e]),t}function Ev(){return Ev=Object.assign||function(e){for(var t=1;t(y==null?void 0:y.map)??null,[y]);const S=P.useCallback(E=>{if(E!==null&&y===null){const w=new Fr.Map(E,g);n!=null&&f!=null?w.setView(n,f):e!=null&&w.fitBounds(e,t),c!=null&&w.whenReady(c),x(IM(w))}},[]);P.useEffect(()=>()=>{y==null||y.map.remove()},[y]);const C=y?ye.createElement(EC,{value:y},r):a??null;return ye.createElement("div",Ev({},v,{ref:S}),C)}const LC=P.forwardRef(zM),$a=DM(function({position:t,...n},r){const i=new Fr.Marker(t,n);return Ff(i,Qy(r,{overlayContainer:i}))},function(t,n,r){n.position!==r.position&&t.setLatLng(n.position),n.icon!=null&&n.icon!==r.icon&&t.setIcon(n.icon),n.zIndexOffset!=null&&n.zIndexOffset!==r.zIndexOffset&&t.setZIndexOffset(n.zIndexOffset),n.opacity!=null&&n.opacity!==r.opacity&&t.setOpacity(n.opacity),t.dragging!=null&&n.draggable!==r.draggable&&(n.draggable===!0?t.dragging.enable():t.dragging.disable())}),Vd=PC(function({positions:t,...n},r){const i=new Fr.Polygon(t,n);return Ff(i,Qy(r,{overlayContainer:i}))},function(t,n,r){n.positions!==r.positions&&t.setLatLngs(n.positions)}),sd=PC(function({positions:t,...n},r){const i=new Fr.Polyline(t,n);return Ff(i,Qy(r,{overlayContainer:i}))},function(t,n,r){n.positions!==r.positions&&t.setLatLngs(n.positions)}),Sv=kM(function(t,n){const r=new Fr.Popup(t,n.overlayContainer);return Ff(r,n)},function(t,n,{position:r},i){P.useEffect(function(){const{instance:a}=t;function l(f){f.popup===a&&(a.update(),i(!0))}function c(f){f.popup===a&&i(!1)}return n.map.on({popupopen:l,popupclose:c}),n.overlayContainer==null?(r!=null&&a.setLatLng(r),a.openOn(n.map)):n.overlayContainer.bindPopup(a),function(){var g;n.map.off({popupopen:l,popupclose:c}),(g=n.overlayContainer)==null||g.unbindPopup(),n.map.removeLayer(a)}},[t,n,i,r])}),IC=FM(function({url:t,...n},r){const i=new Fr.TileLayer(t,Rp(n,r));return Ff(i,r)},function(t,n,r){jM(t,n,r);const{url:i}=n;i!=null&&i!==r.url&&t.setUrl(i)});var Er=63710088e-1,TC={centimeters:Er*100,centimetres:Er*100,degrees:Er/111325,feet:Er*3.28084,inches:Er*39.37,kilometers:Er/1e3,kilometres:Er/1e3,meters:Er,metres:Er,miles:Er/1609.344,millimeters:Er*1e3,millimetres:Er*1e3,nauticalmiles:Er/1852,radians:1,yards:Er*1.0936};function jf(e,t,n){n===void 0&&(n={});var r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}function BM(e,t,n){if(n===void 0&&(n={}),!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!hw(e[0])||!hw(e[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:e};return jf(r,t,n)}function Ap(e,t,n){n===void 0&&(n={});for(var r=0,i=e;rn[0]&&(t[0]=n[0]),t[1]>n[1]&&(t[1]=n[1]),t[2]f==g>-f?(s=f,f=t[++d]):(s=g,g=r[++v]);let y=0;if(df==g>-f?(a=f+s,l=s-(a-f),f=t[++d]):(a=g+s,l=s-(a-g),g=r[++v]),s=a,l!==0&&(i[y++]=l);df==g>-f?(a=s+f,c=a-s,l=s-(a-c)+(f-c),f=t[++d]):(a=s+g,c=a-s,l=s-(a-c)+(g-c),g=r[++v]),s=a,l!==0&&(i[y++]=l);for(;d=D||-$>=D||(d=e-Q,l=e-(Q+d)+(d-i),d=n-Y,f=n-(Y+d)+(d-i),d=t-J,c=t-(J+d)+(d-s),d=r-W,g=r-(W+d)+(d-s),l===0&&c===0&&f===0&&g===0)||(D=YM*a+HM*Math.abs($),$+=Q*g+W*l-(J*f+Y*c),$>=D||-$>=D))return $;I=l*W,v=cr*l,y=v-(v-l),x=l-y,v=cr*W,S=v-(v-W),C=W-S,R=x*C-(I-y*S-x*S-y*C),A=c*Y,v=cr*c,y=v-(v-c),x=c-y,v=cr*Y,S=v-(v-Y),C=Y-S,B=x*C-(A-y*S-x*S-y*C),E=R-B,d=R-E,wr[0]=R-(E+d)+(d-B),w=I+E,d=w-I,N=I-(w-d)+(E-d),E=N-A,d=N-E,wr[1]=N-(E+d)+(d-A),q=w+E,d=q-w,wr[2]=w-(q-d)+(E-d),wr[3]=q;const ut=om(4,Vl,4,wr,pw);I=Q*g,v=cr*Q,y=v-(v-Q),x=Q-y,v=cr*g,S=v-(v-g),C=g-S,R=x*C-(I-y*S-x*S-y*C),A=J*f,v=cr*J,y=v-(v-J),x=J-y,v=cr*f,S=v-(v-f),C=f-S,B=x*C-(A-y*S-x*S-y*C),E=R-B,d=R-E,wr[0]=R-(E+d)+(d-B),w=I+E,d=w-I,N=I-(w-d)+(E-d),E=N-A,d=N-E,wr[1]=N-(E+d)+(d-A),q=w+E,d=q-w,wr[2]=w-(q-d)+(E-d),wr[3]=q;const it=om(ut,pw,4,wr,gw);I=l*g,v=cr*l,y=v-(v-l),x=l-y,v=cr*g,S=v-(v-g),C=g-S,R=x*C-(I-y*S-x*S-y*C),A=c*f,v=cr*c,y=v-(v-c),x=c-y,v=cr*f,S=v-(v-f),C=f-S,B=x*C-(A-y*S-x*S-y*C),E=R-B,d=R-E,wr[0]=R-(E+d)+(d-B),w=I+E,d=w-I,N=I-(w-d)+(E-d),E=N-A,d=N-E,wr[1]=N-(E+d)+(d-A),q=w+E,d=q-w,wr[2]=w-(q-d)+(E-d),wr[3]=q;const yt=om(it,gw,4,wr,mw);return mw[yt-1]}function QM(e,t,n,r,i,s){const a=(t-s)*(n-i),l=(e-i)*(r-s),c=a-l,f=Math.abs(a+l);return Math.abs(c)>=WM*f?c:-KM(e,t,n,r,i,s,f)}function JM(e,t){t===void 0&&(t={});var n=Nv(e),r=(n[0]+n[2])/2,i=(n[1]+n[3])/2;return BM([r,i],t.properties,t)}var vw=6378137;function MC(e){return qM(e,function(t,n){return t+$M(n)},0)}function $M(e){var t=0,n;switch(e.type){case"Polygon":return yw(e.coordinates);case"MultiPolygon":for(n=0;n0){t+=Math.abs(_w(e[0]));for(var n=1;n2){for(l=0;lt?1:e0){if(t.right===null)break;if(n(e,t.right.key)>0){const l=t.right;if(t.right=l.left,l.left=t,t=l,t.right===null)break}i.right=t,i=t,t=t.right}else break}return i.right=t.left,s.left=t.right,t.left=r.right,t.right=r.left,t}function lm(e,t,n,r){const i=new da(e,t);if(n===null)return i.left=i.right=null,i;n=Xo(e,n,r);const s=r(e,n.key);return s<0?(i.left=n.left,i.right=n,n.left=null):s>=0&&(i.right=n.right,i.left=n,n.right=null),i}function xw(e,t,n){let r=null,i=null;if(t){t=Xo(e,t,n);const s=n(t.key,e);s===0?(r=t.left,i=t.right):s<0?(i=t.right,t.right=null,r=t):(r=t.left,t.left=null,i=t)}return{left:r,right:i}}function eA(e,t,n){return t===null?e:(e===null||(t=Xo(e.key,t,n),t.left=e),t)}function Pv(e,t,n,r,i){if(e){r(`${t}${n?"└── ":"├── "}${i(e)} `);const s=t+(n?" ":"│ ");e.left&&Pv(e.left,s,!1,r,i),e.right&&Pv(e.right,s,!0,r,i)}}class e_{constructor(t=tA){this._root=null,this._size=0,this._comparator=t}insert(t,n){return this._size++,this._root=lm(t,n,this._root,this._comparator)}add(t,n){const r=new da(t,n);this._root===null&&(r.left=r.right=null,this._size++,this._root=r);const i=this._comparator,s=Xo(t,this._root,i),a=i(t,s.key);return a===0?this._root=s:(a<0?(r.left=s.left,r.right=s,s.left=null):a>0&&(r.right=s.right,r.left=s,s.right=null),this._size++,this._root=r),this._root}remove(t){this._root=this._remove(t,this._root,this._comparator)}_remove(t,n,r){let i;return n===null?null:(n=Xo(t,n,r),r(t,n.key)===0?(n.left===null?i=n.right:(i=Xo(t,n.left,r),i.right=n.right),this._size--,i):n)}pop(){let t=this._root;if(t){for(;t.left;)t=t.left;return this._root=Xo(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null}findStatic(t){let n=this._root;const r=this._comparator;for(;n;){const i=r(t,n.key);if(i===0)return n;i<0?n=n.left:n=n.right}return null}find(t){return this._root&&(this._root=Xo(t,this._root,this._comparator),this._comparator(t,this._root.key)!==0)?null:this._root}contains(t){let n=this._root;const r=this._comparator;for(;n;){const i=r(t,n.key);if(i===0)return!0;i<0?n=n.left:n=n.right}return!1}forEach(t,n){let r=this._root;const i=[];let s=!1;for(;!s;)r!==null?(i.push(r),r=r.left):i.length!==0?(r=i.pop(),t.call(n,r),r=r.right):s=!0;return this}range(t,n,r,i){const s=[],a=this._comparator;let l=this._root,c;for(;s.length!==0||l;)if(l)s.push(l),l=l.left;else{if(l=s.pop(),c=a(l.key,n),c>0)break;if(a(l.key,t)>=0&&r.call(i,l))return this;l=l.right}return this}keys(){const t=[];return this.forEach(({key:n})=>{t.push(n)}),t}values(){const t=[];return this.forEach(({data:n})=>{t.push(n)}),t}min(){return this._root?this.minNode(this._root).key:null}max(){return this._root?this.maxNode(this._root).key:null}minNode(t=this._root){if(t)for(;t.left;)t=t.left;return t}maxNode(t=this._root){if(t)for(;t.right;)t=t.right;return t}at(t){let n=this._root,r=!1,i=0;const s=[];for(;!r;)if(n)s.push(n),n=n.left;else if(s.length>0){if(n=s.pop(),i===t)return n;i++,n=n.right}else r=!0;return null}next(t){let n=this._root,r=null;if(t.right){for(r=t.right;r.left;)r=r.left;return r}const i=this._comparator;for(;n;){const s=i(t.key,n.key);if(s===0)break;s<0?(r=n,n=n.left):n=n.right}return r}prev(t){let n=this._root,r=null;if(t.left!==null){for(r=t.left;r.right;)r=r.right;return r}const i=this._comparator;for(;n;){const s=i(t.key,n.key);if(s===0)break;s<0?n=n.left:(r=n,n=n.right)}return r}clear(){return this._root=null,this._size=0,this}toList(){return rA(this._root)}load(t,n=[],r=!1){let i=t.length;const s=this._comparator;if(r&&Iv(t,n,0,i-1,s),this._root===null)this._root=bv(t,n,0,i),this._size=i;else{const a=iA(this.toList(),nA(t,n),s);i=this._size+i,this._root=Lv({head:a},0,i)}return this}isEmpty(){return this._root===null}get size(){return this._size}get root(){return this._root}toString(t=n=>String(n.key)){const n=[];return Pv(this._root,"",!0,r=>n.push(r),t),n.join("")}update(t,n,r){const i=this._comparator;let{left:s,right:a}=xw(t,this._root,i);i(t,n)<0?a=lm(n,r,a,i):s=lm(n,r,s,i),this._root=eA(s,a,i)}split(t){return xw(t,this._root,this._comparator)}*[Symbol.iterator](){let t=this._root;const n=[];let r=!1;for(;!r;)t!==null?(n.push(t),t=t.left):n.length!==0?(t=n.pop(),yield t,t=t.right):r=!0}}function bv(e,t,n,r){const i=r-n;if(i>0){const s=n+Math.floor(i/2),a=e[s],l=t[s],c=new da(a,l);return c.left=bv(e,t,n,s),c.right=bv(e,t,s+1,r),c}return null}function nA(e,t){const n=new da(null,null);let r=n;for(let i=0;i0?(t=s=s.next=n.pop(),t=t.right):r=!0;return s.next=null,i.next}function Lv(e,t,n){const r=n-t;if(r>0){const i=t+Math.floor(r/2),s=Lv(e,t,i),a=e.head;return a.left=s,e.head=e.head.next,a.right=Lv(e,i+1,n),a}return null}function iA(e,t,n){const r=new da(null,null);let i=r,s=e,a=t;for(;s!==null&&a!==null;)n(s.key,a.key)<0?(i.next=s,s=s.next):(i.next=a,a=a.next),i=i.next;return s!==null?i.next=s:a!==null&&(i.next=a),r.next}function Iv(e,t,n,r,i){if(n>=r)return;const s=e[n+r>>1];let a=n-1,l=r+1;for(;;){do a++;while(i(e[a],s)<0);do l--;while(i(e[l],s)>0);if(a>=l)break;let c=e[a];e[a]=e[l],e[l]=c,c=t[a],t[a]=t[l],t[l]=c}Iv(e,t,n,l,i),Iv(e,t,l+1,r,i)}var AC={};const xc=(e,t)=>e.ll.x<=t.x&&t.x<=e.ur.x&&e.ll.y<=t.y&&t.y<=e.ur.y,Tv=(e,t)=>{if(t.ur.x{if(-Joe.x*t.y-e.y*t.x,DC=(e,t)=>e.x*t.x+e.y*t.y,Sw=(e,t,n)=>{const r=QM(e.x,e.y,t.x,t.y,n.x,n.y);return r>0?-1:r<0?1:0},qd=e=>Math.sqrt(DC(e,e)),aA=(e,t,n)=>{const r={x:t.x-e.x,y:t.y-e.y},i={x:n.x-e.x,y:n.y-e.y};return od(i,r)/qd(i)/qd(r)},lA=(e,t,n)=>{const r={x:t.x-e.x,y:t.y-e.y},i={x:n.x-e.x,y:n.y-e.y};return DC(i,r)/qd(i)/qd(r)},Cw=(e,t,n)=>t.y===0?null:{x:e.x+t.x/t.y*(n-e.y),y:n},Nw=(e,t,n)=>t.x===0?null:{x:n,y:e.y+t.y/t.x*(n-e.x)},uA=(e,t,n,r)=>{if(t.x===0)return Nw(n,r,e.x);if(r.x===0)return Nw(e,t,n.x);if(t.y===0)return Cw(n,r,e.y);if(r.y===0)return Cw(e,t,n.y);const i=od(t,r);if(i==0)return null;const s={x:n.x-e.x,y:n.y-e.y},a=od(s,t)/i,l=od(s,r)/i,c=e.x+l*t.x,f=n.x+a*r.x,g=e.y+l*t.y,d=n.y+a*r.y,v=(c+f)/2,y=(g+d)/2;return{x:v,y}};class Ti{static compare(t,n){const r=Ti.comparePoints(t.point,n.point);return r!==0?r:(t.point!==n.point&&t.link(n),t.isLeft!==n.isLeft?t.isLeft?1:-1:la.compare(t.segment,n.segment))}static comparePoints(t,n){return t.xn.x?1:t.yn.y?1:0}constructor(t,n){t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=n}link(t){if(t.point===this.point)throw new Error("Tried to link already linked events");const n=t.point.events;for(let r=0,i=n.length;r{const s=i.otherSE;n.set(i,{sine:aA(this.point,t.point,s.point),cosine:lA(this.point,t.point,s.point)})};return(i,s)=>{n.has(i)||r(i),n.has(s)||r(s);const{sine:a,cosine:l}=n.get(i),{sine:c,cosine:f}=n.get(s);return a>=0&&c>=0?lf?-1:0:a<0&&c<0?lf?1:0:ca?1:0}}}let cA=0;class la{static compare(t,n){const r=t.leftSE.point.x,i=n.leftSE.point.x,s=t.rightSE.point.x,a=n.rightSE.point.x;if(al&&c>f)return-1;const d=t.comparePoint(n.leftSE.point);if(d<0)return 1;if(d>0)return-1;const v=n.comparePoint(t.rightSE.point);return v!==0?v:-1}if(r>i){if(lc&&l>g)return 1;const d=n.comparePoint(t.leftSE.point);if(d!==0)return d;const v=t.comparePoint(n.rightSE.point);return v<0?1:v>0?-1:1}if(lc)return 1;if(sa){const d=t.comparePoint(n.rightSE.point);if(d<0)return 1;if(d>0)return-1}if(s!==a){const d=f-l,v=s-r,y=g-c,x=a-i;if(d>v&&yx)return-1}return s>a?1:sg?1:t.idn.id?1:0}constructor(t,n,r,i){this.id=++cA,this.leftSE=t,t.segment=this,t.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=t,this.rings=r,this.windings=i}static fromRing(t,n,r){let i,s,a;const l=Ti.comparePoints(t,n);if(l<0)i=t,s=n,a=1;else if(l>0)i=n,s=t,a=-1;else throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);const c=new Ti(i,!0),f=new Ti(s,!1);return new la(c,f,[r],[a])}replaceRightSE(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const t=this.leftSE.point.y,n=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:tn?t:n}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}comparePoint(t){if(this.isAnEndpoint(t))return 0;const n=this.leftSE.point,r=this.rightSE.point,i=this.vector();if(n.x===r.x)return t.x===n.x?0:t.x0&&l.swapEvents(),Ti.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),s.checkForConsuming()),n}swapEvents(){const t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let n=0,r=this.windings.length;n0){const s=n;n=r,r=s}if(n.prev===r){const s=n;n=r,r=s}for(let s=0,a=r.rings.length;si.length===1&&i[0].isSubject;this._isInResult=r(t)!==r(n);break}default:throw new Error(`Unrecognized operation type found ${fs.type}`)}return this._isInResult}}class Pw{constructor(t,n,r){if(!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=r,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const i=cf.round(t[0][0],t[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};let s=i;for(let a=1,l=t.length;athis.bbox.ur.x&&(this.bbox.ur.x=c.x),c.y>this.bbox.ur.y&&(this.bbox.ur.y=c.y),s=c)}(i.x!==s.x||i.y!==s.y)&&this.segments.push(la.fromRing(s,i,this))}getSweepEvents(){const t=[];for(let n=0,r=this.segments.length;nthis.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.interiorRings.push(s)}this.multiPoly=n}getSweepEvents(){const t=this.exteriorRing.getSweepEvents();for(let n=0,r=this.interiorRings.length;nthis.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.polys.push(s)}this.isSubject=n}getSweepEvents(){const t=[];for(let n=0,r=this.polys.length;n0&&(t=a)}let n=t.segment.prevInResult(),r=n?n.prevInResult():null;for(;;){if(!n)return null;if(!r)return n.ringOut;if(r.ringOut!==n.ringOut)return r.ringOut.enclosingRing()!==n.ringOut?n.ringOut:n.ringOut.enclosingRing();n=r.prevInResult(),r=n?n.prevInResult():null}}}class Lw{constructor(t){this.exteriorRing=t,t.poly=this,this.interiorRings=[]}addInterior(t){this.interiorRings.push(t),t.poly=this}getGeom(){const t=[this.exteriorRing.getGeom()];if(t[0]===null)return null;for(let n=0,r=this.interiorRings.length;n1&&arguments[1]!==void 0?arguments[1]:la.compare;this.queue=t,this.tree=new e_(n),this.segments=[]}process(t){const n=t.segment,r=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(n),r;const i=t.isLeft?this.tree.add(n):this.tree.find(n);if(!i)throw new Error(`Unable to find segment #${n.id} [${n.leftSE.point.x}, ${n.leftSE.point.y}] -> [${n.rightSE.point.x}, ${n.rightSE.point.y}] in SweepLine tree.`);let s=i,a=i,l,c;for(;l===void 0;)s=this.tree.prev(s),s===null?l=null:s.key.consumedBy===void 0&&(l=s.key);for(;c===void 0;)a=this.tree.next(a),a===null?c=null:a.key.consumedBy===void 0&&(c=a.key);if(t.isLeft){let f=null;if(l){const d=l.getIntersection(n);if(d!==null&&(n.isAnEndpoint(d)||(f=d),!l.isAnEndpoint(d))){const v=this._splitSafely(l,d);for(let y=0,x=v.length;y0?(this.tree.remove(n),r.push(t)):(this.segments.push(n),n.prev=l)}else{if(l&&c){const f=l.getIntersection(c);if(f!==null){if(!l.isAnEndpoint(f)){const g=this._splitSafely(l,f);for(let d=0,v=g.length;dIw)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const a=new dA(s);let l=s.size,c=s.pop();for(;c;){const d=c.key;if(s.size===l){const y=d.segment;throw new Error(`Unable to pop() ${d.isLeft?"left":"right"} SweepEvent [${d.point.x}, ${d.point.y}] from segment #${y.id} [${y.leftSE.point.x}, ${y.leftSE.point.y}] -> [${y.rightSE.point.x}, ${y.rightSE.point.y}] from queue.`)}if(s.size>Iw)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(a.segments.length>pA)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const v=a.process(d);for(let y=0,x=v.length;y1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;rn.x?1:this.yn.y?1:0};M.prototype.clone=function(){};M.prototype.copy=function(){return new M(this)};M.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"};M.prototype.distance3D=function(t){var n=this.x-t.x,r=this.y-t.y,i=this.z-t.z;return Math.sqrt(n*n+r*r+i*i)};M.prototype.distance=function(t){var n=this.x-t.x,r=this.y-t.y;return Math.sqrt(n*n+r*r)};M.prototype.hashCode=function(){var t=17;return t=37*t+M.hashCode(this.x),t=37*t+M.hashCode(this.y),t};M.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z};M.prototype.interfaces_=function(){return[ti,Dp,ei]};M.prototype.getClass=function(){return M};M.hashCode=function(){if(arguments.length===1){var t=arguments[0],n=Rt.doubleToLongBits(t);return Math.trunc((n^n)>>>32)}};Cl.DimensionalComparator.get=function(){return uo};Cl.serialVersionUID.get=function(){return 6683108902428367e3};Cl.NULL_ORDINATE.get=function(){return Rt.NaN};Cl.X.get=function(){return 0};Cl.Y.get=function(){return 1};Cl.Z.get=function(){return 2};Object.defineProperties(M,Cl);var uo=function(t){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var n=arguments[0];if(n!==2&&n!==3)throw new ve("only 2 or 3 dimensions may be specified");this._dimensionsToTest=n}}};uo.prototype.compare=function(t,n){var r=t,i=n,s=uo.compare(r.x,i.x);if(s!==0)return s;var a=uo.compare(r.y,i.y);if(a!==0)return a;if(this._dimensionsToTest<=2)return 0;var l=uo.compare(r.z,i.z);return l};uo.prototype.interfaces_=function(){return[vu]};uo.prototype.getClass=function(){return uo};uo.compare=function(t,n){return tn?1:Rt.isNaN(t)?Rt.isNaN(n)?0:-1:Rt.isNaN(n)?1:0};var yu=function(){};yu.prototype.create=function(){};yu.prototype.interfaces_=function(){return[]};yu.prototype.getClass=function(){return yu};var k=function(){},Bf={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};k.prototype.interfaces_=function(){return[]};k.prototype.getClass=function(){return k};k.toLocationSymbol=function(t){switch(t){case k.EXTERIOR:return"e";case k.BOUNDARY:return"b";case k.INTERIOR:return"i";case k.NONE:return"-"}throw new ve("Unknown location value: "+t)};Bf.INTERIOR.get=function(){return 0};Bf.BOUNDARY.get=function(){return 1};Bf.EXTERIOR.get=function(){return 2};Bf.NONE.get=function(){return-1};Object.defineProperties(k,Bf);var Ot=function(e,t){return e.interfaces_&&e.interfaces_().indexOf(t)>-1},Tr=function(){},jC={LOG_10:{configurable:!0}};Tr.prototype.interfaces_=function(){return[]};Tr.prototype.getClass=function(){return Tr};Tr.log10=function(t){var n=Math.log(t);return Rt.isInfinite(n)||Rt.isNaN(n)?n:n/Tr.LOG_10};Tr.min=function(t,n,r,i){var s=t;return nr?r:t}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var i=arguments[0],s=arguments[1],a=arguments[2];return ia?a:i}};Tr.wrap=function(t,n){return t<0?n- -t%n:t%n};Tr.max=function(){if(arguments.length===3){var t=arguments[0],n=arguments[1],r=arguments[2],i=t;return n>i&&(i=n),r>i&&(i=r),i}else if(arguments.length===4){var s=arguments[0],a=arguments[1],l=arguments[2],c=arguments[3],f=s;return a>f&&(f=a),l>f&&(f=l),c>f&&(f=c),f}};Tr.average=function(t,n){return(t+n)/2};jC.LOG_10.get=function(){return Math.log(10)};Object.defineProperties(Tr,jC);var Ki=function(t){this.str=t};Ki.prototype.append=function(t){this.str+=t};Ki.prototype.setCharAt=function(t,n){this.str=this.str.substr(0,t)+n+this.str.substr(t+1)};Ki.prototype.toString=function(t){return this.str};var Bi=function(t){this.value=t};Bi.prototype.intValue=function(){return this.value};Bi.prototype.compareTo=function(t){return this.valuet?1:0};Bi.isNaN=function(t){return Number.isNaN(t)};var ff=function(){};ff.isWhitespace=function(t){return t<=32&&t>=0||t===127};ff.toUpperCase=function(t){return t.toUpperCase()};var V=function e(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this.init(t)}else if(arguments[0]instanceof e){var n=arguments[0];this.init(n)}else if(typeof arguments[0]=="string"){var r=arguments[0];e.call(this,e.parse(r))}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.init(i,s)}},yi={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};V.prototype.le=function(t){return(this._hi9?(d=!0,v="9"):v="0"+g,l.append(v),r=r.subtract(V.valueOf(g)).multiply(V.TEN),d&&r.selfAdd(V.TEN);var y=!0,x=V.magnitude(r._hi);if(x<0&&Math.abs(x)>=c-f&&(y=!1),!y)break}return n[0]=i,l.toString()};V.prototype.sqr=function(){return this.multiply(this)};V.prototype.doubleValue=function(){return this._hi+this._lo};V.prototype.subtract=function(){if(arguments[0]instanceof V){var t=arguments[0];return this.add(t.negate())}else if(typeof arguments[0]=="number"){var n=arguments[0];return this.add(-n)}};V.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}};V.prototype.isZero=function(){return this._hi===0&&this._lo===0};V.prototype.selfSubtract=function(){if(arguments[0]instanceof V){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}else if(typeof arguments[0]=="number"){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n,0)}};V.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null};V.prototype.min=function(t){return this.le(t)?this:t};V.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof V){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var n=arguments[0];return this.selfDivide(n,0)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1],s=null,a=null,l=null,c=null,f=null,g=null,d=null,v=null;return f=this._hi/r,g=V.SPLIT*f,s=g-f,v=V.SPLIT*r,s=g-s,a=f-s,l=v-r,d=f*r,l=v-l,c=r-l,v=s*l-d+s*c+a*l+a*c,g=(this._hi-d-v+this._lo-f*i)/r,v=f+g,this._hi=v,this._lo=f-v+g,this}};V.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"};V.prototype.divide=function(){if(arguments[0]instanceof V){var t=arguments[0],n=null,r=null,i=null,s=null,a=null,l=null,c=null,f=null;a=this._hi/t._hi,l=V.SPLIT*a,n=l-a,f=V.SPLIT*t._hi,n=l-n,r=a-n,i=f-t._hi,c=a*t._hi,i=f-i,s=t._hi-i,f=n*i-c+n*s+r*i+r*s,l=(this._hi-c-f+this._lo-a*t._lo)/t._hi,f=a+l;var g=f,d=a-f+l;return new V(g,d)}else if(typeof arguments[0]=="number"){var v=arguments[0];return Rt.isNaN(v)?V.createNaN():V.copy(this).selfDivide(v,0)}};V.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo};V.prototype.pow=function(t){if(t===0)return V.valueOf(1);var n=new V(this),r=V.valueOf(1),i=Math.abs(t);if(i>1)for(;i>0;)i%2===1&&r.selfMultiply(n),i/=2,i>0&&(n=n.sqr());else r=n;return t<0?r.reciprocal():r};V.prototype.ceil=function(){if(this.isNaN())return V.NaN;var t=Math.ceil(this._hi),n=0;return t===this._hi&&(n=Math.ceil(this._lo)),new V(t,n)};V.prototype.compareTo=function(t){var n=t;return this._hin._hi?1:this._lon._lo?1:0};V.prototype.rint=function(){if(this.isNaN())return this;var t=this.add(.5);return t.floor()};V.prototype.setValue=function(){if(arguments[0]instanceof V){var t=arguments[0];return this.init(t),this}else if(typeof arguments[0]=="number"){var n=arguments[0];return this.init(n),this}};V.prototype.max=function(t){return this.ge(t)?this:t};V.prototype.sqrt=function(){if(this.isZero())return V.valueOf(0);if(this.isNegative())return V.NaN;var t=1/Math.sqrt(this._hi),n=this._hi*t,r=V.valueOf(n),i=this.subtract(r.sqr()),s=i._hi*(t*.5);return r.add(s)};V.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof V){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var n=arguments[0],r=null,i=null,s=null,a=null,l=null,c=null;return s=this._hi+n,l=s-this._hi,a=s-l,a=n-l+(this._hi-a),c=a+this._lo,r=s+c,i=c+(s-r),this._hi=r+i,this._lo=i+(r-this._hi),this}}else if(arguments.length===2){var f=arguments[0],g=arguments[1],d=null,v=null,y=null,x=null,S=null,C=null,E=null,w=null;S=this._hi+f,y=this._lo+g,E=S-this._hi,w=y-this._lo,C=S-E,x=y-w,C=f-E+(this._hi-C),x=g-w+(this._lo-x),E=C+y,d=S+E,v=E+(S-d),E=x+v;var N=d+E,I=E+(d-N);return this._hi=N,this._lo=I,this}};V.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof V){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}else if(typeof arguments[0]=="number"){var n=arguments[0];return this.selfMultiply(n,0)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1],s=null,a=null,l=null,c=null,f=null,g=null;f=V.SPLIT*this._hi,s=f-this._hi,g=V.SPLIT*r,s=f-s,a=this._hi-s,l=g-r,f=this._hi*r,l=g-l,c=r-l,g=s*l-f+s*c+a*l+a*c+(this._hi*i+this._lo*r);var d=f+g;s=f-d;var v=g+s;return this._hi=d,this._lo=v,this}};V.prototype.selfSqr=function(){return this.selfMultiply(this)};V.prototype.floor=function(){if(this.isNaN())return V.NaN;var t=Math.floor(this._hi),n=0;return t===this._hi&&(n=Math.floor(this._lo)),new V(t,n)};V.prototype.negate=function(){return this.isNaN()?this:new V(-this._hi,-this._lo)};V.prototype.clone=function(){};V.prototype.multiply=function(){if(arguments[0]instanceof V){var t=arguments[0];return t.isNaN()?V.createNaN():V.copy(this).selfMultiply(t)}else if(typeof arguments[0]=="number"){var n=arguments[0];return Rt.isNaN(n)?V.createNaN():V.copy(this).selfMultiply(n,0)}};V.prototype.isNaN=function(){return Rt.isNaN(this._hi)};V.prototype.intValue=function(){return Math.trunc(this._hi)};V.prototype.toString=function(){var t=V.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()};V.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(t!==null)return t;var n=new Array(1).fill(null),r=this.extractSignificantDigits(!0,n),i=n[0]+1,s=r;if(r.charAt(0)===".")s="0"+r;else if(i<0)s="0."+V.stringOfChar("0",-i)+r;else if(r.indexOf(".")===-1){var a=i-r.length,l=V.stringOfChar("0",a);s=r+l+".0"}return this.isNegative()?"-"+s:s};V.prototype.reciprocal=function(){var t=null,n=null,r=null,i=null,s=null,a=null,l=null,c=null;s=1/this._hi,a=V.SPLIT*s,t=a-s,c=V.SPLIT*this._hi,t=a-t,n=s-t,r=c-this._hi,l=s*this._hi,r=c-r,i=this._hi-r,c=t*r-l+t*i+n*r+n*i,a=(1-l-c-s*this._lo)/this._hi;var f=s+a,g=s-f+a;return new V(f,g)};V.prototype.toSciNotation=function(){if(this.isZero())return V.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var n=new Array(1).fill(null),r=this.extractSignificantDigits(!1,n),i=V.SCI_NOT_EXPONENT_CHAR+n[0];if(r.charAt(0)==="0")throw new Error("Found leading zero: "+r);var s="";r.length>1&&(s=r.substring(1));var a=r.charAt(0)+"."+s;return this.isNegative()?"-"+a+i:a+i};V.prototype.abs=function(){return this.isNaN()?V.NaN:this.isNegative()?this.negate():new V(this)};V.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0};V.prototype.lt=function(t){return(this._hit._hi||this._hi===t._hi)&&this._lo>t._lo};V.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0};V.prototype.trunc=function(){return this.isNaN()?V.NaN:this.isPositive()?this.floor():this.ceil()};V.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0};V.prototype.interfaces_=function(){return[ei,ti,Dp]};V.prototype.getClass=function(){return V};V.sqr=function(t){return V.valueOf(t).selfMultiply(t)};V.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return V.parse(t)}else if(typeof arguments[0]=="number"){var n=arguments[0];return new V(n)}};V.sqrt=function(t){return V.valueOf(t).sqrt()};V.parse=function(t){for(var n=0,r=t.length;ff.isWhitespace(t.charAt(n));)n++;var i=!1;if(n=r);){var g=t.charAt(n);if(n++,ff.isDigit(g)){var d=g-"0";a.selfMultiply(V.TEN),a.selfAdd(d),l++;continue}if(g==="."){c=l;continue}if(g==="e"||g==="E"){var v=t.substring(n);try{f=Bi.parseInt(v)}catch(E){throw E instanceof Error?new Error("Invalid exponent "+v+" in string "+t):E}finally{}break}throw new Error("Unexpected character '"+g+"' at position "+n+" in string "+t)}var y=a,x=l-c-f;if(x===0)y=a;else if(x>0){var S=V.TEN.pow(x);y=a.divide(S)}else if(x<0){var C=V.TEN.pow(-x);y=a.multiply(C)}return i?y.negate():y};V.createNaN=function(){return new V(Rt.NaN,Rt.NaN)};V.copy=function(t){return new V(t)};V.magnitude=function(t){var n=Math.abs(t),r=Math.log(n)/Math.log(10),i=Math.trunc(Math.floor(r)),s=Math.pow(10,i);return s*10<=n&&(i+=1),i};V.stringOfChar=function(t,n){for(var r=new Ki,i=0;i0){if(a<=0)return er.signum(l);i=s+a}else if(s<0){if(a>=0)return er.signum(l);i=-s-a}else return er.signum(l);var c=er.DP_SAFE_EPSILON*i;return l>=c||-l>=c?er.signum(l):2};er.signum=function(t){return t>0?1:t<0?-1:0};zC.DP_SAFE_EPSILON.get=function(){return 1e-15};Object.defineProperties(er,zC);var Wt=function(){},Uf={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Uf.X.get=function(){return 0};Uf.Y.get=function(){return 1};Uf.Z.get=function(){return 2};Uf.M.get=function(){return 3};Wt.prototype.setOrdinate=function(t,n,r){};Wt.prototype.size=function(){};Wt.prototype.getOrdinate=function(t,n){};Wt.prototype.getCoordinate=function(){};Wt.prototype.getCoordinateCopy=function(t){};Wt.prototype.getDimension=function(){};Wt.prototype.getX=function(t){};Wt.prototype.clone=function(){};Wt.prototype.expandEnvelope=function(t){};Wt.prototype.copy=function(){};Wt.prototype.getY=function(t){};Wt.prototype.toCoordinateArray=function(){};Wt.prototype.interfaces_=function(){return[Dp]};Wt.prototype.getClass=function(){return Wt};Object.defineProperties(Wt,Uf);var BC=function(){},Hu=function(e){function t(){e.call(this,"Projective point not representable on the Cartesian plane.")}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(BC),wn=function(){};wn.arraycopy=function(t,n,r,i,s){for(var a=0,l=n;lt._minx?this._minx:t._minx,r=this._miny>t._miny?this._miny:t._miny,i=this._maxx=this._minx&&n.getMaxX()<=this._maxx&&n.getMinY()>=this._miny&&n.getMaxY()<=this._maxy}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];return this.isNull()?!1:r>=this._minx&&r<=this._maxx&&i>=this._miny&&i<=this._maxy}};Nt.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Nt){var t=arguments[0];return this.isNull()||t.isNull()?!1:!(t._minx>this._maxx||t._maxxthis._maxy||t._maxythis._maxx||rthis._maxy||ithis._maxx&&(this._maxx=n._maxx),n._minythis._maxy&&(this._maxy=n._maxy))}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.isNull()?(this._minx=r,this._maxx=r,this._miny=i,this._maxy=i):(rthis._maxx&&(this._maxx=r),ithis._maxy&&(this._maxy=i))}};Nt.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),n=this.getHeight();return tn._minx?1:this._minyn._miny?1:this._maxxn._maxx?1:this._maxyn._maxy?1:0};Nt.prototype.translate=function(t,n){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+n,this.getMaxY()+n)};Nt.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"};Nt.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1};Nt.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny};Nt.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),n=this.getHeight();return t>n?t:n};Nt.prototype.expandBy=function(){if(arguments.length===1){var t=arguments[0];this.expandBy(t,t)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];if(this.isNull())return null;this._minx-=n,this._maxx+=n,this._miny-=r,this._maxy+=r,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}};Nt.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Nt){var t=arguments[0];return this.covers(t)}else if(arguments[0]instanceof M){var n=arguments[0];return this.covers(n)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];return this.covers(r,i)}};Nt.prototype.centre=function(){return this.isNull()?null:new M((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)};Nt.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof M){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof Nt){var n=arguments[0];this._minx=n._minx,this._maxx=n._maxx,this._miny=n._miny,this._maxy=n._maxy}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.init(r.x,i.x,r.y,i.y)}else if(arguments.length===4){var s=arguments[0],a=arguments[1],l=arguments[2],c=arguments[3];st._maxx&&(n=this._minx-t._maxx);var r=0;return this._maxyt._maxy&&(r=this._miny-t._maxy),n===0?r:r===0?n:Math.sqrt(n*n+r*r)};Nt.prototype.hashCode=function(){var t=17;return t=37*t+M.hashCode(this._minx),t=37*t+M.hashCode(this._maxx),t=37*t+M.hashCode(this._miny),t=37*t+M.hashCode(this._maxy),t};Nt.prototype.interfaces_=function(){return[ti,ei]};Nt.prototype.getClass=function(){return Nt};Nt.intersects=function(){if(arguments.length===3){var t=arguments[0],n=arguments[1],r=arguments[2];return r.x>=(t.xn.x?t.x:n.x)&&r.y>=(t.yn.y?t.y:n.y)}else if(arguments.length===4){var i=arguments[0],s=arguments[1],a=arguments[2],l=arguments[3],c=Math.min(a.x,l.x),f=Math.max(a.x,l.x),g=Math.min(i.x,s.x),d=Math.max(i.x,s.x);return!(g>f||df)||dr?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}};_e.prototype.isProper=function(){return this.hasIntersection()&&this._isProper};_e.prototype.setPrecisionModel=function(t){this._precisionModel=t};_e.prototype.isInteriorIntersection=function(){var t=this;if(arguments.length===0)return!!(this.isInteriorIntersection(0)||this.isInteriorIntersection(1));if(arguments.length===1){for(var n=arguments[0],r=0;rs?a=i:a=s;else{var l=Math.abs(t.x-n.x),c=Math.abs(t.y-n.y);i>s?a=l:a=c,a===0&&!t.equals(n)&&(a=Math.max(l,c))}return kt.isTrue(!(a===0&&!t.equals(n)),"Bad distance calculation"),a};_e.nonRobustComputeEdgeDistance=function(t,n,r){var i=t.x-n.x,s=t.y-n.y,a=Math.sqrt(i*i+s*s);return kt.isTrue(!(a===0&&!t.equals(n)),"Invalid distance calculation"),a};Nl.DONT_INTERSECT.get=function(){return 0};Nl.DO_INTERSECT.get=function(){return 1};Nl.COLLINEAR.get=function(){return 2};Nl.NO_INTERSECTION.get=function(){return 0};Nl.POINT_INTERSECTION.get=function(){return 1};Nl.COLLINEAR_INTERSECTION.get=function(){return 2};Object.defineProperties(_e,Nl);var Ta=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isInSegmentEnvelopes=function(r){var i=new Nt(this._inputLines[0][0],this._inputLines[0][1]),s=new Nt(this._inputLines[1][0],this._inputLines[1][1]);return i.contains(r)&&s.contains(r)},t.prototype.computeIntersection=function(){if(arguments.length===3){var r=arguments[0],i=arguments[1],s=arguments[2];if(this._isProper=!1,Nt.intersects(i,s,r)&&dt.orientationIndex(i,s,r)===0&&dt.orientationIndex(s,i,r)===0)return this._isProper=!0,(r.equals(i)||r.equals(s))&&(this._isProper=!1),this._result=e.POINT_INTERSECTION,null;this._result=e.NO_INTERSECTION}else return e.prototype.computeIntersection.apply(this,arguments)},t.prototype.normalizeToMinimum=function(r,i,s,a,l){l.x=this.smallestInAbsValue(r.x,i.x,s.x,a.x),l.y=this.smallestInAbsValue(r.y,i.y,s.y,a.y),r.x-=l.x,r.y-=l.y,i.x-=l.x,i.y-=l.y,s.x-=l.x,s.y-=l.y,a.x-=l.x,a.y-=l.y},t.prototype.safeHCoordinateIntersection=function(r,i,s,a){var l=null;try{l=oi.intersection(r,i,s,a)}catch(c){if(c instanceof Hu)l=t.nearestEndpoint(r,i,s,a);else throw c}finally{}return l},t.prototype.intersection=function(r,i,s,a){var l=this.intersectionWithNormalization(r,i,s,a);return this.isInSegmentEnvelopes(l)||(l=new M(t.nearestEndpoint(r,i,s,a))),this._precisionModel!==null&&this._precisionModel.makePrecise(l),l},t.prototype.smallestInAbsValue=function(r,i,s,a){var l=r,c=Math.abs(l);return Math.abs(i)1e-4&&wn.out.println("Distance = "+l.distance(c))},t.prototype.intersectionWithNormalization=function(r,i,s,a){var l=new M(r),c=new M(i),f=new M(s),g=new M(a),d=new M;this.normalizeToEnvCentre(l,c,f,g,d);var v=this.safeHCoordinateIntersection(l,c,f,g);return v.x+=d.x,v.y+=d.y,v},t.prototype.computeCollinearIntersection=function(r,i,s,a){var l=Nt.intersects(r,i,s),c=Nt.intersects(r,i,a),f=Nt.intersects(s,a,r),g=Nt.intersects(s,a,i);return l&&c?(this._intPt[0]=s,this._intPt[1]=a,e.COLLINEAR_INTERSECTION):f&&g?(this._intPt[0]=r,this._intPt[1]=i,e.COLLINEAR_INTERSECTION):l&&f?(this._intPt[0]=s,this._intPt[1]=r,s.equals(r)&&!c&&!g?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):l&&g?(this._intPt[0]=s,this._intPt[1]=i,s.equals(i)&&!c&&!f?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):c&&f?(this._intPt[0]=a,this._intPt[1]=r,a.equals(r)&&!l&&!g?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):c&&g?(this._intPt[0]=a,this._intPt[1]=i,a.equals(i)&&!l&&!f?e.POINT_INTERSECTION:e.COLLINEAR_INTERSECTION):e.NO_INTERSECTION},t.prototype.normalizeToEnvCentre=function(r,i,s,a,l){var c=r.xi.x?r.x:i.x,d=r.y>i.y?r.y:i.y,v=s.xa.x?s.x:a.x,S=s.y>a.y?s.y:a.y,C=c>v?c:v,E=gy?f:y,N=d0&&c>0||l<0&&c<0)return e.NO_INTERSECTION;var f=dt.orientationIndex(s,a,r),g=dt.orientationIndex(s,a,i);if(f>0&&g>0||f<0&&g<0)return e.NO_INTERSECTION;var d=l===0&&c===0&&f===0&&g===0;return d?this.computeCollinearIntersection(r,i,s,a):(l===0||c===0||f===0||g===0?(this._isProper=!1,r.equals2D(s)||r.equals2D(a)?this._intPt[0]=r:i.equals2D(s)||i.equals2D(a)?this._intPt[0]=i:l===0?this._intPt[0]=new M(s):c===0?this._intPt[0]=new M(a):f===0?this._intPt[0]=new M(r):g===0&&(this._intPt[0]=new M(i))):(this._isProper=!0,this._intPt[0]=this.intersection(r,i,s,a)),e.POINT_INTERSECTION)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.nearestEndpoint=function(r,i,s,a){var l=r,c=dt.distancePointLine(r,s,a),f=dt.distancePointLine(i,s,a);return f0?r>0?-s:s:r>0?s:-s;if(n===0||r===0)return i>0?t>0?s:-s:t>0?-s:s;if(n>0?i>0?n<=i||(s=-s,a=t,t=r,r=a,a=n,n=i,i=a):n<=-i?(s=-s,r=-r,i=-i):(a=t,t=-r,r=a,a=n,n=-i,i=a):i>0?-n<=i?(s=-s,t=-t,n=-n):(a=-t,t=r,r=a,a=-n,n=i,i=a):n>=i?(t=-t,n=-n,r=-r,i=-i):(s=-s,a=-t,t=-r,r=a,a=-n,n=-i,i=a),t>0)if(r>0){if(!(t<=r))return s}else return s;else{if(r>0)return-s;if(t>=r)s=-s,t=-t,r=-r;else return-s}for(;;){if(l=Math.floor(r/t),r=r-l*t,i=i-l*n,i<0)return-s;if(i>n)return s;if(t>r+r){if(ni+i)return-s;r=t-r,i=n-i,s=-s}if(i===0)return r===0?0:-s;if(r===0||(l=Math.floor(t/r),t=t-l*r,n=n-l*i,n<0))return s;if(n>i)return-s;if(r>t+t){if(in+n)return s;t=r-t,n=i-n,s=-s}if(n===0)return t===0?0:s;if(t===0)return-s}};var ki=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};ki.prototype.countSegment=function(t,n){if(t.xi&&(r=n.x,i=t.x),this._p.x>=r&&this._p.x<=i&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&n.y<=this._p.y||n.y>this._p.y&&t.y<=this._p.y){var s=t.x-this._p.x,a=t.y-this._p.y,l=n.x-this._p.x,c=n.y-this._p.y,f=cl.signOfDet2x2(s,a,l,c);if(f===0)return this._isPointOnSegment=!0,null;c0&&this._crossingCount++}};ki.prototype.isPointInPolygon=function(){return this.getLocation()!==k.EXTERIOR};ki.prototype.getLocation=function(){return this._isPointOnSegment?k.BOUNDARY:this._crossingCount%2===1?k.INTERIOR:k.EXTERIOR};ki.prototype.isOnSegment=function(){return this._isPointOnSegment};ki.prototype.interfaces_=function(){return[]};ki.prototype.getClass=function(){return ki};ki.locatePointInRing=function(){if(arguments[0]instanceof M&&Ot(arguments[1],Wt)){for(var t=arguments[0],n=arguments[1],r=new ki(t),i=new M,s=new M,a=1;a1||f<0||f>1)&&(s=!0)}}return s?Tr.min(dt.distancePointLine(t,r,i),dt.distancePointLine(n,r,i),dt.distancePointLine(r,t,n),dt.distancePointLine(i,t,n)):0};dt.isPointInRing=function(t,n){return dt.locatePointInRing(t,n)!==k.EXTERIOR};dt.computeLength=function(t){var n=t.size();if(n<=1)return 0;var r=0,i=new M;t.getCoordinate(0,i);for(var s=i.x,a=i.y,l=1;lr.y&&(r=a,i=s)}var l=i;do l=l-1,l<0&&(l=n);while(t[l].equals2D(r)&&l!==i);var c=i;do c=(c+1)%n;while(t[c].equals2D(r)&&c!==i);var f=t[l],g=t[c];if(f.equals2D(r)||g.equals2D(r)||f.equals2D(g))return!1;var d=dt.computeOrientation(f,r,g),v=!1;return d===0?v=f.x>g.x:v=d>0,v};dt.locatePointInRing=function(t,n){return ki.locatePointInRing(t,n)};dt.distancePointLinePerpendicular=function(t,n,r){var i=(r.x-n.x)*(r.x-n.x)+(r.y-n.y)*(r.y-n.y),s=((n.y-t.y)*(r.x-n.x)-(n.x-t.x)*(r.y-n.y))/i;return Math.abs(s)*Math.sqrt(i)};dt.computeOrientation=function(t,n,r){return dt.orientationIndex(t,n,r)};dt.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];if(n.length===0)throw new ve("Line array must contain at least one vertex");for(var r=t.distance(n[0]),i=0;i=1)return a.distance(c);var d=((l.y-a.y)*(c.x-l.x)-(l.x-a.x)*(c.y-l.y))/f;return Math.abs(d)*Math.sqrt(f)}};dt.isOnLine=function(t,n){for(var r=new Ta,i=1;i0};xu.prototype.interfaces_=function(){return[Qr]};xu.prototype.getClass=function(){return xu};var wu=function(){};wu.prototype.isInBoundary=function(t){return t>1};wu.prototype.interfaces_=function(){return[Qr]};wu.prototype.getClass=function(){return wu};var Eu=function(){};Eu.prototype.isInBoundary=function(t){return t===1};Eu.prototype.interfaces_=function(){return[Qr]};Eu.prototype.getClass=function(){return Eu};var Ge=function(){};Ge.prototype.add=function(){};Ge.prototype.addAll=function(){};Ge.prototype.isEmpty=function(){};Ge.prototype.iterator=function(){};Ge.prototype.size=function(){};Ge.prototype.toArray=function(){};Ge.prototype.remove=function(){};function r_(e){this.message=e||""}r_.prototype=new Error;r_.prototype.name="IndexOutOfBoundsException";var Zu=function(){};Zu.prototype.hasNext=function(){};Zu.prototype.next=function(){};Zu.prototype.remove=function(){};var ai=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(){},t.prototype.set=function(){},t.prototype.isEmpty=function(){},t}(Ge);function Wu(e){this.message=e||""}Wu.prototype=new Error;Wu.prototype.name="NoSuchElementException";var lt=function(e){function t(){e.call(this),this.array_=[],arguments[0]instanceof Ge&&this.addAll(arguments[0])}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.ensureCapacity=function(){},t.prototype.interfaces_=function(){return[e,Ge]},t.prototype.add=function(r){return arguments.length===1?this.array_.push(r):this.array_.splice(arguments[0],arguments[1]),!0},t.prototype.clear=function(){this.array_=[]},t.prototype.addAll=function(r){for(var i=this,s=r.iterator();s.hasNext();)i.add(s.next());return!0},t.prototype.set=function(r,i){var s=this.array_[r];return this.array_[r]=i,s},t.prototype.iterator=function(){return new xA(this)},t.prototype.get=function(r){if(r<0||r>=this.size())throw new r_;return this.array_[r]},t.prototype.isEmpty=function(){return this.array_.length===0},t.prototype.size=function(){return this.array_.length},t.prototype.toArray=function(){for(var r=this,i=[],s=0,a=this.array_.length;s=1){var g=this.get(this.size()-1);if(g.equals2D(c))return null}e.prototype.add.call(this,c)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var d=arguments[0],v=arguments[1];return this.add(d,v),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var y=arguments[0],x=arguments[1],S=arguments[2];if(S)for(var C=0;C=0;E--)i.add(y[E],x);return!0}else if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof M){var w=arguments[0],N=arguments[1],I=arguments[2];if(!I){var R=this.size();if(R>0){if(w>0){var A=this.get(w-1);if(A.equals2D(N))return null}if(wJ&&(W=-1);for(var $=Y;$!==J;$+=W)i.add(q[$],Q);return!0}},t.prototype.closeRing=function(){this.size()>0&&this.add(new M(this.get(0)),!1)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},Object.defineProperties(t,n),t}(lt),Vt=function(){},Fp={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Fp.ForwardComparator.get=function(){return hf};Fp.BidirectionalComparator.get=function(){return Su};Fp.coordArrayType.get=function(){return new Array(0).fill(null)};Vt.prototype.interfaces_=function(){return[]};Vt.prototype.getClass=function(){return Vt};Vt.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))};Vt.ptNotInList=function(t,n){for(var r=0;r=t?n:[]};Vt.indexOf=function(t,n){for(var r=0;r0)&&(n=t[r]);return n};Vt.extract=function(t,n,r){n=Tr.clamp(n,0,t.length),r=Tr.clamp(r,-1,t.length);var i=r-n+1;r<0&&(i=0),n>=t.length&&(i=0),ri.length)return 1;if(r.length===0)return 0;var s=Vt.compare(r,i),a=Vt.isEqualReversed(r,i);return a?0:s};Su.prototype.OLDcompare=function(t,n){var r=t,i=n;if(r.lengthi.length)return 1;if(r.length===0)return 0;for(var s=Vt.increasingDirection(r),a=Vt.increasingDirection(i),l=s>0?0:r.length-1,c=a>0?0:r.length-1,f=0;f0)t=t.right;else return t.value}return null};Mn.prototype.put=function(e,t){if(this.root_===null)return this.root_={key:e,value:t,left:null,right:null,parent:null,color:js,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n=this.root_,r,i;do if(r=n,i=e.compareTo(n.key),i<0)n=n.left;else if(i>0)n=n.right;else{var s=n.value;return n.value=t,s}while(n!==null);var a={key:e,left:null,right:null,value:t,parent:r,color:js,getValue:function(){return this.value},getKey:function(){return this.key}};return i<0?r.left=a:r.right=a,this.fixAfterInsertion(a),this.size_++,null};Mn.prototype.fixAfterInsertion=function(e){var t=this;for(e.color=jo;e!=null&&e!==this.root_&&e.parent.color===jo;)if(ce(e)===um(ce(ce(e)))){var n=Ow(ce(ce(e)));Tw(n)===jo?(Ms(ce(e),js),Ms(n,js),Ms(ce(ce(e)),jo),e=ce(ce(e))):(e===Ow(ce(e))&&(e=ce(e),t.rotateLeft(e)),Ms(ce(e),js),Ms(ce(ce(e)),jo),t.rotateRight(ce(ce(e))))}else{var r=um(ce(ce(e)));Tw(r)===jo?(Ms(ce(e),js),Ms(r,js),Ms(ce(ce(e)),jo),e=ce(ce(e))):(e===um(ce(e))&&(e=ce(e),t.rotateRight(e)),Ms(ce(e),js),Ms(ce(ce(e)),jo),t.rotateLeft(ce(ce(e))))}this.root_.color=js};Mn.prototype.values=function(){var e=new lt,t=this.getFirstEntry();if(t!==null)for(e.add(t.value);(t=Mn.successor(t))!==null;)e.add(t.value);return e};Mn.prototype.entrySet=function(){var e=new i_,t=this.getFirstEntry();if(t!==null)for(e.add(t);(t=Mn.successor(t))!==null;)e.add(t);return e};Mn.prototype.rotateLeft=function(e){if(e!=null){var t=e.right;e.right=t.left,t.left!=null&&(t.left.parent=e),t.parent=e.parent,e.parent===null?this.root_=t:e.parent.left===e?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t}};Mn.prototype.rotateRight=function(e){if(e!=null){var t=e.left;e.left=t.right,t.right!=null&&(t.right.parent=e),t.parent=e.parent,e.parent===null?this.root_=t:e.parent.right===e?e.parent.right=t:e.parent.left=t,t.right=e,e.parent=t}};Mn.prototype.getFirstEntry=function(){var e=this.root_;if(e!=null)for(;e.left!=null;)e=e.left;return e};Mn.successor=function(e){if(e===null)return null;if(e.right!==null){for(var t=e.right;t.left!==null;)t=t.left;return t}else{for(var n=e.parent,r=e;n!==null&&r===n.right;)r=n,n=n.parent;return n}};Mn.prototype.size=function(){return this.size_};var df=function(){};df.prototype.interfaces_=function(){return[]};df.prototype.getClass=function(){return df};function VC(){}VC.prototype=new jp;function Ui(){this.array_=[],arguments[0]instanceof Ge&&this.addAll(arguments[0])}Ui.prototype=new VC;Ui.prototype.contains=function(e){for(var t=this,n=0,r=this.array_.length;n=0;){var l=s.substring(0,a);i.add(l),s=s.substring(a+r),a=s.indexOf(n)}s.length>0&&i.add(s);for(var c=new Array(i.size()).fill(null),f=0;f0)for(var a=s;a0&&i.append(" ");for(var a=0;a0&&i.append(","),i.append(Yr.toString(t.getOrdinate(s,a)))}return i.append(")"),i.toString()}};Me.ensureValidRing=function(t,n){var r=n.size();if(r===0)return n;if(r<=3)return Me.createClosedRing(t,n,4);var i=n.getOrdinate(0,Wt.X)===n.getOrdinate(r-1,Wt.X)&&n.getOrdinate(0,Wt.Y)===n.getOrdinate(r-1,Wt.Y);return i?n:Me.createClosedRing(t,n,r+1)};Me.createClosedRing=function(t,n,r){var i=t.create(r,n.getDimension()),s=n.size();Me.copy(n,0,i,0,s);for(var a=s;a0&&Me.reverse(i._points),null}},t.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},t.prototype.getBoundaryDimension=function(){return this.isClosed()?Qt.FALSE:0},t.prototype.isClosed=function(){return this.isEmpty()?!1:this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},t.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},t.prototype.getDimension=function(){return 1},t.prototype.getLength=function(){return dt.computeLength(this._points)},t.prototype.getNumPoints=function(){return this._points.size()},t.prototype.reverse=function(){var i=this._points.copy();Me.reverse(i);var s=this.getFactory().createLineString(i);return s},t.prototype.compareToSameClass=function(){var i=this;if(arguments.length===1){for(var s=arguments[0],a=s,l=0,c=0;l= 2)");this._points=i},t.prototype.isCoordinate=function(i){for(var s=this,a=0;a=1&&this.getCoordinateSequence().size()= 4)")},t.prototype.getGeometryType=function(){return"LinearRing"},t.prototype.copy=function(){return new t(this._points.copy(),this._factory)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(t,n),t}(Pe),ps=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={serialVersionUID:{configurable:!0}};return t.prototype.getSortIndex=function(){return Tt.SORTINDEX_MULTIPOLYGON},t.prototype.equalsExact=function(){if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.isEquivalentClass(i)?e.prototype.equalsExact.call(this,i,s):!1}else return e.prototype.equalsExact.apply(this,arguments)},t.prototype.getBoundaryDimension=function(){return 1},t.prototype.getDimension=function(){return 2},t.prototype.reverse=function(){for(var i=this,s=this._geometries.length,a=new Array(s).fill(null),l=0;l0?n.createPoint(r[0]):n.createPoint():t};mf.prototype.interfaces_=function(){return[Jr.GeometryEditorOperation]};mf.prototype.getClass=function(){return mf};var vf=function(){};vf.prototype.edit=function(t,n){return t instanceof ys?n.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Pe?n.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof gr?n.createPoint(this.edit(t.getCoordinateSequence(),t)):t};vf.prototype.interfaces_=function(){return[Jr.GeometryEditorOperation]};vf.prototype.getClass=function(){return vf};var Oe=function(){var t=this;if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var n=arguments[0];this._coordinates=new Array(n).fill(null);for(var r=0;r0){var n=new Ki(17*this._coordinates.length);n.append("("),n.append(this._coordinates[0]);for(var r=1;r3&&(i=3),i<2?new Oe(r):new Oe(r,i)}};_s.prototype.interfaces_=function(){return[yu,ei]};_s.prototype.getClass=function(){return _s};_s.instance=function(){return _s.instanceObject};o_.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00};o_.instanceObject.get=function(){return new _s};Object.defineProperties(_s,o_);var qC=function(e){function t(){e.call(this),this.map_=new Map}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.get=function(r){return this.map_.get(r)||null},t.prototype.put=function(r,i){return this.map_.set(r,i),i},t.prototype.values=function(){for(var r=new lt,i=this.map_.values(),s=i.next();!s.done;)r.add(s.value),s=i.next();return r},t.prototype.entrySet=function(){var r=new i_;return this.map_.entries().forEach(function(i){return r.add(i)}),r},t.prototype.size=function(){return this.map_.size()},t}(bl),$t=function e(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=e.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof Gi){var t=arguments[0];this._modelType=t,t===e.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var n=arguments[0];this._modelType=e.FIXED,this.setScale(n)}else if(arguments[0]instanceof e){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}}},a_={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};$t.prototype.equals=function(t){if(!(t instanceof $t))return!1;var n=t;return this._modelType===n._modelType&&this._scale===n._scale};$t.prototype.compareTo=function(t){var n=t,r=this.getMaximumSignificantDigits(),i=n.getMaximumSignificantDigits();return new Bi(r).compareTo(new Bi(i))};$t.prototype.getScale=function(){return this._scale};$t.prototype.isFloating=function(){return this._modelType===$t.FLOATING||this._modelType===$t.FLOATING_SINGLE};$t.prototype.getType=function(){return this._modelType};$t.prototype.toString=function(){var t="UNKNOWN";return this._modelType===$t.FLOATING?t="Floating":this._modelType===$t.FLOATING_SINGLE?t="Floating-Single":this._modelType===$t.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t};$t.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];if(Rt.isNaN(t))return t;if(this._modelType===$t.FLOATING_SINGLE){var n=t;return n}return this._modelType===$t.FIXED?Math.round(t*this._scale)/this._scale:t}else if(arguments[0]instanceof M){var r=arguments[0];if(this._modelType===$t.FLOATING)return null;r.x=this.makePrecise(r.x),r.y=this.makePrecise(r.y)}};$t.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===$t.FLOATING?t=16:this._modelType===$t.FLOATING_SINGLE?t=6:this._modelType===$t.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t};$t.prototype.setScale=function(t){this._scale=Math.abs(t)};$t.prototype.interfaces_=function(){return[ei,ti]};$t.prototype.getClass=function(){return $t};$t.mostPrecise=function(t,n){return t.compareTo(n)>=0?t:n};a_.serialVersionUID.get=function(){return 7777263578777804e3};a_.maximumPreciseValue.get=function(){return 9007199254740992};Object.defineProperties($t,a_);var Gi=function e(t){this._name=t||null,e.nameToTypeMap.put(t,this)},l_={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Gi.prototype.readResolve=function(){return Gi.nameToTypeMap.get(this._name)};Gi.prototype.toString=function(){return this._name};Gi.prototype.interfaces_=function(){return[ei]};Gi.prototype.getClass=function(){return Gi};l_.serialVersionUID.get=function(){return-552860263173159e4};l_.nameToTypeMap.get=function(){return new qC};Object.defineProperties(Gi,l_);$t.Type=Gi;$t.FIXED=new Gi("FIXED");$t.FLOATING=new Gi("FLOATING");$t.FLOATING_SINGLE=new Gi("FLOATING SINGLE");var Ut=function e(){this._precisionModel=new $t,this._SRID=0,this._coordinateSequenceFactory=e.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Ot(arguments[0],yu)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof $t&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},HC={serialVersionUID:{configurable:!0}};Ut.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new M(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new M(t.getMinX(),t.getMinY()),new M(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new M(t.getMinX(),t.getMinY()),new M(t.getMinX(),t.getMaxY()),new M(t.getMaxX(),t.getMaxY()),new M(t.getMaxX(),t.getMinY()),new M(t.getMinX(),t.getMinY())]),null)};Ut.prototype.createLineString=function(t){if(t){if(t instanceof Array)return new Pe(this.getCoordinateSequenceFactory().create(t),this);if(Ot(t,Wt))return new Pe(t,this)}else return new Pe(this.getCoordinateSequenceFactory().create([]),this)};Ut.prototype.createMultiLineString=function(){if(arguments.length===0)return new pa(null,this);if(arguments.length===1){var t=arguments[0];return new pa(t,this)}};Ut.prototype.buildGeometry=function(t){for(var n=null,r=!1,i=!1,s=t.iterator();s.hasNext();){var a=s.next(),l=a.getClass();n===null&&(n=l),l!==n&&(r=!0),a.isGeometryCollectionOrDerived()&&(i=!0)}if(n===null)return this.createGeometryCollection();if(r||i)return this.createGeometryCollection(Ut.toGeometryArray(t));var c=t.iterator().next(),f=t.size()>1;if(f){if(c instanceof Ye)return this.createMultiPolygon(Ut.toPolygonArray(t));if(c instanceof Pe)return this.createMultiLineString(Ut.toLineStringArray(t));if(c instanceof gr)return this.createMultiPoint(Ut.toPointArray(t));kt.shouldNeverReachHere("Unhandled class: "+c.getClass().getName())}return c};Ut.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)};Ut.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof M){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}else if(Ot(arguments[0],Wt)){var n=arguments[0];return new gr(n,this)}}};Ut.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory};Ut.prototype.createPolygon=function(){if(arguments.length===0)return new Ye(null,null,this);if(arguments.length===1){if(Ot(arguments[0],Wt)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}else if(arguments[0]instanceof Array){var n=arguments[0];return this.createPolygon(this.createLinearRing(n))}else if(arguments[0]instanceof ys){var r=arguments[0];return this.createPolygon(r,null)}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];return new Ye(i,s,this)}};Ut.prototype.getSRID=function(){return this._SRID};Ut.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Hn(null,this);if(arguments.length===1){var t=arguments[0];return new Hn(t,this)}};Ut.prototype.createGeometry=function(t){var n=new Jr(this);return n.edit(t,{edit:function(){if(arguments.length===2){var r=arguments[0];return this._coordinateSequenceFactory.create(r)}}})};Ut.prototype.getPrecisionModel=function(){return this._precisionModel};Ut.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(t!==null?this.getCoordinateSequenceFactory().create(t):null)}else if(Ot(arguments[0],Wt)){var n=arguments[0];return new ys(n,this)}}};Ut.prototype.createMultiPolygon=function(){if(arguments.length===0)return new ps(null,this);if(arguments.length===1){var t=arguments[0];return new ps(t,this)}};Ut.prototype.createMultiPoint=function(){var t=this;if(arguments.length===0)return new Cu(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new Cu(n,this)}else if(arguments[0]instanceof Array){var r=arguments[0];return this.createMultiPoint(r!==null?this.getCoordinateSequenceFactory().create(r):null)}else if(Ot(arguments[0],Wt)){var i=arguments[0];if(i===null)return this.createMultiPoint(new Array(0).fill(null));for(var s=new Array(i.size()).fill(null),a=0;a=this.size())throw new Error;return this.array_[e]};Qi.prototype.push=function(e){return this.array_.push(e),e};Qi.prototype.pop=function(e){if(this.array_.length===0)throw new Gp;return this.array_.pop()};Qi.prototype.peek=function(){if(this.array_.length===0)throw new Gp;return this.array_[this.array_.length-1]};Qi.prototype.empty=function(){return this.array_.length===0};Qi.prototype.isEmpty=function(){return this.empty()};Qi.prototype.search=function(e){return this.array_.indexOf(e)};Qi.prototype.size=function(){return this.array_.length};Qi.prototype.toArray=function(){for(var e=this,t=[],n=0,r=this.array_.length;n0&&this._minIndexthis._minCoord.y&&r.y>this._minCoord.y&&i===dt.CLOCKWISE)&&(s=!0),s&&(this._minIndex=this._minIndex-1)};qi.prototype.getRightmostSideOfSegment=function(t,n){var r=t.getEdge(),i=r.getCoordinates();if(n<0||n+1>=i.length||i[n].y===i[n+1].y)return-1;var s=rt.LEFT;return i[n].yn._minCoord.x)&&(n._minDe=t,n._minIndex=i,n._minCoord=r[i])};qi.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode(),n=t.getEdges();this._minDe=n.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)};qi.prototype.findEdge=function(t){for(var n=this,r=t.iterator();r.hasNext();){var i=r.next();i.isForward()&&n.checkForRightmostCoordinate(i)}kt.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe;var s=this.getRightmostSide(this._minDe,this._minIndex);s===rt.LEFT&&(this._orientedDe=this._minDe.getSym())};qi.prototype.interfaces_=function(){return[]};qi.prototype.getClass=function(){return qi};var Xs=function(e){function t(n,r){e.call(this,t.msgWithCoord(n,r)),this.pt=r?new M(r):null,this.name="TopologyException"}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getCoordinate=function(){return this.pt},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.msgWithCoord=function(r,i){return i?r:r+" [ "+i+" ]"},t}(Zs),qp=function(){this.array_=[]};qp.prototype.addLast=function(t){this.array_.push(t)};qp.prototype.removeFirst=function(){return this.array_.shift()};qp.prototype.isEmpty=function(){return this.array_.length===0};var Zn=function(){this._finder=null,this._dirEdgeList=new lt,this._nodes=new lt,this._rightMostCoord=null,this._env=null,this._finder=new qi};Zn.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var n=t.next();n.setVisited(!1)}};Zn.prototype.getRightmostCoordinate=function(){return this._rightMostCoord};Zn.prototype.computeNodeDepth=function(t){for(var n=this,r=null,i=t.getEdges().iterator();i.hasNext();){var s=i.next();if(s.isVisited()||s.getSym().isVisited()){r=s;break}}if(r===null)throw new Xs("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(r);for(var a=t.getEdges().iterator();a.hasNext();){var l=a.next();l.setVisited(!0),n.copySymDepths(l)}};Zn.prototype.computeDepth=function(t){this.clearVisitedEdges();var n=this._finder.getEdge();n.setEdgeDepths(rt.RIGHT,t),this.copySymDepths(n),this.computeDepths(n)};Zn.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()};Zn.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var n=t.next();n.getDepth(rt.RIGHT)>=1&&n.getDepth(rt.LEFT)<=0&&!n.isInteriorAreaEdge()&&n.setInResult(!0)}};Zn.prototype.computeDepths=function(t){var n=this,r=new i_,i=new qp,s=t.getNode();for(i.addLast(s),r.add(s),t.setVisited(!0);!i.isEmpty();){var a=i.removeFirst();r.add(a),n.computeNodeDepth(a);for(var l=a.getEdges().iterator();l.hasNext();){var c=l.next(),f=c.getSym();if(!f.isVisited()){var g=f.getNode();r.contains(g)||(i.addLast(g),r.add(g))}}}};Zn.prototype.compareTo=function(t){var n=t;return this._rightMostCoord.xn._rightMostCoord.x?1:0};Zn.prototype.getEnvelope=function(){if(this._env===null){for(var t=new Nt,n=this._dirEdgeList.iterator();n.hasNext();)for(var r=n.next(),i=r.getEdge().getCoordinates(),s=0;sthis.location.length){var r=new Array(3).fill(null);r[rt.ON]=this.location[rt.ON],r[rt.LEFT]=k.NONE,r[rt.RIGHT]=k.NONE,this.location=r}for(var i=0;i1&&t.append(k.toLocationSymbol(this.location[rt.LEFT])),t.append(k.toLocationSymbol(this.location[rt.ON])),this.location.length>1&&t.append(k.toLocationSymbol(this.location[rt.RIGHT])),t.toString()};fe.prototype.setLocations=function(t,n,r){this.location[rt.ON]=t,this.location[rt.LEFT]=n,this.location[rt.RIGHT]=r};fe.prototype.get=function(t){return t1};fe.prototype.isAnyNull=function(){for(var t=this,n=0;nt._maxNodeDegree&&(t._maxNodeDegree=i),n=t.getNext(n)}while(n!==this._startDe);this._maxNodeDegree*=2};ze.prototype.addPoints=function(t,n,r){var i=this,s=t.getCoordinates();if(n){var a=1;r&&(a=0);for(var l=a;l=0;f--)i._pts.add(s[f])}};ze.prototype.isHole=function(){return this._isHole};ze.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)};ze.prototype.containsPoint=function(t){var n=this.getLinearRing(),r=n.getEnvelopeInternal();if(!r.contains(t)||!dt.isPointInRing(t,n.getCoordinates()))return!1;for(var i=this._holes.iterator();i.hasNext();){var s=i.next();if(s.containsPoint(t))return!1}return!0};ze.prototype.addHole=function(t){this._holes.add(t)};ze.prototype.isShell=function(){return this._shell===null};ze.prototype.getLabel=function(){return this._label};ze.prototype.getEdges=function(){return this._edges};ze.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree};ze.prototype.getShell=function(){return this._shell};ze.prototype.mergeLabel=function(){if(arguments.length===1){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=n.getLocation(r,rt.RIGHT);if(i===k.NONE)return null;if(this._label.getLocation(r)===k.NONE)return this._label.setLocation(r,i),null}};ze.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)};ze.prototype.toPolygon=function(t){for(var n=this,r=new Array(this._holes.size()).fill(null),i=0;i=2,"found partial label"),this.computeIM(t)};Or.prototype.isInResult=function(){return this._isInResult};Or.prototype.isVisited=function(){return this._isVisited};Or.prototype.interfaces_=function(){return[]};Or.prototype.getClass=function(){return Or};var Hp=function(e){function t(){e.call(this),this._coord=null,this._edges=null;var n=arguments[0],r=arguments[1];this._coord=n,this._edges=r,this._label=new ie(0,k.NONE)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isIncidentEdgeInResult=function(){for(var r=this.getEdges().getEdges().iterator();r.hasNext();){var i=r.next();if(i.getEdge().isInResult())return!0}return!1},t.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},t.prototype.getCoordinate=function(){return this._coord},t.prototype.print=function(r){r.println("node "+this._coord+" lbl: "+this._label)},t.prototype.computeIM=function(r){},t.prototype.computeMergedLocation=function(r,i){var s=k.NONE;if(s=this._label.getLocation(i),!r.isNull(i)){var a=r.getLocation(i);s!==k.BOUNDARY&&(s=a)}return s},t.prototype.setLabel=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];this._label===null?this._label=new ie(r,i):this._label.setLocation(r,i)}else return e.prototype.setLabel.apply(this,arguments)},t.prototype.getEdges=function(){return this._edges},t.prototype.mergeLabel=function(){var r=this;if(arguments[0]instanceof t){var i=arguments[0];this.mergeLabel(i._label)}else if(arguments[0]instanceof ie)for(var s=arguments[0],a=0;a<2;a++){var l=r.computeMergedLocation(s,a),c=r._label.getLocation(a);c===k.NONE&&r._label.setLocation(a,l)}},t.prototype.add=function(r){this._edges.insert(r),r.setNode(this)},t.prototype.setLabelBoundary=function(r){if(this._label===null)return null;var i=k.NONE;this._label!==null&&(i=this._label.getLocation(r));var s=null;switch(i){case k.BOUNDARY:s=k.INTERIOR;break;case k.INTERIOR:s=k.BOUNDARY;break;default:s=k.BOUNDARY;break}this._label.setLocation(r,s)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Or),Hi=function(){this.nodeMap=new Mn,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};Hi.prototype.find=function(t){return this.nodeMap.get(t)};Hi.prototype.addNode=function(){if(arguments[0]instanceof M){var t=arguments[0],n=this.nodeMap.get(t);return n===null&&(n=this.nodeFact.createNode(t),this.nodeMap.put(t,n)),n}else if(arguments[0]instanceof Hp){var r=arguments[0],i=this.nodeMap.get(r.getCoordinate());return i===null?(this.nodeMap.put(r.getCoordinate(),r),r):(i.mergeLabel(r),i)}};Hi.prototype.print=function(t){for(var n=this.iterator();n.hasNext();){var r=n.next();r.print(t)}};Hi.prototype.iterator=function(){return this.nodeMap.values().iterator()};Hi.prototype.values=function(){return this.nodeMap.values()};Hi.prototype.getBoundaryNodes=function(t){for(var n=new lt,r=this.iterator();r.hasNext();){var i=r.next();i.getLabel().getLocation(t)===k.BOUNDARY&&n.add(i)}return n};Hi.prototype.add=function(t){var n=t.getCoordinate(),r=this.addNode(n);r.add(t)};Hi.prototype.interfaces_=function(){return[]};Hi.prototype.getClass=function(){return Hi};var oe=function(){},qf={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};oe.prototype.interfaces_=function(){return[]};oe.prototype.getClass=function(){return oe};oe.isNorthern=function(t){return t===oe.NE||t===oe.NW};oe.isOpposite=function(t,n){if(t===n)return!1;var r=(t-n+4)%4;return r===2};oe.commonHalfPlane=function(t,n){if(t===n)return t;var r=(t-n+4)%4;if(r===2)return-1;var i=tn?t:n;return i===0&&s===3?3:i};oe.isInHalfPlane=function(t,n){return n===oe.SE?t===oe.SE||t===oe.SW:t===n||t===n+1};oe.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],n=arguments[1];if(t===0&&n===0)throw new ve("Cannot compute the quadrant for point ( "+t+", "+n+" )");return t>=0?n>=0?oe.NE:oe.SE:n>=0?oe.NW:oe.SW}else if(arguments[0]instanceof M&&arguments[1]instanceof M){var r=arguments[0],i=arguments[1];if(i.x===r.x&&i.y===r.y)throw new ve("Cannot compute the quadrant for two identical points "+r);return i.x>=r.x?i.y>=r.y?oe.NE:oe.SE:i.y>=r.y?oe.NW:oe.SW}};qf.NE.get=function(){return 0};qf.NW.get=function(){return 1};qf.SW.get=function(){return 2};qf.SE.get=function(){return 3};Object.defineProperties(oe,qf);var An=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var t=arguments[0];this._edge=t}else if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2],s=null;this._edge=n,this.init(r,i),this._label=s}else if(arguments.length===4){var a=arguments[0],l=arguments[1],c=arguments[2],f=arguments[3];this._edge=a,this.init(l,c),this._label=f}};An.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){l.linkDirectedEdgesForMinimalEdgeRings();var c=l.buildMinimalRings(),f=i.findShell(c);f!==null?(i.placePolygonHoles(f,c),n.add(f)):r.addAll(c)}else s.add(l)}return s};mr.prototype.containsPoint=function(t){for(var n=this._shellList.iterator();n.hasNext();){var r=n.next();if(r.containsPoint(t))return!0}return!1};mr.prototype.buildMaximalEdgeRings=function(t){for(var n=this,r=new lt,i=t.iterator();i.hasNext();){var s=i.next();if(s.isInResult()&&s.getLabel().isArea()&&s.getEdgeRing()===null){var a=new OA(s,n._geometryFactory);r.add(a),a.setInResult()}}return r};mr.prototype.placePolygonHoles=function(t,n){for(var r=n.iterator();r.hasNext();){var i=r.next();i.isHole()&&i.setShell(t)}};mr.prototype.getPolygons=function(){var t=this.computePolygons(this._shellList);return t};mr.prototype.findEdgeRingContaining=function(t,n){for(var r=t.getLinearRing(),i=r.getEnvelopeInternal(),s=r.getCoordinateN(0),a=null,l=null,c=n.iterator();c.hasNext();){var f=c.next(),g=f.getLinearRing(),d=g.getEnvelopeInternal();a!==null&&(l=a.getLinearRing().getEnvelopeInternal());var v=!1;d.contains(i)&&dt.isPointInRing(s,g.getCoordinates())&&(v=!0),v&&(a===null||l.contains(d))&&(a=f)}return a};mr.prototype.findShell=function(t){for(var n=0,r=null,i=t.iterator();i.hasNext();){var s=i.next();s.isHole()||(r=s,n++)}return kt.isTrue(n<=1,"found two shells in MinimalEdgeRing list"),r};mr.prototype.add=function(){if(arguments.length===1){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(arguments.length===2){var n=arguments[0],r=arguments[1];xe.linkResultDirectedEdges(r);var i=this.buildMaximalEdgeRings(n),s=new lt,a=this.buildMinimalEdgeRings(i,this._shellList,s);this.sortShellsAndHoles(a,this._shellList,s),this.placeFreeHoles(this._shellList,s)}};mr.prototype.interfaces_=function(){return[]};mr.prototype.getClass=function(){return mr};var Pu=function(){};Pu.prototype.getBounds=function(){};Pu.prototype.interfaces_=function(){return[]};Pu.prototype.getClass=function(){return Pu};var fi=function(){this._bounds=null,this._item=null;var t=arguments[0],n=arguments[1];this._bounds=t,this._item=n};fi.prototype.getItem=function(){return this._item};fi.prototype.getBounds=function(){return this._bounds};fi.prototype.interfaces_=function(){return[Pu,ei]};fi.prototype.getClass=function(){return fi};var Ys=function(){this._size=null,this._items=null,this._size=0,this._items=new lt,this._items.add(null)};Ys.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t};Ys.prototype.size=function(){return this._size};Ys.prototype.reorder=function(t){for(var n=this,r=null,i=this._items.get(t);t*2<=this._size&&(r=t*2,r!==n._size&&n._items.get(r+1).compareTo(n._items.get(r))<0&&r++,n._items.get(r).compareTo(i)<0);t=r)n._items.set(t,n._items.get(r));this._items.set(t,i)};Ys.prototype.clear=function(){this._size=0,this._items.clear()};Ys.prototype.isEmpty=function(){return this._size===0};Ys.prototype.add=function(t){var n=this;this._items.add(null),this._size+=1;var r=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(r/2)))<0;r/=2)n._items.set(r,n._items.get(Math.trunc(r/2)));this._items.set(r,t)};Ys.prototype.interfaces_=function(){return[]};Ys.prototype.getClass=function(){return Ys};var wo=function(){};wo.prototype.visitItem=function(t){};wo.prototype.interfaces_=function(){return[]};wo.prototype.getClass=function(){return wo};var fl=function(){};fl.prototype.insert=function(t,n){};fl.prototype.remove=function(t,n){};fl.prototype.query=function(){};fl.prototype.interfaces_=function(){return[]};fl.prototype.getClass=function(){return fl};var Ze=function(){if(this._childBoundables=new lt,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this._level=t}}},WC={serialVersionUID:{configurable:!0}};Ze.prototype.getLevel=function(){return this._level};Ze.prototype.size=function(){return this._childBoundables.size()};Ze.prototype.getChildBoundables=function(){return this._childBoundables};Ze.prototype.addChildBoundable=function(t){kt.isTrue(this._bounds===null),this._childBoundables.add(t)};Ze.prototype.isEmpty=function(){return this._childBoundables.isEmpty()};Ze.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds};Ze.prototype.interfaces_=function(){return[Pu,ei]};Ze.prototype.getClass=function(){return Ze};WC.serialVersionUID.get=function(){return 6493722185909574e3};Object.defineProperties(Ze,WC);var hi=function(){};hi.reverseOrder=function(){return{compare:function(n,r){return r.compareTo(n)}}};hi.min=function(t){return hi.sort(t),t.get(0)};hi.sort=function(t,n){var r=t.toArray();n?ua.sort(r,n):ua.sort(r);for(var i=t.iterator(),s=0,a=r.length;sFe.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,n),null):(this.expand(this._boundable2,this._boundable1,t,n),null);if(r)return this.expand(this._boundable1,this._boundable2,t,n),null;if(i)return this.expand(this._boundable2,this._boundable1,t,n),null;throw new ve("neither boundable is composite")};Fe.prototype.isLeaves=function(){return!(Fe.isComposite(this._boundable1)||Fe.isComposite(this._boundable2))};Fe.prototype.compareTo=function(t){var n=t;return this._distancen._distance?1:0};Fe.prototype.expand=function(t,n,r,i){for(var s=this,a=t.getChildBoundables(),l=a.iterator();l.hasNext();){var c=l.next(),f=new Fe(c,n,s._itemDistance);f.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},Zp={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};an.prototype.getNodeCapacity=function(){return this._nodeCapacity};an.prototype.lastNode=function(t){return t.get(t.size()-1)};an.prototype.size=function(){var t=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var n=arguments[0],r=0,i=n.getChildBoundables().iterator();i.hasNext();){var s=i.next();s instanceof Ze?r+=t.size(s):s instanceof fi&&(r+=1)}return r}};an.prototype.removeItem=function(t,n){for(var r=null,i=t.getChildBoundables().iterator();i.hasNext();){var s=i.next();s instanceof fi&&s.getItem()===n&&(r=s)}return r!==null?(t.getChildBoundables().remove(r),!0):!1};an.prototype.itemsTree=function(){var t=this;if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new lt:n}else if(arguments.length===1){for(var r=arguments[0],i=new lt,s=r.getChildBoundables().iterator();s.hasNext();){var a=s.next();if(a instanceof Ze){var l=t.itemsTree(a);l!==null&&i.add(l)}else a instanceof fi?i.add(a.getItem()):kt.shouldNeverReachHere()}return i.size()<=0?null:i}};an.prototype.insert=function(t,n){kt.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new fi(t,n))};an.prototype.boundablesAtLevel=function(){var t=this;if(arguments.length===1){var n=arguments[0],r=new lt;return this.boundablesAtLevel(n,this._root,r),r}else if(arguments.length===3){var i=arguments[0],s=arguments[1],a=arguments[2];if(kt.isTrue(i>-2),s.getLevel()===i)return a.add(s),null;for(var l=s.getChildBoundables().iterator();l.hasNext();){var c=l.next();c instanceof Ze?t.boundablesAtLevel(i,c,a):(kt.isTrue(c instanceof fi),i===-1&&a.add(c))}return null}};an.prototype.query=function(){var t=this;if(arguments.length===1){var n=arguments[0];this.build();var r=new lt;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,r),r}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),i)&&this.query(i,this._root,s)}else if(arguments.length===3){if(Ot(arguments[2],wo)&&arguments[0]instanceof Object&&arguments[1]instanceof Ze)for(var a=arguments[0],l=arguments[1],c=arguments[2],f=l.getChildBoundables(),g=0;gr&&(r=a)}}return r+1}};an.prototype.createParentBoundables=function(t,n){var r=this;kt.isTrue(!t.isEmpty());var i=new lt;i.add(this.createNode(n));var s=new lt(t);hi.sort(s,this.getComparator());for(var a=s.iterator();a.hasNext();){var l=a.next();r.lastNode(i).getChildBoundables().size()===r.getNodeCapacity()&&i.add(r.createNode(n)),r.lastNode(i).addChildBoundable(l)}return i};an.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()};an.prototype.interfaces_=function(){return[ei]};an.prototype.getClass=function(){return an};an.compareDoubles=function(t,n){return t>n?1:t0);for(var l=new lt,c=0;c0;){var S=x.poll(),C=S.getDistance();if(C>=v)break;S.isLeaves()?(v=C,y=S):S.expandToQueue(x,v)}return[y.getBoundable(0).getItem(),y.getBoundable(1).getItem()]}}else if(arguments.length===3){var E=arguments[0],w=arguments[1],N=arguments[2],I=new fi(E,w),R=new Fe(this.getRoot(),I,N);return this.nearestNeighbour(R)[0]}},t.prototype.interfaces_=function(){return[fl,ei]},t.prototype.getClass=function(){return t},t.centreX=function(i){return t.avg(i.getMinX(),i.getMaxX())},t.avg=function(i,s){return(i+s)/2},t.centreY=function(i){return t.avg(i.getMinY(),i.getMaxY())},n.STRtreeNode.get=function(){return Rw},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[vu]},compare:function(r,i){return e.compareDoubles(t.centreX(r.getBounds()),t.centreX(i.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[vu]},compare:function(r,i){return e.compareDoubles(t.centreY(r.getBounds()),t.centreY(i.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[e.IntersectsOp]},intersects:function(r,i){return r.intersects(i)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(t,n),t}(an),Rw=function(e){function t(){var n=arguments[0];e.call(this,n)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.computeBounds=function(){for(var r=null,i=this.getChildBoundables().iterator();i.hasNext();){var s=i.next();r===null?r=new Nt(s.getBounds()):r.expandToInclude(s.getBounds())}return r},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Ze),Jn=function(){};Jn.prototype.interfaces_=function(){return[]};Jn.prototype.getClass=function(){return Jn};Jn.relativeSign=function(t,n){return tn?1:0};Jn.compare=function(t,n,r){if(n.equals2D(r))return 0;var i=Jn.relativeSign(n.x,r.x),s=Jn.relativeSign(n.y,r.y);switch(t){case 0:return Jn.compareValue(i,s);case 1:return Jn.compareValue(s,i);case 2:return Jn.compareValue(s,-i);case 3:return Jn.compareValue(-i,s);case 4:return Jn.compareValue(-i,-s);case 5:return Jn.compareValue(-s,-i);case 6:return Jn.compareValue(-s,i);case 7:return Jn.compareValue(i,-s)}return kt.shouldNeverReachHere("invalid octant value"),0};Jn.compareValue=function(t,n){return t<0?-1:t>0?1:n<0?-1:n>0?1:0};var Eo=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],n=arguments[1],r=arguments[2],i=arguments[3];this._segString=t,this.coord=new M(n),this.segmentIndex=r,this._segmentOctant=i,this._isInterior=!n.equals2D(t.getCoordinate(r))};Eo.prototype.getCoordinate=function(){return this.coord};Eo.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)};Eo.prototype.compareTo=function(t){var n=t;return this.segmentIndexn.segmentIndex?1:this.coord.equals2D(n.coord)?0:Jn.compare(this._segmentOctant,this.coord,n.coord)};Eo.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t};Eo.prototype.isInterior=function(){return this._isInterior};Eo.prototype.interfaces_=function(){return[ti]};Eo.prototype.getClass=function(){return Eo};var Wn=function(){this._nodeMap=new Mn,this._edge=null;var t=arguments[0];this._edge=t};Wn.prototype.getSplitCoordinates=function(){var t=this,n=new Vf;this.addEndpoints();for(var r=this.iterator(),i=r.next();r.hasNext();){var s=r.next();t.addEdgeCoordinates(i,s,n),i=s}return n.toCoordinateArray()};Wn.prototype.addCollapsedNodes=function(){var t=this,n=new lt;this.findCollapsesFromInsertedNodes(n),this.findCollapsesFromExistingVertices(n);for(var r=n.iterator();r.hasNext();){var i=r.next().intValue();t.add(t._edge.getCoordinate(i),i)}};Wn.prototype.print=function(t){t.println("Intersections:");for(var n=this.iterator();n.hasNext();){var r=n.next();r.print(t)}};Wn.prototype.findCollapsesFromExistingVertices=function(t){for(var n=this,r=0;r=0?n>=0?r>=i?0:1:r>=i?7:6:n>=0?r>=i?3:2:r>=i?4:5}else if(arguments[0]instanceof M&&arguments[1]instanceof M){var s=arguments[0],a=arguments[1],l=a.x-s.x,c=a.y-s.y;if(l===0&&c===0)throw new ve("Cannot compute the octant for two identical points "+s);return hl.octant(l,c)}};var xs=function(){};xs.prototype.getCoordinates=function(){};xs.prototype.size=function(){};xs.prototype.getCoordinate=function(t){};xs.prototype.isClosed=function(){};xs.prototype.setData=function(t){};xs.prototype.getData=function(){};xs.prototype.interfaces_=function(){return[]};xs.prototype.getClass=function(){return xs};var yf=function(){};yf.prototype.addIntersection=function(t,n){};yf.prototype.interfaces_=function(){return[xs]};yf.prototype.getClass=function(){return yf};var Ae=function(){this._nodeList=new Wn(this),this._pts=null,this._data=null;var t=arguments[0],n=arguments[1];this._pts=t,this._data=n};Ae.prototype.getCoordinates=function(){return this._pts};Ae.prototype.size=function(){return this._pts.length};Ae.prototype.getCoordinate=function(t){return this._pts[t]};Ae.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};Ae.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))};Ae.prototype.setData=function(t){this._data=t};Ae.prototype.safeOctant=function(t,n){return t.equals2D(n)?0:hl.octant(t,n)};Ae.prototype.getData=function(){return this._data};Ae.prototype.addIntersection=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1];this.addIntersectionNode(t,n)}else if(arguments.length===4){var r=arguments[0],i=arguments[1],s=arguments[3],a=new M(r.getIntersection(s));this.addIntersection(a,i)}};Ae.prototype.toString=function(){return ui.toLineString(new Oe(this._pts))};Ae.prototype.getNodeList=function(){return this._nodeList};Ae.prototype.addIntersectionNode=function(t,n){var r=n,i=r+1;if(i=0&&r>=0||n<=0&&r<=0?Math.max(n,r):0}else if(arguments[0]instanceof M){var i=arguments[0];return dt.orientationIndex(this.p0,this.p1,i)}};Pt.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])};Pt.prototype.isVertical=function(){return this.p0.x===this.p1.x};Pt.prototype.equals=function(t){if(!(t instanceof Pt))return!1;var n=t;return this.p0.equals(n.p0)&&this.p1.equals(n.p1)};Pt.prototype.intersection=function(t){var n=new Ta;return n.computeIntersection(this.p0,this.p1,t.p0,t.p1),n.hasIntersection()?n.getIntersection(0):null};Pt.prototype.project=function(){if(arguments[0]instanceof M){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new M(t);var n=this.projectionFactor(t),r=new M;return r.x=this.p0.x+n*(this.p1.x-this.p0.x),r.y=this.p0.y+n*(this.p1.y-this.p0.y),r}else if(arguments[0]instanceof Pt){var i=arguments[0],s=this.projectionFactor(i.p0),a=this.projectionFactor(i.p1);if(s>=1&&a>=1||s<=0&&a<=0)return null;var l=this.project(i.p0);s<0&&(l=this.p0),s>1&&(l=this.p1);var c=this.project(i.p1);return a<0&&(c=this.p0),a>1&&(c=this.p1),new Pt(l,c)}};Pt.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()};Pt.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)};Pt.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1};Pt.prototype.distancePerpendicular=function(t){return dt.distancePointLinePerpendicular(t,this.p0,this.p1)};Pt.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)};Pt.prototype.midPoint=function(){return Pt.midPoint(this.p0,this.p1)};Pt.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var n=this.p1.x-this.p0.x,r=this.p1.y-this.p0.y,i=n*n+r*r;if(i<=0)return Rt.NaN;var s=((t.x-this.p0.x)*n+(t.y-this.p0.y)*r)/i;return s};Pt.prototype.closestPoints=function(t){var n=this.intersection(t);if(n!==null)return[n,n];var r=new Array(2).fill(null),i=Rt.MAX_VALUE,s=null,a=this.closestPoint(t.p0);i=a.distance(t.p0),r[0]=a,r[1]=t.p0;var l=this.closestPoint(t.p1);s=l.distance(t.p1),s0&&n<1)return this.project(t);var r=this.p0.distance(t),i=this.p1.distance(t);return r1||Rt.isNaN(n))&&(n=1),n};Pt.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"};Pt.prototype.isHorizontal=function(){return this.p0.y===this.p1.y};Pt.prototype.distance=function(){if(arguments[0]instanceof Pt){var t=arguments[0];return dt.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}else if(arguments[0]instanceof M){var n=arguments[0];return dt.distancePointLine(n,this.p0,this.p1)}};Pt.prototype.pointAlong=function(t){var n=new M;return n.x=this.p0.x+t*(this.p1.x-this.p0.x),n.y=this.p0.y+t*(this.p1.y-this.p0.y),n};Pt.prototype.hashCode=function(){var t=Rt.doubleToLongBits(this.p0.x);t^=Rt.doubleToLongBits(this.p0.y)*31;var n=Math.trunc(t)^Math.trunc(t>>32),r=Rt.doubleToLongBits(this.p1.x);r^=Rt.doubleToLongBits(this.p1.y)*31;var i=Math.trunc(r)^Math.trunc(r>>32);return n^i};Pt.prototype.interfaces_=function(){return[ti,ei]};Pt.prototype.getClass=function(){return Pt};Pt.midPoint=function(t,n){return new M((t.x+n.x)/2,(t.y+n.y)/2)};YC.serialVersionUID.get=function(){return 0x2d2172135f411c00};Object.defineProperties(Pt,YC);var _f=function(){this.tempEnv1=new Nt,this.tempEnv2=new Nt,this._overlapSeg1=new Pt,this._overlapSeg2=new Pt};_f.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var t=arguments[0],n=arguments[1],r=arguments[2],i=arguments[3];t.getLineSegment(n,this._overlapSeg1),r.getLineSegment(i,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}};_f.prototype.interfaces_=function(){return[]};_f.prototype.getClass=function(){return _f};var vr=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],n=arguments[1],r=arguments[2],i=arguments[3];this._pts=t,this._start=n,this._end=r,this._context=i};vr.prototype.getLineSegment=function(t,n){n.p0=this._pts[t],n.p1=this._pts[t+1]};vr.prototype.computeSelect=function(t,n,r,i){var s=this._pts[n],a=this._pts[r];if(i.tempEnv1.init(s,a),r-n===1)return i.select(this,n),null;if(!t.intersects(i.tempEnv1))return null;var l=Math.trunc((n+r)/2);n=t.length-1)return t.length-1;for(var i=oe.quadrant(t[r],t[r+1]),s=n+1;sl.getId()&&(l.computeOverlaps(g,s),i._nOverlaps++),i._segInt.isDone())return null}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},n.SegmentOverlapAction.get=function(){return Mw},Object.defineProperties(t,n),t}(xf),Mw=function(e){function t(){e.call(this),this._si=null;var n=arguments[0];this._si=n}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.overlap=function(){if(arguments.length===4){var r=arguments[0],i=arguments[1],s=arguments[2],a=arguments[3],l=r.getContext(),c=s.getContext();this._si.processIntersections(l,i,c,a)}else return e.prototype.overlap.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(_f),Jt=function e(){if(this._quadrantSegments=e.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=e.CAP_ROUND,this._joinStyle=e.JOIN_ROUND,this._mitreLimit=e.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=e.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setQuadrantSegments(t)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(arguments.length===4){var i=arguments[0],s=arguments[1],a=arguments[2],l=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(s),this.setJoinStyle(a),this.setMitreLimit(l)}}},$s={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Jt.prototype.getEndCapStyle=function(){return this._endCapStyle};Jt.prototype.isSingleSided=function(){return this._isSingleSided};Jt.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=Jt.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Jt.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Jt.JOIN_ROUND&&(this._quadrantSegments=Jt.DEFAULT_QUADRANT_SEGMENTS)};Jt.prototype.getJoinStyle=function(){return this._joinStyle};Jt.prototype.setJoinStyle=function(t){this._joinStyle=t};Jt.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t};Jt.prototype.getSimplifyFactor=function(){return this._simplifyFactor};Jt.prototype.getQuadrantSegments=function(){return this._quadrantSegments};Jt.prototype.setEndCapStyle=function(t){this._endCapStyle=t};Jt.prototype.getMitreLimit=function(){return this._mitreLimit};Jt.prototype.setMitreLimit=function(t){this._mitreLimit=t};Jt.prototype.setSingleSided=function(t){this._isSingleSided=t};Jt.prototype.interfaces_=function(){return[]};Jt.prototype.getClass=function(){return Jt};Jt.bufferDistanceError=function(t){var n=Math.PI/2/t;return 1-Math.cos(n/2)};$s.CAP_ROUND.get=function(){return 1};$s.CAP_FLAT.get=function(){return 2};$s.CAP_SQUARE.get=function(){return 3};$s.JOIN_ROUND.get=function(){return 1};$s.JOIN_MITRE.get=function(){return 2};$s.JOIN_BEVEL.get=function(){return 3};$s.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8};$s.DEFAULT_MITRE_LIMIT.get=function(){return 5};$s.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01};Object.defineProperties(Jt,$s);var be=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=dt.COUNTERCLOCKWISE,this._inputLine=t||null},Hf={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};be.prototype.isDeletable=function(t,n,r,i){var s=this._inputLine[t],a=this._inputLine[n],l=this._inputLine[r];return!this.isConcave(s,a,l)||!this.isShallow(s,a,l,i)?!1:this.isShallowSampled(s,a,t,r,i)};be.prototype.deleteShallowConcavities=function(){for(var t=this,n=1,r=this.findNextNonDeletedIndex(n),i=this.findNextNonDeletedIndex(r),s=!1;i=0;s--)r.addPt(t[s])};Rr.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var n=this._ptList.get(this._ptList.size()-1),r=t.distance(n);return rMath.PI;)t-=Ht.PI_TIMES_2;for(;t<=-Math.PI;)t+=Ht.PI_TIMES_2;return t};Ht.angle=function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=r.x-n.x,s=r.y-n.y;return Math.atan2(s,i)}};Ht.isAcute=function(t,n,r){var i=t.x-n.x,s=t.y-n.y,a=r.x-n.x,l=r.y-n.y,c=i*a+s*l;return c>0};Ht.isObtuse=function(t,n,r){var i=t.x-n.x,s=t.y-n.y,a=r.x-n.x,l=r.y-n.y,c=i*a+s*l;return c<0};Ht.interiorAngle=function(t,n,r){var i=Ht.angle(n,t),s=Ht.angle(n,r);return Math.abs(s-i)};Ht.normalizePositive=function(t){if(t<0){for(;t<0;)t+=Ht.PI_TIMES_2;t>=Ht.PI_TIMES_2&&(t=0)}else{for(;t>=Ht.PI_TIMES_2;)t-=Ht.PI_TIMES_2;t<0&&(t=0)}return t};Ht.angleBetween=function(t,n,r){var i=Ht.angle(n,t),s=Ht.angle(n,r);return Ht.diff(i,s)};Ht.diff=function(t,n){var r=null;return tMath.PI&&(r=2*Math.PI-r),r};Ht.toRadians=function(t){return t*Math.PI/180};Ht.getTurn=function(t,n){var r=Math.sin(n-t);return r>0?Ht.COUNTERCLOCKWISE:r<0?Ht.CLOCKWISE:Ht.NONE};Ht.angleBetweenOriented=function(t,n,r){var i=Ht.angle(n,t),s=Ht.angle(n,r),a=s-i;return a<=-Math.PI?a+Ht.PI_TIMES_2:a>Math.PI?a-Ht.PI_TIMES_2:a};Ll.PI_TIMES_2.get=function(){return 2*Math.PI};Ll.PI_OVER_2.get=function(){return Math.PI/2};Ll.PI_OVER_4.get=function(){return Math.PI/4};Ll.COUNTERCLOCKWISE.get=function(){return dt.COUNTERCLOCKWISE};Ll.CLOCKWISE.get=function(){return dt.CLOCKWISE};Ll.NONE.get=function(){return dt.COLLINEAR};Object.defineProperties(Ht,Ll);var ge=function e(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Pt,this._seg1=new Pt,this._offset0=new Pt,this._offset1=new Pt,this._side=0,this._hasNarrowConcaveAngle=!1;var t=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=t,this._bufParams=n,this._li=new Ta,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Jt.JOIN_ROUND&&(this._closingSegLengthFactor=e.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},Zf={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};ge.prototype.addNextSegment=function(t,n){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var r=dt.computeOrientation(this._s0,this._s1,this._s2),i=r===dt.CLOCKWISE&&this._side===rt.LEFT||r===dt.COUNTERCLOCKWISE&&this._side===rt.RIGHT;r===0?this.addCollinear(n):i?this.addOutsideTurn(r,n):this.addInsideTurn(r,n)};ge.prototype.addLineEndCap=function(t,n){var r=new Pt(t,n),i=new Pt;this.computeOffsetSegment(r,rt.LEFT,this._distance,i);var s=new Pt;this.computeOffsetSegment(r,rt.RIGHT,this._distance,s);var a=n.x-t.x,l=n.y-t.y,c=Math.atan2(l,a);switch(this._bufParams.getEndCapStyle()){case Jt.CAP_ROUND:this._segList.addPt(i.p1),this.addFilletArc(n,c+Math.PI/2,c-Math.PI/2,dt.CLOCKWISE,this._distance),this._segList.addPt(s.p1);break;case Jt.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(s.p1);break;case Jt.CAP_SQUARE:var f=new M;f.x=Math.abs(this._distance)*Math.cos(c),f.y=Math.abs(this._distance)*Math.sin(c);var g=new M(i.p1.x+f.x,i.p1.y+f.y),d=new M(s.p1.x+f.x,s.p1.y+f.y);this._segList.addPt(g),this._segList.addPt(d);break}};ge.prototype.getCoordinates=function(){var t=this._segList.getCoordinates();return t};ge.prototype.addMitreJoin=function(t,n,r,i){var s=!0,a=null;try{a=oi.intersection(n.p0,n.p1,r.p0,r.p1);var l=i<=0?1:a.distance(t)/Math.abs(i);l>this._bufParams.getMitreLimit()&&(s=!1)}catch(c){if(c instanceof Hu)a=new M(0,0),s=!1;else throw c}finally{}s?this._segList.addPt(a):this.addLimitedMitreJoin(n,r,i,this._bufParams.getMitreLimit())};ge.prototype.addFilletCorner=function(t,n,r,i,s){var a=n.x-t.x,l=n.y-t.y,c=Math.atan2(l,a),f=r.x-t.x,g=r.y-t.y,d=Math.atan2(g,f);i===dt.CLOCKWISE?c<=d&&(c+=2*Math.PI):c>=d&&(c-=2*Math.PI),this._segList.addPt(n),this.addFilletArc(t,c,d,i,s),this._segList.addPt(r)};ge.prototype.addOutsideTurn=function(t,n){if(this._offset0.p1.distance(this._offset1.p0)0){var r=new M((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r);var i=new M((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(i)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}};ge.prototype.createCircle=function(t){var n=new M(t.x+this._distance,t.y);this._segList.addPt(n),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()};ge.prototype.addBevelJoin=function(t,n){this._segList.addPt(t.p1),this._segList.addPt(n.p0)};ge.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Rr,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*ge.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)};ge.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2);var n=this._li.getIntersectionNum();n>=2&&(this._bufParams.getJoinStyle()===Jt.JOIN_BEVEL||this._bufParams.getJoinStyle()===Jt.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,dt.CLOCKWISE,this._distance))};ge.prototype.closeRing=function(){this._segList.closeRing()};ge.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle};ge.prototype.interfaces_=function(){return[]};ge.prototype.getClass=function(){return ge};Zf.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001};Zf.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001};Zf.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6};Zf.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80};Object.defineProperties(ge,Zf);var ir=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],n=arguments[1];this._precisionModel=t,this._bufParams=n};ir.prototype.getOffsetCurve=function(t,n){if(this._distance=n,n===0)return null;var r=n<0,i=Math.abs(n),s=this.getSegGen(i);t.length<=1?this.computePointCurve(t[0],s):this.computeOffsetCurve(t,r,s);var a=s.getCoordinates();return r&&Vt.reverse(a),a};ir.prototype.computeSingleSidedBufferCurve=function(t,n,r){var i=this.simplifyTolerance(this._distance);if(n){r.addSegments(t,!0);var s=be.simplify(t,-i),a=s.length-1;r.initSideSegments(s[a],s[a-1],rt.LEFT),r.addFirstSegment();for(var l=a-2;l>=0;l--)r.addNextSegment(s[l],!0)}else{r.addSegments(t,!1);var c=be.simplify(t,i),f=c.length-1;r.initSideSegments(c[0],c[1],rt.LEFT),r.addFirstSegment();for(var g=2;g<=f;g++)r.addNextSegment(c[g],!0)}r.addLastSegment(),r.closeRing()};ir.prototype.computeRingBufferCurve=function(t,n,r){var i=this.simplifyTolerance(this._distance);n===rt.RIGHT&&(i=-i);var s=be.simplify(t,i),a=s.length-1;r.initSideSegments(s[a-1],s[0],n);for(var l=1;l<=a;l++){var c=l!==1;r.addNextSegment(s[l],c)}r.closeRing()};ir.prototype.computeLineBufferCurve=function(t,n){var r=this.simplifyTolerance(this._distance),i=be.simplify(t,r),s=i.length-1;n.initSideSegments(i[0],i[1],rt.LEFT);for(var a=2;a<=s;a++)n.addNextSegment(i[a],!0);n.addLastSegment(),n.addLineEndCap(i[s-1],i[s]);var l=be.simplify(t,-r),c=l.length-1;n.initSideSegments(l[c],l[c-1],rt.LEFT);for(var f=c-2;f>=0;f--)n.addNextSegment(l[f],!0);n.addLastSegment(),n.addLineEndCap(l[1],l[0]),n.closeRing()};ir.prototype.computePointCurve=function(t,n){switch(this._bufParams.getEndCapStyle()){case Jt.CAP_ROUND:n.createCircle(t);break;case Jt.CAP_SQUARE:n.createSquare(t);break}};ir.prototype.getLineCurve=function(t,n){if(this._distance=n,n<0&&!this._bufParams.isSingleSided()||n===0)return null;var r=Math.abs(n),i=this.getSegGen(r);if(t.length<=1)this.computePointCurve(t[0],i);else if(this._bufParams.isSingleSided()){var s=n<0;this.computeSingleSidedBufferCurve(t,s,i)}else this.computeLineBufferCurve(t,i);var a=i.getCoordinates();return a};ir.prototype.getBufferParameters=function(){return this._bufParams};ir.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()};ir.prototype.getRingCurve=function(t,n,r){if(this._distance=r,t.length<=2)return this.getLineCurve(t,r);if(r===0)return ir.copyCoordinates(t);var i=this.getSegGen(r);return this.computeRingBufferCurve(t,n,i),i.getCoordinates()};ir.prototype.computeOffsetCurve=function(t,n,r){var i=this.simplifyTolerance(this._distance);if(n){var s=be.simplify(t,-i),a=s.length-1;r.initSideSegments(s[a],s[a-1],rt.LEFT),r.addFirstSegment();for(var l=a-2;l>=0;l--)r.addNextSegment(s[l],!0)}else{var c=be.simplify(t,i),f=c.length-1;r.initSideSegments(c[0],c[1],rt.LEFT),r.addFirstSegment();for(var g=2;g<=f;g++)r.addNextSegment(c[g],!0)}r.addLastSegment()};ir.prototype.getSegGen=function(t){return new ge(this._precisionModel,this._bufParams,t)};ir.prototype.interfaces_=function(){return[]};ir.prototype.getClass=function(){return ir};ir.copyCoordinates=function(t){for(var n=new Array(t.length).fill(null),r=0;ra.getMaxY()||t.findStabbedSegments(n,s.getDirectedEdges(),r)}return r}else if(arguments.length===3){if(Ot(arguments[2],ai)&&arguments[0]instanceof M&&arguments[1]instanceof Ov)for(var l=arguments[0],c=arguments[1],f=arguments[2],g=c.getEdge().getCoordinates(),d=0;dt._seg.p1.y&&t._seg.reverse();var v=Math.max(t._seg.p0.x,t._seg.p1.x);if(!(vt._seg.p1.y)&&dt.computeOrientation(t._seg.p0,t._seg.p1,l)!==dt.RIGHT){var y=c.getDepth(rt.LEFT);t._seg.p0.equals(g[d])||(y=c.getDepth(rt.RIGHT));var x=new ma(t._seg,y);f.add(x)}}else if(Ot(arguments[2],ai)&&arguments[0]instanceof M&&Ot(arguments[1],ai))for(var S=arguments[0],C=arguments[1],E=arguments[2],w=C.iterator();w.hasNext();){var N=w.next();N.isForward()&&t.findStabbedSegments(S,N,E)}}};dl.prototype.getDepth=function(t){var n=this.findStabbedSegments(t);if(n.size()===0)return 0;var r=hi.min(n);return r._leftDepth};dl.prototype.interfaces_=function(){return[]};dl.prototype.getClass=function(){return dl};QC.DepthSegment.get=function(){return ma};Object.defineProperties(dl,QC);var ma=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],n=arguments[1];this._upwardSeg=new Pt(t),this._leftDepth=n};ma.prototype.compareTo=function(t){var n=t;if(this._upwardSeg.minX()>=n._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=n._upwardSeg.minX())return-1;var r=this._upwardSeg.orientationIndex(n._upwardSeg);return r!==0||(r=-1*n._upwardSeg.orientationIndex(this._upwardSeg),r!==0)?r:this._upwardSeg.compareTo(n._upwardSeg)};ma.prototype.compareX=function(t,n){var r=t.p0.compareTo(n.p0);return r!==0?r:t.p1.compareTo(n.p1)};ma.prototype.toString=function(){return this._upwardSeg.toString()};ma.prototype.interfaces_=function(){return[ti]};ma.prototype.getClass=function(){return ma};var te=function(t,n,r){this.p0=t||null,this.p1=n||null,this.p2=r||null};te.prototype.area=function(){return te.area(this.p0,this.p1,this.p2)};te.prototype.signedArea=function(){return te.signedArea(this.p0,this.p1,this.p2)};te.prototype.interpolateZ=function(t){if(t===null)throw new ve("Supplied point is null.");return te.interpolateZ(t,this.p0,this.p1,this.p2)};te.prototype.longestSideLength=function(){return te.longestSideLength(this.p0,this.p1,this.p2)};te.prototype.isAcute=function(){return te.isAcute(this.p0,this.p1,this.p2)};te.prototype.circumcentre=function(){return te.circumcentre(this.p0,this.p1,this.p2)};te.prototype.area3D=function(){return te.area3D(this.p0,this.p1,this.p2)};te.prototype.centroid=function(){return te.centroid(this.p0,this.p1,this.p2)};te.prototype.inCentre=function(){return te.inCentre(this.p0,this.p1,this.p2)};te.prototype.interfaces_=function(){return[]};te.prototype.getClass=function(){return te};te.area=function(t,n,r){return Math.abs(((r.x-t.x)*(n.y-t.y)-(n.x-t.x)*(r.y-t.y))/2)};te.signedArea=function(t,n,r){return((r.x-t.x)*(n.y-t.y)-(n.x-t.x)*(r.y-t.y))/2};te.det=function(t,n,r,i){return t*i-n*r};te.interpolateZ=function(t,n,r,i){var s=n.x,a=n.y,l=r.x-s,c=i.x-s,f=r.y-a,g=i.y-a,d=l*g-c*f,v=t.x-s,y=t.y-a,x=(g*v-c*y)/d,S=(-f*v+l*y)/d,C=n.z+x*(r.z-n.z)+S*(i.z-n.z);return C};te.longestSideLength=function(t,n,r){var i=t.distance(n),s=n.distance(r),a=r.distance(t),l=i;return s>l&&(l=s),a>l&&(l=a),l};te.isAcute=function(t,n,r){return!(!Ht.isAcute(t,n,r)||!Ht.isAcute(n,r,t)||!Ht.isAcute(r,t,n))};te.circumcentre=function(t,n,r){var i=r.x,s=r.y,a=t.x-i,l=t.y-s,c=n.x-i,f=n.y-s,g=2*te.det(a,l,c,f),d=te.det(l,a*a+l*l,f,c*c+f*f),v=te.det(a,a*a+l*l,c,c*c+f*f),y=i-d/g,x=s+v/g;return new M(y,x)};te.perpendicularBisector=function(t,n){var r=n.x-t.x,i=n.y-t.y,s=new oi(t.x+r/2,t.y+i/2,1),a=new oi(t.x-i+r/2,t.y+r+i/2,1);return new oi(s,a)};te.angleBisector=function(t,n,r){var i=n.distance(t),s=n.distance(r),a=i/(i+s),l=r.x-t.x,c=r.y-t.y,f=new M(t.x+a*l,t.y+a*c);return f};te.area3D=function(t,n,r){var i=n.x-t.x,s=n.y-t.y,a=n.z-t.z,l=r.x-t.x,c=r.y-t.y,f=r.z-t.z,g=s*f-a*c,d=a*l-i*f,v=i*c-s*l,y=g*g+d*d+v*v,x=Math.sqrt(y)/2;return x};te.centroid=function(t,n,r){var i=(t.x+n.x+r.x)/3,s=(t.y+n.y+r.y)/3;return new M(i,s)};te.inCentre=function(t,n,r){var i=n.distance(r),s=t.distance(r),a=t.distance(n),l=i+s+a,c=(i*t.x+s*n.x+a*r.x)/l,f=(i*t.y+s*n.y+a*r.y)/l;return new M(c,f)};var $r=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new lt;var t=arguments[0],n=arguments[1],r=arguments[2];this._inputGeom=t,this._distance=n,this._curveBuilder=r};$r.prototype.addPoint=function(t){if(this._distance<=0)return null;var n=t.getCoordinates(),r=this._curveBuilder.getLineCurve(n,this._distance);this.addCurve(r,k.EXTERIOR,k.INTERIOR)};$r.prototype.addPolygon=function(t){var n=this,r=this._distance,i=rt.LEFT;this._distance<0&&(r=-this._distance,i=rt.RIGHT);var s=t.getExteriorRing(),a=Vt.removeRepeatedPoints(s.getCoordinates());if(this._distance<0&&this.isErodedCompletely(s,this._distance)||this._distance<=0&&a.length<3)return null;this.addPolygonRing(a,r,i,k.EXTERIOR,k.INTERIOR);for(var l=0;l0&&n.isErodedCompletely(c,-n._distance)||n.addPolygonRing(f,r,rt.opposite(i),k.INTERIOR,k.EXTERIOR)}};$r.prototype.isTriangleErodedCompletely=function(t,n){var r=new te(t[0],t[1],t[2]),i=r.inCentre(),s=dt.distancePointLine(i,r.p0,r.p1);return s=ys.MINIMUM_VALID_SIZE&&dt.isCCW(t)&&(a=s,l=i,r=rt.opposite(r));var c=this._curveBuilder.getRingCurve(t,r,n);this.addCurve(c,a,l)};$r.prototype.add=function(t){if(t.isEmpty())return null;t instanceof Ye?this.addPolygon(t):t instanceof Pe?this.addLineString(t):t instanceof gr?this.addPoint(t):t instanceof Cu?this.addCollection(t):t instanceof pa?this.addCollection(t):t instanceof ps?this.addCollection(t):t instanceof Hn&&this.addCollection(t)};$r.prototype.isErodedCompletely=function(t,n){var r=t.getCoordinates();if(r.length<4)return n<0;if(r.length===4)return this.isTriangleErodedCompletely(r,n);var i=t.getEnvelopeInternal(),s=Math.min(i.getHeight(),i.getWidth());return n<0&&2*Math.abs(n)>s};$r.prototype.addCollection=function(t){for(var n=this,r=0;r=this._max)throw new Wu;var t=this._parent.getGeometryN(this._index++);return t instanceof Hn?(this._subcollectionIterator=new gs(t),this._subcollectionIterator.next()):t};gs.prototype.remove=function(){throw new Error(this.getClass().getName())};gs.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)};gs.prototype.interfaces_=function(){return[Zu]};gs.prototype.getClass=function(){return gs};gs.isAtomic=function(t){return!(t instanceof Hn)};var Ir=function(){this._geom=null;var t=arguments[0];this._geom=t};Ir.prototype.locate=function(t){return Ir.locate(t,this._geom)};Ir.prototype.interfaces_=function(){return[Lu]};Ir.prototype.getClass=function(){return Ir};Ir.isPointInRing=function(t,n){return n.getEnvelopeInternal().intersects(t)?dt.isPointInRing(t,n.getCoordinates()):!1};Ir.containsPointInPolygon=function(t,n){if(n.isEmpty())return!1;var r=n.getExteriorRing();if(!Ir.isPointInRing(t,r))return!1;for(var i=0;i=0;a--){var l=r._edgeList.get(a),c=l.getSym();s===null&&(s=c),i!==null&&c.setNext(i),i=l}s.setNext(i)},t.prototype.computeDepths=function(){var r=this;if(arguments.length===1){var i=arguments[0],s=this.findIndex(i),a=i.getDepth(rt.LEFT),l=i.getDepth(rt.RIGHT),c=this.computeDepths(s+1,this._edgeList.size(),a),f=this.computeDepths(0,s,c);if(f!==l)throw new Xs("depth mismatch at "+i.getCoordinate())}else if(arguments.length===3){for(var g=arguments[0],d=arguments[1],v=arguments[2],y=v,x=g;x=0;c--){var f=i._resultAreaEdgeList.get(c),g=f.getSym();switch(s===null&&f.getEdgeRing()===r&&(s=f),l){case i._SCANNING_FOR_INCOMING:if(g.getEdgeRing()!==r)continue;a=g,l=i._LINKING_TO_OUTGOING;break;case i._LINKING_TO_OUTGOING:if(f.getEdgeRing()!==r)continue;a.setNextMin(f),l=i._SCANNING_FOR_INCOMING;break}}l===this._LINKING_TO_OUTGOING&&(kt.isTrue(s!==null,"found null for first outgoing dirEdge"),kt.isTrue(s.getEdgeRing()===r,"unable to link last incoming dirEdge"),a.setNextMin(s))},t.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var r=0,i=this.iterator();i.hasNext();){var s=i.next();s.isInResult()&&r++}return r}else if(arguments.length===1){for(var a=arguments[0],l=0,c=this.iterator();c.hasNext();){var f=c.next();f.getEdgeRing()===a&&l++}return l}},t.prototype.getLabel=function(){return this._label},t.prototype.findCoveredLineEdges=function(){for(var r=k.NONE,i=this.iterator();i.hasNext();){var s=i.next(),a=s.getSym();if(!s.isLineEdge()){if(s.isInResult()){r=k.INTERIOR;break}if(a.isInResult()){r=k.EXTERIOR;break}}}if(r===k.NONE)return null;for(var l=r,c=this.iterator();c.hasNext();){var f=c.next(),g=f.getSym();f.isLineEdge()?f.getEdge().setCovered(l===k.INTERIOR):(f.isInResult()&&(l=k.EXTERIOR),g.isInResult()&&(l=k.INTERIOR))}},t.prototype.computeLabelling=function(r){var i=this;e.prototype.computeLabelling.call(this,r),this._label=new ie(k.NONE);for(var s=this.iterator();s.hasNext();)for(var a=s.next(),l=a.getEdge(),c=l.getLabel(),f=0;f<2;f++){var g=c.getLocation(f);(g===k.INTERIOR||g===k.BOUNDARY)&&i._label.setLocation(f,k.INTERIOR)}},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Dn),JC=function(e){function t(){e.apply(this,arguments)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.createNode=function(r){return new Hp(r,new MA)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Nu),So=function e(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=e.orientation(t)};So.prototype.compareTo=function(t){var n=t,r=So.compareOriented(this._pts,this._orientation,n._pts,n._orientation);return r};So.prototype.interfaces_=function(){return[ti]};So.prototype.getClass=function(){return So};So.orientation=function(t){return Vt.increasingDirection(t)===1};So.compareOriented=function(t,n,r,i){for(var s=n?1:-1,a=i?1:-1,l=n?t.length:-1,c=i?r.length:-1,f=n?0:t.length-1,g=i?0:r.length-1;;){var d=t[f].compareTo(r[g]);if(d!==0)return d;f+=s,g+=a;var v=f===l,y=g===c;if(v&&!y)return-1;if(!v&&y)return 1;if(v&&y)return 0}};var di=function(){this._edges=new lt,this._ocaMap=new Mn};di.prototype.print=function(t){var n=this;t.print("MULTILINESTRING ( ");for(var r=0;r0&&t.print(","),t.print("(");for(var s=i.getCoordinates(),a=0;a0&&t.print(","),t.print(s[a].x+" "+s[a].y);t.println(")")}t.print(") ")};di.prototype.addAll=function(t){for(var n=this,r=t.iterator();r.hasNext();)n.add(r.next())};di.prototype.findEdgeIndex=function(t){for(var n=this,r=0;r0||!n.coord.equals2D(s);a||i--;var l=new Array(i).fill(null),c=0;l[c++]=new M(t.coord);for(var f=t.segmentIndex+1;f<=n.segmentIndex;f++)l[c++]=r.edge.pts[f];return a&&(l[c]=n.coord),new Xd(l,new ie(this.edge._label))};ws.prototype.add=function(t,n,r){var i=new Zi(t,n,r),s=this._nodeMap.get(i);return s!==null?s:(this._nodeMap.put(i,i),i)};ws.prototype.isIntersection=function(t){for(var n=this.iterator();n.hasNext();){var r=n.next();if(r.coord.equals(t))return!0}return!1};ws.prototype.interfaces_=function(){return[]};ws.prototype.getClass=function(){return ws};var ya=function(){};ya.prototype.getChainStartIndices=function(t){var n=this,r=0,i=new lt;i.add(new Bi(r));do{var s=n.findChainEnd(t,r);i.add(new Bi(s)),r=s}while(rr?n:r};Ks.prototype.getMinX=function(t){var n=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return nr&&(s=1),t._depth[n][i]=s}}};xn.prototype.getDelta=function(t){return this._depth[t][rt.RIGHT]-this._depth[t][rt.LEFT]};xn.prototype.getLocation=function(t,n){return this._depth[t][n]<=0?k.EXTERIOR:k.INTERIOR};xn.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]};xn.prototype.add=function(){var t=this;if(arguments.length===1)for(var n=arguments[0],r=0;r<2;r++)for(var i=1;i<3;i++){var s=n.getLocation(r,i);(s===k.EXTERIOR||s===k.INTERIOR)&&(t.isNull(r,i)?t._depth[r][i]=xn.depthAtLocation(s):t._depth[r][i]+=xn.depthAtLocation(s))}else if(arguments.length===3){var a=arguments[0],l=arguments[1],c=arguments[2];c===k.INTERIOR&&this._depth[a][l]++}};xn.prototype.interfaces_=function(){return[]};xn.prototype.getClass=function(){return xn};xn.depthAtLocation=function(t){return t===k.EXTERIOR?0:t===k.INTERIOR?1:xn.NULL_VALUE};$C.NULL_VALUE.get=function(){return-1};Object.defineProperties(xn,$C);var Xd=function(e){function t(){if(e.call(this),this.pts=null,this._env=null,this.eiList=new ws(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new xn,this._depthDelta=0,arguments.length===1){var n=arguments[0];t.call(this,n,null)}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.pts=r,this._label=i}}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.getDepth=function(){return this._depth},t.prototype.getCollapsedEdge=function(){var r=new Array(2).fill(null);r[0]=this.pts[0],r[1]=this.pts[1];var i=new t(r,ie.toLineLabel(this._label));return i},t.prototype.isIsolated=function(){return this._isIsolated},t.prototype.getCoordinates=function(){return this.pts},t.prototype.setIsolated=function(r){this._isIsolated=r},t.prototype.setName=function(r){this._name=r},t.prototype.equals=function(r){var i=this;if(!(r instanceof t))return!1;var s=r;if(this.pts.length!==s.pts.length)return!1;for(var a=!0,l=!0,c=this.pts.length,f=0;f0?this.pts[0]:null;if(arguments.length===1){var r=arguments[0];return this.pts[r]}},t.prototype.print=function(r){var i=this;r.print("edge "+this._name+": "),r.print("LINESTRING (");for(var s=0;s0&&r.print(","),r.print(i.pts[s].x+" "+i.pts[s].y);r.print(") "+this._label+" "+this._depthDelta)},t.prototype.computeIM=function(r){t.updateIM(this._label,r)},t.prototype.isCollapsed=function(){return!this._label.isArea()||this.pts.length!==3?!1:!!this.pts[0].equals(this.pts[2])},t.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},t.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},t.prototype.getDepthDelta=function(){return this._depthDelta},t.prototype.getNumPoints=function(){return this.pts.length},t.prototype.printReverse=function(r){var i=this;r.print("edge "+this._name+": ");for(var s=this.pts.length-1;s>=0;s--)r.print(i.pts[s]+" ");r.println("")},t.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new Ks(this)),this._mce},t.prototype.getEnvelope=function(){var r=this;if(this._env===null){this._env=new Nt;for(var i=0;i0&&i.append(","),i.append(r.pts[s].x+" "+r.pts[s].y);return i.append(") "+this._label+" "+this._depthDelta),i.toString()},t.prototype.isPointwiseEqual=function(r){var i=this;if(this.pts.length!==r.pts.length)return!1;for(var s=0;si||this._maxya;if(l)return!1;var c=this.intersectsToleranceSquare(t,n);return kt.isTrue(!(l&&c),"Found bad envelope test"),c};sr.prototype.initCorners=function(t){var n=.5;this._minx=t.x-n,this._maxx=t.x+n,this._miny=t.y-n,this._maxy=t.y+n,this._corner[0]=new M(this._maxx,this._maxy),this._corner[1]=new M(this._minx,this._maxy),this._corner[2]=new M(this._minx,this._miny),this._corner[3]=new M(this._maxx,this._miny)};sr.prototype.intersects=function(t,n){return this._scaleFactor===1?this.intersectsScaled(t,n):(this.copyScaled(t,this._p0Scaled),this.copyScaled(n,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))};sr.prototype.scale=function(t){return Math.round(t*this._scaleFactor)};sr.prototype.getCoordinate=function(){return this._originalPt};sr.prototype.copyScaled=function(t,n){n.x=this.scale(t.x),n.y=this.scale(t.y)};sr.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=sr.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new Nt(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv};sr.prototype.intersectsPixelClosure=function(t,n){return this._li.computeIntersection(t,n,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,n,this._corner[1],this._corner[2]),this._li.hasIntersection())||(this._li.computeIntersection(t,n,this._corner[2],this._corner[3]),this._li.hasIntersection())||(this._li.computeIntersection(t,n,this._corner[3],this._corner[0]),this._li.hasIntersection()))};sr.prototype.intersectsToleranceSquare=function(t,n){var r=!1,i=!1;return this._li.computeIntersection(t,n,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,n,this._corner[1],this._corner[2]),this._li.isProper())||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,n,this._corner[2],this._corner[3]),this._li.isProper())||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(t,n,this._corner[3],this._corner[0]),this._li.isProper())||r&&i||t.equals(this._pt)||n.equals(this._pt))};sr.prototype.addSnappedNode=function(t,n){var r=t.getCoordinate(n),i=t.getCoordinate(n+1);return this.intersects(r,i)?(t.addIntersection(this.getCoordinate(),n),!0):!1};sr.prototype.interfaces_=function(){return[]};sr.prototype.getClass=function(){return sr};eN.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75};Object.defineProperties(sr,eN);var wf=function(){this.tempEnv1=new Nt,this.selectedSegment=new Pt};wf.prototype.select=function(){if(arguments.length!==1){if(arguments.length===2){var t=arguments[0],n=arguments[1];t.getLineSegment(n,this.selectedSegment),this.select(this.selectedSegment)}}};wf.prototype.interfaces_=function(){return[]};wf.prototype.getClass=function(){return wf};var Iu=function(){this._index=null;var t=arguments[0];this._index=t},nN={HotPixelSnapAction:{configurable:!0}};Iu.prototype.snap=function(){if(arguments.length===1){var t=arguments[0];return this.snap(t,null,-1)}else if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2],s=n.getSafeEnvelope(),a=new rN(n,r,i);return this._index.query(s,{interfaces_:function(){return[wo]},visitItem:function(l){var c=l;c.select(s,a)}}),a.isNodeAdded()}};Iu.prototype.interfaces_=function(){return[]};Iu.prototype.getClass=function(){return Iu};nN.HotPixelSnapAction.get=function(){return rN};Object.defineProperties(Iu,nN);var rN=function(e){function t(){e.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],r=arguments[1],i=arguments[2];this._hotPixel=n,this._parentEdge=r,this._hotPixelVertexIndex=i}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.isNodeAdded=function(){return this._isNodeAdded},t.prototype.select=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1],s=r.getContext();if(this._parentEdge!==null&&s===this._parentEdge&&i===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(s,i)}else return e.prototype.select.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(wf),pl=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new lt};pl.prototype.processIntersections=function(t,n,r,i){var s=this;if(t===r&&n===i)return null;var a=t.getCoordinates()[n],l=t.getCoordinates()[n+1],c=r.getCoordinates()[i],f=r.getCoordinates()[i+1];if(this._li.computeIntersection(a,l,c,f),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var g=0;g=0;n--){try{t.bufferReducedPrecision(n)}catch(a){if(a instanceof Xs)t._saveException=a;else throw a}finally{}if(t._resultGeometry!==null)return null}throw this._saveException}else if(arguments.length===1){var r=arguments[0],i=_n.precisionScaleFactor(this._argGeom,this._distance,r),s=new $t(i);this.bufferFixedPrecision(s)}};_n.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===$t.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()};_n.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)};_n.prototype.bufferOriginalPrecision=function(){try{var t=new qn(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(n){if(n instanceof Zs)this._saveException=n;else throw n}finally{}};_n.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry};_n.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)};_n.prototype.interfaces_=function(){return[]};_n.prototype.getClass=function(){return _n};_n.bufferOp=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1],r=new _n(t),i=r.getResultGeometry(n);return i}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Tt&&typeof arguments[1]=="number"){var s=arguments[0],a=arguments[1],l=arguments[2],c=new _n(s);c.setQuadrantSegments(l);var f=c.getResultGeometry(a);return f}else if(arguments[2]instanceof Jt&&arguments[0]instanceof Tt&&typeof arguments[1]=="number"){var g=arguments[0],d=arguments[1],v=arguments[2],y=new _n(g,v),x=y.getResultGeometry(d);return x}}else if(arguments.length===4){var S=arguments[0],C=arguments[1],E=arguments[2],w=arguments[3],N=new _n(S);N.setQuadrantSegments(E),N.setEndCapStyle(w);var I=N.getResultGeometry(C);return I}};_n.precisionScaleFactor=function(t,n,r){var i=t.getEnvelopeInternal(),s=Tr.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY())),a=n>0?n:0,l=s+2*a,c=Math.trunc(Math.log(l)/Math.log(10)+1),f=r-c,g=Math.pow(10,f);return g};Xu.CAP_ROUND.get=function(){return Jt.CAP_ROUND};Xu.CAP_BUTT.get=function(){return Jt.CAP_FLAT};Xu.CAP_FLAT.get=function(){return Jt.CAP_FLAT};Xu.CAP_SQUARE.get=function(){return Jt.CAP_SQUARE};Xu.MAX_PRECISION_DIGITS.get=function(){return 12};Object.defineProperties(_n,Xu);var Bn=function(){this._pt=[new M,new M],this._distance=Rt.NaN,this._isNull=!0};Bn.prototype.getCoordinates=function(){return this._pt};Bn.prototype.getCoordinate=function(t){return this._pt[t]};Bn.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var n=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(n,r),null;var i=n.distance(r);ithis._distance&&this.initialize(n,r,i)}};Bn.prototype.interfaces_=function(){return[]};Bn.prototype.getClass=function(){return Bn};var ls=function(){};ls.prototype.interfaces_=function(){return[]};ls.prototype.getClass=function(){return ls};ls.computeDistance=function(){if(arguments[2]instanceof Bn&&arguments[0]instanceof Pe&&arguments[1]instanceof M)for(var t=arguments[0],n=arguments[1],r=arguments[2],i=t.getCoordinates(),s=new Pt,a=0;a0||this._isIn?k.INTERIOR:k.EXTERIOR)};pi.prototype.interfaces_=function(){return[]};pi.prototype.getClass=function(){return pi};var Un=function e(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var t=arguments[0],n=arguments[1];e.call(this,t,e.INSIDE_AREA,n)}else if(arguments.length===3){var r=arguments[0],i=arguments[1],s=arguments[2];this._component=r,this._segIndex=i,this._pt=s}},iN={INSIDE_AREA:{configurable:!0}};Un.prototype.isInsideArea=function(){return this._segIndex===Un.INSIDE_AREA};Un.prototype.getCoordinate=function(){return this._pt};Un.prototype.getGeometryComponent=function(){return this._component};Un.prototype.getSegmentIndex=function(){return this._segIndex};Un.prototype.interfaces_=function(){return[]};Un.prototype.getClass=function(){return Un};iN.INSIDE_AREA.get=function(){return-1};Object.defineProperties(Un,iN);var ho=function(t){this._pts=t||null};ho.prototype.filter=function(t){t instanceof gr&&this._pts.add(t)};ho.prototype.interfaces_=function(){return[Vi]};ho.prototype.getClass=function(){return ho};ho.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof gr?hi.singletonList(t):ho.getPoints(t,new lt)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return n instanceof gr?r.add(n):n instanceof Hn&&n.apply(new ho(r)),r}};var ml=function(){this._locations=null;var t=arguments[0];this._locations=t};ml.prototype.filter=function(t){(t instanceof gr||t instanceof Pe||t instanceof Ye)&&this._locations.add(new Un(t,0,t.getCoordinate()))};ml.prototype.interfaces_=function(){return[Vi]};ml.prototype.getClass=function(){return ml};ml.getLocations=function(t){var n=new lt;return t.apply(new ml(n)),n};var En=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new pi,this._minDistanceLocation=null,this._minDistance=Rt.MAX_VALUE,arguments.length===2){var t=arguments[0],n=arguments[1];this._geom=[t,n],this._terminateDistance=0}else if(arguments.length===3){var r=arguments[0],i=arguments[1],s=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=i,this._terminateDistance=s}};En.prototype.computeContainmentDistance=function(){var t=this;if(arguments.length===0){var n=new Array(2).fill(null);if(this.computeContainmentDistance(0,n),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,n)}else if(arguments.length===2){var r=arguments[0],i=arguments[1],s=1-r,a=qs.getPolygons(this._geom[r]);if(a.size()>0){var l=ml.getLocations(this._geom[s]);if(this.computeContainmentDistance(l,a,i),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[s]=i[0],this._minDistanceLocation[r]=i[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&Ot(arguments[0],ai)&&Ot(arguments[1],ai)){for(var c=arguments[0],f=arguments[1],g=arguments[2],d=0;dthis._minDistance)return null;for(var s=n.getCoordinates(),a=r.getCoordinate(),l=0;lthis._minDistance)return null;for(var x=d.getCoordinates(),S=v.getCoordinates(),C=0;Cthis._distance&&this.initialize(n,r,i)}};Rn.prototype.interfaces_=function(){return[]};Rn.prototype.getClass=function(){return Rn};var Mi=function(){};Mi.prototype.interfaces_=function(){return[]};Mi.prototype.getClass=function(){return Mi};Mi.computeDistance=function(){if(arguments[2]instanceof Rn&&arguments[0]instanceof Pe&&arguments[1]instanceof M)for(var t=arguments[0],n=arguments[1],r=arguments[2],i=new Pt,s=t.getCoordinates(),a=0;a1||t<=0)throw new ve("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t};Kr.prototype.compute=function(t,n){this.computeOrientedDistance(t,n,this._ptDist),this.computeOrientedDistance(n,t,this._ptDist)};Kr.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()};Kr.prototype.computeOrientedDistance=function(t,n,r){var i=new vl(n);if(t.apply(i),r.setMaximum(i.getMaxPointDistance()),this._densifyFrac>0){var s=new Po(n,this._densifyFrac);t.apply(s),r.setMaximum(s.getMaxPointDistance())}};Kr.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()};Kr.prototype.interfaces_=function(){return[]};Kr.prototype.getClass=function(){return Kr};Kr.distance=function(){if(arguments.length===2){var t=arguments[0],n=arguments[1],r=new Kr(t,n);return r.distance()}else if(arguments.length===3){var i=arguments[0],s=arguments[1],a=arguments[2],l=new Kr(i,s);return l.setDensifyFraction(a),l.distance()}};h_.MaxPointDistanceFilter.get=function(){return vl};h_.MaxDensifiedByFractionDistanceFilter.get=function(){return Po};Object.defineProperties(Kr,h_);var vl=function(){this._maxPtDist=new Rn,this._minPtDist=new Rn,this._euclideanDist=new Mi,this._geom=null;var t=arguments[0];this._geom=t};vl.prototype.filter=function(t){this._minPtDist.initialize(),Mi.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)};vl.prototype.getMaxPointDistance=function(){return this._maxPtDist};vl.prototype.interfaces_=function(){return[vs]};vl.prototype.getClass=function(){return vl};var Po=function(){this._maxPtDist=new Rn,this._minPtDist=new Rn,this._geom=null,this._numSubSegs=0;var t=arguments[0],n=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/n))};Po.prototype.filter=function(t,n){var r=this;if(n===0)return null;for(var i=t.getCoordinate(n-1),s=t.getCoordinate(n),a=(s.x-i.x)/this._numSubSegs,l=(s.y-i.y)/this._numSubSegs,c=0;cr){this._isValid=!1;var s=i.getCoordinates();this._errorLocation=s[1],this._errorIndicator=t.getFactory().createLineString(s),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+ui.toLineString(s[0],s[1])+")"}};dr.prototype.isValid=function(){var t=Math.abs(this._bufDistance),n=dr.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-n,this._maxValidDistance=t+n,this._input.isEmpty()||this._result.isEmpty()?!0:(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),dr.VERBOSE&&wn.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)};dr.prototype.checkNegativeValid=function(){if(!(this._input instanceof Ye||this._input instanceof ps||this._input instanceof Hn))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)};dr.prototype.getErrorIndicator=function(){return this._errorIndicator};dr.prototype.checkMinimumDistance=function(t,n,r){var i=new En(t,n,r);if(this._minDistanceFound=i.distance(),this._minDistanceFound0&&t>n&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t=2||this._distance>0)return null;this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),this.report("ExpectedEmpty")};Sn.prototype.report=function(t){if(!Sn.VERBOSE)return null;wn.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))};Sn.prototype.getErrorMessage=function(){return this._errorMsg};Sn.prototype.interfaces_=function(){return[]};Sn.prototype.getClass=function(){return Sn};Sn.isValidMsg=function(t,n,r){var i=new Sn(t,n,r);return i.isValid()?null:i.getErrorMessage()};Sn.isValid=function(t,n,r){var i=new Sn(t,n,r);return!!i.isValid()};p_.VERBOSE.get=function(){return!1};p_.MAX_ENV_DIFF_FRAC.get=function(){return .012};Object.defineProperties(Sn,p_);var Xi=function(){this._pts=null,this._data=null;var t=arguments[0],n=arguments[1];this._pts=t,this._data=n};Xi.prototype.getCoordinates=function(){return this._pts};Xi.prototype.size=function(){return this._pts.length};Xi.prototype.getCoordinate=function(t){return this._pts[t]};Xi.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])};Xi.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:hl.octant(this.getCoordinate(t),this.getCoordinate(t+1))};Xi.prototype.setData=function(t){this._data=t};Xi.prototype.getData=function(){return this._data};Xi.prototype.toString=function(){return ui.toLineString(new Oe(this._pts))};Xi.prototype.interfaces_=function(){return[xs]};Xi.prototype.getClass=function(){return Xi};var ln=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new lt,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};ln.prototype.getInteriorIntersection=function(){return this._interiorIntersection};ln.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t};ln.prototype.getIntersectionSegments=function(){return this._intSegments};ln.prototype.count=function(){return this._intersectionCount};ln.prototype.getIntersections=function(){return this._intersections};ln.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};ln.prototype.setKeepIntersections=function(t){this._keepIntersections=t};ln.prototype.processIntersections=function(t,n,r,i){if(!this._findAllIntersections&&this.hasIntersection()||t===r&&n===i)return null;if(this._isCheckEndSegmentsOnly){var s=this.isEndSegment(t,n)||this.isEndSegment(r,i);if(!s)return null}var a=t.getCoordinates()[n],l=t.getCoordinates()[n+1],c=r.getCoordinates()[i],f=r.getCoordinates()[i+1];this._li.computeIntersection(a,l,c,f),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=a,this._intSegments[1]=l,this._intSegments[2]=c,this._intSegments[3]=f,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)};ln.prototype.isEndSegment=function(t,n){return n===0||n>=t.size()-2};ln.prototype.hasIntersection=function(){return this._interiorIntersection!==null};ln.prototype.isDone=function(){return this._findAllIntersections?!1:this._interiorIntersection!==null};ln.prototype.interfaces_=function(){return[va]};ln.prototype.getClass=function(){return ln};ln.createAllIntersectionsFinder=function(t){var n=new ln(t);return n.setFindAllIntersections(!0),n};ln.createAnyIntersectionFinder=function(t){return new ln(t)};ln.createIntersectionCounter=function(t){var n=new ln(t);return n.setFindAllIntersections(!0),n.setKeepIntersections(!1),n};var gi=function(){this._li=new Ta,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};gi.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()};gi.prototype.getIntersections=function(){return this._segInt.getIntersections()};gi.prototype.isValid=function(){return this.execute(),this._isValid};gi.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t};gi.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new ln(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new c_;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null};gi.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Xs(this.getErrorMessage(),this._segInt.getInteriorIntersection())};gi.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+ui.toLineString(t[0],t[1])+" and "+ui.toLineString(t[2],t[3])};gi.prototype.interfaces_=function(){return[]};gi.prototype.getClass=function(){return gi};gi.computeIntersections=function(t){var n=new gi(t);return n.setFindAllIntersections(!0),n.isValid(),n.getIntersections()};var xa=function e(){this._nv=null;var t=arguments[0];this._nv=new gi(e.toSegmentStrings(t))};xa.prototype.checkValid=function(){this._nv.checkValid()};xa.prototype.interfaces_=function(){return[]};xa.prototype.getClass=function(){return xa};xa.toSegmentStrings=function(t){for(var n=new lt,r=t.iterator();r.hasNext();){var i=r.next();n.add(new Xi(i.getCoordinates(),i))}return n};xa.checkValid=function(t){var n=new xa(t);n.checkValid()};var yl=function(t){this._mapOp=t};yl.prototype.map=function(t){for(var n=this,r=new lt,i=0;i0&&i<4&&!this._preserveType?this._factory.createLineString(r):this._factory.createLinearRing(r)};or.prototype.interfaces_=function(){return[]};or.prototype.getClass=function(){return or};var Ss=function e(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Pt,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Pe&&typeof arguments[1]=="number"){var t=arguments[0],n=arguments[1];e.call(this,t.getCoordinates(),n)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var r=arguments[0],i=arguments[1];this._srcPts=r,this._isClosed=e.isClosed(r),this._snapTolerance=i}};Ss.prototype.snapVertices=function(t,n){for(var r=this,i=this._isClosed?t.size()-1:t.size(),s=0;s=0&&t.add(l+1,new M(a),!1)}};Ss.prototype.findSegmentIndexToSnap=function(t,n){for(var r=this,i=Rt.MAX_VALUE,s=-1,a=0;an&&(n=i)}return n}else if(arguments.length===2){var s=arguments[0],a=arguments[1];return Math.min(Re.computeOverlaySnapTolerance(s),Re.computeOverlaySnapTolerance(a))}};Re.computeSizeBasedSnapTolerance=function(t){var n=t.getEnvelopeInternal(),r=Math.min(n.getHeight(),n.getWidth()),i=r*Re.SNAP_PRECISION_FACTOR;return i};Re.snapToSelf=function(t,n,r){var i=new Re(t);return i.snapToSelf(n,r)};sN.SNAP_PRECISION_FACTOR.get=function(){return 1e-9};Object.defineProperties(Re,sN);var oN=function(e){function t(n,r,i){e.call(this),this._snapTolerance=n||null,this._snapPts=r||null,this._isSelfSnap=i!==void 0?i:!1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.snapLine=function(r,i){var s=new Ss(r,this._snapTolerance);return s.setAllowSnappingToSourceVertices(this._isSelfSnap),s.snapTo(i)},t.prototype.transformCoordinates=function(r,i){var s=r.toCoordinateArray(),a=this.snapLine(s,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(a)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(or),zn=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};zn.prototype.getCommon=function(){return Rt.longBitsToDouble(this._commonBits)};zn.prototype.add=function(t){var n=Rt.doubleToLongBits(t);if(this._isFirst)return this._commonBits=n,this._commonSignExp=zn.signExpBits(this._commonBits),this._isFirst=!1,null;var r=zn.signExpBits(n);if(r!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=zn.numCommonMostSigMantissaBits(this._commonBits,n),this._commonBits=zn.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))};zn.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],n=Rt.longBitsToDouble(t),r=Rt.toBinaryString(t),i="0000000000000000000000000000000000000000000000000000000000000000"+r,s=i.substring(i.length-64),a=s.substring(0,1)+" "+s.substring(1,12)+"(exp) "+s.substring(12)+" [ "+n+" ]";return a}};zn.prototype.interfaces_=function(){return[]};zn.prototype.getClass=function(){return zn};zn.getBit=function(t,n){var r=1<>52};zn.zeroLowerBits=function(t,n){var r=(1<=0;i--){if(zn.getBit(t,i)!==zn.getBit(n,i))return r;r++}return 52};var bo=function(){this._commonCoord=null,this._ccFilter=new xl},g_={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};bo.prototype.addCommonBits=function(t){var n=new Lo(this._commonCoord);t.apply(n),t.geometryChanged()};bo.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var n=new M(this._commonCoord);n.x=-n.x,n.y=-n.y;var r=new Lo(n);return t.apply(r),t.geometryChanged(),t};bo.prototype.getCommonCoordinate=function(){return this._commonCoord};bo.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()};bo.prototype.interfaces_=function(){return[]};bo.prototype.getClass=function(){return bo};g_.CommonCoordinateFilter.get=function(){return xl};g_.Translater.get=function(){return Lo};Object.defineProperties(bo,g_);var xl=function(){this._commonBitsX=new zn,this._commonBitsY=new zn};xl.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)};xl.prototype.getCommonCoordinate=function(){return new M(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())};xl.prototype.interfaces_=function(){return[vs]};xl.prototype.getClass=function(){return xl};var Lo=function(){this.trans=null;var t=arguments[0];this.trans=t};Lo.prototype.filter=function(t,n){var r=t.getOrdinate(n,0)+this.trans.x,i=t.getOrdinate(n,1)+this.trans.y;t.setOrdinate(n,0,r),t.setOrdinate(n,1,i)};Lo.prototype.isDone=function(){return!1};Lo.prototype.isGeometryChanged=function(){return!0};Lo.prototype.interfaces_=function(){return[ci]};Lo.prototype.getClass=function(){return Lo};var un=function(t,n){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=n,this.computeSnapTolerance()};un.prototype.selfSnap=function(t){var n=new Re(t),r=n.snapTo(t,this._snapTolerance);return r};un.prototype.removeCommonBits=function(t){this._cbr=new bo,this._cbr.add(t[0]),this._cbr.add(t[1]);var n=new Array(2).fill(null);return n[0]=this._cbr.removeCommonBits(t[0].copy()),n[1]=this._cbr.removeCommonBits(t[1].copy()),n};un.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t};un.prototype.getResultGeometry=function(t){var n=this.snap(this._geom),r=At.overlayOp(n[0],n[1],t);return this.prepareResult(r)};un.prototype.checkValid=function(t){t.isValid()||wn.out.println("Snapped geometry is invalid")};un.prototype.computeSnapTolerance=function(){this._snapTolerance=Re.computeOverlaySnapTolerance(this._geom[0],this._geom[1])};un.prototype.snap=function(t){var n=this.removeCommonBits(t),r=Re.snap(n[0],n[1],this._snapTolerance);return r};un.prototype.interfaces_=function(){return[]};un.prototype.getClass=function(){return un};un.overlayOp=function(t,n,r){var i=new un(t,n);return i.getResultGeometry(r)};un.union=function(t,n){return un.overlayOp(t,n,At.UNION)};un.intersection=function(t,n){return un.overlayOp(t,n,At.INTERSECTION)};un.symDifference=function(t,n){return un.overlayOp(t,n,At.SYMDIFFERENCE)};un.difference=function(t,n){return un.overlayOp(t,n,At.DIFFERENCE)};var Xn=function(t,n){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=n};Xn.prototype.getResultGeometry=function(t){var n=null,r=!1,i=null;try{n=At.overlayOp(this._geom[0],this._geom[1],t);var s=!0;s&&(r=!0)}catch(a){if(a instanceof Zs)i=a;else throw a}finally{}if(!r)try{n=un.overlayOp(this._geom[0],this._geom[1],t)}catch(a){throw a instanceof Zs?i:a}finally{}return n};Xn.prototype.interfaces_=function(){return[]};Xn.prototype.getClass=function(){return Xn};Xn.overlayOp=function(t,n,r){var i=new Xn(t,n);return i.getResultGeometry(r)};Xn.union=function(t,n){return Xn.overlayOp(t,n,At.UNION)};Xn.intersection=function(t,n){return Xn.overlayOp(t,n,At.INTERSECTION)};Xn.symDifference=function(t,n){return Xn.overlayOp(t,n,At.SYMDIFFERENCE)};Xn.difference=function(t,n){return Xn.overlayOp(t,n,At.DIFFERENCE)};var Ef=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],n=arguments[1];this.mce=t,this.chainIndex=n};Ef.prototype.computeIntersections=function(t,n){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,n)};Ef.prototype.interfaces_=function(){return[]};Ef.prototype.getClass=function(){return Ef};var yr=function e(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var t=arguments[0],n=arguments[1];this._eventType=e.DELETE,this._xValue=t,this._insertEvent=n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],s=arguments[2];this._eventType=e.INSERT,this._label=r,this._xValue=i,this._obj=s}},m_={INSERT:{configurable:!0},DELETE:{configurable:!0}};yr.prototype.isDelete=function(){return this._eventType===yr.DELETE};yr.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t};yr.prototype.getObject=function(){return this._obj};yr.prototype.compareTo=function(t){var n=t;return this._xValuen._xValue?1:this._eventTypen._eventType?1:0};yr.prototype.getInsertEvent=function(){return this._insertEvent};yr.prototype.isInsert=function(){return this._eventType===yr.INSERT};yr.prototype.isSameLabel=function(t){return this._label===null?!1:this._label===t._label};yr.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex};yr.prototype.interfaces_=function(){return[ti]};yr.prototype.getClass=function(){return yr};m_.INSERT.get=function(){return 1};m_.DELETE.get=function(){return 2};Object.defineProperties(yr,m_);var Yd=function(){};Yd.prototype.interfaces_=function(){return[]};Yd.prototype.getClass=function(){return Yd};var Cn=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],n=arguments[1],r=arguments[2];this._li=t,this._includeProper=n,this._recordIsolated=r};Cn.prototype.isTrivialIntersection=function(t,n,r,i){if(t===r&&this._li.getIntersectionNum()===1){if(Cn.isAdjacentSegments(n,i))return!0;if(t.isClosed()){var s=t.getNumPoints()-1;if(n===0&&i===s||i===0&&n===s)return!0}}return!1};Cn.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint};Cn.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t};Cn.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior};Cn.prototype.isBoundaryPointInternal=function(t,n){for(var r=n.iterator();r.hasNext();){var i=r.next(),s=i.getCoordinate();if(t.isIntersection(s))return!0}return!1};Cn.prototype.hasProperIntersection=function(){return this._hasProper};Cn.prototype.hasIntersection=function(){return this._hasIntersection};Cn.prototype.isDone=function(){return this._isDone};Cn.prototype.isBoundaryPoint=function(t,n){return n===null?!1:!!(this.isBoundaryPointInternal(t,n[0])||this.isBoundaryPointInternal(t,n[1]))};Cn.prototype.setBoundaryNodes=function(t,n){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=n};Cn.prototype.addIntersections=function(t,n,r,i){if(t===r&&n===i)return null;this.numTests++;var s=t.getCoordinates()[n],a=t.getCoordinates()[n+1],l=r.getCoordinates()[i],c=r.getCoordinates()[i+1];this._li.computeIntersection(s,a,l,c),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),r.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,n,r,i)||(this._hasIntersection=!0,(this._includeProper||!this._li.isProper())&&(t.addIntersections(this._li,n,0),r.addIntersections(this._li,i,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))};Cn.prototype.interfaces_=function(){return[]};Cn.prototype.getClass=function(){return Cn};Cn.isAdjacentSegments=function(t,n){return Math.abs(t-n)===1};var AA=function(e){function t(){e.call(this),this.events=new lt,this.nOverlaps=null}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.prepareEvents=function(){var r=this;hi.sort(this.events);for(var i=0;in||this._maxa?1:0};Sf.prototype.interfaces_=function(){return[vu]};Sf.prototype.getClass=function(){return Sf};var DA=function(e){function t(){e.call(this),this._item=null;var n=arguments[0],r=arguments[1],i=arguments[2];this._min=n,this._max=r,this._item=i}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.query=function(r,i,s){if(!this.intersects(r,i))return null;s.visitItem(this._item)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Cs),kA=function(e){function t(){e.call(this),this._node1=null,this._node2=null;var n=arguments[0],r=arguments[1];this._node1=n,this._node2=r,this.buildExtent(this._node1,this._node2)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.buildExtent=function(r,i){this._min=Math.min(r._min,i._min),this._max=Math.max(r._max,i._max)},t.prototype.query=function(r,i,s){if(!this.intersects(r,i))return null;this._node1!==null&&this._node1.query(r,i,s),this._node2!==null&&this._node2.query(r,i,s)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t}(Cs),Ns=function(){this._leaves=new lt,this._root=null,this._level=0};Ns.prototype.buildTree=function(){var t=this;hi.sort(this._leaves,new Cs.NodeComparator);for(var n=this._leaves,r=null,i=new lt;;){if(t.buildLevel(n,i),i.size()===1)return i.get(0);r=n,n=i,i=r}};Ns.prototype.insert=function(t,n,r){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new DA(t,n,r))};Ns.prototype.query=function(t,n,r){this.init(),this._root.query(t,n,r)};Ns.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()};Ns.prototype.printNode=function(t){wn.out.println(ui.toLineString(new M(t._min,this._level),new M(t._max,this._level)))};Ns.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()};Ns.prototype.buildLevel=function(t,n){this._level++,n.clear();for(var r=0;r=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,i[0]),this.insertBoundaryPoint(this._argIndex,i[i.length-1])},t.prototype.getInvalidPoint=function(){return this._invalidPoint},t.prototype.getBoundaryPoints=function(){for(var r=this.getBoundaryNodes(),i=new Array(r.size()).fill(null),s=0,a=r.iterator();a.hasNext();){var l=a.next();i[s++]=l.getCoordinate().copy()}return i},t.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},t.prototype.addSelfIntersectionNode=function(r,i,s){if(this.isBoundaryNode(r,i))return null;s===k.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(r,i):this.insertPoint(r,i,s)},t.prototype.addPolygonRing=function(r,i,s){if(r.isEmpty())return null;var a=Vt.removeRepeatedPoints(r.getCoordinates());if(a.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=a[0],null;var l=i,c=s;dt.isCCW(a)&&(l=s,c=i);var f=new Xd(a,new ie(this._argIndex,k.BOUNDARY,l,c));this._lineEdgeMap.put(r,f),this.insertEdge(f),this.insertPoint(this._argIndex,a[0],k.BOUNDARY)},t.prototype.insertPoint=function(r,i,s){var a=this._nodes.addNode(i),l=a.getLabel();l===null?a._label=new ie(r,s):l.setLocation(r,s)},t.prototype.createEdgeSetIntersector=function(){return new AA},t.prototype.addSelfIntersectionNodes=function(r){for(var i=this,s=this._edges.iterator();s.hasNext();)for(var a=s.next(),l=a.getLabel().getLocation(r),c=a.eiList.iterator();c.hasNext();){var f=c.next();i.addSelfIntersectionNode(r,f.coord,l)}},t.prototype.add=function(){if(arguments.length===1){var r=arguments[0];if(r.isEmpty())return null;if(r instanceof ps&&(this._useBoundaryDeterminationRule=!1),r instanceof Ye)this.addPolygon(r);else if(r instanceof Pe)this.addLineString(r);else if(r instanceof gr)this.addPoint(r);else if(r instanceof Cu)this.addCollection(r);else if(r instanceof pa)this.addCollection(r);else if(r instanceof ps)this.addCollection(r);else if(r instanceof Hn)this.addCollection(r);else throw new Error(r.getClass().getName())}else return e.prototype.add.apply(this,arguments)},t.prototype.addCollection=function(r){for(var i=this,s=0;s50?(this._areaPtLocator===null&&(this._areaPtLocator=new Ou(this._parentGeom)),this._areaPtLocator.locate(r)):this._ptLocator.locate(r,this._parentGeom)},t.prototype.findEdge=function(){if(arguments.length===1){var r=arguments[0];return this._lineEdgeMap.get(r)}else return e.prototype.findEdge.apply(this,arguments)},t.prototype.interfaces_=function(){return[]},t.prototype.getClass=function(){return t},t.determineBoundary=function(r,i){return r.isInBoundary(i)?k.BOUNDARY:k.INTERIOR},t}(xe),Mu=function(){if(this._li=new Ta,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new wc(0,t)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=Qr.OGC_SFS_BOUNDARY_RULE;n.getPrecisionModel().compareTo(r.getPrecisionModel())>=0?this.setComputationPrecision(n.getPrecisionModel()):this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new wc(0,n,i),this._arg[1]=new wc(1,r,i)}else if(arguments.length===3){var s=arguments[0],a=arguments[1],l=arguments[2];s.getPrecisionModel().compareTo(a.getPrecisionModel())>=0?this.setComputationPrecision(s.getPrecisionModel()):this.setComputationPrecision(a.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new wc(0,s,l),this._arg[1]=new wc(1,a,l)}};Mu.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()};Mu.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)};Mu.prototype.interfaces_=function(){return[]};Mu.prototype.getClass=function(){return Mu};var ca=function(){};ca.prototype.interfaces_=function(){return[]};ca.prototype.getClass=function(){return ca};ca.map=function(){if(arguments[0]instanceof Tt&&Ot(arguments[1],ca.MapOp)){for(var t=arguments[0],n=arguments[1],r=new lt,i=0;i=t.size()?null:t.get(n)};je.union=function(t){var n=new je(t);return n.union()};uN.STRTREE_NODE_CAPACITY.get=function(){return 4};Object.defineProperties(je,uN);var Kd=function(){};Kd.prototype.interfaces_=function(){return[]};Kd.prototype.getClass=function(){return Kd};Kd.union=function(t,n){if(t.isEmpty()||n.isEmpty()){if(t.isEmpty()&&n.isEmpty())return At.createEmptyResult(At.UNION,t,n,t.getFactory());if(t.isEmpty())return n.copy();if(n.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(n),Xn.overlayOp(t,n,At.UNION)};function Oa(){return new Qd}function Qd(){this.reset()}Qd.prototype={constructor:Qd,reset:function(){this.s=this.t=0},add:function(e){Aw(Dh,e,this.t),Aw(this,Dh.s,this.s),this.s?this.t+=Dh.t:this.s=Dh.t},valueOf:function(){return this.s}};var Dh=new Qd;function Aw(e,t,n){var r=e.s=t+n,i=r-t,s=r-i;e.t=t-s+(n-i)}var Ce=1e-6,ue=Math.PI,Us=ue/2,Dw=ue/4,Qs=ue*2,zo=180/ue,Li=ue/180,Vn=Math.abs,FA=Math.atan,Du=Math.atan2,qe=Math.cos,He=Math.sin,Yu=Math.sqrt;function cN(e){return e>1?0:e<-1?ue:Math.acos(e)}function wl(e){return e>1?Us:e<-1?-Us:Math.asin(e)}function bc(){}function Jd(e,t){e&&Fw.hasOwnProperty(e.type)&&Fw[e.type](e,t)}var kw={Feature:function(e,t){Jd(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++rue?e-Qs:e<-ue?e+Qs:e,t]}Dv.invert=Dv;function zA(e,t,n){return(e%=Qs)?t||n?fN(Bw(e),Uw(t,n)):Bw(e):t||n?Uw(t,n):Dv}function zw(e){return function(t,n){return t+=e,[t>ue?t-Qs:t<-ue?t+Qs:t,n]}}function Bw(e){var t=zw(e);return t.invert=zw(-e),t}function Uw(e,t){var n=qe(e),r=He(e),i=qe(t),s=He(t);function a(l,c){var f=qe(c),g=qe(l)*f,d=He(l)*f,v=He(c),y=v*n+g*r;return[Du(d*i-y*s,g*n-v*r),wl(y*i+d*s)]}return a.invert=function(l,c){var f=qe(c),g=qe(l)*f,d=He(l)*f,v=He(c),y=v*i-d*s;return[Du(d*i+v*s,g*n+y*r),wl(y*n-g*r)]},a}function BA(e,t,n,r,i,s){if(n){var a=qe(t),l=He(t),c=r*n;i==null?(i=t+r*Qs,s=t-c/2):(i=Vw(a,i),s=Vw(a,s),(r>0?is)&&(i+=r*Qs));for(var f,g=i;r>0?g>s:g1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function UA(e,t,n,r,i,s){var a=e[0],l=e[1],c=t[0],f=t[1],g=0,d=1,v=c-a,y=f-l,x;if(x=n-a,!(!v&&x>0)){if(x/=v,v<0){if(x0){if(x>d)return;x>g&&(g=x)}if(x=i-a,!(!v&&x<0)){if(x/=v,v<0){if(x>d)return;x>g&&(g=x)}else if(v>0){if(x0)){if(x/=y,y<0){if(x0){if(x>d)return;x>g&&(g=x)}if(x=s-l,!(!y&&x<0)){if(x/=y,y<0){if(x>d)return;x>g&&(g=x)}else if(y>0){if(x0&&(e[0]=a+g*v,e[1]=l+g*y),d<1&&(t[0]=a+d*v,t[1]=l+d*y),!0}}}}}function ad(e,t){return Vn(e[0]-t[0])=0;--l)i.point((d=g[l])[0],d[1]);else r(v.x,v.p.x,-1,i);v=v.p}v=v.o,g=v.z,y=!y}while(!v.v);i.lineEnd()}}}function Gw(e){if(t=e.length){for(var t,n=0,r=e[0],i;++nt?1:e>=t?0:NaN}function VA(e){return e.length===1&&(e=GA(e)),{left:function(t,n,r,i){for(r==null&&(r=0),i==null&&(i=t.length);r>>1;e(t[s],n)<0?r=s+1:i=s}return r},right:function(t,n,r,i){for(r==null&&(r=0),i==null&&(i=t.length);r>>1;e(t[s],n)>0?i=s:r=s+1}return r}}}function GA(e){return function(t,n){return pN(e(t),n)}}VA(pN);function gN(e){for(var t=e.length,n,r=-1,i=0,s,a;++r=0;)for(a=e[t],n=a.length;--n>=0;)s[--i]=a[n];return s}var Lc=1e9,zh=-Lc;function qA(e,t,n,r){function i(f,g){return e<=f&&f<=n&&t<=g&&g<=r}function s(f,g,d,v){var y=0,x=0;if(f==null||(y=a(f,d))!==(x=a(g,d))||c(f,g)<0^d>0)do v.point(y===0||y===3?e:n,y>1?r:t);while((y=(y+d+4)%4)!==x);else v.point(g[0],g[1])}function a(f,g){return Vn(f[0]-e)0?0:3:Vn(f[0]-n)0?2:1:Vn(f[1]-t)0?1:0:g>0?3:2}function l(f,g){return c(f.x,g.x)}function c(f,g){var d=a(f,1),v=a(g,1);return d!==v?d-v:d===0?g[1]-f[1]:d===1?f[0]-g[0]:d===2?f[1]-g[1]:g[0]-f[0]}return function(f){var g=f,d=hN(),v,y,x,S,C,E,w,N,I,R,A,B={point:q,lineStart:W,lineEnd:$,polygonStart:Y,polygonEnd:J};function q(ut,it){i(ut,it)&&g.point(ut,it)}function Q(){for(var ut=0,it=0,yt=y.length;itr&&(ht-Lt)*(r-ct)>(_t-ct)*(e-Lt)&&++ut:_t<=r&&(ht-Lt)*(r-ct)<(_t-ct)*(e-Lt)&&--ut;return ut}function Y(){g=d,v=[],y=[],A=!0}function J(){var ut=Q(),it=A&&ut,yt=(v=gN(v)).length;(it||yt)&&(f.polygonStart(),it&&(f.lineStart(),s(null,null,1,f),f.lineEnd()),yt&&dN(v,l,ut,s,f),f.polygonEnd()),g=f,v=y=x=null}function W(){B.point=D,y&&y.push(x=[]),R=!0,I=!1,w=N=NaN}function $(){v&&(D(S,C),E&&I&&d.rejoin(),v.push(d.result())),B.point=q,I&&g.lineEnd()}function D(ut,it){var yt=i(ut,it);if(y&&x.push([ut,it]),R)S=ut,C=it,E=yt,R=!1,yt&&(g.lineStart(),g.point(ut,it));else if(yt&&I)g.point(ut,it);else{var z=[w=Math.max(zh,Math.min(Lc,w)),N=Math.max(zh,Math.min(Lc,N))],at=[ut=Math.max(zh,Math.min(Lc,ut)),it=Math.max(zh,Math.min(Lc,it))];UA(z,at,e,t,n,r)?(I||(g.lineStart(),g.point(z[0],z[1])),g.point(at[0],at[1]),yt||g.lineEnd(),A=!1):yt&&(g.lineStart(),g.point(ut,it),A=!1)}w=ut,N=it,I=yt}return B}}var fm=Oa();function HA(e,t){var n=t[0],r=t[1],i=[He(n),-qe(n),0],s=0,a=0;fm.reset();for(var l=0,c=e.length;l=0?1:-1,q=B*A,Q=q>ue,Y=x*I;if(fm.add(Du(Y*B*He(q),S*R+Y*qe(q))),s+=Q?A+B*Qs:A,Q^v>=n^w>=n){var J=$d(ku(d),ku(E));Av(J);var W=$d(i,J);Av(W);var $=(Q^A>=0?-1:1)*wl(W[2]);(r>$||r===$&&(J[0]||J[1]))&&(a+=Q^A>=0?1:-1)}}return(s<-Ce||sCf&&(Cf=e),tep&&(ep=t)}Oa();function mN(e,t,n,r){return function(i,s){var a=t(s),l=i.invert(r[0],r[1]),c=hN(),f=t(c),g=!1,d,v,y,x={point:S,lineStart:E,lineEnd:w,polygonStart:function(){x.point=N,x.lineStart=I,x.lineEnd=R,v=[],d=[]},polygonEnd:function(){x.point=S,x.lineStart=E,x.lineEnd=w,v=gN(v);var A=HA(d,l);v.length?(g||(s.polygonStart(),g=!0),dN(v,XA,A,n,s)):A&&(g||(s.polygonStart(),g=!0),s.lineStart(),n(null,null,1,s),s.lineEnd()),g&&(s.polygonEnd(),g=!1),v=d=null},sphere:function(){s.polygonStart(),s.lineStart(),n(null,null,1,s),s.lineEnd(),s.polygonEnd()}};function S(A,B){var q=i(A,B);e(A=q[0],B=q[1])&&s.point(A,B)}function C(A,B){var q=i(A,B);a.point(q[0],q[1])}function E(){x.point=C,a.lineStart()}function w(){x.point=S,a.lineEnd()}function N(A,B){y.push([A,B]);var q=i(A,B);f.point(q[0],q[1])}function I(){f.lineStart(),y=[]}function R(){N(y[0][0],y[0][1]),f.lineEnd();var A=f.clean(),B=c.result(),q,Q=B.length,Y,J,W;if(y.pop(),d.push(y),y=null,!!Q){if(A&1){if(J=B[0],(Y=J.length-1)>0){for(g||(s.polygonStart(),g=!0),s.lineStart(),q=0;q1&&A&2&&B.push(B.pop().concat(B.shift())),v.push(B.filter(WA))}}return x}}function WA(e){return e.length>1}function XA(e,t){return((e=e.x)[0]<0?e[1]-Us-Ce:Us-e[1])-((t=t.x)[0]<0?t[1]-Us-Ce:Us-t[1])}const Zw=mN(function(){return!0},YA,QA,[-ue,-Us]);function YA(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(s,a){var l=s>0?ue:-ue,c=Vn(s-t);Vn(c-ue)0?Us:-Us),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(l,n),e.point(s,n),i=0):r!==l&&c>=ue&&(Vn(t-r)Ce?FA((He(t)*(s=qe(r))*He(n)-He(r)*(i=qe(t))*He(e))/(i*s*a)):(t+r)/2}function QA(e,t,n,r){var i;if(e==null)i=n*Us,r.point(-ue,i),r.point(0,i),r.point(ue,i),r.point(ue,0),r.point(ue,-i),r.point(0,-i),r.point(-ue,-i),r.point(-ue,0),r.point(-ue,i);else if(Vn(e[0]-t[0])>Ce){var s=e[0]0,i=Vn(n)>Ce;function s(g,d,v,y){BA(y,e,t,v,g,d)}function a(g,d){return qe(g)*qe(d)>n}function l(g){var d,v,y,x,S;return{lineStart:function(){x=y=!1,S=1},point:function(C,E){var w=[C,E],N,I=a(C,E),R=r?I?0:f(C,E):I?f(C+(C<0?ue:-ue),E):0;if(!d&&(x=y=I)&&g.lineStart(),I!==y&&(N=c(d,w),(!N||ad(d,N)||ad(w,N))&&(w[0]+=Ce,w[1]+=Ce,I=a(w[0],w[1]))),I!==y)S=0,I?(g.lineStart(),N=c(w,d),g.point(N[0],N[1])):(N=c(d,w),g.point(N[0],N[1]),g.lineEnd()),d=N;else if(i&&d&&r^I){var A;!(R&v)&&(A=c(w,d,!0))&&(S=0,r?(g.lineStart(),g.point(A[0][0],A[0][1]),g.point(A[1][0],A[1][1]),g.lineEnd()):(g.point(A[1][0],A[1][1]),g.lineEnd(),g.lineStart(),g.point(A[0][0],A[0][1])))}I&&(!d||!ad(d,w))&&g.point(w[0],w[1]),d=w,y=I,v=R},lineEnd:function(){y&&g.lineEnd(),d=null},clean:function(){return S|(x&&y)<<1}}}function c(g,d,v){var y=ku(g),x=ku(d),S=[1,0,0],C=$d(y,x),E=kh(C,C),w=C[0],N=E-w*w;if(!N)return!v&&g;var I=n*E/N,R=-n*w/N,A=$d(S,C),B=Fh(S,I),q=Fh(C,R);cm(B,q);var Q=A,Y=kh(B,Q),J=kh(Q,Q),W=Y*Y-J*(kh(B,B)-1);if(!(W<0)){var $=Yu(W),D=Fh(Q,(-Y-$)/J);if(cm(D,B),D=Mv(D),!v)return D;var ut=g[0],it=d[0],yt=g[1],z=d[1],at;it0^D[1]<(Vn(D[0]-ut)ue^(ut<=D[0]&&D[0]<=it)){var ct=Fh(Q,(-Y+$)/J);return cm(ct,B),[D,Mv(ct)]}}}function f(g,d){var v=r?e:ue-e,y=0;return g<-v?y|=1:g>v&&(y|=2),d<-v?y|=4:d>v&&(y|=8),y}return mN(a,l,s,r?[0,-e]:[-ue,e-ue])}function vN(e){return function(t){var n=new kv;for(var r in e)n[r]=e[r];return n.stream=t,n}}function kv(){}kv.prototype={constructor:kv,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function yN(e,t,n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],s=e.clipExtent&&e.clipExtent();e.scale(150).translate([0,0]),s!=null&&e.clipExtent(null),jA(n,e.stream(Hw));var a=Hw.result(),l=Math.min(r/(a[1][0]-a[0][0]),i/(a[1][1]-a[0][1])),c=+t[0][0]+(r-l*(a[1][0]+a[0][0]))/2,f=+t[0][1]+(i-l*(a[1][1]+a[0][1]))/2;return s!=null&&e.clipExtent(s),e.scale(l*150).translate([c,f])}function $A(e,t,n){return yN(e,[[0,0],t],n)}var Ww=16,tD=qe(30*Li);function Xw(e,t){return+t?nD(e,t):eD(e)}function eD(e){return vN({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function nD(e,t){function n(r,i,s,a,l,c,f,g,d,v,y,x,S,C){var E=f-r,w=g-i,N=E*E+w*w;if(N>4*t&&S--){var I=a+v,R=l+y,A=c+x,B=Yu(I*I+R*R+A*A),q=wl(A/=B),Q=Vn(Vn(A)-1)t||Vn((E*$+w*D)/N-.5)>.3||a*v+l*y+c*x2?D[2]%360*Li:0,W()):[f*zo,g*zo,d*zo]},Q.precision=function(D){return arguments.length?(A=Xw(J,R=D*D),$()):Yu(R)},Q.fitExtent=function(D,ut){return yN(Q,D,ut)},Q.fitSize=function(D,ut){return $A(Q,D,ut)};function W(){y=fN(v=zA(f,g,d),t);var D=t(l,c);return s=r-D[0]*n,a=i+D[1]*n,$()}function $(){return B=q=null,Q}return function(){return t=e.apply(this,arguments),Q.invert=t.invert&&Y,W()}}function _N(e){return function(t,n){var r=qe(t),i=qe(n),s=e(r*i);return[s*i*He(t),s*He(n)]}}function xN(e){return function(t,n){var r=Yu(t*t+n*n),i=e(r),s=He(i),a=qe(i);return[Du(t*s,r*a),wl(r&&n*s/r)]}}var oD=_N(function(e){return Yu(2/(1+e))});oD.invert=xN(function(e){return 2*wl(e/2)});var wN=_N(function(e){return(e=cN(e))&&e/He(e)});wN.invert=xN(function(e){return e});function aD(){return iD(wN).scale(79.4188).clipAngle(180-.001)}function Yw(e,t){return[e,t]}Yw.invert=Yw;function lD(e,t,n){n=n||{};var r=n.units||"kilometers",i=n.steps||8;if(!e)throw new Error("geojson is required");if(typeof n!="object")throw new Error("options must be an object");if(typeof i!="number")throw new Error("steps must be an number");if(t===void 0)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var s=[];switch(e.type){case"GeometryCollection":return t_(e,function(a){var l=ld(a,t,r,i);l&&s.push(l)}),Cv(s);case"FeatureCollection":return dw(e,function(a){var l=ld(a,t,r,i);l&&dw(l,function(c){c&&s.push(c)})}),Cv(s)}return ld(e,t,r,i)}function ld(e,t,n,r){var i=e.properties||{},s=e.type==="Feature"?e.geometry:e;if(s.type==="GeometryCollection"){var a=[];return t_(e,function(S){var C=ld(S,t,n,r);C&&a.push(C)}),Cv(a)}var l=uD(s),c={type:s.type,coordinates:SN(s.coordinates,l)},f=new u_,g=f.read(c),d=VM(GM(t,n),"meters"),v=_n.bufferOp(g,d,r),y=new ZC;if(v=y.write(v),!EN(v.coordinates)){var x={type:v.type,coordinates:CN(v.coordinates,l)};return jf(x,i)}}function EN(e){return Array.isArray(e[0])?EN(e[0]):isNaN(e[0])}function SN(e,t){return typeof e[0]!="object"?t(e):e.map(function(n){return SN(n,t)})}function CN(e,t){return typeof e[0]!="object"?t.invert(e):e.map(function(n){return CN(n,t)})}function uD(e){var t=JM(e).geometry.coordinates,n=[-t[0],-t[1]];return aD().rotate(n).scale(Er)}function cD(e,t,n){n===void 0&&(n={});var r=Gd(e),i=Gd(t),s=kC.union(r.coordinates,i.coordinates);return s.length===0?null:s.length===1?Ap(s[0],n.properties):OC(s,n.properties)}function fD(e,t,n){n===void 0&&(n={});var r=Gd(e),i=Gd(t),s=kC.intersection(r.coordinates,i.coordinates);return s.length===0?null:s.length===1?Ap(s[0],n.properties):OC(s,n.properties)}const hD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAABSCAMAAAAhFXfZAAAC91BMVEVMaXEzeak2f7I4g7g3g7cua5gzeKg8hJo3grY4g7c3grU0gLI2frE0daAubJc2gbQwd6QzeKk2gLMtd5sxdKIua5g1frA2f7IydaM0e6w2fq41fK01eqo3grgubJgta5cxdKI1f7AydaQydaMxc6EubJgvbJkwcZ4ubZkwcJwubZgubJcydqUydKIxapgubJctbJcubZcubJcvbJYubJcvbZkubJctbJctbZcubJg2f7AubJcrbZcubJcubJcua5g3grY0fq8ubJcubJdEkdEwhsw6i88vhswuhcsuhMtBjMgthMsrg8srgss6is8qgcs8i9A9iMYtg8spgcoogMo7hcMngMonf8olfso4gr8kfck5iM8jfMk4iM8he8k1fro7itAgesk2hs8eecgzfLcofssdeMg0hc4cd8g2hcsxeLQbdsgZdcgxeLImfcszhM0vda4xgckzhM4xg84wf8Yxgs4udKsvfcQucqhUndROmdM1fK0wcZ8vb5w0eqpQm9MzeKhXoNVcpdYydKNWn9VZotVKltJFjsIwcJ1Rms9OlslLmtH///8+kc9epdYzd6dbo9VHkMM2f7FHmNBClM8ydqVcpNY9hro3gLM9hLczealQmcw3fa46f7A8gLMxc6I3eagyc6FIldJMl9JSnNRSntNNl9JPnNJFi75UnM9ZodVKksg8kM45jc09e6ZHltFBk883gbRBh7pDk9EwcaBzn784g7dKkcY2i81Om9M7j85Llc81is09g7Q4grY/j9A0eqxKmdFFltBEjcXf6fFImdBCiLxJl9FGlNFBi78yiMxVndEvbpo6js74+vx+psPP3+o/ks5HkcpGmNCjwdZCkNDM3ehYoNJEls+lxNkxh8xHks0+jdC1zd5Lg6r+/v/H2ufz9/o3jM3t8/edvdM/k89Th61OiLBSjbZklbaTt9BfptdjmL1AicBHj8hGk9FAgK1dkLNTjLRekrdClc/k7fM0icy0y9tgp9c4jc2NtM9Dlc8zicxeXZn3AAAAQ3RSTlMAHDdTb4yPA+LtnEQmC4L2EmHqB7XA0d0sr478x4/Yd5i1zOfyPkf1sLVq4Nh3FvjxopQ2/STNuFzUwFIwxKaejILpIBEV9wAABhVJREFUeF6s1NdyFEcYBeBeoQIhRAkLlRDGrhIgY3BJL8CVeKzuyXFzzjkn5ZxzzuScg3PO8cKzu70JkO0LfxdTU//pM9vTu7Xgf6KqOVTb9X7toRrVEfBf1HTVjZccrT/2by1VV928Yty9ZbVuucdz90frG8DBjl9pVApbOstvmMuvVgaNXSfAAd6pGxpy6yxf5ph43pS/4f3uoaGm2rdu72S9xzOvMymkZFq/ptDrk90mhW7e4zl7HLzhxGWPR20xmSxJ/VqldG5m9XhaVOA1DadsNh3Pu5L2N6QtPO/32JpqQBVVk20oy/Pi2s23WEvyfHbe1thadVQttvm7Llf65gGmXK67XtupyoM7HQhmXdLS8oGWJNeOJ3C5fG5XCEJnkez3/oFdsvgJ4l2ANZwhrJKk/7OSXa+3Vw2WJMlKnGkobouYk6T0TyX30klOUnTD9HJ5qpckL3EW/w4XF3Xd0FGywXUrstrclVsqz5Pd/sXFYyDnPdrLcQODmGOK47IZb4CmibmMn+MYRzFZ5jg33ZL/EJrWcszHmANy3ARBK/IXtciJy8VsitPSdE3uuHxzougojcUdr8/32atnz/ev3f/K5wtpxUTpcaI45zusVDpYtZi+jg0oU9b3x74h7+n9ABvYEZeKaVq0sh0AtLKsFtqNBdeT0MrSzwwlq9+x6xAO4tgOtSzbCjrNQQiNvQUbUEubvzBUeGw26yDCsRHCoLkTHDa7IdOLIThs/gHvChszh2CimE8peRs47cxANI0lYNB5y1DljpOF0IhzBDPOZnDOqYYbeGKECbPzWnXludPphw5c2YBq5zlwXphIbO4VDCZ0gnPfUO1TwZoYwAs2ExPCedAu9DAjfQUjzITQb3jNj0KG2Sgt6BHaQUdYzWz+XmBktOHwanXjaSTcwwziBcuMOtwBmqPrTOxFQR/DRKKPqyur0aiW6cULYsx6tBm0jXpR/AUWR6HRq9WVW6MRhIq5jLyjbaCTDCijyYJNpCajdyobP/eTw0iexBAKkJ3gA5KcQb2zBXsIBckn+xVv8jkZSaEFHE+jFEleAEfayRU0MouNoBmB/L50Ai/HSLIHxcrpCvnhSQAuakKp2C/YbCylJjXRVy/z3+Kv/RrNcCo+WUzlVEhzKffnTQnxeN9fWF88fiNCUdSTsaufaChKWInHeysygfpIqagoakW+vV20J8uyl6TyNKEZWV4oRSPyCkWpgOLSbkCObT8o2r6tlG58HQquf6O0v50tB7JM7F4EORd2dx/K0w/KHsVkLPaoYrwgP/y7krr3SSMA4zj+OBgmjYkxcdIJQyQRKgg2viX9Hddi9UBb29LrKR7CVVEEEXWojUkXNyfTNDE14W9gbHJNuhjDettN3ZvbOvdOqCD3Jp/9l+/wJE+9PkYGjx/fqkys3S2rMozM/o2106rfMUINo6hVqz+eu/hd1c4xTg0TAfy5kV+4UG6+IthHTU9woWmxuKNbTfuCSfovBCxq7EtHqvYL4Sm6F8GVxsSXHMQ07TOi1DKtZxjWaaIyi4CXWjxPccUw8WVbMYY5wxC1mzEyXMJWkllpRloi+Kkoq69sxBTlElF6aAxYUbjXNlhlDZilDnM4U5SlN5biRsRHnbx3mbeWjEh4mEyiuJDl5XcWVmX5GvNkFgLWZM5qwsop4/AWfLhU1cR7k1VVvcYCWRkOI6Xy5gmnphCYIkvzuNYzHzosq2oNk2RtSs8khfUOfHIDgR6ysYBaMpl4uEgk2U/oJTs9AaTSwma7dT69geAE2ZpEjUsn2ieJNHeKfrI3EcAGJ2ZaNgVuC8EBctCLc57P5u5led6IOBkIYkuQMrmmjChs4VkfOerHqSBkPzZlhe06RslZ3zMjk2sscqKwY0RcjKK+LWbzd7KiHhkncs/siFJ+V5eXxD34B8nVuJEpGJNmxN2gH3vSvp7J70tF+D1Ej8qUJD1TkErAND2GZwTFg/LubvmgiBG3SOvdlsqFQrkEzJCL1rstlnVFROixZoDDSuXQFHESwVGlcuQcMb/b42NgjLowh5MTDFE3vNB5qStRIErdCQEh6pLPR92anSUb/wAIhldAaDMpGgAAAABJRU5ErkJggg==",dD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=",pD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC";delete Fr.Icon.Default.prototype._getIconUrl;Fr.Icon.Default.mergeOptions({iconRetinaUrl:hD,iconUrl:dD,shadowUrl:pD});const gD=new Fr.Icon({iconUrl:"data:image/svg+xml;base64,"+btoa(` `),iconSize:[20,20],iconAnchor:[10,10]}),mD=new Fr.Icon({iconUrl:"data:image/svg+xml;base64,"+btoa(` `),iconSize:[6,6],iconAnchor:[3,3]}),vD=({isDrawing:e,onPointAdd:t,onDrawingComplete:n})=>(bC({click:r=>{e&&t([r.latlng.lat,r.latlng.lng])},keydown:r=>{r.originalEvent.key==="Escape"&&e&&n()}}),null),yD=({center:e,zoom:t})=>{const n=$y(),r=P.useRef({center:null,zoom:null});return ye.useEffect(()=>{const[i,s]=e||[],a=typeof i=="number"&&typeof s=="number",l=typeof t=="number"?t:n.getZoom(),c=!r.current.center||r.current.center[0]!==i||r.current.center[1]!==s||r.current.zoom!==l;a&&c&&(n.setView(e,l,{animate:!0}),r.current={center:e,zoom:l})},[e,t,n]),null},hm=e=>{if(!e||e.length<3)return 0;let t=0;const n=e.length;for(let a=0;aa+l[0],0)/n,i=3.28084,s=111320*Math.cos(r*Math.PI/180);return t*Math.pow(s*i,2)},NN=({center:e=[39.8283,-98.5795],zoom:t=15,property:n,sections:r=[],onSectionCreate:i,onSectionUpdate:s,onSectionDelete:a,onPropertyUpdate:l,onSectionClick:c,selectedSections:f=[],editable:g=!1,className:d="h-96 w-full",mode:v="view",gpsTrack:y=[],currentLocation:x=null,showTrackPoints:S=!0,direction:C=null})=>{console.log("PropertyMap render:",{center:e,zoom:t,sections:r.length,selectedSections:f,mode:v,gpsTrack:y.length,currentLocation:x});const[E,w]=P.useState(!1),[N,I]=P.useState([]),[R,A]=P.useState(null),[B,q]=P.useState(!1),[Q,Y]=P.useState(""),[J,W]=P.useState(""),[$,D]=P.useState(""),ut=P.useRef(null),it=P.useCallback(ct=>{I(ht=>[...ht,ct])},[]),yt=P.useCallback(()=>{N.length>=3?(hm(N),q(!0)):I([]),w(!1)},[N]),z=()=>{w(!0),I([]),A(null)},at=()=>{w(!1),I([]),q(!1),Y(""),W(""),D("")},tt=async()=>{if(!Q.trim()||N.length<3)return;const ct=hm(N),ht={name:Q,area:ct,polygonData:{type:"Polygon",coordinates:[N.map(([_t,wt])=>[wt,_t])]},grassType:J||null,soilType:$||null};try{i&&await i(ht),at()}catch(_t){console.error("Error creating section:",_t)}},vt=ct=>{c?c(ct):A((R==null?void 0:R.id)===ct.id?null:ct)},Lt=async()=>{if(!(!R||!a))try{await a(R.id),A(null)}catch(ct){console.error("Error deleting section:",ct)}};return p.jsxs("div",{className:`relative ${d}`,children:[g&&p.jsxs("div",{className:"absolute top-4 right-4 z-10 flex flex-col space-y-2",children:[p.jsx("div",{className:"bg-white rounded-lg shadow-lg p-2",children:E?p.jsxs("div",{className:"flex flex-col space-y-2",children:[p.jsxs("button",{onClick:yt,className:"btn-success text-sm px-3 py-2",disabled:N.length<3,title:"Finish drawing (or press Escape)",children:["Finish (",N.length," points)"]}),p.jsx("button",{onClick:at,className:"btn-secondary text-sm px-3 py-2",title:"Cancel drawing",children:"Cancel"})]}):p.jsx("button",{onClick:z,className:"btn-primary text-sm px-3 py-2",title:"Draw new lawn section",children:"Draw Section"})}),R&&p.jsxs("div",{className:"bg-white rounded-lg shadow-lg p-3",children:[p.jsx("h4",{className:"font-medium text-gray-900 mb-2",children:R.name}),p.jsxs("p",{className:"text-sm text-gray-600 mb-2",children:[Math.round(R.area).toLocaleString()," sq ft"]}),R.grassType&&p.jsxs("p",{className:"text-xs text-gray-500 mb-1",children:["Grass: ",R.grassType]}),R.soilType&&p.jsxs("p",{className:"text-xs text-gray-500 mb-3",children:["Soil: ",R.soilType]}),p.jsx("button",{onClick:Lt,className:"btn-danger text-xs px-2 py-1 w-full",children:"Delete Section"})]})]}),B&&p.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-black bg-opacity-50",children:p.jsxs("div",{className:"bg-white rounded-lg p-6 max-w-md w-full mx-4",children:[p.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-4",children:"New Lawn Section"}),p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{children:[p.jsx("label",{className:"label",children:"Section Name *"}),p.jsx("input",{type:"text",value:Q,onChange:ct=>Y(ct.target.value),className:"input",placeholder:"e.g., Front Yard, Back Lawn",autoFocus:!0})]}),p.jsxs("div",{children:[p.jsx("label",{className:"label",children:"Grass Type"}),p.jsxs("select",{value:J,onChange:ct=>W(ct.target.value),className:"input",children:[p.jsx("option",{value:"",children:"Select grass type"}),p.jsx("option",{value:"bermuda",children:"Bermuda"}),p.jsx("option",{value:"fescue",children:"Fescue"}),p.jsx("option",{value:"kentucky bluegrass",children:"Kentucky Bluegrass"}),p.jsx("option",{value:"zoysia",children:"Zoysia"}),p.jsx("option",{value:"st augustine",children:"St. Augustine"}),p.jsx("option",{value:"centipede",children:"Centipede"}),p.jsx("option",{value:"other",children:"Other"})]})]}),p.jsxs("div",{children:[p.jsx("label",{className:"label",children:"Soil Type"}),p.jsxs("select",{value:$,onChange:ct=>D(ct.target.value),className:"input",children:[p.jsx("option",{value:"",children:"Select soil type"}),p.jsx("option",{value:"clay",children:"Clay"}),p.jsx("option",{value:"sand",children:"Sand"}),p.jsx("option",{value:"loam",children:"Loam"}),p.jsx("option",{value:"silt",children:"Silt"}),p.jsx("option",{value:"rocky",children:"Rocky"})]})]}),p.jsxs("div",{className:"bg-gray-50 p-3 rounded-lg",children:[p.jsxs("p",{className:"text-sm text-gray-600",children:["Area: ",Math.round(hm(N)).toLocaleString()," sq ft"]}),p.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:[N.length," points drawn"]})]})]}),p.jsxs("div",{className:"flex justify-end space-x-3 mt-6",children:[p.jsx("button",{onClick:at,className:"btn-outline",children:"Cancel"}),p.jsx("button",{onClick:tt,disabled:!Q.trim(),className:"btn-primary",children:"Save Section"})]})]})}),p.jsxs(LC,{center:e,zoom:t,className:"h-full w-full rounded-lg",ref:ut,children:[p.jsx(IC,{attribution:'© OpenStreetMap contributors',url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),p.jsx(yD,{center:e,zoom:t}),p.jsx(vD,{isDrawing:E,onPointAdd:it,onDrawingComplete:yt}),n&&n.latitude&&n.longitude&&p.jsx($a,{position:[n.latitude,n.longitude],title:n.name}),r.map(ct=>{var we;let ht=ct.polygonData||ct.polygon_data;if(typeof ht=="string")try{ht=JSON.parse(ht)}catch(Ee){return console.error("Failed to parse polygon data:",Ee),null}if(!((we=ht==null?void 0:ht.coordinates)!=null&&we[0]))return null;const _t=ht.coordinates[0],wt=(R==null?void 0:R.id)===ct.id,Gt=f.includes(ct.id),jt=wt||Gt;return p.jsx(Vd,{positions:_t,pathOptions:{fillColor:Gt?"#10b981":"#3b82f6",fillOpacity:jt?.8:.5,color:Gt?"#059669":"#2563eb",weight:jt?4:3,opacity:1},eventHandlers:{click:()=>vt(ct)}},ct.id)}),(v==="execution"||v==="view")&&p.jsxs(p.Fragment,{children:[y.length>1&&p.jsx(sd,{positions:y.map(ct=>[ct.lat,ct.lng]),pathOptions:{color:"#EF4444",weight:4,opacity:.8}}),S&&y.map((ct,ht)=>ht%10===0&&p.jsx($a,{position:[ct.lat,ct.lng],icon:mD},`track-${ht}`)),x&&v==="execution"&&p.jsx($a,{position:[x.lat,x.lng],icon:gD}),C&&r&&r.length>0&&(()=>{let ct=90,ht=-90,_t=180,wt=-180;if(r.forEach(Nn=>{var Ji;let Ke=Nn.polygonData||Nn.polygon_data;if(typeof Ke=="string")try{Ke=JSON.parse(Ke)}catch{return}(Ji=Ke==null?void 0:Ke.coordinates)!=null&&Ji[0]&&Ke.coordinates[0].forEach(([ar,cn])=>{arht&&(ht=ar),cn<_t&&(_t=cn),cn>wt&&(wt=cn)})}),!(ct{const xi=cn/72*2*Math.PI;return[Gt+Nn*Math.sin(xi),jt+Ke*Math.cos(xi)]});return p.jsxs(p.Fragment,{children:[p.jsx(sd,{positions:Ji,pathOptions:{color:"#A855F7",weight:3,dashArray:"8,6",opacity:.9}}),p.jsx("div",{className:"absolute top-4 left-4 bg-white rounded shadow px-2 py-1 text-xs text-gray-900 border border-purple-200",children:"Direction: Circular"})]})}}if(we.length===0)return null;const Ee=(ht-ct)*.02,Je=(wt-_t)*.02,De=[];C==="N_S"?(De.push(we),De.push([[ht,jt-Je],[ct,jt-Je]]),De.push([[ht,jt+Je],[ct,jt+Je]])):C==="E_W"?(De.push(we),De.push([[Gt-Ee,_t],[Gt-Ee,wt]]),De.push([[Gt+Ee,_t],[Gt+Ee,wt]])):(C==="NE_SW"||C==="NW_SE")&&De.push(we);const jr={N_S:"North to South",E_W:"East to West",NE_SW:"NE to SW",NW_SE:"NW to SE",CIRCULAR:"Circular"};return p.jsxs(p.Fragment,{children:[De.map((Nn,Ke)=>p.jsx(sd,{positions:Nn,pathOptions:{color:"#A855F7",weight:Ke===0?4:2,dashArray:"8,6",opacity:.95}},`dir-${Ke}`)),p.jsxs("div",{className:"absolute top-4 left-4 bg-white rounded shadow px-2 py-1 text-xs text-gray-900 border border-purple-200",children:["Direction: ",jr[(C||"").toUpperCase()]||C]})]})})()]}),N.length>0&&p.jsxs(p.Fragment,{children:[N.map((ct,ht)=>p.jsx($a,{position:ct,icon:new Fr.Icon({iconUrl:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMTIiIGN5PSIxMiIgcj0iNCIgZmlsbD0iIzNiODJmNiIgc3Ryb2tlPSJ3aGl0ZSIgc3Ryb2tlLXdpZHRoPSIyIi8+Cjwvc3ZnPgo=",iconSize:[12,12],iconAnchor:[6,6]})},ht)),N.length>=3&&p.jsx(Vd,{positions:N,pathOptions:{fillColor:"#3b82f6",fillOpacity:.3,color:"#3b82f6",weight:2,dashArray:"5, 5"}})]})]}),E&&p.jsxs("div",{className:"absolute bottom-4 left-4 bg-white rounded-lg shadow-lg p-3 max-w-xs",children:[p.jsx("p",{className:"text-sm text-gray-700",children:p.jsx("strong",{children:"Drawing Mode:"})}),p.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:["Click to add points. Press ",p.jsx("kbd",{className:"px-1 py-0.5 bg-gray-100 rounded text-xs",children:"Escape"}),' or click "Finish" when done.']}),p.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Need at least 3 points to create a section."})]}),v==="execution"&&y.length>0&&p.jsxs("div",{className:"absolute bottom-4 left-4 bg-white rounded-lg shadow-lg p-3",children:[p.jsx("p",{className:"text-sm font-medium text-gray-700",children:"GPS Tracking Active"}),p.jsxs("p",{className:"text-xs text-gray-600",children:["Track Points: ",y.length]}),x&&p.jsxs("p",{className:"text-xs text-gray-600",children:["Accuracy: ±",Math.round(x.accuracy||0),"m"]})]}),r.length>0&&!E&&v!=="execution"&&p.jsxs("div",{className:"absolute bottom-4 left-4 bg-white rounded-lg shadow-lg p-3",children:[p.jsxs("p",{className:"text-sm font-medium text-gray-700",children:[r.length," Section",r.length!==1?"s":""]}),p.jsxs("p",{className:"text-xs text-gray-600",children:["Total: ",r.reduce((ct,ht)=>ct+(ht.area||0),0).toLocaleString()," sq ft"]})]})]})},_D=({application:e,propertyDetails:t,onClose:n})=>{var I,R,A,B,q,Q;const[r,i]=P.useState(null),[s,a]=P.useState([]),[l,c]=P.useState(null),[f,g]=P.useState(!0),[d,v]=P.useState(null),[y,x]=P.useState(null),S=(Y,J,W,$)=>{const ut=at=>at*Math.PI/180,it=ut(W-Y),yt=ut($-J),z=Math.sin(it/2)**2+Math.cos(ut(Y))*Math.cos(ut(W))*Math.sin(yt/2)**2;return 2*6371e3*Math.atan2(Math.sqrt(z),Math.sqrt(1-z))},C=(Y=[])=>{if(!Array.isArray(Y)||Y.length<2)return 0;let J=0;for(let W=1;W{if(!(Y!=null&&Y.gpsTrack))return 0;const J=Y.gpsTrack.totalDistance;return typeof J=="number"&&J>0?J*3.28084:C(Y.gpsTrack.points)},w=(Y,J)=>{var ut,it;if(!((ut=J==null?void 0:J.gpsTrack)!=null&&ut.points)||J.gpsTrack.points.length<2)return 0;let W=4;const $=(l==null?void 0:l.equipment)||{};if(typeof $.spreadWidth=="number"&&$.spreadWidth>0)W=$.spreadWidth;else if(typeof $.sprayWidthFeet=="number"&&$.sprayWidthFeet>0)W=$.sprayWidthFeet;else{const yt=((it=Y.equipmentName)==null?void 0:it.toLowerCase())||"";yt.includes("spreader")?W=12:yt.includes("sprayer")?W=20:yt.includes("mower")&&(W=6)}const D=Y.totalSectionArea||0;if(D<=0)return 0;try{const yt=(s||[]).map(Gt=>{var Ee;let jt=Gt.polygonData;if(typeof jt=="string")try{jt=JSON.parse(jt)}catch{jt=null}if(!((Ee=jt==null?void 0:jt.coordinates)!=null&&Ee[0]))return null;const we=jt.coordinates[0].map(([Je,De])=>[De,Je]);return Ap([we])}).filter(Boolean);if(yt.length===0){const Gt=E(J);if(Gt===0)return 0;const jt=Gt*W;return Math.min(Math.round(jt/D*100),100)}const z=yt.reduce((Gt,jt)=>Gt?cD(Gt,jt):jt,null);if(!z)return 0;const at=J.gpsTrack.points.map(Gt=>[Gt.lng,Gt.lat]),tt=UM(at),vt=W/2*.3048/1e3,Lt=lD(tt,vt,{units:"kilometers"});if(!Lt)return 0;const ct=fD(Lt,z);if(!ct)return 0;const ht=MC(ct),_t=D*.092903,wt=ht/_t*100;return Math.min(Math.round(wt),100)}catch(yt){console.warn("Coverage calc fallback due to error:",yt);const at=E(J)*W;return Math.min(Math.round(at/D*100),100)}};P.useEffect(()=>{(async()=>{var J;if(e!=null&&e.id)try{g(!0);const $=(await jc.getPlan(e.id)).data.data.plan;c($),$.sections&&a($.sections);try{const ut=(await jc.getLogs({planId:e.id})).data.data.logs;ut&&ut.length>0&&i(ut[0])}catch(D){console.log("No application logs found:",D)}try{const D=$.property_id||e.propertyId;if(D){const ut=await KO.getCurrent(D);v(ut.data.data.weather),x(null)}}catch(D){console.warn("Weather fetch failed:",((J=D==null?void 0:D.response)==null?void 0:J.data)||D.message),x("Weather unavailable")}}catch(W){console.error("Failed to fetch application data:",W)}finally{g(!1)}})()},[e==null?void 0:e.id]);const N=ye.useMemo(()=>{if(s.length===0)return null;let Y=0,J=0,W=0;return s.forEach($=>{var ut;let D=$.polygonData;if(typeof D=="string")try{D=JSON.parse(D)}catch{return}(ut=D==null?void 0:D.coordinates)!=null&&ut[0]&&D.coordinates[0].forEach(([it,yt])=>{Y+=it,J+=yt,W++})}),W>0?[Y/W,J/W]:null},[s]);return f?p.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:p.jsx("div",{className:"bg-white rounded-lg p-6 w-full max-w-4xl mx-4 max-h-[90vh] overflow-y-auto",children:p.jsx("div",{className:"flex items-center justify-center py-8",children:p.jsx("div",{className:"text-gray-500",children:"Loading application details..."})})})}):p.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:p.jsxs("div",{className:"bg-white rounded-lg p-6 w-full max-w-6xl mx-4 max-h-[90vh] overflow-y-auto",children:[p.jsxs("div",{className:"flex justify-between items-center mb-6",children:[p.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:"Application Details"}),p.jsx("button",{onClick:n,className:"text-gray-400 hover:text-gray-600",children:p.jsx(Hy,{className:"h-6 w-6"})})]}),p.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6",children:[p.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[p.jsxs("h3",{className:"font-semibold text-gray-900 mb-3 flex items-center",children:[p.jsx(zc,{className:"h-5 w-5 mr-2"}),"Property & Areas"]}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("p",{children:[p.jsx("span",{className:"font-medium",children:"Property:"})," ",e.propertyName]}),p.jsxs("p",{children:[p.jsx("span",{className:"font-medium",children:"Areas:"})," ",e.sectionNames]}),p.jsxs("p",{children:[p.jsx("span",{className:"font-medium",children:"Total Area:"})," ",(I=e.totalSectionArea)==null?void 0:I.toLocaleString()," sq ft"]})]})]}),p.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[p.jsxs("h3",{className:"font-semibold text-gray-900 mb-3 flex items-center",children:[p.jsx(mu,{className:"h-5 w-5 mr-2"}),"Equipment & Status"]}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("p",{children:[p.jsx("span",{className:"font-medium",children:"Equipment:"})," ",e.equipmentName]}),p.jsxs("p",{children:[p.jsx("span",{className:"font-medium",children:"Status:"}),p.jsx("span",{className:`ml-2 px-2 py-1 text-xs font-medium rounded-full ${e.status==="completed"?"bg-green-100 text-green-800":e.status==="planned"?"bg-blue-100 text-blue-800":e.status==="in_progress"?"bg-yellow-100 text-yellow-800":"bg-gray-100 text-gray-800"}`,children:e.status})]}),p.jsxs("p",{children:[p.jsx("span",{className:"font-medium",children:"Planned Date:"})," ",new Date(e.plannedDate).toLocaleDateString()]})]})]})]}),p.jsx("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mb-6",children:p.jsxs("div",{className:"bg-blue-50 p-4 rounded-lg col-span-1",children:[p.jsx("h3",{className:"font-semibold text-blue-900 mb-3",children:"Current Weather"}),d?p.jsxs("div",{className:"text-sm text-blue-900",children:[p.jsxs("div",{className:"flex items-center mb-2",children:[p.jsx("img",{alt:"icon",src:`https://openweathermap.org/img/wn/${d.current.icon}@2x.png`}),p.jsxs("div",{className:"ml-2 text-2xl font-bold",children:[d.current.temperature,"°F"]})]}),p.jsx("div",{children:d.current.conditions}),p.jsxs("div",{className:"mt-1",children:["Humidity: ",d.current.humidity,"%"]}),p.jsxs("div",{children:["Wind: ",Math.round(d.current.windSpeed)," mph"]})]}):y?p.jsx("div",{className:"text-sm text-blue-700",children:y}):p.jsx("div",{className:"text-sm text-blue-700",children:"Loading weather…"})]})}),(l==null?void 0:l.products)&&l.products.length>0&&p.jsxs("div",{className:"mb-6",children:[p.jsxs("h3",{className:"font-semibold text-gray-900 mb-3 flex items-center",children:[p.jsx(yv,{className:"h-5 w-5 mr-2"}),"Products Applied"]}),p.jsxs("div",{className:"bg-gray-50 rounded-lg overflow-hidden",children:[p.jsxs("div",{className:"grid grid-cols-4 gap-4 p-4 border-b text-sm font-medium text-gray-600",children:[p.jsx("div",{children:"Product"}),p.jsx("div",{children:"Rate"}),p.jsx("div",{children:"Amount"}),p.jsx("div",{children:"Water"})]}),l.products.map((Y,J)=>{var W,$;return p.jsxs("div",{className:"grid grid-cols-4 gap-4 p-4 border-b last:border-b-0",children:[p.jsx("div",{className:"font-medium",children:Y.productName}),p.jsxs("div",{children:[Y.rateAmount," ",Y.rateUnit]}),p.jsxs("div",{children:[(W=Y.calculatedProductAmount)==null?void 0:W.toFixed(2)," lbs"]}),p.jsxs("div",{children:[($=Y.calculatedWaterAmount)==null?void 0:$.toFixed(2)," gal"]})]},J)})]})]}),r&&p.jsxs("div",{className:"mb-6",children:[p.jsxs("h3",{className:"font-semibold text-gray-900 mb-3 flex items-center",children:[p.jsx(uC,{className:"h-5 w-5 mr-2"}),"Tracking Information"]}),p.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-5 gap-4",children:[p.jsxs("div",{className:"bg-blue-50 p-3 rounded-lg",children:[p.jsx("div",{className:"text-sm text-blue-600 font-medium",children:"Average Speed"}),p.jsxs("div",{className:"text-xl font-bold text-blue-900",children:[(((R=r.gpsTrack)==null?void 0:R.averageSpeed)||r.averageSpeed||0).toFixed(1)," mph"]})]}),p.jsxs("div",{className:"bg-green-50 p-3 rounded-lg",children:[p.jsx("div",{className:"text-sm text-green-600 font-medium",children:"GPS Points"}),p.jsx("div",{className:"text-xl font-bold text-green-900",children:((B=(A=r.gpsTrack)==null?void 0:A.points)==null?void 0:B.length)||0})]}),p.jsxs("div",{className:"bg-purple-50 p-3 rounded-lg",children:[p.jsx("div",{className:"text-sm text-purple-600 font-medium",children:"Duration"}),p.jsxs("div",{className:"text-xl font-bold text-purple-900",children:[(q=r.gpsTrack)!=null&&q.duration?Math.round(r.gpsTrack.duration/60):0," min"]})]}),p.jsxs("div",{className:"bg-orange-50 p-3 rounded-lg",children:[p.jsx("div",{className:"text-sm text-orange-600 font-medium",children:"Distance"}),p.jsxs("div",{className:"text-xl font-bold text-orange-900",children:[Math.round(E(r))," ft"]})]}),p.jsxs("div",{className:"bg-emerald-50 p-3 rounded-lg",children:[p.jsx("div",{className:"text-sm text-emerald-600 font-medium",children:"Coverage"}),p.jsxs("div",{className:"text-xl font-bold text-emerald-900",children:[w(e,r),"%"]})]})]})]}),p.jsxs("div",{className:"mb-6",children:[p.jsx("h4",{className:"font-medium mb-2",children:"Application Area & GPS Track"}),p.jsx("div",{className:"h-96 border rounded-lg overflow-hidden",children:p.jsx(NN,{property:t,sections:s,selectedSections:s.map(Y=>Y.id)||[],mode:"view",gpsTrack:((Q=r==null?void 0:r.gpsTrack)==null?void 0:Q.points)||[],currentLocation:null,center:N,zoom:N?16:15,editable:!1})})]}),(e.notes||(r==null?void 0:r.notes))&&p.jsxs("div",{className:"mb-6",children:[p.jsx("h3",{className:"font-semibold text-gray-900 mb-2",children:"Notes"}),p.jsx("div",{className:"bg-gray-50 p-4 rounded-lg",children:p.jsx("p",{className:"text-gray-700",children:e.notes||(r==null?void 0:r.notes)})})]}),p.jsx("div",{className:"flex justify-end",children:p.jsx("button",{onClick:n,className:"px-4 py-2 bg-gray-500 text-white rounded hover:bg-gray-600",children:"Close"})})]})})},xD=({session:e,onClose:t})=>{var d,v,y;const[n,r]=P.useState([]),[i,s]=P.useState(e),[a,l]=P.useState(!0),c=x=>(x||0)*3.28084;P.useEffect(()=>{(async()=>{var S,C,E,w,N,I,R,A,B,q;if(e!=null&&e.id)try{l(!0);const Q=await aC.getSession(e.id),Y=((C=(S=Q.data)==null?void 0:S.data)==null?void 0:C.session)||e,J=((w=(E=Q.data)==null?void 0:E.data)==null?void 0:w.sections)||[];if(s(Y),J.length)r(J);else if(Y.property_id){const W=await Za.getById(Y.property_id);r(((R=(I=(N=W.data)==null?void 0:N.data)==null?void 0:I.property)==null?void 0:R.sections)||[])}}catch{try{if(e.property_id){const Y=await Za.getById(e.property_id);r(((q=(B=(A=Y.data)==null?void 0:A.data)==null?void 0:B.property)==null?void 0:q.sections)||[])}}catch{}}finally{l(!1)}})()},[e==null?void 0:e.id,e==null?void 0:e.property_id]);const f=P.useMemo(()=>((i==null?void 0:i.gps_track)||(i==null?void 0:i.gpsTrack)||{}).points||[],[i]),g=P.useMemo(()=>{if(!n.length)return null;let x=0,S=0,C=0;return n.forEach(E=>{var N;let w=E.polygonData||E.polygon_data;if(typeof w=="string")try{w=JSON.parse(w)}catch{w=null}(N=w==null?void 0:w.coordinates)!=null&&N[0]&&w.coordinates[0].forEach(([I,R])=>{x+=I,S+=R,C++})}),C?[x/C,S/C]:null},[n]);return a?p.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:p.jsx("div",{className:"bg-white rounded-lg p-6 w-full max-w-4xl mx-4 max-h-[90vh] overflow-y-auto",children:p.jsx("div",{className:"py-8 text-center text-gray-600",children:"Loading mowing session…"})})}):p.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:p.jsxs("div",{className:"bg-white rounded-lg p-6 w-full max-w-6xl mx-4 max-h-[90vh] overflow-y-auto",children:[p.jsxs("div",{className:"flex justify-between items-center mb-6",children:[p.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:"Mowing Session Details"}),p.jsx("button",{onClick:t,className:"text-gray-400 hover:text-gray-600",children:p.jsx(Hy,{className:"h-6 w-6"})})]}),p.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6",children:[p.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[p.jsxs("h3",{className:"font-semibold text-gray-900 mb-3 flex items-center",children:[p.jsx(zc,{className:"h-5 w-5 mr-2"}),"Property & Areas"]}),p.jsxs("div",{className:"space-y-1 text-sm",children:[p.jsxs("p",{children:[p.jsx("span",{className:"font-medium",children:"Property:"})," ",i.property_name||e.property_name]}),p.jsxs("p",{children:[p.jsx("span",{className:"font-medium",children:"Areas:"})," ",i.section_names||e.section_names||n.map(x=>x.name).join(", ")]}),p.jsxs("p",{children:[p.jsx("span",{className:"font-medium",children:"Cut Height:"})," ",Number(i.cut_height_inches||e.cut_height_inches).toFixed(2),'"']}),p.jsxs("p",{children:[p.jsx("span",{className:"font-medium",children:"Direction:"})," ",i.direction||e.direction]})]})]}),p.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[p.jsxs("h3",{className:"font-semibold text-gray-900 mb-3 flex items-center",children:[p.jsx(mu,{className:"h-5 w-5 mr-2"}),"Equipment & Stats"]}),p.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[p.jsxs("div",{children:[p.jsx("span",{className:"font-medium",children:"Mower:"})," ",i.equipment_name||e.equipment_name]}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium",children:"Avg Speed:"})," ",((v=(d=i.average_speed_mph||i.averageSpeed||0).toFixed)==null?void 0:v.call(d,1))||Number(i.averageSpeed||0).toFixed(1)," mph"]}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium",children:"Duration:"})," ",Math.round((i.duration_seconds||i.durationSeconds||0)/60)," min"]}),p.jsxs("div",{children:[p.jsx("span",{className:"font-medium",children:"Distance:"})," ",Math.round(c(i.total_distance_meters||((y=i.gps_track)==null?void 0:y.totalDistance)||0))," ft"]})]})]})]}),p.jsxs("div",{className:"mb-6",children:[p.jsx("h4",{className:"font-medium mb-2",children:"Mowed Areas & GPS Track"}),p.jsx("div",{className:"h-96 border rounded-lg overflow-hidden",children:p.jsx(NN,{sections:n,selectedSections:n.map(x=>x.id),mode:"view",gpsTrack:f,center:g,zoom:g?16:15,direction:i.direction||e.direction,editable:!1})})]}),i.notes&&p.jsxs("div",{className:"mb-6",children:[p.jsx("h3",{className:"font-semibold text-gray-900 mb-2",children:"Notes"}),p.jsx("div",{className:"bg-gray-50 p-4 rounded-lg",children:p.jsx("p",{className:"text-gray-700",children:i.notes})})]}),p.jsx("div",{className:"flex justify-end",children:p.jsx("button",{onClick:t,className:"px-4 py-2 bg-gray-500 text-white rounded hover:bg-gray-600",children:"Close"})})]})})},wD=["Turf Type Tall Fescue","Kentucky Bluegrass","Perennial Ryegrass","Fine Fescue","Creeping Red Fescue","Chewings Fescue","Hard Fescue","Annual Ryegrass"],Kw=({value:e=[],onChange:t})=>{const[n,r]=P.useState(""),i=s=>{const a=s.trim();a&&(e.includes(a)||t([...e||[],a]),r(""))};return p.jsxs("div",{className:"border rounded p-2",children:[p.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:(e||[]).map(s=>p.jsxs("span",{className:"px-2 py-1 bg-gray-100 rounded text-xs flex items-center gap-1",children:[s,p.jsx("button",{className:"text-gray-500 hover:text-gray-700",onClick:()=>t((e||[]).filter(a=>a!==s)),children:"×"})]},s))}),p.jsx("input",{className:"w-full border-0 focus:outline-none text-sm",placeholder:"Type and press Enter to add",value:n,onChange:s=>r(s.target.value),onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),i(n))}})]})},Qw=({onPick:e})=>p.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:wD.map(t=>p.jsx("button",{type:"button",onClick:()=>e(t),className:"px-2 py-1 bg-blue-50 hover:bg-blue-100 text-blue-700 rounded text-xs",children:t},t))});delete Fr.Icon.Default.prototype._getIconUrl;Fr.Icon.Default.mergeOptions({iconRetinaUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-icon-2x.png",iconUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-icon.png",shadowUrl:"https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/images/marker-shadow.png"});const Ga=[{name:"Green",value:"#22c55e"},{name:"Blue",value:"#3b82f6"},{name:"Red",value:"#ef4444"},{name:"Yellow",value:"#eab308"},{name:"Purple",value:"#a855f7"},{name:"Orange",value:"#f97316"}],Vc=e=>{try{const t=Ap([e.map(r=>[r[1],r[0]])]),n=MC(t);return Math.round(n*10.7639)}catch(t){return console.error("Area calculation error:",t),0}},ED=(e,t,n)=>{const[r,i]=e,[s,a]=t,[l,c]=n,f=r-s,g=i-a,d=l-s,v=c-a,y=f*d+g*v,x=d*d+v*v;if(x===0)return Math.sqrt(f*f+g*g);let S=y/x,C,E;S<0?(C=s,E=a):S>1?(C=l,E=c):(C=s+S*d,E=a+S*v);const w=r-C,N=i-E;return Math.sqrt(w*w+N*N)};function SD({isDrawing:e,onPolygonComplete:t,currentColor:n}){const[r,i]=P.useState([]);return bC({click(s){if(!e)return;const a=[s.latlng.lat,s.latlng.lng];console.log("Adding point:",a),i(l=>{const c=[...l,a];return console.log("Current polygon has",c.length,"points"),c})},dblclick(s){console.log("Double click detected, drawing:",e,"points:",r.length),e&&r.length>=3&&(s.originalEvent.preventDefault(),s.originalEvent.stopPropagation(),console.log("Completing polygon with",r.length,"points"),t(r),i([]))}}),r.length>0?p.jsx(Vd,{positions:r,pathOptions:{color:n.value,fillColor:n.value,fillOpacity:.3,weight:2,dashArray:"5, 5"}}):null}function CD({section:e,onUpdate:t,onEdit:n,onDelete:r}){const[i,s]=P.useState(!1),[a,l]=P.useState(e.coordinates);$y();const c=(g,d)=>{const v=[...a];v[g]=[d.lat,d.lng],l(v);const y=Vc([...v,v[0]]);t(e.id,{...e,coordinates:v,area:y})},f=g=>{if(a.length<=3){re.error("Polygon must have at least 3 points");return}const d=a.filter((y,x)=>x!==g);l(d);const v=Vc([...d,d[0]]);t(e.id,{...e,coordinates:d,area:v})};return p.jsxs(p.Fragment,{children:[p.jsx(Vd,{positions:a,pathOptions:{color:e.color.value,fillColor:e.color.value,fillOpacity:i?.3:.4,weight:i?3:2},eventHandlers:{click:g=>{if(!i)s(!0),re("Edit mode enabled: Drag points to move, right-click to remove points, click edges to add points");else{const d=[g.latlng.lat,g.latlng.lng];let v=0,y=1/0;for(let C=0;C{s(!i),re(i?"Edit mode disabled":"Edit mode enabled")},className:`text-sm ${i?"text-green-600":"text-blue-600"}`,title:i?"Exit edit mode":"Drag corners, click edges to add points, right-click to remove",children:i?"Done":"Edit Points"}),p.jsx("button",{onClick:()=>n(e),className:"text-blue-600 text-sm",children:"Edit Name"}),p.jsx("button",{onClick:()=>r(e.id),className:"text-red-600 text-sm",children:"Delete"})]})]})})}),i&&a.map((g,d)=>p.jsx($a,{position:g,draggable:!0,eventHandlers:{dragend:v=>{c(d,v.target.getLatLng())},contextmenu:v=>{v.originalEvent.preventDefault(),a.length>3&&f(d)}},icon:new Fr.Icon({iconUrl:"data:image/svg+xml;base64,"+btoa(` `),iconSize:[12,12],iconAnchor:[6,6]}),children:p.jsx(Sv,{children:p.jsxs("div",{className:"text-center",children:[p.jsxs("p",{className:"text-xs",children:["Point ",d+1]}),p.jsx("button",{onClick:()=>f(d),className:"text-red-600 text-xs",disabled:a.length<=3,children:"Remove Point"})]})})},`${e.id}-${d}`))]})}const ND=()=>{const{id:e}=LI(),t=La(),[n,r]=P.useState(null),[i,s]=P.useState([]),[a,l]=P.useState(!0),[c,f]=P.useState(!1),[g,d]=P.useState(!1),[v,y]=P.useState(!1),[x,S]=P.useState(!1),[C,E]=P.useState(null),[w,N]=P.useState([]),[I,R]=P.useState([]),[A,B]=P.useState(0),[q,Q]=P.useState(null),[Y,J]=P.useState(null),[W,$]=P.useState(!1),[D,ut]=P.useState(null),[it,yt]=P.useState(!1),[z,at]=P.useState(!1),[tt,vt]=P.useState(!1),[Lt,ct]=P.useState(!1),[ht,_t]=P.useState(Ga[0]),[wt,Gt]=P.useState(!1),[jt,we]=P.useState(null),[Ee,Je]=P.useState(""),[De,jr]=P.useState([]),[Nn,Ke]=P.useState(null),[Ji,ar]=P.useState(!1),[cn,xi]=P.useState([]),[Il,Ra]=P.useState([]),[Ma,T]=P.useState([]),[F,G]=P.useState([]),[gt,pt]=P.useState(!1),[ft,Et]=P.useState(null),[Bt,ne]=P.useState(null);P.useEffect(()=>{_r()},[e]);const $e=()=>{if(!navigator.geolocation||D)return;const U=navigator.geolocation.watchPosition(X=>{const{latitude:mt,longitude:st,accuracy:nt}=X.coords;Ls(mt,st,nt)},X=>{console.warn("Warm GPS watch error",X==null?void 0:X.message)},{enableHighAccuracy:!0,maximumAge:1e3,timeout:2e4});ut(U)};P.useEffect(()=>($e(),()=>{try{D&&navigator.geolocation.clearWatch(D)}catch{}ut(null)}),[]),P.useEffect(()=>{if(!navigator.geolocation||it)return;const U=()=>{navigator.geolocation.getCurrentPosition(X=>{Ls(X.coords.latitude,X.coords.longitude,X.coords.accuracy),$e(),yt(!0),document.removeEventListener("click",U),document.removeEventListener("touchstart",U)},()=>{$e(),yt(!0),document.removeEventListener("click",U),document.removeEventListener("touchstart",U)},{enableHighAccuracy:!0,maximumAge:1e3,timeout:8e3})};return document.addEventListener("click",U,{once:!0}),document.addEventListener("touchstart",U,{once:!0}),()=>{document.removeEventListener("click",U),document.removeEventListener("touchstart",U)}},[it]),P.useEffect(()=>{if(!(n!=null&&n.id))return;(async()=>{var X,mt,st,nt,St,Xt,Yt,Mt,zt;try{pt(!0);const[he,kn,fn,ts]=await Promise.all([jc.getPlans({status:"completed",property_id:n.id}),jc.getPlans({status:"archived",property_id:n.id}),jc.getLogs({property_id:n.id}),aC.getLogs({property_id:n.id})]),Mo=((mt=(X=he.data)==null?void 0:X.data)==null?void 0:mt.plans)||[],Ao=((nt=(st=kn.data)==null?void 0:st.data)==null?void 0:nt.plans)||[];Ra([...Mo||[],...Ao||[]]),T(((Xt=(St=fn.data)==null?void 0:St.data)==null?void 0:Xt.logs)||[]),G(((Mt=(Yt=ts.data)==null?void 0:Yt.data)==null?void 0:Mt.logs)||[])}catch(he){console.warn("Failed to load property history",((zt=he==null?void 0:he.response)==null?void 0:zt.data)||he.message),Ra([]),T([]),G([])}finally{pt(!1)}})()},[n==null?void 0:n.id]),P.useEffect(()=>{const U=X=>{c&&X.key==="Enter"&&console.log("Enter pressed during drawing mode"),X.key==="Escape"&&c&&(f(!1),re("Drawing cancelled"))};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[c]);const _r=async()=>{try{l(!0);const U=await Za.getById(e);console.log("Property details:",U);const X=U.data.data.property;if(r(X),X.sections&&X.sections.length>0){const mt=X.sections.map(st=>{var zt;const nt=typeof st.polygonData=="string"?JSON.parse(st.polygonData):st.polygonData,Xt=(Array.isArray((zt=nt==null?void 0:nt.coordinates)==null?void 0:zt[0])?nt.coordinates[0]:[]).map(he=>[Number(he[0]),Number(he[1])]),Yt=nt==null?void 0:nt.color,Mt=Yt&&typeof Yt=="object"&&"value"in Yt?Yt:typeof Yt=="string"?{name:"Custom",value:Yt}:Ga[0];return{id:st.id,name:st.name,coordinates:Xt,color:Mt,area:st.area,grassType:st.grassType||"",grassTypes:st.grassTypes||null}});s(mt)}}catch(U){console.error("Failed to fetch property:",U),re.error("Failed to load property"),t("/properties")}finally{l(!1)}},tn=U=>{if(console.log("handlePolygonComplete called with",U.length,"coordinates"),U.length<3){re.error("Polygon needs at least 3 points");return}const X=Vc([...U,U[0]]);console.log("Calculated area:",X),we({coordinates:U,color:ht,area:X}),Gt(!0),f(!1)},wi=(U,X,mt,st)=>{const nt=zt=>zt*Math.PI/180,Xt=nt(mt-U),Yt=nt(st-X),Mt=Math.sin(Xt/2)**2+Math.cos(nt(U))*Math.cos(nt(mt))*Math.sin(Yt/2)**2;return 2*6371e3*Math.atan2(Math.sqrt(Mt),Math.sqrt(1-Mt))},Aa=12,$i=2.5,Ku=12,Oo=5,Da=(U,X)=>{const mt=he=>he*Math.PI/180,st=he=>he*180/Math.PI,nt=mt(U[0]),St=mt(X[0]),Xt=mt(X[1]-U[1]),Yt=Math.sin(Xt)*Math.cos(St),Mt=Math.cos(nt)*Math.sin(St)-Math.sin(nt)*Math.cos(St)*Math.cos(Xt);return(st(Math.atan2(Yt,Mt))+360)%360},Ls=(U,X,mt)=>{const st=Date.now();R(Mt=>[...Mt,{lat:U,lng:X,accuracy:mt??999,t:st}].slice(-12));const nt=[...I,{lat:U,lng:X,accuracy:mt??999,t:st}].slice(-12),St=nt.filter(Mt=>Mt.accuracy!=null).sort((Mt,zt)=>Mt.accuracy-zt.accuracy).slice(0,Math.min(5,nt.length));if(St.length===0)return[U,X];const Xt=St.reduce((Mt,zt)=>Mt+zt.lat,0)/St.length,Yt=St.reduce((Mt,zt)=>Mt+zt.lng,0)/St.length;return[Xt,Yt]},Wf=()=>{const U=Date.now(),X=I.filter(nt=>U-(nt.t||0)<=3e3),mt=(X.length?X:I).slice(-12);if(mt.length===0)return null;const st=mt.reduce((nt,St)=>St.accuracy<((nt==null?void 0:nt.accuracy)??1/0)?St:nt,null);return st?[st.lat,st.lng,st.accuracy]:null},Xf=(U,X,mt,st)=>{if(mt!=null&&mt>Aa)return re("GPS accuracy too low ("+Math.round(mt)+"m). Waiting for better fix…"),null;if(st.length>0){const[nt,St]=st[st.length-1];if(wi(nt,St,U,X)<$i)if(st.length>=2){const Yt=Da(st[st.length-2],[nt,St]),Mt=Da([nt,St],[U,X]);let zt=Math.abs(Yt-Mt);if(zt>180&&(zt=360-zt),zt=2){const[nt,St]=st[0];if(wi(nt,St,U,X)<=Oo)return[nt,St]}return[U,X]},Wp=()=>{if(!navigator.geolocation){re.error("GPS not available");return}const U=Wf(),X=(mt,st,nt)=>{Q(nt||null),N(St=>{const Xt=Xf(mt,st,nt,St);if(St.length>=2){const[Mt,zt]=St[0],he=wi(Mt,zt,mt,st);at(he<=Oo)}else at(!1);if(!Xt)return St;const Yt=[...St,Xt];if(Yt.length>1){const[Mt,zt]=Yt[Yt.length-2];B(he=>he+wi(Mt,zt,Xt[0],Xt[1]))}return Yt})};if(U){const[mt,st,nt]=U;X(mt,st,nt)}else navigator.geolocation.getCurrentPosition(mt=>{const{latitude:st,longitude:nt,accuracy:St}=mt.coords;Ls(st,nt,St),X(st,nt,St)},mt=>{console.warn("GPS error",mt==null?void 0:mt.message),re.error("GPS error: "+((mt==null?void 0:mt.message)||"unknown"))},{enableHighAccuracy:!0,maximumAge:500,timeout:8e3})},Xp=()=>{N(U=>{if(U.length<=0)return U;const X=U.slice(0,-1);let mt=0;for(let st=1;st{N([]),B(0),Q(null),C&&(navigator.geolocation.clearWatch(C),E(null))},Yf=()=>{if(w.length<3){re.error("Need at least 3 points to create an area");return}tn(w),y(!1),d(!1),Ro()},Yp=async()=>{var U,X,mt,st;if(!Ee.trim()){re.error("Please enter a section name");return}try{let nt=jt.coordinates||[];if(nt.length>=3){const[hn,ni]=nt[0]||[],[Fa,Qf]=nt[nt.length-1]||[];(hn!==Fa||ni!==Qf)&&(nt=[...nt,nt[0]])}if(nt.length<4){re.error("Polygon invalid: need at least 3 unique points");return}const St=Vc(nt);if(!St||St<=0){re.error("Polygon area is zero — adjust points");return}const Xt={name:Ee,area:St,polygonData:{coordinates:[nt],color:jt.color},grassType:De.join(", "),grassTypes:De,soilType:null,captureMethod:g?"gps_points":v?"gps_trace":"tap",captureMeta:{accuracyLast:q,totalDistanceMeters:A,pointsCount:((U=jt.coordinates)==null?void 0:U.length)||0}},Mt=(await Za.createSection(e,Xt)).data.data.section,zt=typeof Mt.polygonData=="string"?JSON.parse(Mt.polygonData):Mt.polygonData,kn=(Array.isArray((X=zt==null?void 0:zt.coordinates)==null?void 0:X[0])?zt.coordinates[0]:[]).map(hn=>[Number(hn[0]),Number(hn[1])]),fn=zt==null?void 0:zt.color,ts=fn&&typeof fn=="object"&&"value"in fn?fn:typeof fn=="string"?{name:"Custom",value:fn}:ht,Mo={id:Mt.id,name:Mt.name,coordinates:kn,color:ts,area:Mt.area,grassType:Mt.grassType||"",grassTypes:Mt.grassTypes||[]};s(hn=>[...hn,Mo]),re.success(`${Ee} section created and saved!`),Je(""),jr([]),we(null),Gt(!1);const Ao=(Ga.findIndex(hn=>hn.value===ht.value)+1)%Ga.length;_t(Ga[Ao])}catch(nt){console.error("Failed to save section:",nt),re.error(((st=(mt=nt==null?void 0:nt.response)==null?void 0:mt.data)==null?void 0:st.message)||(nt==null?void 0:nt.message)||"Failed to save section. Please try again.")}},Tl=async U=>{if(window.confirm("Delete this lawn section?"))try{await Za.deleteSection(e,U),s(X=>X.filter(mt=>mt.id!==U)),re.success("Section deleted")}catch(X){console.error("Failed to delete section:",X),re.error("Failed to delete section. Please try again.")}},Kf=U=>{Ke(U),Je(U.name),_t(U.color),ar(!0);const X=(U.grassType||"").split(",").map(mt=>mt.trim()).filter(Boolean);xi(X)},Kp=async()=>{if(!Ee.trim()){re.error("Please enter a section name");return}try{const U={name:Ee,area:Nn.area,polygonData:{coordinates:[Nn.coordinates],color:ht},grassType:cn.join(", "),grassTypes:cn,soilType:null};await Za.updateSection(e,Nn.id,U);const X={...Nn,name:Ee,color:ht,grassType:cn.join(", "),grassTypes:[...cn]};s(mt=>mt.map(st=>st.id===Nn.id?X:st)),re.success("Section updated and saved!"),Je(""),Ke(null),ar(!1),xi([])}catch(U){console.error("Failed to update section:",U),re.error("Failed to update section. Please try again.")}},Qp=async(U,X)=>{try{const mt={name:X.name,area:X.area,polygonData:{coordinates:[X.coordinates],color:X.color},grassType:X.grassType||"",grassTypes:X.grassTypes||null,soilType:null};await Za.updateSection(e,U,mt),s(st=>st.map(nt=>nt.id===U?X:nt))}catch(mt){console.error("Failed to update section coordinates:",mt),re.error("Failed to save polygon changes. Please try again.")}},Jp=()=>i.reduce((U,X)=>U+X.area,0),Ei=(U,X)=>{var Mt,zt,he,kn,fn,ts;if(!((Mt=X==null?void 0:X.gpsTrack)!=null&&Mt.points)&&!((zt=X==null?void 0:X.gps_track)!=null&&zt.points))return 0;const st=(typeof(((he=X.gpsTrack)==null?void 0:he.totalDistance)||((kn=X.gps_track)==null?void 0:kn.totalDistance))=="number"?((fn=X.gpsTrack)==null?void 0:fn.totalDistance)||((ts=X.gps_track)==null?void 0:ts.totalDistance):0)*3.28084,nt=U.totalSectionArea||U.total_section_area||0;if(st===0||nt===0)return 0;let St=4;const Xt=(U.equipmentName||"").toLowerCase();Xt.includes("spreader")?St=12:Xt.includes("sprayer")?St=20:Xt.includes("mower")&&(St=6);const Yt=st*St;return Math.min(Math.round(Yt/nt*100),100)},It=U=>{var Yt,Mt;const mt=(U.total_distance_meters||((Yt=U.gpsTrack)==null?void 0:Yt.totalDistance)||((Mt=U.gps_track)==null?void 0:Mt.totalDistance)||0||0)*3.28084,st=Number(U.total_area||0),nt=parseFloat(U.cutting_width_inches||0),St=isNaN(nt)?0:nt/12;if(mt===0||st===0||St===0)return 0;const Xt=mt*St;return Math.min(100,Math.round(Xt/st*100))},Qu=(()=>{const U=(Il||[]).map(st=>{const nt=Ma.find(Yt=>Yt.planId===st.id),St=(nt==null?void 0:nt.applicationDate)||st.plannedDate||st.updatedAt||st.createdAt;return{kind:"application",date:St?new Date(St):new Date(0),application:st,log:nt}}),X=(F||[]).map(st=>{const nt=st.session_date||st.created_at;return{kind:"mowing",date:nt?new Date(nt):new Date(0),log:st}}),mt=[...U,...X];return mt.sort((st,nt)=>nt.date-st.date),mt.slice(0,10)})();if(a)return p.jsx("div",{className:"p-6",children:p.jsx("div",{className:"flex justify-center items-center h-64",children:p.jsx(Hs,{size:"lg"})})});if(!n)return p.jsx("div",{className:"p-6",children:p.jsxs("div",{className:"card text-center py-12",children:[p.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"Property Not Found"}),p.jsx("button",{onClick:()=>t("/properties"),className:"btn-primary",children:"Back to Properties"})]})});const ka=n&&n.latitude!==void 0&&n.longitude!==void 0&&n.latitude!==null&&n.longitude!==null&&!isNaN(n.latitude)&&!isNaN(n.longitude),Ju=ka?[n.latitude,n.longitude]:[40.7128,-74.006];return p.jsxs("div",{className:"p-6",children:[p.jsxs("div",{className:"flex items-center justify-between mb-6",children:[p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsx("button",{onClick:()=>t("/properties"),className:"p-2 hover:bg-gray-100 rounded-lg",children:p.jsx(rR,{className:"h-5 w-5"})}),p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:n.name}),p.jsxs("p",{className:"text-gray-600 flex items-center gap-1",children:[p.jsx(zc,{className:"h-4 w-4"}),n.address||"No address specified"]}),!ka&&p.jsx("p",{className:"text-red-600 text-sm",children:"⚠️ Property coordinates not set - using default location"})]})]}),p.jsx("div",{className:"relative",children:p.jsxs("button",{onClick:()=>ct(!0),className:"btn-primary flex items-center gap-2",title:"Add a lawn section",children:[p.jsx(bR,{className:"h-5 w-5"}),"Add Lawn Section"]})})]}),p.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6",children:[p.jsx("div",{className:"lg:col-span-3",children:p.jsxs("div",{className:"card p-0 overflow-hidden",children:[p.jsx("div",{style:{height:"600px",width:"100%"},children:p.jsxs(LC,{center:Ju,zoom:ka?18:13,maxZoom:19,style:{height:"100%",width:"100%"},children:[p.jsx(IC,{attribution:'© Esri',url:"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",maxZoom:19}),ka&&p.jsx($a,{position:Ju,children:p.jsx(Sv,{children:n.name})}),i.map(U=>p.jsx(CD,{section:U,onUpdate:Qp,onEdit:Kf,onDelete:Tl},U.id)),c&&p.jsx(SD,{isDrawing:c,onPolygonComplete:tn,currentColor:ht}),(g||v)&&w.length>0&&p.jsxs(p.Fragment,{children:[p.jsx(sd,{positions:w,pathOptions:{color:"#2563eb",weight:3}}),w.map((U,X)=>p.jsx($a,{position:U,icon:new Fr.Icon({iconUrl:"data:image/svg+xml;base64,"+btoa(` ${X===0&&z?'':''} `),iconSize:[14,14],iconAnchor:[7,7]})},`g${X}`))]})]})}),c&&p.jsxs("div",{className:"p-4 bg-blue-50 border-t",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:"w-3 h-3 bg-blue-600 rounded-full animate-pulse"}),p.jsxs("p",{className:"text-sm text-blue-800",children:[p.jsx("strong",{children:"Drawing Mode Active:"})," Click to add points. Double-click to complete polygon."]})]}),p.jsx("p",{className:"text-xs text-blue-600 mt-1",children:"Need at least 3 points to create a section. Press ESC to cancel."}),p.jsx("p",{className:"text-xs text-blue-500 mt-1",children:"💡 After creating: Click any polygon to edit its points by dragging"})]}),g&&p.jsxs("div",{className:"p-4 bg-green-50 border-t",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-green-900",children:[p.jsx("span",{className:"font-semibold",children:"GPS Points Mode"}),p.jsxs("span",{children:["Points: ",w.length]}),p.jsxs("span",{children:["Distance: ",(A*3.28084).toFixed(0)," ft"]}),p.jsxs("span",{className:"flex items-center gap-1",children:[p.jsx("span",{className:`inline-block w-2.5 h-2.5 rounded-full ${W?"bg-green-600":q&&q<=20?"bg-amber-500":"bg-red-600"}`}),p.jsxs("span",{children:["Fix ",W?"Good":"Improving",q!=null?` • ±${Math.round(q)} m`:""]})]})]}),p.jsxs("div",{className:"mt-3 flex gap-2 items-center",children:[p.jsx("button",{className:"btn-primary",onClick:Wp,children:"Mark Point"}),p.jsx("button",{className:"btn-secondary",onClick:Xp,disabled:w.length===0,children:"Undo"}),p.jsx("button",{className:"btn-secondary",onClick:Ro,disabled:w.length===0,children:"Clear"}),p.jsx("button",{className:"btn-primary",onClick:Yf,disabled:w.length<3,children:"Complete Boundary"}),z&&p.jsx("span",{className:"text-xs text-amber-700 bg-amber-100 px-2 py-1 rounded",children:"Snap to start available"})]}),p.jsx("p",{className:"text-xs text-green-700 mt-2",children:"Walk to each corner, tap Mark Point, then Complete. You can refine points afterward."})]}),v&&p.jsxs("div",{className:"p-4 bg-green-50 border-t",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-green-900",children:[p.jsx("span",{className:"font-semibold",children:"Trace Mode"}),p.jsxs("span",{children:["Points: ",w.length]}),p.jsxs("span",{children:["Distance: ",(A*3.28084).toFixed(0)," ft"]}),p.jsxs("span",{className:"flex items-center gap-1",children:[p.jsx("span",{className:`inline-block w-2.5 h-2.5 rounded-full ${W?"bg-green-600":q&&q<=25?"bg-amber-500":"bg-red-600"}`}),p.jsxs("span",{children:["Fix ",W?"Good":"Improving",q!=null?` • ±${Math.round(q)} m`:""]})]})]}),p.jsxs("div",{className:"mt-3 flex gap-2 items-center",children:[x?p.jsx("button",{className:"btn-secondary",onClick:()=>{C&&(navigator.geolocation.clearWatch(C),E(null)),S(!1)},children:"Pause"}):p.jsx("button",{className:"btn-primary",onClick:()=>{if(!navigator.geolocation){re.error("GPS not available");return}const U=navigator.geolocation.watchPosition(X=>{const{latitude:mt,longitude:st,accuracy:nt}=X.coords;Q(nt||null),N(St=>{const[Xt,Yt]=Ls(mt,st,nt),Mt=Xf(Xt,Yt,nt,St);if(St.length>=2){const[he,kn]=St[0],fn=wi(he,kn,Xt,Yt);at(fn<=Oo)}else at(!1);if(!Mt)return St;const zt=[...St,Mt];if(zt.length>1){const[he,kn]=zt[zt.length-2];B(fn=>fn+wi(he,kn,Mt[0],Mt[1]))}return zt})},X=>{console.warn("GPS watch error",X==null?void 0:X.message)},{enableHighAccuracy:!0,maximumAge:500,timeout:2e4});E(U),S(!0)},children:"Start"}),p.jsx("button",{className:"btn-secondary",onClick:()=>{C&&(navigator.geolocation.clearWatch(C),E(null)),S(!1),Ro()},disabled:w.length===0,children:"Clear"}),p.jsx("button",{className:"btn-secondary",onClick:()=>{window.confirm("Cancel GPS trace? Unsaved points will be lost.")&&(C&&(navigator.geolocation.clearWatch(C),E(null)),S(!1),y(!1),d(!1),f(!1),Ro())},children:"Cancel"}),p.jsx("button",{className:"btn-primary",onClick:Yf,disabled:w.length<3,children:"Complete Boundary"}),z&&p.jsx("span",{className:"text-xs text-amber-700 bg-amber-100 px-2 py-1 rounded",children:"Snap to start available"})]}),p.jsx("p",{className:"text-xs text-green-700 mt-2",children:"Walk the boundary to trace it. Pause as needed, then Complete to create the area."})]})]})}),p.jsxs("div",{className:"space-y-6",children:[c&&p.jsxs("div",{className:"card",children:[p.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[p.jsx(OR,{className:"h-5 w-5"}),"Section Color"]}),p.jsx("div",{className:"grid grid-cols-3 gap-2",children:Ga.map(U=>p.jsx("button",{onClick:()=>_t(U),className:`w-10 h-10 rounded border-2 ${ht.value===U.value?"border-gray-900":"border-gray-300"}`,style:{backgroundColor:U.value},title:U.name},U.value))})]}),p.jsxs("div",{className:"card",children:[p.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Property Summary"}),p.jsxs("div",{className:"space-y-2 text-sm",children:[p.jsxs("div",{className:"flex justify-between",children:[p.jsx("span",{className:"text-gray-600",children:"Total Sections:"}),p.jsx("span",{className:"font-medium",children:i.length})]}),p.jsxs("div",{className:"flex justify-between",children:[p.jsx("span",{className:"text-gray-600",children:"Total Area:"}),p.jsxs("span",{className:"font-medium",children:[Jp().toLocaleString()," sq ft"]})]})]})]}),p.jsxs("div",{className:"card",children:[p.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Lawn Sections"}),i.length===0?p.jsx("p",{className:"text-gray-500 text-sm",children:"No sections yet."}):p.jsx("div",{className:"space-y-2",children:i.map(U=>p.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:"w-4 h-4 rounded",style:{backgroundColor:U.color.value}}),p.jsxs("div",{children:[p.jsx("p",{className:"font-medium text-sm",children:U.name}),p.jsxs("p",{className:"text-xs text-gray-600",children:[U.area.toLocaleString()," sq ft"]}),U.grassTypes&&U.grassTypes.length>0||U.grassType?p.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:(U.grassTypes&&U.grassTypes.length>0?U.grassTypes:(U.grassType||"").split(",").map(X=>X.trim()).filter(Boolean)).map((X,mt)=>p.jsx("span",{className:"px-1.5 py-0.5 bg-green-100 text-green-800 rounded text-[10px]",children:X},mt))}):null]})]}),p.jsxs("div",{className:"flex gap-1",children:[p.jsx("button",{onClick:()=>Kf(U),className:"text-blue-600 hover:text-blue-800",children:p.jsx(NR,{className:"h-4 w-4"})}),p.jsx("button",{onClick:()=>Tl(U.id),className:"text-red-600 hover:text-red-800",children:p.jsx(MR,{className:"h-4 w-4"})})]})]},U.id))})]})]})]}),Lt&&p.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center",style:{zIndex:9999},children:p.jsxs("div",{className:"bg-white rounded-lg p-6 w-96 max-w-[92vw] shadow-2xl",children:[p.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Create Lawn Section"}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("button",{className:"w-full px-4 py-3 border rounded hover:bg-gray-50 text-left",onClick:()=>{ct(!1),f(!0),d(!1),y(!1)},children:[p.jsx("div",{className:"font-medium",children:"Tap to Draw (manual)"}),p.jsx("div",{className:"text-xs text-gray-600",children:"Tap the map to add corners, double‑tap to finish."})]}),p.jsxs("button",{className:"w-full px-4 py-3 border rounded hover:bg-gray-50 text-left",onClick:()=>{ct(!1),y(!1),S(!1),C&&(navigator.geolocation.clearWatch(C),E(null)),Ro(),d(!0)},children:[p.jsx("div",{className:"font-medium",children:"GPS Points (walk and mark)"}),p.jsx("div",{className:"text-xs text-gray-600",children:"Walk to each corner and tap “Mark Point”, then Complete."})]}),p.jsxs("button",{className:"w-full px-4 py-3 border rounded hover:bg-gray-50 text-left",onClick:()=>{ct(!1),d(!1),Ro(),y(!0)},children:[p.jsx("div",{className:"font-medium",children:"Trace Boundary (continuous)"}),p.jsx("div",{className:"text-xs text-gray-600",children:"Start tracing and walk the perimeter. Pause as needed, then Complete."})]})]}),p.jsx("div",{className:"mt-4 flex justify-end",children:p.jsx("button",{className:"btn-secondary",onClick:()=>ct(!1),children:"Cancel"})})]})}),p.jsxs("div",{className:"mt-8",children:[p.jsx("h2",{className:"text-lg font-semibold mb-3",children:"Recent History"}),gt?p.jsx("div",{className:"card p-4",children:p.jsx("div",{className:"text-gray-600",children:"Loading…"})}):Qu.length===0?p.jsx("div",{className:"card p-4 text-gray-600",children:"No history yet for this property."}):p.jsx("div",{className:"grid gap-4",children:Qu.map(U=>{var nt,St,Xt,Yt,Mt,zt,he,kn,fn,ts,Mo,Ao;if(U.kind==="application"){const hn=U.application,ni=U.log;return p.jsx("div",{className:"bg-white p-6 rounded-lg shadow",children:p.jsxs("div",{className:"flex justify-between items-start",children:[p.jsxs("div",{className:"flex-1",children:[p.jsxs("div",{className:"flex items-center justify-between mb-4",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("h3",{className:"text-lg font-semibold text-gray-900",children:[hn.propertyName," - ",hn.sectionNames]}),p.jsx("span",{className:"px-2 py-0.5 text-xs rounded-full bg-indigo-100 text-indigo-800",children:"Application"})]}),p.jsx("span",{className:`px-3 py-1 text-sm font-medium rounded-full ${hn.status==="archived"?"bg-gray-100 text-gray-800":"bg-green-100 text-green-800"}`,children:hn.status==="archived"?"Archived":"Completed"})]}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-4",children:[p.jsxs("div",{className:"flex items-center text-sm text-gray-600",children:[p.jsx(Kx,{className:"h-4 w-4 mr-2"}),new Date(U.date).toLocaleString()]}),p.jsxs("div",{className:"flex items-center text-sm text-gray-600",children:[p.jsx(zc,{className:"h-4 w-4 mr-2"}),hn.propertyName]}),p.jsxs("div",{className:"flex items-center text-sm text-gray-600",children:[p.jsx(mu,{className:"h-4 w-4 mr-2"}),hn.equipmentName]})]}),(ni==null?void 0:ni.gpsTrack)&&p.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 mb-4",children:[p.jsxs("div",{className:"bg-blue-50 p-2 rounded text-center",children:[p.jsx("div",{className:"text-xs text-blue-600 font-medium",children:"Duration"}),p.jsxs("div",{className:"text-sm font-bold text-blue-900",children:[Math.round((((nt=ni.gpsTrack)==null?void 0:nt.duration)||0)/60)," min"]})]}),p.jsxs("div",{className:"bg-green-50 p-2 rounded text-center",children:[p.jsx("div",{className:"text-xs text-green-600 font-medium",children:"GPS Points"}),p.jsx("div",{className:"text-sm font-bold text-green-900",children:((Xt=(St=ni.gpsTrack)==null?void 0:St.points)==null?void 0:Xt.length)||0})]}),p.jsxs("div",{className:"bg-purple-50 p-2 rounded text-center",children:[p.jsx("div",{className:"text-xs text-purple-600 font-medium",children:"Distance"}),p.jsxs("div",{className:"text-sm font-bold text-purple-900",children:[Math.round(((Yt=ni.gpsTrack)==null?void 0:Yt.totalDistance)||0)," ft"]})]}),p.jsxs("div",{className:"bg-orange-50 p-2 rounded text-center",children:[p.jsx("div",{className:"text-xs text-orange-600 font-medium",children:"Coverage"}),p.jsxs("div",{className:"text-sm font-bold text-orange-900",children:[Ei(hn,ni),"%"]})]})]})]}),p.jsx("button",{onClick:()=>Et(hn),className:"p-2 text-indigo-600 hover:text-indigo-800 hover:bg-indigo-50 rounded",title:"View details",children:p.jsx(zd,{className:"h-5 w-5"})})]})},`app-${hn.id}`)}const X=U.log,mt=Math.round((X.duration_seconds||X.durationSeconds||((Mt=X.gpsTrack)==null?void 0:Mt.duration)||((zt=X.gps_track)==null?void 0:zt.duration)||0)/60),st=Math.round((X.total_distance_meters||((he=X.gpsTrack)==null?void 0:he.totalDistance)||((kn=X.gps_track)==null?void 0:kn.totalDistance)||0)*3.28084||0);return p.jsx("div",{className:"bg-white p-6 rounded-lg shadow",children:p.jsxs("div",{className:"flex justify-between items-start",children:[p.jsxs("div",{className:"flex-1",children:[p.jsxs("div",{className:"flex items-center justify-between mb-4",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("h3",{className:"text-lg font-semibold text-gray-900",children:[X.property_name," - ",X.section_names]}),p.jsx("span",{className:"px-2 py-0.5 text-xs rounded-full bg-green-100 text-green-800",children:"Mowing"})]}),p.jsx("span",{className:"px-3 py-1 text-sm font-medium rounded-full bg-green-100 text-green-800",children:"Completed"})]}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-4",children:[p.jsxs("div",{className:"flex items-center text-sm text-gray-600",children:[p.jsx(Kx,{className:"h-4 w-4 mr-2"}),new Date(U.date).toLocaleString()]}),p.jsxs("div",{className:"flex items-center text-sm text-gray-600",children:[p.jsx(zc,{className:"h-4 w-4 mr-2"}),X.property_name]}),p.jsxs("div",{className:"flex items-center text-sm text-gray-600",children:[p.jsx(mu,{className:"h-4 w-4 mr-2"}),X.equipment_name||"Mower"]})]}),p.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 mb-4",children:[p.jsxs("div",{className:"bg-blue-50 p-2 rounded text-center",children:[p.jsx("div",{className:"text-xs text-blue-600 font-medium",children:"Duration"}),p.jsxs("div",{className:"text-sm font-bold text-blue-900",children:[mt," min"]})]}),p.jsxs("div",{className:"bg-green-50 p-2 rounded text-center",children:[p.jsx("div",{className:"text-xs text-green-600 font-medium",children:"GPS Points"}),p.jsx("div",{className:"text-sm font-bold text-green-900",children:((ts=(fn=X.gpsTrack)==null?void 0:fn.points)==null?void 0:ts.length)||((Ao=(Mo=X.gps_track)==null?void 0:Mo.points)==null?void 0:Ao.length)||0})]}),p.jsxs("div",{className:"bg-purple-50 p-2 rounded text-center",children:[p.jsx("div",{className:"text-xs text-purple-600 font-medium",children:"Distance"}),p.jsxs("div",{className:"text-sm font-bold text-purple-900",children:[st," ft"]})]}),p.jsxs("div",{className:"bg-orange-50 p-2 rounded text-center",children:[p.jsx("div",{className:"text-xs text-orange-600 font-medium",children:"Coverage"}),p.jsxs("div",{className:"text-sm font-bold text-orange-900",children:[It(X),"%"]})]})]})]}),p.jsx("button",{onClick:()=>ne(X),className:"p-2 text-indigo-600 hover:text-indigo-800 hover:bg-indigo-50 rounded",title:"View mowing session",children:p.jsx(zd,{className:"h-5 w-5"})})]})},`mow-${X.id}`)})})]}),wt&&p.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center",style:{zIndex:9999},children:p.jsxs("div",{className:"bg-white rounded-lg p-6 w-96 shadow-2xl",children:[p.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Name Your Lawn Section"}),p.jsxs("div",{className:"space-y-4",children:[p.jsx("input",{type:"text",className:"input",value:Ee,onChange:U=>Je(U.target.value),placeholder:"e.g., Front Yard, Back Lawn",autoFocus:!0}),p.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[p.jsx("div",{className:"w-4 h-4 rounded",style:{backgroundColor:jt==null?void 0:jt.color.value}}),p.jsxs("span",{children:[jt==null?void 0:jt.area.toLocaleString()," sq ft"]})]}),p.jsxs("div",{children:[p.jsx("label",{className:"label",children:"Adjust Position (1 ft)"}),p.jsxs("div",{className:"grid grid-cols-3 gap-2 w-40",children:[p.jsx("div",{}),p.jsx("button",{className:"btn-secondary",onClick:()=>{we(U=>{if(!U)return U;U.coordinates[0][0];const mt=1*.3048/111320,st=U.coordinates.map(([nt,St])=>[nt+mt,St]);return{...U,coordinates:st}})},children:"▲"}),p.jsx("div",{}),p.jsx("button",{className:"btn-secondary",onClick:()=>{we(U=>{if(!U)return U;const X=U.coordinates[0][0],mt=111320*Math.cos(X*Math.PI/180),st=1*.3048/mt,nt=U.coordinates.map(([St,Xt])=>[St,Xt-st]);return{...U,coordinates:nt}})},children:"◀"}),p.jsx("div",{}),p.jsx("button",{className:"btn-secondary",onClick:()=>{we(U=>{if(!U)return U;const X=U.coordinates[0][0],mt=111320*Math.cos(X*Math.PI/180),st=1*.3048/mt,nt=U.coordinates.map(([St,Xt])=>[St,Xt+st]);return{...U,coordinates:nt}})},children:"▶"}),p.jsx("div",{}),p.jsx("button",{className:"btn-secondary",onClick:()=>{we(U=>{if(!U)return U;const X=1*.3048/111320,mt=U.coordinates.map(([st,nt])=>[st-X,nt]);return{...U,coordinates:mt}})},children:"▼"}),p.jsx("div",{})]})]}),p.jsxs("div",{children:[p.jsx("label",{className:"label",children:"Grass Types"}),p.jsx(Kw,{value:De,onChange:jr}),p.jsx(Qw,{onPick:U=>jr(X=>X.includes(U)?X:[...X,U])})]})]}),p.jsxs("div",{className:"flex gap-3 mt-6",children:[p.jsx("button",{onClick:Yp,className:"btn-primary flex-1",children:"Save"}),p.jsx("button",{onClick:()=>{Gt(!1),we(null),Je(""),jr([])},className:"btn-secondary flex-1",children:"Cancel"})]})]})}),Ji&&p.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center",style:{zIndex:9999},children:p.jsxs("div",{className:"bg-white rounded-lg p-6 w-96 shadow-2xl",children:[p.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Edit Lawn Section"}),p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{children:[p.jsx("label",{className:"label",children:"Section Name"}),p.jsx("input",{type:"text",className:"input",value:Ee,onChange:U=>Je(U.target.value),placeholder:"e.g., Front Yard, Back Lawn",autoFocus:!0})]}),p.jsxs("div",{children:[p.jsx("label",{className:"label",children:"Color"}),p.jsx("div",{className:"grid grid-cols-3 gap-2",children:Ga.map(U=>p.jsx("button",{onClick:()=>_t(U),className:`w-10 h-10 rounded border-2 ${ht.value===U.value?"border-gray-900":"border-gray-300"}`,style:{backgroundColor:U.value},title:U.name},U.value))})]}),p.jsxs("div",{children:[p.jsx("label",{className:"label",children:"Grass Types"}),p.jsx(Kw,{value:cn,onChange:xi}),p.jsx(Qw,{onPick:U=>xi(X=>X.includes(U)?X:[...X,U])})]}),p.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[p.jsx("div",{className:"w-4 h-4 rounded",style:{backgroundColor:ht.value}}),p.jsxs("span",{children:[Nn==null?void 0:Nn.area.toLocaleString()," sq ft"]})]})]}),p.jsxs("div",{className:"flex gap-3 mt-6",children:[p.jsx("button",{onClick:Kp,className:"btn-primary flex-1",children:"Save Changes"}),p.jsx("button",{onClick:()=>{ar(!1),Ke(null),Je(""),xi([])},className:"btn-secondary flex-1",children:"Cancel"})]})]})}),ft&&p.jsx(_D,{application:ft,propertyDetails:n,onClose:()=>Et(null)}),Bt&&p.jsx(xD,{session:Bt,onClose:()=>ne(null)})]})},PD=()=>p.jsx("div",{className:"min-h-screen bg-white flex flex-col justify-center items-center px-4 sm:px-6 lg:px-8",children:p.jsxs("div",{className:"max-w-md w-full space-y-8 text-center",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-9xl font-bold text-primary-600",children:"404"}),p.jsx("h2",{className:"mt-6 text-3xl font-bold text-gray-900",children:"Page not found"}),p.jsx("p",{className:"mt-2 text-sm text-gray-600",children:"Sorry, we couldn't find the page you're looking for."})]}),p.jsxs("div",{className:"mt-8 space-y-4",children:[p.jsxs(tr,{to:"/dashboard",className:"btn-primary w-full justify-center",children:[p.jsx(qy,{className:"h-5 w-5 mr-2"}),"Go back home"]}),p.jsx(tr,{to:"/properties",className:"btn-outline w-full justify-center",children:"View Properties"})]}),p.jsx("div",{className:"mt-8",children:p.jsx("p",{className:"text-xs text-gray-500",children:"If you believe this is an error, please contact support."})})]})}),bD=()=>p.jsx("div",{className:"min-h-screen bg-white flex flex-col justify-center items-center px-4 sm:px-6 lg:px-8",children:p.jsxs("div",{className:"max-w-md w-full space-y-8 text-center",children:[p.jsxs("div",{children:[p.jsx("div",{className:"mx-auto h-24 w-24 bg-red-100 rounded-full flex items-center justify-center mb-6",children:p.jsx(IR,{className:"h-12 w-12 text-red-600"})}),p.jsx("h2",{className:"text-3xl font-bold text-gray-900",children:"Access Denied"}),p.jsx("p",{className:"mt-2 text-sm text-gray-600",children:"You don't have permission to access this page. Contact your administrator if you believe this is an error."})]}),p.jsxs("div",{className:"mt-8 space-y-4",children:[p.jsxs(tr,{to:"/dashboard",className:"btn-primary w-full justify-center",children:[p.jsx(qy,{className:"h-5 w-5 mr-2"}),"Go back home"]}),p.jsx(tr,{to:"/profile",className:"btn-outline w-full justify-center",children:"View Profile"})]}),p.jsx("div",{className:"mt-8",children:p.jsx("p",{className:"text-xs text-gray-500",children:"Need help? Contact support for assistance."})})]})}),LD=P.lazy(()=>Yn(()=>import("./Dashboard-DJdwRlmp.js"),[])),ID=P.lazy(()=>Yn(()=>import("./Properties-D9FZPvIV.js"),[])),TD=P.lazy(()=>Yn(()=>import("./Equipment-CTLZqt7C.js"),__vite__mapDeps([0,1]))),OD=P.lazy(()=>Yn(()=>import("./Products-BYbbRN4N.js"),__vite__mapDeps([2,1]))),RD=P.lazy(()=>Yn(()=>import("./Applications-Dk6lLrM6.js"),__vite__mapDeps([3,4]))),MD=P.lazy(()=>Yn(()=>import("./ApplicationPlan-SpihCSnJ.js"),[])),AD=P.lazy(()=>Yn(()=>import("./ApplicationLog-DQD7_Rzv.js"),[])),DD=P.lazy(()=>Yn(()=>import("./History-CLp9SoB2.js"),[])),kD=P.lazy(()=>Yn(()=>import("./Reports-Y1w9L7Me.js").then(e=>e.R),[])),FD=P.lazy(()=>Yn(()=>import("./Weather-BKVvxjXo.js"),[])),jD=P.lazy(()=>Yn(()=>import("./Mowing-B8nXiqFU.js"),__vite__mapDeps([5,4]))),zD=P.lazy(()=>Yn(()=>import("./Watering-LopRVs8A.js"),[])),BD=P.lazy(()=>Yn(()=>import("./Profile-1kT_Rbg4.js"),[])),UD=P.lazy(()=>Yn(()=>import("./AdminDashboard-ZjlQm83Z.js"),__vite__mapDeps([6,7]))),VD=P.lazy(()=>Yn(()=>import("./AdminUsers-DBAyiX-x.js"),__vite__mapDeps([8,1,7,9]))),GD=P.lazy(()=>Yn(()=>import("./AdminProducts-Dw06v4jS.js"),__vite__mapDeps([10,1,11,9]))),qD=P.lazy(()=>Yn(()=>import("./AdminEquipment-I7Ze0qiC.js"),__vite__mapDeps([12,1,11,9]))),HD=P.lazy(()=>Yn(()=>import("./AdminProperties-y-IOfczF.js"),[])),ZD=new w2({defaultOptions:{queries:{retry:(e,t)=>{var n,r;return((n=t==null?void 0:t.response)==null?void 0:n.status)===401||((r=t==null?void 0:t.response)==null?void 0:r.status)===403?!1:e<2},staleTime:0,cacheTime:60*1e3,refetchOnWindowFocus:!0,refetchOnReconnect:!0,refetchOnMount:"always"}}}),bn=({children:e,adminOnly:t=!1})=>{const{user:n,loading:r}=qu();return r?p.jsx("div",{className:"min-h-screen flex items-center justify-center",children:p.jsx(Hs,{size:"lg"})}):n?t&&n.role!=="admin"?p.jsx(uf,{to:"/unauthorized",replace:!0}):e:p.jsx(uf,{to:"/login",replace:!0})},Bh=({children:e})=>{const{user:t,loading:n}=qu();return n?p.jsx("div",{className:"min-h-screen flex items-center justify-center",children:p.jsx(Hs,{size:"lg"})}):t?p.jsx(uf,{to:"/dashboard",replace:!0}):e};function WD(){const e=p.jsx("div",{className:"min-h-screen flex items-center justify-center",children:p.jsx(Hs,{size:"lg"})});return p.jsx(P2,{client:ZD,children:p.jsx(eR,{children:p.jsx(JI,{children:p.jsxs("div",{className:"App",children:[p.jsx(P.Suspense,{fallback:e,children:p.jsxs(qI,{children:[p.jsx(me,{path:"/login",element:p.jsx(Bh,{children:p.jsx(Ah,{children:p.jsx(CM,{})})})}),p.jsx(me,{path:"/register",element:p.jsx(Bh,{children:p.jsx(Ah,{children:p.jsx(NM,{})})})}),p.jsx(me,{path:"/forgot-password",element:p.jsx(Bh,{children:p.jsx(Ah,{children:p.jsx(PM,{})})})}),p.jsx(me,{path:"/reset-password",element:p.jsx(Bh,{children:p.jsx(Ah,{children:p.jsx(bM,{})})})}),p.jsx(me,{path:"/dashboard",element:p.jsx(bn,{children:p.jsx(Pn,{children:p.jsx(LD,{})})})}),p.jsx(me,{path:"/properties",element:p.jsx(bn,{children:p.jsx(Pn,{children:p.jsx(ID,{})})})}),p.jsx(me,{path:"/properties/:id",element:p.jsx(bn,{children:p.jsx(Pn,{children:p.jsx(ND,{})})})}),p.jsx(me,{path:"/equipment",element:p.jsx(bn,{children:p.jsx(Pn,{children:p.jsx(TD,{})})})}),p.jsx(me,{path:"/products",element:p.jsx(bn,{children:p.jsx(Pn,{children:p.jsx(OD,{})})})}),p.jsx(me,{path:"/applications",element:p.jsx(bn,{children:p.jsx(Pn,{children:p.jsx(RD,{})})})}),p.jsx(me,{path:"/applications/plan",element:p.jsx(bn,{children:p.jsx(Pn,{children:p.jsx(MD,{})})})}),p.jsx(me,{path:"/applications/log",element:p.jsx(bn,{children:p.jsx(Pn,{children:p.jsx(AD,{})})})}),p.jsx(me,{path:"/history",element:p.jsx(bn,{children:p.jsx(Pn,{children:p.jsx(DD,{})})})}),p.jsx(me,{path:"/reports",element:p.jsx(bn,{children:p.jsx(Pn,{children:p.jsx(kD,{})})})}),p.jsx(me,{path:"/weather",element:p.jsx(bn,{children:p.jsx(Pn,{children:p.jsx(FD,{})})})}),p.jsx(me,{path:"/mowing",element:p.jsx(bn,{children:p.jsx(Pn,{children:p.jsx(jD,{})})})}),p.jsx(me,{path:"/watering",element:p.jsx(bn,{children:p.jsx(Pn,{children:p.jsx(zD,{})})})}),p.jsx(me,{path:"/profile",element:p.jsx(bn,{children:p.jsx(Pn,{children:p.jsx(BD,{})})})}),p.jsx(me,{path:"/admin",element:p.jsx(bn,{adminOnly:!0,children:p.jsx(Pn,{children:p.jsx(UD,{})})})}),p.jsx(me,{path:"/admin/users",element:p.jsx(bn,{adminOnly:!0,children:p.jsx(Pn,{children:p.jsx(VD,{})})})}),p.jsx(me,{path:"/admin/products",element:p.jsx(bn,{adminOnly:!0,children:p.jsx(Pn,{children:p.jsx(GD,{})})})}),p.jsx(me,{path:"/admin/equipment",element:p.jsx(bn,{adminOnly:!0,children:p.jsx(Pn,{children:p.jsx(qD,{})})})}),p.jsx(me,{path:"/admin/properties",element:p.jsx(bn,{adminOnly:!0,children:p.jsx(Pn,{children:p.jsx(HD,{})})})}),p.jsx(me,{path:"/unauthorized",element:p.jsx(bD,{})}),p.jsx(me,{path:"/404",element:p.jsx(PD,{})}),p.jsx(me,{path:"/",element:p.jsx(uf,{to:"/dashboard",replace:!0})}),p.jsx(me,{path:"*",element:p.jsx(uf,{to:"/404",replace:!0})})]})}),p.jsx(pT,{position:"top-right",toastOptions:{duration:4e3,style:{background:"#fff",color:"#374151",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",borderRadius:"0.5rem",border:"1px solid #e5e7eb"},success:{iconTheme:{primary:"#10b981",secondary:"#fff"}},error:{iconTheme:{primary:"#ef4444",secondary:"#fff"}}}})]})})})})}const XD=dm.createRoot(document.getElementById("root"));XD.render(p.jsx(ye.StrictMode,{children:p.jsx(WD,{})}));const Jw=document.getElementById("loading-indicator");Jw&&setTimeout(()=>{Jw.style.display="none"},500);export{Qy as $,_k as A,NN as B,Hy as C,ba as D,La as E,Jx as F,_D as G,pR as H,Kx as I,xD as J,wk as K,Hs as L,LC as M,uf as N,oC as O,Sv as P,UM as Q,ye as R,lD as S,IC as T,Ap as U,cD as V,fD as W,MC as X,PC as Y,Ff as Z,Yn as _,fR as a,xk as a0,Vd as a1,sd as a2,$y as a3,Ek as a4,YD as a5,$w as a6,EP as a7,mu as b,yv as c,uC as d,tr as e,bR as f,Qx as g,gk as h,jc as i,p as j,bC as k,$a as l,aC as m,Fr as n,zc as o,Za as p,NR as q,P as r,MR as s,mk as t,qu as u,zd as v,KO as w,vk as x,yk as y,re as z};